1import{a as k,g as E,c as Y,r as f,u as x,f as A,h as e,F as $,k as u,l as B,w as r,i as L,b as m,p as y,j as v,s as q,q as V,t as a,x as H,M as F,y as Z,z as ee}from"./index-CzH99PD7.js";import{T as R,_ as j,g as S}from"./json-SyoUj7mP.js";import{T as I,M as z}from"./NModalDialog-BkqdOFNH.js";import{P as d,T as b,_ as oe}from"./toastr-DA6SloTT.js";import{u as te}from"./roleHelper-CcZjDSHv.js";import{r as G}from"./recalculate.api-nMlhrwWq.js";const D={globalRecalculate:le,getGlobalRecalculations:ae,getGlobalRecalculation:se,approveDeclineGlobalRecalculation:re};function le(_){return k.post(`${E().atBerthApiUrl}/v1/global/scores/recalculate`,{shipId:_})}function ae(){return k.get(`${E().atBerthApiUrl}/v1/global/scores/recalculate/overview`)}function se(_){return k.get(`${E().atBerthApiUrl}/v1/global/scores/recalculate/${_}`)}function re(_,O){return k.put(`${E().atBerthApiUrl}/v1/global/scores/recalculate/${_}?approved=${O}`)}const l=_=>(Z("data-v-33835e5f"),_=_(),ee(),_),ne={key:0,class:"page-container core"},ce=l(()=>e("div",{class:"page-title-container"},[e("h2",{class:"page-title"},"Score Recalculation")],-1)),ie={class:"main-container"},ue=l(()=>e("h3",null,"Core Recalculation requests",-1)),de={class:"esi-table-container"},he={class:"esi-table-content-container"},_e=l(()=>e("th",{width:"250"},null,-1)),ve={"data-valuekey":"name"},Se={"data-valuekey":"name"},be={"data-valuekey":"name"},pe=["onClick"],ge=["src"],fe=l(()=>e("br",null,null,-1)),me=l(()=>e("br",null,null,-1)),ye=l(()=>e("h3",null,"Global Recalculation requests",-1)),Re={class:"esi-table-container"},Ie={class:"esi-table-content-container"},Ee=l(()=>e("th",{width:"250"},null,-1)),Ne={"data-valuekey":"name"},we={"data-valuekey":"name"},xe={"data-valuekey":"name"},Ae=["onClick"],ke=["src"],Oe=l(()=>e("h4",null,"Current Scores",-1)),Ce={class:"esi-table-content-container"},Me=l(()=>e("th",null,"NOx",-1)),$e=l(()=>e("th",null,"NOx Aux",-1)),Ge=l(()=>e("th",null,"NOx Prop",-1)),De=l(()=>e("th",null,"SOx",-1)),Te=l(()=>e("th",null,"GHG",-1)),Ue=l(()=>e("th",null,"INN",-1)),Pe=l(()=>e("th",null,"ESI CORE",-1)),Be=l(()=>e("th",null,"ESI NOISE",-1)),Le=l(()=>e("th",null,"URN",-1)),qe=l(()=>e("br",null,null,-1)),Ve=l(()=>e("h4",null,"Recalculated Scores",-1)),He={class:"esi-table-content-container"},Fe=l(()=>e("th",null,"NOx",-1)),je=l(()=>e("th",null,"NOx Aux",-1)),ze=l(()=>e("th",null,"NOx Prop",-1)),Ke=l(()=>e("th",null,"SOx",-1)),Je=l(()=>e("th",null,"GHG",-1)),Qe=l(()=>e("th",null,"INN",-1)),We=l(()=>e("th",null,"ESI CORE",-1)),Xe=l(()=>e("th",null,"ESI NOISE",-1)),Ye=l(()=>e("th",null,"URN",-1)),Ze=["disabled"],eo=l(()=>e("h4",null,"Current Scores",-1)),oo={class:"esi-table-content-container"},to=l(()=>e("th",null,"NOx",-1)),lo=l(()=>e("th",null,"SOx",-1)),ao=l(()=>e("th",null,"CO2",-1)),so=l(()=>e("th",null,"OPS",-1)),ro=l(()=>e("th",null,"ESI AIR",-1)),no=l(()=>e("th",null,"ESI NOISE",-1)),co=l(()=>e("br",null,null,-1)),io=l(()=>e("h4",null,"Recalculated Scores",-1)),uo={class:"esi-table-content-container"},ho=l(()=>e("th",null,"NOx",-1)),_o=l(()=>e("th",null,"SOx",-1)),vo=l(()=>e("th",null,"CO2",-1)),So=l(()=>e("th",null,"OPS",-1)),bo=l(()=>e("th",null,"ESI AIR",-1)),po=l(()=>e("th",null,"ESI NOISE",-1)),go=["disabled"],fo=Y({__name:"ScoreRecalculationOverview",setup(_){const{isAdmin:O}=te(),K=window.shared.sessionStorage.state.user.user.userId||0,p=f([]),N=f(),c=f(),g=f([]),w=f(),i=f();function T(s){return s!==K}const J=async()=>{const s=t=>b.error(t);d.show("Loading recalculations...",!0);try{const t=await G.getRecalculations();if(t.hasErrors)s(t.errorMessage);else{const o=[];t.body.forEach(n=>{o.push(n)}),p.value=o}}catch{s(m.messages.internalServerError)}finally{d.hide()}},C=(s,t,o)=>{p.value.sort((n,h)=>t==="asc"?(S(n,s)?.toString()||"").localeCompare(S(h,s)?.toString()||"","en",{numeric:o}):t==="desc"?(S(h,s)?.toString()||"").localeCompare(S(n,s)?.toString()||"","en",{numeric:o}):0)},Q=async s=>{const t=o=>b.error(o);d.show("Loading recalculation...",!0);try{const o=await G.getRecalculation(s);o.hasErrors?t(o.errorMessage):(c.value=o.body,N.value.openModalDialog())}catch(o){console.error(o),t(m.messages.internalServerError)}finally{d.hide()}},U=async(s,t)=>{const o=n=>b.error(n);if(confirm(`Are you sure you want to ${t?"approve":"decline"} the recalculation?`)){d.show(`${t?"Approving":"Declining"} recalculation...`,!0);try{const n=await G.approveDeclineRecalculation(s,t);n.hasErrors?o(n.errorMessage):(b.success(`Recalculation is ${t?"approved":"declined"}`),p.value=p.value.filter(h=>h.id!==s))}catch{o(m.messages.internalServerError)}finally{d.hide(),N?.value.closeModalDialog()}}},W=async()=>{const s=t=>b.error(t);d.show("Loading global recalculations...",!0);try{const t=await D.getGlobalRecalculations();if(t.hasErrors)s(t.errorMessage);else{const o=[];t.body.forEach(n=>{o.push(n)}),g.value=o}}catch{s(m.messages.internalServerError)}finally{d.hide()}},M=(s,t,o)=>{g.value.sort((n,h)=>t==="asc"?(S(n,s)?.toString()||"").localeCompare(S(h,s)?.toString()||"","en",{numeric:o}):t==="desc"?(S(h,s)?.toString()||"").localeCompare(S(n,s)?.toString()||"","en",{numeric:o}):0)},X=async s=>{const t=o=>b.error(o);d.show("Loading global recalculation...",!0);try{const o=await D.getGlobalRecalculation(s);o.hasErrors?t(o.errorMessage):(i.value=o.body,w.value.openModalDialog())}catch(o){console.error(o),t(m.messages.internalServerError)}finally{d.hide()}},P=async(s,t)=>{const o=n=>b.error(n);if(confirm(`Are you sure you want to ${t?"approve":"decline"} the recalculation?`)){d.show(`${t?"Approving":"Declining"} recalculation...`,!0);try{const n=await D.approveDeclineGlobalRecalculation(s,t);n.hasErrors?o(n.errorMessage):(b.success(`Recalculation is ${t?"approved":"declined"}`),g.value=g.value.filter(h=>h.id!==s))}catch{o(m.messages.internalServerError)}finally{d.hide(),w?.value.closeModalDialog()}}};return J(),W(),(s,t)=>x(O)?(y(),A("div",ne,[ce,e("div",ie,[x(E)().enableCore?(y(),A($,{key:0},[ue,e("div",de,[e("div",he,[u(I,{class:"esi-table esi-table--main",id:"recalculationTable"},B({header:r(()=>[u(R,{sortable:"",onSort:t[0]||(t[0]=o=>C("shipName",o,!1))},{default:r(()=>[v("Ship Name ")]),_:1}),u(R,{sortable:"",onSort:t[1]||(t[1]=o=>C("shipImo",o,!1))},{default:r(()=>[v("IMO")]),_:1}),u(R,{sortable:"",onSort:t[2]||(t[2]=o=>C("status",o,!1))},{default:r(()=>[v("Requester ")]),_:1}
1),_e]),body:r(()=>[(y(!0),A($,null,q(p.value,(o,n)=>(y(),V(j,{clickable:!0,"data-row":n},{default:r(()=>[e("td",ve,a(o.shipName),1),e("td",Se,a(o.shipImo),1),e("td",be,a(o.adminUserName),1),e("td",null,[e("button",{onClick:H(h=>Q(o.id??0),["stop","prevent"]),class:"cancel-link"},[e("img",{class:"action-icon",src:`${x(F)()}/assets/icons/search.svg`,alt:"Overview"},null,8,ge)],8,pe)])]),_:2},1032,["data-row"]))),256))]),_:2},[p.value.length===0?{name:"caption",fn:r(()=>[v("No Items available.")]),key:"0"}:void 0]),1024)])]),fe,me],64)):L("",!0),ye,e("div",Re,[e("div",Ie,[u(I,{class:"esi-table esi-table--main",id:"globalRecalculationTable"},B({header:r(()=>[u(R,{sortable:"",onSort:t[3]||(t[3]=o=>M("shipName",o,!1))},{default:r(()=>[v("Ship Name ")]),_:1}),u(R,{sortable:"",onSort:t[4]||(t[4]=o=>M("shipImo",o,!1))},{default:r(()=>[v("IMO")]),_:1}),u(R,{sortable:"",onSort:t[5]||(t[5]=o=>M("status",o,!1))},{default:r(()=>[v("Requester ")]),_:1}),Ee]),body:r(()=>[(y(!0),A($,null,q(g.value,(o,n)=>(y(),V(j,{clickable:!0,"data-row":n},{default:r(()=>[e("td",Ne,a(o.shipName),1),e("td",we,a(o.shipImo),1),e("td",xe,a(o.adminUserName),1),e("td",null,[e("button",{onClick:H(h=>X(o.id??0),["stop","prevent"]),class:"cancel-link"},[e("img",{class:"action-icon",src:`${x(F)()}/assets/icons/search.svg`,alt:"Overview"},null,8,ke)],8,Ae)])]),_:2},1032,["data-row"]))),256))]),_:2},[g.value.length===0?{name:"caption",fn:r(()=>[v("No Items available.")]),key:"0"}:void 0]),1024)])])]),u(z,{ref_key:"recalculationModal",ref:N,id:"recalculationModal"},{header:r(()=>[e("h3",null,"Score Recalculation for "+a(c.value?.shipName)+" ("+a(c.value?.shipImo)+") ",1)]),body:r(()=>[Oe,e("div",Ce,[u(I,{class:"esi-table esi-table--feature",id:"currentScoresTable"},{header:r(()=>
1[Me,$e,Ge,De,Te,Ue,Pe,Be,Le]),body:r(()=>[e("tr",null,[e("td",null,a(c.value?.currentAirScore?.noxScore),1),e("td",null,a(c.value?.currentAirScore?.noxAuxiliaryScore),1),e("td",null,a(c.value?.currentAirScore?.noxPropulsionScore),1),e("td",null,a(c.value?.currentAirScore?.soxScore),1),e("td",null,a(c.value?.currentAirScore?.ghgScore),1),e("td",null,a(c.value?.currentAirScore?.innovationScore),1),e("td",null,a(c.value?.currentAirScore?.esiScore),1),e("td",null,a(c.value?.currentNoiseScore?.noiseScore),1),e("td",null,a(c.value?.currentUwnScore),1)])]),_:1})]),qe,Ve,e("div",He,[u(I,{class:"esi-table esi-table--feature",id:"recalculatedScoresTable"},{header:r(()=>[Fe,je,ze,Ke,Je,Qe,We,Xe,Ye]),body:r(()=>[e("tr",null,[e("td",null,a(c.value?.airScore?.noxScore),1),e("td",null,a(c.value?.currentAirScore?.noxAuxiliaryScore),1),e("td",null,a(c.value?.currentAirScore?.noxPropulsionScore),1),e("td",null,a(c.value?.airScore.soxScore),1),e("td",null,a(c.value?.airScore?.ghgScore),1),e("td",null,a(c.value?.airScore?.innovationScore),1),e("td",null,a(c.value?.airScore?.esiScore),1),e("td",null,a(c.value?.noiseScore?.noiseScore),1),e("td",null,a(c.value?.uwnScore),1)])]),_:1})])]),footer:r(()=>[e("button",{class:"button-esi main",onClick:t[6]||(t[6]=o=>U(c.value?.id??0,!0)),disabled:!T(c.value?.adminUserId??0)},"Approve",8,Ze),e("button",{class:"button-esi main",onClick:t[7]||(t[7]=o=>U(c.value?.id??0,!1))},"Decline"),e("button",{class:"button-esi cancel-link",onClick:t[8]||(t[8]=o=>N.value?.closeModalDialog())},"Close")]),_:1},512),u(z,{ref_key:"globalRecalculationModal",ref:w,id:"globalRecalculationModal"},{header:r(()=>[e("h3",null,"Score Recalculation for "+a(i.value?.shipName)+" ("+a(i.value?.shipImo)+") ",1)]),body:r(()=>[eo,e("div",oo,[u(I,{class:"esi-table esi-table--feature",id:"currentGlobalScoresTable"},{header:r(()=>[to,lo,ao,so,ro,no]),body:r(()=>[e("tr",null,[e("td",null,a(i.value?.currentAirScore?.noxScore),1),e("td",null,a(i.value?.currentAirScore?.soxScore),1),e("td",null,a(i.value?.currentAirScore?.co2Score),1),e("td",null,a(i.value?.currentAirScore?.opsScore),1),e("td",null,a(i.value?.currentAirScore?.esiScore),1),e("td",null,a(i.value?.currentNoiseScore),1)])]),_:1})]),co,io,e("div",uo,[u(I,{class:"esi-table esi-table--feature",id:"recalculatedGlobalScoresTable"},{header:r(()=>[ho,_o,vo,So,bo,po]),body:r(()=>[e("tr",null,[e("td",null,a(i.value?.airScore?.noxScore),1),e("td",null,a(i.value?.airScore?.soxScore),1),e("td",null,a(i.value?.airScore?.co2Score),1),e("td",null,a(i.value?.airScore?.o
1psScore),1),e("td",null,a(i.value?.airScore?.esiScore),1),e("td",null,a(i.value?.noiseScore),1)])]),_:1})])]),footer:r(()=>[e("button",{class:"button-esi main",onClick:t[9]||(t[9]=o=>P(i.value?.id??0,!0)),disabled:!T(i.value?.adminUserId??0)},"Approve",8,go),e("button",{class:"button-esi main",onClick:t[10]||(t[10]=o=>P(i.value?.id??0,!1))},"Decline"),e("button",{class:"button-esi cancel-link",onClick:t[11]||(t[11]=o=>w.value?.closeModalDialog())},"Close")]),_:1},512)])):L("",!0)}}),wo=oe(fo,[["__scopeId","data-v-33835e5f"]]);export{wo as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.