{% extends 'TopxiaWebBundle::layout.html.twig' %}

{% block title %} 订单确认 - {{ parent() }}{% endblock %}

{% set script_controller = 'order/create' %}

{% block content %}

<div class="order-pay">
  <div class="row">
    <div class="col-md-10 col-md-offset-1 ptl">
      <div class="panel panel-default">
        <div class="panel-heading"><h4>订单确认</h4></div>
        <div class="panel-body order-panel">
          <form id="order-create-form" method="post" action="{{path('order_create')}}">

            <input type="password" style="display:none">

          	{% if order|default(null) %}
            <input type="hidden" name="orderId" value="{{order.id}}"/>
            {% endif %}
            
          	<input type="hidden" role="cash-rate" value="{{cashRate|default(null)}}"
            data-price-type = "{{priceType|default('RMB')}}"/>

            <input type="hidden" name="targetType" value="{{targetType}}"/>
            <input type="hidden" name="targetId" value="{{targetId}}"/>
            
            <input type="hidden" name="totalPrice" value="{{totalPrice}}"/>
            <input type="hidden" name="shouldPayMoney" value=""/>

            <input type="hidden" name="sms_code" value=""/>
            <input type="hidden" name="mobile" data-role="mobile" value="{{ verifiedMobile }}"/>

            <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">

            <div class="order-detail-bg">
            {% if targetType == "course" and courses|default(null) %}
              {% include 'TopxiaWebBundle:Order:order-course.html.twig' %}
            {% endif %}

            {% if targetType == "vip" %}
              {% include 'TopxiaWebBundle:Order:vip.html.twig' %}
            {% endif %}

            {% if targetType == "classroom" and is_plugin_installed("Classroom") %}
              {% include 'TopxiaWebBundle:Order:classroom.html.twig' %}
            {% endif %}

              <div class="order-item clearfix" >
                <div class="pull-right order-count">
                  订单金额：
                  <span role="total-price" class="order-price">{{totalPrice}}</span>
                  {% if priceType|default('RMB') == "RMB" %}
                    元
                  {% elseif priceType|default('RMB') == "Coin" %}
                    {{setting("coin.coin_name")}}
                  {% endif %}
                </div>
              </div>
            </div>
            <div class="order-detail-bg">
            {% if is_plugin_installed("Coupon") and setting('coupon.enabled') and (targetType in ['course','vip','classroom']) and showCoupon|default(false) %}
            	{% include 'TopxiaWebBundle:Order:order-item-coupon.html.twig' %}
            {% endif %}

            {% if is_plugin_installed("Coupon") and setting('coupon.enabled') and (targetType in ['course','vip','classroom']) and showCoupon|default(false) and setting('coin.coin_enabled') %}
            <div class="order-item-clear"></div>
            {% endif %}

            {% if setting('coin.coin_enabled') %}
            	{% include 'TopxiaWebBundle:Order:order-item-coin.html.twig' %}
            {% endif %}
            </div>

            <div class="order-item clearfix">
              <div class="total-price">
                应付金额：
                {% if priceType|default('RMB') == "Coin" %}
                  <span role="pay-coin">0</span> {{setting("coin.coin_name")}} ÷ 汇率({{cashRate|default(1)}}) = <span role="pay-rmb" class="pay-rmb"></span> 元
                {% else %}
                  <span role="pay-rmb" class="pay-rmb"></span> 元
                {% endif %}
              </div>
              
            </div>

            <div class="form-group pay">
              <div class="pull-right controls">
                {% if ((setting('cloud_sms.sms_enabled')|default('')) == '1') and ((setting('cloud_sms.sms_user_pay')|default('')) == 'on') %} 
                  <a class="btn btn-fat btn-primary" id="js-order-create-sms-btn" data-toggle="modal" data-target="#modal" data-url="{{path('order_pay_sms_verification')}}" >提交订单</a>
                {% else %}
                  <button class="btn btn-fat btn-primary" id="order-create-btn" type="submit">提交订单</button>          
                {% endif %} 
              </div>
            </div>

          </form>
        </div>
      </div>
    </div>
  </div>
</div>
{% endblock %}