umwd-components 0.1.350 → 0.1.351

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.
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as n,useEffect as a}from"react";import i from"@mui/material/TextField";import r from"@mui/icons-material/Euro";import o from"@mui/material/InputAdornment";import l from"@mui/material/Stack";function c(c){var m=c.data,d=c.componentName,p=c.componentReference,u=m||{},v=u.id,s=u.vat_rate,E=u.vat,f=u.price_incl_vat,_=u.price,b=e(n((null==_?void 0:_.toString())||""),2),g=b[0],F=b[1],h=e(n((function(){return(null==s?void 0:s.toString())||""})),2),x=h[0],A=h[1],I=e(n(E),2),P=I[0],y=I[1],S=e(n(f),2),V=S[0],C=S[1];return a((function(){if(g&&x){var e=parseFloat(g),t=e*(parseFloat(x)/100),n=e+t;y(t),C(n)}}),[g,x]),t.createElement(l,{spacing:2,direction:"row"},t.createElement("input",{id:"",type:"hidden",name:"".concat(d,".__component"),value:p}),v&&t.createElement("input",{id:"",type:"hidden",name:"".concat(d,".id"),value:v}),t.createElement(i,{id:"price",InputProps:{startAdornment:t.createElement(o,{position:"start"},t.createElement(r,null))},name:"".concat(d,".price"),label:"price",type:"float",value:g,onChange:function(e){F(e.target.value)}}),t.createElement(i,{id:"vat_rate",name:"".concat(d,".vat_rate"),type:"number",InputProps:{endAdornment:t.createElement(o,{position:"end"},"%")},label:"Vat Rate",value:x,onChange:function(e){A(e.target.value)}}),t.createElement(i,{id:"vat",InputProps:{startAdornment:t.createElement(o,{position:"start"},t.createElement(r,null))},name:"".concat(d,".vat"),label:"Vat",value:null==P?void 0:P.toFixed(2),disabled:!0}),t.createElement("input",{hidden:!0,name:"".concat(d,".vat"),value:null==P?void 0:P.toFixed(2)}),t.createElement(i,{id:"price_incl_vat",InputProps:{startAdornment:t.createElement(o,{position:"start"},t.createElement(r,null))},name:"".concat(d,".price_incl_vat"),label:"Price Incl VAT",value:null==V?void 0:V.toFixed(2),disabled:!0}),t.createElement("input",{hidden:!0,name:"".concat(d,".price_incl_vat"),value:null==V?void 0:V.toFixed(2)}))}export{c as PriceFields};
7
+ import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as n,useEffect as a}from"react";import r from"@mui/material/TextField";import i from"@mui/icons-material/Euro";import l from"@mui/material/InputAdornment";import o from"@mui/material/Stack";function c(c){var m=c.data,d=c.componentName,u=c.componentReference,p=m||{},v=p.id,s=p.vat_rate,E=p.vat,f=p.price_incl_vat,_=p.price,b=e(n((null==_?void 0:_.toString())||""),2),g=b[0],F=b[1],h=e(n((function(){return(null==s?void 0:s.toString())||""})),2),x=h[0],y=h[1],A=e(n(E),2),I=A[0],P=A[1],V=e(n(f),2),S=V[0],C=V[1];return a((function(){if(g&&x){var e=parseFloat(g),t=e*(parseFloat(x)/100),n=e+t;P(t),C(n)}}),[g,x]),t.createElement(o,{spacing:2,direction:"row"},t.createElement("input",{id:"",type:"hidden",name:"".concat(d,".__component"),value:u}),v&&t.createElement("input",{id:"",type:"hidden",name:"".concat(d,".id"),value:v}),t.createElement(r,{id:"price",InputProps:{startAdornment:t.createElement(l,{position:"start"},t.createElement(i,null))},name:"".concat(d,".price"),label:"price",type:"float",value:g,onChange:function(e){F(e.target.value)}}),t.createElement(r,{id:"vat_rate",name:"".concat(d,".vat_rate"),type:"number",InputProps:{endAdornment:t.createElement(l,{position:"end"},"%")},label:"Vat Rate",value:x,onChange:function(e){y(e.target.value)}}),t.createElement(r,{id:"vat",InputProps:{startAdornment:t.createElement(l,{position:"start"},t.createElement(i,null))},name:"".concat(d,".vat"),label:"Vat",defaultValue:null==I?void 0:I.toFixed(2),disabled:!0}),t.createElement("input",{hidden:!0,name:"".concat(d,".vat"),value:null==I?void 0:I.toFixed(2),readOnly:!0}),t.createElement(r,{id:"price_incl_vat",InputProps:{startAdornment:t.createElement(l,{position:"start"},t.createElement(i,null))},name:"".concat(d,".price_incl_vat"),label:"Price Incl VAT",defaultValue:null==S?void 0:S.toFixed(2),disabled:!0}),t.createElement("input",{hidden:!0,name:"".concat(d,".price_incl_vat"),value:null==S?void 0:S.toFixed(2),readOnly:!0}))}export{c as PriceFields};
@@ -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 n}from"react";import a from"@mui/material/Paper";import o from"@mui/material/Stack";import i from"@mui/material/Typography";import l from"@mui/material/Button";import m from"@mui/material/Divider";import c from"@mui/material/Grid";import d from"@mui/material/Card";import s from"@mui/material/CardContent";import p from"@mui/material/Box";import{useFormState as u}from"react-dom";import{updateIpoAction as v}from"../../../data/actions/logistics/ipo/updateIpoAction.js";import{UploadBase64MediaForm as E}from"../../common/media/UploadBase64MediaForm.js";import f from"../../../data/loaders/common/media/downloadBase64File.js";import g from"./ItemUpdater.js";import y from"../note/NotesDisplay.js";import h from"../note/NoteTakingComponent.js";import{SubmitButton as _}from"../../SubmitButton.js";import{StrapiErrors as b}from"../../StrapiErrors.js";import x from"@mui/material/Alert";var w={zodErrors:null,strapiErrors:null,data:null,message:null};function C(C){var j,D,I,N,k,A,R,F=C.data,O=C.sx,q=C.revalidateCallback,S=e(u(v,w),2),U=S[0],B=S[1];console.log("data",F);var M=e(n(F.items.data),2),P=M[0],T=M[1],H=function(r,n,a){void 0===a&&(a="registered_bad_reports"),console.log(P),console.log(r,n,a),console.log("handleAddReport");var o=t([],e(P),!1),i=o.findIndex((function(e){return e.id===r}));console.log(o[i]),o[i][a]?o[i][a].push(n):o[i][a]=[n]},Q=function(r,n,a){console.log(P),console.log(r,n,a),console.log("handleUpdateQuantity");var o=t([],e(P),!1),i=o.findIndex((function(e){return e.id===n}));o[i][a]=r,T(o)},z=function(e,t){console.log(P),console.log(e,t),console.log("handleRemoveReportAtIndex")};return r.createElement(p,{sx:t([],e(Array.isArray(O)?O:[O]),!1)},r.createElement(c,{container:!0,spacing:2},r.createElement(c,{item:!0,xs:12},r.createElement(o,{spacing:2},r.createElement(o,{direction:"row",spacing:2,justifyContent:"space-between"},r.createElement(o,{spacing:2},r.createElement(i,{variant:"h3",component:"h1"},"Inbound Management Purchase Order"),r.createElement(i,{variant:"body1"},"Manage arrival, registration and recieval of purchase order")),r.createElement(h,{content:"",related:[{id:F.id,__type:"api::logistics.ipo"}]})),r.createElement(m,null))),r.createElement(c,{item:!0,xs:12},r.createElement(i,{variant:"h4"},"Purchase Order Number ",F.ipo_number)),r.createElement(c,{item:!0,xs:6},r.createElement(o,{spacing:1},r.createElement(i,{variant:"h5"},"Details"),r.createElement(o,{direction:"row",spacing:2},r.createElement(i,{variant:"body1",width:"150px"},"Custom reference"),r.createElement(i,{variant:"body2"},F.custom_reference)),r.createElement(o,{direction:"row",spacing:2},r.createElement(i,{variant:"body1",width:"150px"},"Order Date"),r.createElement(i,{variant:"body2"},F.order_date)),r.createElement(o,{direction:"row",spacing:2},r.createElement(i,{variant:"body1",width:"150px"},"Supplier"),r.createElement(i,{variant:"body2"},null===(D=null===(j=F.vendor_profile)||void 0===j?void 0:j.business_credentials)||void 0===D?void 0:D.company_name)),r.createElement(o,{direction:"row",spacing:2},r.createElement(i,{variant:"body1",width:"150px"},"Order Status"),r.createElement(i,{variant:"body2"},F.status)))),r.createElement(c,{item:!0,xs:12},r.createElement(o,{spacing:2},r.createElement(i,{variant:"h5"},"Documents"),r.createElement(d,{variant:"outlined"},r.createElement(s,null,r.createElement(o,{spacing:1},F.order_confirmation?r.createElement(r.Fragment,null,r.createElement(i,{variant:"h6"},"Order Confirmation"),r.createElement(i,null,null===(I=F.order_confirmation)||void 0===I?void 0:I.name),r.createElement(l,{variant:"contained",onClick:function(){f("api/ipos/".concat(F.id),"order_confirmation")}},"Download")):r.createElement(r.Fragment,null,r.createElement(i,{variant:"h5"},"Order Confirmation"),r.createElement(i,{variant:"body1"},"Here you can upload the the order confirmation for this order"),r.createElement(i,{variant:"body1"},"FileUpload"),r.createElement(m,null),r.createElement(E,{reference:"api::logistics.ipo",refID:F.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:q})),F.delivery_note?r.createElement(r.Fragment,null,r.createElement(i,{variant:"h6"},"Delivery Note"),r.createElement(i,null,null===(N=F.delivery_note)||void 0===N?void 0:N.name),r.createElement(l,{variant:"contained",onClick:function(){f("api/ipos/".concat(F.id),"delivery_note")}},"Download")):r.createElement(r.Fragment,null,r.createElement(i,{variant:"h5"},"Delivery Note"),r.createElement(i,{variant:"body1"},"Here you can upload the the delivery note for this order"),r.createElement(m,null),r.createElement(E,{reference:"api::logistics.ipo",refID:F.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:q}))))))),(null===(A=null===(k=null==F?void 0:F.notes)||void 0===k?void 0:k.data)||void 0===A?void 0:A.length)>0&&r.createElement(c,{item:!0,xs:12},r.createElement(o,{spacing:2},r.createElement(i,{variant:"h5"},"Notes"),r.createElement(y,{notes:F.notes.data}),r.createElement(m,null))),r.createElement(c,{item:!0,xs:12},r.createElement("form",{action:B},r.createElement("input",{name:"id",type:"hidden",value:F.id}),(null===(R=null==F?void 0:F.items)||void 0===R?void 0:R.data)&&F.items.data.map((function(e,t){var n;return console.log("item",e),r.createElement(a,{sx:{p:2,mb:2},key:t},r.createElement(g,{item:e,index:t,handleAddReport:H,handleUpdateQuantity:Q,image:null===(n=null==e?void 0:e.product)||void 0===n?void 0:n.image,handleRemoveReportAtIndex:z}))})),r.createElement(a,{sx:{p:2}},r.createElement(o,{direction:"row",spacing:2,justifyContent:"end"},r.createElement(_,{text:"Update items",loadingText:"Loading..."}),r.createElement(b,{error:null==U?void 0:U.strapiErrors}),(null==U?void 0:U.message)&&r.createElement(x,{severity:"error"},null==U?void 0:U.message))),r.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map((function(e){return{id:e.id,arrived_quantity:e.arrived_quantity,registered_quantity:e.registered_quantity,recieved_quantity:e.recieved_quantity,registered_bad_reports:e.registered_bad_reports}}))}(P))})))))}export{C as default};
6
+ import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as a}from"react";import n from"@mui/material/Paper";import o from"@mui/material/Stack";import i from"@mui/material/Typography";import l from"@mui/material/Button";import m from"@mui/material/Divider";import c from"@mui/material/Grid";import d from"@mui/material/Card";import s from"@mui/material/CardContent";import p from"@mui/material/Box";import{useFormState as u}from"react-dom";import{updateIpoAction as v}from"../../../data/actions/logistics/ipo/updateIpoAction.js";import{UploadBase64MediaForm as E}from"../../common/media/UploadBase64MediaForm.js";import f from"../../../data/loaders/common/media/downloadBase64File.js";import g from"./ItemUpdater.js";import y from"../note/NotesDisplay.js";import h from"../note/NoteTakingComponent.js";import{SubmitButton as b}from"../../SubmitButton.js";import{StrapiErrors as _}from"../../StrapiErrors.js";import x from"@mui/material/Alert";var w={zodErrors:null,strapiErrors:null,data:null,message:null};function C(C){var j,D,I,N,k,A,F,R=C.data,O=C.sx,q=C.revalidateCallback,S=e(u(v,w),2),U=S[0],B=S[1];console.log("data",R);var P=e(a(R.items.data),2),M=P[0],T=P[1],H=function(r,a,n){void 0===n&&(n="registered_bad_reports"),console.log(M),console.log(r,a,n),console.log("handleAddReport");var o=t([],e(M),!1),i=o.findIndex((function(e){return e.id===r}));console.log(o[i]),o[i][n]?o[i][n].push(a):o[i][n]=[a]},Q=function(r,a,n){console.log(M),console.log(r,a,n),console.log("handleUpdateQuantity");var o=t([],e(M),!1),i=o.findIndex((function(e){return e.id===a}));o[i][n]=r,T(o)},z=function(e,t){console.log(M),console.log(e,t),console.log("handleRemoveReportAtIndex")};return r.createElement(p,{sx:t([],e(Array.isArray(O)?O:[O]),!1)},r.createElement(c,{container:!0,spacing:2},r.createElement(c,{item:!0,xs:12},r.createElement(o,{spacing:2},r.createElement(o,{direction:"row",spacing:2,justifyContent:"space-between"},r.createElement(o,{spacing:2},r.createElement(i,{variant:"h3",component:"h1"},"Inbound Management Purchase Order"),r.createElement(i,{variant:"body1"},"Manage arrival, registration and recieval of purchase order")),r.createElement(h,{content:"",related:[{id:R.id,__type:"api::logistics.ipo"}]})),r.createElement(m,null))),r.createElement(c,{item:!0,xs:12},r.createElement(i,{variant:"h4"},"Purchase Order Number ",R.ipo_number)),r.createElement(c,{item:!0,xs:6},r.createElement(o,{spacing:1},r.createElement(i,{variant:"h5"},"Details"),r.createElement(o,{direction:"row",spacing:2},r.createElement(i,{variant:"body1",width:"150px"},"Custom reference"),r.createElement(i,{variant:"body2"},R.custom_reference)),r.createElement(o,{direction:"row",spacing:2},r.createElement(i,{variant:"body1",width:"150px"},"Order Date"),r.createElement(i,{variant:"body2"},R.order_date)),r.createElement(o,{direction:"row",spacing:2},r.createElement(i,{variant:"body1",width:"150px"},"Supplier"),r.createElement(i,{variant:"body2"},null===(D=null===(j=R.vendor_profile)||void 0===j?void 0:j.business_credentials)||void 0===D?void 0:D.company_name)),r.createElement(o,{direction:"row",spacing:2},r.createElement(i,{variant:"body1",width:"150px"},"Order Status"),r.createElement(i,{variant:"body2",width:"150px"},R.status)),"placed"===R.status&&r.createElement(r.Fragment,null,r.createElement(l,{variant:"contained",color:"primary"},"Confirm order"),r.createElement(x,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher")))),r.createElement(c,{item:!0,xs:12},r.createElement(o,{spacing:2},r.createElement(i,{variant:"h5"},"Documents"),r.createElement(d,{variant:"outlined"},r.createElement(s,null,r.createElement(o,{spacing:1},R.order_confirmation?r.createElement(r.Fragment,null,r.createElement(i,{variant:"h6"},"Order Confirmation"),r.createElement(i,null,null===(I=R.order_confirmation)||void 0===I?void 0:I.name),r.createElement(l,{variant:"contained",onClick:function(){f("api/ipos/".concat(R.id),"order_confirmation")}},"Download")):r.createElement(r.Fragment,null,r.createElement(i,{variant:"h5"},"Order Confirmation"),r.createElement(i,{variant:"body1"},"Here you can upload the the order confirmation for this order"),r.createElement(i,{variant:"body1"},"FileUpload"),r.createElement(m,null),r.createElement(E,{reference:"api::logistics.ipo",refID:R.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:q})),R.delivery_note?r.createElement(r.Fragment,null,r.createElement(i,{variant:"h6"},"Delivery Note"),r.createElement(i,null,null===(N=R.delivery_note)||void 0===N?void 0:N.name),r.createElement(l,{variant:"contained",onClick:function(){f("api/ipos/".concat(R.id),"delivery_note")}},"Download")):r.createElement(r.Fragment,null,r.createElement(i,{variant:"h5"},"Delivery Note"),r.createElement(i,{variant:"body1"},"Here you can upload the the delivery note for this order"),r.createElement(m,null),r.createElement(E,{reference:"api::logistics.ipo",refID:R.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:q}))))))),(null===(A=null===(k=null==R?void 0:R.notes)||void 0===k?void 0:k.data)||void 0===A?void 0:A.length)>0&&r.createElement(c,{item:!0,xs:12},r.createElement(o,{spacing:2},r.createElement(i,{variant:"h5"},"Notes"),r.createElement(y,{notes:R.notes.data}),r.createElement(m,null))),r.createElement(c,{item:!0,xs:12},r.createElement("form",{action:B},r.createElement("input",{name:"id",type:"hidden",value:R.id}),(null===(F=null==R?void 0:R.items)||void 0===F?void 0:F.data)&&R.items.data.map((function(e,t){var a;return console.log("item",e),r.createElement(n,{sx:{p:2,mb:2},key:t},r.createElement(g,{item:e,index:t,handleAddReport:H,handleUpdateQuantity:Q,image:null===(a=null==e?void 0:e.product)||void 0===a?void 0:a.image,handleRemoveReportAtIndex:z}))})),r.createElement(n,{sx:{p:2}},r.createElement(o,{direction:"row",spacing:2,justifyContent:"end"},r.createElement(b,{text:"Update items",loadingText:"Loading..."}),r.createElement(_,{error:null==U?void 0:U.strapiErrors}),(null==U?void 0:U.message)&&r.createElement(x,{severity:"error"},null==U?void 0:U.message))),r.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map((function(e){return{id:e.id,arrived_quantity:e.arrived_quantity,registered_quantity:e.registered_quantity,recieved_quantity:e.recieved_quantity,registered_bad_reports:e.registered_bad_reports}}))}(M))})))))}export{C as default};