2 lines
No EOL
48 KiB
JavaScript
2 lines
No EOL
48 KiB
JavaScript
"use strict";(self["webpackChunkcmc_fe"]=self["webpackChunkcmc_fe"]||[]).push([[83],{6705:function(e,t,l){l.r(t),l.d(t,{default:function(){return St}});var a=l(3396),o=l(7139),n=l(7312),r=l(9752),i=l(1332),u=l(1888),s=l(1334),c=l(9242),d=l(320),p=l(3122),m=l(8587);const v=(0,d.a)({name:"VDialogTransition",props:{target:Object},setup(e,t){let{slots:l}=t;const o={onBeforeEnter(e){e.style.pointerEvents="none",e.style.visibility="hidden"},async onEnter(t,l){var a;await new Promise((e=>requestAnimationFrame(e))),await new Promise((e=>requestAnimationFrame(e))),t.style.visibility="";const{x:o,y:n,sx:r,sy:i,speed:u}=h(e.target,t),s=(0,p.j)(t,[{transform:`translate(${o}px, ${n}px) scale(${r}, ${i})`,opacity:0},{transform:""}],{duration:225*u,easing:m.uX});null==(a=f(t))||a.forEach((e=>{(0,p.j)(e,[{opacity:0},{opacity:0,offset:.33},{opacity:1}],{duration:450*u,easing:m.Ly})})),s.finished.then((()=>l()))},onAfterEnter(e){e.style.removeProperty("pointer-events")},onBeforeLeave(e){e.style.pointerEvents="none"},async onLeave(t,l){var a;await new Promise((e=>requestAnimationFrame(e)));const{x:o,y:n,sx:r,sy:i,speed:u}=h(e.target,t),s=(0,p.j)(t,[{transform:""},{transform:`translate(${o}px, ${n}px) scale(${r}, ${i})`,opacity:0}],{duration:125*u,easing:m.x0});s.finished.then((()=>l())),null==(a=f(t))||a.forEach((e=>{(0,p.j)(e,[{},{opacity:0,offset:.2},{opacity:0}],{duration:250*u,easing:m.Ly})}))},onAfterLeave(e){e.style.removeProperty("pointer-events")}};return()=>e.target?(0,a.Wm)(c.uT,(0,a.dG)({name:"dialog-transition"},o,{css:!1}),l):(0,a.Wm)(c.uT,{name:"dialog-transition"},l)}});function f(e){var t;const l=null==(t=e.querySelector(":scope > .v-card, :scope > .v-sheet, :scope > .v-list"))?void 0:t.children;return l&&[...l]}function h(e,t){const l=e.getBoundingClientRect(),a=(0,p.G)(t),[o,n]=getComputedStyle(t).transformOrigin.split(" ").map((e=>parseFloat(e))),[r,i]=getComputedStyle(t).getPropertyValue("--v-overlay-anchor-origin").split(" ");let u=l.left+l.width/2;"left"===r||"left"===i?u-=l.width/2:"right"!==r&&"right"!==i||(u+=l.width/2);let s=l.top+l.height/2;"top"===r||"top"===i?s-=l.height/2:"bottom"!==r&&"bottom"!==i||(s+=l.height/2);const c=l.width/a.width,d=l.height/a.height,m=Math.max(1,c,d),v=c/m||0,f=d/m||0,h=a.width*a.height/(window.innerWidth*window.innerHeight),g=h>.12?Math.min(1.5,10*(h-.12)+1):1;return{x:u-(o+a.left),y:s-(n+a.top),sx:v,sy:f,speed:g}}var g=l(836),y=l(8551),_=l(8717),w=l(5975),k=l(3185),b=l(4870),C=l(2385),V=l(9888);const W=(0,d.e)()({name:"VDialog",props:{fullscreen:Boolean,retainFocus:{type:Boolean,default:!0},scrollable:Boolean,...(0,y.BU)({origin:"center center",scrollStrategy:"block",transition:{component:v},zIndex:2400})},emits:{"update:modelValue":e=>!0},setup(e,t){let{slots:l}=t;const o=(0,_.z)(e,"modelValue"),{scopeId:n}=(0,w.a)(),r=(0,b.iH)();function i(e){var t,l;const a=e.relatedTarget,o=e.target;if(a!==o&&null!=(t=r.value)&&t.contentEl&&null!=(l=r.value)&&l.globalTop&&![document,r.value.contentEl].includes(o)&&!r.value.contentEl.contains(o)){const e=[...r.value.contentEl.querySelectorAll('button, [href], input:not([type="hidden"]), select, textarea, [tabindex]:not([tabindex="-1"])')].filter((e=>!e.hasAttribute("disabled")&&!e.matches('[tabindex="-1"]')));if(!e.length)return;const t=e[0],l=e[e.length-1];a===t?l.focus():t.focus()}}return C.BR&&(0,a.YP)((()=>o.value&&e.retainFocus),(e=>{e?document.addEventListener("focusin",i):document.removeEventListener("focusin",i)}),{immediate:!0}),(0,a.YP)(o,(async e=>{var t,l;(await(0,a.Y3)(),e)?null==(t=r.value.contentEl)||t.focus({preventScroll:!0}):null==(l=r.value.activatorEl)||l.focus({preventScroll:!0})})),(0,V.L)((()=>{const[t]=(0,y.Fe)(e);return(0,a.Wm)(y.yc,(0,a.dG)({ref:r,class:["v-dialog",{"v-dialog--fullscreen":e.fullscreen,"v-dialog--scrollable":e.scrollable}]},t,{modelValue:o.value,"onUpdate:modelValue":e=>o.value=e,"aria-role":"dialog","aria-modal":"true",activatorProps:(0,a.dG)({"aria-haspopup":"dialog","aria-expanded":String(o.value)},e.activatorProps)},n),{activator:l.activator,default:function(){for(var e,t=arguments.length,o=new Array(t),n=0;n<t;n++)o[n]=arguments[n];return(0,a.Wm)(g.z,{root:!0},{default:()=>[null==(e=l.default)?void 0:e.call(l,...o)]})}})})),(0,k.F)({},r)}});var x=l(6824),U=l(8521),D=l(3289),S=l(7325),F=l(4162),z=l(3104),I=l(3144),Y=l(9870),B=l(165),P=l(6161),A=l(4722);const E=e=>((0,a.dD)("data-v-1af80872"),e=e(),(0,a.Cn)(),e),H=E((()=>(0,a._)("h3",null,"Contracts",-1))),T={key:0},M=E((()=>(0,a._)("br",null,null,-1))),L=E((()=>(0,a._)("br",null,null,-1))),G=E((()=>(0,a._)("br",null,null,-1))),$=E((()=>(0,a._)("br",null,null,-1))),N=E((()=>(0,a._)("br",null,null,-1))),O=E((()=>(0,a._)("br",null,null,-1))),j={key:0},q=E((()=>(0,a._)("br",null,null,-1)));function Z(e,t,l,c,d,p){const m=(0,a.up)("RecycleScroller"),v=(0,a.up)("ContractEdit"),f=(0,a.up)("ContractMulti");return(0,a.wg)(),(0,a.iD)(a.HY,null,[H,(0,a.Wm)(I.d,{modelValue:d.tab,"onUpdate:modelValue":t[0]||(t[0]=e=>d.tab=e),class:"my-2"},{default:(0,a.w5)((()=>[(0,a.Wm)(Y.L,{value:"list"},{default:(0,a.w5)((()=>[(0,a.Uk)("List")])),_:1}),d.edit?((0,a.wg)(),(0,a.j4)(Y.L,{key:0,value:"edit"},{default:(0,a.w5)((()=>[(0,a.Uk)("Edit")])),_:1})):(0,a.kq)("",!0),d.report?((0,a.wg)(),(0,a.j4)(Y.L,{key:1,value:"report"},{default:(0,a.w5)((()=>[(0,a.Uk)("Report")])),_:1})):(0,a.kq)("",!0)])),_:1},8,["modelValue"]),(0,a.Wm)(P.Oo,{modelValue:d.tab,"onUpdate:modelValue":t[4]||(t[4]=e=>d.tab=e)},{default:(0,a.w5)((()=>[(0,a.Wm)(A.H,{value:"list"},{default:(0,a.w5)((()=>[(0,a.Wm)(F.t,{"max-width":"500"},{default:(0,a.w5)((()=>[(0,a.Wm)(B.hw,{clearable:"",label:"Search",variant:"outlined",modelValue:d.searchQuery,"onUpdate:modelValue":t[1]||(t[1]=e=>d.searchQuery=e),density:"compact","append-inner-icon":"mdi-magnify"},null,8,["modelValue"])])),_:1}),(0,a.Wm)(W,{modelValue:d.showDialog,"onUpdate:modelValue":t[2]||(t[2]=e=>d.showDialog=e)},null,8,["modelValue"]),(0,a.Wm)(x.o,null,{default:(0,a.w5)((()=>[(0,a.Wm)(U.D,{cols:"8",xs:"12",sm:"12",md:"8"},{default:(0,a.w5)((()=>[(0,a.Wm)(S.K,{indeterminate:"",color:"blue",active:d.loading},null,8,["active"]),(0,a.Wm)(m,{class:"scroller",items:p.filteredContracts,"item-size":130,"key-field":"no"},{default:(0,a.w5)((({item:t})=>[(0,a.Wm)(x.o,{class:(0,o.C_)([[{inactive:!t.active}],"item"])},{default:(0,a.w5)((()=>[(0,a.Wm)(U.D,{cols:"4"},{default:(0,a.w5)((()=>[(0,a._)("h3",null,"Contract : "+(0,o.zw)(t.no),1),(0,a.Uk)(" "+(0,o.zw)(t.customer.acc_no)+" - "+(0,o.zw)(t.customer.name)+" ",1),(0,a.Wm)(z.G,{modelValue:t.active,"onUpdate:modelValue":e=>t.active=e,color:"green",onChange:e=>p.setContractInactive(t),label:"Active"},null,8,["modelValue","onUpdate:modelValue","onChange"])])),_:2},1024),(0,a.Wm)(U.D,null,{default:(0,a.w5)((()=>[((0,a.wg)(!0),(0,a.iD)(a.HY,null,(0,a.Ko)(t.products,(e=>((0,a.wg)(),(0,a.iD)(a.HY,{key:e.code},[""!=e.code?((0,a.wg)(),(0,a.iD)("span",T,[(0,a.Uk)((0,o.zw)(e.code)+" @ "+(0,o.zw)(e.price),1),M])):(0,a.kq)("",!0)],64)))),128))])),_:2},1024),(0,a.Wm)(U.D,null,{default:(0,a.w5)((()=>[(0,a.Wm)(D.t,{title:"Start"},{default:(0,a.w5)((()=>[(0,a.Uk)("mdi-play")])),_:1}),(0,a.Uk)(": "+(0,o.zw)(e.formatDate(t.start_date,"DD/MM/YYYY")),1),L,(0,a.Wm)(D.t,{title:"Finish"},{default:(0,a.w5)((()=>[(0,a.Uk)("mdi-flag-checkered")])),_:1}),(0,a.Uk)(": "+(0,o.zw)(e.formatDate(t.finish_date,"DD/MM/YYYY")),1),G,(0,a.Wm)(D.t,{title:"Duration"},{default:(0,a.w5)((()=>[(0,a.Uk)("mdi-clock")])),_:1}),(0,a.Uk)(": "+(0,o.zw)(t.duration)+" months ",1)])),_:2},1024),(0,a.Wm)(U.D,null,{default:(0,a.w5)((()=>[(0,a.Uk)((0,o.zw)(t.tonnage_per_month)+" per month",1),$,(0,a.Uk)(" = "+(0,o.zw)(e.formatNumber(t.tonnage_per_month*t.duration,2))+" total",1),N,(0,a.Uk)(" = "+(0,o.zw)(e.formatNumber(t.tonnage_per_month*t.remaining_duration,2))+" remaining",1),O])),_:2},1024),(0,a.Wm)(U.D,null,{default:(0,a.w5)((()=>[(0,a.Wm)(x.o,null,{default:(0,a.w5)((()=>[(0,a.Wm)(U.D,{cols:"12"},{default:(0,a.w5)((()=>[(0,a.Wm)(n.T,{color:"info"},{default:(0,a.w5)((()=>[(0,a.Uk)(" More "),(0,a.Wm)(y.yc,{activator:"parent",class:"align-center justify-center"},{default:(0,a.w5)((()=>[(0,a.Wm)(r._,{title:"Info",width:"600"},{default:(0,a.w5)((()=>[(0,a.Wm)(i.Q,null,{default:(0,a.w5)((()=>[(0,a.Uk)("Comments")])),_:1}),(0,a.Wm)(u.Z,null,{default:(0,a.w5)((()=>[(0,a.Uk)((0,o.zw)(t.comments),1)])),_:2},1024),(0,a.Wm)(i.Q,null,{default:(0,a.w5)((()=>[(0,a.Uk)("Office")])),_:1}),(0,a.Wm)(u.Z,null,{default:(0,a.w5)((()=>[(0,a.Uk)((0,o.zw)(t.office_comments),1)])),_:2},1024),(0,a.Wm)(i.Q,null,{default:(0,a.w5)((()=>[(0,a.Uk)("Agreed")])),_:1}),(0,a.Wm)(u.Z,null,{default:(0,a.w5)((()=>[(0,a.Uk)((0,o.zw)(e.formatDate(t.agree_date,"DD/MM/YYYY")),1)])),_:2},1024),(0,a.Wm)(i.Q,null,{default:(0,a.w5)((()=>[(0,a.Uk)("Products")])),_:1}),(0,a.Wm)(u.Z,null,{default:(0,a.w5)((()=>[((0,a.wg)(!0),(0,a.iD)(a.HY,null,(0,a.Ko)(t.products,(e=>((0,a.wg)(),(0,a.iD)(a.HY,{key:e.code},[""!=e.code?((0,a.wg)(),(0,a.iD)("span",j,[(0,a.Uk)((0,o.zw)(e.code)+" - "+(0,o.zw)(e.name)+" @ "+(0,o.zw)(e.price),1),q])):(0,a.kq)("",!0)],64)))),128))])),_:2},1024),(0,a.Wm)(s.h,null,{default:(0,a.w5)((()=>[(0,a.Wm)(n.T,{color:"info",target:"blank",onClick:e=>p.getContractPrint(t.no),class:"ma-2 pa-2",loading:t.multiloading},{default:(0,a.w5)((()=>[(0,a.Uk)(" Multi ")])),_:2},1032,["onClick","loading"]),(0,a.Wm)(n.T,{color:"info",target:"blank",onClick:e=>p.getContractPrint(t.no,!0),loading:t.totalloading,class:"ma-2 pa-2"},{default:(0,a.w5)((()=>[(0,a.Uk)(" Total ")])),_:2},1032,["onClick","loading"]),l.site_info.features.editcontract?((0,a.wg)(),(0,a.j4)(n.T,{key:0,color:"warning",onClick:e=>p.showEditContract(t)},{default:(0,a.w5)((()=>[(0,a.Uk)(" Edit ")])),_:2},1032,["onClick"])):(0,a.kq)("",!0)])),_:2},1024)])),_:2},1024)])),_:2},1024)])),_:2},1024)])),_:2},1024),(0,a.Wm)(U.D,{cols:"12"},{default:(0,a.w5)((()=>[l.site_info.features.editcontract?((0,a.wg)(),(0,a.j4)(n.T,{key:0,color:"warning",onClick:e=>p.showEditContract(t)},{default:(0,a.w5)((()=>[(0,a.Uk)(" Edit ")])),_:2},1032,["onClick"])):(0,a.kq)("",!0)])),_:2},1024)])),_:2},1024)])),_:2},1024)])),_:2},1032,["class"])])),_:1},8,["items"])])),_:1})])),_:1})])),_:1}),(0,a.Wm)(A.H,{value:"edit"},{default:(0,a.w5)((()=>[(0,a.Wm)(v,{ref:"edit",setcontract:d.selected_contract,onClosetab:t[3]||(t[3]=e=>d.tab="list"),onContractupdate:p.contractUpdated},null,8,["setcontract","onContractupdate"])])),_:1}),(0,a.Wm)(A.H,{value:"report"},{default:(0,a.w5)((()=>[(0,a.Wm)(f,{contract:d.selected_contract,total:d.total},null,8,["contract","total"])])),_:1})])),_:1},8,["modelValue"])],64)}l(7658);var K=l(1959),R=l(652),Q=l(1970),J=l(1138),X=l(7041),ee=l(5221),te=l(8434),le=l(131);const ae=Symbol.for("vuetify:v-chip-group");(0,d.a)({name:"VChipGroup",props:{column:Boolean,filter:Boolean,valueComparator:{type:Function,default:le.vZ},...(0,Q.k4)({selectedClass:"v-chip--selected"}),...(0,J.Q)(),...(0,X.x$)(),...(0,ee.bk)({variant:"tonal"})},emits:{"update:modelValue":e=>!0},setup(e,t){let{slots:l}=t;const{themeClasses:o}=(0,X.ER)(e),{isSelected:n,select:r,next:i,prev:u,selected:s}=(0,Q._v)(e,ae);return(0,te.AF)({VChip:{color:(0,b.Vh)(e,"color"),filter:(0,b.Vh)(e,"filter"),variant:(0,b.Vh)(e,"variant")}}),(0,V.L)((()=>{var t;return(0,a.Wm)(e.tag,{class:["v-chip-group",{"v-chip-group--column":e.column},o.value]},{default:()=>[null==(t=l.default)?void 0:t.call(l,{isSelected:n,select:r,next:i,prev:u,selected:s.value})]})})),{}}});var oe=l(8952),ne=l(2718),re=l(9694),ie=l(2465),ue=l(4231),se=l(6183),ce=l(9374),de=l(4960),pe=l(3824);const me=(0,d.a)({name:"VChip",directives:{Ripple:pe.H},props:{activeClass:String,appendAvatar:String,appendIcon:de.lE,closable:Boolean,closeIcon:{type:de.lE,default:"$delete"},closeLabel:{type:String,default:"$vuetify.close"},draggable:Boolean,filter:Boolean,filterIcon:{type:String,default:"$complete"},label:Boolean,link:Boolean,pill:Boolean,prependAvatar:String,prependIcon:de.lE,ripple:{type:Boolean,default:!0},text:String,modelValue:{type:Boolean,default:!0},...(0,ne.m)(),...(0,re.f)(),...(0,ie.c)(),...(0,Q.YQ)(),...(0,ue.I)(),...(0,se.GN)(),...(0,ce.Z)(),...(0,J.Q)({tag:"span"}),...(0,X.x$)(),...(0,ee.bk)({variant:"tonal"})},emits:{"click:close":e=>!0,"update:modelValue":e=>!0,"group:selected":e=>!0,click:e=>!0},setup(e,t){let{attrs:l,emit:o,slots:n}=t;const{borderClasses:r}=(0,ne.P)(e),{colorClasses:i,colorStyles:u,variantClasses:s}=(0,ee.c1)(e),{densityClasses:d}=(0,re.t)(e),{elevationClasses:p}=(0,ie.Y)(e),{roundedClasses:m}=(0,ue.b)(e),{sizeClasses:v}=(0,ce.t)(e),{themeClasses:f}=(0,X.ER)(e),h=(0,_.z)(e,"modelValue"),y=(0,Q.Yt)(e,ae,!1),w=(0,se.nB)(e,l),k=(0,a.Fl)((()=>!e.disabled&&(!!y||w.isClickable.value||e.link)));function b(e){h.value=!1,o("click:close",e)}function C(e){var t;o("click",e),k.value&&(null==(t=w.navigate)||t.call(w,e),null==y||y.toggle())}return()=>{var t;const l=w.isLink.value?"a":e.tag,o=!!(n.append||e.appendIcon||e.appendAvatar),_=!(!n.close&&!e.closable),V=!(!n.filter&&!e.filter)&&y,W=!!(n.prepend||e.prependIcon||e.prependAvatar),x=!y||y.isSelected.value;return h.value&&(0,a.wy)((0,a.Wm)(l,{class:["v-chip",{"v-chip--disabled":e.disabled,"v-chip--label":e.label,"v-chip--link":k.value,"v-chip--filter":V,"v-chip--pill":e.pill},f.value,r.value,x?i.value:void 0,d.value,p.value,m.value,v.value,s.value,null==y?void 0:y.selectedClass.value],style:[x?u.value:void 0],disabled:e.disabled||void 0,draggable:e.draggable,href:w.href.value,onClick:C},{default:()=>[(0,ee.Ux)(k.value,"v-chip"),V&&(0,a.Wm)(g.z,{key:"filter",defaults:{VIcon:{icon:e.filterIcon}}},{default:()=>[(0,a.Wm)(oe.Zq,null,{default:()=>[(0,a.wy)((0,a.Wm)("div",{class:"v-chip__filter"},[n.filter?n.filter():(0,a.Wm)(D.t,null,null)]),[[c.F8,y.isSelected.value]])]})]}),W&&(0,a.Wm)(g.z,{key:"prepend",defaults:{VAvatar:{image:e.prependAvatar},VIcon:{icon:e.prependIcon}}},{default:()=>[n.prepend?(0,a.Wm)("div",{class:"v-chip__prepend"},[n.prepend()]):e.prependAvatar?(0,a.Wm)(R.V,{start:!0},null):e.prependIcon?(0,a.Wm)(D.t,{start:!0},null):void 0]}),(null==(t=n.default)?void 0:t.call(n,{isSelected:null==y?void 0:y.isSelected.value,selectedClass:null==y?void 0:y.selectedClass.value,select:null==y?void 0:y.select,toggle:null==y?void 0:y.toggle,value:null==y?void 0:y.value.value,disabled:e.disabled}))??e.text,o&&(0,a.Wm)(g.z,{key:"append",defaults:{VAvatar:{image:e.appendAvatar},VIcon:{icon:e.appendIcon}}},{default:()=>[n.append?(0,a.Wm)("div",{class:"v-chip__append"},[n.append()]):e.appendAvatar?(0,a.Wm)(R.V,{end:!0},null):e.appendIcon?(0,a.Wm)(D.t,{end:!0},null):void 0]}),_&&(0,a.Wm)(g.z,{key:"close",defaults:{VIcon:{icon:e.closeIcon,size:"x-small"}}},{default:()=>[(0,a.Wm)("div",{class:"v-chip__close",onClick:b},[n.close?n.close():(0,a.Wm)(D.t,null,null)])]})]}),[[(0,a.Q2)("ripple"),k.value&&e.ripple,null]])}}});var ve=l(8649),fe=l(8777),he=l(7514),ge=l(4360);const ye=(0,d.e)()({name:"VMenu",props:{id:String,...(0,le.CE)((0,y.BU)({closeDelay:250,closeOnContentClick:!0,locationStrategy:"connected",openDelay:300,scrim:!1,scrollStrategy:"reposition",transition:{component:v}}),["absolute"])},emits:{"update:modelValue":e=>!0},setup(e,t){let{slots:l}=t;const o=(0,_.z)(e,"modelValue"),{scopeId:n}=(0,w.a)(),r=(0,he.sq)(),i=(0,a.Fl)((()=>e.id||`v-menu-${r}`)),u=(0,b.iH)(),s=(0,a.f3)(ge.N,null);let c=0;function d(){null==s||s.closeParents()}return(0,a.JJ)(ge.N,{register(){++c},unregister(){--c},closeParents(){setTimeout((()=>{c||(o.value=!1,null==s||s.closeParents())}),40)}}),(0,a.YP)(o,(e=>{e?null==s||s.register():null==s||s.unregister()})),(0,V.L)((()=>{const[t]=(0,y.Fe)(e);return(0,a.Wm)(y.yc,(0,a.dG)({ref:u,class:["v-menu"]},t,{modelValue:o.value,"onUpdate:modelValue":e=>o.value=e,absolute:!0,activatorProps:(0,a.dG)({"aria-haspopup":"menu","aria-expanded":String(o.value),"aria-owns":i.value},e.activatorProps),"onClick:outside":d},n),{activator:l.activator,default:function(){for(var e,t=arguments.length,o=new Array(t),n=0;n<t;n++)o[n]=arguments[n];return(0,a.Wm)(g.z,{root:!0},{default:()=>[null==(e=l.default)?void 0:e.call(l,...o)]})}})})),(0,k.F)({id:i},u)}});var _e=l(6185),we=l(4906),ke=l(1629),be=l(3766);const Ce=(0,be.U)({chips:Boolean,closableChips:Boolean,eager:Boolean,hideNoData:Boolean,hideSelected:Boolean,menu:Boolean,menuIcon:{type:de.lE,default:"$dropdown"},menuProps:{type:Object},multiple:Boolean,noDataText:{type:String,default:"$vuetify.noDataText"},openOnClear:Boolean,valueComparator:{type:Function,default:le.vZ},...(0,_e.S1)({itemChildren:!1})},"v-select"),Ve=((0,d.e)()({name:"VSelect",props:{...Ce(),...(0,le.CE)((0,B.wG)({modelValue:null}),["validationValue","dirty","appendInnerIcon"]),...(0,we.X)({transition:{component:v}})},emits:{"update:modelValue":e=>!0,"update:menu":e=>!0},setup(e,t){let{slots:l}=t;const{t:o}=(0,ke.bU)(),n=(0,b.iH)(),r=(0,_.z)(e,"menu"),{items:i,transformIn:u,transformOut:s}=(0,_e.Ce)(e),c=(0,_.z)(e,"modelValue",[],(e=>u((0,le.FT)(e))),(t=>{const l=s(t);return e.multiple?l:l[0]??null})),d=(0,a.Fl)((()=>c.value.map((t=>i.value.find((l=>e.valueComparator(l.value,t.value)))||t)))),p=(0,a.Fl)((()=>d.value.map((e=>e.props.value)))),m=(0,b.iH)();function v(t){c.value=[],e.openOnClear&&(r.value=!0)}function f(){e.hideNoData&&!i.value.length||e.readonly||(r.value=!r.value)}function h(t){var l;if(!e.readonly)if(["Enter","ArrowDown"," "].includes(t.key)&&(t.preventDefault(),r.value=!0),["Escape","Tab"].includes(t.key)&&(r.value=!1),"ArrowDown"===t.key)null==(l=m.value)||l.focus("next");else if("ArrowUp"===t.key){var a;t.preventDefault(),null==(a=m.value)||a.focus("prev")}else if("Home"===t.key){var o;t.preventDefault(),null==(o=m.value)||o.focus("first")}else if("End"===t.key){var n;t.preventDefault(),null==(n=m.value)||n.focus("last")}}function y(t){if(e.multiple){const e=p.value.findIndex((e=>e===t.value));if(-1===e)c.value=[...c.value,t];else{const t=[...c.value];t.splice(e,1),c.value=t}}else c.value=[t],r.value=!1}function w(e){var t;null!=(t=m.value)&&t.$el.contains(e.relatedTarget)||(r.value=!1)}function C(e){var t;null==e.relatedTarget&&(null==(t=n.value)||t.focus())}return(0,V.L)((()=>{const t=!(!e.chips&&!l.chip),[u]=(0,B.a)(e);return(0,a.Wm)(B.hw,(0,a.dG)({ref:n},u,{modelValue:c.value.map((e=>e.props.value)).join(", "),"onUpdate:modelValue":e=>{null==e&&(c.value=[])},validationValue:c.externalValue,dirty:c.value.length>0,class:["v-select",{"v-select--active-menu":r.value,"v-select--chips":!!e.chips,["v-select--"+(e.multiple?"multiple":"single")]:!0,"v-select--selected":c.value.length}],appendInnerIcon:e.menuIcon,readonly:!0,"onClick:clear":v,"onClick:control":f,onBlur:w,onKeydown:h}),{...l,default:()=>{var n,u,s;return(0,a.Wm)(a.HY,null,[(0,a.Wm)(ye,(0,a.dG)({modelValue:r.value,"onUpdate:modelValue":e=>r.value=e,activator:"parent",contentClass:"v-select__content",eager:e.eager,openOnClick:!1,closeOnContentClick:!1,transition:e.transition},e.menuProps),{default:()=>[(0,a.Wm)(ve.i,{ref:m,selected:p.value,selectStrategy:e.multiple?"independent":"single-independent",onMousedown:e=>e.preventDefault(),onFocusout:C},{default:()=>[!i.value.length&&!e.hideNoData&&((null==(n=l["no-data"])?void 0:n.call(l))??(0,a.Wm)(fe.l,{title:o(e.noDataText)},null)),null==(u=l["prepend-item"])?void 0:u.call(l),i.value.map(((t,o)=>{var n;return(null==(n=l.item)?void 0:n.call(l,{item:t,index:o,props:(0,a.dG)(t.props,{onClick:()=>y(t)})}))??(0,a.Wm)(fe.l,(0,a.dG)({key:o},t.props,{onClick:()=>y(t)}),{prepend:t=>{let{isSelected:l}=t;return e.multiple&&!e.hideSelected?(0,a.Wm)(K.pM,{modelValue:l,ripple:!1},null):void 0}})})),null==(s=l["append-item"])?void 0:s.call(l)]})]}),d.value.map(((o,n)=>{function r(e){e.stopPropagation(),e.preventDefault(),y(o)}const i={"onClick:close":r,modelValue:!0,"onUpdate:modelValue":void 0};return(0,a.Wm)("div",{key:o.value,class:"v-select__selection"},[t?(0,a.Wm)(g.z,{defaults:{VChip:{closable:e.closableChips,size:"small",text:o.title}}},{default:()=>[l.chip?l.chip({item:o,index:n,props:i}):(0,a.Wm)(me,i,null)]}):l.selection?l.selection({item:o,index:n}):(0,a.Wm)("span",{class:"v-select__selection-text"},[o.title,e.multiple&&n<d.value.length-1&&(0,a.Wm)("span",{class:"v-select__selection-comma"},[(0,a.Uk)(",")])])])}))])}})})),(0,k.F)({menu:r,select:y},n)}}),(e,t,l)=>null==e||null==t?-1:e.toString().toLocaleLowerCase().indexOf(t.toString().toLocaleLowerCase())),We=(0,be.U)({customFilter:Function,customKeyFilter:Object,filterKeys:[Array,String],filterMode:{type:String,default:"intersection"},noFilter:Boolean},"filter");function xe(e,t,l){const a=[],o=(null==l?void 0:l.default)??Ve,n=!(null==l||!l.filterKeys)&&(0,le.FT)(l.filterKeys),r=Object.keys((null==l?void 0:l.customKeyFilter)??{}).length;if(null==e||!e.length)return a;e:for(let u=0;u<e.length;u++){const s=e[u],c={},d={};let p=-1;if(t&&(null==l||!l.noFilter)){if("object"===typeof s){const e=n||Object.keys(s);for(const a of e){var i;const e=(0,le.qF)(s,a,s),n=null==l||null==(i=l.customKeyFilter)?void 0:i[a];if(p=n?n(e,t,s):o(e,t,s),-1!==p&&!1!==p)n?c[a]=p:d[a]=p;else if("every"===(null==l?void 0:l.filterMode))continue e}}else p=o(s,t,s),-1!==p&&!1!==p&&(d.title=p);const e=Object.keys(d).length,a=Object.keys(c).length;if(!e&&!a)continue;if("union"===(null==l?void 0:l.filterMode)&&a!==r&&!e)continue;if("intersection"===(null==l?void 0:l.filterMode)&&(a!==r||!e))continue}a.push({index:u,matches:{...d,...c}})}return a}function Ue(e,t,l){const o=(0,a.Fl)((()=>"string"!==typeof(null==l?void 0:l.value)&&"number"!==typeof(null==l?void 0:l.value)?"":String(l.value))),n=(0,a.Fl)((()=>{const l=(0,b.SU)(t),a=xe(l,o.value,{customKeyFilter:e.customKeyFilter,default:e.customFilter,filterKeys:e.filterKeys,filterMode:e.filterMode,noFilter:e.noFilter});return a.map((e=>{let{index:t,matches:a}=e;return{item:l[t],matches:a}}))}));return{filteredItems:n}}function De(e,t,l){if(Array.isArray(t))throw new Error("Multiple matches is not implemented");return"number"===typeof t&&~t?(0,a.Wm)(a.HY,null,[(0,a.Wm)("span",{class:"v-autocomplete__unmask"},[e.substr(0,t)]),(0,a.Wm)("span",{class:"v-autocomplete__mask"},[e.substr(t,l)]),(0,a.Wm)("span",{class:"v-autocomplete__unmask"},[e.substr(t+l)])]):e}const Se=(0,d.e)()({name:"VAutocomplete",props:{search:String,...We({filterKeys:["title"]}),...Ce(),...(0,le.CE)((0,B.wG)({modelValue:null}),["validationValue","dirty","appendInnerIcon"]),...(0,we.X)({transition:!1})},emits:{"update:search":e=>!0,"update:modelValue":e=>!0,"update:menu":e=>!0},setup(e,t){let{slots:l}=t;const{t:o}=(0,ke.bU)(),n=(0,b.iH)(),r=(0,b.iH)(!1),i=(0,b.iH)(!0),u=(0,_.z)(e,"menu"),{items:s,transformIn:c,transformOut:d}=(0,_e.Ce)(e),p=(0,_.z)(e,"search",""),m=(0,_.z)(e,"modelValue",[],(e=>c((0,le.FT)(e))),(t=>{const l=d(t);return e.multiple?l:l[0]??null})),{filteredItems:v}=Ue(e,s,(0,a.Fl)((()=>i.value?void 0:p.value))),f=(0,a.Fl)((()=>m.value.map((t=>s.value.find((l=>e.valueComparator(l.value,t.value)))||t)))),h=(0,a.Fl)((()=>f.value.map((e=>e.props.value)))),y=(0,b.iH)();function w(t){m.value=[],e.openOnClear&&(u.value=!0),p.value=""}function C(){e.hideNoData&&!s.value.length||e.readonly||(u.value=!0)}function W(t){var l;if(!e.readonly)if(["Enter","ArrowDown"].includes(t.key)&&(u.value=!0),["Escape"].includes(t.key)&&(u.value=!1),["Enter","Escape","Tab"].includes(t.key)&&(i.value=!0),"ArrowDown"===t.key)t.preventDefault(),null==(l=y.value)||l.focus("next");else if("ArrowUp"===t.key){var a;t.preventDefault(),null==(a=y.value)||a.focus("prev")}}function x(e){p.value=e.target.value}function U(){r.value&&(i.value=!0)}function D(e){r.value=!0}function S(e){var t;null==e.relatedTarget&&(null==(t=n.value)||t.focus())}const F=(0,b.iH)(!1);function z(t){if(e.multiple){const e=h.value.findIndex((e=>e===t.value));if(-1===e)m.value=[...m.value,t],p.value="";else{const t=[...m.value];t.splice(e,1),m.value=t}}else m.value=[t],F.value=!0,l.selection||(p.value=t.title),u.value=!1,i.value=!0,(0,a.Y3)((()=>F.value=!1))}return(0,a.YP)(r,(t=>{var o;t?(F.value=!0,p.value=e.multiple||l.selection?"":String((null==(o=f.value.at(-1))?void 0:o.props.title)??""),i.value=!0,(0,a.Y3)((()=>F.value=!1))):(u.value=!1,p.value="")})),(0,a.YP)(p,(e=>{r.value&&!F.value&&(e&&(u.value=!0),i.value=!e)})),(0,V.L)((()=>{const t=!(!e.chips&&!l.chip),[s]=(0,B.a)(e);return(0,a.Wm)(B.hw,(0,a.dG)({ref:n},s,{modelValue:p.value,"onUpdate:modelValue":e=>{null==e&&(m.value=[])},validationValue:m.externalValue,dirty:m.value.length>0,onInput:x,class:["v-autocomplete",{"v-autocomplete--active-menu":u.value,"v-autocomplete--chips":!!e.chips,["v-autocomplete--"+(e.multiple?"multiple":"single")]:!0,"v-autocomplete--selection-slot":!!l.selection}],appendInnerIcon:e.menuIcon,readonly:e.readonly,"onClick:clear":w,"onClick:control":C,"onClick:input":C,onFocus:()=>r.value=!0,onBlur:()=>r.value=!1,onKeydown:W}),{...l,default:()=>{var n,r,s;return(0,a.Wm)(a.HY,null,[(0,a.Wm)(ye,(0,a.dG)({modelValue:u.value,"onUpdate:modelValue":e=>u.value=e,activator:"parent",contentClass:"v-autocomplete__content",eager:e.eager,openOnClick:!1,closeOnContentClick:!1,transition:e.transition,onAfterLeave:U},e.menuProps),{default:()=>[(0,a.Wm)(ve.i,{ref:y,selected:h.value,selectStrategy:e.multiple?"independent":"single-independent",onMousedown:e=>e.preventDefault(),onFocusin:D,onFocusout:S},{default:()=>[!v.value.length&&!e.hideNoData&&((null==(n=l["no-data"])?void 0:n.call(l))??(0,a.Wm)(fe.l,{title:o(e.noDataText)},null)),null==(r=l["prepend-item"])?void 0:r.call(l),v.value.map(((t,o)=>{var n;let{item:r,matches:u}=t;return(null==(n=l.item)?void 0:n.call(l,{item:r,index:o,props:(0,a.dG)(r.props,{onClick:()=>z(r)})}))??(0,a.Wm)(fe.l,(0,a.dG)({key:o},r.props,{onClick:()=>z(r)}),{prepend:t=>{let{isSelected:l}=t;return e.multiple&&!e.hideSelected?(0,a.Wm)(K.pM,{modelValue:l,ripple:!1},null):void 0},title:()=>{var e;return i.value?r.title:De(r.title,u.title,(null==(e=p.value)?void 0:e.length)??0)}})})),null==(s=l["append-item"])?void 0:s.call(l)]})]}),f.value.map(((o,n)=>{function r(e){e.stopPropagation(),e.preventDefault(),z(o)}const i={"onClick:close":r,modelValue:!0,"onUpdate:modelValue":void 0};return(0,a.Wm)("div",{key:o.value,class:"v-autocomplete__selection"},[t?(0,a.Wm)(g.z,{defaults:{VChip:{closable:e.closableChips,size:"small",text:o.title}}},{default:()=>[l.chip?l.chip({item:o,index:n,props:i}):(0,a.Wm)(me,i,null)]}):l.selection?l.selection({item:o,index:n}):(0,a.Wm)("span",{class:"v-autocomplete__selection-text"},[o.title,e.multiple&&n<f.value.length-1&&(0,a.Wm)("span",{class:"v-autocomplete__selection-comma"},[(0,a.Uk)(",")])])])}))])}})})),(0,k.F)({isFocused:r,isPristine:i,menu:u,search:p,filteredItems:v,select:z},n)}});var Fe=l(3369),ze=l(9234),Ie=(l(348),l(7173)),Ye=l(8302),Be=l(2816),Pe=l(7052),Ae=l(8969);const Ee=(0,d.a)({name:"VTextarea",directives:{Intersect:Pe.Z},inheritAttrs:!1,props:{autoGrow:Boolean,autofocus:Boolean,counter:[Boolean,Number,String],counterValue:Function,hint:String,persistentHint:Boolean,prefix:String,placeholder:String,persistentPlaceholder:Boolean,persistentCounter:Boolean,noResize:Boolean,rows:{type:[Number,String],default:5,validator:e=>!isNaN(parseFloat(e))},maxRows:{type:[Number,String],validator:e=>!isNaN(parseFloat(e))},suffix:String,...(0,Ye.co)(),...(0,Ie.hy)()},emits:{"click:control":e=>!0,"update:focused":e=>!0,"update:modelValue":e=>!0},setup(e,t){let{attrs:l,emit:o,slots:n}=t;const r=(0,_.z)(e,"modelValue"),{isFocused:i,focus:u,blur:s}=(0,Ae.K)(e),d=(0,a.Fl)((()=>"function"===typeof e.counterValue?e.counterValue(r.value):(r.value||"").toString().length)),p=(0,a.Fl)((()=>l.maxlength?l.maxlength:!e.counter||"number"!==typeof e.counter&&"string"!==typeof e.counter?void 0:e.counter));function m(t,l){var a,o;e.autofocus&&t&&(null==(a=l[0].target)||null==(o=a.focus)||o.call(a))}const v=(0,b.iH)(),f=(0,b.iH)(),h=(0,b.iH)(""),g=(0,b.iH)(),y=(0,a.Fl)((()=>i.value||e.persistentPlaceholder)),w=(0,a.Fl)((()=>e.messages.length?e.messages:y.value||e.persistentHint?e.hint:""));function C(){var e;g.value!==document.activeElement&&(null==(e=g.value)||e.focus());i.value||u()}function W(e){C(),o("click:control",e)}function x(t){t.stopPropagation(),C(),(0,a.Y3)((()=>{r.value="",(0,le.dr)(e["onClick:clear"],t)}))}function U(e){r.value=e.target.value}const D=(0,b.iH)();function S(){e.autoGrow&&(0,a.Y3)((()=>{if(!D.value||!f.value)return;const t=getComputedStyle(D.value),l=getComputedStyle(f.value.$el),a=parseFloat(t.getPropertyValue("--v-field-padding-top"))+parseFloat(t.getPropertyValue("--v-input-padding-top"))+parseFloat(t.getPropertyValue("--v-field-padding-bottom")),o=D.value.scrollHeight,n=parseFloat(t.lineHeight),r=Math.max(parseFloat(e.rows)*n+a,parseFloat(l.getPropertyValue("--v-input-control-height"))),i=parseFloat(e.maxRows)*n+a||1/0;h.value=(0,le.kb)((0,le.uZ)(o??0,r,i))}))}let F;return(0,a.bv)(S),(0,a.YP)(r,S),(0,a.YP)((()=>e.rows),S),(0,a.YP)((()=>e.maxRows),S),(0,a.YP)((()=>e.density),S),(0,a.YP)(D,(e=>{var t;e?(F=new ResizeObserver(S),F.observe(D.value)):null==(t=F)||t.disconnect()})),(0,a.Jd)((()=>{var e;null==(e=F)||e.disconnect()})),(0,V.L)((()=>{const t=!!(n.counter||e.counter||e.counterValue),o=!(!t&&!n.details),[u,_]=(0,le.An)(l),[{modelValue:k,...b}]=(0,Ye.PE)(e),[V]=(0,Ie.g8)(e);return(0,a.Wm)(Ye.q8,(0,a.dG)({ref:v,modelValue:r.value,"onUpdate:modelValue":e=>r.value=e,class:["v-textarea v-text-field",{"v-textarea--prefixed":e.prefix,"v-textarea--suffixed":e.suffix,"v-text-field--prefixed":e.prefix,"v-text-field--suffixed":e.suffix,"v-textarea--auto-grow":e.autoGrow,"v-textarea--no-resize":e.noResize||e.autoGrow,"v-text-field--flush-details":["plain","underlined"].includes(e.variant)}],"onClick:prepend":e["onClick:prepend"],"onClick:append":e["onClick:append"]},u,b,{focused:i.value,messages:w.value}),{...n,default:t=>{let{isDisabled:l,isDirty:o,isReadonly:u,isValid:d}=t;return(0,a.Wm)(Ie.hF,(0,a.dG)({ref:f,style:{"--v-textarea-control-height":h.value},"onClick:control":W,"onClick:clear":x,"onClick:prependInner":e["onClick:prependInner"],"onClick:appendInner":e["onClick:appendInner"],role:"textbox"},V,{active:y.value||o.value,dirty:o.value||e.dirty,focused:i.value,error:!1===d.value}),{...n,default:t=>{let{props:{class:o,...n}}=t;return(0,a.Wm)(a.HY,null,[e.prefix&&(0,a.Wm)("span",{class:"v-text-field__prefix"},[e.prefix]),(0,a.wy)((0,a.Wm)("textarea",(0,a.dG)({ref:g,class:o,value:r.value,onInput:U,autofocus:e.autofocus,readonly:u.value,disabled:l.value,placeholder:e.placeholder,rows:e.rows,name:e.name,onFocus:C,onBlur:s},n,_),null),[[(0,a.Q2)("intersect"),{handler:m},null,{once:!0}]]),e.autoGrow&&(0,a.wy)((0,a.Wm)("textarea",{class:[o,"v-textarea__sizer"],"onUpdate:modelValue":e=>r.value=e,ref:D,readonly:!0,"aria-hidden":"true"},null),[[c.nr,r.value]]),e.suffix&&(0,a.Wm)("span",{class:"v-text-field__suffix"},[e.suffix])])}})},details:o?l=>{var o;return(0,a.Wm)(a.HY,null,[null==(o=n.details)?void 0:o.call(n,l),t&&(0,a.Wm)(a.HY,null,[(0,a.Wm)("span",null,null),(0,a.Wm)(Be._,{active:e.persistentCounter||i.value,value:d.value,max:p.value},n.counter)])])}:void 0})})),(0,k.F)({},v,f,g)}}),He=(0,a._)("br",null,null,-1),Te=(0,a._)("br",null,null,-1);function Me(e,t,l,o,i,c){const d=(0,a.up)("DatePicker");return(0,a.wg)(),(0,a.j4)(r._,{title:"Edit Contract",subtitle:"Contract : "+i.contract.no},{default:(0,a.w5)((()=>[(0,a.Wm)(u.Z,null,{default:(0,a.w5)((()=>[(0,a.Wm)(Fe.K,null,{default:(0,a.w5)((()=>[(0,a.Wm)(x.o,null,{default:(0,a.w5)((()=>[(0,a.Wm)(U.D,{cols:"6"},{default:(0,a.w5)((()=>[(0,a.Wm)(B.hw,{label:"Customer",modelValue:i.contract.customer.name,"onUpdate:modelValue":t[0]||(t[0]=e=>i.contract.customer.name=e),readonly:""},null,8,["modelValue"]),(0,a.Wm)(B.hw,{type:"number",label:"Tonnage Per Month",modelValue:i.contract.tonnage_per_month,"onUpdate:modelValue":t[1]||(t[1]=e=>i.contract.tonnage_per_month=e)},null,8,["modelValue"])])),_:1}),(0,a.Wm)(U.D,{cols:"6"},{default:(0,a.w5)((()=>[(0,a._)("label",null,[(0,a.Uk)(" Start Date "),(0,a.Wm)(d,{modelValue:i.contract.start_date,"onUpdate:modelValue":t[2]||(t[2]=e=>i.contract.start_date=e),format:"dd/MM/yyyy"},null,8,["modelValue"])]),He,(0,a._)("label",null,[(0,a.Uk)(" Finish Date "),(0,a.Wm)(d,{modelValue:i.contract.finish_date,"onUpdate:modelValue":t[3]||(t[3]=e=>i.contract.finish_date=e),format:"dd/MM/yyyy"},null,8,["modelValue"])]),Te])),_:1})])),_:1}),((0,a.wg)(!0),(0,a.iD)(a.HY,null,(0,a.Ko)(i.contract.products,(e=>((0,a.wg)(),(0,a.j4)(x.o,{key:e.code},{default:(0,a.w5)((()=>[(0,a.Wm)(U.D,{cols:"6"},{default:(0,a.w5)((()=>[(0,a.Wm)(Se,{modelValue:e.code,"onUpdate:modelValue":t=>e.code=t,search:i.product_search,"onUpdate:search":t[4]||(t[4]=e=>i.product_search=e),loading:i.products_loading,items:i.products,"cache-items":"","hide-no-data":"","hide-details":"","solo-inverted":"",label:"Code","no-data-text":"No Products Found","item-title":"code","item-value":"code"},null,8,["modelValue","onUpdate:modelValue","search","loading","items"])])),_:2},1024),(0,a.Wm)(U.D,{cols:"4"},{default:(0,a.w5)((()=>[(0,a.Wm)(B.hw,{type:"number",label:"Price",modelValue:e.price,"onUpdate:modelValue":t=>e.price=t},null,8,["modelValue","onUpdate:modelValue"])])),_:2},1024),(0,a.Wm)(U.D,{cols:"2"},{default:(0,a.w5)((()=>[(0,a.Wm)(n.T,{size:"small",color:"error",title:"Remove",variant:"plain",icon:"",onClick:t[5]||(t[5]=e=>i.contract.products.pop())},{default:(0,a.w5)((()=>[(0,a.Wm)(D.t,null,{default:(0,a.w5)((()=>[(0,a.Uk)("mdi-minus")])),_:1})])),_:1})])),_:1})])),_:2},1024)))),128)),(0,a.Wm)(x.o,null,{default:(0,a.w5)((()=>[(0,a.Wm)(U.D,{cols:"4"},{default:(0,a.w5)((()=>[i.contract.products.length<4?((0,a.wg)(),(0,a.j4)(n.T,{key:0,onClick:t[6]||(t[6]=e=>i.contract.products.push({}))},{default:(0,a.w5)((()=>[(0,a.Uk)("+ Add Product")])),_:1})):(0,a.kq)("",!0)])),_:1})])),_:1}),(0,a.Wm)(x.o,null,{default:(0,a.w5)((()=>[(0,a.Wm)(U.D,{cols:"6"},{default:(0,a.w5)((()=>[(0,a._)("label",null,[(0,a.Uk)(" Agree Date "),(0,a.Wm)(d,{modelValue:i.contract.agree_date,"onUpdate:modelValue":t[7]||(t[7]=e=>i.contract.agree_date=e),format:"dd/MM/yyyy"},null,8,["modelValue"])])])),_:1}),(0,a.Wm)(U.D,{cols:"12"},{default:(0,a.w5)((()=>[(0,a.Wm)(Ee,{rows:"3",label:"Comments",modelValue:i.contract.comments,"onUpdate:modelValue":t[8]||(t[8]=e=>i.contract.comments=e)},null,8,["modelValue"]),(0,a.Wm)(Ee,{rows:"3",label:"Office Comments",modelValue:i.contract.office_comments,"onUpdate:modelValue":t[9]||(t[9]=e=>i.contract.office_comments=e)},null,8,["modelValue"])])),_:1})])),_:1})])),_:1})])),_:1}),(0,a.Wm)(s.h,null,{default:(0,a.w5)((()=>[(0,a.Wm)(n.T,{color:"red-darken-1",variant:"text",onClick:t[10]||(t[10]=t=>c.saveContract(e.selected_contract))},{default:(0,a.w5)((()=>[(0,a.Uk)("Save")])),_:1}),(0,a.Wm)(ze.C),(0,a.Wm)(n.T,{color:"blue-darken-1",variant:"text",onClick:c.close},{default:(0,a.w5)((()=>[(0,a.Uk)("Close")])),_:1},8,["onClick"])])),_:1})])),_:1},8,["subtitle"])}var Le=l(6943),Ge=l(9024),$e={props:{setcontract:{no:Number,customer:{acc_no:String,name:String,at_risk:Boolean},products:[{code:String,name:String,price:Number}],start_date:String,finish_date:String,agree_date:String,tonnage_per_month:Number,comments:String,office_comments:String,active:Boolean}},components:{DatePicker:Ge.Z},watch:{setcontract(e){this.contract=e},product_search(e){e&&e.length>1&&this.searchProducts(e)}},data(){return{contract:this.setcontract,dialog:this.opendialog,saving:!1,product_search:null,products_loading:!1,products:[]}},methods:{close(){this.$emit("closetab","list")},async saveContract(){this.saving=!0;let e=this.$api_url+"/customers/contracts/"+this.contract.no+"/save";console.log("Saving Contract : ",this.contract.no),console.log(this.contract),Le.Z.post(e,{contract:this.contract}).then((e=>{console.log("Saved Contract : "+JSON.stringify(e.data)),this.saving=!1,this.$emit("contractupdate",e.data)})).catch((e=>{console.log(e),this.saving=!1}))},searchProducts(e){let t=this.$api_url+"/products/search/"+e;console.log(t),Le.Z.get(t).then((e=>{console.log(e),this.products=e.data})).catch((e=>{console.log(e),this.products=[{code:"NoProductsFound",name:"No Products Found"}]}))},productCodeName(e){return e.code+" - "+e.name}}},Ne=l(89);const Oe=(0,Ne.Z)($e,[["render",Me]]);var je=Oe;const qe={class:"letter"},Ze=(0,a._)("span",{class:"text-bold"},"Date: ",-1),Ke=(0,a._)("p",{class:"text-bold"},"Customer's Address:",-1),Re={key:0},Qe=(0,a._)("br",null,null,-1),Je=(0,a._)("br",null,null,-1),Xe=(0,a._)("br",null,null,-1),et=(0,a._)("br",null,null,-1),tt=(0,a._)("p",{class:"text-bold"},"This is to confirm that you have entered into a contract on the following terms and conditions.",-1),lt=(0,a._)("p",{class:"text-bold"},"Description of goods",-1),at=(0,a._)("br",null,null,-1),ot={key:1},nt=(0,a._)("span",{class:"text-bold"},"Tonnage Per Month: ",-1),rt={key:2},it=(0,a._)("span",{class:"text-bold"},"Total Tonnage: ",-1),ut=(0,a._)("span",{class:"text-bold"},"Payment Terms: ",-1),st={class:"list contract-product"},ct={class:"gap-before"},dt=(0,a._)("p",{class:"text-bold"},"No variation on the above terms is accepted unless expressly agreed in writing",-1),pt=(0,a._)("span",{class:"text-bold"},"Contract Agreement Date: ",-1),mt=(0,a._)("p",{class:"text-bold"},"This contract is subject to change if additional import duties are imposed as a result of Brexit or unforeseen circumstances. It is also subject to any surcharges imposed on input costs as a result of supply chain issues.",-1),vt=(0,a._)("p",null,"Yours faithfully",-1),ft=(0,a._)("div",{class:"signature"},null,-1),ht=(0,a._)("p",{class:"text-bold"},"On behalf of Crediton Milling Company Limited",-1),gt=(0,a._)("p",{class:"text-center text-italic"},"This contract is subject to the AIC terms and conditions No. 14/21 so far as they are consistent with the terms set out above. Where there is a conflict the above terms will prevail.",-1);function yt(e,t,l,n,r,i){const u=(0,a.up)("ReportLayout");return(0,a.wg)(),(0,a.j4)(u,{scope:"contract"},{default:(0,a.w5)((()=>[(0,a._)("div",qe,[(0,a._)("p",null,[Ze,(0,a.Uk)((0,o.zw)(r.current_date),1)]),Ke,l.contract.customer?((0,a.wg)(),(0,a.iD)("address",Re,[(0,a.Uk)((0,o.zw)(l.contract.customer.name),1),Qe,(0,a.Uk)(" "+(0,o.zw)(l.contract.customer.address.line_1),1),Je,(0,a.Uk)(" "+(0,o.zw)(l.contract.customer.address.line_2),1),Xe,""!=l.contract.customer.address.city?((0,a.wg)(),(0,a.iD)(a.HY,{key:0},[(0,a.Uk)((0,o.zw)(l.contract.customer.address.city),1)],64)):((0,a.wg)(),(0,a.iD)(a.HY,{key:1},[(0,a.Uk)((0,o.zw)(l.contract.customer.address.line_3),1)],64)),et,""!=l.contract.customer.address.county?((0,a.wg)(),(0,a.iD)(a.HY,{key:2},[(0,a.Uk)((0,o.zw)(l.contract.customer.address.county),1)],64)):((0,a.wg)(),(0,a.iD)(a.HY,{key:3},[(0,a.Uk)((0,o.zw)(l.contract.customer.address.line_4),1)],64)),(0,a.Uk)(" "+(0,o.zw)(l.contract.customer.address.postcode),1)])):(0,a.kq)("",!0),tt,lt,(0,a._)("p",null,[(0,a.Uk)("CMC Contract Number: "+(0,o.zw)(l.contract.no),1),at,(0,a.Uk)(" Period: "+(0,o.zw)(i.start_date_formatted)+" until "+(0,o.zw)(i.finish_date_formatted),1)]),l.total?(0,a.kq)("",!0):((0,a.wg)(),(0,a.iD)("p",ot,[nt,(0,a.Uk)((0,o.zw)(l.contract.tonnage_per_month),1)])),l.total?((0,a.wg)(),(0,a.iD)("p",rt,[it,(0,a.Uk)((0,o.zw)(l.contract.tonnage_per_month*l.contract.duration),1)])):(0,a.kq)("",!0),(0,a._)("p",null,(0,o.zw)(l.contract.comments),1),(0,a._)("p",null,[ut,(0,a.Uk)((0,o.zw)(l.contract.terms),1)]),(0,a._)("ul",st,[((0,a.wg)(!0),(0,a.iD)(a.HY,null,(0,a.Ko)(l.contract.products,(e=>((0,a.wg)(),(0,a.iD)("li",{key:e.code},[(0,a.Uk)(" £ "+(0,o.zw)(e.price)+" ",1),(0,a._)("span",ct,(0,o.zw)(e.name),1)])))),128))]),dt,(0,a._)("p",null,[pt,""!=l.contract.agree_date?((0,a.wg)(),(0,a.iD)(a.HY,{key:0},[(0,a.Uk)((0,o.zw)(i.agree_date_formatted),1)],64)):(0,a.kq)("",!0)]),mt,vt,ft,ht,gt])])),_:1})}var _t=l(6858),wt=l(6797),kt=l.n(wt),bt={getAuthToken(){let e=localStorage.getItem("access_token");return console.log(e),e},formatDate(e,t){if(e)return kt()(String(e)).format(t)},getDateNow(){let e=new Date;return e.toLocaleString("en-GB",{day:"2-digit",month:"long",year:"numeric"})},getTimeNow(){let e=new Date;return e.toLocaleString("en-GB",{month:"long",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}},Ct={props:{contract:{},total:Boolean},components:{ReportLayout:_t.Z},data(){return{current_date:bt.getDateNow()}},computed:{start_date_formatted(){return kt()(String(this.contract.start_date)).format("DD/MM/YYYY")},finish_date_formatted(){return kt()(String(this.contract.finish_date)).format("DD/MM/YYYY")},agree_date_formatted(){return kt()(String(this.contract.agree_date)).format("DD/MM/YYYY")}},methods:{}};const Vt=(0,Ne.Z)(Ct,[["render",yt]]);var Wt=Vt,xt=l(7585),Ut={props:{site_info:{},user_info:{}},components:{ContractEdit:je,ContractMulti:Wt},computed:{filteredContracts(){let e=this.searchQuery.toLowerCase();this.data_received||this.getContractsList();let t=this.contracts.filter((t=>t.customer.name.toLowerCase().includes(e)||t.customer.acc_no.includes(e)||t.no==e));return this.showCurrent&&(t=t.filter((e=>1==e.current))),this.showActive&&(t=t.filter((e=>1==e.active))),t}},data(){return{searchQuery:"",contracts:[],data_received:!1,contractsloading:!0,limit:200,loading:!0,showActive:!1,showCurrent:!1,showDialog:!1,selected_contract:{},reportcomponent:null,tab:null,edit:!1,report:!1,total:!1,content:""}},mixins:[xt.Z],methods:{async showEditContract(e){this.selected_contract=e,this.tab="edit",this.edit=!0},async getContractsList(){this.loading=!0;let e=this.$api_url+"/customers/contracts/list";console.log("Getting Contracts list..."),Le.Z.get(e,{params:{limit:this.limit,query:this.searchQuery}}).then((e=>{this.contracts=e.data,this.data_received=!0,this.loading=!1}))},getContractPrint(e,t=!1){Le.Z.get(this.$api_url+"/customers/contracts/"+e+"/info").then((e=>{this.selected_contract=e.data,this.total=t,this.tab="report",this.report=!0}))},findContract(e){for(let t=0;t<this.contracts;t++)if(this.contracts[t].id==e)return t},contractUpdated(e){console.log("Contract updated : "+e.id),this.getContractsList(),this.tab="list",this.edit=!1},setContractInactive(e){let t=this.$api_url+"/customers/contracts/"+e.no+"/active_state";Le.Z.post(t,{state:e.active}).then((t=>{t.data.ok?console.log("Active state set"):(console.log("failed to set Active state"),e.active=!e.active)})).catch((t=>{console.log(t),e.active=!e.active}))}}};const Dt=(0,Ne.Z)(Ut,[["render",Z],["__scopeId","data-v-1af80872"]]);var St=Dt},1959:function(e,t,l){l.d(t,{CI:function(){return m},pM:function(){return p},w4:function(){return d}});var a=l(3396),o=l(6193),n=l(4960),r=l(8717),i=l(3766),u=l(320),s=l(9888),c=l(131);const d=(0,i.U)({indeterminate:Boolean,indeterminateIcon:{type:n.lE,default:"$checkboxIndeterminate"},...(0,o.$9)({falseIcon:"$checkboxOff",trueIcon:"$checkboxOn"})},"v-checkbox-btn"),p=(0,u.a)({name:"VCheckboxBtn",props:d(),emits:{"update:modelValue":e=>!0,"update:indeterminate":e=>!0},setup(e,t){let{slots:l}=t;const n=(0,r.z)(e,"indeterminate"),i=(0,r.z)(e,"modelValue");function u(e){n.value&&(n.value=!1)}const c=(0,a.Fl)((()=>e.indeterminate?e.indeterminateIcon:e.falseIcon)),d=(0,a.Fl)((()=>e.indeterminate?e.indeterminateIcon:e.trueIcon));return(0,s.L)((()=>(0,a.Wm)(o.g5,(0,a.dG)(e,{modelValue:i.value,"onUpdate:modelValue":[e=>i.value=e,u],class:"v-checkbox-btn",type:"checkbox",inline:!0,falseIcon:c.value,trueIcon:d.value,"aria-checked":e.indeterminate?"mixed":void 0}),l))),{}}});function m(e){return(0,c.ei)(e,Object.keys(p.props))}},6193:function(e,t,l){l.d(t,{g5:function(){return V},fU:function(){return W},$9:function(){return b}});var a=l(3396),o=l(3289),n=l(7302),r=l(4960),i=l(9694),u=l(7041),s=l(8434),c=l(8717),d=l(4870),p=l(3766),m=l(131),v=l(320),f=l(7514),h=l(9888);const g=Symbol.for("vuetify:selection-control-group"),y=(0,p.U)({color:String,disabled:Boolean,error:Boolean,id:String,inline:Boolean,falseIcon:r.lE,trueIcon:r.lE,ripple:{type:Boolean,default:!0},multiple:{type:Boolean,default:null},name:String,readonly:Boolean,modelValue:null,type:String,valueComparator:{type:Function,default:m.vZ},...(0,u.x$)(),...(0,i.f)()},"v-selection-control-group");(0,v.a)({name:"VSelectionControlGroup",props:{defaultsTarget:{type:String,default:"VSelectionControl"},...y()},emits:{"update:modelValue":e=>!0},setup(e,t){let{slots:l}=t;const o=(0,c.z)(e,"modelValue"),n=(0,f.sq)(),r=(0,a.Fl)((()=>e.id||`v-selection-control-group-${n}`)),i=(0,a.Fl)((()=>e.name||r.value));return(0,a.JJ)(g,{modelValue:o}),(0,s.AF)({[e.defaultsTarget]:{color:(0,d.Vh)(e,"color"),disabled:(0,d.Vh)(e,"disabled"),density:(0,d.Vh)(e,"density"),error:(0,d.Vh)(e,"error"),inline:(0,d.Vh)(e,"inline"),modelValue:o,multiple:(0,a.Fl)((()=>!!e.multiple||null==e.multiple&&Array.isArray(o.value))),name:i,falseIcon:(0,d.Vh)(e,"falseIcon"),trueIcon:(0,d.Vh)(e,"trueIcon"),readonly:(0,d.Vh)(e,"readonly"),ripple:(0,d.Vh)(e,"ripple"),type:(0,d.Vh)(e,"type"),valueComparator:(0,d.Vh)(e,"valueComparator")}}),(0,h.L)((()=>{var t;return(0,a.Wm)("div",{class:["v-selection-control-group",{"v-selection-control-group--inline":e.inline}],"aria-labelled-by":"radio"===e.type?r.value:void 0,role:"radio"===e.type?"radiogroup":void 0},[null==(t=l.default)?void 0:t.call(l)])})),{}}});var _=l(3824),w=l(2370),k=l(2385);const b=(0,p.U)({label:String,trueValue:null,falseValue:null,value:null,...y()},"v-selection-control");function C(e){const t=(0,a.f3)(g,void 0),{densityClasses:l}=(0,i.t)(e),o=(0,c.z)(e,"modelValue"),n=(0,a.Fl)((()=>void 0!==e.trueValue?e.trueValue:void 0===e.value||e.value)),r=(0,a.Fl)((()=>void 0!==e.falseValue&&e.falseValue)),u=(0,a.Fl)((()=>!!e.multiple||null==e.multiple&&Array.isArray(o.value))),s=(0,a.Fl)({get(){const l=t?t.modelValue.value:o.value;return u.value?l.some((t=>e.valueComparator(t,n.value))):e.valueComparator(l,n.value)},set(l){if(e.readonly)return;const a=l?n.value:r.value;let i=a;u.value&&(i=l?[...(0,m.FT)(o.value),a]:(0,m.FT)(o.value).filter((t=>!e.valueComparator(t,n.value)))),t?t.modelValue.value=i:o.value=i}}),{textColorClasses:d,textColorStyles:p}=(0,w.rY)((0,a.Fl)((()=>!s.value||e.error||e.disabled?void 0:e.color))),v=(0,a.Fl)((()=>s.value?e.trueIcon:e.falseIcon));return{group:t,densityClasses:l,trueValue:n,falseValue:r,model:s,textColorClasses:d,textColorStyles:p,icon:v}}const V=(0,v.e)()({name:"VSelectionControl",directives:{Ripple:_.H},inheritAttrs:!1,props:b(),emits:{"update:modelValue":e=>!0},setup(e,t){let{attrs:l,slots:r}=t;const{densityClasses:i,icon:u,model:s,textColorClasses:c,textColorStyles:p,trueValue:v}=C(e),g=(0,f.sq)(),y=(0,a.Fl)((()=>e.id||`input-${g}`)),_=(0,d.iH)(!1),w=(0,d.iH)(!1),b=(0,d.iH)();function V(e){_.value=!0,(!k.Z1||k.Z1&&e.target.matches(":focus-visible"))&&(w.value=!0)}function W(){_.value=!1,w.value=!1}function x(e){s.value=e.target.checked}return(0,h.L)((()=>{var t,d;const f=r.label?r.label({label:e.label,props:{for:y.value}}):e.label,[h,g]=(0,m.An)(l);return(0,a.Wm)("div",(0,a.dG)({class:["v-selection-control",{"v-selection-control--dirty":s.value,"v-selection-control--disabled":e.disabled,"v-selection-control--error":e.error,"v-selection-control--focused":_.value,"v-selection-control--focus-visible":w.value,"v-selection-control--inline":e.inline},i.value]},h),[(0,a.Wm)("div",{class:["v-selection-control__wrapper",c.value],style:p.value},[null==(t=r.default)?void 0:t.call(r),(0,a.wy)((0,a.Wm)("div",{class:["v-selection-control__input"]},[u.value&&(0,a.Wm)(o.t,{key:"icon",icon:u.value},null),(0,a.Wm)("input",(0,a.dG)({ref:b,checked:s.value,disabled:e.disabled,id:y.value,onBlur:W,onFocus:V,onInput:x,"aria-readonly":e.readonly,type:e.type,value:v.value,name:e.name,"aria-checked":"checkbox"===e.type?s.value:void 0},g),null),null==(d=r.input)?void 0:d.call(r,{model:s,textColorClasses:c,textColorStyles:p,props:{onFocus:V,onBlur:W,id:y.value}})]),[[(0,a.Q2)("ripple"),e.ripple&&[!e.disabled&&!e.readonly,null,["center","circle"]]]])]),f&&(0,a.Wm)(n.J,{for:y.value,clickable:!0},{default:()=>[f]})])})),{isFocused:_,input:b}}});function W(e){return(0,m.ei)(e,Object.keys(V.props))}},3104:function(e,t,l){l.d(t,{G:function(){return f}});var a=l(3396),o=l(6193),n=l(8302),r=l(3173),i=l(1710),u=l(8969),s=l(8717),c=l(4870),d=l(320),p=l(7514),m=l(9888),v=l(131);const f=(0,d.a)({name:"VSwitch",inheritAttrs:!1,props:{indeterminate:Boolean,inset:Boolean,flat:Boolean,loading:{type:[Boolean,String],default:!1},...(0,n.co)(),...(0,o.$9)()},emits:{"update:focused":e=>!0,"update:modelValue":()=>!0,"update:indeterminate":e=>!0},setup(e,t){let{attrs:l,slots:d}=t;const f=(0,s.z)(e,"indeterminate"),h=(0,s.z)(e,"modelValue"),{loaderClasses:g}=(0,i.U2)(e),{isFocused:y,focus:_,blur:w}=(0,u.K)(e),k=(0,a.Fl)((()=>"string"===typeof e.loading&&""!==e.loading?e.loading:e.color)),b=(0,p.sq)(),C=(0,a.Fl)((()=>e.id||`switch-${b}`));function V(){f.value&&(f.value=!1)}return(0,m.L)((()=>{const[t,u]=(0,v.An)(l),[s,p]=(0,n.PE)(e),[m,b]=(0,o.fU)(e),W=(0,c.iH)();function x(){var e,t;null==(e=W.value)||null==(t=e.input)||t.click()}return(0,a.Wm)(n.q8,(0,a.dG)({class:["v-switch",{"v-switch--inset":e.inset},{"v-switch--indeterminate":f.value},g.value]},t,s,{id:C.value,focused:y.value}),{...d,default:t=>{let{id:l,isDisabled:n,isReadonly:s,isValid:c}=t;return(0,a.Wm)(o.g5,(0,a.dG)({ref:W},m,{modelValue:h.value,"onUpdate:modelValue":[e=>h.value=e,V],id:l.value,type:"checkbox","aria-checked":f.value?"mixed":void 0,disabled:n.value,readonly:s.value,onFocus:_,onBlur:w},u),{...d,default:()=>(0,a.Wm)("div",{class:"v-switch__track",onClick:x},null),input:t=>{let{textColorClasses:l,textColorStyles:o}=t;return(0,a.Wm)("div",{class:["v-switch__thumb",l.value],style:o.value},[e.loading&&(0,a.Wm)(i.rD,{name:"v-switch",active:!0,color:!1===c.value?void 0:k.value},{default:e=>d.loader?d.loader(e):(0,a.Wm)(r.L,{active:e.isActive,color:e.color,indeterminate:!0,size:"16",width:"2"},null)})])}})}})})),{}}})}}]);
|
|
//# sourceMappingURL=83.37aa53f6.js.map
|