umwd-components 0.1.388 → 0.1.389
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/common/AmountUpdater.js +1 -1
- package/dist/src/components/common/media/MediaGrid.js +1 -1
- package/dist/src/components/e-commerce/checkout/CheckoutForm.js +1 -1
- package/dist/src/components/e-commerce/customer/CustomerProfileEditForm.js +1 -1
- package/dist/src/components/e-commerce/invoice/CreateInvoiceForm.js +1 -1
- package/dist/src/components/e-commerce/opo/ManageOpoForm.js +1 -1
- package/dist/src/components/e-commerce/opo/OPOItemFields.js +1 -1
- package/dist/src/components/logistics/ipo/ManageIPOForm.js +1 -1
- package/dist/src/components/logistics/note/NotesDisplay.js +1 -1
- package/dist/src/components/logistics/report/ReportDisplay.js +1 -1
- package/dist/src/data/actions/e-commerce/categories/createCategoryAction.js +1 -1
- package/dist/src/data/actions/e-commerce/categories/updateCategoryAction.js +1 -1
- package/dist/src/data/actions/e-commerce/invoices/createInvoiceAction.js +1 -1
- package/dist/src/data/actions/e-commerce/opo/createOpoAction.js +1 -1
- package/dist/src/data/actions/e-commerce/opo/updateOpoAction.js +1 -1
- package/dist/src/data/actions/e-commerce/product/updateProductAction.js +1 -1
- package/dist/src/data/actions/logistics/ipo/updateIpoAction.js +1 -1
- package/dist/src/data/actions/logistics/note/createNoteAction.js +1 -1
- package/dist/src/data/actions/logistics/vendor/createVendorAction.js +1 -1
- package/dist/src/data/actions/logistics/vendor/updateVendorAction.js +1 -1
- package/dist/src/data/actions/media/uploadBase64MediaAction.js +1 -1
- package/dist/src/data/actions/profile-actions.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/components/e-commerce/products/EditStockForm.d.ts +7 -0
- package/dist/types/data/loaders/e-commerce/getSingleStock.d.ts +2 -0
- package/dist/types/types/e-commerce/opo/types.d.ts +1 -0
- package/dist/types/types/e-commerce/product/types.d.ts +9 -0
- package/dist/types/types/logistics/Report.d.ts +3 -3
- package/package.json +1 -1
- package/src/app/page.tsx +0 -8
- package/src/components/ContactForm.tsx +0 -4
- package/src/components/common/AmountUpdater.tsx +0 -2
- package/src/components/common/media/MediaGrid.tsx +0 -1
- package/src/components/e-commerce/EnhancedTable/EnhancedTableHead.tsx +0 -3
- package/src/components/e-commerce/EnhancedTable/EnhancedTableToolbar.tsx +0 -2
- package/src/components/e-commerce/checkout/CheckoutForm.tsx +0 -2
- package/src/components/e-commerce/customer/CustomerProfileEditForm.tsx +0 -3
- package/src/components/e-commerce/customer/CustomerSelector.tsx +0 -10
- package/src/components/e-commerce/invoice/CreateInvoiceForm.tsx +0 -2
- package/src/components/e-commerce/opo/ManageOpoForm.tsx +0 -8
- package/src/components/e-commerce/opo/OPOItemFields.tsx +0 -2
- package/src/components/e-commerce/products/EditStockForm.tsx +411 -0
- package/src/components/logistics/ipo/ManageIPOForm.tsx +0 -8
- package/src/components/logistics/note/NotesDisplay.tsx +0 -1
- package/src/components/logistics/report/ReportDisplay.tsx +3 -2
- package/src/data/actions/e-commerce/categories/createCategoryAction.tsx +0 -4
- package/src/data/actions/e-commerce/categories/updateCategoryAction.tsx +0 -4
- package/src/data/actions/e-commerce/invoices/createInvoiceAction.tsx +0 -4
- package/src/data/actions/e-commerce/opo/createOpoAction.ts +0 -5
- package/src/data/actions/e-commerce/opo/updateOpoAction.ts +0 -4
- package/src/data/actions/e-commerce/product/updateProductAction.tsx +5 -11
- package/src/data/actions/logistics/ipo/updateIpoAction.ts +0 -4
- package/src/data/actions/logistics/note/createNoteAction.ts +0 -7
- package/src/data/actions/logistics/vendor/createVendorAction.tsx +0 -2
- package/src/data/actions/logistics/vendor/updateVendorAction.tsx +0 -2
- package/src/data/actions/media/uploadBase64MediaAction.ts +1 -21
- package/src/data/actions/profile-actions.ts +0 -1
- package/src/data/loaders/e-commerce/getSingleStock.ts +18 -0
- package/src/data/services/logistics/ipo/confirmation-service.ts +1 -0
- package/src/types/e-commerce/opo/types.ts +1 -0
- package/src/types/e-commerce/product/types.ts +10 -0
- package/src/types/logistics/Report.ts +3 -3
|
@@ -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/index6.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/index7.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};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
import{__read as e}from"../../../node_modules/tslib/tslib.es6.js";import t,{useState as n,useEffect as a}from"react";import l from"@mui/material/Box";import r from"@mui/material/IconButton";import i from"@mui/material/Typography";import c from"@mui/material/Stack";import o from"@mui/material/Badge";import m from"@mui/icons-material/RemoveCircle";import d from"@mui/icons-material/AddCircle";import{useTheme as u,styled as p}from"@mui/material/styles";function g(g){var s=g.currentValue,f=g.totalValue,E=g.minNewValue,b=g.maxNewValue,x=g.color,C=g.handleChange,h=g.offsetEnd,k=100/f*s,z=e(n(s),2),v=z[0],y=z[1],R=100/f*v,B=h?100/f*h*-1:0,w=u(),O=function(e){v+e<=b&&(y(v+e),C(v+e))},V=function(e){v-e>=E&&(y(v-e),C(v-e))};a((function(){y(s)}),[s]);var M=p(o)((function(e){return e.theme,{"& .MuiBadge-badge":{backgroundColor:"#fff",fontWeight:"bold",color:"black",mixBlendMode:"lighten",margin:"-1px 0px",padding:"0px 4px"}}})),j=p(r)((function(e){var t=e.theme;return{"&:hover":{color:t.palette.primary.main,"& .MuiBadge-badge":{backgroundColor:t.palette.primary.main}}}}));return
|
|
6
|
+
import{__read as e}from"../../../node_modules/tslib/tslib.es6.js";import t,{useState as n,useEffect as a}from"react";import l from"@mui/material/Box";import r from"@mui/material/IconButton";import i from"@mui/material/Typography";import c from"@mui/material/Stack";import o from"@mui/material/Badge";import m from"@mui/icons-material/RemoveCircle";import d from"@mui/icons-material/AddCircle";import{useTheme as u,styled as p}from"@mui/material/styles";function g(g){var s=g.currentValue,f=g.totalValue,E=g.minNewValue,b=g.maxNewValue,x=g.color,C=g.handleChange,h=g.offsetEnd,k=100/f*s,z=e(n(s),2),v=z[0],y=z[1],R=100/f*v,B=h?100/f*h*-1:0,w=u(),O=function(e){v+e<=b&&(y(v+e),C(v+e))},V=function(e){v-e>=E&&(y(v-e),C(v-e))};a((function(){y(s)}),[s]);var M=p(o)((function(e){return e.theme,{"& .MuiBadge-badge":{backgroundColor:"#fff",fontWeight:"bold",color:"black",mixBlendMode:"lighten",margin:"-1px 0px",padding:"0px 4px"}}})),j=p(r)((function(e){var t=e.theme;return{"&:hover":{color:t.palette.primary.main,"& .MuiBadge-badge":{backgroundColor:t.palette.primary.main}}}}));return t.createElement(l,{sx:[{display:"flex",alignItems:"center",background:"\n linear-gradient(90deg, ".concat(w.palette[x].main,"55 ").concat(k,"%, ").concat(w.palette[x].main,"33 ").concat(k,"%),\n linear-gradient(90deg, ").concat(w.palette[x].main,"55 ").concat(R,"%, ").concat(w.palette[x].main,"33 ").concat(R,"%)\n "),width:"100%",borderRadius:"16px",padding:"2px",justifyContent:"space-between"},v-f==1&&{paddingRight:"4px",background:"linear-gradient(-90deg, ".concat(w.palette[x].main,"33 4px, ").concat(w.palette[x].main,"66 4px)")},v-f==2&&{paddingRight:"8px",background:"linear-gradient(-90deg, ".concat(w.palette[x].main,"33 8px, ").concat(w.palette[x].main,"66 8px)")},v-f==3&&{paddingRight:"12px",background:"linear-gradient(-90deg, ".concat(w.palette[x].main,"33 12px, ").concat(w.palette[x].main,"66 12px)")},v-f==4&&{paddingRight:"16px",background:"linear-gradient(-90deg, ".concat(w.palette[x].main,"33 16px, ").concat(w.palette[x].main,"66 16px)")},v-f>=5&&{paddingRight:"20px",background:"linear-gradient(-90deg, ".concat(w.palette[x].main,"33 20px, ").concat(w.palette[x].main,"66 20px)")},null!=h&&h<0&&{background:"linear-gradient(-90deg, ".concat(w.palette.error.main," ").concat(B,"%, ").concat(w.palette[x].main,"66 ").concat(B,"%)")}]},t.createElement(l,null,v-100>=E&&t.createElement(j,{size:"small",onClick:function(e){return V(100)}},t.createElement(M,{badgeContent:100,max:100,anchorOrigin:{vertical:"bottom",horizontal:"left"}},t.createElement(m,null))),v-25>=E&&t.createElement(j,{size:"small",onClick:function(e){return V(25)}},t.createElement(M,{badgeContent:25,anchorOrigin:{vertical:"bottom",horizontal:"left"}},t.createElement(m,null))),v-10>=E&&t.createElement(j,{size:"small",onClick:function(e){return V(10)}},t.createElement(M,{badgeContent:10,anchorOrigin:{vertical:"bottom",horizontal:"left"}},t.createElement(m,null))),v-5>=E&&t.createElement(j,{size:"small",onClick:function(e){return V(5)}},t.createElement(M,{badgeContent:5,anchorOrigin:{vertical:"bottom",horizontal:"left"}},t.createElement(m,null))),t.createElement(j,{size:"small",onClick:function(){v-1>=E&&(y(v-1),C(v-1))},disabled:v-1<E},t.createElement(m,null))),t.createElement(c,{direction:"row",spacing:1},s!==f?t.createElement(i,{variant:"body2"},"".concat(s," / ").concat(f)):t.createElement(i,{variant:"body2"},"".concat(s)),v!==s&&t.createElement(i,{variant:"body2"},"+ (".concat(v-s,") = ").concat(v))),t.createElement(l,null,t.createElement(j,{size:"small",onClick:function(){v+1<=b&&(y(v+1),C(v+1))},disabled:v+1>b},t.createElement(d,null)),v+5<=b&&t.createElement(j,{size:"small",onClick:function(e){return O(5)}},t.createElement(M,{badgeContent:5},t.createElement(d,null))),v+10<=b&&t.createElement(j,{size:"small",onClick:function(e){return O(10)}},t.createElement(M,{badgeContent:10},t.createElement(d,null))),v+25<=b&&t.createElement(j,{size:"small",onClick:function(e){return O(25)}},t.createElement(M,{badgeContent:25},t.createElement(d,null))),v+100<=b&&t.createElement(j,{size:"small",onClick:function(e){return O(100)}},t.createElement(M,{badgeContent:100,max:100},t.createElement(d,null)))))}export{g as AmountUpdater,g as default};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__read as e,__awaiter as t,__generator as n}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as i,Fragment as o}from"react";import l from"@mui/material/Grid";import{MediaItem as m}from"./MediaItem.js";import a from"./EditMediaDialog.js";function u(u){var
|
|
7
|
+
import{__read as e,__awaiter as t,__generator as n}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as i,Fragment as o}from"react";import l from"@mui/material/Grid";import{MediaItem as m}from"./MediaItem.js";import a from"./EditMediaDialog.js";function u(u){var d=this,c=u.mediaArray,s=u.selected,f=void 0===s?[]:s,p=u.handleSelect,E=e(i(!1),2),h=E[0],v=E[1],x=e(i(null),2),g=x[0],j=x[1],I=function(){v(!1),null!==g&&j(null)};return r.createElement(l,{container:!0,spacing:2,sx:{transform:"translateX(-1rem)"}},(null==c?void 0:c.length)>0&&c.map((function(e,i){return r.createElement(o,{key:e.id},r.createElement(a,{open:h&&g===i,handleClose:I,data:e}),r.createElement(l,{item:!0,xs:3},r.createElement(m,{mediaItem:e,isSelected:-1!==f.findIndex((function(t){return t.id===e.id})),onClick:p?function(){return p(e)}:function(){return function(e){return t(d,void 0,void 0,(function(){return n(this,(function(t){return j(e),v(!0),[2]}))}))}(i)}})))})))}export{u as MediaGrid};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{extends as e}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import{__read as t}from"../../../../node_modules/tslib/tslib.es6.js";import n from"@mui/material/Typography";import r from"@mui/material/Container";import
|
|
7
|
+
import{extends as e}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import{__read as t}from"../../../../node_modules/tslib/tslib.es6.js";import n from"@mui/material/Typography";import r from"@mui/material/Container";import a from"@mui/material/Stack";import l from"@mui/material/Grid";import i from"@mui/material/Paper";import o from"@mui/material/Box";import m from"@mui/material/Button";import c from"@mui/material/Stepper";import s from"@mui/material/Step";import u from"@mui/material/StepLabel";import p from"@mui/material/MobileStepper";import d from"@mui/material/useMediaQuery";import{useTheme as E}from"@mui/material/styles";import x,{useState as f,useEffect as b}from"react";import g from"next/link";import{useSearchParams as v}from"next/navigation";import{useSession as k}from"../../../context/auth/SessionContext.js";import h from"@mui/icons-material/KeyboardArrowLeft";import C from"@mui/icons-material/KeyboardArrowRight";import y from"./Step1.js";import B from"./Step2.js";import S from"./Step3.js";import j from"./Step4.js";import A from"./Step5.js";import{useCheckout as w}from"../../../context/e-commerce/checkout/CheckoutContext.js";function z(z){var P=z.shopUrl,N=void 0===P?"/shop":P,H=E(),I=d(H.breakpoints.down("sm")),L=w(),_=L.state,F=L.runAllChecks,K=t(f(0),2),M=K[0],T=K[1],D=function(){T((function(e){return e+1}))},G=function(){T((function(e){return e-1}))},O=k(),Q=O.loading;O.error;var R=O.user,U=v();b((function(){null!==U&&(U.get("order")&&T(4))}),[U]),b((function(){F()}),[R]);var q=!_.itemsInCart;_.customerProfileComplete;var J=[{label:"Login or register",children:x.createElement(y,null),backButton:x.createElement(m,{variant:I?"text":"outlined",disabled:0===M,onClick:G,sx:{mr:1}},"Back",I&&x.createElement(h,null)),nextButton:x.createElement(m,{variant:I?"text":"contained",onClick:D,sx:{ml:1},size:I?"small":"large"},"Next",I&&x.createElement(C,null))},{label:"Provide us with your address",children:x.createElement(B,null),backButton:x.createElement(m,{size:I?"small":"large",onClick:G,disabled:0===M,variant:I?"text":"outlined"},"Back",I&&x.createElement(h,null)),nextButton:x.createElement(m,{size:I?"small":"large",variant:I?"text":"contained",onClick:function(){D()}},"Next",I&&x.createElement(C,null))},{label:"Set up mailing options",children:x.createElement(S,null),backButton:x.createElement(m,{size:I?"small":"large",variant:I?"text":"outlined",onClick:G,disabled:0===M},"Back",I&&x.createElement(h,null)),nextButton:x.createElement(m,{size:I?"small":"large",variant:I?"text":"contained",onClick:function(){D()}},"Next",I&&x.createElement(C,null))},{label:"Confirm and make a payment",children:x.createElement(j,null),nextButton:x.createElement(x.Fragment,null,x.createElement(m,{size:I?"small":"large",variant:I?"text":"contained",onClick:function(){D()},disabled:!0},"Next",I&&x.createElement(C,null))),backButton:x.createElement(m,{size:I?"small":"large",variant:I?"text":"outlined",onClick:G,disabled:0===M},"Back",I&&x.createElement(h,null))},{label:"Done!",children:x.createElement(A,null)}];return x.createElement(r,{sx:{py:2,minHeight:"100vh"}},x.createElement(l,{container:!0,spacing:2,sx:{py:3,minHeight:"60vh"}},x.createElement(l,{item:!0,xs:12,component:i},x.createElement(n,{variant:"body1",align:"center"},"items in cart: ",_.itemsInCart.toString()),x.createElement(n,{variant:"body1",align:"center"},"customerProfileComplete: ",_.customerProfileComplete.toString()),x.createElement(n,{variant:"body1",align:"center"},"companyAddressComplete: ",_.companyAddressComplete.toString()),x.createElement(n,{variant:"body1",align:"center"},"deliveryAddressComplete: ",_.deliveryAddressComplete.toString()),x.createElement(n,{variant:"body1",align:"center"},"billingAddressComplete: ",_.billingAddressComplete.toString()),x.createElement(n,{variant:"body1",align:"center"},"businessCredentailsComplete:"," ",_.businessCredentailsComplete.toString()),x.createElement(m,{onClick:function(){F()}},"run all checks")),x.createElement(l,{item:!0,xs:12},x.createElement(n,{variant:"h4",align:"center"},"Check Out")),q&&4!=M&&x.createElement(l,{item:!0,xs:12},x.createElement(o,{sx:{color:"red",border:"2px solid red",p:2}},x.createElement(n,{variant:"h5"},"No products in cart"),x.createElement(n,{variant:"body1"},"There are no products selected to order, please visit the shop befor continuing"))),x.createElement(l,{item:!0,xs:12},x.createElement(o,{width:"100%"},x.createElement(i,{sx:{p:2,mb:2,display:{xs:"block",sm:"none"}}},x.createElement(a,{direction:"row",spacing:2,alignItems:"center"},x.createElement(n,{variant:"body2"},"".concat(M+1," / ").concat(J.length)),x.createElement(n,null,"".concat(J[M].label)))),x.createElement(i,{sx:{px:2,pt:2,mb:2,display:{xs:"none",sm:"block"}}},x.createElement(c,{activeStep:M},J.map((function(t,n){var r={};return x.createElement(s,e({key:n},{},{sx:{pb:"20px"}}),x.createElement(u,r,t.label))})))),!Q&&x.createElement(x.Fragment,null,J[M].children,x.createElement(i,{sx:{p:2,mt:2,display:{xs:"none",sm:"block"}}},x.createElement(a,{direction:"row",spacing:2},J[M].backButton,x.createElement(m,{variant:"outlined",sx:{ml:1}},x.createElement(g,{href:N},"continue shopping")),x.createElement(o,{sx:{flex:"1 1 auto"}}),J[M].nextButton))))),x.createElement(l,{item:!0,xs:12},x.createElement(p,{sx:{display:{xs:"flex",sm:"none"}},variant:"text",steps:J.length,position:"static",activeStep:M,nextButton:J[M].nextButton,backButton:J[M].backButton}))))}export{z 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 from"@mui/material/Divider";import a from"@mui/material/Paper";import r from"@mui/material/Box";import n from"@mui/material/Stack";import
|
|
7
|
+
import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t from"@mui/material/Divider";import a from"@mui/material/Paper";import r from"@mui/material/Box";import n from"@mui/material/Stack";import m from"@mui/material/Alert";import l from"@mui/material/TextField";import i from"@mui/material/Typography";import o from"@mui/material/Checkbox";import{AddressFields as s}from"../../common/Address.js";import{SubmitButton as c}from"../../SubmitButton.js";import{useFormState as d}from"react-dom";import{updateCustomerProfileAction as u}from"../../../data/actions/profile-actions.js";import{StrapiErrors as p}from"../../StrapiErrors.js";import{BusinessCredentialsFields as f}from"./BusinessCredentials.js";import E,{useState as v}from"react";var g={zodErrors:null,strapiErrors:null,data:null,message:null};function h(h){var _=h.data,b=_.id;_.uuid,_.customer_number;var y=_.first_name,x=_.last_name,j=_.email,C=_.phone,N=_.company_address,A=_.delivery_address,B=_.billing_address,k=_.business_credentials,R=e(d(u,g),2),V=R[0],w=R[1],D=e(v(null!=A),2),I=D[0],P=D[1],S=e(v(null!=B),2),T=S[0],F=S[1];return E.createElement(r,{component:a,sx:{p:2}},E.createElement("form",{action:w},E.createElement(n,{spacing:2},E.createElement("input",{type:"hidden",name:"id",value:b}),E.createElement(i,{variant:"h6"},"Personal Details"),E.createElement(t,null),E.createElement(l,{id:"first_name",name:"first_name",label:"First Name",defaultValue:y}),E.createElement(l,{id:"last_name",name:"last_name",label:"Last Name",defaultValue:x}),E.createElement(l,{id:"email",name:"email",label:"Email",defaultValue:j}),E.createElement(l,{id:"phone",name:"phone",label:"Phone",defaultValue:C}),E.createElement(i,{variant:"h6"},"Business Credentials"),E.createElement(t,null),E.createElement(f,{componentName:"business_credentials",componentReference:"business.credentials",data:k}),E.createElement(i,{variant:"h6"},"Company Address"),E.createElement(t,null),E.createElement(s,{componentName:"company_address",componentReference:"common.address",data:N}),E.createElement(i,{variant:"h6"},"Delivery Address"),E.createElement(t,null),E.createElement(n,{direction:"row",spacing:2,alignItems:"center"},E.createElement(o,{value:I,checked:I,onChange:function(){return P(!I)}}),E.createElement(i,null,"Use a different address for delivery")),I&&E.createElement(s,{componentName:"delivery_address",componentReference:"common.address",data:A}),E.createElement(i,{variant:"h6"},"Billing Address"),E.createElement(t,null),E.createElement(n,{direction:"row",spacing:2,alignItems:"center"},E.createElement(o,{value:T,checked:T,onChange:function(){return F(!T)}}),E.createElement(i,null,"Use a different address for billing")),T&&E.createElement(s,{componentName:"billing_address",componentReference:"common.address",data:B}),E.createElement(n,{direction:"row-reverse",spacing:2,alignItems:"center",sx:{py:1}},E.createElement(c,{text:"save changes",loadingText:"loading"}),E.createElement(p,{error:null==V?void 0:V.strapiErrors}),(null==V?void 0:V.message)&&E.createElement(m,{severity:"error"},null==V?void 0:V.message)))))}export{h as default};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__read as e,__spreadArray as n,__assign as r,__awaiter as t,__generator as a}from"../../../../node_modules/tslib/tslib.es6.js";import l,{useState as
|
|
7
|
+
import{__read as e,__spreadArray as n,__assign as r,__awaiter as t,__generator as a}from"../../../../node_modules/tslib/tslib.es6.js";import l,{useState as i,useEffect as o}from"react";import m from"@mui/material/Paper";import s from"@mui/material/Box";import c from"@mui/material/Stack";import u from"@mui/material/Alert";import d from"@mui/material/TextField";import f from"@mui/material/Typography";import{SubmitButton as v}from"../../SubmitButton.js";import{useFormState as p}from"react-dom";import{StrapiErrors as b}from"../../StrapiErrors.js";import{createInvoiceAction as E}from"../../../data/actions/e-commerce/invoices/createInvoiceAction.js";import _ from"@mui/material/Grid";import{AddressFields as g}from"../../common/Address.js";import y from"@mui/material/Divider";import{BusinessCredentialsFields as h}from"../customer/BusinessCredentials.js";import{CustomerSelector as C}from"../customer/CustomerSelector.js";import{getSingleCustomer as k}from"../../../data/loaders/e-commerce/getSingleCustomer.js";import x from"@mui/material/Checkbox";import{InvoiceItemFields as I}from"./InvoiceItemFields.js";import{InvoicePDFViewer as j}from"./InvoicePDF.js";import{getPublicInformation as N}from"../../../data/loaders/public-information/getPublicInformation.js";import w from"../../common/markdown/MarkdownEditor.js";var A={zodErrors:null,strapiErrors:null,data:null,message:null};function F(F){var R=this,S=F.customerLabels,B=F.revalidateCallback,P=F.sx,D=e(p(E,A),2),L=D[0],T=D[1],U=e(i(!1),2),z=U[0],G=U[1],M=e(i(!1),2),q=M[0],H=M[1],J=e(i(null),2),K=J[0],O=J[1],Q=e(i(null),2),V=Q[0],W=Q[1];return o((function(){(null==L?void 0:L.data)&&B&&B()}),[L.data]),o((function(){!function(){t(this,void 0,void 0,(function(){var e;return a(this,(function(n){switch(n.label){case 0:return[4,N()];case 1:return e=n.sent(),W({seller_phone:null==e?void 0:e.phone,seller_email:null==e?void 0:e.email,seller_company_address:null==e?void 0:e.address,seller_business_credentials:null==e?void 0:e.business_credentials}),[2]}}))}))}()}),[]),l.createElement(s,{sx:n([{p:2}],e(Array.isArray(P)?P:[P]),!1),component:m},l.createElement("form",{action:T},l.createElement(_,{container:!0,spacing:2},l.createElement(_,{item:!0,xs:12},l.createElement(f,{variant:"h6"},"Create Invoice"),l.createElement(f,{variant:"body2"},"Information on creating a invoice")),l.createElement(_,{item:!0,xs:12},l.createElement(f,{variant:"h6"},"Choose a user"),l.createElement(C,{customerLabels:S,onChangeCallback:function(e){return t(R,void 0,void 0,(function(){var n;return a(this,(function(r){switch(r.label){case 0:return 0===e.length?(O(null),[2]):[4,k(e[0])];case 1:return n=r.sent(),console.log("customer",n),O(n),[2]}}))}))}}),l.createElement(f,{variant:"h6"},"Set user details manually"),l.createElement(c,{spacing:2,direction:"row"},l.createElement(d,{name:"buyer_first_name",label:"First Name",value:(null==K?void 0:K.first_name)||(null==V?void 0:V.buyer_first_name)||"",onChange:function(e){W((function(n){return r(r({},n),{buyer_first_name:e.target.value})}))},disabled:null!==K}),l.createElement(d,{name:"buyer_last_name",label:"Last Name",value:(null==K?void 0:K.last_name)||(null==V?void 0:V.buyer_last_name)||"",onChange:function(e){W((function(n){return r(r({},n),{buyer_last_name:e.target.value})}))},disabled:null!==K})),l.createElement(f,{variant:"body2"}),l.createElement(f,{variant:"h6"},"Company Address"),l.createElement(y,null),l.createElement(g,{data:null==K?void 0:K.company_address,componentName:"buyer_company_address",componentReference:"common.address",onChangeCallback:function(e){W((function(n){return r(r({},n),{buyer_company_address:e})}))},disabled:null!==K}),l.createElement(f,{variant:"h6"},"Delivery Address"),l.createElement(y,null),null!==K?l.createElement(l.Fragment,null,null===K.delivery_address?l.createElement(f,{variant:"body2"},"No delivery address on file"):l.createElement(g,{data:null==K?void 0:K.delivery_address,componentName:"buyer_delivery_address",componentReference:"common.address",onChangeCallback:function(e){W((function(n){return r(r({},n),{buyer_delivery_address:e})}))},disabled:null!==K})):l.createElement(l.Fragment,null,l.createElement(c,{direction:"row",spacing:2,alignItems:"center"},l.createElement(x,{value:q,checked:q,onChange:function(){return H(!q)}}),l.createElement(f,null,"Use a different address for delivery")),q&&l.createElement(g,{componentName:"buyer_delivery_address",componentReference:"common.address",onChangeCallback:function(e){W((function(n){return r(r({},n),{buyer_delivery_address:e})}))}})),l.createElement(f,{variant:"h6"},"Billing Address"),l.createElement(y,null),null!==K?l.createElement(l.Fragment,null,null===K.billing_address?l.createElement(f,{variant:"body2"},"No billing address on file"):l.createElement(g,{data:null==K?void 0:K.billing_address,componentName:"buyer_billing_address",componentReference:"common.address",onChangeCallback:function(e){W((function(n){return r(r({},n),{buyer_billing_address:e})}))},disabled:null!==K})):l.createElement(l.Fragment,null,l.createElement(c,{direction:"row",spacing:2,alignItems:"center"},l.createElement(x,{value:z,checked:z,onChange:function(){return G(!z)}}),l.createElement(f,null,"Use a different address for billing")),z&&l.createElement(g,{componentName:"buyer_billing_address",componentReference:"common.address",onChangeCallback:function(e){W((function(n){return r(r({},n),{buyer_billing_address:e})}))}})),l.createElement(f,{variant:"h6"},"Bussiness Credentials"),l.createElement(y,null),l.createElement(h,{data:null==K?void 0:K.business_credentials,componentName:"buyer_business_credentials",componentReference:"business.credentials",onChangeCallback:function(e){W((function(n){return r(r({},n),{buyer_business_credentials:e})}))},disabled:null!==K})),l.createElement(_,{item:!0,xs:12},l.createElement(f,{variant:"h6"},"Invoice Items"),l.createElement(I,{onChangeCallback:function(e){W((function(n){return n?r(r({},n),{items:e.map((function(e){return r(r({},e),{product:"product"in e?e.product:void 0,item_description:"item_description"in e?e.item_description:void 0})}))}):null}))}})),l.createElement(_,{item:!0,xs:12},l.createElement(f,{variant:"h6"},"Add a Comment"),l.createElement(w,{name:"comments",label:"Comments",onChangeCallback:function(e){return W((function(n){return n?r(r({},n),{comments:e}):null}))}})),l.createElement(_,{item:!0,xs:12},l.createElement(f,{variant:"h6"},"Preview the Invoice"),null!==V&&l.createElement(j,{invoice:V})),l.createElement(_,{item:!0,xs:12},l.createElement(c,{direction:"row-reverse",spacing:2,alignItems:"center",sx:{py:1}},l.createElement(v,{text:"create invoice",loadingText:"loading"}),(null==L?void 0:L.strapiErrors)&&l.createElement(b,{error:null==L?void 0:L.strapiErrors}),(null==L?void 0:L.message)&&l.createElement(u,{severity:"error"},null==L?void 0:L.message))))))}export{F as CreateInvoiceForm};
|
|
@@ -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 a,useEffect as n}from"react";import{useFormState as
|
|
6
|
+
import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as a,useEffect as n}from"react";import{useFormState as i}from"react-dom";import{updateOpoAction as o}from"../../../data/actions/e-commerce/opo/updateOpoAction.js";import l from"./OpoItemUpdater.js";import m from"./OpoItemDisplay.js";import c from"../../logistics/note/NotesDisplay.js";import d from"../../logistics/note/NoteTakingComponent.js";import{StrapiErrors as s}from"../../StrapiErrors.js";import{SubmitButton as p}from"../../SubmitButton.js";import u from"@mui/material/Alert";import E from"@mui/material/Dialog";import v from"@mui/material/DialogActions";import f from"@mui/material/DialogContent";import g from"@mui/material/DialogTitle";import h from"@mui/material/Typography";import y from"@mui/material/Button";import _ from"@mui/material/Grid";import b from"@mui/material/Box";import x from"@mui/material/Paper";import C from"@mui/material/Stack";import k from"@mui/material/Divider";import w from"@mui/material/Card";import D from"@mui/material/CardContent";var O={zodErrors:null,strapiErrors:null,data:null,message:null},j={zodErrors:null,strapiErrors:null,data:null,message:null};function A(t){var a=t.open,l=t.handleClose,m=t.orderID,c=t.currentStatus,d=t.revalidateCallback,_=e(i(o,j),2),b=_[0],x=_[1];return n((function(){"Opo Updated"===(null==b?void 0:b.message)&&(d&&d(),l())}),[null==b?void 0:b.message]),r.createElement(E,{open:a},r.createElement("form",{action:x},r.createElement("input",{name:"id",type:"hidden",value:m}),r.createElement("input",{name:"status",type:"hidden",value:"placed"===c?"ordered":"done"}),r.createElement(g,null,"Confirm Order"),r.createElement(f,null,r.createElement(C,{spacing:2},r.createElement(h,null,"Are you sure you want to confirm this order?"),r.createElement(h,null,"Current status: ",c))),r.createElement(v,null,r.createElement(p,{text:"Confirm",loadingText:"Loading..."}),r.createElement(s,{error:null==b?void 0:b.strapiErrors}),(null==b?void 0:b.message)&&r.createElement(u,{severity:"error"},null==b?void 0:b.message),r.createElement(y,{variant:"contained",color:"secondary",onClick:l},"Cancel"))))}function I(n){var E,v,f,g,j,I=n.opo,q=n.sx,S=n.revalidateCallback,T=n.handleClose,N=n.role,R=e(i(o,O),2),B=R[0],P=R[1],U=e(a(I.opo_items.data?I.opo_items.data:[]),2),z=U[0],L=U[1],M=e(a(!1),2),F=M[0],G=M[1],J=function(r,a,n){var i=t([],e(z),!1),o=i.findIndex((function(e){return e.id===r}));i[o][n]?i[o][n].push(a):i[o][n]=[a],L(i)},Q=function(r,a,n){var i=t([],e(z),!1),o=i.findIndex((function(e){return e.id===a}));i[o][n]=r,L(i)},H=function(e,t){console.log(z),console.log(e,t),console.log("handleRemoveReportAtIndex")};return r.createElement(b,{sx:t([],e(Array.isArray(q)?q:[q]),!1)},r.createElement(_,{container:!0,spacing:2},r.createElement(_,{item:!0,xs:12},r.createElement(C,{spacing:2},r.createElement(C,{direction:"row",spacing:2,justifyContent:"space-between"},r.createElement(C,{spacing:2},r.createElement(h,{variant:"h3",component:"h1"},"Management Outbound Purchase Order"),r.createElement(h,{variant:"body1"},"Manage picking, packing and shipping of purchase order")),r.createElement(d,{content:"",related:[{id:I.id,__type:"api::e-commerce.opo"}],revalidateCallback:S})),r.createElement(k,null))),r.createElement(_,{item:!0,xs:12},r.createElement(h,{variant:"h4"},"Purchase Order Number ",I.opo_number)),r.createElement(_,{item:!0,xs:6},r.createElement(C,{spacing:1},r.createElement(h,{variant:"h5"},"Details"),r.createElement(C,{direction:"row",spacing:2},r.createElement(h,{variant:"body1",width:"150px"},"Custom reference"),r.createElement(h,{variant:"body2"},I.customer_inhouse_reference)),r.createElement(C,{direction:"row",spacing:2},r.createElement(h,{variant:"body1",width:"150px"},"Order Date"),r.createElement(h,{variant:"body2"},I.order_date)),r.createElement(C,{direction:"row",spacing:2},r.createElement(h,{variant:"body1",width:"150px"},"Customer"),r.createElement(h,{variant:"body2"},null===(v=null===(E=I.customer)||void 0===E?void 0:E.business_credentials)||void 0===v?void 0:v.company_name)),r.createElement(C,{direction:"row",spacing:2},r.createElement(h,{variant:"body1",width:"150px"},"Order Status"),r.createElement(h,{variant:"body2",width:"150px"},I.status)),("placed"===I.status||"external_shipping_process"===I.status)&&"enduser"===N&&r.createElement(r.Fragment,null,r.createElement(y,{variant:"contained",color:"primary",onClick:function(){return G(!0)}},"Confirm order"),r.createElement(u,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"),r.createElement(A,{open:F,handleClose:function(){return G(!1)},orderID:I.id,currentStatus:I.status,revalidateCallback:S})))),r.createElement(_,{item:!0,xs:12},r.createElement(C,{spacing:2},r.createElement(h,{variant:"h5"},"Documents"),r.createElement(w,{variant:"outlined"},r.createElement(D,null,r.createElement(C,{spacing:1},"// TODO - Should we add options to upload a shipping label and a delivery note?? where do these notes come from? are they generated by the system or are they uploaded by the enduser?"))))),(null===(g=null===(f=null==I?void 0:I.notes)||void 0===f?void 0:f.data)||void 0===g?void 0:g.length)>0&&r.createElement(_,{item:!0,xs:12},r.createElement(C,{spacing:2},r.createElement(h,{variant:"h5"},"Notes"),r.createElement(c,{notes:I.notes.data}),r.createElement(k,null))),r.createElement(_,{item:!0,xs:12},r.createElement(C,{spacing:1},r.createElement(h,{variant:"h5"},"Items"),"placed"===I.status&&r.createElement(u,{severity:"warning"},"Before confirmation you cannot update the items"),r.createElement(k,null),r.createElement("form",{action:P},r.createElement("input",{name:"id",type:"hidden",value:I.id}),(null===(j=null==I?void 0:I.opo_items)||void 0===j?void 0:j.data)&&I.opo_items.data.map((function(e,t){var a,n;return console.log("item",e),r.createElement(x,{sx:{p:2,mb:2},key:t},"placed"===I.status?r.createElement(m,{item:e,index:t,image:null===(a=null==e?void 0:e.product)||void 0===a?void 0:a.image}):r.createElement(l,{item:e,index:t,handleAddReport:J,handleUpdateQuantity:Q,image:null===(n=null==e?void 0:e.product)||void 0===n?void 0:n.image,handleRemoveReportAtIndex:H}))})),r.createElement(x,{sx:{p:2}},r.createElement(C,{direction:"row",spacing:2,justifyContent:"end"},r.createElement(y,{onClick:T},"Close"),r.createElement(p,{text:"Update items",loadingText:"Loading..."}),r.createElement(s,{error:null==B?void 0:B.strapiErrors}),(null==B?void 0:B.message)&&r.createElement(u,{severity:"error"},null==B?void 0:B.message))),r.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map((function(e){return{id:e.id,ordered_quantity:e.ordered_quantity,picked_quantity:e.picked_quantity,packed_quantity:e.packed_quantity,shipped_quantity:e.shipped_quantity,picked_reports:e.picked_reports,packed_reports:e.packed_reports,shipped_reports:e.shipped_reports}}))}(z))}))))))}export{I 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 r,{useState as n}from"react";import l from"@mui/material/Table";import m from"@mui/material/TableHead";import a from"@mui/material/TableBody";import
|
|
6
|
+
import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as n}from"react";import l from"@mui/material/Table";import m from"@mui/material/TableHead";import a from"@mui/material/TableBody";import i from"@mui/material/TableCell";import o from"@mui/material/TableRow";import u from"@mui/material/IconButton";import c from"@mui/icons-material/Add";import d from"@mui/material/Typography";import p from"@mui/material/Stack";import s from"@mui/material/TextField";import f from"../products/ProductSelector.js";import E from"../../common/WeekPicker.js";import h from"@mui/icons-material/Delete";import{useTheme as w}from"@mui/material/styles";import{getWeek as b}from"../../../../node_modules/date-fns/getWeek.js";function g(g){var x=g.productsArr,v=e(n([]),2),y=v[0],k=v[1],_=e(n(null),2),C=_[0],P=_[1],T=e(n(0),2),A=T[0],I=T[1],N=e(n(new Date),2),j=N[0],D=N[1];w();return r.createElement(p,{spacing:2},r.createElement(l,null,r.createElement(m,null,r.createElement(o,null,r.createElement(i,{id:"line_item_number",sx:[{width:"15%"}]},"Line Item Number"),r.createElement(i,{sx:[{width:"55%"}]},"Product Number"),r.createElement(i,{sx:[{width:"15%"}]},"Amount"),r.createElement(i,{sx:[{width:"15%"}]},"Preferred delivery week"),r.createElement(i,{sx:[]}))),r.createElement(a,null,y.map((function(e,t){return r.createElement(o,{key:t},r.createElement(i,{sx:[{width:"15%"}]},t+1,".0.0"),r.createElement(i,{sx:[{width:"55%"}]},e.product.product_number," | ",e.product.title),r.createElement(i,{sx:{width:"15%"}},e.amount),r.createElement(i,{sx:{width:"10%"}},b(e.pdw)),r.createElement(i,{align:"right",sx:{width:"5%"}},r.createElement(u,null,r.createElement(h,null))))})))),r.createElement("input",{type:"hidden",name:"opo_items",value:JSON.stringify(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}}))}(y))}),r.createElement(p,{direction:"row",spacing:1,alignItems:"center",sx:{p:2,width:"100%"}},r.createElement(d,{variant:"body1",sx:{width:"15%"}},y.length+1,".0.0"),x&&r.createElement(f,{productNames:x,currentValue:[],sx:{width:"55%"},multiple:!1,onChangeCallback:function(e){var t=x.find((function(t){return t.id===e[0]}));P(t||null)}}),r.createElement(s,{id:"amount",name:"amount",type:"number",label:"Amount",value:A,onChange:function(e){""!==e.target.value?parseInt(e.target.value)<0?I(0):I(parseInt(e.target.value)):I(0)},sx:{width:"15%"}}),r.createElement(E,{value:j,onChangeCallback:function(e){console.log("WeekPicker onchange",e),D(e)},label:"Preferred delivery week",disabled:!1}),r.createElement(u,{onClick:function(){if(console.log("handleAddItem"),null!==C&&null!==A){var r={product:C,amount:A,pdw:j};k(t(t([],e(y),!1),[r],!1)),P(null),I(0),D(new Date)}else console.log("nextProductName or nextAmount is null")}},r.createElement(c,null))))}export{g as OPOItemFields};
|
|
@@ -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 a,useEffect as n}from"react";import{useFormState as
|
|
6
|
+
import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as a,useEffect as n}from"react";import{useFormState as i}from"react-dom";import{updateIpoAction as o}from"../../../data/actions/logistics/ipo/updateIpoAction.js";import{UploadBase64MediaForm as l}from"../../common/media/UploadBase64MediaForm.js";import m from"../../../data/loaders/common/media/downloadBase64File.js";import c from"./ItemUpdater.js";import d from"./ItemDisplay.js";import s from"../note/NotesDisplay.js";import p from"../note/NoteTakingComponent.js";import{StrapiErrors as u}from"../../StrapiErrors.js";import{SubmitButton as v}from"../../SubmitButton.js";import E from"@mui/material/Alert";import f from"@mui/material/Dialog";import g from"@mui/material/DialogActions";import y from"@mui/material/DialogContent";import h from"@mui/material/DialogTitle";import b from"@mui/material/Typography";import _ from"@mui/material/Button";import x from"@mui/material/Grid";import C from"@mui/material/Box";import w from"@mui/material/Paper";import D from"@mui/material/Stack";import k from"@mui/material/Divider";import I from"@mui/material/Card";import j from"@mui/material/CardContent";var A={zodErrors:null,strapiErrors:null,data:null,message:null},N={zodErrors:null,strapiErrors:null,data:null,message:null};function F(t){var a=t.open,l=t.handleClose,m=t.orderID,c=t.currentStatus,d=t.revalidateCallback,s=e(i(o,N),2),p=s[0],x=s[1];return n((function(){"Ipo Updated"===(null==p?void 0:p.message)&&(d&&d(),l())}),[null==p?void 0:p.message]),r.createElement(f,{open:a},r.createElement("form",{action:x},r.createElement("input",{name:"id",type:"hidden",value:m}),r.createElement("input",{name:"status",type:"hidden",value:"placed"===c?"ordered":"done"}),r.createElement(h,null,"Confirm Order"),r.createElement(y,null,r.createElement(D,{spacing:2},r.createElement(b,null,"Are you sure you want to confirm this order?"),r.createElement(b,null,"Current status: ",c))),r.createElement(g,null,r.createElement(v,{text:"Confirm",loadingText:"Loading..."}),r.createElement(u,{error:null==p?void 0:p.strapiErrors}),(null==p?void 0:p.message)&&r.createElement(E,{severity:"error"},null==p?void 0:p.message),r.createElement(_,{variant:"contained",color:"secondary",onClick:l},"Cancel"))))}function O(n){var f,g,y,h,N,O,S,R=n.data,q=n.sx,B=n.revalidateCallback;n.handleClose;var U=n.role,T=e(i(o,A),2),P=T[0],M=T[1],z=e(a(R.items.data?R.items.data:[]),2),H=z[0],L=z[1],G=e(a(!1),2),J=G[0],Q=G[1],K=function(r,a,n){void 0===n&&(n="registered_bad_reports");var i=t([],e(H),!1),o=i.findIndex((function(e){return e.id===r}));i[o][n]?i[o][n].push(a):i[o][n]=[a],L(i)},V=function(r,a,n){var i=t([],e(H),!1),o=i.findIndex((function(e){return e.id===a}));i[o][n]=r,L(i)},W=function(e,t){console.log(H),console.log(e,t),console.log("handleRemoveReportAtIndex")};return r.createElement(C,{sx:t([],e(Array.isArray(q)?q:[q]),!1)},r.createElement(x,{container:!0,spacing:2},r.createElement(x,{item:!0,xs:12},r.createElement(D,{spacing:2},r.createElement(D,{direction:"row",spacing:2,justifyContent:"space-between"},r.createElement(D,{spacing:2},r.createElement(b,{variant:"h3",component:"h1"},"Management Inbound Purchase Order"),r.createElement(b,{variant:"body1"},"Manage arrival, registration and recieval of purchase order")),r.createElement(p,{content:"",related:[{id:R.id,__type:"api::logistics.ipo"}],revalidateCallback:B})),r.createElement(k,null))),r.createElement(x,{item:!0,xs:12},r.createElement(b,{variant:"h4"},"Purchase Order Number ",R.ipo_number)),r.createElement(x,{item:!0,xs:6},r.createElement(D,{spacing:1},r.createElement(b,{variant:"h5"},"Details"),r.createElement(D,{direction:"row",spacing:2},r.createElement(b,{variant:"body1",width:"150px"},"Custom reference"),r.createElement(b,{variant:"body2"},R.custom_reference)),r.createElement(D,{direction:"row",spacing:2},r.createElement(b,{variant:"body1",width:"150px"},"Order Date"),r.createElement(b,{variant:"body2"},R.order_date)),r.createElement(D,{direction:"row",spacing:2},r.createElement(b,{variant:"body1",width:"150px"},"Supplier"),r.createElement(b,{variant:"body2"},null===(g=null===(f=R.vendor_profile)||void 0===f?void 0:f.business_credentials)||void 0===g?void 0:g.company_name)),r.createElement(D,{direction:"row",spacing:2},r.createElement(b,{variant:"body1",width:"150px"},"Order Status"),r.createElement(b,{variant:"body2",width:"150px"},R.status)),("placed"===R.status||"received_on_stock"===R.status)&&"enduser"===U&&r.createElement(r.Fragment,null,r.createElement(_,{variant:"contained",color:"primary",onClick:function(){return Q(!0)}},"Confirm order"),r.createElement(E,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"),r.createElement(F,{open:J,handleClose:function(){return Q(!1)},orderID:R.id,currentStatus:R.status,revalidateCallback:B})))),r.createElement(x,{item:!0,xs:12},r.createElement(D,{spacing:2},r.createElement(b,{variant:"h5"},"Documents"),r.createElement(I,{variant:"outlined"},r.createElement(j,null,r.createElement(D,{spacing:1},R.order_confirmation?r.createElement(r.Fragment,null,r.createElement(b,{variant:"h6"},"Order Confirmation"),r.createElement(b,null,null===(y=R.order_confirmation)||void 0===y?void 0:y.name),r.createElement(_,{variant:"contained",onClick:function(){m("api/ipos/".concat(R.id),"order_confirmation")}},"Download")):r.createElement(r.Fragment,null,r.createElement(b,{variant:"h5"},"Order Confirmation"),r.createElement(b,{variant:"body1"},"Here you can upload the the order confirmation for this order"),r.createElement(b,{variant:"body1"},"FileUpload"),r.createElement(k,null),r.createElement(l,{reference:"api::logistics.ipo",refID:R.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:B})),R.delivery_note?r.createElement(r.Fragment,null,r.createElement(b,{variant:"h6"},"Delivery Note"),r.createElement(b,null,null===(h=R.delivery_note)||void 0===h?void 0:h.name),r.createElement(_,{variant:"contained",onClick:function(){m("api/ipos/".concat(R.id),"delivery_note")}},"Download")):r.createElement(r.Fragment,null,r.createElement(b,{variant:"h5"},"Delivery Note"),r.createElement(b,{variant:"body1"},"Here you can upload the the delivery note for this order"),r.createElement(k,null),r.createElement(l,{reference:"api::logistics.ipo",refID:R.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:B}))))))),(null===(O=null===(N=null==R?void 0:R.notes)||void 0===N?void 0:N.data)||void 0===O?void 0:O.length)>0&&r.createElement(x,{item:!0,xs:12},r.createElement(D,{spacing:2},r.createElement(b,{variant:"h5"},"Notes"),r.createElement(s,{notes:R.notes.data}),r.createElement(k,null))),r.createElement(x,{item:!0,xs:12},r.createElement(D,{spacing:1},r.createElement(b,{variant:"h5"},"Items"),"placed"===R.status&&r.createElement(E,{severity:"warning"},"Before confirmation you cannot update the items"),r.createElement(k,null),r.createElement("form",{action:M},r.createElement("input",{name:"id",type:"hidden",value:R.id}),(null===(S=null==R?void 0:R.items)||void 0===S?void 0:S.data)&&R.items.data.map((function(e,t){var a,n;return console.log("item",e),r.createElement(w,{sx:{p:2,mb:2},key:t},"placed"===R.status?r.createElement(d,{item:e,index:t,image:null===(a=null==e?void 0:e.product)||void 0===a?void 0:a.image}):r.createElement(c,{item:e,index:t,handleAddReport:K,handleUpdateQuantity:V,image:null===(n=null==e?void 0:e.product)||void 0===n?void 0:n.image,handleRemoveReportAtIndex:W}))})),r.createElement(w,{sx:{p:2}},r.createElement(D,{direction:"row",spacing:2,justifyContent:"end"},r.createElement(v,{text:"Update items",loadingText:"Loading..."}),r.createElement(u,{error:null==P?void 0:P.strapiErrors}),(null==P?void 0:P.message)&&r.createElement(E,{severity:"error"},null==P?void 0:P.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}}))}(H))}))))))}export{O as default};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
import e from"react";import
|
|
6
|
+
import e from"react";import r from"@mui/material/Typography";import t from"@mui/material/Card";import a from"@mui/material/CardContent";import o from"@mui/material/Stack";import n from"../../common/markdown/MarkdownDisplay.js";var m=function(m){var l=m.notes;return e.createElement(o,{spacing:2},l.map((function(o,m){var l,i,f;return e.createElement(t,{variant:"outlined",key:m,sx:{background:"linear-gradient(135deg, #ffff88 81%,#ffff88 82%,#ffff88 82%,#ffffc6 100%)",color:"black",p:1}},e.createElement(a,null,e.createElement(r,null,o.date),e.createElement(n,null,o.content),e.createElement(r,{align:"right",sx:{fontStyle:"bold"}},"- ",null===(l=o.author)||void 0===l?void 0:l.first_name," ",null===(i=o.author)||void 0===i?void 0:i.last_name," ",null===(f=o.author)||void 0===f?void 0:f.username)))})))};export{m as default};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
import e from"react";import t from"@mui/material/Typography";import r from"@mui/material/Stack";import a from"@mui/material/Card";import{useTheme as
|
|
6
|
+
import e from"react";import t from"@mui/material/Typography";import r from"@mui/material/Stack";import a from"@mui/material/IconButton";import i from"@mui/material/Card";import{useTheme as m}from"@mui/material/styles";import n from"@mui/icons-material/Delete";function o(o){var l=o.report,c=o.removeCallback,p=m();return e.createElement(i,{variant:"outlined",sx:{px:1,py:.5,backgroundColor:l.quantity<0?"".concat(p.palette.error.main,"66"):"".concat(p.palette.success.main,"66")}},e.createElement(r,{direction:"row",justifyContent:"space-between",alignItems:"center"},e.createElement(r,{direction:"row",spacing:1,alignItems:"center"},e.createElement(t,{variant:"body1",sx:{minWidth:"50px"}},l.quantity),e.createElement(t,{variant:"body2"},l.report)),void 0===l.id&&e.createElement(a,{size:"small",onClick:function(){return c(l)}},e.createElement(n,null))))}export{o as default};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__awaiter as r,__generator as t,__assign as e}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as
|
|
7
|
+
import{__awaiter as r,__generator as t,__assign as e}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";function i(i,n){return r(this,void 0,void 0,(function(){var r,m,p;return t(this,(function(t){switch(t.label){case 0:return Object.fromEntries(n),(r=o(n)).data.products&&(r.data.products=JSON.parse(r.data.products)),[4,s("POST","/api/product-categories",r)];case 1:return(m=t.sent())?m.error?[2,e(e({},i),{strapiErrors:m.error,message:"Failed to Create Category."})]:(p=a(m),[2,e(e({},i),{message:"Category Created",data:p,strapiErrors:null})]):[2,e(e({},i),{strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{i as createCategoryAction};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__awaiter as r,__generator as t,__assign as
|
|
7
|
+
import{__awaiter as r,__generator as t,__assign as e}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";function i(i,n){return r(this,void 0,void 0,(function(){var r,d,p,m;return t(this,(function(t){switch(t.label){case 0:return r=Object.fromEntries(n),(d=o(n)).data.products&&(d.data.products=JSON.parse(d.data.products)),[4,s("PUT","/api/product-categories/".concat(r.id),d)];case 1:return(p=t.sent())?p.error?[2,e(e({},i),{strapiErrors:p.error,message:"Failed to Update Category."})]:(m=a(p),[2,e(e({},i),{message:"Category Updated",data:m,strapiErrors:null})]):[2,e(e({},i),{strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{i as updateCategoryAction};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__awaiter as r,__generator as
|
|
7
|
+
import{__awaiter as r,__generator as t,__assign as e}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";function i(i,n){return r(this,void 0,void 0,(function(){var r,m,p;return t(this,(function(t){switch(t.label){case 0:return Object.fromEntries(n),(r=o(n)).data.products&&(r.data.products=JSON.parse(r.data.products)),[4,s("POST","/api/invoices",r)];case 1:return(m=t.sent())?m.error?[2,e(e({},i),{strapiErrors:m.error,message:"Failed to Create Invoice."})]:(p=a(m),[2,e(e({},i),{message:"Invoice Created",data:p,strapiErrors:null})]):[2,e(e({},i),{strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{i as createInvoiceAction};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__awaiter as r,__generator as e,__assign as
|
|
7
|
+
import{__awaiter as r,__generator as e,__assign as s}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as t}from"../../../services/mutate-data.js";import{flattenAttributes as o}from"../../../../lib/utils.js";import{parseFormData as a}from"../../../../lib/parseFormData.js";function i(i,n){return r(this,void 0,void 0,(function(){var r,m,l;return e(this,(function(e){switch(e.label){case 0:return Object.fromEntries(n),r=a(n),[4,t("POST","/api/opos/adminCreate",r)];case 1:return(m=e.sent())?m.error?[2,s(s({},i),{strapiErrors:m.error,message:"Failed to Create Opo."})]:(l=o(m),[2,s(s({},i),{message:"Opo Created Successfully",data:l,strapiErrors:null})]):[2,s(s({},i),{strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{i as createOpoAction};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__awaiter as r,__generator as
|
|
7
|
+
import{__awaiter as r,__generator as t,__assign as s}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as e}from"../../../services/mutate-data.js";import{flattenAttributes as o}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,m,p,l;return t(this,(function(t){switch(t.label){case 0:return r=Object.fromEntries(n),m=i(n),[4,e("PUT","/api/opos/".concat(r.id),m)];case 1:return(p=t.sent())?p.error?[2,s(s({},a),{strapiErrors:p.error,message:"Failed to Update Opo."})]:(l=o(p),[2,s(s({},a),{message:"Opo Updated",data:l,strapiErrors:null})]):[2,s(s({},a),{strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{a as updateOpoAction};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__awaiter as r,__generator as
|
|
7
|
+
import{__awaiter as r,__generator as t,__assign as a}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 o}from"../../../../lib/parseFormData.js";function i(i,d){return r(this,void 0,void 0,(function(){var r,l,n,p;return t(this,(function(t){switch(t.label){case 0:return r=Object.fromEntries(d),(l=o(d)).data.categories&&(l.data.categories=JSON.parse(l.data.categories)),l.data.gallery&&(l.data.gallery=JSON.parse(l.data.gallery)),l.data.stock_reports&&(l.data.stock_reports=JSON.parse(l.data.stock_reports)),[4,e("PUT","/api/products/".concat(r.id),l)];case 1:return(n=t.sent())?n.error?[2,a(a({},i),{strapiErrors:n.error,message:"Failed to Update Product."})]:(p=s(n),[2,a(a({},i),{message:"Product Updated",data:p,strapiErrors:null})]):[2,a(a({},i),{strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{i as updateProductAction};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__awaiter as r,__generator as
|
|
7
|
+
import{__awaiter as r,__generator as t,__assign as s}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as e}from"../../../services/mutate-data.js";import{flattenAttributes as o}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,m,p,l;return t(this,(function(t){switch(t.label){case 0:return r=Object.fromEntries(n),m=i(n),[4,e("PUT","/api/ipos/".concat(r.id),m)];case 1:return(p=t.sent())?p.error?[2,s(s({},a),{strapiErrors:p.error,message:"Failed to Update Ipo."})]:(l=o(p),[2,s(s({},a),{message:"Ipo Updated",data:l,strapiErrors:null})]):[2,s(s({},a),{strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{a as updateIpoAction};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__awaiter as r,__generator as e,__assign as t}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as
|
|
7
|
+
import{__awaiter as r,__generator as e,__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";function i(i,n,m){return r(this,void 0,void 0,(function(){var r,l,u,d;return e(this,(function(e){switch(e.label){case 0:return Object.fromEntries(m),r=o(m),l={data:t(t({},r.data),{related:i})},[4,s("POST","/api/notes",l)];case 1:return(u=e.sent())?u.error?[2,t(t({},n),{strapiErrors:u.error,message:"Failed to Create Note."})]:(d=a(u),[2,t(t({},n),{message:"New Note Created",data:d,strapiErrors:null})]):[2,t(t({},n),{strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{i as createNoteAction};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__awaiter as r,__generator as e,__assign as t}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as
|
|
7
|
+
import{__awaiter as r,__generator as e,__assign as t}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as s}from"../../../services/mutate-data.js";import{flattenAttributes as o}from"../../../../lib/utils.js";import{parseFormData as a}from"../../../../lib/parseFormData.js";function i(i,n){return r(this,void 0,void 0,(function(){var r,d,l;return e(this,(function(e){switch(e.label){case 0:return Object.fromEntries(n),(r=a(n)).data.products&&(r.data.products=JSON.parse(r.data.products)),[4,s("POST","/api/vendor-profiles",r)];case 1:return d=e.sent(),console.dir(d,{depth:null}),d?d.error?[2,t(t({},i),{strapiErrors:d.error,message:"Failed to Create Vendor."})]:(l=o(d),[2,t(t({},i),{message:"New Vendor Created",data:l,strapiErrors:null})]):[2,t(t({},i),{strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{i as createVendorAction};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__awaiter as r,__generator as t,__assign as
|
|
7
|
+
import{__awaiter as r,__generator as t,__assign as e}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as s}from"../../../services/mutate-data.js";import{flattenAttributes as o}from"../../../../lib/utils.js";import{parseFormData as a}from"../../../../lib/parseFormData.js";function i(i,n){return r(this,void 0,void 0,(function(){var r,d,p,m;return t(this,(function(t){switch(t.label){case 0:return r=Object.fromEntries(n),(d=a(n)).data.products&&(d.data.products=JSON.parse(d.data.products)),[4,s("PUT","/api/vendor-profiles/".concat(r.id),d)];case 1:return(p=t.sent())?p.error?[2,e(e({},i),{strapiErrors:p.error,message:"Failed to Update Vendor."})]:(m=o(p),[2,e(e({},i),{message:"Vendor Updated",data:m,strapiErrors:null})]):[2,e(e({},i),{strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{i as updateVendorAction};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
import{__awaiter as
|
|
6
|
+
import{__awaiter as r,__generator as e,__assign as t}from"../../../../node_modules/tslib/tslib.es6.js";import{z as n}from"zod";import{mutateData as s}from"../../services/mutate-data.js";import{flattenAttributes as o}from"../../../lib/utils.js";import{parseFormData as i}from"../../../lib/parseFormData.js";var a=n.object({files:n.any()});function l(n,l,u,m,d){return r(this,void 0,void 0,(function(){var f,c,p,v,g,E,b,F,h,j=this;return e(this,(function(w){switch(w.label){case 0:return f=Object.fromEntries(d),i(d),(c=a.safeParse({files:f.files})).success?(p="".concat(n,"/").concat(l),(v=d.getAll("files")).map((function(r){return r instanceof File?r.name:null})).filter((function(r){return null!==r})),[4,Promise.all(v.map((function(t){return r(j,void 0,void 0,(function(){var r,n,s;return e(this,(function(e){return t instanceof File?(r=t.name.split(".").pop(),n=t.type,(s=new FileReader).readAsDataURL(t),[2,new Promise((function(e){s.onloadend=function(){var o,i=(null===(o=s.result)||void 0===o?void 0:o.toString().split(",")[1])||"";e({name:t.name,ext:r,mime:n,base64_string:i})}}))]):[2,null]}))}))})))]):[2,t(t({},m),{zodErrors:c.error.flatten().fieldErrors,strapiErrors:null,data:null,message:"Invalid Image"})];case 1:return g=w.sent(),E={data:(h={id:l},h[u]=g[0],h)},[4,s("PUT",p,E)];case 2:return(b=w.sent())?b.error?[2,t(t({},m),{strapiErrors:b.error,zodErrors:null,message:"Failed to Upload File."})]:(F=o(b),[2,t(t({},m),{data:F,zodErrors:null,strapiErrors:null,message:"File Uploaded"})]):[2,t(t({},m),{strapiErrors:null,zodErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{l as uploadBase64MediaAction};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__awaiter as r,__generator as e,__assign as s}from"../../../node_modules/tslib/tslib.es6.js";import{mutateData as i}from"../services/mutate-data.js";import{flattenAttributes as
|
|
7
|
+
import{__awaiter as r,__generator as e,__assign as s}from"../../../node_modules/tslib/tslib.es6.js";import{mutateData as i}from"../services/mutate-data.js";import{flattenAttributes as t}from"../../lib/utils.js";import{parseFormData as a}from"../../lib/parseFormData.js";function o(o,d){return r(this,void 0,void 0,(function(){var r,l,n,m,u;return e(this,(function(e){switch(e.label){case 0:return r=Object.fromEntries(d),void 0===(l=a(d)).data.delivery_address&&(console.log("delivery_address is undefined"),l.data.delivery_address=null),void 0===l.data.billing_address&&(console.log("billing_address is undefined"),l.data.billing_address=null),n=r.id,[4,i("PUT","/api/customer-profiles/".concat(n),l)];case 1:return(m=e.sent())?m.error?[2,s(s({},o),{strapiErrors:m.error,message:"Failed to Register."})]:(u=t(m),[2,s(s({},o),{message:"Profile Updated",data:u,strapiErrors:null})]):[2,s(s({},o),{strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{o as updateCustomerProfileAction};
|