<!--packageE/appointment/technician/work_day/TechnicianTime.wxml-->
<view id="work_time">
  <calendar bind:select="select" calendarEvents='{{events}}' wx:if="{{events && !even_true}}"></calendar>
  <calendar bind:select="select" calendarEvents='{{events}}' wx:if="{{even_true}}"></calendar>
  <view class="main">
    <view class="items">
      <view class='p' class="title">工作门店</view>
      <view class="gray" catchtap="getStore">
        <view class='span' style="flex: 1;">{{chooseStore.store_name || "请选择门店"}}</view>
        <icon class="iconfont icon-advertise-next"></icon>
      </view>
    </view>

    <view class="items" wx:if="{{chooseStore.id}}">
      <view class='p' class="title">工作时间（默认）</view>
      <view class="gray times" catchtap="addDefaultTime" wx:if="{{default_time.length > 0}}">
        <view class='span' wx:for="{{default_time}}" wx:key="index">
          {{item.work_hour_start}}-{{item.work_hour_end}}</view>
      </view>
      <view class="gray times" catchtap="addDefaultTime" wx:else>
        <view class='span'>添加工作时间</view>
      </view>
    </view>
    <view class="items" wx:if="{{chooseStore.id}}">
      <view class="title-box">
        <view class="title p">{{today}}</view>
        <view class="mr p">
          <view class="rest span" wx:if="{{isRest == 0}}" catchtap="changeDayStatus" data-item="rest">休息</view>
        </view>
        <view class="mr p">
          <view class="add span" wx:if="{{isRest == 1}}" catchtap="changeDayStatus">上班</view>
        </view>
        <view class='p'>
          <view class="add span" catchtap="addTime">添加工作时间</view>
        </view>
      </view>

      <view class="time-box">
        <view class="time-item" wx:for="{{day_time}}" wx:key="{{item.id}}">
          <view class="left p">{{item.work_hour_start}}-{{item.work_hour_end}}</view>
          <view class="right">
            <view class="mr p">
              <view class="rest span" catchtap="changeStatus" data-item="{{item}}" data-str="rest" wx:if="{{item.status==0}}">休息</view>
            </view>
            <view class="mr p">
              <view class="add span" catchtap="changeStatus" data-item="{{item}}" wx:if="{{item.status==1}}">上班</view>
            </view>
            <view class='p'>
              <view class="edit span" catchtap="editTime" data-item="{{item}}">编辑</view>
            </view>
          </view>
        </view>
      </view>

    </view>
  </view>
  <van-popup show="{{showStore}}" bind:close="showStoreCloseBtn">
    <view class="ul" class="store_list">
      <view class="p" style="text-align: center;font-size: 16px;font-weight: bold;padding: 0.5rem">选择门店</view>
      <view class='li' wx:for="{{store}}" wx:key="index" catchtap="choose" data-item="{{item}}" data-ind='1'>
        {{item.store_name}}
      </view>
    </view>
  </van-popup>
  <van-popup show="{{showDefault}}" custom-style="border-radius:30rpx;" bind:close="showDefaultCloseBtn">
    <view class="popTime">
      <view class="time_title p">添加工作时间</view>
      <view class="tips p">如：08:30-10:00</view>
      <view class="pop-time-box">
        <view class="time" wx:for="{{default_time}}" wx:key="i">
          <view class='span'>{{item.work_hour_start}}-{{item.work_hour_end}}</view>
          <image catchtap="deleteTime" data-date="{{item}}" class="close"
            src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/close-orange.png" alt=""></image>
        </view>
        <view class="time" catchtap="editTime">
          <view class='span'>添加</view>
        </view>
      </view>
      <view class="button">
        <view class="cancle" catchtap="showDefaultCloseBtn">取消</view>
      </view>
    </view>
  </van-popup>
  <van-popup show="{{show1}}" custom-style="border-radius:30rpx;" bind:close="showDefaultCloseBtn">
    <view class="popTime">
      <view class="time_title">编辑工作时间</view>
      <view class="tips">如：08:30-10:00</view>
      <view class="time" style="display:flex;justify-content:center;">
        <picker mode="time" value="{{choose_start}}" start="00:00" end="24:00" bindchange="bindTimeChange">
          <view>{{choose_start || "00:00"}}</view>
        </picker>
         - 
        <picker mode="time" value="{{choose_start}}" start="00:00" end="24:00" bindchange="bindTimeEndChange">
          <view>{{choose_end || "00:00"}}</view>
        </picker>
         
      </view>
      <view class="button">
        <view class="cancle" catchtap="showDefaultCloseBtn">取消</view>
        <view class="submit" catchtap="submitTime">提交</view>
      </view>
    </view>
  </van-popup>
  <van-popup show="{{showDay}}" custom-style="border-radius:30rpx;" bind:close="showDayCloseBtn">
    <view class="popTime">
      <view class="time_title">添加工作时间</view>
      <view class="tips">如：08:30-10:00</view>
      <view class="pop-time-box">
        <view class="time" wx:for="{{day_time}}" wx:key="i">
          <view>{{item.work_hour_start}}-{{item.work_hour_end}}</view></view>
        <view class="time" catchtap="editTime"><view>添加</view></view>
      </view>
      <view class="button">
        <view class="cancle" catchtap="showDay = false">取消</view>
      </view>
    </view>
  </van-popup>
</view>