umwd-components 0.1.730 → 0.1.732
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/cjs/src/components/common/csv/CsvDownloader.js +1 -1
- package/dist/cjs/src/components/e-commerce/cart/CartSummary.js +1 -1
- package/dist/cjs/src/components/e-commerce/cart/CartSummaryRow.js +1 -1
- package/dist/cjs/src/components/e-commerce/categories/CategorySelectorV2.js +1 -1
- package/dist/cjs/src/components/e-commerce/categories/EditCategoryForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/checkout/Step4.js +1 -1
- package/dist/cjs/src/components/e-commerce/customer/CustomerProfileDisplay.js +1 -1
- package/dist/cjs/src/components/e-commerce/iro/IROItemFields.js +1 -1
- package/dist/cjs/src/components/e-commerce/iro/IroItemUpdater.js +1 -1
- package/dist/cjs/src/components/e-commerce/iro/ManageIROForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/iro/RmaForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/iro/TextualIROItemUpdater.js +1 -1
- package/dist/cjs/src/components/e-commerce/iro/TextualManageIROForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/opo/ManageOpoForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/opo/OPOItemFields.js +1 -1
- package/dist/cjs/src/components/e-commerce/opo/OpoItemUpdater.js +1 -1
- package/dist/cjs/src/components/e-commerce/opo/OpoSummary.js +1 -1
- package/dist/cjs/src/components/e-commerce/opo/OpoSummaryRow.js +1 -1
- package/dist/cjs/src/components/e-commerce/opo/TextualManageOpoForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/opo/TextualOpoItemUpdater.js +1 -1
- package/dist/cjs/src/components/e-commerce/products/EditProductForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/products/EditStockForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/products/PriceFields.js +1 -1
- package/dist/cjs/src/components/e-commerce/products/ProductCard.js +1 -1
- package/dist/cjs/src/components/e-commerce/products/ProductCategoryCard.js +1 -1
- package/dist/cjs/src/components/e-commerce/products/ProductSelector.js +1 -1
- package/dist/cjs/src/components/e-commerce/products/SingleProduct.js +1 -1
- package/dist/cjs/src/components/logistics/ipo/IPOItemFields.js +1 -1
- package/dist/cjs/src/components/logistics/ipo/IPOItemUpdater.js +1 -1
- package/dist/cjs/src/components/logistics/ipo/ManageIPOForm.js +1 -1
- package/dist/cjs/src/components/logistics/ipo/TextualIPOItemUpdater.js +1 -1
- package/dist/cjs/src/components/logistics/ipo/TextualManageIPOForm.js +1 -1
- package/dist/cjs/src/components/logistics/vendor/EditVendorForm.js +1 -1
- package/dist/cjs/src/components/logistics/vendor/VendorDisplay.js +1 -1
- package/dist/cjs/src/components/logistics/vendor/VendorSelector.js +1 -1
- package/dist/cjs/src/components/page-elements/CategoryBlock.js +1 -1
- package/dist/cjs/src/context/e-commerce/cart/CartContext.js +1 -1
- package/dist/cjs/src/data/actions/e-commerce/categories/updateCategoryAction.js +1 -1
- package/dist/cjs/src/data/actions/e-commerce/product/updateProductAction.js +1 -1
- package/dist/cjs/src/data/loaders/e-commerce/getSingleCustomer.js +1 -1
- package/dist/cjs/src/data/loaders/e-commerce/getSingleProduct.js +1 -1
- package/dist/cjs/src/data/loaders/logistics/getTableIpos.js +1 -1
- package/dist/cjs/src/lib/molliePaymentProvider.js +1 -1
- package/dist/cjs/src/lib/parseFormData.js +1 -1
- package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/src/components/common/csv/CsvDownloader.js +3 -3
- package/dist/esm/src/components/e-commerce/cart/CartSummary.js +1 -1
- package/dist/esm/src/components/e-commerce/cart/CartSummaryRow.js +4 -4
- package/dist/esm/src/components/e-commerce/categories/CategorySelectorV2.js +4 -3
- package/dist/esm/src/components/e-commerce/categories/EditCategoryForm.js +3 -3
- package/dist/esm/src/components/e-commerce/checkout/Step4.js +1 -1
- package/dist/esm/src/components/e-commerce/customer/CustomerProfileDisplay.js +1 -1
- package/dist/esm/src/components/e-commerce/iro/IROItemFields.js +2 -2
- package/dist/esm/src/components/e-commerce/iro/IroItemUpdater.js +9 -4
- package/dist/esm/src/components/e-commerce/iro/ManageIROForm.js +4 -2
- package/dist/esm/src/components/e-commerce/iro/RmaForm.js +3 -3
- package/dist/esm/src/components/e-commerce/iro/TextualIROItemUpdater.js +4 -4
- package/dist/esm/src/components/e-commerce/iro/TextualManageIROForm.js +10 -8
- package/dist/esm/src/components/e-commerce/opo/ManageOpoForm.js +2 -2
- package/dist/esm/src/components/e-commerce/opo/OPOItemFields.js +1 -1
- package/dist/esm/src/components/e-commerce/opo/OpoItemUpdater.js +9 -4
- package/dist/esm/src/components/e-commerce/opo/OpoSummary.js +1 -1
- package/dist/esm/src/components/e-commerce/opo/OpoSummaryRow.js +1 -1
- package/dist/esm/src/components/e-commerce/opo/TextualManageOpoForm.js +7 -7
- package/dist/esm/src/components/e-commerce/opo/TextualOpoItemUpdater.js +4 -4
- package/dist/esm/src/components/e-commerce/products/EditProductForm.js +19 -17
- package/dist/esm/src/components/e-commerce/products/EditStockForm.js +39 -16
- package/dist/esm/src/components/e-commerce/products/PriceFields.js +3 -2
- package/dist/esm/src/components/e-commerce/products/ProductCard.js +3 -3
- package/dist/esm/src/components/e-commerce/products/ProductCategoryCard.js +1 -1
- package/dist/esm/src/components/e-commerce/products/ProductSelector.js +5 -5
- package/dist/esm/src/components/e-commerce/products/SingleProduct.js +5 -5
- package/dist/esm/src/components/logistics/ipo/IPOItemFields.js +2 -2
- package/dist/esm/src/components/logistics/ipo/IPOItemUpdater.js +9 -4
- package/dist/esm/src/components/logistics/ipo/ManageIPOForm.js +7 -5
- package/dist/esm/src/components/logistics/ipo/TextualIPOItemUpdater.js +4 -4
- package/dist/esm/src/components/logistics/ipo/TextualManageIPOForm.js +10 -8
- package/dist/esm/src/components/logistics/vendor/EditVendorForm.js +7 -4
- package/dist/esm/src/components/logistics/vendor/VendorDisplay.js +1 -1
- package/dist/esm/src/components/logistics/vendor/VendorSelector.js +5 -4
- package/dist/esm/src/components/page-elements/CategoryBlock.js +1 -1
- package/dist/esm/src/context/e-commerce/cart/CartContext.js +2 -2
- package/dist/esm/src/data/actions/e-commerce/categories/updateCategoryAction.js +3 -3
- package/dist/esm/src/data/actions/e-commerce/product/updateProductAction.js +7 -6
- package/dist/esm/src/data/loaders/e-commerce/getAllOpos.js +8 -0
- package/dist/esm/src/data/loaders/e-commerce/getSingleCustomer.js +15 -6
- package/dist/esm/src/data/loaders/e-commerce/getSingleProduct.js +2 -2
- package/dist/esm/src/data/loaders/e-commerce/getSingleStock.js +2 -2
- package/dist/esm/src/data/loaders/logistics/getSingleVendor.js +2 -2
- package/dist/esm/src/data/loaders/logistics/getTableIpos.js +1 -1
- package/dist/esm/src/lib/molliePaymentProvider.js +7 -3
- package/dist/esm/src/lib/parseFormData.js +1 -0
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/types/components/common/csv/CsvDownloader.d.ts +2 -2
- package/dist/esm/types/components/logistics/ipo/IPOItemFields.d.ts +1 -1
- package/dist/esm/types/components/logistics/report/PreReportsDisplay.d.ts +2 -2
- package/dist/esm/types/components/page-elements/CategoryBlock.d.ts +1 -1
- package/dist/esm/types/data/actions/e-commerce/categories/updateCategoryAction.d.ts +1 -1
- package/dist/esm/types/data/actions/e-commerce/product/updateProductAction.d.ts +1 -1
- package/dist/esm/types/data/loaders/e-commerce/getAllOpos.d.ts +8 -0
- package/dist/esm/types/data/loaders/e-commerce/getSingleProduct.d.ts +3 -2
- package/dist/esm/types/data/loaders/e-commerce/getSingleStock.d.ts +1 -1
- package/dist/esm/types/data/loaders/logistics/getSingleVendor.d.ts +1 -1
- package/dist/esm/types/types/e-commerce/cart/types.d.ts +2 -2
- package/dist/esm/types/types/e-commerce/category/types.d.ts +3 -3
- package/dist/esm/types/types/e-commerce/customer/types.d.ts +2 -6
- package/dist/esm/types/types/e-commerce/invoice/types.d.ts +6 -6
- package/dist/esm/types/types/e-commerce/iro/types.d.ts +2 -4
- package/dist/esm/types/types/e-commerce/opo/types.d.ts +2 -4
- package/dist/esm/types/types/e-commerce/product/types.d.ts +9 -16
- package/dist/esm/types/types/logistics/Ipo.d.ts +2 -4
- package/dist/esm/types/types/logistics/Report.d.ts +4 -4
- package/dist/esm/types/types/logistics/Vendor.d.ts +4 -4
- package/package.json +1 -1
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("@mui/material/Stack"),i=require("@mui/material/Typography"),n=require("@mui/material/IconButton"),a=require("@mui/material/Divider"),s=require("@mui/material/Collapse"),l=require("../../common/TextualAmountUpdater.js"),d=require("@mui/icons-material/ArrowDropDown"),o=require("../../common/ImagePreviewTooltip.js"),c=require("../../logistics/report/ReportsDisplay.js"),u=require("../../logistics/report/PreReportsDisplay.js"),
|
|
6
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("@mui/material/Stack"),i=require("@mui/material/Typography"),n=require("@mui/material/IconButton"),a=require("@mui/material/Divider"),s=require("@mui/material/Collapse"),l=require("../../common/TextualAmountUpdater.js"),d=require("@mui/icons-material/ArrowDropDown"),o=require("../../common/ImagePreviewTooltip.js"),c=require("../../logistics/report/ReportsDisplay.js"),u=require("../../logistics/report/PreReportsDisplay.js"),m=require("../../logistics/report/SimpleReportFields.js"),p=require("@mui/material/Box");exports.default=function({item:x,index:h,handleAddReport:j,handleUpdateQuantity:y,image:g,handleRemoveReportAtIndex:b,showing:q}){const{line_item_number:f,product:w,ordered_quantity:I,picked_quantity:k,packed_quantity:A,shipped_quantity:v,reports:V}=x,[_,C]=r.useState(!1);Array.isArray(V)&&V.length>0&&V.filter(e=>"picked"===e.type).reduce((e,r)=>e+r.quantity,0);const R=Array.isArray(V)&&V.length>0?V.filter(e=>"packed"===e.type).reduce((e,r)=>e+r.quantity,0):0;Array.isArray(V)&&V.length>0&&V.filter(e=>"shipped"===e.type).reduce((e,r)=>e+r.quantity,0);const D=x.reports?.filter(e=>"id"in e)||[],N=x.reports?.filter(e=>!1===Boolean("id"in e))||[];return e.jsx(t,{spacing:1,children:x&&e.jsxs(e.Fragment,{children:[e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1},children:[e.jsxs(i,{variant:"body1",children:["Line Item Number: ",f]}),e.jsxs(i,{variant:"body1",children:["Part Number: ",w?.product_number]}),g&&e.jsx(e.Fragment,{children:e.jsx(o.default,{image:g,label:w?.title})})]}),e.jsx(a,{sx:{mb:1}}),q&&q.includes("picked")&&e.jsxs(e.Fragment,{children:[e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1},children:[e.jsx(i,{variant:"body2",children:"Picked"}),e.jsx(l.TextualAmountUpdater,{label:"Picked",currentValue:k,totalValue:I,minNewValue:0+A,maxNewValue:I,color:"info",handleChange:e=>{y(e,x.documentId,"picked_quantity")}})]}),e.jsx(a,{sx:{mb:2}})]}),q&&q.includes("packed")&&e.jsxs(e.Fragment,{children:[e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(i,{variant:"body2",children:"Packed"}),e.jsx(l.TextualAmountUpdater,{label:"Packed",currentValue:A,totalValue:I+R,minNewValue:0+v,maxNewValue:k+R,color:"info",handleChange:e=>{y(e,x.documentId,"packed_quantity")}})]}),e.jsx(a,{sx:{mb:2}})]}),q&&q.includes("reports")&&e.jsxs(p,{sx:{mb:2},children:[e.jsx(a,{sx:{p:0},children:e.jsxs(t,{direction:"row",spacing:1,alignItems:"center",children:[e.jsx(i,{variant:"body2",children:"Irregularities / Corrections"}),e.jsx(n,{onClick:()=>C(!_),children:e.jsx(d,{})})]})}),e.jsx(s,{in:_,children:e.jsxs(t,{spacing:2,children:[e.jsx(i,{variant:"body2",children:"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"}),e.jsx(c.default,{reports:D}),e.jsx(u.default,{itemID:x.documentId,reports:N,handleRemoveReportAtIndex:b}),e.jsx(m.default,{itemID:x.documentId,content:"",type:"packed",minValue:-(k-A+R),handleAddReport:j})]})})]}),q&&q.includes("shipped")&&e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1},children:[e.jsx(i,{variant:"body2",children:"Shipped"}),e.jsx(l.TextualAmountUpdater,{label:"Shipped",currentValue:v,totalValue:I+R,minNewValue:0,maxNewValue:A,color:"info",handleChange:e=>{y(e,x.documentId,"shipped_quantity")}})]})]})},h)};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
"use strict";var e=require("react/jsx-runtime"),r=require("react"),i=require("@mui/material/Box"),t=require("@mui/material/Stack"),
|
|
7
|
+
"use strict";var e=require("react/jsx-runtime"),r=require("react"),i=require("@mui/material/Box"),t=require("@mui/material/Stack"),n=require("@mui/material/TextField"),a=require("@mui/material/Typography"),s=require("../../SubmitButton.js"),l=require("react-dom"),d=require("../../../data/actions/e-commerce/product/updateProductAction.js"),o=require("../../common/media/MediaLibraryDialog.js"),c=require("@mui/material/Button"),u=require("@mui/material/Grid"),m=require("../../StrapiImage.js"),x=require("./PriceFields.js"),h=require("../categories/CategorySelectorV2.js"),g=require("../../common/Dimensions.js"),j=require("../../logistics/vendor/VendorSelector.js"),p=require("../../common/markdown/MarkdownEditor.js"),y=require("../../../context/common/SnackbarContext.js");const v={zodErrors:null,strapiErrors:null,severity:null,data:null,message:null};exports.EditProductForm=function({data:f,vendorArr:b,categoriesArray:q,revalidateCallback:S,handleClose:C,sx:E}){const{documentId:w,title:I,description:k,external_product_number:P,image:V,gallery:A,price:D,dimensions:F,categories:T,vendors:_}=f;console.log("price",D);const M=A||[],N=T||[];console.log("initialCategories",N);const{handleAddMessage:B}=y.useSnackbar(),[L,G]=l.useFormState(d.updateProductAction.bind(null,w),v);r.useEffect(()=>{L?.message&&(B({message:L.message,severity:L.severity||"error"}),"success"===L.severity&&(S&&S(),C&&C()))},[L?.message]),r.useEffect(()=>{L?.strapiErrors&&B({message:L.strapiErrors.message||"Error updating product",severity:L.severity||"error"})},[L?.strapiErrors]);const[R,z]=r.useState(null),[J,O]=r.useState(V||null),[H,K]=r.useState([...M]);return e.jsx(i,{sx:[...Array.isArray(E)?E:[E]],children:e.jsx("form",{action:G,children:e.jsxs(u,{container:!0,spacing:2,children:[e.jsx(u,{item:!0,xs:12,children:e.jsx(a,{variant:"h3",component:"h1",children:"Edit Product"})}),e.jsx(u,{item:!0,xs:12,children:e.jsxs(t,{spacing:2,children:[e.jsx(n,{id:"title",name:"title",label:"Title",defaultValue:I}),e.jsx(p.default,{name:"description",label:"Description",defaultValue:k}),e.jsx(n,{id:"external_product_number",name:"external_product_number",label:"External Product Number",defaultValue:P})]})}),e.jsxs(u,{item:!0,xs:6,children:[e.jsx(a,{variant:"h6",children:"Product Image"}),e.jsx("input",{id:"image",type:"hidden",name:"image",value:J?.id}),e.jsx(m.StrapiImage,{id:J?.id||"",url:J?.url||"",alternativeText:"product image",width:J?.width&&J?.height?J.width/J.height*200:200,height:200}),e.jsx(c,{onClick:()=>z("image"),children:"open media library"}),e.jsx(o.MediaLibraryDialog,{open:"image"===R,handleClose:()=>z(null),handleCancel:()=>{O(null),z(null)},handleSelect:function(e){O(e)},selected:J?[J]:[]})]}),e.jsxs(u,{item:!0,xs:6,children:[e.jsx(a,{variant:"h6",children:"Image Gallery"}),e.jsx("input",{id:"gallery",type:"hidden",name:"gallery",value:JSON.stringify(H.map(e=>e.id))}),e.jsx(t,{direction:"row",spacing:2,children:H.map(r=>e.jsx(m.StrapiImage,{id:r.id,url:r.url,alternativeText:"gallery image",width:r?.width&&r?.height?r.width/r.height*100:100,height:100},r.id))}),e.jsx(c,{onClick:()=>z("gallery"),children:"open media library"}),e.jsx(o.MediaLibraryDialog,{open:"gallery"===R,handleClose:()=>z(null),handleCancel:()=>{K([]),z(null)},handleSelect:function(e){const r=H.findIndex(r=>r.id===e.id);if(r>-1){const e=[...H];e.splice(r,1),K(e)}else H.length>=5?K([...H]):K([...H,e])},selected:H})]}),e.jsxs(u,{item:!0,xs:12,children:[e.jsx(a,{variant:"h6",children:"Price"}),e.jsx(x.PriceFields,{componentName:"price",componentReference:"e-commerce-elements.price",data:D})]}),e.jsxs(u,{item:!0,xs:12,children:[e.jsx(a,{variant:"h6",children:"Categories"}),e.jsx(h.default,{categories:q,currentValue:[...N.map(e=>e.documentId)]})]}),e.jsxs(u,{item:!0,xs:12,children:[e.jsx(a,{variant:"h6",children:"Dimensions"}),e.jsx(g.DimensionsFields,{componentName:"dimensions",componentReference:"e-commerce-elements.dimensions",data:F})]}),e.jsxs(u,{item:!0,xs:12,children:[e.jsx(a,{variant:"h6",children:"Vendors"}),e.jsx(j.default,{vendorNames:b,currentValue:_[0]?.documentId})]}),e.jsx(u,{item:!0,xs:12,children:e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{py:1},children:[C&&e.jsx(c,{onClick:C,variant:"outlined",children:"Cancel"}),e.jsx(s.SubmitButton,{text:"update product",loadingText:"loading"})]})})]})})})};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
"use strict";var e=require("react/jsx-runtime"),r=require("react"),i=require("@mui/material/Paper"),t=require("@mui/material/Box"),n=require("@mui/material/Stack"),s=require("@mui/material/Typography"),a=require("react-dom"),d=require("../../../data/actions/e-commerce/product/updateProductAction.js"),c=require("@mui/material/Grid"),l=require("../../logistics/report/ReportsDisplay.js"),o=require("../../logistics/report/ReportMakingComponent.js"),u=require("../../../context/common/SnackbarContext.js"),x=require("@mui/material/Table"),m=require("@mui/material/TableBody"),
|
|
7
|
+
"use strict";var e=require("react/jsx-runtime"),r=require("react"),i=require("@mui/material/Paper"),t=require("@mui/material/Box"),n=require("@mui/material/Stack"),s=require("@mui/material/Typography"),a=require("react-dom"),d=require("../../../data/actions/e-commerce/product/updateProductAction.js"),c=require("@mui/material/Grid"),l=require("../../logistics/report/ReportsDisplay.js"),o=require("../../logistics/report/ReportMakingComponent.js"),u=require("../../../context/common/SnackbarContext.js"),x=require("@mui/material/Table"),m=require("@mui/material/TableBody"),h=require("@mui/material/TableCell"),j=require("@mui/material/TableContainer"),y=require("@mui/material/TableFooter"),p=require("@mui/material/TableHead"),g=require("@mui/material/TableRow"),q=require("@mui/material/Tooltip"),_=require("@mui/material/Button"),A=require("../../common/AmountIndicator.js");const k={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};exports.EditStockForm=function({data:b,revalidateCallback:v,handleClose:f,sx:I}){const{documentId:T,title:S,product_number:C,stock:E,ipos:Q,opos:V,reports:N}=b,{handleAddMessage:O}=u.useSnackbar(),R=d.updateProductAction.bind(null,T),[F,P]=a.useFormState(R,k);return r.useEffect(()=>{F?.message&&(O({message:F.message,severity:F.severity||"error"}),"success"===F.severity&&(v&&v(),f&&f()))},[F?.message,O,v,f]),r.useEffect(()=>{F?.strapiErrors&&O({message:F.strapiErrors.message||"Error updating stock",severity:"error"})},[F?.strapiErrors,O]),e.jsxs(t,{sx:[...Array.isArray(I)?I:[I]],children:[e.jsxs(c,{container:!0,spacing:2,children:[e.jsx(c,{item:!0,xs:12,children:e.jsx(s,{variant:"h6",children:S})}),e.jsx(c,{item:!0,xs:12,children:e.jsxs(j,{component:i,children:[e.jsx(s,{variant:"h6",sx:{pl:2},children:"Incoming orders"}),e.jsxs(x,{size:"small",children:[e.jsx(p,{children:e.jsxs(g,{children:[e.jsx(h,{children:"Number"}),e.jsx(h,{children:"Order Date"}),e.jsx(h,{children:"Line Item Number"}),e.jsx(h,{children:"Ordered Quantity"}),e.jsx(h,{children:"Received Quantity"}),e.jsx(h,{children:"Registered Quantity"}),e.jsx(h,{children:"Released Quantity"})]})}),e.jsx(m,{children:Array.isArray(Q)?Q.map(r=>e.jsx(e.Fragment,{children:r.items.map(i=>e.jsxs(g,{children:[e.jsx(h,{children:r.ipo_number}),e.jsx(h,{children:r.order_date}),e.jsx(h,{children:i.line_item_number}),e.jsx(h,{children:e.jsx(A.AmountIndicator,{value:i.ordered_quantity,maxValue:i.ordered_quantity,color:"primary"})}),e.jsx(h,{children:e.jsx(A.AmountIndicator,{value:i.received_quantity,maxValue:i.ordered_quantity,color:"primary"})}),e.jsx(h,{children:e.jsx(A.AmountIndicator,{value:i.registered_quantity,maxValue:i.ordered_quantity,color:"primary"})}),e.jsx(h,{children:e.jsx(A.AmountIndicator,{value:i.released_quantity,maxValue:i.ordered_quantity,color:"primary"})})]},r.documentId))})):e.jsx(g,{children:e.jsx(h,{colSpan:7,align:"center",children:"No incoming orders found."})})}),e.jsx(y,{children:e.jsxs(g,{children:[e.jsx(h,{colSpan:6,align:"right",children:"Total added to stock:"}),e.jsx(h,{children:Array.isArray(Q)?Q.reduce((e,r)=>e+r.items.reduce((e,r)=>e+r.released_quantity,0),0):0})]})})]}),e.jsx(s,{variant:"h6",sx:{pl:2},children:"Outgoing orders"}),e.jsxs(x,{size:"small",children:[e.jsx(p,{children:e.jsxs(g,{children:[e.jsx(h,{children:"Number"}),e.jsx(h,{children:"Order Date"}),e.jsx(h,{children:"Line Item Number"}),e.jsx(h,{children:"Ordered Quantity"}),e.jsx(h,{children:"Picked Quantity"}),e.jsx(h,{children:"Packed Quantity"}),e.jsx(h,{children:"Shipped Quantity"})]})}),e.jsx(m,{children:Array.isArray(V)?V.map(r=>e.jsx(e.Fragment,{children:r.opo_items.map(i=>e.jsxs(g,{children:[e.jsx(h,{children:r.opo_number}),e.jsx(h,{children:r.order_date}),e.jsx(h,{children:i.line_item_number}),e.jsx(h,{children:e.jsx(A.AmountIndicator,{value:i.ordered_quantity,maxValue:i.ordered_quantity,color:"primary"})}),e.jsx(h,{children:e.jsx(A.AmountIndicator,{value:i.picked_quantity,maxValue:i.ordered_quantity,color:"primary"})}),e.jsx(h,{children:e.jsx(A.AmountIndicator,{value:i.packed_quantity,maxValue:i.ordered_quantity,color:"primary"})}),e.jsx(h,{children:e.jsx(A.AmountIndicator,{value:i.shipped_quantity,maxValue:i.ordered_quantity,color:"primary"})})]},r.documentId))})):e.jsx(g,{children:e.jsx(h,{colSpan:7,align:"center",children:"No outgoing orders found"})})}),e.jsx(y,{children:e.jsxs(g,{children:[e.jsx(h,{colSpan:3,align:"right",children:"Total reduced from stock:"}),e.jsx(h,{children:Array.isArray(V)?V.reduce((e,r)=>e+r.opo_items.reduce((e,r)=>e+r.ordered_quantity,0),0):0})]})})]}),e.jsxs(x,{size:"small",children:[e.jsxs(g,{children:[e.jsx(h,{align:"right",children:"Total added to stock:"}),e.jsx(h,{children:Array.isArray(Q)&&Q.length>0?Q.reduce((e,r)=>e+r.items.reduce((e,r)=>e+r.released_quantity,0),0):0})]}),e.jsxs(g,{children:[e.jsx(h,{align:"right",children:"Total reduced from stock:"}),e.jsx(h,{children:Array.isArray(V)&&V.length>0?V.reduce((e,r)=>e+r.opo_items.reduce((e,r)=>e+r.ordered_quantity,0),0):0})]}),e.jsxs(g,{children:[e.jsx(h,{align:"right",children:"Corrections:"}),e.jsx(h,{children:e.jsx(q,{title:"Total stock corrections",children:e.jsx(s,{children:N?N.reduce((e,r)=>e+r.quantity,0):0})})}),e.jsx(h,{children:e.jsx(q,{title:"Total stock corrections after updating",children:e.jsx("b",{children:N?N.reduce((e,r)=>e+r.quantity,0):0})})})]}),e.jsxs(g,{children:[e.jsx(h,{align:"right",children:"Stock:"}),e.jsx(h,{children:e.jsx(q,{title:"Total stock",children:e.jsx(s,{children:(Array.isArray(Q)&&Q.length>0?Q.reduce((e,r)=>e+r.items.reduce((e,r)=>e+r.released_quantity,0),0):0)-(Array.isArray(V)&&V.length>0?V.reduce((e,r)=>e+r.opo_items.reduce((e,r)=>e+r.ordered_quantity,0),0):0)+(N?N.reduce((e,r)=>e+r.quantity,0):0)})})}),e.jsx(h,{children:e.jsx(q,{title:"Total stock after updating",children:e.jsx("b",{children:(Array.isArray(Q)&&Q.length>0?Q.reduce((e,r)=>e+r.items.reduce((e,r)=>e+r.released_quantity,0),0):0)-(Array.isArray(V)&&V.length>0?V.reduce((e,r)=>e+r.opo_items.reduce((e,r)=>e+r.ordered_quantity,0),0):0)+(N?N.reduce((e,r)=>e+r.quantity,0):0)})})})]})]})]})})]}),e.jsxs("form",{action:P,children:[e.jsx("input",{id:"stock_reports",type:"hidden",name:"stock_reports",value:JSON.stringify(N)}),e.jsxs(c,{container:!0,spacing:2,children:[e.jsx(c,{item:!0,xs:12,sx:{mt:2},children:e.jsxs(n,{spacing:2,children:[e.jsx(s,{variant:"h5",children:"Stock corrections"}),e.jsx(s,{variant:"body2",children:"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"}),e.jsx(l.default,{reports:N}),e.jsx(n,{direction:"row",justifyContent:"flex-end",children:e.jsx(o.default,{content:"content",quantity:0,type:"stock",related:[{documentId:T,__type:"api::e-commerce.product"}],revalidateCallback:v,biggerButton:!0})})]})}),e.jsx(c,{item:!0,xs:12,children:e.jsx(n,{direction:"row",justifyContent:"flex-end",alignItems:"center",sx:{py:1},children:f&&e.jsx(_,{onClick:f,variant:"outlined",children:"Close"})})})]})]})]})};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
"use strict";var e=require("react/jsx-runtime"),t=require("react"),a=require("@mui/material/TextField"),
|
|
7
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("react"),a=require("@mui/material/TextField"),r=require("@mui/icons-material/Euro"),n=require("@mui/material/InputAdornment"),i=require("@mui/material/Stack");exports.PriceFields=function({data:s,componentName:o,componentReference:l}){const{documentId:c,vat_rate:d,vat:u,price_incl_vat:p,price:m}=s||{};console.log("documentId",c);const[x,v]=t.useState(m?.toString()||""),[j,_]=t.useState(()=>d?.toString()||"21"),[h,g]=t.useState(u||0),[F,I]=t.useState(p||0);return t.useEffect(()=>{if(x&&j){const e=parseFloat(x),t=e*(parseFloat(j)/100),a=e+t;g(t),I(a)}},[x,j]),e.jsxs(i,{spacing:2,direction:"row",children:[e.jsx(a,{id:"price",InputProps:{startAdornment:e.jsx(n,{position:"start",children:e.jsx(r,{})})},name:`${o}.price`,label:"price",type:"float",value:x,onChange:e=>{v(e.target.value)}}),e.jsx(a,{id:"vat_rate",name:`${o}.vat_rate`,type:"number",InputProps:{endAdornment:e.jsx(n,{position:"end",children:"%"})},label:"Vat Rate",value:j,onChange:e=>{_(e.target.value)}}),e.jsx(a,{id:"vat",InputProps:{startAdornment:e.jsx(n,{position:"start",children:e.jsx(r,{})})},name:`${o}.vat`,label:"Vat",value:h?.toFixed(2),disabled:!0}),e.jsx("input",{hidden:!0,name:`${o}.vat`,value:h?.toFixed(2),readOnly:!0}),e.jsx(a,{id:"price_incl_vat",InputProps:{startAdornment:e.jsx(n,{position:"start",children:e.jsx(r,{})})},name:`${o}.price_incl_vat`,label:"Price Incl VAT",value:F?.toFixed(2),disabled:!0}),e.jsx("input",{hidden:!0,name:`${o}.price_incl_vat`,value:F?.toFixed(2),readOnly:!0})]})};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("@mui/material/Box"),
|
|
6
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("@mui/material/Box"),t=require("@mui/material/Card"),i=require("@mui/material/CardActions"),a=require("@mui/material/CardContent"),u=require("@mui/material/CardMedia"),s=require("@mui/material/Button"),l=require("@mui/material/Typography"),n=require("@mui/material/Stack"),c=require("./Price.js"),d=require("../../../lib/utils.js"),o=require("../../StyledLink.js"),m=require("../cart/AddToCartButton.client.js"),p=require("../../common/markdown/MarkdownDisplay.js");exports.default=function({product:x,sx:h=[]}){const{documentId:j,uuid:_,product_number:f,title:q,description:v,slug:y,price:g,image:b,stock:C}=x,k=d.getStrapiMedia(b?.url),w=d.getStrapiMedia(b?.formats?.thumbnail?.url);return e.jsxs(t,{sx:[{width:"100%",height:"100%"},{display:"flex",flexDirection:"column"},...Array.isArray(h)?h:[h]],children:[e.jsx(u,{component:"img",height:"140",src:`${k}`,alt:b.alternativeText}),e.jsxs(a,{children:[e.jsxs(n,{direction:"row",justifyContent:"space-between",sx:{pb:2},children:[e.jsx(o.StyledLink,{href:`/shop/${y}`,target:"_self",children:e.jsx(l,{variant:"h5",children:q})}),e.jsx(c.default,{documentId:j,price:g.price,vat:g.vat,vat_rate:g.vat_rate,price_incl_vat:g.price_incl_vat})]}),v&&e.jsx(p.default,{children:v.substring(0,150)+"..."})]}),e.jsx(r,{sx:{flexGrow:1}}),e.jsxs(i,{sx:{display:"flex",justifyContent:"flex-end",alignItems:"flex-end"},children:[e.jsx(s,{size:"small",href:`/shop/${y}`,children:"Learn More"}),e.jsx(m.default,{product:{documentId:j,uuid:_,slug:y,thumb:w,title:q,vat_rate:g.vat_rate,price_excl_vat:g.price,price_incl_vat:g.price_incl_vat,quantity:1,product_number:f,stock:C}})]})]})};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("@mui/material/Grid"),
|
|
6
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("@mui/material/Grid"),t=require("@mui/material/Card"),i=require("@mui/material/Button"),a=require("@mui/material/Typography"),s=require("@mui/material/Box"),n=require("./ProductCard.js"),l=require("../../common/markdown/MarkdownDisplay.js");exports.default=function({category:d,sx:o=[]}){const{title:c,description:u,slug:m,products:x}=d;return e.jsx(t,{sx:[{width:"100%",height:"100%",pt:2,pl:2,pb:2,mb:2},...Array.isArray(o)?o:[o]],children:e.jsxs(r,{container:!0,xs:12,spacing:2,children:[e.jsxs(r,{item:!0,xs:12,sm:6,md:3,sx:{display:"flex",justifyContent:"start",alignItems:"center",gap:2,flexDirection:"column"},children:[e.jsx(a,{variant:"h4",component:"h1",align:"center",children:c}),u&&e.jsx(s,{sx:{textAlign:"center",p:2,overflow:"hidden"},children:e.jsx(l.default,{children:u})}),e.jsxs(i,{variant:"contained",color:"primary",href:`/shop/categories/${m}`,children:["See all ",d.title]}),x.data.length-3>0&&e.jsxs(a,{variant:"body2",children:[x.data.length-3," more..."]})]}),x.data.slice(0,3).map(t=>e.jsx(r,{item:!0,xs:12,sm:6,md:3,children:e.jsx(n.default,{product:t},t.documentId)}))]})})};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("@mui/material/Autocomplete"),
|
|
6
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("@mui/material/Autocomplete"),u=require("@mui/material/Box"),i=require("@mui/material/TextField");exports.default=({productNames:l,currentValue:n,sx:a,multiple:d=!0,onChangeCallback:s})=>{const[o,c]=t.useState(n||[]);return e.jsxs(u,{sx:[...Array.isArray(a)?a:[a]],children:[e.jsx(r,{multiple:d,options:l,getOptionLabel:e=>`${e.product_number} | ${e.title}`,filterSelectedOptions:!0,onChange:(e,t)=>{if(!0===d){const e=t.map(e=>e.documentId);c(e),s&&s(e)}else t?(c([t.documentId]),s&&s([t.documentId])):(c([]),s&&s([]))},renderInput:t=>e.jsx(i,{...t,label:"Products"}),defaultValue:d?l.filter(e=>o.includes(e.documentId)):l.find(e=>e.documentId===o[0])||null}),e.jsx("input",{type:"hidden",name:"products",value:JSON.stringify(o)})]})};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),r=require("@mui/material/Box"),t=require("@mui/material/Button"),l=require("@mui/material/Typography"),
|
|
6
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),r=require("@mui/material/Box"),t=require("@mui/material/Button"),l=require("@mui/material/Typography"),n=require("@mui/material/Stack"),a=require("@mui/material/Grid"),s=require("@mui/material/Paper"),c=require("../../../lib/utils.js"),d=require("next/link"),x=require("../../StrapiImage.js"),u=require("../cart/AddToCartButton.client.js"),o=require("../../common/markdown/MarkdownDisplay.js");exports.default=function({product:h,sx:m=[]}){const{documentId:g,uuid:j,product_number:p,title:v,description:y,slug:f,price:_,image:b,gallery:q,categories:k,stock:S}=h,T=b?.url?c.getStrapiMedia(b.url):null,w=b?.formats?.thumbnail?.url?c.getStrapiMedia(b.formats.thumbnail.url):null;return e.jsx(e.Fragment,{children:e.jsxs(a,{container:!0,spacing:2,sx:{py:3,minHeight:"60vh"},children:[e.jsx(a,{item:!0,xs:12,sm:12,md:12,lg:12,xl:12,children:e.jsx(l,{variant:"h4",align:"left",component:"h1",children:v})}),e.jsx(a,{item:!0,xs:12,sm:8,md:9,lg:4,xl:4,children:e.jsx(o.default,{children:y})}),e.jsx(a,{item:!0,xs:12,sm:4,md:3,lg:3,xl:3,children:_?.price&&e.jsx(s,{sx:{p:1},children:e.jsxs(n,{spacing:1,children:[e.jsxs(l,{variant:"body2",children:["Price excl. VAT € ",_.price.toFixed(2)]}),_.price_incl_vat&&e.jsxs(l,{variant:"body2",sx:{fontWeight:600},children:["Price incl. VAT € ",_.price_incl_vat.toFixed(2)]}),e.jsxs(l,{variant:"body2",sx:{fontWeight:600,color:0===S?"red":"white"},align:"right",children:[S," items in stock"]}),e.jsx(u.default,{product:{documentId:g,uuid:j,slug:f,thumb:w,title:v,vat_rate:_.vat_rate,quantity:1,price_excl_vat:_.price,price_incl_vat:_.price_incl_vat,product_number:p,stock:S}})]})})}),e.jsx(a,{item:!0,xs:12,sm:12,md:6,lg:5,xl:5,children:null!==T&&e.jsx(r,{sx:{height:"400px",width:"100%",position:"relative"},children:e.jsx(i.Suspense,{fallback:e.jsx("div",{children:"Loading..."}),children:e.jsx(x.StrapiImage,{id:b.id,url:T,alternativeText:b.alternativeText,fill:!0,style:{objectFit:"contain"}})})})}),e.jsx(a,{item:!0,xs:12,sm:12,md:6,lg:7,xl:7,children:e.jsxs(a,{container:!0,spacing:2,children:[e.jsx(a,{item:!0,xs:12,children:e.jsx(l,{variant:"h6",children:"Image gallery"})}),e.jsx(a,{item:!0,xs:12,children:e.jsx(i.Suspense,{fallback:e.jsx("div",{children:"Loading..."}),children:e.jsx(n,{spacing:1,direction:"row",children:h?.gallery&&h.gallery.map(i=>{const t=i?.url?c.getStrapiMedia(i.url):null;return e.jsx(r,{sx:{width:" 150px",height:"150px",position:"relative"},children:null!==t&&e.jsx(x.StrapiImage,{id:i.id,url:t,alternativeText:i.alternativeText,fill:!0,style:{objectFit:"contain"}})},i.id)})})})}),e.jsx(a,{item:!0,xs:12,md:6,children:k&&e.jsxs(n,{justifyContent:"center",alignItems:"center",direction:1===k.length?"row":"column",children:[1===k.length?e.jsx(l,{children:"Category:"}):e.jsx(l,{children:"Categories:"}),k.map(i=>e.jsx(d,{href:`/shop/categories/${i.slug}`,legacyBehavior:!0,children:e.jsx(t,{variant:"text",children:i.slug})},i.id))]})}),e.jsx(a,{item:!0,xs:12,md:6,children:e.jsx(n,{children:e.jsx(d,{href:"/shop",legacyBehavior:!0,children:e.jsx(t,{variant:"outlined",children:"continue shopping"})})})})]})})]})})};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
"use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("@mui/material/Table"),l=require("@mui/material/TableHead"),i=require("@mui/material/TableBody"),a=require("@mui/material/TableCell"),d=require("@mui/material/TableRow"),
|
|
6
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("@mui/material/Table"),l=require("@mui/material/TableHead"),i=require("@mui/material/TableBody"),a=require("@mui/material/TableCell"),d=require("@mui/material/TableRow"),n=require("@mui/material/IconButton"),s=require("@mui/icons-material/Add"),u=require("@mui/material/Typography"),c=require("@mui/material/Stack"),o=require("@mui/material/TextField"),m=require("../../e-commerce/products/ProductSelector.js"),x=require("../../common/WeekPicker.js"),h=require("../../../../node_modules/dayjs/dayjs.min.js"),p=require("@mui/icons-material/Delete"),j=require("@mui/material/styles");exports.IPOItemFields=function({productsArr:b,vendorID:w=null}){const[q,y]=t.useState([]),[v,g]=t.useState(null),[f,k]=t.useState(0),[I,_]=t.useState(new Date),[S,C]=t.useState([]),P=j.useTheme();t.useEffect(()=>{y([])},[w]);const[T,A]=t.useState([]);return t.useEffect(()=>{A((e=>e.map((e,t)=>({line_item_number:`${t+1}.0.0`,product:e.product.documentId,ordered_quantity:e.amount,expected_delivery_date:e.pdw})))(q))},[q]),e.jsxs(c,{spacing:2,children:[e.jsx(u,{variant:"h5",children:"Adding the products"}),e.jsx(u,{variant:"body1",children:"Please select the products that are in the purchase order"}),e.jsx(u,{variant:"body2",children:"Only products by the selected supplier can be added"}),e.jsxs(r,{children:[e.jsx(l,{children:e.jsxs(d,{children:[e.jsx(a,{id:"line_item_number",sx:[{width:"15%"},null===w&&{color:P.palette.text.disabled}],children:"Line Item Number"}),e.jsx(a,{sx:[{width:"55%"},null===w&&{color:P.palette.text.disabled}],children:"Product Number"}),e.jsx(a,{sx:[{width:"15%"},null===w&&{color:P.palette.text.disabled}],children:"Amount"}),e.jsx(a,{sx:[{width:"15%"},null===w&&{color:P.palette.text.disabled}],children:"Preferred delivery week"}),e.jsx(a,{sx:[null===w&&{color:P.palette.text.disabled}]})]})}),e.jsx(i,{children:q.map((t,r)=>{return e.jsxs(d,{children:[e.jsxs(a,{sx:[{width:"15%"},null===w&&{color:P.palette.text.disabled}],children:[r+1,".0.0"]}),e.jsxs(a,{sx:[{width:"55%"},null===w&&{color:P.palette.text.disabled}],children:[t.product.product_number," | ",t.product.title]}),e.jsx(a,{sx:{width:"15%"},children:t.amount}),e.jsx(a,{sx:{width:"10%"},children:(l=t.pdw,h.default(l).isoWeek())}),e.jsx(a,{align:"right",sx:{width:"5%"},children:e.jsx(n,{onClick:()=>(e=>{const t=q.filter((t,r)=>r!==e);y(t)})(r),children:e.jsx(p,{})})})]},r);var l})})]}),e.jsx("input",{type:"hidden",name:"ipo_items",value:JSON.stringify(T)}),e.jsxs(c,{direction:"row",spacing:1,alignItems:"center",sx:{p:2,width:"100%"},children:[e.jsxs(u,{variant:"body1",sx:{width:"15%"},children:[q.length+1,".0.0"]}),b&&e.jsx(m.default,{productNames:b,currentValue:S,sx:{width:"55%"},multiple:!1,onChangeCallback:e=>{const t=b.find(t=>t.documentId===e[0]);g(t||null),C(e)}}),e.jsx(o,{id:"amount",name:"amount",type:"number",label:"Amount",value:f,onChange:e=>{""!==e.target.value?parseInt(e.target.value)<0?k(0):k(parseInt(e.target.value)):k(0)},disabled:null===w,sx:{width:"15%"}}),e.jsx(x.default,{value:I,onChangeCallback:e=>{_(e)},label:"Preferred delivery week",disabled:!1}),e.jsx(n,{disabled:null===w,onClick:()=>{if(null===v||null===f)return void console.log("nextProductName or nextAmount is null");const e={product:v,amount:f,pdw:I};y([...q,e]),g(null),k(0),_(new Date),C([])},children:e.jsx(s,{})})]})]})};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("@mui/material/Stack"),i=require("@mui/material/Typography"),a=require("@mui/material/IconButton"),n=require("@mui/material/Divider"),
|
|
6
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("@mui/material/Stack"),i=require("@mui/material/Typography"),a=require("@mui/material/IconButton"),n=require("@mui/material/Divider"),o=require("@mui/material/Collapse"),d=require("../../common/AmountUpdater.js"),l=require("@mui/icons-material/ArrowDropDown"),u=require("../../common/ImagePreviewTooltip.js"),s=require("../report/ReportMakingComponent.js"),c=require("../report/ReportsDisplay.js");exports.default=function({item:m,index:p,handleUpdateQuantity:x,image:j,revalidateCallback:h}){const{line_item_number:y,product:g,received_quantity:q,registered_quantity:v,released_quantity:b,ordered_quantity:f,reports:V}=m,_=void 0!==V&&V.length>0?V.filter(e=>"received"===e.type).reduce((e,r)=>e+r.quantity,0):0,w=void 0!==V&&V.length>0?V.filter(e=>"registered"===e.type).reduce((e,r)=>e+r.quantity,0):0,[C,I]=r.useState(!1);return e.jsx(t,{spacing:1,children:m&&e.jsxs(e.Fragment,{children:[e.jsxs(t,{direction:"row",justifyContent:"space-between",children:[e.jsxs(t,{spacing:1,children:[e.jsxs(i,{variant:"body1",children:["Line Item Number: ",y]}),e.jsxs(i,{variant:"body1",children:["Part Number: ",g.product_number]})]}),j&&e.jsx(e.Fragment,{children:e.jsx(u.default,{image:j,label:m.product.title})})]}),e.jsx(i,{variant:"body2",children:"Received"}),e.jsx(d.AmountUpdater,{currentValue:q,totalValue:f+_,minNewValue:0+v+-w,maxNewValue:f+_,color:"info",handleChange:e=>{x(e,m.documentId,"received_quantity")}}),e.jsx(i,{variant:"body2",children:"Registered"}),e.jsx(d.AmountUpdater,{currentValue:v,totalValue:f+_,minNewValue:0+b,maxNewValue:q+w,color:"info",handleChange:e=>{x(e,m.documentId,"registered_quantity")},offsetEnd:w}),e.jsx(n,{sx:{p:0},children:e.jsxs(t,{direction:"row",spacing:1,alignItems:"center",children:[e.jsx(i,{variant:"body2",children:"Irregularities / Corrections"}),e.jsx(a,{onClick:()=>I(!C),children:e.jsx(l,{})})]})}),e.jsx(o,{in:C,children:e.jsxs(t,{spacing:2,children:[e.jsx(i,{variant:"body2",children:"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"}),e.jsx(c.default,{reports:V}),e.jsx(s.default,{content:"content",quantity:0,type:"registered",minValue:-(q+w),maxValue:q,related:[{documentId:m.documentId,__type:"api::logistics.ipo-item"}],revalidateCallback:h})]})}),e.jsx(i,{variant:"body2",children:"Released"}),e.jsx(d.AmountUpdater,{currentValue:b||0,totalValue:f+_+w,minNewValue:0,maxNewValue:v,color:"info",handleChange:e=>{x(e,m.documentId,"released_quantity")}})]})},p)};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),r=require("react-dom"),n=require("../../../context/common/SnackbarContext.js"),a=require("../../../data/actions/logistics/ipo/updateIpoAction.js"),t=require("../../common/media/UploadBase64MediaForm.js"),s=require("../../../data/loaders/common/media/downloadBase64File.js"),o=require("./IPOItemUpdater.js"),d=require("./ItemDisplay.js"),c=require("../note/NotesDisplay.js"),l=require("../note/NoteTakingComponent.js"),m=require("../../SubmitButton.js"),
|
|
6
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),r=require("react-dom"),n=require("../../../context/common/SnackbarContext.js"),a=require("../../../data/actions/logistics/ipo/updateIpoAction.js"),t=require("../../common/media/UploadBase64MediaForm.js"),s=require("../../../data/loaders/common/media/downloadBase64File.js"),o=require("./IPOItemUpdater.js"),d=require("./ItemDisplay.js"),c=require("../note/NotesDisplay.js"),l=require("../note/NoteTakingComponent.js"),m=require("../../SubmitButton.js"),u=require("../../../data/services/common/confirmation-service.js"),p=require("@mui/material/Alert"),x=require("@mui/material/Dialog"),h=require("@mui/material/DialogActions"),j=require("@mui/material/DialogContent"),v=require("@mui/material/DialogTitle"),f=require("@mui/material/Typography"),g=require("@mui/material/Button"),y=require("@mui/material/Grid"),b=require("@mui/material/Box"),_=require("@mui/material/Paper"),q=require("@mui/material/Stack"),C=require("@mui/material/Divider");const w={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};function I({open:i,handleClose:r,orderID:n,currentStatus:a,revalidateCallback:t}){return e.jsxs(x,{open:i,children:[e.jsx(v,{children:"Confirm Order"}),e.jsx(j,{children:e.jsxs(q,{spacing:2,children:[e.jsx(f,{children:"Are you sure you want to confirm this order?"}),e.jsxs(f,{children:["Current status: ",a]})]})}),e.jsxs(h,{children:[e.jsx(g,{variant:"contained",onClick:e=>{u.confirmationService("ipos",[n]),t&&t(),r()},children:"Confirm"}),e.jsx(g,{variant:"outlined",onClick:r,children:"Cancel"})]})]})}exports.default=function({data:u,sx:x,revalidateCallback:h,handleClose:j,role:v}){const[k,D]=r.useFormState((e,i)=>a.updateIpoAction(u.documentId,e,i),w),{handleAddMessage:S}=n.useSnackbar(),[O,U]=i.useState(u.items?u.items:[]),[N,A]=i.useState(!1);i.useEffect(()=>{k?.message&&(S({message:k.message,severity:k.severity||"error"}),"success"===k.severity&&(h&&h(),j&&j()))},[k?.message]),i.useEffect(()=>{k?.strapiErrors&&S({message:k.strapiErrors.message||"Error performing action",severity:"error"})},[k?.strapiErrors]);const B=(e,i,r)=>{const n=[...O],a=n.findIndex(e=>e.documentId===i);n[a][r]=e,U(n)};return e.jsx(b,{sx:[...Array.isArray(x)?x:[x]],children:e.jsxs(y,{container:!0,spacing:2,children:[e.jsx(y,{item:!0,xs:12,children:e.jsxs(q,{spacing:2,children:[e.jsxs(q,{direction:"row",spacing:2,justifyContent:"space-between",children:[e.jsxs(q,{spacing:2,children:[e.jsx(f,{variant:"h3",component:"h1",children:"Manage Inbound Purchase Order"}),e.jsx(f,{variant:"body1",children:"Update the incoming purchase order details"})]}),e.jsx(l.default,{content:"",related:[{id:u.documentId,__type:"api::logistics.ipo"}],revalidateCallback:h})]}),e.jsx(C,{})]})}),e.jsx(y,{item:!0,xs:6,children:e.jsxs(q,{spacing:1,children:[e.jsx(f,{variant:"h5",children:"Details"}),e.jsxs(q,{direction:"row",spacing:2,children:[e.jsx(f,{variant:"body1",width:"250px",children:"Purchase Order Number"}),e.jsx(f,{variant:"body2",children:u.ipo_number})]}),e.jsxs(q,{direction:"row",spacing:2,children:[e.jsx(f,{variant:"body1",width:"250px",children:"Custom reference"}),e.jsx(f,{variant:"body2",children:u.customer_reference})]}),e.jsxs(q,{direction:"row",spacing:2,children:[e.jsx(f,{variant:"body1",width:"250px",children:"Order Date"}),e.jsx(f,{variant:"body2",children:u.order_date})]}),e.jsxs(q,{direction:"row",spacing:2,children:[e.jsx(f,{variant:"body1",width:"250px",children:"Supplier"}),e.jsx(f,{variant:"body2",children:u.vendor_profile?.business_credentials?.company_name})]}),e.jsxs(q,{direction:"row",spacing:2,children:[e.jsx(f,{variant:"body1",width:"250px",children:"Order Status"}),e.jsx(f,{variant:"body2",width:"250px",children:u.internal_status})]}),("placed"===u.internal_status||"released_on_stock"===u.internal_status)&&"enduser"===v&&e.jsxs(e.Fragment,{children:[e.jsx(g,{variant:"contained",color:"primary",onClick:()=>A(!0),children:"Confirm order"}),e.jsx(p,{severity:"warning",children:"Please confirm the order as soon as possible. Only upon confirmation will this order be available to the dispatcher."}),e.jsx(I,{open:N,handleClose:()=>A(!1),orderID:u.documentId,currentStatus:u.internal_status,revalidateCallback:h})]})]})}),e.jsx(y,{item:!0,xs:12,children:e.jsxs(q,{spacing:2,children:[e.jsx(f,{variant:"h5",children:"Documents"}),e.jsx(_,{sx:{p:2},children:e.jsxs(q,{spacing:1,children:["enduser"===v&&e.jsx(e.Fragment,{children:u.order_confirmation?e.jsxs(q,{spacing:1,children:[e.jsx(f,{variant:"h6",children:"Order Confirmation"}),e.jsx(f,{children:u.order_confirmation?.name}),e.jsx(g,{variant:"contained",onClick:()=>{s.default(`api/ipos/${u.documentId}`,"order_confirmation")},children:"Download"})]}):e.jsxs(q,{spacing:1,children:[e.jsx(f,{variant:"h6",children:"Order Confirmation"}),e.jsx(f,{variant:"body1",children:"Upload the order confirmation for this order"}),e.jsx(t.UploadBase64MediaForm,{reference:"api::logistics.ipo",refID:u.documentId,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:h})]})}),u.delivery_note?e.jsxs(q,{spacing:1,children:[e.jsx(f,{variant:"h6",children:"Delivery Note"}),e.jsx(f,{children:u.delivery_note?.name}),e.jsx(g,{variant:"contained",onClick:()=>{s.default(`api/ipos/${u.documentId}`,"delivery_note")},children:"Download"})]}):e.jsxs(q,{spacing:1,children:[e.jsx(f,{variant:"h6",children:"Delivery Note"}),e.jsx(f,{variant:"body1",children:"Upload the delivery note for this order"}),e.jsx(t.UploadBase64MediaForm,{reference:"api::logistics.ipo",refID:u.documentId,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:h})]})]})})]})}),u?.notes?.length>0&&e.jsx(y,{item:!0,xs:12,children:e.jsxs(q,{spacing:2,children:[e.jsx(f,{variant:"h5",children:"Notes"}),e.jsx(c.default,{notes:u.notes}),e.jsx(C,{})]})}),e.jsx(y,{item:!0,xs:12,children:e.jsxs(q,{spacing:2,children:[e.jsx(f,{variant:"h5",children:"Items"}),"placed"===u.internal_status&&e.jsx(p,{severity:"warning",children:"Items cannot be updated before order confirmation"}),e.jsxs("form",{action:D,children:[e.jsx("input",{type:"hidden",name:"items",value:JSON.stringify((e=>e.map(e=>({documentId:e.documentId,received_quantity:e.received_quantity,registered_quantity:e.registered_quantity,released_quantity:e.released_quantity})))(O))}),e.jsxs(q,{spacing:2,children:[u?.items&&u.items.map((i,r)=>e.jsx(_,{sx:{p:2},children:"placed"===u.internal_status?e.jsx(d.default,{item:i,index:r,image:i?.product?.image}):e.jsx(o.default,{item:i,index:r,handleUpdateQuantity:B,image:i?.product?.image,revalidateCallback:h})},r)),"placed"!==u.internal_status&&e.jsx(_,{sx:{p:2},children:e.jsxs(q,{direction:"row",justifyContent:"flex-end",spacing:2,children:[j&&e.jsx(g,{onClick:j,variant:"outlined",children:"Cancel"}),e.jsx(m.SubmitButton,{text:"Update Items",loadingText:"Updating...",variant:"contained"})]})})]})]})]})})]})})};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("@mui/material/Stack"),i=require("@mui/material/Typography"),n=require("@mui/material/IconButton"),a=require("@mui/material/Divider"),s=require("@mui/material/Collapse"),
|
|
6
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("@mui/material/Stack"),i=require("@mui/material/Typography"),n=require("@mui/material/IconButton"),a=require("@mui/material/Divider"),s=require("@mui/material/Collapse"),d=require("../../common/TextualAmountUpdater.js"),l=require("@mui/icons-material/ArrowDropDown"),o=require("../../common/ImagePreviewTooltip.js"),u=require("../report/ReportsDisplay.js"),c=require("../report/PreReportsDisplay.js"),m=require("../report/SimpleReportFields.js"),x=require("@mui/material/Box");exports.default=function({item:p,index:j,handleAddReport:h,handleUpdateQuantity:g,image:y,handleRemoveReportAtIndex:b,showing:q}){const{line_item_number:v,product:f,ordered_quantity:w,received_quantity:I,registered_quantity:R,released_quantity:V,reports:_}=p,[C,A]=r.useState(!1);void 0!==_&&_.length>0&&_.filter(e=>"received"===e.type).reduce((e,r)=>e+r.quantity,0);const D=void 0!==_&&_.length>0?_.filter(e=>"registered"===e.type).reduce((e,r)=>e+r.quantity,0):0;void 0!==_&&_.length>0&&_.filter(e=>"released"===e.type).reduce((e,r)=>e+r.quantity,0);const N=p.reports?.filter(e=>"id"in e)||[],T=p.reports?.filter(e=>!1===Boolean("id"in e))||[];return e.jsx(t,{spacing:1,children:p&&e.jsxs(e.Fragment,{children:[e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1},children:[e.jsxs(i,{variant:"body1",children:["Line Item Number: ",v]}),e.jsxs(i,{variant:"body1",children:["Part Number: ",f?.product_number]}),y&&e.jsx(e.Fragment,{children:e.jsx(o.default,{image:y,label:p.product?.title})})]}),e.jsx(a,{sx:{mb:1}}),q&&q.includes("received")&&e.jsxs(e.Fragment,{children:[e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1},children:[e.jsx(i,{variant:"body2",children:"Received"}),e.jsx(d.TextualAmountUpdater,{label:"Received",currentValue:I,totalValue:w,minNewValue:0+R,maxNewValue:w,color:"info",handleChange:e=>{g(e,p.documentId,"received_quantity")}})]}),e.jsx(a,{sx:{mb:2}})]}),q&&q.includes("registered")&&e.jsxs(e.Fragment,{children:[e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(i,{variant:"body2",children:"Registered"}),e.jsx(d.TextualAmountUpdater,{label:"Registered",currentValue:R,totalValue:w+D,minNewValue:0+V,maxNewValue:I+D,color:"info",handleChange:e=>{g(e,p.documentId,"registered_quantity")}})]}),e.jsx(a,{sx:{mb:2}})]}),q&&q.includes("reports")&&e.jsxs(x,{sx:{mb:2},children:[e.jsx(a,{sx:{p:0},children:e.jsxs(t,{direction:"row",spacing:1,alignItems:"center",children:[e.jsx(i,{variant:"body2",children:"Irregularities / Corrections"}),e.jsx(n,{onClick:()=>A(!C),children:e.jsx(l,{})})]})}),e.jsx(s,{in:C,children:e.jsxs(t,{spacing:2,children:[e.jsx(i,{variant:"body2",children:"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"}),e.jsx(u.default,{reports:N}),e.jsx(c.default,{itemID:p.documentId,reports:T,handleRemoveReportAtIndex:b}),e.jsx(m.default,{itemID:p.documentId,content:"",type:"registered",minValue:-(I-R+D),handleAddReport:h})]})})]}),q&&q.includes("released")&&e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1},children:[e.jsx(i,{variant:"body2",children:"Released"}),e.jsx(d.TextualAmountUpdater,{label:"Released",currentValue:V,totalValue:w+D,minNewValue:0,maxNewValue:R,color:"info",handleChange:e=>{g(e,p.documentId,"released_quantity")}})]})]})},j)};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),i=require("react-dom"),t=require("../../../context/common/SnackbarContext.js"),a=require("../../../data/actions/logistics/ipo/updateIpoAction.js"),n=require("../../../data/services/common/confirmation-service.js"),s=require("../../../data/services/common/cancellation-service.js"),o=require("../../../data/loaders/common/media/downloadBase64File.js"),l=require("../../common/media/UploadBase64MediaForm.js"),c=require("../note/NoteTakingComponent.js"),d=require("../note/NotesDisplay.js"),u=require("./ItemDisplay.js"),m=require("./TextualIPOItemUpdater.js"),p=require("./IpoStatusIndicator.js"),h=require("@mui/material/Box"),x=require("@mui/material/Stack"),j=require("@mui/material/Paper"),g=require("@mui/material/Dialog"),v=require("@mui/material/DialogActions"),f=require("@mui/material/DialogContent"),y=require("@mui/material/DialogTitle"),b=require("@mui/material/Typography"),C=require("@mui/material/Button"),q=require("@mui/material/Grid"),_=require("@mui/material/Divider"),I=require("@mui/material/TextField"),w=require("@mui/material/List"),k=require("@mui/material/ListItem"),S=require("@mui/material/Alert"),D=require("@mui/material/Checkbox"),F=require("@mui/material/FormControlLabel"),O=require("@mui/icons-material/Numbers"),E=require("@mui/icons-material/Description"),A=require("@mui/icons-material/CalendarToday"),P=require("@mui/icons-material/Business"),B=require("@mui/icons-material/Update"),U=require("../../SubmitButton.js");const N={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};function M({open:r,handleClose:i,orderID:a,currentStatus:s,revalidateCallback:o}){const{handleAddMessage:l}=t.useSnackbar();return e.jsxs(g,{open:r,onClose:i,children:[e.jsx(y,{children:"Confirm Order"}),e.jsx(f,{children:e.jsxs(x,{spacing:2,children:[e.jsx(b,{children:"Are you sure you want to confirm this order?"}),e.jsxs(b,{children:["Current status: ",s]}),e.jsx(S,{severity:"info",children:"Once confirmed, the order will be available for processing."})]})}),e.jsxs(v,{children:[e.jsx(C,{variant:"outlined",onClick:i,children:"Cancel"}),e.jsx(C,{variant:"contained",color:"primary",onClick:async()=>{try{await n.confirmationService("ipos",[a]),l({message:"IPO confirmed successfully",severity:"success"}),o&&o(),i()}catch(e){l({message:"Failed to confirm IPO",severity:"error"})}},children:"Confirm Order"})]})]})}function T({open:i,handleClose:a,orderID:n,revalidateCallback:o}){const[l,c]=r.useState(""),[d,u]=r.useState(""),{handleAddMessage:m}=t.useSnackbar();return e.jsxs(g,{open:i,onClose:a,children:[e.jsx(y,{children:"Cancel Return"}),e.jsx(f,{children:e.jsxs(x,{spacing:2,children:[e.jsx(b,{children:"Are you sure you want to cancel this return?"}),e.jsxs(w,{children:[e.jsx(k,{children:"By cancelling this return order you will update it's status from requested to cancelled"}),e.jsx(k,{children:"Please provide a reason for the cancellation"}),e.jsx(k,{children:"The customer will be notified about the cancellation and of the reason for the cancellation"})]}),e.jsx(I,{label:"Cancellation reason",name:"reason",multiline:!0,rows:4,fullWidth:!0,variant:"outlined",value:l,onChange:e=>c(e.target.value),placeholder:"Please provide a reason for the cancellation",error:!!d,helperText:d})]})}),e.jsxs(v,{children:[e.jsx(C,{variant:"outlined",onClick:a,children:"Close"}),e.jsx(C,{variant:"contained",color:"error",onClick:async()=>{if(l.length<5)u("Please provide a reason for the cancellation (min 5 characters)");else try{await s.cancellationService("ipos",n,l),m({message:"Order cancelled successfully",severity:"success"}),o&&o(),a()}catch(e){m({message:"Failed to cancel order",severity:"error"})}},children:"Confirm Cancellation"})]})]})}exports.default=function({data:n,sx:s,revalidateCallback:g,handleClose:v,role:f}){const[y,I]=i.useFormState((e,r)=>a.updateIpoAction(n.documentId,e,r),N),{handleAddMessage:w}=t.useSnackbar(),[k,R]=r.useState(n.items?n.items:[]),[W,L]=r.useState(!1),[z,H]=r.useState(!1),[$,G]=r.useState(["received","registered","released","reports"]);r.useEffect(()=>{y?.message&&(w({message:y.message,severity:y.severity||"error"}),"success"===y.severity&&(g&&g(),v&&v()))},[y?.message]),r.useEffect(()=>{y?.strapiErrors&&w({message:y.strapiErrors.message||"Error updating IPO",severity:"error"})},[y?.strapiErrors]);const J=(e,r,i)=>{const t=[...k],a=t.findIndex(e=>e.id===r);t[a][i]=e,R(t)},Q=(e,r)=>{const i=[...k],t=i.findIndex(e=>e.id===r),a=[...i[t]?.reports||[],e];null==i[t]?.reports&&(i[t]={...i[t],reports:[]}),i[t].reports=a,R(i)},K=(e,r)=>{const i=[...k],t=i.findIndex(r=>r.id===e),a=i[t]?.reports||[],n=a.filter(e=>"id"in e),s=a.filter(e=>!("id"in e));s.splice(r,1);const o=[...n,...s];i[t].reports=o,R(i)};return r.useEffect(()=>{"Ipo Updated"===y?.message&&(w({message:"Ipo Updated",severity:"success"}),v&&v(),g&&g())},[y]),r.useEffect(()=>{y?.strapiErrors&&w({message:y.strapiErrors.message||"Error updating IPO",severity:"error"})},[y?.strapiErrors]),r.useEffect(()=>{console.log("data",n),n.items&&R(n.items?n.items:[])},[n]),e.jsx(h,{sx:[...Array.isArray(s)?s:[s]],children:e.jsxs(q,{container:!0,spacing:2,children:[e.jsx(q,{item:!0,xs:12,children:e.jsxs(x,{spacing:2,children:[e.jsxs(x,{direction:"row",spacing:2,justifyContent:"space-between",children:[e.jsxs(x,{spacing:2,children:[e.jsx(b,{variant:"h3",component:"h1",children:"Management Inbound Purchase Order"}),e.jsx(b,{variant:"body1",children:"Manage arrival, registration and recieval of purchase order"})]}),e.jsx(c.default,{content:"",related:[{id:n.id,__type:"api::logistics.ipo"}],revalidateCallback:g})]}),e.jsx(_,{})]})}),e.jsx(q,{item:!0,xs:12,children:e.jsx(b,{variant:"h5",sx:{py:1},children:"Details"})}),e.jsx(q,{item:!0,xs:6,children:e.jsx(j,{elevation:2,sx:{p:2,height:"100%"},children:e.jsxs(x,{spacing:2,children:[e.jsxs(x,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(O,{color:"primary"}),e.jsx(b,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Purchase Order Number"}),e.jsx(b,{variant:"body1",fontWeight:"medium",children:n.ipo_number})]}),e.jsxs(x,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(E,{color:"primary"}),e.jsx(b,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Custom Reference"}),e.jsx(b,{variant:"body1",fontWeight:"medium",children:n.customer_reference})]}),e.jsxs(x,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(A,{color:"primary"}),e.jsx(b,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Order Date"}),e.jsx(b,{variant:"body1",fontWeight:"medium",children:n.order_date})]}),e.jsxs(x,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(P,{color:"primary"}),e.jsx(b,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Supplier"}),e.jsx(b,{variant:"body1",fontWeight:"medium",children:n.vendor_profile?.business_credentials?.company_name})]}),e.jsxs(x,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(B,{color:"primary"}),e.jsx(b,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Order Status"}),e.jsx(p.IpoStatusIndicator,{status:n.internal_status})]})]})})}),"enduser"===f&&e.jsx(q,{item:!0,xs:6,children:e.jsx(j,{elevation:2,sx:{p:2,height:"100%"},children:e.jsxs(x,{spacing:2,children:[("placed"===n.internal_status||"released_on_stock"===n.internal_status)&&e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"contained",color:"primary",onClick:()=>L(!0),children:"Confirm order"}),e.jsx(S,{severity:"warning",children:"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"}),e.jsx(M,{open:W,handleClose:()=>L(!1),orderID:n.documentId,currentStatus:n.internal_status,revalidateCallback:g})]}),("placed"===n.internal_status||"ordered"===n.internal_status)&&e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"contained",color:"error",onClick:()=>H(!0),children:"Cancel order"}),e.jsx(T,{open:z,handleClose:()=>H(!1),orderID:n.documentId,revalidateCallback:g})]})]})})}),e.jsx(q,{item:!0,xs:12,children:e.jsxs(x,{spacing:2,children:[e.jsx(b,{variant:"h5",children:"Documents"}),e.jsx(j,{sx:{p:2},children:e.jsxs(x,{spacing:1,children:["enduser"===f&&e.jsx(e.Fragment,{children:n.order_confirmation?e.jsxs(e.Fragment,{children:[e.jsx(b,{variant:"h6",children:"Order Confirmation"}),e.jsx(b,{children:n.order_confirmation?.name}),e.jsx(C,{variant:"contained",onClick:()=>{o.default(`api/ipos/${n.id}`,"order_confirmation")},children:"Download"})]}):e.jsxs(e.Fragment,{children:[e.jsx(b,{variant:"h5",children:"Order Confirmation"}),e.jsx(b,{variant:"body1",children:"Here you can upload the the order confirmation for this order"}),e.jsx(b,{variant:"body1",children:"FileUpload"}),e.jsx(_,{}),e.jsx(l.UploadBase64MediaForm,{reference:"api::logistics.ipo",refID:n.documentId,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:g})]})}),n.delivery_note?e.jsxs(e.Fragment,{children:[e.jsx(b,{variant:"h6",children:"Delivery Note"}),e.jsx(b,{children:n.delivery_note?.name}),e.jsx(C,{variant:"contained",onClick:()=>{o.default(`api/ipos/${n.id}`,"delivery_note")},children:"Download"})]}):e.jsxs(e.Fragment,{children:[e.jsx(b,{variant:"h5",children:"Delivery Note"}),e.jsx(b,{variant:"body1",children:"Here you can upload the the delivery note for this order"}),e.jsx(_,{}),e.jsx(l.UploadBase64MediaForm,{reference:"api::logistics.ipo",refID:n.documentId,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:g})]})]})})]})}),n?.notes?.length>0&&e.jsx(q,{item:!0,xs:12,children:e.jsxs(x,{spacing:2,children:[e.jsx(b,{variant:"h5",children:"Notes"}),e.jsx(d.default,{notes:n.notes}),e.jsx(_,{})]})}),e.jsx(q,{item:!0,xs:12,children:e.jsxs(x,{spacing:1,children:[e.jsx(b,{variant:"h5",children:"Items"}),e.jsxs(x,{direction:"row",alignItems:"center",justifyContent:"flex-end",spacing:2,component:j,p:1,sx:{bgcolor:"background.default",border:"1px solid",borderColor:"divider",boxShadow:"none"},children:[e.jsx(b,{variant:"body2",color:"text.secondary",children:"Show:"}),["received","registered","released","reports"].map(r=>e.jsx(F,{control:e.jsx(D,{size:"small",checked:$.includes(r),onChange:e=>{e.target.checked?G([...$,r]):G($.filter(e=>e!==r))}}),label:e.jsx(b,{variant:"body2",color:"text.secondary",children:r.charAt(0).toUpperCase()+r.slice(1)}),sx:{mr:0}},r))]}),"placed"===n.internal_status&&e.jsx(S,{severity:"warning",children:"Before confirmation you cannot update the items"}),e.jsx(_,{}),e.jsxs("form",{action:I,children:[k&&k.map((r,i)=>e.jsx(j,{sx:{p:2,mb:2},children:"placed"===n.internal_status||"cancelled"===n.internal_status||"done"===n.internal_status?e.jsx(u.default,{item:r,index:i,image:r?.product?.image}):e.jsx(m.default,{item:r,index:i,handleUpdateQuantity:J,handleAddReport:Q,image:r?.product?.image,handleRemoveReportAtIndex:K,revalidateCallback:g,showing:$})},i)),e.jsxs(x,{direction:"row",spacing:2,justifyContent:"space-between",children:[v&&e.jsx(C,{onClick:v,variant:"outlined",children:"Cancel"}),e.jsx(U.SubmitButton,{variant:"contained",text:"Update items",loadingText:"Loading..."})]}),e.jsx("input",{type:"hidden",name:"items",value:JSON.stringify((e=>e.map(e=>({id:e.id,ordered_quantity:e.ordered_quantity,received_quantity:e.received_quantity,registered_quantity:e.registered_quantity,released_quantity:e.released_quantity,reports:e.reports?.map(e=>({id:"id"in e?e.id:void 0,quantity:e.quantity,content:e.content,type:e.type}))||[]})))(k))})]})]})})]})})};
|
|
6
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),i=require("react-dom"),t=require("../../../context/common/SnackbarContext.js"),n=require("../../../data/actions/logistics/ipo/updateIpoAction.js"),a=require("../../../data/services/common/confirmation-service.js"),s=require("../../../data/services/common/cancellation-service.js"),o=require("../../../data/loaders/common/media/downloadBase64File.js"),c=require("../../common/media/UploadBase64MediaForm.js"),l=require("../note/NoteTakingComponent.js"),d=require("../note/NotesDisplay.js"),u=require("./ItemDisplay.js"),m=require("./TextualIPOItemUpdater.js"),p=require("./IpoStatusIndicator.js"),h=require("@mui/material/Box"),x=require("@mui/material/Stack"),j=require("@mui/material/Paper"),g=require("@mui/material/Dialog"),v=require("@mui/material/DialogActions"),f=require("@mui/material/DialogContent"),y=require("@mui/material/DialogTitle"),b=require("@mui/material/Typography"),C=require("@mui/material/Button"),I=require("@mui/material/Grid"),q=require("@mui/material/Divider"),_=require("@mui/material/TextField"),w=require("@mui/material/List"),k=require("@mui/material/ListItem"),S=require("@mui/material/Alert"),D=require("@mui/material/Checkbox"),F=require("@mui/material/FormControlLabel"),O=require("@mui/icons-material/Numbers"),E=require("@mui/icons-material/Description"),A=require("@mui/icons-material/CalendarToday"),P=require("@mui/icons-material/Business"),B=require("@mui/icons-material/Update"),U=require("../../SubmitButton.js");const N={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};function M({open:r,handleClose:i,orderID:n,currentStatus:s,revalidateCallback:o}){const{handleAddMessage:c}=t.useSnackbar();return e.jsxs(g,{open:r,onClose:i,children:[e.jsx(y,{children:"Confirm Order"}),e.jsx(f,{children:e.jsxs(x,{spacing:2,children:[e.jsx(b,{children:"Are you sure you want to confirm this order?"}),e.jsxs(b,{children:["Current status: ",s]}),e.jsx(S,{severity:"info",children:"Once confirmed, the order will be available for processing."})]})}),e.jsxs(v,{children:[e.jsx(C,{variant:"outlined",onClick:i,children:"Cancel"}),e.jsx(C,{variant:"contained",color:"primary",onClick:async()=>{try{await a.confirmationService("ipos",[n]),c({message:"IPO confirmed successfully",severity:"success"}),o&&o(),i()}catch(e){c({message:"Failed to confirm IPO",severity:"error"})}},children:"Confirm Order"})]})]})}function T({open:i,handleClose:n,orderID:a,revalidateCallback:o}){const[c,l]=r.useState(""),[d,u]=r.useState(""),{handleAddMessage:m}=t.useSnackbar();return e.jsxs(g,{open:i,onClose:n,children:[e.jsx(y,{children:"Cancel Return"}),e.jsx(f,{children:e.jsxs(x,{spacing:2,children:[e.jsx(b,{children:"Are you sure you want to cancel this return?"}),e.jsxs(w,{children:[e.jsx(k,{children:"By cancelling this return order you will update it's status from requested to cancelled"}),e.jsx(k,{children:"Please provide a reason for the cancellation"}),e.jsx(k,{children:"The customer will be notified about the cancellation and of the reason for the cancellation"})]}),e.jsx(_,{label:"Cancellation reason",name:"reason",multiline:!0,rows:4,fullWidth:!0,variant:"outlined",value:c,onChange:e=>l(e.target.value),placeholder:"Please provide a reason for the cancellation",error:!!d,helperText:d})]})}),e.jsxs(v,{children:[e.jsx(C,{variant:"outlined",onClick:n,children:"Close"}),e.jsx(C,{variant:"contained",color:"error",onClick:async()=>{if(c.length<5)u("Please provide a reason for the cancellation (min 5 characters)");else try{await s.cancellationService("ipos",a,c),m({message:"Order cancelled successfully",severity:"success"}),o&&o(),n()}catch(e){m({message:"Failed to cancel order",severity:"error"})}},children:"Confirm Cancellation"})]})]})}exports.default=function({data:a,sx:s,revalidateCallback:g,handleClose:v,role:f}){const[y,_]=i.useFormState((e,r)=>n.updateIpoAction(a.documentId,e,r),N),{handleAddMessage:w}=t.useSnackbar(),[k,R]=r.useState(a.items?a.items:[]),[W,L]=r.useState(!1),[z,H]=r.useState(!1),[$,G]=r.useState(["received","registered","released","reports"]);r.useEffect(()=>{y?.message&&(w({message:y.message,severity:y.severity||"error"}),"success"===y.severity&&(g&&g(),v&&v()))},[y?.message]),r.useEffect(()=>{y?.strapiErrors&&w({message:y.strapiErrors.message||"Error updating IPO",severity:"error"})},[y?.strapiErrors]);const J=(e,r,i)=>{const t=[...k],n=t.findIndex(e=>e.documentId===r);t[n][i]=e,R(t)},Q=(e,r)=>{const i=[...k],t=i.findIndex(e=>e.documentId===r),n=[...i[t]?.reports||[],e];null==i[t]?.reports&&(i[t]={...i[t],reports:[]}),i[t].reports=n,R(i)},K=(e,r)=>{const i=[...k],t=i.findIndex(r=>r.documentId===e),n=i[t]?.reports||[],a=n.filter(e=>"id"in e),s=n.filter(e=>!("id"in e));s.splice(r,1);const o=[...a,...s];i[t].reports=o,R(i)};return r.useEffect(()=>{"Ipo Updated"===y?.message&&(w({message:"Ipo Updated",severity:"success"}),v&&v(),g&&g())},[y]),r.useEffect(()=>{y?.strapiErrors&&w({message:y.strapiErrors.message||"Error updating IPO",severity:"error"})},[y?.strapiErrors]),r.useEffect(()=>{console.log("data",a),a.items&&R(a.items?a.items:[])},[a]),e.jsx(h,{sx:[...Array.isArray(s)?s:[s]],children:e.jsxs(I,{container:!0,spacing:2,children:[e.jsx(I,{item:!0,xs:12,children:e.jsxs(x,{spacing:2,children:[e.jsxs(x,{direction:"row",spacing:2,justifyContent:"space-between",children:[e.jsxs(x,{spacing:2,children:[e.jsx(b,{variant:"h3",component:"h1",children:"Management Inbound Purchase Order"}),e.jsx(b,{variant:"body1",children:"Manage arrival, registration and recieval of purchase order"})]}),e.jsx(l.default,{content:"",related:[{id:a.documentId,__type:"api::logistics.ipo"}],revalidateCallback:g})]}),e.jsx(q,{})]})}),e.jsx(I,{item:!0,xs:12,children:e.jsx(b,{variant:"h5",sx:{py:1},children:"Details"})}),e.jsx(I,{item:!0,xs:6,children:e.jsx(j,{elevation:2,sx:{p:2,height:"100%"},children:e.jsxs(x,{spacing:2,children:[e.jsxs(x,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(O,{color:"primary"}),e.jsx(b,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Purchase Order Number"}),e.jsx(b,{variant:"body1",fontWeight:"medium",children:a.ipo_number})]}),e.jsxs(x,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(E,{color:"primary"}),e.jsx(b,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Custom Reference"}),e.jsx(b,{variant:"body1",fontWeight:"medium",children:a.customer_reference})]}),e.jsxs(x,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(A,{color:"primary"}),e.jsx(b,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Order Date"}),e.jsx(b,{variant:"body1",fontWeight:"medium",children:a.order_date})]}),e.jsxs(x,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(P,{color:"primary"}),e.jsx(b,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Supplier"}),e.jsx(b,{variant:"body1",fontWeight:"medium",children:a.vendor_profile?.business_credentials?.company_name})]}),e.jsxs(x,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(B,{color:"primary"}),e.jsx(b,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Order Status"}),e.jsx(p.IpoStatusIndicator,{status:a.internal_status})]})]})})}),"enduser"===f&&e.jsx(I,{item:!0,xs:6,children:e.jsx(j,{elevation:2,sx:{p:2,height:"100%"},children:e.jsxs(x,{spacing:2,children:[("placed"===a.internal_status||"released_on_stock"===a.internal_status)&&e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"contained",color:"primary",onClick:()=>L(!0),children:"Confirm order"}),e.jsx(S,{severity:"warning",children:"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"}),e.jsx(M,{open:W,handleClose:()=>L(!1),orderID:a.documentId,currentStatus:a.internal_status,revalidateCallback:g})]}),("placed"===a.internal_status||"ordered"===a.internal_status)&&e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"contained",color:"error",onClick:()=>H(!0),children:"Cancel order"}),e.jsx(T,{open:z,handleClose:()=>H(!1),orderID:a.documentId,revalidateCallback:g})]})]})})}),e.jsx(I,{item:!0,xs:12,children:e.jsxs(x,{spacing:2,children:[e.jsx(b,{variant:"h5",children:"Documents"}),e.jsx(j,{sx:{p:2},children:e.jsxs(x,{spacing:1,children:["enduser"===f&&e.jsx(e.Fragment,{children:a.order_confirmation?e.jsxs(e.Fragment,{children:[e.jsx(b,{variant:"h6",children:"Order Confirmation"}),e.jsx(b,{children:a.order_confirmation?.name}),e.jsx(C,{variant:"contained",onClick:()=>{o.default(`api/ipos/${a.documentId}`,"order_confirmation")},children:"Download"})]}):e.jsxs(e.Fragment,{children:[e.jsx(b,{variant:"h5",children:"Order Confirmation"}),e.jsx(b,{variant:"body1",children:"Here you can upload the the order confirmation for this order"}),e.jsx(b,{variant:"body1",children:"FileUpload"}),e.jsx(q,{}),e.jsx(c.UploadBase64MediaForm,{reference:"api::logistics.ipo",refID:a.documentId,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:g})]})}),a.delivery_note?e.jsxs(e.Fragment,{children:[e.jsx(b,{variant:"h6",children:"Delivery Note"}),e.jsx(b,{children:a.delivery_note?.name}),e.jsx(C,{variant:"contained",onClick:()=>{o.default(`api/ipos/${a.documentId}`,"delivery_note")},children:"Download"})]}):e.jsxs(e.Fragment,{children:[e.jsx(b,{variant:"h5",children:"Delivery Note"}),e.jsx(b,{variant:"body1",children:"Here you can upload the the delivery note for this order"}),e.jsx(q,{}),e.jsx(c.UploadBase64MediaForm,{reference:"api::logistics.ipo",refID:a.documentId,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:g})]})]})})]})}),a?.notes?.length>0&&e.jsx(I,{item:!0,xs:12,children:e.jsxs(x,{spacing:2,children:[e.jsx(b,{variant:"h5",children:"Notes"}),e.jsx(d.default,{notes:a.notes}),e.jsx(q,{})]})}),e.jsx(I,{item:!0,xs:12,children:e.jsxs(x,{spacing:1,children:[e.jsx(b,{variant:"h5",children:"Items"}),e.jsxs(x,{direction:"row",alignItems:"center",justifyContent:"flex-end",spacing:2,component:j,p:1,sx:{bgcolor:"background.default",border:"1px solid",borderColor:"divider",boxShadow:"none"},children:[e.jsx(b,{variant:"body2",color:"text.secondary",children:"Show:"}),["received","registered","released","reports"].map(r=>e.jsx(F,{control:e.jsx(D,{size:"small",checked:$.includes(r),onChange:e=>{e.target.checked?G([...$,r]):G($.filter(e=>e!==r))}}),label:e.jsx(b,{variant:"body2",color:"text.secondary",children:r.charAt(0).toUpperCase()+r.slice(1)}),sx:{mr:0}},r))]}),"placed"===a.internal_status&&e.jsx(S,{severity:"warning",children:"Before confirmation you cannot update the items"}),e.jsx(q,{}),e.jsxs("form",{action:_,children:[k&&k.map((r,i)=>e.jsx(j,{sx:{p:2,mb:2},children:"placed"===a.internal_status||"cancelled"===a.internal_status||"done"===a.internal_status?e.jsx(u.default,{item:r,index:i,image:r?.product?.image}):e.jsx(m.default,{item:r,index:i,handleUpdateQuantity:J,handleAddReport:Q,image:r?.product?.image,handleRemoveReportAtIndex:K,revalidateCallback:g,showing:$})},i)),e.jsxs(x,{direction:"row",spacing:2,justifyContent:"space-between",children:[v&&e.jsx(C,{onClick:v,variant:"outlined",children:"Cancel"}),e.jsx(U.SubmitButton,{variant:"contained",text:"Update items",loadingText:"Loading..."})]}),e.jsx("input",{type:"hidden",name:"items",value:JSON.stringify((e=>e.map(e=>({id:e.documentId,ordered_quantity:e.ordered_quantity,received_quantity:e.received_quantity,registered_quantity:e.registered_quantity,released_quantity:e.released_quantity,reports:e.reports?.map(e=>({documentId:"documentId"in e?e.documentId:void 0,quantity:e.quantity,content:e.content,type:e.type}))||[]})))(k))})]})]})})]})})};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
"use strict";var e=require("react/jsx-runtime"),t=require("react"),s=require("@mui/material/Paper"),n=require("@mui/material/Box"),i=require("@mui/material/Stack"),a=require("@mui/material/Button"),r=require("@mui/material/TextField"),d=require("@mui/material/Typography"),c=require("../../SubmitButton.js"),
|
|
7
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("react"),s=require("@mui/material/Paper"),n=require("@mui/material/Box"),i=require("@mui/material/Stack"),a=require("@mui/material/Button"),r=require("@mui/material/TextField"),d=require("@mui/material/Typography"),c=require("../../SubmitButton.js"),o=require("react-dom"),l=require("../../../context/common/SnackbarContext.js"),m=require("../../../data/actions/logistics/vendor/updateVendorAction.js"),u=require("@mui/material/Grid"),x=require("../../e-commerce/customer/BusinessCredentials.js"),p=require("../../common/Address.js"),j=require("../../e-commerce/products/ProductSelector.js"),h=require("../../common/Contacts.js"),g=require("@mui/icons-material/Add"),f=require("../../../types/common/Contact.js"),y=require("../../ExplanatoryFoldOut.js"),C=require("../note/NoteTakingComponent.js"),b=require("../note/NotesDisplay.js");const q={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};exports.EditVendorForm=function({data:v,productNamesArr:N,revalidateCallback:_,handleClose:E,sx:I}){const{documentId:k,website_url:w,phone_number:A,email:V,business_credentials:S,address:F,products:B,contacts:R,notes:$}=v;console.log("data",v);const[T,P]=o.useFormState(m.updateVendorAction,q),{handleAddMessage:O}=l.useSnackbar();t.useEffect(()=>{T?.message&&(O({message:T.message,severity:T.severity||"error"}),"success"===T.severity&&(_&&_(),E&&E()))},[T?.message]),t.useEffect(()=>{T?.strapiErrors&&O({message:T.strapiErrors.message||"Error updating vendor",severity:"error"})},[T?.strapiErrors]);const U=B?.data||[],[z,M]=t.useState([]),D=(e,t)=>{z.includes(t)?M(z.filter(e=>e!==t)):M([...z,t])},[G,W]=t.useState(R.reduce((e,t,s)=>(e.push({componentName:`contacts[${s}]`,componentReference:"logistics-elements.contact",data:t}),e),[])),[H,J]=t.useState([]);return e.jsx(n,{sx:[...Array.isArray(I)?I:[I]],children:e.jsxs("form",{action:P,children:[k&&e.jsx("input",{id:"id",type:"hidden",name:"id",value:k}),e.jsxs(u,{container:!0,spacing:2,children:[e.jsx(u,{item:!0,xs:12,children:e.jsxs(i,{direction:"row",justifyContent:"space-between",children:[e.jsx(d,{variant:"h5",children:"Edit Vendor"}),e.jsx(C.default,{content:"",related:[{id:v.documentId,__type:"api::logistics.vendor-profile"}],revalidateCallback:_})]})}),e.jsx(u,{item:!0,xs:12,children:e.jsx(y.ExplanatoryFoldOut,{title:"Vendor",description:"Vendors are businesses that you purchase products from."})}),e.jsx(u,{item:!0,xs:12,md:6,children:e.jsx(x.BusinessCredentialsFields,{data:S,componentName:"business_credentials",componentReference:"common.business-credentials"})}),e.jsx(u,{item:!0,xs:12,md:6,children:e.jsxs(i,{spacing:2,children:[e.jsx(r,{id:"website_url",name:"website_url",label:"Website Url",defaultValue:w}),e.jsx(r,{id:"phone_number",name:"phone_number",label:"Phone Number",defaultValue:A}),e.jsx(r,{id:"email",name:"email",label:"Email",defaultValue:V})]})}),e.jsxs(u,{item:!0,xs:12,md:6,children:[e.jsx(d,{variant:"h6",children:"Address"}),e.jsx(p.AddressFields,{data:F,componentName:"address",componentReference:"common.address"})]}),e.jsxs(u,{item:!0,xs:12,sx:{mt:1},children:[e.jsx(d,{variant:"h6",children:"Products"}),e.jsx(j.default,{productNames:N,currentValue:U.map(e=>e.documentId)})]}),e.jsx(u,{item:!0,xs:12,sx:{mt:1},children:e.jsx(d,{variant:"h6",children:"Contacts"})}),G?.map((t,n)=>t.data?.id?z.includes(t.data?.id)?e.jsx(u,{item:!0,xs:12,sm:6,md:4,lg:3,sx:{justifyContent:"center",display:"flex",alignItems:"center"},children:e.jsx(s,{sx:{p:2,width:"100%",display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:e.jsx(h.ContactsFields,{data:t.data,componentName:`contacts[${n}]`,componentReference:"logistics-elements.contact",deleteCallback:()=>{W(G.filter((e,t)=>t!==n))}})})},t.data.id):e.jsx(u,{item:!0,xs:12,sm:6,md:4,lg:3,sx:{justifyContent:"center",display:"flex",alignItems:"center"},children:e.jsxs(s,{sx:{p:2,width:"100%",display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:[e.jsx("input",{type:"hidden",name:`contacts[${n}].id`,value:t.data.id}),e.jsx("input",{type:"hidden",name:`contacts[${n}].__component`,value:"logistics-elements.contact"}),e.jsx(h.default,{data:{...t.data,onClick:D}})]})},t.data.id):null),H.map((t,n)=>e.jsx(u,{item:!0,xs:12,sm:6,md:4,lg:3,sx:{justifyContent:"center",display:"flex",alignItems:"center"},children:e.jsx(s,{sx:{p:2,width:"100%",display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:e.jsx(h.ContactsFields,{data:t.data,componentName:t.componentName,componentReference:"logistics-elements.contact",deleteCallback:()=>{J(H.filter((e,t)=>t!==n).map((e,t)=>({...e,componentName:`contacts[${t+G.length}]`})))}})})},t.data?.id||n)),e.jsx(u,{item:!0,xs:12,sm:6,md:4,lg:3,sx:{justifyContent:"center",display:"flex",alignItems:"center"},children:e.jsx(s,{sx:{p:2,width:"100%",display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:e.jsx(a,{variant:"contained",startIcon:e.jsx(g,{}),onClick:()=>{J([...H,{componentName:`contacts[${G.length+H.length}]`,componentReference:"logistics-elements.contact",data:{uuid:Math.random(),first_name:"",last_name:"",email:"",phone_number:"",type:f.ContactType.Other}}])},size:"large",children:"Add contact"})})}),e.jsxs(u,{item:!0,xs:12,children:[e.jsx(d,{variant:"h6",children:"Notes"}),void 0!==$?.data?e.jsx(b.default,{notes:$.data}):e.jsx(d,{children:"No notes to display"})]})," ",e.jsx(u,{item:!0,xs:12,children:e.jsxs(i,{direction:"row",spacing:2,justifyContent:"space-between",alignItems:"center",sx:{mt:2},children:[E&&e.jsx(a,{onClick:E,variant:"outlined",children:"Cancel"}),e.jsx(c.SubmitButton,{text:"Update Vendor",loadingText:"Updating..."})]})})]})]})})};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
"use strict";var e=require("react/jsx-runtime"),r=require("@mui/material/Paper"),s=require("@mui/material/Box"),i=require("@mui/material/Grid"),t=require("@mui/material/Typography"),a=require("@mui/material/Stack"),n=require("../../e-commerce/customer/BusinessCredentials.js"),d=require("../../common/Address.js"),c=require("../../e-commerce/products/Price.js"),l=require("../../ExplanatoryFoldOut.js"),x=require("../../common/Contacts.js");exports.VendorDisplay=function({data:o,sx:m}){const{
|
|
7
|
+
"use strict";var e=require("react/jsx-runtime"),r=require("@mui/material/Paper"),s=require("@mui/material/Box"),i=require("@mui/material/Grid"),t=require("@mui/material/Typography"),a=require("@mui/material/Stack"),n=require("../../e-commerce/customer/BusinessCredentials.js"),d=require("../../common/Address.js"),c=require("../../e-commerce/products/Price.js"),l=require("../../ExplanatoryFoldOut.js"),x=require("../../common/Contacts.js");exports.VendorDisplay=function({data:o,sx:m}){const{documentId:u,website_url:j,phone_number:h,email:p,business_credentials:y,address:q,products:b,contacts:v}=o;return console.log(v),e.jsxs(s,{sx:[{p:2},...Array.isArray(m)?m:[m]],component:r,children:[e.jsxs(i,{container:!0,spacing:2,children:[e.jsx(i,{item:!0,xs:12,children:e.jsx(t,{variant:"h5",children:"Vendor"})}),e.jsx(i,{item:!0,xs:12,md:6,children:e.jsx(n.default,{data:y})}),e.jsxs(i,{item:!0,xs:12,md:6,children:[e.jsxs(t,{variant:"body1",children:["Website Url: ",j]}),e.jsxs(t,{variant:"body1",children:["Phone Number: ",h]}),e.jsxs(t,{variant:"body1",children:["Email: ",p]})]}),e.jsxs(i,{item:!0,xs:12,md:6,children:[e.jsx(t,{variant:"h6",children:"Address"}),e.jsx(d.default,{data:q})]})]}),e.jsxs(i,{item:!0,xs:12,sx:{mt:3},children:[e.jsx(t,{variant:"h6",children:"Products"}),e.jsx(l.ExplanatoryFoldOut,{title:"Products",sx:{mt:1},children:e.jsx(a,{spacing:1,children:b.data.map((s,i)=>e.jsx(r,{sx:{p:1},children:e.jsxs(a,{direction:"row",justifyContent:"space-between",children:[e.jsxs(t,{variant:"h6",children:["Product: ",s.title," ",s.product_number]}),e.jsx(c.default,{...s.price})]})},i))})})]}),e.jsxs(i,{item:!0,xs:12,sx:{mt:3},children:[e.jsx(t,{variant:"h6",children:"Contacts"}),e.jsx(l.ExplanatoryFoldOut,{title:"Contacts",sx:{mt:1},children:e.jsx(a,{spacing:1,children:v.map((s,i)=>e.jsx(r,{sx:{p:1},children:e.jsx(x.default,{data:s})},i))})})]})]})};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),
|
|
6
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("@mui/material/Autocomplete"),r=require("@mui/material/TextField");exports.default=({vendorNames:l,currentValue:u,onSelectVendor:o})=>{console.log(u);const[s,a]=t.useState(u||null);return e.jsxs(e.Fragment,{children:[e.jsx(n,{options:l,getOptionLabel:e=>e?.business_credentials?.company_name,filterSelectedOptions:!0,onChange:(e,t)=>{const n=t?.documentId||null;a(n),o&&o(n)},renderInput:t=>e.jsx(r,{...t,label:"Vendors"}),value:l?.find(e=>e.documentId===s)||null}),e.jsx("input",{type:"hidden",name:"vendors",value:s||""})]})};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
"use strict";var e=require("react/jsx-runtime"),r=require("@mui/material/Paper"),i=require("@mui/material/Container"),t=require("@mui/material/Grid"),a=require("@mui/material/Stack"),o=require("@mui/material/Divider"),s=require("@mui/material/Button"),n=require("@mui/material/Typography"),c=require("@mui/material/styles"),u=require("../../lib/utils.js"),l=require("../e-commerce/products/ProductCard.js"),d=require("../common/markdown/MarkdownDisplay.js");exports.CategoryBlock=function({data:m}){const{maxWidth:p="lg",sx:x={},glass:g=!1,previewAmount:h=3}=m,y=c.useTheme();return e.jsx(i,{maxWidth:p,sx:{my:1,...x},children:e.jsx(t,{container:!0,spacing:2,children:e.jsx(t,{item:!0,xs:12,children:e.jsx(r,{sx:{p:2,backdropFilter:"blur(3px)",backgroundColor:u.setOpacity(y.palette.background.paper,g?.1:1),border:g?"1px solid rgba(255, 255, 255, 0.15)":"none"},children:e.jsxs(a,{spacing:2,children:[e.jsx(n,{variant:"h4",component:"a",href:`/shop/categories/${m.category.slug}`,sx:{textDecoration:"none",color:"inherit"},children:m.category.title}),m.category?.description&&"string"==typeof m.category.description&&e.jsx(d.default,{children:m.category.description.substring(0,150)+"..."}),e.jsx(s,{variant:"contained",href:`/shop/categories/${m.category.slug}`,children:"Learn More"}),null!=m.category?.products?.data&&e.jsxs(e.Fragment,{children:[e.jsx(o,{sx:{my:2}}),e.jsx(a,{direction:{xs:"column",sm:"row"},spacing:2,justifyContent:"space-around",sx:{pt:2},children:m.category.products.data.slice(0,h).map(r=>e.jsx(l.default,{product:r},r.
|
|
7
|
+
"use strict";var e=require("react/jsx-runtime"),r=require("@mui/material/Paper"),i=require("@mui/material/Container"),t=require("@mui/material/Grid"),a=require("@mui/material/Stack"),o=require("@mui/material/Divider"),s=require("@mui/material/Button"),n=require("@mui/material/Typography"),c=require("@mui/material/styles"),u=require("../../lib/utils.js"),l=require("../e-commerce/products/ProductCard.js"),d=require("../common/markdown/MarkdownDisplay.js");exports.CategoryBlock=function({data:m}){const{maxWidth:p="lg",sx:x={},glass:g=!1,previewAmount:h=3}=m,y=c.useTheme();return e.jsx(i,{maxWidth:p,sx:{my:1,...x},children:e.jsx(t,{container:!0,spacing:2,children:e.jsx(t,{item:!0,xs:12,children:e.jsx(r,{sx:{p:2,backdropFilter:"blur(3px)",backgroundColor:u.setOpacity(y.palette.background.paper,g?.1:1),border:g?"1px solid rgba(255, 255, 255, 0.15)":"none"},children:e.jsxs(a,{spacing:2,children:[e.jsx(n,{variant:"h4",component:"a",href:`/shop/categories/${m.category.slug}`,sx:{textDecoration:"none",color:"inherit"},children:m.category.title}),m.category?.description&&"string"==typeof m.category.description&&e.jsx(d.default,{children:m.category.description.substring(0,150)+"..."}),e.jsx(s,{variant:"contained",href:`/shop/categories/${m.category.slug}`,children:"Learn More"}),null!=m.category?.products?.data&&e.jsxs(e.Fragment,{children:[e.jsx(o,{sx:{my:2}}),e.jsx(a,{direction:{xs:"column",sm:"row"},spacing:2,justifyContent:"space-around",sx:{pt:2},children:m.category.products.data.slice(0,h).map(r=>e.jsx(l.default,{product:r},r.documentId))})]}),e.jsx(n,{variant:"body2",component:"a",href:`/shop/categories/${m.category.slug}`,sx:{textDecoration:"none",color:"inherit"},children:"Show all"})]})})})})})};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
"use strict";var t=require("react/jsx-runtime"),e=require("react"),
|
|
7
|
+
"use strict";var t=require("react/jsx-runtime"),e=require("react"),a=require("../../../components/common/cookie-consent/CookieConsentContext.js"),i=require("../../../lib/getCookie.js"),o=require("../../../lib/setCookie.js");const n={items:[],totalExVAT:0,totalVAT:0,totalInclVAT:0,totalAmount:0},s=e.createContext({state:n,dispatch:()=>{}}),r=(t,e)=>{switch(e.type){case"ADD_ITEM":{const a=t.items.findIndex(t=>t.documentId===e.payload.documentId);if(a>-1){const i=t.items.map((t,i)=>i===a?{...t,quantity:t.quantity+e.payload.quantity}:t);return{...t,items:i}}return{...t,items:[...t.items,e.payload]}}case"REMOVE_ITEM":{const a=t.items.findIndex(t=>t.documentId===e.payload.documentId);if(a>-1){const e=t.items.map((t,e)=>e===a?{...t,quantity:t.quantity-1}:t).filter(t=>t.quantity>0);return{...t,items:e}}return t}case"SET_ITEMS":return{...t,items:e.payload};case"UPDATE_TOTALS":return{...t,...e.payload};default:return t}};exports.CartProvider=({children:c})=>{const[u,l]=e.useReducer(r,n),{consentGiven:d}=a.useCookieConsent();return e.useEffect(()=>{if(d){const t=i.getCookie("cart");t&&l({type:"SET_ITEMS",payload:JSON.parse(t)})}},[d]),e.useEffect(()=>{d&&o.setCookie("cart",JSON.stringify(u.items),365)},[u.items,d]),e.useEffect(()=>{(()=>{let t=0,e=0,a=0,i=0;u.items.forEach(o=>{t+=o.price_excl_vat*o.quantity,e+=o.price_excl_vat*(o.vat_rate/100)*o.quantity,a+=o.price_incl_vat*o.quantity,i+=o.quantity}),l({type:"UPDATE_TOTALS",payload:{totalExVAT:t,totalVAT:e,totalInclVAT:a,totalAmount:i}})})()},[u.items]),t.jsx(s.Provider,{value:{state:u,dispatch:l},children:c})},exports.useCart=()=>e.useContext(s);
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
"use strict";var r=require("../../../services/mutate-data.js"),e=require("../../../../lib/utils.js"),t=require("../../../../lib/parseFormData.js");exports.updateCategoryAction=async function(a,s){
|
|
7
|
+
"use strict";var r=require("../../../services/mutate-data.js"),e=require("../../../../lib/utils.js"),t=require("../../../../lib/parseFormData.js");exports.updateCategoryAction=async function(a,s,o){Object.fromEntries(o);const i=t.parseFormData(o);i.data.products&&(i.data.products=JSON.parse(i.data.products));const u=await r.mutateData("PUT",`/api/product-categories/${a}`,i);if(!u)return{...s,severity:"error",strapiErrors:null,message:"Ops! Something went wrong. Please try again."};if(u.error)return{...s,severity:"error",strapiErrors:u.error,message:"Failed to Update Category."};const c=e.flattenAttributes(u);return{...s,severity:"success",message:"Category Updated Successfully",data:c,strapiErrors:null}};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
"use strict";var r=require("../../../services/mutate-data.js"),
|
|
7
|
+
"use strict";var r=require("../../../services/mutate-data.js"),a=require("../../../../lib/parseFormData.js");exports.updateProductAction=async function(e,t,s){Object.fromEntries(s);const o=a.parseFormData(s);console.log("parsedFormData",o),o.data.categories&&(o.data.categories=JSON.parse(o.data.categories)),o.data.gallery&&(o.data.gallery=JSON.parse(o.data.gallery)),o.data.stock_reports&&(o.data.stock_reports=JSON.parse(o.data.stock_reports));const c=await r.mutateData("PUT",`/api/products/${e}`,o);return console.log("responseData",c),c?c.error?{...t,severity:"error",strapiErrors:c.error,message:"Failed to Update Product."}:{...t,severity:"success",message:"Product Updated Successfully",data:c,strapiErrors:null}:{...t,severity:"error",strapiErrors:null,message:"Ops! Something went wrong. Please try again."}};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
"use strict";var e=require("../../../../node_modules/qs/lib/index.js"),r=require("../loaders.js"),s=require("../../../lib/utils.js"),t=require("next/cache");const
|
|
7
|
+
"use strict";var e=require("../../../../node_modules/qs/lib/index.js"),r=require("../loaders.js"),s=require("../../../lib/utils.js"),t=require("next/cache");const n=s.getStrapiURL();exports.getSingleCustomer=async function(s){t.unstable_noStore();const a=new URL(`/api/customer-profiles/${s}`,n);return a.search=e.default.stringify({populate:{company_address:!0,delivery_address:!0,billing_address:!0,business_credentials:!0,orders:{fields:["opo_number","order_date","internal_status","total_incl_vat"]},returns:{fields:["return_number","return_date","internal_status"]}}}),await r.fetchData(a.href)};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
"use strict";var e=require("../../../../node_modules/qs/lib/index.js"),r=require("../loaders.js"),i=require("../../../lib/utils.js"),
|
|
7
|
+
"use strict";var e=require("../../../../node_modules/qs/lib/index.js"),r=require("../loaders.js"),i=require("../../../lib/utils.js"),t=require("next/cache");const s=i.getStrapiURL();exports.getSingleProduct=async function(i){t.unstable_noStore();const a=new URL(`/api/products/${i}`,s);return a.search=e.default.stringify({filters:{is_archive:!1},populate:{price:!0,image:!0,gallery:!0,dimensions:!0,categories:!0,brand:!0,vendors:!0}}),await r.fetchData(a.href)};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
"use strict";var e=require("../../../../node_modules/qs/lib/index.js"),r=require("../loaders.js"),s=require("../../../lib/utils.js"),
|
|
7
|
+
"use strict";var e=require("../../../../node_modules/qs/lib/index.js"),r=require("../loaders.js"),s=require("../../../lib/utils.js"),t=require("next/cache"),i=require("../../../lib/processFilters.js");const a=s.getStrapiURL();exports.getTableIpos=async function(s,n,o,l,u=[!1],p={}){t.unstable_noStore();const c=new URL("/api/ipos",a),d=i.processFilters(p);return c.search=e.default.stringify({filters:{is_archive:{$in:u},...d},sort:`${l||"createdAt"}:${o||"desc"}`,populate:{vendor_profile:{fields:["vendor_number","website_url"],populate:{business_credentials:{fields:"company_name"}}},items:{populate:{product:{fields:["title","product_number","external_product_number"]},reports:!0}}},pagination:{pageSize:n||10,page:s?s+1:1}}),await r.fetchData(c.href)};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
"use strict";const e=require("../../node_modules/@mollie/api-client/dist/mollie.esm.js").createMollieClient({apiKey:`${process.env.MOLLIE_KEY}`});exports.createMolliePayment=async function(r){const{
|
|
7
|
+
"use strict";const e=require("../../node_modules/@mollie/api-client/dist/mollie.esm.js").createMollieClient({apiKey:`${process.env.MOLLIE_KEY}`});exports.createMolliePayment=async function(r){const{documentId:o,opo_number:t,total_incl_vat:c,order_currency:n,uuid:i}=r;return o&&t&&c&&n&&i?await e.payments.create({amount:{currency:n,value:c.toFixed(2)},description:`Order #${t}`,redirectUrl:`${process.env.FRONTEND_URL}/shop/check-out?order=${i}`,webhookUrl:`${process.env.FRONTEND_URL}/api/mollie`,metadata:{documentId:o,opo_number:t}}).catch(e=>`error from payment creation: ${e}`):"missing order data"};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
"use strict";exports.parseFormData=function(t){const e={};for(const[n
|
|
6
|
+
"use strict";exports.parseFormData=function(t){const e={};for(const[s,n]of t.entries()){if(!n)continue;const t=s.split(".");console.log("parts",t);const o=(t,e,s)=>{if(e[0].endsWith("]")&&e[0].includes("[")&&e.length>1){const n=e[0].split("[")[0],c=parseInt(e[0].split("[")[1].replace("]",""));t[n]||(t[n]=[]),t[n][c]||(t[n][c]={}),e.shift(),o(t[n][c],e,s)}else if(e.length>1){const n=e.shift();null!=n&&(t[n]||(t[n]=e[0].endsWith("]")?[]:{}),o(t[n],e,s))}else t[e[0]]=s};o(e,t,n)}const s=t=>{for(const e in t)"object"==typeof t[e]&&1===Object.keys(t[e]).length&&t[e].__component?delete t[e]:"object"==typeof t[e]&&s(t[e])};return s(e),{data:e}};
|