2 lines
21 KiB
JavaScript
2 lines
21 KiB
JavaScript
import{bc as B,aP as W,r as H,c as p}from"./index-QAlcqU00.js";class k extends B{constructor(){super("/contracts")}async search(t={}){const r=new URLSearchParams;t.page!==void 0&&r.append("page",t.page.toString()),t.size!==void 0&&r.append("size",t.size.toString()),t.search&&r.append("search",t.search),t.status&&r.append("status",t.status),t.contractType&&r.append("contractType",t.contractType),t.vendorId&&r.append("vendorId",t.vendorId.toString()),t.sortBy&&r.append("sortBy",t.sortBy),t.direction&&r.append("direction",t.direction);const n=r.toString(),o=n?`/contracts?${n}`:"/contracts";return this.get(o)}async getById(t){return this.get(`/contracts/${t}`)}async create(t){return this.post("/contracts",t)}async update(t,r){return this.put(`/contracts/${t}`,r)}async delete(t){return this.deleteRequest(`/contracts/${t}`)}async getExpiringContracts(t=30){const r=new URLSearchParams;return r.append("days",t.toString()),this.get(`/contracts/expiring?${r.toString()}`)}async getByVendor(t,r={}){const n=new URLSearchParams;return n.append("vendorId",t.toString()),r.status&&n.append("status",r.status),this.get(`/contracts?${n.toString()}`)}async getDocuments(t){return this.get(`/contracts/${t}/documents`)}async uploadDocument(t,r,n){const o=new FormData;return o.append("file",r),Object.entries(n).forEach(([c,y])=>{y!=null&&o.append(c,y.toString())}),this.post(`/contracts/${t}/documents`,o,{headers:{}})}async deleteDocument(t,r){return this.deleteRequest(`/contracts/${t}/documents/${r}`)}async downloadDocument(t,r){const n=await this.request(`/contracts/${t}/documents/${r}/download`,{method:"GET"});if(!n.ok)throw new Error("Failed to download document");return n.blob()}async getSLAs(t){return this.get(`/contracts/${t}/slas`)}async createSLA(t,r){return this.post(`/contracts/${t}/slas`,r)}async updateSLA(t,r,n){return this.put(`/contracts/${t}/slas/${r}`,n)}async deleteSLA(t,r){return this.deleteRequest(`/contracts/${t}/slas/${r}`)}async getMilestones(t){return this.get(`/contracts/${t}/milestones`)}async createMilestone(t,r){return this.post(`/contracts/${t}/milestones`,r)}async updateMilestone(t,r,n){return this.put(`/contracts/${t}/milestones/${r}`,n)}async deleteMilestone(t,r){return this.deleteRequest(`/contracts/${t}/milestones/${r}`)}async completeMilestone(t,r,n){return this.post(`/contracts/${t}/milestones/${r}/complete`,n)}async renewContract(t,r){return this.post(`/contracts/${t}/renew`,r)}async terminateContract(t,r){return this.post(`/contracts/${t}/terminate`,r)}async getAlerts(t={}){const r=new URLSearchParams;t.type&&r.append("type",t.type),t.severity&&r.append("severity",t.severity),t.acknowledged!==void 0&&r.append("acknowledged",t.acknowledged.toString());const n=r.toString(),o=n?`/contracts/alerts?${n}`:"/contracts/alerts";return this.get(o)}async acknowledgeAlert(t,r){return this.post(`/contracts/alerts/${t}/acknowledge`,r)}async getAnalytics(t={}){const r=new URLSearchParams;t.period&&r.append("period",t.period),t.startDate&&r.append("startDate",t.startDate),t.endDate&&r.append("endDate",t.endDate);const n=r.toString(),o=n?`/contracts/analytics?${n}`:"/contracts/analytics";return this.get(o)}async export(t={}){const r=new URLSearchParams;t.format&&r.append("format",t.format),t.fields&&r.append("fields",t.fields.join(",")),t.filters&&Object.entries(t.filters).forEach(([o,c])=>{c!=null&&r.append(o,c.toString())});const n=await this.request(`/contracts/export?${r.toString()}`,{method:"GET"});if(!n.ok)throw new Error("Failed to export contracts");return n.blob()}}const f={SERVICE:"service",MAINTENANCE:"maintenance",WARRANTY:"warranty",LEASE:"lease",PURCHASE:"purchase",SOFTWARE_LICENSE:"software_license",INSURANCE:"insurance",CONSULTING:"consulting"},u={DRAFT:"draft",PENDING_APPROVAL:"pending_approval",ACTIVE:"active",EXPIRED:"expired",TERMINATED:"terminated",CANCELLED:"cancelled",RENEWED:"renewed"},d={LOW:"low",MEDIUM:"medium",HIGH:"high",CRITICAL:"critical"},G={AUTO_RENEW:"auto_renew",MANUAL_RENEW:"manual_renew",DO_NOT_RENEW:"do_not_renew",UNDER_REVIEW:"under_review"},Y={NET_15:"net_15",NET_30:"net_30",NET_45:"net_45",NET_60:"net_60",NET_90:"net_90",COD:"cod",PREPAID:"prepaid",MONTHLY:"monthly",QUARTERLY:"quarterly",ANNUALLY:"annually"},z={contractNumber:{required:!0,type:"string",minLength:3,maxLength:50,pattern:/^[A-Z0-9-]+$/},title:{required:!0,type:"string",minLength:3,maxLength:200},description:{required:!1,type:"string",maxLength:1e3},contractType:{required:!0,type:"string",enum:Object.values(f)},status:{required:!0,type:"string",enum:Object.values(u)},priority:{required:!0,type:"string",enum:Object.values(d)},vendorId:{required:!0,type:"number",min:1},startDate:{required:!0,type:"date"},endDate:{required:!0,type:"date"},contractValue:{required:!1,type:"number",min:0},currency:{required:!1,type:"string",default:"USD"},paymentTerms:{required:!1,type:"string",enum:Object.values(Y)},renewalStatus:{required:!1,type:"string",enum:Object.values(G)},autoRenew:{required:!1,type:"boolean",default:!1},renewalNotificationDays:{required:!1,type:"number",min:1,max:365,default:30}};function X(e,t=z){const r=[];for(const[n,o]of Object.entries(t)){const c=e[n];if(o.required&&(c==null||c==="")){r.push(`${n} is required`);continue}if(!(!o.required&&(c==null||c===""))){if(o.type&&!K(c,o.type)){r.push(`${n} must be of type ${o.type}`);continue}if(o.type==="string"&&typeof c=="string"&&(o.minLength&&c.length<o.minLength&&r.push(`${n} must be at least ${o.minLength} characters`),o.maxLength&&c.length>o.maxLength&&r.push(`${n} must be no more than ${o.maxLength} characters`),o.pattern&&!o.pattern.test(c)&&r.push(`${n} format is invalid`)),o.type==="number"&&typeof c=="number"&&(o.min!==void 0&&c<o.min&&r.push(`${n} must be at least ${o.min}`),o.max!==void 0&&c>o.max&&r.push(`${n} must be no more than ${o.max}`)),o.enum&&!o.enum.includes(c)&&r.push(`${n} must be one of: ${o.enum.join(", ")}`),o.type==="date"&&c){const y=new Date(c);isNaN(y.getTime())&&r.push(`${n} must be a valid date`)}}}if(e.startDate&&e.endDate){const n=new Date(e.startDate);new Date(e.endDate)<=n&&r.push("End date must be after start date")}return{isValid:r.length===0,errors:r}}function K(e,t){switch(t){case"string":return typeof e=="string";case"number":return typeof e=="number"&&!isNaN(e);case"boolean":return typeof e=="boolean";case"date":return e instanceof Date||typeof e=="string"&&!isNaN(Date.parse(e));case"array":return Array.isArray(e);case"object":return typeof e=="object"&&e!==null&&!Array.isArray(e);default:return!0}}function J(e){const n=new Date(e)-new Date;return Math.ceil(n/(1e3*60*60*24))}function tt(e){const t={[u.DRAFT]:{label:"Draft",color:"gray",bgColor:"bg-gray-100",textColor:"text-gray-800"},[u.PENDING_APPROVAL]:{label:"Pending Approval",color:"yellow",bgColor:"bg-yellow-100",textColor:"text-yellow-800"},[u.ACTIVE]:{label:"Active",color:"green",bgColor:"bg-green-100",textColor:"text-green-800"},[u.EXPIRED]:{label:"Expired",color:"red",bgColor:"bg-red-100",textColor:"text-red-800"},[u.TERMINATED]:{label:"Terminated",color:"red",bgColor:"bg-red-100",textColor:"text-red-800"},[u.CANCELLED]:{label:"Cancelled",color:"gray",bgColor:"bg-gray-100",textColor:"text-gray-800"},[u.RENEWED]:{label:"Renewed",color:"blue",bgColor:"bg-blue-100",textColor:"text-blue-800"}};return t[e]||t[u.DRAFT]}function et(e){const t={[d.LOW]:{label:"Low",color:"green",bgColor:"bg-green-100",textColor:"text-green-800"},[d.MEDIUM]:{label:"Medium",color:"yellow",bgColor:"bg-yellow-100",textColor:"text-yellow-800"},[d.HIGH]:{label:"High",color:"orange",bgColor:"bg-orange-100",textColor:"text-orange-800"},[d.CRITICAL]:{label:"Critical",color:"red",bgColor:"bg-red-100",textColor:"text-red-800"}};return t[e]||t[d.MEDIUM]}function rt(e){return{[f.SERVICE]:"Service",[f.MAINTENANCE]:"Maintenance",[f.WARRANTY]:"Warranty",[f.LEASE]:"Lease",[f.PURCHASE]:"Purchase",[f.SOFTWARE_LICENSE]:"Software License",[f.INSURANCE]:"Insurance",[f.CONSULTING]:"Consulting"}[e]||e}function nt(e){return{[u.DRAFT]:"Draft",[u.PENDING_APPROVAL]:"Pending Approval",[u.ACTIVE]:"Active",[u.EXPIRED]:"Expired",[u.TERMINATED]:"Terminated",[u.RENEWED]:"Renewed"}[e]||e}function at(e){return{[d.LOW]:"Low",[d.MEDIUM]:"Medium",[d.HIGH]:"High",[d.CRITICAL]:"Critical"}[e]||e}let h=new k;const Q=W("contracts",{state:()=>({contracts:[],currentContract:null,loading:!1,error:null,initialized:!1,totalElements:0,totalPages:0,searchCriteria:{page:0,size:10,sortBy:"contractNumber",direction:"ASC",search:"",filters:{}},contractAlerts:[],contractDocuments:{},contractSLAs:{},contractMilestones:{},contractAnalytics:{}}),getters:{getContractById:e=>t=>e.contracts.find(r=>r.id===t),activeContracts:e=>e.contracts.filter(t=>t.status===u.ACTIVE),expiredContracts:e=>e.contracts.filter(t=>t.status===u.EXPIRED),pendingApprovalContracts:e=>e.contracts.filter(t=>t.status===u.PENDING_APPROVAL),getContractsByVendor:e=>t=>e.contracts.filter(r=>r.vendorId===t),getContractsByType:e=>t=>e.contracts.filter(r=>r.contractType===t),highPriorityContracts:e=>e.contracts.filter(t=>t.priority===d.HIGH||t.priority===d.CRITICAL),expiringSoonContracts:e=>{const t=new Date;return t.setDate(t.getDate()+30),e.contracts.filter(r=>{if(r.status!==u.ACTIVE)return!1;const n=new Date(r.endDate);return n<=t&&n>new Date})},filteredContracts:e=>{let t=[...e.contracts];if(e.searchCriteria.search){const r=e.searchCriteria.search.toLowerCase();t=t.filter(n=>{var o,c,y,m;return((o=n.contractNumber)==null?void 0:o.toLowerCase().includes(r))||((c=n.title)==null?void 0:c.toLowerCase().includes(r))||((y=n.vendorName)==null?void 0:y.toLowerCase().includes(r))||((m=n.description)==null?void 0:m.toLowerCase().includes(r))})}return e.searchCriteria.filters.status&&(t=t.filter(r=>r.status===e.searchCriteria.filters.status)),e.searchCriteria.filters.contractType&&(t=t.filter(r=>r.contractType===e.searchCriteria.filters.contractType)),e.searchCriteria.filters.vendorId&&(t=t.filter(r=>r.vendorId===e.searchCriteria.filters.vendorId)),t},contractStats:e=>{const t={total:e.contracts.length,active:0,expired:0,pendingApproval:0,terminated:0,totalValue:0,averageValue:0,byType:{},byPriority:{low:0,medium:0,high:0,critical:0}};return e.contracts.forEach(r=>{switch(r.status){case u.ACTIVE:t.active++;break;case u.EXPIRED:t.expired++;break;case u.PENDING_APPROVAL:t.pendingApproval++;break;case u.TERMINATED:t.terminated++;break}t.totalValue+=r.contractValue||0;const n=r.contractType||"UNKNOWN";t.byType[n]=(t.byType[n]||0)+1,t.byPriority[r.priority]!==void 0&&t.byPriority[r.priority]++}),t.averageValue=t.total>0?t.totalValue/t.total:0,t},contractsRequiringAttention:(e,t)=>[...t.expiringSoonContracts,...t.pendingApprovalContracts].filter((r,n,o)=>o.findIndex(c=>c.id===r.id)===n),contractDocumentsById:e=>t=>e.contractDocuments[t]||[],contractSLAsById:e=>t=>e.contractSLAs[t]||[],contractMilestonesById:e=>t=>e.contractMilestones[t]||[]},actions:{async fetchContracts(e=null){this.loading=!0,this.error=null;try{const t=e||this.searchCriteria,r=await h.search(t);this.contracts=r.content||r,this.totalElements=r.totalElements||this.contracts.length,this.totalPages=r.totalPages||1}catch(t){throw this.error=t.message,t}finally{this.loading=!1}},async fetchContractById(e){this.loading=!0,this.error=null;try{const t=await h.getById(e);return this.currentContract=t,t}catch(t){throw this.error=t.message,t}finally{this.loading=!1}},async createContract(e){this.loading=!0,this.error=null;try{const t=await h.create(e);return this.contracts.push(t),this.currentContract=t,t}catch(t){throw this.error=t.message,t}finally{this.loading=!1}},async updateContract(e,t){var r;this.loading=!0,this.error=null;try{const n=await h.update(e,t),o=this.contracts.findIndex(c=>c.id===e);return o!==-1&&(this.contracts[o]=n),((r=this.currentContract)==null?void 0:r.id)===e&&(this.currentContract=n),n}catch(n){throw this.error=n.message,n}finally{this.loading=!1}},async deleteContract(e){var t;this.loading=!0,this.error=null;try{await h.delete(e);const r=this.contracts.findIndex(n=>n.id===e);r!==-1&&this.contracts.splice(r,1),((t=this.currentContract)==null?void 0:t.id)===e&&(this.currentContract=null)}catch(r){throw this.error=r.message,r}finally{this.loading=!1}},async renewContract(e,t){this.loading=!0,this.error=null;try{const r=await h.renewContract(e,t);return this.contracts.push(r),r}catch(r){throw this.error=r.message,r}finally{this.loading=!1}},async terminateContract(e,t){var r;this.loading=!0,this.error=null;try{const n=await h.terminateContract(e,t),o=this.contracts.findIndex(c=>c.id===e);return o!==-1&&(this.contracts[o]=n),((r=this.currentContract)==null?void 0:r.id)===e&&(this.currentContract=n),n}catch(n){throw this.error=n.message,n}finally{this.loading=!1}},async getExpiringContracts(e=30){this.loading=!0,this.error=null;try{return await h.getExpiringContracts(e)}catch(t){throw this.error=t.message,t}finally{this.loading=!1}},async getVendorContracts(e,t={}){this.loading=!0,this.error=null;try{return await h.getByVendor(e,t)}catch(r){throw this.error=r.message,r}finally{this.loading=!1}},async updateSearchTerm(e){this.searchCriteria.search=e,this.searchCriteria.page=0,await this.fetchContracts()},async updateFilters(e){this.searchCriteria.filters={...this.searchCriteria.filters,...e},this.searchCriteria.page=0,await this.fetchContracts()},async changePage(e){this.searchCriteria.page=e,await this.fetchContracts()},async changeSorting(e,t){this.searchCriteria.sortBy=e,this.searchCriteria.direction=t,this.searchCriteria.page=0,await this.fetchContracts()},async refreshContracts(){await this.fetchContracts()},async initializeContracts(){this.initialized||(await this.fetchContracts(),this.initialized=!0)},async getContractDocuments(e){this.loading=!0,this.error=null;try{const t=await h.getDocuments(e);return this.contractDocuments[e]=t,t}catch(t){throw this.error=t.message,t}finally{this.loading=!1}},async uploadContractDocument(e,t,r){this.loading=!0,this.error=null;try{const n=await h.uploadDocument(e,t,r);return this.contractDocuments[e]||(this.contractDocuments[e]=[]),this.contractDocuments[e].push(n),n}catch(n){throw this.error=n.message,n}finally{this.loading=!1}},async deleteContractDocument(e,t){this.loading=!0,this.error=null;try{if(await h.deleteDocument(e,t),this.contractDocuments[e]){const r=this.contractDocuments[e].findIndex(n=>n.id===t);r!==-1&&this.contractDocuments[e].splice(r,1)}}catch(r){throw this.error=r.message,r}finally{this.loading=!1}},async getContractSLAs(e){this.loading=!0,this.error=null;try{const t=await h.getSLAs(e);return this.contractSLAs[e]=t,t}catch(t){throw this.error=t.message,t}finally{this.loading=!1}},async createContractSLA(e,t){this.loading=!0,this.error=null;try{const r=await h.createSLA(e,t);return this.contractSLAs[e]||(this.contractSLAs[e]=[]),this.contractSLAs[e].push(r),r}catch(r){throw this.error=r.message,r}finally{this.loading=!1}},async getContractMilestones(e){this.loading=!0,this.error=null;try{const t=await h.getMilestones(e);return this.contractMilestones[e]=t,t}catch(t){throw this.error=t.message,t}finally{this.loading=!1}},async createContractMilestone(e,t){this.loading=!0,this.error=null;try{const r=await h.createMilestone(e,t);return this.contractMilestones[e]||(this.contractMilestones[e]=[]),this.contractMilestones[e].push(r),r}catch(r){throw this.error=r.message,r}finally{this.loading=!1}},async completeContractMilestone(e,t,r){this.loading=!0,this.error=null;try{const n=await h.completeMilestone(e,t,r);if(this.contractMilestones[e]){const o=this.contractMilestones[e].findIndex(c=>c.id===t);o!==-1&&(this.contractMilestones[e][o]=n)}return n}catch(n){throw this.error=n.message,n}finally{this.loading=!1}},async getContractAlerts(e={}){this.loading=!0,this.error=null;try{const t=await h.getAlerts(e);return this.contractAlerts=t,t}catch(t){throw this.error=t.message,t}finally{this.loading=!1}},async acknowledgeContractAlert(e,t){this.loading=!0,this.error=null;try{const r=await h.acknowledgeAlert(e,t),n=this.contractAlerts.findIndex(o=>o.id===e);return n!==-1&&(this.contractAlerts[n]=r),r}catch(r){throw this.error=r.message,r}finally{this.loading=!1}},async getContractAnalytics(e={}){this.loading=!0,this.error=null;try{const t=await h.getAnalytics(e);return this.contractAnalytics=t,t}catch(t){throw this.error=t.message,t}finally{this.loading=!1}},async exportContracts(e={}){this.loading=!0,this.error=null;try{return await h.export(e)}catch(t){throw this.error=t.message,t}finally{this.loading=!1}},clearCurrentContract(){this.currentContract=null},clearError(){this.error=null},setRepository(e){h=e}}});function st(){const e=Q(),t=H(null),r=p(()=>e.contracts),n=p(()=>e.currentContract),o=p(()=>e.loading),c=p(()=>e.error),y=p(()=>e.contractStats),m=a=>(t.value=null,X(a)),S=async(a=null)=>{try{await e.fetchContracts(a)}catch(s){throw console.error("Failed to load contracts:",s),s}},L=async a=>{try{return await e.fetchContractById(a)}catch(s){throw console.error(`Failed to load contract ${a}:`,s),s}},T=async(a,s=null)=>{const i=m(a);if(!i.isValid)return t.value=i.errors.join(", "),null;try{return s?await e.updateContract(s,a):await e.createContract(a)}catch(l){throw console.error("Failed to save contract:",l),l}},N=async a=>{try{await e.deleteContract(a)}catch(s){throw console.error(`Failed to remove contract ${a}:`,s),s}},C=a=>{const s=[];if(a.startDate||s.push("Start date is required"),a.endDate||s.push("End date is required"),a.startDate&&a.endDate){const i=new Date(a.startDate);new Date(a.endDate)<=i&&s.push("End date must be after start date")}return a.contractValue!==void 0&&a.contractValue<0&&s.push("Contract value must be positive"),{isValid:s.length===0,errors:s}},w=a=>{const s=[];if(!a.terminationDate)s.push("Termination date is required");else{const i=new Date(a.terminationDate),l=new Date;l.setHours(0,0,0,0),i<l&&s.push("Termination date cannot be in the past")}return(!a.reason||a.reason.trim().length===0)&&s.push("Termination reason is required"),{isValid:s.length===0,errors:s}},R=async(a,s)=>{const i=C(s);if(!i.isValid)throw t.value=i.errors.join(", "),new Error(i.errors.join(", "));try{return await e.renewContract(a,s)}catch(l){throw console.error(`Failed to renew contract ${a}:`,l),l}},x=async(a,s)=>{const i=w(s);if(!i.isValid)throw t.value=i.errors.join(", "),new Error(i.errors.join(", "));try{return await e.terminateContract(a,s)}catch(l){throw console.error(`Failed to terminate contract ${a}:`,l),l}},M=async a=>{try{return await e.getContractDocuments(a)}catch(s){throw console.error(`Failed to load documents for contract ${a}:`,s),s}},A=a=>{const s=[];return(!a.name||a.name.trim().length===0)&&s.push("Document name is required"),(!a.type||a.type.trim().length===0)&&s.push("Document type is required"),{isValid:s.length===0,errors:s}},$=async(a,s,i)=>{const l=A(i);if(!l.isValid)throw t.value=l.errors.join(", "),new Error(l.errors.join(", "));try{return await e.uploadContractDocument(a,s,i)}catch(g){throw console.error(`Failed to upload document for contract ${a}:`,g),g}},v=async a=>{try{return await e.getContractSLAs(a)}catch(s){throw console.error(`Failed to load SLAs for contract ${a}:`,s),s}},E=a=>{const s=[];return(!a.metric||a.metric.trim().length===0)&&s.push("SLA metric is required"),(a.target===void 0||a.target===null||a.target<=0)&&s.push("SLA target must be positive"),(!a.unit||a.unit.trim().length===0)&&s.push("SLA unit is required"),{isValid:s.length===0,errors:s}},P=async(a,s)=>{const i=E(s);if(!i.isValid)throw t.value=i.errors.join(", "),new Error(i.errors.join(", "));try{return await e.createContractSLA(a,s)}catch(l){throw console.error(`Failed to create SLA for contract ${a}:`,l),l}},V=async a=>{try{return await e.getContractMilestones(a)}catch(s){throw console.error(`Failed to load milestones for contract ${a}:`,s),s}},D=a=>{const s=[];if((!a.title||a.title.trim().length===0)&&s.push("Milestone title is required"),!a.dueDate)s.push("Valid due date is required");else{const i=new Date(a.dueDate);isNaN(i.getTime())&&s.push("Valid due date is required")}return{isValid:s.length===0,errors:s}},q=async(a,s)=>{const i=D(s);if(!i.isValid)throw t.value=i.errors.join(", "),new Error(i.errors.join(", "));try{return await e.createContractMilestone(a,s)}catch(l){throw console.error(`Failed to create milestone for contract ${a}:`,l),l}},I=async(a,s,i)=>{try{return await e.completeContractMilestone(a,s,i)}catch(l){throw console.error(`Failed to complete milestone ${s} for contract ${a}:`,l),l}},_=a=>{if(!a.startDate||!a.endDate)return{days:0,months:0,years:0};const s=new Date(a.startDate),i=new Date(a.endDate),l=i.getTime()-s.getTime(),g=Math.ceil(l/(1e3*3600*24)),b=(i.getFullYear()-s.getFullYear())*12+(i.getMonth()-s.getMonth()),j=Math.floor(b/12);return{days:g,months:b,years:j}},O=(a,s=30)=>{if(!a.endDate)return!1;const i=new Date(a.endDate),l=new Date,g=new Date(l.getTime()+s*24*60*60*1e3);return i<=g&&i>=l},F=(a,s="USD")=>a==null?"N/A":new Intl.NumberFormat("en-US",{style:"currency",currency:s,minimumFractionDigits:2,maximumFractionDigits:2}).format(a),U=()=>{t.value=null,e.clearError()};return{contracts:r,currentContract:n,loading:o,error:p(()=>c.value||t.value),contractStats:y,loadContracts:S,loadContractById:L,saveContract:T,removeContract:N,validateContract:m,renewContract:R,terminateContract:x,validateRenewalData:C,validateTerminationData:w,loadContractDocuments:M,uploadContractDocument:$,validateDocumentData:A,loadContractSLAs:v,createContractSLA:P,validateSLAData:E,loadContractMilestones:V,createContractMilestone:q,completeContractMilestone:I,validateMilestoneData:D,calculateContractDuration:_,isContractExpiringSoon:O,formatContractValue:F,clearError:U}}export{u as C,f as a,nt as b,d as c,at as d,J as e,rt as f,tt as g,et as h,st as u};
|