bettertend/frontend/dist/assets/WorkOrdersCalendarView-XWSD...

2 lines
41 KiB
JavaScript

import{_ as Me,r as W,c as _,m as Ke,o as Ae,a as u,g as d,b as e,d as m,t as c,w as h,e as s,F as O,k,af as C,aQ as E,n as ye,j as v,Q as de,h as Ye,i as ce,aV as Qe,s as Je,v as Xe}from"./index-BUdRbiwj.js";import{u as Ze}from"./useWorkOrders-B61P5JA7.js";import{u as et}from"./useFormAutoSave-Jaawgo91.js";import{F as tt,a as st}from"./FPPageHeader-CTG2L28r.js";import{F as U}from"./FPSelect-C7p47Ma2.js";import{F as Ie}from"./FPModal-DWGF1LV8.js";import{F as Q}from"./FPBadge-BKY5dPnL.js";import{u as ot}from"./useUniversalCalendar-2CJQgaXx.js";import{T as rt,P as at,A as lt}from"./AudioRecorder-CcKMXbWt.js";import{T as nt}from"./TimeTracker-Ch4gtOrh.js";import{C as it,S as dt}from"./StatusHistory-DeozEdNs.js";import{W as ut}from"./WorkOrderIdGenerator-BPGN0soM.js";import{R as ct}from"./ReportGenerator-CjXdt1Qp.js";import{F as ue}from"./FPInput-CzR_dWoe.js";import{F as mt}from"./FPCheckbox-Bu8jNAEW.js";import{F as pt}from"./FPTabs-R71V25QN.js";import{F as $e}from"./FPFileUpload-D2coSbjN.js";import{_ as vt}from"./FormRestoreNotification-DYBlXhOP.js";import"./workOrder-jNxj_kjQ.js";import"./usePreventiveMaintenanceDisplay-Bhncwa9c.js";const gt={class:"universal-calendar"},ft={class:"mb-6"},yt={class:"flex items-center justify-between mb-4"},xt={class:"flex items-center space-x-4"},ht={class:"text-xl font-semibold text-gray-900"},kt={class:"flex items-center space-x-2"},bt={class:"flex flex-wrap items-center gap-3"},wt={class:"flex items-center bg-gray-100 rounded-lg p-1"},_t=["onClick"],Dt={class:"mb-4 text-center"},Ct={class:"text-lg font-medium text-gray-900"},Et={class:"bg-white border border-gray-200 rounded-lg overflow-hidden shadow-sm"},St={key:0,class:"month-view"},Vt={class:"grid grid-cols-7 bg-gray-50 border-b border-gray-200"},Tt={class:"grid grid-cols-7"},Pt={class:"flex items-center justify-between mb-1"},Ot={key:0,class:"text-xs text-gray-500"},$t={class:"space-y-1"},Mt=["onClick"],At={class:"flex-1 min-w-0"},It={class:"font-medium truncate"},Nt={class:"text-xs opacity-75"},Ut=["onClick"],Rt={key:1,class:"week-view"},Ft={class:"grid grid-cols-8 bg-gray-50 border-b border-gray-200"},Wt={class:"text-sm font-medium text-gray-700"},Lt={class:"grid grid-cols-8"},Bt={class:"border-r border-gray-200"},zt=["onClick"],Ht=["onClick"],jt={class:"font-medium truncate"},Gt={class:"text-xs opacity-75"},qt={key:2,class:"list-view p-4"},Kt={class:"space-y-3"},Yt=["onClick"],Qt={class:"flex items-center space-x-4"},Jt={class:"min-w-0 flex-1"},Xt={class:"font-medium text-gray-900"},Zt={class:"text-sm text-gray-600"},es={class:"flex items-center mt-2 space-x-4 text-xs text-gray-500"},ts={key:0},ss={key:1},os={key:2},rs={key:3},as={class:"flex items-center space-x-4 text-sm text-gray-500"},ls={class:"font-medium"},ns={class:"text-xs"},is={key:0,class:"text-center py-12 text-gray-500"},ds={key:0,class:"space-y-4"},us={class:"flex items-center space-x-2"},cs={class:"grid grid-cols-2 gap-4 text-sm"},ms={key:0},ps={key:1},vs={key:2},gs={key:3},fs={key:4},ys={key:0},xs={class:"mt-1 text-gray-700"},hs={key:1},ks={class:"mt-1 text-gray-700 whitespace-pre-wrap"},bs={key:2,class:"border-t pt-4"},ws={class:"mt-6 p-4 bg-gray-50 rounded-lg"},_s={class:"flex flex-wrap gap-4 text-sm"},Ds={__name:"UniversalCalendar",props:{title:{type:String,default:"Calendar"},showWorkOrders:{type:Boolean,default:!0},showPreventiveMaintenance:{type:Boolean,default:!0},showAssetInspections:{type:Boolean,default:!1},showScheduledDowntime:{type:Boolean,default:!1}},emits:["create-work-order","edit-work-order","create-pm-schedule","edit-pm-schedule","generate-work-order-from-pm","create-event-at-time"],setup(xe,{emit:G}){const T=xe,S=G,{currentDate:y,currentView:o,selectedEvent:p,showEventModal:L,allCalendarEvents:he,eventTypes:me,getEventsForDate:ke,refreshCalendarData:N,handleEventClick:be}=ot(),D=W({eventType:"",status:"",priority:""}),we=[{key:"month",label:"Month"},{key:"week",label:"Week"},{key:"list",label:"List"}],J=["8:00","9:00","10:00","11:00","12:00","13:00","14:00","15:00","16:00","17:00"],_e=_(()=>{if(o.value==="month")return y.value.toLocaleDateString("en-US",{month:"long",year:"numeric"});if(o.value==="week"){const n=ve(y.value),a=new Date(n);return a.setDate(a.getDate()+6),`${n.toLocaleDateString("en-US",{month:"short",day:"numeric"})} - ${a.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}`}return T.title}),De=_(()=>o.value==="month"?["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]:[]),B=_(()=>{if(o.value==="week"){const n=ve(y.value),a=[];for(let g=0;g<7;g++){const w=new Date(n);w.setDate(w.getDate()+g),a.push({date:w.toISOString().split("T")[0],dayName:w.toLocaleDateString("en-US",{weekday:"short"}),dayNumber:w.getDate(),isToday:R(w)})}return a}return[]}),pe=_(()=>{if(o.value!=="month")return[];const n=y.value.getFullYear(),a=y.value.getMonth(),g=new Date(n,a,1),w=new Date(g);w.setDate(w.getDate()-g.getDay());const i=[],f=new Date(w);for(let F=0;F<42;F++)i.push({date:f.toISOString().split("T")[0],dayNumber:f.getDate(),isCurrentMonth:f.getMonth()===a,isToday:R(f)}),f.setDate(f.getDate()+1);return i}),X=_(()=>{let n=he.value;return n=n.filter(a=>{const g=a.extendedProps.type;return!(g==="WORK_ORDER"&&!T.showWorkOrders||g==="PREVENTIVE_MAINTENANCE"&&!T.showPreventiveMaintenance||g==="ASSET_INSPECTION"&&!T.showAssetInspections||g==="SCHEDULED_DOWNTIME"&&!T.showScheduledDowntime)}),D.value.eventType&&(n=n.filter(a=>a.extendedProps.type===D.value.eventType)),D.value.status&&(n=n.filter(a=>a.extendedProps.status===D.value.status)),D.value.priority&&(n=n.filter(a=>a.extendedProps.priority===D.value.priority)),n}),Ce=_(()=>[{value:"",label:"All Events"},...T.showWorkOrders?[{value:"WORK_ORDER",label:"Work Orders"}]:[],...T.showPreventiveMaintenance?[{value:"PREVENTIVE_MAINTENANCE",label:"Preventive Maintenance"}]:[],...T.showAssetInspections?[{value:"ASSET_INSPECTION",label:"Asset Inspections"}]:[],...T.showScheduledDowntime?[{value:"SCHEDULED_DOWNTIME",label:"Scheduled Downtime"}]:[]]),Z=_(()=>[{value:"",label:"All Statuses"},{value:"OPEN",label:"Open"},{value:"IN_PROGRESS",label:"In Progress"},{value:"COMPLETED",label:"Completed"},{value:"ON_HOLD",label:"On Hold"},{value:"CANCELLED",label:"Cancelled"},{value:"ACTIVE",label:"Active"},{value:"PAUSED",label:"Paused"},{value:"INACTIVE",label:"Inactive"}]),ee=_(()=>[{value:"",label:"All Priorities"},{value:"LOW",label:"Low"},{value:"MEDIUM",label:"Medium"},{value:"HIGH",label:"High"},{value:"CRITICAL",label:"Critical"}]),q=()=>{o.value==="month"?y.value=new Date(y.value.getFullYear(),y.value.getMonth()-1,1):o.value==="week"&&(y.value=new Date(y.value.getTime()-7*24*60*60*1e3)),N()},Ee=()=>{o.value==="month"?y.value=new Date(y.value.getFullYear(),y.value.getMonth()+1,1):o.value==="week"&&(y.value=new Date(y.value.getTime()+7*24*60*60*1e3)),N()},te=()=>{y.value=new Date,N()},$=n=>ke(new Date(n)),se=n=>$(n).length,K=(n,a)=>$(n).filter(g=>g.id.replace(/\D/g,"")%J.length==a),M=n=>{be({event:{id:n.id,title:n.title,start:n.start,end:n.end,extendedProps:n.extendedProps}})},V=()=>{L.value=!1,p.value=null},z=()=>{if(p.value){const n=p.value.extendedProps.type,a=p.value.extendedProps.originalData;n==="WORK_ORDER"?S("edit-work-order",a.id):n==="PREVENTIVE_MAINTENANCE"&&S("edit-pm-schedule",a.id),V()}},b=(n,a)=>{S("create-event-at-time",{date:n,time:a})},A=()=>{if(p.value&&p.value.extendedProps.type==="PREVENTIVE_MAINTENANCE"){const n=p.value.extendedProps.originalData;S("generate-work-order-from-pm",n.id),V()}},H=n=>{console.log("Show day details for:",n)},j=()=>{},R=n=>{const a=new Date;return n.toDateString()===a.toDateString()},ve=n=>{const a=new Date(n);return a.setDate(a.getDate()-a.getDay()),a.setHours(0,0,0,0),a},oe=n=>n?new Date(n).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"",re=n=>n?new Date(n).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit"}):"",ae=n=>n?n.charAt(0)+n.slice(1).toLowerCase():"N/A",le=n=>n?n.replace("_"," ").toLowerCase().replace(/\b\w/g,a=>a.toUpperCase()):"N/A",ge=n=>{if(!n)return"N/A";const a=Math.floor(n/60),g=n%60;return a>0?g>0?`${a}h ${g}m`:`${a}h`:`${g}m`},Y=n=>{var a;return((a=me[n])==null?void 0:a.label)||n},ne=n=>({WORK_ORDER:"primary",PREVENTIVE_MAINTENANCE:"success",ASSET_INSPECTION:"warning",SCHEDULED_DOWNTIME:"error"})[n]||"secondary",fe=n=>({LOW:"secondary",MEDIUM:"primary",HIGH:"warning",CRITICAL:"error"})[n]||"secondary",Se=n=>({OPEN:"primary",IN_PROGRESS:"warning",COMPLETED:"success",ON_HOLD:"warning",CANCELLED:"secondary",ACTIVE:"success",PAUSED:"warning",INACTIVE:"secondary"})[n]||"secondary",ie=n=>{if(!n)return"Unassigned";if(Array.isArray(n)){if(n.length===0)return"Unassigned";const a=n[0],g=`${a.firstName} ${a.lastName}`;return n.length>1?`${g} +${n.length-1}`:g}return`${n.firstName} ${n.lastName}`};return Ke(o,()=>{N()}),Ae(()=>{N()}),(n,a)=>{var g,w;return d(),u("div",gt,[e("div",ft,[e("div",yt,[e("div",xt,[e("h2",ht,c(xe.title),1),e("div",kt,[m(s(O),{variant:"outline",size:"sm",onClick:q},{default:h(()=>a[4]||(a[4]=[e("svg",{class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 19l-7-7 7-7"})],-1)])),_:1,__:[4]}),m(s(O),{variant:"outline",size:"sm",onClick:te},{default:h(()=>a[5]||(a[5]=[k(" Today ",-1)])),_:1,__:[5]}),m(s(O),{variant:"outline",size:"sm",onClick:Ee},{default:h(()=>a[6]||(a[6]=[e("svg",{class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"})],-1)])),_:1,__:[6]})])])]),e("div",bt,[e("div",wt,[(d(),u(C,null,E(we,i=>e("button",{key:i.key,onClick:f=>o.value=i.key,class:ye(["px-3 py-1 text-sm font-medium rounded-md transition-colors",{"bg-white text-gray-900 shadow":s(o)===i.key,"text-gray-600 hover:text-gray-900":s(o)!==i.key}])},c(i.label),11,_t)),64))]),m(s(U),{modelValue:D.value.eventType,"onUpdate:modelValue":[a[0]||(a[0]=i=>D.value.eventType=i),j],placeholder:"All Events",options:Ce.value,size:"sm"},null,8,["modelValue","options"]),m(s(U),{modelValue:D.value.status,"onUpdate:modelValue":[a[1]||(a[1]=i=>D.value.status=i),j],placeholder:"All Statuses",options:Z.value,size:"sm"},null,8,["modelValue","options"]),m(s(U),{modelValue:D.value.priority,"onUpdate:modelValue":[a[2]||(a[2]=i=>D.value.priority=i),j],placeholder:"All Priorities",options:ee.value,size:"sm"},null,8,["modelValue","options"])])]),e("div",Dt,[e("h3",Ct,c(_e.value),1)]),e("div",Et,[s(o)==="month"?(d(),u("div",St,[e("div",Vt,[(d(!0),u(C,null,E(De.value,i=>(d(),u("div",{key:i,class:"p-3 text-center text-sm font-medium text-gray-700"},c(i),1))),128))]),e("div",Tt,[(d(!0),u(C,null,E(pe.value,i=>(d(),u("div",{key:i.date,class:ye(["min-h-[120px] border-r border-b border-gray-200 p-2",{"bg-gray-50":!i.isCurrentMonth,"bg-blue-50":i.isToday}])},[e("div",Pt,[e("span",{class:ye(["text-sm font-medium",{"text-gray-400":!i.isCurrentMonth,"text-blue-600 bg-blue-100 w-6 h-6 rounded-full flex items-center justify-center":i.isToday,"text-gray-900":i.isCurrentMonth&&!i.isToday}])},c(i.dayNumber),3),se(i.date)?(d(),u("span",Ot,c(se(i.date)),1)):v("",!0)]),e("div",$t,[(d(!0),u(C,null,E($(i.date).slice(0,3),f=>(d(),u("div",{key:f.id,class:"p-1 rounded text-xs cursor-pointer hover:opacity-80 transition-opacity flex items-center space-x-1",style:de({backgroundColor:f.backgroundColor,color:f.textColor}),onClick:F=>M(f)},[e("div",{class:"flex-shrink-0 w-2 h-2 rounded-full",style:de({backgroundColor:f.borderColor})},null,4),e("div",At,[e("div",It,c(f.title),1),e("div",Nt,c(Y(f.extendedProps.type)),1)])],12,Mt))),128)),$(i.date).length>3?(d(),u("div",{key:0,class:"text-xs text-gray-500 text-center cursor-pointer hover:text-gray-700",onClick:f=>H(i.date)}," +"+c($(i.date).length-3)+" more ",9,Ut)):v("",!0)])],2))),128))])])):s(o)==="week"?(d(),u("div",Rt,[e("div",Ft,[a[7]||(a[7]=e("div",{class:"p-3"},null,-1)),(d(!0),u(C,null,E(B.value,i=>(d(),u("div",{key:i.date,class:"p-3 text-center border-l border-gray-200"},[e("div",Wt,c(i.dayName),1),e("div",{class:ye(["text-lg font-semibold mt-1",{"text-blue-600 bg-blue-100 w-8 h-8 rounded-full flex items-center justify-center mx-auto":i.isToday,"text-gray-900":!i.isToday}])},c(i.dayNumber),3)]))),128))]),e("div",Lt,[e("div",Bt,[(d(),u(C,null,E(J,i=>e("div",{key:i,class:"h-16 border-b border-gray-200 p-2 text-xs text-gray-500"},c(i),1)),64))]),(d(!0),u(C,null,E(B.value,i=>(d(),u("div",{key:i.date,class:"border-r border-gray-200 relative"},[(d(),u(C,null,E(J,(f,F)=>e("div",{key:f,class:"h-16 border-b border-gray-200 p-1 cursor-pointer hover:bg-gray-50",onClick:I=>b(i.date,f)},[(d(!0),u(C,null,E(K(i.date,F),I=>(d(),u("div",{key:I.id,class:"absolute z-10 left-1 right-1 p-1 rounded text-xs cursor-pointer",style:de({backgroundColor:I.backgroundColor,borderLeft:`4px solid ${I.borderColor}`,color:I.textColor,top:`${F*64+4}px`,height:"56px"}),onClick:Ye(Ve=>M(I),["stop"])},[e("div",jt,c(I.title),1),e("div",Gt,c(Y(I.extendedProps.type)),1)],12,Ht))),128))],8,zt)),64))]))),128))])])):s(o)==="list"?(d(),u("div",qt,[e("div",Kt,[(d(!0),u(C,null,E(X.value,i=>(d(),u("div",{key:i.id,class:"flex items-center justify-between p-4 border border-gray-200 rounded-lg hover:border-gray-300 transition-colors cursor-pointer",onClick:f=>M(i)},[e("div",Qt,[e("div",{class:"w-4 h-4 rounded-full flex-shrink-0",style:de({backgroundColor:i.borderColor})},null,4),e("div",Jt,[e("h4",Xt,c(i.title),1),e("p",Zt,c(Y(i.extendedProps.type)),1),e("div",es,[i.extendedProps.priority?(d(),u("span",ts," Priority: "+c(ae(i.extendedProps.priority)),1)):v("",!0),i.extendedProps.status?(d(),u("span",ss," Status: "+c(le(i.extendedProps.status)),1)):v("",!0),i.extendedProps.location?(d(),u("span",os," Location: "+c(i.extendedProps.location),1)):v("",!0),i.extendedProps.assetName?(d(),u("span",rs," Asset: "+c(i.extendedProps.assetName),1)):v("",!0)])])]),e("div",as,[e("div",null,[e("div",ls,c(oe(i.start)),1),e("div",ns,c(re(i.start)),1)]),m(s(Q),{variant:fe(i.extendedProps.priority)},{default:h(()=>[k(c(ae(i.extendedProps.priority)),1)]),_:2},1032,["variant"])])],8,Yt))),128))]),X.value.length===0?(d(),u("div",is,a[8]||(a[8]=[e("svg",{class:"w-12 h-12 mx-auto mb-4 text-gray-300",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})],-1),e("p",null,"No events found for the selected period",-1)]))):v("",!0)])):v("",!0)]),m(s(Ie),{modelValue:s(L),"onUpdate:modelValue":a[3]||(a[3]=i=>Qe(L)?L.value=i:null),title:((g=s(p))==null?void 0:g.title)||"Event Details",size:"lg",onConfirm:z,onCancel:V,"confirm-text":((w=s(p))==null?void 0:w.extendedProps.type)==="WORK_ORDER"?"Edit Work Order":"Edit Schedule","cancel-text":"Close"},{default:h(()=>[s(p)?(d(),u("div",ds,[e("div",us,[m(s(Q),{variant:ne(s(p).extendedProps.type)},{default:h(()=>[k(c(Y(s(p).extendedProps.type)),1)]),_:1},8,["variant"]),s(p).extendedProps.priority?(d(),ce(s(Q),{key:0,variant:fe(s(p).extendedProps.priority)},{default:h(()=>[k(c(ae(s(p).extendedProps.priority)),1)]),_:1},8,["variant"])):v("",!0),s(p).extendedProps.status?(d(),ce(s(Q),{key:1,variant:Se(s(p).extendedProps.status)},{default:h(()=>[k(c(le(s(p).extendedProps.status)),1)]),_:1},8,["variant"])):v("",!0)]),e("div",cs,[e("div",null,[a[9]||(a[9]=e("strong",null,"Start:",-1)),k(" "+c(oe(s(p).start))+" "+c(re(s(p).start)),1)]),e("div",null,[a[10]||(a[10]=e("strong",null,"End:",-1)),k(" "+c(oe(s(p).end))+" "+c(re(s(p).end)),1)]),s(p).extendedProps.location?(d(),u("div",ms,[a[11]||(a[11]=e("strong",null,"Location:",-1)),k(" "+c(s(p).extendedProps.location),1)])):v("",!0),s(p).extendedProps.assetName?(d(),u("div",ps,[a[12]||(a[12]=e("strong",null,"Asset:",-1)),k(" "+c(s(p).extendedProps.assetName),1)])):v("",!0),s(p).extendedProps.type==="WORK_ORDER"&&s(p).extendedProps.assignedTo?(d(),u("div",vs,[a[13]||(a[13]=e("strong",null,"Assigned To:",-1)),k(" "+c(ie(s(p).extendedProps.assignedTo)),1)])):v("",!0),s(p).extendedProps.type==="PREVENTIVE_MAINTENANCE"&&s(p).extendedProps.frequency?(d(),u("div",gs,[a[14]||(a[14]=e("strong",null,"Frequency:",-1)),k(" "+c(s(p).extendedProps.frequency),1)])):v("",!0),s(p).extendedProps.estimatedDuration?(d(),u("div",fs,[a[15]||(a[15]=e("strong",null,"Duration:",-1)),k(" "+c(ge(s(p).extendedProps.estimatedDuration)),1)])):v("",!0)]),s(p).extendedProps.description?(d(),u("div",ys,[a[16]||(a[16]=e("strong",null,"Description:",-1)),e("p",xs,c(s(p).extendedProps.description),1)])):v("",!0),s(p).extendedProps.instructions?(d(),u("div",hs,[a[17]||(a[17]=e("strong",null,"Instructions:",-1)),e("p",ks,c(s(p).extendedProps.instructions),1)])):v("",!0),s(p).extendedProps.type==="PREVENTIVE_MAINTENANCE"?(d(),u("div",bs,[m(s(O),{variant:"secondary",size:"sm",onClick:A},{default:h(()=>a[18]||(a[18]=[e("svg",{class:"w-4 h-4 mr-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})],-1),k(" Generate Work Order ",-1)])),_:1,__:[18]})])):v("",!0)])):v("",!0)]),_:1},8,["modelValue","title","confirm-text"]),e("div",ws,[a[19]||(a[19]=e("h4",{class:"text-sm font-medium text-gray-900 mb-3"},"Event Types",-1)),e("div",_s,[(d(!0),u(C,null,E(s(me),(i,f)=>(d(),u("div",{key:f,class:"flex items-center space-x-2"},[e("div",{class:"w-3 h-3 rounded",style:de({backgroundColor:i.color})},null,4),e("span",null,c(i.label),1)]))),128))])])])}}},Cs=Me(Ds,[["__scopeId","data-v-196ae05f"]]),Es={class:"p-6"},Ss={class:"grid grid-cols-1 md:grid-cols-4 gap-4 mb-6"},Vs={class:"bg-white p-4 rounded-lg border border-gray-200"},Ts={class:"flex items-center"},Ps={class:"ml-4"},Os={class:"text-2xl font-bold text-gray-900"},$s={class:"bg-white p-4 rounded-lg border border-gray-200"},Ms={class:"flex items-center"},As={class:"ml-4"},Is={class:"text-2xl font-bold text-gray-900"},Ns={class:"bg-white p-4 rounded-lg border border-gray-200"},Us={class:"flex items-center"},Rs={class:"ml-4"},Fs={class:"text-2xl font-bold text-gray-900"},Ws={class:"bg-white p-4 rounded-lg border border-gray-200"},Ls={class:"flex items-center"},Bs={class:"ml-4"},zs={class:"text-2xl font-bold text-gray-900"},Hs={class:"mt-8 grid grid-cols-1 lg:grid-cols-3 gap-6"},js={class:"space-y-6"},Gs={class:"bg-white border border-gray-200 rounded-lg overflow-hidden"},qs={class:"divide-y divide-gray-200"},Ks=["onClick"],Ys={class:"flex items-start justify-between"},Qs={class:"flex-1 min-w-0"},Js={class:"text-sm font-medium text-gray-900 truncate"},Xs={class:"text-xs text-gray-500 mt-1"},Zs={class:"flex items-center mt-2"},eo={class:"ml-2 text-xs text-gray-500"},to={class:"ml-2 text-xs text-gray-400"},so={key:0,class:"p-4 text-center text-gray-500 text-sm"},oo={class:"bg-white border border-gray-200 rounded-lg overflow-hidden"},ro={class:"divide-y divide-gray-200"},ao=["onClick"],lo={class:"flex items-center justify-between"},no={class:"flex-1 min-w-0"},io={class:"text-sm font-medium text-gray-900 truncate"},uo={class:"text-xs text-gray-500 mt-1"},co={key:0,class:"p-4 text-center text-gray-500 text-sm"},mo={class:"border-b border-gray-200 mb-6"},po={class:"min-h-[400px]"},vo={key:0,class:"space-y-4"},go={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},fo={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},yo={class:"mt-6 border-t pt-6"},xo={key:1,class:"space-y-4"},ho={key:2,class:"space-y-4"},ko={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},bo={class:"mt-6 border-t pt-6"},wo={key:3,class:"space-y-4"},_o={key:4,class:"space-y-6"},Do={class:"border-2 border-dashed border-gray-300 rounded-lg p-6 text-center hover:border-gray-400 transition-colors"},Co={class:"mt-4"},Eo={class:"cursor-pointer"},So={key:0,class:"mt-4 space-y-2"},Vo={class:"flex items-center"},To={class:"text-sm font-medium text-gray-900"},Po={class:"text-xs text-gray-500"},Oo={class:"mt-2 text-xs text-gray-500"},$o={class:"mt-2"},Mo={key:5,class:"space-y-4"},Ao={class:"mt-6 border-t pt-6"},Io={class:"mt-6 border-t pt-6"},No={class:"mt-6 border-t pt-6"},Uo={class:"flex items-center justify-between"},Ro={class:"flex items-center space-x-4"},Fo={key:0,class:"flex items-center text-sm text-gray-500"},Wo={key:0,class:"w-4 h-4 mr-2 text-amber-500 animate-pulse",fill:"currentColor",viewBox:"0 0 20 20"},Lo={key:1,class:"w-4 h-4 mr-2 text-green-500",fill:"currentColor",viewBox:"0 0 20 20"},Bo={key:2},zo={key:3},Ho={class:"flex space-x-3"},jo={__name:"WorkOrdersCalendarView",setup(xe){const G=Xe(),T=Je(),{loading:S,workOrders:y,workOrderForm:o,uploadingFiles:p,uploadProgress:L,priorityOptions:he,assetOptions:me,locationOptions:ke,userOptions:N,teamOptions:be,categoryOptions:D,searchWorkOrders:we,createWorkOrder:J,updateWorkOrder:_e,loadDropdownOptions:De,resetForm:B,formatStatus:pe,getStatusBadge:X,markUserInteraction:Ce,finishInitialization:Z,WORK_ORDER_STATUS:ee}=Ze(),{hasUnsavedChanges:q,restoreFormData:Ee,clearSavedData:te,hasSavedData:$,getSavedDataInfo:se,lastSaveTime:K}=et(o,{storageKey:"atlas_work_order_form_data",saveInterval:3e3,excludeFields:[]}),M=W(!1),V=W("create"),z=W(null),b=W("basic"),A=W(null),H=W(!1),j=W(null),R=[{key:"basic",label:"Basic Info"},{key:"assignment",label:"Assignment"},{key:"scheduling",label:"Scheduling"},{key:"parts",label:"Parts"},{key:"attachments",label:"Attachments"},{key:"options",label:"Options"}],ve=_(()=>{const l=V.value==="create"?"Create Work Order":"Edit Work Order";return q.value?`${l} (unsaved changes)`:l}),oe=_(()=>{const l=new Date,t=new Date(l.getTime()+7*24*60*60*1e3);return y.value.filter(r=>{if(!r.dueDate)return!1;const x=new Date(r.dueDate);return x>=l&&x<=t}).length}),re=_(()=>{const l=new Date;return y.value.filter(t=>t.dueDate?new Date(t.dueDate)<l&&t.status!==ee.COMPLETE:!1).length}),ae=_(()=>{const l=new Date,t=new Date(l.getFullYear(),l.getMonth(),1);return y.value.filter(r=>r.status!==ee.COMPLETE||!r.completedAt?!1:new Date(r.completedAt)>=t).length}),le=_(()=>{const l=new Date;return y.value.filter(t=>!t.dueDate||t.status===ee.COMPLETE?!1:new Date(t.dueDate)>l).sort((t,r)=>new Date(t.dueDate)-new Date(r.dueDate)).slice(0,5)}),ge=_(()=>{const l=new Date().toDateString();return y.value.filter(t=>t.dueDate?new Date(t.dueDate).toDateString()===l:!1)}),Y=_(()=>{if(!K.value)return"";const l=new Date,t=new Date(K.value),r=l-t,x=Math.floor(r/(60*1e3));return x<1?"just now":x===1?"1 minute ago":x<60?`${x} minutes ago`:t.toLocaleTimeString()}),ne=async()=>{await we()},fe=()=>{console.log("Export calendar")},Se=()=>{V.value="create",z.value=null,b.value="basic",Ve(),$()||(B(),Te(),Z()),M.value=!0},ie=l=>{const t=y.value.find(r=>r.id===l);t&&(V.value="edit",z.value=l,b.value="basic",Object.assign(o,t),Z(),M.value=!0)},n=()=>{G.push("/maintenance/preventive?create=true")},a=l=>{G.push(`/maintenance/preventive/${l}`)},g=l=>{G.push(`/work-orders?create=true&pmScheduleId=${l}`)},w=l=>{V.value="create",z.value=null,b.value="basic",Ve(),$()?l.date&&!o.dueDate&&(o.dueDate=l.date):(B(),l.date&&(o.dueDate=l.date),Te()),M.value=!0},i=()=>{te(),M.value=!1,B(),H.value=!1},f=async()=>{try{V.value==="create"?await J():await _e(z.value,o),te(),i(),await ne()}catch(l){console.error("Failed to save work order:",l)}},F=l=>l?new Date(l).toLocaleDateString("en-US",{month:"short",day:"numeric"}):"",I=l=>{if(!l)return"";const x=new Date(l)-new Date,P=Math.ceil(x/(1e3*60*60*24));return P===0?"Today":P===1?"Tomorrow":P===-1?"Yesterday":P>0?`In ${P} days`:`${Math.abs(P)} days ago`},Ve=()=>{console.log("Checking for saved data...",{modalMode:V.value,hasSaved:$(),savedInfo:se()}),V.value==="create"&&$()?(j.value=se(),H.value=!0,console.log("Showing restore notification with data:",j.value)):console.log("No saved data found or not in create mode")},Ne=()=>{var l,t,r;Ee()&&(H.value=!1,Ce(),console.log("Form data restored successfully"),((l=o.audioRecordings)!=null&&l.some(x=>x._hadBlobUrl)||(t=o.image)!=null&&t._isFile||(r=o.files)!=null&&r.some(x=>x._isFile))&&console.warn("Note: Audio recordings, images, and uploaded files cannot be restored after page refresh. Only metadata was preserved."))},Ue=()=>{H.value=!1,te(),B(),Te(),Z(),console.log("Auto-saved data dismissed and form reset")},Re=l=>{b.value=l},Pe=l=>{const t=R.findIndex(r=>r.key===b.value);l==="next"&&t<R.length-1?b.value=R[t+1].key:l==="previous"&&t>0&&(b.value=R[t-1].key)},Fe=async l=>{console.log("Primary image uploaded:",l)},We=async l=>{console.log("Additional files uploaded:",l)},Le=l=>{const t=Array.from(l.target.files);if(!t.length)return;const r=t.map(x=>({...x,id:Date.now()+Math.random(),uploadedAt:new Date().toISOString(),uploadedBy:A.value}));o.files||(o.files=[]),o.files.push(...r),l.target.value=""},Be=l=>{o.files&&o.files[l]&&o.files.splice(l,1)},ze=l=>{if(!l)return"0 B";const t=["B","KB","MB","GB"],r=Math.floor(Math.log(l)/Math.log(1024));return`${Math.round(l/Math.pow(1024,r)*100)/100} ${t[r]}`},He=l=>{if(!l)return"just now";const t=new Date(l),x=new Date-t,P=Math.floor(x/(1e3*60));if(P<1)return"just now";if(P<60)return`${P}m ago`;const Oe=Math.floor(P/60);return Oe<24?`${Oe}h ago`:t.toLocaleDateString()},je=l=>{o.status=l.newStatus;const t={id:Date.now()+Math.random(),action:"STATUS_CHANGE",field:"status",oldValue:l.previousStatus,newValue:l.newStatus,user:l.user,timestamp:new Date().toISOString(),description:`Status changed from ${l.previousStatus} to ${l.newStatus}`};o.auditTrail||(o.auditTrail=[]),o.auditTrail.unshift(t),console.log("Status changed:",l)},Ge=l=>{console.log("Report generated:",l);const t={id:Date.now()+Math.random(),action:"REPORT_GENERATED",field:"report",newValue:l.name,user:A.value,timestamp:new Date().toISOString(),description:`Generated report: ${l.name}`};o.auditTrail||(o.auditTrail=[]),o.auditTrail.unshift(t)},qe=l=>{console.log("Recording saved:",l);const t={id:Date.now()+Math.random(),action:"AUDIO_RECORDED",field:"audioRecordings",newValue:l.title||"Untitled Recording",user:A.value,timestamp:new Date().toISOString(),description:`Added audio recording: ${l.title||"Untitled Recording"} (${Math.round(l.duration||0)}s)`};o.auditTrail||(o.auditTrail=[]),o.auditTrail.unshift(t)},Te=()=>{if(A.value&&!o.primaryUser&&(o.primaryUser=A.value.id),!o.estimatedStartDate){const l=new Date;l.setMinutes(l.getMinutes()-l.getTimezoneOffset()),o.estimatedStartDate=l.toISOString().slice(0,16)}o.files||(o.files=[]),o.audioRecordings||(o.audioRecordings=[]),o.tasks||(o.tasks=[]),o.parts||(o.parts=[])};return Ae(async()=>{try{if(await De(),await ne(),T.query.create==="true"){const l=T.query.assetId;setTimeout(()=>{l&&(o.assetId=parseInt(l)),Se(),G.replace({path:"/work-orders/calendar"})},500)}}catch(l){console.error("Failed to initialize work orders calendar view:",l)}}),(l,t)=>(d(),ce(tt,null,{header:h(()=>[m(st,{title:"Work Order Calendar",description:"Schedule and view work orders in calendar format",breadcrumbs:[{text:"Work Orders",to:"/work-orders"},{text:"Calendar",to:null}]},{actions:h(()=>[m(s(O),{variant:"outline",size:"sm",onClick:ne},{default:h(()=>t[25]||(t[25]=[e("svg",{class:"w-4 h-4 mr-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})],-1),k(" Refresh ",-1)])),_:1,__:[25]}),m(s(O),{variant:"outline",size:"sm",onClick:fe},{default:h(()=>t[26]||(t[26]=[e("svg",{class:"w-4 h-4 mr-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})],-1),k(" Export ",-1)])),_:1,__:[26]})]),_:1})]),default:h(()=>[e("div",Es,[e("div",Ss,[e("div",Vs,[e("div",Ts,[t[28]||(t[28]=e("div",{class:"flex-shrink-0"},[e("svg",{class:"w-8 h-8 text-blue-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 7V3a1 1 0 011-1h6a1 1 0 011 1v4m4 0V9a2 2 0 00-2-2H6a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V9a2 2 0 00-2-2m-4 0H8"})])],-1)),e("div",Ps,[t[27]||(t[27]=e("div",{class:"text-sm font-medium text-gray-500"},"Total Work Orders",-1)),e("div",Os,c(s(y).length),1)])])]),e("div",$s,[e("div",Ms,[t[30]||(t[30]=e("div",{class:"flex-shrink-0"},[e("svg",{class:"w-8 h-8 text-yellow-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})])],-1)),e("div",As,[t[29]||(t[29]=e("div",{class:"text-sm font-medium text-gray-500"},"Due This Week",-1)),e("div",Is,c(oe.value),1)])])]),e("div",Ns,[e("div",Us,[t[32]||(t[32]=e("div",{class:"flex-shrink-0"},[e("svg",{class:"w-8 h-8 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.854-.833-2.598 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"})])],-1)),e("div",Rs,[t[31]||(t[31]=e("div",{class:"text-sm font-medium text-gray-500"},"Overdue",-1)),e("div",Fs,c(re.value),1)])])]),e("div",Ws,[e("div",Ls,[t[34]||(t[34]=e("div",{class:"flex-shrink-0"},[e("svg",{class:"w-8 h-8 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})])],-1)),e("div",Bs,[t[33]||(t[33]=e("div",{class:"text-sm font-medium text-gray-500"},"Completed This Month",-1)),e("div",zs,c(ae.value),1)])])])]),m(Cs,{title:"Work Orders & Maintenance Calendar","show-work-orders":!0,"show-preventive-maintenance":!0,"show-asset-inspections":!1,"show-scheduled-downtime":!1,onCreateWorkOrder:l.handleCreateWorkOrder,onEditWorkOrder:ie,onCreatePmSchedule:n,onEditPmSchedule:a,onGenerateWorkOrderFromPm:g,onCreateEventAtTime:w},null,8,["onCreateWorkOrder"]),e("div",Hs,[t[37]||(t[37]=e("div",{class:"lg:col-span-2"},null,-1)),e("div",js,[e("div",Gs,[t[35]||(t[35]=e("div",{class:"px-4 py-3 border-b border-gray-200 bg-gray-50"},[e("h3",{class:"text-sm font-medium text-gray-900"},"Upcoming Work Orders")],-1)),e("div",qs,[(d(!0),u(C,null,E(le.value,r=>(d(),u("div",{key:r.id,class:"p-4 hover:bg-gray-50 cursor-pointer transition-colors",onClick:x=>ie(r.id)},[e("div",Ys,[e("div",Qs,[e("h4",Js,c(r.title),1),e("p",Xs,c(r.workOrderId),1),e("div",Zs,[m(s(Q),{variant:s(X)(r.status),size:"sm"},{default:h(()=>[k(c(s(pe)(r.status)),1)]),_:2},1032,["variant"]),e("span",eo,c(I(r.dueDate)),1)])]),e("div",to,c(F(r.dueDate)),1)])],8,Ks))),128))]),le.value.length===0?(d(),u("div",so," No upcoming work orders ")):v("",!0)]),e("div",oo,[t[36]||(t[36]=e("div",{class:"px-4 py-3 border-b border-gray-200 bg-gray-50"},[e("h3",{class:"text-sm font-medium text-gray-900"},"Today's Schedule")],-1)),e("div",ro,[(d(!0),u(C,null,E(ge.value,r=>(d(),u("div",{key:r.id,class:"p-4 hover:bg-gray-50 cursor-pointer transition-colors",onClick:x=>ie(r.id)},[e("div",lo,[e("div",no,[e("h4",io,c(r.title),1),e("p",uo,c(r.workOrderId),1)]),m(s(Q),{variant:s(X)(r.status),size:"sm"},{default:h(()=>[k(c(s(pe)(r.status)),1)]),_:2},1032,["variant"])])],8,ao))),128))]),ge.value.length===0?(d(),u("div",co," No work orders scheduled for today ")):v("",!0)])])])]),m(s(Ie),{modelValue:M.value,"onUpdate:modelValue":t[24]||(t[24]=r=>M.value=r),title:ve.value,size:"xl",onConfirm:f,onCancel:i},{footer:h(()=>[e("div",Uo,[e("div",Ro,[s(q)||s(K)?(d(),u("div",Fo,[s(q)?(d(),u("svg",Wo,t[53]||(t[53]=[e("path",{"fill-rule":"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z","clip-rule":"evenodd"},null,-1)]))):(d(),u("svg",Lo,t[54]||(t[54]=[e("path",{"fill-rule":"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z","clip-rule":"evenodd"},null,-1)]))),s(q)?(d(),u("span",Bo,"Auto-saving...")):s(K)?(d(),u("span",zo,"Last saved "+c(Y.value),1)):v("",!0)])):v("",!0),b.value!=="basic"?(d(),ce(s(O),{key:1,variant:"outline",size:"sm",onClick:t[22]||(t[22]=r=>Pe("previous"))},{default:h(()=>t[55]||(t[55]=[k(" ← Previous ",-1)])),_:1,__:[55]})):v("",!0)]),e("div",Ho,[m(s(O),{variant:"secondary",onClick:i},{default:h(()=>t[56]||(t[56]=[k(" Cancel ",-1)])),_:1,__:[56]}),b.value!=="options"?(d(),ce(s(O),{key:0,variant:"outline",onClick:t[23]||(t[23]=r=>Pe("next"))},{default:h(()=>t[57]||(t[57]=[k(" Next → ",-1)])),_:1,__:[57]})):v("",!0),m(s(O),{variant:"primary",loading:s(S),onClick:f},{default:h(()=>[k(c(V.value==="create"?"Create Work Order":"Update Work Order"),1)]),_:1},8,["loading"])])])]),default:h(()=>[e("div",mo,[m(s(pt),{modelValue:b.value,"onUpdate:modelValue":t[0]||(t[0]=r=>b.value=r),tabs:R,onTabChange:Re},null,8,["modelValue"])]),m(s(vt),{visible:H.value,"saved-data-info":j.value,onRestore:Ne,onDismiss:Ue},null,8,["visible","saved-data-info"]),e("div",po,[b.value==="basic"?(d(),u("div",vo,[m(ut,{modelValue:s(o).workOrderId,"onUpdate:modelValue":t[1]||(t[1]=r=>s(o).workOrderId=r),category:s(o).category,location:s(o).location,disabled:s(S),"allow-manual-entry":!0},null,8,["modelValue","category","location","disabled"]),m(s(ue),{modelValue:s(o).title,"onUpdate:modelValue":t[2]||(t[2]=r=>s(o).title=r),label:"Title",placeholder:"Enter work order title",required:""},null,8,["modelValue"]),m(s(ue),{modelValue:s(o).description,"onUpdate:modelValue":t[3]||(t[3]=r=>s(o).description=r),label:"Description",placeholder:"Enter work order description",type:"textarea",rows:"4"},null,8,["modelValue"]),e("div",go,[m(s(U),{modelValue:s(o).priority,"onUpdate:modelValue":t[4]||(t[4]=r=>s(o).priority=r),label:"Priority",options:s(he),required:""},null,8,["modelValue","options"]),m(s(U),{modelValue:s(o).category,"onUpdate:modelValue":t[5]||(t[5]=r=>s(o).category=r),label:"Category",options:s(D),placeholder:"Select category"},null,8,["modelValue","options"])]),e("div",fo,[m(s(U),{modelValue:s(o).asset,"onUpdate:modelValue":t[6]||(t[6]=r=>s(o).asset=r),label:"Asset",options:s(me),placeholder:"Select asset"},null,8,["modelValue","options"]),m(s(U),{modelValue:s(o).location,"onUpdate:modelValue":t[7]||(t[7]=r=>s(o).location=r),label:"Location",options:s(ke),placeholder:"Select location"},null,8,["modelValue","options"])]),e("div",yo,[m(rt,{modelValue:s(o).tasks,"onUpdate:modelValue":t[8]||(t[8]=r=>s(o).tasks=r),disabled:s(S),"show-templates":!0},null,8,["modelValue","disabled"])])])):v("",!0),b.value==="assignment"?(d(),u("div",xo,[m(s(U),{modelValue:s(o).primaryUser,"onUpdate:modelValue":t[9]||(t[9]=r=>s(o).primaryUser=r),label:"Primary Assignee",options:s(N),placeholder:"Select primary user"},null,8,["modelValue","options"]),m(s(U),{modelValue:s(o).team,"onUpdate:modelValue":t[10]||(t[10]=r=>s(o).team=r),label:"Team",options:s(be),placeholder:"Select team"},null,8,["modelValue","options"]),t[38]||(t[38]=e("div",{class:"bg-gray-50 p-4 rounded-lg"},[e("h4",{class:"text-sm font-medium text-gray-900 mb-2"},"Assignment Notes"),e("p",{class:"text-sm text-gray-600"}," The primary assignee will be the main person responsible for this work order. If a team is selected, all team members will have access to this work order. ")],-1))])):v("",!0),b.value==="scheduling"?(d(),u("div",ho,[e("div",ko,[m(s(ue),{modelValue:s(o).estimatedStartDate,"onUpdate:modelValue":t[11]||(t[11]=r=>s(o).estimatedStartDate=r),label:"Planned Start Date",type:"datetime-local"},null,8,["modelValue"]),m(s(ue),{modelValue:s(o).dueDate,"onUpdate:modelValue":t[12]||(t[12]=r=>s(o).dueDate=r),label:"Due Date",type:"datetime-local"},null,8,["modelValue"])]),m(s(ue),{modelValue:s(o).estimatedDuration,"onUpdate:modelValue":t[13]||(t[13]=r=>s(o).estimatedDuration=r),label:"Estimated Duration (hours)",type:"number",min:"0",step:"0.5",placeholder:"e.g. 2.5"},null,8,["modelValue"]),t[39]||(t[39]=e("div",{class:"bg-blue-50 p-4 rounded-lg"},[e("h4",{class:"text-sm font-medium text-blue-900 mb-2"},"Scheduling Tips"),e("ul",{class:"text-sm text-blue-800 space-y-1"},[e("li",null,"• Set realistic start and due dates based on priority and complexity"),e("li",null,"• Estimated duration helps with resource planning"),e("li",null,"• Consider dependencies on other work orders"),e("li",null,"• Start date defaults to current time for immediate work")])],-1)),e("div",bo,[m(nt,{modelValue:s(o).timeEntries,"onUpdate:modelValue":t[14]||(t[14]=r=>s(o).timeEntries=r),disabled:s(S),"user-options":s(N),"current-user":A.value},null,8,["modelValue","disabled","user-options","current-user"])])])):v("",!0),b.value==="parts"?(d(),u("div",wo,[m(at,{modelValue:s(o).parts,"onUpdate:modelValue":t[15]||(t[15]=r=>s(o).parts=r),disabled:s(S)},null,8,["modelValue","disabled"])])):v("",!0),b.value==="attachments"?(d(),u("div",_o,[e("div",null,[t[40]||(t[40]=e("label",{class:"block text-sm font-medium text-gray-700 mb-2"}," Primary Image ",-1)),t[41]||(t[41]=e("p",{class:"text-sm text-gray-500 mb-3"}," Upload a main image that represents this work order (before photos, equipment images, etc.) ",-1)),m(s($e),{modelValue:s(o).image,"onUpdate:modelValue":t[16]||(t[16]=r=>s(o).image=r),accept:"image/*",multiple:!1,uploading:s(p),"upload-progress":s(L),onFilesAdded:Fe},null,8,["modelValue","uploading","upload-progress"])]),e("div",null,[t[42]||(t[42]=e("label",{class:"block text-sm font-medium text-gray-700 mb-2"}," Audio Notes ",-1)),t[43]||(t[43]=e("p",{class:"text-sm text-gray-500 mb-3"}," Record voice notes, observations, or instructions for this work order ",-1)),m(lt,{modelValue:s(o).audioRecordings,"onUpdate:modelValue":t[17]||(t[17]=r=>s(o).audioRecordings=r),"work-order-id":V.value==="edit"?z.value:null,"current-user":A.value,"auto-transcribe":!0,"enable-visualization":!0,"auto-save":!1,onRecordingSaved:qe},null,8,["modelValue","work-order-id","current-user"])]),e("div",null,[t[50]||(t[50]=e("label",{class:"block text-sm font-medium text-gray-700 mb-2"}," Additional Files ",-1)),t[51]||(t[51]=e("p",{class:"text-sm text-gray-500 mb-3"}," Upload manuals, documentation, additional photos, or other relevant files ",-1)),e("div",Do,[t[45]||(t[45]=e("svg",{class:"mx-auto h-12 w-12 text-gray-400",stroke:"currentColor",fill:"none",viewBox:"0 0 48 48"},[e("path",{d:"M28 8H12a4 4 0 00-4 4v20m32-12v8m0 0v8a4 4 0 01-4 4H12a4 4 0 01-4-4v-4m32-4l-3.172-3.172a4 4 0 00-5.656 0L28 28M8 32l9.172-9.172a4 4 0 015.656 0L28 28m0 0l4 4m4-24h8m-4-4v8m-12 4h.02","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)),e("div",Co,[e("label",Eo,[t[44]||(t[44]=e("span",{class:"mt-2 block text-sm font-medium text-gray-900"}," Drop files here or click to upload ",-1)),e("input",{type:"file",class:"sr-only",multiple:"",accept:"image/*,application/pdf,.doc,.docx,.txt",onChange:Le},null,32)])]),t[46]||(t[46]=e("p",{class:"mt-2 text-xs text-gray-500"}," PNG, JPG, PDF, DOC, TXT up to 10MB each (max 10 files) ",-1))]),s(o).files&&s(o).files.length>0?(d(),u("div",So,[(d(!0),u(C,null,E(s(o).files,(r,x)=>(d(),u("div",{key:x,class:"flex items-center justify-between p-3 bg-gray-50 rounded-lg border"},[e("div",Vo,[t[47]||(t[47]=e("svg",{class:"w-5 h-5 text-gray-400 mr-3",fill:"currentColor",viewBox:"0 0 20 20"},[e("path",{"fill-rule":"evenodd",d:"M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4zm2 6a1 1 0 011-1h6a1 1 0 110 2H7a1 1 0 01-1-1zm1 3a1 1 0 100 2h6a1 1 0 100-2H7z","clip-rule":"evenodd"})],-1)),e("div",null,[e("span",To,c(r.name||"Untitled File"),1),e("div",Po,c(ze(r.size||0))+" • Uploaded "+c(He(r.uploadedAt)),1)])]),m(s(O),{variant:"ghost",size:"sm",onClick:P=>Be(x),class:"text-red-600 hover:text-red-800"},{default:h(()=>t[48]||(t[48]=[e("svg",{class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})],-1)])),_:2,__:[48]},1032,["onClick"])]))),128))])):v("",!0),e("div",Oo,[e("details",null,[t[49]||(t[49]=e("summary",{class:"cursor-pointer hover:text-gray-700"},"Alternative Upload Method",-1)),e("div",$o,[m(s($e),{modelValue:s(o).files,"onUpdate:modelValue":t[18]||(t[18]=r=>s(o).files=r),accept:"image/*,application/pdf,.doc,.docx,.txt",multiple:!0,"max-files":10,uploading:s(p),"upload-progress":s(L),onFilesAdded:We},null,8,["modelValue","uploading","upload-progress"])])])])])])):v("",!0),b.value==="options"?(d(),u("div",Mo,[m(s(mt),{modelValue:s(o).requiredSignature,"onUpdate:modelValue":t[19]||(t[19]=r=>s(o).requiredSignature=r),label:"Require signature for completion"},null,8,["modelValue"]),t[52]||(t[52]=e("div",{class:"bg-gray-50 p-4 rounded-lg"},[e("h4",{class:"text-sm font-medium text-gray-900 mb-2"},"Additional Options"),e("p",{class:"text-sm text-gray-600 mb-3"}," Configure special requirements and completion settings for this work order. "),e("ul",{class:"text-sm text-gray-600 space-y-1"},[e("li",null,[k("• "),e("strong",null,"Signature Required:"),k(" Technician must provide digital signature upon completion")]),e("li",null,"• More options will be available in future updates")])],-1)),e("div",Ao,[m(it,{modelValue:s(o).costTracking,"onUpdate:modelValue":t[20]||(t[20]=r=>s(o).costTracking=r),parts:s(o).parts,"time-entries":s(o).timeEntries,disabled:s(S)},null,8,["modelValue","parts","time-entries","disabled"])]),e("div",Io,[m(dt,{modelValue:s(o).statusHistory,"onUpdate:modelValue":t[21]||(t[21]=r=>s(o).statusHistory=r),"current-status":s(o).status,"audit-entries":s(o).auditTrail,"user-options":s(N),"current-user":A.value,disabled:s(S),onStatusChange:je},null,8,["modelValue","current-status","audit-entries","user-options","current-user","disabled"])]),e("div",No,[m(ct,{"work-order":s(o),disabled:s(S),onReportGenerated:Ge},null,8,["work-order","disabled"])])])):v("",!0)])]),_:1},8,["modelValue","title"])]),_:1}))}},mr=Me(jo,[["__scopeId","data-v-4f6f1a42"]]);export{mr as default};