<?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;

/* member/member_reward_form.twig */
class __TwigTemplate_24b8729949b0aee187db9c7e734293f0eca129a981fe4d0005a0f02ce2a07aa9 extends \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 ($context["header"] ?? null);
        echo ($context["column_left"] ?? null);
        echo "
<div id=\"content\">
  <div class=\"page-header\">
    <div class=\"container-fluid\">
      <div class=\"pull-right\">
        <button type=\"submit\" form=\"form-reward\" data-toggle=\"tooltip\" title=\"";
        // line 6
        echo ($context["button_save"] ?? null);
        echo "\" class=\"btn btn-primary\"><i class=\"fa fa-save\"></i></button>
        <a href=\"";
        // line 7
        echo ($context["cancel"] ?? null);
        echo "\" data-toggle=\"tooltip\" title=\"";
        echo ($context["button_cancel"] ?? null);
        echo "\" class=\"btn btn-default\"><i class=\"fa fa-reply\"></i></a></div>
      <h1>";
        // line 8
        echo ($context["heading_title"] ?? null);
        echo "</h1>
      <ul class=\"breadcrumb\">
        ";
        // line 10
        $context['_parent'] = $context;
        $context['_seq'] = twig_ensure_traversable(($context["breadcrumbs"] ?? null));
        foreach ($context['_seq'] as $context["_key"] => $context["breadcrumb"]) {
            // line 11
            echo "        <li><a href=\"";
            echo twig_get_attribute($this->env, $this->source, $context["breadcrumb"], "href", [], "any", false, false, false, 11);
            echo "\">";
            echo twig_get_attribute($this->env, $this->source, $context["breadcrumb"], "text", [], "any", false, false, false, 11);
            echo "</a></li>
        ";
        }
        $_parent = $context['_parent'];
        unset($context['_seq'], $context['_iterated'], $context['_key'], $context['breadcrumb'], $context['_parent'], $context['loop']);
        $context = array_intersect_key($context, $_parent) + $_parent;
        // line 13
        echo "      </ul>
    </div>
  </div>
  <div class=\"container-fluid\">
    ";
        // line 17
        if (($context["error_warning"] ?? null)) {
            // line 18
            echo "    <div class=\"alert alert-danger alert-dismissible\"><i class=\"fa fa-exclamation-circle\"></i> ";
            echo ($context["error_warning"] ?? null);
            echo "
      <button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>
    </div>
    ";
        }
        // line 22
        echo "    <div class=\"panel panel-default\">
      <div class=\"panel-heading\">
        <h3 class=\"panel-title\"><i class=\"fa fa-pencil\"></i> ";
        // line 24
        echo ($context["text_form"] ?? null);
        echo "</h3>
      </div>
      <div class=\"panel-body\">
        <form action=\"";
        // line 27
        echo ($context["action"] ?? null);
        echo "\" method=\"post\" enctype=\"multipart/form-data\" id=\"form-member-reward\" class=\"form-horizontal\">
        <fieldset>
           <legend>Member Info</legend>
           <div class=\"form-group\">
               <label class=\"col-sm-2 control-label\">";
        // line 31
        echo ($context["entry_phone_no"] ?? null);
        echo ":</label>
               <div class=\"col-sm-10\">
                  <label>";
        // line 33
        echo ($context["phone_no"] ?? null);
        echo " </label>  
               </div>
           </div>
           <div class=\"form-group\">
               <label class=\"col-sm-2 control-label\">";
        // line 37
        echo ($context["entry_email"] ?? null);
        echo ":</label>
               <div class=\"col-sm-10\">
                  <label>";
        // line 39
        echo ($context["email"] ?? null);
        echo " </label>
               </div>
           </div>
           <div class=\"form-group\">
              <label class=\"col-sm-2 control-label\">";
        // line 43
        echo ($context["entry_tier_level"] ?? null);
        echo ":</label>
              <div class=\"col-sm-10\">
              <label>  ";
        // line 45
        echo ($context["tier_level"] ?? null);
        echo " </label>
              </div>
            </div>
        </fieldset>
        <fieldset>
           <legend>Reward Info</legend>
            <div class=\"form-group\">
              <label class=\"col-sm-2 control-label\">";
        // line 52
        echo ($context["entry_reward"] ?? null);
        echo "</label>
              <div class=\"col-sm-10\">
                  <label>";
        // line 54
        echo twig_get_attribute($this->env, $this->source, ($context["reward"] ?? null), "title", [], "any", false, false, false, 54);
        echo " </label>  
              </div>
            </div>
            <div class=\"form-group\">
               <label class=\"col-sm-2 control-label\">";
        // line 58
        echo ($context["entry_used_point"] ?? null);
        echo ":</label>
                <div class=\"col-sm-10\">
                      <label>";
        // line 60
        echo twig_get_attribute($this->env, $this->source, ($context["reward"] ?? null), "used_point", [], "any", false, false, false, 60);
        echo " </label>  
                </div>
            </div>    
            <div class=\"form-group\">
                <label class=\"col-sm-2 control-label\">";
        // line 64
        echo ($context["entry_value"] ?? null);
        echo ":</label>
                <div class=\"col-sm-10\">
                    <label>";
        // line 66
        echo twig_get_attribute($this->env, $this->source, ($context["reward"] ?? null), "value", [], "any", false, false, false, 66);
        echo " </label>  
                </div>
            </div>            
            <div class=\"form-group required\">
            <label class=\"col-sm-2 control-label\" for=\"input-expiry_date\">";
        // line 70
        echo ($context["entry_expiry_date"] ?? null);
        echo "</label>
            <div class=\"col-sm-3\">
              <div class=\"input-group date\">
                <input type=\"text\" name=\"expiry_date\" value=\"";
        // line 73
        echo ($context["expiry_date"] ?? null);
        echo "\" placeholder=\"";
        echo ($context["entry_expiry_date"] ?? null);
        echo "\" data-date-format=\"YYYY-MM-DD\" id=\"input-expiry_date\" class=\"form-control\" />
                <span class=\"input-group-btn\">
                <button type=\"button\" class=\"btn btn-default\"><i class=\"fa fa-calendar\"></i></button>
                </span></div>
                ";
        // line 77
        if (($context["error_expiry_date"] ?? null)) {
            // line 78
            echo "                <div class=\"text-danger\">";
            echo ($context["error_expiry_date"] ?? null);
            echo "</div>
                ";
        }
        // line 80
        echo "              </div>
          </div>
          <div class=\"form-group required\">
            <label class=\"col-sm-2 control-label\" for=\"input-redeemed\">";
        // line 83
        echo ($context["entry_redeemed"] ?? null);
        echo "</label>
            <div class=\"col-sm-10\">
              <select name=\"is_redeemed\" id=\"input-redeemed\" class=\"form-control\">
                ";
        // line 86
        if (twig_get_attribute($this->env, $this->source, ($context["reward"] ?? null), "is_redeemed", [], "any", false, false, false, 86)) {
            // line 87
            echo "                <option value=\"0\">";
            echo ($context["text_no"] ?? null);
            echo "</option>
                <option value=\"1\" selected=\"selected\">";
            // line 88
            echo ($context["text_yes"] ?? null);
            echo "</option>
                ";
        } else {
            // line 90
            echo "                <option value=\"0\" selected=\"selected\">";
            echo ($context["text_no"] ?? null);
            echo "</option>
                <option value=\"1\">";
            // line 91
            echo ($context["text_yes"] ?? null);
            echo "</option>
                ";
        }
        // line 93
        echo "              </select>
            </div>
          </div>
          <div class=\"form-group required\">
            <label class=\"col-sm-2 control-label\" for=\"input-cancelled\">";
        // line 97
        echo ($context["entry_cancelled"] ?? null);
        echo "</label>
            <div class=\"col-sm-10\">
              <select name=\"is_cancelled\" id=\"input-cancelled\" class=\"form-control\">
                ";
        // line 100
        if (twig_get_attribute($this->env, $this->source, ($context["reward"] ?? null), "is_cancelled", [], "any", false, false, false, 100)) {
            // line 101
            echo "                <option value=\"0\">";
            echo ($context["text_no"] ?? null);
            echo "</option>
                <option value=\"1\" selected=\"selected\">";
            // line 102
            echo ($context["text_yes"] ?? null);
            echo "</option>
                ";
        } else {
            // line 104
            echo "                <option value=\"0\" selected=\"selected\">";
            echo ($context["text_no"] ?? null);
            echo "</option>
                <option value=\"1\">";
            // line 105
            echo ($context["text_yes"] ?? null);
            echo "</option>
                ";
        }
        // line 107
        echo "              </select>
            </div>
          </div>
          </fieldset>
        </form>
      </div>
    </div>
  </div>
<style type=\"text/css\">
label{
    display: block;
    width: 100%;
    height: 36px;
    padding: 8px 13px;
    font-size: 13px;
    color: #555;
}
</style>
<script type=\"text/javascript\">
\$('.date').datetimepicker({
\tlanguage: '";
        // line 127
        echo ($context["datepicker"] ?? null);
        echo "',
\tpickTime: false
});

 \$('#input-reward_setting_id').on('change', function() {
    var value = \$('#input-reward_setting_id').val();
      \$.ajax({
      url: 'index.php?route=member/member/reward&user_token=";
        // line 134
        echo ($context["user_token"] ?? null);
        echo "&reward_setting_id=' + this.value,
      dataType: 'json',
      beforeSend: function() {
        \$('#input-reward_setting_id').after('<i class=\"fa fa-circle-o-notch fa-spin\"></i>');
      },
      complete: function() {
        \$('.fa-spin').remove();
      },
      success: function(json) {
          \$('#lblUsedPoint').html(json['point']);
          \$('#lblValue').html(json['value']);
          var newDate = addDaysToCurrentDate (json['expiry']);
          \$('#lblExpiredDate').html(newDate);
      },
      error: function(xhr, ajaxOptions, thrownError) {
        alert(thrownError + \"\\r\\n\" + xhr.statusText + \"\\r\\n\" + xhr.responseText);
      }
\t    });
 });

\$('#input-reward_setting_id').trigger('change');

  function addDaysToCurrentDate(daysToAdd) {
    const currentDate = new Date();
    const newDate = new Date(currentDate.getTime() + (daysToAdd * 24 * 60 * 60 * 1000));
    return newDate.toLocaleDateString();
  }
</script>

</div>
";
        // line 164
        echo ($context["footer"] ?? null);
        echo " ";
    }

    public function getTemplateName()
    {
        return "member/member_reward_form.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  339 => 164,  306 => 134,  296 => 127,  274 => 107,  269 => 105,  264 => 104,  259 => 102,  254 => 101,  252 => 100,  246 => 97,  240 => 93,  235 => 91,  230 => 90,  225 => 88,  220 => 87,  218 => 86,  212 => 83,  207 => 80,  201 => 78,  199 => 77,  190 => 73,  184 => 70,  177 => 66,  172 => 64,  165 => 60,  160 => 58,  153 => 54,  148 => 52,  138 => 45,  133 => 43,  126 => 39,  121 => 37,  114 => 33,  109 => 31,  102 => 27,  96 => 24,  92 => 22,  84 => 18,  82 => 17,  76 => 13,  65 => 11,  61 => 10,  56 => 8,  50 => 7,  46 => 6,  37 => 1,);
    }

    public function getSourceContext()
    {
        return new Source("", "member/member_reward_form.twig", "");
    }
}
