umwd-components 0.1.632 → 0.1.634
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/src/components/e-commerce/iro/TextualManageIROForm.js +1 -1
- package/dist/src/data/loaders/e-commerce/getAllOpos.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/e-commerce/iro/TextualManageIROForm.tsx +22 -9
- package/src/data/loaders/e-commerce/getAllOpos.ts +3 -0
- package/src/data/loaders/e-commerce/iros/getSingleIro.ts +1 -0
- package/src/data/loaders/e-commerce-loaders.ts +4 -1
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
import{__read as e,__spreadArray as t,__assign as r}from"../../../../node_modules/tslib/tslib.es6.js";import n,{useState as a,useEffect as i}from"react";import{useFormState as o}from"react-dom";import{updateIroAction as l}from"../../../data/actions/e-commerce/iro/updateIroAction.js";import m from"./TextualIROItemUpdater.js";import
|
|
6
|
+
import{__read as e,__spreadArray as t,__assign as r}from"../../../../node_modules/tslib/tslib.es6.js";import n,{useState as a,useEffect as i}from"react";import{useFormState as o}from"react-dom";import{updateIroAction as l}from"../../../data/actions/e-commerce/iro/updateIroAction.js";import m from"./TextualIROItemUpdater.js";import c from"./IroItemDisplay.js";import d from"../../logistics/note/NotesDisplay.js";import s from"../../logistics/note/NoteTakingComponent.js";import{StrapiErrors as u}from"../../StrapiErrors.js";import{SubmitButton as p}from"../../SubmitButton.js";import v from"@mui/material/Alert";import f from"@mui/material/Dialog";import E from"@mui/material/DialogActions";import g from"@mui/material/DialogContent";import y from"@mui/material/DialogTitle";import h from"@mui/material/Typography";import b from"@mui/material/Button";import x from"@mui/material/Grid";import C from"@mui/material/Box";import w from"@mui/material/Paper";import _ from"@mui/material/Stack";import I from"@mui/material/Divider";import{confirmationService as k}from"../../../data/services/common/confirmation-service.js";import{FormControlLabel as j,Checkbox as D,List as q,ListItem as A}from"@mui/material";var R={zodErrors:null,strapiErrors:null,data:null,message:null};function S(e){var t=e.open,r=e.handleClose,a=e.orderID,i=e.currentStatus,o=e.revalidateCallback;return n.createElement(f,{open:t},n.createElement(y,null,"Confirm Return"),n.createElement(g,null,n.createElement(_,{spacing:2},n.createElement(h,null,"Are you sure you want to confirm this return?"),n.createElement(q,null,"requested"===i&&n.createElement(A,null,"When confirming this return order a rma number will be generated"),n.createElement(A,null,"requested"===i?"By confirming the return you will update it's status from requested to returning":"By confirming the return you will update it's status from finalising_process to done")),n.createElement(h,null,"Current status: ",i))),n.createElement(E,null,n.createElement(b,{variant:"contained",onClick:function(e){k("iros",[a]),o&&o()}},"Confirm"),n.createElement(b,{variant:"contained",onClick:r},"Cancel")))}function B(f){var E,g,y,k,q=f.data,A=f.sx,B=f.revalidateCallback;f.handleClose;var N=f.role,T=e(o(l,R),2),U=T[0],M=T[1],O=e(a(q.iro_items.data?q.iro_items.data:[]),2),P=O[0],z=O[1],F=e(a(!1),2),G=F[0],J=F[1],L=e(a(["received","registered","released","reports"]),2),Q=L[0],W=L[1],H=function(r,n,a){var i=t([],e(P),!1),o=i.findIndex((function(e){return e.id===n}));i[o][a]=r,z(i)},K=function(n,a){var i,o,l,m=t([],e(P),!1),c=m.findIndex((function(e){return e.id===a})),d=(null===(o=null===(i=m[c])||void 0===i?void 0:i.reports)||void 0===o?void 0:o.data)||[],s=t(t([],e(d),!1),[n],!1);null==(null===(l=m[c])||void 0===l?void 0:l.reports)&&(m[c]=r(r({},m[c]),{reports:{data:[]}})),m[c].reports.data=s,z(m)},V=function(r,n){var a,i,o=t([],e(P),!1),l=o.findIndex((function(e){return e.id===r})),m=(null===(i=null===(a=o[l])||void 0===a?void 0:a.reports)||void 0===i?void 0:i.data)||[],c=m.filter((function(e){return"id"in e})),d=m.filter((function(e){return!("id"in e)}));d.splice(n,1);var s=t(t([],e(c),!1),e(d),!1);o[l].reports.data=s,z(o)};return i((function(){"Iro Updated"===(null==U?void 0:U.message)&&B&&B()}),[U]),i((function(){var e;console.log(q),(null===(e=q.iro_items)||void 0===e?void 0:e.data)&&z(q.iro_items.data?q.iro_items.data:[])}),[q]),n.createElement(C,{sx:t([],e(Array.isArray(A)?A:[A]),!1)},n.createElement(x,{container:!0,spacing:2},n.createElement(x,{item:!0,xs:12},n.createElement(_,{spacing:2},n.createElement(_,{direction:"row",spacing:2,justifyContent:"space-between"},n.createElement(_,{spacing:2},n.createElement(h,{variant:"h3",component:"h1"},"Management Inbound Return"),n.createElement(h,{variant:"body1"},"Manage arrival, registration and release of returns")),n.createElement(s,{content:"",related:[{id:q.id,__type:"api::e-commerce.iro"}],revalidateCallback:B})),n.createElement(I,null))),n.createElement(x,{item:!0,xs:6},n.createElement(_,{spacing:1},n.createElement(h,{variant:"h5"},"Details"),n.createElement(_,{direction:"row",spacing:2},n.createElement(h,{variant:"body1",width:"250px"},"Return Number"),n.createElement(h,{variant:"body2"},q.return_number)),n.createElement(_,{direction:"row",spacing:2},n.createElement(h,{variant:"body1",width:"250px"},"Return Date"),n.createElement(h,{variant:"body2"},q.return_date)),n.createElement(_,{direction:"row",spacing:2},n.createElement(h,{variant:"body1",width:"250px"},"Customer"),n.createElement(h,{variant:"body2"},null===(g=null===(E=q.customer)||void 0===E?void 0:E.business_credentials)||void 0===g?void 0:g.company_name)),n.createElement(_,{direction:"row",spacing:2},n.createElement(h,{variant:"body1",width:"250px"},"Return Status"),n.createElement(h,{variant:"body2",width:"250px"},q.status)),("requested"===q.status||"finalising_process"===q.status)&&"enduser"===N&&n.createElement(n.Fragment,null,n.createElement(b,{variant:"contained",color:"primary",onClick:function(){return J(!0)}},"Confirm order"),n.createElement(v,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"),n.createElement(S,{open:G,handleClose:function(){return J(!1)},orderID:q.id,currentStatus:q.status,revalidateCallback:B})))),n.createElement(x,{item:!0,xs:12},n.createElement(_,{spacing:2},n.createElement(h,{variant:"h5"},"Documents"),n.createElement(w,{sx:{p:2}},n.createElement(_,{spacing:1})))),(null===(k=null===(y=null==q?void 0:q.notes)||void 0===y?void 0:y.data)||void 0===k?void 0:k.length)>0&&n.createElement(x,{item:!0,xs:12},n.createElement(_,{spacing:2},n.createElement(h,{variant:"h5"},"Notes"),n.createElement(d,{notes:q.notes.data}),n.createElement(I,null))),n.createElement(x,{item:!0,xs:12},n.createElement(_,{spacing:1},n.createElement(h,{variant:"h5"},"Items"),n.createElement(_,{direction:"row",alignItems:"center",justifyContent:"flex-end",spacing:2,component:w,p:1},n.createElement(h,{variant:"body1"},"Show:"),["received","registered","released","reports"].map((function(r){return n.createElement(j,{key:r,control:n.createElement(D,{checked:Q.includes(r),onChange:function(n){n.target.checked?W(t(t([],e(Q),!1),[r],!1)):W(Q.filter((function(e){return e!==r})))}}),label:r.charAt(0).toUpperCase()+r.slice(1)})}))),"requested"===q.status&&n.createElement(v,{severity:"warning"},"Before confirmation you cannot update the items"),n.createElement(I,null),n.createElement("form",{action:M},n.createElement("input",{name:"id",type:"hidden",value:q.id}),P&&P.map((function(e,t){var r,a;return n.createElement(w,{sx:{p:2,mb:2},key:t},"requested"===q.status?n.createElement(c,{item:e,index:t,image:null===(r=null==e?void 0:e.product)||void 0===r?void 0:r.image}):n.createElement(m,{item:e,index:t,handleUpdateQuantity:H,handleAddReport:K,image:null===(a=null==e?void 0:e.product)||void 0===a?void 0:a.image,handleRemoveReportAtIndex:V,revalidateCallback:B,showing:Q}))})),n.createElement(w,{sx:{p:2}},n.createElement(_,{direction:"row",spacing:2,justifyContent:"end"},n.createElement(p,{text:"Update items",loadingText:"Loading..."}),n.createElement(u,{error:null==U?void 0:U.strapiErrors}),(null==U?void 0:U.message)&&n.createElement(v,{severity:"error"},null==U?void 0:U.message))),n.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map((function(e){var t,r;return{id:e.id,returned_quantity:e.returned_quantity,reports:(null===(r=null===(t=e.reports)||void 0===t?void 0:t.data)||void 0===r?void 0:r.map((function(e){return{id:"id"in e?e.id:void 0,quantity:e.quantity,content:e.content,type:e.type}})))||[]}}))}(P))}))))))}export{B as default};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__awaiter as e,__generator as s}from"../../../../node_modules/tslib/tslib.es6.js";import r from"../../../../node_modules/qs/lib/index.js";import{fetchData as i}from"../loaders.js";import{getStrapiURL as o}from"../../../lib/utils.js";import{unstable_noStore as t}from"next/cache";import{getUserRole as
|
|
7
|
+
import{__awaiter as e,__generator as s}from"../../../../node_modules/tslib/tslib.es6.js";import r from"../../../../node_modules/qs/lib/index.js";import{fetchData as i}from"../loaders.js";import{getStrapiURL as o}from"../../../lib/utils.js";import{unstable_noStore as t}from"next/cache";import{getUserRole as d}from"../../services/get-user-me-loader.js";var n=o();function a(o,a,l,u,p){return e(this,void 0,void 0,(function(){var e,c,m,_,b,v;return s(this,(function(s){switch(s.label){case 0:return t(),[4,d()];case 1:return e=s.sent(),c=null===(v=null===(b=null==e?void 0:e.data)||void 0===b?void 0:b.role)||void 0===v?void 0:v.type,m="enduser"===c,(_=new URL("/api/opos",n)).search=r.stringify({filters:{is_archive:{$in:p}},sort:"".concat(u||"id",":").concat(l||"desc"),populate:{opo_items:{populate:{product:{populate:{price:!0}},reports:!0}},customer:!!m&&{populate:{company_address:!0,delivery_address:!0,billing_address:!0,business_credentials:!0}},payments:!0,invoice:{populate:{seller_business_credentials:!0,seller_company_address:!0,buyer_company_address:!0,buyer_delivery_address:!0,buyer_billing_address:!0,buyer_business_credentials:!0,items:!0,admin_items:!0},iros:{fields:["id","uuid","status"]}}},pagination:{pageSize:a||10,page:o?o+1:1}}),[4,i(_.href)];case 2:return[2,s.sent()]}}))}))}export{a as getAllOpos};
|