{% extends 'settings/layout.html.twig' %}
{% block title %}{{'实名认证'|trans}} - {{ parent() }}{% endblock %}
{% set side_nav = 'approval' %}
{% if app.user.approvalStatus not in ['approving', 'approved'] %}
	{% do script(['libs/jquery-validation.js', 'app/js/settings/approval/index.js']) %}
{% endif %}

{% block main %}

    {% embed "bootstrap/panel.html.twig" with {class:'panel-col'} %}

        {% block heading %}
          {{'实名认证'|trans}}
        {% endblock %}

        {% block body %}

            {% if app.user.approvalStatus in ['approved', 'unapprove', 'approve_fail','approving'] %}
                    <form id="approval-form" class="form-horizontal" method="post" enctype="multipart/form-data">

                        {{ web_macro.flash_messages() }}
                            <div class="help-block approval">
                                <label class="col-md-2 control-label" ></label>
                                {% if app.user.approvalStatus == 'approving' %}
                                    <div class="alert alert-info" role="alert">{{'正在实名认证中，管理员会尽快答复您。'|trans}}
                                    </div>
                                {% elseif  app.user.approvalStatus == 'approved' %}
                                    <div class="alert alert-success" role="alert">{{'恭喜您，已通过实名认证！'|trans}}
                                    </div>
                                {% elseif  app.user.approvalStatus == 'unapprove' %}
                                    <div class="alert alert-warning" role="alert">{{'您尚未实名认证。'|trans}}
                                    </div>
                                {% elseif app.user.approvalStatus == 'approve_fail' %}
                                    <div class="alert alert-info" role="alert">
                                        {{'实名认证审核尚未通过，请参照通知中的信息，修改后重新认证。'|trans}}
                                    </div>
                                {% endif %}
                            </div>

                        {% if app.user.approvalStatus != 'approving' %}

                            <div class="form-group">
                                <div class="col-md-2 control-label">
                                    <label for="truename">{{'真实姓名'|trans}}</label>
                                </div>
                                <div class="col-md-8 controls">
                                    {% if  app.user.approvalStatus in ['approved']  %}
                                         <input disabled="true" type="text" id="truename" name="truename" class="form-control" value="{{profile.truename}}"  disabled="">
                                    {% else %}
                                         <input type="text" id="truename" name="truename" class="form-control" value="" >
                                    {% endif %}
                                </div>
                            </div>

                            <div class="form-group">
                            <div class="col-md-2 control-label">
                                <label for="idcard">{{'身份证号'|trans}}</label>
                            </div>
                            <div class="col-md-8 controls">
                                {% if  app.user.approvalStatus in ['approved']  %}
                                    <input type="text" id="idcard" name="idcard" class="form-control" value="{{profile.idcard}}"disabled="true">
                                {% else %}
                                    <input type="text" id="idcard" name="idcard" class="form-control" value="">
                                {% endif %}
                            </div>
                            </div>
                            {% if app.user.approvalStatus != 'approved' %}
                            <div class="form-group">
                                <div class="col-md-2 control-label">
                                        <label>{{'照片要求'|trans}}</label>
                                </div>
                                <div class="col-md-8 form-control-static">
                                    {{'<p class="color-warning">证件必须是清晰彩色原件电子版，可以是扫描或者数码相机拍摄照片。<br />图片格式支持jpg、gif、png，每张图片文件大小不能超过2M。</p>'|trans|raw}}
                                </div>
                            </div>

                            <div class="form-group">
                                <div class="col-md-2 control-label">
                                    <label for="faceImg">{{'身份证正面照'|trans}}</label>
                                </div>
                                <div class="col-md-8 form-control-static">
                                    {% if  app.user.approvalStatus in ['approving' , 'approved']  %}
                                        <input type="file" id="faceImg" name="faceImg" accept="image/bmp,image/jpeg,image/png" disabled="true">
                                    {% else %}
                                        <input type="file" id="faceImg" name="faceImg" accept="image/bmp,image/jpeg,image/png" >
                                    {% endif %}
                                </div>
                            </div>

                             <div class="form-group">
                                <div class="col-md-2 control-label">
                                    <label for="backImg">{{'身份证反面照'|trans}}</label>
                                </div>
                                <div class="col-md-8 form-control-static">
                                    {% if  app.user.approvalStatus in ['approving' , 'approved']  %}
                                        <input type="file" id="backImg" name="backImg" accept="image/bmp,image/jpeg,image/png" disabled="true">
                                    {% else %}
                                        <input type="file" id="backImg" name="backImg" accept="image/bmp,image/jpeg,image/png">
                                    {% endif %}
                                </div>
                            </div>

                            <div class="row">
                                <div class="col-md-7 col-md-offset-2">
                                    {% if  app.user.approvalStatus in ['approving' , 'approved']  %}
                                        <button type="submit" class="btn btn-primary" disabled="true">{{'已提交'|trans}}</button>
                                    {% else %}
                                        <button type="submit" class="btn btn-primary">{{'提交'|trans}}</button>
                                    {% endif %}
                                </div>
                            </div>

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

                    {% endif %}

                 {% endif %}

            {% endif %}

        {% endblock %}

    {% endembed %}

{% endblock %}