oceanhelm 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- (function(c,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(c=typeof globalThis<"u"?globalThis:c||self,e(c.OceanHelm={},c.Vue))})(this,function(c,e){"use strict";const kl="",m=(l,t)=>{const s=l.__vccOpts||l;for(const[a,o]of t)s[a]=o;return s},V={name:"ConfigurableSidebar",props:{brandName:{type:String,default:"OceanHelm"},logoIcon:{type:String,default:"bi bi-water"},showLogo:{type:Boolean,default:!0},menuItems:{type:Array,required:!0,default:()=>[]},userProfile:{type:Object,default:()=>({})},responsive:{type:Boolean,default:!0},customClasses:{type:String,default:""},permissionChecker:{type:Function,default:null}},computed:{sidebarClasses(){return this.customClasses},filteredMenuItems(){return this.menuItems.filter(l=>this.hasPermission(l))}},mounted(){this.responsive&&this.initializeResponsiveBehavior()},methods:{hasPermission(l){return this.permissionChecker?this.permissionChecker(l,this.userProfile):!l.roles||l.roles.length===0?!0:l.roles.includes(this.userProfile.role)},handleNavigation(l){var t;this.$emit("navigate",l),l.href&&!l.preventDefault&&(l.external?window.open(l.href,"_blank"):(t=this.$router)==null||t.push(l.href))},handleAction(l){this.$emit("action",l)},handleItemClick(l){this.$emit("item-click",l),l.type},initializeResponsiveBehavior(){const l=document.getElementById("sidebarToggle"),t=document.getElementById("sidebar"),s=document.getElementById("content");!l||!t||!s||(window.innerWidth>=768&&(t.classList.toggle("active"),s.classList.toggle("active")),l.addEventListener("click",()=>{t.classList.toggle("active"),s.classList.toggle("active")}),document.addEventListener("click",a=>{const o=t.contains(a.target),i=l.contains(a.target);!o&&!i&&window.innerWidth<768&&t.classList.contains("active")&&(t.classList.remove("active"),s.classList.remove("active"))}))}},emits:["navigate","action","item-click"]},N={key:0,class:"logo d-flex align-items-center left"},k={class:"list-unstyled components mt-4"},b=["onClick"],w=["href","onClick"],C=["onClick"],u={class:"dropdown-toggle",type:"button","data-bs-toggle":"dropdown","aria-expanded":"false"},D={class:"dropdown-menu","aria-labelledby":"dropdownMenuLink"},S=["onClick"],B={key:3,class:"dropdown-divider"},_={key:4};function x(l,t,s,a,o,i){return e.openBlock(),e.createElementBlock("nav",{id:"sidebar",class:e.normalizeClass(i.sidebarClasses)},[s.showLogo?(e.openBlock(),e.createElementBlock("div",N,[e.createElementVNode("i",{class:e.normalizeClass([s.logoIcon,"me-2"])},null,2),e.createElementVNode("span",null,e.toDisplayString(s.brandName),1)])):e.createCommentVNode("",!0),e.createElementVNode("ul",k,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.filteredMenuItems,(n,r)=>(e.openBlock(),e.createElementBlock("li",{key:r,class:e.normalizeClass({active:n.active,dropdown:n.type==="dropdown"}),onClick:d=>i.handleItemClick(n)},[n.type==="link"?(e.openBlock(),e.createElementBlock("a",{key:0,href:n.href||"#",onClick:e.withModifiers(d=>i.handleNavigation(n),["prevent"])},[n.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(n.icon)},null,2)):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(n.label),1)],8,w)):n.type==="button"?(e.openBlock(),e.createElementBlock("a",{key:1,onClick:e.withModifiers(d=>i.handleAction(n),["prevent"]),style:{cursor:"pointer"}},[n.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(n.icon)},null,2)):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(n.label),1)],8,C)):n.type==="dropdown"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("a",u,[n.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(n.icon)},null,2)):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(n.label),1)]),e.createElementVNode("div",D,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.children,(d,Nl)=>(e.openBlock(),e.createElementBlock("a",{key:Nl,class:"dropdown-item black",onClick:e.withModifiers(Sl=>i.handleAction(d),["prevent"]),style:{cursor:"pointer"}},e.toDisplayString(d.label),9,S))),128))])],64)):n.type==="separator"?(e.openBlock(),e.createElementBlock("div",B)):n.type==="text"?(e.openBlock(),e.createElementBlock("a",_,e.toDisplayString(n.label),1)):e.createCommentVNode("",!0)],10,b))),128))]),e.renderSlot(l.$slots,"footer",{},void 0,!0)],2)}const p=m(V,[["render",x],["__scopeId","data-v-5c9320f4"]]),bl="",T={name:"VesselList",props:{vessels:{type:Array,required:!0,default:()=>[]},userProfile:{type:Object,required:!0,default:()=>({role:"viewer",vessel:null})},loading:{type:Boolean,default:!1},currentRoute:{type:String,default:"dashboard"},config:{type:Object,default:()=>({enableAdd:!0,enableEdit:!0,enableDelete:!0,enableStatusToggle:!0,showCertifications:!0})}},emits:["vessel-add","vessel-click","vessel-edit","vessel-delete","vessel-toggle-status","vessel-navigate","access-denied"],computed:{activeVesselsCount(){return this.vessels.filter(l=>l.status==="Active").length},inactiveVesselsCount(){return this.vessels.filter(l=>l.status==="Inactive").length},canAddVessel(){return this.config.enableAdd&&(this.userProfile.role==="owner"||this.userProfile.role==="staff")}},methods:{handleAddVessel(){if(!this.canAddVessel){this.handleAccessDenied("add vessel");return}this.$emit("vessel-add")},handleVesselClick(l){const t={vessel:l,route:this.currentRoute,id:l.registrationNumber,name:l.name};this.currentRoute==="dashboard"?this.$emit("vessel-click",l):this.$emit("vessel-navigate",t)},handleDeleteVessel(l){if(!this.grantAccess(l)){this.handleAccessDenied("delete vessel");return}this.config.enableDelete&&this.$emit("vessel-delete",l)},handleToggleStatus(l){if(!this.grantAccess(l)){this.handleAccessDenied("change vessel status");return}this.config.enableStatusToggle&&this.$emit("vessel-toggle-status",l)},handleEditVessel(l){if(!this.grantAccess(l)){this.handleAccessDenied("edit vessel");return}this.config.enableEdit&&this.$emit("vessel-edit",l)},handleAccessDenied(l){this.$emit("access-denied",{action:l,userProfile:this.userProfile})},statusClass(l){return`status-${(l==null?void 0:l.toLowerCase())||""}`},grantAccess(l){const{role:t,vessel:s}=this.userProfile;return t==="owner"||t==="staff"||t==="captain"&&s===l.name},getDaysToExpiry(l){if(!l)return null;const t=new Date,a=new Date(l)-t;return Math.ceil(a/(1e3*60*60*24))},getExpiryClass(l){const t=this.getDaysToExpiry(l);return t===null?"":t<30?"cert-critical":t<90?"cert-warning":""}}},A={class:"row mb-3"},M={class:"col-md-4"},P={class:"card border-0 shadow-sm"},L={class:"card-body d-flex align-items-center"},F={class:"mt-2 mb-0"},U={class:"col-md-4"},I={class:"card border-0 shadow-sm"},R={class:"card-body d-flex align-items-center"},O={class:"mt-2 mb-0"},H={key:0,class:"col-md-4"},z={key:0,class:"text-center py-4"},q={key:1,class:"alert alert-primary",role:"alert"},j={key:2,class:"row"},$=["onClick"],Q={class:"card-body d-flex align-items-center"},Y={class:"flex-grow-1"},K={class:"d-flex justify-content-between align-items-center mb-2"},W={class:"card-title mb-0"},G={class:"row"},J={class:"col-6"},X={class:"mb-0"},Z={class:"col-6"},v={class:"mb-0"},ee={class:"action-icon left delete"},te=["onClick"],ne=["onClick"];function le(l,t,s,a,o,i){return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",A,[e.createElementVNode("div",M,[e.createElementVNode("div",P,[e.createElementVNode("div",L,[t[2]||(t[2]=e.createElementVNode("div",{class:"rounded-circle bg-primary bg-opacity-10 p-3 me-3"},[e.createElementVNode("i",{class:"bi bi-check-circle-fill text-primary fs-4"})],-1)),e.createElementVNode("div",null,[t[1]||(t[1]=e.createElementVNode("h6",{class:"mb-0"},"Active Vessels",-1)),e.createElementVNode("h3",F,e.toDisplayString(i.activeVesselsCount),1)])])])]),e.createElementVNode("div",U,[e.createElementVNode("div",I,[e.createElementVNode("div",R,[t[4]||(t[4]=e.createElementVNode("div",{class:"rounded-circle bg-secondary bg-opacity-10 p-3 me-3"},[e.createElementVNode("i",{class:"bi bi-pause-circle-fill text-secondary fs-4"})],-1)),e.createElementVNode("div",null,[t[3]||(t[3]=e.createElementVNode("h6",{class:"mb-0"},"Inactive",-1)),e.createElementVNode("h3",O,e.toDisplayString(i.inactiveVesselsCount),1)])])])]),i.canAddVessel?(e.openBlock(),e.createElementBlock("div",H,[e.createElementVNode("div",{class:"card border-0 shadow-sm",onClick:t[0]||(t[0]=(...n)=>i.handleAddVessel&&i.handleAddVessel(...n))},t[5]||(t[5]=[e.createElementVNode("div",{class:"card-body d-flex align-items-center"},[e.createElementVNode("div",{class:"rounded-circle bg-success bg-opacity-10 p-3 me-3"},[e.createElementVNode("i",{class:"bi bi-patch-plus-fill text-success fs-4"})]),e.createElementVNode("div",null,[e.createElementVNode("h6",{class:"mb-0"},"Add New Vessel")])],-1)]))])):e.createCommentVNode("",!0)]),t[11]||(t[11]=e.createElementVNode("h4",{class:"mb-4"},[e.createElementVNode("i",{class:"bi bi-ship me-2"}),e.createTextVNode("Registered Vessels")],-1)),s.loading?(e.openBlock(),e.createElementBlock("div",z,t[6]||(t[6]=[e.createElementVNode("div",{class:"spinner-border text-primary",role:"status"},[e.createElementVNode("span",{class:"visually-hidden"},"Loading...")],-1),e.createElementVNode("p",{class:"mt-2"},"Loading vessels...",-1)]))):s.vessels.length?(e.openBlock(),e.createElementBlock("div",j,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.vessels,n=>(e.openBlock(),e.createElementBlock("div",{class:"col-lg-6",key:n.registrationNumber||n.id},[e.createElementVNode("div",{class:"vessel-card",onClick:r=>i.handleVesselClick(n)},[e.createElementVNode("div",Q,[t[10]||(t[10]=e.createElementVNode("div",{class:"vessel-icon left"},[e.createElementVNode("i",{class:"fas fa-ship"})],-1)),e.createElementVNode("div",Y,[e.createElementVNode("div",K,[e.createElementVNode("h5",W,e.toDisplayString(n.name),1),e.createElementVNode("span",{class:e.normalizeClass(["vessel-status",i.statusClass(n.status)])},e.toDisplayString(n.status),3)]),e.createElementVNode("div",G,[e.createElementVNode("div",J,[t[8]||(t[8]=e.createElementVNode("small",{class:"text-muted"},"Registration #:",-1)),e.createElementVNode("p",X,e.toDisplayString(n.registrationNumber),1)]),e.createElementVNode("div",Z,[t[9]||(t[9]=e.createElementVNode("small",{class:"text-muted"},"Next Maintenance:",-1)),e.createElementVNode("p",v,e.toDisplayString(n.nextMaintenance||"Not scheduled"),1)])])])]),e.createElementVNode("div",ee,[e.createElementVNode("i",{class:"bi bi-trash",onClick:e.withModifiers(r=>i.handleDeleteVessel(n),["stop"])},null,8,te)]),e.createElementVNode("button",{class:"btn btn-primary",onClick:e.withModifiers(r=>i.handleToggleStatus(n),["stop"])},e.toDisplayString(n.status==="Active"?"Mark Inactive":"Mark Active"),9,ne)],8,$)]))),128))])):(e.openBlock(),e.createElementBlock("div",q,t[7]||(t[7]=[e.createElementVNode("h4",{class:"alert-heading"},"Empty Fleet!",-1),e.createElementVNode("p",null,"You have an empty fleet, you have not added any vessel yet.",-1),e.createElementVNode("hr",null,null,-1),e.createElementVNode("p",{class:"mb-0"},"Click on the add vessel button above, to start adding vessels to your fleet",-1)])))],64)}const h=m(T,[["render",le]]),wl="",oe={name:"DashHead",props:{name:{type:String,required:!0},userProfile:{type:Object,required:!0,default:()=>({role:"viewer",vessel:null})}},emits:["add-user","logged-in"],methods:{addUser(){this.$emit("add-user")},loggedIn(){this.$emit("logged-in")}}},se={class:"page-header d-flex justify-content-between align-items-center"},ie={style:{"margin-left":"20px"}},re={class:"d-flex"};function ae(l,t,s,a,o,i){return e.openBlock(),e.createElementBlock("div",se,[e.createElementVNode("h2",ie,e.toDisplayString(s.name),1),e.createElementVNode("div",re,[this.userProfile.role=="owner"?(e.openBlock(),e.createElementBlock("button",{key:0,class:"btn btn-outline-primary me-2",onClick:t[0]||(t[0]=n=>i.addUser())},t[2]||(t[2]=[e.createElementVNode("i",{class:"bi bi-bell"},null,-1),e.createElementVNode("span",{class:"badge bg-danger"},"1",-1)]))):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"btn btn-outline-primary",onClick:t[1]||(t[1]=n=>i.loggedIn())},t[3]||(t[3]=[e.createElementVNode("i",{class:"bi bi-person-circle"},null,-1)]))])])}const f=m(oe,[["render",ae]]),Cl="",de={name:"OceanHelmMaintenance",props:{vesselInfo:{type:Object,required:!0},tasks:{type:Array,default:()=>[]},vesselCrew:{type:Array,default:()=>[]},companyInfo:{type:Object,default:()=>({})},userProfile:{type:Object,required:!0}},emits:["dashboard-navigate","load-checklist","save-schedule","update-task","upload-file","delete-evidence","access-denied","show-message","generate-checklist"],data(){return{ready:!0,isSaving:!1,after:null,lastSection:"",currentTask:"",imgText:"Choose file to upload",fileText:"Drag and drop files here or",fileattachments:{},refreshKey:0,activeSection:"inventory",sections:[{id:"schedule",name:"Schedule",icon:"📅"},{id:"inventory",name:"All Maintenance",icon:"♻️"},{id:"dashboard",name:"Dashboard",icon:"☰",onClick:()=>this.$emit("dashboard-navigate")}],activeFilter:"all",searchQuery:"",checklists:[],isLoading:!1,form:{taskName:"",description:"",maintenanceType:"",component:"",priority:"",dueDate:"",estimatedHours:null,assignedTo:"",recurrence:"",lastPerformed:"",nextDue:"",notifyEmail:!0,notifySms:!0,reminderDays:"1",estimatedDuration:null,notes:"",status:"Soon",email:"",remainingDays:null,attachments:{}},maintenanceTasks:[],showReport:!1,reportDate:new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}),reportId:"MT-"+Math.random().toString(36).substr(2,9).toUpperCase()}},watch:{"form.lastPerformed":"calculateNextDue","form.recurrence":"calculateNextDue","form.nextDue":function(l){this.calculateRemainingDays()}},computed:{filteredTasks(){let l=[...this.tasks];if(this.activeFilter==="all"?l=l.filter(t=>t.status==="Overdue"||t.status==="Soon"||t.status==="Completed"):this.activeFilter==="due"?l=l.filter(t=>t.status==="Overdue"||t.status==="Soon"):this.activeFilter==="completed"&&(l=l.filter(t=>t.status==="Completed")),this.searchQuery){const t=this.searchQuery.toLowerCase();l=l.filter(s=>s.component.toLowerCase().includes(t)||s.taskName.toLowerCase().includes(t)||s.assignedTo.toLowerCase().includes(t))}return l},completedCount(){return this.checklists.filter(l=>l.completed)},progress(){return Math.round(this.completedCount.length/this.checklists.length*100)},checklistButtonLabel(){return this.lastSection==="schedule"?"Approve Maintenance":"Save Checklist"},showAddTaskButton(){return this.checklistButtonLabel!=="Save Checklist"},totalEstimatedHours(){return this.maintenanceTasks.reduce((l,t)=>l+(t.estimatedHours||0),0)}},methods:{grantAccess(l){const t=this.userProfile;return t.role==="owner"||t.role==="staff"||t.role==="captain"&&t.vessel===l},deepAccess(){const l=this.userProfile;return l.role==="owner"||l.role==="captain"?!0:(this.$emit("access-denied","You do not have access to do this"),!1)},deleteTask(l){this.checklists=this.checklists.filter(t=>t.id!==l)},addTask(l){l&&l.preventDefault(),this.$emit("show-message",{type:"prompt",title:"Add New Task",message:"Enter the task details",callback:t=>{if(t){const s={id:Date.now(),text:t,completed:!1};this.checklists.push(s)}}})},setFilter(l){this.activeFilter=l},loadChecklist(l){this.isLoading=!0,this.$emit("generate-checklist",{component:l,callback:t=>{this.checklists=t.map(s=>({...s,completed:!1})),this.isLoading=!1}})},showMaintenance(l){if(this.deepAccess()){const t=this.tasks.find(s=>s.component===l);t&&t.checklistProgress?this.checklists=[...t.checklistProgress]:this.loadChecklist(l),this.after=t==null?void 0:t.after,this.currentTask=l,this.lastSection="inventory",this.activeSection="maintenance"}},printMaintenance(l){const t=this.tasks.find(s=>s.component===l);this.maintenanceTasks=[t],this.loadMaintenanceData(),this.showReport=!0,this.$nextTick(()=>{setTimeout(()=>{window.print(),this.showReport=!1},100)})},switchSchedule(){this.deepAccess()&&(this.activeSection="schedule")},handleFiles(l){this.imgText=l.target.files[0].name,this.form.attachments={file:l.target.files[0]}},handleImg(l){this.fileText=l.target.files[0].name,this.fileattachments={file:l.target.files[0]}},validateForm(){const l=["taskName","description","maintenanceType","component","priority","estimatedHours","recurrence","lastPerformed","assignedTo"];for(const t of l)if(!this.form[t])return this.$emit("show-message",{type:"error",title:"Missing info",message:`Please fill in the required field: ${t}`}),!1;return!0},handleSectionClick(l){this.activeSection=l.id,typeof l.onClick=="function"&&l.onClick()},calculateNextDue(){const l=this.form.lastPerformed?new Date(this.form.lastPerformed):null,t=this.form.recurrence;if(!l||!t)return;let s=new Date(l);switch(t){case"daily":s.setDate(s.getDate()+1);break;case"weekly":s.setDate(s.getDate()+7);break;case"monthly":s.setMonth(s.getMonth()+1);break;case"quarterly":s.setMonth(s.getMonth()+3);break;case"semi-annual":s.setMonth(s.getMonth()+6);break;case"annual":s.setFullYear(s.getFullYear()+1);break;case"once":case"custom":return}this.form.nextDue=s.toISOString().split("T")[0]},calculateRemainingDays(){if(!this.form.nextDue){this.form.remainingDays=null;return}const l=new Date,t=new Date(this.form.nextDue);l.setHours(0,0,0,0),t.setHours(0,0,0,0);const s=t-l,a=Math.ceil(s/(1e3*60*60*24));this.form.remainingDays=`${a} Days`},async saveSchedule(){if(this.isSaving=!0,!this.validateForm()){this.isSaving=!1;return}const l={...this.form};if(this.form.component==="Other"&&this.form.customComponent&&(l.component=this.form.customComponent),l.email=this.companyInfo.email,this.tasks.some(s=>s.component===l.component)){this.$emit("show-message",{type:"error",title:"Duplicate Component",message:`A task with the component "${l.component}" already exists in maintenance`}),this.isSaving=!1;return}delete l.customComponent,this.$emit("save-schedule",{taskData:l,file:l.attachments.file,callback:s=>{this.isSaving=!1,s&&(this.loadChecklist(l.component),this.lastSection="schedule",this.currentTask=l.component,this.resetForm(),this.activeSection="maintenance")}})},resetForm(){this.form={taskName:"",description:"",maintenanceType:"",component:"",priority:"",dueDate:"",estimatedHours:null,assignedTo:"",recurrence:"",lastPerformed:"",nextDue:"",notifyEmail:!0,notifySms:!0,reminderDays:"1",estimatedDuration:null,notes:"",status:"Soon",remainingDays:null,attachments:{}}},toggleTask(l){l.completed=!l.completed},async resetTasks(){const t=this.checklists.every(a=>a.completed)?"Completed":"In Progress",s={checklistProgress:[...this.checklists],status:t,component:this.currentTask,after:this.after};this.$emit("update-task",{updateData:s,file:this.fileattachments.file,callback:(a,o)=>{a&&(o&&(this.after=o),this.fileattachments={},this.fileText="Drag and drop files here or",this.refreshKey+=1,this.activeSection="inventory")}})},loadMaintenanceData(){this.reportId="MT-"+Math.random().toString(36).substr(2,9).toUpperCase(),this.reportDate=new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})},formatDate(l){return l?new Date(l).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"N/A"},getTaskStatusClass(l){return l.status==="Completed"?"completed":l.status==="Overdue"?"overdue":l.status==="In Progress"?"in-progress":"pending"},getChecklistProgress(l){if(!l.checklistProgress||l.checklistProgress.length===0)return 0;const t=l.checklistProgress.filter(s=>s.completed).length;return Math.round(t/l.checklistProgress.length*100)},getCompletedChecklistItems(l){return l.checklistProgress?l.checklistProgress.filter(t=>t.completed).length:0},generateRecommendations(){return["Maintain regular communication with assigned technicians","Ensure all safety protocols are followed during maintenance activities","Update task progress and notes in real-time for accurate reporting"]},deleteEvidence(){this.$emit("delete-evidence",{currentTask:this.currentTask,callback:l=>{l&&(this.after=null,this.fileText="Drag and drop files here or",this.fileattachments={},this.refreshKey+=1)}})}}},ce={key:0},me=["onClick"],pe={class:"content"},he={key:0,class:"loading-container"},fe={key:1},ge={class:"container"},Ee={class:"d-flex justify-content-between align-items-center"},ye={class:"progress-container"},Ve={class:"progress-info"},Ne={class:"progress-bar"},ke={class:"checklist"},be=["onClick"],we={key:0},Ce=["onClick"],ue=["onClick"],De={key:0},Se={class:"checklist"},Be={class:"checklist-item"},_e={class:"attachment-area"},xe={key:2,class:"status"},Te={class:"form-group"},Ae={class:"form-group"},Me={class:"input-group"},Pe={class:"form-group"},Le={class:"form-group"},Fe={class:"input-group"},Ue={class:"form-group"},Ie={class:"form-group"},Re={class:"input-group"},Oe={class:"form-group"},He={class:"form-group"},ze=["value"],qe={class:"input-group"},je={class:"form-group"},$e={class:"input-group"},Qe={class:"form-group"},Ye={class:"form-group"},Ke={class:"form-group"},We={class:"checkbox-group"},Ge={class:"checkbox-item"},Je={class:"checkbox-item"},Xe={class:"input-group"},Ze={class:"form-group"},ve={class:"form-group"},et={class:"form-group"},tt={class:"attachment-area"},nt={class:"action-buttons"},lt=["disabled"],ot={class:"task-table-wrapper"},st={class:"table-controls"},it={class:"filters"},rt={class:"task-table"},at=["onClick"],dt=["onClick"],ct={key:0},mt={class:"alert alert-primary",role:"alert"},pt={class:"mb-0"},ht={class:"report-container",ref:"reportContainer"},ft={class:"report-info"},gt={class:"info-box"},Et={class:"info-box"},yt={class:"info-box"},Vt={class:"section"},Nt={class:"summary-grid"},kt={class:"summary-card"},bt={class:"summary-number"},wt={class:"section"},Ct={class:"task-header"},ut={class:"task-title"},Dt={class:"task-component"},St={class:"task-details"},Bt={class:"detail-item"},_t={class:"detail-value"},xt={class:"detail-item"},Tt={class:"detail-value"},At={class:"detail-item"},Mt={class:"detail-value"},Pt={class:"detail-item"},Lt={class:"detail-value"},Ft={class:"detail-item"},Ut={class:"detail-value"},It={class:"detail-item"},Rt={class:"detail-value"},Ot={key:0,style:{margin:"15px 0",padding:"10px",background:"white","border-radius":"5px"}},Ht={class:"detail-value"},zt={key:1,style:{margin:"15px 0",padding:"10px",background:"white","border-radius":"5px"}},qt={class:"detail-value"},jt={key:2,class:"checklist-progress"},$t={class:"progress-bar"},Qt={style:{"font-size":"0.9em",color:"#666","margin-top":"5px"}},Yt={class:"checklist-items"},Kt={class:"checklist-icon"},Wt={class:"section"},Gt={class:"info-box"},Jt={class:"signature-section"},Xt={class:"signature-box"},Zt={style:{"margin-top":"10px",color:"#666"}};function vt(l,t,s,a,o,i){return o.ready?(e.openBlock(),e.createElementBlock("div",ce,[e.createElementVNode("div",null,[e.withDirectives(e.createElementVNode("nav",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.sections,n=>(e.openBlock(),e.createElementBlock("button",{key:n.id,class:e.normalizeClass(["nav-btn",{active:o.activeSection===n.id}]),onClick:r=>i.handleSectionClick(n)},e.toDisplayString(n.icon)+" "+e.toDisplayString(n.name),11,me))),128))],512),[[e.vShow,!o.showReport]]),e.withDirectives(e.createElementVNode("div",pe,[e.withDirectives(e.createElementVNode("section",{class:e.normalizeClass(["form-section",{active:o.activeSection==="maintenance"}])},[t[37]||(t[37]=e.createElementVNode("h2",null,"🛠️ Maintenance Tasks",-1)),o.isLoading?(e.openBlock(),e.createElementBlock("div",he,t[27]||(t[27]=[e.createElementVNode("div",{class:"loading-spinner"},null,-1),e.createElementVNode("p",null,"Loading checklist...",-1)]))):e.createCommentVNode("",!0),o.isLoading?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("form",fe,[e.createElementVNode("div",ge,[e.createElementVNode("div",Ee,[t[29]||(t[29]=e.createElementVNode("h1",null,"Maintenance Checklist",-1)),i.showAddTaskButton?(e.openBlock(),e.createElementBlock("button",{key:0,class:"btn btn-outline-custom",onClick:t[0]||(t[0]=e.withModifiers(n=>i.addTask(),["prevent"]))},t[28]||(t[28]=[e.createTextVNode(" Manually Add Task ",-1),e.createElementVNode("i",{class:"fas fa-plus"},null,-1)]))):e.createCommentVNode("",!0)]),e.createElementVNode("div",ye,[e.createElementVNode("div",Ve," Progress: "+e.toDisplayString(i.progress)+"% ("+e.toDisplayString(i.completedCount.length)+"/"+e.toDisplayString(o.checklists.length)+") ",1),e.createElementVNode("div",Ne,[e.createElementVNode("div",{class:"progress-fill",style:e.normalizeStyle({width:i.progress+"%"})},null,4)])]),e.createElementVNode("ul",ke,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.checklists,n=>(e.openBlock(),e.createElementBlock("li",{key:n.id,class:"checklist-item"},[e.createElementVNode("div",{class:e.normalizeClass(["checkbox",{checked:n.completed}]),onClick:r=>i.toggleTask(n)},[n.completed?(e.openBlock(),e.createElementBlock("span",we,"✓")):e.createCommentVNode("",!0)],10,be),e.createElementVNode("span",{class:e.normalizeClass(["task-text",{completed:n.completed}]),onClick:r=>i.toggleTask(n)},e.toDisplayString(n.text),11,Ce),i.showAddTaskButton?(e.openBlock(),e.createElementBlock("button",{key:0,class:"delete-btn",onClick:r=>i.deleteTask(n.id),title:"Delete task"},t[30]||(t[30]=[e.createStaticVNode('<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3,6 5,6 21,6"></polyline><path d="m19,6v14a2,2 0 0,1 -2,2H7a2,2 0 0,1 -2,-2V6m3,0V4a2,2 0 0,1 2,-2h4a2,2 0 0,1 2,2v2"></path><line x1="10" y1="11" x2="10" y2="17"></line><line x1="14" y1="11" x2="14" y2="17"></line></svg>',1)]),8,ue)):e.createCommentVNode("",!0)]))),128))]),o.after?(e.openBlock(),e.createElementBlock("div",De,[t[33]||(t[33]=e.createElementVNode("label",null,"Upload Image Evidence",-1)),e.createElementVNode("ul",Se,[e.createElementVNode("li",Be,[t[32]||(t[32]=e.createElementVNode("span",{class:"task-text"}," Image Evidence Already Uploaded ",-1)),e.createElementVNode("button",{type:"button",class:"delete-btn",onClick:t[1]||(t[1]=n=>i.deleteEvidence()),title:"Delete Image"},t[31]||(t[31]=[e.createStaticVNode('<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3,6 5,6 21,6"></polyline><path d="m19,6v14a2,2 0 0,1 -2,2H7a2,2 0 0,1 -2,-2V6m3,0V4a2,2 0 0,1 2,-2h4a2,2 0 0,1 2,2v2"></path><line x1="10" y1="11" x2="10" y2="17"></line><line x1="14" y1="11" x2="14" y2="17"></line></svg>',1)]))])])])):(e.openBlock(),e.createElementBlock("div",{class:"form-group",key:o.refreshKey||"default"},[t[35]||(t[35]=e.createElementVNode("label",null,"Upload Image Evidence",-1)),t[36]||(t[36]=e.createElementVNode("p",null,"You can only upload one image evidence here.",-1)),e.createElementVNode("div",_e,[e.createElementVNode("p",null,e.toDisplayString(o.fileText),1),e.createElementVNode("input",{type:"file",id:"evidence-files",class:"file-input",onChange:t[2]||(t[2]=(...n)=>i.handleImg&&i.handleImg(...n))},null,32),t[34]||(t[34]=e.createElementVNode("label",{for:"evidence-files",class:"file-label"},"Browse Files",-1))])])),i.completedCount===o.checklists.length?(e.openBlock(),e.createElementBlock("div",xe," All tasks completed! ✅ ")):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"reset-button",onClick:t[3]||(t[3]=e.withModifiers((...n)=>i.resetTasks&&i.resetTasks(...n),["prevent"]))},e.toDisplayString(i.checklistButtonLabel),1)])]))],2),[[e.vShow,o.activeSection==="maintenance"]]),e.withDirectives(e.createElementVNode("section",{class:e.normalizeClass(["form-section",{active:o.activeSection==="schedule"}])},[t[62]||(t[62]=e.createElementVNode("h2",null,"📅 Maintenance Schedule",-1)),e.createElementVNode("form",null,[e.createElementVNode("div",Te,[t[38]||(t[38]=e.createElementVNode("label",{for:"task-name"},"Task Name",-1)),e.withDirectives(e.createElementVNode("input",{type:"text",id:"task-name","onUpdate:modelValue":t[4]||(t[4]=n=>o.form.taskName=n),required:""},null,512),[[e.vModelText,o.form.taskName]])]),e.createElementVNode("div",Ae,[t[39]||(t[39]=e.createElementVNode("label",{for:"task-description"},"Description",-1)),e.withDirectives(e.createElementVNode("textarea",{id:"task-description","onUpdate:modelValue":t[5]||(t[5]=n=>o.form.description=n),required:""},null,512),[[e.vModelText,o.form.description]])]),e.createElementVNode("div",Me,[e.createElementVNode("div",Pe,[t[41]||(t[41]=e.createElementVNode("label",{for:"maintenance-type"},"Maintenance Type",-1)),e.withDirectives(e.createElementVNode("select",{id:"maintenance-type","onUpdate:modelValue":t[6]||(t[6]=n=>o.form.maintenanceType=n),required:""},t[40]||(t[40]=[e.createStaticVNode('<option value="">-- Select Type --</option><option value="preventive">Preventive</option><option value="corrective">Corrective</option><option value="predictive">Predictive</option><option value="condition">Condition-Based</option>',5)]),512),[[e.vModelSelect,o.form.maintenanceType]])]),e.createElementVNode("div",Le,[t[43]||(t[43]=e.createElementVNode("label",{for:"component"},"Component/System",-1)),e.withDirectives(e.createElementVNode("select",{id:"component","onUpdate:modelValue":t[7]||(t[7]=n=>o.form.component=n),required:""},t[42]||(t[42]=[e.createStaticVNode('<option value="">-- Select Component --</option><option value="engine">Engine</option><option value="hull">Hull</option><option value="electronics">Electronics</option><option value="deck">Deck Machinery</option><option value="plumbing">Plumbing</option><option value="electrical">Electrical</option><option value="hvac">HVAC</option><option value="safety">Safety Systems</option><option value="Other">Other</option>',10)]),512),[[e.vModelSelect,o.form.component]]),o.form.component==="Other"?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,type:"text",placeholder:"Enter custom component/system","onUpdate:modelValue":t[8]||(t[8]=n=>o.form.customComponent=n),style:{"margin-top":"8px"}},null,512)),[[e.vModelText,o.form.customComponent]]):e.createCommentVNode("",!0)])]),e.createElementVNode("div",Fe,[e.createElementVNode("div",Ue,[t[45]||(t[45]=e.createElementVNode("label",{for:"priority"},"Priority",-1)),e.withDirectives(e.createElementVNode("select",{id:"priority","onUpdate:modelValue":t[9]||(t[9]=n=>o.form.priority=n),required:""},t[44]||(t[44]=[e.createElementVNode("option",{value:"low"},"Low",-1),e.createElementVNode("option",{value:"medium"},"Medium",-1),e.createElementVNode("option",{value:"high"},"High",-1),e.createElementVNode("option",{value:"critical"},"Critical",-1)]),512),[[e.vModelSelect,o.form.priority]])]),e.createElementVNode("div",Ie,[t[46]||(t[46]=e.createElementVNode("label",{for:"status"},"Status",-1)),e.withDirectives(e.createElementVNode("input",{type:"text",id:"status","onUpdate:modelValue":t[10]||(t[10]=n=>o.form.status=n),readonly:""},null,512),[[e.vModelText,o.form.status]])])]),e.createElementVNode("div",Re,[e.createElementVNode("div",Oe,[t[47]||(t[47]=e.createElementVNode("label",{for:"estimated-hours"},"Estimated Hours",-1)),e.withDirectives(e.createElementVNode("input",{type:"number",id:"estimated-hours","onUpdate:modelValue":t[11]||(t[11]=n=>o.form.estimatedHours=n),min:"0",step:"0.5"},null,512),[[e.vModelText,o.form.estimatedHours]])])]),e.createElementVNode("div",He,[t[49]||(t[49]=e.createElementVNode("label",{for:"assigned-to"},"Assigned To",-1)),e.withDirectives(e.createElementVNode("select",{id:"assigned-to","onUpdate:modelValue":t[12]||(t[12]=n=>o.form.assignedTo=n)},[t[48]||(t[48]=e.createElementVNode("option",{value:""},"-- Select Personnel --",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.vesselCrew,n=>(e.openBlock(),e.createElementBlock("option",{key:n.id,value:`${n.name} - ${n.role}`},e.toDisplayString(n.name)+" - "+e.toDisplayString(n.role),9,ze))),128))],512),[[e.vModelSelect,o.form.assignedTo]])]),e.createElementVNode("div",qe,[e.createElementVNode("div",je,[t[51]||(t[51]=e.createElementVNode("label",{for:"recurrence-type"},"Recurrence",-1)),e.withDirectives(e.createElementVNode("select",{id:"recurrence-type","onUpdate:modelValue":t[13]||(t[13]=n=>o.form.recurrence=n),required:""},t[50]||(t[50]=[e.createStaticVNode('<option value="once">One-time</option><option value="daily">Daily</option><option value="weekly">Weekly</option><option value="monthly">Monthly</option><option value="quarterly">Quarterly</option><option value="semi-annual">Semi-annually</option><option value="annual">Annually</option><option value="custom">Custom Interval</option>',8)]),512),[[e.vModelSelect,o.form.recurrence]])])]),e.createElementVNode("div",$e,[e.createElementVNode("div",Qe,[t[52]||(t[52]=e.createElementVNode("label",{for:"last-performed"},"Last Performed Date",-1)),e.withDirectives(e.createElementVNode("input",{type:"date",id:"last-performed","onUpdate:modelValue":t[14]||(t[14]=n=>o.form.lastPerformed=n)},null,512),[[e.vModelText,o.form.lastPerformed]])]),e.createElementVNode("div",Ye,[t[53]||(t[53]=e.createElementVNode("label",{for:"next-due"},"Due Date",-1)),e.withDirectives(e.createElementVNode("input",{type:"date",id:"next-due","onUpdate:modelValue":t[15]||(t[15]=n=>o.form.nextDue=n),required:""},null,512),[[e.vModelText,o.form.nextDue]])])]),e.createElementVNode("div",Ke,[t[56]||(t[56]=e.createElementVNode("label",null,"Notifications",-1)),e.createElementVNode("div",We,[e.createElementVNode("div",Ge,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",id:"notify-email","onUpdate:modelValue":t[16]||(t[16]=n=>o.form.notifyEmail=n)},null,512),[[e.vModelCheckbox,o.form.notifyEmail]]),t[54]||(t[54]=e.createElementVNode("label",{for:"notify-email"},"Email Notification",-1))]),e.createElementVNode("div",Je,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",id:"notify-sms","onUpdate:modelValue":t[17]||(t[17]=n=>o.form.notifySms=n)},null,512),[[e.vModelCheckbox,o.form.notifySms]]),t[55]||(t[55]=e.createElementVNode("label",{for:"notify-sms"},"SMS Notification",-1))])])]),e.createElementVNode("div",Xe,[e.createElementVNode("div",Ze,[t[58]||(t[58]=e.createElementVNode("label",{for:"reminder-days"},"Reminder (Days Before)",-1)),e.withDirectives(e.createElementVNode("select",{id:"reminder-days","onUpdate:modelValue":t[18]||(t[18]=n=>o.form.reminderDays=n)},t[57]||(t[57]=[e.createStaticVNode('<option value="1">1 day</option><option value="3">3 days</option><option value="7">1 week</option><option value="14">2 weeks</option><option value="30">1 month</option>',5)]),512),[[e.vModelSelect,o.form.reminderDays]])])]),e.createElementVNode("div",ve,[t[59]||(t[59]=e.createElementVNode("label",{for:"schedule-notes"},"Notes",-1)),e.withDirectives(e.createElementVNode("textarea",{id:"schedule-notes","onUpdate:modelValue":t[19]||(t[19]=n=>o.form.notes=n)},null,512),[[e.vModelText,o.form.notes]])]),e.createElementVNode("div",et,[t[61]||(t[61]=e.createElementVNode("label",null,"Attachments",-1)),e.createElementVNode("div",tt,[e.createElementVNode("p",null,e.toDisplayString(o.imgText),1),e.createElementVNode("input",{type:"file",id:"maintenance-files",class:"file-input",onChange:t[20]||(t[20]=(...n)=>i.handleFiles&&i.handleFiles(...n)),multiple:""},null,32),t[60]||(t[60]=e.createElementVNode("label",{for:"maintenance-files",class:"file-label"},"Browse Files",-1))])]),e.createElementVNode("div",nt,[e.createElementVNode("button",{type:"button",class:"btn btn-primary",onClick:t[21]||(t[21]=e.withModifiers((...n)=>i.saveSchedule&&i.saveSchedule(...n),["prevent"])),disabled:o.isSaving},e.toDisplayString(o.isSaving?"Saving...":"Save Schedule"),9,lt)])])],2),[[e.vShow,o.activeSection==="schedule"]]),e.withDirectives(e.createElementVNode("section",{class:e.normalizeClass(["form-section",{active:o.activeSection==="inventory"}])},[t[68]||(t[68]=e.createElementVNode("h2",null,"All Maintenance",-1)),e.createElementVNode("div",ot,[e.createElementVNode("div",st,[e.createElementVNode("div",it,[e.createElementVNode("button",{class:e.normalizeClass({active:o.activeFilter==="due"}),onClick:t[22]||(t[22]=n=>i.setFilter("due"))},"Due",2),e.createElementVNode("button",{class:e.normalizeClass({active:o.activeFilter==="all"}),onClick:t[23]||(t[23]=n=>i.setFilter("all"))},"All",2),e.createElementVNode("button",{class:e.normalizeClass({active:o.activeFilter==="completed"}),onClick:t[24]||(t[24]=n=>i.setFilter("completed"))},"Completed",2),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":t[25]||(t[25]=n=>o.searchQuery=n),placeholder:"Search..."},null,512),[[e.vModelText,o.searchQuery]])])]),e.createElementVNode("table",rt,[t[63]||(t[63]=e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[e.createElementVNode("th",null,"Equipment"),e.createElementVNode("th",null,"Task Name"),e.createElementVNode("th",null,"Assigned To"),e.createElementVNode("th",null,"Intervals"),e.createElementVNode("th",null,"Remaining"),e.createElementVNode("th",null,"Next Due"),e.createElementVNode("th",null,"Status"),e.createElementVNode("th",null,"Action")])],-1)),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.filteredTasks,n=>(e.openBlock(),e.createElementBlock("tr",{key:n.id},[e.createElementVNode("td",null,e.toDisplayString(n.component),1),e.createElementVNode("td",null,e.toDisplayString(n.taskName),1),e.createElementVNode("td",null,e.toDisplayString(n.assignedTo),1),e.createElementVNode("td",null,e.toDisplayString(n.recurrence),1),e.createElementVNode("td",null,e.toDisplayString(n.remainingDays),1),e.createElementVNode("td",null,e.toDisplayString(n.nextDue),1),e.createElementVNode("td",null,[e.createElementVNode("span",{class:e.normalizeClass(["status-badge",n.status.toLowerCase().replace(" ","-")])},e.toDisplayString(n.status),3)]),e.createElementVNode("td",null,[n.status==="Completed"?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:r=>i.printMaintenance(n.component),class:"status-action"},"Print",8,at)):(e.openBlock(),e.createElementBlock("button",{key:1,onClick:r=>i.showMaintenance(n.component),class:"status-action"},"Start",8,dt))])]))),128))])]),s.tasks.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",ct,[e.createElementVNode("div",mt,[t[65]||(t[65]=e.createElementVNode("h4",{class:"alert-heading"},"Such Empty!!!",-1)),t[66]||(t[66]=e.createElementVNode("p",null,"You have no maintenance, because you have not scheduled any for this ship.",-1)),t[67]||(t[67]=e.createElementVNode("hr",null,null,-1)),e.createElementVNode("p",pt,[t[64]||(t[64]=e.createTextVNode("Navigate to the schedule tab, to start scheduling. Or click on this button to ",-1)),e.createElementVNode("button",{type:"button",class:"btn btn-primary",onClick:t[26]||(t[26]=n=>i.switchSchedule())},"Schedule")])])]))])],2),[[e.vShow,o.activeSection==="inventory"]])],512),[[e.vShow,!o.showReport]]),e.withDirectives(e.createElementVNode("div",ht,[t[89]||(t[89]=e.createElementVNode("div",{class:"header"},[e.createElementVNode("div",{class:"report-title"},"MAINTENANCE TASK REPORT")],-1)),e.createElementVNode("div",ft,[e.createElementVNode("div",gt,[t[69]||(t[69]=e.createElementVNode("div",{class:"info-label"},"Report Generated:",-1)),e.createElementVNode("div",null,e.toDisplayString(o.reportDate),1)]),e.createElementVNode("div",Et,[t[70]||(t[70]=e.createElementVNode("div",{class:"info-label"},"Report ID:",-1)),e.createElementVNode("div",null,e.toDisplayString(o.reportId),1)]),e.createElementVNode("div",yt,[t[71]||(t[71]=e.createElementVNode("div",{class:"info-label"},"Total Tasks:",-1)),e.createElementVNode("div",null,e.toDisplayString(o.maintenanceTasks.length),1)]),t[72]||(t[72]=e.createElementVNode("div",{class:"info-box"},[e.createElementVNode("div",{class:"info-label"},"Generated By:"),e.createElementVNode("div",null,"OceanHelm System")],-1))]),e.createElementVNode("div",Vt,[t[75]||(t[75]=e.createElementVNode("div",{class:"section-title"},"📊 Task Summary",-1)),e.createElementVNode("div",Nt,[t[74]||(t[74]=e.createStaticVNode('<div class="summary-card"><div class="summary-number">1</div><div class="summary-label">Completed</div></div><div class="summary-card"><div class="summary-number">0</div><div class="summary-label">Pending</div></div><div class="summary-card"><div class="summary-number">0</div><div class="summary-label">Overdue</div></div>',3)),e.createElementVNode("div",kt,[e.createElementVNode("div",bt,e.toDisplayString(i.totalEstimatedHours),1),t[73]||(t[73]=e.createElementVNode("div",{class:"summary-label"},"Total Hours",-1))])])]),e.createElementVNode("div",wt,[t[85]||(t[85]=e.createElementVNode("div",{class:"section-title"},"🔧 Maintenance Tasks",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.maintenanceTasks,n=>(e.openBlock(),e.createElementBlock("div",{key:n.taskName,class:e.normalizeClass(["task-item",i.getTaskStatusClass(n)])},[e.createElementVNode("div",Ct,[e.createElementVNode("div",null,[e.createElementVNode("div",ut,[e.createTextVNode(e.toDisplayString(n.taskName)+" ",1),e.createElementVNode("span",{class:e.normalizeClass(["maintenance-type","type-"+n.maintenanceType])},e.toDisplayString(n.maintenanceType),3)]),e.createElementVNode("div",Dt,"Component: "+e.toDisplayString(n.component),1)]),e.createElementVNode("span",{class:e.normalizeClass(["status-badge","status-"+n.status.toLowerCase().replace(" ","-")])},e.toDisplayString(n.status),3)]),e.createElementVNode("div",St,[e.createElementVNode("div",Bt,[t[76]||(t[76]=e.createElementVNode("div",{class:"detail-label"},"Assigned To",-1)),e.createElementVNode("div",_t,e.toDisplayString(n.assignedTo),1)]),e.createElementVNode("div",xt,[t[77]||(t[77]=e.createElementVNode("div",{class:"detail-label"},"Estimated Hours",-1)),e.createElementVNode("div",Tt,e.toDisplayString(n.estimatedHours)+" hours",1)]),e.createElementVNode("div",At,[t[78]||(t[78]=e.createElementVNode("div",{class:"detail-label"},"Last Performed",-1)),e.createElementVNode("div",Mt,e.toDisplayString(i.formatDate(n.lastPerformed)),1)]),e.createElementVNode("div",Pt,[t[79]||(t[79]=e.createElementVNode("div",{class:"detail-label"},"Next Due",-1)),e.createElementVNode("div",Lt,e.toDisplayString(i.formatDate(n.nextDue)),1)]),e.createElementVNode("div",Ft,[t[80]||(t[80]=e.createElementVNode("div",{class:"detail-label"},"Recurrence",-1)),e.createElementVNode("div",Ut,e.toDisplayString(n.recurrence),1)]),e.createElementVNode("div",It,[t[81]||(t[81]=e.createElementVNode("div",{class:"detail-label"},"Remaining Days",-1)),e.createElementVNode("div",Rt,e.toDisplayString(n.remainingDays)+" days",1)])]),n.description?(e.openBlock(),e.createElementBlock("div",Ot,[t[82]||(t[82]=e.createElementVNode("div",{class:"detail-label"},"Description",-1)),e.createElementVNode("div",Ht,e.toDisplayString(n.description),1)])):e.createCommentVNode("",!0),n.notes?(e.openBlock(),e.createElementBlock("div",zt,[t[83]||(t[83]=e.createElementVNode("div",{class:"detail-label"},"Notes",-1)),e.createElementVNode("div",qt,e.toDisplayString(n.notes),1)])):e.createCommentVNode("",!0),n.checklistProgress&&n.checklistProgress.length>0?(e.openBlock(),e.createElementBlock("div",jt,[t[84]||(t[84]=e.createElementVNode("div",{class:"detail-label"},"Checklist Progress",-1)),e.createElementVNode("div",$t,[e.createElementVNode("div",{class:"progress-fill",style:e.normalizeStyle({width:i.getChecklistProgress(n)+"%"})},null,4)]),e.createElementVNode("div",Qt,e.toDisplayString(i.getCompletedChecklistItems(n))+" of "+e.toDisplayString(n.checklistProgress.length)+" items completed ("+e.toDisplayString(i.getChecklistProgress(n))+"%) ",1),e.createElementVNode("div",Yt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.checklistProgress,(r,d)=>(e.openBlock(),e.createElementBlock("div",{key:d,class:"checklist-item"},[e.createElementVNode("span",Kt,e.toDisplayString(r.completed?"✅":"⭕"),1),e.createElementVNode("span",null,e.toDisplayString(r.text||"Checklist Item "+(d+1)),1)]))),128))])])):e.createCommentVNode("",!0)],2))),128))]),e.createElementVNode("div",Wt,[t[86]||(t[86]=e.createElementVNode("div",{class:"section-title"},"📋 Recommendations",-1)),e.createElementVNode("div",Gt,[e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.generateRecommendations(),n=>(e.openBlock(),e.createElementBlock("li",{key:n},e.toDisplayString(n),1))),128))])])]),e.createElementVNode("div",Jt,[t[88]||(t[88]=e.createElementVNode("div",{class:"signature-box"},[e.createElementVNode("div",null,[e.createElementVNode("strong",null,"Report Generated By")]),e.createElementVNode("div",{style:{"margin-top":"10px",color:"#666"}},"OceanHelm Maintenance System")],-1)),e.createElementVNode("div",Xt,[t[87]||(t[87]=e.createElementVNode("div",null,[e.createElementVNode("strong",null,"Date")],-1)),e.createElementVNode("div",Zt,e.toDisplayString(o.reportDate),1)])])],512),[[e.vShow,o.showReport]])])])):e.createCommentVNode("",!0)}const g=m(de,[["render",vt]]),ul="",en={name:"ActivityLogs",props:{loading:Boolean,searchTerm:String,selectedFilter:String,logs:Array,paginatedLogs:Array,totalActivities:Number,todayActivities:Number,activeUsers:Number,totalPages:Number,currentPage:Number},emits:["update:searchTerm","update:selectedFilter","refresh","download","change-page"],methods:{formatDate(l){return new Date(l).toLocaleString()},getBadgeClass(l){return{login:"badge-login",logout:"badge-logout",create:"badge-create",update:"badge-update",delete:"badge-delete",view:"badge-view"}[l]||"badge-view"}}},tn={class:"activity-logs"},nn={class:"controls"},ln={class:"search-box"},on=["value"],sn=["value"],rn={class:"stats-grid"},an={class:"stat-card"},dn={class:"value"},cn={class:"stat-card"},mn={class:"value"},pn={class:"stat-card"},hn={class:"value"},fn={class:"logs-container"},gn={key:0,class:"loading"},En={key:1,class:"no-logs"},yn={key:2},Vn={class:"logs-table"},Nn={style:{color:"gray"}},kn={style:{color:"gray"}},bn={class:"pagination"},wn=["disabled"],Cn=["onClick"],un=["disabled"];function Dn(l,t,s,a,o,i){return e.openBlock(),e.createElementBlock("div",tn,[t[14]||(t[14]=e.createElementVNode("div",{class:"header"},[e.createElementVNode("h1",null,"Activity Logs"),e.createElementVNode("p",null,"Monitor and track all system activities in real-time")],-1)),e.createElementVNode("div",nn,[e.createElementVNode("div",ln,[e.createElementVNode("input",{type:"text",placeholder:"Search activities, users, or actions...",value:s.searchTerm,onInput:t[0]||(t[0]=n=>l.$emit("update:searchTerm",n.target.value))},null,40,on)]),e.createElementVNode("select",{class:"filter-select",value:s.selectedFilter,onChange:t[1]||(t[1]=n=>l.$emit("update:selectedFilter",n.target.value))},t[6]||(t[6]=[e.createStaticVNode('<option value="all">All Activities</option><option value="login">Login</option><option value="logout">Logout</option><option value="create">Create</option><option value="update">Update</option><option value="delete">Delete</option><option value="view">View</option>',7)]),40,sn),e.createElementVNode("button",{class:"btn btn-primary",onClick:t[2]||(t[2]=n=>l.$emit("refresh"))},"🔄 Refresh"),e.createElementVNode("button",{class:"btn btn-secondary",onClick:t[3]||(t[3]=n=>l.$emit("download"))},"📥 Download Report")]),e.createElementVNode("div",rn,[e.createElementVNode("div",an,[t[7]||(t[7]=e.createElementVNode("h3",null,"Total Activities",-1)),e.createElementVNode("div",dn,e.toDisplayString(s.totalActivities),1)]),e.createElementVNode("div",cn,[t[8]||(t[8]=e.createElementVNode("h3",null,"Today's Activities",-1)),e.createElementVNode("div",mn,e.toDisplayString(s.todayActivities),1)]),e.createElementVNode("div",pn,[t[9]||(t[9]=e.createElementVNode("h3",null,"Active Users",-1)),e.createElementVNode("div",hn,e.toDisplayString(s.activeUsers),1)]),t[10]||(t[10]=e.createElementVNode("div",{class:"stat-card"},[e.createElementVNode("h3",null,"Important"),e.createElementVNode("div",{class:"badge-danger"}," Logs are deleted at the end of every month, please download a copy ")],-1))]),e.createElementVNode("div",fn,[s.loading?(e.openBlock(),e.createElementBlock("div",gn,t[11]||(t[11]=[e.createElementVNode("div",{class:"spinner"},null,-1),e.createElementVNode("p",null,"Loading activity logs...",-1)]))):s.logs.length===0?(e.openBlock(),e.createElementBlock("div",En,t[12]||(t[12]=[e.createElementVNode("h3",null,"No activities found",-1),e.createElementVNode("p",null,"Try adjusting your search or filter criteria",-1)]))):(e.openBlock(),e.createElementBlock("div",yn,[e.createElementVNode("table",Vn,[t[13]||(t[13]=e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[e.createElementVNode("th",null,"Timestamp"),e.createElementVNode("th",null,"User Name"),e.createElementVNode("th",null,"Action"),e.createElementVNode("th",null,"Details"),e.createElementVNode("th",null,"Section")])],-1)),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.paginatedLogs,n=>(e.openBlock(),e.createElementBlock("tr",{key:n.id},[e.createElementVNode("td",null,e.toDisplayString(i.formatDate(n.timestamp)),1),e.createElementVNode("td",null,[e.createElementVNode("div",null,e.toDisplayString(n.user_name),1),e.createElementVNode("small",Nn,e.toDisplayString(n.email),1)]),e.createElementVNode("td",null,[e.createElementVNode("span",{class:e.normalizeClass(["activity-badge",i.getBadgeClass(n.action)])},e.toDisplayString(n.action),3)]),e.createElementVNode("td",null,[e.createTextVNode(e.toDisplayString(n.details.status)+" ",1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.details.information,(r,d)=>(e.openBlock(),e.createElementBlock("div",{key:d},[e.createElementVNode("strong",null,e.toDisplayString(d)+": ",1),e.createElementVNode("small",kn,e.toDisplayString(r.from||"")+" → "+e.toDisplayString(r.to||r),1)]))),128))]),e.createElementVNode("td",null,e.toDisplayString(n.table_name),1)]))),128))])]),e.createElementVNode("div",bn,[e.createElementVNode("button",{onClick:t[4]||(t[4]=n=>l.$emit("change-page",s.currentPage-1)),disabled:s.currentPage===1}," Previous ",8,wn),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.totalPages,n=>(e.openBlock(),e.createElementBlock("button",{key:n,onClick:r=>l.$emit("change-page",n),class:e.normalizeClass({active:s.currentPage===n})},e.toDisplayString(n),11,Cn))),128)),e.createElementVNode("button",{onClick:t[5]||(t[5]=n=>l.$emit("change-page",s.currentPage+1)),disabled:s.currentPage===s.totalPages}," Next ",8,un)])]))])])}const E=m(en,[["render",Dn]]),Dl="",Sn={name:"CrewManagement",props:{crew:{type:Array,required:!0,default:()=>[]},vesselName:{type:String,default:""},userProfile:{type:Object,default:()=>({role:"viewer"})},loading:{type:Boolean,default:!1},availableRoles:{type:Array,default:()=>["Captain","First Officer","Engineer","Deckhand","Mechanic","Cook"]},config:{type:Object,default:()=>({showWaveBackground:!0,enableAdd:!0,enableEdit:!0,enableDelete:!0,enableAssignShift:!0,enableCertificationManagement:!0})}},emits:["crew-add","crew-edit","crew-delete","crew-assign-shift","crew-add-certification","crew-view-certification","search-changed","filter-changed","access-denied"],data(){return{searchQuery:"",filterStatus:"all",showAddForm:!1,formErrors:{},newCrew:{name:"",role:"Deckhand",customRole:"",status:"available",nextShift:"",certifications:[{name:"",expiryDate:""}],notes:"",email:"",onBoard:""}}},computed:{sectionTitle(){return this.vesselName?`Current Crew for ${this.vesselName}`:"All Fleet Crew"},filteredCrew(){return this.crew.filter(l=>{const t=this.searchQuery===""||l.name.toLowerCase().includes(this.searchQuery.toLowerCase())||l.role.toLowerCase().includes(this.searchQuery.toLowerCase())||l.vessel&&l.vessel.toLowerCase().includes(this.searchQuery.toLowerCase()),s=this.filterStatus==="all"||l.status===this.filterStatus;return t&&s})},canAddCrew(){return this.config.enableAdd&&this.hasPermission("add")},canEditCrew(){return this.config.enableEdit&&this.hasPermission("edit")},canDeleteCrew(){return this.config.enableDelete&&this.hasPermission("delete")},canAssignShift(){return this.config.enableAssignShift&&this.hasPermission("assign")}},methods:{hasPermission(l){var a;const{role:t}=this.userProfile;return((a={owner:["add","edit","delete","assign","view"],staff:["add","edit","assign","view"],captain:["assign","view"],viewer:["view"]}[t])==null?void 0:a.includes(l))||!1},handleToggleAddForm(){if(!this.canAddCrew){this.$emit("access-denied",{action:"add crew",userProfile:this.userProfile});return}this.showAddForm=!this.showAddForm,this.showAddForm||this.resetForm()},handleSearch(){this.$emit("search-changed",this.searchQuery)},handleFilter(){this.$emit("filter-changed",this.filterStatus)},handleAddCrewMember(){if(!this.validateForm())return;const l=this.newCrew.certifications.filter(a=>a.name.trim()!==""&&a.expiryDate!==""),t=this.newCrew.role==="Other"?this.newCrew.customRole:this.newCrew.role,s={name:this.newCrew.name,role:t,status:this.newCrew.status,certifications:l,notes:this.newCrew.notes,vessel:this.vesselName,email:this.newCrew.email,onBoard:this.newCrew.onBoard,nextShift:this.newCrew.nextShift};this.$emit("crew-add",s),this.resetForm(),this.showAddForm=!1},handleCancelForm(){this.showAddForm=!1,this.resetForm()},handleDeleteCrew(l){if(!this.canDeleteCrew){this.$emit("access-denied",{action:"delete crew",userProfile:this.userProfile});return}this.$emit("crew-delete",l)},handleAssignShift(l){if(!this.canAssignShift){this.$emit("access-denied",{action:"assign shift",userProfile:this.userProfile});return}this.$emit("crew-assign-shift",l)},handleAddCertification(l){if(!this.canEditCrew){this.$emit("access-denied",{action:"add certification",userProfile:this.userProfile});return}this.$emit("crew-add-certification",l)},handleViewCertification(l,t){this.$emit("crew-view-certification",{certification:l,member:t})},resetForm(){this.newCrew={name:"",role:"Deckhand",customRole:"",status:"available",nextShift:"",certifications:[{name:"",expiryDate:""}],notes:"",email:"",onBoard:""},this.formErrors={}},validateForm(){this.formErrors={};const l={name:"Full Name",email:"Email Address"};return Object.keys(l).forEach(t=>{(!this.newCrew[t]||this.newCrew[t].trim()==="")&&(this.formErrors[t]=`${l[t]} is required`)}),this.newCrew.email&&!this.isValidEmail(this.newCrew.email)&&(this.formErrors.email="Please enter a valid email address"),this.newCrew.role==="Other"&&(!this.newCrew.customRole||this.newCrew.customRole.trim()==="")&&(this.formErrors.customRole='Custom role is required when "Other" is selected'),Object.keys(this.formErrors).length===0},isValidEmail(l){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(l)},addCertificationEntry(){this.newCrew.certifications.push({name:"",expiryDate:""})},removeCertification(l){this.newCrew.certifications.splice(l,1)},formatStatus(l){return l?l.charAt(0).toUpperCase()+l.slice(1):""},getStatusClass(l){return{available:"status-available",onduty:"status-onduty",unavailable:"status-unavailable"}[l]||""},getCertificationClass(l){const t=this.getExpiryStatus(l);return{expired:"text-danger",expiringSoon:"text-warning",valid:"text-success"}[t]||""},getExpiryStatus(l){if(!l)return"none";const t=new Date(l),s=new Date,a=new Date;return a.setMonth(s.getMonth()+1),t<=s?"expired":t<=a?"expiringSoon":"valid"}}},Bn={class:"crew-management"},_n={key:0,class:"wave-bg"},xn={class:"crew-section"},Tn={class:"section-header"},An={class:"search-filter"},Mn={key:0,class:"loading-state"},Pn={key:1,class:"crew-grid"},Ln={class:"crew-name"},Fn={class:"crew-role"},Un={class:"crew-certifications"},In=["onClick"],Rn=["onClick"],On={class:"crew-availability"},Hn={class:"crew-availability"},zn={class:"action-buttons"},qn={key:0,class:"status-available crew-availability vcard"},jn={key:1,class:"status-unavailable crew-availability vcard"},$n=["onClick"],Qn=["onClick"],Yn={key:2,class:"no-results"},Kn={key:3,class:"add-crew-form"},Wn={class:"form-row"},Gn={class:"form-group"},Jn={key:0,class:"error-message"},Xn={class:"form-group"},Zn=["value"],vn={class:"form-row"},el={class:"form-group"},tl={class:"form-group"},nl={key:0,class:"error-message"},ll={class:"certification-section"},ol={class:"form-row"},sl={class:"form-group"},il=["onUpdate:modelValue"],rl={class:"form-group"},al=["onUpdate:modelValue"],dl={class:"form-group"},cl=["onClick"],ml={class:"form-row"},pl={class:"form-group"},hl={class:"form-actions"};function fl(l,t,s,a,o,i){return e.openBlock(),e.createElementBlock("div",Bn,[s.config.showWaveBackground?(e.openBlock(),e.createElementBlock("div",_n)):e.createCommentVNode("",!0),e.createElementVNode("div",xn,[e.createElementVNode("div",Tn,[e.createElementVNode("h2",null,e.toDisplayString(i.sectionTitle),1),i.canAddCrew?(e.openBlock(),e.createElementBlock("button",{key:0,class:"btn btn-primary",onClick:t[0]||(t[0]=(...n)=>i.handleToggleAddForm&&i.handleToggleAddForm(...n))},e.toDisplayString(o.showAddForm?"Cancel":"+ Add Crew Member"),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",An,[e.withDirectives(e.createElementVNode("input",{type:"text",placeholder:"Search crew by name or role...","onUpdate:modelValue":t[1]||(t[1]=n=>o.searchQuery=n),onInput:t[2]||(t[2]=(...n)=>i.handleSearch&&i.handleSearch(...n))},null,544),[[e.vModelText,o.searchQuery]]),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":t[3]||(t[3]=n=>o.filterStatus=n),onChange:t[4]||(t[4]=(...n)=>i.handleFilter&&i.handleFilter(...n))},t[14]||(t[14]=[e.createElementVNode("option",{value:"all"},"All Statuses",-1),e.createElementVNode("option",{value:"available"},"Available",-1),e.createElementVNode("option",{value:"onduty"},"On Duty",-1),e.createElementVNode("option",{value:"unavailable"},"Unavailable",-1)]),544),[[e.vModelSelect,o.filterStatus]])]),s.loading?(e.openBlock(),e.createElementBlock("div",Mn,t[15]||(t[15]=[e.createElementVNode("div",{class:"spinner-border text-primary",role:"status"},[e.createElementVNode("span",{class:"visually-hidden"},"Loading crew...")],-1),e.createElementVNode("p",null,"Loading crew members...",-1)]))):i.filteredCrew.length>0?(e.openBlock(),e.createElementBlock("div",Pn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.filteredCrew,n=>(e.openBlock(),e.createElementBlock("div",{key:n.id,class:e.normalizeClass(["crew-card",{unavailable:n.status==="unavailable"}])},[e.createElementVNode("div",{class:e.normalizeClass(["status-badge",i.getStatusClass(n.status)])},e.toDisplayString(i.formatStatus(n.status)),3),e.createElementVNode("div",Ln,e.toDisplayString(n.name),1),e.createElementVNode("div",Fn,e.toDisplayString(n.role),1),e.createElementVNode("div",Un,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.certifications,r=>(e.openBlock(),e.createElementBlock("div",{key:r.name,class:e.normalizeClass(["certification-tag",i.getCertificationClass(r.expiryDate)]),onClick:d=>i.handleViewCertification(r,n)},e.toDisplayString(r.name),11,In))),128)),i.canEditCrew?(e.openBlock(),e.createElementBlock("i",{key:0,class:"bi bi-patch-plus-fill icon",onClick:r=>i.handleAddCertification(n)},null,8,Rn)):e.createCommentVNode("",!0)]),e.createElementVNode("div",On,[t[16]||(t[16]=e.createElementVNode("strong",null,"Embarkation Date:",-1)),e.createTextVNode(" "+e.toDisplayString(n.nextShift||"Not Scheduled"),1)]),e.createElementVNode("div",Hn,[t[17]||(t[17]=e.createElementVNode("strong",null,"Expected Days Onboard (in days):",-1)),e.createTextVNode(" "+e.toDisplayString(n.onBoard||"Not Scheduled"),1)]),e.createElementVNode("div",zn,[n.vessel?(e.openBlock(),e.createElementBlock("div",qn," Vessel: "+e.toDisplayString(n.vessel),1)):(e.openBlock(),e.createElementBlock("div",jn," Vessel: Unassigned ")),i.canAssignShift?(e.openBlock(),e.createElementBlock("button",{key:2,class:"btn btn-primary",onClick:r=>i.handleAssignShift(n)}," Assign Shift ",8,$n)):e.createCommentVNode("",!0)]),i.canDeleteCrew?(e.openBlock(),e.createElementBlock("i",{key:0,class:"bi bi-trash icon delete-icon",onClick:r=>i.handleDeleteCrew(n)},null,8,Qn)):e.createCommentVNode("",!0)],2))),128))])):s.loading?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Yn,e.toDisplayString(s.crew.length===0?"No crew members found.":"No crew members found matching your search criteria."),1)),o.showAddForm?(e.openBlock(),e.createElementBlock("div",Kn,[t[28]||(t[28]=e.createElementVNode("h2",null,"Add New Crew Member",-1)),e.createElementVNode("div",Wn,[e.createElementVNode("div",Gn,[t[18]||(t[18]=e.createElementVNode("label",{for:"crew-name"},"Full Name *",-1)),e.withDirectives(e.createElementVNode("input",{type:"text",id:"crew-name","onUpdate:modelValue":t[5]||(t[5]=n=>o.newCrew.name=n),class:e.normalizeClass({error:o.formErrors.name})},null,2),[[e.vModelText,o.newCrew.name]]),o.formErrors.name?(e.openBlock(),e.createElementBlock("div",Jn,e.toDisplayString(o.formErrors.name),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",Xn,[t[20]||(t[20]=e.createElementVNode("label",{for:"crew-role"},"Role/Position *",-1)),e.withDirectives(e.createElementVNode("select",{id:"crew-role","onUpdate:modelValue":t[6]||(t[6]=n=>o.newCrew.role=n)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.availableRoles,n=>(e.openBlock(),e.createElementBlock("option",{key:n,value:n},e.toDisplayString(n),9,Zn))),128)),t[19]||(t[19]=e.createElementVNode("option",{value:"Other"},"Other",-1))],512),[[e.vModelSelect,o.newCrew.role]]),o.newCrew.role==="Other"?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,type:"text",placeholder:"Enter custom role","onUpdate:modelValue":t[7]||(t[7]=n=>o.newCrew.customRole=n),style:{"margin-top":"8px"}},null,512)),[[e.vModelText,o.newCrew.customRole]]):e.createCommentVNode("",!0)])]),e.createElementVNode("div",vn,[e.createElementVNode("div",el,[t[22]||(t[22]=e.createElementVNode("label",{for:"crew-status"},"Status *",-1)),e.withDirectives(e.createElementVNode("select",{id:"crew-status","onUpdate:modelValue":t[8]||(t[8]=n=>o.newCrew.status=n)},t[21]||(t[21]=[e.createElementVNode("option",{value:"available"},"Available",-1),e.createElementVNode("option",{value:"onduty"},"On Duty",-1),e.createElementVNode("option",{value:"unavailable"},"Unavailable",-1)]),512),[[e.vModelSelect,o.newCrew.status]])]),e.createElementVNode("div",tl,[t[23]||(t[23]=e.createElementVNode("label",{for:"crew-email"},"Email Address *",-1)),e.withDirectives(e.createElementVNode("input",{type:"email",id:"crew-email","onUpdate:modelValue":t[9]||(t[9]=n=>o.newCrew.email=n),class:e.normalizeClass({error:o.formErrors.email})},null,2),[[e.vModelText,o.newCrew.email]]),o.formErrors.email?(e.openBlock(),e.createElementBlock("div",nl,e.toDisplayString(o.formErrors.email),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",ll,[t[26]||(t[26]=e.createElementVNode("h3",null,"Certifications",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.newCrew.certifications,(n,r)=>(e.openBlock(),e.createElementBlock("div",{key:r,class:"certification-entry"},[e.createElementVNode("div",ol,[e.createElementVNode("div",sl,[t[24]||(t[24]=e.createElementVNode("label",null,"Certification Name",-1)),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":d=>n.name=d,placeholder:"Enter certification name"},null,8,il),[[e.vModelText,n.name]])]),e.createElementVNode("div",rl,[t[25]||(t[25]=e.createElementVNode("label",null,"Expiry Date",-1)),e.withDirectives(e.createElementVNode("input",{type:"date","onUpdate:modelValue":d=>n.expiryDate=d},null,8,al),[[e.vModelText,n.expiryDate]])]),e.createElementVNode("div",dl,[o.newCrew.certifications.length>1?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"btn btn-danger btn-sm",onClick:d=>i.removeCertification(r)}," Remove ",8,cl)):e.createCommentVNode("",!0)])])]))),128)),e.createElementVNode("button",{type:"button",class:"btn btn-secondary btn-sm",onClick:t[10]||(t[10]=(...n)=>i.addCertificationEntry&&i.addCertificationEntry(...n))}," + Add More Certification ")]),e.createElementVNode("div",ml,[e.createElementVNode("div",pl,[t[27]||(t[27]=e.createElementVNode("label",{for:"crew-notes"},"Notes",-1)),e.withDirectives(e.createElementVNode("textarea",{id:"crew-notes",rows:"3","onUpdate:modelValue":t[11]||(t[11]=n=>o.newCrew.notes=n)},null,512),[[e.vModelText,o.newCrew.notes]])])]),e.createElementVNode("div",hl,[e.createElementVNode("button",{class:"btn btn-secondary",onClick:t[12]||(t[12]=(...n)=>i.handleCancelForm&&i.handleCancelForm(...n))},"Cancel"),e.createElementVNode("button",{class:"btn btn-primary",onClick:t[13]||(t[13]=(...n)=>i.handleAddCrewMember&&i.handleAddCrewMember(...n))},"Add Crew Member")])])):e.createCommentVNode("",!0)])])}const y=m(Sn,[["render",fl]]),gl=(l={})=>({brandName:l.brandName||"OceanHelm",logoIcon:l.logoIcon||"bi bi-water",showLogo:l.showLogo!==!1,responsive:l.responsive!==!1,...l}),El=[{type:"link",label:"Dashboard",icon:"bi bi-speedometer2",href:"/app/dashboard",active:!0},{type:"link",label:"Activity Log",icon:"bi bi-activity",href:"/activity-log",roles:["owner"]},{type:"text",label:"Services"},{type:"button",label:"Maintenance",icon:"bi bi-tools",action:"maintenance"},{type:"dropdown",label:"Crew Management",icon:"bi bi-people",children:[{label:"All Crew",action:"crew-all",roles:["owner","staff"]},{type:"separator"},{label:"Get Crew by Vessel",action:"crew-by-vessel"}]},{type:"link",label:"Inventory Management",icon:"bi bi-clipboard-data",href:"/app/inventory"},{type:"link",label:"Requisition Processing",icon:"bi bi-calendar-check",href:"/app/requisition"},{type:"button",label:"Voyage Manager",icon:"fas fa-ship",action:"coming-soon"},{type:"button",label:"Settings",icon:"bi bi-gear",action:"settings",roles:["owner","staff"]},{type:"button",label:"Help & Support",icon:"bi bi-question-circle",action:"help"}],yl=(l,t)=>!l.roles||l.roles.length===0?!0:l.roles.includes(t==null?void 0:t.role),Vl={install(l,t={}){l.component("ConfigurableSidebar",p),l.component("VesselList",h),l.component("DashHead",f),l.component("ActivityLogs",E),l.component("CrewManagement",y),l.component("DashHead",g),l.provide("sidebarConfig",t)}};c.ActivityLogs=E,c.ConfigurableSidebar=p,c.CrewManagement=y,c.DashHead=f,c.OceanHelmMaintenance=g,c.VesselList=h,c.createSidebarConfig=gl,c.default=Vl,c.defaultMenuItems=El,c.defaultPermissionChecker=yl,Object.defineProperties(c,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(h,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(h=typeof globalThis<"u"?globalThis:h||self,e(h.OceanHelm={},h.Vue))})(this,function(h,e){"use strict";const f=(o,t)=>{const r=o.__vccOpts||o;for(const[c,s]of t)r[c]=s;return r},T={name:"ConfigurableSidebar",props:{brandName:{type:String,default:"OceanHelm"},logoIcon:{type:String,default:"bi bi-water"},showLogo:{type:Boolean,default:!0},menuItems:{type:Array,required:!0,default:()=>[]},userProfile:{type:Object,default:()=>({})},responsive:{type:Boolean,default:!0},customClasses:{type:String,default:""},permissionChecker:{type:Function,default:null}},computed:{sidebarClasses(){return this.customClasses},filteredMenuItems(){return this.menuItems.filter(o=>this.hasPermission(o))}},mounted(){this.responsive&&this.initializeResponsiveBehavior()},methods:{hasPermission(o){return this.permissionChecker?this.permissionChecker(o,this.userProfile):!o.roles||o.roles.length===0?!0:o.roles.includes(this.userProfile.role)},handleNavigation(o){var t;this.$emit("navigate",o),o.href&&!o.preventDefault&&(o.external?window.open(o.href,"_blank"):(t=this.$router)==null||t.push(o.href))},handleAction(o){this.$emit("action",o)},handleItemClick(o){this.$emit("item-click",o),o.type},initializeResponsiveBehavior(){const o=document.getElementById("sidebarToggle"),t=document.getElementById("sidebar"),r=document.getElementById("content");!o||!t||!r||(window.innerWidth>=768&&(t.classList.toggle("active"),r.classList.toggle("active")),o.addEventListener("click",()=>{t.classList.toggle("active"),r.classList.toggle("active")}),document.addEventListener("click",c=>{const s=t.contains(c.target),l=o.contains(c.target);!s&&!l&&window.innerWidth<768&&t.classList.contains("active")&&(t.classList.remove("active"),r.classList.remove("active"))}))}},emits:["navigate","action","item-click"]},P={key:0,class:"logo d-flex align-items-center left"},M={class:"list-unstyled components mt-4"},A=["onClick"],q=["href","onClick"],F=["onClick"],I={class:"dropdown-toggle",type:"button","data-bs-toggle":"dropdown","aria-expanded":"false"},R={class:"dropdown-menu","aria-labelledby":"dropdownMenuLink"},L=["onClick"],O={key:3,class:"dropdown-divider"},U={key:4};function j(o,t,r,c,s,l){return e.openBlock(),e.createElementBlock("nav",{id:"sidebar",class:e.normalizeClass(l.sidebarClasses)},[r.showLogo?(e.openBlock(),e.createElementBlock("div",P,[e.createElementVNode("i",{class:e.normalizeClass([r.logoIcon,"me-2"])},null,2),e.createElementVNode("span",null,e.toDisplayString(r.brandName),1)])):e.createCommentVNode("",!0),e.createElementVNode("ul",M,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.filteredMenuItems,(n,d)=>(e.openBlock(),e.createElementBlock("li",{key:d,class:e.normalizeClass({active:n.active,dropdown:n.type==="dropdown"}),onClick:p=>l.handleItemClick(n)},[n.type==="link"?(e.openBlock(),e.createElementBlock("a",{key:0,href:n.href||"#",onClick:e.withModifiers(p=>l.handleNavigation(n),["prevent"])},[n.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(n.icon)},null,2)):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(n.label),1)],8,q)):n.type==="button"?(e.openBlock(),e.createElementBlock("a",{key:1,onClick:e.withModifiers(p=>l.handleAction(n),["prevent"]),style:{cursor:"pointer"}},[n.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(n.icon)},null,2)):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(n.label),1)],8,F)):n.type==="dropdown"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("a",I,[n.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(n.icon)},null,2)):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(n.label),1)]),e.createElementVNode("div",R,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.children,(p,g)=>(e.openBlock(),e.createElementBlock("a",{key:g,class:"dropdown-item black",onClick:e.withModifiers(E=>l.handleAction(p),["prevent"]),style:{cursor:"pointer"}},e.toDisplayString(p.label),9,L))),128))])],64)):n.type==="separator"?(e.openBlock(),e.createElementBlock("div",O)):n.type==="text"?(e.openBlock(),e.createElementBlock("a",U,e.toDisplayString(n.label),1)):e.createCommentVNode("",!0)],10,A))),128))]),e.renderSlot(o.$slots,"footer")],2)}const V=f(T,[["render",j]]),oi="",$={name:"VesselList",props:{vessels:{type:Array,required:!0,default:()=>[]},userProfile:{type:Object,required:!0,default:()=>({role:"viewer",vessel:null})},loading:{type:Boolean,default:!1},currentRoute:{type:String,default:"dashboard"},config:{type:Object,default:()=>({enableAdd:!0,enableEdit:!0,enableDelete:!0,enableStatusToggle:!0,showCertifications:!0})}},emits:["vessel-add","vessel-click","vessel-edit","vessel-delete","vessel-toggle-status","vessel-navigate","access-denied"],computed:{activeVesselsCount(){return this.vessels.filter(o=>o.status==="Active").length},inactiveVesselsCount(){return this.vessels.filter(o=>o.status==="Inactive").length},canAddVessel(){return this.config.enableAdd&&(this.userProfile.role==="owner"||this.userProfile.role==="staff")}},methods:{handleAddVessel(){if(!this.canAddVessel){this.handleAccessDenied("add vessel");return}this.$emit("vessel-add")},handleVesselClick(o){const t={vessel:o,route:this.currentRoute,id:o.registrationNumber,name:o.name};this.currentRoute==="dashboard"?this.$emit("vessel-click",o):this.$emit("vessel-navigate",t)},handleDeleteVessel(o){if(!this.grantAccess(o)){this.handleAccessDenied("delete vessel");return}this.config.enableDelete&&this.$emit("vessel-delete",o)},handleToggleStatus(o){if(!this.grantAccess(o)){this.handleAccessDenied("change vessel status");return}this.config.enableStatusToggle&&this.$emit("vessel-toggle-status",o)},handleEditVessel(o){if(!this.grantAccess(o)){this.handleAccessDenied("edit vessel");return}this.config.enableEdit&&this.$emit("vessel-edit",o)},handleAccessDenied(o){this.$emit("access-denied",{action:o,userProfile:this.userProfile})},statusClass(o){return`status-${(o==null?void 0:o.toLowerCase())||""}`},grantAccess(o){const{role:t,vessel:r}=this.userProfile;return t==="owner"||t==="staff"||t==="captain"&&r===o.name},getDaysToExpiry(o){if(!o)return null;const t=new Date,c=new Date(o)-t;return Math.ceil(c/(1e3*60*60*24))},getExpiryClass(o){const t=this.getDaysToExpiry(o);return t===null?"":t<30?"cert-critical":t<90?"cert-warning":""}}},z={class:"row mb-3"},H={class:"col-md-4"},Q={class:"card border-0 shadow-sm"},J={class:"card-body d-flex align-items-center"},W={class:"mt-2 mb-0"},G={class:"col-md-4"},Y={class:"card border-0 shadow-sm"},K={class:"card-body d-flex align-items-center"},X={class:"mt-2 mb-0"},Z={key:0,class:"col-md-4"},v={key:0,class:"text-center py-4"},ee={key:1,class:"alert alert-primary",role:"alert"},te={key:2,class:"row"},oe=["onClick"],ne={class:"card-body d-flex align-items-center"},se={class:"flex-grow-1"},le={class:"d-flex justify-content-between align-items-center mb-2"},ie={class:"card-title mb-0"},re={class:"row"},ae={class:"col-6"},de={class:"mb-0"},ce={class:"col-6"},me={class:"mb-0"},pe={class:"action-icon v-left delete"},he=["onClick"],fe=["onClick"];function ge(o,t,r,c,s,l){return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",z,[e.createElementVNode("div",H,[e.createElementVNode("div",Q,[e.createElementVNode("div",J,[t[2]||(t[2]=e.createElementVNode("div",{class:"rounded-circle bg-primary bg-opacity-10 p-3 me-3"},[e.createElementVNode("i",{class:"bi bi-check-circle-fill text-primary fs-4"})],-1)),e.createElementVNode("div",null,[t[1]||(t[1]=e.createElementVNode("h6",{class:"mb-0"},"Active Vessels",-1)),e.createElementVNode("h3",W,e.toDisplayString(l.activeVesselsCount),1)])])])]),e.createElementVNode("div",G,[e.createElementVNode("div",Y,[e.createElementVNode("div",K,[t[4]||(t[4]=e.createElementVNode("div",{class:"rounded-circle bg-secondary bg-opacity-10 p-3 me-3"},[e.createElementVNode("i",{class:"bi bi-pause-circle-fill text-secondary fs-4"})],-1)),e.createElementVNode("div",null,[t[3]||(t[3]=e.createElementVNode("h6",{class:"mb-0"},"Inactive",-1)),e.createElementVNode("h3",X,e.toDisplayString(l.inactiveVesselsCount),1)])])])]),l.canAddVessel?(e.openBlock(),e.createElementBlock("div",Z,[e.createElementVNode("div",{class:"card border-0 shadow-sm",onClick:t[0]||(t[0]=(...n)=>l.handleAddVessel&&l.handleAddVessel(...n))},t[5]||(t[5]=[e.createElementVNode("div",{class:"card-body d-flex align-items-center"},[e.createElementVNode("div",{class:"rounded-circle bg-success bg-opacity-10 p-3 me-3"},[e.createElementVNode("i",{class:"bi bi-patch-plus-fill text-success fs-4"})]),e.createElementVNode("div",null,[e.createElementVNode("h6",{class:"mb-0"},"Add New Vessel")])],-1)]))])):e.createCommentVNode("",!0)]),t[11]||(t[11]=e.createElementVNode("h4",{class:"mb-4"},[e.createElementVNode("i",{class:"bi bi-ship me-2"}),e.createTextVNode("Registered Vessels")],-1)),r.loading?(e.openBlock(),e.createElementBlock("div",v,t[6]||(t[6]=[e.createElementVNode("div",{class:"spinner-border text-primary",role:"status"},[e.createElementVNode("span",{class:"visually-hidden"},"Loading...")],-1),e.createElementVNode("p",{class:"mt-2"},"Loading vessels...",-1)]))):r.vessels.length?(e.openBlock(),e.createElementBlock("div",te,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.vessels,n=>(e.openBlock(),e.createElementBlock("div",{class:"col-lg-6",key:n.registrationNumber||n.id},[e.createElementVNode("div",{class:"vessel-card",onClick:d=>l.handleVesselClick(n)},[e.createElementVNode("div",ne,[t[10]||(t[10]=e.createElementVNode("div",{class:"vessel-icon v-left"},[e.createElementVNode("i",{class:"fas fa-ship"})],-1)),e.createElementVNode("div",se,[e.createElementVNode("div",le,[e.createElementVNode("h5",ie,e.toDisplayString(n.name),1),e.createElementVNode("span",{class:e.normalizeClass(["vessel-status",l.statusClass(n.status)])},e.toDisplayString(n.status),3)]),e.createElementVNode("div",re,[e.createElementVNode("div",ae,[t[8]||(t[8]=e.createElementVNode("small",{class:"text-muted"},"Registration #:",-1)),e.createElementVNode("p",de,e.toDisplayString(n.registrationNumber),1)]),e.createElementVNode("div",ce,[t[9]||(t[9]=e.createElementVNode("small",{class:"text-muted"},"Next Maintenance:",-1)),e.createElementVNode("p",me,e.toDisplayString(n.nextMaintenance||"Not scheduled"),1)])])])]),e.createElementVNode("div",pe,[e.createElementVNode("i",{class:"bi bi-trash",onClick:e.withModifiers(d=>l.handleDeleteVessel(n),["stop"])},null,8,he)]),e.createElementVNode("button",{class:"btn btn-primary",onClick:e.withModifiers(d=>l.handleToggleStatus(n),["stop"])},e.toDisplayString(n.status==="Active"?"Mark Inactive":"Mark Active"),9,fe)],8,oe)]))),128))])):(e.openBlock(),e.createElementBlock("div",ee,t[7]||(t[7]=[e.createElementVNode("h4",{class:"alert-heading"},"Empty Fleet!",-1),e.createElementVNode("p",null,"You have an empty fleet, you have not added any vessel yet.",-1),e.createElementVNode("hr",null,null,-1),e.createElementVNode("p",{class:"mb-0"},"Click on the add vessel button above, to start adding vessels to your fleet",-1)])))],64)}const y=f($,[["render",ge]]),ni="",Ee={name:"DashHead",props:{name:{type:String,required:!0},userProfile:{type:Object,required:!0,default:()=>({role:"viewer",vessel:null})}},emits:["add-user","logged-in"],methods:{addUser(){this.$emit("add-user")},loggedIn(){this.$emit("logged-in")}}},Ve={class:"page-header d-flex justify-content-between align-items-center"},ye={style:{"margin-left":"20px"}},Ne={class:"d-flex"};function ke(o,t,r,c,s,l){return e.openBlock(),e.createElementBlock("div",Ve,[e.createElementVNode("h2",ye,e.toDisplayString(r.name),1),e.createElementVNode("div",Ne,[this.userProfile.role=="owner"?(e.openBlock(),e.createElementBlock("button",{key:0,class:"btn btn-outline-primary me-2",onClick:t[0]||(t[0]=n=>l.addUser())},t[2]||(t[2]=[e.createElementVNode("i",{class:"bi bi-bell"},null,-1),e.createElementVNode("span",{class:"badge bg-danger"},"1",-1)]))):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"btn btn-outline-primary",onClick:t[1]||(t[1]=n=>l.loggedIn())},t[3]||(t[3]=[e.createElementVNode("i",{class:"bi bi-person-circle"},null,-1)]))])])}const N=f(Ee,[["render",ke]]),si="",be={name:"OceanHelmMaintenance",props:{vesselInfo:{type:Object,required:!0},tasks:{type:Array,default:()=>[]},vesselCrew:{type:Array,default:()=>[]},companyInfo:{type:Object,default:()=>({})},userProfile:{type:Object,required:!0}},emits:["dashboard-navigate","load-checklist","save-schedule","update-task","upload-file","delete-evidence","access-denied","show-message","generate-checklist"],data(){return{ready:!0,isSaving:!1,after:null,lastSection:"",currentTask:"",imgText:"Choose file to upload",fileText:"Drag and drop files here or",fileattachments:{},refreshKey:0,activeSection:"inventory",sections:[{id:"schedule",name:"Schedule",icon:"📅"},{id:"inventory",name:"All Maintenance",icon:"♻️"},{id:"dashboard",name:"Dashboard",icon:"☰",onClick:()=>this.$emit("dashboard-navigate")}],activeFilter:"all",searchQuery:"",checklists:[],isLoading:!1,form:{taskName:"",description:"",maintenanceType:"",component:"",priority:"",dueDate:"",estimatedHours:null,assignedTo:"",recurrence:"",lastPerformed:"",nextDue:"",notifyEmail:!0,notifySms:!0,reminderDays:"1",estimatedDuration:null,notes:"",status:"Soon",email:"",remainingDays:null,attachments:{}},maintenanceTasks:[],showReport:!1,reportDate:new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}),reportId:"MT-"+Math.random().toString(36).substr(2,9).toUpperCase()}},watch:{"form.lastPerformed":"calculateNextDue","form.recurrence":"calculateNextDue","form.nextDue":function(o){this.calculateRemainingDays()}},computed:{filteredTasks(){let o=[...this.tasks];if(this.activeFilter==="all"?o=o.filter(t=>t.status==="Overdue"||t.status==="Soon"||t.status==="Completed"):this.activeFilter==="due"?o=o.filter(t=>t.status==="Overdue"||t.status==="Soon"):this.activeFilter==="completed"&&(o=o.filter(t=>t.status==="Completed")),this.searchQuery){const t=this.searchQuery.toLowerCase();o=o.filter(r=>r.component.toLowerCase().includes(t)||r.taskName.toLowerCase().includes(t)||r.assignedTo.toLowerCase().includes(t))}return o},completedCount(){return this.checklists.filter(o=>o.completed)},progress(){return Math.round(this.completedCount.length/this.checklists.length*100)},checklistButtonLabel(){return this.lastSection==="schedule"?"Approve Maintenance":"Save Checklist"},showAddTaskButton(){return this.checklistButtonLabel!=="Save Checklist"},totalEstimatedHours(){return this.maintenanceTasks.reduce((o,t)=>o+(t.estimatedHours||0),0)}},methods:{grantAccess(o){const t=this.userProfile;return t.role==="owner"||t.role==="staff"||t.role==="captain"&&t.vessel===o},deepAccess(){const o=this.userProfile;return o.role==="owner"||o.role==="captain"?!0:(this.$emit("access-denied","You do not have access to do this"),!1)},deleteTask(o){this.checklists=this.checklists.filter(t=>t.id!==o)},addTask(o){o&&o.preventDefault(),this.$emit("show-message",{type:"prompt",title:"Add New Task",message:"Enter the task details",callback:t=>{if(t){const r={id:Date.now(),text:t,completed:!1};this.checklists.push(r)}}})},setFilter(o){this.activeFilter=o},loadChecklist(o){this.isLoading=!0,this.$emit("generate-checklist",{component:o,callback:t=>{this.checklists=t.map(r=>({...r,completed:!1})),this.isLoading=!1}})},showMaintenance(o){if(this.deepAccess()){const t=this.tasks.find(r=>r.component===o);t&&t.checklistProgress?this.checklists=[...t.checklistProgress]:this.loadChecklist(o),this.after=t==null?void 0:t.after,this.currentTask=o,this.lastSection="inventory",this.activeSection="maintenance"}},printMaintenance(o){const t=this.tasks.find(r=>r.component===o);this.maintenanceTasks=[t],this.loadMaintenanceData(),this.showReport=!0,this.$nextTick(()=>{setTimeout(()=>{window.print(),this.showReport=!1},100)})},switchSchedule(){this.deepAccess()&&(this.activeSection="schedule")},handleFiles(o){this.imgText=o.target.files[0].name,this.form.attachments={file:o.target.files[0]}},handleImg(o){this.fileText=o.target.files[0].name,this.fileattachments={file:o.target.files[0]}},validateForm(){const o=["taskName","description","maintenanceType","component","priority","estimatedHours","recurrence","lastPerformed","assignedTo"];for(const t of o)if(!this.form[t])return this.$emit("show-message",{type:"error",title:"Missing info",message:`Please fill in the required field: ${t}`}),!1;return!0},handleSectionClick(o){this.activeSection=o.id,typeof o.onClick=="function"&&o.onClick()},calculateNextDue(){const o=this.form.lastPerformed?new Date(this.form.lastPerformed):null,t=this.form.recurrence;if(!o||!t)return;let r=new Date(o);switch(t){case"daily":r.setDate(r.getDate()+1);break;case"weekly":r.setDate(r.getDate()+7);break;case"monthly":r.setMonth(r.getMonth()+1);break;case"quarterly":r.setMonth(r.getMonth()+3);break;case"semi-annual":r.setMonth(r.getMonth()+6);break;case"annual":r.setFullYear(r.getFullYear()+1);break;case"once":case"custom":return}this.form.nextDue=r.toISOString().split("T")[0]},calculateRemainingDays(){if(!this.form.nextDue){this.form.remainingDays=null;return}const o=new Date,t=new Date(this.form.nextDue);o.setHours(0,0,0,0),t.setHours(0,0,0,0);const r=t-o,c=Math.ceil(r/(1e3*60*60*24));this.form.remainingDays=`${c} Days`},async saveSchedule(){if(this.isSaving=!0,!this.validateForm()){this.isSaving=!1;return}const o={...this.form};if(this.form.component==="Other"&&this.form.customComponent&&(o.component=this.form.customComponent),o.email=this.companyInfo.email,this.tasks.some(r=>r.component===o.component)){this.$emit("show-message",{type:"error",title:"Duplicate Component",message:`A task with the component "${o.component}" already exists in maintenance`}),this.isSaving=!1;return}delete o.customComponent,this.$emit("save-schedule",{taskData:o,file:o.attachments.file,callback:r=>{this.isSaving=!1,r&&(this.loadChecklist(o.component),this.lastSection="schedule",this.currentTask=o.component,this.resetForm(),this.activeSection="maintenance")}})},resetForm(){this.form={taskName:"",description:"",maintenanceType:"",component:"",priority:"",dueDate:"",estimatedHours:null,assignedTo:"",recurrence:"",lastPerformed:"",nextDue:"",notifyEmail:!0,notifySms:!0,reminderDays:"1",estimatedDuration:null,notes:"",status:"Soon",remainingDays:null,attachments:{}}},toggleTask(o){o.completed=!o.completed},async resetTasks(){const t=this.checklists.every(c=>c.completed)?"Completed":"In Progress",r={checklistProgress:[...this.checklists],status:t,component:this.currentTask,after:this.after};this.$emit("update-task",{updateData:r,file:this.fileattachments.file,callback:(c,s)=>{c&&(s&&(this.after=s),this.fileattachments={},this.fileText="Drag and drop files here or",this.refreshKey+=1,this.activeSection="inventory")}})},loadMaintenanceData(){this.reportId="MT-"+Math.random().toString(36).substr(2,9).toUpperCase(),this.reportDate=new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})},formatDate(o){return o?new Date(o).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"N/A"},getTaskStatusClass(o){return o.status==="Completed"?"completed":o.status==="Overdue"?"overdue":o.status==="In Progress"?"in-progress":"pending"},getChecklistProgress(o){if(!o.checklistProgress||o.checklistProgress.length===0)return 0;const t=o.checklistProgress.filter(r=>r.completed).length;return Math.round(t/o.checklistProgress.length*100)},getCompletedChecklistItems(o){return o.checklistProgress?o.checklistProgress.filter(t=>t.completed).length:0},generateRecommendations(){return["Maintain regular communication with assigned technicians","Ensure all safety protocols are followed during maintenance activities","Update task progress and notes in real-time for accurate reporting"]},deleteEvidence(){this.$emit("delete-evidence",{currentTask:this.currentTask,callback:o=>{o&&(this.after=null,this.fileText="Drag and drop files here or",this.fileattachments={},this.refreshKey+=1)}})}}},we={key:0},De=["onClick"],ue={class:"content"},Ce={key:0,class:"loading-container"},Se={key:1},Be={class:"container"},_e={class:"d-flex justify-content-between align-items-center"},xe={class:"progress-container"},Te={class:"progress-info"},Pe={class:"progress-bar"},Me={class:"checklist"},Ae=["onClick"],qe={key:0},Fe=["onClick"],Ie=["onClick"],Re={key:0},Le={class:"checklist"},Oe={class:"checklist-item"},Ue={class:"attachment-area"},je={key:2,class:"status"},$e={class:"form-group"},ze={class:"form-group"},He={class:"input-group"},Qe={class:"form-group"},Je={class:"form-group"},We={class:"input-group"},Ge={class:"form-group"},Ye={class:"form-group"},Ke={class:"input-group"},Xe={class:"form-group"},Ze={class:"form-group"},ve=["value"],et={class:"input-group"},tt={class:"form-group"},ot={class:"input-group"},nt={class:"form-group"},st={class:"form-group"},lt={class:"form-group"},it={class:"checkbox-group"},rt={class:"checkbox-item"},at={class:"checkbox-item"},dt={class:"input-group"},ct={class:"form-group"},mt={class:"form-group"},pt={class:"form-group"},ht={class:"attachment-area"},ft={class:"action-buttons"},gt=["disabled"],Et={class:"task-table-wrapper"},Vt={class:"table-controls"},yt={class:"filters"},Nt={class:"task-table"},kt=["onClick"],bt=["onClick"],wt={key:0},Dt={class:"alert alert-primary",role:"alert"},ut={class:"mb-0"},Ct={class:"report-container",ref:"reportContainer"},St={class:"report-info"},Bt={class:"info-box"},_t={class:"info-box"},xt={class:"info-box"},Tt={class:"section"},Pt={class:"summary-grid"},Mt={class:"summary-card"},At={class:"summary-number"},qt={class:"section"},Ft={class:"task-header"},It={class:"task-title"},Rt={class:"task-component"},Lt={class:"task-details"},Ot={class:"detail-item"},Ut={class:"detail-value"},jt={class:"detail-item"},$t={class:"detail-value"},zt={class:"detail-item"},Ht={class:"detail-value"},Qt={class:"detail-item"},Jt={class:"detail-value"},Wt={class:"detail-item"},Gt={class:"detail-value"},Yt={class:"detail-item"},Kt={class:"detail-value"},Xt={key:0,style:{margin:"15px 0",padding:"10px",background:"white","border-radius":"5px"}},Zt={class:"detail-value"},vt={key:1,style:{margin:"15px 0",padding:"10px",background:"white","border-radius":"5px"}},eo={class:"detail-value"},to={key:2,class:"checklist-progress"},oo={class:"progress-bar"},no={style:{"font-size":"0.9em",color:"#666","margin-top":"5px"}},so={class:"checklist-items"},lo={class:"checklist-icon"},io={class:"section"},ro={class:"info-box"},ao={class:"signature-section"},co={class:"signature-box"},mo={style:{"margin-top":"10px",color:"#666"}};function po(o,t,r,c,s,l){return s.ready?(e.openBlock(),e.createElementBlock("div",we,[e.createElementVNode("div",null,[e.withDirectives(e.createElementVNode("nav",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.sections,n=>(e.openBlock(),e.createElementBlock("button",{key:n.id,class:e.normalizeClass(["nav-btn",{active:s.activeSection===n.id}]),onClick:d=>l.handleSectionClick(n)},e.toDisplayString(n.icon)+" "+e.toDisplayString(n.name),11,De))),128))],512),[[e.vShow,!s.showReport]]),e.withDirectives(e.createElementVNode("div",ue,[e.withDirectives(e.createElementVNode("section",{class:e.normalizeClass(["form-section",{active:s.activeSection==="maintenance"}])},[t[37]||(t[37]=e.createElementVNode("h2",null,"🛠️ Maintenance Tasks",-1)),s.isLoading?(e.openBlock(),e.createElementBlock("div",Ce,t[27]||(t[27]=[e.createElementVNode("div",{class:"loading-spinner"},null,-1),e.createElementVNode("p",null,"Loading checklist...",-1)]))):e.createCommentVNode("",!0),s.isLoading?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("form",Se,[e.createElementVNode("div",Be,[e.createElementVNode("div",_e,[t[29]||(t[29]=e.createElementVNode("h1",null,"Maintenance Checklist",-1)),l.showAddTaskButton?(e.openBlock(),e.createElementBlock("button",{key:0,class:"btn btn-outline-custom",onClick:t[0]||(t[0]=e.withModifiers(n=>l.addTask(),["prevent"]))},t[28]||(t[28]=[e.createTextVNode(" Manually Add Task ",-1),e.createElementVNode("i",{class:"fas fa-plus"},null,-1)]))):e.createCommentVNode("",!0)]),e.createElementVNode("div",xe,[e.createElementVNode("div",Te," Progress: "+e.toDisplayString(l.progress)+"% ("+e.toDisplayString(l.completedCount.length)+"/"+e.toDisplayString(s.checklists.length)+") ",1),e.createElementVNode("div",Pe,[e.createElementVNode("div",{class:"progress-fill",style:e.normalizeStyle({width:l.progress+"%"})},null,4)])]),e.createElementVNode("ul",Me,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.checklists,n=>(e.openBlock(),e.createElementBlock("li",{key:n.id,class:"checklist-item"},[e.createElementVNode("div",{class:e.normalizeClass(["checkbox",{checked:n.completed}]),onClick:d=>l.toggleTask(n)},[n.completed?(e.openBlock(),e.createElementBlock("span",qe,"✓")):e.createCommentVNode("",!0)],10,Ae),e.createElementVNode("span",{class:e.normalizeClass(["task-text",{completed:n.completed}]),onClick:d=>l.toggleTask(n)},e.toDisplayString(n.text),11,Fe),l.showAddTaskButton?(e.openBlock(),e.createElementBlock("button",{key:0,class:"delete-btn",onClick:d=>l.deleteTask(n.id),title:"Delete task"},t[30]||(t[30]=[e.createStaticVNode('<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3,6 5,6 21,6"></polyline><path d="m19,6v14a2,2 0 0,1 -2,2H7a2,2 0 0,1 -2,-2V6m3,0V4a2,2 0 0,1 2,-2h4a2,2 0 0,1 2,2v2"></path><line x1="10" y1="11" x2="10" y2="17"></line><line x1="14" y1="11" x2="14" y2="17"></line></svg>',1)]),8,Ie)):e.createCommentVNode("",!0)]))),128))]),s.after?(e.openBlock(),e.createElementBlock("div",Re,[t[33]||(t[33]=e.createElementVNode("label",null,"Upload Image Evidence",-1)),e.createElementVNode("ul",Le,[e.createElementVNode("li",Oe,[t[32]||(t[32]=e.createElementVNode("span",{class:"task-text"}," Image Evidence Already Uploaded ",-1)),e.createElementVNode("button",{type:"button",class:"delete-btn",onClick:t[1]||(t[1]=n=>l.deleteEvidence()),title:"Delete Image"},t[31]||(t[31]=[e.createStaticVNode('<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3,6 5,6 21,6"></polyline><path d="m19,6v14a2,2 0 0,1 -2,2H7a2,2 0 0,1 -2,-2V6m3,0V4a2,2 0 0,1 2,-2h4a2,2 0 0,1 2,2v2"></path><line x1="10" y1="11" x2="10" y2="17"></line><line x1="14" y1="11" x2="14" y2="17"></line></svg>',1)]))])])])):(e.openBlock(),e.createElementBlock("div",{class:"form-group",key:s.refreshKey||"default"},[t[35]||(t[35]=e.createElementVNode("label",null,"Upload Image Evidence",-1)),t[36]||(t[36]=e.createElementVNode("p",null,"You can only upload one image evidence here.",-1)),e.createElementVNode("div",Ue,[e.createElementVNode("p",null,e.toDisplayString(s.fileText),1),e.createElementVNode("input",{type:"file",id:"evidence-files",class:"file-input",onChange:t[2]||(t[2]=(...n)=>l.handleImg&&l.handleImg(...n))},null,32),t[34]||(t[34]=e.createElementVNode("label",{for:"evidence-files",class:"file-label"},"Browse Files",-1))])])),l.completedCount===s.checklists.length?(e.openBlock(),e.createElementBlock("div",je," All tasks completed! ✅ ")):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"reset-button",onClick:t[3]||(t[3]=e.withModifiers((...n)=>l.resetTasks&&l.resetTasks(...n),["prevent"]))},e.toDisplayString(l.checklistButtonLabel),1)])]))],2),[[e.vShow,s.activeSection==="maintenance"]]),e.withDirectives(e.createElementVNode("section",{class:e.normalizeClass(["form-section",{active:s.activeSection==="schedule"}])},[t[62]||(t[62]=e.createElementVNode("h2",null,"📅 Maintenance Schedule",-1)),e.createElementVNode("form",null,[e.createElementVNode("div",$e,[t[38]||(t[38]=e.createElementVNode("label",{for:"task-name"},"Task Name",-1)),e.withDirectives(e.createElementVNode("input",{type:"text",id:"task-name","onUpdate:modelValue":t[4]||(t[4]=n=>s.form.taskName=n),required:""},null,512),[[e.vModelText,s.form.taskName]])]),e.createElementVNode("div",ze,[t[39]||(t[39]=e.createElementVNode("label",{for:"task-description"},"Description",-1)),e.withDirectives(e.createElementVNode("textarea",{id:"task-description","onUpdate:modelValue":t[5]||(t[5]=n=>s.form.description=n),required:""},null,512),[[e.vModelText,s.form.description]])]),e.createElementVNode("div",He,[e.createElementVNode("div",Qe,[t[41]||(t[41]=e.createElementVNode("label",{for:"maintenance-type"},"Maintenance Type",-1)),e.withDirectives(e.createElementVNode("select",{id:"maintenance-type","onUpdate:modelValue":t[6]||(t[6]=n=>s.form.maintenanceType=n),required:""},t[40]||(t[40]=[e.createStaticVNode('<option value="">-- Select Type --</option><option value="preventive">Preventive</option><option value="corrective">Corrective</option><option value="predictive">Predictive</option><option value="condition">Condition-Based</option>',5)]),512),[[e.vModelSelect,s.form.maintenanceType]])]),e.createElementVNode("div",Je,[t[43]||(t[43]=e.createElementVNode("label",{for:"component"},"Component/System",-1)),e.withDirectives(e.createElementVNode("select",{id:"component","onUpdate:modelValue":t[7]||(t[7]=n=>s.form.component=n),required:""},t[42]||(t[42]=[e.createStaticVNode('<option value="">-- Select Component --</option><option value="engine">Engine</option><option value="hull">Hull</option><option value="electronics">Electronics</option><option value="deck">Deck Machinery</option><option value="plumbing">Plumbing</option><option value="electrical">Electrical</option><option value="hvac">HVAC</option><option value="safety">Safety Systems</option><option value="Other">Other</option>',10)]),512),[[e.vModelSelect,s.form.component]]),s.form.component==="Other"?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,type:"text",placeholder:"Enter custom component/system","onUpdate:modelValue":t[8]||(t[8]=n=>s.form.customComponent=n),style:{"margin-top":"8px"}},null,512)),[[e.vModelText,s.form.customComponent]]):e.createCommentVNode("",!0)])]),e.createElementVNode("div",We,[e.createElementVNode("div",Ge,[t[45]||(t[45]=e.createElementVNode("label",{for:"priority"},"Priority",-1)),e.withDirectives(e.createElementVNode("select",{id:"priority","onUpdate:modelValue":t[9]||(t[9]=n=>s.form.priority=n),required:""},t[44]||(t[44]=[e.createElementVNode("option",{value:"low"},"Low",-1),e.createElementVNode("option",{value:"medium"},"Medium",-1),e.createElementVNode("option",{value:"high"},"High",-1),e.createElementVNode("option",{value:"critical"},"Critical",-1)]),512),[[e.vModelSelect,s.form.priority]])]),e.createElementVNode("div",Ye,[t[46]||(t[46]=e.createElementVNode("label",{for:"status"},"Status",-1)),e.withDirectives(e.createElementVNode("input",{type:"text",id:"status","onUpdate:modelValue":t[10]||(t[10]=n=>s.form.status=n),readonly:""},null,512),[[e.vModelText,s.form.status]])])]),e.createElementVNode("div",Ke,[e.createElementVNode("div",Xe,[t[47]||(t[47]=e.createElementVNode("label",{for:"estimated-hours"},"Estimated Hours",-1)),e.withDirectives(e.createElementVNode("input",{type:"number",id:"estimated-hours","onUpdate:modelValue":t[11]||(t[11]=n=>s.form.estimatedHours=n),min:"0",step:"0.5"},null,512),[[e.vModelText,s.form.estimatedHours]])])]),e.createElementVNode("div",Ze,[t[49]||(t[49]=e.createElementVNode("label",{for:"assigned-to"},"Assigned To",-1)),e.withDirectives(e.createElementVNode("select",{id:"assigned-to","onUpdate:modelValue":t[12]||(t[12]=n=>s.form.assignedTo=n)},[t[48]||(t[48]=e.createElementVNode("option",{value:""},"-- Select Personnel --",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.vesselCrew,n=>(e.openBlock(),e.createElementBlock("option",{key:n.id,value:`${n.name} - ${n.role}`},e.toDisplayString(n.name)+" - "+e.toDisplayString(n.role),9,ve))),128))],512),[[e.vModelSelect,s.form.assignedTo]])]),e.createElementVNode("div",et,[e.createElementVNode("div",tt,[t[51]||(t[51]=e.createElementVNode("label",{for:"recurrence-type"},"Recurrence",-1)),e.withDirectives(e.createElementVNode("select",{id:"recurrence-type","onUpdate:modelValue":t[13]||(t[13]=n=>s.form.recurrence=n),required:""},t[50]||(t[50]=[e.createStaticVNode('<option value="once">One-time</option><option value="daily">Daily</option><option value="weekly">Weekly</option><option value="monthly">Monthly</option><option value="quarterly">Quarterly</option><option value="semi-annual">Semi-annually</option><option value="annual">Annually</option><option value="custom">Custom Interval</option>',8)]),512),[[e.vModelSelect,s.form.recurrence]])])]),e.createElementVNode("div",ot,[e.createElementVNode("div",nt,[t[52]||(t[52]=e.createElementVNode("label",{for:"last-performed"},"Last Performed Date",-1)),e.withDirectives(e.createElementVNode("input",{type:"date",id:"last-performed","onUpdate:modelValue":t[14]||(t[14]=n=>s.form.lastPerformed=n)},null,512),[[e.vModelText,s.form.lastPerformed]])]),e.createElementVNode("div",st,[t[53]||(t[53]=e.createElementVNode("label",{for:"next-due"},"Due Date",-1)),e.withDirectives(e.createElementVNode("input",{type:"date",id:"next-due","onUpdate:modelValue":t[15]||(t[15]=n=>s.form.nextDue=n),required:""},null,512),[[e.vModelText,s.form.nextDue]])])]),e.createElementVNode("div",lt,[t[56]||(t[56]=e.createElementVNode("label",null,"Notifications",-1)),e.createElementVNode("div",it,[e.createElementVNode("div",rt,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",id:"notify-email","onUpdate:modelValue":t[16]||(t[16]=n=>s.form.notifyEmail=n)},null,512),[[e.vModelCheckbox,s.form.notifyEmail]]),t[54]||(t[54]=e.createElementVNode("label",{for:"notify-email"},"Email Notification",-1))]),e.createElementVNode("div",at,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",id:"notify-sms","onUpdate:modelValue":t[17]||(t[17]=n=>s.form.notifySms=n)},null,512),[[e.vModelCheckbox,s.form.notifySms]]),t[55]||(t[55]=e.createElementVNode("label",{for:"notify-sms"},"SMS Notification",-1))])])]),e.createElementVNode("div",dt,[e.createElementVNode("div",ct,[t[58]||(t[58]=e.createElementVNode("label",{for:"reminder-days"},"Reminder (Days Before)",-1)),e.withDirectives(e.createElementVNode("select",{id:"reminder-days","onUpdate:modelValue":t[18]||(t[18]=n=>s.form.reminderDays=n)},t[57]||(t[57]=[e.createStaticVNode('<option value="1">1 day</option><option value="3">3 days</option><option value="7">1 week</option><option value="14">2 weeks</option><option value="30">1 month</option>',5)]),512),[[e.vModelSelect,s.form.reminderDays]])])]),e.createElementVNode("div",mt,[t[59]||(t[59]=e.createElementVNode("label",{for:"schedule-notes"},"Notes",-1)),e.withDirectives(e.createElementVNode("textarea",{id:"schedule-notes","onUpdate:modelValue":t[19]||(t[19]=n=>s.form.notes=n)},null,512),[[e.vModelText,s.form.notes]])]),e.createElementVNode("div",pt,[t[61]||(t[61]=e.createElementVNode("label",null,"Attachments",-1)),e.createElementVNode("div",ht,[e.createElementVNode("p",null,e.toDisplayString(s.imgText),1),e.createElementVNode("input",{type:"file",id:"maintenance-files",class:"file-input",onChange:t[20]||(t[20]=(...n)=>l.handleFiles&&l.handleFiles(...n)),multiple:""},null,32),t[60]||(t[60]=e.createElementVNode("label",{for:"maintenance-files",class:"file-label"},"Browse Files",-1))])]),e.createElementVNode("div",ft,[e.createElementVNode("button",{type:"button",class:"btn btn-primary",onClick:t[21]||(t[21]=e.withModifiers((...n)=>l.saveSchedule&&l.saveSchedule(...n),["prevent"])),disabled:s.isSaving},e.toDisplayString(s.isSaving?"Saving...":"Save Schedule"),9,gt)])])],2),[[e.vShow,s.activeSection==="schedule"]]),e.withDirectives(e.createElementVNode("section",{class:e.normalizeClass(["form-section",{active:s.activeSection==="inventory"}])},[t[68]||(t[68]=e.createElementVNode("h2",null,"All Maintenance",-1)),e.createElementVNode("div",Et,[e.createElementVNode("div",Vt,[e.createElementVNode("div",yt,[e.createElementVNode("button",{class:e.normalizeClass({active:s.activeFilter==="due"}),onClick:t[22]||(t[22]=n=>l.setFilter("due"))},"Due",2),e.createElementVNode("button",{class:e.normalizeClass({active:s.activeFilter==="all"}),onClick:t[23]||(t[23]=n=>l.setFilter("all"))},"All",2),e.createElementVNode("button",{class:e.normalizeClass({active:s.activeFilter==="completed"}),onClick:t[24]||(t[24]=n=>l.setFilter("completed"))},"Completed",2),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":t[25]||(t[25]=n=>s.searchQuery=n),placeholder:"Search..."},null,512),[[e.vModelText,s.searchQuery]])])]),e.createElementVNode("table",Nt,[t[63]||(t[63]=e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[e.createElementVNode("th",null,"Equipment"),e.createElementVNode("th",null,"Task Name"),e.createElementVNode("th",null,"Assigned To"),e.createElementVNode("th",null,"Intervals"),e.createElementVNode("th",null,"Remaining"),e.createElementVNode("th",null,"Next Due"),e.createElementVNode("th",null,"Status"),e.createElementVNode("th",null,"Action")])],-1)),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.filteredTasks,n=>(e.openBlock(),e.createElementBlock("tr",{key:n.id},[e.createElementVNode("td",null,e.toDisplayString(n.component),1),e.createElementVNode("td",null,e.toDisplayString(n.taskName),1),e.createElementVNode("td",null,e.toDisplayString(n.assignedTo),1),e.createElementVNode("td",null,e.toDisplayString(n.recurrence),1),e.createElementVNode("td",null,e.toDisplayString(n.remainingDays),1),e.createElementVNode("td",null,e.toDisplayString(n.nextDue),1),e.createElementVNode("td",null,[e.createElementVNode("span",{class:e.normalizeClass(["status-badge",n.status.toLowerCase().replace(" ","-")])},e.toDisplayString(n.status),3)]),e.createElementVNode("td",null,[n.status==="Completed"?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:d=>l.printMaintenance(n.component),class:"status-action"},"Print",8,kt)):(e.openBlock(),e.createElementBlock("button",{key:1,onClick:d=>l.showMaintenance(n.component),class:"status-action"},"Start",8,bt))])]))),128))])]),r.tasks.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",wt,[e.createElementVNode("div",Dt,[t[65]||(t[65]=e.createElementVNode("h4",{class:"alert-heading"},"Such Empty!!!",-1)),t[66]||(t[66]=e.createElementVNode("p",null,"You have no maintenance, because you have not scheduled any for this ship.",-1)),t[67]||(t[67]=e.createElementVNode("hr",null,null,-1)),e.createElementVNode("p",ut,[t[64]||(t[64]=e.createTextVNode("Navigate to the schedule tab, to start scheduling. Or click on this button to ",-1)),e.createElementVNode("button",{type:"button",class:"btn btn-primary",onClick:t[26]||(t[26]=n=>l.switchSchedule())},"Schedule")])])]))])],2),[[e.vShow,s.activeSection==="inventory"]])],512),[[e.vShow,!s.showReport]]),e.withDirectives(e.createElementVNode("div",Ct,[t[89]||(t[89]=e.createElementVNode("div",{class:"header"},[e.createElementVNode("div",{class:"report-title"},"MAINTENANCE TASK REPORT")],-1)),e.createElementVNode("div",St,[e.createElementVNode("div",Bt,[t[69]||(t[69]=e.createElementVNode("div",{class:"info-label"},"Report Generated:",-1)),e.createElementVNode("div",null,e.toDisplayString(s.reportDate),1)]),e.createElementVNode("div",_t,[t[70]||(t[70]=e.createElementVNode("div",{class:"info-label"},"Report ID:",-1)),e.createElementVNode("div",null,e.toDisplayString(s.reportId),1)]),e.createElementVNode("div",xt,[t[71]||(t[71]=e.createElementVNode("div",{class:"info-label"},"Total Tasks:",-1)),e.createElementVNode("div",null,e.toDisplayString(s.maintenanceTasks.length),1)]),t[72]||(t[72]=e.createElementVNode("div",{class:"info-box"},[e.createElementVNode("div",{class:"info-label"},"Generated By:"),e.createElementVNode("div",null,"OceanHelm System")],-1))]),e.createElementVNode("div",Tt,[t[75]||(t[75]=e.createElementVNode("div",{class:"section-title"},"📊 Task Summary",-1)),e.createElementVNode("div",Pt,[t[74]||(t[74]=e.createStaticVNode('<div class="summary-card"><div class="summary-number">1</div><div class="summary-label">Completed</div></div><div class="summary-card"><div class="summary-number">0</div><div class="summary-label">Pending</div></div><div class="summary-card"><div class="summary-number">0</div><div class="summary-label">Overdue</div></div>',3)),e.createElementVNode("div",Mt,[e.createElementVNode("div",At,e.toDisplayString(l.totalEstimatedHours),1),t[73]||(t[73]=e.createElementVNode("div",{class:"summary-label"},"Total Hours",-1))])])]),e.createElementVNode("div",qt,[t[85]||(t[85]=e.createElementVNode("div",{class:"section-title"},"🔧 Maintenance Tasks",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.maintenanceTasks,n=>(e.openBlock(),e.createElementBlock("div",{key:n.taskName,class:e.normalizeClass(["task-item",l.getTaskStatusClass(n)])},[e.createElementVNode("div",Ft,[e.createElementVNode("div",null,[e.createElementVNode("div",It,[e.createTextVNode(e.toDisplayString(n.taskName)+" ",1),e.createElementVNode("span",{class:e.normalizeClass(["maintenance-type","type-"+n.maintenanceType])},e.toDisplayString(n.maintenanceType),3)]),e.createElementVNode("div",Rt,"Component: "+e.toDisplayString(n.component),1)]),e.createElementVNode("span",{class:e.normalizeClass(["status-badge","status-"+n.status.toLowerCase().replace(" ","-")])},e.toDisplayString(n.status),3)]),e.createElementVNode("div",Lt,[e.createElementVNode("div",Ot,[t[76]||(t[76]=e.createElementVNode("div",{class:"detail-label"},"Assigned To",-1)),e.createElementVNode("div",Ut,e.toDisplayString(n.assignedTo),1)]),e.createElementVNode("div",jt,[t[77]||(t[77]=e.createElementVNode("div",{class:"detail-label"},"Estimated Hours",-1)),e.createElementVNode("div",$t,e.toDisplayString(n.estimatedHours)+" hours",1)]),e.createElementVNode("div",zt,[t[78]||(t[78]=e.createElementVNode("div",{class:"detail-label"},"Last Performed",-1)),e.createElementVNode("div",Ht,e.toDisplayString(l.formatDate(n.lastPerformed)),1)]),e.createElementVNode("div",Qt,[t[79]||(t[79]=e.createElementVNode("div",{class:"detail-label"},"Next Due",-1)),e.createElementVNode("div",Jt,e.toDisplayString(l.formatDate(n.nextDue)),1)]),e.createElementVNode("div",Wt,[t[80]||(t[80]=e.createElementVNode("div",{class:"detail-label"},"Recurrence",-1)),e.createElementVNode("div",Gt,e.toDisplayString(n.recurrence),1)]),e.createElementVNode("div",Yt,[t[81]||(t[81]=e.createElementVNode("div",{class:"detail-label"},"Remaining Days",-1)),e.createElementVNode("div",Kt,e.toDisplayString(n.remainingDays)+" days",1)])]),n.description?(e.openBlock(),e.createElementBlock("div",Xt,[t[82]||(t[82]=e.createElementVNode("div",{class:"detail-label"},"Description",-1)),e.createElementVNode("div",Zt,e.toDisplayString(n.description),1)])):e.createCommentVNode("",!0),n.notes?(e.openBlock(),e.createElementBlock("div",vt,[t[83]||(t[83]=e.createElementVNode("div",{class:"detail-label"},"Notes",-1)),e.createElementVNode("div",eo,e.toDisplayString(n.notes),1)])):e.createCommentVNode("",!0),n.checklistProgress&&n.checklistProgress.length>0?(e.openBlock(),e.createElementBlock("div",to,[t[84]||(t[84]=e.createElementVNode("div",{class:"detail-label"},"Checklist Progress",-1)),e.createElementVNode("div",oo,[e.createElementVNode("div",{class:"progress-fill",style:e.normalizeStyle({width:l.getChecklistProgress(n)+"%"})},null,4)]),e.createElementVNode("div",no,e.toDisplayString(l.getCompletedChecklistItems(n))+" of "+e.toDisplayString(n.checklistProgress.length)+" items completed ("+e.toDisplayString(l.getChecklistProgress(n))+"%) ",1),e.createElementVNode("div",so,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.checklistProgress,(d,p)=>(e.openBlock(),e.createElementBlock("div",{key:p,class:"checklist-item"},[e.createElementVNode("span",lo,e.toDisplayString(d.completed?"✅":"⭕"),1),e.createElementVNode("span",null,e.toDisplayString(d.text||"Checklist Item "+(p+1)),1)]))),128))])])):e.createCommentVNode("",!0)],2))),128))]),e.createElementVNode("div",io,[t[86]||(t[86]=e.createElementVNode("div",{class:"section-title"},"📋 Recommendations",-1)),e.createElementVNode("div",ro,[e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.generateRecommendations(),n=>(e.openBlock(),e.createElementBlock("li",{key:n},e.toDisplayString(n),1))),128))])])]),e.createElementVNode("div",ao,[t[88]||(t[88]=e.createElementVNode("div",{class:"signature-box"},[e.createElementVNode("div",null,[e.createElementVNode("strong",null,"Report Generated By")]),e.createElementVNode("div",{style:{"margin-top":"10px",color:"#666"}},"OceanHelm Maintenance System")],-1)),e.createElementVNode("div",co,[t[87]||(t[87]=e.createElementVNode("div",null,[e.createElementVNode("strong",null,"Date")],-1)),e.createElementVNode("div",mo,e.toDisplayString(s.reportDate),1)])])],512),[[e.vShow,s.showReport]])])])):e.createCommentVNode("",!0)}const k=f(be,[["render",po]]),li="",ho={name:"ActivityLogs",props:{loading:Boolean,searchTerm:String,selectedFilter:String,logs:Array,paginatedLogs:Array,totalActivities:Number,todayActivities:Number,activeUsers:Number,totalPages:Number,currentPage:Number},emits:["update:searchTerm","update:selectedFilter","refresh","download","change-page"],methods:{formatDate(o){return new Date(o).toLocaleString()},getBadgeClass(o){return{login:"badge-login",logout:"badge-logout",create:"badge-create",update:"badge-update",delete:"badge-delete",view:"badge-view"}[o]||"badge-view"}}},fo={class:"activity-logs"},go={class:"a-controls"},Eo={class:"a-search-box"},Vo=["value"],yo=["value"],No={class:"stats-grid"},ko={class:"stat-card"},bo={class:"value"},wo={class:"stat-card"},Do={class:"value"},uo={class:"stat-card"},Co={class:"value"},So={class:"logs-container"},Bo={key:0,class:"loading"},_o={key:1,class:"no-logs"},xo={key:2},To={class:"logs-table"},Po={style:{color:"gray"}},Mo={style:{color:"gray"}},Ao={class:"pagination"},qo=["disabled"],Fo=["onClick"],Io=["disabled"];function Ro(o,t,r,c,s,l){return e.openBlock(),e.createElementBlock("div",fo,[e.createElementVNode("div",go,[e.createElementVNode("div",Eo,[e.createElementVNode("input",{type:"text",placeholder:"Search activities, users, or actions...",value:r.searchTerm,onInput:t[0]||(t[0]=n=>o.$emit("update:searchTerm",n.target.value))},null,40,Vo)]),e.createElementVNode("select",{class:"filter-select",value:r.selectedFilter,onChange:t[1]||(t[1]=n=>o.$emit("update:selectedFilter",n.target.value))},t[6]||(t[6]=[e.createStaticVNode('<option value="all">All Activities</option><option value="login">Login</option><option value="logout">Logout</option><option value="create">Create</option><option value="update">Update</option><option value="delete">Delete</option><option value="view">View</option>',7)]),40,yo),e.createElementVNode("button",{class:"btn btn-primary",onClick:t[2]||(t[2]=n=>o.$emit("refresh"))},"🔄 Refresh"),e.createElementVNode("button",{class:"btn btn-secondary",onClick:t[3]||(t[3]=n=>o.$emit("download"))},"📥 Download Report")]),e.createElementVNode("div",No,[e.createElementVNode("div",ko,[t[7]||(t[7]=e.createElementVNode("h3",null,"Total Activities",-1)),e.createElementVNode("div",bo,e.toDisplayString(r.totalActivities),1)]),e.createElementVNode("div",wo,[t[8]||(t[8]=e.createElementVNode("h3",null,"Today's Activities",-1)),e.createElementVNode("div",Do,e.toDisplayString(r.todayActivities),1)]),e.createElementVNode("div",uo,[t[9]||(t[9]=e.createElementVNode("h3",null,"Active Users",-1)),e.createElementVNode("div",Co,e.toDisplayString(r.activeUsers),1)]),t[10]||(t[10]=e.createElementVNode("div",{class:"stat-card"},[e.createElementVNode("h3",null,"Important"),e.createElementVNode("div",{class:"badge-danger"}," Logs are deleted at the end of every month, please download a copy ")],-1))]),e.createElementVNode("div",So,[r.loading?(e.openBlock(),e.createElementBlock("div",Bo,t[11]||(t[11]=[e.createElementVNode("div",{class:"spinner"},null,-1),e.createElementVNode("p",null,"Loading activity logs...",-1)]))):r.logs.length===0?(e.openBlock(),e.createElementBlock("div",_o,t[12]||(t[12]=[e.createElementVNode("h3",null,"No activities found",-1),e.createElementVNode("p",null,"Try adjusting your search or filter criteria",-1)]))):(e.openBlock(),e.createElementBlock("div",xo,[e.createElementVNode("table",To,[t[13]||(t[13]=e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[e.createElementVNode("th",null,"Timestamp"),e.createElementVNode("th",null,"User Name"),e.createElementVNode("th",null,"Action"),e.createElementVNode("th",null,"Details"),e.createElementVNode("th",null,"Section")])],-1)),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.paginatedLogs,n=>(e.openBlock(),e.createElementBlock("tr",{key:n.id},[e.createElementVNode("td",null,e.toDisplayString(l.formatDate(n.timestamp)),1),e.createElementVNode("td",null,[e.createElementVNode("div",null,e.toDisplayString(n.user_name),1),e.createElementVNode("small",Po,e.toDisplayString(n.email),1)]),e.createElementVNode("td",null,[e.createElementVNode("span",{class:e.normalizeClass(["activity-badge",l.getBadgeClass(n.action)])},e.toDisplayString(n.action),3)]),e.createElementVNode("td",null,[e.createTextVNode(e.toDisplayString(n.details.status)+" ",1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.details.information,(d,p)=>(e.openBlock(),e.createElementBlock("div",{key:p},[e.createElementVNode("strong",null,e.toDisplayString(p)+": ",1),e.createElementVNode("small",Mo,e.toDisplayString(d.from||"")+" → "+e.toDisplayString(d.to||d),1)]))),128))]),e.createElementVNode("td",null,e.toDisplayString(n.table_name),1)]))),128))])]),e.createElementVNode("div",Ao,[e.createElementVNode("button",{onClick:t[4]||(t[4]=n=>o.$emit("change-page",r.currentPage-1)),disabled:r.currentPage===1}," Previous ",8,qo),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.totalPages,n=>(e.openBlock(),e.createElementBlock("button",{key:n,onClick:d=>o.$emit("change-page",n),class:e.normalizeClass({active:r.currentPage===n})},e.toDisplayString(n),11,Fo))),128)),e.createElementVNode("button",{onClick:t[5]||(t[5]=n=>o.$emit("change-page",r.currentPage+1)),disabled:r.currentPage===r.totalPages}," Next ",8,Io)])]))])])}const b=f(ho,[["render",Ro]]),ii="",Lo={name:"CrewManagement",props:{crew:{type:Array,required:!0,default:()=>[]},vesselName:{type:String,default:""},userProfile:{type:Object,default:()=>({role:"viewer"})},loading:{type:Boolean,default:!1},availableRoles:{type:Array,default:()=>["Captain","First Officer","Engineer","Deckhand","Mechanic","Cook"]},config:{type:Object,default:()=>({showWaveBackground:!0,enableAdd:!0,enableEdit:!0,enableDelete:!0,enableAssignShift:!0,enableCertificationManagement:!0})}},emits:["crew-add","crew-edit","crew-delete","crew-assign-shift","crew-add-certification","crew-view-certification","search-changed","filter-changed","access-denied"],data(){return{searchQuery:"",filterStatus:"all",showAddForm:!1,formErrors:{},newCrew:{name:"",role:"Deckhand",customRole:"",status:"available",nextShift:"",certifications:[{name:"",expiryDate:""}],notes:"",email:"",onBoard:""}}},computed:{sectionTitle(){return this.vesselName?`Current Crew for ${this.vesselName}`:"All Fleet Crew"},filteredCrew(){return this.crew.filter(o=>{const t=this.searchQuery===""||o.name.toLowerCase().includes(this.searchQuery.toLowerCase())||o.role.toLowerCase().includes(this.searchQuery.toLowerCase())||o.vessel&&o.vessel.toLowerCase().includes(this.searchQuery.toLowerCase()),r=this.filterStatus==="all"||o.status===this.filterStatus;return t&&r})},canAddCrew(){return this.config.enableAdd&&this.hasPermission("add")},canEditCrew(){return this.config.enableEdit&&this.hasPermission("edit")},canDeleteCrew(){return this.config.enableDelete&&this.hasPermission("delete")},canAssignShift(){return this.config.enableAssignShift&&this.hasPermission("assign")}},methods:{hasPermission(o){var c;const{role:t}=this.userProfile;return((c={owner:["add","edit","delete","assign","view"],staff:["add","edit","assign","view"],captain:["assign","view"],viewer:["view"]}[t])==null?void 0:c.includes(o))||!1},handleToggleAddForm(){if(!this.canAddCrew){this.$emit("access-denied",{action:"add crew",userProfile:this.userProfile});return}this.showAddForm=!this.showAddForm,this.showAddForm||this.resetForm()},handleSearch(){this.$emit("search-changed",this.searchQuery)},handleFilter(){this.$emit("filter-changed",this.filterStatus)},handleAddCrewMember(){if(!this.validateForm())return;const o=this.newCrew.certifications.filter(c=>c.name.trim()!==""&&c.expiryDate!==""),t=this.newCrew.role==="Other"?this.newCrew.customRole:this.newCrew.role,r={name:this.newCrew.name,role:t,status:this.newCrew.status,certifications:o,notes:this.newCrew.notes,vessel:this.vesselName,email:this.newCrew.email,onBoard:this.newCrew.onBoard,nextShift:this.newCrew.nextShift};this.$emit("crew-add",r),this.resetForm(),this.showAddForm=!1},handleCancelForm(){this.showAddForm=!1,this.resetForm()},handleDeleteCrew(o){if(!this.canDeleteCrew){this.$emit("access-denied",{action:"delete crew",userProfile:this.userProfile});return}this.$emit("crew-delete",o)},handleAssignShift(o){if(!this.canAssignShift){this.$emit("access-denied",{action:"assign shift",userProfile:this.userProfile});return}this.$emit("crew-assign-shift",o)},handleAddCertification(o){if(!this.canEditCrew){this.$emit("access-denied",{action:"add certification",userProfile:this.userProfile});return}this.$emit("crew-add-certification",o)},handleViewCertification(o,t){this.$emit("crew-view-certification",{certification:o,member:t})},resetForm(){this.newCrew={name:"",role:"Deckhand",customRole:"",status:"available",nextShift:"",certifications:[{name:"",expiryDate:""}],notes:"",email:"",onBoard:""},this.formErrors={}},validateForm(){this.formErrors={};const o={name:"Full Name",email:"Email Address"};return Object.keys(o).forEach(t=>{(!this.newCrew[t]||this.newCrew[t].trim()==="")&&(this.formErrors[t]=`${o[t]} is required`)}),this.newCrew.email&&!this.isValidEmail(this.newCrew.email)&&(this.formErrors.email="Please enter a valid email address"),this.newCrew.role==="Other"&&(!this.newCrew.customRole||this.newCrew.customRole.trim()==="")&&(this.formErrors.customRole='Custom role is required when "Other" is selected'),Object.keys(this.formErrors).length===0},isValidEmail(o){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o)},addCertificationEntry(){this.newCrew.certifications.push({name:"",expiryDate:""})},removeCertification(o){this.newCrew.certifications.splice(o,1)},formatStatus(o){return o?o.charAt(0).toUpperCase()+o.slice(1):""},getStatusClass(o){return{available:"status-available",onduty:"status-onduty",unavailable:"status-unavailable"}[o]||""},getCertificationClass(o){const t=this.getExpiryStatus(o);return{expired:"text-danger",expiringSoon:"text-warning",valid:"text-success"}[t]||""},getExpiryStatus(o){if(!o)return"none";const t=new Date(o),r=new Date,c=new Date;return c.setMonth(r.getMonth()+1),t<=r?"expired":t<=c?"expiringSoon":"valid"}}},Oo={class:"crew-management"},Uo={key:0,class:"wave-bg"},jo={class:"crew-section"},$o={class:"section-header"},zo={class:"search-filter"},Ho={key:0,class:"loading-state"},Qo={key:1,class:"crew-grid"},Jo={class:"crew-name"},Wo={class:"crew-role"},Go={class:"crew-certifications"},Yo=["onClick"],Ko=["onClick"],Xo={class:"crew-availability"},Zo={class:"crew-availability"},vo={class:"action-buttons"},en={key:0,class:"status-available crew-availability vcard"},tn={key:1,class:"status-unavailable crew-availability vcard"},on=["onClick"],nn=["onClick"],sn={key:2,class:"no-results"},ln={key:3,class:"add-crew-form"},rn={class:"form-row"},an={class:"form-group"},dn={key:0,class:"error-message"},cn={class:"form-group"},mn=["value"],pn={class:"form-row"},hn={class:"form-group"},fn={class:"form-group"},gn={key:0,class:"error-message"},En={class:"certification-section"},Vn={class:"form-row"},yn={class:"form-group"},Nn=["onUpdate:modelValue"],kn={class:"form-group"},bn=["onUpdate:modelValue"],wn={class:"form-group"},Dn=["onClick"],un={class:"form-row"},Cn={class:"form-group"},Sn={class:"form-actions"};function Bn(o,t,r,c,s,l){return e.openBlock(),e.createElementBlock("div",Oo,[r.config.showWaveBackground?(e.openBlock(),e.createElementBlock("div",Uo)):e.createCommentVNode("",!0),e.createElementVNode("div",jo,[e.createElementVNode("div",$o,[e.createElementVNode("h2",null,e.toDisplayString(l.sectionTitle),1),l.canAddCrew?(e.openBlock(),e.createElementBlock("button",{key:0,class:"btn btn-primary",onClick:t[0]||(t[0]=(...n)=>l.handleToggleAddForm&&l.handleToggleAddForm(...n))},e.toDisplayString(s.showAddForm?"Cancel":"+ Add Crew Member"),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",zo,[e.withDirectives(e.createElementVNode("input",{type:"text",placeholder:"Search crew by name or role...","onUpdate:modelValue":t[1]||(t[1]=n=>s.searchQuery=n),onInput:t[2]||(t[2]=(...n)=>l.handleSearch&&l.handleSearch(...n))},null,544),[[e.vModelText,s.searchQuery]]),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":t[3]||(t[3]=n=>s.filterStatus=n),onChange:t[4]||(t[4]=(...n)=>l.handleFilter&&l.handleFilter(...n))},t[14]||(t[14]=[e.createElementVNode("option",{value:"all"},"All Statuses",-1),e.createElementVNode("option",{value:"available"},"Available",-1),e.createElementVNode("option",{value:"onduty"},"On Duty",-1),e.createElementVNode("option",{value:"unavailable"},"Unavailable",-1)]),544),[[e.vModelSelect,s.filterStatus]])]),r.loading?(e.openBlock(),e.createElementBlock("div",Ho,t[15]||(t[15]=[e.createElementVNode("div",{class:"spinner-border text-primary",role:"status"},[e.createElementVNode("span",{class:"visually-hidden"},"Loading crew...")],-1),e.createElementVNode("p",null,"Loading crew members...",-1)]))):l.filteredCrew.length>0?(e.openBlock(),e.createElementBlock("div",Qo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.filteredCrew,n=>(e.openBlock(),e.createElementBlock("div",{key:n.id,class:e.normalizeClass(["crew-card",{unavailable:n.status==="unavailable"}])},[e.createElementVNode("div",{class:e.normalizeClass(["status-badge",l.getStatusClass(n.status)])},e.toDisplayString(l.formatStatus(n.status)),3),e.createElementVNode("div",Jo,e.toDisplayString(n.name),1),e.createElementVNode("div",Wo,e.toDisplayString(n.role),1),e.createElementVNode("div",Go,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.certifications,d=>(e.openBlock(),e.createElementBlock("div",{key:d.name,class:e.normalizeClass(["certification-tag",l.getCertificationClass(d.expiryDate)]),onClick:p=>l.handleViewCertification(d,n)},e.toDisplayString(d.name),11,Yo))),128)),l.canEditCrew?(e.openBlock(),e.createElementBlock("i",{key:0,class:"bi bi-patch-plus-fill icon",onClick:d=>l.handleAddCertification(n)},null,8,Ko)):e.createCommentVNode("",!0)]),e.createElementVNode("div",Xo,[t[16]||(t[16]=e.createElementVNode("strong",null,"Embarkation Date:",-1)),e.createTextVNode(" "+e.toDisplayString(n.nextShift||"Not Scheduled"),1)]),e.createElementVNode("div",Zo,[t[17]||(t[17]=e.createElementVNode("strong",null,"Expected Days Onboard (in days):",-1)),e.createTextVNode(" "+e.toDisplayString(n.onBoard||"Not Scheduled"),1)]),e.createElementVNode("div",vo,[n.vessel?(e.openBlock(),e.createElementBlock("div",en," Vessel: "+e.toDisplayString(n.vessel),1)):(e.openBlock(),e.createElementBlock("div",tn," Vessel: Unassigned ")),l.canAssignShift?(e.openBlock(),e.createElementBlock("button",{key:2,class:"btn btn-primary",onClick:d=>l.handleAssignShift(n)}," Assign Shift ",8,on)):e.createCommentVNode("",!0)]),l.canDeleteCrew?(e.openBlock(),e.createElementBlock("i",{key:0,class:"bi bi-trash icon delete-icon",onClick:d=>l.handleDeleteCrew(n)},null,8,nn)):e.createCommentVNode("",!0)],2))),128))])):r.loading?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",sn,e.toDisplayString(r.crew.length===0?"No crew members found.":"No crew members found matching your search criteria."),1)),s.showAddForm?(e.openBlock(),e.createElementBlock("div",ln,[t[28]||(t[28]=e.createElementVNode("h2",null,"Add New Crew Member",-1)),e.createElementVNode("div",rn,[e.createElementVNode("div",an,[t[18]||(t[18]=e.createElementVNode("label",{for:"crew-name"},"Full Name *",-1)),e.withDirectives(e.createElementVNode("input",{type:"text",id:"crew-name","onUpdate:modelValue":t[5]||(t[5]=n=>s.newCrew.name=n),class:e.normalizeClass({error:s.formErrors.name})},null,2),[[e.vModelText,s.newCrew.name]]),s.formErrors.name?(e.openBlock(),e.createElementBlock("div",dn,e.toDisplayString(s.formErrors.name),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",cn,[t[20]||(t[20]=e.createElementVNode("label",{for:"crew-role"},"Role/Position *",-1)),e.withDirectives(e.createElementVNode("select",{id:"crew-role","onUpdate:modelValue":t[6]||(t[6]=n=>s.newCrew.role=n)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.availableRoles,n=>(e.openBlock(),e.createElementBlock("option",{key:n,value:n},e.toDisplayString(n),9,mn))),128)),t[19]||(t[19]=e.createElementVNode("option",{value:"Other"},"Other",-1))],512),[[e.vModelSelect,s.newCrew.role]]),s.newCrew.role==="Other"?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,type:"text",placeholder:"Enter custom role","onUpdate:modelValue":t[7]||(t[7]=n=>s.newCrew.customRole=n),style:{"margin-top":"8px"}},null,512)),[[e.vModelText,s.newCrew.customRole]]):e.createCommentVNode("",!0)])]),e.createElementVNode("div",pn,[e.createElementVNode("div",hn,[t[22]||(t[22]=e.createElementVNode("label",{for:"crew-status"},"Status *",-1)),e.withDirectives(e.createElementVNode("select",{id:"crew-status","onUpdate:modelValue":t[8]||(t[8]=n=>s.newCrew.status=n)},t[21]||(t[21]=[e.createElementVNode("option",{value:"available"},"Available",-1),e.createElementVNode("option",{value:"onduty"},"On Duty",-1),e.createElementVNode("option",{value:"unavailable"},"Unavailable",-1)]),512),[[e.vModelSelect,s.newCrew.status]])]),e.createElementVNode("div",fn,[t[23]||(t[23]=e.createElementVNode("label",{for:"crew-email"},"Email Address *",-1)),e.withDirectives(e.createElementVNode("input",{type:"email",id:"crew-email","onUpdate:modelValue":t[9]||(t[9]=n=>s.newCrew.email=n),class:e.normalizeClass({error:s.formErrors.email})},null,2),[[e.vModelText,s.newCrew.email]]),s.formErrors.email?(e.openBlock(),e.createElementBlock("div",gn,e.toDisplayString(s.formErrors.email),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",En,[t[26]||(t[26]=e.createElementVNode("h3",null,"Certifications",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.newCrew.certifications,(n,d)=>(e.openBlock(),e.createElementBlock("div",{key:d,class:"certification-entry"},[e.createElementVNode("div",Vn,[e.createElementVNode("div",yn,[t[24]||(t[24]=e.createElementVNode("label",null,"Certification Name",-1)),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":p=>n.name=p,placeholder:"Enter certification name"},null,8,Nn),[[e.vModelText,n.name]])]),e.createElementVNode("div",kn,[t[25]||(t[25]=e.createElementVNode("label",null,"Expiry Date",-1)),e.withDirectives(e.createElementVNode("input",{type:"date","onUpdate:modelValue":p=>n.expiryDate=p},null,8,bn),[[e.vModelText,n.expiryDate]])]),e.createElementVNode("div",wn,[s.newCrew.certifications.length>1?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"btn btn-danger btn-sm",onClick:p=>l.removeCertification(d)}," Remove ",8,Dn)):e.createCommentVNode("",!0)])])]))),128)),e.createElementVNode("button",{type:"button",class:"btn btn-secondary btn-sm",onClick:t[10]||(t[10]=(...n)=>l.addCertificationEntry&&l.addCertificationEntry(...n))}," + Add More Certification ")]),e.createElementVNode("div",un,[e.createElementVNode("div",Cn,[t[27]||(t[27]=e.createElementVNode("label",{for:"crew-notes"},"Notes",-1)),e.withDirectives(e.createElementVNode("textarea",{id:"crew-notes",rows:"3","onUpdate:modelValue":t[11]||(t[11]=n=>s.newCrew.notes=n)},null,512),[[e.vModelText,s.newCrew.notes]])])]),e.createElementVNode("div",Sn,[e.createElementVNode("button",{class:"btn btn-secondary",onClick:t[12]||(t[12]=(...n)=>l.handleCancelForm&&l.handleCancelForm(...n))},"Cancel"),e.createElementVNode("button",{class:"btn btn-primary",onClick:t[13]||(t[13]=(...n)=>l.handleAddCrewMember&&l.handleAddCrewMember(...n))},"Add Crew Member")])])):e.createCommentVNode("",!0)])])}const w=f(Lo,[["render",Bn]]),ri="",_n={name:"RequisitionSystem",props:{userProfile:{type:Object,required:!0},userRole:{type:String,required:!0},requisitions:{type:Array,default:()=>[]},vessels:{type:Array,default:()=>[]}},emits:["submit-requisition","submit-info-response","approve-requisition","decline-requisition","info-requisition","create-po","open-po","finish-po","accept-delivery"],data(){return{activeTab:"workflow",isPrinting:!1,infoResponse:"",tabs:[{name:"new-requisition",label:"New Requisition",roles:["requisitor"]},{name:"my-requisitions",label:"My Requisitions",roles:["requisitor"]},{name:"all-requisitions",label:"All Requisitions",roles:["requisitor","supervisor","captain","owner","purchaser"]},{name:"approvals",label:"Pending Approvals",roles:["owner","supervisor","captain"]},{name:"purchasing",label:"Purchasing Queue",roles:["purchaser"]},{name:"receiving",label:"Receiving",roles:["requisitor"]},{name:"workflow",label:"Workflow Guide",roles:["requisitor","supervisor","owner","purchaser","captain"]}],form:{requestor:"",department:"",project:"",neededDate:"",justification:"",items:[]},poDetails:{editing:!1,items:[]},vendorInfo:{},justificationText:"",currentItemIndex:null,showJustificationModal:!1,requisitionFields:[{label:"Requestor",value:o=>o.requestor},{label:"Department",value:o=>o.department},{label:"Project",value:o=>o.project||"N/A"},{label:"Submitted",value:o=>o.submittedDate},{label:"Items",value:o=>`${o.items.length} item(s)`}],requisitionFieldsMap:{approved:[{label:"Approved By",value:o=>o.approvedBy}],declined:[{label:"Declined By",value:o=>o.declinedBy},{label:"Rejection Reason",value:o=>o.rejectionReason}],"info-requested":[{label:"Info Requester",value:o=>o.infoRequestedBy},{label:"Requested Info",value:o=>o.requestedInfo}]},departments:["Marine Operations","Engineering","Maintenance","Safety & Compliance","Logistics","Administration","Engine Room"],priorities:["Urgent - Same Day","High - Within 3 Days","Normal - Within 1 Week","Low - Within 2 Weeks"],units:["Pieces","Kilograms","Liters","Meters","Sets","Boxes"]}},computed:{visibleTabs(){return this.tabs.filter(o=>o.roles.includes(this.userRole))},subTotal(){return(this.poDetails.items||[]).reduce((o,t)=>o+t.unitPrice*t.qty,0)},reviewRequisitions(){return this.requisitions.filter(o=>o.status==="under-review")},poRequisitions(){return this.requisitions.filter(o=>o.status==="approved")},awaitingDelivery(){return this.requisitions.filter(o=>o.status==="po-created")},currentItem(){return this.currentItemIndex!==null?this.poDetails.items[this.currentItemIndex]:null},myRequisitions(){const o=this.userProfile.id||this.userProfile.profile_id;return this.requisitions.filter(t=>t.profile_id==o)}},methods:{setActiveTab(o){this.activeTab=o},getOptional(o){return typeof o=="number"?o.toFixed(2):"0.00"},getRequisitionFields(o){const t=this.requisitionFieldsMap[o.status]||[];return[...this.requisitionFields||[],...t]},addItem(){this.form.items.push({id:"",desc:"",qty:1,unit:"Pieces",cost:0})},removeItem(o){this.form.items.splice(o,1)},startEdit(o){this.poDetails.items[o].editing=!0,this.poDetails.items[o].tempPrice=this.poDetails.items[o].unitPrice},cancelEdit(o){this.poDetails.items[o].editing=!1,this.poDetails.items[o].tempPrice=this.poDetails.items[o].unitPrice},savePrice(o){const t=this.poDetails.items[o];t.tempPrice!==t.cost?(this.currentItemIndex=o,this.showJustificationModal=!0):(t.unitPrice=t.tempPrice,t.editing=!1)},confirmPriceChange(){if(!this.justificationText.trim()){alert("Please provide a justification for the price change.");return}const o=this.poDetails.items[this.currentItemIndex];o.unitPrice=o.tempPrice,o.cost=o.tempPrice,o.justification=this.justificationText.trim(),o.editing=!1,this.closeJustificationModal()},closeJustificationModal(){this.showJustificationModal=!1,this.currentItemIndex=null,this.justificationText=""},handleSubmitRequisition(){const o=this.collectFormData("under-review");this.$emit("submit-requisition",o),this.resetForm()},handleSubmitInfoResponse(o){if(!this.infoResponse||this.infoResponse.trim()===""){alert("Please enter a response before submitting.");return}this.$emit("submit-info-response",{req:o,response:this.infoResponse}),this.infoResponse=""},handleApproveRequisition(o){this.$emit("approve-requisition",o)},handleDeclineRequisition(o){this.$emit("decline-requisition",o)},handleInfoRequisition(o){this.$emit("info-requisition",o)},handleCreatePO(o){this.$emit("create-po",o)},handleOpenPO(o){this.$emit("open-po",o)},handleFinishPO(o){this.$emit("finish-po",o)},handleAcceptDelivery(o){this.$emit("accept-delivery",o)},collectFormData(o){return{id:"REQ-"+Date.now(),requestor:this.userProfile.full_name,department:this.form.department,project:this.form.project,neededDate:this.form.neededDate,justification:this.form.justification,items:this.form.items.map(t=>({...t})),status:o,submittedDate:new Date().toLocaleDateString(),profile_id:this.userProfile.id||this.userProfile.profile_id}},resetForm(){this.form={requestor:"",department:"",project:"",neededDate:"",justification:"",items:[]},this.addItem()},updatePODetails(o){this.poDetails=o,this.getNumber();for(let t of this.poDetails.items)t.tempPrice=t.cost,t.unitPrice=t.cost,t.subTotal=t.unitPrice*t.qty},updateVendorInfo(o){this.vendorInfo=o},setPrintingMode(o){this.isPrinting=o},getNumber(){return(this.poDetails.items||[]).map((o,t)=>o.itemNumber=t+1)}},created(){this.addItem()}},xn={class:"s-container container"},Tn={class:"nav-tabs"},Pn=["onClick"],Mn={key:0,class:"tab-content active"},An={class:"form-grid"},qn={class:"form-group"},Fn=["value"],In={class:"form-group"},Rn=["value"],Ln={class:"form-group"},On=["value"],Un={class:"form-group"},jn={class:"form-group"},$n={class:"items-section"},zn={class:"items-header"},Hn={class:"form-group"},Qn=["onUpdate:modelValue"],Jn={class:"form-group"},Wn=["onUpdate:modelValue"],Gn={class:"form-group"},Yn=["onUpdate:modelValue"],Kn={class:"form-group"},Xn=["onUpdate:modelValue"],Zn=["value"],vn={class:"form-group"},es=["onUpdate:modelValue"],ts=["onClick"],os={key:1,class:"tab-content active"},ns={class:"requisition-list"},ss={class:"requisition-header"},ls={class:"requisition-id"},is={class:"requisition-details"},rs={class:"detail-label"},as={class:"detail-value"},ds={key:0,class:"form-group comments-section"},cs=["onClick"],ms={key:2,class:"tab-content active"},ps={class:"requisition-list"},hs={class:"requisition-header"},fs={class:"requisition-id"},gs={class:"requisition-details"},Es={class:"detail-label"},Vs={class:"detail-value"},ys={key:0,class:"form-group comments-section"},Ns=["onClick"],ks={key:3,class:"tab-content active"},bs={class:"requisition-list",id:"approvalsQueue"},ws={class:"requisition-header"},Ds={class:"requisition-id"},us={class:"requisition-details"},Cs={class:"detail-label"},Ss={class:"detail-value"},Bs={class:"detail-item"},_s={class:"detail-value"},xs={class:"detail-item"},Ts={class:"item-list"},Ps=["onClick"],Ms=["onClick"],As=["onClick"],qs={key:4,class:"tab-content active"},Fs={class:"requisition-list",id:"purchasingQueue"},Is={class:"requisition-header"},Rs={class:"requisition-id"},Ls={class:"requisition-details"},Os={class:"detail-label"},Us={class:"detail-value"},js={class:"detail-item"},$s={class:"detail-value"},zs={class:"detail-item"},Hs={class:"item-list"},Qs=["onClick"],Js={key:5,class:"tab-content active"},Ws={class:"requisition-list",id:"receivingQueue"},Gs={class:"requisition-header"},Ys={class:"requisition-id"},Ks={class:"requisition-details"},Xs={class:"detail-label"},Zs={class:"detail-value"},vs={class:"detail-item"},el={class:"detail-value"},tl={class:"detail-item"},ol={class:"item-list"},nl=["onClick"],sl={key:6,class:"tab-content active"},ll={class:"po-content",id:"po-content"},il={class:"po-header"},rl={class:"company-info"},al={class:"info-row"},dl={class:"info-value"},cl={class:"info-row"},ml={class:"info-value"},pl={class:"info-row"},hl={class:"info-value"},fl={class:"info-row"},gl={class:"info-value"},El={class:"info-row"},Vl={class:"info-value"},yl={class:"company-info"},Nl={class:"info-row"},kl={class:"info-value"},bl={class:"info-row"},wl={class:"info-value"},Dl={class:"info-row"},ul={class:"info-value"},Cl={class:"info-row"},Sl={class:"info-value"},Bl={class:"info-row"},_l={class:"info-value"},xl={class:"items-section"},Tl={class:"items-table"},Pl={key:0},Ml={key:0},Al={key:0,class:"price-change-indicator"},ql=["onUpdate:modelValue"],Fl={key:0},Il=["onClick"],Rl={key:1},Ll=["onClick"],Ol=["onClick"],Ul={key:0,class:"justification-note"},jl={class:"totals"},$l={class:"total-row"},zl={class:"total-row"},Hl={class:"total-row"},Ql={class:"total-row grand-total"},Jl={class:"modal-content"},Wl={style:{"margin-bottom":"15px",color:"#666"}},Gl={class:"modal-buttons"},Yl=["disabled"],Kl={key:7,class:"tab-content active"};function Xl(o,t,r,c,s,l){var n,d,p,g,E,u,C,S,B,_,x;return e.openBlock(),e.createElementBlock("div",xn,[t[62]||(t[62]=e.createElementVNode("div",{class:"header"},[e.createElementVNode("h1",null,"OceanHelm Requisition System"),e.createElementVNode("p",null,"Streamlined Material Request & Ordering Process")],-1)),e.createElementVNode("div",Tn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.visibleTabs,i=>(e.openBlock(),e.createElementBlock("button",{key:i.name,class:e.normalizeClass(["nav-tab",{active:s.activeTab===i.name}]),onClick:a=>l.setActiveTab(i.name)},e.toDisplayString(i.label),11,Pn))),128))]),s.activeTab==="new-requisition"?(e.openBlock(),e.createElementBlock("div",Mn,[e.createElementVNode("form",{onSubmit:t[5]||(t[5]=e.withModifiers((...i)=>l.handleSubmitRequisition&&l.handleSubmitRequisition(...i),["prevent"]))},[e.createElementVNode("div",An,[e.createElementVNode("div",qn,[t[12]||(t[12]=e.createElementVNode("label",null,"Requestor Name *",-1)),e.createElementVNode("input",{type:"text",value:r.userProfile.full_name,readonly:"",required:"",class:"form-control"},null,8,Fn)]),e.createElementVNode("div",In,[t[14]||(t[14]=e.createElementVNode("label",null,"Department *",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":t[0]||(t[0]=i=>s.form.department=i),required:""},[t[13]||(t[13]=e.createElementVNode("option",{value:""},"Select Department",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.departments,i=>(e.openBlock(),e.createElementBlock("option",{key:i,value:i},e.toDisplayString(i),9,Rn))),128))],512),[[e.vModelSelect,s.form.department]])]),e.createElementVNode("div",Ln,[t[16]||(t[16]=e.createElementVNode("label",null,"Vessel *",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":t[1]||(t[1]=i=>s.form.project=i),class:"form-control",required:""},[t[15]||(t[15]=e.createElementVNode("option",{disabled:"",value:""},"Select a vessel",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.vessels,i=>(e.openBlock(),e.createElementBlock("option",{key:i.id,value:i.name},e.toDisplayString(i.name),9,On))),128))],512),[[e.vModelSelect,s.form.project]])]),e.createElementVNode("div",Un,[t[17]||(t[17]=e.createElementVNode("label",null,"Date Needed *",-1)),e.withDirectives(e.createElementVNode("input",{type:"date","onUpdate:modelValue":t[2]||(t[2]=i=>s.form.neededDate=i),required:""},null,512),[[e.vModelText,s.form.neededDate]])])]),e.createElementVNode("div",jn,[t[18]||(t[18]=e.createElementVNode("label",null,"Business Justification *",-1)),e.withDirectives(e.createElementVNode("textarea",{"onUpdate:modelValue":t[3]||(t[3]=i=>s.form.justification=i),placeholder:"Explain why these materials are needed...",required:""},null,512),[[e.vModelText,s.form.justification]])]),e.createElementVNode("div",$n,[e.createElementVNode("div",zn,[t[19]||(t[19]=e.createElementVNode("h3",null,"Requested Items",-1)),e.createElementVNode("button",{type:"button",class:"add-item-btn",onClick:t[4]||(t[4]=(...i)=>l.addItem&&l.addItem(...i))},"+ Add Item")]),e.createElementVNode("div",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.form.items,(i,a)=>(e.openBlock(),e.createElementBlock("div",{key:a,class:"item-row"},[e.createElementVNode("div",Hn,[t[20]||(t[20]=e.createElementVNode("label",null,"Item Code *",-1)),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":m=>i.id=m,required:""},null,8,Qn),[[e.vModelText,i.id]])]),e.createElementVNode("div",Jn,[t[21]||(t[21]=e.createElementVNode("label",null,"Item Description *",-1)),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":m=>i.desc=m,required:""},null,8,Wn),[[e.vModelText,i.desc]])]),e.createElementVNode("div",Gn,[t[22]||(t[22]=e.createElementVNode("label",null,"Quantity *",-1)),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":m=>i.qty=m,min:"1",required:""},null,8,Yn),[[e.vModelText,i.qty,void 0,{number:!0}]])]),e.createElementVNode("div",Kn,[t[23]||(t[23]=e.createElementVNode("label",null,"Unit *",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":m=>i.unit=m,required:""},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.units,m=>(e.openBlock(),e.createElementBlock("option",{key:m,value:m},e.toDisplayString(m),9,Zn))),128))],8,Xn),[[e.vModelSelect,i.unit]])]),e.createElementVNode("div",vn,[t[24]||(t[24]=e.createElementVNode("label",null,"Est. Unit Cost *",-1)),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":m=>i.cost=m,step:"0.01",placeholder:"0.00",required:""},null,8,es),[[e.vModelText,i.cost,void 0,{number:!0}]])]),e.createElementVNode("button",{type:"button",class:"remove-item-btn",onClick:m=>l.removeItem(a)},"Remove",8,ts)]))),128))])]),t[25]||(t[25]=e.createElementVNode("div",{class:"action-buttons"},[e.createElementVNode("button",{type:"submit",class:"btn btn-primary"},"Submit Requisition")],-1))],32)])):e.createCommentVNode("",!0),s.activeTab==="all-requisitions"?(e.openBlock(),e.createElementBlock("div",os,[e.createElementVNode("div",ns,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.requisitions,i=>(e.openBlock(),e.createElementBlock("div",{key:i.id,class:"requisition-card"},[e.createElementVNode("div",ss,[e.createElementVNode("div",ls,e.toDisplayString(i.id),1),e.createElementVNode("div",{class:e.normalizeClass(["status-badge",`status-${i.status}`])},e.toDisplayString(i.status),3)]),e.createElementVNode("div",is,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.getRequisitionFields(i),a=>(e.openBlock(),e.createElementBlock("div",{class:"detail-item",key:a.label},[e.createElementVNode("div",rs,e.toDisplayString(a.label),1),e.createElementVNode("div",as,e.toDisplayString(a.value(i)),1)]))),128))]),i.status==="po-created"||i.status==="delivered"?(e.openBlock(),e.createElementBlock("div",ds,[e.createElementVNode("button",{onClick:a=>l.handleOpenPO(i.id),class:"add-item-btn comments-section"}," Print PO ",8,cs)])):e.createCommentVNode("",!0)]))),128))])])):e.createCommentVNode("",!0),s.activeTab==="my-requisitions"?(e.openBlock(),e.createElementBlock("div",ms,[e.createElementVNode("div",ps,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.myRequisitions,i=>(e.openBlock(),e.createElementBlock("div",{key:i.id,class:"requisition-card"},[e.createElementVNode("div",hs,[e.createElementVNode("div",fs,e.toDisplayString(i.id),1),e.createElementVNode("div",{class:e.normalizeClass(["status-badge",`status-${i.status}`])},e.toDisplayString(i.status),3)]),e.createElementVNode("div",gs,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.getRequisitionFields(i),a=>(e.openBlock(),e.createElementBlock("div",{class:"detail-item",key:a.label},[e.createElementVNode("div",Es,e.toDisplayString(a.label),1),e.createElementVNode("div",Vs,e.toDisplayString(a.value(i)),1)]))),128))]),i.status==="info-requested"?(e.openBlock(),e.createElementBlock("div",ys,[t[26]||(t[26]=e.createElementVNode("label",{class:"detail-label"},"Your Response",-1)),e.withDirectives(e.createElementVNode("textarea",{"onUpdate:modelValue":t[6]||(t[6]=a=>s.infoResponse=a),class:"response-textarea",placeholder:"Submit more info..."},null,512),[[e.vModelText,s.infoResponse]]),e.createElementVNode("button",{onClick:a=>l.handleSubmitInfoResponse(i),class:"add-item-btn comments-section"}," Submit Info ",8,Ns)])):e.createCommentVNode("",!0)]))),128))])])):e.createCommentVNode("",!0),s.activeTab==="approvals"?(e.openBlock(),e.createElementBlock("div",ks,[t[29]||(t[29]=e.createElementVNode("div",{style:{"margin-bottom":"20px"}},[e.createElementVNode("h3",{style:{color:"#1e40af","margin-bottom":"15px"}},"Department Supervisor Dashboard"),e.createElementVNode("div",{style:{background:"#fef3c7",padding:"15px","border-radius":"10px","border-left":"4px solid #f59e0b"}},[e.createElementVNode("strong",null,"Role:"),e.createTextVNode(" Department Supervisor - Review requests for accuracy, necessity, and budget compliance ")])],-1)),e.createElementVNode("div",bs,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.reviewRequisitions,i=>(e.openBlock(),e.createElementBlock("div",{key:i.id,class:"requisition-card"},[e.createElementVNode("div",ws,[e.createElementVNode("div",Ds,e.toDisplayString(i.id),1)]),e.createElementVNode("div",us,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.requisitionFields,a=>(e.openBlock(),e.createElementBlock("div",{class:"detail-item",key:a.label},[e.createElementVNode("div",Cs,e.toDisplayString(a.label),1),e.createElementVNode("div",Ss,e.toDisplayString(a.value(i)),1)]))),128))]),e.createElementVNode("div",Bs,[t[27]||(t[27]=e.createElementVNode("div",{class:"detail-label"},"Justification",-1)),e.createElementVNode("div",_s,e.toDisplayString(i.justification||"N/A"),1)]),e.createElementVNode("div",xs,[t[28]||(t[28]=e.createElementVNode("div",{class:"detail-label"},"Items",-1)),e.createElementVNode("ul",Ts,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.items,(a,m)=>(e.openBlock(),e.createElementBlock("li",{key:m},e.toDisplayString(a.desc)+" - "+e.toDisplayString(a.qty)+" "+e.toDisplayString(a.unit)+" @ ₦"+e.toDisplayString(a.cost.toFixed(2))+" each ",1))),128))])]),e.createElementVNode("button",{type:"button",class:"add-item-btn",onClick:a=>l.handleApproveRequisition(i.id)},"Approve",8,Ps),e.createElementVNode("button",{type:"button",class:"marginbox btn-reject",onClick:a=>l.handleDeclineRequisition(i.id)},"Decline",8,Ms),e.createElementVNode("button",{type:"button",class:"marginbox btn-request",onClick:a=>l.handleInfoRequisition(i.id)},"Request Info",8,As)]))),128))])])):e.createCommentVNode("",!0),s.activeTab==="purchasing"?(e.openBlock(),e.createElementBlock("div",qs,[t[32]||(t[32]=e.createElementVNode("div",{style:{"margin-bottom":"20px"}},[e.createElementVNode("h3",{style:{color:"#1e40af","margin-bottom":"15px"}},"Purchasing Department Dashboard"),e.createElementVNode("div",{style:{background:"#dbeafe",padding:"15px","border-radius":"10px","border-left":"4px solid #3b82f6"}},[e.createElementVNode("strong",null,"Role:"),e.createTextVNode(" Purchasing Team - Convert approved requisitions to Purchase Orders ")])],-1)),e.createElementVNode("div",Fs,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.poRequisitions,i=>(e.openBlock(),e.createElementBlock("div",{key:i.id,class:"requisition-card"},[e.createElementVNode("div",Is,[e.createElementVNode("div",Rs,e.toDisplayString(i.id),1)]),e.createElementVNode("div",Ls,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.requisitionFields,a=>(e.openBlock(),e.createElementBlock("div",{class:"detail-item",key:a.label},[e.createElementVNode("div",Os,e.toDisplayString(a.label),1),e.createElementVNode("div",Us,e.toDisplayString(a.value(i)),1)]))),128))]),e.createElementVNode("div",js,[t[30]||(t[30]=e.createElementVNode("div",{class:"detail-label"},"Justification",-1)),e.createElementVNode("div",$s,e.toDisplayString(i.justification||"N/A"),1)]),e.createElementVNode("div",zs,[t[31]||(t[31]=e.createElementVNode("div",{class:"detail-label"},"Items",-1)),e.createElementVNode("ul",Hs,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.items,(a,m)=>(e.openBlock(),e.createElementBlock("li",{key:m},e.toDisplayString(a.desc)+" - "+e.toDisplayString(a.qty)+" "+e.toDisplayString(a.unit)+" @ ₦"+e.toDisplayString(a.cost.toFixed(2))+" each ",1))),128))])]),e.createElementVNode("button",{type:"button",class:"add-item-btn",onClick:a=>l.handleCreatePO(i.id)},"Create PO",8,Qs)]))),128))])])):e.createCommentVNode("",!0),s.activeTab==="receiving"?(e.openBlock(),e.createElementBlock("div",Js,[t[35]||(t[35]=e.createElementVNode("div",{style:{"margin-bottom":"20px"}},[e.createElementVNode("h3",{style:{color:"#1e40af","margin-bottom":"15px"}},"Receiving & Inventory Dashboard"),e.createElementVNode("div",{style:{background:"#dcfce7",padding:"15px","border-radius":"10px","border-left":"4px solid #10b981"}},[e.createElementVNode("strong",null,"Role:"),e.createTextVNode(" Warehouse Team - Process incoming deliveries and update inventory ")])],-1)),e.createElementVNode("div",Ws,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.awaitingDelivery,i=>(e.openBlock(),e.createElementBlock("div",{key:i.id,class:"requisition-card"},[e.createElementVNode("div",Gs,[e.createElementVNode("div",Ys,e.toDisplayString(i.id),1)]),e.createElementVNode("div",Ks,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.requisitionFields,a=>(e.openBlock(),e.createElementBlock("div",{class:"detail-item",key:a.label},[e.createElementVNode("div",Xs,e.toDisplayString(a.label),1),e.createElementVNode("div",Zs,e.toDisplayString(a.value(i)),1)]))),128))]),e.createElementVNode("div",vs,[t[33]||(t[33]=e.createElementVNode("div",{class:"detail-label"},"Justification",-1)),e.createElementVNode("div",el,e.toDisplayString(i.justification||"N/A"),1)]),e.createElementVNode("div",tl,[t[34]||(t[34]=e.createElementVNode("div",{class:"detail-label"},"Items",-1)),e.createElementVNode("ul",ol,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.items,(a,m)=>(e.openBlock(),e.createElementBlock("li",{key:m},e.toDisplayString(a.desc)+" - "+e.toDisplayString(a.qty)+" "+e.toDisplayString(a.unit)+" @ ₦"+e.toDisplayString(a.cost.toFixed(2))+" each ",1))),128))])]),e.createElementVNode("button",{type:"button",class:"add-item-btn",onClick:a=>l.handleAcceptDelivery(i.id)},"Accept Delivery",8,nl)]))),128))])])):e.createCommentVNode("",!0),s.activeTab==="po"?(e.openBlock(),e.createElementBlock("div",sl,[e.createElementVNode("div",ll,[e.createElementVNode("div",il,[e.createElementVNode("div",rl,[t[41]||(t[41]=e.createElementVNode("h3",null,"Vendor Information",-1)),e.createElementVNode("div",al,[t[36]||(t[36]=e.createElementVNode("span",{class:"info-label"},"Company:",-1)),e.createElementVNode("span",dl,e.toDisplayString(s.vendorInfo.company||((n=s.poDetails.vendorInfo)==null?void 0:n.company)),1)]),e.createElementVNode("div",cl,[t[37]||(t[37]=e.createElementVNode("span",{class:"info-label"},"Contact:",-1)),e.createElementVNode("span",ml,e.toDisplayString(s.vendorInfo.contact||((d=s.poDetails.vendorInfo)==null?void 0:d.contact)),1)]),e.createElementVNode("div",pl,[t[38]||(t[38]=e.createElementVNode("span",{class:"info-label"},"Email:",-1)),e.createElementVNode("span",hl,e.toDisplayString(s.vendorInfo.email||((p=s.poDetails.vendorInfo)==null?void 0:p.email)),1)]),e.createElementVNode("div",fl,[t[39]||(t[39]=e.createElementVNode("span",{class:"info-label"},"Phone:",-1)),e.createElementVNode("span",gl,e.toDisplayString(s.vendorInfo.phone||((g=s.poDetails.vendorInfo)==null?void 0:g.phone)),1)]),e.createElementVNode("div",El,[t[40]||(t[40]=e.createElementVNode("span",{class:"info-label"},"Address:",-1)),e.createElementVNode("span",Vl,e.toDisplayString(s.vendorInfo.address||((E=s.poDetails.vendorInfo)==null?void 0:E.address)),1)])]),e.createElementVNode("div",yl,[t[47]||(t[47]=e.createElementVNode("h3",null,"Purchase Order Details",-1)),e.createElementVNode("div",Nl,[t[42]||(t[42]=e.createElementVNode("span",{class:"info-label"},"PO Number:",-1)),e.createElementVNode("span",kl,e.toDisplayString(s.poDetails.id),1)]),e.createElementVNode("div",bl,[t[43]||(t[43]=e.createElementVNode("span",{class:"info-label"},"Date:",-1)),e.createElementVNode("span",wl,e.toDisplayString(s.vendorInfo.poDate||((u=s.poDetails.vendorInfo)==null?void 0:u.poDate)),1)]),e.createElementVNode("div",Dl,[t[44]||(t[44]=e.createElementVNode("span",{class:"info-label"},"Requested By:",-1)),e.createElementVNode("span",ul,e.toDisplayString(s.vendorInfo.poApproved||((C=s.poDetails.vendorInfo)==null?void 0:C.poApproved)),1)]),e.createElementVNode("div",Cl,[t[45]||(t[45]=e.createElementVNode("span",{class:"info-label"},"Department:",-1)),e.createElementVNode("span",Sl,"PO-"+e.toDisplayString(s.poDetails.department),1)]),e.createElementVNode("div",Bl,[t[46]||(t[46]=e.createElementVNode("span",{class:"info-label"},"Delivery Date:",-1)),e.createElementVNode("span",_l,e.toDisplayString(s.poDetails.neededDate),1)])])]),e.createElementVNode("div",xl,[t[57]||(t[57]=e.createElementVNode("h2",{class:"section-title"},"Order Items",-1)),e.createElementVNode("table",Tl,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[t[48]||(t[48]=e.createElementVNode("th",null,"Item #",-1)),t[49]||(t[49]=e.createElementVNode("th",null,"Description",-1)),t[50]||(t[50]=e.createElementVNode("th",null,"Quantity",-1)),t[51]||(t[51]=e.createElementVNode("th",null,"Unit Price",-1)),t[52]||(t[52]=e.createElementVNode("th",null,"Total",-1)),s.isPrinting?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("th",Pl,"Actions"))])]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.poDetails.items||[],(i,a)=>(e.openBlock(),e.createElementBlock("tr",{key:a},[e.createElementVNode("td",null,e.toDisplayString(i.itemNumber),1),e.createElementVNode("td",null,e.toDisplayString(i.desc),1),e.createElementVNode("td",null,e.toDisplayString(i.qty),1),e.createElementVNode("td",null,[i.editing?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:1,"onUpdate:modelValue":m=>i.tempPrice=m,type:"number",step:"0.01",class:e.normalizeClass(["price-input",{"price-changed":i.cost!==i.tempPrice}])},null,10,ql)),[[e.vModelText,i.tempPrice,void 0,{number:!0}]]):(e.openBlock(),e.createElementBlock("span",Ml,[e.createTextVNode(" $"+e.toDisplayString(i.cost.toFixed(2))+" ",1),i.cost!==i.unitPrice?(e.openBlock(),e.createElementBlock("span",Al,"!")):e.createCommentVNode("",!0)]))]),e.createElementVNode("td",null,"$"+e.toDisplayString((i.unitPrice*i.qty).toFixed(2)),1),s.isPrinting?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("td",Fl,[i.editing?(e.openBlock(),e.createElementBlock("div",Rl,[e.createElementVNode("button",{onClick:m=>l.savePrice(a),class:"save-btn"},"Save",8,Ll),e.createElementVNode("button",{onClick:m=>l.cancelEdit(a),class:"cancel-btn"},"Cancel",8,Ol)])):(e.openBlock(),e.createElementBlock("button",{key:0,onClick:m=>l.startEdit(a),class:"edit-btn"}," Edit Price ",8,Il))]))]))),128))])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.poDetails.items||[],(i,a)=>(e.openBlock(),e.createElementBlock("div",{key:"note-"+a},[i.justification?(e.openBlock(),e.createElementBlock("div",Ul,[e.createElementVNode("strong",null,"Price Change Justification (Item "+e.toDisplayString(i.itemNumber)+"):",1),e.createTextVNode(" "+e.toDisplayString(i.justification),1)])):e.createCommentVNode("",!0)]))),128)),e.createElementVNode("div",jl,[e.createElementVNode("div",$l,[t[53]||(t[53]=e.createElementVNode("span",null,"Subtotal:",-1)),e.createElementVNode("span",null,"$"+e.toDisplayString(l.subTotal.toFixed(2)),1)]),e.createElementVNode("div",zl,[t[54]||(t[54]=e.createElementVNode("span",null,"Tax (%):",-1)),e.createElementVNode("span",null,"$"+e.toDisplayString(l.getOptional(s.vendorInfo.tax)),1)]),e.createElementVNode("div",Hl,[t[55]||(t[55]=e.createElementVNode("span",null,"Shipping:",-1)),e.createElementVNode("span",null,"$"+e.toDisplayString(l.getOptional(s.vendorInfo.shipping)),1)]),e.createElementVNode("div",Ql,[t[56]||(t[56]=e.createElementVNode("span",null,"Grand Total:",-1)),e.createElementVNode("span",null,"$"+e.toDisplayString((l.subTotal+l.getOptional(s.vendorInfo.tax)+l.getOptional(s.vendorInfo.shipping)).toFixed(2)),1)])])])]),s.showJustificationModal?(e.openBlock(),e.createElementBlock("div",{key:0,class:"justification-modal",onClick:t[10]||(t[10]=e.withModifiers((...i)=>l.closeJustificationModal&&l.closeJustificationModal(...i),["self"]))},[e.createElementVNode("div",Jl,[t[60]||(t[60]=e.createElementVNode("h3",null,"Price Change Justification Required",-1)),e.createElementVNode("p",Wl,[t[58]||(t[58]=e.createTextVNode(" Please provide a justification for changing the price from ",-1)),e.createElementVNode("strong",null,"$"+e.toDisplayString((B=(S=l.currentItem)==null?void 0:S.cost)==null?void 0:B.toFixed(2)),1),t[59]||(t[59]=e.createTextVNode(" to ",-1)),e.createElementVNode("strong",null,"$"+e.toDisplayString((x=(_=l.currentItem)==null?void 0:_.tempPrice)==null?void 0:x.toFixed(2)),1)]),e.withDirectives(e.createElementVNode("textarea",{"onUpdate:modelValue":t[7]||(t[7]=i=>s.justificationText=i),class:"justification-textarea",placeholder:"Enter justification for price change...",required:""},null,512),[[e.vModelText,s.justificationText]]),e.createElementVNode("div",Gl,[e.createElementVNode("button",{onClick:t[8]||(t[8]=(...i)=>l.closeJustificationModal&&l.closeJustificationModal(...i)),class:"cancel-btn"},"Cancel"),e.createElementVNode("button",{onClick:t[9]||(t[9]=(...i)=>l.confirmPriceChange&&l.confirmPriceChange(...i)),class:"save-btn",disabled:!s.justificationText.trim()}," Confirm Change ",8,Yl)])])])):e.createCommentVNode("",!0),s.isPrinting?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"add-item-btn",onClick:t[11]||(t[11]=i=>l.handleFinishPO(s.poDetails.id))},"Approve PO"))])):e.createCommentVNode("",!0),s.activeTab==="workflow"?(e.openBlock(),e.createElementBlock("div",Kl,t[61]||(t[61]=[e.createStaticVNode('<div class="workflow-steps"><div class="workflow-step"><div class="step-icon completed">1</div><div class="step-title">Request Submitted</div></div><div class="workflow-step"><div class="step-icon active">2</div><div class="step-title">Department Review</div></div><div class="workflow-step"><div class="step-icon">3</div><div class="step-title">Management Approval</div></div><div class="workflow-step"><div class="step-icon">4</div><div class="step-title">Purchase Order Created</div></div><div class="workflow-step"><div class="step-icon">5</div><div class="step-title">Order Fulfilled</div></div></div><div style="background:white;padding:30px;border-radius:15px;margin-top:20px;"><h3 style="color:#1e40af;margin-bottom:20px;">Requisition Workflow Process</h3><div style="line-height:1.8;color:#374151;"><p><strong>Step 1: Request Identification</strong><br> Department or individual identifies need for materials, equipment, or services.</p><p><strong>Step 2: Requisition Creation</strong><br> Complete requisition form with detailed specifications, quantities, and business justification.</p><p><strong>Step 3: Department Review</strong><br> Department supervisor reviews request for accuracy, necessity, and budget compliance.</p><p><strong>Step 4: Management Approval</strong><br> Based on cost thresholds, appropriate management level provides approval.</p><p><strong>Step 5: Purchase Order Generation</strong><br> Purchasing team converts approved requisition into formal Purchase Order (PO).</p><p><strong>Step 6: Vendor Processing</strong><br> PO sent to vendor, order processed, and delivery scheduled.</p><p><strong>Step 7: Receipt &amp; Inventory</strong><br> Goods received, inspected, and entered into inventory system.</p></div></div>',2)]))):e.createCommentVNode("",!0)])}const D=f(_n,[["render",Xl]]),Zl=(o={})=>({brandName:o.brandName||"OceanHelm",logoIcon:o.logoIcon||"bi bi-water",showLogo:o.showLogo!==!1,responsive:o.responsive!==!1,...o}),vl=[{type:"link",label:"Dashboard",icon:"bi bi-speedometer2",href:"/app/dashboard",active:!0},{type:"link",label:"Activity Log",icon:"bi bi-activity",href:"/activity-log",roles:["owner"]},{type:"text",label:"Services"},{type:"button",label:"Maintenance",icon:"bi bi-tools",action:"maintenance"},{type:"dropdown",label:"Crew Management",icon:"bi bi-people",children:[{label:"All Crew",action:"crew-all",roles:["owner","staff"]},{type:"separator"},{label:"Get Crew by Vessel",action:"crew-by-vessel"}]},{type:"link",label:"Inventory Management",icon:"bi bi-clipboard-data",href:"/app/inventory"},{type:"link",label:"Requisition Processing",icon:"bi bi-calendar-check",href:"/app/requisition"},{type:"button",label:"Voyage Manager",icon:"fas fa-ship",action:"coming-soon"},{type:"button",label:"Settings",icon:"bi bi-gear",action:"settings",roles:["owner","staff"]},{type:"button",label:"Help & Support",icon:"bi bi-question-circle",action:"help"}],ei=(o,t)=>!o.roles||o.roles.length===0?!0:o.roles.includes(t==null?void 0:t.role),ti={install(o,t={}){o.component("ConfigurableSidebar",V),o.component("VesselLists",y),o.component("DashHead",N),o.component("ActivityLogs",b),o.component("CrewManagement",w),o.component("RequisitionSystem",D),o.component("OceanHelmMaintenance",k),o.provide("sidebarConfig",t)}};h.ActivityLogs=b,h.ConfigurableSidebar=V,h.CrewManagement=w,h.DashHead=N,h.OceanHelmMaintenance=k,h.RequisitionSystem=D,h.VesselList=y,h.createSidebarConfig=Zl,h.default=ti,h.defaultMenuItems=vl,h.defaultPermissionChecker=ei,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
2
2
  //# sourceMappingURL=oceanhelm.umd.js.map