PageSourceSearch

https://sailcraft.ventisails.com/assets/CustomerDetailPage-BjddONXw.js

js ventisails.com collected 2026-10-08 03:34:18 UTC 21,445 bytes, 1 lines download raw bytes

1import{s as Se,b as Be,d as Ee,R as c,e as De,f as Ie,a as Le,g as y,j as e,B as v,C as k,i as C,k as w,h as S,L as z,E as Te}from"./index-Bep90cXs.js";import{C as de}from"./customers.api-DXJMVVCa.js";import{B as Oe}from"./boats.api-VvI4Ug0-.js";import{S as Ue,i as ce}from"./offerUtils-CWrkyyX5.js";import{O as $e}from"./orders.api-CyJZuDN8.js";import{O as Ae}from"./orderSails.api-BSgMXrBH.js";import{T as M,a as R,b,c as x,d as K,e as m}from"./table-Cr5-c6AL.js";import{F as Pe}from"./file-card-D1GWB1sm.js";import{f as me}from"./format-CC0CpxJA.js";import"./jspdf-vendor-_9OnqGYv.js";function Xe(){const{id:r}=Se(),n=Be(),i=Ee(),j=c.useCallback(t=>{n(`/boats/${t}`,{state:{from:`${i.pathname}${i.search}`}})},[n,i.pathname,i.search]),f=c.useCallback(t=>{n(`/offers/${t}`,{state:{from:`${i.pathname}${i.search}`}})},[n,i.pathname,i.search]),B=c.useCallback(t=>{n(`/order-sails/${t}`,{state:{from:`${i.pathname}${i.search}`}})},[n,i.pathname,i.search]),{setHeader:_,setActions:H,clear:V}=De(),{hasPermission:N}=Ie(),{t:s}=Le(),[a,T]=c.useState(null),[ye,O]=c.useState(!0),[q,U]=c.useState(null),[$,G]=c.useState(!1),[J,Q]=c.useState(null),[W,X]=c.useState(null),[g,ve]=c.useState([]),[Y,Z]=c.useState(!0),[A,ee]=c.useState(null),[E,ke]=c.useState([]),[te,se]=c.useState(!0),[P,re]=c.useState(null),[D,ae]=c.useState([]),[ne,le]=c.useState(!0),[F,oe]=c.useState(null);c.useEffect(()=>{const t=Number(r);
1if(!t||Number.isNaN(t)){U(s("customers.invalidId")),O(!1);return}const l=new AbortController;return O(!0),U(null),de.getById(t).then(d=>{T(d)}).catch(d=>{l.signal.aborted||U(y(d))}).finally(()=>O(!1)),()=>l.abort()},[r,s]),c.useEffect(()=>(_(a?.displayName||s("customers.header")),H([...N("customers.write")?[{label:s("common.edit"),onClick:()=>n(`/customers/${a.id}/edit`),variant:"primary"}]:[],{label:s("common.back"),onClick:()=>n(-1)}]),()=>V()),[a,_,H,V,n,N,s]),c.useEffect(()=>{const t=Number(r);if(!t||Number.isNaN(t))return;const l=new AbortController;return Z(!0),ee(null),Oe.listByCustomer(t,{page:1,pageSize:50,signal:l.signal}).then(d=>ve(d.items)).catch(d=>{l.signal.aborted||ee(y(d))}).finally(()=>Z(!1)),()=>l.abort()},[r]),c.useEffect(()=>{const t=Number(r);if(!t||Number.isNaN(t))return;const l=new AbortController;return se(!0),re(null),Ue.list({customerId:t,page:1,pageSize:100,sortBy:"offerDate",sortDirection:"desc",signal:l.signal}).then(d=>ke(d.items)).catch(d=>{l.signal.aborted||re(y(d))}).finally(()=>{l.signal.aborted||se(!1)}),()=>l.abort()},[r]),c.useEffect(()=>{const t=Number(r);
1if(!t||Number.isNaN(t))return;const l=new AbortController;return le(!0),oe(null),(async()=>{try{const d=await $e.list({customerId:t,page:1,pageSize:200,signal:l.signal});if(l.signal.aborted)return;const p=d.items;if(p.length===0){ae([]);return}const u=await Promise.all(p.map(async h=>{try{return(await Ae.listByOrder(h.id)).map(we=>ze(we,h))}catch{return[]}}));if(l.signal.aborted)return;ae(u.flat())}catch(d){if(l.signal.aborted)return;oe(y(d))}finally{l.signal.aborted||le(!1)}})(),()=>l.abort()},[r]);const I=c.useMemo(()=>{const t=new Map;return g.forEach(l=>t.set(l.id,l)),t},[g]),ie=(a?.roleTypes??[]).some(t=>t.active&&t.name.trim().toLowerCase()==="cliente"),L=a?.portalUsers??(a?.portalUser?[a.portalUser]:[]),Ce=async()=>{if(!(!a||$)&&window.confirm(s("customers.createPortalUserConfirm")))try{G(!0),X(null),Q(null);const t=await de.createPortalUser(a.id);T(l=>l&&be(l,t)),Q(s("customers.portalUserCreated"))}catch(t){if(Te.isAxiosError(t)&&t.response?.status===409){const l=t.response.data;if(typeof l?.id=="number"){T(d=>d&&be(d,{id:l.id,username:l.username,email:l.email}));return}}X(y(t))}finally{G(!1)}};return ye?e.jsx("div",{className:"p-6 text-sm opacity-70",children:s("common.loading")}):q?e.jsxs("div",{className:"p-6 space-y-4",children:[e.jsxs("div",{className:"text-sm text-red-600",children:["Error: ",q]}),e.jsx(v,{variant:"outline",onClick:()=>n(-1),children:s("common.back")})]}):a?e.jsxs("div",{className:"p-3 md:p-6 space-y-6",children:[e.jsxs(k,{className:"rounded-2xl",children:[e.jsx(C,{className:"pb-2",children:e.jsx(w,{className:"text-base",children:s("customers.details")})}),e.jsxs(S,{className:"grid grid-cols-1 md:grid-cols-2 gap-4 text-sm",children:[e.jsx(o,{label:s("common.type"),value:Fe(a.type,s)}),e.jsx(o,{label:s("customers.company"),value:a.companyName}),e.jsx(o,{label:s("customers.firstName"),value:a.firstName}),e.jsx(o,{label:s("customers.lastName"),value:a.lastName}),e.jsx(o,{label:s("customers.contactPerson"),value:a.contactPerson}),e.jsx(o,{label:s("customers.email1"),value:a.email1}),e.jsx(o,{label:s("customers.email2"),value:a.email2}),e.jsx(o,{label:s("common.phone"),value:a.phone1}),e.jsx(o,{label:s("customers.phoneAlt"),value:a.phone2}),e.jsx(o,{label:s("common.fax"),value:a.fax}),e.jsx(o,{label:s("common.address"),value:a.addressLine1}),e.jsx(o,{label:s("customers.addressCont"),value:a.addressLine2}),e.jsx(o,{label:s("common.city"),value:a.city}),e.jsx(o,{label:s("customers.province"),value:a.province}),e.jsx(o,{label:s("customers.postalCode"),value:a.postalCode}),e.jsx(o,{label:s("common.country"),value:a.country}),e.jsx(o,{label:s("customers.shippingAddress"),value:a.shippingAddress}),e.jsx(o,{label:s("customers.addressNote"),value:a.addressNote}),e.jsx(o,{label:"VAT",value:a.vatNumber}),e.jsx(o,{label:s("customers.taxCode"),value:a.taxCode}),e.jsx(o,{label:"IBAN",value:a.iban}),e.jsx(o,{label:s("customers.paymentMethod"),value:a.paymentMethod}),e.jsx(o,{label:s("customers.paymentTerms"),value:a.paymentTerms}),e.jsx(o,{label:s("customers.defaultVatRate"),value:a.defaultVatRate}),e.jsx(o,{label:s("customers.hasIntentLetter"),value:typeof a.hasIntentLetter=="boolean"?a.hasIntentLetter?s("customers.yes"):s("customers.no"):a.hasIntentLetter??a.hasintentletter??"-"}),e.jsx(o,{label:s("customers.defaultDiscount"),value:typeof a.defaultDiscount=="number"?`${a.defaultDiscount}`:a.defaultDiscount}),e.jsx(o,{label:"SDI",value:a.sdi}),e.jsx(o,{label:"PEC",value:a.pec}),e.jsx(o,{label:s("customers.internalCode"),value:a.internalCode??a.internalcode}),e.jsx(o,{label:s("common.notes"),value:a.notes})]})]}),e.jsxs(k,{className:"rounded-2xl",children:[e.jsxs(C,{className:"pb-2 flex flex-row items-center justify-between gap-2",children:[e.jsx(w,{className:"text-base",children:s("customers.relationship")}),ie&&L.length===0&&N("users.write")&&e.jsx(v,{size:"sm",className:"ml-auto",disabled:$||!a.mainEmail,onClick:()=>void Ce(),children:s($?"common.saving":"customers.createPortalUser")})]}),e.jsxs(S,{children:[ie&&L.length===0&&!a.mainEmail&&e.jsx("p",{className:"mb-3 text-sm text-muted-foreground",children:s("customers.portalUserMissingEmail")}),J&&e.jsx("p",{className:"mb-3 text-sm text-emerald-700 dark:text-emerald-400",children:J}),W&&e.jsx("p",{className:"mb-3 text-sm text-destructive",children:W}),(a.roleTypes??[]).length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:s("customers.relationshipNone")}):e.jsx("ul",{className:"space-y-1 text-sm",children:(a.roleTypes??[]).map(t=>e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{children:t.name}),!t.active&&e.jsx("span",{className:"text-[11px] text-muted-foreground",children:s("customers.relationshipInactive")})]},t.id))}),e.jsxs("div",{className:"mt-4 space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:s("customers.users")}),L.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:s("customers.usersNone")}):e.jsx("ul",{className:"divide-y rounded-md border",children:L.map(t=>e.jsx("li",{children:e.jsxs(z,{to:`/users/${t.id}`,className:"flex items-center justify-between gap-3 px-3 py-2 text-sm hover:bg-muted/50",children:[e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block truncate font-medium",children:t.fullName?.trim()||t.username||t.email}),e.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:[t.username,t.email].filter(
1Boolean).join(" · ")})]}),t.active===!1&&e.jsx("span",{className:"shrink-0 text-[11px] text-muted-foreground",children:s("customers.relationshipInactive")})]})},t.id))})]})]})]}),e.jsxs(k,{className:"rounded-2xl",children:[e.jsxs(C,{className:"pb-2 flex flex-row items-center justify-between gap-2",children:[e.jsx(w,{className:"text-base",children:s("customers.boats")}),e.jsx("div",{className:"flex gap-2 ml-auto",children:N("boats.write")&&e.jsx(v,{variant:"outline",asChild:!0,children:e.jsx(z,{to:`/boats/new?customerId=${a.id}`,children:s("customers.newBoat")})})})]}),e.jsxs(S,{children:[Y&&e.jsx("div",{className:"p-6 text-sm opacity-70",children:s("customers.loadingBoats")}),A&&e.jsxs("div",{className:"p-6 text-sm text-destructive",children:["Error: ",A]}),!Y&&!A&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-3 md:hidden",children:[g.length===0&&e.jsx("div",{className:"py-8 text-center text-sm text-muted-foreground",children:s("customers.noBoatsForCustomer")}),g.map(t=>e.jsxs("div",{role:"button",tabIndex:0,onClick:()=>j(t.id),onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),j(t.id))},className:"rounded-2xl border border-gray-100 dark:border-slate-700 p-3 space-y-1 cursor-pointer hover:bg-neutral-50 dark:hover:bg-neutral-800/60",children:[e.jsx("div",{className:"text-sm font-semibold truncate",children:t.boatName??s("customers.noName")}),e.jsx("div",{className:"text-xs text-muted-foreground truncate",children:t.modelName??(t.modelId!=null?`#${t.modelId}`:"—")}),e.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs",children:[e.jsx("span",{className:"capitalize text-muted-foreground",children:t.boatTypeName||"—"}),t.length!=null&&e.jsxs("span",{className:"font-medium",children:[t.length," ",e.jsx("span",{className:"text-muted-foreground",children:"m"})]})]})]},t.id))]}),e.jsx("div",{className:"hidden md:block",children:e.jsxs(M,{children:[e.jsx(R,{children:e.jsxs(b,{children:[e.jsx(x,{children:s("common.name")}),e.jsx(x,{children:s("customers.model")}),e.jsx(x,{children:s("common.type")}),e.jsx(x,{className:"text-right",children:s("customers.length")})]})}),e.jsxs(K,{children:[g.length===0&&e.jsx(b,{children:e.jsx(m,{colSpan:4,className:"text-center py-8 text-sm text-muted-foreground",children:s("customers.noBoatsForCustomer")})}),g.map(t=>e.jsxs(b,{role:"button",tabIndex:0,onClick:()=>j(t.id),onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),j(t.id))},className:"cursor-pointer hover:bg-neutral-50 dark:hover:bg-neutral-800/60",children:[e.jsx(m,{className:"font-medium",children:t.boatName??s("customers.noName")}),e.jsx(m,{children:t.modelName??t.modelId}),e.jsx(m,{className:"capitalize",children:t.boatTypeName??""}),e.jsx(m,{className:"text-right",children:t.length??""})]},t.id))]})]})})]})]})]}),e.jsxs(k,{className:"rounded-2xl",children:[e.jsxs(C,{className:"pb-2 flex flex-row items-center justify-between gap-2",children:[e.jsx(w,{className:"text-base",children:s("customers.offers")}),e.jsx("div",{className:"flex gap-2 ml-auto",children:N("sailoffers.write")&&e.jsx(v,{variant:"outline",asChild:!0,children:e.jsx(z,{to:`/offers/new?customerId=${a.id}`,children:s("offers.newOffer")})})})]}),e.jsxs(S,{children:[te&&e.jsx("div",{className:"p-6 text-sm opacity-70",children:s("customers.loadingOffers")}),P&&e.jsxs("div",{className:"p-6 text-sm text-destructive",children:["Error: ",P]}),!te&&!P&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-3 md:hidden",children:[E.length===0&&e.jsx("div",{className:"py-8 text-center text-sm text-muted-foreground",children:s("customers.noOffersForCustomer")}),E.map(t=>{const l=ue(t),d=xe(t,I),p=t.grandTotal!=null&&t.grandTotal!==0?t.grandTotal:t.subtotal??0,u=ce(t)?"expired":t.status?.toLowerCase()??"";return e.jsxs("div",{role:"button",tabIndex:0,onClick:()=>f(t.id),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),f(t.id))},className:"rounded-2xl border border-gray-100 dark:border-slate-700 p-3 space-y-1 cursor-pointer hover:bg-neutral-50 dark:hover:bg-neutral-800/60",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-semibold truncate",children:l}),t.name&&e.jsx("div",{className:"text-xs text-muted-foreground truncate",children:t.name})]}),e.jsx("span",{className:he(u),children:je(u,s)})]}),e.jsx("div",{className:"text-xs text-muted-foreground truncate",children:d}),e.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs",children:[e.jsx("span",{className:"text-muted-foreground",children:t.offerDate?new Date(t.offerDate).toLocaleDateString():"—"}),e.jsx("span",{className:"font-semibold",children:me(p,t.currency||"EUR")})]})]},t.id)})]}),e.jsx("div",{className:"hidden md:block",children:e.jsxs(M,{children:[e.jsx(R,{children:e.jsxs(b,{children:[e.jsx(x,{children:s("customers.offerNumber")}),e.jsx(x,{children:s("offers.offerDate")}),e.jsx(x,{children:s("common.name")}
1),e.jsx(x,{children:s("common.boat")}),e.jsx(x,{children:s("common.status")}),e.jsx(x,{className:"text-right",children:s("offers.amount")})]})}),e.jsxs(K,{children:[E.length===0&&e.jsx(b,{children:e.jsx(m,{colSpan:6,className:"text-center py-8 text-sm text-muted-foreground",children:s("customers.noOffersForCustomer")})}),E.map(t=>{const l=ue(t),d=xe(t,I),p=t.grandTotal!=null&&t.grandTotal!==0?t.grandTotal:t.subtotal??0,u=ce(t)?"expired":t.status?.toLowerCase()??"";return e.jsxs(b,{role:"button",tabIndex:0,onClick:()=>f(t.id),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),f(t.id))},className:"cursor-pointer hover:bg-neutral-50 dark:hover:bg-neutral-800/60",children:[e.jsx(m,{className:"font-medium",children:l}),e.jsx(m,{className:"text-sm text-muted-foreground",children:t.offerDate?new Date(t.offerDate).toLocaleDateString():"—"}),e.jsx(m,{children:t.name||"—"}),e.jsx(m,{children:d}),e.jsx(m,{children:e.jsx("span",{className:he(u),children:je(u,s)})}),e.jsx(m,{className:"text-right font-semibold",children:me(p,t.currency||"EUR")})]},t.id)})]})]})})]})]})]}),e.jsxs(k,{className:"rounded-2xl",children:[e.jsx(C,{className:"pb-2 flex flex-row items-center justify-between gap-2",children:e.jsx(w,{className:"text-base",children:s("customers.sails")})}),e.jsxs(S,{children:[ne&&e.jsx("div",{className:"p-6 text-sm opacity-70",children:s("customers.loadingSails")}),F&&e.jsxs("div",{className:"p-6 text-sm text-destructive",children:["Error: ",F]}),!ne&&!F&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-3 md:hidden",children:[D.length===0&&e.jsx("div",{className:"py-8 text-center text-sm text-muted-foreground",children:s("customers.noSailsForCustomer")}),D.map(t=>{const l=fe(t,I),d=pe(t),p=[t.sailTypeDescription,t.sailConstructionTypeDescription].filter(Boolean).join(" / ")||"—";return e.jsxs("div",{role:"button",tabIndex:0,onClick:()=>B(t.id),onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),B(t.id))},className:"rounded-2xl border border-gray-100 dark:border-slate-700 p-3 space-y-1 cursor-pointer hover:bg-neutral-50 dark:hover:bg-neutral-800/60",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-semibold truncate",children:t.sailCode||t.name||`#${t.id}`}),e.jsx("div",{className:"text-xs text-muted-foreground truncate",children:p})]}),e.jsx("span",{className:ge(t.status),children:Ne(t.status,s)})]}),e.jsx("div",{className:"text-xs text-muted-foreground truncate",children:l}),e.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs",children:[e.jsx("span",{className:"text-muted-foreground",children:s("orders.orderNumber")}),e.jsx("span",{className:"font-medium",children:d})]})]},t.id)})]}),e.jsx("div",{className:"hidden md:block",children:e.jsxs(M,{children:[e.jsx(R,{children:e.jsxs(b,{children:[e.jsx(x,{children:s("orders.sailName")}),e.jsx(x,{children:s("orders.typeConstruction")}),e.jsx(x,{children:s("common.boat")}),e.jsx(x,{children:s("orders.orderNumber")}),e.jsx(x,{children:s("common.status")})]})}),e.jsxs(K,{children:[D.length===0&&e.jsx(b,{children:e.jsx(m,{colSpan:5,className:"text-center py-8 text-sm text-muted-foreground",children:s("customers.noSailsForCustomer")})}),D.map(t=>{const l=fe(t,I),d=pe(t),p=[t.sailTypeDescription,t.sailConstructionTypeDescription].filter(Boolean).join(" / ")||"—";return e.jsxs(b,{role:"button",tabIndex:0,onClick:()=>B(t.id),onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),B(t.id))},className:"cursor-pointer hover:bg-neutral-50 dark:hover:bg-neutral-800/60",children:[e.jsx(m,{className:"font-medium",children:t.sailCode||t.name||`#${t.id}`}),e.jsx(m,{children:p}),e.jsx(m,{children:l}),e.jsx(m,{children:d}),e.jsx(m,{children:e.jsx("span",{className:ge(t.status),children:Ne(t.status,s)})})]},t.id)})]})]})})]})]})]}),e.jsx("div",{className:"mt-4",children:e.jsx(Pe,{entityType:"customers",entityId:a?.id??null})})]}):e.jsxs("div",{className:"p-6 space-y-4",children:[e.jsx("div",{className:"text-sm",children:s("customers.notFound")}),e.jsx(v,{variant:"outline",onClick:()=>n(-1),children:s("common.back")})]})}function o({label:r,value:n}){return e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-gray-500",children:r}),e.jsx("div",{className:"mt-0.5",children:n??"-"})]})}function Fe(r,n){if(!r)return"-";const i=r.toLowerCase();return i==="company"?n("customers.type.company"):i==="individual"?n("customers.type.individual"):r}function ze(r,n){return{...r,orderBoatId:n.boatId??null,orderBoatName:n.boatName??null,orderOrderNumber:n.orderNumber??null,orderName:r.orderName??n.name??null}}function ue(r){const n=typeof r.offerNumber=="number"&&Number.isFinite(r.offerNumber)?String(r.offerNumber):`#${r.id}`,i=r.revision&&r.revision>0?`/${r.revision}`:"";return`${n}${i}`}function xe(r,n){if(r.boatId){const i=n.get(r.boatId);return i?.boatName?.trim()||r.boatName?.trim()||r.boatNameSnapshot?.trim()||i?.modelName?.trim()||r.boatModelName?.trim()||r.boatModelSnapshot?.trim()||`Boat #${r.boatId}`}return r.boatName?.trim()||r.boatNameSnapshot?.trim()||"—"}function fe(r,n){if(r.orderBoatId){const i=n.get(r.orderBoatId);return i?.boatName?.trim()||r.orderBoatName?.trim()||i?.modelName?.trim()||`Boat #${r.orderBoatId}`}return r.orderBoatName?.trim()||"—"}function pe(r){return typeof r.orderOrderNumber=="number"&&Number.isFinite(r.orderOrderNumber)?String(r.orderOrderNumber):r.orderName?.trim()||"—"}function he(r){switch(r){case"accepted":return"inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium bg-emerald-100 text-emerald-800 dark:bg-emerald-900/50 dark:text-emerald-300";
1case"partially_accepted":return"inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium bg-amber-100 text-amber-800 dark:bg-amber-900/50 dark:text-amber-300";case"rejected":return"inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium bg-red-100 text-red-800 dark:bg-red-900/50 dark:text-red-300";case"sent":return"inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium bg-sky-100 text-sky-800 dark:bg-sky-900/50 dark:text-sky-300";case"expired":return"inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium bg-orange-100 text-orange-800 dark:bg-orange-900/50 dark:text-orange-300";default:return"inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium bg-slate-100 text-slate-600 dark:bg-slate-800 dark:text-slate-400"}}function be(r,n){const i=r.portalUsers??(r.portalUser?[r.portalUser]:[]),j=i.some(f=>f.id===n.id)?i.map(f=>f.id===n.id?{...f,...n}:f):[...i,n];return{...r,portalUser:j[0]??n,portalUsers:j}}function je(r,n){switch(r){case"draft":return n("offers.status.draft");case"sent":return n("offers.status.sent");case"accepted":return n("offers.status.accepted");case"partially_accepted":return n("offers.partiallyAccepted");case"rejected":return n("offers.status.rejected");case"expired":return n("offers.status.expired");case"cancelled":return n("orders.status.cancelled");default:return r||"—"}}function ge(r){switch((r??"").toLowerCase()){case"completed":case"closed":return"inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium bg-emerald-100 text-emerald-800 dark:bg-emerald-900/50 dark:text-emerald-300";case"in_production":case"in production":return"inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium bg-sky-100 text-sky-800 dark:bg-sky-900/50 dark:text-sky-300";
1case"cancelled":return"inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium bg-red-100 text-red-800 dark:bg-red-900/50 dark:text-red-300";case"on_hold":case"pending":return"inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium bg-amber-100 text-amber-800 dark:bg-amber-900/50 dark:text-amber-300";default:return"inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium bg-slate-100 text-slate-600 dark:bg-slate-800 dark:text-slate-400"}}function Ne(r,n){switch((r??"").toLowerCase()){case"open":return n("orders.status.open");case"in_production":case"in production":return n("orders.status.inProduction");case"completed":return n("orders.status.completed");case"closed":return n("orders.status.closed");case"cancelled":return n("orders.status.cancelled");case"pending":return n("orders.status.pending");case"on_hold":case"onhold":return n("orders.status.onHold");default:return r||"—"}}export{Xe 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.