1import{r as u,aa as L,ab as A,f as C,j as e,b_ as h,b as _,z as B,y as G,D as N,aO as w,cv as T,aj as F,S as W,cw as H,cx as K,bJ as U,bB as P}from"./index-DolpDJU8.js";import{g as J}from"./index-DqmOgZvS.js";import{g as Y,G as Z,u as q,a as Q,b as V,c as X,P as ee,C as se,O as b,f as te}from"./useCurrencyConversion-BKjb6mzW.js";import{C as ae}from"./CountryFilterMulti-DEoXOIV9.js";import{C as re}from"./CityFilterMulti-BpW7MLbm.js";var le={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M811.4 418.7C765.6 297.9 648.9 212 512.2 212S258.8 297.8 213 418.6C127.3 441.1 64 519.1 64 612c0 110.5 89.5 200 199.9 200h496.2C870.5 812 960 722.5 960 612c0-92.7-63.1-170.7-148.6-193.3zm36.3 281a123.07 123.07 0 01-87.6 36.3H263.9c-33.1 0-64.2-12.9-87.6-36.3A123.3 123.3 0 01140 612c0-28 9.1-54.3 26.2-76.3a125.7 125.7 0 0166.1-43.7l37.9-9.9 13.9-36.6c8.6-22.8 20.6-44.1 35.7-63.4a245.6 245.6 0 0152.4-49.9c41.1-28.9 89.5-44.2 140-44.2s98.9 15.3 140 44.2c19.9 14 37.5 30.8 52.4 49.9 15.1 19.3 27.1 40.7 35.7 63.4l13.8 36.5 37.8 10c54.3 14.5 92.1 63.8 92.1 120 0 33.1-12.9 64.3-36.3 87.7z"}}]},name:"cloud",theme:"outlined"},ne=function(c,x){return u.createElement(L,A({},c,{ref:x,icon:le}))},oe=u.forwardRef(ne);const ie=({status:a,color:c,bgColor:x,className:r=""})=>{const{t:n}=C();return e.jsxs("span",{className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium whitespace-nowrap ${r}`,style:{color:c,backgroundColor:x},children:[e.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full shrink-0",style:{backgroundColor:c}}),n(`posOverview.status.${a}`)]})},ce=({item:a,dateStart:c,dateEnd:x,currencySymbol:r="â½",onClick:n})=>{const{t:s}=C(),o=u.useMemo(()=>Y(a.planFulfillmentPercent,c,x),[a.planFulfillmentPercent,c,x]);return e.jsxs("button",{type:"button",onClick:n,className:"w-full h-full text-left rounded-xl bg-white shadow-sm border border-borderFill/60 p-5 hover:shadow-card transition-shadow cursor-pointer",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-base font-semibold text-text01 truncate",children:a.name}),e.jsx("div",{className:"text-sm text-text02 mt-0.5",children:a.city||"â"})]}),e.jsxs("div",{className:"flex flex-col items-end gap-1.5 shrink-0",children:[e.jsx(ie,{status:o.status,color:o.color,bgColor:o.bgColor}),e.jsxs("div",{className:"flex items-center gap-1 text-xs text-text02",children:[e.jsx(oe,{className:"text-[12px]"}),e.jsx("span",{children:"â°"}),e.jsx("span",{className:"text-borderFill",children:"|"}),e.jsx("span",{children:"â"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-3 mb-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-text02 mb-1",children:s("posOverview.carsWashed")}),e.jsx("div",{className:"text-lg font-semibold text-text01",children:h(a.carsWashed)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-text02 mb-1",children:s("posOverview.revenueMtd")}),e.jsxs("div",{className:"text-lg font-semibold text-text01",children:[h(a.revenue)," ",r]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-text02 mb-1",children:s("posOverview.planCompleted")}),e.jsxs("div",{className:"text-lg font-semibold text-text01",children:[h(a.planFulfillmentPercent,"double"),"%"]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-text02 mb-1",children:s("posOverview.downtime")}),e.jsx("div",{className:"text-lg font-semibold text-text01",children:"â"})]})]}),e.jsx(Z,{goal:o,compact:!0})]})},ge=()=>{var E;const{t:a}=C(),c=_(),x=B(),[r,n]=G(),s=q(x.organizationId),o=Q(),p=s.countryId!=null,S=u.useRef(!1),y=u.useRef(!1),{data:g}=N(["get-countries"],()=>J(),{shouldRetryOnError:!1,revalidateOnFocus:!1});u.useEffect(()=>{if(S.current||!(g!=null&&g.length)||(S.current=!0,r.get("countryId")))return;const t=g.find(i=>i.id===1)??g[0];t&&w(r,n,{countryId:String(t.id),page:String(P)})},[g,r,n]),u.useEffect(()=>{if(y.current)return;if(r.get("dateStart")&&r.get("dateEnd")){y.current=!0;return}y.current=!0;const t=new Date,i=new Date(t);i.setHours(0,0,0,0);const m=new Date(t);m.setHours(23,59,0,0);const j=v=>String(v).padStart(2,"0"),I=v=>`${v.getFullYear()}-${j(v.getMonth()+1)}-${j(v.getDate())}T${j(v.getHours())}:${j(v.getMinutes())}`;w(r,n,{dateStart:I(i),dateEnd:I(m)})},[r,n]);const k=u.useMemo(()=>{var t;return p?["pos-overview-network-summary",s.dateStart,s.dateEnd,s.organizationId,s.countryId,(t=s.placementIds)==null?void 0:t.join(","),s.search]:null},[p,s]),z=u.useMemo(()=>{var t;return p?["pos-overview-network-cards",s.dateStart,s.dateEnd,s.organizationId,s.countryId,(t=s.placementIds)==null?void 0:t.join(","),s.search,s.page,s.size]:null},[p,s]),{data:d,isLoading:f,error:M}=N(k,()=>V(s),{shouldRetryOnError:!1,keepPreviousData:!0,revalidateOnFocus:!1}),{data:l,isLoading:O,error:D}=N(z,()=>X(s),{shouldRetryOnError:!1,keepPreviousData:!0,revalidateOnFocus:!1}),R=(t,i)=>{const m=new URLSearchParams(r);m.set("posName",i),m.delete("page"),m.delete("size"),m.delete("search"),c(`/station/enrollments/${t}?${m.toString()}`)},$=M||D;return e.jsxs("div",{className:"px-2 md:px-0",children:[e.jsxs("div",{className:"mb-5 flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[e.jsx("h1",{className:"text-xl sm:text-3xl font-semibold text-text01 m-0",children:a("posOverview.networkTitle")}),e.jsxs("div",{className:"flex flex-wrap items-end gap-3",children:[e.jsx(T,{className:"w-full sm:w-48"}),e.jsx(re,{countryParamKey:"countryId",className:"w-full sm:w-44",label:a("posOverview.region"),placeholder:a("posOverview.allRegions")}),e.jsx(ae,{className:"w-full sm:w-44"})]})]}),e.jsx("div",{className:"mb-5",children:e.jsx(ee,{})}),e.jsx("div",{className:"mb-5",children:e.jsx(se,{conversion:o})}),p?null:e.jsx(F,{type:"info",showIcon:!0,message:a("posOverview.selectCountry"),className:"mb-4"}),$?e.jsx(F,{type:"error",showIcon:!0,message:a("posOverview.loadError"),className:"mb-4"}):null,e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-4 gap-4 mb-6",children:[e.jsx(b,{label:a("posOverview.revenueMtd"),value:te(o.convert(d==null?void 0:d.revenue),o.displayCurrencySymbol),loading:f,delta:"â"}),e.jsx(b,{label:a("posOverview.carsWashed"),value:h(d==null?void 0:d.carsWashed),loading:f,delta:"â"}),e.jsx(b,{label:a("posOverview.planFulfillment"),value:`${h(d==null?void 0:d.planFulfillmentPercent,"double")}%`,loading:f,delta:"â"}),e.jsx(b,{label:a("posOverview.downtimeMonth"),value:"â",loading:f,delta:"â"})]}),e.jsx(W,{spinning:O,children:!O&&(!(l!=null&&l.items)||l.items.length===0)?e.jsx(H,{description:a("table.noData"),className:"py-12"}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-4",children:(E=l==null?void 0:l.items)==null?void 0:E.map(t=>e.jsx(ce,{item:{...t,revenue:o.convert(t.revenue)??t.revenue},dateStart:s.dateStart,dateEnd:s.dateEnd,currencySymbol:o.displayCurrencySymbol,onClick:()=>R(t.id,t.name)}
1,t.id))})}),((l==null?void 0:l.totalCount)??0)>0?e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx(K,{current:s.page,pageSize:s.size,total:(l==null?void 0:l.totalCount)??0,showSizeChanger:!0,pageSizeOptions:U,onChange:(t,i)=>{w(r,n,{page:t,size:i})},onShowSizeChange:(t,i)=>{w(r,n,{page:P,size:i})}})}):null]})};export{ge 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.