PageSourceSearch

https://app.nuport.io/_next/static/chunks/pages/purchase-orders-cbf75151d6b6b707.js

js nuport.io collected 2026-10-01 12:14:12 UTC 15,211 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6218],{83814:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/purchase-orders",function(){return a(67269)}])},67269:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return $}});var l=a(85893),s=a(70449),r=a(47871),n=a(56469),o=a(30381),d=a.n(o),i=a(41664),u=a.n(i),c=a(11163),h=a(67294),p=a(16517),v=a(19893),f=a(33956),x=a(53636),m=a(57517),b=a(17702),_=a(55322),y=a(85905),C=a.n(y),S=a(51259),g=a(17245),O=a(44839),E=a(29838),j=a(10227),R=e=>{let{visible:t,onCancel:a,onComplete:s}=e;return(0,l.jsx)(E.Z,{title:"Upload Purchase Orders",type:"purchase-orders",fields:[{label:"ID",key:"id"},{label:"Location ID",key:"locationId"},{label:"Vendor ID",key:"vendorId"},{label:"Purchase Date",key:"purchaseDate"},{label:"Product ID",key:"productId"},{label:"Quantity",key:"quantity"},{label:"Package Quantity",key:"packageQuantity"}],firstStepPrompt:"Download an example CSV file. Do not modify the first row of the CSV. This CSV will inform you on how to structure your data.",secondStepPrompt:"Edit the CSV file by adding new rows. Rows will be uploaded as new purchase orders into the platform.",visible:t,onCancel:a,onComplete:s,downloadTask:j.g.downloadPurchaseOrdersCsv,uploadTask:j.g.uploadPurchaseOrdersCsv})},D=a(91531),A=a(38674),P=a(33580),N=a(26800),k=a.n(N),w=a(45697),T=a.n(w),Z=a(79850),H=a(69377),I=a(47385),U=a(21757),M=a(4116),V=a(72370),L=a(30369),B=a(12301),q=a(83567),F=a(429);let Y={CREATION_DATE:"createdAt",APPROVED_DATE:"approvedAt",RECEIVED_DATE:"receivedAt"},W=Object.keys(Y).map(e=>({value:Y[e],label:(0,m.ZX)((0,m.Nb)(e))})),z=Object.values(b.U8).map(e=>({value:e,label:(0,m.ZX)((0,m.Nb)(e))})),G=e=>{let{visible:t,exportType:a,onCancel:s}=e,[r,o]=(0,h.useState)(Y.CREATION_DATE),[i,u]=(0,h.useState)(null),[c,p]=(0,h.useState)(null),[v,f]=(0,h.useState)(null),[x,m]=(0,h.useState)([]),[_,y]=(0,h.useState)(!1),[C,S]=(0,h.useState)(!1),[g,O]=(0,h.useState)([]),[E,j]=(0,h.useState)(null),[R,D]=(0,h.useState)([]),[A,P]=(0,h.useState)(!1),[N,w]=(0,h.useState)(!1);(0,h.useEffect)(()=>{Q()},[]),(0,h.useEffect)(()=>{x.length&&x.length===z.length?y(!0):y(!1)},[x]),(0,h.useEffect)(()=>{R.length&&R.length===g.length?P(!0):P(!1)},[R]);let T=async e=>{var t;let a=(null==e?void 0:null===(t=e.trim())||void 0===t?void 0:t.toLowerCase())||"";return a?{data:z.filter(e=>{let{label:t}=e;return t.trim().toLowerCase().includes(a)})}:{data:[]}},G=e=>{let{data:t}=e;f({value:t.value,label:t.label,data:t}),x.find(e=>{let{value:a}=e;return a===t.value})?m(x.filter(e=>{let{value:a}=e;return a!==t.value})):m(x.concat([t]))},Q=async()=>{S(!0);try{var e;let{data:t}=await q.t.index({types:[b.aD.WAREHOUSE,b.aD.FACTORY,b.aD.FULFILMENT_WAREHOUSE]});O((null==t?void 0:null===(e=t.results)||void 0===e?void 0:e.length)?t.results:[])}catch(e){Z.Z.error({message:"Unable To Get Warehouses",description:e.message,placement:"bottomLeft"})}finally{S(!1)}},X=async e=>await q.t.index({searchTerm:e,types:[b.aD.WAREHOUSE,b.aD.FACTORY,b.aD.FULFILMENT_WAREHOUSE]}),J=e=>{let{data:t}=e;j({value:t.value,label:(null==t?void 0:t.label)||(null==t?void 0:t.address),data:t}),R.find(e=>{let{id:a}=e;return a===t.id})?D(R.filter(e=>{let{id:a}=e;return a!==t.id})):D(R.concat([t]))},K=async()=>{w(!0);try{let e={timezone:d().tz.guess()};r&&i&&c&&(e.dateRangeType=r,e.fromDate=i,e.toDate=c),x.length&&(e.statuses=x.map(e=>{let{value:t}=e;return t})),R.length&&(e.locationIds=R.map(e=>{let{id:t}=e;return t})),await F.D.downloadCSV(e),Z.Z.success({message:"Purchase Orders As '".concat(a,"' Download Successful"),description:"Successfully downloaded purchase orders as '".concat(a,"'."),placement:"bottomLeft"})}catch(e){Z.Z.error({message:"Unable To Download Purchase Orders As '".concat(a,"'"),description:e.message,placement:"bottomLeft"})}finally{w(!1),s()}};return(0,l.jsx)(H.Z,{title:"Export",visible:t,onCancel:s,width:538,okText:"Apply",footer:(0,l.jsxs)("div",{className:k().footer,children:[(0,l.jsx)(n.Z,{disabled:!(i||c||x.length||R.length)||N,onClick:()=>{o(Y.CREATION_DATE),u(null),p(null),f(null),m([]),y(!1),j(null),D([]),P(!1)},style:{marginRight:"auto"},children:"Reset Filter"},"reset"),(0,l.jsx)(n.Z,{disabled:N,onClick:s,children:"Cancel"},"cancel"),(0,l.jsx)(n.Z,{className:k().primaryButton,type:"primary",loading:N,disabled:!(i&&c)||N,onClick:K,style:{marginLeft:"16
1px"},children:"Export ".concat(a)},"apply")]}),children:(0,l.jsxs)("div",{className:k().exportModalContainer,children:[(0,l.jsxs)("div",{className:k().section,children:[(0,l.jsx)("h3",{className:k().label,children:"Date Range"}),(0,l.jsx)(I.default.Group,{style:{display:"flex"},onChange:e=>o(e.target.value),value:r,children:W.map(e=>{let{value:t,label:a}=e;return(0,l.jsx)(I.default,{value:t,style:{marginBottom:16},children:a},t)})}),(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(0,l.jsx)(L.Z,{type:"date",title:"From",value:i?d()(i):null,onChange:e=>u((null==e?void 0:e.toDate())||null),disabledDate:e=>e&&e.valueOf()>d()(c),style:{borderRadius:0,flex:1}}),(0,l.jsx)("div",{className:k().dash}),(0,l.jsx)(L.Z,{type:"date",title:"To",value:c?d()(c):null,onChange:e=>p((null==e?void 0:e.toDate())||null),disabledDate:e=>e&&e.valueOf()<d()(i),style:{borderRadius:0,flex:1}})]})]}),(0,l.jsx)(U.Z,{}),(0,l.jsx)("div",{className:k().section,children:(0,l.jsx)(M.Z,{align:"center",children:(0,l.jsx)(B.Z,{style:{width:490},searchTask:T,defaultOptions:z,title:"Purchase Order Status",labelIndex:"label",valueIndex:"value",placeholder:"Select Purchase Order Status",onChange:G,onClear:()=>{m([]),f(null)},value:v,setValue:f,areAllValuesSelected:_,setAreAllValuesSelected:y,onAreAllValuesSelectedChange:e=>{m(e?z:[]),f(null)},selectedValues:x,setSelectedValues:m,isOnChangeDropdownOpen:!0,dropdownConfig:["label"],renderOption:e=>{let{data:t}=e;return(0,l.jsxs)("div",{className:k().optionContainer,children:[(0,l.jsx)(V.Z,{checked:x.some(e=>{let{value:a}=e;return a===t.value}),onChange:()=>G({data:t}),style:{marginRight:8}}),t.label]})},popupContainer:()=>document.querySelector(".ant-modal-body")})})}),(0,l.jsx)(U.Z,{}),(0,l.jsx)("div",{className:k().section,children:(0,l.jsx)(M.Z,{align:"center",children:(0,l.jsx)(B.Z,{style:{width:490},searchTask:X,defaultOptions:g,isLoading:C,title:"Warehouse",customLabel:e=>(null==e?void 0:e.label)||(null==e?void 0:e.address)||"N/A",valueIndex:"id",placeholder:"Select Warehouse",onChange:J,onClear:()=>{D([]),j(null)},value:E,setValue:j,areAllValuesSelected:A,setAreAllValuesSelected:P,onAreAllValuesSelectedChange:e=>{D(e?g:[]),j(null)},selectedValues:R,setSelectedValues:D,isOnChangeDropdownOpen:!0,dropdownConfig:["label"],renderOption:e=>{let{data:t}=e;return(0,l.jsxs)("div",{className:k().optionContainer,children:[(0,l.jsx)(V.Z,{checked:R.some(e=>{let{id:a}=e;return a===t.id}),onChange:()=>J({data:t}),style:{marginRight:8}}),t.label]})},popupContainer:()=>document.querySelector(".ant-modal-body")})})})]})})};G.propTypes={visible:T().bool,exportType:T().string,onCancel:T().func},G.defaultProps={visible:!1,exportType:b.Cx.CSV,onCancel:()=>{}};let Q=[{title:"All Orders",status:"all",path:"".concat(b.Hb.PURCHASE_ORDERS,"?status=").concat("all")},{title:"Requested",status:_.zq,path:"".concat(b.Hb.PURCHASE_ORDERS,"?status=").concat(_.zq)},{title:"Approved",status:_._q,path:"".concat(b.Hb.PURCHASE_ORDERS,"?status=").concat(_._q)},{title:"Received",status:_.Bm,path:"".concat(b.Hb.PURCHASE_ORDERS,"?status=").concat(_.Bm)},{title:"Flagged",status:_.GI,path:"".concat(b.Hb.PURCHASE_ORDERS,"?status=").concat(_.GI)},{title:"Cancelled",status:_.fh,path:"".concat(b.Hb.PURCHASE_ORDERS,"?status=").concat(_.fh)}],X=[{title:"Returned",value:_.oN},{title:"Damaged",value:_.OH},{title:"Expired",value:_.$i}],J=[{title:"Payment Due",value:_.kx},{title:"Payment Paid",value:_.al}],K=()=>{let e=(0,c.useRouter)(),t=(0,p.I0)(),{permissions:a,enabledPurchaseOrderStatuses:o,companyDetails:i}=(0,p.v9)(e=>e.authReducer),{status:v,subStatus:y}=e.query,{totalCount:E,page:j,counts:N,allPurchaseOrders:k,requestedPurchaseOrders:w,approvedPurchaseOrders:T,receivedPurchaseOrders:Z,flaggedPurchaseOrders:H,cancelledPurchaseOrders:I}=(0,p.v9)(e=>e.purchaseOrdersReducer),{searchParams:U}=(0,f.Z)(),[M,V]=(0,h.useState)([]),[L,B]=(0,h.useState)(!1),[q,F]=(0,h.useState)(!1),[Y,W]=(0,h.useState)(b.Cx.CSV),[z,K]=(0,h.useState)(!1),$=(0,h.useMemo)(()=>{var e;return(null==i?void 0:i.industry)!==b.Q7.E_COMMERCE||!!i.isBulkUploadEnabled&&null!==(e=i.bulkUploadFlags)&&void 0!==e&&!!e.isPurchaseOrderUploadEnabled},[i]),ee=[{title:"Order No",key:"orderNo",render:e=>(0,l.jsx)(u(),{href:{pathname:"".concat(b.Hb.PURCHASE_ORDERS,"/").concat(e.id),query:{status:v,subStatus:y}}
1,className:C().link,children:(0,_.bH)(e)})},{title:"Creation Date",key:"creationDate",render:e=>{let{createdAt:t}=e;return(0,l.jsx)("div",{style:{display:"flex",alignItems:"center"},children:d()(t).format("MMM D, YYYY")})}},{title:"Approved Date",key:"approvedDate",render:e=>{let{approvedAt:t}=e;return(0,l.jsx)("div",{style:{display:"flex",alignItems:"center"},children:t?d()(t).format("MMM D, YYYY"):"N/A"})}},{title:"Received Date",key:"receivedDate",render:e=>{let{receivedAt:t}=e;return(0,l.jsx)("div",{style:{display:"flex",alignItems:"center"},children:t?d()(t).format("MMM D, YYYY"):"N/A"})}},{title:"Vendor",key:"vendor",render:e=>{let{vendor:t}=e;return(null==t?void 0:t.name)||"N/A"}},{title:"Drop off Location",key:"dropOffLocation",render:e=>{let{distributor:t,location:a}=e;return a?(0,l.jsxs)("div",{style:{display:"flex",flexDirection:"column"},children:[!t&&(0,l.jsx)("div",{className:C().badge,children:(0,m.Nb)(a.type.toLowerCase())}),[D.aD.WAREHOUSE,D.aD.FACTORY].includes(a.type)&&!a.deletedAt?(0,l.jsx)(u(),{href:"".concat(b.Hb.WAREHOUSES,"/").concat(a.id),children:(0,l.jsx)("div",{className:C().location,children:a.label||a.address})}):(0,l.jsx)("div",{children:(0,l.jsx)("div",{className:C().location,children:a.label||a.address})})]}):"N/A"}},{title:"Order Amount",key:"orderAmount",render:e=>{let{totalAmount:t}=e;return(0,m.cS)(t)||"N/A"}},{title:"Order Status",key:"orderStatus",render:e=>{let{status:t}=e;return(0,m.ZX)(t)||"N/A"}}],et=(0,h.useMemo)(()=>{switch(v){case _.zq:return ee.filter(e=>{let{key:t}=e;return!["approvedDate","receivedDate","orderStatus"].includes(t)});case _._q:return ee.filter(e=>{let{key:t}=e;return!["receivedDate","orderStatus"].includes(t)});case _.Bm:case _.GI:case _.fh:return ee.filter(e=>{let{key:t}=e;return!["orderStatus"].includes(t)});default:return ee}},[v]);(0,h.useEffect)(()=>{if(!v){var t,a;e.push("".concat(b.Hb.PURCHASE_ORDERS,"?status=").concat(null!==(a=null==i?void 0:null===(t=i.orderStatusFlow)||void 0===t?void 0:t.defaultStatus.toLowerCase())&&void 0!==a?a:b.orderStatuses.SALES_ORDER_REQUESTED_STATUS.toLowerCase()));return}},[v]),(0,h.useEffect)(()=>{i&&!i.isPurchaseOrderEnabled&&e.push("/")},[i]),(0,h.useEffect)(()=>{var e,t;!(0,m.Qr)(o)&&(o[v]||"all"===v)&&ea({...U,statuses:(null==U?void 0:null===(e=U.statuses)||void 0===e?void 0:e.length)?U.statuses.filter(e=>o[e]):[],disabledStatuses:(null==U?void 0:null===(t=U.statuses)||void 0===t?void 0:t.length)?U.statuses.filter(e=>!o[e]):[],status:v,subStatus:y,page:0})},[v,y,o,U]),(0,h.useEffect)(()=>{let e=k;switch(v){case _.zq:e=w;break;case _._q:e=T;break;case _.Bm:e=Z;break;case _.GI:e=H;break;case _.fh:e=I}V(e)},[k,w,T,Z,H,I]);let ea=async function(){let{statuses:e,disabledStatuses:a,status:l,subStatuses:s,subStatus:r,page:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};B(!0),await t((0,x.Nm)({...U,statuses:e,disabledStatuses:a,status:l,subStatuses:s,subStatus:r,page:n})),B(!1)},el=async e=>{var t,a;await ea({statuses:(null==U?void 0:null===(t=U.statuses)||void 0===t?void 0:t.length)?U.statuses.filter(e=>o[e]):[],disabledStatuses:(null==U?void 0:null===(a=U.statuses)||void 0===a?void 0:a.length)?U.statuses.filter(e=>!o[e]):[],status:o[v]?v:void 0,subStatus:y,page:e-1,...U})},es=(0,h.useMemo)(()=>[...Q].filter(e=>{let{status:t}=e;return o[t]||"all"===t||void 0===t}),[o]),er=(0,h.useMemo)(()=>{switch(v){case _.GI:return X;case _.Bm:return J;default:return null}},[v]);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:C().container,children:[(0,l.jsxs)("div",{className:C().header,children:[(0,l.jsx)("h1",{className:C().headerTitle,children:"Purchase Orders"}),(0,l.jsxs)("div",{className:C().headerButtons,children:[(0,l.jsx)(s.Z,{overlay:()=>(0,l.jsxs)(r.Z,{children:[(0,l.jsx)(r.Z.Item,{disabled:!a.viewPurchaseOrders||!a.exportPurchaseOrders,icon:(0,l.jsx)(g.Z,{}),onClick:()=>{W(b.Cx.CSV),K(!0)},children:"Export As CSV"},"1"),(0,l.jsx)(r.Z.Item,{disabled:!a.uploadPurchaseOrders||!$,icon:(0,l.jsx)(O.Z,{}),onClick:()=>F(!0),children:"Upload Purchase Orders"},"2")]}),trigger:["click"],children:(0,l.jsx)(n.Z,{loading:!1,onClick:()=>{},children:"Action"})}),(0,l.jsx)(n.Z,{type:"primary",className:C().actionButton,disabled:!a.addPurchaseOrders,onClick:()=>e.push("/add-purchase-order"),children:"Create Purchase Order"})]})]}),(0,l.jsx)("div",{className:C().contentHeader,children:(0,l.jsx)("div",{style:{display:"flex"},children:(0,l.jsx)("div",{className:C().tabContainer,children:es.map(t=>(0,l.jsx)(A.Z,{title:t.title,isSelected:()=>v===t.status,onClick:()=>e.push(t.path),count:N[t.status]},t.title))})})}),er&&(0,l.jsx)("div",{className:C().subTabs,children:(0,l.jsx)("div",{className:C().subTabsContainer,children:er.map(t=>(0,l.jsx)(P.Z,{active:y===t.value,count:N[t.value],onClick:()=>e.push("".concat(b.Hb.PURCHASE_ORDERS,"?status=").concat(v,"&subStatus=").concat(t.value)),children:t.title},t.value))})}),(0,l.jsx)("div",{className:C().content,children:(0,l.jsx)(S.Z,{refresh:()=>el(j),loading:L,columns:et,dataSource:M,pagination:{pageSize:50,total:E,position:["topRight"],onChange:el,showSizeChanger:!1,current:j+1},scroll:{y:null!==er?"calc(100vh - 380px)":"calc(100vh - 320px)"},rowKey:"id"})})]}),q&&(0,l.jsx)(R,{visible:q,onCancel:()=>F(!1),onComplete:()=>{ea({status:o[v]?v:void 0,page:0})}}),z&&(0,l.jsx)(G,{visible:z,exportType:Y,onCancel:()=>K(!1)})]})};K.getLayout=function(e){return(0,l.jsx)(v.Z,{children:e})};var $=K},26800:function(e){e.exports={defaultButton:"PurchaseOrderExportModal_defaultButton__mPFG5",primaryButton:"PurchaseOrderExportModal_primaryButton__i1EHN",section:"PurchaseOrderExportModal_section__Xsh8N",label:"PurchaseOrderExportModal_label__Bytfl",dash:"PurchaseOrderExportModal_dash__RsrRx",optionContainer:"PurchaseOrderExportModal_optionContainer__pjaZ7",footer
1:"PurchaseOrderExportModal_footer__nB_t3"}},85905:function(e){e.exports={container:"PurchaseOrders_container__h_b8q",header:"PurchaseOrders_header__MCryQ",headerTitle:"PurchaseOrders_headerTitle__l3_fp",contentHeader:"PurchaseOrders_contentHeader__ZISfc",headerButtons:"PurchaseOrders_headerButtons__Xw7UD",tabContainer:"PurchaseOrders_tabContainer__5q6hN",locations:"PurchaseOrders_locations__J433r",location:"PurchaseOrders_location__siNfF",locationIndicator:"PurchaseOrders_locationIndicator__FIHM1",badge:"PurchaseOrders_badge__CQjOH",subTabs:"PurchaseOrders_subTabs__3Ukn7",subTabsContainer:"PurchaseOrders_subTabsContainer__iL4Yt"}}},function(e){e.O(0,[2888,9774,179],function(){return e(e.s=83814)}),_N_E=e.O()}]);

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.