PageSourceSearch

https://en.conteb2b.com/assets/_id-CE0lzbeh.js

js conteb2b.com collected 2026-10-09 17:03:57 UTC 29,699 bytes, 1 lines download raw bytes

1import{r as j,u as s,bp as Ie,ad as Be,bR as ze}from"./vendor-zwMyrWV7.js";import{d as We}from"./vendor-tanstack-xXnKmKlY.js";import{g as ke}from"./order-D2PT9jez.js";import{S as Ne}from"./storePriceVatMode-C9s5KlZW.js";import{p as Te,Z as le,_ as oe,$ as I,aU as Ke,aV as $e,L as Pe,a3 as B,bu as De,a_ as ve,bg as we,B as z,b0 as Ve,b2 as Fe,a$ as Ge,b as ce,ax as Le,y as Ue,P as D,a as Qe,S as He,bK as qe,u as Xe,k as R,U as v,bc as Ze,Q as Je,bi as Ye}from"./index-D1efGhhH.js";import{O as W,I as P,d as _e,b as es,g as ss}from"./orderStatusConfig-GPrj3JBx.js";import{u as S}from"./vendor-i18n-CdOuSghu.js";import{P as ts}from"./PriceBlock-DBBrmy77.js";import{u as as,B as ns}from"./useTable-CIJa25rY.js";import{E as ls}from"./ExpandGroupCell-COnJMnsQ.js";import"./vendor-socket-BXkti3oS.js";import"./vendor-phone-D1XSQJZP.js";const os=(e,a,t)=>t&&a?e*(1+a/100):e,ie=(e,a)=>{const t=e.attributes;if(!Array.isArray(t))return null;const l=t.find(c=>c.key===a);return!l||l.value==null?null:l.type==="float"||l.type==="int"?String(l.value):String(l.value).trim()||null},cs=e=>{var o,c,d,u,i;const a=Fe(e);if(a.length>0)return{displayItem:a[0],hasMedia:!0,allMedia:a};const t=((o=e.images)==null?void 0:o.thump_1)||((c=e.images)==null?void 0:c.thumb_2)||((d=e.images)==null?void 0:d.thump_2)||((u=e.images)==null?void 0:u.original)||"",l=((i=e.images)==null?void 0:i.original)||"";if(t||l){const r={type:"photo",thumbnail:t,original:l};return{displayItem:r,hasMedia:!0,allMedia:[r]}}return{displayItem:null,hasMedia:!1,allMedia:[]}},is=({item:e})=>{const{displayItem:a,hasMedia:t,allMedia:l}=cs(e),[o,c]=j.useState(!1),d=s.jsx("div",{className:"h-10 shrink-0 aspect-3/4",children:a?s.jsx(ve,{item:a,playIconSize:"xs",className:"h-10 shrink-0 aspect-3/4 rounded-sm ring-1 ring-transparent transition-colors hover:ring-primary",...we}):s.jsx("img",{src:Ge,className:"h-10 w-full aspect-3/4 object-cover overflow-hidden rounded-sm",alt:""})});return t?s.jsxs(s.Fragment,{children:[s.jsx(De,{triggerEvent:"hover",openDelay:300,trigger:d,triggerProps:{asChild:!0},contentProps:{side:"right",align:"center",className:"p-1.5 w-fit"},children:s.jsxs("div",{className:"relative",children:[s.jsx(ve,{item:a,playIconSize:"sm",sizePriority:"full",className:"w-52 aspect-3/4 overflow-hidden rounded-md",...we}),s.jsx(z,{variant:"glass",size:"icon",className:"absolute top-1 right-1 size-6",onClick:()=>c(!0),children:s.jsx(Ie,{className:"size-3.5"})})]})}),o&&s.jsx(Ve,{items:l,initialIndex:0,onClose:()=>c(!1)})]}):d},rs="[--row-bg:color-mix(in_oklch,var(--color-error)_10%,white)] hover:[--row-bg:color-mix(in_oklch,var(--color-error)_10%,white)]",ds="[--row-bg:color-mix(in_oklch,var(--color-warning)_10%,white)] hover:[--row-bg:color-mix(in_oklch,var(--color-warning)_10%,white)]",Ce=({key:e})=>({accessorKey:e,header:()=>null,meta:{fit:!0,columnProps:{minWidth:"32px",width:"32px",maxWidth:"32px"},groupCell:null},cell:()=>null}),us=e=>({accessorKey:"_num",header:()=>s.jsx("span",{className:"text-conte-body-m text-secondary-foreground",children:"#"}),meta:{fit:!0,columnProps:{maxWidth:"min-content"},cellProps:{className:"justify-center"},headerProps:{className:"justify-center"},groupCell:null},cell:({row:a})=>s.jsx("span",{className:"text-conte-body-s text-secondary-foreground",children:a.index+1})}),ms=e=>({accessorKey:"_photo",header:()=>s.jsx("span",{className:"text-conte-body-m text-secondary-foreground",children:e.t("orders.order.table.photo")}),meta:{fit:!0,columnProps:{maxWidth:"min-content"},cellProps:{className:"justify-center"},headerProps:{className:"justify-center"},groupCell:null},cell:({row:a})=>s.jsx(is,{item:a.original})}),ps=e=>({accessorKey:"skuMf",header:()=>s.jsx("span",{className:"text-conte-body-m text-secondary-foreground whitespace-nowrap",children:e.t("orders.order.table.sku_mf")}),meta:{fit:!0,columnProps:{maxWidth:"min-content"},cellProps:{className:"justify-center"},headerProps:{className:"justify-center"},groupCell:null},cell:({row:a})=>{var l;const t=a.original;return s.jsx("span",{className:"text-conte-body-s text-muted-foreground truncate max-w-32",children:(l=t.skuMf)!=null?l:"—"})}}),hs=e=>({accessorKey:"code",header:()=>s.jsx(le,{value:e.codeSwitcher,onValueChange:a=>{a&&a!==e.codeSwitcher&&e.updateSetting({codeSwitcher:a})},children:s.jsxs(oe,{variant:"button",rounded:"md",size:"icon",children:[s.jsx(I,{title:e.t("orders.order.table.barcode"),value:"barcode",children:s.jsx(Ke,{})}),s.jsx(I,{title:e.t("orders.order.table.sku"),value:"sku",children:s.jsx($e,{strokeWidth:1})})]})}),meta:{fit:!0,columnProps:{maxWidth:"min-content"},cellProps:{className:"justify-center"},headerProps:{className:"justify-center"},groupCell:null},cell:({row:a})=>{const t=a.original,{sku:l,barcode:o,barcodes:c}=t,d=c?c.length>1?c:[o]:[o],u=e.codeSwitcher==="barcode"?s.jsx("div",{className:"flex flex-col",children:d.filter(
1Boolean).map(i=>s.jsx("span",{children:i},i))}):l;return s.jsx("span",{className:"text-conte-body-s text-muted-foreground truncate max-w-40",children:u!=null?u:"—"})}}),xs=e=>({accessorKey:"name",enableHiding:!1,header:()=>s.jsx("span",{className:"text-conte-body-m text-secondary-foreground",children:e.t("orders.order.table.name")}),meta:{columnProps:{minWidth:200},cellProps:{className:"w-full justify-start"},headerProps:{className:"justify-start"},groupCell:({row:a,table:t})=>{const o=(a.original.category||a.original.type||"").split(">").map(c=>c.trim()).filter(Boolean).reverse().join(" / ");return s.jsx(ls,{row:a,table:t,className:"text-secondary-foreground",children:s.jsx("span",{className:"text-conte-button-xs",children:o})})}},cell:({row:a})=>{var o;const t=a.original,l=t.catalogLink;return s.jsx(Pe,{to:l,rel:"noreferrer",variant:"secondary",className:"text-conte-body-s line-clamp-2 text-left",children:(o=t.name)!=null?o:"—"})}}),gs=e=>({accessorKey:"color",header:()=>s.jsx("span",{className:"text-conte-body-m text-secondary-foreground",children:e.t("orders.order.table.color")}),meta:{columnProps:{minWidth:100},cellProps:{className:"justify-start"},headerProps:{className:"justify-start"},groupCell:null},cell:({row:a})=>{var l;const t=a.original;return s.jsxs("div",{className:"flex items-center gap-1.5",children:[t.colorSrc&&s.jsx("img",{src:t.colorSrc,alt:t.color,className:"h-8 w-6 object-cover rounded-sm shrink-0"}),s.jsx("span",{className:"text-conte-body-s text-primary-black wrap-break-word",children:(l=t.color)!=null?l:"—"})]})}}),fs=e=>({accessorKey:"patternCode",header:()=>s.jsx("span",{className:"text-conte-body-m text-secondary-foreground",children:e.t("orders.order.table.figure")}),meta:{columnProps:{minWidth:80},cellProps:{className:"justify-center"},headerProps:{className:"justify-center"},groupCell:null},cell:({row:a})=>{var t;return s.jsx("span",{className:"text-conte-body-s text-primary-black",children:(t=a.original.patternCode)!=null?t:"—"})}}),ys=e=>({accessorKey:"size",header:()=>s.jsx("span",{className:"text-conte-body-m text-secondary-foreground",children:e.t("orders.order.table.size")}),meta:{columnProps:{minWidth:100},cellProps:{className:"justify-center"},headerProps:{className:"justify-center"},groupCell:null},cell:({row:a})=>{var t;return s.jsx("span",{className:"text-conte-body-m text-primary-black wrap-break-word",children:(t=a.original.size)!=null?t:"—"})}}),js=e=>({accessorKey:"count",enableHiding:!1,header:()=>s.jsx("span",{className:"text-conte-button-m text-primary-black",children:e.t("orders.order.table.count")}),meta:{columnProps:{minWidth:80,width:"max-content"},cellProps:{className:"justify-center"},headerProps:{className:"justify-center"},groupCell:null},cell:({row:a})=>{const{count:t,oldCount:l}=a.original,c=l!=null&&l>0&&l!==t?l:t;return s.jsx("span",{className:"text-conte-button-m text-primary-black",children:c!=null?c:"—"})}}),bs=e=>({accessorKey:"_reserve",header:()=>s.jsx("span",{className:"text-conte-button-m text-primary-black",children:e.t("orders.order.table.reserve")}),meta:{fit:!0,columnProps:{maxWidth:"min-content"},cellProps:{className:"justify-center"},headerProps:{className:"justify-center"},groupCell:null},cell:({row:a})=>{const{count:t,oldCount:l}=a.original,o=l!=null&&l>0&&l!==t;return s.jsx("span",{className:"text-conte-button-m text-primary-black",children:o&&t!=null?t:"—"})}}),Ns=e=>({accessorKey:"_total",enableHiding:!1,header:()=>s.jsxs("span",{className:"text-conte-button-m text-primary-black",children:[e.t("orders.order.table.amount"),e.currency&&", ".concat(e.currency)]}),meta:{columnProps:{minWidth:90,width:"max-content"},cellProps:{className:"w-full justify-end"},headerProps:{className:"justify-end"},groupCell:null},cell:({row:a})=>{const{amount:t}=a.original;return t==null?s.jsx("span",{className:"text-muted-foreground",children:"—"}):s.jsx("span",{className:"text-conte-button-m text-primary-black",children:B(t,{precision:2})})}}),vs=e=>({accessorKey:"_sort",header:()=>s.jsx("span",{className:"text-conte-body-m text-secondary-foreground",children:e.t("orders.cart.table.sort")}),meta:{columnProps:{minWidth:100},groupCell:null},cell:({row:a})=>{const t=ie(a.original,"grade");return s.jsx("span",{className:"text-conte-body-s text-primary-black wrap-break-word",children:t!=null?t:"—"})}}),ws=e=>({accessorKey:"_container",header:()=>s.jsx("span",{className:"text-conte-body-m text-secondary-foreground",children:e.t("orders.cart.table.container")}),meta:{columnProps:{minWidth:90},cellProps:{className:"justify-center"},headerProps:{className:"justify-center"},groupCell:null},cell:({row:a})=>{const t=ie(a.original,"container");return s.jsx("span",{className:"text-conte-body-m text-primary-black wrap-break-word",children:t!=null?t:"—"})}}),Cs=e=>({accessorKey:"_volume",header:()=>s.jsx("span",{className:"text-conte-body-m text-secondary-foreground",children:e.t("orders.cart.table.volume")}),meta:{columnProps:{minWidth:80},cellProps:{className:"justify-center"},headerProps:{className:"justify-center"},groupCell:null},cell:({row:a})=>{const t=ie(a.original,"volume");return s.jsx("span",{className:"text-conte-body-m text-primary-black",children:t!=null?t:"—"})}}),ks=e=>({accessorKey:"price",enableHiding:!1,header:()=>s.jsxs("span",{className:"text-conte-button-m text-primary-black text-nowrap",children:[e.withVat?e.t("orders.cart.table.price_vat"):e.t("orders.cart.table.price_no_vat"),e.currency&&", ".concat(e.currency)]}),meta:{columnProps:{minWidth:160,width:"max-content"},cellProps:{className:"min-w-40 w-full justify-end"},headerProps:{className:"justify-end"},groupCell:null},cell:({row:a})=>{var o;const t=a.original,l=os((o=t.price)!=null?o:0,t.vatRate,e.withVat);return s.jsx(ts,{price:l,precision:2,className:"ml-auto"})}}),Ps=e=>[Ce({key:"left_empty"}),us(),ps(e),hs(e),ms(e),xs(e),e.isAlivaria?vs(e):gs(e),e.isAlivaria?ws(e):fs(e),e.isAlivaria?Cs(e):ys(e),js(e),...e.hasQuantityMismatch?[bs(e)]:[],...e.isAlivaria?[ks(e)]:[],Ns(e),Ce({key:"right_empty"})],_s=({items:e,isLoading:a,settings:t,onSettingChange:l,currency:o="",hasQuantityMismatch:c=!1,withVat:d=!1})=>{const{t:u}=S("orders"),i=Te.id==="alivaria",r=n=>l(n),m=j.useMemo(()=>t.showChangedOnly?e.filter(n=>n.oldCount!=null&&n.oldCount>0&&n.oldCount!==n.count):e,[e,t.showChangedOnly]),f=j.useMemo(()=>Ps({codeSwitcher:t.codeSwitcher,updateSetting:r,t:u,currency:o,hasQuantityMismatch:c,withVat:d,isAlivaria:i}),[t.codeSwitcher,o,u,c,d,i]),x=j.useMemo(()=>
1{if(!t.groupByCategory)return[];const n=new Map;return m.forEach(g=>{const C=g.category||g.type||u("orders.cart.misc");n.has(C)||n.set(C,[]),n.get(C).push(g)}),Array.from(n.entries()).map(([g,C])=>({id:g,headerData:{category:g},items:C,collapsible:!0,defaultCollapsed:!1}))},[m,t.groupByCategory,u]),{table:h,expandHandler:b,layout:w}=as({groups:t.groupByCategory?x:void 0,data:t.groupByCategory?void 0:m,columns:f,groupRow:t.groupByCategory}),N=j.useCallback(n=>{var T,K;if((T=n.original)!=null&&T.__isGroupRow)return;const g=n.original,C=(K=g.count)!=null?K:0,V=g.oldCount!=null&&g.oldCount>0&&g.oldCount!==g.count;if(C===0)return rs;if(V)return ds},[]);return s.jsx(ns,{mobileView:!1,table:h,isLoading:a,className:"border-b border-border",classNames:{header:"border-t-0",groupRow:"px-8 py-2 bg-card",groupCell:"rounded-md"},layout:w,expandHandler:b,getRowClassName:N,empty:s.jsx("span",{className:"text-conte-input text-muted-foreground",children:u("common:common.table.empty.message")})})},Ss=({statusCode:e,isAdmin:a,onConfirm:t,onCancel:l})=>{const{t:o}=S("orders"),c="order.reserve.".concat(e,".title"),d=e==="processing"&&a?"orders.order.reserve.processing.description_admin":"order.reserve.".concat(e,".description"),u=e!=="processing",i=e!=="processing"||a;return s.jsx(W,{title:o(c),children:s.jsxs("div",{className:"flex flex-col gap-3",children:[s.jsx("p",{className:"text-conte-body-l text-primary-black",children:o(d)}),s.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[i&&s.jsx(z,{size:"md",color:"destructive",className:"rounded-full px-6",onClick:l,children:o("orders.order.action.cancel")}),u&&s.jsx(z,{color:"black",size:"md",className:"rounded-full px-6",onClick:t,children:o("orders.order.action.confirm")})]})]})})},{orderChangeBoxLabel:As}=ke(),Os=({orderId:e,boxlabel:a,readonly:t,className:l})=>{const{t:o}=S("orders"),[c,d]=j.useState(a!=null?a:""),[u,i]=j.useState(null),r=j.useRef(a!=null?a:""),{mutateAsync:m,isPending:f}=ce({mutationKey:["order-boxlabel-save",e],mutationFn:h=>As({id:e,boxlabel:h}),errorFn:()=>i(o("orders.order.info.boxlabel_error"))}),x=async()=>{t||c===r.current||(i(null),await m(c),r.current=c)};return s.jsx(W,{title:o("orders.order.info.boxlabel"),className:l,children:s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx(Le,{value:c,onChange:h=>{d(h.target.value),u&&i(null)},onBlur:x,readOnly:t,disabled:f,size:"md",maxLength:20,error:!!u,placeholder:t?void 0:o("orders.order.info.boxlabel_placeholder")}),u&&s.jsx(Ue,{children:u})]})})},Ms=({comment:e,isPending:a,className:t})=>{const{t:l}=S("orders");return!a&&!e?null:s.jsx(W,{title:l("orders.order.comment.title"),className:t,children:a?s.jsx(D,{className:"h-16 w-full"}):s.jsx("p",{className:"text-conte-body-m text-primary-black",children:e})})},Es=({order:e,isPending:a,currency:t,positionsLabel:l,showClient:o,showManager:c,showStore:d,showStoreLink:u,className:i})=>{var m,f,x,h,b,w,N,n,g,C,V,T,K,$,H,q,X,Z,J,k,Y,ee,se,te,ae,ne,A,L,U,F,O;const{t:r}=S("orders");return s.jsx(W,{title:r("orders.order.info.title"),className:i,classNames:{body:"flex-1"},children:a?s.jsx("div",{className:"flex flex-col gap-4",children:Array.from({length:8}).map((G,M)=>s.jsxs("div",{className:"grid grid-cols-[180px_1fr] gap-4",children:[s.jsx(D,{className:"h-4 w-32"}),s.jsx(D,{className:"h-4 w-48"})]},M))}):s.jsx("div",{className:"h-full flex flex-col justify-between gap-4 sm:grid sm:grid-cols-[min(180px,40%)_1fr] sm:content-between",children:s.jsxs("div",{className:"flex flex-col gap-5 sm:col-span-full sm:grid sm:grid-cols-subgrid sm:gap-y-4",children:[s.jsx(P,{label:r("orders.order.info.organization"),value:(m=e==null?void 0:e.company)==null?void 0:m.name,to:(f=e==null?void 0:e.client)!=null&&f.isAccess?"/users/".concat((x=e==null?void 0:e.client)==null?void 0:x.id,"/companies/").concat((h=e==null?void 0:e.company)==null?void 0:h.id):void 0}),s.jsx(P,{label:r("orders.order.info.address"),value:(b=e==null?void 0:e.address)!=null&&b.place&&((w=e==null?void 0:e.address)!=null&&w.data)?"".concat(e.address.place," (").concat(e.address.data,")"):((N=e==null?void 0:e.address)==null?void 0:N.place)||((n=e==null?void 0:e.address)==null?void 0:n.data)}),s.jsx(P,{label:r("orders.order.info.client"),value:(g=e==null?void 0:e.client)==null?void 0:g.fullName,show:o&&!!((C=e==null?void 0:e.client)!=null&&C.fullName),to:(V=e==null?void 0:e.client)!=null&&V.isAccess?"/users/".concat((T=e==null?void 0:e.client)==null?void 0:T.id):void 0}),s.jsx(P,{label:r("orders.order.info.manager"),value:(K=e==null?void 0:e.manager)==null?void 0:K.fullName,show:c&&!!(($=e==null?void 0:e.manager)!=null&&$.fullName),to:(H=e==null?void 0:e.manager)!=null&&H.isAccess?"/users/".concat((q=e==null?void 0:e.manager)==null?void 0:q.id):void 0}),s.jsx(P,{label:r("orders.order.info.client_manager"),value:(Z=(X=e==null?void 0:e.managers)==null?void 0:X.find(G=>{var M;return G.id!==((M=e==null?void 0:e.manager)==null?void 0:M.id)}
1))==null?void 0:Z.fullName,show:c&&!!((J=e==null?void 0:e.managers)!=null&&J.find(G=>{var M;return G.id!==((M=e==null?void 0:e.manager)==null?void 0:M.id)}))}),s.jsx(P,{label:r("orders.order.info.type"),value:(k=e==null?void 0:e.type)==null?void 0:k.name}),s.jsx(P,{label:r("orders.order.info.store"),value:(Y=e==null?void 0:e.store)==null?void 0:Y.name,show:d&&!!((ee=e==null?void 0:e.store)!=null&&ee.name),to:u?"/stores/edit/".concat((se=e==null?void 0:e.store)==null?void 0:se.id):void 0}),s.jsx(P,{label:r("orders.order.info.original_store"),value:(te=e==null?void 0:e.originalStore)==null?void 0:te.name,show:d&&!!((ae=e==null?void 0:e.originalStore)!=null&&ae.id)&&e.originalStore.id!==((ne=e==null?void 0:e.store)==null?void 0:ne.id),to:u?"/stores/edit/".concat((A=e==null?void 0:e.originalStore)==null?void 0:A.id):void 0}),s.jsx(P,{label:r("orders.order.info.positions"),value:l}),s.jsx(P,{label:r("orders.order.info.amount"),value:(e==null?void 0:e.amount)!=null?"".concat(B(e.amount,{precision:2})," ").concat(t):null}),s.jsx(P,{label:r("orders.order.info.weight"),value:"".concat(B((L=e==null?void 0:e.totalWeight)!=null?L:0,{precision:2})," ").concat(r("orders.cart.weight")),show:((U=e==null?void 0:e.totalWeight)!=null?U:0)>0}),s.jsx(P,{label:r("orders.order.info.volume"),value:"".concat(B((F=e==null?void 0:e.totalVolume)!=null?F:0,{precision:2})," ").concat(r("orders.cart.volume")),show:((O=e==null?void 0:e.totalVolume)!=null?O:0)>0})]})})})},Rs=({orderId:e,order:a,isPending:t,showDeviceInfo:l,canDelete:o,canEdit:c,onBack:d,onDownload:u,onDelete:i,onEdit:r})=>{var x,h,b,w,N,n,g;const{t:m}=S("orders"),f=_e(a==null?void 0:a.creationTime);return t?s.jsxs("div",{className:"flex flex-col items-start gap-1",children:[s.jsx(D,{className:"h-9 w-56"}),s.jsx(D,{className:"h-4 w-40"})]}):s.jsxs("div",{className:"flex flex-col items-start justify-between flex-wrap w-full gap-1",children:[s.jsxs("div",{className:"w-full flex justify-between flex-wrap-reverse items-center gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground hover:text-primary-black transition-colors w-fit",children:[s.jsx(z,{size:"icon",onClick:d,children:s.jsx(Be,{className:"size-4"})}),s.jsx("h1",{className:"text-conte-heading2 text-primary-black",children:m("orders.order.title",{id:(h=(x=a==null?void 0:a.extId)!=null?x:a==null?void 0:a.id)!=null?h:e})})]}),s.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[s.jsx(z,{color:"black",size:"md",onClick:u,children:m("orders.order.action.download")}),o&&s.jsx(z,{size:"md",color:"destructive",onClick:i,children:m("orders.order.action.delete")})]})]}),s.jsxs("div",{className:"text-conte-body-m text-secondary-foreground flex flex-col gap-2 flex-wrap",children:[f&&s.jsxs("span",{children:[m("orders.order.info.date")," ",f]}),(((b=a==null?void 0:a.manager)==null?void 0:b.fullName)||l||(a==null?void 0:a.whoseOrder))&&s.jsxs("span",{className:"flex items-center gap-2 flex-wrap",children:[!!(a!=null&&a.whoseOrder)&&s.jsx("span",{children:a.whoseOrder}),!!(a!=null&&a.whoseOrder)&&l&&s.jsx("span",{children:" • "}),l&&s.jsx(es,{deviceType:(N=(w=a==null?void 0:a.device)==null?void 0:w.type)!=null?N:void 0,version:(g=(n=a==null?void 0:a.device)==null?void 0:n.version)!=null?g:void 0})]})]})]})},Is=e=>{var o;const a=e.indexOf("<?xml"),t=e.indexOf("<svg"),l=(o=[a,t].filter(c=>c>=0).sort((c,d)=>c-d)[0])!=null?o:-1;if(l>=0){const c=e.slice(l);return"data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(c))}return e},Bs=({show:e,payments:a,className:t})=>{const{t:l}=S("orders");if(!e||!(a!=null&&a.length))return null;const o=a[0];return s.jsx(W,{className:t,title:s.jsxs("div",{className:"flex justify-between flex-wrap",children:[s.jsx("h2",{children:l("orders.order.payment.title")}),o.link&&s.jsx(Pe,{variant:"no-styled",to:o.link,target:"_blank",rel:"noreferrer",children:s.jsx(z,{color:"primary",size:"sm",className:"rounded-full px-6",children:l("orders.order.payment.pay_link")})})]}),children:s.jsx("div",{className:"flex flex-col items-center gap-3",children:o.qrCode&&s.jsx("img",{src:Is(o.qrCode),alt:l("common:common.image.qr"),className:"size-40 object-contain"})})})},zs=({products:e,isPending:a,order:t,currency:l,positionsLabel:o,settings:c,withVat:d,showVatSwitcher:u,onSettingChange:i,onVatChange:r})=>{var f,x,h,b,w;const{t:m}=S("orders");return s.jsxs(W,{title:m("orders.order.products.title"),className:"px-0",classNames:{header:"px-8"},children:[s.jsxs("div",{className:"w-full flex justify-end items-center gap-3 flex-wrap px-12",children:[(t==null?void 0:t.hasQuantityMismatch)&&s.jsx(le,{value:c.showChangedOnly?"changed":"all",onValueChange:N=>i({showChangedOnly:N==="changed"}),children:s.jsxs(oe,{variant:"button",rounded:"md",size:"xs",children:[s.jsx(I,{value:"all",children:m("orders.order.display.all")}),s.jsx(I,{value:"changed",children:m("orders.order.display.changed")})]})}),s.jsx(le,{value:c.groupByCategory?"categories":"list",onValueChange:N=>i({groupByCategory:N==="categories"}),children:s.jsxs(oe,{variant:"button",rounded:"md",size:"xs",children:[s.jsx(I,{value:"list",children:m("orders.order.display.list")}),s.jsx(I,{value:"categories",children:m("orders.order.display.categories")})]})}),u&&s.jsx(le,{value:d?"vat":"no_vat",onValueChange:N=>r(N==="vat"),children:s.jsxs(oe,{variant:"button",rounded:"md",size:"xs",children:[s.jsx(I,{value:"no_vat",children:m("orders.cart.vat.without")}),s.jsx(I,{value:"vat",children:m("orders.cart.vat.with")})]})})]}),s.jsx("div",{className:Qe("px-0",!a&&"pt-4"),children:s.jsx(_s,{items:e,isLoading:a,settings:c,onSettingChange:i,currency:l,hasQuantityMismatch:(f=t==null?void 0:t.hasQuantityMismatch)!=null?f:!1,withVat:d})}),!a&&t&&s.jsx("div",{className:"flex justify-end px-4 py-6 sm:px-10 sm:py-10",children:s.jsxs("div",{className:"grid grid-cols-[1fr_auto] gap-x-8 sm:gap-x-16 gap-y-2 text-primary-black",children:[((x=t.discountAmount)!=null?x:0)>0&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"col-span-2 grid grid-cols-subgrid text-conte-body-m",children:[s.jsxs("span",{children:[m("orders.order.summary.order_total"),":"]}),s.jsxs("span",{className:"text-right",children:[B(((h=t.amount)!=null?h:0)+((b=t.discountAmount)!=null?b:0),{precision:2})," ",l]})]}),s.jsxs("div",{className:"col-span-2 grid grid-cols-subgrid text-conte-body-m",children:[s.jsxs("span",{children:[m("orders.order.summary.discount"),":"]}),s.jsxs("span",{className:"text-right",children:[B((w=t.discountAmount)!=null?w:0,{precision:2})," ",l]})]}),s.jsx("div",{className:"h-4 col-span-2"})]}),s.jsxs("div",{className:"text-conte-button-l col-span-2 grid grid-cols-subgrid",children:[s.jsxs("span",{children:[m("orders.order.summary.total_with_discounts"),":"]}),s.jsx("span",{className:"text-right",children:t.amount!=null?"".concat(B(t.amount,{precision:2})," ").concat(l):"—"})]}),d&&t.vatAmount!=null&&t.vatAmount>0&&s.jsxs("div",{className:"col-span-2 grid grid-cols-subgrid text-conte-body-m",children:[s.jsxs("span",{children:[m("orders.order.summary.vat_included"),":"]}),s.jsxs("span",{className:"text-right",children:[B(t.vatAmount,{precision:2})," ",l]})]})]})})]})},Ws=({order:e,isPending:a,canChangeStatus:t,allowedStatuses:l,selectedStatusCode:o,onStatusChange:c,className:d})=>{var f,x;const{t:u}=S("orders"),i=_e(e==null?void 0:e.updateTime),r=j.useMemo(()=>e!=null&&e.status?l!=null&&l.length?l.some(({code:h})=>{var b;return h===((b=e.status)==null?void 0:b.code)})?l:[e.status,...l]:[e.status]:[],[l,e==null?void 0:e.status]),m=!t||r.length<=1;return a?s.jsxs(W,{title:u("orders.order.status.title"),className:d,children:[s.jsx(D,{className:"h-12 w-full"}),s.jsx(D,{className:"h-4 w-32"})]}):s.jsx(W,{title:u("orders.order.status.title"),className:d,children:s.jsx(He,{size:"lg",keyField:"code",disabled:m,items:r,value:(x=o!=null?o:(f=e==null?void 0:e.status)==null?void 0:f.code)!=null?x:void 0,onChange:c,placeholder:"—",description:i?s.jsxs("span",{className:"text-conte-body-l text-secondary-foreground",children:[u("orders.order.info.updated")," ",i]}):null,ItemSlot:({item:h})=>s.jsxs("div",{className:"flex gap-2 items-center text-sm",children:[s.jsx("div",{className:"flex size-3 rounded-full shrink-0",style:{background:ss(h.code)}}),s.jsx("span",{children:h.name})]})})})},{orderOne:Ts,orderGetAllowedStatuses:Ks,orderUpdate:$s,orderDownload:Ds,orderDelete:Vs,orderCancel:Fs,orderConfirmReserve:Gs}=ke();function Ls(){var de,ue,me,pe,he,xe,ge,fe,ye,je;const{t:e,i18n:a}=S(["orders","common"]),{id:t}
1=qe.useParams(),l=We(),{currentRole:o,priceVatMode:c,userId:d,userIsModePurchaseManager:u}=Xe("appStore"),i=R(o,[v.ADMIN]),r=R(o,[v.DISTRIBUTOR]),m=R(o,[v.MANAGER,v.SENIOR_MANAGER,v.SALESMAN]),f=R(o,[v.SENIOR_MANAGER]),x=R(o,[v.CLIENT,v.RETAIL_NETWORK,v.USER]),h=R(o,[v.AGENT]),b=()=>{Ye()!==null?window.history.back():l({to:"/order/list"})},[w,N]=j.useState(!1),[n,g]=j.useState(null),[C,V]=j.useState([]),[T,K]=j.useState([]),[$,H]=j.useState(null),[q,X]=j.useState({codeSwitcher:"sku",groupByCategory:!1,showChangedOnly:!1}),[Z,J]=j.useState(()=>c===Ne.with_vat);j.useEffect(()=>{var p,y;Ze(e("orders.order.title",{id:(y=(p=n==null?void 0:n.extId)!=null?p:n==null?void 0:n.id)!=null?y:t}))},[a.language,n==null?void 0:n.extId,n==null?void 0:n.id]);const{isPending:k}=ce({mutationKey:["order-one",t],mutationFn:()=>Ts({id:Number(t)}),init:!0,successFn:p=>{var y,_,E,Q;g((_=(y=p==null?void 0:p.result)==null?void 0:y.order)!=null?_:null),V((Q=(E=p==null?void 0:p.result)==null?void 0:E.products)!=null?Q:[])},errorFn:p=>{(p==null?void 0:p.status)===404&&N(!0)}}),{mutateAsync:Y}=ce({mutationKey:["order-allowed-statuses",t],mutationFn:()=>Ks({id:Number(t)}),cached:!1,init:!0,successFn:p=>{var y;return K((y=p==null?void 0:p.result)!=null?y:[])}}),ee=async()=>{var E;const p=await Ds({id:Number(t)}),y=(E=p==null?void 0:p.result)==null?void 0:E.file;if(!y)return;const _=document.createElement("a");_.href=y,_.download="",document.body.appendChild(_),_.click(),document.body.removeChild(_)},se=async()=>{await Vs({id:Number(t)}),l({to:"/order/list"})},te=async()=>{await Fs({id:Number(t)}),l({to:"/order/list"})},ae=async()=>{await Gs({id:Number(t)}),l({to:"/order/list"})},ne=async p=>{var E,Q,be;const y=(E=p==null?void 0:p.code)!=null?E:null,_=(be=$!=null?$:(Q=n==null?void 0:n.status)==null?void 0:Q.code)!=null?be:null;!y||y===_||(H(y),await $s({id:Number(t),status:y}),await Y())},A=(ue=(de=n==null?void 0:n.status)==null?void 0:de.code)!=null?ue:null,L=(pe=(me=n==null?void 0:n.currency)==null?void 0:me.symbol)!=null?pe:"",U=(n==null?void 0:n.totalCount)!=null||(n==null?void 0:n.totalCountProducts)!=null?e("orders.order.info.positions_detail",{sku:(he=n==null?void 0:n.totalCountProducts)!=null?he:0,count:(xe=n==null?void 0:n.totalCount)!=null?xe:0}):null,F=!!d&&((ge=n==null?void 0:n.client)==null?void 0:ge.id)===d,O=!!(n!=null&&n.isTypeEntitySelf),G=i&&O,Se=(i||r||R(o,[v.MANAGER,v.SENIOR_MANAGER]))&&!h&&!F&&!u&&O,Ae=(i||r||m)&&!h&&!F&&O,re=(i||R(o,[v.MANAGER]))&&A==="confirmedClient"&&O,Oe=!h&&(x||i||m||r||f)&&(["reserveChanged","reserveNotChanged","processing"].includes(A)||A==="confirmedClient"&&!x)&&O,Me=!k&&!!n&&(re||!!n.boxlabel),Ee=A==="paymentPending"&&((ye=(fe=n==null?void 0:n.payments)==null?void 0:fe.length)!=null?ye:0)>0,Re=c===Ne.both;return!k&&w?s.jsx("div",{className:"flex flex-col items-center justify-center gap-6 px-2 py-16",children:s.jsxs("div",{className:"bg-white rounded-xl p-10 flex flex-col items-center gap-4 w-full max-w-lg text-center",children:[s.jsx(ze,{className:"size-12 text-muted-foreground",strokeWidth:1.5}),s.jsx("h1",{className:"text-conte-heading3 text-primary-black",children:e("orders.order.not_found.title")}),s.jsxs("p",{className:"text-conte-body-m text-secondary-foreground",children:[e("orders.order.not_found.description_before"),s.jsx(Je,{}),e("orders.order.not_found.description_after")]}),s.jsx(z,{size:"md",color:"black",className:"mt-2",onClick:()=>l({to:"/order/list"}),children:e("orders.order.not_found.back")})]})}):s.jsxs("div",{className:"flex flex-col gap-6 px-2 py-6",children:[s.jsx(Rs,{orderId:t,order:n,isPending:k,showDeviceInfo:i||r||f,canDelete:G,canEdit:Se,onBack:b,onDownload:ee,onDelete:se,onEdit:()=>{}}),!k&&n&&Oe&&A&&s.jsx(Ss,{statusCode:A,isAdmin:i,onConfirm:ae,onCancel:te}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 items-stretch",children:[s.jsx("div",{className:"col-span-1 md:col-span-1 lg:col-span-2 h-full",children:s.jsx(Es,{isPending:k,order:n,currency:L,positionsLabel:U,showClient:!x&&!F,showManager:(f||i||r)&&((je=n==null?void 0:n.manager)==null?void 0:je.id)!==d,showStore:!x&&
1!!(n!=null&&n.storeDonorOrder),showStoreLink:i,className:"h-full"})}),s.jsxs("div",{className:"col-span-1 flex flex-col gap-6 h-full",children:[s.jsx(Ws,{order:n,isPending:k,canChangeStatus:Ae,allowedStatuses:T,selectedStatusCode:$,onStatusChange:ne,className:"flex-1"}),s.jsx(Bs,{show:!k&&Ee,payments:n==null?void 0:n.payments,className:"flex-1"}),Me&&s.jsx(Os,{orderId:Number(t),boxlabel:n==null?void 0:n.boxlabel,readonly:!re,className:"flex-1"}),s.jsx(Ms,{comment:n==null?void 0:n.comment,isPending:k,className:"flex-1"})]})]}),s.jsx(zs,{products:C,isPending:k,order:n,currency:L,positionsLabel:U,settings:q,withVat:Z,showVatSwitcher:Re,onSettingChange:p=>X(y=>({...y,...p})),onVatChange:J})]})}const nt=Ls;export{nt as component};

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.