umwd-components 0.1.614 → 0.1.615

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.
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as a,useEffect as n}from"react";import{useFormState as i}from"react-dom";import{updateOpoAction as o}from"../../../data/actions/e-commerce/opo/updateOpoAction.js";import m from"./OpoItemUpdater.js";import l from"./OpoItemDisplay.js";import c from"../../logistics/note/NotesDisplay.js";import d from"../../logistics/note/NoteTakingComponent.js";import{StrapiErrors as s}from"../../StrapiErrors.js";import{SubmitButton as u}from"../../SubmitButton.js";import p from"@mui/material/Alert";import E from"@mui/material/Dialog";import v from"@mui/material/DialogActions";import f from"@mui/material/DialogContent";import g from"@mui/material/DialogTitle";import y from"@mui/material/Typography";import h from"@mui/material/Button";import b from"@mui/material/Grid";import C from"@mui/material/Box";import x from"@mui/material/Paper";import _ from"@mui/material/Stack";import w from"@mui/material/Divider";import k from"@mui/material/Card";import D from"@mui/material/CardContent";import{confirmationService as O}from"../../../data/services/logistics/ipo/confirmation-service.js";var j={zodErrors:null,strapiErrors:null,data:null,message:null};function q(e){var t=e.open,a=e.handleClose,n=e.orderID,i=e.currentStatus,o=e.revalidateCallback;return r.createElement(E,{open:t},r.createElement(g,null,"Confirm Order"),r.createElement(f,null,r.createElement(_,{spacing:2},r.createElement(y,null,"Are you sure you want to confirm this order?"),r.createElement(y,null,"Current status: ",i))),r.createElement(v,null,r.createElement(h,{variant:"contained",onClick:function(e){O("opos",[n]),o&&o()}},"Confirm"),r.createElement(h,{variant:"contained",onClick:a},"Cancel")))}function S(E){var v,f,g,O,S=E.opo,A=E.sx,I=E.revalidateCallback;E.handleClose;var N=E.role,T=e(i(o,j),2),B=T[0],P=T[1],U=e(a(S.opo_items.data?S.opo_items.data:[]),2),M=U[0],z=U[1],F=e(a(!1),2),G=F[0],J=F[1],L=function(r,a,n){var i=t([],e(M),!1),o=i.findIndex((function(e){return e.id===a}));i[o][n]=r,z(i)};return n((function(){var e;(null===(e=S.opo_items)||void 0===e?void 0:e.data)&&z(S.opo_items.data)}),[S]),r.createElement(C,{sx:t([],e(Array.isArray(A)?A:[A]),!1)},r.createElement(b,{container:!0,spacing:2},r.createElement(b,{item:!0,xs:12},r.createElement(_,{spacing:2},r.createElement(_,{direction:"row",spacing:2,justifyContent:"space-between"},r.createElement(_,{spacing:2},r.createElement(y,{variant:"h3",component:"h1"},"Management Outbound Purchase Order"),r.createElement(y,{variant:"body1"},"Manage picking, packing and shipping of purchase order")),r.createElement(d,{content:"",related:[{id:S.id,__type:"api::e-commerce.opo"}],revalidateCallback:I})),r.createElement(w,null))),r.createElement(b,{item:!0,xs:6},r.createElement(_,{spacing:1},r.createElement(y,{variant:"h5"},"Details"),r.createElement(_,{direction:"row",spacing:2},r.createElement(y,{variant:"body1",width:"250px"},"Purchase Order Number"),r.createElement(y,{variant:"body2"},S.opo_number)),r.createElement(_,{direction:"row",spacing:2},r.createElement(y,{variant:"body1",width:"250px"},"Custom reference"),r.createElement(y,{variant:"body2"},S.customer_inhouse_reference)),r.createElement(_,{direction:"row",spacing:2},r.createElement(y,{variant:"body1",width:"250px"},"Order Date"),r.createElement(y,{variant:"body2"},S.order_date)),r.createElement(_,{direction:"row",spacing:2},r.createElement(y,{variant:"body1",width:"250px"},"Customer"),r.createElement(y,{variant:"body2"},null===(f=null===(v=S.customer)||void 0===v?void 0:v.business_credentials)||void 0===f?void 0:f.company_name)),r.createElement(_,{direction:"row",spacing:2},r.createElement(y,{variant:"body1",width:"250px"},"Order Status"),r.createElement(y,{variant:"body2",width:"250px"},S.status)),("placed"===S.status||"external_shipping_process"===S.status)&&"enduser"===N&&r.createElement(r.Fragment,null,r.createElement(h,{variant:"contained",color:"primary",onClick:function(){return J(!0)}},"Confirm order"),r.createElement(p,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"),r.createElement(q,{open:G,handleClose:function(){return J(!1)},orderID:S.id,currentStatus:S.status,revalidateCallback:I})))),r.createElement(b,{item:!0,xs:12},r.createElement(_,{spacing:2},r.createElement(y,{variant:"h5"},"Documents"),r.createElement(k,{variant:"outlined"},r.createElement(D,null,r.createElement(_,{spacing:1},"// TODO - Should we add options to upload a shipping label and a delivery note?? where do these notes come from? are they generated by the system or are they uploaded by the enduser?"))))),(null===(O=null===(g=null==S?void 0:S.notes)||void 0===g?void 0:g.data)||void 0===O?void 0:O.length)>0&&r.createElement(b,{item:!0,xs:12},r.createElement(_,{spacing:2},r.createElement(y,{variant:"h5"},"Notes"),r.createElement(c,{notes:S.notes.data}),r.createElement(w,null))),r.createElement(b,{item:!0,xs:12},r.createElement(_,{spacing:1},r.createElement(y,{variant:"h5"},"Items"),"placed"===S.status&&r.createElement(p,{severity:"warning"},"Before confirmation you cannot update the items"),r.createElement(w,null),r.createElement("form",{action:P},r.createElement("input",{name:"id",type:"hidden",value:S.id}),M&&M.map((function(e,t){var a,n;return console.log("item",e),r.createElement(x,{sx:{p:2,mb:2},key:t},"placed"===S.status?r.createElement(l,{item:e,index:t,image:null===(a=null==e?void 0:e.product)||void 0===a?void 0:a.image}):r.createElement(m,{item:e,index:t,handleUpdateQuantity:L,image:null===(n=null==e?void 0:e.product)||void 0===n?void 0:n.image,revalidateCallback:I}))})),r.createElement(x,{sx:{p:2}},r.createElement(_,{direction:"row",spacing:2,justifyContent:"end"},r.createElement(u,{text:"Update items",loadingText:"Loading..."}),r.createElement(s,{error:null==B?void 0:B.strapiErrors}),(null==B?void 0:B.message)&&r.createElement(p,{severity:"error"},null==B?void 0:B.message))),r.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map((function(e){return{id:e.id,ordered_quantity:e.ordered_quantity,picked_quantity:e.picked_quantity,packed_quantity:e.packed_quantity,shipped_quantity:e.shipped_quantity}}))}(M))}))))))}export{S as default};
6
+ import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import a,{useState as r,useEffect as n}from"react";import{useFormState as i}from"react-dom";import{updateOpoAction as o}from"../../../data/actions/e-commerce/opo/updateOpoAction.js";import{UploadBase64MediaForm as l}from"../../common/media/UploadBase64MediaForm.js";import m from"../../../data/loaders/common/media/downloadBase64File.js";import c from"./OpoItemUpdater.js";import d from"./OpoItemDisplay.js";import s from"../../logistics/note/NotesDisplay.js";import p from"../../logistics/note/NoteTakingComponent.js";import{StrapiErrors as u}from"../../StrapiErrors.js";import{SubmitButton as E}from"../../SubmitButton.js";import v from"@mui/material/Alert";import f from"@mui/material/Dialog";import y from"@mui/material/DialogActions";import g from"@mui/material/DialogContent";import h from"@mui/material/DialogTitle";import b from"@mui/material/Typography";import _ from"@mui/material/Button";import x from"@mui/material/Grid";import C from"@mui/material/Box";import w from"@mui/material/Paper";import k from"@mui/material/Stack";import D from"@mui/material/Divider";import{confirmationService as j}from"../../../data/services/logistics/ipo/confirmation-service.js";var O={zodErrors:null,strapiErrors:null,data:null,message:null};function q(e){var t=e.open,r=e.handleClose,n=e.orderID,i=e.currentStatus,o=e.revalidateCallback;return a.createElement(f,{open:t},a.createElement(h,null,"Confirm Order"),a.createElement(g,null,a.createElement(k,{spacing:2},a.createElement(b,null,"Are you sure you want to confirm this order?"),a.createElement(b,null,"Current status: ",i))),a.createElement(y,null,a.createElement(_,{variant:"contained",onClick:function(e){j("opos",[n]),o&&o()}},"Confirm"),a.createElement(_,{variant:"contained",onClick:r},"Cancel")))}function N(f){var y,g,h,j,N,I=f.opo,S=f.sx,A=f.revalidateCallback;f.handleClose;var B=f.role,F=e(i(o,O),2),P=F[0],T=F[1],U=e(r(I.opo_items.data?I.opo_items.data:[]),2),M=U[0],z=U[1],G=e(r(!1),2),H=G[0],J=G[1],L=function(a,r,n){var i=t([],e(M),!1),o=i.findIndex((function(e){return e.id===r}));i[o][n]=a,z(i)};return n((function(){var e;(null===(e=I.opo_items)||void 0===e?void 0:e.data)&&z(I.opo_items.data)}),[I]),a.createElement(C,{sx:t([],e(Array.isArray(S)?S:[S]),!1)},a.createElement(x,{container:!0,spacing:2},a.createElement(x,{item:!0,xs:12},a.createElement(k,{spacing:2},a.createElement(k,{direction:"row",spacing:2,justifyContent:"space-between"},a.createElement(k,{spacing:2},a.createElement(b,{variant:"h3",component:"h1"},"Management Outbound Purchase Order"),a.createElement(b,{variant:"body1"},"Manage picking, packing and shipping of purchase order")),a.createElement(p,{content:"",related:[{id:I.id,__type:"api::e-commerce.opo"}],revalidateCallback:A})),a.createElement(D,null))),a.createElement(x,{item:!0,xs:6},a.createElement(k,{spacing:1},a.createElement(b,{variant:"h5"},"Details"),a.createElement(k,{direction:"row",spacing:2},a.createElement(b,{variant:"body1",width:"250px"},"Purchase Order Number"),a.createElement(b,{variant:"body2"},I.opo_number)),a.createElement(k,{direction:"row",spacing:2},a.createElement(b,{variant:"body1",width:"250px"},"Custom reference"),a.createElement(b,{variant:"body2"},I.customer_inhouse_reference)),a.createElement(k,{direction:"row",spacing:2},a.createElement(b,{variant:"body1",width:"250px"},"Order Date"),a.createElement(b,{variant:"body2"},I.order_date)),a.createElement(k,{direction:"row",spacing:2},a.createElement(b,{variant:"body1",width:"250px"},"Customer"),a.createElement(b,{variant:"body2"},null===(g=null===(y=I.customer)||void 0===y?void 0:y.business_credentials)||void 0===g?void 0:g.company_name)),a.createElement(k,{direction:"row",spacing:2},a.createElement(b,{variant:"body1",width:"250px"},"Order Status"),a.createElement(b,{variant:"body2",width:"250px"},I.status)),("placed"===I.status||"external_shipping_process"===I.status)&&"enduser"===B&&a.createElement(a.Fragment,null,a.createElement(_,{variant:"contained",color:"primary",onClick:function(){return J(!0)}},"Confirm order"),a.createElement(v,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"),a.createElement(q,{open:H,handleClose:function(){return J(!1)},orderID:I.id,currentStatus:I.status,revalidateCallback:A})))),a.createElement(x,{item:!0,xs:12},a.createElement(k,{spacing:2},a.createElement(b,{variant:"h5"},"Documents"),a.createElement(w,null,a.createElement(k,{spacing:1},I.delivery_note?a.createElement(a.Fragment,null,a.createElement(b,{variant:"h6"},"Delivery Note"),a.createElement(b,null,null===(h=I.delivery_note)||void 0===h?void 0:h.name),a.createElement(_,{variant:"contained",onClick:function(){m("api/opos/".concat(I.id),"delivery_note")}},"Download")):a.createElement(a.Fragment,null,a.createElement(b,{variant:"h5"},"Delivery Note"),a.createElement(b,{variant:"body1"},"Here you can upload the the delivery note for this order"),a.createElement(D,null),a.createElement(l,{reference:"api::e-commerce.opo",refID:I.id,field:"delivery_note",multiple:!1,accept:"text/*,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",path:"api/opos",componentName:"delivery_note",componentReference:"common.base64-encoded-media",revalidateCallback:A})))))),(null===(N=null===(j=null==I?void 0:I.notes)||void 0===j?void 0:j.data)||void 0===N?void 0:N.length)>0&&a.createElement(x,{item:!0,xs:12},a.createElement(k,{spacing:2},a.createElement(b,{variant:"h5"},"Notes"),a.createElement(s,{notes:I.notes.data}),a.createElement(D,null))),a.createElement(x,{item:!0,xs:12},a.createElement(k,{spacing:1},a.createElement(b,{variant:"h5"},"Items"),"placed"===I.status&&a.createElement(v,{severity:"warning"},"Before confirmation you cannot update the items"),a.createElement(D,null),a.createElement("form",{action:T},a.createElement("input",{name:"id",type:"hidden",value:I.id}),M&&M.map((function(e,t){var r,n;return console.log("item",e),a.createElement(w,{sx:{p:2,mb:2},key:t},"placed"===I.status?a.createElement(d,{item:e,index:t,image:null===(r=null==e?void 0:e.product)||void 0===r?void 0:r.image}):a.createElement(c,{item:e,index:t,handleUpdateQuantity:L,image:null===(n=null==e?void 0:e.product)||void 0===n?void 0:n.image,revalidateCallback:A}))})),a.createElement(w,{sx:{p:2}},a.createElement(k,{direction:"row",spacing:2,justifyContent:"end"},a.createElement(E,{text:"Update items",loadingText:"Loading..."}),a.createElement(u,{error:null==P?void 0:P.strapiErrors}),(null==P?void 0:P.message)&&a.createElement(v,{severity:"error"},null==P?void 0:P.message))),a.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map((function(e){return{id:e.id,ordered_quantity:e.ordered_quantity,picked_quantity:e.picked_quantity,packed_quantity:e.packed_quantity,shipped_quantity:e.shipped_quantity}}))}(M))}))))))}export{N as default};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{__read as e,__spreadArray as t,__assign as r}from"../../../../node_modules/tslib/tslib.es6.js";import n,{useState as a,useEffect as i}from"react";import{useFormState as o}from"react-dom";import{updateOpoAction as l}from"../../../data/actions/e-commerce/opo/updateOpoAction.js";import m from"./TextualOpoItemUpdater.js";import c from"./OpoItemDisplay.js";import d from"../../logistics/note/NotesDisplay.js";import s from"../../logistics/note/NoteTakingComponent.js";import{StrapiErrors as p}from"../../StrapiErrors.js";import{SubmitButton as u}from"../../SubmitButton.js";import v from"@mui/material/Alert";import E from"@mui/material/Dialog";import f from"@mui/material/DialogActions";import y from"@mui/material/DialogContent";import g from"@mui/material/DialogTitle";import h from"@mui/material/Typography";import b from"@mui/material/Button";import x from"@mui/material/Grid";import C from"@mui/material/Box";import k from"@mui/material/Paper";import _ from"@mui/material/Stack";import w from"@mui/material/Divider";import D from"@mui/material/Card";import j from"@mui/material/CardContent";import{confirmationService as O}from"../../../data/services/logistics/ipo/confirmation-service.js";import{FormControlLabel as I,Checkbox as q}from"@mui/material";var A={zodErrors:null,strapiErrors:null,data:null,message:null};function S(e){var t=e.open,r=e.handleClose,a=e.orderID,i=e.currentStatus,o=e.revalidateCallback;return n.createElement(E,{open:t},n.createElement(g,null,"Confirm Order"),n.createElement(y,null,n.createElement(_,{spacing:2},n.createElement(h,null,"Are you sure you want to confirm this order?"),n.createElement(h,null,"Current status: ",i))),n.createElement(f,null,n.createElement(b,{variant:"contained",onClick:function(e){O("opos",[a]),o&&o()}},"Confirm"),n.createElement(b,{variant:"contained",onClick:r},"Cancel")))}function T(E){var f,y,g,O,T=E.opo,N=E.sx,U=E.revalidateCallback;E.handleClose;var B=E.role,P=e(o(l,A),2),R=P[0],M=P[1],z=e(a(T.opo_items.data?T.opo_items.data:[]),2),F=z[0],G=z[1],J=e(a(!1),2),L=J[0],Q=J[1],H=e(a(["picked","packed","shipped","reports"]),2),K=H[0],V=H[1],W=function(r,n,a){var i=t([],e(F),!1),o=i.findIndex((function(e){return e.id===n}));i[o][a]=r,G(i)},X=function(n,a){var i,o,l,m=t([],e(F),!1),c=m.findIndex((function(e){return e.id===a})),d=(null===(o=null===(i=m[c])||void 0===i?void 0:i.reports)||void 0===o?void 0:o.data)||[],s=t(t([],e(d),!1),[n],!1);null==(null===(l=m[c])||void 0===l?void 0:l.reports)&&(m[c]=r(r({},m[c]),{reports:{data:[]}})),m[c].reports.data=s,G(m)},Y=function(r,n){var a,i,o=t([],e(F),!1),l=o.findIndex((function(e){return e.id===r})),m=(null===(i=null===(a=o[l])||void 0===a?void 0:a.reports)||void 0===i?void 0:i.data)||[],c=m.filter((function(e){return"id"in e})),d=m.filter((function(e){return!("id"in e)}));d.splice(n,1);var s=t(t([],e(c),!1),e(d),!1);o[l].reports.data=s,G(o)};return i((function(){"Ipo Updated"===(null==R?void 0:R.message)&&U&&U()}),[R]),i((function(){var e;(null===(e=T.opo_items)||void 0===e?void 0:e.data)&&G(T.opo_items.data?T.opo_items.data:[])}),[T]),n.createElement(C,{sx:t([],e(Array.isArray(N)?N:[N]),!1)},n.createElement(x,{container:!0,spacing:2},n.createElement(x,{item:!0,xs:12},n.createElement(_,{spacing:2},n.createElement(_,{direction:"row",spacing:2,justifyContent:"space-between"},n.createElement(_,{spacing:2},n.createElement(h,{variant:"h3",component:"h1"},"Management Outbound Purchase Order"),n.createElement(h,{variant:"body1"},"Manage picking, packing and shipping of purchase order")),n.createElement(s,{content:"",related:[{id:T.id,__type:"api::e-commerce.opo"}],revalidateCallback:U})),n.createElement(w,null))),n.createElement(x,{item:!0,xs:6},n.createElement(_,{spacing:1},n.createElement(h,{variant:"h5"},"Details"),n.createElement(_,{direction:"row",spacing:2},n.createElement(h,{variant:"body1",width:"250px"},"Purchase Order Number"),n.createElement(h,{variant:"body2"},T.opo_number)),n.createElement(_,{direction:"row",spacing:2},n.createElement(h,{variant:"body1",width:"250px"},"Custom reference"),n.createElement(h,{variant:"body2"},T.customer_inhouse_reference)),n.createElement(_,{direction:"row",spacing:2},n.createElement(h,{variant:"body1",width:"250px"},"Order Date"),n.createElement(h,{variant:"body2"},T.order_date)),n.createElement(_,{direction:"row",spacing:2},n.createElement(h,{variant:"body1",width:"250px"},"Customer"),n.createElement(h,{variant:"body2"},null===(y=null===(f=T.customer)||void 0===f?void 0:f.business_credentials)||void 0===y?void 0:y.company_name)),n.createElement(_,{direction:"row",spacing:2},n.createElement(h,{variant:"body1",width:"250px"},"Order Status"),n.createElement(h,{variant:"body2",width:"250px"},T.status)),("placed"===T.status||"external_shipping_process"===T.status)&&"enduser"===B&&n.createElement(n.Fragment,null,n.createElement(b,{variant:"contained",color:"primary",onClick:function(){return Q(!0)}},"Confirm order"),n.createElement(v,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"),n.createElement(S,{open:L,handleClose:function(){return Q(!1)},orderID:T.id,currentStatus:T.status,revalidateCallback:U})))),n.createElement(x,{item:!0,xs:12},n.createElement(_,{spacing:2},n.createElement(h,{variant:"h5"},"Documents"),n.createElement(D,{variant:"outlined"},n.createElement(j,null,n.createElement(_,{spacing:1},"// TODO - Should we add options to upload a shipping label and a delivery note?? where do these notes come from? are they generated by the system or are they uploaded by the enduser?"))))),(null===(O=null===(g=null==T?void 0:T.notes)||void 0===g?void 0:g.data)||void 0===O?void 0:O.length)>0&&n.createElement(x,{item:!0,xs:12},n.createElement(_,{spacing:2},n.createElement(h,{variant:"h5"},"Notes"),n.createElement(d,{notes:T.notes.data}),n.createElement(w,null))),n.createElement(x,{item:!0,xs:12},n.createElement(_,{spacing:1},n.createElement(h,{variant:"h5"},"Items"),n.createElement(_,{direction:"row",alignItems:"center",justifyContent:"flex-end",spacing:2,component:k,p:1},n.createElement(h,{variant:"body1"},"Show:"),["picked","packed","shipped","reports"].map((function(r){return n.createElement(I,{key:r,control:n.createElement(q,{checked:K.includes(r),onChange:function(n){n.target.checked?V(t(t([],e(K),!1),[r],!1)):V(K.filter((function(e){return e!==r})))}}),label:r.charAt(0).toUpperCase()+r.slice(1)})}))),"placed"===T.status&&n.createElement(v,{severity:"warning"},"Before confirmation you cannot update the items"),n.createElement(w,null),n.createElement("form",{action:M},n.createElement("input",{name:"id",type:"hidden",value:T.id}),F&&F.map((function(e,t){var r,a;return n.createElement(k,{sx:{p:2,mb:2},key:t},"placed"===T.status?n.createElement(c,{item:e,index:t,image:null===(r=null==e?void 0:e.product)||void 0===r?void 0:r.image}):n.createElement(m,{item:e,index:t,handleUpdateQuantity:W,handleAddReport:X,image:null===(a=null==e?void 0:e.product)||void 0===a?void 0:a.image,handleRemoveReportAtIndex:Y,revalidateCallback:U,showing:K}))})),n.createElement(k,{sx:{p:2}},n.createElement(_,{direction:"row",spacing:2,justifyContent:"end"},n.createElement(u,{text:"Update items",loadingText:"Loading..."}),n.createElement(p,{error:null==R?void 0:R.strapiErrors}),(null==R?void 0:R.message)&&n.createElement(v,{severity:"error"},null==R?void 0:R.message))),n.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map((function(e){var t,r;return{id:e.id,ordered_quantity:e.ordered_quantity,picked_quantity:e.picked_quantity,packed_quantity:e.packed_quantity,shipped_quantity:e.shipped_quantity,reports:(null===(r=null===(t=e.reports)||void 0===t?void 0:t.data)||void 0===r?void 0:r.map((function(e){return{id:"id"in e?e.id:void 0,quantity:e.quantity,content:e.content,type:e.type}})))||[]}}))}(F))}))))))}export{T as default};
6
+ import{__read as e,__spreadArray as t,__assign as n}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as a,useEffect as i}from"react";import{useFormState as o}from"react-dom";import{updateOpoAction as l}from"../../../data/actions/e-commerce/opo/updateOpoAction.js";import{UploadBase64MediaForm as m}from"../../common/media/UploadBase64MediaForm.js";import c from"../../../data/loaders/common/media/downloadBase64File.js";import d from"./TextualOpoItemUpdater.js";import s from"./OpoItemDisplay.js";import p from"../../logistics/note/NotesDisplay.js";import u from"../../logistics/note/NoteTakingComponent.js";import{StrapiErrors as v}from"../../StrapiErrors.js";import{SubmitButton as E}from"../../SubmitButton.js";import f from"@mui/material/Alert";import y from"@mui/material/Dialog";import g from"@mui/material/DialogActions";import h from"@mui/material/DialogContent";import b from"@mui/material/DialogTitle";import x from"@mui/material/Typography";import _ from"@mui/material/Button";import C from"@mui/material/Grid";import k from"@mui/material/Box";import w from"@mui/material/Paper";import D from"@mui/material/Stack";import j from"@mui/material/Divider";import{confirmationService as I}from"../../../data/services/logistics/ipo/confirmation-service.js";import{FormControlLabel as q,Checkbox as O}from"@mui/material";var A={zodErrors:null,strapiErrors:null,data:null,message:null};function N(e){var t=e.open,n=e.handleClose,a=e.orderID,i=e.currentStatus,o=e.revalidateCallback;return r.createElement(y,{open:t},r.createElement(b,null,"Confirm Order"),r.createElement(h,null,r.createElement(D,{spacing:2},r.createElement(x,null,"Are you sure you want to confirm this order?"),r.createElement(x,null,"Current status: ",i))),r.createElement(g,null,r.createElement(_,{variant:"contained",onClick:function(e){I("opos",[a]),o&&o()}},"Confirm"),r.createElement(_,{variant:"contained",onClick:n},"Cancel")))}function S(y){var g,h,b,I,S,B=y.opo,U=y.sx,F=y.revalidateCallback;y.handleClose;var T=y.role,P=e(o(l,A),2),R=P[0],M=P[1],z=e(a(B.opo_items.data?B.opo_items.data:[]),2),G=z[0],H=z[1],J=e(a(!1),2),L=J[0],Q=J[1],K=e(a(["picked","packed","shipped","reports"]),2),V=K[0],W=K[1],X=function(n,r,a){var i=t([],e(G),!1),o=i.findIndex((function(e){return e.id===r}));i[o][a]=n,H(i)},Y=function(r,a){var i,o,l,m=t([],e(G),!1),c=m.findIndex((function(e){return e.id===a})),d=(null===(o=null===(i=m[c])||void 0===i?void 0:i.reports)||void 0===o?void 0:o.data)||[],s=t(t([],e(d),!1),[r],!1);null==(null===(l=m[c])||void 0===l?void 0:l.reports)&&(m[c]=n(n({},m[c]),{reports:{data:[]}})),m[c].reports.data=s,H(m)},Z=function(n,r){var a,i,o=t([],e(G),!1),l=o.findIndex((function(e){return e.id===n})),m=(null===(i=null===(a=o[l])||void 0===a?void 0:a.reports)||void 0===i?void 0:i.data)||[],c=m.filter((function(e){return"id"in e})),d=m.filter((function(e){return!("id"in e)}));d.splice(r,1);var s=t(t([],e(c),!1),e(d),!1);o[l].reports.data=s,H(o)};return i((function(){"Ipo Updated"===(null==R?void 0:R.message)&&F&&F()}),[R]),i((function(){var e;(null===(e=B.opo_items)||void 0===e?void 0:e.data)&&H(B.opo_items.data?B.opo_items.data:[])}),[B]),r.createElement(k,{sx:t([],e(Array.isArray(U)?U:[U]),!1)},r.createElement(C,{container:!0,spacing:2},r.createElement(C,{item:!0,xs:12},r.createElement(D,{spacing:2},r.createElement(D,{direction:"row",spacing:2,justifyContent:"space-between"},r.createElement(D,{spacing:2},r.createElement(x,{variant:"h3",component:"h1"},"Management Outbound Purchase Order"),r.createElement(x,{variant:"body1"},"Manage picking, packing and shipping of purchase order")),r.createElement(u,{content:"",related:[{id:B.id,__type:"api::e-commerce.opo"}],revalidateCallback:F})),r.createElement(j,null))),r.createElement(C,{item:!0,xs:6},r.createElement(D,{spacing:1},r.createElement(x,{variant:"h5"},"Details"),r.createElement(D,{direction:"row",spacing:2},r.createElement(x,{variant:"body1",width:"250px"},"Purchase Order Number"),r.createElement(x,{variant:"body2"},B.opo_number)),r.createElement(D,{direction:"row",spacing:2},r.createElement(x,{variant:"body1",width:"250px"},"Custom reference"),r.createElement(x,{variant:"body2"},B.customer_inhouse_reference)),r.createElement(D,{direction:"row",spacing:2},r.createElement(x,{variant:"body1",width:"250px"},"Order Date"),r.createElement(x,{variant:"body2"},B.order_date)),r.createElement(D,{direction:"row",spacing:2},r.createElement(x,{variant:"body1",width:"250px"},"Customer"),r.createElement(x,{variant:"body2"},null===(h=null===(g=B.customer)||void 0===g?void 0:g.business_credentials)||void 0===h?void 0:h.company_name)),r.createElement(D,{direction:"row",spacing:2},r.createElement(x,{variant:"body1",width:"250px"},"Order Status"),r.createElement(x,{variant:"body2",width:"250px"},B.status)),("placed"===B.status||"external_shipping_process"===B.status)&&"enduser"===T&&r.createElement(r.Fragment,null,r.createElement(_,{variant:"contained",color:"primary",onClick:function(){return Q(!0)}},"Confirm order"),r.createElement(f,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"),r.createElement(N,{open:L,handleClose:function(){return Q(!1)},orderID:B.id,currentStatus:B.status,revalidateCallback:F})))),r.createElement(C,{item:!0,xs:12},r.createElement(D,{spacing:2},r.createElement(x,{variant:"h5"},"Documents"),r.createElement(w,null,r.createElement(D,{spacing:1},B.delivery_note?r.createElement(r.Fragment,null,r.createElement(x,{variant:"h6"},"Delivery Note"),r.createElement(x,null,null===(b=B.delivery_note)||void 0===b?void 0:b.name),r.createElement(_,{variant:"contained",onClick:function(){c("api/ipos/".concat(B.id),"delivery_note")}},"Download")):r.createElement(r.Fragment,null,r.createElement(x,{variant:"h5"},"Delivery Note"),r.createElement(x,{variant:"body1"},"Here you can upload the the delivery note for this order"),r.createElement(j,null),r.createElement(m,{reference:"api::e-commerce.opo",refID:B.id,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:F})))))),(null===(S=null===(I=null==B?void 0:B.notes)||void 0===I?void 0:I.data)||void 0===S?void 0:S.length)>0&&r.createElement(C,{item:!0,xs:12},r.createElement(D,{spacing:2},r.createElement(x,{variant:"h5"},"Notes"),r.createElement(p,{notes:B.notes.data}),r.createElement(j,null))),r.createElement(C,{item:!0,xs:12},r.createElement(D,{spacing:1},r.createElement(x,{variant:"h5"},"Items"),r.createElement(D,{direction:"row",alignItems:"center",justifyContent:"flex-end",spacing:2,component:w,p:1},r.createElement(x,{variant:"body1"},"Show:"),["picked","packed","shipped","reports"].map((function(n){return r.createElement(q,{key:n,control:r.createElement(O,{checked:V.includes(n),onChange:function(r){r.target.checked?W(t(t([],e(V),!1),[n],!1)):W(V.filter((function(e){return e!==n})))}}),label:n.charAt(0).toUpperCase()+n.slice(1)})}))),"placed"===B.status&&r.createElement(f,{severity:"warning"},"Before confirmation you cannot update the items"),r.createElement(j,null),r.createElement("form",{action:M},r.createElement("input",{name:"id",type:"hidden",value:B.id}),G&&G.map((function(e,t){var n,a;return r.createElement(w,{sx:{p:2,mb:2},key:t},"placed"===B.status?r.createElement(s,{item:e,index:t,image:null===(n=null==e?void 0:e.product)||void 0===n?void 0:n.image}):r.createElement(d,{item:e,index:t,handleUpdateQuantity:X,handleAddReport:Y,image:null===(a=null==e?void 0:e.product)||void 0===a?void 0:a.image,handleRemoveReportAtIndex:Z,revalidateCallback:F,showing:V}))})),r.createElement(w,{sx:{p:2}},r.createElement(D,{direction:"row",spacing:2,justifyContent:"end"},r.createElement(E,{text:"Update items",loadingText:"Loading..."}),r.createElement(v,{error:null==R?void 0:R.strapiErrors}),(null==R?void 0:R.message)&&r.createElement(f,{severity:"error"},null==R?void 0:R.message))),r.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map((function(e){var t,n;return{id:e.id,ordered_quantity:e.ordered_quantity,picked_quantity:e.picked_quantity,packed_quantity:e.packed_quantity,shipped_quantity:e.shipped_quantity,reports:(null===(n=null===(t=e.reports)||void 0===t?void 0:t.data)||void 0===n?void 0:n.map((function(e){return{id:"id"in e?e.id:void 0,quantity:e.quantity,content:e.content,type:e.type}})))||[]}}))}(G))}))))))}export{S as default};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import a,{useState as r}from"react";import{useFormState as n}from"react-dom";import{updateIpoAction as i}from"../../../data/actions/logistics/ipo/updateIpoAction.js";import{UploadBase64MediaForm as o}from"../../common/media/UploadBase64MediaForm.js";import l from"../../../data/loaders/common/media/downloadBase64File.js";import m from"./IPOItemUpdater.js";import c from"./ItemDisplay.js";import d from"../note/NotesDisplay.js";import s from"../note/NoteTakingComponent.js";import{StrapiErrors as p}from"../../StrapiErrors.js";import{SubmitButton as u}from"../../SubmitButton.js";import E from"@mui/material/Alert";import v from"@mui/material/Dialog";import f from"@mui/material/DialogActions";import g from"@mui/material/DialogContent";import y from"@mui/material/DialogTitle";import h from"@mui/material/Typography";import b from"@mui/material/Button";import C from"@mui/material/Grid";import _ from"@mui/material/Box";import x from"@mui/material/Paper";import w from"@mui/material/Stack";import D from"@mui/material/Divider";import k from"@mui/material/Card";import j from"@mui/material/CardContent";import{confirmationService as I}from"../../../data/services/logistics/ipo/confirmation-service.js";var F={zodErrors:null,strapiErrors:null,data:null,message:null};function N(e){var t=e.open,r=e.handleClose,n=e.orderID,i=e.currentStatus,o=e.revalidateCallback;return a.createElement(v,{open:t},a.createElement(y,null,"Confirm Order"),a.createElement(g,null,a.createElement(w,{spacing:2},a.createElement(h,null,"Are you sure you want to confirm this order?"),a.createElement(h,null,"Current status: ",i))),a.createElement(f,null,a.createElement(b,{variant:"contained",onClick:function(e){I("ipos",[n]),o&&o()}},"Confirm"),a.createElement(b,{variant:"contained",onClick:r},"Cancel")))}function O(v){var f,g,y,I,O,S,q,A=v.data,B=v.sx,P=v.revalidateCallback;v.handleClose;var U=v.role,T=e(n(i,F),2),M=T[0],H=T[1],R=e(r(A.items.data?A.items.data:[]),2),z=R[0],G=R[1],J=e(r(!1),2),L=J[0],Q=J[1],K=function(a,r,n){var i=t([],e(z),!1),o=i.findIndex((function(e){return e.id===r}));i[o][n]=a,G(i)};return a.createElement(_,{sx:t([],e(Array.isArray(B)?B:[B]),!1)},a.createElement(C,{container:!0,spacing:2},a.createElement(C,{item:!0,xs:12},a.createElement(w,{spacing:2},a.createElement(w,{direction:"row",spacing:2,justifyContent:"space-between"},a.createElement(w,{spacing:2},a.createElement(h,{variant:"h3",component:"h1"},"Management Inbound Purchase Order"),a.createElement(h,{variant:"body1"},"Manage arrival, registration and recieval of purchase order")),a.createElement(s,{content:"",related:[{id:A.id,__type:"api::logistics.ipo"}],revalidateCallback:P})),a.createElement(D,null))),a.createElement(C,{item:!0,xs:6},a.createElement(w,{spacing:1},a.createElement(h,{variant:"h5"},"Details"),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Purchase Order Number"),a.createElement(h,{variant:"body2"},A.ipo_number)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Custom reference"),a.createElement(h,{variant:"body2"},A.custom_reference)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Order Date"),a.createElement(h,{variant:"body2"},A.order_date)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Supplier"),a.createElement(h,{variant:"body2"},null===(g=null===(f=A.vendor_profile)||void 0===f?void 0:f.business_credentials)||void 0===g?void 0:g.company_name)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Order Status"),a.createElement(h,{variant:"body2",width:"250px"},A.status)),("placed"===A.status||"released_on_stock"===A.status)&&"enduser"===U&&a.createElement(a.Fragment,null,a.createElement(b,{variant:"contained",color:"primary",onClick:function(){return Q(!0)}},"Confirm order"),a.createElement(E,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"),a.createElement(N,{open:L,handleClose:function(){return Q(!1)},orderID:A.id,currentStatus:A.status,revalidateCallback:P})))),a.createElement(C,{item:!0,xs:12},a.createElement(w,{spacing:2},a.createElement(h,{variant:"h5"},"Documents"),a.createElement(k,{variant:"outlined"},a.createElement(j,null,a.createElement(w,{spacing:1},"enduser"===U&&a.createElement(a.Fragment,null,A.order_confirmation?a.createElement(a.Fragment,null,a.createElement(h,{variant:"h6"},"Order Confirmation"),a.createElement(h,null,null===(y=A.order_confirmation)||void 0===y?void 0:y.name),a.createElement(b,{variant:"contained",onClick:function(){l("api/ipos/".concat(A.id),"order_confirmation")}},"Download")):a.createElement(a.Fragment,null,a.createElement(h,{variant:"h5"},"Order Confirmation"),a.createElement(h,{variant:"body1"},"Here you can upload the the order confirmation for this order"),a.createElement(h,{variant:"body1"},"FileUpload"),a.createElement(D,null),a.createElement(o,{reference:"api::logistics.ipo",refID:A.id,field:"order_confirmation",multiple:!1,accept:"text/*,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",path:"api/ipos",componentName:"order_confirmation",componentReference:"common.base64-encoded-media",revalidateCallback:P}))),A.delivery_note?a.createElement(a.Fragment,null,a.createElement(h,{variant:"h6"},"Delivery Note"),a.createElement(h,null,null===(I=A.delivery_note)||void 0===I?void 0:I.name),a.createElement(b,{variant:"contained",onClick:function(){l("api/ipos/".concat(A.id),"delivery_note")}},"Download")):a.createElement(a.Fragment,null,a.createElement(h,{variant:"h5"},"Delivery Note"),a.createElement(h,{variant:"body1"},"Here you can upload the the delivery note for this order"),a.createElement(D,null),a.createElement(o,{reference:"api::logistics.ipo",refID:A.id,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:P}))))))),(null===(S=null===(O=null==A?void 0:A.notes)||void 0===O?void 0:O.data)||void 0===S?void 0:S.length)>0&&a.createElement(C,{item:!0,xs:12},a.createElement(w,{spacing:2},a.createElement(h,{variant:"h5"},"Notes"),a.createElement(d,{notes:A.notes.data}),a.createElement(D,null))),a.createElement(C,{item:!0,xs:12},a.createElement(w,{spacing:1},a.createElement(h,{variant:"h5"},"Items"),"placed"===A.status&&a.createElement(E,{severity:"warning"},"Before confirmation you cannot update the items"),a.createElement(D,null),a.createElement("form",{action:H},a.createElement("input",{name:"id",type:"hidden",value:A.id}),(null===(q=null==A?void 0:A.items)||void 0===q?void 0:q.data)&&A.items.data.map((function(e,t){var r,n;return console.log("item",e),a.createElement(x,{sx:{p:2,mb:2},key:t},"placed"===A.status?a.createElement(c,{item:e,index:t,image:null===(r=null==e?void 0:e.product)||void 0===r?void 0:r.image}):a.createElement(m,{item:e,index:t,handleUpdateQuantity:K,image:null===(n=null==e?void 0:e.product)||void 0===n?void 0:n.image,revalidateCallback:P}))})),a.createElement(x,{sx:{p:2}},a.createElement(w,{direction:"row",spacing:2,justifyContent:"end"},a.createElement(u,{text:"Update items",loadingText:"Loading..."}),a.createElement(p,{error:null==M?void 0:M.strapiErrors}),(null==M?void 0:M.message)&&a.createElement(E,{severity:"error"},null==M?void 0:M.message))),a.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map((function(e){return{id:e.id,received_quantity:e.received_quantity,registered_quantity:e.registered_quantity,released_quantity:e.released_quantity}}))}(z))}))))))}export{O as default};
6
+ import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import a,{useState as r}from"react";import{useFormState as n}from"react-dom";import{updateIpoAction as i}from"../../../data/actions/logistics/ipo/updateIpoAction.js";import{UploadBase64MediaForm as o}from"../../common/media/UploadBase64MediaForm.js";import l from"../../../data/loaders/common/media/downloadBase64File.js";import m from"./IPOItemUpdater.js";import c from"./ItemDisplay.js";import d from"../note/NotesDisplay.js";import s from"../note/NoteTakingComponent.js";import{StrapiErrors as p}from"../../StrapiErrors.js";import{SubmitButton as u}from"../../SubmitButton.js";import E from"@mui/material/Alert";import v from"@mui/material/Dialog";import f from"@mui/material/DialogActions";import g from"@mui/material/DialogContent";import y from"@mui/material/DialogTitle";import h from"@mui/material/Typography";import b from"@mui/material/Button";import x from"@mui/material/Grid";import C from"@mui/material/Box";import _ from"@mui/material/Paper";import w from"@mui/material/Stack";import D from"@mui/material/Divider";import{confirmationService as k}from"../../../data/services/logistics/ipo/confirmation-service.js";var j={zodErrors:null,strapiErrors:null,data:null,message:null};function I(e){var t=e.open,r=e.handleClose,n=e.orderID,i=e.currentStatus,o=e.revalidateCallback;return a.createElement(v,{open:t},a.createElement(y,null,"Confirm Order"),a.createElement(g,null,a.createElement(w,{spacing:2},a.createElement(h,null,"Are you sure you want to confirm this order?"),a.createElement(h,null,"Current status: ",i))),a.createElement(f,null,a.createElement(b,{variant:"contained",onClick:function(e){k("ipos",[n]),o&&o()}},"Confirm"),a.createElement(b,{variant:"contained",onClick:r},"Cancel")))}function F(v){var f,g,y,k,F,N,O,S=v.data,q=v.sx,A=v.revalidateCallback;v.handleClose;var B=v.role,P=e(n(i,j),2),U=P[0],T=P[1],M=e(r(S.items.data?S.items.data:[]),2),H=M[0],R=M[1],z=e(r(!1),2),G=z[0],J=z[1],L=function(a,r,n){var i=t([],e(H),!1),o=i.findIndex((function(e){return e.id===r}));i[o][n]=a,R(i)};return a.createElement(C,{sx:t([],e(Array.isArray(q)?q:[q]),!1)},a.createElement(x,{container:!0,spacing:2},a.createElement(x,{item:!0,xs:12},a.createElement(w,{spacing:2},a.createElement(w,{direction:"row",spacing:2,justifyContent:"space-between"},a.createElement(w,{spacing:2},a.createElement(h,{variant:"h3",component:"h1"},"Management Inbound Purchase Order"),a.createElement(h,{variant:"body1"},"Manage arrival, registration and recieval of purchase order")),a.createElement(s,{content:"",related:[{id:S.id,__type:"api::logistics.ipo"}],revalidateCallback:A})),a.createElement(D,null))),a.createElement(x,{item:!0,xs:6},a.createElement(w,{spacing:1},a.createElement(h,{variant:"h5"},"Details"),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Purchase Order Number"),a.createElement(h,{variant:"body2"},S.ipo_number)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Custom reference"),a.createElement(h,{variant:"body2"},S.custom_reference)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Order Date"),a.createElement(h,{variant:"body2"},S.order_date)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Supplier"),a.createElement(h,{variant:"body2"},null===(g=null===(f=S.vendor_profile)||void 0===f?void 0:f.business_credentials)||void 0===g?void 0:g.company_name)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Order Status"),a.createElement(h,{variant:"body2",width:"250px"},S.status)),("placed"===S.status||"released_on_stock"===S.status)&&"enduser"===B&&a.createElement(a.Fragment,null,a.createElement(b,{variant:"contained",color:"primary",onClick:function(){return J(!0)}},"Confirm order"),a.createElement(E,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"),a.createElement(I,{open:G,handleClose:function(){return J(!1)},orderID:S.id,currentStatus:S.status,revalidateCallback:A})))),a.createElement(x,{item:!0,xs:12},a.createElement(w,{spacing:2},a.createElement(h,{variant:"h5"},"Documents"),a.createElement(_,{sx:{p:2}},a.createElement(w,{spacing:1},"enduser"===B&&a.createElement(a.Fragment,null,S.order_confirmation?a.createElement(a.Fragment,null,a.createElement(h,{variant:"h6"},"Order Confirmation"),a.createElement(h,null,null===(y=S.order_confirmation)||void 0===y?void 0:y.name),a.createElement(b,{variant:"contained",onClick:function(){l("api/ipos/".concat(S.id),"order_confirmation")}},"Download")):a.createElement(a.Fragment,null,a.createElement(h,{variant:"h5"},"Order Confirmation"),a.createElement(h,{variant:"body1"},"Here you can upload the the order confirmation for this order"),a.createElement(h,{variant:"body1"},"FileUpload"),a.createElement(D,null),a.createElement(o,{reference:"api::logistics.ipo",refID:S.id,field:"order_confirmation",multiple:!1,accept:"text/*,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",path:"api/ipos",componentName:"order_confirmation",componentReference:"common.base64-encoded-media",revalidateCallback:A}))),S.delivery_note?a.createElement(a.Fragment,null,a.createElement(h,{variant:"h6"},"Delivery Note"),a.createElement(h,null,null===(k=S.delivery_note)||void 0===k?void 0:k.name),a.createElement(b,{variant:"contained",onClick:function(){l("api/ipos/".concat(S.id),"delivery_note")}},"Download")):a.createElement(a.Fragment,null,a.createElement(h,{variant:"h5"},"Delivery Note"),a.createElement(h,{variant:"body1"},"Here you can upload the the delivery note for this order"),a.createElement(D,null),a.createElement(o,{reference:"api::logistics.ipo",refID:S.id,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:A})))))),(null===(N=null===(F=null==S?void 0:S.notes)||void 0===F?void 0:F.data)||void 0===N?void 0:N.length)>0&&a.createElement(x,{item:!0,xs:12},a.createElement(w,{spacing:2},a.createElement(h,{variant:"h5"},"Notes"),a.createElement(d,{notes:S.notes.data}),a.createElement(D,null))),a.createElement(x,{item:!0,xs:12},a.createElement(w,{spacing:1},a.createElement(h,{variant:"h5"},"Items"),"placed"===S.status&&a.createElement(E,{severity:"warning"},"Before confirmation you cannot update the items"),a.createElement(D,null),a.createElement("form",{action:T},a.createElement("input",{name:"id",type:"hidden",value:S.id}),(null===(O=null==S?void 0:S.items)||void 0===O?void 0:O.data)&&S.items.data.map((function(e,t){var r,n;return console.log("item",e),a.createElement(_,{sx:{p:2,mb:2},key:t},"placed"===S.status?a.createElement(c,{item:e,index:t,image:null===(r=null==e?void 0:e.product)||void 0===r?void 0:r.image}):a.createElement(m,{item:e,index:t,handleUpdateQuantity:L,image:null===(n=null==e?void 0:e.product)||void 0===n?void 0:n.image,revalidateCallback:A}))})),a.createElement(_,{sx:{p:2}},a.createElement(w,{direction:"row",spacing:2,justifyContent:"end"},a.createElement(u,{text:"Update items",loadingText:"Loading..."}),a.createElement(p,{error:null==U?void 0:U.strapiErrors}),(null==U?void 0:U.message)&&a.createElement(E,{severity:"error"},null==U?void 0:U.message))),a.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map((function(e){return{id:e.id,received_quantity:e.received_quantity,registered_quantity:e.registered_quantity,released_quantity:e.released_quantity}}))}(H))}))))))}export{F as default};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{__read as e,__spreadArray as t,__assign as r}from"../../../../node_modules/tslib/tslib.es6.js";import n,{useState as a,useEffect as i}from"react";import{useFormState as o}from"react-dom";import{updateIpoAction as l}from"../../../data/actions/logistics/ipo/updateIpoAction.js";import{UploadBase64MediaForm as m}from"../../common/media/UploadBase64MediaForm.js";import c from"../../../data/loaders/common/media/downloadBase64File.js";import d from"./TextualIPOItemUpdater.js";import s from"./ItemDisplay.js";import u from"../note/NotesDisplay.js";import p from"../note/NoteTakingComponent.js";import{StrapiErrors as v}from"../../StrapiErrors.js";import{SubmitButton as f}from"../../SubmitButton.js";import E from"@mui/material/Alert";import y from"@mui/material/Dialog";import g from"@mui/material/DialogActions";import h from"@mui/material/DialogContent";import b from"@mui/material/DialogTitle";import C from"@mui/material/Typography";import x from"@mui/material/Button";import _ from"@mui/material/Grid";import w from"@mui/material/Box";import k from"@mui/material/Paper";import D from"@mui/material/Stack";import I from"@mui/material/Divider";import j from"@mui/material/Card";import q from"@mui/material/CardContent";import{confirmationService as A}from"../../../data/services/logistics/ipo/confirmation-service.js";import{FormControlLabel as F,Checkbox as N}from"@mui/material";var O={zodErrors:null,strapiErrors:null,data:null,message:null};function S(e){var t=e.open,r=e.handleClose,a=e.orderID,i=e.currentStatus,o=e.revalidateCallback;return n.createElement(y,{open:t},n.createElement(b,null,"Confirm Order"),n.createElement(h,null,n.createElement(D,{spacing:2},n.createElement(C,null,"Are you sure you want to confirm this order?"),n.createElement(C,null,"Current status: ",i))),n.createElement(g,null,n.createElement(x,{variant:"contained",onClick:function(e){A("ipos",[a]),o&&o()}},"Confirm"),n.createElement(x,{variant:"contained",onClick:r},"Cancel")))}function U(y){var g,h,b,A,U,B,P=y.data,R=y.sx,T=y.revalidateCallback;y.handleClose;var M=y.role,H=e(o(l,O),2),z=H[0],G=H[1],J=e(a(P.items.data?P.items.data:[]),2),L=J[0],Q=J[1],K=e(a(!1),2),V=K[0],W=K[1],X=e(a(["received","registered","released","reports"]),2),Y=X[0],Z=X[1],$=function(r,n,a){var i=t([],e(L),!1),o=i.findIndex((function(e){return e.id===n}));i[o][a]=r,Q(i)},ee=function(n,a){var i,o,l,m=t([],e(L),!1),c=m.findIndex((function(e){return e.id===a})),d=(null===(o=null===(i=m[c])||void 0===i?void 0:i.reports)||void 0===o?void 0:o.data)||[],s=t(t([],e(d),!1),[n],!1);null==(null===(l=m[c])||void 0===l?void 0:l.reports)&&(m[c]=r(r({},m[c]),{reports:{data:[]}})),m[c].reports.data=s,Q(m)},te=function(r,n){var a,i,o=t([],e(L),!1),l=o.findIndex((function(e){return e.id===r})),m=(null===(i=null===(a=o[l])||void 0===a?void 0:a.reports)||void 0===i?void 0:i.data)||[],c=m.filter((function(e){return"id"in e})),d=m.filter((function(e){return!("id"in e)}));d.splice(n,1);var s=t(t([],e(c),!1),e(d),!1);o[l].reports.data=s,Q(o)};return i((function(){"Ipo Updated"===(null==z?void 0:z.message)&&T&&T()}),[z]),i((function(){var e;(null===(e=P.items)||void 0===e?void 0:e.data)&&Q(P.items.data?P.items.data:[])}),[P]),n.createElement(w,{sx:t([],e(Array.isArray(R)?R:[R]),!1)},n.createElement(_,{container:!0,spacing:2},n.createElement(_,{item:!0,xs:12},n.createElement(D,{spacing:2},n.createElement(D,{direction:"row",spacing:2,justifyContent:"space-between"},n.createElement(D,{spacing:2},n.createElement(C,{variant:"h3",component:"h1"},"Management Inbound Purchase Order"),n.createElement(C,{variant:"body1"},"Manage arrival, registration and recieval of purchase order")),n.createElement(p,{content:"",related:[{id:P.id,__type:"api::logistics.ipo"}],revalidateCallback:T})),n.createElement(I,null))),n.createElement(_,{item:!0,xs:6},n.createElement(D,{spacing:1},n.createElement(C,{variant:"h5"},"Details"),n.createElement(D,{direction:"row",spacing:2},n.createElement(C,{variant:"body1",width:"250px"},"Purchase Order Number"),n.createElement(C,{variant:"body2"},P.ipo_number)),n.createElement(D,{direction:"row",spacing:2},n.createElement(C,{variant:"body1",width:"250px"},"Custom reference"),n.createElement(C,{variant:"body2"},P.custom_reference)),n.createElement(D,{direction:"row",spacing:2},n.createElement(C,{variant:"body1",width:"250px"},"Order Date"),n.createElement(C,{variant:"body2"},P.order_date)),n.createElement(D,{direction:"row",spacing:2},n.createElement(C,{variant:"body1",width:"250px"},"Supplier"),n.createElement(C,{variant:"body2"},null===(h=null===(g=P.vendor_profile)||void 0===g?void 0:g.business_credentials)||void 0===h?void 0:h.company_name)),n.createElement(D,{direction:"row",spacing:2},n.createElement(C,{variant:"body1",width:"250px"},"Order Status"),n.createElement(C,{variant:"body2",width:"250px"},P.status)),("placed"===P.status||"released_on_stock"===P.status)&&"enduser"===M&&n.createElement(n.Fragment,null,n.createElement(x,{variant:"contained",color:"primary",onClick:function(){return W(!0)}},"Confirm order"),n.createElement(E,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"),n.createElement(S,{open:V,handleClose:function(){return W(!1)},orderID:P.id,currentStatus:P.status,revalidateCallback:T})))),n.createElement(_,{item:!0,xs:12},n.createElement(D,{spacing:2},n.createElement(C,{variant:"h5"},"Documents"),n.createElement(j,{variant:"outlined"},n.createElement(q,null,n.createElement(D,{spacing:1},"enduser"===M&&n.createElement(n.Fragment,null,P.order_confirmation?n.createElement(n.Fragment,null,n.createElement(C,{variant:"h6"},"Order Confirmation"),n.createElement(C,null,null===(b=P.order_confirmation)||void 0===b?void 0:b.name),n.createElement(x,{variant:"contained",onClick:function(){c("api/ipos/".concat(P.id),"order_confirmation")}},"Download")):n.createElement(n.Fragment,null,n.createElement(C,{variant:"h5"},"Order Confirmation"),n.createElement(C,{variant:"body1"},"Here you can upload the the order confirmation for this order"),n.createElement(C,{variant:"body1"},"FileUpload"),n.createElement(I,null),n.createElement(m,{reference:"api::logistics.ipo",refID:P.id,field:"order_confirmation",multiple:!1,accept:"text/*,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",path:"api/ipos",componentName:"order_confirmation",componentReference:"common.base64-encoded-media",revalidateCallback:T}))),P.delivery_note?n.createElement(n.Fragment,null,n.createElement(C,{variant:"h6"},"Delivery Note"),n.createElement(C,null,null===(A=P.delivery_note)||void 0===A?void 0:A.name),n.createElement(x,{variant:"contained",onClick:function(){c("api/ipos/".concat(P.id),"delivery_note")}},"Download")):n.createElement(n.Fragment,null,n.createElement(C,{variant:"h5"},"Delivery Note"),n.createElement(C,{variant:"body1"},"Here you can upload the the delivery note for this order"),n.createElement(I,null),n.createElement(m,{reference:"api::logistics.ipo",refID:P.id,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:T}))))))),(null===(B=null===(U=null==P?void 0:P.notes)||void 0===U?void 0:U.data)||void 0===B?void 0:B.length)>0&&n.createElement(_,{item:!0,xs:12},n.createElement(D,{spacing:2},n.createElement(C,{variant:"h5"},"Notes"),n.createElement(u,{notes:P.notes.data}),n.createElement(I,null))),n.createElement(_,{item:!0,xs:12},n.createElement(D,{spacing:1},n.createElement(C,{variant:"h5"},"Items"),n.createElement(D,{direction:"row",alignItems:"center",justifyContent:"flex-end",spacing:2,component:k,p:1},n.createElement(C,{variant:"body1"},"Show:"),["received","registered","released","reports"].map((function(r){return n.createElement(F,{key:r,control:n.createElement(N,{checked:Y.includes(r),onChange:function(n){n.target.checked?Z(t(t([],e(Y),!1),[r],!1)):Z(Y.filter((function(e){return e!==r})))}}),label:r.charAt(0).toUpperCase()+r.slice(1)})}))),"placed"===P.status&&n.createElement(E,{severity:"warning"},"Before confirmation you cannot update the items"),n.createElement(I,null),n.createElement("form",{action:G},n.createElement("input",{name:"id",type:"hidden",value:P.id}),L&&L.map((function(e,t){var r,a;return n.createElement(k,{sx:{p:2,mb:2},key:t},"placed"===P.status?n.createElement(s,{item:e,index:t,image:null===(r=null==e?void 0:e.product)||void 0===r?void 0:r.image}):n.createElement(d,{item:e,index:t,handleUpdateQuantity:$,handleAddReport:ee,image:null===(a=null==e?void 0:e.product)||void 0===a?void 0:a.image,handleRemoveReportAtIndex:te,revalidateCallback:T,showing:Y}))})),n.createElement(k,{sx:{p:2}},n.createElement(D,{direction:"row",spacing:2,justifyContent:"end"},n.createElement(f,{text:"Update items",loadingText:"Loading..."}),n.createElement(v,{error:null==z?void 0:z.strapiErrors}),(null==z?void 0:z.message)&&n.createElement(E,{severity:"error"},null==z?void 0:z.message))),n.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map((function(e){var t,r;return{id:e.id,ordered_quantity:e.ordered_quantity,received_quantity:e.received_quantity,registered_quantity:e.registered_quantity,released_quantity:e.released_quantity,reports:(null===(r=null===(t=e.reports)||void 0===t?void 0:t.data)||void 0===r?void 0:r.map((function(e){return{id:"id"in e?e.id:void 0,quantity:e.quantity,content:e.content,type:e.type}})))||[]}}))}(L))}))))))}export{U as default};
6
+ import{__read as e,__spreadArray as t,__assign as r}from"../../../../node_modules/tslib/tslib.es6.js";import n,{useState as a,useEffect as i}from"react";import{useFormState as o}from"react-dom";import{updateIpoAction as l}from"../../../data/actions/logistics/ipo/updateIpoAction.js";import{UploadBase64MediaForm as m}from"../../common/media/UploadBase64MediaForm.js";import c from"../../../data/loaders/common/media/downloadBase64File.js";import d from"./TextualIPOItemUpdater.js";import s from"./ItemDisplay.js";import u from"../note/NotesDisplay.js";import p from"../note/NoteTakingComponent.js";import{StrapiErrors as v}from"../../StrapiErrors.js";import{SubmitButton as f}from"../../SubmitButton.js";import E from"@mui/material/Alert";import y from"@mui/material/Dialog";import g from"@mui/material/DialogActions";import h from"@mui/material/DialogContent";import b from"@mui/material/DialogTitle";import x from"@mui/material/Typography";import C from"@mui/material/Button";import _ from"@mui/material/Grid";import w from"@mui/material/Box";import k from"@mui/material/Paper";import D from"@mui/material/Stack";import I from"@mui/material/Divider";import{confirmationService as j}from"../../../data/services/logistics/ipo/confirmation-service.js";import{FormControlLabel as q,Checkbox as A}from"@mui/material";var F={zodErrors:null,strapiErrors:null,data:null,message:null};function N(e){var t=e.open,r=e.handleClose,a=e.orderID,i=e.currentStatus,o=e.revalidateCallback;return n.createElement(y,{open:t},n.createElement(b,null,"Confirm Order"),n.createElement(h,null,n.createElement(D,{spacing:2},n.createElement(x,null,"Are you sure you want to confirm this order?"),n.createElement(x,null,"Current status: ",i))),n.createElement(g,null,n.createElement(C,{variant:"contained",onClick:function(e){j("ipos",[a]),o&&o()}},"Confirm"),n.createElement(C,{variant:"contained",onClick:r},"Cancel")))}function O(y){var g,h,b,j,O,S,U=y.data,B=y.sx,P=y.revalidateCallback;y.handleClose;var R=y.role,T=e(o(l,F),2),M=T[0],H=T[1],z=e(a(U.items.data?U.items.data:[]),2),G=z[0],J=z[1],L=e(a(!1),2),Q=L[0],K=L[1],V=e(a(["received","registered","released","reports"]),2),W=V[0],X=V[1],Y=function(r,n,a){var i=t([],e(G),!1),o=i.findIndex((function(e){return e.id===n}));i[o][a]=r,J(i)},Z=function(n,a){var i,o,l,m=t([],e(G),!1),c=m.findIndex((function(e){return e.id===a})),d=(null===(o=null===(i=m[c])||void 0===i?void 0:i.reports)||void 0===o?void 0:o.data)||[],s=t(t([],e(d),!1),[n],!1);null==(null===(l=m[c])||void 0===l?void 0:l.reports)&&(m[c]=r(r({},m[c]),{reports:{data:[]}})),m[c].reports.data=s,J(m)},$=function(r,n){var a,i,o=t([],e(G),!1),l=o.findIndex((function(e){return e.id===r})),m=(null===(i=null===(a=o[l])||void 0===a?void 0:a.reports)||void 0===i?void 0:i.data)||[],c=m.filter((function(e){return"id"in e})),d=m.filter((function(e){return!("id"in e)}));d.splice(n,1);var s=t(t([],e(c),!1),e(d),!1);o[l].reports.data=s,J(o)};return i((function(){"Ipo Updated"===(null==M?void 0:M.message)&&P&&P()}),[M]),i((function(){var e;(null===(e=U.items)||void 0===e?void 0:e.data)&&J(U.items.data?U.items.data:[])}),[U]),n.createElement(w,{sx:t([],e(Array.isArray(B)?B:[B]),!1)},n.createElement(_,{container:!0,spacing:2},n.createElement(_,{item:!0,xs:12},n.createElement(D,{spacing:2},n.createElement(D,{direction:"row",spacing:2,justifyContent:"space-between"},n.createElement(D,{spacing:2},n.createElement(x,{variant:"h3",component:"h1"},"Management Inbound Purchase Order"),n.createElement(x,{variant:"body1"},"Manage arrival, registration and recieval of purchase order")),n.createElement(p,{content:"",related:[{id:U.id,__type:"api::logistics.ipo"}],revalidateCallback:P})),n.createElement(I,null))),n.createElement(_,{item:!0,xs:6},n.createElement(D,{spacing:1},n.createElement(x,{variant:"h5"},"Details"),n.createElement(D,{direction:"row",spacing:2},n.createElement(x,{variant:"body1",width:"250px"},"Purchase Order Number"),n.createElement(x,{variant:"body2"},U.ipo_number)),n.createElement(D,{direction:"row",spacing:2},n.createElement(x,{variant:"body1",width:"250px"},"Custom reference"),n.createElement(x,{variant:"body2"},U.custom_reference)),n.createElement(D,{direction:"row",spacing:2},n.createElement(x,{variant:"body1",width:"250px"},"Order Date"),n.createElement(x,{variant:"body2"},U.order_date)),n.createElement(D,{direction:"row",spacing:2},n.createElement(x,{variant:"body1",width:"250px"},"Supplier"),n.createElement(x,{variant:"body2"},null===(h=null===(g=U.vendor_profile)||void 0===g?void 0:g.business_credentials)||void 0===h?void 0:h.company_name)),n.createElement(D,{direction:"row",spacing:2},n.createElement(x,{variant:"body1",width:"250px"},"Order Status"),n.createElement(x,{variant:"body2",width:"250px"},U.status)),("placed"===U.status||"released_on_stock"===U.status)&&"enduser"===R&&n.createElement(n.Fragment,null,n.createElement(C,{variant:"contained",color:"primary",onClick:function(){return K(!0)}},"Confirm order"),n.createElement(E,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"),n.createElement(N,{open:Q,handleClose:function(){return K(!1)},orderID:U.id,currentStatus:U.status,revalidateCallback:P})))),n.createElement(_,{item:!0,xs:12},n.createElement(D,{spacing:2},n.createElement(x,{variant:"h5"},"Documents"),n.createElement(k,{sx:{p:2}},n.createElement(D,{spacing:1},"enduser"===R&&n.createElement(n.Fragment,null,U.order_confirmation?n.createElement(n.Fragment,null,n.createElement(x,{variant:"h6"},"Order Confirmation"),n.createElement(x,null,null===(b=U.order_confirmation)||void 0===b?void 0:b.name),n.createElement(C,{variant:"contained",onClick:function(){c("api/ipos/".concat(U.id),"order_confirmation")}},"Download")):n.createElement(n.Fragment,null,n.createElement(x,{variant:"h5"},"Order Confirmation"),n.createElement(x,{variant:"body1"},"Here you can upload the the order confirmation for this order"),n.createElement(x,{variant:"body1"},"FileUpload"),n.createElement(I,null),n.createElement(m,{reference:"api::logistics.ipo",refID:U.id,field:"order_confirmation",multiple:!1,accept:"text/*,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",path:"api/ipos",componentName:"order_confirmation",componentReference:"common.base64-encoded-media",revalidateCallback:P}))),U.delivery_note?n.createElement(n.Fragment,null,n.createElement(x,{variant:"h6"},"Delivery Note"),n.createElement(x,null,null===(j=U.delivery_note)||void 0===j?void 0:j.name),n.createElement(C,{variant:"contained",onClick:function(){c("api/ipos/".concat(U.id),"delivery_note")}},"Download")):n.createElement(n.Fragment,null,n.createElement(x,{variant:"h5"},"Delivery Note"),n.createElement(x,{variant:"body1"},"Here you can upload the the delivery note for this order"),n.createElement(I,null),n.createElement(m,{reference:"api::logistics.ipo",refID:U.id,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:P})))))),(null===(S=null===(O=null==U?void 0:U.notes)||void 0===O?void 0:O.data)||void 0===S?void 0:S.length)>0&&n.createElement(_,{item:!0,xs:12},n.createElement(D,{spacing:2},n.createElement(x,{variant:"h5"},"Notes"),n.createElement(u,{notes:U.notes.data}),n.createElement(I,null))),n.createElement(_,{item:!0,xs:12},n.createElement(D,{spacing:1},n.createElement(x,{variant:"h5"},"Items"),n.createElement(D,{direction:"row",alignItems:"center",justifyContent:"flex-end",spacing:2,component:k,p:1},n.createElement(x,{variant:"body1"},"Show:"),["received","registered","released","reports"].map((function(r){return n.createElement(q,{key:r,control:n.createElement(A,{checked:W.includes(r),onChange:function(n){n.target.checked?X(t(t([],e(W),!1),[r],!1)):X(W.filter((function(e){return e!==r})))}}),label:r.charAt(0).toUpperCase()+r.slice(1)})}))),"placed"===U.status&&n.createElement(E,{severity:"warning"},"Before confirmation you cannot update the items"),n.createElement(I,null),n.createElement("form",{action:H},n.createElement("input",{name:"id",type:"hidden",value:U.id}),G&&G.map((function(e,t){var r,a;return n.createElement(k,{sx:{p:2,mb:2},key:t},"placed"===U.status?n.createElement(s,{item:e,index:t,image:null===(r=null==e?void 0:e.product)||void 0===r?void 0:r.image}):n.createElement(d,{item:e,index:t,handleUpdateQuantity:Y,handleAddReport:Z,image:null===(a=null==e?void 0:e.product)||void 0===a?void 0:a.image,handleRemoveReportAtIndex:$,revalidateCallback:P,showing:W}))})),n.createElement(k,{sx:{p:2}},n.createElement(D,{direction:"row",spacing:2,justifyContent:"end"},n.createElement(f,{text:"Update items",loadingText:"Loading..."}),n.createElement(v,{error:null==M?void 0:M.strapiErrors}),(null==M?void 0:M.message)&&n.createElement(E,{severity:"error"},null==M?void 0:M.message))),n.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map((function(e){var t,r;return{id:e.id,ordered_quantity:e.ordered_quantity,received_quantity:e.received_quantity,registered_quantity:e.registered_quantity,released_quantity:e.released_quantity,reports:(null===(r=null===(t=e.reports)||void 0===t?void 0:t.data)||void 0===r?void 0:r.map((function(e){return{id:"id"in e?e.id:void 0,quantity:e.quantity,content:e.content,type:e.type}})))||[]}}))}(G))}))))))}export{O as default};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import{__awaiter as r,__generator as t,__assign as s}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as e}from"../../../services/mutate-data.js";import{flattenAttributes as o}from"../../../../lib/utils.js";import{parseFormData as i}from"../../../../lib/parseFormData.js";function a(a,n){return r(this,void 0,void 0,(function(){var r,m,p,l;return t(this,(function(t){switch(t.label){case 0:return r=Object.fromEntries(n),m=i(n),[4,e("PUT","/api/opos/".concat(r.id),m)];case 1:return(p=t.sent())?p.error?[2,s(s({},a),{strapiErrors:p.error,message:"Failed to Update Opo."})]:(l=o(p),[2,s(s({},a),{message:"Opo Updated",data:l,strapiErrors:null})]):[2,s(s({},a),{strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{a as updateOpoAction};
7
+ import{__awaiter as r,__generator as t,__assign as s}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as e}from"../../../services/mutate-data.js";import{flattenAttributes as o}from"../../../../lib/utils.js";import{parseFormData as a}from"../../../../lib/parseFormData.js";function i(i,n){return r(this,void 0,void 0,(function(){var r,m,p,l;return t(this,(function(t){switch(t.label){case 0:return r=Object.fromEntries(n),m=a(n),console.log("parsedFormData",m),[4,e("PUT","/api/opos/".concat(r.id),m)];case 1:return(p=t.sent())?p.error?[2,s(s({},i),{strapiErrors:p.error,message:"Failed to Update Opo."})]:(l=o(p),[2,s(s({},i),{message:"Opo Updated",data:l,strapiErrors:null})]):[2,s(s({},i),{strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{i as updateOpoAction};