<?php

use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Extension\SandboxExtension;
use Twig\Markup;
use Twig\Sandbox\SecurityError;
use Twig\Sandbox\SecurityNotAllowedTagError;
use Twig\Sandbox\SecurityNotAllowedFilterError;
use Twig\Sandbox\SecurityNotAllowedFunctionError;
use Twig\Source;
use Twig\Template;

/* @Atobaraidotcom4/admin/order_index.twig */
class __TwigTemplate_16b0068363fc43dbd02ca085260c6fbec2115f9170c5dd6b68400225420c830d extends \Eccube\Twig\Template
{
    private $source;
    private $macros = [];

    public function __construct(Environment $env)
    {
        parent::__construct($env);

        $this->source = $this->getSourceContext();

        $this->parent = false;

        $this->blocks = [
        ];
    }

    protected function doDisplay(array $context, array $blocks = [])
    {
        $macros = $this->macros;
        // line 1
        echo "<script>
    \$(function () {

        // 送り状番号
        var updateTrackingNumber_atobarai = function(id, url, tracking_number, callback) {
            \$.ajax({
                type: 'POST',
                url: url,
                data: { 'tracking_number': tracking_number,
                        'id': id}
            }).done(function(data, textStatus, jqXHR) {
                if (data['status'] == 'OK') {
                    //\$('#tracking_number_' + id).val(data['tracking_number']);
                    //if (typeof callback == 'function') {
                    //    callback();
                    //}
                } else {
                    alert('Update failed.');
                }
                return true;
            }).fail(function(jqXHR, textStatus, errorThrown) {
                return false;
            });
        };
        \$('button.update_tracking_number').on('click', function(event) {
            event.preventDefault();
            var \$button = \$(this);
            var \$target = \$(\$(this).data('target'));
            var tracking_number = \$target.val();
            var callback = function() {
            //    \$button.prop('disabled', true);
            //    \$button.children('i')
            //        .removeClass('text-success')
            //        .addClass('text-secondary');
            };

            updateTrackingNumber_atobarai(\$target.data('shipping_id'), \"";
        // line 37
        echo $this->extensions['Eccube\Twig\Extension\IgnoreRoutingNotFoundExtension']->getUrl("atobaraidotcom4_admin_order_update_tracking");
        echo "\", tracking_number, callback);
        });
        // enter キーで更新し、次のフォームへフォーカスを移動する
        \$('input.update_tracking_number').on('keypress', function(event) {
            var \$tracking_number = \$(this);
            var \$button = \$(\"button[data-target='#\" + \$tracking_number.attr('id') + \"']\");

            var code = event.which ? event.which : event.keyCode;

            if (code == 13) { // on press to enter
                //var index = \$('input.update_tracking_number').index(this);
                var callback = function() {
                //   \$button.prop('disabled', true);
                //    \$button.children('i')
                //        .removeClass('text-success')
                //        .addClass('text-secondary');
                //    \$('input.update_tracking_number:gt(' + index + '):first').focus();
                };
                updateTrackingNumber_atobarai(\$tracking_number.data('shipping_id'), \"";
        // line 55
        echo $this->extensions['Eccube\Twig\Extension\IgnoreRoutingNotFoundExtension']->getUrl("atobaraidotcom4_admin_order_update_tracking");
        echo "\", \$tracking_number.val(), callback);
                event.preventDefault();
            }
        });
    });
</script>

";
    }

    public function getTemplateName()
    {
        return "@Atobaraidotcom4/admin/order_index.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  96 => 55,  75 => 37,  37 => 1,);
    }

    public function getSourceContext()
    {
        return new Source("", "@Atobaraidotcom4/admin/order_index.twig", "/home/probiotech2/www/mamebio/app/Plugin/Atobaraidotcom4/Resource/template/admin/order_index.twig");
    }
}
