<ion-header>

    <ion-navbar>
        <ion-title>值班情况</ion-title>
        <span (click)="sigUp()" float-right class="margin-right-10 color-999">值班签到</span>

    </ion-navbar>
    <div class="duty">
        <div class="dutyItem" (click)="change(1)">
            <span  class="{{changeType == 1?'duty-title':''}}">值班安排</span>
        </div>
        <div class="dutyItem"  (click)="change(2)">
            <span class="{{changeType == 2?'duty-title':''}}">我的值班</span>
        </div>
    </div>
</ion-header>


<ion-content>
    <ion-content direction="y" scrollbar-y="true" class="bgc-e7e8ed">
        <ng-container *ngIf="changeType == 1">
            <ion-calendar [(ngModel)]="date"
                          (onChange)="onChange($event)"
                          [options]="options"
                          type="string"
                          format="YYYY-MM-DD">
            </ion-calendar>
            <div>
                <ion-item>
                    <p>
                        <span>白班</span>
                        <span *ngIf="dayObj.name" float-right>{{dayObj.name}}</span>
                        <span *ngIf="!dayObj.name" float-right>暂无</span>
                    </p>
                </ion-item>
                <ion-item>
                    <p>
                        <span>夜班</span>
                        <span *ngIf="nightObj.name" float-right>{{nightObj.name}}</span>
                        <span *ngIf="!nightObj.name" float-right>暂无</span>
                    </p>
                </ion-item>
            </div>
        </ng-container>
       <ng-container *ngIf="changeType == 2">
            <div class="duty-content">
                <ion-list *ngIf="nowDuty.length > 0">
                    <ion-item *ngFor="let item of nowDuty">
                        <div >
                            <span>{{item.dutyDate | date:'yyyy-MM-dd'}}</span>
                            <span *ngIf="item.type == 0">白班</span>
                            <span *ngIf="item.type == 1">夜班</span>
                        </div>
                        <div>
                            <span  (click)="dutyDetail(item)" *ngIf="item.applyId">申请详情</span>
                            <span (click)="dutyApply(item)" *ngIf="!item.applyId">换班申请</span>
                        </div>
                    </ion-item>
                </ion-list>
                <ion-list *ngIf="nowDuty.length == 0">
                    <p text-center>暂无数据</p>
                </ion-list>
            </div>
       </ng-container>
    </ion-content>
</ion-content>

