@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,27 +1,15 @@
1
1
  <template>
2
2
  <div v-if="order && orderOrganization" class="pd-thin">
3
-
4
- <SectionPageTitle
5
- :title="`Order is ${order.status}`"
6
- class="mn-b-small bg-grey bg-grey radius-big"
7
- />
8
3
 
9
- <div v-if="order" class="mn-b-thin pos-relative w-100 bg-main radius-big pd-big">
4
+ <div v-if="order" class="mn-b-thin pos-relative w-100 bg-main radius-big pd-medium">
10
5
  <div class="mn-b-small flex-nowrap flex">
11
- <p class="t-medium p-medium mn-r-auto">
12
- Progress
13
- </p>
14
-
15
6
  <p class="t-medium p-medium">
16
- Order No: <span class="p-small t-transp">#{{order._id}}</span>
17
- </p>
18
- </div>
19
-
7
+ Order No: <span class="p-small t-transp">#{{order._id}}</span>
8
+ </p>
9
+ </div>
20
10
 
21
- <h2 class="mn-b-small"></h2>
22
-
23
- <div class="radius-extra mn-b-medium flex-nowrap flex pos-relative ">
24
- <div v-for="(status, index) in statuses" :key="index" class="mn-r-thin w-20">
11
+ <div class="flex-nowrap flex gap-thin pos-relative ">
12
+ <div v-for="(status, index) in statuses" :key="index" class="w-20">
25
13
  <div
26
14
  class="bg-grey br-anim br-glow radius-extra h-1r w-100"
27
15
  :class="
@@ -32,21 +20,21 @@
32
20
  />
33
21
  <div
34
22
  :class="{ 't-transp': !isActiveStatus(index) }"
35
- class="mn-t-thin t-medium uppercase">{{ statusLabels[index] }}</div>
23
+ class="mn-t-thin p-small t-medium uppercase">{{ statusLabels[index] }}</div>
36
24
  </div>
37
25
  </div>
26
+ </div>
38
27
 
39
- <div class="flex-nowrap flex">
40
- <div class="w-max flex-v-center gap-thin flex-nowrap flex pd-thin radius-small bg-white-transp-20">
41
- <IconTime class="i-semi t-transp" fill="rgb(var(--black)" />
42
- <p class="t-medium mn-r-auto">Estimated Arrival {{formatDate(order.deadline)}}</p>
43
- </div>
44
-
45
- <button v-if="getNextStatus(order.status) && route.name === 'Order Edit'" @click="openStatusPopup" class="mn-l-auto bg-black t-white button">
46
- Mark as {{ getStatusLabel(getNextStatus(order.status)) }}
47
- </button>
28
+ <div class="bg-grey mn-b-thin pd-thin radius-extra flex-nowrap flex">
29
+ <div class="w-max flex-v-center gap-thin flex-nowrap flex pd-thin radius-small bg-white-transp-20">
30
+ <IconTime class="i-semi t-transp" fill="rgb(var(--black)" />
31
+ <p class="t-medium mn-r-auto"><span class="p-small t-transp">Estimated Arrival</span><br>{{formatDate(order.deadline)}}</p>
48
32
  </div>
49
- </div>
33
+
34
+ <button v-if="getNextStatus(order.status) && route.name === 'Order Edit'" @click="openStatusPopup" class="mn-l-auto bg-black t-white button">
35
+ Mark as {{ getStatusLabel(getNextStatus(order.status)) }}
36
+ </button>
37
+ </div>
50
38
 
51
39
  <Popup
52
40
  title="Change status"
@@ -54,7 +42,13 @@
54
42
  :isPopupOpen="isOpeStatusPopup"
55
43
  class="bg-white w-min-30r w-max-30r radius-big pd-big"
56
44
  >
57
- <p class="bg-grey radius-small pd-small mn-b-thin">Estimated Arrival {{formatDate(order.deadline)}}</p>
45
+
46
+ <VueDatePicker v-model="order.deadline" :hide-navigation="['calendar']" :flow="['time']" class="z-index-3 bg-grey radius-small pd-small mn-b-thin mn-b-semi" />
47
+
48
+ <p class="t-medium p-medium mn-b-thin">
49
+ Positions
50
+ </p>
51
+
58
52
  <ul class="bg-grey pd-small radius-small flex gap-thin flex-column mn-b-semi">
59
53
  <CardOrderItem
60
54
  v-for="(product, index) in orderProducts" :key="product._id"
@@ -89,17 +83,17 @@
89
83
  >
90
84
  <div class="pd-small flex-nowrap flex">
91
85
  <div class="mn-r-auto">
92
- <span class="d-block t-medium p-medium">Your order is</span>
93
- <span class=" t-lh-075 h2 d-block mn-b-small">{{order.status}}</span>
94
- <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</p>
86
+ <span class="d-block t-medium p-medium">Order is</span>
87
+ <span class=" t-lh-075 h2 d-block mn-b-small">created</span>
88
+ <p class="pd-t-nano pd-b-nano pd-r-thin pd-l-thin radius-extra bg-black t-white w-max">{{formatDate(order.createdAt)}}</p>
95
89
  </div>
96
- <div class="t-right">
90
+ <!-- <div class="t-right">
97
91
  Cancel order<br>
98
92
  Exchange item
99
93
  <hr class="mn-b-thin mn-t-thin">
100
94
  For Delivery Queries Contact Us
101
95
 
102
- </div>
96
+ </div> -->
103
97
  </div>
104
98
 
105
99
  <div class="pd-small cols-2 br-t br-black-transp-10 br-solid">
@@ -108,17 +102,7 @@
108
102
  </p>
109
103
 
110
104
  <p class="w-100 t-right ">
111
- {{order.user?.number}}
112
- </p>
113
- </div>
114
-
115
- <div v-if="order.user?.messenger.type" class="pd-small cols-2 br-t br-black-transp-10 br-solid">
116
- <p class="w-100 t-medium p-medium">
117
- {{order.user?.messenger.type}}
118
- </p>
119
-
120
- <p class="w-100 t-right ">
121
- {{order.user?.messenger.value}}
105
+ {{order.customer.target?.number || 'Not specified'}}
122
106
  </p>
123
107
  </div>
124
108
 
@@ -128,7 +112,7 @@
128
112
  </p>
129
113
 
130
114
  <p class="w-100 t-right">
131
- <!-- {{order.delivery?.address.slice(0,64)}} -->
115
+ {{order.delivery.address ? order.delivery.address.slice(0,64) : 'Not specified'}}
132
116
  </p>
133
117
  </div>
134
118
 
@@ -138,7 +122,7 @@
138
122
  </p>
139
123
 
140
124
  <p class="w-100 t-right mn-b-small">
141
- {{order.delivery?.type}}
125
+ {{order.delivery.type ? order.delivery.type : 'Not specified'}}
142
126
  </p>
143
127
  </div>
144
128
 
@@ -210,7 +194,10 @@
210
194
  <script setup="props">
211
195
  import { computed, ref, onMounted } from 'vue'
212
196
  import { useRouter, useRoute } from 'vue-router'
213
-
197
+
198
+ import VueDatePicker from '@vuepic/vue-datepicker';
199
+ import '@vuepic/vue-datepicker/dist/main.css'
200
+
214
201
  import SectionPageTitle from '@pf/src/modules/globals/components/sections/SectionPageTitle.vue'
215
202
 
216
203
  import Popup from "@pf/src/components/Popup/Popup.vue";
@@ -239,7 +226,7 @@
239
226
  const orderOrganization = ref(null)
240
227
 
241
228
  const statuses = ['created', 'confirmed', 'packing', 'in delivery', 'delivered'];
242
- const statusLabels = ['Order Confirming', 'Order Confirmed', 'Packing', 'In Delivery', 'Delivered'];
229
+ const statusLabels = ['Created', 'Confirmed', 'Packing', 'In Delivery', 'Delivered'];
243
230
 
244
231
  const isActiveStatus = (index) => {
245
232
  return statuses.slice(index).includes(order.value.status);
@@ -196,6 +196,7 @@
196
196
  import { computed, ref, defineProps, onMounted, reactive, toRefs, watch } from 'vue'
197
197
  import { useRoute, useRouter } from 'vue-router'
198
198
 
199
+
199
200
  import Field from '@pf/src/components/Field/Field.vue'
200
201
  import Button from "@pf/src/components/Button/Button.vue";
201
202
  import Tab from '@pf/src/components/Tab/Tab.vue'
@@ -225,6 +226,8 @@
225
226
  const route = useRoute()
226
227
  const router = useRouter()
227
228
 
229
+ orders.mutations.resetOrder(orders.state.current)
230
+
228
231
  let cartTotalPrice = computed(() => {
229
232
  return Number(orders.state.current.positions.reduce((total, product) => {
230
233
  return total + product.price * product.quantity;
@@ -261,12 +264,12 @@
261
264
  function onSubmit() {
262
265
 
263
266
  orders.state.current.creator = {
264
- type: 'user',
267
+ type: 'User',
265
268
  target: auth.state.user._id
266
269
  }
267
270
 
268
271
  orders.state.current.owner = {
269
- type: 'organization',
272
+ type: 'Organization',
270
273
  target: route.params._id,
271
274
  }
272
275
 
@@ -287,7 +290,8 @@
287
290
  })
288
291
  }
289
292
 
290
- onMounted(async () => {
293
+ onMounted(() => {
294
+
291
295
  // await orders.actions.fetchOrder(route.params.id) // Implement this action in your store
292
296
 
293
297
  // order.value = orders.state.current
@@ -87,7 +87,7 @@
87
87
 
88
88
  <div class="mn-b-small pd-small bg-white radius-small flex-nowrap flex">
89
89
  <div class="w-100">
90
- <h3 class="mn-b-thin">{{order.customer.target.profile.name || order.customer.target.phone || order.customer.target.email || 'No name'}}</h3>
90
+ <h3 class="mn-b-thin">{{order.customer.target.profile?.name || order.customer.target.phone || order.customer.target.email || 'No name'}}</h3>
91
91
  <p class="t-truncate">{{order.delivery.address || 'Not specified'}}</p>
92
92
  </div>
93
93
 
@@ -1,6 +1,8 @@
1
+ const queryProcessorGlobals = require('@pf/src/modules/globals/controllers/utils/queryProcessor');
2
+
1
3
  const { sendChatMessageTelegram } = require('@pf/src/modules/globals/utils/mailing');
2
4
 
3
- const queryProcessorGlobals = require('@pf/src/modules/globals/controllers/utils/queryProcessor');
5
+
4
6
 
5
7
  function formatPositions(positions) {
6
8
  return positions.map(pos => `🔹 ${pos.name} - Price: $${pos.price}, Quantity: ${pos.quantity}`).join('\n');
@@ -22,7 +24,6 @@ function formatOrderMessage(order) {
22
24
  `;
23
25
  }
24
26
 
25
-
26
27
  async function findOrCreateCustomer(Customer, customerInfo, orderOwner, orderCreator) {
27
28
  let searchCriteria = {};
28
29
 
@@ -36,6 +37,8 @@ async function findOrCreateCustomer(Customer, customerInfo, orderOwner, orderCre
36
37
 
37
38
  let customer = null;
38
39
 
40
+ console.log(searchCriteria)
41
+
39
42
  // Проверяем, есть ли критерии для поиска
40
43
  if (Object.keys(searchCriteria).length > 0) {
41
44
  customer = await Customer.findOne({ $or: [searchCriteria] });
@@ -47,12 +50,12 @@ async function findOrCreateCustomer(Customer, customerInfo, orderOwner, orderCre
47
50
  ...customerInfo,
48
51
  owner: orderOwner,
49
52
  creator: {
50
- type: customerInfo.creator.type || orderCreator.type,
51
- target: customerInfo.creator.target || orderCreator.target,
53
+ type: customerInfo.creator?.type || orderCreator.type,
54
+ target: customerInfo.creator?.target || orderCreator.target,
52
55
  },
53
56
  identity: {
54
- type: customerInfo.identity.type || orderCreator.type,
55
- target: customerInfo.identity.target || orderCreator.target,
57
+ type: customerInfo.identity?.type || orderCreator.type,
58
+ target: customerInfo.identity?.target || orderCreator.target,
56
59
  },
57
60
  };
58
61
  customer = await Customer.create(newCustomerData);
@@ -70,20 +73,6 @@ async function findOrCreateCustomer(Customer, customerInfo, orderOwner, orderCre
70
73
  }
71
74
  }
72
75
 
73
- function initializeOrder(orderData, userId) {
74
- orderData.status = 'created';
75
-
76
- orderData.status_history = orderData.status_history || [];
77
-
78
- orderData.status_history.push({
79
- status: orderData.status,
80
- changedBy: userId,
81
- timestamp: new Date(),
82
- comment: ''
83
- });
84
- }
85
-
86
-
87
76
  const controllerFactory = (db) => {
88
77
  const Order = db.order;
89
78
  const Customer = db.customer;
@@ -93,7 +82,16 @@ const controllerFactory = (db) => {
93
82
  const orderData = req.body;
94
83
  const userId = req.userId;
95
84
 
96
- initializeOrder(orderData, userId);
85
+ orderData.status = 'created';
86
+
87
+ orderData.status_history = orderData.status_history || [];
88
+
89
+ orderData.status_history.push({
90
+ status: orderData.status,
91
+ user: new db.mongoose.Types.ObjectId(req.userId),
92
+ timestamp: new Date(),
93
+ comment: ''
94
+ });
97
95
 
98
96
  try {
99
97
  if (!orderData.customer.target) {
@@ -119,7 +117,7 @@ const controllerFactory = (db) => {
119
117
 
120
118
  const read = async (req, res) => {
121
119
 
122
- stages = [
120
+ let stages = [
123
121
  ...queryProcessorGlobals.getBasicOptions(
124
122
  req.query
125
123
  ),
@@ -173,19 +171,21 @@ const controllerFactory = (db) => {
173
171
 
174
172
  // Обновление заказа
175
173
  const update = async (req, res) => {
176
- console.log(req.body)
177
174
  const order = await Order.findOne({ _id: req.body._id });
178
175
 
179
176
  if (!order) {
180
177
  return res.status(404).send({ errorCode: "ORDER_NOT_FOUND", message: "Order not found." });
181
178
  }
182
179
 
180
+ console.log('order status is', req.userId)
181
+
182
+
183
183
  if (req.body.status && req.body.status !== order.status) {
184
184
  order.status = req.body.status; // Обновление текущего статуса заказа
185
185
  // Добавление записи в историю изменений статусов
186
186
  order.status_history.push({
187
187
  status: req.body.status,
188
- changedBy: req.userId,
188
+ user: new db.mongoose.Types.ObjectId(req.userId),
189
189
  timestamp: new Date(),
190
190
  comment: ''
191
191
  });
@@ -203,7 +203,7 @@ const controllerFactory = (db) => {
203
203
  try {
204
204
  const order = await Order.findOneAndUpdate(
205
205
  { _id: req.params._id },
206
- { status: 'Оплачен', payment: { type: 'Наличные', status: 'Оплачено' }},
206
+ { status: 'closed', payment: { type: 'Cash', status: 'paid' }},
207
207
  { new: true }
208
208
  ).exec();
209
209
  if (!order) {
@@ -32,7 +32,7 @@ module.exports = (db) => {
32
32
  type: String,
33
33
  trim: true
34
34
  },
35
- changedBy: {
35
+ user: {
36
36
  type: db.mongoose.Schema.Types.ObjectId,
37
37
  ref: 'User',
38
38
  },
@@ -9,6 +9,9 @@ module.exports = function(app, db, origins, publicPath) {
9
9
 
10
10
  app.post(
11
11
  "/api/orders/create",
12
+ [
13
+ middleware.authJwt.verifyToken
14
+ ],
12
15
  controller.create
13
16
  );
14
17
 
@@ -27,6 +30,9 @@ module.exports = function(app, db, origins, publicPath) {
27
30
 
28
31
  app.post(
29
32
  "/api/orders/delete",
33
+ [
34
+ middleware.authJwt.verifyToken
35
+ ],
30
36
  controller.deleteOrder
31
37
  );
32
38
  };
@@ -0,0 +1,33 @@
1
+ import customerInitState from "@pf/src/modules/orders/store/models/customer"
2
+
3
+ const orderInitState = {
4
+ _id: undefined,
5
+ positions: [],
6
+ status: null,
7
+ comment: '',
8
+
9
+ owner: {
10
+ type: 'Organization',
11
+ target: null,
12
+ },
13
+
14
+ creator: {
15
+ type: 'Customer',
16
+ target: null,
17
+ },
18
+
19
+ customer: { ...customerInitState },
20
+
21
+ payment: {
22
+ type: 'Cash',
23
+ status: 'Unpaid',
24
+ },
25
+
26
+ delivery: {
27
+ type: null,
28
+ address: null,
29
+ status: '',
30
+ }
31
+ };
32
+
33
+ export default orderInitState
@@ -6,39 +6,14 @@ import axios from 'axios';
6
6
  const $axios = axios.create({baseURL: process.env.API_URL, withCredentials: true})
7
7
  // Globals
8
8
  import { setError } from '@pf/src/modules/globals/store/globals'
9
+ // Init State
10
+ import orderInitState from "@pf/src/modules/orders/store/models/order"
9
11
 
10
- import customerInitState from "@pf/src/modules/orders/store/models/customer"
11
12
 
12
13
  const state = reactive({
13
14
  all: [],
14
15
  current: {
15
- _id: undefined,
16
- positions: [],
17
- status: null,
18
- comment: '',
19
-
20
- owner: {
21
- type: 'Organization',
22
- target: null,
23
- },
24
-
25
- creator: {
26
- type: 'Customer',
27
- target: null,
28
- },
29
-
30
- customer: { ...customerInitState },
31
-
32
- payment: {
33
- type: 'Cash',
34
- status: 'Unpaid',
35
- },
36
-
37
- delivery: {
38
- type: null,
39
- address: null,
40
- status: '',
41
- }
16
+ ...orderInitState
42
17
  }
43
18
  });
44
19
 
@@ -114,6 +89,10 @@ const actions = {
114
89
  const mutations = {
115
90
  resetCustomer(stateObject) {
116
91
  Object.assign(stateObject, customerInitState);
92
+ },
93
+ resetOrder(stateObject) {
94
+ state.current = { ...orderInitState }
95
+ // Object.assign(stateObject, orderInitState);
117
96
  }
118
97
  }
119
98
 
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="radius-semi o-hidden cols-2-1_3">
2
+ <div class="">
3
3
 
4
4
  <div class="pd-medium w-100">
5
5
 
@@ -32,7 +32,7 @@
32
32
  <ul>
33
33
  <li v-if="department.members.length < 1">No members in department</li>
34
34
  <User
35
- class="br-b br-solid br-grey"
35
+ class="pd-small br-solid br-1px br-black-transp-5 radius-small mn-b-thin"
36
36
  v-for="(member, index) in department.members"
37
37
  :key="index"
38
38
  :user="member.user"
@@ -62,7 +62,10 @@
62
62
  :name="member.user.profile.name || member.user.phone || member.user.email || member.user._id"
63
63
  :position="member.position"
64
64
  :action="{
65
- label: 'x',
65
+ label: {
66
+ is: IconDelete,
67
+ props: { class: 'i-medium', fill: 'rgb(var(--white)' }
68
+ },
66
69
  method: () => removeMember(member)
67
70
  }"
68
71
  />
@@ -120,8 +123,6 @@
120
123
 
121
124
  <p class="p-medium mn-b-small">Please settings for your department:</p>
122
125
  <div class="cols-1 gap-thin">
123
- <h4>Products</h4>
124
-
125
126
  <Checkbox
126
127
  label="Hidden department"
127
128
  name="hidden"
@@ -267,9 +268,10 @@ import Popup from "@pf/src/components/Popup/Popup.vue";
267
268
  import Block from '@pf/src/components/Block/Block.vue';
268
269
  import Feed from '@pf/src/components/Feed/Feed.vue'
269
270
 
271
+ import IconDelete from '@pf/src/modules/icons/navigation/IconDelete.vue'
272
+
270
273
  import EditArray from "@pf/src/modules/organizations/components/blocks/EditArray.vue";
271
274
  import DepartmentSub from "@pf/src/modules/organizations/components/blocks/DepartmentSub.vue";
272
- import DepartmentSubDepartmentModify from "@pf/src/modules/organizations/components/blocks/DepartmentMemberModify.vue";
273
275
 
274
276
  import CardUser from '@pf/src/modules/users/components/blocks/CardUser.vue'
275
277
 
@@ -332,7 +334,7 @@ async function onSubmit() {
332
334
  }
333
335
 
334
336
  function redirectTo() {
335
- router.replace({ name: "Department", params: { _id: route.params._id, department: departments.state.department._id } });
337
+ router.push({ name: "Organization Members", params: { _id: route.params._id } });
336
338
  }
337
339
 
338
340
  async function onDelete() {
@@ -5,7 +5,7 @@
5
5
  @update:tabs_current="(update) => tab = update"
6
6
  :tabs_current="tab"
7
7
  :tabs="[
8
- { name: `Members (${organization.state.current.numberOfMembers})`, value: 'members' },
8
+ { name: `Members (${organization.state.current.numberOfMembers || 0})`, value: 'members' },
9
9
  { name: 'Departments', value: 'departments' },
10
10
  { name: 'Invites', value: 'invites' }
11
11
  ]"
@@ -28,46 +28,49 @@
28
28
  />
29
29
  </Popup>
30
30
 
31
- <Block
31
+ <Feed
32
32
  v-if="tab === 'departments'"
33
- class="mn-b-semi"
33
+ :states="{
34
+ empty: {
35
+ title: 'No Departments Found',
36
+ description: 'Currently, there are no departments available.',
37
+ action: 'Add department',
38
+ callback: () => $router.push(`/organizations/${route.params._id}/departments/create`)
39
+ }
40
+ }"
41
+ :store="{
42
+ read: (options) => departments.actions.read(options),
43
+ state: null
44
+ }"
45
+ :options="{
46
+ organization: route.params._id,
47
+ user: auth.state.user._id,
48
+ }"
49
+ v-slot="{
50
+ items
51
+ }"
34
52
  >
35
- <Feed
36
- :states="{
37
- empty: {
38
- title: 'No Departments Found',
39
- description: 'Currently, there are no departments available.',
40
- action: 'Add department',
41
- callback: () => $router.push(`/organizations/${route.params._id}/departments/create`)
42
- }
43
- }"
44
- :store="{
45
- read: (options) => departments.actions.read(options),
46
- state: null
47
- }"
48
- :options="{
49
- organization: route.params._id,
50
- user: auth.state.user._id,
51
- hidden: false,
52
- }"
53
- v-slot="{
54
- items
53
+ <CardDepartment
54
+ v-for="(department, index) in items"
55
+ :key="index"
56
+ :department="department"
57
+ :organization="route.params._id"
58
+ class="radius-semi bg-grey pos-relative mn-b-thin"
59
+ />
60
+
61
+ </Feed>
62
+ <router-link
63
+ v-if="tab === 'departments' && departments.state.departments.length > 0"
64
+ :to="{
65
+ path: `/organizations/${route.params._id}/departments/create`
55
66
  }"
67
+ class="d-block flex-center flex uppercase t-semi bg-main w-100 pd-small radius-extra"
56
68
  >
57
- <CardDepartment
58
- v-for="(department, index) in items"
59
- :key="index"
60
- :department="department"
61
- :organization="route.params._id"
62
- class="radius-big bg-white pos-relative mn-b-thin"
63
- />
64
- </Feed>
65
- </Block>
66
-
67
- <section class="mn-b-big radius-medium bg-white">
69
+ Add department
70
+ </router-link>
68
71
  <!-- Members -->
69
72
  <div
70
- v-if="tab === 'members'"
73
+ v-if="tab === 'members'"
71
74
  class="cols-1 gap-thin"
72
75
  >
73
76
  <Feed
@@ -102,7 +105,10 @@
102
105
  :role="member.label || member.role"
103
106
  @click="$router.push(`/profile/${member.user._id}`)"
104
107
  :action=" member.role !== 'owner' ? {
105
- label: 'x',
108
+ label: {
109
+ is: IconDelete,
110
+ props: { class: 'i-medium', fill: 'rgb(var(--white)' }
111
+ },
106
112
  method: () => removeMember(index, member)
107
113
  } : null"
108
114
  class="w-100 bg-grey radius-big flex-nowrap flex pd-medium"
@@ -139,14 +145,17 @@
139
145
  :name="invite.email || invite.phone"
140
146
  :role="invite.status"
141
147
  :action="{
142
- label: 'x',
148
+ label: {
149
+ is: IconDelete,
150
+ props: { class: 'i-medium', fill: 'rgb(var(--white)' }
151
+ },
143
152
  method: () => removeInvite(index, invite)
144
153
  }"
145
154
  class="w-100 bg-grey radius-big flex-nowrap flex pd-medium"
146
155
  />
147
156
  </Feed>
148
157
  </div>
149
- </section>
158
+
150
159
  </div>
151
160
  </template>
152
161
 
@@ -171,6 +180,8 @@ import MenuItem from '@pf/src/modules/mobile/components/Menu/MenuItem.vue'
171
180
  import CardUser from '@pf/src/modules/users/components/blocks/CardUser.vue';
172
181
  import CardDepartment from '@pf/src/modules/organizations/components/blocks/CardDepartment.vue';
173
182
 
183
+ import IconDelete from '@pf/src/modules/icons/navigation/IconDelete.vue'
184
+
174
185
  import * as auth from '@pf/src/modules/auth/store/auth'
175
186
  import * as invites from '@pf/src/modules/organizations/store/invites';
176
187
  import * as memberships from '@pf/src/modules/organizations/store/memberships';
@@ -212,6 +223,7 @@ const FirstLevelDepartments = computed(() => {
212
223
  });
213
224
 
214
225
  async function handleSendInvite(list) {
226
+ console.log('invite.list')
215
227
  await invites.actions.create({
216
228
  owner: {
217
229
  type: 'Organization',
@@ -185,7 +185,7 @@
185
185
  user: auth.state.user._id
186
186
  })
187
187
 
188
- await memberships.actions.read(route.params._id)
188
+ await memberships.actions.read({target: route.params._id})
189
189
  })
190
190
 
191
191
  const tabOrganization = ref(tab)
@@ -36,6 +36,7 @@ const сontrollerFactory = (db) => {
36
36
  const create = async (req, res) => {
37
37
  const creator = req.body.creator
38
38
  const owner = req.body.owner
39
+
39
40
  const list = req.body.invites
40
41
 
41
42
  try {
@@ -60,6 +61,7 @@ const сontrollerFactory = (db) => {
60
61
 
61
62
  await membership.save();
62
63
  } else {
64
+
63
65
  const newInvite = new Invite({
64
66
  code: uuid(),
65
67
  creator: creator,