<ion-view view-title="任务详情" hide-back-button="true">
    <ion-nav-buttons side="left">
        <button class="button ion-chevron-left button-clear button-dark" ng-click="goBack()">&nbsp;返回</button>
    </ion-nav-buttons>
    <ion-nav-buttons side="right">
        <button class="button button-clear" ng-click="setTask()" ng-if="!task.is_completed">
            <i class="icon" ng-class="{true:'ion-ios-gear-outline',false:'ion-person-add'}[Isheader]"></i>
        </button>
    </ion-nav-buttons>
    <ion-content ng-init="init()" set-class-when-at-top="fix-to-top">
        <div class="top-mark" ng-if="task.is_completed">
            <div class="title">
                <label><i class="ion-ios-checkmark-outline"></i></label>
                <label>已完成</label>
            </div>
        </div>
        <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="task-header item-avatar item-icon-right ">
                <img ng-src="../../../img/panda.png">
                <h2>{{task.create_user.username}}</h2>
                <p>{{task.create_user.dept}} {{task.create_user.degree}}</p>
                <label class="datetime">{{task.create_date | date:"y-MM-dd HH:mm" }}</label>
            </ion-item>
            <ion-item class="task-details item-icon-right item-text-wrap">
                <h2 ng-bind-html="task.content | SwitchHtmlContent"></h2>
                <p ng-if="task.task_members.length>0">负责人：
                    <label>{{task.leader.username}}</label>
                </p>
                <p ng-if="task.task_members.length-1>0">任务成员：
                    <label>{{task.membernames}}</label>
                </p>
                <p ng-if="task.end_dd!=null">截止日期：
                    <label ng-class="{true:'colorred',false:''}[task.pastdate]">{{task.end_dd | date:"y-MM-dd"}}</label>
                </p>
                <div>
                    <image-popover all-images="task.task_files"></image-popover>
                </div>
            </ion-item>
            <ul class="list">
                <li class="item item-checkbox" ng-repeat="childtask in childtasks">
                    <label class="checkbox taskcontent-checkbox">
                        <input ng-change="changecheck(childtask);" ng-model="childtask.is_completed" type="checkbox" class="ng-pristine ng-untouched ng-valid ng-not-empty">
                    </label>
                    <label ng-click="toeditchildtask(childtask.id)">
                    <span class="item-text-wrap">{{childtask.content | SwitchHtmlContent}}
                        <label ng-if="childtask.leader!=null||childtask.end_dd!=null">{{childtask.leader.username}}
                            <label ng-if="childtask.end_dd!=null" ng-class="{true:'colorred',false:''}[childtask.pastdate]">
                                {{childtask.end_dd | date:"y年MM月dd日"}}
                            </label>
                        </label>
                    </span>
                    </label>
                </li>
            </ul>
            <div class="task-button-div" id="nav-comment">
                <div class="comment-div" ng-click="change(0)" ng-class="{true:'',false:'colorgray'}[activeIndex==0]">评论({{taskcomments.length}})
                    <label>|</label>
                    <hr ng-if="activeIndex==0">
                </div>
                <div class="history-div" ng-click="change(1)" ng-class="{true:'',false:'colorgray'}[activeIndex==1]">历史动态
                    <hr ng-if="activeIndex==1">
                </div>
            </div>
            <div>
                <ion-slide-box class="slide-task" show-pager="false" ng-init="lockSlide()" active-slide="activeIndex">
                    <ion-slide>
                        <ion-list class="daily">
                            <div class="center comment-empty" ng-if="taskcomments.length==0">还没有人进行评论哦!</div>
                            <div ng-repeat="comment in taskcomments">
                                <a class="item item-avatar item-text-wrap" ng-click="deletecomment(comment,$index)">
                                    <img ng-src="../../../img/panda.png" ng-click="showcardinfo(conmmentitem.create_user.id)">
                                    <div>
                                        <span>{{comment.create_user.username}}</span>
                                        <p class="comment-content" ng-bind-html="comment.content | SwitchHtmlContent">
                                        </p>
                                        <p class="time">{{comment.create_date | getDateDiff}}</p>
                                    </div>
                                    <div class="comment-imgs">
                                        <image-popover all-images="comment.task_comment_files"></image-popover>
                                    </div>
                                </a>
                            </div>
                            <ion-infinite-scroll spinner="android" ng-if="nexturl.comment!=null" on-infinite="loadMore('comment')" distance="1%" immediate-check="false">
                            </ion-infinite-scroll>
                            <h4 class="stable center" ng-show="taskcomments.length>=10&&nexturl.comment== null">没有更多了</h4>
                            <div class='obligate-item'></div>
                        </ion-list>
                    </ion-slide>
                    <ion-slide>
                        <ion-list class="daily">
                            <div ng-repeat="history in taskhistory">
                                <div class="item item-avatar item-text-wrap">
                                    <img ng-src="../../../img/panda.png" ng-click="showcardinfo(conmmentitem.create_user.id)">
                                    <!--<div>-->
                                    <span>{{history.create_user.username}}</span>
                                    <p ng-bind-html="history.content | SwitchHtmlContent"></p>
                                    <p class="time">{{history.create_date | date:"y-MM-dd HH:mm" }}</p>
                                    <!--</div>-->
                                </div>
                            </div>
                            <ion-infinite-scroll spinner="android" ng-if="nexturl.history!=null" on-infinite="loadMore('history')" distance="1%" immediate-check="false">
                            </ion-infinite-scroll>
                            <h4 class="stable center" ng-show="taskhistory.length>=10&&nexturl.history== null">没有更多了</h4>
                            <div class='obligate-item'></div>
                        </ion-list>
                    </ion-slide>
                </ion-slide-box>
            </div>
        </div>
    </ion-content>
    <div class="tabs tabs-icon-left footer-task" ng-if="!loading">
        <a class="tab-item" ng-click="tocomment()">
            <i class="icon ion-ios-chatbubble" style="font-size:25px;"></i> 评论
        </a>
        <a class="tab-item" ng-click="toaddchildtask()" ng-if="!task.is_completed">
            <i class="icon ion-plus"></i> 添加子任务
        </a>
        <a class="tab-item" ng-click="marktask(1);" ng-disabled="is_disabledmark" ng-if="!task.is_completed">
            <i class="icon ion-checkmark" style="font-size:30px;"></i> 完成任务
        </a>
        <a class="tab-item" ng-click="marktask(0);" ng-disabled="is_disabledmark" ng-if="task.is_completed">
            <i class="icon ion-reply" style="font-size:30px;"></i> 改为未完成
        </a>
    </div>
    <div ng-show="commons.bigImage" class="popover-backdrop1">
        <img class="fullscreen-image" ng-click="hideBigImage()" ng-src="{{Url}}" ng-pinch-zoom/>
    </div>
</ion-view>