umwd-components 0.1.560 → 0.1.562

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import{__read as e,__assign as a,__awaiter as t,__generator as r}from"../../node_modules/tslib/tslib.es6.js";import n from"react";import i from"@mui/material/Container";import l from"@mui/material/Paper";import m from"@mui/material/TextField";import o from"@mui/material/Typography";import s from"@mui/material/Stack";import u from"@mui/material/Button";import c from"validator/lib/isEmail";import{setOpacity as d}from"../lib/utils.js";import{useTheme as g}from"@mui/material/styles";function p(p){var v=this,b=p.data,f=b.title,h=void 0===f?"Write us":f,E=b.subtitle,j=void 0===E?"We're open for any suggestion or just to have a chat":E,x=b.successHeading,y=void 0===x?"Thank you!":x,S=b.successText,C=void 0===S?"Your e-mail has been successfully sent!":S,T=b.errorHeading,k=b.errorText,w=void 0===k?"I am sorry, something went wrong, you could email me directly on info@jellepaulus.nl":k,B=b.maxWidth,q=b.sx,W=void 0===q?{}:q,N=b.glass,O=void 0!==N&&N,F=e(n.useState({name:"",email:"",subject:"",message:""}),2),H=F[0],I=F[1],M=e(n.useState({}),2),P=M[0],D=M[1],J=e(n.useState("Send"),2);J[0],J[1];var R=e(n.useState(!1),2),Y=R[0],_=R[1],z=e(n.useState(!1),2),A=z[0],G=z[1],K=function(e){var t,r=e.target,n=r.name,i=r.value;I(a(a({},H),((t={})[n]=i,t)))},L=function(e){var t=e.target.name,r=Q(H);r[t]?D((function(e){var n;return a(a({},e),((n={})[t]=r[t],n))})):D((function(e){var r=a({},e);return delete r[t],r}))},Q=function(e){var a={};return""===e.name&&(a.name="Name is required"),""===e.email?a.email="Email is required":c(e.email)||(a.email="Invalid email"),""===e.subject&&(a.subject="Subject is required"),""===e.message&&(a.message="Message is required"),console.log("errors from validate",a),a},U=g();return n.createElement(i,{maxWidth:B||"lg",sx:a({my:1},W)},n.createElement(s,{spacing:2,sx:{width:"100%"}},n.createElement(o,{variant:"h6",align:"center"},h),n.createElement(o,{variant:"body1",align:"center",sx:{pb:3}},j),Y&&n.createElement(l,{sx:{p:2}},n.createElement(s,{spacing:2},n.createElement(o,{variant:"h6"},y),n.createElement(o,null,C))),A&&n.createElement(l,{sx:{p:2}},n.createElement(s,{spacing:2},T&&n.createElement(o,{variant:"h6"},T),n.createElement(o,null,w),n.createElement(u,{variant:"contained"},"try again")))),!Y&&!A&&n.createElement(l,{sx:{p:2,backdropFilter:"blur(3px)",backgroundColor:d(U.palette.background.paper,O?.1:1),border:O?"1px solid rgba(255, 255, 255, 0.15)":"none"}},n.createElement(s,{spacing:2},n.createElement(m,{id:"name",name:"name",label:"Name",value:H.name,variant:"outlined",onBlur:L,onChange:K,error:null!=P.name,helperText:P.name}),n.createElement(m,{id:"email",name:"email",label:"Email",value:H.email,variant:"outlined",onBlur:L,onChange:K,error:null!=P.email,helperText:P.email}),n.createElement(m,{id:"subject",name:"subject",label:"Subject",value:H.subject,variant:"outlined",onBlur:L,onChange:K,error:null!=P.subject,helperText:P.subject}),n.createElement(m,{id:"message",name:"message",label:"Message",value:H.message,variant:"outlined",multiline:!0,minRows:5,onBlur:L,onChange:K,error:null!=P.message,helperText:P.message}),n.createElement(s,{direction:"row",spacing:2,justifyContent:"end"},n.createElement(u,{variant:"outlined",color:"primary",onClick:function(){I({name:"",email:"",subject:"",message:""})}},"Clear"),n.createElement(u,{variant:"contained",onClick:function(e){return t(v,void 0,void 0,(function(){var a,t;return r(this,(function(r){switch(r.label){case 0:return e.preventDefault(),a=Q(H),0!==Object.keys(a).length?[3,3]:[4,fetch("/api/sendgrid",{body:JSON.stringify({email:H.email,fullname:H.name,subject:H.subject,message:H.message}),headers:{"Content-Type":"application/json"},method:"POST"})];case 1:return[4,r.sent().json()];case 2:if(t=r.sent().error)return G(!0),console.log(t),[2];_(!0),r.label=3;case 3:return[2]}}))}))}},"Send")))))}export{p as ContactForm};
7
+ import{__read as e,__assign as t,__awaiter as a,__generator as r}from"../../node_modules/tslib/tslib.es6.js";import n,{useEffect as i}from"react";import{useRouter as l}from"next/router";import m from"@mui/material/Container";import o from"@mui/material/Paper";import s from"@mui/material/TextField";import u from"@mui/material/Typography";import c from"@mui/material/Stack";import d from"@mui/material/Button";import g from"validator/lib/isEmail";import{setOpacity as p}from"../lib/utils.js";import{useTheme as v}from"@mui/material/styles";function b(b){var f=this,h=b.data,E=h.title,j=void 0===E?"Write us":E,x=h.subtitle,y=void 0===x?"We're open for any suggestion or just to have a chat":x,S=h.successHeading,C=void 0===S?"Thank you!":S,T=h.successText,k=void 0===T?"Your e-mail has been successfully sent!":T,w=h.errorHeading,q=h.errorText,B=void 0===q?"I am sorry, something went wrong, you could email me directly on info@jellepaulus.nl":q,W=h.maxWidth,N=h.sx,O=void 0===N?{}:N,F=h.glass,H=void 0!==F&&F,I=l().query.subject,M=e(n.useState({name:"",email:"",subject:I?String(I):"",message:""}),2),P=M[0],D=M[1];i((function(){I&&D((function(e){return t(t({},e),{subject:String(I)})}))}),[I]);var J=e(n.useState({}),2),R=J[0],Y=J[1],_=e(n.useState("Send"),2);_[0],_[1];var z=e(n.useState(!1),2),A=z[0],G=z[1],K=e(n.useState(!1),2),L=K[0],Q=K[1],U=function(e){var a,r=e.target,n=r.name,i=r.value;D(t(t({},P),((a={})[n]=i,a)))},V=function(e){var a=e.target.name,r=Z(P);r[a]?Y((function(e){var n;return t(t({},e),((n={})[a]=r[a],n))})):Y((function(e){var r=t({},e);return delete r[a],r}))},X=function(){D({name:"",email:"",subject:"",message:""})},Z=function(e){var t={};return e.name||(t.name="Name is required"),e.email?g(e.email)||(t.email="Invalid email address"):t.email="Email is required",e.subject||(t.subject="Subject is required"),e.message||(t.message="Message is required"),t},$=v();return n.createElement(m,{maxWidth:W||"lg",sx:t({my:1},O)},n.createElement(c,{spacing:2,sx:{width:"100%"}},n.createElement(u,{variant:"h6",align:"center"},j),n.createElement(u,{variant:"body1",align:"center",sx:{pb:3}},y),A&&n.createElement(o,{sx:{p:2}},n.createElement(c,{spacing:2},n.createElement(u,{variant:"h6"},C),n.createElement(u,null,k))),L&&n.createElement(o,{sx:{p:2}},n.createElement(c,{spacing:2},w&&n.createElement(u,{variant:"h6"},w),n.createElement(u,null,B),n.createElement(d,{variant:"contained"},"try again")))),!A&&!L&&n.createElement(o,{sx:{p:2,backdropFilter:"blur(3px)",backgroundColor:p($.palette.background.paper,H?.1:1),border:H?"1px solid rgba(255, 255, 255, 0.15)":"none"}},n.createElement(c,{spacing:2},n.createElement(s,{id:"name",name:"name",label:"Name",value:P.name,variant:"outlined",onBlur:V,onChange:U,error:!!R.name,helperText:R.name}),n.createElement(s,{id:"email",name:"email",label:"Email",value:P.email,variant:"outlined",onBlur:V,onChange:U,error:!!R.email,helperText:R.email}),n.createElement(s,{id:"subject",name:"subject",label:"Subject",value:P.subject,variant:"outlined",onBlur:V,onChange:U,error:!!R.subject,helperText:R.subject}),n.createElement(s,{id:"message",name:"message",label:"Message",value:P.message,variant:"outlined",multiline:!0,minRows:5,onBlur:V,onChange:U,error:!!R.message,helperText:R.message}),n.createElement(c,{direction:"row",spacing:2,justifyContent:"end"},n.createElement(d,{variant:"outlined",color:"primary",onClick:X},"Clear"),n.createElement(d,{variant:"contained",onClick:function(e){return a(f,void 0,void 0,(function(){var t;return r(this,(function(a){switch(a.label){case 0:return e.preventDefault(),t=Z(P),0!==Object.keys(t).length?[3,2]:[4,fetch("/api/sendgrid",{body:JSON.stringify({email:P.email,fullname:P.name,subject:P.subject,message:P.message}),headers:{"Content-Type":"application/json"},method:"POST"})];case 1:return a.sent().ok?(G(!0),Q(!1),X()):(G(!1),Q(!0)),[3,3];case 2:Y(t),a.label=3;case 3:return[2]}}))}))}},"Send")))))}export{b as ContactForm};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import e from"react";import{IconButton as t}from"@mui/material";import{useCookieConsent as o}from"./CookieConsentContext.js";import r from"@mui/icons-material/Cookie";var n=function(){var n=o().resetConsent;return e.createElement(t,{onClick:function(){n()}},e.createElement(r,null))};export{n as default};
7
+ import{__spreadArray as r,__read as o}from"../../../../node_modules/tslib/tslib.es6.js";import t from"react";import e from"@mui/material/Button";import{useCookieConsent as i}from"./CookieConsentContext.js";import n from"@mui/icons-material/Cookie";var a=function(a){var m=a.sx,s=i().resetConsent;return t.createElement(e,{variant:"outlined",onClick:function(){s()},startIcon:t.createElement(n,null),sx:r([{borderColor:"primary.contrast",color:"primary.contrast","&:hover":{borderColor:"primary.contrast",color:"primary.contrast"}}],o(Array.isArray(m)?m:[m]),!1)},"Reset Cookie Preferences")};export{a as default};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import t from"react";import a from"@mui/material/Button";import{useCart as e}from"../../../context/e-commerce/cart/CartContext.js";var o=function(o){var r=o.product,n=e().dispatch;return 0===r.stock?t.createElement(a,{size:"small",variant:"contained",disabled:!0},"Out of Stock"):t.createElement(a,{size:"small",variant:"contained",onClick:function(){n({type:"ADD_ITEM",payload:r})}},"Add to Card")};export{o as default};
7
+ import t from"react";import e from"@mui/material/Button";import a from"@mui/material/Stack";import o from"next/link";import{useCart as r}from"../../../context/e-commerce/cart/CartContext.js";var n=function(n){var c=n.product,i=r().dispatch;if(0===c.stock){var m="quotation request for ".concat(c.product_number," - ").concat(c.title),l="/contact?subject=".concat(encodeURIComponent(m));return t.createElement(a,{direction:"row",spacing:2},t.createElement(o,{href:l,passHref:!0},t.createElement(e,{size:"small",variant:"contained"},"Request a Quotation")),t.createElement(e,{size:"small",variant:"contained",disabled:!0},"Out of Stock"))}return t.createElement(e,{size:"small",variant:"contained",onClick:function(){i({type:"ADD_ITEM",payload:c})}},"Add to Card")};export{n as default};
@@ -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 l,{useState as r,useEffect as n}from"react";import a from"@mui/material/Table";import o from"@mui/material/TableHead";import i from"@mui/material/TableBody";import m from"@mui/material/TableCell";import u from"@mui/material/TableRow";import c from"@mui/material/IconButton";import d from"@mui/icons-material/Add";import s from"@mui/material/Typography";import p from"@mui/material/Stack";import f from"@mui/material/TextField";import b from"../../e-commerce/products/ProductSelector.js";import h from"../../common/WeekPicker.js";import E from"../../../../node_modules/dayjs/dayjs.min.js";import x from"@mui/icons-material/Delete";import{useTheme as w}from"@mui/material/styles";function g(g){var v=g.productsArr,y=g.vendorID,k=void 0===y?null:y,_=e(r([]),2),C=_[0],I=_[1],P=e(r(null),2),A=P[0],T=P[1],j=e(r(0),2),N=j[0],D=j[1],S=e(r(new Date),2),W=S[0],B=S[1],O=w();n((function(){I([])}),[k]);var q=e(r([]),2),F=q[0],H=q[1];return n((function(){H(function(e){return e.map((function(e,t){return{line_item_number:"".concat(t+1,".0.0"),product:e.product.id,ordered_quantity:e.amount,expected_delivery_date:e.pdw}}))}(C))}),[C]),l.createElement(p,{spacing:2},l.createElement(s,{variant:"h5"},"Adding the products"),l.createElement(s,{variant:"body1"},"Please select the products that are in the purchase order"),l.createElement(s,{variant:"body2"},"Only products by the selected supplier can be added"),l.createElement(a,null,l.createElement(o,null,l.createElement(u,null,l.createElement(m,{id:"line_item_number",sx:[{width:"15%"},null===k&&{color:O.palette.text.disabled}]},"Line Item Number"),l.createElement(m,{sx:[{width:"55%"},null===k&&{color:O.palette.text.disabled}]},"Product Number"),l.createElement(m,{sx:[{width:"15%"},null===k&&{color:O.palette.text.disabled}]},"Amount"),l.createElement(m,{sx:[{width:"15%"},null===k&&{color:O.palette.text.disabled}]},"Preferred delivery week"),l.createElement(m,{sx:[null===k&&{color:O.palette.text.disabled}]}))),l.createElement(i,null,C.map((function(e,t){return l.createElement(u,{key:t},l.createElement(m,{sx:[{width:"15%"},null===k&&{color:O.palette.text.disabled}]},t+1,".0.0"),l.createElement(m,{sx:[{width:"55%"},null===k&&{color:O.palette.text.disabled}]},e.product.product_number),l.createElement(m,{sx:{width:"15%"}},e.amount),l.createElement(m,{sx:{width:"10%"}},(r=e.pdw,E(r).isoWeek())),l.createElement(m,{align:"right",sx:{width:"5%"}},l.createElement(c,{onClick:function(){return function(e){var t=C.filter((function(t,l){return l!==e}));I(t)}(t)}},l.createElement(x,null))));var r})))),l.createElement("input",{type:"hidden",name:"ipo_items",value:JSON.stringify(F)}),l.createElement(p,{direction:"row",spacing:1,alignItems:"center",sx:{p:2,width:"100%"}},l.createElement(s,{variant:"body1",sx:{width:"15%"}},C.length+1,".0.0"),v&&l.createElement(b,{productNames:v,currentValue:[],sx:{width:"55%"},multiple:!1,onChangeCallback:function(e){var t=v.find((function(t){return t.id===e[0]}));console.log("product",t),T(t||null)}}),l.createElement(f,{id:"amount",name:"amount",type:"number",label:"Amount",value:N,onChange:function(e){""!==e.target.value?parseInt(e.target.value)<0?D(0):D(parseInt(e.target.value)):D(0)},disabled:null===k,sx:{width:"15%"}}),l.createElement(h,{value:W,onChangeCallback:function(e){console.log("WeekPicker onchange",e),B(e)},label:"Preferred delivery week",disabled:!1}),l.createElement(c,{disabled:null===k,onClick:function(){if(console.log("handleAddItem"),null!==A&&null!==N){var l={product:A,amount:N,pdw:W};console.log("newItem",l),I(t(t([],e(C),!1),[l],!1)),T(null),D(0),B(new Date)}else console.log("nextProductName or nextAmount is null")}},l.createElement(d,null))))}export{g as IPOItemFields};
6
+ import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as l,useEffect as n}from"react";import a from"@mui/material/Table";import i from"@mui/material/TableHead";import o from"@mui/material/TableBody";import m from"@mui/material/TableCell";import u from"@mui/material/TableRow";import c from"@mui/material/IconButton";import d from"@mui/icons-material/Add";import s from"@mui/material/Typography";import p from"@mui/material/Stack";import f from"@mui/material/TextField";import b from"../../e-commerce/products/ProductSelector.js";import E from"../../common/WeekPicker.js";import h from"../../../../node_modules/dayjs/dayjs.min.js";import x from"@mui/icons-material/Delete";import{useTheme as w}from"@mui/material/styles";function v(v){var y=v.productsArr,g=v.vendorID,k=void 0===g?null:g,_=e(l([]),2),C=_[0],P=_[1],T=e(l(null),2),j=T[0],A=T[1],I=e(l(0),2),N=I[0],D=I[1],S=e(l(new Date),2),B=S[0],O=S[1],W=e(l([]),2),q=W[0],F=W[1],H=w();n((function(){P([])}),[k]);var J=e(l([]),2),L=J[0],R=J[1];return n((function(){R(function(e){return e.map((function(e,t){return{line_item_number:"".concat(t+1,".0.0"),product:e.product.id,ordered_quantity:e.amount,expected_delivery_date:e.pdw}}))}(C))}),[C]),r.createElement(p,{spacing:2},r.createElement(s,{variant:"h5"},"Adding the products"),r.createElement(s,{variant:"body1"},"Please select the products that are in the purchase order"),r.createElement(s,{variant:"body2"},"Only products by the selected supplier can be added"),r.createElement(a,null,r.createElement(i,null,r.createElement(u,null,r.createElement(m,{id:"line_item_number",sx:[{width:"15%"},null===k&&{color:H.palette.text.disabled}]},"Line Item Number"),r.createElement(m,{sx:[{width:"55%"},null===k&&{color:H.palette.text.disabled}]},"Product Number"),r.createElement(m,{sx:[{width:"15%"},null===k&&{color:H.palette.text.disabled}]},"Amount"),r.createElement(m,{sx:[{width:"15%"},null===k&&{color:H.palette.text.disabled}]},"Preferred delivery week"),r.createElement(m,{sx:[null===k&&{color:H.palette.text.disabled}]}))),r.createElement(o,null,C.map((function(e,t){return r.createElement(u,{key:t},r.createElement(m,{sx:[{width:"15%"},null===k&&{color:H.palette.text.disabled}]},t+1,".0.0"),r.createElement(m,{sx:[{width:"55%"},null===k&&{color:H.palette.text.disabled}]},e.product.product_number),r.createElement(m,{sx:{width:"15%"}},e.amount),r.createElement(m,{sx:{width:"10%"}},(l=e.pdw,h(l).isoWeek())),r.createElement(m,{align:"right",sx:{width:"5%"}},r.createElement(c,{onClick:function(){return function(e){var t=C.filter((function(t,r){return r!==e}));P(t)}(t)}},r.createElement(x,null))));var l})))),r.createElement("input",{type:"hidden",name:"ipo_items",value:JSON.stringify(L)}),r.createElement(p,{direction:"row",spacing:1,alignItems:"center",sx:{p:2,width:"100%"}},r.createElement(s,{variant:"body1",sx:{width:"15%"}},C.length+1,".0.0"),y&&r.createElement(b,{productNames:y,currentValue:q,sx:{width:"55%"},multiple:!1,onChangeCallback:function(e){var t=y.find((function(t){return t.id===e[0]}));A(t||null),F(e)}}),r.createElement(f,{id:"amount",name:"amount",type:"number",label:"Amount",value:N,onChange:function(e){""!==e.target.value?parseInt(e.target.value)<0?D(0):D(parseInt(e.target.value)):D(0)},disabled:null===k,sx:{width:"15%"}}),r.createElement(E,{value:B,onChangeCallback:function(e){O(e)},label:"Preferred delivery week",disabled:!1}),r.createElement(c,{disabled:null===k,onClick:function(){if(null!==j&&null!==N){var r={product:j,amount:N,pdw:B};P(t(t([],e(C),!1),[r],!1)),A(null),D(0),O(new Date),F([])}else console.log("nextProductName or nextAmount is null")}},r.createElement(d,null))))}export{v as IPOItemFields};