umwd-components 0.1.796 → 0.1.798
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/src/components/e-commerce/opo/TextualManageOpoForm.js +1 -1
- package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/src/components/e-commerce/opo/TextualManageOpoForm.js +1 -0
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/types/types/logistics/Report.d.ts +1 -0
- package/package.json +1 -1
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),i=require("../../../data/actions/e-commerce/opo/updateOpoAction.js"),n=require("../../common/media/UploadBase64MediaForm.js"),t=require("../../../data/loaders/common/media/downloadBase64File.js"),a=require("./TextualOpoItemUpdater.js"),s=require("./OpoItemDisplay.js"),o=require("../../logistics/note/NotesDisplay.js"),c=require("../../logistics/note/NoteTakingComponent.js"),l=require("@mui/material/Alert"),d=require("@mui/material/Dialog"),u=require("@mui/material/DialogActions"),m=require("@mui/material/DialogContent"),p=require("@mui/material/DialogTitle"),h=require("@mui/material/Typography"),x=require("@mui/material/Button"),j=require("@mui/material/Grid"),g=require("@mui/material/Box"),v=require("@mui/material/Paper"),y=require("@mui/material/Stack"),f=require("@mui/material/Divider"),C=require("../../../data/services/common/confirmation-service.js"),_=require("../../../data/services/common/cancellation-service.js"),b=require("@mui/material"),q=require("@mui/icons-material/Numbers"),I=require("@mui/icons-material/CalendarToday"),k=require("@mui/icons-material/Business"),w=require("@mui/icons-material/Description"),S=require("@mui/icons-material/Update"),D=require("./OpoStatusIndicator.js"),O=require("../../../context/common/SnackbarContext.js"),A=require("../../SubmitButton.js"),F=require("../../common/media/minio/UploadMinioMediaForm.js");const M={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null},B=["picked","packed","shipped","reports"];function N({open:r,handleClose:i,orderID:n,currentStatus:t,revalidateCallback:a}){return e.jsxs(d,{open:r,onClose:i,children:[e.jsx(p,{children:"Confirm Order"}),e.jsx(m,{children:e.jsxs(y,{spacing:2,children:[e.jsx(h,{children:"Are you sure you want to confirm this order?"}),e.jsxs(h,{children:["Current status: ",t]})]})}),e.jsxs(u,{children:[e.jsx(x,{variant:"contained",onClick:e=>{C.confirmationService("opos",[n]),a&&a(),i()},children:"Yes"}),e.jsx(x,{variant:"contained",onClick:i,children:"No"})]})]})}function z({open:i,handleClose:n,orderID:t,revalidateCallback:a}){const[s,o]=r.useState(""),[c,l]=r.useState(""),{handleAddMessage:j}=O.useSnackbar();return e.jsxs(d,{open:i,onClose:n,children:[e.jsx(p,{children:"Cancel Return"}),e.jsx(m,{children:e.jsxs(y,{spacing:2,children:[e.jsx(h,{children:"Are you sure you want to cancel this order?"}),e.jsxs(b.List,{children:[e.jsx(b.ListItem,{children:"By cancelling this order you will update it's status from ordered to cancelled"}),e.jsx(b.ListItem,{children:"Please provide a reason for the cancellation"}),e.jsx(b.ListItem,{children:"The customer will be notified about the cancellation and of the reason for the cancellation"})]}),e.jsx(b.TextField,{label:"Cancellation reason",name:"reason",multiline:!0,rows:4,fullWidth:!0,variant:"outlined",value:s,onChange:e=>o(e.target.value),placeholder:"Please provide a reason for the cancellation",error:!!c,helperText:c})]})}),e.jsxs(u,{children:[e.jsx(x,{variant:"outlined",onClick:n,children:"Close"}),e.jsx(x,{variant:"contained",color:"error",onClick:async()=>{if(s.length<5)l("Please provide a reason for the cancellation (min 5 characters)");else{l("");try{await _.cancellationService("opos",t,s),j({message:"Order cancelled successfully",severity:"success"}),a&&a(),n()}catch(e){j({message:"Failed to cancel order",severity:"error"})}}},children:"Confirm Cancellation"})]})]})}exports.default=function({opo:d,sx:u,revalidateCallback:m,handleClose:p,role:C}){const _=i.updateOpoAction.bind(null,d.documentId),[E,P]=r.useActionState(_,M),{handleAddMessage:T}=O.useSnackbar(),[U,L]=r.useState(d.opo_items?d.opo_items:[]),[R,W]=r.useState(!1),[G,H]=r.useState(!1),[J,Q]=r.useState(["picked","packed","shipped","reports"]);r.useEffect(()=>{E?.message&&(T({message:E.message,severity:E.severity||"info"}),"success"===E.severity&&(m?.(),p?.()))},[E?.message]),r.useEffect(()=>{E?.strapiErrors&&T({message:E.strapiErrors.message||"Error updating OPO",severity:"error"})},[E?.strapiErrors]),r.useEffect(()=>{d.opo_items&&L(d.opo_items?d.opo_items:[])},[d]);const Y=(e,r,i)=>{const n=[...U],t=n.findIndex(e=>e.documentId===r);n[t][i]=e,L(n)},$=(e,r)=>{const i=[...U],n=i.findIndex(e=>e.documentId===r),t=[...i[n]?.reports||[],e];null==i[n]?.reports&&(i[n]={...i[n],reports:[]}),i[n].reports=t,L(i)},K=(e,r)=>{const i=[...U],n=i.findIndex(r=>r.documentId===e),t=i[n]?.reports||[],a=t.filter(e=>"documentId"in e),s=t.filter(e=>!("documentId"in e));s.splice(r,1);const o=[...a,...s];i[n].reports=o,L(i)};return e.jsx(g,{sx:[...Array.isArray(u)?u:[u]],children:e.jsxs(j,{container:!0,spacing:2,children:[e.jsx(j,{size:12,children:e.jsxs(y,{spacing:2,children:[e.jsxs(y,{direction:"row",spacing:2,justifyContent:"space-between",children:[e.jsxs(y,{spacing:2,children:[e.jsx(h,{variant:"h3",component:"h1",children:"Management Outbound Purchase Order"}),e.jsx(h,{variant:"body1",children:"Manage picking, packing and shipping of purchase order"})]}),e.jsx(c.default,{content:"",related:[{id:d.documentId,__type:"api::e-commerce.opo"}],revalidateCallback:m})]}),e.jsx(f,{})]})}),e.jsx(j,{size:12,children:e.jsx(h,{variant:"h5",sx:{py:1},children:"Details"})}),e.jsx(j,{size:6,children:e.jsx(v,{elevation:2,sx:{p:2,height:"100%"},children:e.jsxs(y,{spacing:2,children:[e.jsxs(y,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(q,{color:"primary"}),e.jsx(h,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Purchase Order Number"}),e.jsx(h,{variant:"body1",fontWeight:"medium",children:d.opo_number})]}),e.jsxs(y,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(w,{color:"primary"}),e.jsx(h,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Custom reference"}),e.jsx(h,{variant:"body1",fontWeight:"medium",children:d.customer_reference})]}),e.jsxs(y,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(I,{color:"primary"}),e.jsx(h,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Order Date"}),e.jsx(h,{variant:"body1",fontWeight:"medium",children:d.order_date})]}),e.jsxs(y,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(k,{color:"primary"}),e.jsx(h,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Customer"}),e.jsx(h,{variant:"body1",fontWeight:"medium",children:d.customer?.business_credentials?.company_name})]}),e.jsxs(y,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(S,{color:"primary"}),e.jsx(h,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Order Status"}),e.jsx(D.OpoStatusIndicator,{status:d.internal_status})]})]})})}),"enduser"===C&&e.jsx(j,{size:6,children:e.jsx(v,{elevation:2,sx:{p:2,height:"100%"},children:e.jsxs(y,{spacing:2,children:[("placed"===d.internal_status||"external_shipping_process"===d.internal_status)&&e.jsxs(e.Fragment,{children:[e.jsx(x,{variant:"contained",color:"primary",onClick:()=>W(!0),children:"Confirm order"}),e.jsx(l,{severity:"warning",children:"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"}),e.jsx(N,{open:R,handleClose:()=>W(!1),orderID:d.documentId,currentStatus:d.internal_status,revalidateCallback:m})]}),("placed"===d.internal_status||"ordered"===d.internal_status)&&e.jsxs(e.Fragment,{children:[e.jsx(x,{variant:"contained",color:"error",onClick:()=>H(!0),children:"Cancel order"}),e.jsx(z,{open:G,handleClose:()=>H(!1),orderID:d.documentId,revalidateCallback:m})]})]})})}),e.jsx(j,{size:12,children:e.jsxs(y,{spacing:2,children:[e.jsx(h,{variant:"h5",children:"Documents"}),e.jsx(v,{sx:{p:2},children:e.jsx(y,{spacing:1,children:d.delivery_note?e.jsxs(e.Fragment,{children:[e.jsx(h,{variant:"h6",children:"Delivery Note"}),e.jsx(h,{children:d.delivery_note?.name}),e.jsx(x,{variant:"contained",onClick:()=>{t.default(`api/opos/${d.documentId}`,"delivery_note")},children:"Download"})]}):e.jsxs(e.Fragment,{children:[e.jsx(h,{variant:"h5",children:"Delivery Note"}),e.jsx(h,{variant:"body1",children:"Here you can upload the the delivery note for this order"}),e.jsx(f,{}),e.jsx(n.UploadBase64MediaForm,{reference:"api::e-commerce.opo",refID:d.documentId,field:"delivery_note",multiple:!1,accept:"text/*,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",path:"api/ipos",componentName:"delivery_note",componentReference:"common.base64-encoded-media",revalidateCallback:m})]})})})]})}),e.jsx(j,{size:12,children:e.jsxs(y,{spacing:2,children:[e.jsx(h,{variant:"h5",children:"Minio Documents"}),e.jsx(v,{sx:{p:2},children:e.jsx(F.UploadMinioMediaForm,{reference:"api::e-commerce.opo",refID:d.documentId,field:"minio",multiple:!1,revalidateCallback:m})})]})}),d?.notes?.length>0&&e.jsx(j,{size:12,children:e.jsxs(y,{spacing:2,children:[e.jsx(h,{variant:"h5",children:"Notes"}),e.jsx(o.default,{notes:d.notes}),e.jsx(f,{})]})}),e.jsx(j,{size:12,children:e.jsxs(y,{spacing:1,children:[e.jsx(h,{variant:"h5",children:"Items"}),e.jsxs(y,{direction:"row",alignItems:"center",justifyContent:"flex-end",spacing:2,component:v,p:1,children:[e.jsx(h,{variant:"body1",children:"Show:"}),B.map(r=>e.jsx(b.FormControlLabel,{control:e.jsx(b.Checkbox,{checked:J.includes(r),onChange:e=>{e.target.checked?Q([...J,r]):Q(J.filter(e=>e!==r))}}),label:r.charAt(0).toUpperCase()+r.slice(1)},r))]}),"placed"===d.internal_status&&e.jsx(l,{severity:"warning",children:"Before confirmation you cannot update the items"}),e.jsx(f,{}),e.jsxs("form",{action:P,children:[e.jsx("input",{type:"hidden",name:"items",value:JSON.stringify((e=>e.map(e=>({documentId:e.documentId,ordered_quantity:e.ordered_quantity,picked_quantity:e.picked_quantity,packed_quantity:e.packed_quantity,shipped_quantity:e.shipped_quantity,reports:e.reports?.map(e=>({documentId:"documentId"in e?e.documentId:void 0,quantity:e.quantity,content:e.content,type:e.type}))||[]})))(U))}),U&&U.map((r,i)=>e.jsx(v,{sx:{p:2,mb:2},children:"placed"===d.internal_status||"external_shipping_process"===d.internal_status||"done"===d.internal_status||"cancelled"===d.internal_status?e.jsx(s.default,{item:r,index:i,image:r?.product?.image}):e.jsx(a.default,{item:r,index:i,handleUpdateQuantity:Y,handleAddReport:$,image:r?.product?.image,handleRemoveReportAtIndex:K,revalidateCallback:m,showing:J})},i))," ",e.jsxs(y,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{pt:2},children:[p&&e.jsx(x,{onClick:p,variant:"outlined",children:"Close"}),"placed"!==d.internal_status&&"external_shipping_process"!==d.internal_status&&"done"!==d.internal_status&&"cancelled"!==d.internal_status&&e.jsx(A.SubmitButton,{text:"Update items",loadingText:"Saving...",variant:"contained"})]})]})]})})]})})};
|
|
6
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),i=require("../../../data/actions/e-commerce/opo/updateOpoAction.js"),n=require("../../common/media/UploadBase64MediaForm.js"),t=require("../../../data/loaders/common/media/downloadBase64File.js"),a=require("./TextualOpoItemUpdater.js"),s=require("./OpoItemDisplay.js"),o=require("../../logistics/note/NotesDisplay.js"),c=require("../../logistics/note/NoteTakingComponent.js"),l=require("@mui/material/Alert"),d=require("@mui/material/Dialog"),u=require("@mui/material/DialogActions"),m=require("@mui/material/DialogContent"),p=require("@mui/material/DialogTitle"),h=require("@mui/material/Typography"),x=require("@mui/material/Button"),j=require("@mui/material/Grid"),g=require("@mui/material/Box"),v=require("@mui/material/Paper"),y=require("@mui/material/Stack"),f=require("@mui/material/Divider"),C=require("../../../data/services/common/confirmation-service.js"),_=require("../../../data/services/common/cancellation-service.js"),b=require("@mui/material"),q=require("@mui/icons-material/Numbers"),I=require("@mui/icons-material/CalendarToday"),k=require("@mui/icons-material/Business"),w=require("@mui/icons-material/Description"),S=require("@mui/icons-material/Update"),D=require("./OpoStatusIndicator.js"),O=require("../../../context/common/SnackbarContext.js"),A=require("../../SubmitButton.js"),F=require("../../common/media/minio/UploadMinioMediaForm.js");const M={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null},B=["picked","packed","shipped","reports"];function N({open:r,handleClose:i,orderID:n,currentStatus:t,revalidateCallback:a}){return e.jsxs(d,{open:r,onClose:i,children:[e.jsx(p,{children:"Confirm Order"}),e.jsx(m,{children:e.jsxs(y,{spacing:2,children:[e.jsx(h,{children:"Are you sure you want to confirm this order?"}),e.jsxs(h,{children:["Current status: ",t]})]})}),e.jsxs(u,{children:[e.jsx(x,{variant:"contained",onClick:e=>{C.confirmationService("opos",[n]),a&&a(),i()},children:"Yes"}),e.jsx(x,{variant:"contained",onClick:i,children:"No"})]})]})}function z({open:i,handleClose:n,orderID:t,revalidateCallback:a}){const[s,o]=r.useState(""),[c,l]=r.useState(""),{handleAddMessage:j}=O.useSnackbar();return e.jsxs(d,{open:i,onClose:n,children:[e.jsx(p,{children:"Cancel Return"}),e.jsx(m,{children:e.jsxs(y,{spacing:2,children:[e.jsx(h,{children:"Are you sure you want to cancel this order?"}),e.jsxs(b.List,{children:[e.jsx(b.ListItem,{children:"By cancelling this order you will update it's status from ordered to cancelled"}),e.jsx(b.ListItem,{children:"Please provide a reason for the cancellation"}),e.jsx(b.ListItem,{children:"The customer will be notified about the cancellation and of the reason for the cancellation"})]}),e.jsx(b.TextField,{label:"Cancellation reason",name:"reason",multiline:!0,rows:4,fullWidth:!0,variant:"outlined",value:s,onChange:e=>o(e.target.value),placeholder:"Please provide a reason for the cancellation",error:!!c,helperText:c})]})}),e.jsxs(u,{children:[e.jsx(x,{variant:"outlined",onClick:n,children:"Close"}),e.jsx(x,{variant:"contained",color:"error",onClick:async()=>{if(s.length<5)l("Please provide a reason for the cancellation (min 5 characters)");else{l("");try{await _.cancellationService("opos",t,s),j({message:"Order cancelled successfully",severity:"success"}),a&&a(),n()}catch(e){j({message:"Failed to cancel order",severity:"error"})}}},children:"Confirm Cancellation"})]})]})}exports.default=function({opo:d,sx:u,revalidateCallback:m,handleClose:p,role:C}){const _=i.updateOpoAction.bind(null,d.documentId),[E,P]=r.useActionState(_,M),{handleAddMessage:T}=O.useSnackbar(),[U,L]=r.useState(d.opo_items?d.opo_items:[]),[R,W]=r.useState(!1),[G,H]=r.useState(!1),[J,Q]=r.useState(["picked","packed","shipped","reports"]);r.useEffect(()=>{E?.message&&(T({message:E.message,severity:E.severity||"info"}),"success"===E.severity&&(m?.(),p?.()))},[E?.message]),r.useEffect(()=>{E?.strapiErrors&&T({message:E.strapiErrors.message||"Error updating OPO",severity:"error"})},[E?.strapiErrors]),r.useEffect(()=>{d.opo_items&&L(d.opo_items?d.opo_items:[])},[d]);const Y=(e,r,i)=>{const n=[...U],t=n.findIndex(e=>e.documentId===r);n[t][i]=e,L(n)},$=(e,r)=>{const i=[...U],n=i.findIndex(e=>e.documentId===r),t=[...i[n]?.reports||[],e];null==i[n]?.reports&&(i[n]={...i[n],reports:[]}),i[n].reports=t,L(i)},K=(e,r)=>{const i=[...U],n=i.findIndex(r=>r.documentId===e),t=i[n]?.reports||[],a=t.filter(e=>"documentId"in e),s=t.filter(e=>!("documentId"in e));s.splice(r,1);const o=[...a,...s];i[n].reports=o,L(i)};return e.jsx(g,{sx:[...Array.isArray(u)?u:[u]],children:e.jsxs(j,{container:!0,spacing:2,children:[e.jsx(j,{size:12,children:e.jsxs(y,{spacing:2,children:[e.jsxs(y,{direction:"row",spacing:2,justifyContent:"space-between",children:[e.jsxs(y,{spacing:2,children:[e.jsx(h,{variant:"h3",component:"h1",children:"Management Outbound Purchase Order"}),e.jsx(h,{variant:"body1",children:"Manage picking, packing and shipping of purchase order"})]}),e.jsx(c.default,{content:"",related:[{id:d.documentId,__type:"api::e-commerce.opo"}],revalidateCallback:m})]}),e.jsx(f,{})]})}),e.jsx(j,{size:12,children:e.jsx(h,{variant:"h5",sx:{py:1},children:"Details"})}),e.jsx(j,{size:6,children:e.jsx(v,{elevation:2,sx:{p:2,height:"100%"},children:e.jsxs(y,{spacing:2,children:[e.jsxs(y,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(q,{color:"primary"}),e.jsx(h,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Purchase Order Number"}),e.jsx(h,{variant:"body1",fontWeight:"medium",children:d.opo_number})]}),e.jsxs(y,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(w,{color:"primary"}),e.jsx(h,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Custom reference"}),e.jsx(h,{variant:"body1",fontWeight:"medium",children:d.customer_reference})]}),e.jsxs(y,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(I,{color:"primary"}),e.jsx(h,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Order Date"}),e.jsx(h,{variant:"body1",fontWeight:"medium",children:d.order_date})]}),e.jsxs(y,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(k,{color:"primary"}),e.jsx(h,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Customer"}),e.jsx(h,{variant:"body1",fontWeight:"medium",children:d.customer?.business_credentials?.company_name})]}),e.jsxs(y,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(S,{color:"primary"}),e.jsx(h,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Order Status"}),e.jsx(D.OpoStatusIndicator,{status:d.internal_status})]})]})})}),"enduser"===C&&e.jsx(j,{size:6,children:e.jsx(v,{elevation:2,sx:{p:2,height:"100%"},children:e.jsxs(y,{spacing:2,children:[("placed"===d.internal_status||"external_shipping_process"===d.internal_status)&&e.jsxs(e.Fragment,{children:[e.jsx(x,{variant:"contained",color:"primary",onClick:()=>W(!0),children:"Confirm order"}),e.jsx(l,{severity:"warning",children:"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"}),e.jsx(N,{open:R,handleClose:()=>W(!1),orderID:d.documentId,currentStatus:d.internal_status,revalidateCallback:m})]}),("placed"===d.internal_status||"ordered"===d.internal_status)&&e.jsxs(e.Fragment,{children:[e.jsx(x,{variant:"contained",color:"error",onClick:()=>H(!0),children:"Cancel order"}),e.jsx(z,{open:G,handleClose:()=>H(!1),orderID:d.documentId,revalidateCallback:m})]})]})})}),e.jsx(j,{size:12,children:e.jsxs(y,{spacing:2,children:[e.jsx(h,{variant:"h5",children:"Documents"}),e.jsx(v,{sx:{p:2},children:e.jsx(y,{spacing:1,children:d.delivery_note?e.jsxs(e.Fragment,{children:[e.jsx(h,{variant:"h6",children:"Delivery Note"}),e.jsx(h,{children:d.delivery_note?.name}),e.jsx(x,{variant:"contained",onClick:()=>{t.default(`api/opos/${d.documentId}`,"delivery_note")},children:"Download"})]}):e.jsxs(e.Fragment,{children:[e.jsx(h,{variant:"h5",children:"Delivery Note"}),e.jsx(h,{variant:"body1",children:"Here you can upload the the delivery note for this order"}),e.jsx(f,{}),e.jsx(n.UploadBase64MediaForm,{reference:"api::e-commerce.opo",refID:d.documentId,field:"delivery_note",multiple:!1,accept:"text/*,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",path:"api/ipos",componentName:"delivery_note",componentReference:"common.base64-encoded-media",revalidateCallback:m})]})})})]})}),e.jsx(j,{size:12,children:e.jsxs(y,{spacing:2,children:[e.jsx(h,{variant:"h5",children:"Minio Documents"}),e.jsx(v,{sx:{p:2},children:e.jsx(F.UploadMinioMediaForm,{reference:"api::e-commerce.opo",refID:d.documentId,field:"minio",multiple:!1,revalidateCallback:m})})]})}),d?.notes?.length>0&&e.jsx(j,{size:12,children:e.jsxs(y,{spacing:2,children:[e.jsx(h,{variant:"h5",children:"Notes"}),e.jsx(o.default,{notes:d.notes}),e.jsx(f,{})]})}),e.jsx(j,{size:12,children:e.jsxs(y,{spacing:1,children:[e.jsx(h,{variant:"h5",children:"Items"}),e.jsxs(y,{direction:"row",alignItems:"center",justifyContent:"flex-end",spacing:2,component:v,p:1,children:[e.jsx(h,{variant:"body1",children:"Show:"}),B.map(r=>e.jsx(b.FormControlLabel,{control:e.jsx(b.Checkbox,{checked:J.includes(r),onChange:e=>{e.target.checked?Q([...J,r]):Q(J.filter(e=>e!==r))}}),label:r.charAt(0).toUpperCase()+r.slice(1)},r))]}),"placed"===d.internal_status&&e.jsx(l,{severity:"warning",children:"Before confirmation you cannot update the items"}),e.jsx(f,{}),e.jsxs("form",{action:P,children:[e.jsx("input",{type:"hidden",name:"items",value:JSON.stringify((e=>e.map(e=>({documentId:e.documentId,ordered_quantity:e.ordered_quantity,picked_quantity:e.picked_quantity,packed_quantity:e.packed_quantity,shipped_quantity:e.shipped_quantity,reports:e.reports?.map(e=>({id:"id"in e?e.id:void 0,documentId:"documentId"in e?e.documentId:void 0,quantity:e.quantity,content:e.content,type:e.type}))||[]})))(U))}),U&&U.map((r,i)=>e.jsx(v,{sx:{p:2,mb:2},children:"placed"===d.internal_status||"external_shipping_process"===d.internal_status||"done"===d.internal_status||"cancelled"===d.internal_status?e.jsx(s.default,{item:r,index:i,image:r?.product?.image}):e.jsx(a.default,{item:r,index:i,handleUpdateQuantity:Y,handleAddReport:$,image:r?.product?.image,handleRemoveReportAtIndex:K,revalidateCallback:m,showing:J})},i))," ",e.jsxs(y,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{pt:2},children:[p&&e.jsx(x,{onClick:p,variant:"outlined",children:"Close"}),"placed"!==d.internal_status&&"external_shipping_process"!==d.internal_status&&"done"!==d.internal_status&&"cancelled"!==d.internal_status&&e.jsx(A.SubmitButton,{text:"Update items",loadingText:"Saving...",variant:"contained"})]})]})]})})]})})};
|