umwd-components 0.1.606 → 0.1.608
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/node_modules/base64-js/index.js +1 -1
- package/dist/node_modules/ieee754/index.js +1 -1
- package/dist/src/components/e-commerce/opo/TextualManageOpoForm.js +1 -1
- package/dist/src/components/e-commerce/opo/TextualOpoItemUpdater.js +1 -1
- package/dist/src/components/logistics/ipo/TextualIPOItemUpdater.js +1 -1
- package/dist/src/components/logistics/ipo/TextualManageIPOForm.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/components/logistics/ipo/TextualIPOItemUpdater.d.ts +1 -1
- package/dist/types/types/e-commerce/opo/types.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/e-commerce/opo/TextualManageOpoForm.tsx +88 -5
- package/src/components/e-commerce/opo/TextualOpoItemUpdater.tsx +4 -4
- package/src/components/logistics/ipo/TextualIPOItemUpdater.tsx +0 -3
- package/src/components/logistics/ipo/TextualManageIPOForm.tsx +7 -17
- package/src/types/e-commerce/opo/types.ts +1 -1
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
import{__exports as r}from"../../_virtual/
|
|
6
|
+
import{__exports as r}from"../../_virtual/index8.js";var t;function e(){if(t)return r;t=1,r.byteLength=function(r){var t=i(r),e=t[0],n=t[1];return 3*(e+n)/4-n},r.toByteArray=function(r){var t,e,a=i(r),u=a[0],h=a[1],c=new o(function(r,t,e){return 3*(t+e)/4-e}(0,u,h)),f=0,d=h>0?u-4:u;for(e=0;e<d;e+=4)t=n[r.charCodeAt(e)]<<18|n[r.charCodeAt(e+1)]<<12|n[r.charCodeAt(e+2)]<<6|n[r.charCodeAt(e+3)],c[f++]=t>>16&255,c[f++]=t>>8&255,c[f++]=255&t;2===h&&(t=n[r.charCodeAt(e)]<<2|n[r.charCodeAt(e+1)]>>4,c[f++]=255&t);1===h&&(t=n[r.charCodeAt(e)]<<10|n[r.charCodeAt(e+1)]<<4|n[r.charCodeAt(e+2)]>>2,c[f++]=t>>8&255,c[f++]=255&t);return c},r.fromByteArray=function(r){for(var t,n=r.length,o=n%3,a=[],u=16383,i=0,c=n-o;i<c;i+=u)a.push(h(r,i,i+u>c?c:i+u));1===o?(t=r[n-1],a.push(e[t>>2]+e[t<<4&63]+"==")):2===o&&(t=(r[n-2]<<8)+r[n-1],a.push(e[t>>10]+e[t>>4&63]+e[t<<2&63]+"="));return a.join("")};for(var e=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0;u<64;++u)e[u]=a[u],n[a.charCodeAt(u)]=u;function i(r){var t=r.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=r.indexOf("=");return-1===e&&(e=t),[e,e===t?0:4-e%4]}function h(r,t,n){for(var o,a,u=[],i=t;i<n;i+=3)o=(r[i]<<16&16711680)+(r[i+1]<<8&65280)+(255&r[i+2]),u.push(e[(a=o)>>18&63]+e[a>>12&63]+e[a>>6&63]+e[63&a]);return u.join("")}return n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63,r}export{e as __require};
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
import{__exports as a}from"../../_virtual/
|
|
6
|
+
import{__exports as a}from"../../_virtual/index7.js";
|
|
7
7
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */var t;function o(){return t||(t=1,a.read=function(a,t,o,r,h){var M,e,i=8*h-r-1,p=(1<<i)-1,f=p>>1,n=-7,w=o?h-1:0,s=o?-1:1,u=a[t+w];for(w+=s,M=u&(1<<-n)-1,u>>=-n,n+=i;n>0;M=256*M+a[t+w],w+=s,n-=8);for(e=M&(1<<-n)-1,M>>=-n,n+=r;n>0;e=256*e+a[t+w],w+=s,n-=8);if(0===M)M=1-f;else{if(M===p)return e?NaN:1/0*(u?-1:1);e+=Math.pow(2,r),M-=f}return(u?-1:1)*e*Math.pow(2,M-r)},a.write=function(a,t,o,r,h,M){var e,i,p,f=8*M-h-1,n=(1<<f)-1,w=n>>1,s=23===h?Math.pow(2,-24)-Math.pow(2,-77):0,u=r?0:M-1,N=r?1:-1,_=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(i=isNaN(t)?1:0,e=n):(e=Math.floor(Math.log(t)/Math.LN2),t*(p=Math.pow(2,-e))<1&&(e--,p*=2),(t+=e+w>=1?s/p:s*Math.pow(2,1-w))*p>=2&&(e++,p/=2),e+w>=n?(i=0,e=n):e+w>=1?(i=(t*p-1)*Math.pow(2,h),e+=w):(i=t*Math.pow(2,w-1)*Math.pow(2,h),e=0));h>=8;a[o+u]=255&i,u+=N,i/=256,h-=8);for(e=e<<h|i,f+=h;f>0;a[o+u]=255&e,u+=N,e/=256,f-=8);a[o+u-N]|=128*_}),a}export{o as __require};
|
|
@@ -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
|
|
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 u}from"../../StrapiErrors.js";import{SubmitButton as p}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 w from"@mui/material/Stack";import _ 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(w,{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]),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(w,{spacing:2},n.createElement(w,{direction:"row",spacing:2,justifyContent:"space-between"},n.createElement(w,{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(_,null))),n.createElement(x,{item:!0,xs:6},n.createElement(w,{spacing:1},n.createElement(h,{variant:"h5"},"Details"),n.createElement(w,{direction:"row",spacing:2},n.createElement(h,{variant:"body1",width:"250px"},"Purchase Order Number"),n.createElement(h,{variant:"body2"},T.opo_number)),n.createElement(w,{direction:"row",spacing:2},n.createElement(h,{variant:"body1",width:"250px"},"Custom reference"),n.createElement(h,{variant:"body2"},T.customer_inhouse_reference)),n.createElement(w,{direction:"row",spacing:2},n.createElement(h,{variant:"body1",width:"250px"},"Order Date"),n.createElement(h,{variant:"body2"},T.order_date)),n.createElement(w,{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(w,{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(w,{spacing:2},n.createElement(h,{variant:"h5"},"Documents"),n.createElement(D,{variant:"outlined"},n.createElement(j,null,n.createElement(w,{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(w,{spacing:2},n.createElement(h,{variant:"h5"},"Notes"),n.createElement(d,{notes:T.notes.data}),n.createElement(_,null))),n.createElement(x,{item:!0,xs:12},n.createElement(w,{spacing:1},n.createElement(h,{variant:"h5"},"Items"),n.createElement(w,{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(_,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(w,{direction:"row",spacing:2,justifyContent:"end"},n.createElement(p,{text:"Update items",loadingText:"Loading..."}),n.createElement(u,{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};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as n,useMemo as r}from"react";import a from"@mui/material/Stack";import i from"@mui/material/Typography";import o from"@mui/material/IconButton";import l from"@mui/material/Divider";import m from"@mui/material/Collapse";import{TextualAmountUpdater as c}from"../../common/TextualAmountUpdater.js";import u from"@mui/icons-material/ArrowDropDown";import d from"../../common/ImagePreviewTooltip.js";import p from"../../logistics/report/ReportsDisplay.js";import s from"../../logistics/report/PreReportsDisplay.js";import f from"../../logistics/report/SimpleReportFields.js";import E from"@mui/material/Box";function y(y){var g,v,b,h,w=y.item,k=y.index,x=y.handleAddReport,I=y.handleUpdateQuantity,V=y.image,_=y.handleRemoveReportAtIndex,j=y.showing,q=w.line_item_number,C=w.product,R=w.ordered_quantity,D=w.picked_quantity,N=w.packed_quantity,P=w.shipped_quantity,A=w.reports,F=e(n(!1),2),S=F[0],B=F[1];r((function(){return void 0!==(null==A?void 0:A.data)&&A.data.length>0?A.data.filter((function(e){return"picked"===e.type})).reduce((function(e,t){return e+t.quantity}),0):0}),[A]);var T=r((function(){return void 0!==(null==A?void 0:A.data)&&A.data.length>0?A.data.filter((function(e){return"packed"===e.type})).reduce((function(e,t){return e+t.quantity}),0):0}),[A]);r((function(){return void 0!==(null==A?void 0:A.data)&&A.data.length>0?A.data.filter((function(e){return"shipped"===e.type})).reduce((function(e,t){return e+t.quantity}),0):0}),[A]);var U=(null===(v=null===(g=w.reports)||void 0===g?void 0:g.data)||void 0===v?void 0:v.filter((function(e){return"id"in e})))||[],H=(null===(h=null===(b=w.reports)||void 0===b?void 0:b.data)||void 0===h?void 0:h.filter((function(e){return!1===Boolean("id"in e)})))||[];return t.createElement(a,{spacing:1,key:k},w&&t.createElement(t.Fragment,null,t.createElement(a,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1}},t.createElement(i,{variant:"body1"},"Line Item Number: ",q),t.createElement(i,{variant:"body1"},"Part Number: ",null==C?void 0:C.product_number),V&&t.createElement(t.Fragment,null,t.createElement(d,{image:V,label:null==C?void 0:C.title}))),t.createElement(l,{sx:{mb:1}}),j&&j.includes("picked")&&t.createElement(t.Fragment,null,t.createElement(a,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1}},t.createElement(i,{variant:"body2"},"Picked"),t.createElement(c,{label:"Picked",currentValue:D,totalValue:R
|
|
6
|
+
import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as n,useMemo as r}from"react";import a from"@mui/material/Stack";import i from"@mui/material/Typography";import o from"@mui/material/IconButton";import l from"@mui/material/Divider";import m from"@mui/material/Collapse";import{TextualAmountUpdater as c}from"../../common/TextualAmountUpdater.js";import u from"@mui/icons-material/ArrowDropDown";import d from"../../common/ImagePreviewTooltip.js";import p from"../../logistics/report/ReportsDisplay.js";import s from"../../logistics/report/PreReportsDisplay.js";import f from"../../logistics/report/SimpleReportFields.js";import E from"@mui/material/Box";function y(y){var g,v,b,h,w=y.item,k=y.index,x=y.handleAddReport,I=y.handleUpdateQuantity,V=y.image,_=y.handleRemoveReportAtIndex,j=y.showing,q=w.line_item_number,C=w.product,R=w.ordered_quantity,D=w.picked_quantity,N=w.packed_quantity,P=w.shipped_quantity,A=w.reports,F=e(n(!1),2),S=F[0],B=F[1];r((function(){return void 0!==(null==A?void 0:A.data)&&A.data.length>0?A.data.filter((function(e){return"picked"===e.type})).reduce((function(e,t){return e+t.quantity}),0):0}),[A]);var T=r((function(){return void 0!==(null==A?void 0:A.data)&&A.data.length>0?A.data.filter((function(e){return"packed"===e.type})).reduce((function(e,t){return e+t.quantity}),0):0}),[A]);r((function(){return void 0!==(null==A?void 0:A.data)&&A.data.length>0?A.data.filter((function(e){return"shipped"===e.type})).reduce((function(e,t){return e+t.quantity}),0):0}),[A]);var U=(null===(v=null===(g=w.reports)||void 0===g?void 0:g.data)||void 0===v?void 0:v.filter((function(e){return"id"in e})))||[],H=(null===(h=null===(b=w.reports)||void 0===b?void 0:b.data)||void 0===h?void 0:h.filter((function(e){return!1===Boolean("id"in e)})))||[];return t.createElement(a,{spacing:1,key:k},w&&t.createElement(t.Fragment,null,t.createElement(a,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1}},t.createElement(i,{variant:"body1"},"Line Item Number: ",q),t.createElement(i,{variant:"body1"},"Part Number: ",null==C?void 0:C.product_number),V&&t.createElement(t.Fragment,null,t.createElement(d,{image:V,label:null==C?void 0:C.title}))),t.createElement(l,{sx:{mb:1}}),j&&j.includes("picked")&&t.createElement(t.Fragment,null,t.createElement(a,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1}},t.createElement(i,{variant:"body2"},"Picked"),t.createElement(c,{label:"Picked",currentValue:D,totalValue:R,minNewValue:0+N,maxNewValue:R,color:"info",handleChange:function(e){I(e,w.id,"picked_quantity")}})),t.createElement(l,{sx:{mb:2}})),j&&j.includes("packed")&&t.createElement(t.Fragment,null,t.createElement(a,{direction:"row",justifyContent:"space-between",alignItems:"center"},t.createElement(i,{variant:"body2"},"Packed"),t.createElement(c,{label:"Packed",currentValue:N,totalValue:R+T,minNewValue:0+P,maxNewValue:D+T,color:"info",handleChange:function(e){I(e,w.id,"packed_quantity")}})),t.createElement(l,{sx:{mb:2}})),j&&j.includes("reports")&&t.createElement(E,{sx:{mb:2}},t.createElement(l,{sx:{p:0}},t.createElement(a,{direction:"row",spacing:1,alignItems:"center"},t.createElement(i,{variant:"body2"},"Irregularities / Corrections"),t.createElement(o,{onClick:function(){return B(!S)}},t.createElement(u,null)))),t.createElement(m,{in:S},t.createElement(a,{spacing:2},t.createElement(i,{variant:"body2"},"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"),t.createElement(p,{reports:U}),t.createElement(s,{itemID:w.id,reports:H,handleRemoveReportAtIndex:_}),t.createElement(f,{itemID:w.id,content:"",type:"packed",minValue:-(D-N+T),handleAddReport:x})))),j&&j.includes("shipped")&&t.createElement(a,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1}},t.createElement(i,{variant:"body2"},"Shipped"),t.createElement(c,{label:"Shipped",currentValue:P,totalValue:R+T,minNewValue:0,maxNewValue:N,color:"info",handleChange:function(e){I(e,w.id,"shipped_quantity")}}))))}export{y as default};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as r}from"react";import n from"@mui/material/Stack";import a from"@mui/material/Typography";import i from"@mui/material/IconButton";import o from"@mui/material/Divider";import l from"@mui/material/Collapse";import{TextualAmountUpdater as m}from"../../common/TextualAmountUpdater.js";import
|
|
6
|
+
import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as r}from"react";import n from"@mui/material/Stack";import a from"@mui/material/Typography";import i from"@mui/material/IconButton";import o from"@mui/material/Divider";import l from"@mui/material/Collapse";import{TextualAmountUpdater as m}from"../../common/TextualAmountUpdater.js";import u from"@mui/icons-material/ArrowDropDown";import c from"../../common/ImagePreviewTooltip.js";import d from"../report/ReportsDisplay.js";import s from"../report/PreReportsDisplay.js";import p from"../report/SimpleReportFields.js";import f from"@mui/material/Box";function g(g){var v,E,y,b,w=g.item,h=g.index,x=g.handleAddReport,R=g.handleUpdateQuantity,I=g.image,V=g.handleRemoveReportAtIndex,_=g.showing,j=w.line_item_number,q=w.product,C=w.ordered_quantity,D=w.received_quantity,N=w.registered_quantity,A=w.released_quantity,F=w.reports,k=e(r(!1),2),B=k[0],M=k[1];t.useMemo((function(){return void 0!==(null==F?void 0:F.data)&&F.data.length>0?F.data.filter((function(e){return"received"===e.type})).reduce((function(e,t){return e+t.quantity}),0):0}),[F]);var P=t.useMemo((function(){return void 0!==(null==F?void 0:F.data)&&F.data.length>0?F.data.filter((function(e){return"registered"===e.type})).reduce((function(e,t){return e+t.quantity}),0):0}),[F]);t.useMemo((function(){return void 0!==(null==F?void 0:F.data)&&F.data.length>0?F.data.filter((function(e){return"released"===e.type})).reduce((function(e,t){return e+t.quantity}),0):0}),[F]);var T=(null===(E=null===(v=w.reports)||void 0===v?void 0:v.data)||void 0===E?void 0:E.filter((function(e){return"id"in e})))||[],S=(null===(b=null===(y=w.reports)||void 0===y?void 0:y.data)||void 0===b?void 0:b.filter((function(e){return!1===Boolean("id"in e)})))||[];return t.createElement(n,{spacing:1,key:h},w&&t.createElement(t.Fragment,null,t.createElement(n,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1}},t.createElement(a,{variant:"body1"},"Line Item Number: ",j),t.createElement(a,{variant:"body1"},"Part Number: ",q.product_number),I&&t.createElement(t.Fragment,null,t.createElement(c,{image:I,label:w.product.title}))),t.createElement(o,{sx:{mb:1}}),_&&_.includes("received")&&t.createElement(t.Fragment,null,t.createElement(n,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1}},t.createElement(a,{variant:"body2"},"Received"),t.createElement(m,{label:"Received",currentValue:D,totalValue:C,minNewValue:0+N,maxNewValue:C,color:"info",handleChange:function(e){R(e,w.id,"received_quantity")}})),t.createElement(o,{sx:{mb:2}})),_&&_.includes("registered")&&t.createElement(t.Fragment,null,t.createElement(n,{direction:"row",justifyContent:"space-between",alignItems:"center"},t.createElement(a,{variant:"body2"},"Registered"),t.createElement(m,{label:"Registered",currentValue:N,totalValue:C+P,minNewValue:0+A,maxNewValue:D+P,color:"info",handleChange:function(e){R(e,w.id,"registered_quantity")}})),t.createElement(o,{sx:{mb:2}})),_&&_.includes("reports")&&t.createElement(f,{sx:{mb:2}},t.createElement(o,{sx:{p:0}},t.createElement(n,{direction:"row",spacing:1,alignItems:"center"},t.createElement(a,{variant:"body2"},"Irregularities / Corrections"),t.createElement(i,{onClick:function(){return M(!B)}},t.createElement(u,null)))),t.createElement(l,{in:B},t.createElement(n,{spacing:2},t.createElement(a,{variant:"body2"},"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"),t.createElement(d,{reports:T}),t.createElement(s,{itemID:w.id,reports:S,handleRemoveReportAtIndex:V}),t.createElement(p,{itemID:w.id,content:"",type:"registered",minValue:-(D-N+P),handleAddReport:x})))),_&&_.includes("released")&&t.createElement(n,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1}},t.createElement(a,{variant:"body2"},"Released"),t.createElement(m,{label:"Released",currentValue:A,totalValue:C+P,minNewValue:0,maxNewValue:N,color:"info",handleChange:function(e){R(e,w.id,"released_quantity")}}))))}export{g 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
|
|
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 g from"@mui/material/Dialog";import y 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 w from"@mui/material/Grid";import _ 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 A from"@mui/material/CardContent";import{confirmationService as F}from"../../../data/services/logistics/ipo/confirmation-service.js";import{FormControlLabel as N,Checkbox as O}from"@mui/material";var S={zodErrors:null,strapiErrors:null,data:null,message:null};function q(e){var t=e.open,r=e.handleClose,a=e.orderID,i=e.currentStatus,o=e.revalidateCallback;return n.createElement(g,{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(y,null,n.createElement(x,{variant:"contained",onClick:function(e){F("ipos",[a]),o&&o()}},"Confirm"),n.createElement(x,{variant:"contained",onClick:r},"Cancel")))}function U(g){var y,h,b,F,U,B,P=g.data,R=g.sx,T=g.revalidateCallback;g.handleClose;var M=g.role,H=e(o(l,S),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(_,{sx:t([],e(Array.isArray(R)?R:[R]),!1)},n.createElement(w,{container:!0,spacing:2},n.createElement(w,{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(w,{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===(y=P.vendor_profile)||void 0===y?void 0:y.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(q,{open:V,handleClose:function(){return W(!1)},orderID:P.id,currentStatus:P.status,revalidateCallback:T})))),n.createElement(w,{item:!0,xs:12},n.createElement(D,{spacing:2},n.createElement(C,{variant:"h5"},"Documents"),n.createElement(j,{variant:"outlined"},n.createElement(A,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===(F=P.delivery_note)||void 0===F?void 0:F.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(w,{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(w,{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(N,{key:r,control:n.createElement(O,{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,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};
|