oceanhelm 0.0.9 → 0.0.10

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(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,l]of t)r[c]=l;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)?o.type==="dropdown"&&o.children?o.children.some(t=>this.hasPermission(t)):!0:!1)}},mounted(){this.responsive&&this.initializeResponsiveBehavior()},methods:{getFilteredChildren(o){return o.children?o.children.filter(t=>this.hasPermission(t)):[]},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 l=t.contains(c.target),s=o.contains(c.target);!l&&!s&&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"},A={class:"list-unstyled components mt-4"},M=["onClick"],F=["href","onClick"],q=["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,l,s){return e.openBlock(),e.createElementBlock("nav",{id:"sidebar",class:e.normalizeClass(s.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",A,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.filteredMenuItems,(n,d)=>(e.openBlock(),e.createElementBlock("li",{key:d,class:e.normalizeClass({active:n.active,dropdown:n.type==="dropdown"}),onClick:m=>s.handleItemClick(n)},[n.type==="link"?(e.openBlock(),e.createElementBlock("a",{key:0,href:n.href||"#",onClick:e.withModifiers(m=>s.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,F)):n.type==="button"?(e.openBlock(),e.createElementBlock("a",{key:1,onClick:e.withModifiers(m=>s.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,q)):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(s.getFilteredChildren(n),(m,g)=>(e.openBlock(),e.createElementBlock("a",{key:g,class:"dropdown-item black",onClick:e.withModifiers(E=>s.handleAction(m),["prevent"]),style:{cursor:"pointer"}},e.toDisplayString(m.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,M))),128))]),e.renderSlot(o.$slots,"footer")],2)}const V=f(T,[["render",j]]),di="",$={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})}},data(){return{activeFilter:"All"}},emits:["vessel-add","vessel-click","vessel-edit","vessel-delete","vessel-toggle-status","vessel-navigate","access-denied","date-change"],computed:{activeVesselsCount(){return this.vessels.filter(o=>o.status==="Active").length},inactiveVesselsCount(){return this.vessels.filter(o=>o.status==="Inactive").length},filteredVessels(){return this.activeFilter==="All"?this.vessels:this.vessels.filter(o=>o.status===this.activeFilter)},canAddVessel(){return this.config.enableAdd&&(this.userProfile.role==="owner"||this.userProfile.role==="staff")}},methods:{filterVessels(o){this.activeFilter=o},clearFilter(){this.activeFilter="All"},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.grantAccess(o)?this.currentRoute==="dashboard"?this.$emit("vessel-click",o):this.$emit("vessel-navigate",t):this.handleAccessDenied("this protected route")},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())||""}`},getDuration(o,t){const r=new Date,c=new Date(o),l=r-c;if(l<0)return"Invalid (future date)";const s=Math.floor(l/(1e3*60*60)),n=Math.floor(s/24),d=s%24;let m="";return n>0&&(m+=`${n} day${n>1?"s":""}`),d>0&&(m+=(m?" ":"")+`${d} hr${d>1?"s":""}`),m||"0 hr"},setVesselDate(o){this.$emit("date-change",o)},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-body d-flex align-items-center"},J={class:"mt-2 mb-0"},W={class:"col-md-4"},G={class:"card-body d-flex align-items-center"},Y={class:"mt-2 mb-0"},K={key:0,class:"col-md-4"},X={class:"d-flex justify-content-between align-items-center mb-4"},Z={key:0,class:"alert alert-info mb-3",role:"alert"},v={key:1,class:"text-center py-4"},ee={key:2,class:"alert alert-primary",role:"alert"},te={key:3,class:"alert alert-warning",role:"alert"},oe={class:"alert-heading"},ne={class:"mb-0"},le={key:4,class:"row"},se=["onClick"],ie={class:"card-body d-flex align-items-center"},re={class:"flex-grow-1"},ae={class:"d-flex justify-content-between align-items-center mb-2"},de={class:"card-title mb-0"},ce={class:"row"},me={class:"col-6"},pe={class:"mb-0"},he={key:0,class:"col-6"},fe={class:"mb-0"},ge={class:"mb-0"},Ee={key:1,class:"col-6"},Ve={class:"text-muted"},ye=["onClick"],Ne={class:"action-icon v-left delete"},ke=["onClick"],be=["onClick"];function we(o,t,r,c,l,s){return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",z,[e.createElementVNode("div",H,[e.createElementVNode("div",{class:e.normalizeClass(["card border-0 shadow-sm",{"border-primary border-2":l.activeFilter==="Active"}]),onClick:t[0]||(t[0]=n=>s.filterVessels("Active")),style:{cursor:"pointer"}},[e.createElementVNode("div",Q,[t[5]||(t[5]=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[4]||(t[4]=e.createElementVNode("h6",{class:"mb-0"},"Active Vessels",-1)),e.createElementVNode("h3",J,e.toDisplayString(s.activeVesselsCount),1)])])],2)]),e.createElementVNode("div",W,[e.createElementVNode("div",{class:e.normalizeClass(["card border-0 shadow-sm",{"border-secondary border-2":l.activeFilter==="Inactive"}]),onClick:t[1]||(t[1]=n=>s.filterVessels("Inactive")),style:{cursor:"pointer"}},[e.createElementVNode("div",G,[t[7]||(t[7]=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[6]||(t[6]=e.createElementVNode("h6",{class:"mb-0"},"Inactive",-1)),e.createElementVNode("h3",Y,e.toDisplayString(s.inactiveVesselsCount),1)])])],2)]),s.canAddVessel?(e.openBlock(),e.createElementBlock("div",K,[e.createElementVNode("div",{class:"card border-0 shadow-sm",onClick:t[2]||(t[2]=(...n)=>s.handleAddVessel&&s.handleAddVessel(...n)),style:{cursor:"pointer"}},t[8]||(t[8]=[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)]),e.createElementVNode("div",X,[t[10]||(t[10]=e.createElementVNode("h4",{class:"mb-0"},[e.createElementVNode("i",{class:"bi bi-ship me-2"}),e.createTextVNode("Registered Vessels")],-1)),l.activeFilter!=="All"?(e.openBlock(),e.createElementBlock("button",{key:0,class:"btn btn-sm btn-outline-secondary",onClick:t[3]||(t[3]=(...n)=>s.clearFilter&&s.clearFilter(...n))},t[9]||(t[9]=[e.createElementVNode("i",{class:"bi bi-x-circle me-1"},null,-1),e.createTextVNode("Clear Filter ",-1)]))):e.createCommentVNode("",!0)]),l.activeFilter!=="All"?(e.openBlock(),e.createElementBlock("div",Z,[t[11]||(t[11]=e.createTextVNode(" Showing ",-1)),e.createElementVNode("strong",null,e.toDisplayString(l.activeFilter),1),e.createTextVNode(" vessels ("+e.toDisplayString(s.filteredVessels.length)+") ",1)])):e.createCommentVNode("",!0),r.loading?(e.openBlock(),e.createElementBlock("div",v,t[12]||(t[12]=[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.filteredVessels.length&&l.activeFilter==="All"?(e.openBlock(),e.createElementBlock("div",ee,t[13]||(t[13]=[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)]))):!s.filteredVessels.length&&l.activeFilter!=="All"?(e.openBlock(),e.createElementBlock("div",te,[e.createElementVNode("h4",oe,"No "+e.toDisplayString(l.activeFilter)+" Vessels",1),e.createElementVNode("p",ne,"There are no "+e.toDisplayString(l.activeFilter.toLowerCase())+" vessels in your fleet.",1)])):(e.openBlock(),e.createElementBlock("div",le,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.filteredVessels,n=>(e.openBlock(),e.createElementBlock("div",{class:"col-lg-6",key:n.registrationNumber||n.id},[e.createElementVNode("div",{class:"vessel-card",onClick:d=>s.handleVesselClick(n)},[e.createElementVNode("div",ie,[t[17]||(t[17]=e.createElementVNode("div",{class:"vessel-icon v-left"},[e.createElementVNode("i",{class:"fas fa-ship"})],-1)),e.createElementVNode("div",re,[e.createElementVNode("div",ae,[e.createElementVNode("h5",de,e.toDisplayString(n.name),1),e.createElementVNode("span",{class:e.normalizeClass(["vessel-status",s.statusClass(n.status)])},e.toDisplayString(n.status),3)]),e.createElementVNode("div",ce,[e.createElementVNode("div",me,[t[14]||(t[14]=e.createElementVNode("small",{class:"text-muted"},"Registration #:",-1)),e.createElementVNode("p",pe,e.toDisplayString(n.registrationNumber),1)]),n.date?(e.openBlock(),e.createElementBlock("div",he,[n.status==="Active"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t[15]||(t[15]=e.createElementVNode("small",{class:"text-muted"},"Active Duration:",-1)),e.createElementVNode("p",fe,e.toDisplayString(s.getDuration(n.date,n.registrationNumber)),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t[16]||(t[16]=e.createElementVNode("small",{class:"text-muted"},"Inactive Duration:",-1)),e.createElementVNode("p",ge,e.toDisplayString(s.getDuration(n.date,n.registrationNumber)),1)],64))])):(e.openBlock(),e.createElementBlock("div",Ee,[e.createElementVNode("small",Ve,e.toDisplayString(n.status)+" Duration:",1),e.createElementVNode("button",{type:"button",class:"btn btn-outline-primary btn-sm mt-1",onClick:e.withModifiers(d=>s.setVesselDate(n.registrationNumber),["stop"])}," Set Date ",8,ye)]))])])]),e.createElementVNode("div",Ne,[e.createElementVNode("i",{class:"bi bi-trash",onClick:e.withModifiers(d=>s.handleDeleteVessel(n),["stop"])},null,8,ke)]),e.createElementVNode("button",{class:"btn btn-primary",onClick:e.withModifiers(d=>s.handleToggleStatus(n),["stop"])},e.toDisplayString(n.status==="Active"?"Mark Inactive":"Mark Active"),9,be)],8,se)]))),128))]))],64)}const y=f($,[["render",we]]),ci="",De={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")}}},Ce={class:"page-header d-flex justify-content-between align-items-center"},ue={style:{"margin-left":"20px"}},Se={class:"d-flex"};function Be(o,t,r,c,l,s){return e.openBlock(),e.createElementBlock("div",Ce,[e.createElementVNode("h4",ue,e.toDisplayString(r.name),1),e.createElementVNode("div",Se,[this.userProfile.role=="owner"?(e.openBlock(),e.createElementBlock("button",{key:0,class:"btn btn-outline-primary me-2",onClick:t[0]||(t[0]=n=>s.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=>s.loggedIn())},t[3]||(t[3]=[e.createElementVNode("i",{class:"bi bi-person-circle"},null,-1)]))])])}const N=f(De,[["render",Be]]),_e={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":"Soon",r={checklistProgress:[...this.checklists],status:t,component:this.currentTask,after:this.after};this.$emit("update-task",{updateData:r,file:this.fileattachments.file,tasks:this.tasks,callback:(c,l)=>{c&&(l&&(this.after=l),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)}})}}},xe={key:0},Te=["onClick"],Pe={class:"content"},Ae={key:0,class:"loading-container"},Me={key:1},Fe={class:"container"},qe={class:"d-flex justify-content-between align-items-center"},Ie={class:"progress-container"},Re={class:"progress-info"},Le={class:"progress-bar"},Oe={class:"checklist"},Ue=["onClick"],je={key:0},$e=["onClick"],ze=["onClick"],He={key:0},Qe={class:"checklist"},Je={class:"checklist-item"},We={class:"attachment-area"},Ge={key:2,class:"status"},Ye={class:"form-group"},Ke={class:"form-group"},Xe={class:"input-group"},Ze={class:"form-group"},ve={class:"form-group"},et={class:"input-group"},tt={class:"form-group"},ot={class:"form-group"},nt={class:"input-group"},lt={class:"form-group"},st={class:"form-group"},it=["value"],rt={class:"input-group"},at={class:"form-group"},dt={class:"input-group"},ct={class:"form-group"},mt={class:"form-group"},pt={class:"form-group"},ht={class:"checkbox-group"},ft={class:"checkbox-item"},gt={class:"checkbox-item"},Et={class:"input-group"},Vt={class:"form-group"},yt={class:"form-group"},Nt={class:"form-group"},kt={class:"attachment-area"},bt={class:"action-buttons"},wt=["disabled"],Dt={class:"task-table-wrapper"},Ct={class:"table-controls"},ut={class:"filters"},St={class:"task-table"},Bt=["onClick"],_t=["onClick"],xt={key:0},Tt={class:"alert alert-primary",role:"alert"},Pt={class:"mb-0"},At={class:"report-container",ref:"reportContainer"},Mt={class:"report-info"},Ft={class:"info-box"},qt={class:"info-box"},It={class:"info-box"},Rt={class:"section"},Lt={class:"summary-grid"},Ot={class:"summary-card"},Ut={class:"summary-number"},jt={class:"section"},$t={class:"task-header"},zt={class:"task-title"},Ht={class:"task-component"},Qt={class:"task-details"},Jt={class:"detail-item"},Wt={class:"detail-value"},Gt={class:"detail-item"},Yt={class:"detail-value"},Kt={class:"detail-item"},Xt={class:"detail-value"},Zt={class:"detail-item"},vt={class:"detail-value"},eo={class:"detail-item"},to={class:"detail-value"},oo={class:"detail-item"},no={class:"detail-value"},lo={key:0,style:{margin:"15px 0",padding:"10px",background:"white","border-radius":"5px"}},so={class:"detail-value"},io={key:1,style:{margin:"15px 0",padding:"10px",background:"white","border-radius":"5px"}},ro={class:"detail-value"},ao={key:2,class:"checklist-progress"},co={class:"progress-bar"},mo={style:{"font-size":"0.9em",color:"#666","margin-top":"5px"}},po={class:"checklist-items"},ho={class:"checklist-icon"},fo={class:"section"},go={class:"info-box"},Eo={class:"signature-section"},Vo={class:"signature-box"},yo={style:{"margin-top":"10px",color:"#666"}};function No(o,t,r,c,l,s){return l.ready?(e.openBlock(),e.createElementBlock("div",xe,[e.createElementVNode("div",null,[e.withDirectives(e.createElementVNode("nav",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.sections,n=>(e.openBlock(),e.createElementBlock("button",{key:n.id,class:e.normalizeClass(["nav-btn",{active:l.activeSection===n.id}]),onClick:d=>s.handleSectionClick(n)},e.toDisplayString(n.icon)+" "+e.toDisplayString(n.name),11,Te))),128))],512),[[e.vShow,!l.showReport]]),e.withDirectives(e.createElementVNode("div",Pe,[e.withDirectives(e.createElementVNode("section",{class:e.normalizeClass(["form-section",{active:l.activeSection==="maintenance"}])},[t[37]||(t[37]=e.createElementVNode("h2",null,"🛠️ Maintenance Tasks",-1)),l.isLoading?(e.openBlock(),e.createElementBlock("div",Ae,t[27]||(t[27]=[e.createElementVNode("div",{class:"loading-spinner"},null,-1),e.createElementVNode("p",null,"Loading checklist...",-1)]))):e.createCommentVNode("",!0),l.isLoading?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("form",Me,[e.createElementVNode("div",Fe,[e.createElementVNode("div",qe,[t[29]||(t[29]=e.createElementVNode("h1",null,"Maintenance Checklist",-1)),s.showAddTaskButton?(e.openBlock(),e.createElementBlock("button",{key:0,class:"btn btn-outline-custom",onClick:t[0]||(t[0]=e.withModifiers(n=>s.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",Ie,[e.createElementVNode("div",Re," Progress: "+e.toDisplayString(s.progress)+"% ("+e.toDisplayString(s.completedCount.length)+"/"+e.toDisplayString(l.checklists.length)+") ",1),e.createElementVNode("div",Le,[e.createElementVNode("div",{class:"progress-fill",style:e.normalizeStyle({width:s.progress+"%"})},null,4)])]),e.createElementVNode("ul",Oe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.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=>s.toggleTask(n)},[n.completed?(e.openBlock(),e.createElementBlock("span",je,"✓")):e.createCommentVNode("",!0)],10,Ue),e.createElementVNode("span",{class:e.normalizeClass(["task-text",{completed:n.completed}]),onClick:d=>s.toggleTask(n)},e.toDisplayString(n.text),11,$e),s.showAddTaskButton?(e.openBlock(),e.createElementBlock("button",{key:0,class:"delete-btn",onClick:d=>s.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,ze)):e.createCommentVNode("",!0)]))),128))]),l.after?(e.openBlock(),e.createElementBlock("div",He,[t[33]||(t[33]=e.createElementVNode("label",null,"Upload Image Evidence",-1)),e.createElementVNode("ul",Qe,[e.createElementVNode("li",Je,[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=>s.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:l.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",We,[e.createElementVNode("p",null,e.toDisplayString(l.fileText),1),e.createElementVNode("input",{type:"file",id:"evidence-files",class:"file-input",onChange:t[2]||(t[2]=(...n)=>s.handleImg&&s.handleImg(...n))},null,32),t[34]||(t[34]=e.createElementVNode("label",{for:"evidence-files",class:"file-label"},"Browse Files",-1))])])),s.completedCount===l.checklists.length?(e.openBlock(),e.createElementBlock("div",Ge," All tasks completed! ✅ ")):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"reset-button",onClick:t[3]||(t[3]=e.withModifiers((...n)=>s.resetTasks&&s.resetTasks(...n),["prevent"]))},e.toDisplayString(s.checklistButtonLabel),1)])]))],2),[[e.vShow,l.activeSection==="maintenance"]]),e.withDirectives(e.createElementVNode("section",{class:e.normalizeClass(["form-section",{active:l.activeSection==="schedule"}])},[t[62]||(t[62]=e.createElementVNode("h2",null,"📅 Maintenance Schedule",-1)),e.createElementVNode("form",null,[e.createElementVNode("div",Ye,[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=>l.form.taskName=n),required:""},null,512),[[e.vModelText,l.form.taskName]])]),e.createElementVNode("div",Ke,[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=>l.form.description=n),required:""},null,512),[[e.vModelText,l.form.description]])]),e.createElementVNode("div",Xe,[e.createElementVNode("div",Ze,[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=>l.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,l.form.maintenanceType]])]),e.createElementVNode("div",ve,[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=>l.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,l.form.component]]),l.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=>l.form.customComponent=n),style:{"margin-top":"8px"}},null,512)),[[e.vModelText,l.form.customComponent]]):e.createCommentVNode("",!0)])]),e.createElementVNode("div",et,[e.createElementVNode("div",tt,[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=>l.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,l.form.priority]])]),e.createElementVNode("div",ot,[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=>l.form.status=n),readonly:""},null,512),[[e.vModelText,l.form.status]])])]),e.createElementVNode("div",nt,[e.createElementVNode("div",lt,[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=>l.form.estimatedHours=n),min:"0",step:"0.5"},null,512),[[e.vModelText,l.form.estimatedHours]])])]),e.createElementVNode("div",st,[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=>l.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,it))),128))],512),[[e.vModelSelect,l.form.assignedTo]])]),e.createElementVNode("div",rt,[e.createElementVNode("div",at,[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=>l.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,l.form.recurrence]])])]),e.createElementVNode("div",dt,[e.createElementVNode("div",ct,[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=>l.form.lastPerformed=n)},null,512),[[e.vModelText,l.form.lastPerformed]])]),e.createElementVNode("div",mt,[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=>l.form.nextDue=n),required:""},null,512),[[e.vModelText,l.form.nextDue]])])]),e.createElementVNode("div",pt,[t[56]||(t[56]=e.createElementVNode("label",null,"Notifications",-1)),e.createElementVNode("div",ht,[e.createElementVNode("div",ft,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",id:"notify-email","onUpdate:modelValue":t[16]||(t[16]=n=>l.form.notifyEmail=n)},null,512),[[e.vModelCheckbox,l.form.notifyEmail]]),t[54]||(t[54]=e.createElementVNode("label",{for:"notify-email"},"Email Notification",-1))]),e.createElementVNode("div",gt,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",id:"notify-sms","onUpdate:modelValue":t[17]||(t[17]=n=>l.form.notifySms=n)},null,512),[[e.vModelCheckbox,l.form.notifySms]]),t[55]||(t[55]=e.createElementVNode("label",{for:"notify-sms"},"SMS Notification",-1))])])]),e.createElementVNode("div",Et,[e.createElementVNode("div",Vt,[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=>l.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,l.form.reminderDays]])])]),e.createElementVNode("div",yt,[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=>l.form.notes=n)},null,512),[[e.vModelText,l.form.notes]])]),e.createElementVNode("div",Nt,[t[61]||(t[61]=e.createElementVNode("label",null,"Attachments",-1)),e.createElementVNode("div",kt,[e.createElementVNode("p",null,e.toDisplayString(l.imgText),1),e.createElementVNode("input",{type:"file",id:"maintenance-files",class:"file-input",onChange:t[20]||(t[20]=(...n)=>s.handleFiles&&s.handleFiles(...n)),multiple:""},null,32),t[60]||(t[60]=e.createElementVNode("label",{for:"maintenance-files",class:"file-label"},"Browse Files",-1))])]),e.createElementVNode("div",bt,[e.createElementVNode("button",{type:"button",class:"btn btn-primary",onClick:t[21]||(t[21]=e.withModifiers((...n)=>s.saveSchedule&&s.saveSchedule(...n),["prevent"])),disabled:l.isSaving},e.toDisplayString(l.isSaving?"Saving...":"Save Schedule"),9,wt)])])],2),[[e.vShow,l.activeSection==="schedule"]]),e.withDirectives(e.createElementVNode("section",{class:e.normalizeClass(["form-section",{active:l.activeSection==="inventory"}])},[t[68]||(t[68]=e.createElementVNode("h2",null,"All Maintenance",-1)),e.createElementVNode("div",Dt,[e.createElementVNode("div",Ct,[e.createElementVNode("div",ut,[e.createElementVNode("button",{class:e.normalizeClass({active:l.activeFilter==="due"}),onClick:t[22]||(t[22]=n=>s.setFilter("due"))},"Due",2),e.createElementVNode("button",{class:e.normalizeClass({active:l.activeFilter==="all"}),onClick:t[23]||(t[23]=n=>s.setFilter("all"))},"All",2),e.createElementVNode("button",{class:e.normalizeClass({active:l.activeFilter==="completed"}),onClick:t[24]||(t[24]=n=>s.setFilter("completed"))},"Completed",2),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":t[25]||(t[25]=n=>l.searchQuery=n),placeholder:"Search..."},null,512),[[e.vModelText,l.searchQuery]])])]),e.createElementVNode("table",St,[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(s.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=>s.printMaintenance(n.component),class:"status-action"},"Print",8,Bt)):(e.openBlock(),e.createElementBlock("button",{key:1,onClick:d=>s.showMaintenance(n.component),class:"status-action"},"Start",8,_t))])]))),128))])]),r.tasks.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",xt,[e.createElementVNode("div",Tt,[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=>s.switchSchedule())},"Schedule")])])]))])],2),[[e.vShow,l.activeSection==="inventory"]])],512),[[e.vShow,!l.showReport]]),e.withDirectives(e.createElementVNode("div",At,[t[89]||(t[89]=e.createElementVNode("div",{class:"header"},[e.createElementVNode("div",{class:"report-title"},"MAINTENANCE TASK REPORT")],-1)),e.createElementVNode("div",Mt,[e.createElementVNode("div",Ft,[t[69]||(t[69]=e.createElementVNode("div",{class:"info-label"},"Report Generated:",-1)),e.createElementVNode("div",null,e.toDisplayString(l.reportDate),1)]),e.createElementVNode("div",qt,[t[70]||(t[70]=e.createElementVNode("div",{class:"info-label"},"Report ID:",-1)),e.createElementVNode("div",null,e.toDisplayString(l.reportId),1)]),e.createElementVNode("div",It,[t[71]||(t[71]=e.createElementVNode("div",{class:"info-label"},"Total Tasks:",-1)),e.createElementVNode("div",null,e.toDisplayString(l.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",Rt,[t[75]||(t[75]=e.createElementVNode("div",{class:"section-title"},"📊 Task Summary",-1)),e.createElementVNode("div",Lt,[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",Ot,[e.createElementVNode("div",Ut,e.toDisplayString(s.totalEstimatedHours),1),t[73]||(t[73]=e.createElementVNode("div",{class:"summary-label"},"Total Hours",-1))])])]),e.createElementVNode("div",jt,[t[85]||(t[85]=e.createElementVNode("div",{class:"section-title"},"🔧 Maintenance Tasks",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.maintenanceTasks,n=>(e.openBlock(),e.createElementBlock("div",{key:n.taskName,class:e.normalizeClass(["task-item",s.getTaskStatusClass(n)])},[e.createElementVNode("div",$t,[e.createElementVNode("div",null,[e.createElementVNode("div",zt,[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",Ht,"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",Qt,[e.createElementVNode("div",Jt,[t[76]||(t[76]=e.createElementVNode("div",{class:"detail-label"},"Assigned To",-1)),e.createElementVNode("div",Wt,e.toDisplayString(n.assignedTo),1)]),e.createElementVNode("div",Gt,[t[77]||(t[77]=e.createElementVNode("div",{class:"detail-label"},"Estimated Hours",-1)),e.createElementVNode("div",Yt,e.toDisplayString(n.estimatedHours)+" hours",1)]),e.createElementVNode("div",Kt,[t[78]||(t[78]=e.createElementVNode("div",{class:"detail-label"},"Last Performed",-1)),e.createElementVNode("div",Xt,e.toDisplayString(s.formatDate(n.lastPerformed)),1)]),e.createElementVNode("div",Zt,[t[79]||(t[79]=e.createElementVNode("div",{class:"detail-label"},"Next Due",-1)),e.createElementVNode("div",vt,e.toDisplayString(s.formatDate(n.nextDue)),1)]),e.createElementVNode("div",eo,[t[80]||(t[80]=e.createElementVNode("div",{class:"detail-label"},"Recurrence",-1)),e.createElementVNode("div",to,e.toDisplayString(n.recurrence),1)]),e.createElementVNode("div",oo,[t[81]||(t[81]=e.createElementVNode("div",{class:"detail-label"},"Remaining Days",-1)),e.createElementVNode("div",no,e.toDisplayString(n.remainingDays)+" days",1)])]),n.description?(e.openBlock(),e.createElementBlock("div",lo,[t[82]||(t[82]=e.createElementVNode("div",{class:"detail-label"},"Description",-1)),e.createElementVNode("div",so,e.toDisplayString(n.description),1)])):e.createCommentVNode("",!0),n.notes?(e.openBlock(),e.createElementBlock("div",io,[t[83]||(t[83]=e.createElementVNode("div",{class:"detail-label"},"Notes",-1)),e.createElementVNode("div",ro,e.toDisplayString(n.notes),1)])):e.createCommentVNode("",!0),n.checklistProgress&&n.checklistProgress.length>0?(e.openBlock(),e.createElementBlock("div",ao,[t[84]||(t[84]=e.createElementVNode("div",{class:"detail-label"},"Checklist Progress",-1)),e.createElementVNode("div",co,[e.createElementVNode("div",{class:"progress-fill",style:e.normalizeStyle({width:s.getChecklistProgress(n)+"%"})},null,4)]),e.createElementVNode("div",mo,e.toDisplayString(s.getCompletedChecklistItems(n))+" of "+e.toDisplayString(n.checklistProgress.length)+" items completed ("+e.toDisplayString(s.getChecklistProgress(n))+"%) ",1),e.createElementVNode("div",po,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.checklistProgress,(d,m)=>(e.openBlock(),e.createElementBlock("div",{key:m,class:"checklist-item"},[e.createElementVNode("span",ho,e.toDisplayString(d.completed?"✅":"⭕"),1),e.createElementVNode("span",null,e.toDisplayString(d.text||"Checklist Item "+(m+1)),1)]))),128))])])):e.createCommentVNode("",!0)],2))),128))]),e.createElementVNode("div",fo,[t[86]||(t[86]=e.createElementVNode("div",{class:"section-title"},"📋 Recommendations",-1)),e.createElementVNode("div",go,[e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.generateRecommendations(),n=>(e.openBlock(),e.createElementBlock("li",{key:n},e.toDisplayString(n),1))),128))])])]),e.createElementVNode("div",Eo,[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",Vo,[t[87]||(t[87]=e.createElementVNode("div",null,[e.createElementVNode("strong",null,"Date")],-1)),e.createElementVNode("div",yo,e.toDisplayString(l.reportDate),1)])])],512),[[e.vShow,l.showReport]])])])):e.createCommentVNode("",!0)}const k=f(_e,[["render",No]]),mi="",ko={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"}}},bo={class:"activity-logs"},wo={class:"a-controls"},Do={class:"a-search-box"},Co=["value"],uo=["value"],So={class:"stats-grid"},Bo={class:"stat-card"},_o={class:"value"},xo={class:"stat-card"},To={class:"value"},Po={class:"stat-card"},Ao={class:"value"},Mo={class:"logs-container"},Fo={key:0,class:"loading"},qo={key:1,class:"no-logs"},Io={key:2},Ro={class:"logs-table"},Lo={style:{color:"gray"}},Oo={style:{color:"gray"}},Uo={class:"pagination"},jo=["disabled"],$o=["onClick"],zo=["disabled"];function Ho(o,t,r,c,l,s){return e.openBlock(),e.createElementBlock("div",bo,[e.createElementVNode("div",wo,[e.createElementVNode("div",Do,[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,Co)]),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,uo),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",So,[e.createElementVNode("div",Bo,[t[7]||(t[7]=e.createElementVNode("h3",null,"Total Activities",-1)),e.createElementVNode("div",_o,e.toDisplayString(r.totalActivities),1)]),e.createElementVNode("div",xo,[t[8]||(t[8]=e.createElementVNode("h3",null,"Today's Activities",-1)),e.createElementVNode("div",To,e.toDisplayString(r.todayActivities),1)]),e.createElementVNode("div",Po,[t[9]||(t[9]=e.createElementVNode("h3",null,"Active Users",-1)),e.createElementVNode("div",Ao,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",Mo,[r.loading?(e.openBlock(),e.createElementBlock("div",Fo,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",qo,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",Io,[e.createElementVNode("table",Ro,[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(s.formatDate(n.timestamp)),1),e.createElementVNode("td",null,[e.createElementVNode("div",null,e.toDisplayString(n.user_name),1),e.createElementVNode("small",Lo,e.toDisplayString(n.email),1)]),e.createElementVNode("td",null,[e.createElementVNode("span",{class:e.normalizeClass(["activity-badge",s.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,m)=>(e.openBlock(),e.createElementBlock("div",{key:m},[e.createElementVNode("strong",null,e.toDisplayString(m)+": ",1),e.createElementVNode("small",Oo,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",Uo,[e.createElementVNode("button",{onClick:t[4]||(t[4]=n=>o.$emit("change-page",r.currentPage-1)),disabled:r.currentPage===1}," Previous ",8,jo),(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,$o))),128)),e.createElementVNode("button",{onClick:t[5]||(t[5]=n=>o.$emit("change-page",r.currentPage+1)),disabled:r.currentPage===r.totalPages}," Next ",8,zo)])]))])])}const b=f(ko,[["render",Ho]]),pi="",Qo={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){const{role:t,vessel:r}=this.userProfile,c=r===this.vesselName;let s={owner:["add","edit","delete","assign","view"],staff:["add","edit","assign","view"],captain:["assign","view"],viewer:["view"]}[t]||[];return t==="captain"&&c&&(s=[...s,"add"]),s.includes(o)},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"}}},Jo={class:"crew-management"},Wo={key:0,class:"wave-bg"},Go={class:"crew-section"},Yo={class:"crew-section-header"},Ko={class:"search-filter"},Xo={key:0,class:"loading-state"},Zo={key:1,class:"crew-grid"},vo={class:"crew-name"},en={class:"crew-role"},tn={class:"crew-certifications"},on=["onClick"],nn=["onClick"],ln={class:"crew-availability"},sn={class:"crew-availability"},rn={class:"action-buttons"},an={key:0,class:"status-available crew-availability vcard"},dn={key:1,class:"status-unavailable crew-availability vcard"},cn=["onClick"],mn=["onClick"],pn={key:2,class:"no-results"},hn={key:3,class:"add-crew-form"},fn={class:"form-row"},gn={class:"form-group"},En={key:0,class:"error-message"},Vn={class:"form-group"},yn=["value"],Nn={class:"form-row"},kn={class:"form-group"},bn={class:"form-group"},wn={key:0,class:"error-message"},Dn={class:"certification-section"},Cn={class:"form-row"},un={class:"form-group"},Sn=["onUpdate:modelValue"],Bn={class:"form-group"},_n=["onUpdate:modelValue"],xn={class:"form-group"},Tn=["onClick"],Pn={class:"form-row"},An={class:"form-group"},Mn={class:"form-actions"};function Fn(o,t,r,c,l,s){return e.openBlock(),e.createElementBlock("div",Jo,[r.config.showWaveBackground?(e.openBlock(),e.createElementBlock("div",Wo)):e.createCommentVNode("",!0),e.createElementVNode("div",Go,[e.createElementVNode("div",Yo,[e.createElementVNode("h2",null,e.toDisplayString(s.sectionTitle),1),s.canAddCrew?(e.openBlock(),e.createElementBlock("button",{key:0,class:"btn btn-primary",onClick:t[0]||(t[0]=(...n)=>s.handleToggleAddForm&&s.handleToggleAddForm(...n))},e.toDisplayString(l.showAddForm?"Cancel":"+ Add Crew Member"),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",Ko,[e.withDirectives(e.createElementVNode("input",{type:"text",placeholder:"Search crew by name or role...","onUpdate:modelValue":t[1]||(t[1]=n=>l.searchQuery=n),onInput:t[2]||(t[2]=(...n)=>s.handleSearch&&s.handleSearch(...n))},null,544),[[e.vModelText,l.searchQuery]]),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":t[3]||(t[3]=n=>l.filterStatus=n),onChange:t[4]||(t[4]=(...n)=>s.handleFilter&&s.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,l.filterStatus]])]),r.loading?(e.openBlock(),e.createElementBlock("div",Xo,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)]))):s.filteredCrew.length>0?(e.openBlock(),e.createElementBlock("div",Zo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.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(["crew-status-badge",s.getStatusClass(n.status)])},e.toDisplayString(s.formatStatus(n.status)),3),e.createElementVNode("div",vo,e.toDisplayString(n.name),1),e.createElementVNode("div",en,e.toDisplayString(n.role),1),e.createElementVNode("div",tn,[(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",s.getCertificationClass(d.expiryDate)]),onClick:m=>s.handleViewCertification(d,n)},e.toDisplayString(d.name),11,on))),128)),s.canEditCrew?(e.openBlock(),e.createElementBlock("i",{key:0,class:"bi bi-patch-plus-fill icon",onClick:d=>s.handleAddCertification(n)},null,8,nn)):e.createCommentVNode("",!0)]),e.createElementVNode("div",ln,[t[16]||(t[16]=e.createElementVNode("strong",null,"Embarkation Date:",-1)),e.createTextVNode(" "+e.toDisplayString(n.nextShift||"Not Scheduled"),1)]),e.createElementVNode("div",sn,[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",rn,[n.vessel?(e.openBlock(),e.createElementBlock("div",an," Vessel: "+e.toDisplayString(n.vessel),1)):(e.openBlock(),e.createElementBlock("div",dn," Vessel: Unassigned ")),s.canAssignShift?(e.openBlock(),e.createElementBlock("button",{key:2,class:"btn btn-primary",onClick:d=>s.handleAssignShift(n)}," Assign Shift ",8,cn)):e.createCommentVNode("",!0)]),s.canDeleteCrew?(e.openBlock(),e.createElementBlock("i",{key:0,class:"bi bi-trash icon delete-icon",onClick:d=>s.handleDeleteCrew(n)},null,8,mn)):e.createCommentVNode("",!0)],2))),128))])):r.loading?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",pn,e.toDisplayString(r.crew.length===0?"No crew members found.":"No crew members found matching your search criteria."),1)),l.showAddForm?(e.openBlock(),e.createElementBlock("div",hn,[t[28]||(t[28]=e.createElementVNode("h2",null,"Add New Crew Member",-1)),e.createElementVNode("div",fn,[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=>l.newCrew.name=n),class:e.normalizeClass({error:l.formErrors.name})},null,2),[[e.vModelText,l.newCrew.name]]),l.formErrors.name?(e.openBlock(),e.createElementBlock("div",En,e.toDisplayString(l.formErrors.name),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",Vn,[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=>l.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,yn))),128)),t[19]||(t[19]=e.createElementVNode("option",{value:"Other"},"Other",-1))],512),[[e.vModelSelect,l.newCrew.role]]),l.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=>l.newCrew.customRole=n),style:{"margin-top":"8px"}},null,512)),[[e.vModelText,l.newCrew.customRole]]):e.createCommentVNode("",!0)])]),e.createElementVNode("div",Nn,[e.createElementVNode("div",kn,[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=>l.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,l.newCrew.status]])]),e.createElementVNode("div",bn,[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=>l.newCrew.email=n),class:e.normalizeClass({error:l.formErrors.email})},null,2),[[e.vModelText,l.newCrew.email]]),l.formErrors.email?(e.openBlock(),e.createElementBlock("div",wn,e.toDisplayString(l.formErrors.email),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",Dn,[t[26]||(t[26]=e.createElementVNode("h3",null,"Certifications",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.newCrew.certifications,(n,d)=>(e.openBlock(),e.createElementBlock("div",{key:d,class:"certification-entry"},[e.createElementVNode("div",Cn,[e.createElementVNode("div",un,[t[24]||(t[24]=e.createElementVNode("label",null,"Certification Name",-1)),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":m=>n.name=m,placeholder:"Enter certification name"},null,8,Sn),[[e.vModelText,n.name]])]),e.createElementVNode("div",Bn,[t[25]||(t[25]=e.createElementVNode("label",null,"Expiry Date",-1)),e.withDirectives(e.createElementVNode("input",{type:"date","onUpdate:modelValue":m=>n.expiryDate=m},null,8,_n),[[e.vModelText,n.expiryDate]])]),e.createElementVNode("div",xn,[l.newCrew.certifications.length>1?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"btn btn-danger btn-sm",onClick:m=>s.removeCertification(d)}," Remove ",8,Tn)):e.createCommentVNode("",!0)])])]))),128)),e.createElementVNode("button",{type:"button",class:"btn btn-secondary btn-sm",onClick:t[10]||(t[10]=(...n)=>s.addCertificationEntry&&s.addCertificationEntry(...n))}," + Add More Certification ")]),e.createElementVNode("div",Pn,[e.createElementVNode("div",An,[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=>l.newCrew.notes=n)},null,512),[[e.vModelText,l.newCrew.notes]])])]),e.createElementVNode("div",Mn,[e.createElementVNode("button",{class:"btn btn-secondary",onClick:t[12]||(t[12]=(...n)=>s.handleCancelForm&&s.handleCancelForm(...n))},"Cancel"),e.createElementVNode("button",{class:"btn btn-primary",onClick:t[13]||(t[13]=(...n)=>s.handleAddCrewMember&&s.handleAddCrewMember(...n))},"Add Crew Member")])])):e.createCommentVNode("",!0)])])}const w=f(Qo,[["render",Fn]]),hi="",qn={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"]},{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()}},In={class:"s-container container"},Rn={class:"nav-tabs"},Ln=["onClick"],On={key:0,class:"tab-content active"},Un={class:"form-grid"},jn={class:"form-group"},$n=["value"],zn={class:"form-group"},Hn=["value"],Qn={class:"form-group"},Jn=["value"],Wn={class:"form-group"},Gn={class:"form-group"},Yn={class:"items-section"},Kn={class:"items-header"},Xn={class:"form-group"},Zn=["onUpdate:modelValue"],vn={class:"form-group"},el=["onUpdate:modelValue"],tl={class:"form-group"},ol=["onUpdate:modelValue"],nl={class:"form-group"},ll=["onUpdate:modelValue"],sl=["value"],il={class:"form-group"},rl=["onUpdate:modelValue"],al=["onClick"],dl={key:1,class:"tab-content active"},cl={class:"requisition-list"},ml={class:"requisition-header"},pl={class:"requisition-id"},hl={class:"requisition-details"},fl={class:"detail-label"},gl={class:"detail-value"},El={key:0,class:"form-group comments-section"},Vl=["onClick"],yl={key:2,class:"tab-content active"},Nl={class:"requisition-list"},kl={class:"requisition-header"},bl={class:"requisition-id"},wl={class:"requisition-details"},Dl={class:"detail-label"},Cl={class:"detail-value"},ul={key:0,class:"form-group comments-section"},Sl=["onClick"],Bl={key:3,class:"tab-content active"},_l={class:"requisition-list",id:"approvalsQueue"},xl={class:"requisition-header"},Tl={class:"requisition-id"},Pl={class:"requisition-details"},Al={class:"detail-label"},Ml={class:"detail-value"},Fl={class:"detail-item"},ql={class:"detail-value"},Il={class:"detail-item"},Rl={class:"item-list"},Ll=["onClick"],Ol=["onClick"],Ul=["onClick"],jl={key:4,class:"tab-content active"},$l={class:"requisition-list",id:"purchasingQueue"},zl={class:"requisition-header"},Hl={class:"requisition-id"},Ql={class:"requisition-details"},Jl={class:"detail-label"},Wl={class:"detail-value"},Gl={class:"detail-item"},Yl={class:"detail-value"},Kl={class:"detail-item"},Xl={class:"item-list"},Zl=["onClick"],vl={key:5,class:"tab-content active"},es={class:"requisition-list",id:"receivingQueue"},ts={class:"requisition-header"},os={class:"requisition-id"},ns={class:"requisition-details"},ls={class:"detail-label"},ss={class:"detail-value"},is={class:"detail-item"},rs={class:"detail-value"},as={class:"detail-item"},ds={class:"item-list"},cs=["onClick"],ms={key:6,class:"tab-content active"},ps={class:"po-content",id:"po-content"},hs={class:"po-header"},fs={class:"company-info"},gs={class:"info-row"},Es={class:"info-value"},Vs={class:"info-row"},ys={class:"info-value"},Ns={class:"info-row"},ks={class:"info-value"},bs={class:"info-row"},ws={class:"info-value"},Ds={class:"info-row"},Cs={class:"info-value"},us={class:"company-info"},Ss={class:"info-row"},Bs={class:"info-value"},_s={class:"info-row"},xs={class:"info-value"},Ts={class:"info-row"},Ps={class:"info-value"},As={class:"info-row"},Ms={class:"info-value"},Fs={class:"info-row"},qs={class:"info-value"},Is={class:"items-section"},Rs={class:"items-table"},Ls={key:0},Os={key:0},Us={key:0,class:"price-change-indicator"},js=["onUpdate:modelValue"],$s={key:0},zs=["onClick"],Hs={key:1},Qs=["onClick"],Js=["onClick"],Ws={key:0,class:"justification-note"},Gs={class:"totals"},Ys={class:"total-row"},Ks={class:"total-row"},Xs={class:"total-row"},Zs={class:"total-row grand-total"},vs={class:"modal-content"},ei={style:{"margin-bottom":"15px",color:"#666"}},ti={class:"modal-buttons"},oi=["disabled"],ni={key:7,class:"tab-content active"};function li(o,t,r,c,l,s){var n,d,m,g,E,C,u,S,B,_,x;return e.openBlock(),e.createElementBlock("div",In,[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",Rn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.visibleTabs,i=>(e.openBlock(),e.createElementBlock("button",{key:i.name,class:e.normalizeClass(["nav-tab",{active:l.activeTab===i.name}]),onClick:a=>s.setActiveTab(i.name)},e.toDisplayString(i.label),11,Ln))),128))]),l.activeTab==="new-requisition"?(e.openBlock(),e.createElementBlock("div",On,[e.createElementVNode("form",{onSubmit:t[5]||(t[5]=e.withModifiers((...i)=>s.handleSubmitRequisition&&s.handleSubmitRequisition(...i),["prevent"]))},[e.createElementVNode("div",Un,[e.createElementVNode("div",jn,[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,$n)]),e.createElementVNode("div",zn,[t[14]||(t[14]=e.createElementVNode("label",null,"Department *",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":t[0]||(t[0]=i=>l.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(l.departments,i=>(e.openBlock(),e.createElementBlock("option",{key:i,value:i},e.toDisplayString(i),9,Hn))),128))],512),[[e.vModelSelect,l.form.department]])]),e.createElementVNode("div",Qn,[t[16]||(t[16]=e.createElementVNode("label",null,"Vessel *",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":t[1]||(t[1]=i=>l.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,Jn))),128))],512),[[e.vModelSelect,l.form.project]])]),e.createElementVNode("div",Wn,[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=>l.form.neededDate=i),required:""},null,512),[[e.vModelText,l.form.neededDate]])])]),e.createElementVNode("div",Gn,[t[18]||(t[18]=e.createElementVNode("label",null,"Business Justification *",-1)),e.withDirectives(e.createElementVNode("textarea",{"onUpdate:modelValue":t[3]||(t[3]=i=>l.form.justification=i),placeholder:"Explain why these materials are needed...",required:""},null,512),[[e.vModelText,l.form.justification]])]),e.createElementVNode("div",Yn,[e.createElementVNode("div",Kn,[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)=>s.addItem&&s.addItem(...i))},"+ Add Item")]),e.createElementVNode("div",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.form.items,(i,a)=>(e.openBlock(),e.createElementBlock("div",{key:a,class:"item-row"},[e.createElementVNode("div",Xn,[t[20]||(t[20]=e.createElementVNode("label",null,"Item Code *",-1)),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":p=>i.id=p,required:""},null,8,Zn),[[e.vModelText,i.id]])]),e.createElementVNode("div",vn,[t[21]||(t[21]=e.createElementVNode("label",null,"Item Description *",-1)),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":p=>i.desc=p,required:""},null,8,el),[[e.vModelText,i.desc]])]),e.createElementVNode("div",tl,[t[22]||(t[22]=e.createElementVNode("label",null,"Quantity *",-1)),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":p=>i.qty=p,min:"1",required:""},null,8,ol),[[e.vModelText,i.qty,void 0,{number:!0}]])]),e.createElementVNode("div",nl,[t[23]||(t[23]=e.createElementVNode("label",null,"Unit *",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":p=>i.unit=p,required:""},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.units,p=>(e.openBlock(),e.createElementBlock("option",{key:p,value:p},e.toDisplayString(p),9,sl))),128))],8,ll),[[e.vModelSelect,i.unit]])]),e.createElementVNode("div",il,[t[24]||(t[24]=e.createElementVNode("label",null,"Est. Unit Cost *",-1)),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":p=>i.cost=p,step:"0.01",placeholder:"0.00",required:""},null,8,rl),[[e.vModelText,i.cost,void 0,{number:!0}]])]),e.createElementVNode("button",{type:"button",class:"remove-item-btn",onClick:p=>s.removeItem(a)},"Remove",8,al)]))),128))])]),t[25]||(t[25]=e.createElementVNode("div",{class:"action-buttons"},[e.createElementVNode("button",{type:"submit",class:"btn btn-primary-req"},"Submit Requisition")],-1))],32)])):e.createCommentVNode("",!0),l.activeTab==="all-requisitions"?(e.openBlock(),e.createElementBlock("div",dl,[e.createElementVNode("div",cl,[(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",ml,[e.createElementVNode("div",pl,e.toDisplayString(i.id),1),e.createElementVNode("div",{class:e.normalizeClass(["status-badge",`status-${i.status}`])},e.toDisplayString(i.status),3)]),e.createElementVNode("div",hl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.getRequisitionFields(i),a=>(e.openBlock(),e.createElementBlock("div",{class:"detail-item",key:a.label},[e.createElementVNode("div",fl,e.toDisplayString(a.label),1),e.createElementVNode("div",gl,e.toDisplayString(a.value(i)),1)]))),128))]),i.status==="po-created"||i.status==="delivered"?(e.openBlock(),e.createElementBlock("div",El,[e.createElementVNode("button",{onClick:a=>s.handleOpenPO(i.id),class:"add-item-btn comments-section"}," Print PO ",8,Vl)])):e.createCommentVNode("",!0)]))),128))])])):e.createCommentVNode("",!0),l.activeTab==="my-requisitions"?(e.openBlock(),e.createElementBlock("div",yl,[e.createElementVNode("div",Nl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.myRequisitions,i=>(e.openBlock(),e.createElementBlock("div",{key:i.id,class:"requisition-card"},[e.createElementVNode("div",kl,[e.createElementVNode("div",bl,e.toDisplayString(i.id),1),e.createElementVNode("div",{class:e.normalizeClass(["status-badge",`status-${i.status}`])},e.toDisplayString(i.status),3)]),e.createElementVNode("div",wl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.getRequisitionFields(i),a=>(e.openBlock(),e.createElementBlock("div",{class:"detail-item",key:a.label},[e.createElementVNode("div",Dl,e.toDisplayString(a.label),1),e.createElementVNode("div",Cl,e.toDisplayString(a.value(i)),1)]))),128))]),i.status==="info-requested"?(e.openBlock(),e.createElementBlock("div",ul,[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=>l.infoResponse=a),class:"response-textarea",placeholder:"Submit more info..."},null,512),[[e.vModelText,l.infoResponse]]),e.createElementVNode("button",{onClick:a=>s.handleSubmitInfoResponse(i),class:"add-item-btn comments-section"}," Submit Info ",8,Sl)])):e.createCommentVNode("",!0)]))),128))])])):e.createCommentVNode("",!0),l.activeTab==="approvals"?(e.openBlock(),e.createElementBlock("div",Bl,[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",_l,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.reviewRequisitions,i=>(e.openBlock(),e.createElementBlock("div",{key:i.id,class:"requisition-card"},[e.createElementVNode("div",xl,[e.createElementVNode("div",Tl,e.toDisplayString(i.id),1)]),e.createElementVNode("div",Pl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.requisitionFields,a=>(e.openBlock(),e.createElementBlock("div",{class:"detail-item",key:a.label},[e.createElementVNode("div",Al,e.toDisplayString(a.label),1),e.createElementVNode("div",Ml,e.toDisplayString(a.value(i)),1)]))),128))]),e.createElementVNode("div",Fl,[t[27]||(t[27]=e.createElementVNode("div",{class:"detail-label"},"Justification",-1)),e.createElementVNode("div",ql,e.toDisplayString(i.justification||"N/A"),1)]),e.createElementVNode("div",Il,[t[28]||(t[28]=e.createElementVNode("div",{class:"detail-label"},"Items",-1)),e.createElementVNode("ul",Rl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.items,(a,p)=>(e.openBlock(),e.createElementBlock("li",{key:p},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=>s.handleApproveRequisition(i.id)},"Approve",8,Ll),e.createElementVNode("button",{type:"button",class:"marginbox btn-reject",onClick:a=>s.handleDeclineRequisition(i.id)},"Decline",8,Ol),e.createElementVNode("button",{type:"button",class:"marginbox btn-request",onClick:a=>s.handleInfoRequisition(i.id)},"Request Info",8,Ul)]))),128))])])):e.createCommentVNode("",!0),l.activeTab==="purchasing"?(e.openBlock(),e.createElementBlock("div",jl,[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",$l,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.poRequisitions,i=>(e.openBlock(),e.createElementBlock("div",{key:i.id,class:"requisition-card"},[e.createElementVNode("div",zl,[e.createElementVNode("div",Hl,e.toDisplayString(i.id),1)]),e.createElementVNode("div",Ql,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.requisitionFields,a=>(e.openBlock(),e.createElementBlock("div",{class:"detail-item",key:a.label},[e.createElementVNode("div",Jl,e.toDisplayString(a.label),1),e.createElementVNode("div",Wl,e.toDisplayString(a.value(i)),1)]))),128))]),e.createElementVNode("div",Gl,[t[30]||(t[30]=e.createElementVNode("div",{class:"detail-label"},"Justification",-1)),e.createElementVNode("div",Yl,e.toDisplayString(i.justification||"N/A"),1)]),e.createElementVNode("div",Kl,[t[31]||(t[31]=e.createElementVNode("div",{class:"detail-label"},"Items",-1)),e.createElementVNode("ul",Xl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.items,(a,p)=>(e.openBlock(),e.createElementBlock("li",{key:p},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=>s.handleCreatePO(i.id)},"Create PO",8,Zl)]))),128))])])):e.createCommentVNode("",!0),l.activeTab==="receiving"?(e.openBlock(),e.createElementBlock("div",vl,[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",es,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.awaitingDelivery,i=>(e.openBlock(),e.createElementBlock("div",{key:i.id,class:"requisition-card"},[e.createElementVNode("div",ts,[e.createElementVNode("div",os,e.toDisplayString(i.id),1)]),e.createElementVNode("div",ns,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.requisitionFields,a=>(e.openBlock(),e.createElementBlock("div",{class:"detail-item",key:a.label},[e.createElementVNode("div",ls,e.toDisplayString(a.label),1),e.createElementVNode("div",ss,e.toDisplayString(a.value(i)),1)]))),128))]),e.createElementVNode("div",is,[t[33]||(t[33]=e.createElementVNode("div",{class:"detail-label"},"Justification",-1)),e.createElementVNode("div",rs,e.toDisplayString(i.justification||"N/A"),1)]),e.createElementVNode("div",as,[t[34]||(t[34]=e.createElementVNode("div",{class:"detail-label"},"Items",-1)),e.createElementVNode("ul",ds,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.items,(a,p)=>(e.openBlock(),e.createElementBlock("li",{key:p},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=>s.handleAcceptDelivery(i.id)},"Accept Delivery",8,cs)]))),128))])])):e.createCommentVNode("",!0),l.activeTab==="po"?(e.openBlock(),e.createElementBlock("div",ms,[e.createElementVNode("div",ps,[e.createElementVNode("div",hs,[e.createElementVNode("div",fs,[t[41]||(t[41]=e.createElementVNode("h3",null,"Vendor Information",-1)),e.createElementVNode("div",gs,[t[36]||(t[36]=e.createElementVNode("span",{class:"info-label"},"Company:",-1)),e.createElementVNode("span",Es,e.toDisplayString(l.vendorInfo.company||((n=l.poDetails.vendorInfo)==null?void 0:n.company)),1)]),e.createElementVNode("div",Vs,[t[37]||(t[37]=e.createElementVNode("span",{class:"info-label"},"Contact:",-1)),e.createElementVNode("span",ys,e.toDisplayString(l.vendorInfo.contact||((d=l.poDetails.vendorInfo)==null?void 0:d.contact)),1)]),e.createElementVNode("div",Ns,[t[38]||(t[38]=e.createElementVNode("span",{class:"info-label"},"Email:",-1)),e.createElementVNode("span",ks,e.toDisplayString(l.vendorInfo.email||((m=l.poDetails.vendorInfo)==null?void 0:m.email)),1)]),e.createElementVNode("div",bs,[t[39]||(t[39]=e.createElementVNode("span",{class:"info-label"},"Phone:",-1)),e.createElementVNode("span",ws,e.toDisplayString(l.vendorInfo.phone||((g=l.poDetails.vendorInfo)==null?void 0:g.phone)),1)]),e.createElementVNode("div",Ds,[t[40]||(t[40]=e.createElementVNode("span",{class:"info-label"},"Address:",-1)),e.createElementVNode("span",Cs,e.toDisplayString(l.vendorInfo.address||((E=l.poDetails.vendorInfo)==null?void 0:E.address)),1)])]),e.createElementVNode("div",us,[t[47]||(t[47]=e.createElementVNode("h3",null,"Purchase Order Details",-1)),e.createElementVNode("div",Ss,[t[42]||(t[42]=e.createElementVNode("span",{class:"info-label"},"PO Number:",-1)),e.createElementVNode("span",Bs,e.toDisplayString(l.poDetails.id),1)]),e.createElementVNode("div",_s,[t[43]||(t[43]=e.createElementVNode("span",{class:"info-label"},"Date:",-1)),e.createElementVNode("span",xs,e.toDisplayString(l.vendorInfo.poDate||((C=l.poDetails.vendorInfo)==null?void 0:C.poDate)),1)]),e.createElementVNode("div",Ts,[t[44]||(t[44]=e.createElementVNode("span",{class:"info-label"},"Requested By:",-1)),e.createElementVNode("span",Ps,e.toDisplayString(l.vendorInfo.poApproved||((u=l.poDetails.vendorInfo)==null?void 0:u.poApproved)),1)]),e.createElementVNode("div",As,[t[45]||(t[45]=e.createElementVNode("span",{class:"info-label"},"Department:",-1)),e.createElementVNode("span",Ms,"PO-"+e.toDisplayString(l.poDetails.department),1)]),e.createElementVNode("div",Fs,[t[46]||(t[46]=e.createElementVNode("span",{class:"info-label"},"Delivery Date:",-1)),e.createElementVNode("span",qs,e.toDisplayString(l.poDetails.neededDate),1)])])]),e.createElementVNode("div",Is,[t[57]||(t[57]=e.createElementVNode("h2",{class:"section-title"},"Order Items",-1)),e.createElementVNode("table",Rs,[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)),l.isPrinting?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("th",Ls,"Actions"))])]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.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":p=>i.tempPrice=p,type:"number",step:"0.01",class:e.normalizeClass(["price-input",{"price-changed":i.cost!==i.tempPrice}])},null,10,js)),[[e.vModelText,i.tempPrice,void 0,{number:!0}]]):(e.openBlock(),e.createElementBlock("span",Os,[e.createTextVNode(" $"+e.toDisplayString(i.cost.toFixed(2))+" ",1),i.cost!==i.unitPrice?(e.openBlock(),e.createElementBlock("span",Us,"!")):e.createCommentVNode("",!0)]))]),e.createElementVNode("td",null,"$"+e.toDisplayString((i.unitPrice*i.qty).toFixed(2)),1),l.isPrinting?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("td",$s,[i.editing?(e.openBlock(),e.createElementBlock("div",Hs,[e.createElementVNode("button",{onClick:p=>s.savePrice(a),class:"save-btn"},"Save",8,Qs),e.createElementVNode("button",{onClick:p=>s.cancelEdit(a),class:"cancel-btn"},"Cancel",8,Js)])):(e.openBlock(),e.createElementBlock("button",{key:0,onClick:p=>s.startEdit(a),class:"edit-btn"}," Edit Price ",8,zs))]))]))),128))])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.poDetails.items||[],(i,a)=>(e.openBlock(),e.createElementBlock("div",{key:"note-"+a},[i.justification?(e.openBlock(),e.createElementBlock("div",Ws,[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",Gs,[e.createElementVNode("div",Ys,[t[53]||(t[53]=e.createElementVNode("span",null,"Subtotal:",-1)),e.createElementVNode("span",null,"$"+e.toDisplayString(s.subTotal.toFixed(2)),1)]),e.createElementVNode("div",Ks,[t[54]||(t[54]=e.createElementVNode("span",null,"Tax (%):",-1)),e.createElementVNode("span",null,"$"+e.toDisplayString(s.getOptional(l.vendorInfo.tax)),1)]),e.createElementVNode("div",Xs,[t[55]||(t[55]=e.createElementVNode("span",null,"Shipping:",-1)),e.createElementVNode("span",null,"$"+e.toDisplayString(s.getOptional(l.vendorInfo.shipping)),1)]),e.createElementVNode("div",Zs,[t[56]||(t[56]=e.createElementVNode("span",null,"Grand Total:",-1)),e.createElementVNode("span",null,"$"+e.toDisplayString((s.subTotal+s.getOptional(l.vendorInfo.tax)+s.getOptional(l.vendorInfo.shipping)).toFixed(2)),1)])])])]),l.showJustificationModal?(e.openBlock(),e.createElementBlock("div",{key:0,class:"justification-modal",onClick:t[10]||(t[10]=e.withModifiers((...i)=>s.closeJustificationModal&&s.closeJustificationModal(...i),["self"]))},[e.createElementVNode("div",vs,[t[60]||(t[60]=e.createElementVNode("h3",null,"Price Change Justification Required",-1)),e.createElementVNode("p",ei,[t[58]||(t[58]=e.createTextVNode(" Please provide a justification for changing the price from ",-1)),e.createElementVNode("strong",null,"$"+e.toDisplayString((B=(S=s.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=(_=s.currentItem)==null?void 0:_.tempPrice)==null?void 0:x.toFixed(2)),1)]),e.withDirectives(e.createElementVNode("textarea",{"onUpdate:modelValue":t[7]||(t[7]=i=>l.justificationText=i),class:"justification-textarea",placeholder:"Enter justification for price change...",required:""},null,512),[[e.vModelText,l.justificationText]]),e.createElementVNode("div",ti,[e.createElementVNode("button",{onClick:t[8]||(t[8]=(...i)=>s.closeJustificationModal&&s.closeJustificationModal(...i)),class:"cancel-btn"},"Cancel"),e.createElementVNode("button",{onClick:t[9]||(t[9]=(...i)=>s.confirmPriceChange&&s.confirmPriceChange(...i)),class:"save-btn",disabled:!l.justificationText.trim()}," Confirm Change ",8,oi)])])])):e.createCommentVNode("",!0),l.isPrinting?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"add-item-btn",onClick:t[11]||(t[11]=i=>s.handleFinishPO(l.poDetails.id))},"Approve PO"))])):e.createCommentVNode("",!0),l.activeTab==="workflow"?(e.openBlock(),e.createElementBlock("div",ni,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(qn,[["render",li]]),si=(o={})=>({brandName:o.brandName||"OceanHelm",logoIcon:o.logoIcon||"bi bi-water",showLogo:o.showLogo!==!1,responsive:o.responsive!==!1,...o}),ii=[{type:"link",label:"Home",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:"Modules"},{type:"dropdown",label:"Compliance",icon:"bi bi-list-ul",children:[{label:"Vessel Certification",action:"vessel-cert"},{type:"separator"},{label:"Crew Certification",action:"crew-cert"},{type:"separator"},{label:"Reports",action:"reports"}]},{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:"Vessel Log",icon:"bi bi-file-ruled",action:"vessel-log"},{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"}],ri=(o,t)=>!o.roles||o.roles.length===0?!0:o.roles.includes(t==null?void 0:t.role),ai={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=si,h.default=ai,h.defaultMenuItems=ii,h.defaultPermissionChecker=ri,Object.defineProperties(h,{__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 g=(o,t)=>{const l=o.__vccOpts||o;for(const[c,s]of t)l[c]=s;return l},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)?o.type==="dropdown"&&o.children?o.children.some(t=>this.hasPermission(t)):!0:!1)}},mounted(){this.responsive&&this.initializeResponsiveBehavior()},methods:{getFilteredChildren(o){return o.children?o.children.filter(t=>this.hasPermission(t)):[]},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"),l=document.getElementById("content");!o||!t||!l||(window.innerWidth>=768&&(t.classList.toggle("active"),l.classList.toggle("active")),o.addEventListener("click",()=>{t.classList.toggle("active"),l.classList.toggle("active")}),document.addEventListener("click",c=>{const s=t.contains(c.target),i=o.contains(c.target);!s&&!i&&window.innerWidth<768&&t.classList.contains("active")&&(t.classList.remove("active"),l.classList.remove("active"))}))}},emits:["navigate","action","item-click"]},A={key:0,class:"logo d-flex align-items-center left"},P={style:{"margin-left":"45px"}},F={class:"list-unstyled components mt-4"},M=["onClick"],L=["href","onClick"],q=["onClick"],I={class:"dropdown-toggle",type:"button","data-bs-toggle":"dropdown","aria-expanded":"false"},R={class:"dropdown-menu","aria-labelledby":"dropdownMenuLink"},O=["onClick"],U={key:3,class:"dropdown-divider"},$={key:4};function j(o,t,l,c,s,i){return e.openBlock(),e.createElementBlock("nav",{id:"sidebar",class:e.normalizeClass(i.sidebarClasses)},[l.showLogo?(e.openBlock(),e.createElementBlock("div",A,[e.createElementVNode("span",P,e.toDisplayString(l.brandName),1)])):e.createCommentVNode("",!0),e.createElementVNode("ul",F,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.filteredMenuItems,(n,a)=>(e.openBlock(),e.createElementBlock("li",{key:a,class:e.normalizeClass({active:n.active,dropdown:n.type==="dropdown"}),onClick:m=>i.handleItemClick(n)},[n.type==="link"?(e.openBlock(),e.createElementBlock("a",{key:0,href:n.href||"#",onClick:e.withModifiers(m=>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,L)):n.type==="button"?(e.openBlock(),e.createElementBlock("a",{key:1,onClick:e.withModifiers(m=>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,q)):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(i.getFilteredChildren(n),(m,f)=>(e.openBlock(),e.createElementBlock("a",{key:f,class:"dropdown-item black",onClick:e.withModifiers(E=>i.handleAction(m),["prevent"]),style:{cursor:"pointer"}},e.toDisplayString(m.label),9,O))),128))])],64)):n.type==="separator"?(e.openBlock(),e.createElementBlock("div",U)):n.type==="text"?(e.openBlock(),e.createElementBlock("a",$,e.toDisplayString(n.label),1)):e.createCommentVNode("",!0)],10,M))),128))]),e.renderSlot(o.$slots,"footer")],2)}const V=g(T,[["render",j]]),Yl="",z={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})}},data(){return{activeFilter:"All"}},emits:["vessel-add","vessel-click","vessel-edit","vessel-delete","vessel-toggle-status","vessel-navigate","access-denied","date-change"],computed:{activeVesselsCount(){return this.vessels.filter(o=>o.status==="Active").length},inactiveVesselsCount(){return this.vessels.filter(o=>o.status==="Inactive").length},filteredVessels(){return this.activeFilter==="All"?this.vessels:this.vessels.filter(o=>o.status===this.activeFilter)},canAddVessel(){return this.config.enableAdd&&(this.userProfile.role==="owner"||this.userProfile.role==="staff")}},methods:{filterVessels(o){this.activeFilter=o},clearFilter(){this.activeFilter="All"},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.grantAccess(o)?this.currentRoute==="dashboard"?this.$emit("vessel-click",o):this.$emit("vessel-navigate",t):this.handleAccessDenied("this protected route")},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())||""}`},getDuration(o,t){const l=new Date,c=new Date(o),s=l-c;if(s<0)return"Invalid (future date)";const i=Math.floor(s/(1e3*60*60)),n=Math.floor(i/24),a=i%24;let m="";return n>0&&(m+=`${n} day${n>1?"s":""}`),a>0&&(m+=(m?" ":"")+`${a} hr${a>1?"s":""}`),m||"0 hr"},setVesselDate(o){this.$emit("date-change",o)},grantAccess(o){const{role:t,vessel:l}=this.userProfile;return t==="owner"||t==="staff"||t==="captain"&&l===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":""}}},H={class:"row mb-3"},Q={class:"col-md-4"},J={class:"card-body d-flex align-items-center"},W={class:"mt-2 mb-0"},K={class:"col-md-4"},G={class:"card-body d-flex align-items-center"},Y={class:"mt-2 mb-0"},X={key:0,class:"col-md-4"},Z={class:"d-flex justify-content-between align-items-center mb-4"},v={key:0,class:"alert alert-info mb-3",role:"alert"},ee={key:1,class:"text-center py-4"},te={key:2,class:"alert alert-primary",role:"alert"},oe={key:3,class:"alert alert-warning",role:"alert"},ne={class:"alert-heading"},se={class:"mb-0"},ie={key:4,class:"row"},le=["onClick"],re={class:"card-body d-flex align-items-center"},ae={class:"flex-grow-1"},de={class:"d-flex justify-content-between align-items-center mb-2"},ce={class:"card-title mb-0"},me={class:"row"},pe={class:"col-6"},he={class:"mb-0"},ge={key:0,class:"col-6"},fe={class:"mb-0"},Ee={class:"mb-0"},Ve={key:1,class:"col-6"},Ne={class:"text-muted"},ye=["onClick"],ke={class:"action-icon v-left delete"},be=["onClick"],we=["onClick"];function Ce(o,t,l,c,s,i){return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",H,[e.createElementVNode("div",Q,[e.createElementVNode("div",{class:e.normalizeClass(["card border-0 shadow-sm",{"border-primary border-2":s.activeFilter==="Active"}]),onClick:t[0]||(t[0]=n=>i.filterVessels("Active")),style:{cursor:"pointer"}},[e.createElementVNode("div",J,[t[5]||(t[5]=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[4]||(t[4]=e.createElementVNode("h6",{class:"mb-0"},"Active Vessels",-1)),e.createElementVNode("h3",W,e.toDisplayString(i.activeVesselsCount),1)])])],2)]),e.createElementVNode("div",K,[e.createElementVNode("div",{class:e.normalizeClass(["card border-0 shadow-sm",{"border-secondary border-2":s.activeFilter==="Inactive"}]),onClick:t[1]||(t[1]=n=>i.filterVessels("Inactive")),style:{cursor:"pointer"}},[e.createElementVNode("div",G,[t[7]||(t[7]=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[6]||(t[6]=e.createElementVNode("h6",{class:"mb-0"},"Inactive",-1)),e.createElementVNode("h3",Y,e.toDisplayString(i.inactiveVesselsCount),1)])])],2)]),i.canAddVessel?(e.openBlock(),e.createElementBlock("div",X,[e.createElementVNode("div",{class:"card border-0 shadow-sm",onClick:t[2]||(t[2]=(...n)=>i.handleAddVessel&&i.handleAddVessel(...n)),style:{cursor:"pointer"}},t[8]||(t[8]=[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)]),e.createElementVNode("div",Z,[t[10]||(t[10]=e.createElementVNode("h4",{class:"mb-0"},[e.createElementVNode("i",{class:"bi bi-ship me-2"}),e.createTextVNode("Registered Vessels")],-1)),s.activeFilter!=="All"?(e.openBlock(),e.createElementBlock("button",{key:0,class:"btn btn-sm btn-outline-secondary",onClick:t[3]||(t[3]=(...n)=>i.clearFilter&&i.clearFilter(...n))},t[9]||(t[9]=[e.createElementVNode("i",{class:"bi bi-x-circle me-1"},null,-1),e.createTextVNode("Clear Filter ",-1)]))):e.createCommentVNode("",!0)]),s.activeFilter!=="All"?(e.openBlock(),e.createElementBlock("div",v,[t[11]||(t[11]=e.createTextVNode(" Showing ",-1)),e.createElementVNode("strong",null,e.toDisplayString(s.activeFilter),1),e.createTextVNode(" vessels ("+e.toDisplayString(i.filteredVessels.length)+") ",1)])):e.createCommentVNode("",!0),l.loading?(e.openBlock(),e.createElementBlock("div",ee,t[12]||(t[12]=[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)]))):!i.filteredVessels.length&&s.activeFilter==="All"?(e.openBlock(),e.createElementBlock("div",te,t[13]||(t[13]=[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)]))):!i.filteredVessels.length&&s.activeFilter!=="All"?(e.openBlock(),e.createElementBlock("div",oe,[e.createElementVNode("h4",ne,"No "+e.toDisplayString(s.activeFilter)+" Vessels",1),e.createElementVNode("p",se,"There are no "+e.toDisplayString(s.activeFilter.toLowerCase())+" vessels in your fleet.",1)])):(e.openBlock(),e.createElementBlock("div",ie,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.filteredVessels,n=>(e.openBlock(),e.createElementBlock("div",{class:"col-lg-6",key:n.registrationNumber||n.id},[e.createElementVNode("div",{class:"vessel-card",onClick:a=>i.handleVesselClick(n)},[e.createElementVNode("div",re,[t[17]||(t[17]=e.createElementVNode("div",{class:"vessel-icon v-left"},[e.createElementVNode("i",{class:"fas fa-ship"})],-1)),e.createElementVNode("div",ae,[e.createElementVNode("div",de,[e.createElementVNode("h5",ce,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",me,[e.createElementVNode("div",pe,[t[14]||(t[14]=e.createElementVNode("small",{class:"text-muted"},"Registration #:",-1)),e.createElementVNode("p",he,e.toDisplayString(n.registrationNumber),1)]),n.date?(e.openBlock(),e.createElementBlock("div",ge,[n.status==="Active"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t[15]||(t[15]=e.createElementVNode("small",{class:"text-muted"},"Active Duration:",-1)),e.createElementVNode("p",fe,e.toDisplayString(i.getDuration(n.date,n.registrationNumber)),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t[16]||(t[16]=e.createElementVNode("small",{class:"text-muted"},"Inactive Duration:",-1)),e.createElementVNode("p",Ee,e.toDisplayString(i.getDuration(n.date,n.registrationNumber)),1)],64))])):(e.openBlock(),e.createElementBlock("div",Ve,[e.createElementVNode("small",Ne,e.toDisplayString(n.status)+" Duration:",1),e.createElementVNode("button",{type:"button",class:"btn btn-outline-primary btn-sm mt-1",onClick:e.withModifiers(a=>i.setVesselDate(n.registrationNumber),["stop"])}," Set Date ",8,ye)]))])])]),e.createElementVNode("div",ke,[e.createElementVNode("i",{class:"bi bi-trash",onClick:e.withModifiers(a=>i.handleDeleteVessel(n),["stop"])},null,8,be)]),e.createElementVNode("button",{class:"btn btn-primary",onClick:e.withModifiers(a=>i.handleToggleStatus(n),["stop"])},e.toDisplayString(n.status==="Active"?"Mark Inactive":"Mark Active"),9,we)],8,le)]))),128))]))],64)}const N=g(z,[["render",Ce]]),Xl="",De={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")}}},ue={class:"page-header d-flex justify-content-between align-items-center"},Se={style:{"margin-left":"20px"}},Be={class:"d-flex"};function _e(o,t,l,c,s,i){return e.openBlock(),e.createElementBlock("div",ue,[e.createElementVNode("h4",Se,e.toDisplayString(l.name),1),e.createElementVNode("div",Be,[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 y=g(De,[["render",_e]]),xe={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(l=>l.component.toLowerCase().includes(t)||l.taskName.toLowerCase().includes(t)||l.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 l={id:Date.now(),text:t,completed:!1};this.checklists.push(l)}}})},setFilter(o){this.activeFilter=o},loadChecklist(o){this.isLoading=!0,this.$emit("generate-checklist",{component:o,callback:t=>{this.checklists=t.map(l=>({...l,completed:!1})),this.isLoading=!1}})},showMaintenance(o){if(this.deepAccess()){const t=this.tasks.find(l=>l.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(l=>l.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 l=new Date(o);switch(t){case"daily":l.setDate(l.getDate()+1);break;case"weekly":l.setDate(l.getDate()+7);break;case"monthly":l.setMonth(l.getMonth()+1);break;case"quarterly":l.setMonth(l.getMonth()+3);break;case"semi-annual":l.setMonth(l.getMonth()+6);break;case"annual":l.setFullYear(l.getFullYear()+1);break;case"once":case"custom":return}this.form.nextDue=l.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 l=t-o,c=Math.ceil(l/(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(l=>l.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:l=>{this.isSaving=!1,l&&(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":"Soon",l={checklistProgress:[...this.checklists],status:t,component:this.currentTask,after:this.after};this.$emit("update-task",{updateData:l,file:this.fileattachments.file,tasks:this.tasks,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(l=>l.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)}})}}},Te={key:0},Ae=["onClick"],Pe={class:"content"},Fe={key:0,class:"loading-container"},Me={key:1},Le={class:"container"},qe={class:"d-flex justify-content-between align-items-center"},Ie={class:"progress-container"},Re={class:"progress-info"},Oe={class:"progress-bar"},Ue={class:"checklist"},$e=["onClick"],je={key:0},ze=["onClick"],He=["onClick"],Qe={key:0},Je={class:"checklist"},We={class:"checklist-item"},Ke={class:"attachment-area"},Ge={key:2,class:"status"},Ye={class:"form-group"},Xe={class:"form-group"},Ze={class:"input-group"},ve={class:"form-group"},et={class:"form-group"},tt={class:"input-group"},ot={class:"form-group"},nt={class:"form-group"},st={class:"input-group"},it={class:"form-group"},lt={class:"form-group"},rt=["value"],at={class:"input-group"},dt={class:"form-group"},ct={class:"input-group"},mt={class:"form-group"},pt={class:"form-group"},ht={class:"form-group"},gt={class:"checkbox-group"},ft={class:"checkbox-item"},Et={class:"checkbox-item"},Vt={class:"input-group"},Nt={class:"form-group"},yt={class:"form-group"},kt={class:"form-group"},bt={class:"attachment-area"},wt={class:"action-buttons"},Ct=["disabled"],Dt={class:"task-table-wrapper"},ut={class:"table-controls"},St={class:"filters"},Bt={class:"task-table"},_t=["onClick"],xt=["onClick"],Tt={key:0},At={class:"alert alert-primary",role:"alert"},Pt={class:"mb-0"},Ft={class:"report-container",ref:"reportContainer"},Mt={class:"report-info"},Lt={class:"info-box"},qt={class:"info-box"},It={class:"info-box"},Rt={class:"section"},Ot={class:"summary-grid"},Ut={class:"summary-card"},$t={class:"summary-number"},jt={class:"section"},zt={class:"task-header"},Ht={class:"task-title"},Qt={class:"task-component"},Jt={class:"task-details"},Wt={class:"detail-item"},Kt={class:"detail-value"},Gt={class:"detail-item"},Yt={class:"detail-value"},Xt={class:"detail-item"},Zt={class:"detail-value"},vt={class:"detail-item"},eo={class:"detail-value"},to={class:"detail-item"},oo={class:"detail-value"},no={class:"detail-item"},so={class:"detail-value"},io={key:0,style:{margin:"15px 0",padding:"10px",background:"white","border-radius":"5px"}},lo={class:"detail-value"},ro={key:1,style:{margin:"15px 0",padding:"10px",background:"white","border-radius":"5px"}},ao={class:"detail-value"},co={key:2,class:"checklist-progress"},mo={class:"progress-bar"},po={style:{"font-size":"0.9em",color:"#666","margin-top":"5px"}},ho={class:"checklist-items"},go={class:"checklist-icon"},fo={class:"section"},Eo={class:"info-box"},Vo={class:"signature-section"},No={class:"signature-box"},yo={style:{"margin-top":"10px",color:"#666"}};function ko(o,t,l,c,s,i){return s.ready?(e.openBlock(),e.createElementBlock("div",Te,[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:a=>i.handleSectionClick(n)},e.toDisplayString(n.icon)+" "+e.toDisplayString(n.name),11,Ae))),128))],512),[[e.vShow,!s.showReport]]),e.withDirectives(e.createElementVNode("div",Pe,[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",Fe,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",Me,[e.createElementVNode("div",Le,[e.createElementVNode("div",qe,[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",Ie,[e.createElementVNode("div",Re," Progress: "+e.toDisplayString(i.progress)+"% ("+e.toDisplayString(i.completedCount.length)+"/"+e.toDisplayString(s.checklists.length)+") ",1),e.createElementVNode("div",Oe,[e.createElementVNode("div",{class:"progress-fill",style:e.normalizeStyle({width:i.progress+"%"})},null,4)])]),e.createElementVNode("ul",Ue,[(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:a=>i.toggleTask(n)},[n.completed?(e.openBlock(),e.createElementBlock("span",je,"✓")):e.createCommentVNode("",!0)],10,$e),e.createElementVNode("span",{class:e.normalizeClass(["task-text",{completed:n.completed}]),onClick:a=>i.toggleTask(n)},e.toDisplayString(n.text),11,ze),i.showAddTaskButton?(e.openBlock(),e.createElementBlock("button",{key:0,class:"delete-btn",onClick:a=>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,He)):e.createCommentVNode("",!0)]))),128))]),s.after?(e.openBlock(),e.createElementBlock("div",Qe,[t[33]||(t[33]=e.createElementVNode("label",null,"Upload Image Evidence",-1)),e.createElementVNode("ul",Je,[e.createElementVNode("li",We,[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: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",Ke,[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)=>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===s.checklists.length?(e.openBlock(),e.createElementBlock("div",Ge," 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,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",Ye,[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",Xe,[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",Ze,[e.createElementVNode("div",ve,[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",et,[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",tt,[e.createElementVNode("div",ot,[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",nt,[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",st,[e.createElementVNode("div",it,[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",lt,[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(l.vesselCrew,n=>(e.openBlock(),e.createElementBlock("option",{key:n.id,value:`${n.name} - ${n.role}`},e.toDisplayString(n.name)+" - "+e.toDisplayString(n.role),9,rt))),128))],512),[[e.vModelSelect,s.form.assignedTo]])]),e.createElementVNode("div",at,[e.createElementVNode("div",dt,[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",ct,[e.createElementVNode("div",mt,[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",pt,[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",ht,[t[56]||(t[56]=e.createElementVNode("label",null,"Notifications",-1)),e.createElementVNode("div",gt,[e.createElementVNode("div",ft,[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",Et,[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",Vt,[e.createElementVNode("div",Nt,[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",yt,[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",kt,[t[61]||(t[61]=e.createElementVNode("label",null,"Attachments",-1)),e.createElementVNode("div",bt,[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)=>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",wt,[e.createElementVNode("button",{type:"button",class:"btn btn-primary",onClick:t[21]||(t[21]=e.withModifiers((...n)=>i.saveSchedule&&i.saveSchedule(...n),["prevent"])),disabled:s.isSaving},e.toDisplayString(s.isSaving?"Saving...":"Save Schedule"),9,Ct)])])],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",Dt,[e.createElementVNode("div",ut,[e.createElementVNode("div",St,[e.createElementVNode("button",{class:e.normalizeClass({active:s.activeFilter==="due"}),onClick:t[22]||(t[22]=n=>i.setFilter("due"))},"Due",2),e.createElementVNode("button",{class:e.normalizeClass({active:s.activeFilter==="all"}),onClick:t[23]||(t[23]=n=>i.setFilter("all"))},"All",2),e.createElementVNode("button",{class:e.normalizeClass({active:s.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=>s.searchQuery=n),placeholder:"Search..."},null,512),[[e.vModelText,s.searchQuery]])])]),e.createElementVNode("table",Bt,[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:a=>i.printMaintenance(n.component),class:"status-action"},"Print",8,_t)):(e.openBlock(),e.createElementBlock("button",{key:1,onClick:a=>i.showMaintenance(n.component),class:"status-action"},"Start",8,xt))])]))),128))])]),l.tasks.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Tt,[e.createElementVNode("div",At,[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,s.activeSection==="inventory"]])],512),[[e.vShow,!s.showReport]]),e.withDirectives(e.createElementVNode("div",Ft,[t[89]||(t[89]=e.createElementVNode("div",{class:"header"},[e.createElementVNode("div",{class:"report-title"},"MAINTENANCE TASK REPORT")],-1)),e.createElementVNode("div",Mt,[e.createElementVNode("div",Lt,[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",qt,[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",It,[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",Rt,[t[75]||(t[75]=e.createElementVNode("div",{class:"section-title"},"📊 Task Summary",-1)),e.createElementVNode("div",Ot,[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",Ut,[e.createElementVNode("div",$t,e.toDisplayString(i.totalEstimatedHours),1),t[73]||(t[73]=e.createElementVNode("div",{class:"summary-label"},"Total Hours",-1))])])]),e.createElementVNode("div",jt,[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",i.getTaskStatusClass(n)])},[e.createElementVNode("div",zt,[e.createElementVNode("div",null,[e.createElementVNode("div",Ht,[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",Qt,"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",Jt,[e.createElementVNode("div",Wt,[t[76]||(t[76]=e.createElementVNode("div",{class:"detail-label"},"Assigned To",-1)),e.createElementVNode("div",Kt,e.toDisplayString(n.assignedTo),1)]),e.createElementVNode("div",Gt,[t[77]||(t[77]=e.createElementVNode("div",{class:"detail-label"},"Estimated Hours",-1)),e.createElementVNode("div",Yt,e.toDisplayString(n.estimatedHours)+" hours",1)]),e.createElementVNode("div",Xt,[t[78]||(t[78]=e.createElementVNode("div",{class:"detail-label"},"Last Performed",-1)),e.createElementVNode("div",Zt,e.toDisplayString(i.formatDate(n.lastPerformed)),1)]),e.createElementVNode("div",vt,[t[79]||(t[79]=e.createElementVNode("div",{class:"detail-label"},"Next Due",-1)),e.createElementVNode("div",eo,e.toDisplayString(i.formatDate(n.nextDue)),1)]),e.createElementVNode("div",to,[t[80]||(t[80]=e.createElementVNode("div",{class:"detail-label"},"Recurrence",-1)),e.createElementVNode("div",oo,e.toDisplayString(n.recurrence),1)]),e.createElementVNode("div",no,[t[81]||(t[81]=e.createElementVNode("div",{class:"detail-label"},"Remaining Days",-1)),e.createElementVNode("div",so,e.toDisplayString(n.remainingDays)+" days",1)])]),n.description?(e.openBlock(),e.createElementBlock("div",io,[t[82]||(t[82]=e.createElementVNode("div",{class:"detail-label"},"Description",-1)),e.createElementVNode("div",lo,e.toDisplayString(n.description),1)])):e.createCommentVNode("",!0),n.notes?(e.openBlock(),e.createElementBlock("div",ro,[t[83]||(t[83]=e.createElementVNode("div",{class:"detail-label"},"Notes",-1)),e.createElementVNode("div",ao,e.toDisplayString(n.notes),1)])):e.createCommentVNode("",!0),n.checklistProgress&&n.checklistProgress.length>0?(e.openBlock(),e.createElementBlock("div",co,[t[84]||(t[84]=e.createElementVNode("div",{class:"detail-label"},"Checklist Progress",-1)),e.createElementVNode("div",mo,[e.createElementVNode("div",{class:"progress-fill",style:e.normalizeStyle({width:i.getChecklistProgress(n)+"%"})},null,4)]),e.createElementVNode("div",po,e.toDisplayString(i.getCompletedChecklistItems(n))+" of "+e.toDisplayString(n.checklistProgress.length)+" items completed ("+e.toDisplayString(i.getChecklistProgress(n))+"%) ",1),e.createElementVNode("div",ho,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.checklistProgress,(a,m)=>(e.openBlock(),e.createElementBlock("div",{key:m,class:"checklist-item"},[e.createElementVNode("span",go,e.toDisplayString(a.completed?"✅":"⭕"),1),e.createElementVNode("span",null,e.toDisplayString(a.text||"Checklist Item "+(m+1)),1)]))),128))])])):e.createCommentVNode("",!0)],2))),128))]),e.createElementVNode("div",fo,[t[86]||(t[86]=e.createElementVNode("div",{class:"section-title"},"📋 Recommendations",-1)),e.createElementVNode("div",Eo,[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",Vo,[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",No,[t[87]||(t[87]=e.createElementVNode("div",null,[e.createElementVNode("strong",null,"Date")],-1)),e.createElementVNode("div",yo,e.toDisplayString(s.reportDate),1)])])],512),[[e.vShow,s.showReport]])])])):e.createCommentVNode("",!0)}const k=g(xe,[["render",ko]]),Zl="",bo={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"}}},wo={class:"activity-logs"},Co={class:"a-controls"},Do={class:"a-search-box"},uo=["value"],So=["value"],Bo={class:"stats-grid"},_o={class:"stat-card"},xo={class:"value"},To={class:"stat-card"},Ao={class:"value"},Po={class:"stat-card"},Fo={class:"value"},Mo={class:"logs-container"},Lo={key:0,class:"loading"},qo={key:1,class:"no-logs"},Io={key:2},Ro={class:"logs-table"},Oo={style:{color:"gray"}},Uo={style:{color:"gray"}},$o={class:"pagination"},jo=["disabled"],zo=["onClick"],Ho=["disabled"];function Qo(o,t,l,c,s,i){return e.openBlock(),e.createElementBlock("div",wo,[e.createElementVNode("div",Co,[e.createElementVNode("div",Do,[e.createElementVNode("input",{type:"text",placeholder:"Search activities, users, or actions...",value:l.searchTerm,onInput:t[0]||(t[0]=n=>o.$emit("update:searchTerm",n.target.value))},null,40,uo)]),e.createElementVNode("select",{class:"filter-select",value:l.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,So),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",Bo,[e.createElementVNode("div",_o,[t[7]||(t[7]=e.createElementVNode("h3",null,"Total Activities",-1)),e.createElementVNode("div",xo,e.toDisplayString(l.totalActivities),1)]),e.createElementVNode("div",To,[t[8]||(t[8]=e.createElementVNode("h3",null,"Today's Activities",-1)),e.createElementVNode("div",Ao,e.toDisplayString(l.todayActivities),1)]),e.createElementVNode("div",Po,[t[9]||(t[9]=e.createElementVNode("h3",null,"Active Users",-1)),e.createElementVNode("div",Fo,e.toDisplayString(l.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",Mo,[l.loading?(e.openBlock(),e.createElementBlock("div",Lo,t[11]||(t[11]=[e.createElementVNode("div",{class:"spinner"},null,-1),e.createElementVNode("p",null,"Loading activity logs...",-1)]))):l.logs.length===0?(e.openBlock(),e.createElementBlock("div",qo,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",Io,[e.createElementVNode("table",Ro,[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(l.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",Oo,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,(a,m)=>(e.openBlock(),e.createElementBlock("div",{key:m},[e.createElementVNode("strong",null,e.toDisplayString(m)+": ",1),e.createElementVNode("small",Uo,e.toDisplayString(a.from||"")+" → "+e.toDisplayString(a.to||a),1)]))),128))]),e.createElementVNode("td",null,e.toDisplayString(n.table_name),1)]))),128))])]),e.createElementVNode("div",$o,[e.createElementVNode("button",{onClick:t[4]||(t[4]=n=>o.$emit("change-page",l.currentPage-1)),disabled:l.currentPage===1}," Previous ",8,jo),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.totalPages,n=>(e.openBlock(),e.createElementBlock("button",{key:n,onClick:a=>o.$emit("change-page",n),class:e.normalizeClass({active:l.currentPage===n})},e.toDisplayString(n),11,zo))),128)),e.createElementVNode("button",{onClick:t[5]||(t[5]=n=>o.$emit("change-page",l.currentPage+1)),disabled:l.currentPage===l.totalPages}," Next ",8,Ho)])]))])])}const b=g(bo,[["render",Qo]]),vl="",Jo={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-deboard","crew-add-certification","crew-view-certification","search-changed","filter-changed","access-denied","upload-cert-image"],data(){return{searchQuery:"",filterStatus:"all",showAddForm:!1,formErrors:{},expandedLogs:[],showTimesheet:!1,timesheetFilter:"all",timesheetSearch:"",timesheetSortKey:"timestamp",timesheetSortOrder:"desc",newCrew:{name:"",role:"Deckhand",customRole:"",status:"available",nextShift:"",certifications:[{name:"",expiryDate:"",imageFile:null,imagePreview:null,imageName:"",imageType:""}],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()),l=this.filterStatus==="all"||o.status===this.filterStatus;return t&&l})},allTimesheetEntries(){const o=[];return this.crew.forEach(t=>{t.log&&t.log.length>0&&t.log.forEach((l,c)=>{o.push({...l,crewName:t.name,role:t.role,crewId:t.id,uniqueId:`${t.id}-${c}`})})}),o.sort((t,l)=>{const c=new Date(t.timestamp),s=new Date(l.timestamp);return this.timesheetSortOrder==="desc"?s-c:c-s})},filteredTimesheetEntries(){let o=this.allTimesheetEntries;if(this.timesheetFilter!=="all"&&(o=o.filter(t=>t.action===this.timesheetFilter)),this.timesheetSearch){const t=this.timesheetSearch.toLowerCase();o=o.filter(l=>l.crewName.toLowerCase().includes(t)||l.role.toLowerCase().includes(t)||l.action.toLowerCase().includes(t)||l.vessel&&l.vessel.toLowerCase().includes(t)||l.notes&&l.notes.toLowerCase().includes(t))}return this.sortTimesheetEntries(o)},uniqueCrewCount(){return new Set(this.filteredTimesheetEntries.map(t=>t.crewId)).size},timesheetDateRange(){if(this.filteredTimesheetEntries.length===0)return"N/A";const o=this.filteredTimesheetEntries.map(s=>new Date(s.timestamp)),t=new Date(Math.min(...o)),l=new Date(Math.max(...o)),c=s=>s.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return`${c(t)} - ${c(l)}`},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")},canDeboardCrew(){return this.config.enableAssignShift&&this.hasPermission("assign")}},methods:{hasPermission(o){const{role:t,vessel:l}=this.userProfile,c=l===this.vesselName;let i={owner:["add","edit","delete","assign","view"],staff:["add","edit","assign","view"],captain:["assign","view"],viewer:["view"]}[t]||[];return t==="captain"&&c&&(i=[...i,"add"]),i.includes(o)},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)},filterTimesheet(){},sortTimesheet(o){this.timesheetSortKey===o?this.timesheetSortOrder=this.timesheetSortOrder==="asc"?"desc":"asc":(this.timesheetSortKey=o,this.timesheetSortOrder="asc")},sortTimesheetEntries(o){const t=[...o];return t.sort((l,c)=>{let s,i;switch(this.timesheetSortKey){case"timestamp":s=new Date(l.timestamp),i=new Date(c.timestamp);break;case"crewName":s=l.crewName.toLowerCase(),i=c.crewName.toLowerCase();break;case"role":s=l.role.toLowerCase(),i=c.role.toLowerCase();break;case"action":s=l.action.toLowerCase(),i=c.action.toLowerCase();break;default:return 0}return s<i?this.timesheetSortOrder==="asc"?-1:1:s>i?this.timesheetSortOrder==="asc"?1:-1:0}),t},getTimesheetRowClass(o){return`timesheet-row-${o.toLowerCase().replace(/\s+/g,"-")}`},async handleAddCrewMember(){if(!this.validateForm())return;const o=this.newCrew.certifications.filter(s=>s.name.trim()!==""&&s.expiryDate!==""&&s.imageFile!==null);if(o.length===0){alert("Please add at least one complete certification with name, expiry date, and image.");return}const t=this.newCrew.role==="Other"?this.newCrew.customRole:this.newCrew.role,l=await Promise.all(o.map(async(s,i)=>{const n=await this.uploadCertificationImage(s.imageFile,this.newCrew.email);return{name:s.name,expiryDate:s.expiryDate,imageName:s.imageName,imageType:s.imageType,imageUrl:n.publicUrl}})),c={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",c),this.resetForm(),this.showAddForm=!1},async uploadCertificationImage(o,t){return new Promise((l,c)=>{this.$emit("upload-cert-image",{file:o,email:t,callback:s=>{s.error?c(s.error):l(s)}})})},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)},handleDeboardCrew(o){if(!this.canDeboardCrew){this.$emit("access-denied",{action:"deboard crew",userProfile:this.userProfile});return}let t=null;if(o.nextShift){const l=new Date(o.nextShift),s=Math.abs(new Date-l);t=Math.ceil(s/(1e3*60*60*24))}this.$emit("crew-deboard",{member:o,duration:t})},toggleCrewLog(o){const t=this.expandedLogs.indexOf(o);t>-1?this.expandedLogs.splice(t,1):this.expandedLogs.push(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:"",imageFile:null,imagePreview:null,imageName:"",imageType:""}],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:"",imageFile:null,imagePreview:null,imageName:"",imageType:""})},removeCertification(o){this.newCrew.certifications.splice(o,1)},handleCertImageUpload(o,t){const l=o.target.files[0];if(!l)return;const c=this.newCrew.certifications[t];if(c.imageFile=l,c.imageName=l.name,c.imageType=l.type.includes("pdf")?"pdf":"image",c.imageType==="image"){const s=new FileReader;s.onload=i=>{c.imagePreview=i.target.result},s.readAsDataURL(l)}else c.imagePreview="pdf"},removeCertImage(o){const t=this.newCrew.certifications[o];t.imageFile=null,t.imagePreview=null,t.imageName="",t.imageType="";const l=document.getElementById("cert-image-"+o);l&&(l.value="")},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),l=new Date,c=new Date;return c.setMonth(l.getMonth()+1),t<=l?"expired":t<=c?"expiringSoon":"valid"},formatLogDate(o){return o?new Date(o).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):""},getLogActionClass(o){return{Embarked:"log-action-embark",Deboarded:"log-action-deboard",Assigned:"log-action-assign","Status Changed":"log-action-status"}[o]||""},getLogIcon(o){return{Embarked:"bi bi-box-arrow-in-right",Deboarded:"bi bi-box-arrow-left",Assigned:"bi bi-calendar-check","Status Changed":"bi bi-arrow-repeat"}[o]||"bi bi-circle-fill"}}},Wo={class:"crew-management"},Ko={key:0,class:"wave-bg"},Go={class:"crew-section"},Yo={class:"crew-section-header"},Xo={class:"crew-subhead"},Zo={key:0,class:"search-filter"},vo={key:1,class:"loading-state"},en={key:2,class:"timesheet-view"},tn={class:"timesheet-header"},on={class:"timesheet-controls"},nn={class:"timesheet-summary"},sn={class:"summary-card"},ln={class:"summary-value"},rn={class:"summary-card"},an={class:"summary-value"},dn={class:"summary-card"},cn={class:"summary-value"},mn={key:0,class:"no-results"},pn={key:1,class:"timesheet-table-container"},hn={class:"timesheet-table"},gn={class:"timestamp-cell"},fn={class:"crew-name-cell"},En={class:"role-cell"},Vn={class:"action-cell"},Nn={class:"vessel-cell"},yn={class:"duration-cell"},kn={class:"notes-cell"},bn={key:3,class:"crew-grid"},wn={class:"crew-name"},Cn={class:"crew-role"},Dn={class:"crew-certifications"},un=["onClick"],Sn=["onClick"],Bn={class:"crew-availability"},_n={class:"crew-availability"},xn={class:"action-buttons"},Tn={key:0,class:"status-available crew-availability vcard"},An={key:1,class:"status-unavailable crew-availability vcard"},Pn=["onClick"],Fn=["onClick"],Mn={class:"crew-footer"},Ln={key:0,class:"crew-log-toggle"},qn=["onClick"],In=["onClick"],Rn={key:0,class:"crew-log"},On={class:"log-date"},Un={class:"log-details"},$n={key:0},jn={key:1},zn={key:0,class:"log-notes"},Hn={key:4,class:"no-results"},Qn={key:5,class:"add-crew-form"},Jn={class:"form-row"},Wn={class:"form-group"},Kn={key:0,class:"error-message"},Gn={class:"form-group"},Yn=["value"],Xn={class:"form-row"},Zn={class:"form-group"},vn={class:"form-group"},es={key:0,class:"error-message"},ts={class:"certification-section"},os={class:"form-row"},ns={class:"form-group"},ss=["onUpdate:modelValue"],is={class:"form-group"},ls=["onUpdate:modelValue"],rs={class:"form-group"},as={class:"image-upload-wrapper"},ds=["id","onChange"],cs=["for"],ms={key:0,class:"image-preview"},ps=["src"],hs={key:1,class:"pdf-preview"},gs=["onClick"],fs={key:1,class:"file-name"},Es={class:"form-group",style:{display:"flex","align-items":"flex-end"}},Vs=["onClick"],Ns={class:"form-row"},ys={class:"form-group"},ks={class:"form-actions"};function bs(o,t,l,c,s,i){return e.openBlock(),e.createElementBlock("div",Wo,[l.config.showWaveBackground?(e.openBlock(),e.createElementBlock("div",Ko)):e.createCommentVNode("",!0),e.createElementVNode("div",Go,[e.createElementVNode("div",Yo,[e.createElementVNode("h4",Xo,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(s.showAddForm?"Cancel":"+ Add Crew Member"),1)):e.createCommentVNode("",!0)]),s.showAddForm?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("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)=>i.handleSearch&&i.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)=>i.handleFilter&&i.handleFilter(...n))},t[22]||(t[22]=[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]]),e.createElementVNode("button",{class:"btn btn-secondary",onClick:t[5]||(t[5]=n=>s.showTimesheet=!s.showTimesheet)},[e.createElementVNode("i",{class:e.normalizeClass(s.showTimesheet?"bi bi-grid-3x3-gap":"bi bi-table")},null,2),e.createTextVNode(" "+e.toDisplayString(s.showTimesheet?"Show Crew Cards":"Show Timesheet"),1)])])),l.loading&&!s.showAddForm?(e.openBlock(),e.createElementBlock("div",vo,t[23]||(t[23]=[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)]))):s.showTimesheet&&!s.showAddForm?(e.openBlock(),e.createElementBlock("div",en,[e.createElementVNode("div",tn,[t[25]||(t[25]=e.createElementVNode("h3",null,[e.createElementVNode("i",{class:"bi bi-table"}),e.createTextVNode(" Crew Activity Timesheet")],-1)),e.createElementVNode("div",on,[e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":t[6]||(t[6]=n=>s.timesheetFilter=n),onChange:t[7]||(t[7]=(...n)=>i.filterTimesheet&&i.filterTimesheet(...n))},t[24]||(t[24]=[e.createStaticVNode('<option value="all">All Activities</option><option value="Embarked">Embarked Only</option><option value="Deboarded">Deboarded Only</option><option value="Assigned">Assigned Only</option><option value="Status Changed">Status Changes Only</option>',5)]),544),[[e.vModelSelect,s.timesheetFilter]]),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":t[8]||(t[8]=n=>s.timesheetSearch=n),placeholder:"Search timesheet...",class:"timesheet-search"},null,512),[[e.vModelText,s.timesheetSearch]])])]),e.createElementVNode("div",nn,[e.createElementVNode("div",sn,[t[26]||(t[26]=e.createElementVNode("span",{class:"summary-label"},"Total Entries:",-1)),e.createElementVNode("span",ln,e.toDisplayString(i.filteredTimesheetEntries.length),1)]),e.createElementVNode("div",rn,[t[27]||(t[27]=e.createElementVNode("span",{class:"summary-label"},"Crew Members:",-1)),e.createElementVNode("span",an,e.toDisplayString(i.uniqueCrewCount),1)]),e.createElementVNode("div",dn,[t[28]||(t[28]=e.createElementVNode("span",{class:"summary-label"},"Date Range:",-1)),e.createElementVNode("span",cn,e.toDisplayString(i.timesheetDateRange),1)])]),i.filteredTimesheetEntries.length===0?(e.openBlock(),e.createElementBlock("div",mn," No timesheet entries found. ")):(e.openBlock(),e.createElementBlock("div",pn,[e.createElementVNode("table",hn,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[e.createElementVNode("th",{onClick:t[9]||(t[9]=n=>i.sortTimesheet("timestamp"))},t[29]||(t[29]=[e.createTextVNode(" Date/Time ",-1),e.createElementVNode("i",{class:"bi bi-arrow-down-up"},null,-1)])),e.createElementVNode("th",{onClick:t[10]||(t[10]=n=>i.sortTimesheet("crewName"))},t[30]||(t[30]=[e.createTextVNode(" Crew Member ",-1),e.createElementVNode("i",{class:"bi bi-arrow-down-up"},null,-1)])),e.createElementVNode("th",{onClick:t[11]||(t[11]=n=>i.sortTimesheet("role"))},t[31]||(t[31]=[e.createTextVNode(" Role ",-1),e.createElementVNode("i",{class:"bi bi-arrow-down-up"},null,-1)])),e.createElementVNode("th",{onClick:t[12]||(t[12]=n=>i.sortTimesheet("action"))},t[32]||(t[32]=[e.createTextVNode(" Action ",-1),e.createElementVNode("i",{class:"bi bi-arrow-down-up"},null,-1)])),t[33]||(t[33]=e.createElementVNode("th",null,"Vessel",-1)),t[34]||(t[34]=e.createElementVNode("th",null,"Duration",-1)),t[35]||(t[35]=e.createElementVNode("th",null,"Notes",-1))])]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.filteredTimesheetEntries,n=>(e.openBlock(),e.createElementBlock("tr",{key:n.uniqueId,class:e.normalizeClass(i.getTimesheetRowClass(n.action))},[e.createElementVNode("td",gn,e.toDisplayString(i.formatLogDate(n.timestamp)),1),e.createElementVNode("td",fn,[e.createElementVNode("strong",null,e.toDisplayString(n.crewName),1)]),e.createElementVNode("td",En,e.toDisplayString(n.role),1),e.createElementVNode("td",Vn,[e.createElementVNode("span",{class:e.normalizeClass(["action-badge",i.getLogActionClass(n.action)])},[e.createElementVNode("i",{class:e.normalizeClass(i.getLogIcon(n.action))},null,2),e.createTextVNode(" "+e.toDisplayString(n.action),1)],2)]),e.createElementVNode("td",Nn,e.toDisplayString(n.vessel||"N/A"),1),e.createElementVNode("td",yn,e.toDisplayString(n.duration?n.duration+" days":"N/A"),1),e.createElementVNode("td",kn,e.toDisplayString(n.notes||"-"),1)],2))),128))])])]))])):i.filteredCrew.length>0&&!s.showAddForm?(e.openBlock(),e.createElementBlock("div",bn,[(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(["crew-status-badge",i.getStatusClass(n.status)])},e.toDisplayString(i.formatStatus(n.status)),3),e.createElementVNode("div",wn,e.toDisplayString(n.name),1),e.createElementVNode("div",Cn,e.toDisplayString(n.role),1),e.createElementVNode("div",Dn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.certifications,a=>(e.openBlock(),e.createElementBlock("div",{key:a.name,class:e.normalizeClass(["certification-tag",i.getCertificationClass(a.expiryDate)]),onClick:m=>i.handleViewCertification(a,n)},e.toDisplayString(a.name),11,un))),128)),i.canEditCrew?(e.openBlock(),e.createElementBlock("i",{key:0,class:"bi bi-patch-plus-fill icon",onClick:a=>i.handleAddCertification(n)},null,8,Sn)):e.createCommentVNode("",!0)]),e.createElementVNode("div",Bn,[t[36]||(t[36]=e.createElementVNode("strong",null,"Embarkation Date:",-1)),e.createTextVNode(" "+e.toDisplayString(n.nextShift||"Not Scheduled"),1)]),e.createElementVNode("div",_n,[t[37]||(t[37]=e.createElementVNode("strong",null,"Expected Days Onboard (in days):",-1)),e.createTextVNode(" "+e.toDisplayString(n.onBoard||"Not Scheduled"),1)]),e.createElementVNode("div",xn,[n.vessel?(e.openBlock(),e.createElementBlock("div",Tn," Vessel: "+e.toDisplayString(n.vessel),1)):(e.openBlock(),e.createElementBlock("div",An," Vessel: Unassigned ")),i.canAssignShift&&n.status!=="onduty"?(e.openBlock(),e.createElementBlock("button",{key:2,class:"btn btn-primary",onClick:a=>i.handleAssignShift(n)}," Assign Shift ",8,Pn)):e.createCommentVNode("",!0),i.canDeboardCrew&&n.status==="onduty"?(e.openBlock(),e.createElementBlock("button",{key:3,class:"btn btn-warning",onClick:a=>i.handleDeboardCrew(n)}," Deboard ",8,Fn)):e.createCommentVNode("",!0)]),e.createElementVNode("div",Mn,[n.log&&n.log.length>0?(e.openBlock(),e.createElementBlock("div",Ln,[e.createElementVNode("button",{class:"btn btn-link btn-sm log-toggle-btn",onClick:a=>i.toggleCrewLog(n.id)},[t[38]||(t[38]=e.createElementVNode("i",{class:"bi bi-clock-history"},null,-1)),e.createTextVNode(" View Log ("+e.toDisplayString(n.log.length)+") ",1)],8,qn)])):e.createCommentVNode("",!0),i.canDeleteCrew?(e.openBlock(),e.createElementBlock("i",{key:1,class:"bi bi-trash icon delete-icon",onClick:a=>i.handleDeleteCrew(n)},null,8,In)):e.createCommentVNode("",!0)]),s.expandedLogs.includes(n.id)?(e.openBlock(),e.createElementBlock("div",Rn,[t[39]||(t[39]=e.createElementVNode("h4",null,"Crew Activity Log",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.log,(a,m)=>(e.openBlock(),e.createElementBlock("div",{key:m,class:"log-entry"},[e.createElementVNode("div",On,e.toDisplayString(i.formatLogDate(a.timestamp)),1),e.createElementVNode("div",{class:e.normalizeClass(["log-action",i.getLogActionClass(a.action)])},[e.createElementVNode("i",{class:e.normalizeClass(i.getLogIcon(a.action))},null,2),e.createTextVNode(" "+e.toDisplayString(a.action),1)],2),e.createElementVNode("div",Un,[a.vessel?(e.openBlock(),e.createElementBlock("span",$n,"Vessel: "+e.toDisplayString(a.vessel),1)):e.createCommentVNode("",!0),a.duration?(e.openBlock(),e.createElementBlock("span",jn," | Duration: "+e.toDisplayString(a.duration)+" days",1)):e.createCommentVNode("",!0)]),a.notes?(e.openBlock(),e.createElementBlock("div",zn,e.toDisplayString(a.notes),1)):e.createCommentVNode("",!0)]))),128))])):e.createCommentVNode("",!0)],2))),128))])):!l.loading&&!s.showTimesheet&&!s.showAddForm?(e.openBlock(),e.createElementBlock("div",Hn,e.toDisplayString(l.crew.length===0?"No crew members found.":"No crew members found matching your search criteria."),1)):e.createCommentVNode("",!0),s.showAddForm?(e.openBlock(),e.createElementBlock("div",Qn,[t[54]||(t[54]=e.createElementVNode("h2",null,"Add New Crew Member",-1)),e.createElementVNode("div",Jn,[e.createElementVNode("div",Wn,[t[40]||(t[40]=e.createElementVNode("label",{for:"crew-name"},"Full Name *",-1)),e.withDirectives(e.createElementVNode("input",{type:"text",id:"crew-name","onUpdate:modelValue":t[13]||(t[13]=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",Kn,e.toDisplayString(s.formErrors.name),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",Gn,[t[42]||(t[42]=e.createElementVNode("label",{for:"crew-role"},"Role/Position *",-1)),e.withDirectives(e.createElementVNode("select",{id:"crew-role","onUpdate:modelValue":t[14]||(t[14]=n=>s.newCrew.role=n)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.availableRoles,n=>(e.openBlock(),e.createElementBlock("option",{key:n,value:n},e.toDisplayString(n),9,Yn))),128)),t[41]||(t[41]=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[15]||(t[15]=n=>s.newCrew.customRole=n),style:{"margin-top":"8px"}},null,512)),[[e.vModelText,s.newCrew.customRole]]):e.createCommentVNode("",!0)])]),e.createElementVNode("div",Xn,[e.createElementVNode("div",Zn,[t[44]||(t[44]=e.createElementVNode("label",{for:"crew-status"},"Status *",-1)),e.withDirectives(e.createElementVNode("select",{id:"crew-status","onUpdate:modelValue":t[16]||(t[16]=n=>s.newCrew.status=n)},t[43]||(t[43]=[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",vn,[t[45]||(t[45]=e.createElementVNode("label",{for:"crew-email"},"Email Address *",-1)),e.withDirectives(e.createElementVNode("input",{type:"email",id:"crew-email","onUpdate:modelValue":t[17]||(t[17]=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",es,e.toDisplayString(s.formErrors.email),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",ts,[t[52]||(t[52]=e.createElementVNode("h3",null,"Certifications",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.newCrew.certifications,(n,a)=>(e.openBlock(),e.createElementBlock("div",{key:a,class:"certification-entry"},[e.createElementVNode("div",os,[e.createElementVNode("div",ns,[t[46]||(t[46]=e.createElementVNode("label",null,"Certification Name *",-1)),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":m=>n.name=m,placeholder:"Enter certification name"},null,8,ss),[[e.vModelText,n.name]])]),e.createElementVNode("div",is,[t[47]||(t[47]=e.createElementVNode("label",null,"Expiry Date *",-1)),e.withDirectives(e.createElementVNode("input",{type:"date","onUpdate:modelValue":m=>n.expiryDate=m},null,8,ls),[[e.vModelText,n.expiryDate]])]),e.createElementVNode("div",rs,[t[51]||(t[51]=e.createElementVNode("label",null,"Certificate Image *",-1)),e.createElementVNode("div",as,[e.createElementVNode("input",{type:"file",id:"cert-image-"+a,onChange:m=>i.handleCertImageUpload(m,a),accept:"image/*,.pdf",class:"file-input"},null,40,ds),e.createElementVNode("label",{for:"cert-image-"+a,class:"file-input-label"},[t[48]||(t[48]=e.createElementVNode("i",{class:"bi bi-cloud-upload"},null,-1)),e.createTextVNode(" "+e.toDisplayString(n.imagePreview?"Change File":"Upload File"),1)],8,cs),n.imagePreview?(e.openBlock(),e.createElementBlock("div",ms,[n.imageType!=="pdf"?(e.openBlock(),e.createElementBlock("img",{key:0,src:n.imagePreview,alt:"Certificate preview"},null,8,ps)):(e.openBlock(),e.createElementBlock("div",hs,[t[49]||(t[49]=e.createElementVNode("i",{class:"bi bi-file-pdf"},null,-1)),e.createElementVNode("span",null,e.toDisplayString(n.imageName),1)])),e.createElementVNode("button",{type:"button",class:"btn-remove-image",onClick:m=>i.removeCertImage(a)},t[50]||(t[50]=[e.createElementVNode("i",{class:"bi bi-x-circle"},null,-1)]),8,gs)])):e.createCommentVNode("",!0),n.imageName?(e.openBlock(),e.createElementBlock("small",fs,e.toDisplayString(n.imageName),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",Es,[s.newCrew.certifications.length>1?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"btn btn-danger btn-sm",onClick:m=>i.removeCertification(a)}," Remove ",8,Vs)):e.createCommentVNode("",!0)])])]))),128)),e.createElementVNode("button",{type:"button",class:"btn btn-secondary btn-sm",onClick:t[18]||(t[18]=(...n)=>i.addCertificationEntry&&i.addCertificationEntry(...n))}," + Add More Certification ")]),e.createElementVNode("div",Ns,[e.createElementVNode("div",ys,[t[53]||(t[53]=e.createElementVNode("label",{for:"crew-notes"},"Notes",-1)),e.withDirectives(e.createElementVNode("textarea",{id:"crew-notes",rows:"3","onUpdate:modelValue":t[19]||(t[19]=n=>s.newCrew.notes=n)},null,512),[[e.vModelText,s.newCrew.notes]])])]),e.createElementVNode("div",ks,[e.createElementVNode("button",{class:"btn btn-secondary",onClick:t[20]||(t[20]=(...n)=>i.handleCancelForm&&i.handleCancelForm(...n))},"Cancel"),e.createElementVNode("button",{class:"btn btn-primary",onClick:t[21]||(t[21]=(...n)=>i.handleAddCrewMember&&i.handleAddCrewMember(...n))},"Add Crew Member")])])):e.createCommentVNode("",!0)])])}const w=g(Jo,[["render",bs]]),er="",ws={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"]},{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()}},Cs={class:"s-container container"},Ds={class:"nav-tabs"},us=["onClick"],Ss={key:0,class:"tab-content active"},Bs={class:"form-grid"},_s={class:"form-group"},xs=["value"],Ts={class:"form-group"},As=["value"],Ps={class:"form-group"},Fs=["value"],Ms={class:"form-group"},Ls={class:"form-group"},qs={class:"items-section"},Is={class:"items-header"},Rs={class:"form-group"},Os=["onUpdate:modelValue"],Us={class:"form-group"},$s=["onUpdate:modelValue"],js={class:"form-group"},zs=["onUpdate:modelValue"],Hs={class:"form-group"},Qs=["onUpdate:modelValue"],Js=["value"],Ws={class:"form-group"},Ks=["onUpdate:modelValue"],Gs=["onClick"],Ys={key:1,class:"tab-content active"},Xs={class:"requisition-list"},Zs={class:"requisition-header"},vs={class:"requisition-id"},ei={class:"requisition-details"},ti={class:"detail-label"},oi={class:"detail-value"},ni={key:0,class:"form-group comments-section"},si=["onClick"],ii={key:2,class:"tab-content active"},li={class:"requisition-list"},ri={class:"requisition-header"},ai={class:"requisition-id"},di={class:"requisition-details"},ci={class:"detail-label"},mi={class:"detail-value"},pi={key:0,class:"form-group comments-section"},hi=["onClick"],gi={key:3,class:"tab-content active"},fi={class:"requisition-list",id:"approvalsQueue"},Ei={class:"requisition-header"},Vi={class:"requisition-id"},Ni={class:"requisition-details"},yi={class:"detail-label"},ki={class:"detail-value"},bi={class:"detail-item"},wi={class:"detail-value"},Ci={class:"detail-item"},Di={class:"item-list"},ui=["onClick"],Si=["onClick"],Bi=["onClick"],_i={key:4,class:"tab-content active"},xi={class:"requisition-list",id:"purchasingQueue"},Ti={class:"requisition-header"},Ai={class:"requisition-id"},Pi={class:"requisition-details"},Fi={class:"detail-label"},Mi={class:"detail-value"},Li={class:"detail-item"},qi={class:"detail-value"},Ii={class:"detail-item"},Ri={class:"item-list"},Oi=["onClick"],Ui={key:5,class:"tab-content active"},$i={class:"requisition-list",id:"receivingQueue"},ji={class:"requisition-header"},zi={class:"requisition-id"},Hi={class:"requisition-details"},Qi={class:"detail-label"},Ji={class:"detail-value"},Wi={class:"detail-item"},Ki={class:"detail-value"},Gi={class:"detail-item"},Yi={class:"item-list"},Xi=["onClick"],Zi={key:6,class:"tab-content active"},vi={class:"po-content",id:"po-content"},el={class:"po-header"},tl={class:"company-info"},ol={class:"info-row"},nl={class:"info-value"},sl={class:"info-row"},il={class:"info-value"},ll={class:"info-row"},rl={class:"info-value"},al={class:"info-row"},dl={class:"info-value"},cl={class:"info-row"},ml={class:"info-value"},pl={class:"company-info"},hl={class:"info-row"},gl={class:"info-value"},fl={class:"info-row"},El={class:"info-value"},Vl={class:"info-row"},Nl={class:"info-value"},yl={class:"info-row"},kl={class:"info-value"},bl={class:"info-row"},wl={class:"info-value"},Cl={class:"items-section"},Dl={class:"items-table"},ul={key:0},Sl={key:0},Bl={key:0,class:"price-change-indicator"},_l=["onUpdate:modelValue"],xl={key:0},Tl=["onClick"],Al={key:1},Pl=["onClick"],Fl=["onClick"],Ml={key:0,class:"justification-note"},Ll={class:"totals"},ql={class:"total-row"},Il={class:"total-row"},Rl={class:"total-row"},Ol={class:"total-row grand-total"},Ul={class:"modal-content"},$l={style:{"margin-bottom":"15px",color:"#666"}},jl={class:"modal-buttons"},zl=["disabled"],Hl={key:7,class:"tab-content active"};function Ql(o,t,l,c,s,i){var n,a,m,f,E,D,u,S,B,_,x;return e.openBlock(),e.createElementBlock("div",Cs,[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",Ds,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.visibleTabs,r=>(e.openBlock(),e.createElementBlock("button",{key:r.name,class:e.normalizeClass(["nav-tab",{active:s.activeTab===r.name}]),onClick:d=>i.setActiveTab(r.name)},e.toDisplayString(r.label),11,us))),128))]),s.activeTab==="new-requisition"?(e.openBlock(),e.createElementBlock("div",Ss,[e.createElementVNode("form",{onSubmit:t[5]||(t[5]=e.withModifiers((...r)=>i.handleSubmitRequisition&&i.handleSubmitRequisition(...r),["prevent"]))},[e.createElementVNode("div",Bs,[e.createElementVNode("div",_s,[t[12]||(t[12]=e.createElementVNode("label",null,"Requestor Name *",-1)),e.createElementVNode("input",{type:"text",value:l.userProfile.full_name,readonly:"",required:"",class:"form-control"},null,8,xs)]),e.createElementVNode("div",Ts,[t[14]||(t[14]=e.createElementVNode("label",null,"Department *",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":t[0]||(t[0]=r=>s.form.department=r),required:""},[t[13]||(t[13]=e.createElementVNode("option",{value:""},"Select Department",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.departments,r=>(e.openBlock(),e.createElementBlock("option",{key:r,value:r},e.toDisplayString(r),9,As))),128))],512),[[e.vModelSelect,s.form.department]])]),e.createElementVNode("div",Ps,[t[16]||(t[16]=e.createElementVNode("label",null,"Vessel *",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":t[1]||(t[1]=r=>s.form.project=r),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(l.vessels,r=>(e.openBlock(),e.createElementBlock("option",{key:r.id,value:r.name},e.toDisplayString(r.name),9,Fs))),128))],512),[[e.vModelSelect,s.form.project]])]),e.createElementVNode("div",Ms,[t[17]||(t[17]=e.createElementVNode("label",null,"Date Needed *",-1)),e.withDirectives(e.createElementVNode("input",{type:"date","onUpdate:modelValue":t[2]||(t[2]=r=>s.form.neededDate=r),required:""},null,512),[[e.vModelText,s.form.neededDate]])])]),e.createElementVNode("div",Ls,[t[18]||(t[18]=e.createElementVNode("label",null,"Business Justification *",-1)),e.withDirectives(e.createElementVNode("textarea",{"onUpdate:modelValue":t[3]||(t[3]=r=>s.form.justification=r),placeholder:"Explain why these materials are needed...",required:""},null,512),[[e.vModelText,s.form.justification]])]),e.createElementVNode("div",qs,[e.createElementVNode("div",Is,[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]=(...r)=>i.addItem&&i.addItem(...r))},"+ Add Item")]),e.createElementVNode("div",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.form.items,(r,d)=>(e.openBlock(),e.createElementBlock("div",{key:d,class:"item-row"},[e.createElementVNode("div",Rs,[t[20]||(t[20]=e.createElementVNode("label",null,"Item Code *",-1)),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":p=>r.id=p,required:""},null,8,Os),[[e.vModelText,r.id]])]),e.createElementVNode("div",Us,[t[21]||(t[21]=e.createElementVNode("label",null,"Item Description *",-1)),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":p=>r.desc=p,required:""},null,8,$s),[[e.vModelText,r.desc]])]),e.createElementVNode("div",js,[t[22]||(t[22]=e.createElementVNode("label",null,"Quantity *",-1)),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":p=>r.qty=p,min:"1",required:""},null,8,zs),[[e.vModelText,r.qty,void 0,{number:!0}]])]),e.createElementVNode("div",Hs,[t[23]||(t[23]=e.createElementVNode("label",null,"Unit *",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":p=>r.unit=p,required:""},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.units,p=>(e.openBlock(),e.createElementBlock("option",{key:p,value:p},e.toDisplayString(p),9,Js))),128))],8,Qs),[[e.vModelSelect,r.unit]])]),e.createElementVNode("div",Ws,[t[24]||(t[24]=e.createElementVNode("label",null,"Est. Unit Cost *",-1)),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":p=>r.cost=p,step:"0.01",placeholder:"0.00",required:""},null,8,Ks),[[e.vModelText,r.cost,void 0,{number:!0}]])]),e.createElementVNode("button",{type:"button",class:"remove-item-btn",onClick:p=>i.removeItem(d)},"Remove",8,Gs)]))),128))])]),t[25]||(t[25]=e.createElementVNode("div",{class:"action-buttons"},[e.createElementVNode("button",{type:"submit",class:"btn btn-primary-req"},"Submit Requisition")],-1))],32)])):e.createCommentVNode("",!0),s.activeTab==="all-requisitions"?(e.openBlock(),e.createElementBlock("div",Ys,[e.createElementVNode("div",Xs,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.requisitions,r=>(e.openBlock(),e.createElementBlock("div",{key:r.id,class:"requisition-card"},[e.createElementVNode("div",Zs,[e.createElementVNode("div",vs,e.toDisplayString(r.id),1),e.createElementVNode("div",{class:e.normalizeClass(["status-badge",`status-${r.status}`])},e.toDisplayString(r.status),3)]),e.createElementVNode("div",ei,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.getRequisitionFields(r),d=>(e.openBlock(),e.createElementBlock("div",{class:"detail-item",key:d.label},[e.createElementVNode("div",ti,e.toDisplayString(d.label),1),e.createElementVNode("div",oi,e.toDisplayString(d.value(r)),1)]))),128))]),r.status==="po-created"||r.status==="delivered"?(e.openBlock(),e.createElementBlock("div",ni,[e.createElementVNode("button",{onClick:d=>i.handleOpenPO(r.id),class:"add-item-btn comments-section"}," Print PO ",8,si)])):e.createCommentVNode("",!0)]))),128))])])):e.createCommentVNode("",!0),s.activeTab==="my-requisitions"?(e.openBlock(),e.createElementBlock("div",ii,[e.createElementVNode("div",li,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.myRequisitions,r=>(e.openBlock(),e.createElementBlock("div",{key:r.id,class:"requisition-card"},[e.createElementVNode("div",ri,[e.createElementVNode("div",ai,e.toDisplayString(r.id),1),e.createElementVNode("div",{class:e.normalizeClass(["status-badge",`status-${r.status}`])},e.toDisplayString(r.status),3)]),e.createElementVNode("div",di,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.getRequisitionFields(r),d=>(e.openBlock(),e.createElementBlock("div",{class:"detail-item",key:d.label},[e.createElementVNode("div",ci,e.toDisplayString(d.label),1),e.createElementVNode("div",mi,e.toDisplayString(d.value(r)),1)]))),128))]),r.status==="info-requested"?(e.openBlock(),e.createElementBlock("div",pi,[t[26]||(t[26]=e.createElementVNode("label",{class:"detail-label"},"Your Response",-1)),e.withDirectives(e.createElementVNode("textarea",{"onUpdate:modelValue":t[6]||(t[6]=d=>s.infoResponse=d),class:"response-textarea",placeholder:"Submit more info..."},null,512),[[e.vModelText,s.infoResponse]]),e.createElementVNode("button",{onClick:d=>i.handleSubmitInfoResponse(r),class:"add-item-btn comments-section"}," Submit Info ",8,hi)])):e.createCommentVNode("",!0)]))),128))])])):e.createCommentVNode("",!0),s.activeTab==="approvals"?(e.openBlock(),e.createElementBlock("div",gi,[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",fi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.reviewRequisitions,r=>(e.openBlock(),e.createElementBlock("div",{key:r.id,class:"requisition-card"},[e.createElementVNode("div",Ei,[e.createElementVNode("div",Vi,e.toDisplayString(r.id),1)]),e.createElementVNode("div",Ni,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.requisitionFields,d=>(e.openBlock(),e.createElementBlock("div",{class:"detail-item",key:d.label},[e.createElementVNode("div",yi,e.toDisplayString(d.label),1),e.createElementVNode("div",ki,e.toDisplayString(d.value(r)),1)]))),128))]),e.createElementVNode("div",bi,[t[27]||(t[27]=e.createElementVNode("div",{class:"detail-label"},"Justification",-1)),e.createElementVNode("div",wi,e.toDisplayString(r.justification||"N/A"),1)]),e.createElementVNode("div",Ci,[t[28]||(t[28]=e.createElementVNode("div",{class:"detail-label"},"Items",-1)),e.createElementVNode("ul",Di,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.items,(d,p)=>(e.openBlock(),e.createElementBlock("li",{key:p},e.toDisplayString(d.desc)+" - "+e.toDisplayString(d.qty)+" "+e.toDisplayString(d.unit)+" @ ₦"+e.toDisplayString(d.cost.toFixed(2))+" each ",1))),128))])]),e.createElementVNode("button",{type:"button",class:"add-item-btn",onClick:d=>i.handleApproveRequisition(r.id)},"Approve",8,ui),e.createElementVNode("button",{type:"button",class:"marginbox btn-reject",onClick:d=>i.handleDeclineRequisition(r.id)},"Decline",8,Si),e.createElementVNode("button",{type:"button",class:"marginbox btn-request",onClick:d=>i.handleInfoRequisition(r.id)},"Request Info",8,Bi)]))),128))])])):e.createCommentVNode("",!0),s.activeTab==="purchasing"?(e.openBlock(),e.createElementBlock("div",_i,[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",xi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.poRequisitions,r=>(e.openBlock(),e.createElementBlock("div",{key:r.id,class:"requisition-card"},[e.createElementVNode("div",Ti,[e.createElementVNode("div",Ai,e.toDisplayString(r.id),1)]),e.createElementVNode("div",Pi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.requisitionFields,d=>(e.openBlock(),e.createElementBlock("div",{class:"detail-item",key:d.label},[e.createElementVNode("div",Fi,e.toDisplayString(d.label),1),e.createElementVNode("div",Mi,e.toDisplayString(d.value(r)),1)]))),128))]),e.createElementVNode("div",Li,[t[30]||(t[30]=e.createElementVNode("div",{class:"detail-label"},"Justification",-1)),e.createElementVNode("div",qi,e.toDisplayString(r.justification||"N/A"),1)]),e.createElementVNode("div",Ii,[t[31]||(t[31]=e.createElementVNode("div",{class:"detail-label"},"Items",-1)),e.createElementVNode("ul",Ri,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.items,(d,p)=>(e.openBlock(),e.createElementBlock("li",{key:p},e.toDisplayString(d.desc)+" - "+e.toDisplayString(d.qty)+" "+e.toDisplayString(d.unit)+" @ ₦"+e.toDisplayString(d.cost.toFixed(2))+" each ",1))),128))])]),e.createElementVNode("button",{type:"button",class:"add-item-btn",onClick:d=>i.handleCreatePO(r.id)},"Create PO",8,Oi)]))),128))])])):e.createCommentVNode("",!0),s.activeTab==="receiving"?(e.openBlock(),e.createElementBlock("div",Ui,[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",$i,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.awaitingDelivery,r=>(e.openBlock(),e.createElementBlock("div",{key:r.id,class:"requisition-card"},[e.createElementVNode("div",ji,[e.createElementVNode("div",zi,e.toDisplayString(r.id),1)]),e.createElementVNode("div",Hi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.requisitionFields,d=>(e.openBlock(),e.createElementBlock("div",{class:"detail-item",key:d.label},[e.createElementVNode("div",Qi,e.toDisplayString(d.label),1),e.createElementVNode("div",Ji,e.toDisplayString(d.value(r)),1)]))),128))]),e.createElementVNode("div",Wi,[t[33]||(t[33]=e.createElementVNode("div",{class:"detail-label"},"Justification",-1)),e.createElementVNode("div",Ki,e.toDisplayString(r.justification||"N/A"),1)]),e.createElementVNode("div",Gi,[t[34]||(t[34]=e.createElementVNode("div",{class:"detail-label"},"Items",-1)),e.createElementVNode("ul",Yi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.items,(d,p)=>(e.openBlock(),e.createElementBlock("li",{key:p},e.toDisplayString(d.desc)+" - "+e.toDisplayString(d.qty)+" "+e.toDisplayString(d.unit)+" @ ₦"+e.toDisplayString(d.cost.toFixed(2))+" each ",1))),128))])]),e.createElementVNode("button",{type:"button",class:"add-item-btn",onClick:d=>i.handleAcceptDelivery(r.id)},"Accept Delivery",8,Xi)]))),128))])])):e.createCommentVNode("",!0),s.activeTab==="po"?(e.openBlock(),e.createElementBlock("div",Zi,[e.createElementVNode("div",vi,[e.createElementVNode("div",el,[e.createElementVNode("div",tl,[t[41]||(t[41]=e.createElementVNode("h3",null,"Vendor Information",-1)),e.createElementVNode("div",ol,[t[36]||(t[36]=e.createElementVNode("span",{class:"info-label"},"Company:",-1)),e.createElementVNode("span",nl,e.toDisplayString(s.vendorInfo.company||((n=s.poDetails.vendorInfo)==null?void 0:n.company)),1)]),e.createElementVNode("div",sl,[t[37]||(t[37]=e.createElementVNode("span",{class:"info-label"},"Contact:",-1)),e.createElementVNode("span",il,e.toDisplayString(s.vendorInfo.contact||((a=s.poDetails.vendorInfo)==null?void 0:a.contact)),1)]),e.createElementVNode("div",ll,[t[38]||(t[38]=e.createElementVNode("span",{class:"info-label"},"Email:",-1)),e.createElementVNode("span",rl,e.toDisplayString(s.vendorInfo.email||((m=s.poDetails.vendorInfo)==null?void 0:m.email)),1)]),e.createElementVNode("div",al,[t[39]||(t[39]=e.createElementVNode("span",{class:"info-label"},"Phone:",-1)),e.createElementVNode("span",dl,e.toDisplayString(s.vendorInfo.phone||((f=s.poDetails.vendorInfo)==null?void 0:f.phone)),1)]),e.createElementVNode("div",cl,[t[40]||(t[40]=e.createElementVNode("span",{class:"info-label"},"Address:",-1)),e.createElementVNode("span",ml,e.toDisplayString(s.vendorInfo.address||((E=s.poDetails.vendorInfo)==null?void 0:E.address)),1)])]),e.createElementVNode("div",pl,[t[47]||(t[47]=e.createElementVNode("h3",null,"Purchase Order Details",-1)),e.createElementVNode("div",hl,[t[42]||(t[42]=e.createElementVNode("span",{class:"info-label"},"PO Number:",-1)),e.createElementVNode("span",gl,e.toDisplayString(s.poDetails.id),1)]),e.createElementVNode("div",fl,[t[43]||(t[43]=e.createElementVNode("span",{class:"info-label"},"Date:",-1)),e.createElementVNode("span",El,e.toDisplayString(s.vendorInfo.poDate||((D=s.poDetails.vendorInfo)==null?void 0:D.poDate)),1)]),e.createElementVNode("div",Vl,[t[44]||(t[44]=e.createElementVNode("span",{class:"info-label"},"Requested By:",-1)),e.createElementVNode("span",Nl,e.toDisplayString(s.vendorInfo.poApproved||((u=s.poDetails.vendorInfo)==null?void 0:u.poApproved)),1)]),e.createElementVNode("div",yl,[t[45]||(t[45]=e.createElementVNode("span",{class:"info-label"},"Department:",-1)),e.createElementVNode("span",kl,"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",wl,e.toDisplayString(s.poDetails.neededDate),1)])])]),e.createElementVNode("div",Cl,[t[57]||(t[57]=e.createElementVNode("h2",{class:"section-title"},"Order Items",-1)),e.createElementVNode("table",Dl,[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",ul,"Actions"))])]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.poDetails.items||[],(r,d)=>(e.openBlock(),e.createElementBlock("tr",{key:d},[e.createElementVNode("td",null,e.toDisplayString(r.itemNumber),1),e.createElementVNode("td",null,e.toDisplayString(r.desc),1),e.createElementVNode("td",null,e.toDisplayString(r.qty),1),e.createElementVNode("td",null,[r.editing?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:1,"onUpdate:modelValue":p=>r.tempPrice=p,type:"number",step:"0.01",class:e.normalizeClass(["price-input",{"price-changed":r.cost!==r.tempPrice}])},null,10,_l)),[[e.vModelText,r.tempPrice,void 0,{number:!0}]]):(e.openBlock(),e.createElementBlock("span",Sl,[e.createTextVNode(" $"+e.toDisplayString(r.cost.toFixed(2))+" ",1),r.cost!==r.unitPrice?(e.openBlock(),e.createElementBlock("span",Bl,"!")):e.createCommentVNode("",!0)]))]),e.createElementVNode("td",null,"$"+e.toDisplayString((r.unitPrice*r.qty).toFixed(2)),1),s.isPrinting?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("td",xl,[r.editing?(e.openBlock(),e.createElementBlock("div",Al,[e.createElementVNode("button",{onClick:p=>i.savePrice(d),class:"save-btn"},"Save",8,Pl),e.createElementVNode("button",{onClick:p=>i.cancelEdit(d),class:"cancel-btn"},"Cancel",8,Fl)])):(e.openBlock(),e.createElementBlock("button",{key:0,onClick:p=>i.startEdit(d),class:"edit-btn"}," Edit Price ",8,Tl))]))]))),128))])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.poDetails.items||[],(r,d)=>(e.openBlock(),e.createElementBlock("div",{key:"note-"+d},[r.justification?(e.openBlock(),e.createElementBlock("div",Ml,[e.createElementVNode("strong",null,"Price Change Justification (Item "+e.toDisplayString(r.itemNumber)+"):",1),e.createTextVNode(" "+e.toDisplayString(r.justification),1)])):e.createCommentVNode("",!0)]))),128)),e.createElementVNode("div",Ll,[e.createElementVNode("div",ql,[t[53]||(t[53]=e.createElementVNode("span",null,"Subtotal:",-1)),e.createElementVNode("span",null,"$"+e.toDisplayString(i.subTotal.toFixed(2)),1)]),e.createElementVNode("div",Il,[t[54]||(t[54]=e.createElementVNode("span",null,"Tax (%):",-1)),e.createElementVNode("span",null,"$"+e.toDisplayString(i.getOptional(s.vendorInfo.tax)),1)]),e.createElementVNode("div",Rl,[t[55]||(t[55]=e.createElementVNode("span",null,"Shipping:",-1)),e.createElementVNode("span",null,"$"+e.toDisplayString(i.getOptional(s.vendorInfo.shipping)),1)]),e.createElementVNode("div",Ol,[t[56]||(t[56]=e.createElementVNode("span",null,"Grand Total:",-1)),e.createElementVNode("span",null,"$"+e.toDisplayString((i.subTotal+i.getOptional(s.vendorInfo.tax)+i.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((...r)=>i.closeJustificationModal&&i.closeJustificationModal(...r),["self"]))},[e.createElementVNode("div",Ul,[t[60]||(t[60]=e.createElementVNode("h3",null,"Price Change Justification Required",-1)),e.createElementVNode("p",$l,[t[58]||(t[58]=e.createTextVNode(" Please provide a justification for changing the price from ",-1)),e.createElementVNode("strong",null,"$"+e.toDisplayString((B=(S=i.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=(_=i.currentItem)==null?void 0:_.tempPrice)==null?void 0:x.toFixed(2)),1)]),e.withDirectives(e.createElementVNode("textarea",{"onUpdate:modelValue":t[7]||(t[7]=r=>s.justificationText=r),class:"justification-textarea",placeholder:"Enter justification for price change...",required:""},null,512),[[e.vModelText,s.justificationText]]),e.createElementVNode("div",jl,[e.createElementVNode("button",{onClick:t[8]||(t[8]=(...r)=>i.closeJustificationModal&&i.closeJustificationModal(...r)),class:"cancel-btn"},"Cancel"),e.createElementVNode("button",{onClick:t[9]||(t[9]=(...r)=>i.confirmPriceChange&&i.confirmPriceChange(...r)),class:"save-btn",disabled:!s.justificationText.trim()}," Confirm Change ",8,zl)])])])):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]=r=>i.handleFinishPO(s.poDetails.id))},"Approve PO"))])):e.createCommentVNode("",!0),s.activeTab==="workflow"?(e.openBlock(),e.createElementBlock("div",Hl,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 C=g(ws,[["render",Ql]]),Jl=(o={})=>({brandName:o.brandName||"OceanHelm",logoIcon:o.logoIcon||"bi bi-water",showLogo:o.showLogo!==!1,responsive:o.responsive!==!1,...o}),Wl=[{type:"link",label:"Home",icon:"bi bi-speedometer2",href:"/app/dashboard",active:!0},{type:"link",label:"Activity Log",icon:"bi bi-activity",href:"/activity-log",roles:["owner"]},{type:"link",label:"People Manager",icon:"bi bi-person-plus",href:"/app/people-manager",roles:["owner"]},{type:"text",label:"Modules"},{type:"dropdown",label:"Compliance",icon:"bi bi-list-ul",children:[{label:"Vessel Certification",action:"vessel-cert"},{type:"separator"},{label:"Crew Certification",action:"crew-cert"},{type:"separator"},{label:"Reports",action:"reports"}]},{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:"Vessel Log",icon:"bi bi-file-ruled",action:"vessel-log"},{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"}],Kl=(o,t)=>!o.roles||o.roles.length===0?!0:o.roles.includes(t==null?void 0:t.role),Gl={install(o,t={}){o.component("ConfigurableSidebar",V),o.component("VesselLists",N),o.component("DashHead",y),o.component("ActivityLogs",b),o.component("CrewManagement",w),o.component("RequisitionSystem",C),o.component("OceanHelmMaintenance",k),o.provide("sidebarConfig",t)}};h.ActivityLogs=b,h.ConfigurableSidebar=V,h.CrewManagement=w,h.DashHead=y,h.OceanHelmMaintenance=k,h.RequisitionSystem=C,h.VesselList=N,h.createSidebarConfig=Jl,h.default=Gl,h.defaultMenuItems=Wl,h.defaultPermissionChecker=Kl,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
2
2
  //# sourceMappingURL=oceanhelm.umd.js.map