umwd-components 0.1.382 → 0.1.384

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.
@@ -0,0 +1,6 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+ import e from"react";import t from"@mui/material/Stack";import a from"@mui/material/TextField";import n from"@mui/material/Typography";import m from"@mui/material/Button";import l from"@mui/icons-material/AccountCircle";import r from"@mui/material/IconButton";import{Delete as i}from"@mui/icons-material";function c(a){var r=a.data,i=r.id,c=r.name,o=r.url;r.icon;var u=r.onClick;return e.createElement(t,null,e.createElement(t,{spacing:2,direction:"row"},e.createElement(l,null),e.createElement(t,null,e.createElement(n,null,c),e.createElement(n,null,o),u&&e.createElement(m,{onClick:function(e){i&&u(e,i)}},"Edit"))))}function o(n){var m=n.data,l=n.componentName,c=n.componentReference,o=n.deleteCallback,u=m||{},d=u.id,p=u.name,f=u.url;return e.createElement(t,{spacing:1},e.createElement("input",{id:"".concat(l,".__component"),type:"hidden",name:"".concat(l,".__component"),value:c}),d&&e.createElement("input",{id:"".concat(l,".id"),type:"hidden",name:"".concat(l,".id"),value:d}),e.createElement(t,{spacing:1,direction:"row"},e.createElement(a,{id:"name",name:"".concat(l,".name"),label:"Name of social media",defaultValue:p||""}),o&&e.createElement(r,{onClick:o},e.createElement(i,null))),e.createElement(a,{id:"url",name:"".concat(l,".url"),label:"URL",defaultValue:f||""}))}export{o as SocialsFields,c as default};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import{__assign as e}from"../../../node_modules/tslib/tslib.es6.js";import t from"react";import{useTheme as n}from"@mui/material/styles";import r from"@mui/material/AppBar";import a from"@mui/material/Container";import i from"@mui/material/Toolbar";import m from"@mui/material/Typography";import l from"@mui/material/Box";import o from"@mui/material/IconButton";import c from"@mui/material/Grid";import s from"@mui/material/Divider";import d from"@mui/material/Stack";import u from"next/link";import p from"next/image";import f from"../../lib/getIcon.js";import{StyledLink as E}from"../StyledLink.js";import y from"@mui/icons-material/Home";import x from"@mui/icons-material/Phone";import b from"@mui/icons-material/Email";function g(g){var h=g.data,v=h.site_title,_=h.logo,C=h.parent_company_name,j=h.business_credentials,w=h.address,I=h.socials,k=h.disclaimer_link,A=h.privacypolicy_link,D=h.maxWidth,T=void 0===D?"lg":D,F=h.referal,B=h.sx,P=void 0===B?{}:B,S=h.useIcons,W=void 0!==S&&S,G=n(),V=f("APIcon");return t.createElement(r,{position:"relative",sx:e({backgroundColor:"light"===G.palette.mode?G.palette.primary.light:G.palette.primary.dark,top:"auto",bottom:0},P),component:"footer"},t.createElement(a,{maxWidth:T},t.createElement(i,{disableGutters:!0},t.createElement(c,{container:!0,sx:{p:2},spacing:2},t.createElement(c,{item:!0,xs:12,sm:6,md:4,sx:[W&&{display:"grid",justifyContent:"center"}]},t.createElement(l,{sx:{display:{xs:"none",md:"flex"},cursor:"pointer",flexDirection:"column",alignItems:"center",justifyContent:"flex-start",height:"100%",textDecoration:"none"}},t.createElement(m,{variant:"h6",color:"#ffffff",sx:{mb:2},component:"h2"},v),void 0!==(null==_?void 0:_.url)&&t.createElement(u,{href:"#home"},t.createElement(l,{sx:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",p:1}},t.createElement(p,{src:_.url,width:_.width||100,height:_.height||100,alt:_.alternativeText||"site logo"}))))),t.createElement(c,{item:!0,xs:12,sm:6,md:4,sx:[W&&{display:"grid",justifyContent:"stretch",width:{xs:"80%",sm:"60%",md:"80%"}}]},t.createElement(m,{variant:"h6",sx:[{mb:2},W&&{textAlign:"center"}],component:"h2"},"Contact Information"),j&&t.createElement(t.Fragment,null,t.createElement(m,{id:"company_name",variant:"h6",component:"h3",sx:[{mb:2},W&&{textAlign:"center"}]},j.company_name),C&&t.createElement(m,{id:"parent_company_name",variant:"h6",component:"h4",sx:{mb:2,textAlign:"center"}},"By ",C)),!0===W?t.createElement(d,{spacing:1},w&&t.createElement(d,{direction:"row",justifyContent:"space-between"},t.createElement(y,null),t.createElement(d,{alignItems:"flex-end"},t.createElement(m,{variant:"body1"},w.street," ",w.street_number," ",w.street_number_addition&&w.street_number_addition),t.createElement(m,{variant:"body1"},w.postal_code," ",w.city))),t.createElement(d,{direction:"row",justifyContent:"space-between"},t.createElement(x,null),t.createElement(m,{variant:"body1"},"+3133867606")),t.createElement(d,{direction:"row",justifyContent:"space-between"},t.createElement(b,null),t.createElement(m,{variant:"body1"},"info@jellepaulus.nl")),j&&t.createElement(t.Fragment,null,t.createElement(d,{direction:"row",justifyContent:"space-between"},t.createElement(m,{variant:"body1"},"CoC:"),t.createElement(m,{variant:"body1"},j.coc_number)),t.createElement(d,{direction:"row",justifyContent:"space-between"},t.createElement(m,{variant:"body1"},"VAT:"),t.createElement(m,{variant:"body1",align:"right"},j.vat_number)))):t.createElement(t.Fragment,null,w&&t.createElement(t.Fragment,null,t.createElement(m,{variant:"body1"},w.street," ",w.street_number," ",w.street_number_addition&&w.street_number_addition),t.createElement(m,{variant:"body1"},w.postal_code," ",w.city),t.createElement(m,{variant:"body1"},w.country),j&&t.createElement(t.Fragment,null,t.createElement(m,{variant:"body1"},j.company_name," by"," ",C),t.createElement(m,{variant:"body1"},"CoC: ",j.coc_number),t.createElement(m,{variant:"body1"},"VAT: ",j.vat_number))))),t.createElement(c,{item:!0,xs:12,sm:6,md:4,sx:[W&&{display:"grid",justifyContent:"center"}]},I&&I.length>0&&t.createElement(t.Fragment,null,t.createElement(m,{variant:"h6",sx:{mb:2},component:"h2"},"Socials"),t.createElement(d,{spacing:2,sx:{width:"min-content",color:"primary.contrastText",alignContent:"space-between"}},I.map((function(e,n){var r=f(e.icon);return t.createElement(E,{href:e.url,key:n},t.createElement(o,{key:n,color:"inherit",size:"large"},null!==r&&t.createElement(r,null)))}))))),t.createElement(c,{item:!0,xs:12},t.createElement(s,null)),t.createElement(c,{item:!0,xs:12},t.createElement(d,{direction:{xs:"column",sm:"row"},alignItems:"center",gap:2,justifyContent:"space-around"},k&&t.createElement(E,{href:k},t.createElement(m,{variant:"body1",color:"#ffffff"},"Disclaimer")),A&&t.createElement(E,{href:A},t.createElement(m,{variant:"body1",color:"#ffffff"},"Privacy Policy")))),Boolean(k||A)&&t.createElement(c,{item:!0,xs:12},t.createElement(s,null)),t.createElement(c,{item:!0,xs:12,sx:{display:"flex",justifyContent:"center",alignItems:"center",pb:"50px"}},F||t.createElement(E,{href:"https://atelierpaulus.nl/"},t.createElement(m,{color:"secondary.contrastText",sx:{textDecoration:"underline",verticalAlign:"middle",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:{xs:"column",sm:"row"},gap:2}},"Design & Webdevelopment",null!==V&&t.createElement(V,{sx:{mx:2}}),"Atelier Paulus")))))))}export{g as default};
7
+ import{__assign as e}from"../../../node_modules/tslib/tslib.es6.js";import t from"react";import{useTheme as n}from"@mui/material/styles";import r from"@mui/material/AppBar";import a from"@mui/material/Container";import i from"@mui/material/Toolbar";import m from"@mui/material/Typography";import l from"@mui/material/Box";import o from"@mui/material/IconButton";import c from"@mui/material/Grid";import s from"@mui/material/Divider";import d from"@mui/material/Stack";import p from"next/link";import u from"next/image";import f from"../../lib/getIcon.js";import{StyledLink as E}from"../StyledLink.js";import y from"@mui/icons-material/Home";import x from"@mui/icons-material/Phone";import b from"@mui/icons-material/Email";function g(g){var h=g.data,v=h.site_title,_=h.logo,C=h.parent_company_name,j=h.business_credentials,w=h.address,I=h.socials,k=h.disclaimer_link,A=h.privacypolicy_link,D=h.maxWidth,T=void 0===D?"lg":D,F=h.referal,B=h.sx,P=void 0===B?{}:B,S=h.useIcons,W=void 0!==S&&S,G=n(),V=f("APIcon");return t.createElement(r,{position:"relative",sx:e({backgroundColor:"light"===G.palette.mode?G.palette.primary.light:G.palette.primary.dark,top:"auto",bottom:0},P),component:"footer"},t.createElement(a,{maxWidth:T},t.createElement(i,{disableGutters:!0},t.createElement(c,{container:!0,sx:{p:2},spacing:2},t.createElement(c,{item:!0,xs:12,sm:6,md:4,sx:[W&&{display:"grid",justifyContent:"center"}]},t.createElement(l,{sx:{display:{xs:"none",md:"flex"},cursor:"pointer",flexDirection:"column",alignItems:"center",justifyContent:"flex-start",height:"100%",textDecoration:"none"}},t.createElement(m,{variant:"h6",color:"#ffffff",sx:{mb:2},component:"h2"},v),void 0!==(null==_?void 0:_.url)&&t.createElement(p,{href:"#home"},t.createElement(l,{sx:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",p:1}},t.createElement(u,{src:_.url,width:_.width||100,height:_.height||100,alt:_.alternativeText||"site logo"}))))),t.createElement(c,{item:!0,xs:12,sm:6,md:4,sx:[W&&{display:"grid",justifyContent:"stretch",width:{xs:"80%",sm:"60%",md:"80%"}}]},t.createElement(m,{variant:"h6",sx:[{mb:2},W&&{textAlign:"center"}],component:"h2"},"Contact Information"),j&&t.createElement(t.Fragment,null,t.createElement(m,{id:"company_name",variant:"h6",component:"h3",sx:[{mb:2},W&&{textAlign:"center"}]},j.company_name),C&&t.createElement(m,{id:"parent_company_name",variant:"h6",component:"h4",sx:{mb:2,textAlign:"center"}},"By ",C)),!0===W?t.createElement(d,{spacing:1},w&&t.createElement(d,{direction:"row",justifyContent:"space-between"},t.createElement(y,null),t.createElement(d,{alignItems:"flex-end"},t.createElement(m,{variant:"body1"},w.street," ",w.street_number," ",w.street_number_addition&&w.street_number_addition),t.createElement(m,{variant:"body1"},w.postal_code," ",w.city))),t.createElement(d,{direction:"row",justifyContent:"space-between"},t.createElement(x,null),t.createElement(m,{variant:"body1"},"+3133867606")),t.createElement(d,{direction:"row",justifyContent:"space-between"},t.createElement(b,null),t.createElement(m,{variant:"body1"},"info@jellepaulus.nl")),j&&t.createElement(t.Fragment,null,t.createElement(d,{direction:"row",justifyContent:"space-between"},t.createElement(m,{variant:"body1"},"CoC:"),t.createElement(m,{variant:"body1"},j.coc_number)),t.createElement(d,{direction:"row",justifyContent:"space-between"},t.createElement(m,{variant:"body1"},"VAT:"),t.createElement(m,{variant:"body1",align:"right"},j.vat_number)))):t.createElement(t.Fragment,null,w&&t.createElement(t.Fragment,null,t.createElement(m,{variant:"body1"},w.street," ",w.street_number," ",w.street_number_addition&&w.street_number_addition),t.createElement(m,{variant:"body1"},w.postal_code," ",w.city),j&&t.createElement(t.Fragment,null,t.createElement(m,{variant:"body1"},j.company_name," by"," ",C),t.createElement(m,{variant:"body1"},"CoC: ",j.coc_number),t.createElement(m,{variant:"body1"},"VAT: ",j.vat_number))))),t.createElement(c,{item:!0,xs:12,sm:6,md:4,sx:[W&&{display:"grid",justifyContent:"center"}]},I&&I.length>0&&t.createElement(t.Fragment,null,t.createElement(m,{variant:"h6",sx:{mb:2},component:"h2"},"Socials"),t.createElement(d,{spacing:2,sx:{width:"min-content",color:"primary.contrastText",alignContent:"space-between"}},I.map((function(e,n){var r=f(e.icon);return t.createElement(E,{href:e.url,key:n},t.createElement(o,{key:n,color:"inherit",size:"large"},null!==r&&t.createElement(r,null)))}))))),t.createElement(c,{item:!0,xs:12},t.createElement(s,null)),t.createElement(c,{item:!0,xs:12},t.createElement(d,{direction:{xs:"column",sm:"row"},alignItems:"center",gap:2,justifyContent:"space-around"},k&&t.createElement(E,{href:k},t.createElement(m,{variant:"body1",color:"#ffffff"},"Disclaimer")),A&&t.createElement(E,{href:A},t.createElement(m,{variant:"body1",color:"#ffffff"},"Privacy Policy")))),Boolean(k||A)&&t.createElement(c,{item:!0,xs:12},t.createElement(s,null)),t.createElement(c,{item:!0,xs:12,sx:{display:"flex",justifyContent:"center",alignItems:"center",pb:"50px"}},F||t.createElement(E,{href:"https://atelierpaulus.nl/"},t.createElement(m,{color:"secondary.contrastText",sx:{textDecoration:"underline",verticalAlign:"middle",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:{xs:"column",sm:"row"},gap:2}},"Design & Webdevelopment",null!==V&&t.createElement(V,{sx:{mx:2}}),"Atelier Paulus")))))))}export{g as default};
@@ -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,useEffect as o}from"react";import m from"@mui/material/Paper";import c from"@mui/material/Box";import i from"@mui/material/Stack";import l from"@mui/material/Alert";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{StrapiErrors as f}from"../../StrapiErrors.js";import{updateVendorAction as E}from"../../../data/actions/logistics/vendor/updateVendorAction.js";import g from"@mui/material/Grid";import{BusinessCredentialsFields as v}from"../../e-commerce/customer/BusinessCredentials.js";import{AddressFields as b}from"../../common/Address.js";import x from"../../e-commerce/products/ProductSelector.js";import h,{ContactsFields as y}from"../../common/Contacts.js";import _ from"@mui/material/IconButton";import C from"@mui/icons-material/Add";import{ContactType as j}from"../../../types/common/Contact.js";var k={zodErrors:null,strapiErrors:null,data:null,message:null};function N(N){var A=N.data,R=N.productNamesArr;N.revalidateCallback;var V=A.id,w=A.website_url,B=A.phone_number,P=A.email,S=A.business_credentials,I=A.address,T=A.products,z=A.contacts;console.log("data",A);var F=e(p(E,k),2),G=F[0],O=F[1],U=e(r([]),2),W=U[0],q=U[1],D=(null==T?void 0:T.data)||[],H=e(r([]),2),J=H[0],K=H[1],L=e(r(z.reduce((function(e,t,n){return e.push({componentName:"contacts[".concat(n,"]"),componentReference:"logistics-elements.contact",data:t}),e}),[])),2),M=L[0],Q=L[1],X=function(t,a){J.includes(a)?K(J.filter((function(e){return e!==a}))):K(n(n([],e(J),!1),[a],!1))};return o((function(){console.log("oldContacts changed:",M)}),[M]),o((function(){console.log("newContacts changed:",W)}),[W]),a.createElement(c,{component:m,sx:{p:2}},a.createElement("form",{action:O},V&&a.createElement("input",{id:"id",type:"hidden",name:"id",value:V}),a.createElement(g,{container:!0,spacing:2},a.createElement(g,{item:!0,xs:12},a.createElement(d,{variant:"h5"},"Edit Vendor")),a.createElement(g,{item:!0,xs:12,md:6},a.createElement(v,{data:S,componentName:"business_credentials",componentReference:"common.business-credentials"})),a.createElement(g,{item:!0,xs:12,md:6},a.createElement(i,{spacing:2},a.createElement(s,{id:"website_url",name:"website_url",label:"Website Url",defaultValue:w}),a.createElement(s,{id:"phone_number",name:"phone_number",label:"Phone Number",defaultValue:B}),a.createElement(s,{id:"email",name:"email",label:"Email",defaultValue:P}))),a.createElement(g,{item:!0,xs:12,md:6},a.createElement(d,{variant:"h6"},"Address"),a.createElement(b,{data:I,componentName:"address",componentReference:"common.address"})),a.createElement(g,{item:!0,xs:12,sx:{mt:1}},a.createElement(d,{variant:"h6"},"Products"),a.createElement(x,{productNames:R,currentValue:D.map((function(e){return e.id}))})),a.createElement(g,{item:!0,xs:12,sx:{mt:1}},a.createElement(d,{variant:"h6"},"Contacts")),null==M?void 0:M.map((function(e,n){var r,o;return(null===(r=e.data)||void 0===r?void 0:r.id)?J.includes(null===(o=e.data)||void 0===o?void 0:o.id)?a.createElement(g,{item:!0,xs:12,md:6,lg:4,key:e.data.id},a.createElement(y,{data:e.data,componentName:"contacts[".concat(n,"]"),componentReference:"logistics-elements.contact",deleteCallback:function(){Q(M.filter((function(e,t){return t!==n})))}})):a.createElement(g,{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(h,{data:t(t({},e.data),{onClick:X})})):null})),W.map((function(e,t){return a.createElement(g,{item:!0,xs:12,md:6,lg:4,key:t},a.createElement(y,{key:t,data:e.data,componentName:e.componentName,componentReference:"logistics-elements.contact",deleteCallback:function(){q(W.filter((function(e,n){return n!==t})))}}))})),a.createElement(g,{item:!0,xs:12,md:6,lg:4,justifyContent:"center",alignItems:"center"},a.createElement(_,{onClick:function(){q(n(n([],e(W),!1),[{componentName:"contacts[".concat(z.length+W.length,"]"),componentReference:"logistics-elements.contact",data:{first_name:"",last_name:"",email:"",phone_number:"",type:j.Other}}],!1))}},a.createElement(C,null))),a.createElement(g,{item:!0,xs:12},a.createElement(i,{direction:"row-reverse",spacing:2,alignItems:"center",sx:{py:1}},a.createElement(u,{text:"update vendor",loadingText:"loading"}),(null==G?void 0:G.strapiErrors)&&a.createElement(f,{error:null==G?void 0:G.strapiErrors}),(null==G?void 0:G.message)&&a.createElement(l,{severity:"error"},null==G?void 0:G.message))))))}export{N as EditVendorForm};
7
+ import{__read as e,__spreadArray as t,__assign 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 y from"@mui/material/IconButton";import _ 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=C.sx,V=k.id,w=k.website_url,B=k.phone_number,P=k.email,S=k.business_credentials,I=k.address,T=k.products,z=k.contacts;console.log("data",k);var F=e(u(f,j),2),G=F[0],M=F[1],O=(null==T?void 0:T.data)||[],U=e(r([]),2),W=U[0],q=U[1],D=function(n,a){W.includes(a)?q(W.filter((function(e){return e!==a}))):q(t(t([],e(W),!1),[a],!1))},H=e(r(z.reduce((function(e,t,n){return e.push({componentName:"contacts[".concat(n,"]"),componentReference:"logistics-elements.contact",data:t}),e}),[])),2),J=H[0],K=H[1],L=e(r([]),2),Q=L[0],X=L[1];return a.createElement(o,{sx:t([{p:2}],e(Array.isArray(R)?R:[R]),!1),component:m},a.createElement("form",{action:M},V&&a.createElement("input",{id:"id",type:"hidden",name:"id",value:V}),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:S,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:w}),a.createElement(l,{id:"phone_number",name:"phone_number",label:"Phone Number",defaultValue:B}),a.createElement(l,{id:"email",name:"email",label:"Email",defaultValue:P}))),a.createElement(E,{item:!0,xs:12,md:6},a.createElement(s,{variant:"h6"},"Address"),a.createElement(g,{data:I,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:O.map((function(e){return e.id}))})),a.createElement(E,{item:!0,xs:12,sx:{mt:1}},a.createElement(s,{variant:"h6"},"Contacts")),null==J?void 0:J.map((function(e,t){var r,m;return(null===(r=e.data)||void 0===r?void 0:r.id)?W.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(t,"]"),componentReference:"logistics-elements.contact",deleteCallback:function(){K(J.filter((function(e,n){return n!==t})))}})):a.createElement(E,{item:!0,xs:12,md:6,lg:4,key:e.data.id},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(x,{data:n(n({},e.data),{onClick:D})})):null})),Q.map((function(e,t){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(){X(Q.filter((function(e,n){return n!==t})).map((function(e,t){return n(n({},e),{componentName:"contacts[".concat(t+J.length,"]")})})))}}))})),a.createElement(E,{item:!0,xs:12,md:6,lg:4,justifyContent:"center",alignItems:"center"},a.createElement(y,{onClick:function(){X(t(t([],e(Q),!1),[{componentName:"contacts[".concat(J.length+Q.length,"]"),componentReference:"logistics-elements.contact",data:{uuid:Math.random(),first_name:"",last_name:"",email:"",phone_number:"",type:N.Other}}],!1))}},a.createElement(_,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==G?void 0:G.strapiErrors)&&a.createElement(p,{error:null==G?void 0:G.strapiErrors}),(null==G?void 0:G.message)&&a.createElement(c,{severity:"error"},null==G?void 0:G.message))))))}export{C as EditVendorForm};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import{__read as e,__spreadArray as r}from"../../../node_modules/tslib/tslib.es6.js";import t from"@mui/material/Divider";import a from"@mui/material/Paper";import i from"@mui/material/Box";import m from"@mui/material/Stack";import n from"@mui/material/Alert";import o from"@mui/material/TextField";import l from"@mui/material/Typography";import{SubmitButton as s}from"../SubmitButton.js";import{useFormState as c}from"react-dom";import{StrapiErrors as d}from"../StrapiErrors.js";import{BusinessCredentialsFields as p}from"../e-commerce/customer/BusinessCredentials.js";import u from"react";import{AddressFields as f}from"../common/Address.js";import{updatePublicInformationAction as E}from"../../data/actions/public-information/updatePublicInformationAction.js";var b={zodErrors:null,strapiErrors:null,data:null,message:null};function v(v){var g=v.publicInformation,h=v.sx;console.log(g);var _=g.id,y=g.title,x=g.description;g.disclaimer_link,g.privacypolicy_link,g.maxWidth;var j=g.email,A=g.phone_number,B=g.business_credentials,T=g.address;g.socials,g.header_logo,g.footer_logo;var V=e(c(E,b),2),k=V[0],C=V[1];return u.createElement(i,{sx:r([{p:2}],e(Array.isArray(h)?h:[h]),!1),component:a},u.createElement("form",{action:C},u.createElement("input",{id:"id",type:"hidden",name:"id",value:_}),u.createElement(m,{spacing:2},u.createElement(o,{id:"title",name:"title",label:"Title",defaultValue:y}),u.createElement(o,{id:"description",name:"description",label:"Description",defaultValue:x}),u.createElement(o,{id:"email",name:"email",label:"email",defaultValue:j}),u.createElement(o,{id:"phone_number",name:"phone_number",label:"phone_number",defaultValue:A}),u.createElement(l,{variant:"h6"},"Company Address"),u.createElement(t,null),u.createElement(f,{componentName:"address",componentReference:"common.address",data:T}),u.createElement(t,null),u.createElement(l,{variant:"h6"},"Business Credentials"),u.createElement(p,{componentName:"business_credentials",componentReference:"business.credentials",data:B}),u.createElement(m,{direction:"row-reverse",spacing:2,alignItems:"center",sx:{py:1}},u.createElement(s,{text:"save changes",loadingText:"loading"}),u.createElement(d,{error:null==k?void 0:k.strapiErrors}),(null==k?void 0:k.message)&&u.createElement(n,{severity:"error"},null==k?void 0:k.message)))))}export{v as PublicInformationForm};
7
+ import{__read as e,__spreadArray as t,__assign as n}from"../../../node_modules/tslib/tslib.es6.js";import a from"@mui/material/Divider";import r from"@mui/material/Paper";import i from"@mui/material/Box";import m from"@mui/material/Stack";import o from"@mui/material/Alert";import l from"@mui/material/TextField";import c from"@mui/material/Typography";import s from"@mui/material/Grid";import{SubmitButton as d}from"../SubmitButton.js";import{useFormState as u}from"react-dom";import{StrapiErrors as p}from"../StrapiErrors.js";import{BusinessCredentialsFields as f}from"../e-commerce/customer/BusinessCredentials.js";import E,{useState as v}from"react";import{AddressFields as g}from"../common/Address.js";import{updatePublicInformationAction as b}from"../../data/actions/public-information/updatePublicInformationAction.js";import h,{SocialsFields as x}from"../common/socials/Socials.js";import y from"@mui/material/IconButton";import _ from"@mui/icons-material/Add";var k={zodErrors:null,strapiErrors:null,data:null,message:null};function j(j){var C=j.publicInformation,N=j.sx;console.log(C);var A=C.id,S=C.title,I=C.description;C.disclaimer_link,C.privacypolicy_link,C.maxWidth;var R=C.email,B=C.phone_number,T=C.business_credentials,V=C.address,P=C.socials;C.header_logo,C.footer_logo;var D=e(u(b,k),2),w=D[0],z=D[1],F=e(v([]),2),G=F[0],M=F[1],W=function(n,a){G.includes(a)?M(G.filter((function(e){return e!==a}))):M(t(t([],e(G),!1),[a],!1))},q=e(E.useState(P.reduce((function(e,t,n){return e.push({data:t,componentName:"socials[".concat(n,"]"),componentReference:"common.social"}),e}),[])),2),H=q[0],J=q[1],K=e(E.useState([]),2),L=K[0],O=K[1];return E.createElement(i,{sx:t([{p:2}],e(Array.isArray(N)?N:[N]),!1),component:r},E.createElement("form",{action:z},A&&E.createElement("input",{id:"id",type:"hidden",name:"id",value:A}),E.createElement(s,{container:!0,spacing:2},E.createElement(s,{item:!0,xs:12},E.createElement(c,{variant:"h5"},"Edit Public Information")),E.createElement(s,{item:!0,xs:12},E.createElement(m,{spacing:2},E.createElement(l,{id:"title",name:"title",label:"Title",defaultValue:S}),E.createElement(l,{id:"description",name:"description",label:"Description",defaultValue:I}),E.createElement(l,{id:"email",name:"email",label:"email",defaultValue:R}),E.createElement(l,{id:"phone_number",name:"phone_number",label:"phone_number",defaultValue:B}))),E.createElement(s,{item:!0,xs:12,lg:6},E.createElement(m,{spacing:2},E.createElement(c,{variant:"h6"},"Company Address"),E.createElement(a,null),E.createElement(g,{componentName:"address",componentReference:"common.address",data:V}))),E.createElement(s,{item:!0,xs:12,lg:6},E.createElement(m,{spacing:2},E.createElement(c,{variant:"h6"},"Business Credentials"),E.createElement(a,null),E.createElement(f,{componentName:"business_credentials",componentReference:"business.credentials",data:T}))),E.createElement(s,{item:!0,xs:12,sx:{mt:1}},E.createElement(c,{variant:"h6"},"Socials")),H.map((function(e,t){var a,r;return(null===(a=e.data)||void 0===a?void 0:a.id)?G.includes(null===(r=e.data)||void 0===r?void 0:r.id)?E.createElement(s,{item:!0,xs:12,md:6,lg:4,key:e.data.id},E.createElement(x,{data:e.data,componentName:"socials[".concat(t,"]"),componentReference:"common.social",deleteCallback:function(){J(H.filter((function(e,n){return n!==t})))}})):E.createElement(s,{item:!0,xs:12,md:6,lg:4,key:e.data.id},E.createElement("input",{type:"hidden",name:"socials[".concat(t,"].id"),value:e.data.id}),E.createElement("input",{type:"hidden",name:"socials[".concat(t,"].__component"),value:"logistics-elements.social"}),E.createElement(h,{data:n(n({},e.data),{onClick:W})})):null})),L.map((function(e,t){var a;return E.createElement(s,{item:!0,xs:12,md:6,lg:4,key:null===(a=e.data)||void 0===a?void 0:a.uuid},E.createElement(x,{data:e.data,componentName:e.componentName,componentReference:"common.social",deleteCallback:function(){O(L.filter((function(e,n){return n!==t})).map((function(e,t){return n(n({},e),{componentName:"socials[".concat(t+H.length,"]")})})))}}))})),E.createElement(s,{item:!0,xs:12,md:6,lg:4,justifyContent:"center",alignItems:"center"},E.createElement(y,{onClick:function(){O(t(t([],e(L),!1),[{componentName:"socials[".concat(H.length+L.length,"]"),componentReference:"logistics-elements.social",data:{uuid:Math.random(),name:"",url:""}}],!1))}},E.createElement(_,null))),E.createElement(s,{item:!0,xs:12},E.createElement(m,{direction:"row-reverse",spacing:2,alignItems:"center",sx:{py:1}},E.createElement(d,{text:"save changes",loadingText:"loading"}),(null==w?void 0:w.strapiErrors)&&E.createElement(p,{error:null==w?void 0:w.strapiErrors}),(null==w?void 0:w.message)&&E.createElement(o,{severity:"error"},null==w?void 0:w.message))))))}export{j as PublicInformationForm};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import{__awaiter as r,__generator as o,__assign as t}from"../../../../node_modules/tslib/tslib.es6.js";import{mutateData as e}from"../../services/mutate-data.js";import{flattenAttributes as s}from"../../../lib/utils.js";import{parseFormData as a}from"../../../lib/parseFormData.js";import{vatValidate as i}from"../../../lib/vatValidate.js";function n(n,l){return r(this,void 0,void 0,(function(){var r,m,p,u,c;return o(this,(function(o){switch(o.label){case 0:return r=Object.fromEntries(l),console.log("rawFormData",r),m=a(l),console.log("parsedFormData",m),r.id,p=i("NL123456789B01"),console.log("validateRes",p),[4,e("PUT","/api/public-information",m)];case 1:return(u=o.sent())?u.error?[2,t(t({},n),{strapiErrors:u.error,message:"Failed to Register."})]:(c=s(u),[2,t(t({},n),{message:"Public Information Updated",data:c,strapiErrors:null})]):[2,t(t({},n),{strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{n as updatePublicInformationAction};
7
+ import{__awaiter as r,__generator as t,__assign as o}from"../../../../node_modules/tslib/tslib.es6.js";import{mutateData as e}from"../../services/mutate-data.js";import{flattenAttributes as s}from"../../../lib/utils.js";import{parseFormData as i}from"../../../lib/parseFormData.js";function a(a,n){return r(this,void 0,void 0,(function(){var r,l,m,p;return t(this,(function(t){switch(t.label){case 0:return r=Object.fromEntries(n),console.log("rawFormData",r),l=i(n),console.log("parsedFormData",l),r.id,[4,e("PUT","/api/public-information",l)];case 1:return(m=t.sent())?m.error?[2,o(o({},a),{strapiErrors:m.error,message:"Failed to Register."})]:(p=s(m),[2,o(o({},a),{message:"Public Information Updated",data:p,strapiErrors:null})]):[2,o(o({},a),{strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{a as updatePublicInformationAction};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import{__awaiter as i,__generator as r}from"../../../../node_modules/tslib/tslib.es6.js";import e from"../../../../node_modules/qs/lib/index.js";import{fetchData as s}from"../loaders.js";import{getStrapiURL as o,flattenAttributes as t}from"../../../lib/utils.js";import{unstable_noStore as n}from"next/cache";var a=o();function l(){return i(this,void 0,void 0,(function(){var i,o;return r(this,(function(r){switch(r.label){case 0:return n(),(i=new URL("/api/public-information",a)).search=e.stringify({populate:{address:!0,business_credentials:!0}}),o=t,[4,s(i.href)];case 1:return[2,o.apply(void 0,[r.sent()])]}}))}))}export{l as getPublicInformation};
7
+ import{__awaiter as i,__generator as r}from"../../../../node_modules/tslib/tslib.es6.js";import s from"../../../../node_modules/qs/lib/index.js";import{fetchData as e}from"../loaders.js";import{getStrapiURL as o,flattenAttributes as t}from"../../../lib/utils.js";import{unstable_noStore as n}from"next/cache";var a=o();function l(){return i(this,void 0,void 0,(function(){var i,o;return r(this,(function(r){switch(r.label){case 0:return n(),(i=new URL("/api/public-information",a)).search=s.stringify({populate:{address:!0,business_credentials:!0,socials:!0}}),o=t,[4,e(i.href)];case 1:return[2,o.apply(void 0,[r.sent()])]}}))}))}export{l as getPublicInformation};