umwd-components 0.1.635 → 0.1.636
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/e-commerce/checkout/CheckoutForm.js +1 -1
- package/dist/src/components/e-commerce/checkout/Step3.js +1 -1
- package/dist/src/components/e-commerce/checkout/Step4.js +1 -1
- package/dist/src/components/e-commerce/invoice/InvoicePDF.js +1 -1
- package/dist/src/components/e-commerce/iro/CreateIROForm.js +1 -1
- package/dist/src/components/e-commerce/iro/TextualManageIROForm.js +1 -1
- package/dist/src/components/e-commerce/opo/CreateOpoForm.js +1 -1
- package/dist/src/components/e-commerce/opo/ManageOpoForm.js +1 -1
- package/dist/src/components/e-commerce/opo/TextualManageOpoForm.js +1 -1
- package/dist/src/components/logistics/ipo/AddIPOForm.js +1 -1
- package/dist/src/components/logistics/ipo/ManageIPOForm.js +1 -1
- package/dist/src/components/logistics/ipo/TextualManageIPOForm.js +1 -1
- package/dist/src/context/e-commerce/checkout/CheckoutContext.js +1 -1
- package/dist/src/data/actions/logistics/ipo/createIPOAction.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/components/e-commerce/checkout/Step4.d.ts +2 -2
- package/dist/types/types/e-commerce/checkout/types.d.ts +3 -3
- package/dist/types/types/e-commerce/invoice/types.d.ts +1 -1
- package/dist/types/types/e-commerce/iro/types.d.ts +2 -1
- package/dist/types/types/e-commerce/opo/types.d.ts +1 -1
- package/dist/types/types/logistics/Ipo.d.ts +1 -1
- package/next-env.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/e-commerce/checkout/CheckoutForm.tsx +1 -5
- package/src/components/e-commerce/checkout/Step3.tsx +2 -2
- package/src/components/e-commerce/checkout/Step4.tsx +5 -6
- package/src/components/e-commerce/invoice/InvoicePDF.tsx +2 -2
- package/src/components/e-commerce/iro/CreateIROForm.tsx +2 -2
- package/src/components/e-commerce/iro/ManageIROForm.tsx +1 -1
- package/src/components/e-commerce/iro/TextualManageIROForm.tsx +10 -4
- package/src/components/e-commerce/opo/CreateOpoForm.tsx +2 -2
- package/src/components/e-commerce/opo/ManageOpoForm.tsx +1 -3
- package/src/components/e-commerce/opo/TextualManageOpoForm.tsx +1 -3
- package/src/components/logistics/ipo/AddIPOForm.tsx +4 -4
- package/src/components/logistics/ipo/ManageIPOForm.tsx +1 -1
- package/src/components/logistics/ipo/TextualManageIPOForm.tsx +1 -1
- package/src/context/e-commerce/checkout/CheckoutContext.tsx +5 -5
- package/src/data/actions/logistics/ipo/createIPOAction.ts +1 -1
- package/src/types/e-commerce/checkout/types.ts +3 -3
- package/src/types/e-commerce/invoice/types.ts +1 -1
- package/src/types/e-commerce/iro/types.ts +2 -1
- package/src/types/e-commerce/opo/types.ts +1 -1
- package/src/types/logistics/Ipo.ts +1 -1
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
import{__exports as r}from"../../_virtual/
|
|
6
|
+
import{__exports as r}from"../../_virtual/index7.js";var t;function e(){if(t)return r;t=1,r.byteLength=function(r){var t=i(r),e=t[0],n=t[1];return 3*(e+n)/4-n},r.toByteArray=function(r){var t,e,a=i(r),u=a[0],h=a[1],c=new o(function(r,t,e){return 3*(t+e)/4-e}(0,u,h)),f=0,d=h>0?u-4:u;for(e=0;e<d;e+=4)t=n[r.charCodeAt(e)]<<18|n[r.charCodeAt(e+1)]<<12|n[r.charCodeAt(e+2)]<<6|n[r.charCodeAt(e+3)],c[f++]=t>>16&255,c[f++]=t>>8&255,c[f++]=255&t;2===h&&(t=n[r.charCodeAt(e)]<<2|n[r.charCodeAt(e+1)]>>4,c[f++]=255&t);1===h&&(t=n[r.charCodeAt(e)]<<10|n[r.charCodeAt(e+1)]<<4|n[r.charCodeAt(e+2)]>>2,c[f++]=t>>8&255,c[f++]=255&t);return c},r.fromByteArray=function(r){for(var t,n=r.length,o=n%3,a=[],u=16383,i=0,c=n-o;i<c;i+=u)a.push(h(r,i,i+u>c?c:i+u));1===o?(t=r[n-1],a.push(e[t>>2]+e[t<<4&63]+"==")):2===o&&(t=(r[n-2]<<8)+r[n-1],a.push(e[t>>10]+e[t>>4&63]+e[t<<2&63]+"="));return a.join("")};for(var e=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0;u<64;++u)e[u]=a[u],n[a.charCodeAt(u)]=u;function i(r){var t=r.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=r.indexOf("=");return-1===e&&(e=t),[e,e===t?0:4-e%4]}function h(r,t,n){for(var o,a,u=[],i=t;i<n;i+=3)o=(r[i]<<16&16711680)+(r[i+1]<<8&65280)+(255&r[i+2]),u.push(e[(a=o)>>18&63]+e[a>>12&63]+e[a>>6&63]+e[63&a]);return u.join("")}return n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63,r}export{e as __require};
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
import{__exports as a}from"../../_virtual/
|
|
6
|
+
import{__exports as a}from"../../_virtual/index8.js";
|
|
7
7
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */var t;function o(){return t||(t=1,a.read=function(a,t,o,r,h){var M,e,i=8*h-r-1,p=(1<<i)-1,f=p>>1,n=-7,w=o?h-1:0,s=o?-1:1,u=a[t+w];for(w+=s,M=u&(1<<-n)-1,u>>=-n,n+=i;n>0;M=256*M+a[t+w],w+=s,n-=8);for(e=M&(1<<-n)-1,M>>=-n,n+=r;n>0;e=256*e+a[t+w],w+=s,n-=8);if(0===M)M=1-f;else{if(M===p)return e?NaN:1/0*(u?-1:1);e+=Math.pow(2,r),M-=f}return(u?-1:1)*e*Math.pow(2,M-r)},a.write=function(a,t,o,r,h,M){var e,i,p,f=8*M-h-1,n=(1<<f)-1,w=n>>1,s=23===h?Math.pow(2,-24)-Math.pow(2,-77):0,u=r?0:M-1,N=r?1:-1,_=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(i=isNaN(t)?1:0,e=n):(e=Math.floor(Math.log(t)/Math.LN2),t*(p=Math.pow(2,-e))<1&&(e--,p*=2),(t+=e+w>=1?s/p:s*Math.pow(2,1-w))*p>=2&&(e++,p/=2),e+w>=n?(i=0,e=n):e+w>=1?(i=(t*p-1)*Math.pow(2,h),e+=w):(i=t*Math.pow(2,w-1)*Math.pow(2,h),e=0));h>=8;a[o+u]=255&i,u+=N,i/=256,h-=8);for(e=e<<h|i,f+=h;f>0;a[o+u]=255&e,u+=N,e/=256,f-=8);a[o+u-N]|=128*_}),a}export{o as __require};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{extends as e}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import{__read as t}from"../../../../node_modules/tslib/tslib.es6.js";import r from"@mui/material/Typography";import n from"@mui/material/Container";import l from"@mui/material/Stack";import
|
|
7
|
+
import{extends as e}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import{__read as t}from"../../../../node_modules/tslib/tslib.es6.js";import r from"@mui/material/Typography";import n from"@mui/material/Container";import l from"@mui/material/Stack";import o from"@mui/material/Grid";import i from"@mui/material/Paper";import a from"@mui/material/Box";import m from"@mui/material/Button";import s from"@mui/material/Stepper";import c from"@mui/material/Step";import u from"@mui/material/StepLabel";import p from"@mui/material/MobileStepper";import d from"@mui/material/Alert";import f from"@mui/material/useMediaQuery";import{useTheme as E}from"@mui/material/styles";import x,{useState as g,useEffect as v,useMemo as b}from"react";import h from"next/link";import{useSearchParams as y}from"next/navigation";import{useSession as k}from"../../../context/auth/SessionContext.js";import B from"@mui/icons-material/KeyboardArrowLeft";import C from"@mui/icons-material/KeyboardArrowRight";import S from"./Step1.js";import _ from"./Step2.js";import A from"./Step3.js";import j from"./Step4.js";import N from"./Step5.js";import{useCheckout as D}from"../../../context/e-commerce/checkout/CheckoutContext.js";import{useCart as P}from"../../../context/e-commerce/cart/CartContext.js";import w from"../../../lib/isCustomerProfileCompleteEnough.js";function z(z){var I=z.shopUrl,O=void 0===I?"/shop":I,T=E(),H=f(T.breakpoints.down("sm")),L=D(),M=L.state,R=L.runAllChecks,V=L.togglePrefersBillingAddress,F=L.togglePrefersDeliveryAddress,K=L.setCustomerInternalReference,G=P().dispatch,Q=k(),U=Q.loading;Q.error;var q=Q.user;Q.login;var J=Q.logout,W=t(g(0),2),X=W[0],Y=W[1],Z=t(g(null),2),$=Z[0],ee=Z[1],te=t(g(null),2),re=te[0],ne=te[1],le=function(){Y((function(e){return e+1}))},oe=function(){Y((function(e){return e-1}))},ie=y();v((function(){if(null!==ie){var e=ie.get("order");e&&ee(e);var t=ie.get("message"),r=ie.get("severity");t&&r&&ne({message:t,severity:r})}}),[ie]),v((function(){$&&(Y(4),localStorage.removeItem("cart"),G({type:"SET_ITEMS",payload:[]}))}),[$]),v((function(){q&&(console.log("checkout change in user"),R())}),[q]);var ae=!M.confirmations.itemsInCart,me=b((function(){return null!==(null==q?void 0:q.customer_profile)&&w(null==q?void 0:q.customer_profile)}),[null==q?void 0:q.customer_profile]),se=b((function(){return[{label:"Login or register",children:x.createElement(S,{user:q,logout:J}),backButton:x.createElement(m,{variant:H?"text":"outlined",disabled:0===X,onClick:oe,sx:{mr:1}},"Back",H&&x.createElement(B,null)),nextButton:x.createElement(m,{variant:H?"text":"contained",onClick:le,sx:{ml:1},disabled:(!q||ae)&&"production"===process.env.NODE_ENV,size:H?"small":"large"},"Next",H&&x.createElement(C,null))},{label:"Provide us with your address",children:x.createElement(_,null),backButton:x.createElement(m,{size:H?"small":"large",onClick:oe,disabled:0===X,variant:H?"text":"outlined"},"Back",H&&x.createElement(B,null)),nextButton:x.createElement(m,{size:H?"small":"large",variant:H?"text":"contained",onClick:function(){le()},disabled:(!q||ae||!me)&&"production"===process.env.NODE_ENV},"Next",H&&x.createElement(C,null))},{label:"Set up mailing options",children:x.createElement(A,{user:q,prefersBillingAddress:M.prefersBillingAddress,prefersDeliveryAddress:M.prefersDeliveryAddress,delivery_options:M.delivery_options,payment_options:M.payment_options,togglePrefersBillingAddress:V,togglePrefersDeliveryAddress:F,setCustomerInternalReference:K}),backButton:x.createElement(m,{size:H?"small":"large",variant:H?"text":"outlined",onClick:oe,disabled:0===X},"Back",H&&x.createElement(B,null)),nextButton:x.createElement(m,{size:H?"small":"large",variant:H?"text":"contained",onClick:function(){le()},disabled:(!q||ae||!me)&&"production"===process.env.NODE_ENV},"Next",H&&x.createElement(C,null))},{label:"Confirm and make a payment",children:x.createElement(j,{customer_reference:M.customer_reference}),nextButton:x.createElement(x.Fragment,null,x.createElement(m,{size:H?"small":"large",variant:H?"text":"contained",onClick:function(){le()},disabled:!0},"Next",H&&x.createElement(C,null))),backButton:x.createElement(m,{size:H?"small":"large",variant:H?"text":"outlined",onClick:oe,disabled:0===X},"Back",H&&x.createElement(B,null))},{label:"Done!",children:x.createElement(N,null)}]}),[q,ae,me,M,H,X]);return x.createElement(n,{sx:{py:2,minHeight:"100vh"}},x.createElement(o,{container:!0,spacing:2,sx:{py:3,minHeight:"60vh"}},x.createElement(o,{item:!0,xs:12},x.createElement(r,{variant:"h4",align:"center"},"Check Out")),ae&&4!=X&&x.createElement(o,{item:!0,xs:12},x.createElement(d,{severity:"error"},x.createElement(r,{variant:"h5"},"No products in cart"),x.createElement(r,{variant:"body1"},"There are no products selected to order, please visit the shop befor continuing"))),null!=re&&x.createElement(o,{item:!0,xs:12},x.createElement(d,{severity:re.severity},x.createElement(r,{variant:"body1"},re.message))),x.createElement(o,{item:!0,xs:12},x.createElement(a,{width:"100%"},x.createElement(i,{sx:{p:2,mb:2,display:{xs:"block",sm:"none"}}},x.createElement(l,{direction:"row",spacing:2,alignItems:"center"},x.createElement(r,{variant:"body2"},"".concat(X+1," / ").concat(se.length)),x.createElement(r,null,"".concat(se[X].label)))),x.createElement(i,{sx:{px:2,pt:2,mb:2,display:{xs:"none",sm:"block"}}},x.createElement(s,{activeStep:X},se.map((function(t,r){var n={};return x.createElement(c,e({key:r},{},{sx:{pb:"20px"}}),x.createElement(u,n,t.label))})))),!U&&x.createElement(x.Fragment,null,se[X].children,x.createElement(i,{sx:{p:2,mt:2,display:{xs:"none",sm:"block"}}},x.createElement(l,{direction:"row",spacing:2},se[X].backButton,x.createElement(m,{variant:"outlined",sx:{ml:1}},x.createElement(h,{href:O},"continue shopping")),x.createElement(a,{sx:{flex:"1 1 auto"}}),se[X].nextButton))))),x.createElement(o,{item:!0,xs:12},x.createElement(p,{sx:{display:{xs:"flex",sm:"none"}},variant:"text",steps:se.length,position:"static",activeStep:X,nextButton:se[X].nextButton,backButton:se[X].backButton}))))}export{z as default};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
import{extends as e}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import t from"react";import r from"@mui/material/Paper";import n from"@mui/material/Stack";import a from"@mui/material/Typography";import l from"@mui/material/Autocomplete";import i from"@mui/material/Grid";import o from"@mui/material/Checkbox";import m from"@mui/material/TextField";import s from"../../common/Address.js";function c(c){var d,p,u=c.user,f=c.prefersBillingAddress,E=void 0===f||f,v=c.prefersDeliveryAddress,g=void 0===v||v,
|
|
6
|
+
import{extends as e}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import t from"react";import r from"@mui/material/Paper";import n from"@mui/material/Stack";import a from"@mui/material/Typography";import l from"@mui/material/Autocomplete";import i from"@mui/material/Grid";import o from"@mui/material/Checkbox";import m from"@mui/material/TextField";import s from"../../common/Address.js";function c(c){var d,p,u=c.user,f=c.prefersBillingAddress,E=void 0===f||f,v=c.prefersDeliveryAddress,g=void 0===v||v,y=c.delivery_options,_=c.payment_options,h=c.togglePrefersBillingAddress,b=c.togglePrefersDeliveryAddress,x=c.setCustomerInternalReference;return t.createElement(r,{sx:{p:2}},t.createElement(n,{spacing:2},null!==u&&t.createElement("form",null,t.createElement(i,{container:!0,spacing:2},t.createElement(i,{item:!0,xs:12,md:6},t.createElement(n,{spacing:2,justifyContent:"space-between"},t.createElement(a,{variant:"h5"},"Delivery Options"),t.createElement(a,{variant:"body1"},"Your order will be delivered at this address"),g&&u.customer_profile.delivery_address?t.createElement(s,{data:u.customer_profile.delivery_address}):t.createElement(s,{data:u.customer_profile.company_address}),null!=(null===(d=null==u?void 0:u.customer_profile)||void 0===d?void 0:d.delivery_address)&&t.createElement(n,{direction:"row",spacing:2,alignItems:"center"},t.createElement(o,{checked:!g,onChange:b}),t.createElement(a,null,"Use company address instead")),y&&y.length>0&&t.createElement(l,{options:y,renderInput:function(r){return t.createElement(m,e({},r,{label:"Delivery Options"}))}}))),t.createElement(i,{item:!0,xs:12,md:6},t.createElement(n,{spacing:2,justifyContent:"space-between"},t.createElement(a,{variant:"h5"},"Payment Options"),t.createElement(a,{variant:"body1"},"Your invoice will be shipped to this address"),E&&u.customer_profile.billing_address?t.createElement(s,{data:u.customer_profile.billing_address}):t.createElement(s,{data:u.customer_profile.company_address}),null!=(null===(p=null==u?void 0:u.customer_profile)||void 0===p?void 0:p.billing_address)&&t.createElement(n,{direction:"row",spacing:2,alignItems:"center"},t.createElement(o,{checked:!E,onChange:h}),t.createElement(a,null,"Use company address instead")),_&&_.length>0&&t.createElement(l,{options:_,renderInput:function(r){return t.createElement(m,e({},r,{label:"Payment Options"}))}}))),t.createElement(i,{item:!0,xs:12},t.createElement(n,{spacing:2},t.createElement(a,{variant:"h5"},"Internal Reference"),t.createElement(a,{variant:"body1"},"Optionaly attach an internal reference to this order"),t.createElement(m,{id:"customer_reference",name:"customer_reference",label:"Internal Reference",onChange:function(e){return x(e.target.value)}})))))))}export{c 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,{Fragment as r}from"react";import a from"@mui/material/Paper";import o from"@mui/material/Stack";import m from"@mui/material/Alert";import n from"@mui/material/Button";import i from"@mui/material/Typography";import{useClientSideCart as l}from"../cart/hooks.js";import c from"../cart/CartSummary.js";import{useFormState as s}from"react-dom";import{checkoutAction as p}from"../../../data/actions/e-commerce/checkout-action.js";import{StrapiErrors as u}from"../../StrapiErrors.js";function d(d){var y=d.
|
|
7
|
+
import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t,{Fragment as r}from"react";import a from"@mui/material/Paper";import o from"@mui/material/Stack";import m from"@mui/material/Alert";import n from"@mui/material/Button";import i from"@mui/material/Typography";import{useClientSideCart as l}from"../cart/hooks.js";import c from"../cart/CartSummary.js";import{useFormState as s}from"react-dom";import{checkoutAction as p}from"../../../data/actions/e-commerce/checkout-action.js";import{StrapiErrors as u}from"../../StrapiErrors.js";function d(d){var y=d.customer_reference,f=l(),E=f.state;f.isClient;var h=e(s(p,{zodErrors:null,strapiErrors:null,data:null,message:null}),2),v=h[0],g=h[1];return t.createElement(a,{sx:{p:2}},t.createElement(o,{spacing:2},t.createElement(c,null),t.createElement(u,{error:null==v?void 0:v.strapiErrors}),(null==v?void 0:v.message)&&t.createElement(m,{severity:"error"},null==v?void 0:v.message),t.createElement(i,null,"Please double check all details prior to payment. ",y),t.createElement(i,null,"Is this order compleet?"),t.createElement("form",{id:"paymentform",action:g},E.items&&E.items.map((function(e,a){return t.createElement(r,{key:a},t.createElement("input",{type:"hidden",name:"opo_items[".concat(a,"].product"),value:e.id}),t.createElement("input",{type:"hidden",name:"opo_items[".concat(a,"].ordered_quantity"),value:e.quantity}))})),t.createElement("input",{type:"hidden",name:"customer_reference",value:y}),t.createElement(i,null,"Please click 'Proceed to payment' to proceed to the secure payment page. After completing the payment, you will automatically return to our shop. For any updates on this order, you can always access the latest information in your personal details."),t.createElement(n,{variant:"contained",form:"paymentform",type:"submit"},"Proceed to payment"))))}export{d 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}from"../../../../node_modules/tslib/tslib.es6.js";import{StyleSheet as l,PDFDownloadLink as n,PDFViewer as o,Document as r,Page as i,View as c,Text as a}from"@react-pdf/renderer";import m,{useState as d,Fragment as u}from"react";import s from"@mui/material/IconButton";import E from"@mui/material/Dialog";import y from"@mui/material/DialogContent";import v from"@mui/material/DialogActions";import p from"@mui/material/Button";import S from"@mui/icons-material/PictureAsPdf";var f=l.create({page:{flexDirection:"column",backgroundColor:"#E4E4E4"},header:{padding:10,flexDirection:"row",alignItems:"center"},logo:{width:24,height:24,marginRight:10},section:{margin:10,padding:10,fontSize:12},row:{flexDirection:"row"},rowSection:{flex:1},productRowSection:{flex:1,width:1/6},h1:{fontSize:28},h2:{fontSize:24,fontStyle:"bold"},h3:{fontSize:16,fontStyle:"bold"}});function _(e){var l,n,o,d,s,E,y,v=e.props.invoice;console.log("invoice from invoicePDF",v);var p=v.seller_business_credentials,S=v.seller_company_address,_=v.buyer_company_address,w=v.buyer_business_credentials;return m.createElement(r,{title:"invoice_".concat(null==v?void 0:v.invoice_number)},m.createElement(i,{size:"A4",style:f.page},m.createElement(c,{style:f.header},m.createElement(a,{style:f.h1},null==p?void 0:p.company_name)),m.createElement(c,{style:f.section},m.createElement(a,{style:f.h2},"INVOICE")),m.createElement(c,{style:f.section},m.createElement(c,{style:f.row},m.createElement(c,{style:f.rowSection},m.createElement(a,{style:f.h3},"BILLING DETAILS"),m.createElement(a,null,null==w?void 0:w.company_name),m.createElement(a,null,null==v?void 0:v.buyer_first_name," ",null==v?void 0:v.buyer_last_name),m.createElement(a,null,null==_?void 0:_.street," ",null==_?void 0:_.street_number," ",null==_?void 0:_.street_number_addition),m.createElement(a,null,null==_?void 0:_.postal_code," ",null==_?void 0:_.city)),m.createElement(c,{style:f.rowSection},m.createElement(a,{style:f.h3},"FROM"),m.createElement(a,null,null==p?void 0:p.company_name),m.createElement(a,null,null==S?void 0:S.street," ",null==S?void 0:S.street_number," ",null==S?void 0:S.street_number_addition),m.createElement(a,null,null==S?void 0:S.postal_code," ",null==S?void 0:S.city),m.createElement(a,{style:{fontStyle:"bold",marginTop:10}},"CoC Number"),m.createElement(a,null,null==p?void 0:p.coc_number),m.createElement(a,{style:{fontStyle:"bold",marginTop:10}},"VAT Number"),m.createElement(a,null,null==p?void 0:p.vat_number)))),m.createElement(c,{style:f.section},m.createElement(c,{style:f.row},m.createElement(c,{style:f.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Invoice number: "),m.createElement(a,null,null==v?void 0:v.invoice_number)),(null==v?void 0:v.
|
|
7
|
+
import{__read as e,__assign as t}from"../../../../node_modules/tslib/tslib.es6.js";import{StyleSheet as l,PDFDownloadLink as n,PDFViewer as o,Document as r,Page as i,View as c,Text as a}from"@react-pdf/renderer";import m,{useState as d,Fragment as u}from"react";import s from"@mui/material/IconButton";import E from"@mui/material/Dialog";import y from"@mui/material/DialogContent";import v from"@mui/material/DialogActions";import p from"@mui/material/Button";import S from"@mui/icons-material/PictureAsPdf";var f=l.create({page:{flexDirection:"column",backgroundColor:"#E4E4E4"},header:{padding:10,flexDirection:"row",alignItems:"center"},logo:{width:24,height:24,marginRight:10},section:{margin:10,padding:10,fontSize:12},row:{flexDirection:"row"},rowSection:{flex:1},productRowSection:{flex:1,width:1/6},h1:{fontSize:28},h2:{fontSize:24,fontStyle:"bold"},h3:{fontSize:16,fontStyle:"bold"}});function _(e){var l,n,o,d,s,E,y,v=e.props.invoice;console.log("invoice from invoicePDF",v);var p=v.seller_business_credentials,S=v.seller_company_address,_=v.buyer_company_address,w=v.buyer_business_credentials;return m.createElement(r,{title:"invoice_".concat(null==v?void 0:v.invoice_number)},m.createElement(i,{size:"A4",style:f.page},m.createElement(c,{style:f.header},m.createElement(a,{style:f.h1},null==p?void 0:p.company_name)),m.createElement(c,{style:f.section},m.createElement(a,{style:f.h2},"INVOICE")),m.createElement(c,{style:f.section},m.createElement(c,{style:f.row},m.createElement(c,{style:f.rowSection},m.createElement(a,{style:f.h3},"BILLING DETAILS"),m.createElement(a,null,null==w?void 0:w.company_name),m.createElement(a,null,null==v?void 0:v.buyer_first_name," ",null==v?void 0:v.buyer_last_name),m.createElement(a,null,null==_?void 0:_.street," ",null==_?void 0:_.street_number," ",null==_?void 0:_.street_number_addition),m.createElement(a,null,null==_?void 0:_.postal_code," ",null==_?void 0:_.city)),m.createElement(c,{style:f.rowSection},m.createElement(a,{style:f.h3},"FROM"),m.createElement(a,null,null==p?void 0:p.company_name),m.createElement(a,null,null==S?void 0:S.street," ",null==S?void 0:S.street_number," ",null==S?void 0:S.street_number_addition),m.createElement(a,null,null==S?void 0:S.postal_code," ",null==S?void 0:S.city),m.createElement(a,{style:{fontStyle:"bold",marginTop:10}},"CoC Number"),m.createElement(a,null,null==p?void 0:p.coc_number),m.createElement(a,{style:{fontStyle:"bold",marginTop:10}},"VAT Number"),m.createElement(a,null,null==p?void 0:p.vat_number)))),m.createElement(c,{style:f.section},m.createElement(c,{style:f.row},m.createElement(c,{style:f.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Invoice number: "),m.createElement(a,null,null==v?void 0:v.invoice_number)),(null==v?void 0:v.customer_reference)&&m.createElement(c,{style:f.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Your reference: "),m.createElement(a,null,null==v?void 0:v.customer_reference)),m.createElement(c,{style:f.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Invoice date"),m.createElement(a,null,null==v?void 0:v.invoice_date)))),m.createElement(c,{style:f.section},m.createElement(a,{style:f.h3},"SUMMARY"),m.createElement(c,{style:f.row},(null===(l=null==v?void 0:v.admin_items)||void 0===l?void 0:l.length)>0&&m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Line Item Number")),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Title")),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Amount")),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"VAT rate")),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"VAT")),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Excl. VAT")),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Incl. VAT"))),null===(n=null==v?void 0:v.items)||void 0===n?void 0:n.map((function(e,t){var l,n,o;return m.createElement(u,{key:t},m.createElement(c,{style:f.row},m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"product_title"in e&&e.product_title,"item_description"in e&&e.item_description)),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.quantity)),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.vat_rate," %")," "),m.createElement(c,{style:f.productRowSection},e.price_excl_vat&&e.price_incl_vat&&m.createElement(a,{style:{fontSize:"10px"}},"€"," ",null===(l=e.price_incl_vat-e.price_excl_vat)||void 0===l?void 0:l.toFixed(2))),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(n=e.price_excl_vat)||void 0===n?void 0:n.toFixed(2))),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(o=e.price_incl_vat)||void 0===o?void 0:o.toFixed(2)))))})),null===(o=null==v?void 0:v.admin_items)||void 0===o?void 0:o.map((function(e,t){var l,n,o,r,i,d,s;return m.createElement(u,{key:t},m.createElement(c,{style:f.row},m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.line_item_number)),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.description)),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.quantity)),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},null===(l=null==e?void 0:e.price)||void 0===l?void 0:l.vat_rate," %")),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(o=null===(n=null==e?void 0:e.price)||void 0===n?void 0:n.vat)||void 0===o?void 0:o.toFixed(2))),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(i=null===(r=null==e?void 0:e.price)||void 0===r?void 0:r.price)||void 0===i?void 0:i.toFixed(2))),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(s=null===(d=null==e?void 0:e.price)||void 0===d?void 0:d.price_incl_vat)||void 0===s?void 0:s.toFixed(2)))))}))),m.createElement(c,{style:f.section},m.createElement(a,{style:f.h3},"TOTALS"),m.createElement(c,{style:f.row},m.createElement(c,{style:f.productRowSection}),m.createElement(c,{style:f.productRowSection}),m.createElement(c,{style:f.productRowSection}),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"VAT")),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Excl. VAT")),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Incl. VAT"))),m.createElement(c,{style:f.row},m.createElement(c,{style:f.productRowSection}),m.createElement(c,{style:f.productRowSection}),m.createElement(c,{style:f.productRowSection}),m.createElement(c,{style:f.productRowSection},m.createElement(a,null,"€ ",null===(d=null==v?void 0:v.VAT_total)||void 0===d?void 0:d.toFixed(2))),m.createElement(c,{style:f.productRowSection},m.createElement(a,null,"€ ",null===(s=null==v?void 0:v.total_excl_vat)||void 0===s?void 0:s.toFixed(2))),m.createElement(c,{style:f.productRowSection},m.createElement(a,null,"€ ",null===(E=null==v?void 0:v.total_incl_vat)||void 0===E?void 0:E.toFixed(2))))),m.createElement(c,{style:f.section},m.createElement(a,{style:t(t({},f.h3),{border:"2px solid black",padding:10})},"Total Due: € ",null===(y=null==v?void 0:v.total_incl_vat)||void 0===y?void 0:y.toFixed(2)))))}function w(e){var t=e.invoice;return m.createElement(n,{document:m.createElement(_,{props:{invoice:t}}),fileName:"invoice_".concat(null==t?void 0:t.invoice_number)},m.createElement(s,null,m.createElement(S,null)))}function x(t){var l=t.invoice,n=e(d(!1),2),r=n[0],i=n[1];return m.createElement(m.Fragment,null,m.createElement(s,{onClick:function(){return i(!0)}},m.createElement(S,null)),m.createElement(E,{open:r,fullWidth:!0,maxWidth:"lg"},m.createElement(y,null,m.createElement(o,{style:{width:"100%",minHeight:"70vh"}},m.createElement(_,{props:{invoice:l}}))),m.createElement(v,null,m.createElement(p,{variant:"contained",onClick:function(){return i(!1)}},"Close"))))}export{w as InvoiceDownloadLink,x as InvoicePDFViewer};
|
|
@@ -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,{useState as a,useEffect as o}from"react";import{useFormState as m}from"react-dom";import{createIroAction as n}from"../../../data/actions/e-commerce/iro/createIroAction.js";import{StrapiErrors as i}from"../../StrapiErrors.js";import{SubmitButton as l}from"../../SubmitButton.js";import{CustomerSelector as s}from"../customer/CustomerSelector.js";import{IROItemFields as c}from"./IROItemFields.js";import u from"@mui/material/Typography";import d from"@mui/material/Grid";import p from"@mui/material/Box";import f from"@mui/material/TextField";import E from"@mui/material/Checkbox";import h from"@mui/material/Alert";import v from"@mui/material/Stack";var g={zodErrors:null,strapiErrors:null,data:null,message:null};function x(x){var y=x.sx,b=x.revalidateCallback;x.handleClose;var C=x.customerLabels,w=x.productLabels,I=e(a(!1),2),j=I[0],A=I[1],S=e(m(n,g),2),
|
|
7
|
+
import{__read as e,__spreadArray as r}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as a,useEffect as o}from"react";import{useFormState as m}from"react-dom";import{createIroAction as n}from"../../../data/actions/e-commerce/iro/createIroAction.js";import{StrapiErrors as i}from"../../StrapiErrors.js";import{SubmitButton as l}from"../../SubmitButton.js";import{CustomerSelector as s}from"../customer/CustomerSelector.js";import{IROItemFields as c}from"./IROItemFields.js";import u from"@mui/material/Typography";import d from"@mui/material/Grid";import p from"@mui/material/Box";import f from"@mui/material/TextField";import E from"@mui/material/Checkbox";import h from"@mui/material/Alert";import v from"@mui/material/Stack";var g={zodErrors:null,strapiErrors:null,data:null,message:null};function x(x){var y=x.sx,b=x.revalidateCallback;x.handleClose;var C=x.customerLabels,w=x.productLabels,I=e(a(!1),2),j=I[0],A=I[1],S=e(m(n,g),2),k=S[0],L=S[1];return o((function(){(null==k?void 0:k.data)&&b&&b()}),[k.data]),t.createElement(p,{sx:r([],e(Array.isArray(y)?y:[y]),!1)},t.createElement("form",{action:L},t.createElement(d,{container:!0,spacing:2},t.createElement(d,{item:!0,xs:12},t.createElement(v,{spacing:2},t.createElement(u,{variant:"h6"},"Choose a customer"),t.createElement(u,{variant:"body2"},"Select the customer for which you want to create a return order"),t.createElement(s,{customerLabels:C}))),t.createElement(d,{item:!0,xs:12},t.createElement(v,{spacing:2},t.createElement(u,{variant:"h6"},"Customer reference"),t.createElement(u,null,"If the customer utilizes a custom reference for inbound order management it should be left here"),t.createElement(f,{id:"customer_reference",name:"customer_reference",sx:{width:"100%"}}))),t.createElement(d,{item:!0,xs:12},t.createElement(u,{variant:"h6"},"Choose products that should be in this return order"),t.createElement(c,{productsArr:w})),t.createElement(d,{item:!0,xs:12},t.createElement(u,{variant:"h6"},"Confirm Order"),t.createElement(u,null,"Are you sure you want to confirm this return? Confirming this order means you are sure the customer wants to return the products and you are ready to process the return."),t.createElement(v,{direction:"row",spacing:1,alignItems:"center"},t.createElement(E,{value:j,checked:j,onChange:function(){return A(!j)}}),j&&t.createElement(u,{color:"primary"},"I am sure I want to confirm this return order")),t.createElement("input",{name:"status",type:"hidden",value:j?"returning":"requested"})),t.createElement(d,{item:!0,xs:12},t.createElement(l,{text:"Confirm",loadingText:"Loading..."}),null!==(null==k?void 0:k.strapiErrors)&&t.createElement(i,{error:null==k?void 0:k.strapiErrors}),(null==k?void 0:k.message)&&t.createElement(h,{severity:"error"},null==k?void 0:k.message)))))}export{x 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,__assign as r}from"../../../../node_modules/tslib/tslib.es6.js";import n,{useState as a,useEffect as i}from"react";import{useFormState as o}from"react-dom";import{updateIroAction as l}from"../../../data/actions/e-commerce/iro/updateIroAction.js";import m from"./TextualIROItemUpdater.js";import c from"./IroItemDisplay.js";import d from"../../logistics/note/NotesDisplay.js";import s from"../../logistics/note/NoteTakingComponent.js";import{StrapiErrors as u}from"../../StrapiErrors.js";import{SubmitButton as p}from"../../SubmitButton.js";import v from"@mui/material/Alert";import
|
|
6
|
+
import{__read as e,__spreadArray as t,__assign as r}from"../../../../node_modules/tslib/tslib.es6.js";import n,{useState as a,useEffect as i}from"react";import{useFormState as o}from"react-dom";import{updateIroAction as l}from"../../../data/actions/e-commerce/iro/updateIroAction.js";import m from"./TextualIROItemUpdater.js";import c from"./IroItemDisplay.js";import d from"../../logistics/note/NotesDisplay.js";import s from"../../logistics/note/NoteTakingComponent.js";import{StrapiErrors as u}from"../../StrapiErrors.js";import{SubmitButton as p}from"../../SubmitButton.js";import v from"@mui/material/Alert";import E from"@mui/material/Dialog";import f from"@mui/material/DialogActions";import g from"@mui/material/DialogContent";import y from"@mui/material/DialogTitle";import h from"@mui/material/Typography";import b from"@mui/material/Button";import x from"@mui/material/Grid";import w from"@mui/material/Box";import C from"@mui/material/Paper";import _ from"@mui/material/Stack";import I from"@mui/material/Divider";import{confirmationService as k}from"../../../data/services/common/confirmation-service.js";import{FormControlLabel as j,Checkbox as D,List as q,ListItem as A}from"@mui/material";var R={zodErrors:null,strapiErrors:null,data:null,message:null};function S(e){var t=e.open,r=e.handleClose,a=e.orderID,i=e.currentStatus,o=e.revalidateCallback;return n.createElement(E,{open:t},n.createElement(y,null,"Confirm Return"),n.createElement(g,null,n.createElement(_,{spacing:2},n.createElement(h,null,"Are you sure you want to confirm this return?"),n.createElement(q,null,"requested"===i&&n.createElement(A,null,"When confirming this return order a rma number will be generated"),n.createElement(A,null,"requested"===i?"By confirming the return you will update it's status from requested to returning":"By confirming the return you will update it's status from finalising_process to done")),n.createElement(h,null,"Current status: ",i))),n.createElement(f,null,n.createElement(b,{variant:"contained",onClick:function(e){k("iros",[a]),o&&o()}},"Confirm"),n.createElement(b,{variant:"contained",onClick:r},"Cancel")))}function B(E){var f,g,y,k,q=E.data,A=E.sx,B=E.revalidateCallback;E.handleClose;var N=E.role,T=e(o(l,R),2),U=T[0],M=T[1],O=e(a(q.iro_items.data?q.iro_items.data:[]),2),P=O[0],z=O[1],F=e(a(!1),2),G=F[0],J=F[1],L=e(a(["received","registered","released","reports"]),2),Q=L[0],W=L[1],H=function(r,n,a){var i=t([],e(P),!1),o=i.findIndex((function(e){return e.id===n}));i[o][a]=r,z(i)},K=function(n,a){var i,o,l,m=t([],e(P),!1),c=m.findIndex((function(e){return e.id===a})),d=(null===(o=null===(i=m[c])||void 0===i?void 0:i.reports)||void 0===o?void 0:o.data)||[],s=t(t([],e(d),!1),[n],!1);null==(null===(l=m[c])||void 0===l?void 0:l.reports)&&(m[c]=r(r({},m[c]),{reports:{data:[]}})),m[c].reports.data=s,z(m)},V=function(r,n){var a,i,o=t([],e(P),!1),l=o.findIndex((function(e){return e.id===r})),m=(null===(i=null===(a=o[l])||void 0===a?void 0:a.reports)||void 0===i?void 0:i.data)||[],c=m.filter((function(e){return"id"in e})),d=m.filter((function(e){return!("id"in e)}));d.splice(n,1);var s=t(t([],e(c),!1),e(d),!1);o[l].reports.data=s,z(o)};return i((function(){"Iro Updated"===(null==U?void 0:U.message)&&B&&B()}),[U]),i((function(){var e;console.log(q),(null===(e=q.iro_items)||void 0===e?void 0:e.data)&&z(q.iro_items.data?q.iro_items.data:[])}),[q]),n.createElement(w,{sx:t([],e(Array.isArray(A)?A:[A]),!1)},n.createElement(x,{container:!0,spacing:2},n.createElement(x,{item:!0,xs:12},n.createElement(_,{spacing:2},n.createElement(_,{direction:"row",spacing:2,justifyContent:"space-between"},n.createElement(_,{spacing:2},n.createElement(h,{variant:"h3",component:"h1"},"Management Inbound Return"),n.createElement(h,{variant:"body1"},"Manage arrival, registration and release of returns")),n.createElement(s,{content:"",related:[{id:q.id,__type:"api::e-commerce.iro"}],revalidateCallback:B})),n.createElement(I,null))),n.createElement(x,{item:!0,xs:6},n.createElement(_,{spacing:1},n.createElement(h,{variant:"h5"},"Details"),n.createElement(_,{direction:"row",spacing:2},n.createElement(h,{variant:"body1",width:"250px"},"Return Number"),n.createElement(h,{variant:"body2"},q.return_number)),n.createElement(_,{direction:"row",spacing:2},n.createElement(h,{variant:"body1",width:"250px"},"RMA Number"),n.createElement(h,{variant:"body2"},q.rma_number)),n.createElement(_,{direction:"row",spacing:2},n.createElement(h,{variant:"body1",width:"250px"},"Customer internal reference number"),n.createElement(h,{variant:"body2"},q.customer_reference)),n.createElement(_,{direction:"row",spacing:2},n.createElement(h,{variant:"body1",width:"250px"},"Return Date"),n.createElement(h,{variant:"body2"},q.return_date)),n.createElement(_,{direction:"row",spacing:2},n.createElement(h,{variant:"body1",width:"250px"},"Customer"),n.createElement(h,{variant:"body2"},null===(g=null===(f=q.customer)||void 0===f?void 0:f.business_credentials)||void 0===g?void 0:g.company_name)),n.createElement(_,{direction:"row",spacing:2},n.createElement(h,{variant:"body1",width:"250px"},"Return Status"),n.createElement(h,{variant:"body2",width:"250px"},q.status)),("requested"===q.status||"finalising_process"===q.status)&&"enduser"===N&&n.createElement(n.Fragment,null,n.createElement(b,{variant:"contained",color:"primary",onClick:function(){return J(!0)}},"Confirm order"),n.createElement(v,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"),n.createElement(S,{open:G,handleClose:function(){return J(!1)},orderID:q.id,currentStatus:q.status,revalidateCallback:B})))),n.createElement(x,{item:!0,xs:12},n.createElement(_,{spacing:2},n.createElement(h,{variant:"h5"},"Documents"),n.createElement(C,{sx:{p:2}},n.createElement(_,{spacing:1})))),(null===(k=null===(y=null==q?void 0:q.notes)||void 0===y?void 0:y.data)||void 0===k?void 0:k.length)>0&&n.createElement(x,{item:!0,xs:12},n.createElement(_,{spacing:2},n.createElement(h,{variant:"h5"},"Notes"),n.createElement(d,{notes:q.notes.data}),n.createElement(I,null))),n.createElement(x,{item:!0,xs:12},n.createElement(_,{spacing:1},n.createElement(h,{variant:"h5"},"Items"),n.createElement(_,{direction:"row",alignItems:"center",justifyContent:"flex-end",spacing:2,component:C,p:1},n.createElement(h,{variant:"body1"},"Show:"),["received","registered","released","reports"].map((function(r){return n.createElement(j,{key:r,control:n.createElement(D,{checked:Q.includes(r),onChange:function(n){n.target.checked?W(t(t([],e(Q),!1),[r],!1)):W(Q.filter((function(e){return e!==r})))}}),label:r.charAt(0).toUpperCase()+r.slice(1)})}))),"requested"===q.status&&n.createElement(v,{severity:"warning"},"Before confirmation you cannot update the items"),n.createElement(I,null),n.createElement("form",{action:M},n.createElement("input",{name:"id",type:"hidden",value:q.id}),P&&P.map((function(e,t){var r,a;return n.createElement(C,{sx:{p:2,mb:2},key:t},"requested"===q.status?n.createElement(c,{item:e,index:t,image:null===(r=null==e?void 0:e.product)||void 0===r?void 0:r.image}):n.createElement(m,{item:e,index:t,handleUpdateQuantity:H,handleAddReport:K,image:null===(a=null==e?void 0:e.product)||void 0===a?void 0:a.image,handleRemoveReportAtIndex:V,revalidateCallback:B,showing:Q}))})),n.createElement(C,{sx:{p:2}},n.createElement(_,{direction:"row",spacing:2,justifyContent:"end"},n.createElement(p,{text:"Update items",loadingText:"Loading..."}),n.createElement(u,{error:null==U?void 0:U.strapiErrors}),(null==U?void 0:U.message)&&n.createElement(v,{severity:"error"},null==U?void 0:U.message))),n.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map((function(e){var t,r;return{id:e.id,returned_quantity:e.returned_quantity,reports:(null===(r=null===(t=e.reports)||void 0===t?void 0:t.data)||void 0===r?void 0:r.map((function(e){return{id:"id"in e?e.id:void 0,quantity:e.quantity,content:e.content,type:e.type}})))||[]}}))}(P))}))))))}export{B as default};
|
|
@@ -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,{useState as a,useEffect as o}from"react";import{useFormState as m}from"react-dom";import{createOpoAction as i}from"../../../data/actions/e-commerce/opo/createOpoAction.js";import{StrapiErrors as n}from"../../StrapiErrors.js";import{SubmitButton as l}from"../../SubmitButton.js";import{CustomerSelector as c}from"../customer/CustomerSelector.js";import{OPOItemFields as s}from"./OPOItemFields.js";import u from"@mui/material/Typography";import d from"@mui/material/Grid";import p from"@mui/material/Box";import f from"@mui/material/TextField";import E from"@mui/material/Checkbox";import h from"@mui/material/Alert";import v from"@mui/material/Stack";var g={zodErrors:null,strapiErrors:null,data:null,message:null};function x(x){var y=x.sx,b=x.revalidateCallback;x.handleClose;var C=x.customerLabels,w=x.productLabels,j=e(a(!1),2),A=j[0],I=j[1],k=e(m(i,g),2),
|
|
7
|
+
import{__read as e,__spreadArray as r}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as a,useEffect as o}from"react";import{useFormState as m}from"react-dom";import{createOpoAction as i}from"../../../data/actions/e-commerce/opo/createOpoAction.js";import{StrapiErrors as n}from"../../StrapiErrors.js";import{SubmitButton as l}from"../../SubmitButton.js";import{CustomerSelector as c}from"../customer/CustomerSelector.js";import{OPOItemFields as s}from"./OPOItemFields.js";import u from"@mui/material/Typography";import d from"@mui/material/Grid";import p from"@mui/material/Box";import f from"@mui/material/TextField";import E from"@mui/material/Checkbox";import h from"@mui/material/Alert";import v from"@mui/material/Stack";var g={zodErrors:null,strapiErrors:null,data:null,message:null};function x(x){var y=x.sx,b=x.revalidateCallback;x.handleClose;var C=x.customerLabels,w=x.productLabels,j=e(a(!1),2),A=j[0],I=j[1],k=e(m(i,g),2),L=k[0],O=k[1];return o((function(){(null==L?void 0:L.data)&&b&&b()}),[L.data]),t.createElement(p,{sx:r([],e(Array.isArray(y)?y:[y]),!1)},t.createElement("form",{action:O},t.createElement(d,{container:!0,spacing:2},t.createElement(d,{item:!0,xs:12},t.createElement(v,{spacing:2},t.createElement(u,{variant:"h6"},"Choose a customer"),t.createElement(c,{customerLabels:C}))),t.createElement(d,{item:!0,xs:12},t.createElement(v,{spacing:2},t.createElement(u,{variant:"h6"},"Customer reference"),t.createElement(u,null,"If the customer utilizes a custom reference for inbound order management it should be left here"),t.createElement(f,{id:"customer_reference",name:"customer_reference",sx:{width:"100%"}}))),t.createElement(d,{item:!0,xs:12},t.createElement(u,{variant:"h6"},"Choose products for this order"),t.createElement(s,{productsArr:w})),t.createElement(d,{item:!0,xs:12},t.createElement(u,{variant:"h6"},"Confirm Order"),t.createElement(u,null,"Are you sure you want to confirm this order? Creating a order this way will not create a shipping label nor will it invoke a payment. It does however create an invoice which you can find under invoices"),t.createElement(v,{direction:"row",spacing:1,alignItems:"center"},t.createElement(E,{value:A,checked:A,onChange:function(){return I(!A)}}),A&&t.createElement(u,{color:"primary"},"I am sure I want to confirm this order")),t.createElement("input",{name:"status",type:"hidden",value:A?"ordered":"placed"})),t.createElement(d,{item:!0,xs:12},t.createElement(l,{text:"Confirm",loadingText:"Loading..."}),null!==(null==L?void 0:L.strapiErrors)&&t.createElement(n,{error:null==L?void 0:L.strapiErrors}),(null==L?void 0:L.message)&&t.createElement(h,{severity:"error"},null==L?void 0:L.message)))))}export{x 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 a,{useState as r,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{UploadBase64MediaForm as l}from"../../common/media/UploadBase64MediaForm.js";import m from"../../../data/loaders/common/media/downloadBase64File.js";import c from"./OpoItemUpdater.js";import d from"./OpoItemDisplay.js";import s from"../../logistics/note/NotesDisplay.js";import p from"../../logistics/note/NoteTakingComponent.js";import{StrapiErrors as u}from"../../StrapiErrors.js";import{SubmitButton as E}from"../../SubmitButton.js";import v from"@mui/material/Alert";import f from"@mui/material/Dialog";import y from"@mui/material/DialogActions";import g 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 k from"@mui/material/Stack";import D from"@mui/material/Divider";import{confirmationService as j}from"../../../data/services/common/confirmation-service.js";var O={zodErrors:null,strapiErrors:null,data:null,message:null};function q(e){var t=e.open,r=e.handleClose,n=e.orderID,i=e.currentStatus,o=e.revalidateCallback;return a.createElement(f,{open:t},a.createElement(h,null,"Confirm Order"),a.createElement(g,null,a.createElement(k,{spacing:2},a.createElement(b,null,"Are you sure you want to confirm this order?"),a.createElement(b,null,"Current status: ",i))),a.createElement(y,null,a.createElement(_,{variant:"contained",onClick:function(e){j("opos",[n]),o&&o()}},"Confirm"),a.createElement(_,{variant:"contained",onClick:r},"Cancel")))}function N(f){var y,g,h,j,N,I=f.opo,S=f.sx,A=f.revalidateCallback;f.handleClose;var B=f.role,F=e(i(o,O),2),P=F[0],T=F[1],U=e(r(I.opo_items.data?I.opo_items.data:[]),2),M=U[0],z=U[1],G=e(r(!1),2),H=G[0],J=G[1],L=function(a,r,n){var i=t([],e(M),!1),o=i.findIndex((function(e){return e.id===r}));i[o][n]=a,z(i)};return n((function(){var e;(null===(e=I.opo_items)||void 0===e?void 0:e.data)&&z(I.opo_items.data)}),[I]),a.createElement(C,{sx:t([],e(Array.isArray(S)?S:[S]),!1)},a.createElement(x,{container:!0,spacing:2},a.createElement(x,{item:!0,xs:12},a.createElement(k,{spacing:2},a.createElement(k,{direction:"row",spacing:2,justifyContent:"space-between"},a.createElement(k,{spacing:2},a.createElement(b,{variant:"h3",component:"h1"},"Management Outbound Purchase Order"),a.createElement(b,{variant:"body1"},"Manage picking, packing and shipping of purchase order")),a.createElement(p,{content:"",related:[{id:I.id,__type:"api::e-commerce.opo"}],revalidateCallback:A})),a.createElement(D,null))),a.createElement(x,{item:!0,xs:6},a.createElement(k,{spacing:1},a.createElement(b,{variant:"h5"},"Details"),a.createElement(k,{direction:"row",spacing:2},a.createElement(b,{variant:"body1",width:"250px"},"Purchase Order Number"),a.createElement(b,{variant:"body2"},I.opo_number)),a.createElement(k,{direction:"row",spacing:2},a.createElement(b,{variant:"body1",width:"250px"},"Custom reference"),a.createElement(b,{variant:"body2"},I.
|
|
6
|
+
import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import a,{useState as r,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{UploadBase64MediaForm as l}from"../../common/media/UploadBase64MediaForm.js";import m from"../../../data/loaders/common/media/downloadBase64File.js";import c from"./OpoItemUpdater.js";import d from"./OpoItemDisplay.js";import s from"../../logistics/note/NotesDisplay.js";import p from"../../logistics/note/NoteTakingComponent.js";import{StrapiErrors as u}from"../../StrapiErrors.js";import{SubmitButton as E}from"../../SubmitButton.js";import v from"@mui/material/Alert";import f from"@mui/material/Dialog";import y from"@mui/material/DialogActions";import g 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 k from"@mui/material/Stack";import D from"@mui/material/Divider";import{confirmationService as j}from"../../../data/services/common/confirmation-service.js";var O={zodErrors:null,strapiErrors:null,data:null,message:null};function q(e){var t=e.open,r=e.handleClose,n=e.orderID,i=e.currentStatus,o=e.revalidateCallback;return a.createElement(f,{open:t},a.createElement(h,null,"Confirm Order"),a.createElement(g,null,a.createElement(k,{spacing:2},a.createElement(b,null,"Are you sure you want to confirm this order?"),a.createElement(b,null,"Current status: ",i))),a.createElement(y,null,a.createElement(_,{variant:"contained",onClick:function(e){j("opos",[n]),o&&o()}},"Confirm"),a.createElement(_,{variant:"contained",onClick:r},"Cancel")))}function N(f){var y,g,h,j,N,I=f.opo,S=f.sx,A=f.revalidateCallback;f.handleClose;var B=f.role,F=e(i(o,O),2),P=F[0],T=F[1],U=e(r(I.opo_items.data?I.opo_items.data:[]),2),M=U[0],z=U[1],G=e(r(!1),2),H=G[0],J=G[1],L=function(a,r,n){var i=t([],e(M),!1),o=i.findIndex((function(e){return e.id===r}));i[o][n]=a,z(i)};return n((function(){var e;(null===(e=I.opo_items)||void 0===e?void 0:e.data)&&z(I.opo_items.data)}),[I]),a.createElement(C,{sx:t([],e(Array.isArray(S)?S:[S]),!1)},a.createElement(x,{container:!0,spacing:2},a.createElement(x,{item:!0,xs:12},a.createElement(k,{spacing:2},a.createElement(k,{direction:"row",spacing:2,justifyContent:"space-between"},a.createElement(k,{spacing:2},a.createElement(b,{variant:"h3",component:"h1"},"Management Outbound Purchase Order"),a.createElement(b,{variant:"body1"},"Manage picking, packing and shipping of purchase order")),a.createElement(p,{content:"",related:[{id:I.id,__type:"api::e-commerce.opo"}],revalidateCallback:A})),a.createElement(D,null))),a.createElement(x,{item:!0,xs:6},a.createElement(k,{spacing:1},a.createElement(b,{variant:"h5"},"Details"),a.createElement(k,{direction:"row",spacing:2},a.createElement(b,{variant:"body1",width:"250px"},"Purchase Order Number"),a.createElement(b,{variant:"body2"},I.opo_number)),a.createElement(k,{direction:"row",spacing:2},a.createElement(b,{variant:"body1",width:"250px"},"Custom reference"),a.createElement(b,{variant:"body2"},I.customer_reference)),a.createElement(k,{direction:"row",spacing:2},a.createElement(b,{variant:"body1",width:"250px"},"Order Date"),a.createElement(b,{variant:"body2"},I.order_date)),a.createElement(k,{direction:"row",spacing:2},a.createElement(b,{variant:"body1",width:"250px"},"Customer"),a.createElement(b,{variant:"body2"},null===(g=null===(y=I.customer)||void 0===y?void 0:y.business_credentials)||void 0===g?void 0:g.company_name)),a.createElement(k,{direction:"row",spacing:2},a.createElement(b,{variant:"body1",width:"250px"},"Order Status"),a.createElement(b,{variant:"body2",width:"250px"},I.status)),("placed"===I.status||"external_shipping_process"===I.status)&&"enduser"===B&&a.createElement(a.Fragment,null,a.createElement(_,{variant:"contained",color:"primary",onClick:function(){return J(!0)}},"Confirm order"),a.createElement(v,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"),a.createElement(q,{open:H,handleClose:function(){return J(!1)},orderID:I.id,currentStatus:I.status,revalidateCallback:A})))),a.createElement(x,{item:!0,xs:12},a.createElement(k,{spacing:2},a.createElement(b,{variant:"h5"},"Documents"),a.createElement(w,{sx:{p:2}},a.createElement(k,{spacing:1},I.delivery_note?a.createElement(a.Fragment,null,a.createElement(b,{variant:"h6"},"Delivery Note"),a.createElement(b,null,null===(h=I.delivery_note)||void 0===h?void 0:h.name),a.createElement(_,{variant:"contained",onClick:function(){m("api/opos/".concat(I.id),"delivery_note")}},"Download")):a.createElement(a.Fragment,null,a.createElement(b,{variant:"h5"},"Delivery Note"),a.createElement(b,{variant:"body1"},"Here you can upload the the delivery note for this order"),a.createElement(D,null),a.createElement(l,{reference:"api::e-commerce.opo",refID:I.id,field:"delivery_note",multiple:!1,accept:"text/*,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",path:"api/opos",componentName:"delivery_note",componentReference:"common.base64-encoded-media",revalidateCallback:A})))))),(null===(N=null===(j=null==I?void 0:I.notes)||void 0===j?void 0:j.data)||void 0===N?void 0:N.length)>0&&a.createElement(x,{item:!0,xs:12},a.createElement(k,{spacing:2},a.createElement(b,{variant:"h5"},"Notes"),a.createElement(s,{notes:I.notes.data}),a.createElement(D,null))),a.createElement(x,{item:!0,xs:12},a.createElement(k,{spacing:1},a.createElement(b,{variant:"h5"},"Items"),"placed"===I.status&&a.createElement(v,{severity:"warning"},"Before confirmation you cannot update the items"),a.createElement(D,null),a.createElement("form",{action:T},a.createElement("input",{name:"id",type:"hidden",value:I.id}),M&&M.map((function(e,t){var r,n;return console.log("item",e),a.createElement(w,{sx:{p:2,mb:2},key:t},"placed"===I.status?a.createElement(d,{item:e,index:t,image:null===(r=null==e?void 0:e.product)||void 0===r?void 0:r.image}):a.createElement(c,{item:e,index:t,handleUpdateQuantity:L,image:null===(n=null==e?void 0:e.product)||void 0===n?void 0:n.image,revalidateCallback:A}))})),a.createElement(w,{sx:{p:2}},a.createElement(k,{direction:"row",spacing:2,justifyContent:"end"},a.createElement(E,{text:"Update items",loadingText:"Loading..."}),a.createElement(u,{error:null==P?void 0:P.strapiErrors}),(null==P?void 0:P.message)&&a.createElement(v,{severity:"error"},null==P?void 0:P.message))),a.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}}))}(M))}))))))}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,__assign as n}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as a,useEffect as i}from"react";import{useFormState as o}from"react-dom";import{updateOpoAction as l}from"../../../data/actions/e-commerce/opo/updateOpoAction.js";import{UploadBase64MediaForm as m}from"../../common/media/UploadBase64MediaForm.js";import c from"../../../data/loaders/common/media/downloadBase64File.js";import d from"./TextualOpoItemUpdater.js";import p from"./OpoItemDisplay.js";import s from"../../logistics/note/NotesDisplay.js";import u from"../../logistics/note/NoteTakingComponent.js";import{StrapiErrors as v}from"../../StrapiErrors.js";import{SubmitButton as E}from"../../SubmitButton.js";import f from"@mui/material/Alert";import y from"@mui/material/Dialog";import g from"@mui/material/DialogActions";import h from"@mui/material/DialogContent";import b from"@mui/material/DialogTitle";import x from"@mui/material/Typography";import _ from"@mui/material/Button";import C from"@mui/material/Grid";import k from"@mui/material/Box";import w from"@mui/material/Paper";import D from"@mui/material/Stack";import j from"@mui/material/Divider";import{confirmationService as I}from"../../../data/services/common/confirmation-service.js";import{FormControlLabel as q,Checkbox as O}from"@mui/material";var A={zodErrors:null,strapiErrors:null,data:null,message:null};function N(e){var t=e.open,n=e.handleClose,a=e.orderID,i=e.currentStatus,o=e.revalidateCallback;return r.createElement(y,{open:t},r.createElement(b,null,"Confirm Order"),r.createElement(h,null,r.createElement(D,{spacing:2},r.createElement(x,null,"Are you sure you want to confirm this order?"),r.createElement(x,null,"Current status: ",i))),r.createElement(g,null,r.createElement(_,{variant:"contained",onClick:function(e){I("opos",[a]),o&&o()}},"Confirm"),r.createElement(_,{variant:"contained",onClick:n},"Cancel")))}function S(y){var g,h,b,I,S,B=y.opo,U=y.sx,F=y.revalidateCallback;y.handleClose;var T=y.role,P=e(o(l,A),2),R=P[0],M=P[1],z=e(a(B.opo_items.data?B.opo_items.data:[]),2),G=z[0],H=z[1],J=e(a(!1),2),L=J[0],Q=J[1],K=e(a(["picked","packed","shipped","reports"]),2),V=K[0],W=K[1],X=function(n,r,a){var i=t([],e(G),!1),o=i.findIndex((function(e){return e.id===r}));i[o][a]=n,H(i)},Y=function(r,a){var i,o,l,m=t([],e(G),!1),c=m.findIndex((function(e){return e.id===a})),d=(null===(o=null===(i=m[c])||void 0===i?void 0:i.reports)||void 0===o?void 0:o.data)||[],p=t(t([],e(d),!1),[r],!1);null==(null===(l=m[c])||void 0===l?void 0:l.reports)&&(m[c]=n(n({},m[c]),{reports:{data:[]}})),m[c].reports.data=p,H(m)},Z=function(n,r){var a,i,o=t([],e(G),!1),l=o.findIndex((function(e){return e.id===n})),m=(null===(i=null===(a=o[l])||void 0===a?void 0:a.reports)||void 0===i?void 0:i.data)||[],c=m.filter((function(e){return"id"in e})),d=m.filter((function(e){return!("id"in e)}));d.splice(r,1);var p=t(t([],e(c),!1),e(d),!1);o[l].reports.data=p,H(o)};return i((function(){"Ipo Updated"===(null==R?void 0:R.message)&&F&&F()}),[R]),i((function(){var e;(null===(e=B.opo_items)||void 0===e?void 0:e.data)&&H(B.opo_items.data?B.opo_items.data:[])}),[B]),r.createElement(k,{sx:t([],e(Array.isArray(U)?U:[U]),!1)},r.createElement(C,{container:!0,spacing:2},r.createElement(C,{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(x,{variant:"h3",component:"h1"},"Management Outbound Purchase Order"),r.createElement(x,{variant:"body1"},"Manage picking, packing and shipping of purchase order")),r.createElement(u,{content:"",related:[{id:B.id,__type:"api::e-commerce.opo"}],revalidateCallback:F})),r.createElement(j,null))),r.createElement(C,{item:!0,xs:6},r.createElement(D,{spacing:1},r.createElement(x,{variant:"h5"},"Details"),r.createElement(D,{direction:"row",spacing:2},r.createElement(x,{variant:"body1",width:"250px"},"Purchase Order Number"),r.createElement(x,{variant:"body2"},B.opo_number)),r.createElement(D,{direction:"row",spacing:2},r.createElement(x,{variant:"body1",width:"250px"},"Custom reference"),r.createElement(x,{variant:"body2"},B.
|
|
6
|
+
import{__read as e,__spreadArray as t,__assign as n}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as a,useEffect as i}from"react";import{useFormState as o}from"react-dom";import{updateOpoAction as l}from"../../../data/actions/e-commerce/opo/updateOpoAction.js";import{UploadBase64MediaForm as m}from"../../common/media/UploadBase64MediaForm.js";import c from"../../../data/loaders/common/media/downloadBase64File.js";import d from"./TextualOpoItemUpdater.js";import p from"./OpoItemDisplay.js";import s from"../../logistics/note/NotesDisplay.js";import u from"../../logistics/note/NoteTakingComponent.js";import{StrapiErrors as v}from"../../StrapiErrors.js";import{SubmitButton as E}from"../../SubmitButton.js";import f from"@mui/material/Alert";import y from"@mui/material/Dialog";import g from"@mui/material/DialogActions";import h from"@mui/material/DialogContent";import b from"@mui/material/DialogTitle";import x from"@mui/material/Typography";import _ from"@mui/material/Button";import C from"@mui/material/Grid";import k from"@mui/material/Box";import w from"@mui/material/Paper";import D from"@mui/material/Stack";import j from"@mui/material/Divider";import{confirmationService as I}from"../../../data/services/common/confirmation-service.js";import{FormControlLabel as q,Checkbox as O}from"@mui/material";var A={zodErrors:null,strapiErrors:null,data:null,message:null};function N(e){var t=e.open,n=e.handleClose,a=e.orderID,i=e.currentStatus,o=e.revalidateCallback;return r.createElement(y,{open:t},r.createElement(b,null,"Confirm Order"),r.createElement(h,null,r.createElement(D,{spacing:2},r.createElement(x,null,"Are you sure you want to confirm this order?"),r.createElement(x,null,"Current status: ",i))),r.createElement(g,null,r.createElement(_,{variant:"contained",onClick:function(e){I("opos",[a]),o&&o()}},"Confirm"),r.createElement(_,{variant:"contained",onClick:n},"Cancel")))}function S(y){var g,h,b,I,S,B=y.opo,U=y.sx,F=y.revalidateCallback;y.handleClose;var T=y.role,P=e(o(l,A),2),R=P[0],M=P[1],z=e(a(B.opo_items.data?B.opo_items.data:[]),2),G=z[0],H=z[1],J=e(a(!1),2),L=J[0],Q=J[1],K=e(a(["picked","packed","shipped","reports"]),2),V=K[0],W=K[1],X=function(n,r,a){var i=t([],e(G),!1),o=i.findIndex((function(e){return e.id===r}));i[o][a]=n,H(i)},Y=function(r,a){var i,o,l,m=t([],e(G),!1),c=m.findIndex((function(e){return e.id===a})),d=(null===(o=null===(i=m[c])||void 0===i?void 0:i.reports)||void 0===o?void 0:o.data)||[],p=t(t([],e(d),!1),[r],!1);null==(null===(l=m[c])||void 0===l?void 0:l.reports)&&(m[c]=n(n({},m[c]),{reports:{data:[]}})),m[c].reports.data=p,H(m)},Z=function(n,r){var a,i,o=t([],e(G),!1),l=o.findIndex((function(e){return e.id===n})),m=(null===(i=null===(a=o[l])||void 0===a?void 0:a.reports)||void 0===i?void 0:i.data)||[],c=m.filter((function(e){return"id"in e})),d=m.filter((function(e){return!("id"in e)}));d.splice(r,1);var p=t(t([],e(c),!1),e(d),!1);o[l].reports.data=p,H(o)};return i((function(){"Ipo Updated"===(null==R?void 0:R.message)&&F&&F()}),[R]),i((function(){var e;(null===(e=B.opo_items)||void 0===e?void 0:e.data)&&H(B.opo_items.data?B.opo_items.data:[])}),[B]),r.createElement(k,{sx:t([],e(Array.isArray(U)?U:[U]),!1)},r.createElement(C,{container:!0,spacing:2},r.createElement(C,{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(x,{variant:"h3",component:"h1"},"Management Outbound Purchase Order"),r.createElement(x,{variant:"body1"},"Manage picking, packing and shipping of purchase order")),r.createElement(u,{content:"",related:[{id:B.id,__type:"api::e-commerce.opo"}],revalidateCallback:F})),r.createElement(j,null))),r.createElement(C,{item:!0,xs:6},r.createElement(D,{spacing:1},r.createElement(x,{variant:"h5"},"Details"),r.createElement(D,{direction:"row",spacing:2},r.createElement(x,{variant:"body1",width:"250px"},"Purchase Order Number"),r.createElement(x,{variant:"body2"},B.opo_number)),r.createElement(D,{direction:"row",spacing:2},r.createElement(x,{variant:"body1",width:"250px"},"Custom reference"),r.createElement(x,{variant:"body2"},B.customer_reference)),r.createElement(D,{direction:"row",spacing:2},r.createElement(x,{variant:"body1",width:"250px"},"Order Date"),r.createElement(x,{variant:"body2"},B.order_date)),r.createElement(D,{direction:"row",spacing:2},r.createElement(x,{variant:"body1",width:"250px"},"Customer"),r.createElement(x,{variant:"body2"},null===(h=null===(g=B.customer)||void 0===g?void 0:g.business_credentials)||void 0===h?void 0:h.company_name)),r.createElement(D,{direction:"row",spacing:2},r.createElement(x,{variant:"body1",width:"250px"},"Order Status"),r.createElement(x,{variant:"body2",width:"250px"},B.status)),("placed"===B.status||"external_shipping_process"===B.status)&&"enduser"===T&&r.createElement(r.Fragment,null,r.createElement(_,{variant:"contained",color:"primary",onClick:function(){return Q(!0)}},"Confirm order"),r.createElement(f,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"),r.createElement(N,{open:L,handleClose:function(){return Q(!1)},orderID:B.id,currentStatus:B.status,revalidateCallback:F})))),r.createElement(C,{item:!0,xs:12},r.createElement(D,{spacing:2},r.createElement(x,{variant:"h5"},"Documents"),r.createElement(w,{sx:{p:2}},r.createElement(D,{spacing:1},B.delivery_note?r.createElement(r.Fragment,null,r.createElement(x,{variant:"h6"},"Delivery Note"),r.createElement(x,null,null===(b=B.delivery_note)||void 0===b?void 0:b.name),r.createElement(_,{variant:"contained",onClick:function(){c("api/ipos/".concat(B.id),"delivery_note")}},"Download")):r.createElement(r.Fragment,null,r.createElement(x,{variant:"h5"},"Delivery Note"),r.createElement(x,{variant:"body1"},"Here you can upload the the delivery note for this order"),r.createElement(j,null),r.createElement(m,{reference:"api::e-commerce.opo",refID:B.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:F})))))),(null===(S=null===(I=null==B?void 0:B.notes)||void 0===I?void 0:I.data)||void 0===S?void 0:S.length)>0&&r.createElement(C,{item:!0,xs:12},r.createElement(D,{spacing:2},r.createElement(x,{variant:"h5"},"Notes"),r.createElement(s,{notes:B.notes.data}),r.createElement(j,null))),r.createElement(C,{item:!0,xs:12},r.createElement(D,{spacing:1},r.createElement(x,{variant:"h5"},"Items"),r.createElement(D,{direction:"row",alignItems:"center",justifyContent:"flex-end",spacing:2,component:w,p:1},r.createElement(x,{variant:"body1"},"Show:"),["picked","packed","shipped","reports"].map((function(n){return r.createElement(q,{key:n,control:r.createElement(O,{checked:V.includes(n),onChange:function(r){r.target.checked?W(t(t([],e(V),!1),[n],!1)):W(V.filter((function(e){return e!==n})))}}),label:n.charAt(0).toUpperCase()+n.slice(1)})}))),"placed"===B.status&&r.createElement(f,{severity:"warning"},"Before confirmation you cannot update the items"),r.createElement(j,null),r.createElement("form",{action:M},r.createElement("input",{name:"id",type:"hidden",value:B.id}),G&&G.map((function(e,t){var n,a;return r.createElement(w,{sx:{p:2,mb:2},key:t},"placed"===B.status?r.createElement(p,{item:e,index:t,image:null===(n=null==e?void 0:e.product)||void 0===n?void 0:n.image}):r.createElement(d,{item:e,index:t,handleUpdateQuantity:X,handleAddReport:Y,image:null===(a=null==e?void 0:e.product)||void 0===a?void 0:a.image,handleRemoveReportAtIndex:Z,revalidateCallback:F,showing:V}))})),r.createElement(w,{sx:{p:2}},r.createElement(D,{direction:"row",spacing:2,justifyContent:"end"},r.createElement(E,{text:"Update items",loadingText:"Loading..."}),r.createElement(v,{error:null==R?void 0:R.strapiErrors}),(null==R?void 0:R.message)&&r.createElement(f,{severity:"error"},null==R?void 0:R.message))),r.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map((function(e){var t,n;return{id:e.id,ordered_quantity:e.ordered_quantity,picked_quantity:e.picked_quantity,packed_quantity:e.packed_quantity,shipped_quantity:e.shipped_quantity,reports:(null===(n=null===(t=e.reports)||void 0===t?void 0:t.data)||void 0===n?void 0:n.map((function(e){return{id:"id"in e?e.id:void 0,quantity:e.quantity,content:e.content,type:e.type}})))||[]}}))}(G))}))))))}export{S as default};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__read as e,__spreadArray as r,__awaiter as t,__generator as o}from"../../../../node_modules/tslib/tslib.es6.js";import a,{useState as i}from"react";import m from"@mui/material/Paper";import n from"@mui/material/Box";import l from"@mui/material/Stack";import s from"@mui/material/Alert";import c from"@mui/material/TextField";import d from"@mui/material/Typography";import u from"@mui/material/Divider";import{SubmitButton as p}from"../../SubmitButton.js";import{useFormState as f}from"react-dom";import{StrapiErrors as E}from"../../StrapiErrors.js";import{createIPOAction as v}from"../../../data/actions/logistics/ipo/createIPOAction.js";import x from"@mui/material/Grid";import g from"../vendor/VendorSelector.js";import{getSingleVendor as y}from"../../../data/loaders/logistics/getSingleVendor.js";import{IPOItemFields as h}from"./IPOItemFields.js";import{AdapterDayjs as b}from"@mui/x-date-pickers/AdapterDayjs";import{LocalizationProvider as A}from"@mui/x-date-pickers/LocalizationProvider";import{DatePicker as j}from"@mui/x-date-pickers/DatePicker";var P={zodErrors:null,strapiErrors:null,data:null,message:null};function D(D){var I=this,S=D.vendorNamesArr,k=D.sx,O=e(f(v,P),2),w=O[0],T=O[1],V=e(i([]),2),_=V[0],N=V[1],z=e(i(null),2),B=z[0],F=z[1];return a.createElement(n,{sx:r([{p:2}],e(Array.isArray(k)?k:[k]),!1),component:m},a.createElement("form",{action:T},a.createElement(x,{container:!0,spacing:2},a.createElement(x,{item:!0,xs:12},a.createElement(d,{variant:"h5"},"Add IPO")),a.createElement(x,{item:!0,xs:12,md:6,sx:{mt:1}},S?a.createElement(g,{vendorNames:S,currentValue:null,onSelectVendor:function(e){return t(I,void 0,void 0,(function(){var r,t;return o(this,(function(o){switch(o.label){case 0:return F(e),e?[4,y(e)]:(N([]),[2]);case 1:return r=o.sent(),N(null===(t=null==r?void 0:r.products)||void 0===t?void 0:t.data),[2]}}))}))}}):a.createElement(d,null,"No vendors on file, you need to create a vendor first before you are able to create incoming purchase orders")),a.createElement(x,{item:!0,xs:12},a.createElement(l,{spacing:2},a.createElement(d,{variant:"h5"},"Order Details"),a.createElement(d,{variant:"body1"},"The orderdate should be the official date of the order, don't worry, you can also set days in the past or future"),a.createElement(A,{dateAdapter:b},a.createElement(j,{name:"order_date",label:"Order Date"})),a.createElement(d,{variant:"body1"},"Please enter a custom reference for this order"),a.createElement(c,{id:"
|
|
7
|
+
import{__read as e,__spreadArray as r,__awaiter as t,__generator as o}from"../../../../node_modules/tslib/tslib.es6.js";import a,{useState as i}from"react";import m from"@mui/material/Paper";import n from"@mui/material/Box";import l from"@mui/material/Stack";import s from"@mui/material/Alert";import c from"@mui/material/TextField";import d from"@mui/material/Typography";import u from"@mui/material/Divider";import{SubmitButton as p}from"../../SubmitButton.js";import{useFormState as f}from"react-dom";import{StrapiErrors as E}from"../../StrapiErrors.js";import{createIPOAction as v}from"../../../data/actions/logistics/ipo/createIPOAction.js";import x from"@mui/material/Grid";import g from"../vendor/VendorSelector.js";import{getSingleVendor as y}from"../../../data/loaders/logistics/getSingleVendor.js";import{IPOItemFields as h}from"./IPOItemFields.js";import{AdapterDayjs as b}from"@mui/x-date-pickers/AdapterDayjs";import{LocalizationProvider as A}from"@mui/x-date-pickers/LocalizationProvider";import{DatePicker as j}from"@mui/x-date-pickers/DatePicker";var P={zodErrors:null,strapiErrors:null,data:null,message:null};function D(D){var I=this,S=D.vendorNamesArr,k=D.sx,O=e(f(v,P),2),w=O[0],T=O[1],V=e(i([]),2),_=V[0],N=V[1],z=e(i(null),2),B=z[0],F=z[1];return a.createElement(n,{sx:r([{p:2}],e(Array.isArray(k)?k:[k]),!1),component:m},a.createElement("form",{action:T},a.createElement(x,{container:!0,spacing:2},a.createElement(x,{item:!0,xs:12},a.createElement(d,{variant:"h5"},"Add IPO")),a.createElement(x,{item:!0,xs:12,md:6,sx:{mt:1}},S?a.createElement(g,{vendorNames:S,currentValue:null,onSelectVendor:function(e){return t(I,void 0,void 0,(function(){var r,t;return o(this,(function(o){switch(o.label){case 0:return F(e),e?[4,y(e)]:(N([]),[2]);case 1:return r=o.sent(),N(null===(t=null==r?void 0:r.products)||void 0===t?void 0:t.data),[2]}}))}))}}):a.createElement(d,null,"No vendors on file, you need to create a vendor first before you are able to create incoming purchase orders")),a.createElement(x,{item:!0,xs:12},a.createElement(l,{spacing:2},a.createElement(d,{variant:"h5"},"Order Details"),a.createElement(d,{variant:"body1"},"The orderdate should be the official date of the order, don't worry, you can also set days in the past or future"),a.createElement(A,{dateAdapter:b},a.createElement(j,{name:"order_date",label:"Order Date"})),a.createElement(d,{variant:"body1"},"Please enter a custom reference for this order"),a.createElement(c,{id:"customer_reference",name:"customer_reference",type:"text",label:"Custom Reference"}),a.createElement(u,null))),a.createElement(x,{item:!0,xs:12},a.createElement(h,{productsArr:_,vendorID:B}))),a.createElement(x,{item:!0,xs:12},a.createElement(l,{direction:"row-reverse",spacing:2,alignItems:"center",sx:{py:1}},a.createElement(p,{text:"create new ipo",loadingText:"loading"}),(null==w?void 0:w.strapiErrors)&&a.createElement(E,{error:null==w?void 0:w.strapiErrors}),(null==w?void 0:w.message)&&a.createElement(s,{severity:"error"},null==w?void 0:w.message)))))}export{D as AddIPOForm};
|
|
@@ -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 a,{useState as r}from"react";import{useFormState as n}from"react-dom";import{updateIpoAction as i}from"../../../data/actions/logistics/ipo/updateIpoAction.js";import{UploadBase64MediaForm as o}from"../../common/media/UploadBase64MediaForm.js";import l from"../../../data/loaders/common/media/downloadBase64File.js";import m from"./IPOItemUpdater.js";import c from"./ItemDisplay.js";import d from"../note/NotesDisplay.js";import s from"../note/NoteTakingComponent.js";import{StrapiErrors as p}from"../../StrapiErrors.js";import{SubmitButton as u}from"../../SubmitButton.js";import E from"@mui/material/Alert";import v from"@mui/material/Dialog";import f from"@mui/material/DialogActions";import g from"@mui/material/DialogContent";import y from"@mui/material/DialogTitle";import h from"@mui/material/Typography";import b from"@mui/material/Button";import x from"@mui/material/Grid";import C from"@mui/material/Box";import _ from"@mui/material/Paper";import w from"@mui/material/Stack";import D from"@mui/material/Divider";import{confirmationService as k}from"../../../data/services/common/confirmation-service.js";var j={zodErrors:null,strapiErrors:null,data:null,message:null};function I(e){var t=e.open,r=e.handleClose,n=e.orderID,i=e.currentStatus,o=e.revalidateCallback;return a.createElement(v,{open:t},a.createElement(y,null,"Confirm Order"),a.createElement(g,null,a.createElement(w,{spacing:2},a.createElement(h,null,"Are you sure you want to confirm this order?"),a.createElement(h,null,"Current status: ",i))),a.createElement(f,null,a.createElement(b,{variant:"contained",onClick:function(e){k("ipos",[n]),o&&o()}},"Confirm"),a.createElement(b,{variant:"contained",onClick:r},"Cancel")))}function F(v){var f,g,y,k,F,N,O,S=v.data,q=v.sx,A=v.revalidateCallback;v.handleClose;var B=v.role,P=e(n(i,j),2),U=P[0],T=P[1],M=e(r(S.items.data?S.items.data:[]),2),H=M[0],R=M[1],z=e(r(!1),2),G=z[0],J=z[1],L=function(a,r,n){var i=t([],e(H),!1),o=i.findIndex((function(e){return e.id===r}));i[o][n]=a,R(i)};return a.createElement(C,{sx:t([],e(Array.isArray(q)?q:[q]),!1)},a.createElement(x,{container:!0,spacing:2},a.createElement(x,{item:!0,xs:12},a.createElement(w,{spacing:2},a.createElement(w,{direction:"row",spacing:2,justifyContent:"space-between"},a.createElement(w,{spacing:2},a.createElement(h,{variant:"h3",component:"h1"},"Management Inbound Purchase Order"),a.createElement(h,{variant:"body1"},"Manage arrival, registration and recieval of purchase order")),a.createElement(s,{content:"",related:[{id:S.id,__type:"api::logistics.ipo"}],revalidateCallback:A})),a.createElement(D,null))),a.createElement(x,{item:!0,xs:6},a.createElement(w,{spacing:1},a.createElement(h,{variant:"h5"},"Details"),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Purchase Order Number"),a.createElement(h,{variant:"body2"},S.ipo_number)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Custom reference"),a.createElement(h,{variant:"body2"},S.
|
|
6
|
+
import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import a,{useState as r}from"react";import{useFormState as n}from"react-dom";import{updateIpoAction as i}from"../../../data/actions/logistics/ipo/updateIpoAction.js";import{UploadBase64MediaForm as o}from"../../common/media/UploadBase64MediaForm.js";import l from"../../../data/loaders/common/media/downloadBase64File.js";import m from"./IPOItemUpdater.js";import c from"./ItemDisplay.js";import d from"../note/NotesDisplay.js";import s from"../note/NoteTakingComponent.js";import{StrapiErrors as p}from"../../StrapiErrors.js";import{SubmitButton as u}from"../../SubmitButton.js";import E from"@mui/material/Alert";import v from"@mui/material/Dialog";import f from"@mui/material/DialogActions";import g from"@mui/material/DialogContent";import y from"@mui/material/DialogTitle";import h from"@mui/material/Typography";import b from"@mui/material/Button";import x from"@mui/material/Grid";import C from"@mui/material/Box";import _ from"@mui/material/Paper";import w from"@mui/material/Stack";import D from"@mui/material/Divider";import{confirmationService as k}from"../../../data/services/common/confirmation-service.js";var j={zodErrors:null,strapiErrors:null,data:null,message:null};function I(e){var t=e.open,r=e.handleClose,n=e.orderID,i=e.currentStatus,o=e.revalidateCallback;return a.createElement(v,{open:t},a.createElement(y,null,"Confirm Order"),a.createElement(g,null,a.createElement(w,{spacing:2},a.createElement(h,null,"Are you sure you want to confirm this order?"),a.createElement(h,null,"Current status: ",i))),a.createElement(f,null,a.createElement(b,{variant:"contained",onClick:function(e){k("ipos",[n]),o&&o()}},"Confirm"),a.createElement(b,{variant:"contained",onClick:r},"Cancel")))}function F(v){var f,g,y,k,F,N,O,S=v.data,q=v.sx,A=v.revalidateCallback;v.handleClose;var B=v.role,P=e(n(i,j),2),U=P[0],T=P[1],M=e(r(S.items.data?S.items.data:[]),2),H=M[0],R=M[1],z=e(r(!1),2),G=z[0],J=z[1],L=function(a,r,n){var i=t([],e(H),!1),o=i.findIndex((function(e){return e.id===r}));i[o][n]=a,R(i)};return a.createElement(C,{sx:t([],e(Array.isArray(q)?q:[q]),!1)},a.createElement(x,{container:!0,spacing:2},a.createElement(x,{item:!0,xs:12},a.createElement(w,{spacing:2},a.createElement(w,{direction:"row",spacing:2,justifyContent:"space-between"},a.createElement(w,{spacing:2},a.createElement(h,{variant:"h3",component:"h1"},"Management Inbound Purchase Order"),a.createElement(h,{variant:"body1"},"Manage arrival, registration and recieval of purchase order")),a.createElement(s,{content:"",related:[{id:S.id,__type:"api::logistics.ipo"}],revalidateCallback:A})),a.createElement(D,null))),a.createElement(x,{item:!0,xs:6},a.createElement(w,{spacing:1},a.createElement(h,{variant:"h5"},"Details"),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Purchase Order Number"),a.createElement(h,{variant:"body2"},S.ipo_number)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Custom reference"),a.createElement(h,{variant:"body2"},S.customer_reference)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Order Date"),a.createElement(h,{variant:"body2"},S.order_date)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Supplier"),a.createElement(h,{variant:"body2"},null===(g=null===(f=S.vendor_profile)||void 0===f?void 0:f.business_credentials)||void 0===g?void 0:g.company_name)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Order Status"),a.createElement(h,{variant:"body2",width:"250px"},S.status)),("placed"===S.status||"released_on_stock"===S.status)&&"enduser"===B&&a.createElement(a.Fragment,null,a.createElement(b,{variant:"contained",color:"primary",onClick:function(){return J(!0)}},"Confirm order"),a.createElement(E,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"),a.createElement(I,{open:G,handleClose:function(){return J(!1)},orderID:S.id,currentStatus:S.status,revalidateCallback:A})))),a.createElement(x,{item:!0,xs:12},a.createElement(w,{spacing:2},a.createElement(h,{variant:"h5"},"Documents"),a.createElement(_,{sx:{p:2}},a.createElement(w,{spacing:1},"enduser"===B&&a.createElement(a.Fragment,null,S.order_confirmation?a.createElement(a.Fragment,null,a.createElement(h,{variant:"h6"},"Order Confirmation"),a.createElement(h,null,null===(y=S.order_confirmation)||void 0===y?void 0:y.name),a.createElement(b,{variant:"contained",onClick:function(){l("api/ipos/".concat(S.id),"order_confirmation")}},"Download")):a.createElement(a.Fragment,null,a.createElement(h,{variant:"h5"},"Order Confirmation"),a.createElement(h,{variant:"body1"},"Here you can upload the the order confirmation for this order"),a.createElement(h,{variant:"body1"},"FileUpload"),a.createElement(D,null),a.createElement(o,{reference:"api::logistics.ipo",refID:S.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:A}))),S.delivery_note?a.createElement(a.Fragment,null,a.createElement(h,{variant:"h6"},"Delivery Note"),a.createElement(h,null,null===(k=S.delivery_note)||void 0===k?void 0:k.name),a.createElement(b,{variant:"contained",onClick:function(){l("api/ipos/".concat(S.id),"delivery_note")}},"Download")):a.createElement(a.Fragment,null,a.createElement(h,{variant:"h5"},"Delivery Note"),a.createElement(h,{variant:"body1"},"Here you can upload the the delivery note for this order"),a.createElement(D,null),a.createElement(o,{reference:"api::logistics.ipo",refID:S.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:A})))))),(null===(N=null===(F=null==S?void 0:S.notes)||void 0===F?void 0:F.data)||void 0===N?void 0:N.length)>0&&a.createElement(x,{item:!0,xs:12},a.createElement(w,{spacing:2},a.createElement(h,{variant:"h5"},"Notes"),a.createElement(d,{notes:S.notes.data}),a.createElement(D,null))),a.createElement(x,{item:!0,xs:12},a.createElement(w,{spacing:1},a.createElement(h,{variant:"h5"},"Items"),"placed"===S.status&&a.createElement(E,{severity:"warning"},"Before confirmation you cannot update the items"),a.createElement(D,null),a.createElement("form",{action:T},a.createElement("input",{name:"id",type:"hidden",value:S.id}),(null===(O=null==S?void 0:S.items)||void 0===O?void 0:O.data)&&S.items.data.map((function(e,t){var r,n;return console.log("item",e),a.createElement(_,{sx:{p:2,mb:2},key:t},"placed"===S.status?a.createElement(c,{item:e,index:t,image:null===(r=null==e?void 0:e.product)||void 0===r?void 0:r.image}):a.createElement(m,{item:e,index:t,handleUpdateQuantity:L,image:null===(n=null==e?void 0:e.product)||void 0===n?void 0:n.image,revalidateCallback:A}))})),a.createElement(_,{sx:{p:2}},a.createElement(w,{direction:"row",spacing:2,justifyContent:"end"},a.createElement(u,{text:"Update items",loadingText:"Loading..."}),a.createElement(p,{error:null==U?void 0:U.strapiErrors}),(null==U?void 0:U.message)&&a.createElement(E,{severity:"error"},null==U?void 0:U.message))),a.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map((function(e){return{id:e.id,received_quantity:e.received_quantity,registered_quantity:e.registered_quantity,released_quantity:e.released_quantity}}))}(H))}))))))}export{F 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,__assign as r}from"../../../../node_modules/tslib/tslib.es6.js";import n,{useState as a,useEffect as i}from"react";import{useFormState as o}from"react-dom";import{updateIpoAction as l}from"../../../data/actions/logistics/ipo/updateIpoAction.js";import{UploadBase64MediaForm as m}from"../../common/media/UploadBase64MediaForm.js";import c from"../../../data/loaders/common/media/downloadBase64File.js";import d from"./TextualIPOItemUpdater.js";import s from"./ItemDisplay.js";import u from"../note/NotesDisplay.js";import p from"../note/NoteTakingComponent.js";import{StrapiErrors as v}from"../../StrapiErrors.js";import{SubmitButton as f}from"../../SubmitButton.js";import E from"@mui/material/Alert";import y from"@mui/material/Dialog";import g from"@mui/material/DialogActions";import h from"@mui/material/DialogContent";import b from"@mui/material/DialogTitle";import x from"@mui/material/Typography";import C from"@mui/material/Button";import _ from"@mui/material/Grid";import w from"@mui/material/Box";import k from"@mui/material/Paper";import D from"@mui/material/Stack";import I from"@mui/material/Divider";import{confirmationService as j}from"../../../data/services/common/confirmation-service.js";import{FormControlLabel as q,Checkbox as A}from"@mui/material";var F={zodErrors:null,strapiErrors:null,data:null,message:null};function N(e){var t=e.open,r=e.handleClose,a=e.orderID,i=e.currentStatus,o=e.revalidateCallback;return n.createElement(y,{open:t},n.createElement(b,null,"Confirm Order"),n.createElement(h,null,n.createElement(D,{spacing:2},n.createElement(x,null,"Are you sure you want to confirm this order?"),n.createElement(x,null,"Current status: ",i))),n.createElement(g,null,n.createElement(C,{variant:"contained",onClick:function(e){j("ipos",[a]),o&&o()}},"Confirm"),n.createElement(C,{variant:"contained",onClick:r},"Cancel")))}function O(y){var g,h,b,j,O,S,U=y.data,B=y.sx,P=y.revalidateCallback;y.handleClose;var R=y.role,T=e(o(l,F),2),M=T[0],H=T[1],z=e(a(U.items.data?U.items.data:[]),2),G=z[0],J=z[1],L=e(a(!1),2),Q=L[0],K=L[1],V=e(a(["received","registered","released","reports"]),2),W=V[0],X=V[1],Y=function(r,n,a){var i=t([],e(G),!1),o=i.findIndex((function(e){return e.id===n}));i[o][a]=r,J(i)},Z=function(n,a){var i,o,l,m=t([],e(G),!1),c=m.findIndex((function(e){return e.id===a})),d=(null===(o=null===(i=m[c])||void 0===i?void 0:i.reports)||void 0===o?void 0:o.data)||[],s=t(t([],e(d),!1),[n],!1);null==(null===(l=m[c])||void 0===l?void 0:l.reports)&&(m[c]=r(r({},m[c]),{reports:{data:[]}})),m[c].reports.data=s,J(m)},$=function(r,n){var a,i,o=t([],e(G),!1),l=o.findIndex((function(e){return e.id===r})),m=(null===(i=null===(a=o[l])||void 0===a?void 0:a.reports)||void 0===i?void 0:i.data)||[],c=m.filter((function(e){return"id"in e})),d=m.filter((function(e){return!("id"in e)}));d.splice(n,1);var s=t(t([],e(c),!1),e(d),!1);o[l].reports.data=s,J(o)};return i((function(){"Ipo Updated"===(null==M?void 0:M.message)&&P&&P()}),[M]),i((function(){var e;(null===(e=U.items)||void 0===e?void 0:e.data)&&J(U.items.data?U.items.data:[])}),[U]),n.createElement(w,{sx:t([],e(Array.isArray(B)?B:[B]),!1)},n.createElement(_,{container:!0,spacing:2},n.createElement(_,{item:!0,xs:12},n.createElement(D,{spacing:2},n.createElement(D,{direction:"row",spacing:2,justifyContent:"space-between"},n.createElement(D,{spacing:2},n.createElement(x,{variant:"h3",component:"h1"},"Management Inbound Purchase Order"),n.createElement(x,{variant:"body1"},"Manage arrival, registration and recieval of purchase order")),n.createElement(p,{content:"",related:[{id:U.id,__type:"api::logistics.ipo"}],revalidateCallback:P})),n.createElement(I,null))),n.createElement(_,{item:!0,xs:6},n.createElement(D,{spacing:1},n.createElement(x,{variant:"h5"},"Details"),n.createElement(D,{direction:"row",spacing:2},n.createElement(x,{variant:"body1",width:"250px"},"Purchase Order Number"),n.createElement(x,{variant:"body2"},U.ipo_number)),n.createElement(D,{direction:"row",spacing:2},n.createElement(x,{variant:"body1",width:"250px"},"Custom reference"),n.createElement(x,{variant:"body2"},U.
|
|
6
|
+
import{__read as e,__spreadArray as t,__assign as r}from"../../../../node_modules/tslib/tslib.es6.js";import n,{useState as a,useEffect as i}from"react";import{useFormState as o}from"react-dom";import{updateIpoAction as l}from"../../../data/actions/logistics/ipo/updateIpoAction.js";import{UploadBase64MediaForm as m}from"../../common/media/UploadBase64MediaForm.js";import c from"../../../data/loaders/common/media/downloadBase64File.js";import d from"./TextualIPOItemUpdater.js";import s from"./ItemDisplay.js";import u from"../note/NotesDisplay.js";import p from"../note/NoteTakingComponent.js";import{StrapiErrors as v}from"../../StrapiErrors.js";import{SubmitButton as f}from"../../SubmitButton.js";import E from"@mui/material/Alert";import y from"@mui/material/Dialog";import g from"@mui/material/DialogActions";import h from"@mui/material/DialogContent";import b from"@mui/material/DialogTitle";import x from"@mui/material/Typography";import C from"@mui/material/Button";import _ from"@mui/material/Grid";import w from"@mui/material/Box";import k from"@mui/material/Paper";import D from"@mui/material/Stack";import I from"@mui/material/Divider";import{confirmationService as j}from"../../../data/services/common/confirmation-service.js";import{FormControlLabel as q,Checkbox as A}from"@mui/material";var F={zodErrors:null,strapiErrors:null,data:null,message:null};function N(e){var t=e.open,r=e.handleClose,a=e.orderID,i=e.currentStatus,o=e.revalidateCallback;return n.createElement(y,{open:t},n.createElement(b,null,"Confirm Order"),n.createElement(h,null,n.createElement(D,{spacing:2},n.createElement(x,null,"Are you sure you want to confirm this order?"),n.createElement(x,null,"Current status: ",i))),n.createElement(g,null,n.createElement(C,{variant:"contained",onClick:function(e){j("ipos",[a]),o&&o()}},"Confirm"),n.createElement(C,{variant:"contained",onClick:r},"Cancel")))}function O(y){var g,h,b,j,O,S,U=y.data,B=y.sx,P=y.revalidateCallback;y.handleClose;var R=y.role,T=e(o(l,F),2),M=T[0],H=T[1],z=e(a(U.items.data?U.items.data:[]),2),G=z[0],J=z[1],L=e(a(!1),2),Q=L[0],K=L[1],V=e(a(["received","registered","released","reports"]),2),W=V[0],X=V[1],Y=function(r,n,a){var i=t([],e(G),!1),o=i.findIndex((function(e){return e.id===n}));i[o][a]=r,J(i)},Z=function(n,a){var i,o,l,m=t([],e(G),!1),c=m.findIndex((function(e){return e.id===a})),d=(null===(o=null===(i=m[c])||void 0===i?void 0:i.reports)||void 0===o?void 0:o.data)||[],s=t(t([],e(d),!1),[n],!1);null==(null===(l=m[c])||void 0===l?void 0:l.reports)&&(m[c]=r(r({},m[c]),{reports:{data:[]}})),m[c].reports.data=s,J(m)},$=function(r,n){var a,i,o=t([],e(G),!1),l=o.findIndex((function(e){return e.id===r})),m=(null===(i=null===(a=o[l])||void 0===a?void 0:a.reports)||void 0===i?void 0:i.data)||[],c=m.filter((function(e){return"id"in e})),d=m.filter((function(e){return!("id"in e)}));d.splice(n,1);var s=t(t([],e(c),!1),e(d),!1);o[l].reports.data=s,J(o)};return i((function(){"Ipo Updated"===(null==M?void 0:M.message)&&P&&P()}),[M]),i((function(){var e;(null===(e=U.items)||void 0===e?void 0:e.data)&&J(U.items.data?U.items.data:[])}),[U]),n.createElement(w,{sx:t([],e(Array.isArray(B)?B:[B]),!1)},n.createElement(_,{container:!0,spacing:2},n.createElement(_,{item:!0,xs:12},n.createElement(D,{spacing:2},n.createElement(D,{direction:"row",spacing:2,justifyContent:"space-between"},n.createElement(D,{spacing:2},n.createElement(x,{variant:"h3",component:"h1"},"Management Inbound Purchase Order"),n.createElement(x,{variant:"body1"},"Manage arrival, registration and recieval of purchase order")),n.createElement(p,{content:"",related:[{id:U.id,__type:"api::logistics.ipo"}],revalidateCallback:P})),n.createElement(I,null))),n.createElement(_,{item:!0,xs:6},n.createElement(D,{spacing:1},n.createElement(x,{variant:"h5"},"Details"),n.createElement(D,{direction:"row",spacing:2},n.createElement(x,{variant:"body1",width:"250px"},"Purchase Order Number"),n.createElement(x,{variant:"body2"},U.ipo_number)),n.createElement(D,{direction:"row",spacing:2},n.createElement(x,{variant:"body1",width:"250px"},"Custom reference"),n.createElement(x,{variant:"body2"},U.customer_reference)),n.createElement(D,{direction:"row",spacing:2},n.createElement(x,{variant:"body1",width:"250px"},"Order Date"),n.createElement(x,{variant:"body2"},U.order_date)),n.createElement(D,{direction:"row",spacing:2},n.createElement(x,{variant:"body1",width:"250px"},"Supplier"),n.createElement(x,{variant:"body2"},null===(h=null===(g=U.vendor_profile)||void 0===g?void 0:g.business_credentials)||void 0===h?void 0:h.company_name)),n.createElement(D,{direction:"row",spacing:2},n.createElement(x,{variant:"body1",width:"250px"},"Order Status"),n.createElement(x,{variant:"body2",width:"250px"},U.status)),("placed"===U.status||"released_on_stock"===U.status)&&"enduser"===R&&n.createElement(n.Fragment,null,n.createElement(C,{variant:"contained",color:"primary",onClick:function(){return K(!0)}},"Confirm order"),n.createElement(E,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"),n.createElement(N,{open:Q,handleClose:function(){return K(!1)},orderID:U.id,currentStatus:U.status,revalidateCallback:P})))),n.createElement(_,{item:!0,xs:12},n.createElement(D,{spacing:2},n.createElement(x,{variant:"h5"},"Documents"),n.createElement(k,{sx:{p:2}},n.createElement(D,{spacing:1},"enduser"===R&&n.createElement(n.Fragment,null,U.order_confirmation?n.createElement(n.Fragment,null,n.createElement(x,{variant:"h6"},"Order Confirmation"),n.createElement(x,null,null===(b=U.order_confirmation)||void 0===b?void 0:b.name),n.createElement(C,{variant:"contained",onClick:function(){c("api/ipos/".concat(U.id),"order_confirmation")}},"Download")):n.createElement(n.Fragment,null,n.createElement(x,{variant:"h5"},"Order Confirmation"),n.createElement(x,{variant:"body1"},"Here you can upload the the order confirmation for this order"),n.createElement(x,{variant:"body1"},"FileUpload"),n.createElement(I,null),n.createElement(m,{reference:"api::logistics.ipo",refID:U.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:P}))),U.delivery_note?n.createElement(n.Fragment,null,n.createElement(x,{variant:"h6"},"Delivery Note"),n.createElement(x,null,null===(j=U.delivery_note)||void 0===j?void 0:j.name),n.createElement(C,{variant:"contained",onClick:function(){c("api/ipos/".concat(U.id),"delivery_note")}},"Download")):n.createElement(n.Fragment,null,n.createElement(x,{variant:"h5"},"Delivery Note"),n.createElement(x,{variant:"body1"},"Here you can upload the the delivery note for this order"),n.createElement(I,null),n.createElement(m,{reference:"api::logistics.ipo",refID:U.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:P})))))),(null===(S=null===(O=null==U?void 0:U.notes)||void 0===O?void 0:O.data)||void 0===S?void 0:S.length)>0&&n.createElement(_,{item:!0,xs:12},n.createElement(D,{spacing:2},n.createElement(x,{variant:"h5"},"Notes"),n.createElement(u,{notes:U.notes.data}),n.createElement(I,null))),n.createElement(_,{item:!0,xs:12},n.createElement(D,{spacing:1},n.createElement(x,{variant:"h5"},"Items"),n.createElement(D,{direction:"row",alignItems:"center",justifyContent:"flex-end",spacing:2,component:k,p:1},n.createElement(x,{variant:"body1"},"Show:"),["received","registered","released","reports"].map((function(r){return n.createElement(q,{key:r,control:n.createElement(A,{checked:W.includes(r),onChange:function(n){n.target.checked?X(t(t([],e(W),!1),[r],!1)):X(W.filter((function(e){return e!==r})))}}),label:r.charAt(0).toUpperCase()+r.slice(1)})}))),"placed"===U.status&&n.createElement(E,{severity:"warning"},"Before confirmation you cannot update the items"),n.createElement(I,null),n.createElement("form",{action:H},n.createElement("input",{name:"id",type:"hidden",value:U.id}),G&&G.map((function(e,t){var r,a;return n.createElement(k,{sx:{p:2,mb:2},key:t},"placed"===U.status?n.createElement(s,{item:e,index:t,image:null===(r=null==e?void 0:e.product)||void 0===r?void 0:r.image}):n.createElement(d,{item:e,index:t,handleUpdateQuantity:Y,handleAddReport:Z,image:null===(a=null==e?void 0:e.product)||void 0===a?void 0:a.image,handleRemoveReportAtIndex:$,revalidateCallback:P,showing:W}))})),n.createElement(k,{sx:{p:2}},n.createElement(D,{direction:"row",spacing:2,justifyContent:"end"},n.createElement(f,{text:"Update items",loadingText:"Loading..."}),n.createElement(v,{error:null==M?void 0:M.strapiErrors}),(null==M?void 0:M.message)&&n.createElement(E,{severity:"error"},null==M?void 0:M.message))),n.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map((function(e){var t,r;return{id:e.id,ordered_quantity:e.ordered_quantity,received_quantity:e.received_quantity,registered_quantity:e.registered_quantity,released_quantity:e.released_quantity,reports:(null===(r=null===(t=e.reports)||void 0===t?void 0:t.data)||void 0===r?void 0:r.map((function(e){return{id:"id"in e?e.id:void 0,quantity:e.quantity,content:e.content,type:e.type}})))||[]}}))}(G))}))))))}export{O as default};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__read as e,__assign as r}from"../../../../node_modules/tslib/tslib.es6.js";import s,{useReducer as l,useEffect as
|
|
7
|
+
import{__read as e,__assign as r}from"../../../../node_modules/tslib/tslib.es6.js";import s,{useReducer as l,useEffect as o,useContext as i,createContext as t}from"react";import{isCustomerProfileCompleteV2 as n}from"../../../lib/isCustomerProfileCompleteV2.js";import{isAddressComplete as d}from"../../../lib/isAddressComplete.js";import{areBusinessCredentailsComplete as a}from"../../../lib/areBusinessCredentialsComplete.js";import{useClientSideCart as u}from"../../../components/e-commerce/cart/hooks.js";import{useSession as m}from"../../auth/SessionContext.js";import c from"../../../lib/isVATValid.js";import p from"../../../lib/isEORIValid.js";var f={confirmations:{itemsInCart:!1,customerProfileComplete:!1,companyAddressComplete:!1,deliveryAddressComplete:!1,billingAddressComplete:!1,businessCredentailsComplete:!1,hasVAT:!1,hasEORI:!1,hasValidatedVAT:!1,hasValidatedEORI:!1},delivery_options:[{id:1,label:"ptt"}],payment_options:[{id:1,label:"ideal"}],prefersBillingAddress:!0,prefersDeliveryAddress:!0,customer_reference:""},v=t({state:f,runAllChecks:function(){},togglePrefersBillingAddress:function(){},togglePrefersDeliveryAddress:function(){},setCustomerInternalReference:function(){}}),_=function(e,s){switch(s.type){case"UPDATE_CONFIRMATIONS":return r(r({},e),{confirmations:r(r({},e.confirmations),s.payload)});case"SET_PREFERS_BILLING_ADDRESS":return r(r({},e),{prefersBillingAddress:s.payload.prefersBillingAddress});case"SET_PREFERS_DELIVERY_ADDRESS":return r(r({},e),{prefersDeliveryAddress:s.payload.prefersDeliveryAddress});case"SET_customer_reference":return r(r({},e),{customer_reference:s.payload.customer_reference});default:return e}},A=function(r){var i=r.children,t=e(l(_,f),2),A=t[0],E=t[1],y=m(),C=y.user;y.loading,y.error;var R=u(),b=function(){var e,r,s,l,o,i,t,u,m,f,v=R.state.items.length>0,_=!!(null==C?void 0:C.customer_profile)&&Object.values(n(null==C?void 0:C.customer_profile)).every((function(e){return!0===e})),A=d(null===(e=null==C?void 0:C.customer_profile)||void 0===e?void 0:e.company_address),y=d(null===(r=null==C?void 0:C.customer_profile)||void 0===r?void 0:r.delivery_address),b=d(null===(s=null==C?void 0:C.customer_profile)||void 0===s?void 0:s.billing_address),S=a(null===(l=null==C?void 0:C.customer_profile)||void 0===l?void 0:l.business_credentials),g=Boolean(null===(i=null===(o=null==C?void 0:C.customer_profile)||void 0===o?void 0:o.business_credentials)||void 0===i?void 0:i.VAT_number),I=Boolean(null===(u=null===(t=null==C?void 0:C.customer_profile)||void 0===t?void 0:t.business_credentials)||void 0===u?void 0:u.EORI_number),D=c(null===(m=null==C?void 0:C.customer_profile)||void 0===m?void 0:m.business_credentials),T=p(null===(f=null==C?void 0:C.customer_profile)||void 0===f?void 0:f.business_credentials);E({type:"UPDATE_CONFIRMATIONS",payload:{itemsInCart:v,customerProfileComplete:_,companyAddressComplete:A,deliveryAddressComplete:y,billingAddressComplete:b,businessCredentailsComplete:S,hasVAT:g,hasEORI:I,hasValidatedVAT:D,hasValidatedEORI:T}})};o((function(){C&&b()}),[C]);var S={state:A,runAllChecks:b,togglePrefersBillingAddress:function(){E({type:"SET_PREFERS_BILLING_ADDRESS",payload:{prefersBillingAddress:!A.prefersBillingAddress}})},togglePrefersDeliveryAddress:function(){E({type:"SET_PREFERS_DELIVERY_ADDRESS",payload:{prefersDeliveryAddress:!A.prefersDeliveryAddress}})},setCustomerInternalReference:function(e){E({type:"SET_customer_reference",payload:{customer_reference:e}})}};return s.createElement(v.Provider,{value:S},i)},E=function(){return i(v)};export{A as CheckoutProvider,E as useCheckout};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__awaiter as e,__generator as r,__assign as t}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as s}from"../../../services/mutate-data.js";import{flattenAttributes as a}from"../../../../lib/utils.js";import{parseFormData as o}from"../../../../lib/parseFormData.js";import i from"../../../../../node_modules/dayjs/dayjs.min.js";function n(n,d){return e(this,void 0,void 0,(function(){var e,m,l,p;return r(this,(function(r){switch(r.label){case 0:return Object.fromEntries(d),(e=o(d)).data.order_date?(m={data:{vendor_profile:e.data.vendors,
|
|
7
|
+
import{__awaiter as e,__generator as r,__assign as t}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as s}from"../../../services/mutate-data.js";import{flattenAttributes as a}from"../../../../lib/utils.js";import{parseFormData as o}from"../../../../lib/parseFormData.js";import i from"../../../../../node_modules/dayjs/dayjs.min.js";function n(n,d){return e(this,void 0,void 0,(function(){var e,m,l,p;return r(this,(function(r){switch(r.label){case 0:return Object.fromEntries(d),(e=o(d)).data.order_date?(m={data:{vendor_profile:e.data.vendors,customer_reference:e.data.customer_reference,order_date:i(e.data.order_date).format("YYYY-MM-DD"),items:e.data.ipo_items}},0===JSON.parse(e.data.ipo_items).length?(console.log("No items in IPO"),[2,t(t({},n),{strapiErrors:null,message:"Please add items to the IPO."})]):(console.log("ipoData",m),[4,s("POST","/api/ipos",m)])):[2,t(t({},n),{strapiErrors:null,message:"Please select an Order Date."})];case 1:return(l=r.sent())?l.error?[2,t(t({},n),{strapiErrors:l.error,message:"Failed to Create IPO."})]:(p=a(l),[2,t(t({},n),{message:"New IPO Created",data:p,strapiErrors:null})]):[2,t(t({},n),{strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{n as createIPOAction};
|