umwd-components 0.1.347 → 0.1.348

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 r,__spreadArray as e}from"../../node_modules/tslib/tslib.es6.js";import t,{useState as i}from"react";import m from"@mui/material/Typography";import o from"@mui/material/Divider";import a from"@mui/material/Box";import l from"@mui/material/Collapse";import n from"@mui/material/Chip";import p from"@mui/icons-material/KeyboardArrowDown";import c from"@mui/icons-material/KeyboardArrowUp";function s(s){var u=s.title,f=s.description,y=s.sx,d=void 0===y?[]:y,E=r(i(!1),2),b=E[0],x=E[1];return t.createElement(a,{sx:e([],r(Array.isArray(d)?d:[d]),!1)},t.createElement(o,{textAlign:"left"},t.createElement(n,{label:u,size:"small",color:"primary",onClick:function(){return x(!b)},icon:b?t.createElement(c,null):t.createElement(p,null)})),t.createElement(l,{in:b},t.createElement(m,{variant:"body2",color:"primary",sx:{mt:1}},f)))}export{s as ExplanatoryFoldOut};
6
+ import{__read as r,__spreadArray as e}from"../../node_modules/tslib/tslib.es6.js";import t,{useState as i}from"react";import m from"@mui/material/Typography";import o from"@mui/material/Divider";import a from"@mui/material/Box";import l from"@mui/material/Collapse";import n from"@mui/material/Chip";import c from"@mui/icons-material/KeyboardArrowDown";import p from"@mui/icons-material/KeyboardArrowUp";function s(s){var u=s.title,f=s.description,d=s.sx,y=void 0===d?[]:d,E=s.children,x=r(i(!1),2),b=x[0],A=x[1];return t.createElement(a,{sx:e([],r(Array.isArray(y)?y:[y]),!1)},t.createElement(o,{textAlign:"left"},t.createElement(n,{label:u,size:"small",color:"primary",onClick:function(){return A(!b)},icon:b?t.createElement(p,null):t.createElement(c,null)})),t.createElement(l,{in:b},f&&t.createElement(m,{variant:"body2",color:"primary",sx:{mt:1}},f),E&&t.createElement(a,{sx:{mt:1}},E)))}export{s as ExplanatoryFoldOut};
@@ -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,useRef as r}from"react";import i from"@mui/material/Stack";import l from"@mui/material/Typography";import a from"@mui/material/Box";import{useFormState as o}from"react-dom";import{uploadBase64MediaAction as m}from"../../../data/actions/media/uploadBase64MediaAction.js";import{StrapiErrors as c}from"../../StrapiErrors.js";import{ZodErrors as u}from"../../ZodErrors.js";import p from"@mui/material/Alert";import{SubmitButton as d}from"../../SubmitButton.js";var s={zodErrors:null,strapiErrors:null,data:null,message:null};function f(f){var E,v=f.reference,y=f.refID,g=void 0===y?0:y,x=f.field,h=f.multiple,b=void 0===h||h,j=f.accept,k=void 0===j?"image/*":j;f.fileData;var w=f.path,C=void 0===w?"api/ipos":w,I=f.componentName,O=void 0===I?"":I,_=f.componentReference,B=e(n(null),2),R=B[0],S=B[1],z=e(n(null),2),A=z[0],D=z[1],H=m.bind(null,C,g,O),L=e(o(H,s),2),N=L[0],T=L[1],U=r(null);return t.createElement("form",{action:T,id:x},t.createElement(i,{spacing:1,sx:{flex:1}},v&&t.createElement("input",{type:"text",name:"ref",value:v,style:{display:"none"},readOnly:!0}),g&&t.createElement("input",{type:"text",name:"refId",value:g,style:{display:"none"},readOnly:!0})," ",x&&t.createElement("input",{type:"text",name:"field",value:x,style:{display:"none"},readOnly:!0}),t.createElement("input",{id:"component_name",type:"hidden",name:"".concat(O,".__component"),value:_}),null!==R?t.createElement(a,{onClick:function(){var e;return null===(e=U.current)||void 0===e?void 0:e.click()},sx:{p:2,width:"100%",border:"1px dashed white",minHeight:"100px"}},void 0===k||"image/*"===k?t.createElement(i,{direction:"row",spacing:1,justifyContent:"flex-end"},R.map((function(e,n){return t.createElement("img",{key:n,src:e.url,alt:e.name,style:{width:"100px"}})}))):t.createElement(i,{spacing:1,justifyContent:"flex-end"},R.map((function(e,n){return t.createElement(l,{key:n},e.name)})))):t.createElement(a,{onClick:function(){var e;return null===(e=U.current)||void 0===e?void 0:e.click()},sx:{p:2,width:"100%",border:"1px dashed white",minHeight:"100px"}},t.createElement(l,null,"No file","".concat(b?"s":"")," selected")),t.createElement(i,{direction:"column",spacing:2,alignItems:"center",justifyContent:"space-between"},t.createElement(c,{error:N.strapiErrors}),t.createElement(u,{error:null===(E=N.zodErrors)||void 0===E?void 0:E.image}),(null==N?void 0:N.message)&&t.createElement(p,{severity:"error"},null==N?void 0:N.message),t.createElement(a,null,t.createElement("label",{htmlFor:"pictureInput"},t.createElement("input",{id:"pictureInput",accept:k,multiple:b,type:"file",name:"files",ref:U,onChange:function(e){var t=e.target.files;if(null!==t){var n=Object.keys(t).map((function(e,n){return{url:URL.createObjectURL(t[n]),name:t[n].name}}));D(t),S(n)}},style:{display:"none"}})),null!==A&&t.createElement(d,{text:"submit",loadingText:"loading"})))))}export{f as UploadBase64MediaForm};
7
+ import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as r,useRef as n,useEffect as l}from"react";import a from"@mui/material/Stack";import i from"@mui/material/Typography";import o from"@mui/material/Box";import{useFormState as m}from"react-dom";import{uploadBase64MediaAction as c}from"../../../data/actions/media/uploadBase64MediaAction.js";import{StrapiErrors as p}from"../../StrapiErrors.js";import{ZodErrors as d}from"../../ZodErrors.js";import u from"@mui/material/Alert";import{SubmitButton as s}from"../../SubmitButton.js";var f={zodErrors:null,strapiErrors:null,data:null,message:null};function E(E){var v,y=E.reference,g=E.refID,x=void 0===g?0:g,h=E.field,b=E.multiple,j=void 0===b||b,k=E.accept,w=void 0===k?"image/*":k;E.fileData;var C=E.path,I=void 0===C?"api/ipos":C,O=E.componentName,_=void 0===O?"":O,B=E.componentReference,R=E.revalidateCallback,S=e(r(null),2),z=S[0],A=S[1],D=e(r(null),2),H=D[0],L=D[1],N=c.bind(null,I,x,_),T=e(m(N,f),2),U=T[0],F=T[1],M=n(null);return l((function(){U.data&&R&&R()}),[U.data]),t.createElement("form",{action:F,id:h},t.createElement(o,{sx:[z&&z.length>0&&{border:"2px solid red",p:1}]},t.createElement(a,{spacing:1,sx:{flex:1}},y&&t.createElement("input",{type:"text",name:"ref",value:y,style:{display:"none"},readOnly:!0}),x&&t.createElement("input",{type:"text",name:"refId",value:x,style:{display:"none"},readOnly:!0})," ",h&&t.createElement("input",{type:"text",name:"field",value:h,style:{display:"none"},readOnly:!0}),t.createElement("input",{id:"component_name",type:"hidden",name:"".concat(_,".__component"),value:B}),null!==z?t.createElement(o,{onClick:function(){var e;return null===(e=M.current)||void 0===e?void 0:e.click()},sx:{p:2,width:"100%",border:"1px dashed white",minHeight:"100px"}},void 0===w||"image/*"===w?t.createElement(a,{direction:"row",spacing:1,justifyContent:"flex-end"},z.map((function(e,r){return t.createElement("img",{key:r,src:e.url,alt:e.name,style:{width:"100px"}})}))):t.createElement(a,{spacing:1,justifyContent:"flex-end"},z.map((function(e,r){return t.createElement(i,{key:r},e.name)})))):t.createElement(o,{onClick:function(){var e;return null===(e=M.current)||void 0===e?void 0:e.click()},sx:{p:2,width:"100%",border:"1px dashed white",minHeight:"100px"}},t.createElement(i,null,"No file","".concat(j?"s":"")," selected for upload")),t.createElement(a,{direction:"column",spacing:2,alignItems:"center",justifyContent:"space-between"},t.createElement(p,{error:U.strapiErrors}),t.createElement(d,{error:null===(v=U.zodErrors)||void 0===v?void 0:v.image}),(null==U?void 0:U.message)&&t.createElement(u,{severity:"error"},null==U?void 0:U.message),t.createElement(o,null,t.createElement("label",{htmlFor:"pictureInput"},t.createElement("input",{id:"pictureInput",accept:w,multiple:j,type:"file",name:"files",ref:M,onChange:function(e){var t=e.target.files;if(null!==t){var r=Object.keys(t).map((function(e,r){return{url:URL.createObjectURL(t[r]),name:t[r].name}}));L(t),A(r)}},style:{display:"none"}})),null!==H&&t.createElement(s,{text:"upload",loadingText:"loading"}))))))}export{E as UploadBase64MediaForm};
@@ -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 r,useRef as n,useEffect as l}from"react";import a from"@mui/material/Stack";import i from"@mui/material/Typography";import o from"@mui/material/Box";import{useFormState as m}from"react-dom";import{uploadMediaAction as c}from"../../../data/actions/media/uploadMediaAction.js";import{StrapiErrors as u}from"../../StrapiErrors.js";import{ZodErrors as s}from"../../ZodErrors.js";import p from"@mui/material/Alert";import{SubmitButton as d}from"../../SubmitButton.js";var f={zodErrors:null,strapiErrors:null,data:null,message:null};function E(E){var y,v=E.reference,g=E.refID,x=E.field,h=E.multiple,b=void 0===h||h,j=E.accept,k=void 0===j?"image/*":j;E.fileData;var w=E.revalidateCallback,C=e(r(null),2),I=C[0],O=C[1],S=e(r(null),2),z=S[0],A=S[1],B=e(m(c,f),2),D=B[0],H=B[1],L=n(null);return l((function(){D.data&&(null==w||w())}),[D.data]),t.createElement("form",{action:H},t.createElement(a,{spacing:1,sx:{flex:1}},v&&t.createElement("input",{type:"text",name:"ref",value:v,style:{display:"none"},readOnly:!0}),g&&t.createElement("input",{type:"text",name:"refId",value:g,style:{display:"none"},readOnly:!0}),x&&t.createElement("input",{type:"text",name:"field",value:x,style:{display:"none"},readOnly:!0}),null!==I?t.createElement(o,{onClick:function(){var e;return null===(e=L.current)||void 0===e?void 0:e.click()},sx:{p:2,width:"100%",border:"1px dashed white",minHeight:"100px"}},void 0===k||"image/*"===k?t.createElement(a,{direction:"row",spacing:1,justifyContent:"flex-end"},I.map((function(e,r){return t.createElement("img",{key:r,src:e.url,alt:e.name,style:{width:"100px"}})}))):t.createElement(a,{spacing:1,justifyContent:"flex-end"},I.map((function(e,r){return t.createElement(i,{key:r},e.name)})))):t.createElement(o,{onClick:function(){var e;return null===(e=L.current)||void 0===e?void 0:e.click()},sx:{p:2,width:"100%",border:"1px dashed white",minHeight:"100px"}},t.createElement(i,null,"No file","".concat(b?"s":"")," selected")),t.createElement(a,{direction:"column",spacing:2,alignItems:"center",justifyContent:"space-between"},t.createElement(u,{error:D.strapiErrors}),t.createElement(s,{error:null===(y=D.zodErrors)||void 0===y?void 0:y.image}),(null==D?void 0:D.message)&&t.createElement(p,{severity:"error"},null==D?void 0:D.message),t.createElement(o,null,t.createElement("label",{htmlFor:"pictureInput"},t.createElement("input",{id:"pictureInput",accept:k,multiple:b,type:"file",name:"files",ref:L,onChange:function(e){console.log(e.target.files);var t=e.target.files;if(null!==t){var r=Object.keys(t).map((function(e,r){return{url:URL.createObjectURL(t[r]),name:t[r].name}}));A(t),O(r)}},style:{display:"none"}})),null!==z&&t.createElement(d,{text:"upload",loadingText:"loading"})))))}export{E as UploadMediaForm};
7
+ import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as r,useRef as n}from"react";import l from"@mui/material/Stack";import a from"@mui/material/Typography";import i from"@mui/material/Box";import{useFormState as o}from"react-dom";import{uploadMediaAction as m}from"../../../data/actions/media/uploadMediaAction.js";import{StrapiErrors as c}from"../../StrapiErrors.js";import{ZodErrors as u}from"../../ZodErrors.js";import s from"@mui/material/Alert";import{SubmitButton as p}from"../../SubmitButton.js";var d={zodErrors:null,strapiErrors:null,data:null,message:null};function f(f){var E,y=f.reference,v=f.refID,g=f.field,x=f.multiple,h=void 0===x||x,b=f.accept,j=void 0===b?"image/*":b;f.fileData,f.revalidateCallback;var k=e(r(null),2),w=k[0],C=k[1],I=e(r(null),2),O=I[0],S=I[1],z=e(o(m,d),2),A=z[0],B=z[1],D=n(null);return t.createElement("form",{action:B},t.createElement(l,{spacing:1,sx:{flex:1}},y&&t.createElement("input",{type:"text",name:"ref",value:y,style:{display:"none"},readOnly:!0}),v&&t.createElement("input",{type:"text",name:"refId",value:v,style:{display:"none"},readOnly:!0}),g&&t.createElement("input",{type:"text",name:"field",value:g,style:{display:"none"},readOnly:!0}),null!==w?t.createElement(i,{onClick:function(){var e;return null===(e=D.current)||void 0===e?void 0:e.click()},sx:{p:2,width:"100%",border:"1px dashed white",minHeight:"100px"}},void 0===j||"image/*"===j?t.createElement(l,{direction:"row",spacing:1,justifyContent:"flex-end"},w.map((function(e,r){return t.createElement("img",{key:r,src:e.url,alt:e.name,style:{width:"100px"}})}))):t.createElement(l,{spacing:1,justifyContent:"flex-end"},w.map((function(e,r){return t.createElement(a,{key:r},e.name)})))):t.createElement(i,{onClick:function(){var e;return null===(e=D.current)||void 0===e?void 0:e.click()},sx:{p:2,width:"100%",border:"1px dashed white",minHeight:"100px"}},t.createElement(a,null,"No file","".concat(h?"s":"")," selected")),t.createElement(l,{direction:"column",spacing:2,alignItems:"center",justifyContent:"space-between"},t.createElement(c,{error:A.strapiErrors}),t.createElement(u,{error:null===(E=A.zodErrors)||void 0===E?void 0:E.image}),(null==A?void 0:A.message)&&t.createElement(s,{severity:"error"},null==A?void 0:A.message),t.createElement(i,null,t.createElement("label",{htmlFor:"pictureInput"},t.createElement("input",{id:"pictureInput",accept:j,multiple:h,type:"file",name:"files",ref:D,onChange:function(e){console.log(e.target.files);var t=e.target.files;if(null!==t){var r=Object.keys(t).map((function(e,r){return{url:URL.createObjectURL(t[r]),name:t[r].name}}));S(t),C(r)}},style:{display:"none"}})),null!==O&&t.createElement(p,{text:"upload",loadingText:"loading"})))))}export{f as UploadMediaForm};
@@ -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 f}from"../../common/media/UploadBase64MediaForm.js";import E 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 x}from"../../StrapiErrors.js";import b from"@mui/material/Alert";var w={zodErrors:null,strapiErrors:null,data:null,message:null};function j(j){var C,D,I,N,A,R,F,q=j.data,O=j.sx,S=e(u(v,w),2),k=S[0],B=S[1];console.log("data",q);var U=e(n(q.items.data),2),M=U[0],P=U[1],T=function(r,n,a){void 0===a&&(a="registered_bad_reports"),console.log(M),console.log(r,n,a),console.log("handleAddReport");var o=t([],e(M),!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]},H=function(r,n,a){console.log(M),console.log(r,n,a),console.log("handleUpdateQuantity");var o=t([],e(M),!1),i=o.findIndex((function(e){return e.id===n}));o[i][a]=r,P(o)},Q=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:q.id,__type:"api::logistics.ipo"}]})),r.createElement(m,null))),r.createElement(c,{item:!0,xs:12},r.createElement(i,{variant:"h4"},"Purchase Order Number ",q.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"},q.custom_reference)),r.createElement(o,{direction:"row",spacing:2},r.createElement(i,{variant:"body1",width:"150px"},"Order Date"),r.createElement(i,{variant:"body2"},q.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===(C=q.vendor_profile)||void 0===C?void 0:C.business_credentials)||void 0===D?void 0:D.company_name)))),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},q.order_confirmation?r.createElement(r.Fragment,null,r.createElement(i,{variant:"h6"},"Order Confirmation"),r.createElement(i,null,null===(I=q.order_confirmation)||void 0===I?void 0:I.name),r.createElement(l,{variant:"contained",onClick:function(){E("api/ipos/".concat(q.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(f,{reference:"api::logistics.ipo",refID:q.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"})),q.delivery_note?r.createElement(r.Fragment,null,r.createElement(i,{variant:"h6"},"Delivery Note"),r.createElement(i,null,null===(N=q.delivery_note)||void 0===N?void 0:N.name),r.createElement(l,{variant:"contained",onClick:function(){E("api/ipos/".concat(q.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(f,{reference:"api::logistics.ipo",refID:q.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"}))))))),(null===(R=null===(A=null==q?void 0:q.notes)||void 0===A?void 0:A.data)||void 0===R?void 0:R.length)>0&&r.createElement(c,{item:!0,xs:12},r.createElement(o,{spacing:2},r.createElement(i,{variant:"h5"},"Notes"),r.createElement(y,{notes:q.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:q.id}),(null===(F=null==q?void 0:q.items)||void 0===F?void 0:F.data)&&q.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:T,handleUpdateQuantity:H,image:null===(n=null==e?void 0:e.product)||void 0===n?void 0:n.image,handleRemoveReportAtIndex:Q}))})),r.createElement(a,{sx:{p:2}},r.createElement(o,{direction:"row",spacing:2,justifyContent:"end"},r.createElement(_,{text:"Submit",loadingText:"Loading..."}),r.createElement(x,{error:null==k?void 0:k.strapiErrors}),(null==k?void 0:k.message)&&r.createElement(b,{severity:"error"},null==k?void 0:k.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{j as default};
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};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as m}from"react";import o from"@mui/material/Paper";import n from"@mui/material/Box";import a from"@mui/material/Stack";import c from"@mui/material/Alert";import i from"@mui/material/TextField";import s from"@mui/material/Typography";import{SubmitButton as l}from"../../SubmitButton.js";import{useFormState as p}from"react-dom";import{StrapiErrors as d}from"../../StrapiErrors.js";import{createVendorAction as u}from"../../../data/actions/logistics/vendor/createVendorAction.js";import f from"@mui/material/Grid";import{BusinessCredentialsFields as E}from"../../e-commerce/customer/BusinessCredentials.js";import{AddressFields as x}from"../../common/Address.js";import b from"../../e-commerce/products/ProductSelector.js";import{ContactsFields as g}from"../../common/Contacts.js";import _ from"@mui/material/IconButton";import h from"@mui/icons-material/Add";import{ContactType as v}from"../../../types/common/Contact.js";var y={zodErrors:null,strapiErrors:null,data:null,message:null};function j(j){var N=j.productNamesArr,A=e(p(u,y),2),k=A[0],C=A[1],R=e(m([{componentName:"contacts[0]",componentReference:"logistics-elements.contact",data:{first_name:"",last_name:"",email:"",phone_number:"",type:v.Other}}]),2),w=R[0],B=R[1];return r.createElement(n,{component:o,sx:{p:2}},r.createElement("form",{action:C},r.createElement(f,{container:!0,spacing:2},r.createElement(f,{item:!0,xs:12},r.createElement(a,{direction:"row-reverse",spacing:2,alignItems:"center",sx:{backgroundColor:"secondary.dark",px:2,py:1}},r.createElement(l,{text:"create new vendor",loadingText:"loading",sx:{color:"secondary.contrastText"}}),r.createElement(d,{error:null==k?void 0:k.strapiErrors}),(null==k?void 0:k.message)&&r.createElement(c,{severity:"error"},null==k?void 0:k.message))),r.createElement(f,{item:!0,xs:12},r.createElement(s,{variant:"h5"},"Add Vendor")),r.createElement(f,{item:!0,xs:12,md:6},r.createElement(E,{componentName:"business_credentials",componentReference:"common.business-credentials"})),r.createElement(f,{item:!0,xs:12,md:6},r.createElement(a,{spacing:1,sx:{pt:1}},r.createElement(i,{id:"website_url",name:"website_url",label:"Website Url"}),r.createElement(i,{id:"phone_number",name:"phone_number",label:"Phone Number"}),r.createElement(i,{id:"email",name:"email",label:"Email"}))),r.createElement(f,{item:!0,xs:12,md:6},r.createElement(x,{componentName:"address",componentReference:"common.address"})),r.createElement(f,{item:!0,xs:12,md:6,sx:{mt:1}},r.createElement(b,{productNames:N,currentValue:[]})),r.createElement(f,{item:!0,xs:12,md:6,sx:{mt:1}},w.map((function(e,t){return r.createElement(g,{key:t,data:e.data,componentName:e.componentName,componentReference:"logistics-elements.contact"})})),r.createElement(_,{onClick:function(){B(t(t([],e(w),!1),[{componentName:"contacts[".concat(w.length,"]"),componentReference:"logistics-elements.contact",data:{first_name:"",last_name:"",email:"",phone_number:"",type:v.Other}}],!1))}},r.createElement(h,null))))))}export{j as AddVendorForm};
7
+ import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as m,useEffect as n}from"react";import o from"@mui/material/Paper";import a from"@mui/material/Box";import c from"@mui/material/Stack";import i from"@mui/material/Alert";import l from"@mui/material/TextField";import s from"@mui/material/Typography";import{SubmitButton as p}from"../../SubmitButton.js";import{useFormState as d}from"react-dom";import{StrapiErrors as u}from"../../StrapiErrors.js";import{createVendorAction as E}from"../../../data/actions/logistics/vendor/createVendorAction.js";import f from"@mui/material/Grid";import{BusinessCredentialsFields as x}from"../../e-commerce/customer/BusinessCredentials.js";import{AddressFields as b}from"../../common/Address.js";import g from"../../e-commerce/products/ProductSelector.js";import{ContactsFields as v}from"../../common/Contacts.js";import h from"@mui/material/IconButton";import _ from"@mui/icons-material/Add";import{ContactType as y}from"../../../types/common/Contact.js";var j={zodErrors:null,strapiErrors:null,data:null,message:null};function N(N){var A=N.productNamesArr,C=N.revalidateCallback,k=e(d(E,j),2),R=k[0],w=k[1],B=e(m([{componentName:"contacts[0]",componentReference:"logistics-elements.contact",data:{first_name:"",last_name:"",email:"",phone_number:"",type:y.Other}}]),2),P=B[0],S=B[1];return n((function(){(null==R?void 0:R.data)&&C&&C()}),[R.data]),r.createElement(a,{component:o,sx:{p:2}},r.createElement("form",{action:w},r.createElement(f,{container:!0,spacing:2},r.createElement(f,{item:!0,xs:12},r.createElement(s,{variant:"h5"},"Add Vendor")),r.createElement(f,{item:!0,xs:12,md:6},r.createElement(x,{componentName:"business_credentials",componentReference:"common.business-credentials"})),r.createElement(f,{item:!0,xs:12,md:6},r.createElement(c,{spacing:1,sx:{pt:1}},r.createElement(l,{id:"website_url",name:"website_url",label:"Website Url"}),r.createElement(l,{id:"phone_number",name:"phone_number",label:"Phone Number"}),r.createElement(l,{id:"email",name:"email",label:"Email"}))),r.createElement(f,{item:!0,xs:12,md:6},r.createElement(s,{variant:"h6"},"Address"),r.createElement(b,{componentName:"address",componentReference:"common.address"})),r.createElement(f,{item:!0,xs:12,sx:{mt:1}},r.createElement(s,{variant:"h6"},"Products"),r.createElement(g,{productNames:A,currentValue:[]})),r.createElement(f,{item:!0,xs:12,sx:{mt:1}},r.createElement(s,{variant:"h6"},"Contacts"),P.map((function(e,t){return r.createElement(v,{key:t,data:e.data,componentName:e.componentName,componentReference:"logistics-elements.contact"})})),r.createElement(h,{onClick:function(){S(t(t([],e(P),!1),[{componentName:"contacts[".concat(P.length,"]"),componentReference:"logistics-elements.contact",data:{first_name:"",last_name:"",email:"",phone_number:"",type:y.Other}}],!1))}},r.createElement(_,null))),r.createElement(f,{item:!0,xs:12},r.createElement(c,{direction:"row-reverse",spacing:2,alignItems:"center",sx:{backgroundColor:"secondary.dark",px:2,py:1}},r.createElement(p,{text:"create new vendor",loadingText:"loading",sx:{color:"secondary.contrastText"}}),r.createElement(u,{error:null==R?void 0:R.strapiErrors}),(null==R?void 0:R.message)&&r.createElement(i,{severity:"error"},null==R?void 0:R.message))))))}export{N as AddVendorForm};