import{d as J,b as x,r as d,c as s,e as a,f as n,g as j,h as o,i as u,F as g,j as h,k as F,u as _,m as E,t as A,H as K,C as O,E as y,a as P,N as Q}from"./index.0308b213.js";import{c as R,b as W,l as X}from"./clerk_shift.2a7d44e0.js";import{l as Z}from"./shift.e85f39e5.js";const ee={class:"employee-list"},le=["onClick"],te={key:0},ae={key:1,style:{"margin-top":"5px"}},oe=E("\u4FDD\u5B58"),ce=J({setup(ue){const B=x({list:[]}),k=x({list:[]}),D=d(""),f=d(new Date),V=d(!1),L=d(null),i=d(null),c=d(0);function N(e){console.log("Date:",e),f.value=e}(()=>{R({}).then(e=>{console.log("Clerk List:",e),B.list=e})})();let S=d(!1);function C(){if(!i.value)return y({message:"\u8BF7\u9009\u62E9\u73ED\u6B21",type:"warning"}),!1;if(!c.value)return y({message:"\u8BF7\u9009\u62E9\u5458\u5DE5",type:"warning"}),!1;W({clerk_id:c.value,shift_id:i.value,date:D.value,is_change:S.value}).then(e=>{console.log("Save Shift:",e),V.value=!1,b()})}function Y(e){if(console.log("xx",e),!c.value)return y({message:"\u8BF7\u9009\u62E9\u5458\u5DE5",type:"warning"}),!1;if(!i.value)return y({message:"\u8BF7\u9009\u62E9\u73ED\u6B21",type:"warning"}),!1;z(e)!=""?Q.confirm("\u662F\u5426\u66F4\u6539\u73ED\u6B21?","\u63D0\u793A",{confirmButtonText:"\u786E\u8BA4",cancelButtonText:"\u53D6\u6D88",type:"warning"}).then(()=>{S.value=!0,D.value=e.day,C()}).catch(()=>{}):(D.value=e.day,C())}const m=x({list:[],dateArr:{}}),b=()=>{let e=P(f.value).format("YYYY-MM");X({clerk_id:c.value,date:e}).then(t=>{console.log("List By Clerk:",t),m.list=t.list,m.dateArr=t.dateArr})};function T(e){console.log("Choose Employee:",e),c.value=e,b()}(()=>{Z({page:1,limit:9999}).then(e=>{console.log("Shift List:",e),k.list=e.list})})();const z=e=>{let t="";return m.list.forEach(r=>{r.clerk_id==c.value&&r.date==e.day&&(t=r.shift_title)}),t};return b(),(e,t)=>{const r=s("el-option"),p=s("el-select"),M=s("el-form-item"),H=s("el-form"),U=s("el-tag"),$=s("el-calendar"),q=s("el-button"),G=s("el-dialog");return a(),n("div",null,[j("div",ee,[o(H,{model:_(B),"label-width":"80px"},{default:u(()=>[o(M,{label:"\u5458\u5DE5"},{default:u(()=>[o(p,{modelValue:L.value,"onUpdate:modelValue":t[0]||(t[0]=l=>L.value=l),placeholder:"\u8BF7\u9009\u62E9\u5458\u5DE5",onChange:T,clearable:""},{default:u(()=>[(a(!0),n(g,null,h(_(B).list,l=>(a(),F(r,{key:l.id,label:l.clerk.title,value:l.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),o(M,{label:"\u73ED\u6B21"},{default:u(()=>[o(p,{modelValue:i.value,"onUpdate:modelValue":t[1]||(t[1]=l=>i.value=l),placeholder:"\u8BF7\u9009\u62E9\u73ED\u6B21",clearable:""},{default:u(()=>[(a(!0),n(g,null,h(_(k).list,l=>(a(),F(r,{key:l.id,label:l.title,value:l.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["model"])]),o($,{modelValue:f.value,"onUpdate:modelValue":t[2]||(t[2]=l=>f.value=l),onChange:N},{dateCell:u(({date:l,data:v})=>[j("div",{class:K(v.isSelected?"is-selected":""),onClick:O(w=>Y(v),["stop"]),style:{width:"100%",height:"100%"}},[E(A(v.day.split("-").slice(1).join("-")),1),(a(!0),n(g,null,h(_(m).dateArr[v.day.split("-").slice(1).join("-")],(w,I)=>(a(),n("view",null,[I%2==0?(a(),n("p",te,[o(U,{type:"success"},{default:u(()=>[E(A(w),1)]),_:2},1024)])):(a(),n("p",ae,[o(U,{type:"warning"},{default:u(()=>[E(A(w),1)]),_:2},1024)]))]))),256))],10,le)]),_:1},8,["modelValue"]),o(G,{modelValue:V.value,"onUpdate:modelValue":t[4]||(t[4]=l=>V.value=l),title:"\u9009\u62E9\u73ED\u6B21"},{default:u(()=>[o(p,{modelValue:i.value,"onUpdate:modelValue":t[3]||(t[3]=l=>i.value=l),placeholder:"\u8BF7\u9009\u62E9\u73ED\u6B21"},{default:u(()=>[(a(!0),n(g,null,h(_(k).list,l=>(a(),F(r,{key:l.id,label:l.title,value:l.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),o(q,{onClick:C},{default:u(()=>[oe]),_:1})]),_:1},8,["modelValue"])])}}});export{ce as default};
