
 <script src="/static/js/jqueryrotate-master/jQueryRotate.js"></script>


<script type="text/javascript">    
    $(document).ready(function(){   
        var dlgId='#custom-url-modal';
        $(dlgId+' .btn-approve,'+dlgId+' .btn-reject,'+dlgId+' .btn-scrap')
                .unbind('click').bind('click',function(){  
            var btn_ids=$(this).attr('class').split(' ');
            var action='';
            var msg='';
            if(btn_ids.indexOf("btn-scrap")>-1){
                action='scrap';
                msg='申请已作废';
            }else{
                if(btn_ids.indexOf("btn-reject")>-1){
                    action='reject';
                    msg="申请已驳回";
                }else{
                    action='approve';
                    msg="申请已通过申核";
                }
            };
            var app_id=$(dlgId+' .app_id').val();
            $(dlgId).modal('hide');
            $.ajax({
                type:'POST',
                url:'{{request.path}}',
                dataType:'json',
                data:{"id":app_id,"action":action},
                success: function(data) {  
                    if(data.e!=''){
                        toastr.error(data.e); 
                    }else{                        
                        toastr.success(msg);
                        $('#tb_application tbody a[app_id="'+app_id+'"]').closest('tr').find('td:nth-child(10)').text(data.status);                        
                    };
                },
                beforeSend: function (xhr, settings) {                    
                        xhr.setRequestHeader("X-CSRFToken", '{{csrf_token}}');                    
                },
                error: function(XMLHttpRequest, textStatus, errorThrown) {
                    alert('连接服务器失败');
                    return;
                }  
            });
        });


        $('#bg-modal').on('click','.btn-rotate-right',function(){
            var p=$(this).closest('div'); 
            $(p).find('.img-invoice').rotate(90);
        });
        $('#bg-modal').on('click','.btn-rotate-left',function(){
            var p=$(this).closest('div'); 
            $(p).find('.img-invoice').rotate(-90);
        });
    });
</script>




<div class="row">
    <input class='app_id' type='hidden' value='{{id}}' />
    <div style="display: flex;padding: 1rem;font-size: 1.4rem;border-bottom: 1px solid #d5d5d5;">
        {% ifequal payment_method 1 %}
            <div>
                收款人实名: <b>{{payee_name}}</b> 
            </div>
            <div style="margin-left:1.5rem;">
                金额: ￥ <b>{{amount}}</b> 
            </div>
            <div style="margin-left:2rem;">
                申请人微信: <img src="{{wx_headimgurl}}" style="width:25px;height:25px;" />
            </div>
            <div style="margin-left:0.5rem;">
                <b>{{wx_nickname}}</b>
            </div>
        {% else %}
            <div>
                收款行: <b>{{bank_name}}</b> 
            </div>
            <div style="margin-left:1.5rem;">
                帐号: <b>{{bank_account}}</b>
            </div>
            <div style="margin-left:2rem;">
                收款人: <b>{{payee}}</b>
            </div>
            <div style="margin-left:0.5rem;">            
                金额：￥ <b>{{amount}}</b> 
            </div>
        {% endifequal %}
        <div style="margin-left:1.5rem;">
            发票图片张数: {{images | length}}
        </div>
    </div>
    <div>
        {% for img in images %}
            {% ifequal images|length 1 %}
                <div class="col-xs-12">
            {% else %}
                <div class="col-xs-6">
            {% endifequal %}
                <p class="lead" style='font-size: 1.4rem;margin-top:10px;margin-bottom:0px;'>
                    <span>上传账号: <b>{{img.user_name}}</b></span>
                    <span style='margin-left: 2rem;'>上传时间: <b>{{img.time}}</b></span>
                    <button class='btn btn-primary btn-xs btn-rotate-right'>右转</button>
                    <button class='btn btn-primary btn-xs btn-rotate-left'>左转</button>
                </p>
                <div style='overflow:auto;max-height:650px;'>                    
                    <img  class='img-invoice' src="{{img.image}}">
                </div>
            </div>
        {% endfor %}
    </div>

</div>
