umwd-components 0.1.670 → 0.1.672
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/logistics/vendor/AddVendorForm.js +1 -1
- package/dist/src/components/logistics/vendor/EditVendorForm.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/logistics/vendor/AddVendorForm.tsx +82 -43
- package/src/components/logistics/vendor/EditVendorForm.tsx +157 -70
|
@@ -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/index7.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/index8.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};
|
|
@@ -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 n,useEffect as
|
|
7
|
+
import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as n,useEffect as a}from"react";import m from"@mui/material/Box";import o from"@mui/material/Stack";import i from"@mui/material/Button";import s from"@mui/material/TextField";import c from"@mui/material/Typography";import{SubmitButton as l}from"../../SubmitButton.js";import{useFormState as d}from"react-dom";import{useSnackbar as u}from"../../../context/common/SnackbarContext.js";import{createVendorAction as p}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 g}from"../../common/Address.js";import x from"../../e-commerce/products/ProductSelector.js";import{ContactsFields as y}from"../../common/Contacts.js";import v from"@mui/icons-material/Add";import{ContactType as b}from"../../../types/common/Contact.js";import{ExplanatoryFoldOut as h}from"../../ExplanatoryFoldOut.js";import{Paper as C}from"@mui/material";var j={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};function A(A){var _=A.productNamesArr,k=A.revalidateCallback,N=A.handleClose,w=A.sx,I=e(d(p,j),2),V=I[0],B=I[1],R=u().handleAddMessage,S=e(n([]),2),P=S[0],T=S[1];return a((function(){(null==V?void 0:V.message)&&(R({message:V.message,severity:V.severity||"error"}),"success"===V.severity&&(k&&k(),N&&N()))}),[null==V?void 0:V.message]),a((function(){(null==V?void 0:V.strapiErrors)&&R({message:V.strapiErrors.message||"Error creating vendor",severity:"error"})}),[null==V?void 0:V.strapiErrors]),r.createElement(m,{sx:t([],e(Array.isArray(w)?w:[w]),!1)},r.createElement("form",{action:B},r.createElement(f,{container:!0,spacing:2},r.createElement(f,{item:!0,xs:12},r.createElement(o,{spacing:2},r.createElement(c,{variant:"h3",component:"h1"},"Add Vendor"),r.createElement(c,{variant:"body1"},"Create a new vendor for your business"))),r.createElement(f,{item:!0,xs:12},r.createElement(h,{title:"Vendor",description:"Vendors are businesses that you purchase products from."})),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(o,{spacing:1,sx:{pt:1}},r.createElement(s,{id:"website_url",name:"website_url",label:"Website Url"}),r.createElement(s,{id:"phone_number",name:"phone_number",label:"Phone Number"}),r.createElement(s,{id:"email",name:"email",label:"Email"}))),r.createElement(f,{item:!0,xs:12,md:6},r.createElement(c,{variant:"h6"},"Address"),r.createElement(g,{componentName:"address",componentReference:"common.address"})),r.createElement(f,{item:!0,xs:12},r.createElement(c,{variant:"h6"},"Products")),r.createElement(f,{item:!0,xs:12},r.createElement(x,{productNames:_,currentValue:[]})),r.createElement(f,{item:!0,xs:12},r.createElement(c,{variant:"h6"},"Contacts")),P.map((function(e,t){return r.createElement(f,{item:!0,xs:12,sm:6,md:4,lg:3,key:t,sx:{justifyContent:"center",display:"flex",alignItems:"center"}},r.createElement(C,{sx:{p:2,width:"100%",display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},r.createElement(y,{key:t,data:e.data,componentName:e.componentName,componentReference:"logistics-elements.contact",deleteCallback:function(){!function(e){var t=P.filter((function(t,r){return r!==e}));T(t)}(t)}})))})),r.createElement(f,{item:!0,xs:12,sm:6,md:4,lg:3,sx:{justifyContent:"center",display:"flex",alignItems:"center"}},r.createElement(C,{sx:{p:2,width:"100%",display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},r.createElement(i,{variant:"contained",startIcon:r.createElement(v,null),onClick:function(){T(t(t([],e(P),!1),[{componentName:"contacts[".concat(P.length,"]"),componentReference:"logistics-elements.contact",data:{first_name:"",last_name:"",email:"",phone_number:"",type:b.Other}}],!1))},size:"large"},"Add contact"))),r.createElement(f,{item:!0,xs:12},r.createElement(o,{direction:"row",spacing:2,justifyContent:"space-between",alignItems:"center"},N&&r.createElement(i,{onClick:N,variant:"outlined"},"Cancel"),r.createElement(l,{text:"Create Vendor",loadingText:"Creating...",variant:"contained"}))))))}export{A as AddVendorForm};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__read as e,__spreadArray as t,__assign as n}from"../../../../node_modules/tslib/tslib.es6.js";import a,{useEffect as r,useState as o}from"react";import m from"@mui/material/Box";import
|
|
7
|
+
import{__read as e,__spreadArray as t,__assign as n}from"../../../../node_modules/tslib/tslib.es6.js";import a,{useEffect as r,useState as o}from"react";import i from"@mui/material/Paper";import m from"@mui/material/Box";import l from"@mui/material/Stack";import c from"@mui/material/Button";import s from"@mui/material/TextField";import d from"@mui/material/Typography";import{SubmitButton as u}from"../../SubmitButton.js";import{useFormState as p}from"react-dom";import{useSnackbar as f}from"../../../context/common/SnackbarContext.js";import{updateVendorAction as E}from"../../../data/actions/logistics/vendor/updateVendorAction.js";import g from"@mui/material/Grid";import{BusinessCredentialsFields as x}from"../../e-commerce/customer/BusinessCredentials.js";import{AddressFields as v}from"../../common/Address.js";import y from"../../e-commerce/products/ProductSelector.js";import h,{ContactsFields as b}from"../../common/Contacts.js";import C from"@mui/icons-material/Add";import{ContactType as j}from"../../../types/common/Contact.js";import{ExplanatoryFoldOut as _}from"../../ExplanatoryFoldOut.js";import N from"../note/NoteTakingComponent.js";import k from"../note/NotesDisplay.js";var w={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};function A(A){var I=A.data,V=A.productNamesArr,R=A.revalidateCallback,B=A.handleClose,P=A.sx,S=I.id,T=I.website_url,U=I.phone_number,z=I.email,F=I.business_credentials,M=I.address,O=I.products,D=I.contacts,G=I.notes;console.log("data",I);var W=e(p(E,w),2),q=W[0],H=W[1],J=f().handleAddMessage;r((function(){(null==q?void 0:q.message)&&(J({message:q.message,severity:q.severity||"error"}),"success"===q.severity&&(R&&R(),B&&B()))}),[null==q?void 0:q.message]),r((function(){(null==q?void 0:q.strapiErrors)&&J({message:q.strapiErrors.message||"Error updating vendor",severity:"error"})}),[null==q?void 0:q.strapiErrors]);var K=(null==O?void 0:O.data)||[],L=e(o([]),2),Q=L[0],X=L[1],Y=function(n,a){Q.includes(a)?X(Q.filter((function(e){return e!==a}))):X(t(t([],e(Q),!1),[a],!1))},Z=e(o(D.reduce((function(e,t,n){return e.push({componentName:"contacts[".concat(n,"]"),componentReference:"logistics-elements.contact",data:t}),e}),[])),2),$=Z[0],ee=Z[1],te=e(o([]),2),ne=te[0],ae=te[1];return a.createElement(m,{sx:t([],e(Array.isArray(P)?P:[P]),!1)},a.createElement("form",{action:H},S&&a.createElement("input",{id:"id",type:"hidden",name:"id",value:S}),a.createElement(g,{container:!0,spacing:2},a.createElement(g,{item:!0,xs:12},a.createElement(l,{direction:"row",justifyContent:"space-between"},a.createElement(d,{variant:"h5"},"Edit Vendor"),a.createElement(N,{content:"",related:[{id:I.id,__type:"api::logistics.vendor-profile"}],revalidateCallback:R}))),a.createElement(g,{item:!0,xs:12},a.createElement(_,{title:"Vendor",description:"Vendors are businesses that you purchase products from."})),a.createElement(g,{item:!0,xs:12,md:6},a.createElement(x,{data:F,componentName:"business_credentials",componentReference:"common.business-credentials"})),a.createElement(g,{item:!0,xs:12,md:6},a.createElement(l,{spacing:2},a.createElement(s,{id:"website_url",name:"website_url",label:"Website Url",defaultValue:T}),a.createElement(s,{id:"phone_number",name:"phone_number",label:"Phone Number",defaultValue:U}),a.createElement(s,{id:"email",name:"email",label:"Email",defaultValue:z}))),a.createElement(g,{item:!0,xs:12,md:6},a.createElement(d,{variant:"h6"},"Address"),a.createElement(v,{data:M,componentName:"address",componentReference:"common.address"})),a.createElement(g,{item:!0,xs:12,sx:{mt:1}},a.createElement(d,{variant:"h6"},"Products"),a.createElement(y,{productNames:V,currentValue:K.map((function(e){return e.id}))})),a.createElement(g,{item:!0,xs:12,sx:{mt:1}},a.createElement(d,{variant:"h6"},"Contacts")),null==$?void 0:$.map((function(e,t){var r,o;return(null===(r=e.data)||void 0===r?void 0:r.id)?Q.includes(null===(o=e.data)||void 0===o?void 0:o.id)?a.createElement(g,{item:!0,xs:12,sm:6,md:4,lg:3,sx:{justifyContent:"center",display:"flex",alignItems:"center"},key:e.data.id},a.createElement(i,{sx:{p:2,width:"100%",display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},a.createElement(b,{data:e.data,componentName:"contacts[".concat(t,"]"),componentReference:"logistics-elements.contact",deleteCallback:function(){ee($.filter((function(e,n){return n!==t})))}}))):a.createElement(g,{item:!0,xs:12,sm:6,md:4,lg:3,sx:{justifyContent:"center",display:"flex",alignItems:"center"},key:e.data.id},a.createElement(i,{sx:{p:2,width:"100%",display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},a.createElement("input",{type:"hidden",name:"contacts[".concat(t,"].id"),value:e.data.id}),a.createElement("input",{type:"hidden",name:"contacts[".concat(t,"].__component"),value:"logistics-elements.contact"}),a.createElement(h,{data:n(n({},e.data),{onClick:Y})}))):null})),ne.map((function(e,t){var r;return a.createElement(g,{item:!0,xs:12,sm:6,md:4,lg:3,sx:{justifyContent:"center",display:"flex",alignItems:"center"},key:(null===(r=e.data)||void 0===r?void 0:r.id)||t},a.createElement(i,{sx:{p:2,width:"100%",display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},a.createElement(b,{data:e.data,componentName:e.componentName,componentReference:"logistics-elements.contact",deleteCallback:function(){ae(ne.filter((function(e,n){return n!==t})).map((function(e,t){return n(n({},e),{componentName:"contacts[".concat(t+$.length,"]")})})))}})))})),a.createElement(g,{item:!0,xs:12,sm:6,md:4,lg:3,sx:{justifyContent:"center",display:"flex",alignItems:"center"}},a.createElement(i,{sx:{p:2,width:"100%",display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},a.createElement(c,{variant:"contained",startIcon:a.createElement(C,null),onClick:function(){ae(t(t([],e(ne),!1),[{componentName:"contacts[".concat($.length+ne.length,"]"),componentReference:"logistics-elements.contact",data:{uuid:Math.random(),first_name:"",last_name:"",email:"",phone_number:"",type:j.Other}}],!1))},size:"large"},"Add contact"))),a.createElement(g,{item:!0,xs:12},a.createElement(d,{variant:"h6"},"Notes"),void 0!==(null==G?void 0:G.data)?a.createElement(k,{notes:G.data}):a.createElement(d,null,"No notes to display"))," ",a.createElement(g,{item:!0,xs:12},a.createElement(l,{direction:"row",spacing:2,justifyContent:"flex-end",sx:{mt:2}},B&&a.createElement(c,{onClick:B,variant:"outlined"},"Cancel"),a.createElement(u,{text:"Update Vendor",loadingText:"Updating..."}))))))}export{A as EditVendorForm};
|