oceanhelm 0.0.9 → 0.0.11

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