import{d as V,bk as z,r as k,ay as p,c as y,o as i,X as F,w as m,j as v,i as w,h,a9 as I,H as M,A,l as n,F as S,aG as $,D as G,N as H,ix as X,aj as J,v as K}from"./index-9PRMimni.js";import{g as Q}from"./crewDailyTask-CA-vJisZ.js";import{g as U,f as D}from"./columns-BGwNjcbZ.js";import{T as Y}from"./helper-ByM4DLer.js";import{i as b}from"./isEmpty-BUg1OsQj.js";import{_ as Z}from"./list-table.vue-BMAnwqtG.js";import"./_createRound-MlkJBLNh.js";import"./toInteger-DQeH-nF-.js";import"./tslib.es6-CSJU3tT9.js";const ee={class:"flex flex-row gap-4"},te=["onClick"],ae={class:"proCard mt-3 h-40"},oe=V({__name:"MarkScale",props:{sceneTypes:{required:!0,default:[]},vesselId:{required:!0,default:null},currentWeekDay:{required:!0,default:""},taskPlanItem:{required:!0,default:{}}},emits:["update-row"],setup(T,{emit:L}){const W=z(),E=L,C=k(),t=k(),N=k(),l=T,{tableOptions:O,updateSelectedColor:P,updateRowData:g}=U({selectedColor:t.value});function R(e){const{ranges:a}=e,{start:r,end:c}=a[0],u=r.col,o=c.col;let d,s;u<o?[d,s]=[u,o]:[d,s]=[o,u];const _=Array.from({length:s-d+1},(f,B)=>B+d).map(f=>[D(f),new Y({taskId:t.value.id,taskColor:t.value.colour,weekDay:l.currentWeekDay,raw:t.value,planTime:D(f)})]),x=Object.fromEntries(_),q=g(x);E("update-row",{row:q,weekDay:l.currentWeekDay})}function j(e){const a=J(t.value);t.value=a?.code&&a.code===e.code?void 0:e}return p(()=>l.sceneTypes,e=>{b(e)||Promise.all(e.map((a,r)=>Q({type:a.value,vesselId:l.vesselId}))).then(a=>{C.value=e.map((r,c)=>({...r,detailList:a[c].list}))})}),p(()=>l.taskPlanItem,e=>{t.value=null,b(e)||g(e)}),p(()=>l.currentWeekDay,()=>{t.value=null}),p(t,e=>{P(e)}),(e,a)=>{const r=H,c=M,u=F;return i(),y(u,null,{default:m(()=>[v(c,{size:[80,30]},{default:m(()=>[(i(!0),h(S,null,I(n(C),(o,d)=>(i(),y(c,{vertical:"",key:d},{default:m(()=>[w("span",null,A(n(W).getLocale==="en"?o.labelEn:o.label),1),w("div",ee,[(i(!0),h(S,null,I(o.detailList,(s,_)=>(i(),h("div",{key:_,class:"w-10 h-10 flex justify-center items-center it-mark",style:$({backgroundColor:s.colour}),onClick:x=>j(s)},[n(t)&&s.code===n(t).code?(i(),y(r,{key:0,size:"20",class:"selected-icon"},{default:m(()=>[v(n(X),{style:{color:"#fff"}})]),_:1})):G("",!0)],12,te))),128))])]),_:2},1024))),128))]),_:1}),w("div",ae,[v(n(Z),{options:n(O),onOnSelectedCell:R,ref_key:"listTableRef",ref:N},null,8,["options"])])]),_:1})}}}),me=K(oe,[["__scopeId","data-v-5db700de"]]);export{me as default};
