@ozdao/prometheus-framework 0.2.93 → 0.2.95

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. package/dist/auth.server.js +15 -14
  2. package/dist/auth.server.mjs +15 -14
  3. package/dist/main-BJvlNekm.mjs +13631 -0
  4. package/dist/main-pGo7JpSP.js +92 -0
  5. package/dist/orders.server.js +31 -27
  6. package/dist/orders.server.mjs +31 -27
  7. package/dist/organizations.server.js +31 -10
  8. package/dist/organizations.server.mjs +31 -10
  9. package/dist/prometheus-framework/src/components/Block/Block.vue.cjs +1 -1
  10. package/dist/prometheus-framework/src/components/Block/Block.vue.js +1 -1
  11. package/dist/prometheus-framework/src/components/EditImages/EditImages.vue.js +19 -19
  12. package/dist/prometheus-framework/src/components/Popup/Popup.vue.js +12 -12
  13. package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue.cjs +1 -1
  14. package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue.js +36 -1
  15. package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue2.cjs +1 -1
  16. package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue2.js +1 -36
  17. package/dist/prometheus-framework/src/components/Upload/Upload.vue.js +21 -21
  18. package/dist/prometheus-framework/src/modules/auth/router/auth.cjs +1 -1
  19. package/dist/prometheus-framework/src/modules/auth/router/auth.js +4 -0
  20. package/dist/prometheus-framework/src/modules/backoffice/router/backoffice.cjs +1 -1
  21. package/dist/prometheus-framework/src/modules/backoffice/router/backoffice.js +8 -8
  22. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +1 -1
  23. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.js +58 -58
  24. package/dist/prometheus-framework/src/modules/icons/navigation/IconCross.vue.cjs +1 -1
  25. package/dist/prometheus-framework/src/modules/icons/navigation/IconCross.vue.js +22 -21
  26. package/dist/prometheus-framework/src/modules/orders/components/blocks/StatusHistory.vue.cjs +2 -2
  27. package/dist/prometheus-framework/src/modules/orders/components/blocks/StatusHistory.vue.js +48 -37
  28. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderBackoffice.vue.cjs +1 -1
  29. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderBackoffice.vue.js +160 -167
  30. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs +1 -1
  31. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js +49 -48
  32. package/dist/prometheus-framework/src/modules/orders/components/pages/Orders.vue.cjs +1 -1
  33. package/dist/prometheus-framework/src/modules/orders/components/pages/Orders.vue.js +113 -110
  34. package/dist/prometheus-framework/src/modules/orders/components/partials/ShopCart.vue.js +14 -14
  35. package/dist/prometheus-framework/src/modules/orders/store/models/order.cjs +1 -0
  36. package/dist/prometheus-framework/src/modules/orders/store/models/order.js +28 -0
  37. package/dist/prometheus-framework/src/modules/orders/store/orders.cjs +1 -1
  38. package/dist/prometheus-framework/src/modules/orders/store/orders.js +25 -43
  39. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.cjs +1 -1
  40. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.js +20 -20
  41. package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.cjs +1 -1
  42. package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.js +1 -1
  43. package/dist/prometheus-framework/src/modules/organizations/components/pages/Department.vue.cjs +1 -1
  44. package/dist/prometheus-framework/src/modules/organizations/components/pages/Department.vue.js +1 -1
  45. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +1 -1
  46. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.js +47 -47
  47. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.cjs +1 -1
  48. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.js +143 -131
  49. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.cjs +1 -1
  50. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.js +1 -1
  51. package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.cjs +1 -1
  52. package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.js +1 -1
  53. package/dist/prometheus-framework/src/modules/organizations/organizations.client.cjs +1 -1
  54. package/dist/prometheus-framework/src/modules/organizations/organizations.client.js +32 -34
  55. package/dist/prometheus-framework/src/modules/organizations/router/members.router.cjs +1 -1
  56. package/dist/prometheus-framework/src/modules/organizations/router/members.router.js +1 -1
  57. package/dist/prometheus-framework/src/modules/organizations/store/departments.cjs +1 -1
  58. package/dist/prometheus-framework/src/modules/organizations/store/departments.js +1 -1
  59. package/dist/prometheus-framework/src/modules/organizations/store/memberships.cjs +1 -1
  60. package/dist/prometheus-framework/src/modules/organizations/store/memberships.js +30 -32
  61. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs +1 -1
  62. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js +155 -187
  63. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.cjs +1 -1
  64. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.js +18 -18
  65. package/dist/prometheus-framework/src/modules/products/components/sections/FilterProducts.vue.cjs +1 -1
  66. package/dist/prometheus-framework/src/modules/products/components/sections/FilterProducts.vue.js +1 -1
  67. package/dist/prometheus-framework/src/modules/users/components/blocks/CardUser.vue.cjs +1 -1
  68. package/dist/prometheus-framework/src/modules/users/components/blocks/CardUser.vue.js +26 -22
  69. package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.cjs +1 -1
  70. package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.js +66 -63
  71. package/dist/prometheus-framework.cjs.js +1 -1
  72. package/dist/prometheus-framework.es.js +1 -1
  73. package/dist/style.css +1 -1
  74. package/dist/web-B2xhKZNK.js +1 -0
  75. package/dist/web-DTzbVshr.mjs +54 -0
  76. package/package.json +1 -1
  77. package/src/components/Block/Block.vue +1 -1
  78. package/src/modules/auth/controllers/auth.controller.js +19 -16
  79. package/src/modules/auth/router/auth.js +4 -0
  80. package/src/modules/backoffice/router/backoffice.js +3 -3
  81. package/src/modules/chats/routes/chats.routes.js +1 -2
  82. package/src/modules/gallery/components/sections/BackofficeGallery.vue +2 -1
  83. package/src/modules/icons/navigation/IconCross.vue +11 -7
  84. package/src/modules/orders/components/blocks/StatusHistory.vue +8 -11
  85. package/src/modules/orders/components/pages/OrderBackoffice.vue +37 -50
  86. package/src/modules/orders/components/pages/OrderCreateBackoffice.vue +7 -3
  87. package/src/modules/orders/components/pages/Orders.vue +1 -1
  88. package/src/modules/orders/controllers/orders.controller.js +25 -25
  89. package/src/modules/orders/models/order.model.js +1 -1
  90. package/src/modules/orders/routes/orders.routes.js +6 -0
  91. package/src/modules/orders/store/models/order.js +33 -0
  92. package/src/modules/orders/store/orders.js +7 -28
  93. package/src/modules/organizations/components/blocks/CardDepartment.vue +2 -2
  94. package/src/modules/organizations/components/pages/DepartmentEdit.vue +7 -5
  95. package/src/modules/organizations/components/pages/Members.vue +50 -38
  96. package/src/modules/organizations/components/pages/Organization.vue +1 -1
  97. package/src/modules/organizations/controllers/invites.controller.js +2 -0
  98. package/src/modules/organizations/controllers/memberships.controller.js +35 -11
  99. package/src/modules/organizations/models/invite.model.js +4 -0
  100. package/src/modules/organizations/organizations.client.js +0 -2
  101. package/src/modules/organizations/router/members.router.js +1 -1
  102. package/src/modules/organizations/store/departments.js +0 -1
  103. package/src/modules/organizations/store/memberships.js +1 -8
  104. package/src/modules/products/components/pages/ProductEdit.vue +39 -33
  105. package/src/modules/products/components/sections/EditProductInfo.vue +3 -3
  106. package/src/modules/users/components/blocks/CardUser.vue +9 -5
  107. package/src/modules/users/components/pages/Profile.vue +5 -3
  108. package/src/modules/organizations/components/blocks/DepartmentMemberModify.vue +0 -126
@@ -1,9 +1,9 @@
1
- import { ref as i, openBlock as n, createElementBlock as a, Fragment as f, renderList as h, unref as x, createElementVNode as o, createBlock as k, createCommentVNode as u, toDisplayString as c } from "vue";
2
- import g from "../../../icons/navigation/IconCheckmark.vue.js";
3
- const H = { class: "bg-grey radius-medium w-100" }, v = /* @__PURE__ */ o("h3", { class: "pd-medium" }, "Tracking History", -1), S = { class: "flex-center flex i-big radius-extra br-solid br-2px br-black-transp-10 mn-r-small" }, w = { class: "h4 w-8r" }, C = {
1
+ import { ref as o, resolveComponent as f, openBlock as r, createElementBlock as i, Fragment as k, renderList as x, unref as h, createElementVNode as n, createBlock as u, createCommentVNode as c, toDisplayString as m, withCtx as b, createTextVNode as g } from "vue";
2
+ import H from "../../../icons/navigation/IconCheckmark.vue.js";
3
+ const v = { class: "bg-grey radius-medium w-100" }, w = /* @__PURE__ */ n("h3", { class: "pd-medium" }, "Tracking History", -1), C = { class: "flex-center flex i-big radius-extra br-solid br-2px br-black-transp-10 mn-r-small" }, B = { class: "h4 w-8r" }, N = {
4
4
  key: 0,
5
5
  class: "h5 w-8r"
6
- }, I = { class: "h5 w-8r" }, B = ["disabled", "onClick"], D = {
6
+ }, D = {
7
7
  __name: "StatusHistory",
8
8
  props: {
9
9
  statusHistory: {
@@ -19,46 +19,57 @@ const H = { class: "bg-grey radius-medium w-100" }, v = /* @__PURE__ */ o("h3",
19
19
  type: Array
20
20
  }
21
21
  },
22
- setup(l) {
23
- const r = l, m = r.statuses.map((s) => {
24
- const e = r.statusHistory.find((t) => t.status === s);
25
- return {
22
+ setup(d) {
23
+ const a = d, p = a.statuses.map((s) => {
24
+ const e = a.statusHistory.find((l) => l.status === s);
25
+ return console.log(), {
26
26
  status: s,
27
+ user: (e == null ? void 0 : e.user) || void 0,
27
28
  timestamp: e ? e.timestamp : "N/A",
28
29
  inHistory: !!e,
29
30
  _id: e ? e._id : null
30
31
  };
31
- }), p = i(r.statusCurrent), y = i(r.statusHistory), _ = (s) => y.value.some((e) => e.status === s), b = (s) => {
32
- const t = r.statuses.findIndex((d) => d === p.value) + 1;
33
- return r.statuses[t] && r.statuses[t] === s;
34
- };
35
- return i("192.168.1.197"), i(9100), i(`This is some text to print
32
+ });
33
+ o(a.statusCurrent);
34
+ const _ = o(a.statusHistory), y = (s) => _.value.some((e) => e.status === s);
35
+ return o("192.168.1.197"), o(9100), o(`This is some text to print
36
36
 
37
- `), (s, e) => (n(), a("div", H, [
38
- v,
39
- (n(!0), a(f, null, h(x(m), (t) => (n(), a("div", {
40
- key: t,
41
- class: "w-100 br-t br-solid br-black-transp-10 pd-medium flex-v-center flex-nowrap flex"
42
- }, [
43
- o("div", S, [
44
- _(t.status) ? (n(), k(g, {
37
+ `), (s, e) => {
38
+ const l = f("router-link");
39
+ return r(), i("div", v, [
40
+ w,
41
+ (r(!0), i(k, null, x(h(p), (t) => (r(), i("div", {
42
+ key: t,
43
+ class: "w-100 br-t br-solid br-black-transp-10 pd-medium flex-v-center flex-nowrap flex"
44
+ }, [
45
+ n("div", C, [
46
+ y(t.status) ? (r(), u(H, {
47
+ key: 0,
48
+ class: "i-medium"
49
+ })) : c("", !0)
50
+ ]),
51
+ n("div", null, [
52
+ n("p", B, m(t.status), 1),
53
+ t.timestamp ? (r(), i("p", N, m(s.formatDate(t.timestamp)), 1)) : c("", !0)
54
+ ]),
55
+ t.user ? (r(), u(l, {
45
56
  key: 0,
46
- class: "i-medium"
47
- })) : u("", !0)
48
- ]),
49
- o("div", null, [
50
- o("p", w, c(t.status), 1),
51
- t.timestamp ? (n(), a("p", C, c(s.formatDate(t.timestamp)), 1)) : u("", !0)
52
- ]),
53
- o("p", I, c(t._id), 1),
54
- l.edit ? (n(), a("button", {
55
- key: 0,
56
- disabled: !b(t),
57
- onClick: (d) => s.setStatus(t),
58
- class: "mn-l-auto bg-main button radius-big"
59
- }, "Set status", 8, B)) : u("", !0)
60
- ]))), 128))
61
- ]));
57
+ to: {
58
+ name: "User Profile",
59
+ params: {
60
+ _id: t.user
61
+ }
62
+ },
63
+ class: "pd-small radius-extra bg-second t-white mn-l-auto flex-center uppercase t-semi"
64
+ }, {
65
+ default: b(() => [
66
+ g("Check User")
67
+ ]),
68
+ _: 2
69
+ }, 1032, ["to"])) : c("", !0)
70
+ ]))), 128))
71
+ ]);
72
+ };
62
73
  }
63
74
  };
64
75
  export {
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),q=require("vue-router"),z=require("../../../globals/components/sections/SectionPageTitle.vue.cjs"),T=require("../../../../components/Popup/Popup.vue.cjs"),F=require("../../../icons/entities/IconTime.vue.cjs"),P=require("../blocks/CardOrderItem.vue.cjs"),L=require("../../../organizations/components/blocks/CardOrganization.vue.cjs"),R=require("../../../chats/components/pages/ChatPage.vue.cjs"),A=require("../blocks/StatusHistory.vue.cjs"),H=require("../../../globals/store/globals.cjs"),c=require("../../store/orders.cjs"),U=require("../../../products/store/products.cjs"),W=require("../../../organizations/store/organizations.cjs");require("./OrderBackoffice.vue2.cjs");const j=require("../../../../../../_virtual/_plugin-vue_export-helper.cjs"),r=b=>(e.pushScopeId("data-v-36d45d04"),b=b(),e.popScopeId(),b),Q={key:0,class:"pd-thin"},Y={key:0,class:"mn-b-thin pos-relative w-100 bg-main radius-big pd-big"},$={class:"mn-b-small flex-nowrap flex"},G=r(()=>e.createElementVNode("p",{class:"t-medium p-medium mn-r-auto"}," Progress ",-1)),J={class:"t-medium p-medium"},K={class:"p-small t-transp"},X=r(()=>e.createElementVNode("h2",{class:"mn-b-small"},null,-1)),Z={class:"radius-extra mn-b-medium flex-nowrap flex pos-relative"},ee={class:"flex-nowrap flex"},te={class:"w-max flex-v-center gap-thin flex-nowrap flex pd-thin radius-small bg-white-transp-20"},se={class:"t-medium mn-r-auto"},ae={class:"bg-grey radius-small pd-small mn-b-thin"},re={class:"bg-grey pd-small radius-small flex gap-thin flex-column mn-b-semi"},le={key:1,class:"gap-thin cols-2"},ne={class:"w-100"},oe={class:"mn-b-thin bg-grey w-100 o-hidden radius-medium"},ie={class:"pd-small flex-nowrap flex"},ce={class:"mn-r-auto"},de=r(()=>e.createElementVNode("span",{class:"d-block t-medium p-medium"},"Your order is",-1)),ue={class:"t-lh-075 h2 d-block mn-b-small"},me=r(()=>e.createElementVNode("p",{class:"pd-t-nano pd-b-nano pd-r-thin pd-l-thin radius-extra bg-black t-white w-max"},"as on 29 aug 2021, Friday",-1)),pe=r(()=>e.createElementVNode("div",{class:"t-right"},[e.createTextVNode(" Cancel order"),e.createElementVNode("br"),e.createTextVNode(" Exchange item "),e.createElementVNode("hr",{class:"mn-b-thin mn-t-thin"}),e.createTextVNode(" For Delivery Queries Contact Us ")],-1)),_e={class:"pd-small cols-2 br-t br-black-transp-10 br-solid"},he=r(()=>e.createElementVNode("p",{class:"w-100 t-medium p-medium"}," Phone ",-1)),be={class:"w-100 t-right"},ge={key:0,class:"pd-small cols-2 br-t br-black-transp-10 br-solid"},ve={class:"w-100 t-medium p-medium"},Ne={class:"w-100 t-right"},fe=r(()=>e.createElementVNode("div",{class:"pd-small cols-2 br-t br-black-transp-10 br-solid"},[e.createElementVNode("p",{class:"t-medium p-medium"}," Address "),e.createElementVNode("p",{class:"w-100 t-right"})],-1)),Ve={class:"pd-small cols-2 br-t br-black-transp-10 br-solid"},Ee=r(()=>e.createElementVNode("p",{class:"mn-b-small t-medium p-medium"}," Delivery ",-1)),ye={class:"w-100 t-right mn-b-small"},ke={key:2,class:"t-transp"},we={class:"bg-grey radius-big pd-medium mn-r-bold pd-r-big br-right-dark w-100"},Se=r(()=>e.createElementVNode("h3",{class:"mn-b-small"},"Order Summary",-1)),xe={class:"flex gap-thin flex-column mn-b-semi"},Ce={class:"mn-b-medium radius-small br-solid br-1px br-black-transp-10 w-100"},Be={class:"pd-small br-solid br-b br-black-transp-10 flex"},De=r(()=>e.createElementVNode("p",{class:"mn-r-auto t-transp"},"In total",-1)),Oe={class:"pd-small br-solid br-b br-black-transp-10 flex"},qe=r(()=>e.createElementVNode("p",{class:"mn-r-auto t-transp"},"Delivery",-1)),Pe={class:"pd-small flex-bottom flex"},Ie=r(()=>e.createElementVNode("p",{class:"mn-r-auto t-transp"},"In total to pay",-1)),Me={class:"p-big t-semi"},ze=r(()=>e.createElementVNode("h3",{class:"mn-b-small"},"Chat With Us",-1)),Te={__name:"OrderBackoffice",setup(b){q.useRouter();const _=q.useRoute(),s=e.ref(null),g=e.ref(null),n=e.ref(null),o=["created","confirmed","packing","in delivery","delivered"],V=["Order Confirming","Order Confirmed","Packing","In Delivery","Delivered"],v=t=>o.slice(t).includes(s.value.status),N=e.ref(!1),E=e.ref(null),f=e.ref([]);function I(t){N.value=!0,typeof t=="number"&&(E.value=t)}function y(){N.value=!1,E.value=null}e.onMounted(async()=>{var a,l;s.value=await c.actions.read({_id:_.params.order}),s.value=s.value[0],g.value=await U.actions.read({organization:s.value.owner.target._id,limit:1e3}),console.log(g.value);const t=g.value.reduce((d,u)=>(d[u._id]=u,d),{});console.log(t),f.value=s.value.positions.map(({_id:d,quantity:u})=>{const m=t[d];return{name:m.name,images:m.images,price:m.price,_id:m._id,quantity:u}}),n.value=await W.actions.read({_id:(a=s.value)==null?void 0:a.owner.target._id,location:(l=H.state.position)==null?void 0:l.location})});let k=e.computed(()=>{var t;return Number((t=s.value)==null?void 0:t.positions.reduce((a,l)=>a+l.price*l.quantity,0))});e.computed(()=>{var t;return Number((t=s.value)==null?void 0:t.positions.reduce((a,l)=>a+l.quantity,0))});function h(t){const a=o.indexOf(t);return a!==-1&&a+1<o.length?o[a+1]:null}function w(t){const a=o.indexOf(t);return t?V[a]:""}async function M(){const t=h(c.state.current.status);t?(c.state.current.status=t,await c.actions.update(c.state.current)):console.error("Next status is void. Must handle somehow."),y()}return(t,a)=>{var l,d,u,m,S,x,C,B,D,O;return s.value&&n.value?(e.openBlock(),e.createElementBlock("div",Q,[e.createVNode(z.default,{title:`Order is ${s.value.status}`,class:"mn-b-small bg-grey bg-grey radius-big"},null,8,["title"]),s.value?(e.openBlock(),e.createElementBlock("div",Y,[e.createElementVNode("div",$,[G,e.createElementVNode("p",J,[e.createTextVNode(" Order No: "),e.createElementVNode("span",K,"#"+e.toDisplayString(s.value._id),1)])]),X,e.createElementVNode("div",Z,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(o,(p,i)=>e.createElementVNode("div",{key:i,class:"mn-r-thin w-20"},[e.createElementVNode("div",{class:e.normalizeClass(["bg-grey br-anim br-glow radius-extra h-1r w-100",{"br-glow-anim":v(i)},{"t-transp":!v(i)},{blink:s.value.status===o[i]&&h(s.value.status)}])},null,2),e.createElementVNode("div",{class:e.normalizeClass([{"t-transp":!v(i)},"mn-t-thin t-medium uppercase"])},e.toDisplayString(V[i]),3)])),64))]),e.createElementVNode("div",ee,[e.createElementVNode("div",te,[e.createVNode(F.default,{class:"i-semi t-transp",fill:"rgb(var(--black)"}),e.createElementVNode("p",se,"Estimated Arrival "+e.toDisplayString(t.formatDate(s.value.deadline)),1)]),h(s.value.status)&&e.unref(_).name==="Order Edit"?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:I,class:"mn-l-auto bg-black t-white button"}," Mark as "+e.toDisplayString(w(h(s.value.status))),1)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),e.createVNode(T.default,{title:"Change status",onClosePopup:y,isPopupOpen:N.value,class:"bg-white w-min-30r w-max-30r radius-big pd-big"},{default:e.withCtx(()=>[e.createElementVNode("p",ae,"Estimated Arrival "+e.toDisplayString(t.formatDate(s.value.deadline)),1),e.createElementVNode("ul",re,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,(p,i)=>(e.openBlock(),e.createBlock(P.default,{key:p._id,editable:!1,product:p},null,8,["product"]))),128))]),e.createElementVNode("button",{onClick:M,class:"w-100 bg-black-small t-white button"},e.toDisplayString("Confirm Changing to "+w(h(s.value.status))),1)]),_:1},8,["isPopupOpen"]),s.value?(e.openBlock(),e.createElementBlock("div",le,[e.createElementVNode("div",ne,[n.value[0]?(e.openBlock(),e.createBlock(L.default,{key:0,organization:n.value[0],showRating:!0,showFollowers:!1,showProducts:!1,class:"bg-grey mn-b-thin w-100 o-hidden radius-big pd-small"},null,8,["organization"])):e.createCommentVNode("",!0),e.createElementVNode("div",oe,[e.createElementVNode("div",ie,[e.createElementVNode("div",ce,[de,e.createElementVNode("span",ue,e.toDisplayString(s.value.status),1),me]),pe]),e.createElementVNode("div",_e,[he,e.createElementVNode("p",be,e.toDisplayString((l=s.value.user)==null?void 0:l.number),1)]),(d=s.value.user)!=null&&d.messenger.type?(e.openBlock(),e.createElementBlock("div",ge,[e.createElementVNode("p",ve,e.toDisplayString((u=s.value.user)==null?void 0:u.messenger.type),1),e.createElementVNode("p",Ne,e.toDisplayString((m=s.value.user)==null?void 0:m.messenger.value),1)])):e.createCommentVNode("",!0),fe,e.createElementVNode("div",Ve,[Ee,e.createElementVNode("p",ye,e.toDisplayString((S=s.value.delivery)==null?void 0:S.type),1)])]),c.state.current.status_history?(e.openBlock(),e.createBlock(A.default,{key:1,statuses:o,statusHistory:c.state.current.status_history,statusCurrent:c.state.current.status,edit:e.unref(_).name==="Order Edit"},null,8,["statusHistory","statusCurrent","edit"])):e.createCommentVNode("",!0),t.payment&&t.payment.Status==="CONFIRMED"?(e.openBlock(),e.createElementBlock("span",ke,"Paid")):e.createCommentVNode("",!0)]),e.createElementVNode("div",we,[Se,e.createElementVNode("ul",xe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,(p,i)=>(e.openBlock(),e.createBlock(P.default,{key:p._id,editable:!1,product:p},null,8,["product"]))),128))]),e.createElementVNode("div",Ce,[e.createElementVNode("div",Be,[De,e.createElementVNode("p",null,e.toDisplayString(e.unref(k))+" "+e.toDisplayString(t.returnCurrency()),1)]),e.createElementVNode("div",Oe,[qe,e.createElementVNode("p",null,e.toDisplayString(t.returnCurrency())+" "+e.toDisplayString(Math.trunc(100+20*((x=n.value[0])==null?void 0:x.distance)-7,5*(((C=n.value[0])==null?void 0:C.distance)/10))),1)]),e.createElementVNode("div",Pe,[Ie,e.createElementVNode("p",Me,e.toDisplayString(t.returnCurrency())+" "+e.toDisplayString(Math.trunc(100+20*((B=n.value[0])==null?void 0:B.distance)-7,5*(((D=n.value[0])==null?void 0:D.distance)/10))+e.unref(k)),1)])]),ze,e.createVNode(R.default,{username:e.unref(_).name==="Order Status"?((O=s.value.user)==null?void 0:O.name)||"User":"Weeder Support",chatID:e.unref(_).params.order,class:"radius-semi bg-white o-hidden"},null,8,["username","chatID"])])])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)}}},Fe=j.default(Te,[["__scopeId","data-v-36d45d04"]]);exports.default=Fe;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),C=require("vue-router"),O=require("../../../../../node_modules/@vuepic/vue-datepicker/dist/vue-datepicker.cjs");require("../../../../../node_modules/@vuepic/vue-datepicker/dist/main.css.cjs");require("../../../../components/Tab/Tab.vue.cjs");const P=require("../../../../components/Popup/Popup.vue.cjs"),I=require("../../../icons/entities/IconTime.vue.cjs"),B=require("../blocks/CardOrderItem.vue.cjs"),z=require("../../../organizations/components/blocks/CardOrganization.vue.cjs"),M=require("../../../chats/components/pages/ChatPage.vue.cjs"),F=require("../blocks/StatusHistory.vue.cjs"),L=require("../../../globals/store/globals.cjs"),d=require("../../store/orders.cjs"),R=require("../../../products/store/products.cjs"),T=require("../../../organizations/store/organizations.cjs");require("./OrderBackoffice.vue2.cjs");const A=require("../../../../../../_virtual/_plugin-vue_export-helper.cjs"),r=b=>(e.pushScopeId("data-v-ec5fc79c"),b=b(),e.popScopeId(),b),H={key:0,class:"pd-thin"},U={key:0,class:"mn-b-thin pos-relative w-100 bg-main radius-big pd-medium"},W={class:"mn-b-small flex-nowrap flex"},j={class:"t-medium p-medium"},G={class:"p-small t-transp"},J={class:"flex-nowrap flex gap-thin pos-relative"},K={class:"bg-grey mn-b-thin pd-thin radius-extra flex-nowrap flex"},Q={class:"w-max flex-v-center gap-thin flex-nowrap flex pd-thin radius-small bg-white-transp-20"},X={class:"t-medium mn-r-auto"},Y=r(()=>e.createElementVNode("span",{class:"p-small t-transp"},"Estimated Arrival",-1)),Z=r(()=>e.createElementVNode("br",null,null,-1)),$=r(()=>e.createElementVNode("p",{class:"t-medium p-medium mn-b-thin"}," Positions ",-1)),ee={class:"bg-grey pd-small radius-small flex gap-thin flex-column mn-b-semi"},te={key:1,class:"gap-thin cols-2"},se={class:"w-100"},ae={class:"mn-b-thin bg-grey w-100 o-hidden radius-medium"},re={class:"pd-small flex-nowrap flex"},le={class:"mn-r-auto"},ne=r(()=>e.createElementVNode("span",{class:"d-block t-medium p-medium"},"Order is",-1)),oe=r(()=>e.createElementVNode("span",{class:"t-lh-075 h2 d-block mn-b-small"},"created",-1)),ie={class:"pd-t-nano pd-b-nano pd-r-thin pd-l-thin radius-extra bg-black t-white w-max"},ce={class:"pd-small cols-2 br-t br-black-transp-10 br-solid"},de=r(()=>e.createElementVNode("p",{class:"w-100 t-medium p-medium"}," Phone ",-1)),ue={class:"w-100 t-right"},me={class:"pd-small cols-2 br-t br-black-transp-10 br-solid"},pe=r(()=>e.createElementVNode("p",{class:"t-medium p-medium"}," Address ",-1)),_e={class:"w-100 t-right"},he={class:"pd-small cols-2 br-t br-black-transp-10 br-solid"},be=r(()=>e.createElementVNode("p",{class:"mn-b-small t-medium p-medium"}," Delivery ",-1)),ve={class:"w-100 t-right mn-b-small"},ge={key:2,class:"t-transp"},fe={class:"bg-grey radius-big pd-medium mn-r-bold pd-r-big br-right-dark w-100"},Ne=r(()=>e.createElementVNode("h3",{class:"mn-b-small"},"Order Summary",-1)),Ve={class:"flex gap-thin flex-column mn-b-semi"},ye={class:"mn-b-medium radius-small br-solid br-1px br-black-transp-10 w-100"},Ee={class:"pd-small br-solid br-b br-black-transp-10 flex"},ke=r(()=>e.createElementVNode("p",{class:"mn-r-auto t-transp"},"In total",-1)),we={class:"pd-small br-solid br-b br-black-transp-10 flex"},Se=r(()=>e.createElementVNode("p",{class:"mn-r-auto t-transp"},"Delivery",-1)),xe={class:"pd-small flex-bottom flex"},Ce=r(()=>e.createElementVNode("p",{class:"mn-r-auto t-transp"},"In total to pay",-1)),Be={class:"p-big t-semi"},De=r(()=>e.createElementVNode("h3",{class:"mn-b-small"},"Chat With Us",-1)),qe={__name:"OrderBackoffice",setup(b){C.useRouter();const _=C.useRoute(),s=e.ref(null),v=e.ref(null),n=e.ref(null),o=["created","confirmed","packing","in delivery","delivered"],V=["Created","Confirmed","Packing","In Delivery","Delivered"],g=t=>o.slice(t).includes(s.value.status),f=e.ref(!1),y=e.ref(null),N=e.ref([]);function D(t){f.value=!0,typeof t=="number"&&(y.value=t)}function E(){f.value=!1,y.value=null}e.onMounted(async()=>{var a,l;s.value=await d.actions.read({_id:_.params.order}),s.value=s.value[0],v.value=await R.actions.read({organization:s.value.owner.target._id,limit:1e3}),console.log(v.value);const t=v.value.reduce((u,m)=>(u[m._id]=m,u),{});console.log(t),N.value=s.value.positions.map(({_id:u,quantity:m})=>{const p=t[u];return{name:p.name,images:p.images,price:p.price,_id:p._id,quantity:m}}),n.value=await T.actions.read({_id:(a=s.value)==null?void 0:a.owner.target._id,location:(l=L.state.position)==null?void 0:l.location})});let k=e.computed(()=>{var t;return Number((t=s.value)==null?void 0:t.positions.reduce((a,l)=>a+l.price*l.quantity,0))});e.computed(()=>{var t;return Number((t=s.value)==null?void 0:t.positions.reduce((a,l)=>a+l.quantity,0))});function h(t){const a=o.indexOf(t);return a!==-1&&a+1<o.length?o[a+1]:null}function w(t){const a=o.indexOf(t);return t?V[a]:""}async function q(){const t=h(d.state.current.status);t?(d.state.current.status=t,await d.actions.update(d.state.current)):console.error("Next status is void. Must handle somehow."),E()}return(t,a)=>{var l,u,m,p,S,x;return s.value&&n.value?(e.openBlock(),e.createElementBlock("div",H,[s.value?(e.openBlock(),e.createElementBlock("div",U,[e.createElementVNode("div",W,[e.createElementVNode("p",j,[e.createTextVNode(" Order No: "),e.createElementVNode("span",G,"#"+e.toDisplayString(s.value._id),1)])]),e.createElementVNode("div",J,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(o,(i,c)=>e.createElementVNode("div",{key:c,class:"w-20"},[e.createElementVNode("div",{class:e.normalizeClass(["bg-grey br-anim br-glow radius-extra h-1r w-100",{"br-glow-anim":g(c)},{"t-transp":!g(c)},{blink:s.value.status===o[c]&&h(s.value.status)}])},null,2),e.createElementVNode("div",{class:e.normalizeClass([{"t-transp":!g(c)},"mn-t-thin p-small t-medium uppercase"])},e.toDisplayString(V[c]),3)])),64))])])):e.createCommentVNode("",!0),e.createElementVNode("div",K,[e.createElementVNode("div",Q,[e.createVNode(I.default,{class:"i-semi t-transp",fill:"rgb(var(--black)"}),e.createElementVNode("p",X,[Y,Z,e.createTextVNode(e.toDisplayString(t.formatDate(s.value.deadline)),1)])]),h(s.value.status)&&e.unref(_).name==="Order Edit"?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:D,class:"mn-l-auto bg-black t-white button"}," Mark as "+e.toDisplayString(w(h(s.value.status))),1)):e.createCommentVNode("",!0)]),e.createVNode(P.default,{title:"Change status",onClosePopup:E,isPopupOpen:f.value,class:"bg-white w-min-30r w-max-30r radius-big pd-big"},{default:e.withCtx(()=>[e.createVNode(e.unref(O.default),{modelValue:s.value.deadline,"onUpdate:modelValue":a[0]||(a[0]=i=>s.value.deadline=i),"hide-navigation":["calendar"],flow:["time"],class:"z-index-3 bg-grey radius-small pd-small mn-b-thin mn-b-semi"},null,8,["modelValue"]),$,e.createElementVNode("ul",ee,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(N.value,(i,c)=>(e.openBlock(),e.createBlock(B.default,{key:i._id,editable:!1,product:i},null,8,["product"]))),128))]),e.createElementVNode("button",{onClick:q,class:"w-100 bg-black-small t-white button"},e.toDisplayString("Confirm Changing to "+w(h(s.value.status))),1)]),_:1},8,["isPopupOpen"]),s.value?(e.openBlock(),e.createElementBlock("div",te,[e.createElementVNode("div",se,[n.value[0]?(e.openBlock(),e.createBlock(z.default,{key:0,organization:n.value[0],showRating:!0,showFollowers:!1,showProducts:!1,class:"bg-grey mn-b-thin w-100 o-hidden radius-big pd-small"},null,8,["organization"])):e.createCommentVNode("",!0),e.createElementVNode("div",ae,[e.createElementVNode("div",re,[e.createElementVNode("div",le,[ne,oe,e.createElementVNode("p",ie,e.toDisplayString(t.formatDate(s.value.createdAt)),1)])]),e.createElementVNode("div",ce,[de,e.createElementVNode("p",ue,e.toDisplayString(((l=s.value.customer.target)==null?void 0:l.number)||"Not specified"),1)]),e.createElementVNode("div",me,[pe,e.createElementVNode("p",_e,e.toDisplayString(s.value.delivery.address?s.value.delivery.address.slice(0,64):"Not specified"),1)]),e.createElementVNode("div",he,[be,e.createElementVNode("p",ve,e.toDisplayString(s.value.delivery.type?s.value.delivery.type:"Not specified"),1)])]),d.state.current.status_history?(e.openBlock(),e.createBlock(F.default,{key:1,statuses:o,statusHistory:d.state.current.status_history,statusCurrent:d.state.current.status,edit:e.unref(_).name==="Order Edit"},null,8,["statusHistory","statusCurrent","edit"])):e.createCommentVNode("",!0),t.payment&&t.payment.Status==="CONFIRMED"?(e.openBlock(),e.createElementBlock("span",ge,"Paid")):e.createCommentVNode("",!0)]),e.createElementVNode("div",fe,[Ne,e.createElementVNode("ul",Ve,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(N.value,(i,c)=>(e.openBlock(),e.createBlock(B.default,{key:i._id,editable:!1,product:i},null,8,["product"]))),128))]),e.createElementVNode("div",ye,[e.createElementVNode("div",Ee,[ke,e.createElementVNode("p",null,e.toDisplayString(e.unref(k))+" "+e.toDisplayString(t.returnCurrency()),1)]),e.createElementVNode("div",we,[Se,e.createElementVNode("p",null,e.toDisplayString(t.returnCurrency())+" "+e.toDisplayString(Math.trunc(100+20*((u=n.value[0])==null?void 0:u.distance)-7,5*(((m=n.value[0])==null?void 0:m.distance)/10))),1)]),e.createElementVNode("div",xe,[Ce,e.createElementVNode("p",Be,e.toDisplayString(t.returnCurrency())+" "+e.toDisplayString(Math.trunc(100+20*((p=n.value[0])==null?void 0:p.distance)-7,5*(((S=n.value[0])==null?void 0:S.distance)/10))+e.unref(k)),1)])]),De,e.createVNode(M.default,{username:e.unref(_).name==="Order Status"?((x=s.value.user)==null?void 0:x.name)||"User":"Weeder Support",chatID:e.unref(_).params.order,class:"radius-semi bg-white o-hidden"},null,8,["username","chatID"])])])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)}}},Oe=A.default(qe,[["__scopeId","data-v-ec5fc79c"]]);exports.default=Oe;
@@ -1,62 +1,52 @@
1
- import { ref as v, onMounted as G, computed as q, openBlock as l, createElementBlock as o, createVNode as x, createElementVNode as s, createTextVNode as O, toDisplayString as a, Fragment as N, renderList as $, normalizeClass as H, unref as g, createCommentVNode as m, withCtx as J, createBlock as C, pushScopeId as K, popScopeId as X } from "vue";
2
- import { useRouter as Z, useRoute as ss } from "vue-router";
3
- import ts from "../../../globals/components/sections/SectionPageTitle.vue.js";
4
- import es from "../../../../components/Popup/Popup.vue.js";
5
- import as from "../../../icons/entities/IconTime.vue.js";
6
- import W from "../blocks/CardOrderItem.vue.js";
7
- import rs from "../../../organizations/components/blocks/CardOrganization.vue.js";
8
- import ls from "../../../chats/components/pages/ChatPage.vue.js";
9
- import ns from "../blocks/StatusHistory.vue.js";
10
- import { state as is } from "../../../globals/store/globals.js";
11
- import { actions as Q, state as f } from "../../store/orders.js";
12
- import { actions as os } from "../../../products/store/products.js";
13
- import { actions as us } from "../../../organizations/store/organizations.js";
1
+ import { ref as f, onMounted as W, computed as R, openBlock as i, createElementBlock as m, createElementVNode as t, createTextVNode as F, toDisplayString as l, Fragment as I, renderList as D, normalizeClass as L, createCommentVNode as b, createVNode as x, unref as v, withCtx as j, createBlock as C, pushScopeId as G, popScopeId as J } from "vue";
2
+ import { useRouter as K, useRoute as Q } from "vue-router";
3
+ import X from "../../../../../node_modules/@vuepic/vue-datepicker/dist/vue-datepicker.js";
4
+ import "../../../../../node_modules/@vuepic/vue-datepicker/dist/main.css.js";
5
+ import "../../../../components/Tab/Tab.vue.js";
6
+ import Y from "../../../../components/Popup/Popup.vue.js";
7
+ import Z from "../../../icons/entities/IconTime.vue.js";
8
+ import T from "../blocks/CardOrderItem.vue.js";
9
+ import tt from "../../../organizations/components/blocks/CardOrganization.vue.js";
10
+ import st from "../../../chats/components/pages/ChatPage.vue.js";
11
+ import et from "../blocks/StatusHistory.vue.js";
12
+ import { state as at } from "../../../globals/store/globals.js";
13
+ import { actions as U, state as g } from "../../store/orders.js";
14
+ import { actions as lt } from "../../../products/store/products.js";
15
+ import { actions as rt } from "../../../organizations/store/organizations.js";
14
16
  import "./OrderBackoffice.vue2.js";
15
- import ds from "../../../../../../_virtual/_plugin-vue_export-helper.js";
16
- const n = (k) => (K("data-v-36d45d04"), k = k(), X(), k), cs = {
17
+ import it from "../../../../../../_virtual/_plugin-vue_export-helper.js";
18
+ const r = (k) => (G("data-v-ec5fc79c"), k = k(), J(), k), nt = {
17
19
  key: 0,
18
20
  class: "pd-thin"
19
- }, ms = {
21
+ }, ot = {
20
22
  key: 0,
21
- class: "mn-b-thin pos-relative w-100 bg-main radius-big pd-big"
22
- }, ps = { class: "mn-b-small flex-nowrap flex" }, _s = /* @__PURE__ */ n(() => /* @__PURE__ */ s("p", { class: "t-medium p-medium mn-r-auto" }, " Progress ", -1)), hs = { class: "t-medium p-medium" }, bs = { class: "p-small t-transp" }, vs = /* @__PURE__ */ n(() => /* @__PURE__ */ s("h2", { class: "mn-b-small" }, null, -1)), gs = { class: "radius-extra mn-b-medium flex-nowrap flex pos-relative" }, fs = { class: "flex-nowrap flex" }, ys = { class: "w-max flex-v-center gap-thin flex-nowrap flex pd-thin radius-small bg-white-transp-20" }, ws = { class: "t-medium mn-r-auto" }, ks = { class: "bg-grey radius-small pd-small mn-b-thin" }, xs = { class: "bg-grey pd-small radius-small flex gap-thin flex-column mn-b-semi" }, Cs = {
23
+ class: "mn-b-thin pos-relative w-100 bg-main radius-big pd-medium"
24
+ }, dt = { class: "mn-b-small flex-nowrap flex" }, ut = { class: "t-medium p-medium" }, ct = { class: "p-small t-transp" }, mt = { class: "flex-nowrap flex gap-thin pos-relative" }, pt = { class: "bg-grey mn-b-thin pd-thin radius-extra flex-nowrap flex" }, _t = { class: "w-max flex-v-center gap-thin flex-nowrap flex pd-thin radius-small bg-white-transp-20" }, ht = { class: "t-medium mn-r-auto" }, bt = /* @__PURE__ */ r(() => /* @__PURE__ */ t("span", { class: "p-small t-transp" }, "Estimated Arrival", -1)), vt = /* @__PURE__ */ r(() => /* @__PURE__ */ t("br", null, null, -1)), ft = /* @__PURE__ */ r(() => /* @__PURE__ */ t("p", { class: "t-medium p-medium mn-b-thin" }, " Positions ", -1)), gt = { class: "bg-grey pd-small radius-small flex gap-thin flex-column mn-b-semi" }, wt = {
23
25
  key: 1,
24
26
  class: "gap-thin cols-2"
25
- }, Os = { class: "w-100" }, Ss = { class: "mn-b-thin bg-grey w-100 o-hidden radius-medium" }, Ps = { class: "pd-small flex-nowrap flex" }, Is = { class: "mn-r-auto" }, Ds = /* @__PURE__ */ n(() => /* @__PURE__ */ s("span", { class: "d-block t-medium p-medium" }, "Your order is", -1)), Ns = { class: "t-lh-075 h2 d-block mn-b-small" }, $s = /* @__PURE__ */ n(() => /* @__PURE__ */ s("p", { class: "pd-t-nano pd-b-nano pd-r-thin pd-l-thin radius-extra bg-black t-white w-max" }, "as on 29 aug 2021, Friday", -1)), Es = /* @__PURE__ */ n(() => /* @__PURE__ */ s("div", { class: "t-right" }, [
26
- /* @__PURE__ */ O(" Cancel order"),
27
- /* @__PURE__ */ s("br"),
28
- /* @__PURE__ */ O(" Exchange item "),
29
- /* @__PURE__ */ s("hr", { class: "mn-b-thin mn-t-thin" }),
30
- /* @__PURE__ */ O(" For Delivery Queries Contact Us ")
31
- ], -1)), Ms = { class: "pd-small cols-2 br-t br-black-transp-10 br-solid" }, zs = /* @__PURE__ */ n(() => /* @__PURE__ */ s("p", { class: "w-100 t-medium p-medium" }, " Phone ", -1)), Bs = { class: "w-100 t-right" }, Fs = {
32
- key: 0,
33
- class: "pd-small cols-2 br-t br-black-transp-10 br-solid"
34
- }, As = { class: "w-100 t-medium p-medium" }, Rs = { class: "w-100 t-right" }, Vs = /* @__PURE__ */ n(() => /* @__PURE__ */ s("div", { class: "pd-small cols-2 br-t br-black-transp-10 br-solid" }, [
35
- /* @__PURE__ */ s("p", { class: "t-medium p-medium" }, " Address "),
36
- /* @__PURE__ */ s("p", { class: "w-100 t-right" })
37
- ], -1)), Ls = { class: "pd-small cols-2 br-t br-black-transp-10 br-solid" }, Ts = /* @__PURE__ */ n(() => /* @__PURE__ */ s("p", { class: "mn-b-small t-medium p-medium" }, " Delivery ", -1)), Us = { class: "w-100 t-right mn-b-small" }, qs = {
27
+ }, yt = { class: "w-100" }, kt = { class: "mn-b-thin bg-grey w-100 o-hidden radius-medium" }, xt = { class: "pd-small flex-nowrap flex" }, Ct = { class: "mn-r-auto" }, Ot = /* @__PURE__ */ r(() => /* @__PURE__ */ t("span", { class: "d-block t-medium p-medium" }, "Order is", -1)), St = /* @__PURE__ */ r(() => /* @__PURE__ */ t("span", { class: "t-lh-075 h2 d-block mn-b-small" }, "created", -1)), Nt = { class: "pd-t-nano pd-b-nano pd-r-thin pd-l-thin radius-extra bg-black t-white w-max" }, Pt = { class: "pd-small cols-2 br-t br-black-transp-10 br-solid" }, It = /* @__PURE__ */ r(() => /* @__PURE__ */ t("p", { class: "w-100 t-medium p-medium" }, " Phone ", -1)), Dt = { class: "w-100 t-right" }, Mt = { class: "pd-small cols-2 br-t br-black-transp-10 br-solid" }, $t = /* @__PURE__ */ r(() => /* @__PURE__ */ t("p", { class: "t-medium p-medium" }, " Address ", -1)), zt = { class: "w-100 t-right" }, Et = { class: "pd-small cols-2 br-t br-black-transp-10 br-solid" }, Vt = /* @__PURE__ */ r(() => /* @__PURE__ */ t("p", { class: "mn-b-small t-medium p-medium" }, " Delivery ", -1)), Bt = { class: "w-100 t-right mn-b-small" }, At = {
38
28
  key: 2,
39
29
  class: "t-transp"
40
- }, Hs = { class: "bg-grey radius-big pd-medium mn-r-bold pd-r-big br-right-dark w-100" }, Ws = /* @__PURE__ */ n(() => /* @__PURE__ */ s("h3", { class: "mn-b-small" }, "Order Summary", -1)), Qs = { class: "flex gap-thin flex-column mn-b-semi" }, Ys = { class: "mn-b-medium radius-small br-solid br-1px br-black-transp-10 w-100" }, js = { class: "pd-small br-solid br-b br-black-transp-10 flex" }, Gs = /* @__PURE__ */ n(() => /* @__PURE__ */ s("p", { class: "mn-r-auto t-transp" }, "In total", -1)), Js = { class: "pd-small br-solid br-b br-black-transp-10 flex" }, Ks = /* @__PURE__ */ n(() => /* @__PURE__ */ s("p", { class: "mn-r-auto t-transp" }, "Delivery", -1)), Xs = { class: "pd-small flex-bottom flex" }, Zs = /* @__PURE__ */ n(() => /* @__PURE__ */ s("p", { class: "mn-r-auto t-transp" }, "In total to pay", -1)), st = { class: "p-big t-semi" }, tt = /* @__PURE__ */ n(() => /* @__PURE__ */ s("h3", { class: "mn-b-small" }, "Chat With Us", -1)), et = {
30
+ }, Rt = { class: "bg-grey radius-big pd-medium mn-r-bold pd-r-big br-right-dark w-100" }, Ft = /* @__PURE__ */ r(() => /* @__PURE__ */ t("h3", { class: "mn-b-small" }, "Order Summary", -1)), Lt = { class: "flex gap-thin flex-column mn-b-semi" }, Tt = { class: "mn-b-medium radius-small br-solid br-1px br-black-transp-10 w-100" }, Ut = { class: "pd-small br-solid br-b br-black-transp-10 flex" }, qt = /* @__PURE__ */ r(() => /* @__PURE__ */ t("p", { class: "mn-r-auto t-transp" }, "In total", -1)), Ht = { class: "pd-small br-solid br-b br-black-transp-10 flex" }, Wt = /* @__PURE__ */ r(() => /* @__PURE__ */ t("p", { class: "mn-r-auto t-transp" }, "Delivery", -1)), jt = { class: "pd-small flex-bottom flex" }, Gt = /* @__PURE__ */ r(() => /* @__PURE__ */ t("p", { class: "mn-r-auto t-transp" }, "In total to pay", -1)), Jt = { class: "p-big t-semi" }, Kt = /* @__PURE__ */ r(() => /* @__PURE__ */ t("h3", { class: "mn-b-small" }, "Chat With Us", -1)), Qt = {
41
31
  __name: "OrderBackoffice",
42
32
  setup(k) {
43
- Z();
44
- const y = ss(), e = v(null), S = v(null), u = v(null), d = ["created", "confirmed", "packing", "in delivery", "delivered"], E = ["Order Confirming", "Order Confirmed", "Packing", "In Delivery", "Delivered"], P = (t) => d.slice(t).includes(e.value.status), I = v(!1), M = v(null), D = v([]);
45
- function Y(t) {
46
- I.value = !0, typeof t == "number" && (M.value = t);
33
+ K();
34
+ const w = Q(), e = f(null), O = f(null), o = f(null), d = ["created", "confirmed", "packing", "in delivery", "delivered"], M = ["Created", "Confirmed", "Packing", "In Delivery", "Delivered"], S = (s) => d.slice(s).includes(e.value.status), N = f(!1), $ = f(null), P = f([]);
35
+ function q(s) {
36
+ N.value = !0, typeof s == "number" && ($.value = s);
47
37
  }
48
38
  function z() {
49
- I.value = !1, M.value = null;
39
+ N.value = !1, $.value = null;
50
40
  }
51
- G(async () => {
52
- var r, i;
53
- e.value = await Q.read({ _id: y.params.order }), e.value = e.value[0], S.value = await os.read({
41
+ W(async () => {
42
+ var a, n;
43
+ e.value = await U.read({ _id: w.params.order }), e.value = e.value[0], O.value = await lt.read({
54
44
  organization: e.value.owner.target._id,
55
45
  limit: 1e3
56
- }), console.log(S.value);
57
- const t = S.value.reduce((p, _) => (p[_._id] = _, p), {});
58
- console.log(t), D.value = e.value.positions.map(({ _id: p, quantity: _ }) => {
59
- const h = t[p];
46
+ }), console.log(O.value);
47
+ const s = O.value.reduce((p, _) => (p[_._id] = _, p), {});
48
+ console.log(s), P.value = e.value.positions.map(({ _id: p, quantity: _ }) => {
49
+ const h = s[p];
60
50
  return {
61
51
  name: h.name,
62
52
  images: h.images,
@@ -64,179 +54,182 @@ const n = (k) => (K("data-v-36d45d04"), k = k(), X(), k), cs = {
64
54
  _id: h._id,
65
55
  quantity: _
66
56
  };
67
- }), u.value = await us.read({
68
- _id: (r = e.value) == null ? void 0 : r.owner.target._id,
69
- location: (i = is.position) == null ? void 0 : i.location
57
+ }), o.value = await rt.read({
58
+ _id: (a = e.value) == null ? void 0 : a.owner.target._id,
59
+ location: (n = at.position) == null ? void 0 : n.location
70
60
  });
71
61
  });
72
- let B = q(() => {
73
- var t;
74
- return Number((t = e.value) == null ? void 0 : t.positions.reduce((r, i) => r + i.price * i.quantity, 0));
62
+ let E = R(() => {
63
+ var s;
64
+ return Number((s = e.value) == null ? void 0 : s.positions.reduce((a, n) => a + n.price * n.quantity, 0));
75
65
  });
76
- q(() => {
77
- var t;
78
- return Number((t = e.value) == null ? void 0 : t.positions.reduce((r, i) => r + i.quantity, 0));
66
+ R(() => {
67
+ var s;
68
+ return Number((s = e.value) == null ? void 0 : s.positions.reduce((a, n) => a + n.quantity, 0));
79
69
  });
80
- function w(t) {
81
- const r = d.indexOf(t);
82
- return r !== -1 && r + 1 < d.length ? d[r + 1] : null;
70
+ function y(s) {
71
+ const a = d.indexOf(s);
72
+ return a !== -1 && a + 1 < d.length ? d[a + 1] : null;
83
73
  }
84
- function F(t) {
85
- const r = d.indexOf(t);
86
- return t ? E[r] : "";
74
+ function V(s) {
75
+ const a = d.indexOf(s);
76
+ return s ? M[a] : "";
87
77
  }
88
- async function j() {
89
- const t = w(f.current.status);
90
- t ? (f.current.status = t, await Q.update(f.current)) : console.error("Next status is void. Must handle somehow."), z();
78
+ async function H() {
79
+ const s = y(g.current.status);
80
+ s ? (g.current.status = s, await U.update(g.current)) : console.error("Next status is void. Must handle somehow."), z();
91
81
  }
92
- return (t, r) => {
93
- var i, p, _, h, A, R, V, L, T, U;
94
- return e.value && u.value ? (l(), o("div", cs, [
95
- x(ts, {
96
- title: `Order is ${e.value.status}`,
97
- class: "mn-b-small bg-grey bg-grey radius-big"
98
- }, null, 8, ["title"]),
99
- e.value ? (l(), o("div", ms, [
100
- s("div", ps, [
101
- _s,
102
- s("p", hs, [
103
- O(" Order No: "),
104
- s("span", bs, "#" + a(e.value._id), 1)
82
+ return (s, a) => {
83
+ var n, p, _, h, B, A;
84
+ return e.value && o.value ? (i(), m("div", nt, [
85
+ e.value ? (i(), m("div", ot, [
86
+ t("div", dt, [
87
+ t("p", ut, [
88
+ F(" Order No: "),
89
+ t("span", ct, "#" + l(e.value._id), 1)
105
90
  ])
106
91
  ]),
107
- vs,
108
- s("div", gs, [
109
- (l(), o(N, null, $(d, (b, c) => s("div", {
92
+ t("div", mt, [
93
+ (i(), m(I, null, D(d, (u, c) => t("div", {
110
94
  key: c,
111
- class: "mn-r-thin w-20"
95
+ class: "w-20"
112
96
  }, [
113
- s("div", {
114
- class: H([
97
+ t("div", {
98
+ class: L([
115
99
  "bg-grey br-anim br-glow radius-extra h-1r w-100",
116
- { "br-glow-anim": P(c) },
117
- { "t-transp": !P(c) },
118
- { blink: e.value.status === d[c] && w(e.value.status) }
100
+ { "br-glow-anim": S(c) },
101
+ { "t-transp": !S(c) },
102
+ { blink: e.value.status === d[c] && y(e.value.status) }
119
103
  ])
120
104
  }, null, 2),
121
- s("div", {
122
- class: H([{ "t-transp": !P(c) }, "mn-t-thin t-medium uppercase"])
123
- }, a(E[c]), 3)
105
+ t("div", {
106
+ class: L([{ "t-transp": !S(c) }, "mn-t-thin p-small t-medium uppercase"])
107
+ }, l(M[c]), 3)
124
108
  ])), 64))
125
- ]),
126
- s("div", fs, [
127
- s("div", ys, [
128
- x(as, {
129
- class: "i-semi t-transp",
130
- fill: "rgb(var(--black)"
131
- }),
132
- s("p", ws, "Estimated Arrival " + a(t.formatDate(e.value.deadline)), 1)
133
- ]),
134
- w(e.value.status) && g(y).name === "Order Edit" ? (l(), o("button", {
135
- key: 0,
136
- onClick: Y,
137
- class: "mn-l-auto bg-black t-white button"
138
- }, " Mark as " + a(F(w(e.value.status))), 1)) : m("", !0)
139
109
  ])
140
- ])) : m("", !0),
141
- x(es, {
110
+ ])) : b("", !0),
111
+ t("div", pt, [
112
+ t("div", _t, [
113
+ x(Z, {
114
+ class: "i-semi t-transp",
115
+ fill: "rgb(var(--black)"
116
+ }),
117
+ t("p", ht, [
118
+ bt,
119
+ vt,
120
+ F(l(s.formatDate(e.value.deadline)), 1)
121
+ ])
122
+ ]),
123
+ y(e.value.status) && v(w).name === "Order Edit" ? (i(), m("button", {
124
+ key: 0,
125
+ onClick: q,
126
+ class: "mn-l-auto bg-black t-white button"
127
+ }, " Mark as " + l(V(y(e.value.status))), 1)) : b("", !0)
128
+ ]),
129
+ x(Y, {
142
130
  title: "Change status",
143
131
  onClosePopup: z,
144
- isPopupOpen: I.value,
132
+ isPopupOpen: N.value,
145
133
  class: "bg-white w-min-30r w-max-30r radius-big pd-big"
146
134
  }, {
147
- default: J(() => [
148
- s("p", ks, "Estimated Arrival " + a(t.formatDate(e.value.deadline)), 1),
149
- s("ul", xs, [
150
- (l(!0), o(N, null, $(D.value, (b, c) => (l(), C(W, {
151
- key: b._id,
135
+ default: j(() => [
136
+ x(v(X), {
137
+ modelValue: e.value.deadline,
138
+ "onUpdate:modelValue": a[0] || (a[0] = (u) => e.value.deadline = u),
139
+ "hide-navigation": ["calendar"],
140
+ flow: ["time"],
141
+ class: "z-index-3 bg-grey radius-small pd-small mn-b-thin mn-b-semi"
142
+ }, null, 8, ["modelValue"]),
143
+ ft,
144
+ t("ul", gt, [
145
+ (i(!0), m(I, null, D(P.value, (u, c) => (i(), C(T, {
146
+ key: u._id,
152
147
  editable: !1,
153
- product: b
148
+ product: u
154
149
  }, null, 8, ["product"]))), 128))
155
150
  ]),
156
- s("button", {
157
- onClick: j,
151
+ t("button", {
152
+ onClick: H,
158
153
  class: "w-100 bg-black-small t-white button"
159
- }, a("Confirm Changing to " + F(w(e.value.status))), 1)
154
+ }, l("Confirm Changing to " + V(y(e.value.status))), 1)
160
155
  ]),
161
156
  _: 1
162
157
  }, 8, ["isPopupOpen"]),
163
- e.value ? (l(), o("div", Cs, [
164
- s("div", Os, [
165
- u.value[0] ? (l(), C(rs, {
158
+ e.value ? (i(), m("div", wt, [
159
+ t("div", yt, [
160
+ o.value[0] ? (i(), C(tt, {
166
161
  key: 0,
167
- organization: u.value[0],
162
+ organization: o.value[0],
168
163
  showRating: !0,
169
164
  showFollowers: !1,
170
165
  showProducts: !1,
171
166
  class: "bg-grey mn-b-thin w-100 o-hidden radius-big pd-small"
172
- }, null, 8, ["organization"])) : m("", !0),
173
- s("div", Ss, [
174
- s("div", Ps, [
175
- s("div", Is, [
176
- Ds,
177
- s("span", Ns, a(e.value.status), 1),
178
- $s
179
- ]),
180
- Es
167
+ }, null, 8, ["organization"])) : b("", !0),
168
+ t("div", kt, [
169
+ t("div", xt, [
170
+ t("div", Ct, [
171
+ Ot,
172
+ St,
173
+ t("p", Nt, l(s.formatDate(e.value.createdAt)), 1)
174
+ ])
175
+ ]),
176
+ t("div", Pt, [
177
+ It,
178
+ t("p", Dt, l(((n = e.value.customer.target) == null ? void 0 : n.number) || "Not specified"), 1)
181
179
  ]),
182
- s("div", Ms, [
183
- zs,
184
- s("p", Bs, a((i = e.value.user) == null ? void 0 : i.number), 1)
180
+ t("div", Mt, [
181
+ $t,
182
+ t("p", zt, l(e.value.delivery.address ? e.value.delivery.address.slice(0, 64) : "Not specified"), 1)
185
183
  ]),
186
- (p = e.value.user) != null && p.messenger.type ? (l(), o("div", Fs, [
187
- s("p", As, a((_ = e.value.user) == null ? void 0 : _.messenger.type), 1),
188
- s("p", Rs, a((h = e.value.user) == null ? void 0 : h.messenger.value), 1)
189
- ])) : m("", !0),
190
- Vs,
191
- s("div", Ls, [
192
- Ts,
193
- s("p", Us, a((A = e.value.delivery) == null ? void 0 : A.type), 1)
184
+ t("div", Et, [
185
+ Vt,
186
+ t("p", Bt, l(e.value.delivery.type ? e.value.delivery.type : "Not specified"), 1)
194
187
  ])
195
188
  ]),
196
- f.current.status_history ? (l(), C(ns, {
189
+ g.current.status_history ? (i(), C(et, {
197
190
  key: 1,
198
191
  statuses: d,
199
- statusHistory: f.current.status_history,
200
- statusCurrent: f.current.status,
201
- edit: g(y).name === "Order Edit"
202
- }, null, 8, ["statusHistory", "statusCurrent", "edit"])) : m("", !0),
203
- t.payment && t.payment.Status === "CONFIRMED" ? (l(), o("span", qs, "Paid")) : m("", !0)
192
+ statusHistory: g.current.status_history,
193
+ statusCurrent: g.current.status,
194
+ edit: v(w).name === "Order Edit"
195
+ }, null, 8, ["statusHistory", "statusCurrent", "edit"])) : b("", !0),
196
+ s.payment && s.payment.Status === "CONFIRMED" ? (i(), m("span", At, "Paid")) : b("", !0)
204
197
  ]),
205
- s("div", Hs, [
206
- Ws,
207
- s("ul", Qs, [
208
- (l(!0), o(N, null, $(D.value, (b, c) => (l(), C(W, {
209
- key: b._id,
198
+ t("div", Rt, [
199
+ Ft,
200
+ t("ul", Lt, [
201
+ (i(!0), m(I, null, D(P.value, (u, c) => (i(), C(T, {
202
+ key: u._id,
210
203
  editable: !1,
211
- product: b
204
+ product: u
212
205
  }, null, 8, ["product"]))), 128))
213
206
  ]),
214
- s("div", Ys, [
215
- s("div", js, [
216
- Gs,
217
- s("p", null, a(g(B)) + " " + a(t.returnCurrency()), 1)
207
+ t("div", Tt, [
208
+ t("div", Ut, [
209
+ qt,
210
+ t("p", null, l(v(E)) + " " + l(s.returnCurrency()), 1)
218
211
  ]),
219
- s("div", Js, [
220
- Ks,
221
- s("p", null, a(t.returnCurrency()) + " " + a(Math.trunc(100 + 20 * ((R = u.value[0]) == null ? void 0 : R.distance) - 7, 5 * (((V = u.value[0]) == null ? void 0 : V.distance) / 10))), 1)
212
+ t("div", Ht, [
213
+ Wt,
214
+ t("p", null, l(s.returnCurrency()) + " " + l(Math.trunc(100 + 20 * ((p = o.value[0]) == null ? void 0 : p.distance) - 7, 5 * (((_ = o.value[0]) == null ? void 0 : _.distance) / 10))), 1)
222
215
  ]),
223
- s("div", Xs, [
224
- Zs,
225
- s("p", st, a(t.returnCurrency()) + " " + a(Math.trunc(100 + 20 * ((L = u.value[0]) == null ? void 0 : L.distance) - 7, 5 * (((T = u.value[0]) == null ? void 0 : T.distance) / 10)) + g(B)), 1)
216
+ t("div", jt, [
217
+ Gt,
218
+ t("p", Jt, l(s.returnCurrency()) + " " + l(Math.trunc(100 + 20 * ((h = o.value[0]) == null ? void 0 : h.distance) - 7, 5 * (((B = o.value[0]) == null ? void 0 : B.distance) / 10)) + v(E)), 1)
226
219
  ])
227
220
  ]),
228
- tt,
229
- x(ls, {
230
- username: g(y).name === "Order Status" ? ((U = e.value.user) == null ? void 0 : U.name) || "User" : "Weeder Support",
231
- chatID: g(y).params.order,
221
+ Kt,
222
+ x(st, {
223
+ username: v(w).name === "Order Status" ? ((A = e.value.user) == null ? void 0 : A.name) || "User" : "Weeder Support",
224
+ chatID: v(w).params.order,
232
225
  class: "radius-semi bg-white o-hidden"
233
226
  }, null, 8, ["username", "chatID"])
234
227
  ])
235
- ])) : m("", !0)
236
- ])) : m("", !0);
228
+ ])) : b("", !0)
229
+ ])) : b("", !0);
237
230
  };
238
231
  }
239
- }, gt = /* @__PURE__ */ ds(et, [["__scopeId", "data-v-36d45d04"]]);
232
+ }, _s = /* @__PURE__ */ it(Qt, [["__scopeId", "data-v-ec5fc79c"]]);
240
233
  export {
241
- gt as default
234
+ _s as default
242
235
  };