umwd-components 0.1.381 → 0.1.383
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/src/components/common/Contacts.js +1 -1
- package/dist/src/components/common/media/UploadBase64MediaForm.js +1 -1
- package/dist/src/components/common/media/UploadMediaForm.js +1 -1
- package/dist/src/components/logistics/vendor/EditVendorForm.js +1 -1
- package/dist/src/data/actions/logistics/ipo/createIPOAction.js +1 -1
- package/dist/src/data/services/file-service.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/components/common/media/UploadBase64MediaForm.d.ts +1 -1
- package/dist/types/components/common/media/UploadMediaForm.d.ts +1 -1
- package/dist/types/types/common/Contact.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/common/Contacts.tsx +7 -2
- package/src/components/common/media/UploadBase64MediaForm.tsx +0 -1
- package/src/components/common/media/UploadMediaForm.tsx +25 -19
- package/src/components/logistics/vendor/EditVendorForm.tsx +31 -16
- package/src/data/actions/logistics/ipo/createIPOAction.ts +0 -3
- package/src/data/services/file-service.ts +0 -5
- package/src/types/common/Contact.ts +1 -0
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
import{extends as e}from"../../../_virtual/_rollupPluginBabelHelpers.js";import t from"react";import a from"@mui/material/Stack";import n from"@mui/material/TextField";import l from"@mui/material/Typography";import m from"@mui/material/Button";import r from"@mui/icons-material/AccountCircle";import{ContactType as i}from"../../types/common/Contact.js";import o from"@mui/material/Autocomplete";import c from"@mui/material/IconButton";import{Delete as u}from"@mui/icons-material";function p(e){var n=e.data,i=n.id,o=n.first_name,c=n.last_name,u=n.email,p=n.phone_number,d=n.type,f=n.onClick;return t.createElement(a,null,t.createElement(a,{spacing:2,direction:"row"},t.createElement(r,null),t.createElement(a,null,t.createElement(l,null,o," ",c),t.createElement(l,null,u),t.createElement(l,null,p),t.createElement(l,null,d),f&&t.createElement(m,{onClick:function(e){i&&f(e,i)}},"Edit"))))}function d(l){var m=l.data,r=l.componentName,p=l.componentReference,d=l.deleteCallback,f=m||{},s=f.id,E=f.first_name,_=f.last_name,b=f.email,y=f.phone_number,h=f.type;return t.createElement(a,{spacing:1},t.createElement("input",{id:"",type:"hidden",name:"".concat(r,".__component"),value:p}),s&&t.createElement("input",{id:"",type:"hidden",name:"".concat(r,".id"),value:s}),t.createElement(a,{spacing:1,direction:"row"},t.createElement(n,{id:"first_name",name:"".concat(r,".first_name"),label:"First Name",defaultValue:E||""}),d&&t.createElement(c,{onClick:d},t.createElement(u,null))),t.createElement(n,{id:"last_name",name:"".concat(r,".last_name"),label:"Last Name",defaultValue:_||""}),t.createElement(n,{id:"email",name:"".concat(r,".email"),label:"E-mail",defaultValue:b||""}),t.createElement(n,{id:"phone_number",name:"".concat(r,".phone_number"),label:"Phone Number",defaultValue:y||""}),t.createElement(o,{id:"type",options:Object.values(i),defaultValue:h||Object.values(i)[0],renderInput:function(a){return t.createElement(n,e({},a,{name:"".concat(r,".type"),label:"Type"}))}}))}export{d as ContactsFields,p as default};
|
|
6
|
+
import{extends as e}from"../../../_virtual/_rollupPluginBabelHelpers.js";import t from"react";import a from"@mui/material/Stack";import n from"@mui/material/TextField";import l from"@mui/material/Typography";import m from"@mui/material/Button";import r from"@mui/icons-material/AccountCircle";import{ContactType as i}from"../../types/common/Contact.js";import o from"@mui/material/Autocomplete";import c from"@mui/material/IconButton";import{Delete as u}from"@mui/icons-material";function p(e){var n=e.data,i=n.id,o=n.first_name,c=n.last_name,u=n.email,p=n.phone_number,d=n.type,f=n.onClick;return t.createElement(a,null,t.createElement(a,{spacing:2,direction:"row"},t.createElement(r,null),t.createElement(a,null,t.createElement(l,null,o," ",c),t.createElement(l,null,u),t.createElement(l,null,p),t.createElement(l,null,d),f&&t.createElement(m,{onClick:function(e){i&&f(e,i)}},"Edit"))))}function d(l){var m=l.data,r=l.componentName,p=l.componentReference,d=l.deleteCallback,f=m||{},s=f.id,E=f.first_name,_=f.last_name,b=f.email,y=f.phone_number,h=f.type;return t.createElement(a,{spacing:1},t.createElement("input",{id:"".concat(r,".__component"),type:"hidden",name:"".concat(r,".__component"),value:p}),s&&t.createElement("input",{id:"".concat(r,".id"),type:"hidden",name:"".concat(r,".id"),value:s}),t.createElement(a,{spacing:1,direction:"row"},t.createElement(n,{id:"first_name",name:"".concat(r,".first_name"),label:"First Name",defaultValue:E||""}),d&&t.createElement(c,{onClick:d},t.createElement(u,null))),t.createElement(n,{id:"last_name",name:"".concat(r,".last_name"),label:"Last Name",defaultValue:_||""}),t.createElement(n,{id:"email",name:"".concat(r,".email"),label:"E-mail",defaultValue:b||""}),t.createElement(n,{id:"phone_number",name:"".concat(r,".phone_number"),label:"Phone Number",defaultValue:y||""}),t.createElement(o,{id:"type",options:Object.values(i),defaultValue:h||Object.values(i)[0],renderInput:function(a){return t.createElement(n,e({},a,{name:"".concat(r,".type"),label:"Type"}))}}))}export{d as ContactsFields,p as default};
|
|
@@ -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
|
|
7
|
+
import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as n,useRef as r,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,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(n(null),2),z=S[0],A=S[1],H=e(n(null),2),L=H[0],N=H[1],T=c.bind(null,I,x,_),U=e(m(T,f),2),D=U[0],F=U[1],M=r(null);return l((function(){D.data&&R&&R()}),[D.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,n){return t.createElement("img",{key:n,src:e.url,alt:e.name,style:{width:"100px"}})}))):t.createElement(a,{spacing:1,justifyContent:"flex-end"},z.map((function(e,n){return t.createElement(i,{key:n},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:D.strapiErrors}),t.createElement(d,{error:null===(v=D.zodErrors)||void 0===v?void 0:v.image}),(null==D?void 0:D.message)&&t.createElement(u,{severity:"error"},null==D?void 0:D.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 n=Object.keys(t).map((function(e,n){return{url:URL.createObjectURL(t[n]),name:t[n].name}}));N(t),A(n)}},style:{display:"none"}})),null!==L&&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
|
|
7
|
+
import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as r,useRef as l,useEffect as n}from"react";import{useFormState as a}from"react-dom";import{uploadMediaAction as i}from"../../../data/actions/media/uploadMediaAction.js";import{StrapiErrors as m}from"../../StrapiErrors.js";import{ZodErrors as o}from"../../ZodErrors.js";import{SubmitButton as c}from"../../SubmitButton.js";import u from"@mui/material/Stack";import s from"@mui/material/Typography";import d from"@mui/material/Box";import p from"@mui/material/Grid";import f from"@mui/material/Alert";var E={zodErrors:null,strapiErrors:null,data:null,message:null};function y(y){var v,g=y.reference,x=y.refID,h=y.field,b=y.multiple,k=void 0===b||b,j=y.accept,w=void 0===j?"image/*":j,C=y.revalidateCallback,I=e(r(null),2),O=I[0],S=I[1],z=e(r(null),2),A=z[0],B=z[1],H=e(a(i,E),2),L=H[0],R=H[1],T=l(null);return n((function(){L.data&&(null==C||C())}),[L.data]),t.createElement("form",{action:R},t.createElement(u,{spacing:1,sx:{flex:1}},g&&t.createElement("input",{type:"text",name:"ref",value:g,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}),null!==O?t.createElement(d,{onClick:function(){var e;return null===(e=T.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(p,{container:!0},O.map((function(e,r){return t.createElement(p,{item:!0,key:r,xs:12,sm:6,md:4,lg:2},t.createElement("img",{key:r,src:e.url,alt:e.name,style:{width:"100px"}}))}))):t.createElement(p,{container:!0},O.map((function(e,r){return t.createElement(p,{item:!0,key:r,xs:12,sm:6,md:4,lg:2},t.createElement(s,null,e.name))})))):t.createElement(d,{onClick:function(){var e;return null===(e=T.current)||void 0===e?void 0:e.click()},sx:{p:2,width:"100%",border:"1px dashed white",minHeight:"100px"}},t.createElement(s,null,"No file","".concat(k?"s":"")," selected")),t.createElement(u,{direction:"column",spacing:2,alignItems:"center",justifyContent:"space-between"},t.createElement(m,{error:L.strapiErrors}),t.createElement(o,{error:null===(v=L.zodErrors)||void 0===v?void 0:v.image}),(null==L?void 0:L.message)&&t.createElement(f,{severity:"error"},null==L?void 0:L.message),t.createElement(d,null,t.createElement("label",{htmlFor:"pictureInput"},t.createElement("input",{id:"pictureInput",accept:w,multiple:k,type:"file",name:"files",ref:T,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}}));B(t),S(r)}},style:{display:"none"}})),null!==A&&t.createElement(c,{text:"upload",loadingText:"loading"})))))}export{y as UploadMediaForm};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__read as e,__assign as t,__spreadArray as n}from"../../../../node_modules/tslib/tslib.es6.js";import a,{useState as r}from"react";import m from"@mui/material/Paper";import o from"@mui/material/Box";import i from"@mui/material/Stack";import c from"@mui/material/Alert";import l from"@mui/material/TextField";import s from"@mui/material/Typography";import{SubmitButton as d}from"../../SubmitButton.js";import{useFormState as u}from"react-dom";import{StrapiErrors as p}from"../../StrapiErrors.js";import{updateVendorAction as f}from"../../../data/actions/logistics/vendor/updateVendorAction.js";import E from"@mui/material/Grid";import{BusinessCredentialsFields as v}from"../../e-commerce/customer/BusinessCredentials.js";import{AddressFields as g}from"../../common/Address.js";import b from"../../e-commerce/products/ProductSelector.js";import x,{ContactsFields as h}from"../../common/Contacts.js";import
|
|
7
|
+
import{__read as e,__assign as t,__spreadArray as n}from"../../../../node_modules/tslib/tslib.es6.js";import a,{useState as r}from"react";import m from"@mui/material/Paper";import o from"@mui/material/Box";import i from"@mui/material/Stack";import c from"@mui/material/Alert";import l from"@mui/material/TextField";import s from"@mui/material/Typography";import{SubmitButton as d}from"../../SubmitButton.js";import{useFormState as u}from"react-dom";import{StrapiErrors as p}from"../../StrapiErrors.js";import{updateVendorAction as f}from"../../../data/actions/logistics/vendor/updateVendorAction.js";import E from"@mui/material/Grid";import{BusinessCredentialsFields as v}from"../../e-commerce/customer/BusinessCredentials.js";import{AddressFields as g}from"../../common/Address.js";import b from"../../e-commerce/products/ProductSelector.js";import x,{ContactsFields as h}from"../../common/Contacts.js";import _ from"@mui/material/IconButton";import y from"@mui/icons-material/Add";import{ContactType as N}from"../../../types/common/Contact.js";var j={zodErrors:null,strapiErrors:null,data:null,message:null};function C(C){var k=C.data,A=C.productNamesArr;C.revalidateCallback;var R=k.id,V=k.website_url,w=k.phone_number,B=k.email,P=k.business_credentials,S=k.address,I=k.products,T=k.contacts;console.log("data",k);var z=e(u(f,j),2),F=z[0],G=z[1],M=(null==I?void 0:I.data)||[],O=e(r([]),2),U=O[0],W=O[1],q=function(t,a){U.includes(a)?W(U.filter((function(e){return e!==a}))):W(n(n([],e(U),!1),[a],!1))},D=e(r(T.reduce((function(e,t,n){return e.push({componentName:"contacts[".concat(n,"]"),componentReference:"logistics-elements.contact",data:t}),e}),[])),2),H=D[0],J=D[1],K=e(r([]),2),L=K[0],Q=K[1];return a.createElement(o,{component:m,sx:{p:2}},a.createElement("form",{action:G},R&&a.createElement("input",{id:"id",type:"hidden",name:"id",value:R}),a.createElement(E,{container:!0,spacing:2},a.createElement(E,{item:!0,xs:12},a.createElement(s,{variant:"h5"},"Edit Vendor")),a.createElement(E,{item:!0,xs:12,md:6},a.createElement(v,{data:P,componentName:"business_credentials",componentReference:"common.business-credentials"})),a.createElement(E,{item:!0,xs:12,md:6},a.createElement(i,{spacing:2},a.createElement(l,{id:"website_url",name:"website_url",label:"Website Url",defaultValue:V}),a.createElement(l,{id:"phone_number",name:"phone_number",label:"Phone Number",defaultValue:w}),a.createElement(l,{id:"email",name:"email",label:"Email",defaultValue:B}))),a.createElement(E,{item:!0,xs:12,md:6},a.createElement(s,{variant:"h6"},"Address"),a.createElement(g,{data:S,componentName:"address",componentReference:"common.address"})),a.createElement(E,{item:!0,xs:12,sx:{mt:1}},a.createElement(s,{variant:"h6"},"Products"),a.createElement(b,{productNames:A,currentValue:M.map((function(e){return e.id}))})),a.createElement(E,{item:!0,xs:12,sx:{mt:1}},a.createElement(s,{variant:"h6"},"Contacts")),null==H?void 0:H.map((function(e,n){var r,m;return(null===(r=e.data)||void 0===r?void 0:r.id)?U.includes(null===(m=e.data)||void 0===m?void 0:m.id)?a.createElement(E,{item:!0,xs:12,md:6,lg:4,key:e.data.id},a.createElement(h,{data:e.data,componentName:"contacts[".concat(n,"]"),componentReference:"logistics-elements.contact",deleteCallback:function(){J(H.filter((function(e,t){return t!==n})))}})):a.createElement(E,{item:!0,xs:12,md:6,lg:4,key:e.data.id},a.createElement("input",{type:"hidden",name:"contacts[".concat(n,"].id"),value:e.data.id}),a.createElement("input",{type:"hidden",name:"contacts[".concat(n,"].__component"),value:"logistics-elements.contact"}),a.createElement(x,{data:t(t({},e.data),{onClick:q})})):null})),L.map((function(e,n){var r;return a.createElement(E,{item:!0,xs:12,md:6,lg:4,key:null===(r=e.data)||void 0===r?void 0:r.uuid},a.createElement(h,{data:e.data,componentName:e.componentName,componentReference:"logistics-elements.contact",deleteCallback:function(){Q(L.filter((function(e,t){return t!==n})).map((function(e,n){return t(t({},e),{componentName:"contacts[".concat(n+H.length,"]")})})))}}))})),a.createElement(E,{item:!0,xs:12,md:6,lg:4,justifyContent:"center",alignItems:"center"},a.createElement(_,{onClick:function(){Q(n(n([],e(L),!1),[{componentName:"contacts[".concat(H.length+L.length,"]"),componentReference:"logistics-elements.contact",data:{uuid:Math.random(),first_name:"",last_name:"",email:"",phone_number:"",type:N.Other}}],!1))}},a.createElement(y,null))),a.createElement(E,{item:!0,xs:12},a.createElement(i,{direction:"row-reverse",spacing:2,alignItems:"center",sx:{py:1}},a.createElement(d,{text:"update vendor",loadingText:"loading"}),(null==F?void 0:F.strapiErrors)&&a.createElement(p,{error:null==F?void 0:F.strapiErrors}),(null==F?void 0:F.message)&&a.createElement(c,{severity:"error"},null==F?void 0:F.message))))))}export{C as EditVendorForm};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__awaiter as e,__generator as r,__assign as t}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as
|
|
7
|
+
import{__awaiter as e,__generator as r,__assign as t}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as s}from"../../../services/mutate-data.js";import{flattenAttributes as a}from"../../../../lib/utils.js";import{parseFormData as o}from"../../../../lib/parseFormData.js";import{formatDate as i}from"../../../../../node_modules/date-fns/format.js";function n(n,d){return e(this,void 0,void 0,(function(){var e,m,l,p;return r(this,(function(r){switch(r.label){case 0:return Object.fromEntries(d),(e=o(d)).data.order_date?(m={data:{vendor_profile:e.data.vendors,custom_reference:e.data.custom_reference,order_date:i(e.data.order_date,"yyyy-MM-dd"),items:e.data.ipo_items}},0===JSON.parse(e.data.ipo_items).length?(console.log("No items in IPO"),[2,t(t({},n),{strapiErrors:null,message:"Please add items to the IPO."})]):(console.log("ipoData",m),[4,s("POST","/api/ipos",m)])):[2,t(t({},n),{strapiErrors:null,message:"Please select an Order Date."})];case 1:return(l=r.sent())?l.error?[2,t(t({},n),{strapiErrors:l.error,message:"Failed to Create IPO."})]:(p=a(l),[2,t(t({},n),{message:"New IPO Created",data:p,strapiErrors:null})]):[2,t(t({},n),{strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{n as createIPOAction};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
import{__awaiter as e,__generator as
|
|
6
|
+
import{__awaiter as e,__generator as r}from"../../../node_modules/tslib/tslib.es6.js";import{getAuthToken as t}from"./get-token.js";import{getStrapiURL as n}from"../../lib/utils.js";function o(o){return e(this,void 0,void 0,(function(){var e,s,a,i;return r(this,(function(r){switch(r.label){case 0:return[4,t()];case 1:if(!(e=r.sent()))throw new Error("No auth token found");s=n(),a=new URL("/api/upload",s),r.label=2;case 2:return r.trys.push([2,5,,6]),[4,fetch(a,{headers:{Authorization:"Bearer ".concat(e)},method:"POST",body:o})];case 3:return[4,r.sent().json()];case 4:return[2,r.sent()];case 5:throw i=r.sent(),console.error("Error uploading image:",i),i;case 6:return[2]}}))}))}function s(o,s){return e(this,void 0,void 0,(function(){var e,a,i,u,c;return r(this,(function(r){switch(r.label){case 0:return[4,t()];case 1:if(!(e=r.sent()))throw new Error("No auth token found");a=n(),i=new URL("/api/upload?id=".concat(s),a),(u=new FormData).append("fileInfo",JSON.stringify(o)),r.label=2;case 2:return r.trys.push([2,5,,6]),[4,fetch(i,{method:"POST",headers:{Authorization:"Bearer ".concat(e)},body:u})];case 3:return[4,r.sent().json()];case 4:return[2,r.sent()];case 5:throw c=r.sent(),console.error("Error updating image:",c),c;case 6:return[2]}}))}))}export{s as fileUpdateService,o as fileUploadService};
|