umwd-components 0.1.648 → 0.1.650
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/.ai/patterns.md +145 -0
- package/dist/src/components/e-commerce/categories/AddCategoryForm.js +1 -1
- package/dist/src/components/e-commerce/categories/EditCategoryForm.js +1 -1
- package/dist/src/components/e-commerce/iro/CreateIROForm.js +1 -1
- package/dist/src/components/e-commerce/iro/RmaForm.js +1 -1
- package/dist/src/components/e-commerce/iro/TextualManageIROForm.js +1 -1
- package/dist/src/components/e-commerce/opo/CreateOpoForm.js +1 -1
- package/dist/src/components/e-commerce/opo/ManageOpoForm.js +1 -1
- package/dist/src/components/e-commerce/opo/TextualManageOpoForm.js +1 -1
- package/dist/src/components/e-commerce/products/AddProductForm.js +1 -1
- package/dist/src/components/e-commerce/products/EditProductForm.js +1 -1
- package/dist/src/components/e-commerce/products/EditStockForm.js +1 -1
- package/dist/src/components/logistics/ipo/TextualManageIPOForm.js +1 -1
- package/dist/src/data/actions/e-commerce/categories/createCategoryAction.js +1 -1
- package/dist/src/data/actions/e-commerce/categories/updateCategoryAction.js +1 -1
- package/dist/src/data/actions/e-commerce/iro/requestRmaAction.js +2 -2
- package/dist/src/data/actions/e-commerce/opo/createOpoAction.js +1 -1
- package/dist/src/data/actions/e-commerce/opo/updateOpoAction.js +1 -1
- package/dist/src/data/actions/e-commerce/product/createProductAction.js +1 -1
- package/dist/src/data/actions/e-commerce/product/updateProductAction.js +1 -1
- package/dist/src/data/loaders/loaders.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/components/e-commerce/categories/AddCategoryForm.d.ts +2 -1
- package/dist/types/components/e-commerce/categories/CreateCategoryForm.d.ts +9 -0
- package/dist/types/components/e-commerce/categories/EditCategoryForm.d.ts +5 -1
- package/dist/types/components/e-commerce/iro/CreateIROForm.d.ts +4 -1
- package/dist/types/components/e-commerce/iro/RmaForm.d.ts +4 -1
- package/dist/types/components/e-commerce/iro/TextualManageIROForm.d.ts +4 -1
- package/dist/types/components/e-commerce/opo/TextualManageOpoForm.d.ts +4 -1
- package/dist/types/components/e-commerce/products/AddProductForm.d.ts +4 -2
- package/dist/types/components/e-commerce/products/EditProductForm.d.ts +4 -1
- package/package.json +1 -1
- package/src/components/e-commerce/categories/AddCategoryForm.tsx +33 -17
- package/src/components/e-commerce/categories/CreateCategoryForm.tsx +89 -0
- package/src/components/e-commerce/categories/EditCategoryForm.tsx +39 -7
- package/src/components/e-commerce/checkout/CheckoutForm.tsx +1 -0
- package/src/components/e-commerce/iro/CreateIROForm.tsx +27 -10
- package/src/components/e-commerce/iro/RmaForm.tsx +29 -12
- package/src/components/e-commerce/iro/TextualManageIROForm.tsx +4 -7
- package/src/components/e-commerce/opo/CreateOpoForm.tsx +23 -9
- package/src/components/e-commerce/opo/ManageOpoForm.tsx +25 -1
- package/src/components/e-commerce/opo/TextualManageOpoForm.tsx +5 -9
- package/src/components/e-commerce/products/AddProductForm.tsx +36 -4
- package/src/components/e-commerce/products/EditProductForm.tsx +36 -6
- package/src/components/e-commerce/products/EditStockForm.tsx +26 -1
- package/src/components/logistics/ipo/TextualManageIPOForm.tsx +49 -40
- package/src/data/actions/e-commerce/categories/createCategoryAction.tsx +4 -1
- package/src/data/actions/e-commerce/categories/updateCategoryAction.tsx +4 -1
- package/src/data/actions/e-commerce/checkout-action.ts +0 -1
- package/src/data/actions/e-commerce/iro/cancelIroAction.ts +2 -1
- package/src/data/actions/e-commerce/iro/requestRmaAction.ts +1 -6
- package/src/data/actions/e-commerce/opo/createOpoAction.ts +3 -0
- package/src/data/actions/e-commerce/opo/updateOpoAction.ts +4 -1
- package/src/data/actions/e-commerce/product/createProductAction.tsx +4 -1
- package/src/data/actions/e-commerce/product/updateProductAction.tsx +4 -1
- package/src/data/loaders/loaders.ts +1 -1
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r from"react";import
|
|
7
|
+
import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useEffect as n}from"react";import l from"@mui/material/Paper";import a from"@mui/material/Box";import m from"@mui/material/Stack";import c from"@mui/material/Alert";import i from"@mui/material/Typography";import{SubmitButton as o}from"../../SubmitButton.js";import{useFormState as u}from"react-dom";import{StrapiErrors as d}from"../../StrapiErrors.js";import{updateProductAction as s}from"../../../data/actions/e-commerce/product/updateProductAction.js";import E from"@mui/material/Grid";import p from"../../logistics/report/ReportsDisplay.js";import y from"../../logistics/report/ReportMakingComponent.js";import{TableContainer as f,Table as g,TableHead as _,TableRow as v,TableCell as q,TableBody as k,TableFooter as x,Tooltip as b}from"@mui/material";import{AmountIndicator as h}from"../../common/AmountIndicator.js";import{useSnackbar as S}from"../../../context/common/SnackbarContext.js";var T={zodErrors:null,strapiErrors:null,severity:null,data:null,message:null};function j(j){var Q=j.data,V=j.revalidateCallback,A=j.sx,O=Q.id,C=Q.title;Q.product_number,Q.stock;var I=Q.ipos,N=Q.opos,R=Q.reports,z=e(u(s,T),2),D=z[0],P=z[1],w=S().handleAddMessage;return n((function(){(null==D?void 0:D.message)&&(w({message:D.message,severity:D.severity||"error"}),"success"===D.severity&&V&&V())}),[null==D?void 0:D.message]),n((function(){(null==D?void 0:D.strapiErrors)&&w({message:D.strapiErrors.message||"Error updating stock",severity:D.severity||"error"})}),[null==D?void 0:D.strapiErrors]),r.createElement(a,{sx:t([{p:2}],e(Array.isArray(A)?A:[A]),!1),component:l},r.createElement(E,{container:!0,spacing:2},r.createElement(E,{item:!0,xs:12},r.createElement(i,{variant:"h6"},C)),r.createElement(E,{item:!0,xs:12},r.createElement(f,{component:l},r.createElement(i,{variant:"h6"},"Incoming orders"),r.createElement(g,{size:"small"},r.createElement(_,null,r.createElement(v,null,r.createElement(q,null,"Number"),r.createElement(q,null,"Order Date"),r.createElement(q,null,"Line Item Number"),r.createElement(q,null,"Ordered Quantity"),r.createElement(q,null,"Received Quantity"),r.createElement(q,null,"Registered Quantity"),r.createElement(q,null,"Released Quantity"))),r.createElement(k,null,I.map((function(e){return r.createElement(r.Fragment,null,e.items.map((function(t){return r.createElement(v,{key:e.id},r.createElement(q,null,e.ipo_number),r.createElement(q,null,e.order_date),r.createElement(q,null,t.line_item_number),r.createElement(q,null,r.createElement(h,{value:t.ordered_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(q,null,r.createElement(h,{value:t.received_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(q,null,r.createElement(h,{value:t.registered_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(q,null,r.createElement(h,{value:t.released_quantity,maxValue:t.ordered_quantity,color:"primary"})))})))}))),r.createElement(x,null,r.createElement(v,null,r.createElement(q,{colSpan:6,align:"right"},"Total added to stock:"),r.createElement(q,null,I.reduce((function(e,t){return e+t.items.reduce((function(e,t){return e+t.released_quantity}),0)}),0))))),r.createElement(i,{variant:"h6"},"Outgoing orders"),r.createElement(g,{size:"small"},r.createElement(_,null,r.createElement(v,null,r.createElement(q,null,"Number"),r.createElement(q,null,"Order Date"),r.createElement(q,null,"Line Item Number"),r.createElement(q,null,"Ordered Quantity"),r.createElement(q,null,"Picked Quantity"),r.createElement(q,null,"Packed Quantity"),r.createElement(q,null,"Shipped Quantity"))),r.createElement(k,null,N.map((function(e){return r.createElement(r.Fragment,null,e.opo_items.map((function(t){return r.createElement(v,{key:e.id},r.createElement(q,null,e.opo_number),r.createElement(q,null,e.order_date),r.createElement(q,null,t.line_item_number),r.createElement(q,null,r.createElement(h,{value:t.ordered_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(q,null,r.createElement(h,{value:t.picked_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(q,null,r.createElement(h,{value:t.packed_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(q,null,r.createElement(h,{value:t.shipped_quantity,maxValue:t.ordered_quantity,color:"primary"})))})))}))),r.createElement(x,null,r.createElement(v,null,r.createElement(q,{colSpan:3,align:"right"},"Total reduced from stock:"),r.createElement(q,null,N.reduce((function(e,t){return e+t.opo_items.reduce((function(e,t){return e+t.ordered_quantity}),0)}),0))))),r.createElement(g,{size:"small"},r.createElement(v,null,r.createElement(q,{align:"right"},"Total added to stock:"),r.createElement(q,null,I.reduce((function(e,t){return e+t.items.reduce((function(e,t){return e+t.released_quantity}),0)}),0))),r.createElement(v,null,r.createElement(q,{align:"right"},"Total reduced from stock:"),r.createElement(q,null,N.reduce((function(e,t){return e+t.opo_items.reduce((function(e,t){return e+t.ordered_quantity}),0)}),0))),r.createElement(v,null,r.createElement(q,{align:"right"},"Corrections:"),r.createElement(q,null,r.createElement(b,{title:"Total stock corrections"},r.createElement(i,null,R?R.reduce((function(e,t){return e+t.quantity}),0):0))),r.createElement(q,null,r.createElement(b,{title:"Total stock corrections after updating"},r.createElement("b",null,R?R.reduce((function(e,t){return e+t.quantity}),0):0)))),r.createElement(v,null,r.createElement(q,{align:"right"},"Stock:"),r.createElement(q,null,r.createElement(b,{title:"Total stock"},r.createElement(i,null,I.reduce((function(e,t){return e+t.items.reduce((function(e,t){return e+t.released_quantity}),0)}),0)-N.reduce((function(e,t){return e+t.opo_items.reduce((function(e,t){return e+t.ordered_quantity}),0)}),0)+(R?R.reduce((function(e,t){return e+t.quantity}),0):0)))),r.createElement(q,null,r.createElement(b,{title:"Total stock after updating"},r.createElement("b",null,I.reduce((function(e,t){return e+t.items.reduce((function(e,t){return e+t.released_quantity}),0)}),0)-N.reduce((function(e,t){return e+t.opo_items.reduce((function(e,t){return e+t.ordered_quantity}),0)}),0)+(R?R.reduce((function(e,t){return e+t.quantity}),0):0))))))))),r.createElement("form",{action:P},O&&r.createElement("input",{id:"id",type:"hidden",name:"id",value:O}),r.createElement("input",{id:"stock_reports",type:"hidden",name:"stock_reports",value:JSON.stringify(R)}),r.createElement(E,{container:!0,spacing:2},r.createElement(E,{item:!0,xs:12,sx:{mt:2}},r.createElement(m,{spacing:2},r.createElement(i,{variant:"h5"},"Stock corrections"),r.createElement(i,{variant:"body2"},"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"),r.createElement(p,{reports:R}),r.createElement(y,{content:"content",quantity:0,type:"stock",related:[{id:O,__type:"api::e-commerce.product"}],revalidateCallback:V}))),r.createElement(E,{item:!0,xs:12},r.createElement(m,{direction:"row-reverse",spacing:2,alignItems:"center",sx:{py:1}},r.createElement(o,{text:"update stock",loadingText:"loading"}),(null==D?void 0:D.strapiErrors)&&r.createElement(d,{error:null==D?void 0:D.strapiErrors}),(null==D?void 0:D.message)&&r.createElement(c,{severity:"error"},null==D?void 0:D.message))))))}export{j as EditStockForm};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
import{__read as e,__spreadArray as t,__assign as r}from"../../../../node_modules/tslib/tslib.es6.js";import n,{useState as a,useEffect as i}from"react";import{useFormState as o}from"react-dom";import{updateIpoAction as l}from"../../../data/actions/logistics/ipo/updateIpoAction.js";import{UploadBase64MediaForm as c}from"../../common/media/UploadBase64MediaForm.js";import m from"../../../data/loaders/common/media/downloadBase64File.js";import d from"./TextualIPOItemUpdater.js";import s from"./ItemDisplay.js";import u from"../note/NotesDisplay.js";import p from"../note/NoteTakingComponent.js";import{SubmitButton as v}from"../../SubmitButton.js";import f from"@mui/material/Alert";import E from"@mui/material/Dialog";import g from"@mui/material/DialogActions";import y from"@mui/material/DialogContent";import h from"@mui/material/DialogTitle";import x from"@mui/material/Typography";import b from"@mui/material/Button";import C from"@mui/material/Grid";import w from"@mui/material/Box";import _ from"@mui/material/Paper";import I from"@mui/material/Stack";import k from"@mui/material/Divider";import{confirmationService as D}from"../../../data/services/common/confirmation-service.js";import{cancellationService as j}from"../../../data/services/common/cancellation-service.js";import{FormControlLabel as q,Checkbox as A,List as N,ListItem as S,TextField as O}from"@mui/material";import P from"@mui/icons-material/Numbers";import U from"@mui/icons-material/CalendarToday";import B from"@mui/icons-material/Business";import F from"@mui/icons-material/Description";import T from"@mui/icons-material/Update";import{IpoStatusIndicator as R}from"./IpoStatusIndicator.js";import{useSnackbar as W}from"../../../context/common/SnackbarContext.js";var M={zodErrors:null,strapiErrors:null,data:null,message:null};function z(e){var t=e.open,r=e.handleClose,a=e.orderID,i=e.currentStatus,o=e.revalidateCallback;return n.createElement(E,{open:t},n.createElement(h,null,"Confirm Order"),n.createElement(y,null,n.createElement(I,{spacing:2},n.createElement(x,null,"Are you sure you want to confirm this order?"),n.createElement(x,null,"Current status: ",i))),n.createElement(g,null,n.createElement(b,{variant:"contained",onClick:function(e){D("ipos",[a]),o&&o(),r()}},"Confirm"),n.createElement(b,{variant:"contained",onClick:r},"Cancel")))}function H(t){var r=t.open,i=t.handleClose,o=t.orderID,l=t.revalidateCallback,c=e(a(""),2),m=c[0],d=c[1],s=e(a(""),2),u=s[0],p=s[1];return n.createElement("form",null,n.createElement(E,{open:r},n.createElement(h,null,"Cancel Return"),n.createElement(y,null,n.createElement(I,{spacing:2},n.createElement(x,null,"Are you sure you want to cancel this return?"),n.createElement(N,null,n.createElement(S,null,"By cancelling this return order you will update it's status from requested to cancelled"),n.createElement(S,null,"Please provide a reason for the cancellation"),n.createElement(S,null,"The customer will be notified about the cancellation and of the reason for the cancellation")),n.createElement(O,{label:"Cancellation reason",name:"reason",multiline:!0,rows:4,fullWidth:!0,variant:"outlined",value:m,onChange:function(e){return d(e.target.value)},placeholder:"Please provide a reason for the cancellation",error:!!u,helperText:u}))),n.createElement(g,null,n.createElement(b,{variant:"contained",onClick:function(e){m.length<5?p("Please provide a reason for the cancellation"):(j("ipos",o,m),l&&l(),i())}},"Yes"),n.createElement(b,{variant:"contained",onClick:i},"No"))))}function G(E){var g,y,h,D,j,N,S=E.data,O=E.sx,G=E.revalidateCallback,J=E.handleClose,L=E.role,Q=e(o(l,M),2),Y=Q[0],K=Q[1],V=e(a(S.items.data?S.items.data:[]),2),X=V[0],Z=V[1],$=e(a(!1),2),ee=$[0],te=$[1],re=e(a(!1),2),ne=re[0],ae=re[1],ie=e(a(["received","registered","released","reports"]),2),oe=ie[0],le=ie[1],ce=function(r,n,a){var i=t([],e(X),!1),o=i.findIndex((function(e){return e.id===n}));i[o][a]=r,Z(i)},me=function(n,a){var i,o,l,c=t([],e(X),!1),m=c.findIndex((function(e){return e.id===a})),d=(null===(o=null===(i=c[m])||void 0===i?void 0:i.reports)||void 0===o?void 0:o.data)||[],s=t(t([],e(d),!1),[n],!1);null==(null===(l=c[m])||void 0===l?void 0:l.reports)&&(c[m]=r(r({},c[m]),{reports:{data:[]}})),c[m].reports.data=s,Z(c)},de=function(r,n){var a,i,o=t([],e(X),!1),l=o.findIndex((function(e){return e.id===r})),c=(null===(i=null===(a=o[l])||void 0===a?void 0:a.reports)||void 0===i?void 0:i.data)||[],m=c.filter((function(e){return"id"in e})),d=c.filter((function(e){return!("id"in e)}));d.splice(n,1);var s=t(t([],e(m),!1),e(d),!1);o[l].reports.data=s,Z(o)},se=W().handleAddMessage;return i((function(){"Ipo Updated"===(null==Y?void 0:Y.message)&&(se({message:"Ipo Updated",severity:"success"}),J&&J(),G&&G())}),[Y]),i((function(){(null==Y?void 0:Y.strapiErrors)&&se({message:Y.strapiErrors.message||"Error updating IPO",severity:"error"})}),[null==Y?void 0:Y.strapiErrors]),i((function(){var e;console.log("data",S),(null===(e=S.items)||void 0===e?void 0:e.data)&&Z(S.items.data?S.items.data:[])}),[S]),n.createElement(w,{sx:t([],e(Array.isArray(O)?O:[O]),!1)},n.createElement(C,{container:!0,spacing:2},n.createElement(C,{item:!0,xs:12},n.createElement(I,{spacing:2},n.createElement(I,{direction:"row",spacing:2,justifyContent:"space-between"},n.createElement(I,{spacing:2},n.createElement(x,{variant:"h3",component:"h1"},"Management Inbound Purchase Order"),n.createElement(x,{variant:"body1"},"Manage arrival, registration and recieval of purchase order")),n.createElement(p,{content:"",related:[{id:S.id,__type:"api::logistics.ipo"}],revalidateCallback:G})),n.createElement(k,null))),n.createElement(C,{item:!0,xs:12},n.createElement(x,{variant:"h5",sx:{py:1}},"Details")),n.createElement(C,{item:!0,xs:6},n.createElement(_,{elevation:2,sx:{p:2,height:"100%"}},n.createElement(I,{spacing:2},n.createElement(I,{direction:"row",spacing:2,alignItems:"center"},n.createElement(P,{color:"primary"}),n.createElement(x,{variant:"subtitle1",color:"text.secondary",width:"200px"},"Purchase Order Number"),n.createElement(x,{variant:"body1",fontWeight:"medium"},S.ipo_number)),n.createElement(I,{direction:"row",spacing:2,alignItems:"center"},n.createElement(F,{color:"primary"}),n.createElement(x,{variant:"subtitle1",color:"text.secondary",width:"200px"},"Custom Reference"),n.createElement(x,{variant:"body1",fontWeight:"medium"},S.customer_reference)),n.createElement(I,{direction:"row",spacing:2,alignItems:"center"},n.createElement(U,{color:"primary"}),n.createElement(x,{variant:"subtitle1",color:"text.secondary",width:"200px"},"Order Date"),n.createElement(x,{variant:"body1",fontWeight:"medium"},S.order_date)),n.createElement(I,{direction:"row",spacing:2,alignItems:"center"},n.createElement(B,{color:"primary"}),n.createElement(x,{variant:"subtitle1",color:"text.secondary",width:"200px"},"Supplier"),n.createElement(x,{variant:"body1",fontWeight:"medium"},null===(y=null===(g=S.vendor_profile)||void 0===g?void 0:g.business_credentials)||void 0===y?void 0:y.company_name)),n.createElement(I,{direction:"row",spacing:2,alignItems:"center"},n.createElement(T,{color:"primary"}),n.createElement(x,{variant:"subtitle1",color:"text.secondary",width:"200px"},"Order Status"),n.createElement(R,{status:S.status}))))),("placed"===S.status||"released_on_stock"===S.status)&&"enduser"===L&&n.createElement(C,{item:!0,xs:6},n.createElement(_,{elevation:2,sx:{p:2,height:"100%"}},n.createElement(I,{spacing:2},n.createElement(b,{variant:"contained",color:"primary",onClick:function(){return te(!0)}},"Confirm order"),n.createElement(f,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"),n.createElement(b,{variant:"contained",color:"error",onClick:function(){return ae(!0)}},"Cancel order"),n.createElement(z,{open:ee,handleClose:function(){return te(!1)},orderID:S.id,currentStatus:S.status,revalidateCallback:G}),n.createElement(H,{open:ne,handleClose:function(){return ae(!1)},orderID:S.id,revalidateCallback:G})))),n.createElement(C,{item:!0,xs:12},n.createElement(I,{spacing:2},n.createElement(x,{variant:"h5"},"Documents"),n.createElement(_,{sx:{p:2}},n.createElement(I,{spacing:1},"enduser"===L&&n.createElement(n.Fragment,null,S.order_confirmation?n.createElement(n.Fragment,null,n.createElement(x,{variant:"h6"},"Order Confirmation"),n.createElement(x,null,null===(h=S.order_confirmation)||void 0===h?void 0:h.name),n.createElement(b,{variant:"contained",onClick:function(){m("api/ipos/".concat(S.id),"order_confirmation")}},"Download")):n.createElement(n.Fragment,null,n.createElement(x,{variant:"h5"},"Order Confirmation"),n.createElement(x,{variant:"body1"},"Here you can upload the the order confirmation for this order"),n.createElement(x,{variant:"body1"},"FileUpload"),n.createElement(k,null),n.createElement(c,{reference:"api::logistics.ipo",refID:S.id,field:"order_confirmation",multiple:!1,accept:"text/*,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",path:"api/ipos",componentName:"order_confirmation",componentReference:"common.base64-encoded-media",revalidateCallback:G}))),S.delivery_note?n.createElement(n.Fragment,null,n.createElement(x,{variant:"h6"},"Delivery Note"),n.createElement(x,null,null===(D=S.delivery_note)||void 0===D?void 0:D.name),n.createElement(b,{variant:"contained",onClick:function(){m("api/ipos/".concat(S.id),"delivery_note")}},"Download")):n.createElement(n.Fragment,null,n.createElement(x,{variant:"h5"},"Delivery Note"),n.createElement(x,{variant:"body1"},"Here you can upload the the delivery note for this order"),n.createElement(k,null),n.createElement(c,{reference:"api::logistics.ipo",refID:S.id,field:"delivery_note",multiple:!1,accept:"text/*,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",path:"api/ipos",componentName:"delivery_note",componentReference:"common.base64-encoded-media",revalidateCallback:G})))))),(null===(N=null===(j=null==S?void 0:S.notes)||void 0===j?void 0:j.data)||void 0===N?void 0:N.length)>0&&n.createElement(C,{item:!0,xs:12},n.createElement(I,{spacing:2},n.createElement(x,{variant:"h5"},"Notes"),n.createElement(u,{notes:S.notes.data}),n.createElement(k,null))),n.createElement(C,{item:!0,xs:12},n.createElement(I,{spacing:1},n.createElement(x,{variant:"h5"},"Items"),n.createElement(I,{direction:"row",alignItems:"center",justifyContent:"flex-end",spacing:2,component:_,p:1,sx:{bgcolor:"background.default",border:"1px solid",borderColor:"divider",boxShadow:"none"}},n.createElement(x,{variant:"body2",color:"text.secondary"},"Show:"),["received","registered","released","reports"].map((function(r){return n.createElement(q,{key:r,control:n.createElement(A,{size:"small",checked:oe.includes(r),onChange:function(n){n.target.checked?le(t(t([],e(oe),!1),[r],!1)):le(oe.filter((function(e){return e!==r})))}}),label:n.createElement(x,{variant:"body2",color:"text.secondary"},r.charAt(0).toUpperCase()+r.slice(1)),sx:{mr:0}})}))),"placed"===S.status&&n.createElement(f,{severity:"warning"},"Before confirmation you cannot update the items"),n.createElement(k,null),n.createElement("form",{action:K},n.createElement("input",{name:"id",type:"hidden",value:S.id}),X&&X.map((function(e,t){var r,a;return n.createElement(_,{sx:{p:2,mb:2},key:t},"placed"===S.status||"cancelled"===S.status||"done"===S.status?n.createElement(s,{item:e,index:t,image:null===(r=null==e?void 0:e.product)||void 0===r?void 0:r.image}):n.createElement(d,{item:e,index:t,handleUpdateQuantity:ce,handleAddReport:me,image:null===(a=null==e?void 0:e.product)||void 0===a?void 0:a.image,handleRemoveReportAtIndex:de,revalidateCallback:G,showing:oe}))})),n.createElement(_,{sx:{p:2}},n.createElement(I,{direction:"row",spacing:2,justifyContent:"end"},n.createElement(v,{text:"Update items",loadingText:"Loading..."}))),n.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map((function(e){var t,r;return{id:e.id,ordered_quantity:e.ordered_quantity,received_quantity:e.received_quantity,registered_quantity:e.registered_quantity,released_quantity:e.released_quantity,reports:(null===(r=null===(t=e.reports)||void 0===t?void 0:t.data)||void 0===r?void 0:r.map((function(e){return{id:"id"in e?e.id:void 0,quantity:e.quantity,content:e.content,type:e.type}})))||[]}}))}(X))}))))))}export{G as default};
|
|
6
|
+
import{__read as e,__spreadArray as t,__assign as r}from"../../../../node_modules/tslib/tslib.es6.js";import n,{useState as a,useEffect as o}from"react";import{useFormState as i}from"react-dom";import{updateIpoAction as l}from"../../../data/actions/logistics/ipo/updateIpoAction.js";import{UploadBase64MediaForm as c}from"../../common/media/UploadBase64MediaForm.js";import m from"../../../data/loaders/common/media/downloadBase64File.js";import d from"./TextualIPOItemUpdater.js";import s from"./ItemDisplay.js";import u from"../note/NotesDisplay.js";import p from"../note/NoteTakingComponent.js";import{SubmitButton as v}from"../../SubmitButton.js";import f from"@mui/material/Alert";import E from"@mui/material/Dialog";import g from"@mui/material/DialogActions";import y from"@mui/material/DialogContent";import h from"@mui/material/DialogTitle";import x from"@mui/material/Typography";import b from"@mui/material/Button";import C from"@mui/material/Grid";import w from"@mui/material/Box";import _ from"@mui/material/Paper";import I from"@mui/material/Stack";import k from"@mui/material/Divider";import{confirmationService as D}from"../../../data/services/common/confirmation-service.js";import{cancellationService as j}from"../../../data/services/common/cancellation-service.js";import{FormControlLabel as q,Checkbox as A,List as N,ListItem as S,TextField as F}from"@mui/material";import O from"@mui/icons-material/Numbers";import P from"@mui/icons-material/CalendarToday";import U from"@mui/icons-material/Business";import B from"@mui/icons-material/Description";import T from"@mui/icons-material/Update";import{IpoStatusIndicator as R}from"./IpoStatusIndicator.js";import{useSnackbar as W}from"../../../context/common/SnackbarContext.js";var M={zodErrors:null,strapiErrors:null,data:null,message:null};function z(e){var t=e.open,r=e.handleClose,a=e.orderID,o=e.currentStatus,i=e.revalidateCallback;return n.createElement(E,{open:t},n.createElement(h,null,"Confirm Order"),n.createElement(y,null,n.createElement(I,{spacing:2},n.createElement(x,null,"Are you sure you want to confirm this order?"),n.createElement(x,null,"Current status: ",o))),n.createElement(g,null,n.createElement(b,{variant:"contained",onClick:function(e){D("ipos",[a]),i&&i(),r()}},"Confirm"),n.createElement(b,{variant:"contained",onClick:r},"Cancel")))}function H(t){var r=t.open,o=t.handleClose,i=t.orderID,l=t.revalidateCallback,c=e(a(""),2),m=c[0],d=c[1],s=e(a(""),2),u=s[0],p=s[1];return n.createElement("form",null,n.createElement(E,{open:r},n.createElement(h,null,"Cancel Return"),n.createElement(y,null,n.createElement(I,{spacing:2},n.createElement(x,null,"Are you sure you want to cancel this return?"),n.createElement(N,null,n.createElement(S,null,"By cancelling this return order you will update it's status from requested to cancelled"),n.createElement(S,null,"Please provide a reason for the cancellation"),n.createElement(S,null,"The customer will be notified about the cancellation and of the reason for the cancellation")),n.createElement(F,{label:"Cancellation reason",name:"reason",multiline:!0,rows:4,fullWidth:!0,variant:"outlined",value:m,onChange:function(e){return d(e.target.value)},placeholder:"Please provide a reason for the cancellation",error:!!u,helperText:u}))),n.createElement(g,null,n.createElement(b,{variant:"contained",onClick:function(e){m.length<5?p("Please provide a reason for the cancellation"):(j("ipos",i,m),l&&l(),o())}},"Yes"),n.createElement(b,{variant:"contained",onClick:o},"No"))))}function G(E){var g,y,h,D,j,N,S=E.data,F=E.sx,G=E.revalidateCallback,J=E.handleClose,L=E.role,Q=e(i(l,M),2),Y=Q[0],K=Q[1],V=e(a(S.items.data?S.items.data:[]),2),X=V[0],Z=V[1],$=e(a(!1),2),ee=$[0],te=$[1],re=e(a(!1),2),ne=re[0],ae=re[1],oe=e(a(["received","registered","released","reports"]),2),ie=oe[0],le=oe[1],ce=function(r,n,a){var o=t([],e(X),!1),i=o.findIndex((function(e){return e.id===n}));o[i][a]=r,Z(o)},me=function(n,a){var o,i,l,c=t([],e(X),!1),m=c.findIndex((function(e){return e.id===a})),d=(null===(i=null===(o=c[m])||void 0===o?void 0:o.reports)||void 0===i?void 0:i.data)||[],s=t(t([],e(d),!1),[n],!1);null==(null===(l=c[m])||void 0===l?void 0:l.reports)&&(c[m]=r(r({},c[m]),{reports:{data:[]}})),c[m].reports.data=s,Z(c)},de=function(r,n){var a,o,i=t([],e(X),!1),l=i.findIndex((function(e){return e.id===r})),c=(null===(o=null===(a=i[l])||void 0===a?void 0:a.reports)||void 0===o?void 0:o.data)||[],m=c.filter((function(e){return"id"in e})),d=c.filter((function(e){return!("id"in e)}));d.splice(n,1);var s=t(t([],e(m),!1),e(d),!1);i[l].reports.data=s,Z(i)},se=W().handleAddMessage;return o((function(){"Ipo Updated"===(null==Y?void 0:Y.message)&&(se({message:"Ipo Updated",severity:"success"}),J&&J(),G&&G())}),[Y]),o((function(){(null==Y?void 0:Y.strapiErrors)&&se({message:Y.strapiErrors.message||"Error updating IPO",severity:"error"})}),[null==Y?void 0:Y.strapiErrors]),o((function(){var e;console.log("data",S),(null===(e=S.items)||void 0===e?void 0:e.data)&&Z(S.items.data?S.items.data:[])}),[S]),n.createElement(w,{sx:t([],e(Array.isArray(F)?F:[F]),!1)},n.createElement(C,{container:!0,spacing:2},n.createElement(C,{item:!0,xs:12},n.createElement(I,{spacing:2},n.createElement(I,{direction:"row",spacing:2,justifyContent:"space-between"},n.createElement(I,{spacing:2},n.createElement(x,{variant:"h3",component:"h1"},"Management Inbound Purchase Order"),n.createElement(x,{variant:"body1"},"Manage arrival, registration and recieval of purchase order")),n.createElement(p,{content:"",related:[{id:S.id,__type:"api::logistics.ipo"}],revalidateCallback:G})),n.createElement(k,null))),n.createElement(C,{item:!0,xs:12},n.createElement(x,{variant:"h5",sx:{py:1}},"Details")),n.createElement(C,{item:!0,xs:6},n.createElement(_,{elevation:2,sx:{p:2,height:"100%"}},n.createElement(I,{spacing:2},n.createElement(I,{direction:"row",spacing:2,alignItems:"center"},n.createElement(O,{color:"primary"}),n.createElement(x,{variant:"subtitle1",color:"text.secondary",width:"200px"},"Purchase Order Number"),n.createElement(x,{variant:"body1",fontWeight:"medium"},S.ipo_number)),n.createElement(I,{direction:"row",spacing:2,alignItems:"center"},n.createElement(B,{color:"primary"}),n.createElement(x,{variant:"subtitle1",color:"text.secondary",width:"200px"},"Custom Reference"),n.createElement(x,{variant:"body1",fontWeight:"medium"},S.customer_reference)),n.createElement(I,{direction:"row",spacing:2,alignItems:"center"},n.createElement(P,{color:"primary"}),n.createElement(x,{variant:"subtitle1",color:"text.secondary",width:"200px"},"Order Date"),n.createElement(x,{variant:"body1",fontWeight:"medium"},S.order_date)),n.createElement(I,{direction:"row",spacing:2,alignItems:"center"},n.createElement(U,{color:"primary"}),n.createElement(x,{variant:"subtitle1",color:"text.secondary",width:"200px"},"Supplier"),n.createElement(x,{variant:"body1",fontWeight:"medium"},null===(y=null===(g=S.vendor_profile)||void 0===g?void 0:g.business_credentials)||void 0===y?void 0:y.company_name)),n.createElement(I,{direction:"row",spacing:2,alignItems:"center"},n.createElement(T,{color:"primary"}),n.createElement(x,{variant:"subtitle1",color:"text.secondary",width:"200px"},"Order Status"),n.createElement(R,{status:S.status}))))),"enduser"===L&&n.createElement(C,{item:!0,xs:6},n.createElement(_,{elevation:2,sx:{p:2,height:"100%"}},n.createElement(I,{spacing:2},("placed"===S.status||"released_on_stock"===S.status)&&n.createElement(n.Fragment,null,n.createElement(b,{variant:"contained",color:"primary",onClick:function(){return te(!0)}},"Confirm order"),n.createElement(f,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"),n.createElement(z,{open:ee,handleClose:function(){return te(!1)},orderID:S.id,currentStatus:S.status,revalidateCallback:G})),("placed"===S.status||"ordered"===S.status)&&n.createElement(n.Fragment,null,n.createElement(b,{variant:"contained",color:"error",onClick:function(){return ae(!0)}},"Cancel order"),n.createElement(H,{open:ne,handleClose:function(){return ae(!1)},orderID:S.id,revalidateCallback:G}))))),n.createElement(C,{item:!0,xs:12},n.createElement(I,{spacing:2},n.createElement(x,{variant:"h5"},"Documents"),n.createElement(_,{sx:{p:2}},n.createElement(I,{spacing:1},"enduser"===L&&n.createElement(n.Fragment,null,S.order_confirmation?n.createElement(n.Fragment,null,n.createElement(x,{variant:"h6"},"Order Confirmation"),n.createElement(x,null,null===(h=S.order_confirmation)||void 0===h?void 0:h.name),n.createElement(b,{variant:"contained",onClick:function(){m("api/ipos/".concat(S.id),"order_confirmation")}},"Download")):n.createElement(n.Fragment,null,n.createElement(x,{variant:"h5"},"Order Confirmation"),n.createElement(x,{variant:"body1"},"Here you can upload the the order confirmation for this order"),n.createElement(x,{variant:"body1"},"FileUpload"),n.createElement(k,null),n.createElement(c,{reference:"api::logistics.ipo",refID:S.id,field:"order_confirmation",multiple:!1,accept:"text/*,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",path:"api/ipos",componentName:"order_confirmation",componentReference:"common.base64-encoded-media",revalidateCallback:G}))),S.delivery_note?n.createElement(n.Fragment,null,n.createElement(x,{variant:"h6"},"Delivery Note"),n.createElement(x,null,null===(D=S.delivery_note)||void 0===D?void 0:D.name),n.createElement(b,{variant:"contained",onClick:function(){m("api/ipos/".concat(S.id),"delivery_note")}},"Download")):n.createElement(n.Fragment,null,n.createElement(x,{variant:"h5"},"Delivery Note"),n.createElement(x,{variant:"body1"},"Here you can upload the the delivery note for this order"),n.createElement(k,null),n.createElement(c,{reference:"api::logistics.ipo",refID:S.id,field:"delivery_note",multiple:!1,accept:"text/*,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",path:"api/ipos",componentName:"delivery_note",componentReference:"common.base64-encoded-media",revalidateCallback:G})))))),(null===(N=null===(j=null==S?void 0:S.notes)||void 0===j?void 0:j.data)||void 0===N?void 0:N.length)>0&&n.createElement(C,{item:!0,xs:12},n.createElement(I,{spacing:2},n.createElement(x,{variant:"h5"},"Notes"),n.createElement(u,{notes:S.notes.data}),n.createElement(k,null))),n.createElement(C,{item:!0,xs:12},n.createElement(I,{spacing:1},n.createElement(x,{variant:"h5"},"Items"),n.createElement(I,{direction:"row",alignItems:"center",justifyContent:"flex-end",spacing:2,component:_,p:1,sx:{bgcolor:"background.default",border:"1px solid",borderColor:"divider",boxShadow:"none"}},n.createElement(x,{variant:"body2",color:"text.secondary"},"Show:"),["received","registered","released","reports"].map((function(r){return n.createElement(q,{key:r,control:n.createElement(A,{size:"small",checked:ie.includes(r),onChange:function(n){n.target.checked?le(t(t([],e(ie),!1),[r],!1)):le(ie.filter((function(e){return e!==r})))}}),label:n.createElement(x,{variant:"body2",color:"text.secondary"},r.charAt(0).toUpperCase()+r.slice(1)),sx:{mr:0}})}))),"placed"===S.status&&n.createElement(f,{severity:"warning"},"Before confirmation you cannot update the items"),n.createElement(k,null),n.createElement("form",{action:K},n.createElement("input",{name:"id",type:"hidden",value:S.id}),X&&X.map((function(e,t){var r,a;return n.createElement(_,{sx:{p:2,mb:2},key:t},"placed"===S.status||"cancelled"===S.status||"done"===S.status?n.createElement(s,{item:e,index:t,image:null===(r=null==e?void 0:e.product)||void 0===r?void 0:r.image}):n.createElement(d,{item:e,index:t,handleUpdateQuantity:ce,handleAddReport:me,image:null===(a=null==e?void 0:e.product)||void 0===a?void 0:a.image,handleRemoveReportAtIndex:de,revalidateCallback:G,showing:ie}))})),n.createElement(_,{sx:{p:2}},n.createElement(I,{direction:"row",spacing:2,justifyContent:"end"},n.createElement(v,{text:"Update items",loadingText:"Loading..."}))),n.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map((function(e){var t,r;return{id:e.id,ordered_quantity:e.ordered_quantity,received_quantity:e.received_quantity,registered_quantity:e.registered_quantity,released_quantity:e.released_quantity,reports:(null===(r=null===(t=e.reports)||void 0===t?void 0:t.data)||void 0===r?void 0:r.map((function(e){return{id:"id"in e?e.id:void 0,quantity:e.quantity,content:e.content,type:e.type}})))||[]}}))}(X))}))))))}export{G as default};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__awaiter as r,__generator as
|
|
7
|
+
import{__awaiter as r,__generator as e,__assign as t}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as s}from"../../../services/mutate-data.js";import{flattenAttributes as a}from"../../../../lib/utils.js";import{parseFormData as o}from"../../../../lib/parseFormData.js";function i(i,n){return r(this,void 0,void 0,(function(){var r,u,c;return e(this,(function(e){switch(e.label){case 0:return Object.fromEntries(n),(r=o(n)).data.products&&(r.data.products=JSON.parse(r.data.products)),[4,s("POST","/api/product-categories",r)];case 1:return(u=e.sent())?u.error?[2,t(t({},i),{severity:"error",strapiErrors:u.error,message:"Failed to Create Category."})]:(c=a(u),[2,t(t({},i),{severity:"success",message:"Category Created Successfully",data:c,strapiErrors:null})]):[2,t(t({},i),{severity:"error",strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{i as createCategoryAction};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__awaiter as r,__generator as t,__assign as e}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as s}from"../../../services/mutate-data.js";import{flattenAttributes as a}from"../../../../lib/utils.js";import{parseFormData as o}from"../../../../lib/parseFormData.js";function i(i,n){return r(this,void 0,void 0,(function(){var r,
|
|
7
|
+
import{__awaiter as r,__generator as t,__assign as e}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as s}from"../../../services/mutate-data.js";import{flattenAttributes as a}from"../../../../lib/utils.js";import{parseFormData as o}from"../../../../lib/parseFormData.js";function i(i,n){return r(this,void 0,void 0,(function(){var r,c,u,d;return t(this,(function(t){switch(t.label){case 0:return r=Object.fromEntries(n),(c=o(n)).data.products&&(c.data.products=JSON.parse(c.data.products)),[4,s("PUT","/api/product-categories/".concat(r.id),c)];case 1:return(u=t.sent())?u.error?[2,e(e({},i),{severity:"error",strapiErrors:u.error,message:"Failed to Update Category."})]:(d=a(u),[2,e(e({},i),{severity:"success",message:"Category Updated Successfully",data:d,strapiErrors:null})]):[2,e(e({},i),{severity:"error",strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{i as updateCategoryAction};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use
|
|
1
|
+
"use server";
|
|
2
2
|
/*
|
|
3
3
|
* UMWD-Components
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__awaiter as r,__generator as
|
|
7
|
+
import{__awaiter as r,__generator as s,__assign as t}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as e}from"../../../services/mutate-data.js";import{flattenAttributes as a}from"../../../../lib/utils.js";import{parseFormData as o}from"../../../../lib/parseFormData.js";function i(i,m){return r(this,void 0,void 0,(function(){var r,n,l;return s(this,(function(s){switch(s.label){case 0:return Object.fromEntries(m),(r=o(m)).data.iro_items&&(r.data.iro_items=JSON.parse(r.data.iro_items)),r.data.opos&&(r.data.opos=JSON.parse(r.data.opos)),[4,e("POST","/api/iros",r)];case 1:return(n=s.sent())?n.error?[2,t(t({},i),{strapiErrors:n.error,message:"Failed to Create Iro."})]:(l=a(n),[2,t(t({},i),{message:"Iro Created Successfully",data:l,strapiErrors:null})]):[2,t(t({},i),{strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{i as requestRmaAction};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__awaiter as r,__generator as e,__assign as s}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as t}from"../../../services/mutate-data.js";import{flattenAttributes as o}from"../../../../lib/utils.js";import{parseFormData as i}from"../../../../lib/parseFormData.js";function a(a,n){return r(this,void 0,void 0,(function(){var r,m,l;return e(this,(function(e){switch(e.label){case 0:return Object.fromEntries(n),r=i(n),[4,t("POST","/api/opos/createAdmin",r)];case 1:return(m=e.sent())?m.error?[2,s(s({},a),{strapiErrors:m.error,message:"Failed to Create Opo."})]:(l=o(m),[2,s(s({},a),{message:"Opo Created Successfully",data:l,strapiErrors:null})]):[2,s(s({},a),{strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{a as createOpoAction};
|
|
7
|
+
import{__awaiter as r,__generator as e,__assign as s}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as t}from"../../../services/mutate-data.js";import{flattenAttributes as o}from"../../../../lib/utils.js";import{parseFormData as i}from"../../../../lib/parseFormData.js";function a(a,n){return r(this,void 0,void 0,(function(){var r,m,l;return e(this,(function(e){switch(e.label){case 0:return Object.fromEntries(n),r=i(n),[4,t("POST","/api/opos/createAdmin",r)];case 1:return(m=e.sent())?m.error?[2,s(s({},a),{severity:"error",strapiErrors:m.error,message:"Failed to Create Opo."})]:(l=o(m),[2,s(s({},a),{severity:"success",message:"Opo Created Successfully",data:l,strapiErrors:null})]):[2,s(s({},a),{severity:"error",strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{a as createOpoAction};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__awaiter as r,__generator as
|
|
7
|
+
import{__awaiter as r,__generator as e,__assign as s}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as t}from"../../../services/mutate-data.js";import{flattenAttributes as o}from"../../../../lib/utils.js";import{parseFormData as i}from"../../../../lib/parseFormData.js";function a(a,n){return r(this,void 0,void 0,(function(){var r,l,m,p;return e(this,(function(e){switch(e.label){case 0:return r=Object.fromEntries(n),l=i(n),console.log("parsedFormData",l),[4,t("PUT","/api/opos/".concat(r.id),l)];case 1:return(m=e.sent())?m.error?[2,s(s({},a),{severity:"error",strapiErrors:m.error,message:"Failed to Update Opo."})]:(p=o(m),[2,s(s({},a),{severity:"success",message:"Opo Updated Successfully",data:p,strapiErrors:null})]):[2,s(s({},a),{severity:"error",strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{a as updateOpoAction};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__awaiter as r,__generator as e,__assign as t}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as
|
|
7
|
+
import{__awaiter as r,__generator as e,__assign as t}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as s}from"../../../services/mutate-data.js";import{flattenAttributes as a}from"../../../../lib/utils.js";import{parseFormData as o}from"../../../../lib/parseFormData.js";function i(i,l){return r(this,void 0,void 0,(function(){var r,n,c;return e(this,(function(e){switch(e.label){case 0:return Object.fromEntries(l),(r=o(l)).data.categories&&(r.data.categories=JSON.parse(r.data.categories)),r.data.gallery&&(r.data.gallery=JSON.parse(r.data.gallery)),[4,s("POST","/api/products",r)];case 1:return(n=e.sent())?n.error?[2,t(t({},i),{severity:"error",strapiErrors:n.error,message:"Failed to Create Product."})]:(c=a(n),[2,t(t({},i),{severity:"success",message:"Product Created Successfully",data:c,strapiErrors:null})]):[2,t(t({},i),{severity:"error",strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{i as createProductAction};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__awaiter as r,__generator as t,__assign as
|
|
7
|
+
import{__awaiter as r,__generator as t,__assign as e}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as s}from"../../../services/mutate-data.js";import{flattenAttributes as a}from"../../../../lib/utils.js";import{parseFormData as o}from"../../../../lib/parseFormData.js";function i(i,c){return r(this,void 0,void 0,(function(){var r,d,l,n;return t(this,(function(t){switch(t.label){case 0:return r=Object.fromEntries(c),(d=o(c)).data.categories&&(d.data.categories=JSON.parse(d.data.categories)),d.data.gallery&&(d.data.gallery=JSON.parse(d.data.gallery)),d.data.stock_reports&&(d.data.stock_reports=JSON.parse(d.data.stock_reports)),[4,s("PUT","/api/products/".concat(r.id),d)];case 1:return(l=t.sent())?l.error?[2,e(e({},i),{severity:"error",strapiErrors:l.error,message:"Failed to Update Product."})]:(n=a(l),[2,e(e({},i),{severity:"success",message:"Product Updated Successfully",data:n,strapiErrors:null})]):[2,e(e({},i),{severity:"error",strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{i as updateProductAction};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__awaiter as e,__generator as t}from"../../../node_modules/tslib/tslib.es6.js";import n from"../../../node_modules/qs/lib/index.js";import{getStrapiURL as r,flattenAttributes as o}from"../../lib/utils.js";import{unstable_noStore as i}from"next/cache";import{getAuthToken as a}from"../services/get-token.js";var s=r();function u(n){return e(this,void 0,void 0,(function(){var e,r,i,s;return t(this,(function(t){switch(t.label){case 0:return[4,a()];case 1:e=t.sent(),r={method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(e)}},t.label=2;case 2:return t.trys.push([2,5,,6]),[4,fetch(n,e?r:{})];case 3:return[4,t.sent().json()];case 4:return i=t.sent(),[2,o(i)];case 5:throw s=t.sent(),console.error("Error fetching data:",s),s;case 6:return[2]}}))}))}function c(){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return(e=new URL("/api/home-page",s)).search=n.stringify({populate:{blocks:{populate:{image:{populate:!0},link:{populate:!0},feature:{populate:!0}}}}}),[4,u(e.href)];case 1:return[2,t.sent()]}}))}))}function p(){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return i(),(e=new URL("/api/slugify/slugs/page/disclaimer?populate[blocks][populate]=%2A",s)).search=n.stringify({populate:{blocks:{populate:!0}}}),[4,u(e.href)];case 1:return[2,t.sent()]}}))}))}function l(){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return i(),(e=new URL("/api/slugify/slugs/page/privacy-policy?populate[blocks][populate]=%2A",s)).search=n.stringify({populate:{blocks:{populate:!0}}}),[4,u(e.href)];case 1:return[2,t.sent()]}}))}))}function f(){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return i(),(e=new URL("/api/pages",s)).search=n.stringify({populate:{blocks:{populate:{bgImage:{populate:!0},logoImage:{populate:!0},image:{populate:!0},link:{populate:!0},feature:{populate:!0},icon:{populate:!0},airplane:{populate:{floorplan:!0}},column:{populate:!0},partner:{populate:{text:!0,photo:!0,links:!0}},pictures:!0,companies:{populate:{logo:!0}},textV2:!0,category:{populate:{products:{populate:{image:!0,price:!0}}}}}}}}),[4,u(e.href)];case 1:return[2,t.sent()]}}))}))}function h(){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return i(),(e=new URL("/api/pages",s)).search=n.stringify({fields:["slug","title"]}),[4,u(e.href)];case 1:return[2,t.sent()]}}))}))}function d(){return e(this,void 0,void 0,(function(){var e,r,
|
|
7
|
+
import{__awaiter as e,__generator as t}from"../../../node_modules/tslib/tslib.es6.js";import n from"../../../node_modules/qs/lib/index.js";import{getStrapiURL as r,flattenAttributes as o}from"../../lib/utils.js";import{unstable_noStore as i}from"next/cache";import{getAuthToken as a}from"../services/get-token.js";var s=r();function u(n){return e(this,void 0,void 0,(function(){var e,r,i,s;return t(this,(function(t){switch(t.label){case 0:return[4,a()];case 1:e=t.sent(),r={method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(e)}},t.label=2;case 2:return t.trys.push([2,5,,6]),[4,fetch(n,e?r:{})];case 3:return[4,t.sent().json()];case 4:return i=t.sent(),[2,o(i)];case 5:throw s=t.sent(),console.error("Error fetching data:",s),s;case 6:return[2]}}))}))}function c(){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return(e=new URL("/api/home-page",s)).search=n.stringify({populate:{blocks:{populate:{image:{populate:!0},link:{populate:!0},feature:{populate:!0}}}}}),[4,u(e.href)];case 1:return[2,t.sent()]}}))}))}function p(){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return i(),(e=new URL("/api/slugify/slugs/page/disclaimer?populate[blocks][populate]=%2A",s)).search=n.stringify({populate:{blocks:{populate:!0}}}),[4,u(e.href)];case 1:return[2,t.sent()]}}))}))}function l(){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return i(),(e=new URL("/api/slugify/slugs/page/privacy-policy?populate[blocks][populate]=%2A",s)).search=n.stringify({populate:{blocks:{populate:!0}}}),[4,u(e.href)];case 1:return[2,t.sent()]}}))}))}function f(){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return i(),(e=new URL("/api/pages",s)).search=n.stringify({populate:{blocks:{populate:{bgImage:{populate:!0},logoImage:{populate:!0},image:{populate:!0},link:{populate:!0},feature:{populate:!0},icon:{populate:!0},airplane:{populate:{floorplan:!0}},column:{populate:!0},partner:{populate:{text:!0,photo:!0,links:!0}},pictures:!0,companies:{populate:{logo:!0}},textV2:!0,category:{populate:{products:{populate:{image:!0,price:!0}}}}}}}}),[4,u(e.href)];case 1:return[2,t.sent()]}}))}))}function h(){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return i(),(e=new URL("/api/pages",s)).search=n.stringify({fields:["slug","title"]}),[4,u(e.href)];case 1:return[2,t.sent()]}}))}))}function d(){return e(this,void 0,void 0,(function(){var e,r,a,u;return t(this,(function(t){switch(t.label){case 0:i(),(e=new URL("/api/public-information",s)).search=n.stringify({populate:{socials:!0,business_credentials:!0,footer_logo:!0,header_logo:!0,address:!0}}),r={method:"GET",headers:{"Content-Type":"application/json"}},t.label=1;case 1:return t.trys.push([1,4,,5]),[4,fetch(e,r)];case 2:return[4,t.sent().json()];case 3:return a=t.sent(),[2,o(a)];case 4:return u=t.sent(),console.error("Error fetching data:",u),[2,null];case 5:return[2]}}))}))}function g(){return e(this,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,u(new URL("/api/navigation/render/main-navigation?type=RFR",s).href)];case 1:return[2,e.sent()]}}))}))}export{u as fetchData,f as getAllPages,p as getDisclaimerData,c as getHomePageData,g as getNavigation,h as getPageNames,l as getPrivacyPolicyData,d as getSiteData};
|