1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1368],{2719:(e,t,o)=>{o.d(t,{HG:()=>c,Ts:()=>s,by:()=>x,g8:()=>i});var r=o(37876),a=o(48230),n=o.n(a);function s({count:e,label:t}){return"number"!=typeof e||e<=0?null:(0,r.jsx)("span",{"aria-label":t,style:p,children:e})}function i({href:e,label:t,active:o,badge:a}){return(0,r.jsxs)(n(),{href:e,"aria-current":o?"page":void 0,className:`stock-nav-tab${o?" stock-nav-tab--active":""}`,style:{...b,...o?h:{}},children:[(0,r.jsx)("span",{children:t}),a]})}function c({documentId:e,authorized:t,busy:o,onSubmit:a}){return(0,r.jsxs)("div",{className:"stock-receive-guidance",style:d,children:[(0,r.jsx)("strong",{style:u,children:t?"Submit this receipt for QC":"Waiting for a Stock receiver"}),(0,r.jsx)("span",{style:f,children:t?"Review the receipt details. Inventory will not change until final posting.":"A user with Stock receiving permission must review and submit this receipt."}),t&&(0,r.jsxs)("div",{style:l,children:[(0,r.jsx)("button",{type:"button",disabled:o,className:"stock-button stock-button--primary",style:k,onClick:a,children:o?"Submitting...":"Submit receipt to QC"}),(0,r.jsx)(n(),{href:`/stock/documents/${e}/edit`,className:"stock-button stock-button--secondary",style:g,children:"Edit receipt"})]})]})}let l={display:"flex",gridColumn:2,gridRow:"1 / span 2",gap:8,alignItems:"center",justifyContent:"flex-end",flexWrap:"wrap"},d={display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto",gap:"6px 16px",minWidth:0},u={display:"block",color:"#071a3d",fontSize:17,lineHeight:1.35},f={display:"block",color:"#475569",lineHeight:1.55},p={display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:20,height:20,padding:"0 5px",boxSizing:"border-box",borderRadius:999,color:"#fff",background:"#1e3a8a",fontSize:11,lineHeight:1,fontWeight:900},g={display:"inline-flex",alignItems:"center",minHeight:44,padding:"0 16px",borderRadius:9,color:"#173b7a",background:"#fff",border:"1px solid #64748b",textDecoration:"none",fontWeight:800,outlineOffset:3},k={minHeight:44,padding:"0 16px",border:"1px solid #1d4ed8",borderRadius:9,color:"#fff",background:"#1d4ed8",fontWeight:800,cursor:"pointer",outlineOffset:3},m={...k,color:"#991b1b",background:"#fff",border:"1px solid #ef4444"},b={display:"inline-flex",alignItems:"center",gap:5,minHeight:38,padding:"7px 11px",borderRadius:8,color:"#334155",background:"transparent",border:"1px solid transparent",textDecoration:"none",fontSize:13,fontWeight:750,outlineOffset:3},h={color:"#fff",background:"#173b7a",borderColor:"#173b7a"},x={badge:p,secondaryLink:g,primaryButton:k,dangerButton:m,navigationTab:b,activeNavigationTab:h}},5226:(e,t,o)=>{o.d(t,{a:()=>i});var r=o(14232),a=o(39540),n=o(50876);class s{start(e,t,o,r=()=>void 0){let a=++this.requestId;if(this.controller?.abort(),this.controller=null,!e)return o({data:null,loading:!1,error:""}),r({kind:"inactive",generationId:a,active:!1,hasSucceeded:!1}),()=>void 0;let n=new AbortController;return this.controller=n,o({data:null,loading:!0,error:""}),r({kind:"start",generationId:a,active:!0,hasSucceeded:!1}),t(e,n.signal).then(e=>{a!==this.requestId||n.signal.aborted||(o({data:e,loading:!1,error:""}),r({kind:"success",generationId:a,active:!0,hasSucceeded:!0}))}).catch(e=>{if(a===this.requestId&&!n.signal.aborted){let t=e&&"object"==typeof e?e:{},n=e instanceof Error?e.message:"Unable to load Stock data.";o({data:null,loading:!1,error:n}),r({kind:"failure",generationId:a,active:!0,hasSucceeded:!1,status:"number"==typeof t.status?t.status:void 0,code:"string"==typeof t.code?t.code:void 0,message:n})}}),()=>{a===this.requestId&&n.abort()}}constructor(){this.requestId=0,this.controller=null}}function i(e,t={}){let{user:o}=(0,a.As)(),[c,l]=(0,r.useState)({data:null,loading:!1,error:""}),[d,u]=(0,r.useState)({kind:"inactive",generationId:0,active:!1,hasSucceeded:!1}),f=(0,r.useRef)(new s),[p,g]=(0,r.useState)(0),k=(0,r.useCallback)(()=>g(e=>e+1),[]);return(0,r.useEffect)(()=>
1{let t=o?.organizationId?e:null;return f.current.start(t,(e,t)=>(0,n.Rx)(e,{signal:t}),l,e=>{u(e),e.kind})},[t.source,e,p,o?.organizationId]),{...c,...d,endpoint:e,reload:k}}},11368:(e,t,o)=>{o.d(t,{jP:()=>v,Kj:()=>w,rB:()=>j,KT:()=>x,lo:()=>y,lZ:()=>H});var r=o(37876),a=o(94208),n=o.n(a),s=o(89099),i=o(14232),c=o(23256),l=o(39540),d=o(50876),u=o(24043),f=o(5226),p=o(2719),g=o(15137),k=o(48620),m=o(50386);let b=[["Overview","/stock"],["Pilot Queue","/stock/work-queue"],["Products","/stock/products"],["Warehouses","/stock/master/warehouse"],["Borrowers","/stock/master/borrowers"],["Receive","/stock/receive"],["Issue","/stock/issue"],["Transfer","/stock/transfer"],["Borrow","/stock/borrow"],["Return","/stock/return"],["Stock Count","/stock/count"],["Adjustment","/stock/adjustment"],["QC","/stock/qc"],["Approvals","/stock/approvals"],["Alerts","/stock/alerts"],["Reports","/stock/reports"],["Reconciliation","/stock/reconciliation"],["Reorder","/stock/reorder"],["Numbering","/stock/settings/document-numbering"],["SLA Policy","/stock/settings/sla-policy"],["Movements","/stock/movements"],["Audit","/stock/audit"],["Serials","/stock/serials"]],h=new Set(["/stock","/stock/work-queue","/stock/products","/stock/master/warehouse","/stock/master/borrowers","/stock/receive","/stock/issue","/stock/transfer","/stock/borrow","/stock/return","/stock/count","/stock/adjustment","/stock/qc","/stock/approvals","/stock/movements","/stock/serials"]);function x({title:e,description:t,actions:o,activeNavigationHref:a,navigationAlertCount:k,useDedicatedAlertCount:j=!0,useDedicatedWorkflowCounts:P=!0,workspaceNavigation:D,children:q}){let{user:B,loading:U}=(0,l.As)(),[H,$]=(0,i.useState)(null),[Q,V]=(0,i.useState)(!1),[M,J]=(0,i.useState)(!1),[F,K]=(0,i.useState)(""),X=(0,g._m)(B,"stock.view");(0,i.useEffect)(()=>{if(U)return;if(!X){$({enforced:!1,owners:[]}),J(!1),V(!0),K("");return}let e=!0;return(0,d.Rx)("/api/stock/owner-context").then(t=>{if(!e||(J(!1),$(t),!t.enforced))return;let o=window.sessionStorage.getItem("bes.stockOwnerId")||"",r=t.owners.some(e=>e.id===o)?o:"";r||window.sessionStorage.removeItem("bes.stockOwnerId"),K(r)}).catch(()=>{e&&($(null),J(!0))}).finally(()=>{e&&V(!0)}),()=>{e=!1}},[U,X,B?.uid]);let Z=Q&&!M&&(!H?.enforced||!!F),Y=function(e=!0){let t=(0,f.a)(e?"/api/stock/workflow-counts":null);return(0,i.useEffect)(()=>e?(0,u._R)(t.reload):void 0,[e,t.reload]),(0,i.useEffect)(()=>{e&&t.error},[e,t.error]),{counts:t.data,loading:t.loading,unavailable:e&&!!t.error}}(Z&&P&&["stock.receive","stock.qc","stock.approve","stock.post","stock.count"].some(e=>(0,g._m)(B,e))),ee=function(e=!0){let t=(0,f.a)(e?"/api/stock/alerts?page=1&pageSize=1":null,{source:"Stock alert count"});return(0,i.useEffect)(()=>e?(0,u._R)(t.reload):void 0,[e,t.reload]),{count:t.data?.unreadCount??void 0,incomplete:t.data?.completeness?.countCompleteness==="INCOMPLETE",unavailable:e&&!!t.error}}(Z&&j&&(0,m.kL)(B,"/stock/alerts")),et=(0,s.useRouter)().asPath.split(/[?#]/)[0],eo=b.find(([,e])=>"/stock"===e?et===e:et===e||et.startsWith(`${e}/`))?.[1],er=a||eo;return(0,r.jsx)(c.A,{children:(0,r.jsxs)("main",{style:S,"data-stock-print-root":!0,className:"jsx-3835f966801fef8a",children:[(0,r.jsxs)("header",{style:C,"data-print-hidden":!0,className:"jsx-3835f966801fef8a",children:[(0,r.jsxs)("div",{className:"jsx-3835f966801fef8a",children:[(0,r.jsx)("div",{style:I,className:"jsx-3835f966801fef8a",children:"BES OS \xb7 ORGANIZATION STOCK"}),(0,r.jsx)("h1",{style:E,className:"jsx-3835f966801fef8a",children:e}),(0,r.jsx)("p",{style:N,className:"jsx-3835f966801fef8a",children:t})]}),o&&(0,r.jsx)("div",{style:R,className:"jsx-3835f966801fef8a",children:o})]}),H?.enforced&&(0,r.jsxs)("section",{style:W,"aria-label":"Stock Owner context","data-stock-owner-context":!0,"data-print-hidden":!0,className:"jsx-3835f966801fef8a",children:[(0,r.jsxs)("label",{style:L,className:"jsx-3835f966801fef8a",children:["à¸à¸£à¸´à¸©à¸±à¸à¹à¸à¹à¸²à¸à¸à¸ Stock",(0,r.jsxs)("select",{value:F,onChange:e=>{let t=e.target.value;t?window.sessionStorage.setItem("bes.stockOwnerId",t):window.sessionStorage.removeItem("bes.stockOwnerId"),K(t),window.location.reload()},style:G,className:"jsx-3835f966801fef8a",children:[(0,r.jsx)("option",{value:"",className:"jsx-3835f966801fef8a",children:"à¹à¸¥à¸·à¸à¸à¸à¸£à¸´à¸©à¸±à¸à¹à¸à¹à¸²à¸à¸à¸ Stock"}),H.owners.map(e=>(0,r.jsxs)("option",{value:e.id,className:"jsx-3835f966801fef8a",children:[e.code," \xb7 ",e.displayName]},e.id))]})]}),!F&&(0,r.jsx)("div",{role:"status",style:_,className:"jsx-3835f966801fef8a",children:"à¸à¸£à¸¸à¸à¸²à¹à¸¥à¸·à¸à¸à¸à¸£à¸´à¸©à¸±à¸à¸à¹à¸à¸à¸à¸¹à¸à¹à¸à¸¡à¸¹à¸¥ Stock ระà¸à¸à¸à¸°à¹à¸¡à¹à¸£à¸§à¸¡à¸¢à¸à¸à¸à¹à¸²à¸¡à¸à¸£à¸´à¸©à¸±à¸"})]}),(0,r.jsx)("nav",{style:O,"aria-label":"Stock navigation","data-
1print-hidden":!0,className:"jsx-3835f966801fef8a",children:b.filter(([,e])=>(!H?.enforced||h.has(e))&&(!D||"/stock"===e||D.includes(e))&&(0,m.kL)(B,e)&&(!e.startsWith("/stock/settings/")||(0,g._m)(B,"settings.view")&&(0,g._m)(B,"stock.view"))).map(([e,t])=>{let o="/stock/receive"===t?Y.counts?.receiveActionRequired:"/stock/count"===t?Y.counts?.countActionRequired:"/stock/qc"===t?Y.counts?.qc:"/stock/approvals"===t?Y.counts?.approvals:"/stock/alerts"===t?j?ee.count:k:void 0,a="/stock/qc"===t?`${o} ${1===o?"document":"documents"} waiting for QC`:"/stock/count"===t?`${o} active ${1===o?"count":"counts"} requiring workflow action`:"/stock/receive"===t?`${o} ${1===o?"receipt":"receipts"} requiring receiver action`:"/stock/alerts"===t?ee.incomplete?"Stock alert count is incomplete":`${o} unread Stock ${1===o?"alert":"alerts"}`:`${o} ${1===o?"document":"documents"} waiting for approval or posting`,n=er===t;return(0,r.jsx)(p.g8,{href:t,label:e,active:n,badge:"/stock/receive"===t||"/stock/count"===t||"/stock/qc"===t||"/stock/approvals"===t?(0,r.jsx)("span",{style:A,className:"jsx-3835f966801fef8a",children:(0,r.jsx)("span",{className:"jsx-3835f966801fef8a "+((n?"stock-nav-badge stock-nav-badge--active":"stock-nav-badge")||""),children:(0,r.jsx)(p.Ts,{count:o,label:a})})}):"/stock/alerts"===t?(0,r.jsx)("span",{style:A,className:"jsx-3835f966801fef8a",children:(0,r.jsx)("span",{className:"jsx-3835f966801fef8a "+((n?"stock-nav-badge stock-nav-badge--active":"stock-nav-badge")||""),children:ee.incomplete?(0,r.jsx)("span",{"aria-label":a,title:"à¸à¹à¸à¸¡à¸¹à¸¥à¹à¸à¹à¸à¹à¸à¸·à¸à¸à¸¢à¸±à¸à¸à¸£à¸§à¸à¹à¸¡à¹à¸à¸£à¸",style:T,className:"jsx-3835f966801fef8a",children:"!"}):(0,r.jsx)(p.Ts,{count:o,label:a})})}):void 0},t)})}),Y.unavailable&&(0,r.jsx)("div",{role:"status",style:z,className:"jsx-3835f966801fef8a",children:"Workflow counts unavailable"}),(0,r.jsx)(n(),{id:"3835f966801fef8a",children:".stock-nav-tab:hover{background:#eff6ff!important;color:#1d4ed8!important;border-color:#bfdbfe!important}.stock-nav-tab--active,.stock-nav-tab--active:hover{background:#173b7a!important;color:#fff!important;border-color:#173b7a!important}.stock-nav-tab:focus-visible,.stock-button:focus-visible{outline:3px solid#60a5fa!important;outline-offset:3px}[data-stock-print-root] a:focus-visible,[data-stock-print-root] button:focus-visible,[data-stock-print-root] input:focus-visible,[data-stock-print-root] select:focus-visible,[data-stock-print-root] textarea:focus-visible{outline:3px solid#2563eb!important;outline-offset:3px}[data-stock-print-root] a{text-underline-offset:3px}[data-stock-print-root] button,[data-stock-print-root] a.stock-button{min-height:44px}[data-stock-print-root] input,[data-stock-print-root] select,[data-stock-print-root] textarea{color:#0f172a}[data-stock-print-root] input:disabled,[data-stock-print-root] select:disabled,[data-stock-print-root] textarea:disabled{color:#475569;background:#f1f5f9;opacity:1}.stock-field-help{margin:0 0 16px;padding:12px 14px;border:1px solid#94a3b8;border-radius:10px;background:#f8fafc;color:#334155;line-height:1.6}.stock-field-help summary{cursor:pointer;color:#173b7a;font-weight:800;min-height:44px;display:flex;align-items:center}.stock-field-help summary:focus-visible{outline:3px solid#2563eb;outline-offset:2px}.stock-field-help ul{margin:6px 0 0;padding-left:22px}.stock-field-help li{margin:4px 0}.stock-action-bar{position:sticky;bottom:12px;z-index:10;display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:16px;padding:12px;border:1px solid#bfdbfe;border-radius:14px;background:rgba(255,255,255,.97);box-shadow:0 10px 30px rgba(15,23,42,.14)}.stock-action-bar__hint{margin-right:auto;color:#334155;font-size:13px;font-weight:700}.stock-route{display:grid;grid-template-columns:minmax(0,1fr)auto minmax(0,1fr);align-items:center;gap:10px;color:#0f172a}.stock-route__point{min-width:0;padding:10px 12px;border:1px solid#cbd5e1;border-radius:10px;background:#f8fafc;overflow-wrap:anywhere}.stock-route__point small{display:block;margin-bottom:3px;color:#475569;font-weight:800}.stock-route__arrow{color:#1d4ed8;font-size:20px;font-weight:900}.stock-nav-badge--active>span{background:#fff!important;color:#173b7a!important}.stock-button{transition:background-color.15s ease,border-color.15s ease,color.15s ease}.stock-button--primary:hover:not(:disabled){background:#173b7a!important}.stock-button--secondary:hover:not(:disabled){background:#eff6ff!important;border-color:#3b82f6!important;color:#1d4ed8!important}.stock-button--danger:hover:not(:disabled){background:#fee2e2!important;border-color:#dc2626!important}.stock-button:disabled{cursor:not-allowed!important;opacity:.65}@media(max-width:640px){[data-stock-print-root]{padding:16px 12px 104px!important}[data-stock-print-root]>header{display:grid!important}[data-stock-owner-context]{grid-template-columns:1fr!important}.stock-next-step-card,.stock-receive-guidance{grid-template-columns:1fr!important}.stock-next-step-actions,.stock-receive-guidance>div{width:100%;grid-column:1!important;grid-row:auto!important;justify-content:flex-start!important}.stock-route{grid-template-columns:1fr}.stock-route__arrow{transform:rotate(90deg);justify-self:center}.stock-action-bar{position:static}.stock-action-bar>
1button,.stock-action-bar>a{flex:1 1 100%;justify-content:center}}"}),(0,r.jsx)(v,{children:Q?M?(0,r.jsx)(y,{children:(0,r.jsx)(w,{title:"à¹à¸¡à¹à¸ªà¸²à¸¡à¸²à¸£à¸à¸à¸£à¸§à¸à¸ªà¸´à¸à¸à¸´à¹à¸à¸£à¸´à¸©à¸±à¸",detail:"หยุà¸à¹à¸«à¸¥à¸à¸à¹à¸à¸¡à¸¹à¸¥ Stock à¹à¸à¸·à¹à¸à¸à¹à¸à¸à¸à¸±à¸à¸à¸²à¸£à¹à¸ªà¸à¸à¸à¹à¸à¸¡à¸¹à¸¥à¸à¸´à¸à¸à¸à¸à¹à¸à¸ à¸à¸£à¸¸à¸à¸²à¸¥à¸à¸à¹à¸«à¸¡à¹à¸ ายหลัà¸"})}):H?.enforced&&!F?(0,r.jsx)(y,{children:(0,r.jsx)(w,{title:"à¹à¸¥à¸·à¸à¸à¸à¸£à¸´à¸©à¸±à¸à¹à¸à¹à¸²à¸à¸à¸ Stock",detail:"à¸à¹à¸à¸¡à¸¹à¸¥ Stock à¸à¸°à¹à¸ªà¸à¸à¸à¸µà¸¥à¸°à¸à¸£à¸´à¸©à¸±à¸à¸à¸²à¸¡à¸ªà¸´à¸à¸à¸´à¹à¸à¸µà¹à¹à¸à¹à¸£à¸±à¸à¹à¸à¹à¸²à¸à¸±à¹à¸"})}):q:(0,r.jsx)(y,{children:(0,r.jsx)(w,{title:"à¸à¸³à¸¥à¸±à¸à¸à¸£à¸§à¸à¸ªà¸´à¸à¸à¸´à¹à¸à¸£à¸´à¸©à¸±à¸",detail:"ระà¸à¸à¸à¸³à¸¥à¸±à¸à¹à¸«à¸¥à¸à¸à¸à¸à¹à¸à¸ Stock à¸à¸µà¹à¹à¸à¹à¸£à¸±à¸à¸à¸à¸¸à¸à¸²à¸"})})})]})})}function v({children:e}){let{user:t}=(0,l.As)(),[o,a]=(0,i.useState)("bes-group"),[n,s]=(0,i.useState)("BES Group"),[c,u]=(0,i.useState)(!1),[f,p]=(0,i.useState)("");if(t?.organizationId)return(0,r.jsx)(r.Fragment,{children:e});if(t?.role!=="SUPER_ADMIN")return(0,r.jsx)(y,{children:(0,r.jsx)(w,{title:"Organization not assigned",detail:"Ask a Super Admin to assign your Organization ID in Users & Roles before using Stock."})});let g=async()=>{u(!0),p("");try{await (0,d.Rx)("/api/organizations/bootstrap",{method:"POST",body:JSON.stringify({organizationId:o,name:n})}),window.location.reload()}catch(e){p(e instanceof Error?e.message:"The organization could not be initialized.")}finally{u(!1)}};return(0,r.jsxs)(y,{children:[(0,r.jsx)("h2",{style:{marginTop:0},children:"Initialize your organization"}),(0,r.jsx)("p",{style:{color:"#475569"},children:"This one-time setup creates the organization boundary and assigns your Super Admin account to it."}),(0,r.jsxs)("div",{style:U,children:[(0,r.jsxs)("label",{style:L,children:["Organization ID",(0,r.jsx)("input",{value:o,onChange:e=>a(e.target.value),style:G})]}),(0,r.jsxs)("label",{style:L,children:["Organization name",(0,r.jsx)("input",{value:n,onChange:e=>s(e.target.value),style:G})]})]}),f&&(0,r.jsx)(j,{message:f}),(0,r.jsx)("button",{type:"button",disabled:c,onClick:()=>void g(),style:B,children:c?"Initializing...":"Initialize organization"})]})}function y({children:e}){return(0,r.jsx)("section",{style:P,children:e})}function w({title:e,detail:t}){return(0,r.jsxs)("div",{style:D,children:[(0,r.jsx)("strong",{style:{color:"#0f172a",fontSize:18},children:e}),(0,r.jsx)("span",{style:{color:"#334155",lineHeight:1.55},children:t})]})}function j({message:e}){let t=(0,k.nx)(e);return(0,r.jsxs)("div",{role:"alert",style:q,children:[(0,r.jsx)("strong",{children:t.category}),(0,r.jsx)("div",{children:t.remedy}),(0,r.jsxs)("details",{children:[(0,r.jsx)("summary",{children:"รายละà¹à¸à¸µà¸¢à¸à¸à¹à¸à¸à¸´à¸à¸à¸¥à¸²à¸"}),(0,r.jsx)("span",{children:e})]})]})}let S={minHeight:"100vh",padding:"24px 24px 104px",color:"#0f172a",background:"#f1f5f9"},C={display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:18,marginBottom:18},I={color:"#2563eb",fontSize:11,fontWeight:900,letterSpacing:".14em"},E={margin:"7px 0 6px",color:"#071a3d",fontSize:36},N={margin:0,maxWidth:760,color:"#334155",lineHeight:1.6,fontWeight:550},R={display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},O={display:"flex",flexWrap:"wrap",gap:8,marginBottom:18,padding:10,border:"1px solid #dbe5f1",borderRadius:14,background:"#fff"},A={display:"inline-flex",justifyContent:"center",minWidth:20},T={display:"inline-grid",placeItems:"center",minWidth:20,minHeight:20,padding:"0 6px",borderRadius:999,background:"#f59e0b",color:"#111827",fontSize:12,fontWeight:900},z={margin:"-8px 0 16px",color:"#713f12",fontSize:13,fontWeight:700},W={marginBottom:14,padding:14,border:"1px solid #93c5fd",borderRadius:12,background:"#eff6ff",display:"grid",gridTemplateColumns:"minmax(220px, 360px) minmax(0, 1fr)",gap:12,alignItems:"end"},_={padding:10,color:"#7c2d12",background:"#fff7ed",border:"1px solid #fdba74",borderRadius:9,fontWeight:800},P={marginBottom:14,padding:18,border:"1px solid #cbd5e1",borderRadius:14,background:"#fff",overflowX:"auto"},D={minHeight:150,display:"grid",placeContent:"center",gap:8,textAlign:"center"},q={margin:"12px 0",padding:12,color:"#b91c1c",background:"#fef2f2",border:"1px solid #fecaca",borderRadius:10},B=p.by.primaryButton,U={display:"grid",gridTemplateColumns:"repeat(auto-fit,minmax(220px,1fr))",alignItems:"start",ga
1p:12,marginBottom:14},L={display:"grid",alignContent:"start",gap:6,color:"#334155",fontSize:13,fontWeight:800},G={width:"100%",minHeight:44,boxSizing:"border-box",padding:"9px 11px",color:"#0f172a",border:"1px solid #94a3b8",borderRadius:9,background:"#fff",outlineOffset:3},H={table:{width:"100%",borderCollapse:"collapse"},th:{padding:11,textAlign:"left",color:"#1e293b",background:"#f1f5f9",borderBottom:"1px solid #94a3b8",fontSize:12,fontWeight:900},td:{padding:11,color:"#1e293b",borderBottom:"1px solid #cbd5e1",verticalAlign:"top"},primaryButton:B,secondaryButton:p.by.secondaryLink,dangerButton:p.by.dangerButton,input:G,field:L,formGrid:U}},23256:(e,t,o)=>{o.d(t,{A:()=>n});var r=o(37876),a=o(64602);function n({children:e}){return(0,r.jsx)(a.A,{children:e})}},24043:(e,t,o)=>{o.d(t,{V4:()=>r,_R:()=>n,kH:()=>s,rN:()=>i});let r={DRAFT:{message:"Complete and submit the document",href:null,action:null},SUBMITTED:{message:"Continue to the required workflow queue",href:null,action:null},PENDING_QC:{message:"Waiting for QC",href:"/stock/qc",action:"Go to QC"},PENDING_APPROVAL:{message:"Waiting for approval",href:"/stock/approvals",action:"Go to approvals"},APPROVED:{message:"Waiting for posting",href:"/stock/approvals",action:"Go to posting queue"},POSTED:{message:"Completed",href:"/stock/movements",action:"View movements"},REJECTED:{message:"Closed as rejected",href:null,action:null},CANCELLED:{message:"Closed as cancelled",href:null,action:null}},a=new Set;function n(e){return a.add(e),()=>{a.delete(e)}}function s(){a.forEach(e=>e())}async function i(e,t){let o=await t(e.id,"SUBMITTED",e.version);return t(e.id,"PENDING_QC",o.version)}},48620:(e,t,o)=>{function r(e,t,o){return e.allowedActions?e.allowedActions.includes(t):o}function a(e,t){switch(e.status){case"DRAFT":return{step:"à¸à¸£à¸§à¸à¸à¹à¸à¸¡à¸¹à¸¥à¹à¸¥à¸°à¸ªà¹à¸à¹à¸à¸à¸ªà¸²à¸£",owner:"à¸à¸¹à¹à¸à¸±à¸à¸à¸³à¹à¸à¸à¸ªà¸²à¸£",blocked:t?"":"à¸à¸±à¸à¸à¸µà¸à¸µà¹à¹à¸¡à¹à¸¡à¸µà¸ªà¸´à¸à¸à¸´à¹à¹à¸à¹à¹à¸à¸«à¸£à¸·à¸à¸ªà¹à¸à¹à¸à¸à¸ªà¸²à¸£à¸à¸à¸±à¸à¸à¸µà¹ à¹à¸«à¹à¸à¸¹à¹à¸£à¸±à¸à¸à¸´à¸à¸à¸à¸à¸à¸³à¹à¸à¸´à¸à¸à¸²à¸£"};case"SUBMITTED":return{step:"RECEIVE"===e.type||"RETURN"===e.type?"สà¹à¸à¹à¸«à¹à¸à¸£à¸§à¸ QC":"สà¹à¸à¹à¸«à¹à¸à¸¹à¹à¸à¸à¸¸à¸¡à¸±à¸à¸´",owner:"à¸à¸¹à¹à¸£à¸±à¸à¸à¸´à¸à¸à¸à¸à¹à¸à¸à¸ªà¸²à¸£",blocked:t?"":"รà¸à¸à¸¹à¹à¸£à¸±à¸à¸à¸´à¸à¸à¸à¸à¸à¸µà¹à¸¡à¸µà¸ªà¸´à¸à¸à¸´à¹à¸ªà¹à¸à¸à¹à¸à¹à¸à¸à¸ªà¸²à¸£"};case"PENDING_QC":return{step:"à¸à¸£à¸§à¸à¸à¸¸à¸à¸ าภ(QC)",owner:"à¸à¸¹à¹à¸à¸£à¸§à¸ QC",blocked:t?"":"รà¸à¸à¸¹à¹à¸à¸£à¸§à¸ QC à¸à¸µà¹à¹à¸à¹à¸£à¸±à¸à¸ªà¸´à¸à¸à¸´à¹ หาà¸à¹à¸à¹à¸à¸à¸²à¸à¸à¸à¸à¸à¸à¹à¸à¸à¸à¹à¸à¸à¸¢à¸·à¸à¸¢à¸±à¸à¹à¸«à¸à¸¸à¸à¸¥à¸à¸²à¸¡à¸à¸±à¹à¸à¸à¸à¸à¸à¸§à¸à¸à¸¸à¸¡"};case"PENDING_APPROVAL":return{step:"à¸à¸´à¸à¸²à¸£à¸à¸²à¸à¸à¸¸à¸¡à¸±à¸à¸´",owner:"à¸à¸¹à¹à¸à¸à¸¸à¸¡à¸±à¸à¸´ Stock",blocked:t?"":"รà¸à¸à¸¹à¹à¸à¸à¸¸à¸¡à¸±à¸à¸´à¸à¸µà¹à¹à¸à¹à¸£à¸±à¸à¸ªà¸´à¸à¸à¸´à¹ à¹à¸¡à¹à¸à¸§à¸£à¸à¸à¸ªà¹à¸à¸à¸³à¸à¸à¸à¹à¸³"};case"APPROVED":return{step:"à¸à¸£à¸§à¸à¸à¸²à¸à¹à¸¥à¸°à¸à¸±à¸à¸à¸¶à¸à¹à¸à¹à¸²à¸ªà¸à¹à¸à¸",owner:"à¸à¸¹à¹à¸à¸±à¸à¸à¸¶à¸ Stock",blocked:t?"":"รà¸à¸à¸¹à¹à¸à¸±à¸à¸à¸¶à¸ Stock à¸à¸µà¹à¹à¸à¹à¸£à¸±à¸à¸ªà¸´à¸à¸à¸´à¹ ยà¸à¸à¸à¸à¹à¸«à¸¥à¸·à¸à¸¢à¸±à¸à¹à¸¡à¹à¹à¸à¸¥à¸µà¹à¸¢à¸à¸à¸à¸à¸§à¹à¸²à¸à¸°à¸à¸±à¸à¸à¸¶à¸à¸ªà¸³à¹à¸£à¹à¸"};case"POSTED":return{step:"à¸à¸£à¸§à¸à¸£à¸²à¸¢à¸à¸²à¸£à¹à¸à¸¥à¸·à¹à¸à¸à¹à¸«à¸§",owner:"à¸à¸¹à¹à¸à¸´à¸à¸à¸²à¸¡à¹à¸à¸à¸ªà¸²à¸£",blocked:"à¹à¸à¸à¸ªà¸²à¸£à¹à¸ªà¸£à¹à¸à¹à¸¥à¹à¸§ à¹à¸¡à¹à¸ªà¸²à¸¡à¸²à¸£à¸à¸à¸±à¸à¸à¸¶à¸à¸à¹à¸³à¸«à¸£à¸·à¸à¹à¸à¹à¹à¸à¹à¸à¹"};case"REJECTED":return{step:"à¸à¸£à¸§à¸à¹à¸«à¸à¸¸à¸à¸¥à¸à¸²à¸£à¸à¸à¸´à¹à¸ªà¸",owner:"à¸à¸¹à¹à¸à¸±à¸à¸à¸³à¹à¸à¸à¸ªà¸²à¸£",blocked:"à¹à¸à¸à¸ªà¸²à¸£à¸à¸¹à¸à¸à¸´à¸à¹à¸¥à¹à¸§ à¹à¸«à¹à¹à¸£à¸´à¹à¸¡à¹à¸à¸à¸ªà¸²à¸£à¹à¸«à¸¡à¹à¹à¸¡à¸·à¹à¸à¹à¸à¹à¸£à¸±à¸à¸à¸³à¹à¸à¸°à¸à¸³à¸à¸²à¸à¸à¸¹à¹à¸£à¸±à¸à¸à¸´à¸à¸à¸à¸"};case"CANCELLED":return{step:"à¸à¸£à¸§à¸à¸à¸£à¸°à¸§à¸±à¸à¸´à¸à¸²à¸£à¸¢à¸à¹à¸¥à¸´à¸",owner:"à¸à¸¹à¹à¸à¸±à¸à¸à¸³à¹à¸à¸à¸ªà¸²à¸£",blocked:"à¹à¸à¸à¸ªà¸²à¸£à¸à¸¹à¸à¸¢à¸à¹à¸¥à¸´à¸à¹à¸¥à¹à¸§ à¹à¸¡à¹à¸ªà¸²à¸¡à¸²à¸£à¸à¸à¸³à¹à¸à¸´à¸à¸à¸²à¸£à¸à¹à¸"}}}function n(e){let t=e.toLowerCase();return/permission|forbidden|unauthori[sz]ed|access|403|auth\/|sign in|à¹à¸¡à¹à¸¡à¸µà¸ªà¸´à¸à¸à¸´à¹/.test(t)?{category:"à¹à¸¡à¹à¸¡à¸µà¸ªà¸´à¸à¸à¸´à¹",remedy:"à¸à¸£à¸§à¸à¸ªà¸à¸à¸à¸±à¸à¸à¸µà¹à¸¥à¸°à¸à¸´à¸à¸à¹à¸à¸à¸¹à¹à¸à¸¹à¹à¸¥à¸ªà¸´à¸à¸à¸´à¹ à¸à¸¢à¹à¸²à¹à¸à¹à¸à¸±à¸à¸à¸µà¸à¸à¸à¸à¸¹à¹à¸à¸·à¹à¸"}:/version|stale|conflict|already|status|state|409|สà¸à¸²à¸à¸°/.test(t)?{category:"สà¸à¸²à¸à¸°à¹à¸à¸à¸ªà¸²à¸£à¹à¸à¸¥à¸µà¹à¸¢à¸à¹à¸¥à¹à¸§",remedy:"à¹à¸à¸´à¸à¹à¸à¸à¸ªà¸²à¸£à¸à¸µà¸à¸à¸£à¸±à¹à¸à¹à¸¥à¸°à¸à¸£à¸§à¸à¸ªà¸à¸²à¸à¸°à¸¥à¹à¸²à¸ªà¸¸à¸à¸à¹à¸à¸à¸à¸±à¸à¸ªà¸´à¸à¹à¸ หà¹à¸²à¸¡à¸ªà¹à¸à¸à¸³à¸ªà¸±à¹à¸à¹à¸à¸´à¸¡à¸à¹à¸³à¹à¸à¸¢à¹à¸¡à¹à¸à¸£à¸§à¸à¸à¸¥"}:/fetch|network|offline|timeout|unavailable|500|502|503|504|à¹à¸à¸£à¸·à¸à¸à¹à¸²à¸¢/.test(t)?{category:"ระà¸à¸à¸«à¸£à¸·à¸à¹à¸à¸£à¸·à¸à¸à¹à¸²à¸¢à¹à¸¡à¹à¸à¸£à¹à¸à¸¡",remedy:"à¸à¸£à¸§à¸à¸à¸²à¸£à¹à¸à¸·à¹à¸à¸¡à¸à¹à¸à¹à¸¥à¸°à¹à¸à¸´à¸à¸«à¸à¹à¸²à¸à¹à¸²à¸à¸à¹à¸à¸¡à¸¹à¸¥à¹à¸«à¸¡à¹à¹à¸à¸·à¹à¸à¸à¸£à¸§à¸à¸à¸¥à¸à¸³à¸ªà¸±à¹à¸à¸¥à¹à¸²à¸ªà¸¸à¸ หà¹à¸²à¸¡à¸à¸à¸à¸±à¸à¸à¸¶à¸à¸«à¸£à¸·à¸à¸ªà¹à¸à¸à¹à¸³à¸à¸à¸à¸§à¹à¸²à¸à¸°à¸¢à¸·à¸à¸¢à¸±à¸à¸ªà¸à¸²à¸à¸°"}:{category:"à¸à¹à¸à¸¡à¸¹à¸¥à¹à¸¡à¹à¸à¸£à¸à¸«à¸£à¸·à¸à¹à¸¡à¹à¸à¸¹à¸à¸à¹à¸à¸",remedy:"à¸à¸£à¸§à¸à¸à¹à¸à¸à¸à¸µà¹à¸£à¸°à¸à¸¸à¹à¸¥à¸°à¹à¸à¹à¹à¸à¸à¸²à¸°à¸à¹à¸à¸¡à¸¹à¸¥à¸à¸µà¹à¸¢à¸±à¸à¹à¸¡à¹à¸à¸¹à¸à¸à¹à¸à¸ à¹à¸¥à¹à¸§à¸à¸£à¸§à¸à¹à¸à¸à¸ªà¸²à¸£à¸à¹à¸à¸à¸ªà¹à¸à¸à¸µà¸à¸à¸£à¸±à¹à¸"}}o.d(t,{cn:()=>r,mN:()=>a,nx:()=>n})},50876:(e,t,o)=>{o.d(t,{RX:()=>p,Rx:()=>u,ho:()=>f});var r=o(84317),a=o(24043);let n=null,s=null;function i(e,t,o){let r=t?.error||{};return Object.assign(Error(r.message||o),{code:r.code,status:e.status,field:r.field,currentStatus:r.currentStatus,expectedVersion:r.expectedVersion,details:r.details})}async function c(e,t,o={}){let a=async r=>{let a=await e.getIdToken(r);return fetch(t,{...o,cache:o.cache??"no-store",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`,...o.headers}})},n=await a(!1);return 401===n.status&&r.j.currentUser?.uid===e.uid&&(n=await a(!0)),n}async function l(e){if(n?.actorUid===e.uid)return n.value;if(s?.actorUid===e.uid)return s.promise;let t=(async()=>{let t=await c(e,"/api/stock/owner-context"),o=await t.json().catch(()=>({}));if(!t.ok)throw i(t,o,"Unable to resolve the Stock Owner context.");return n={actorUid:e.uid,value:o},o})().finally(()=>{s?.actorUid===e.uid&&(s=null)});return s={actorUid:e.uid,promise:t},t}async function d(e,t={}){let o=r.j.currentUser;if(!o)throw Object.assign(Error("Please sign in again."),{code:"auth/missing-user",status:401});let a=e;if(e.startsWith("/api/stock/")&&"/api/stock/owner-context"!==e){let t=await l(o);if(t.enforced){let o=window.sessionStorage.getItem("bes.stockOwnerId")||"";if(!o||!t.owners.some(e=>e.id===o))throw Object.assign(Error("Select a Stock Owner before opening Stock data."),{code:"stock-owner/context-required",status:409});let r=new URL(e,window.location.origin);r.searchParams.set("stockOwnerId",o),a=`${r.pathname}${r.search}`}}return c(o,a,t)}async function u(e,t={}){if("/api/stock/owner-context"===e&&"GET"===String(t.method||"GET").toUpperCase()){let e=r.j.currentUser;if(!e)throw Object.assign(Error("Please sign in again."),{code:"auth/missing-user",status:401});return l(e)}let o=await d(e,t),n=await o.json().catch(()=>({}));if(!o.ok)throw i(o,n,"The Stock request failed.");let s=String(t.method||"GET").toUpperCase();return"GET"!==s&&"HEAD"!==s&&"/api/stock/unit-identities/check"!==e&&"/api/stock/reorder-procurement"!==e&&(0,a.kH)(),n}async function f(e){let t=await d(e),o=t.headers.get("X-Stock-Report-Next-Cursor");return await g(t),{nextCursor:o}}async function p(e,t){return g(await d(e,{method:"POST",body:JSON.stringify(t)}))}async function g(e){if(!e.ok){let t=await e.json().catch(()=>({})),o=t?.error||{};throw Object.assign(Error(o.message||"The Stock export failed."),{code:o.code,status:e.status})}let t=(e.headers.get("Content-Disposition")||"").match(/filename="([A-Za-z0-9._-]+)"/),o=t?.[1]||"stock-report.csv",r=URL.createObjectURL(await e.blob()),a=document.createElement("a");a.href=r,a.download=o,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(r)}}}]);
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.