{% extends 'bootstrap-modal-layout.html.twig' %}
{% block title %}{{'退出学习'|trans}}{% endblock %}
{% do script(['app/js/order-refund/order-refund-modal/index.js'])%}

{% block body %}
  <form id="refund-form" class="form-horizontal" method="post" action="{{ path('order_refund', {id:target.id, targetType:targetType}) }}" data-goto="{{ path(targetType ~ '_show', {id:target.id}) }}">
    <div class="form-group">
      <div class="col-md-3 control-label">{{'退学原因'|trans}}</div>
      <div class="col-md-8 controls">

        <select class="form-control" name="reason[type]">
          {% set defaultFields = dict('refund_reason') %}
          {{ dict_select_options('refund_reason') }}
        </select>
        <textarea class="form-control" name="reason[note]" placeholder="{{'请输入您的退学原因'|trans}}" style="margin-top:10px;display:none;"></textarea>
        <span class='color-danger warnning'></span>
      </div>
    </div>
    {% if order.payment != 'coin' and maxRefundDays > 0 and (order.amount * 100) > 0 %}
      <div class="form-group">
        <div class="col-md-8 col-md-offset-3">
          <div class="checkbox">
            <label><input type="checkbox" name="applyRefund" value="1"{% if maxRefundDays > 0 and refundOverdue %}disabled{% endif %}> {{'申请退款'|trans}} <span class="color-gray text-sm">{{'（购买时的价格：%amount%元）'|trans({'%amount%':order.amount})}}</span></label>
          </div>
          {% if maxRefundDays > 0 and refundOverdue %}
            <div class="alert alert-warning">{{'已经超出了退款期限%maxRefundDays%天，不能申请退款。'|trans({'%maxRefundDays%':maxRefundDays})}}</div>
          {% endif %}
        </div>
      </div>
    {% endif %}
    <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">
  </form>
{% endblock %}

{% block footer %}
  <button class="btn btn-danger refund-btn" type="submit" data-toggle="form-submit" data-target="#refund-form" data-loading-text="{{'正在退出'|trans}}...">{{'退出学习'|trans}}</button>
{% endblock %}