<ion-view view-title="报销单详情">
    <ion-content>
        <div ng-if="loading" class="center init-load action-sheet-backdrop">
            <ion-spinner icon="android"></ion-spinner>
        </div>
        <div ng-if="!loading">
            <ion-item class="mission-header item item-avatar " type="item-text-wrap">
                <img ng-src="../../../img/panda.png" style="">
                <span class="item-note">{{bill.create_date | date:'MM-dd'}}</span>
                <h2>{{bill.create_user.username}}</h2>
                <p>{{bill.create_user.degree}}</p>
            </ion-item>
            <div class="item item-text-wrap bill-details-item">
                {{bill.title}}
                <p> 报销金额：
                    <label for="" class="energized">{{bill.total_amount}}元 </label>
                </p>
                <p> 备注：
                    <label for="" class="dark">{{bill.note}}</label>
                </p>
                <!--<p style="float:right">报销单号：{{bill.billno}}</p>-->
            </div>
            <div class="item item-divider"></div>
            <ion-item class="item auditemp-box">
                消费详情
                <label for="" class="edit-text-label positive">{{bill.record.length}}笔消费</label>
                <div class="item item-text-wrap bill-record-box">
                    <div class="item item-icon-left" ng-repeat="rd in bill.record">
                        <i class="icon icon-style {{rd.type_modal.icon}}" style="background-color:{{rd.type_modal.icon_color}}"></i>{{rd.type_modal.name}}
                        <span class="item-note ">￥{{rd.amount}}</span>
                        <p>{{rd.spend_date | date:'yyyy-MM-dd'}}</p>
                        <p>{{rd.description}}</p>
                        <!-- <hr> -->
                    </div>
                </div>
                <!--<div class="bill-grant">-->
                    <!--<p><i class="ion-android-add"></i>&nbsp;补助-->
                        <!--<la bel class="assertive">￥ {{bill.grant}}</label>-->
                    <!--</p>-->
                <!--</div>-->
            </ion-item>
            <div class="item item-divider"></div>
            <ion-item class="item">审批信息
                <span ng-if="bill.status == 1" class="item-note energized">未支付</span>
            </ion-item>
            <section id="cd-timeline" class="cd-container">
                <div ng-repeat="hs in billhistorydata">
                    <div class="cd-timeline-block">
                        <div class="cd-timeline-picture">
                            <img ng-src={{hs.profilePicture}} />
                        </div>
                        <!-- cd-timeline-img -->
                        <div class="cd-timeline-content">
                            <h5 class="marginBottom0 marginTop0">
                                <i class="{{hs.icon}}"></i>
                                <span ng-class="{true:'task-create-member-p'}[$index == 0 && !bill.verifier.is_teller]">{{hs.title}}</span>
                                <label class="cd-author">{{hs.date | date: "yyyy年MM月dd日 HH:mm"}}</label>
                            </h5>
                            <p class="timelineText">{{hs.text}}</p>
                        </div>
                    </div>
                </div>
            </section>
            <button ng-if="user == bill.create_user.id && bill.status == 0 || bill.history.length == 0" class="button button-full button-assertive" ng-click="deleteBill()">撤销</button>
        </div>
        <ion-item ng-if="user == bill.verifier.verifier_id || (user == bill.create_user.id && bill.status == 0)" class="item"></ion-item>
    </ion-content>
    <ion-footer-bar ng-if="(!bill.status && user == bill.verifier.verifier_id) || (user == bill.create_user.id && bill.status == 0) || (user == bill.verifier.verifier_id && bill.status == 1)">
        <div class="bar bar-footer" ng-if="user == bill.verifier.verifier_id && !bill.status">
            <button class="button button-balanced col-40" ng-click="audit(1)">同意</button>
            <div class="col-20"></div>
            <button class="button button-energized col-40" ng-click="audit(0)">驳回</button>
        </div>
        <div class="bar bar-footer" ng-if="user == bill.create_user.id && bill.status == 0">
            <div class="col-10"></div>
            <button class="button button-energized col-80" ng-click="toedit()">已被驳回，请修改报销单</button>
            <div class="col-10"></div>
        </div>
        <div class="bar bar-footer" ng-if="user == bill.verifier.verifier_id && bill.status == 1">
            <div class="col-10"></div>
            <button class="button button-balanced col-80" ng-click="audit(2)">标记为已支付</button>
            <div class="col-10"></div>
        </div>
    </ion-footer-bar>
</ion-view>
