@ozdao/prometheus-framework 0.2.92 → 0.2.94

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. package/dist/events.server.js +14 -6
  2. package/dist/events.server.mjs +14 -6
  3. package/dist/main-CX2ISR43.mjs +13629 -0
  4. package/dist/main-cffh4bbv.js +92 -0
  5. package/dist/main.css +1 -1
  6. package/dist/orders.server.js +37 -23
  7. package/dist/orders.server.mjs +37 -23
  8. package/dist/organizations.server.js +2 -1
  9. package/dist/organizations.server.mjs +2 -1
  10. package/dist/prometheus-framework/src/components/Address/Address.vue2.cjs +1 -1
  11. package/dist/prometheus-framework/src/components/Address/Address.vue2.js +46 -48
  12. package/dist/prometheus-framework/src/components/LocationMarker/LocationMarker.vue2.cjs +1 -1
  13. package/dist/prometheus-framework/src/components/LocationMarker/LocationMarker.vue2.js +25 -20
  14. package/dist/prometheus-framework/src/components/Map/Map.vue.cjs +1 -1
  15. package/dist/prometheus-framework/src/components/Map/Map.vue.js +36 -26
  16. package/dist/prometheus-framework/src/components/Select/Select.vue.cjs +1 -1
  17. package/dist/prometheus-framework/src/components/Select/Select.vue.js +103 -1
  18. package/dist/prometheus-framework/src/components/Select/Select.vue2.cjs +1 -1
  19. package/dist/prometheus-framework/src/components/Select/Select.vue2.js +1 -103
  20. package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue.cjs +1 -1
  21. package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue.js +36 -1
  22. package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue2.cjs +1 -1
  23. package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue2.js +1 -36
  24. package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.cjs +1 -1
  25. package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.js +1 -1
  26. package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.cjs +1 -1
  27. package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.js +1 -1
  28. package/dist/prometheus-framework/src/modules/constructor/components/elements/VideoPlayer.vue.cjs +1 -1
  29. package/dist/prometheus-framework/src/modules/constructor/components/elements/VideoPlayer.vue.js +11 -11
  30. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +1 -1
  31. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.js +1 -1
  32. package/dist/prometheus-framework/src/modules/gallery/components/sections/GalleryWithCategories.vue.cjs +1 -1
  33. package/dist/prometheus-framework/src/modules/gallery/components/sections/GalleryWithCategories.vue.js +1 -1
  34. package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.cjs +1 -1
  35. package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.js +45 -45
  36. package/dist/prometheus-framework/src/modules/orders/components/blocks/StatusHistory.vue.cjs +2 -2
  37. package/dist/prometheus-framework/src/modules/orders/components/blocks/StatusHistory.vue.js +39 -65
  38. package/dist/prometheus-framework/src/modules/orders/components/pages/Order.vue.cjs +1 -1
  39. package/dist/prometheus-framework/src/modules/orders/components/pages/Order.vue.js +31 -31
  40. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderBackoffice.vue.cjs +1 -0
  41. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderBackoffice.vue.js +242 -0
  42. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderBackoffice.vue2.cjs +1 -0
  43. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderBackoffice.vue2.js +1 -0
  44. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreate.vue.cjs +1 -1
  45. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreate.vue.js +62 -62
  46. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs +1 -1
  47. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js +28 -28
  48. package/dist/prometheus-framework/src/modules/orders/components/pages/Orders.vue.cjs +1 -1
  49. package/dist/prometheus-framework/src/modules/orders/components/pages/Orders.vue.js +99 -70
  50. package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.cjs +1 -1
  51. package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.js +1 -1
  52. package/dist/prometheus-framework/src/modules/orders/components/sections/FormCustomerDetails.vue.cjs +1 -1
  53. package/dist/prometheus-framework/src/modules/orders/components/sections/FormCustomerDetails.vue.js +1 -1
  54. package/dist/prometheus-framework/src/modules/orders/components/sections/FormDelivery.vue.cjs +1 -1
  55. package/dist/prometheus-framework/src/modules/orders/components/sections/FormDelivery.vue.js +10 -10
  56. package/dist/prometheus-framework/src/modules/orders/components/sections/FormPayment.vue.cjs +1 -1
  57. package/dist/prometheus-framework/src/modules/orders/components/sections/FormPayment.vue.js +1 -1
  58. package/dist/prometheus-framework/src/modules/orders/router/orders.backoffice.router.cjs +1 -1
  59. package/dist/prometheus-framework/src/modules/orders/router/orders.backoffice.router.js +1 -1
  60. package/dist/prometheus-framework/src/modules/orders/router/orders.router.cjs +1 -1
  61. package/dist/prometheus-framework/src/modules/orders/router/orders.router.js +2 -2
  62. package/dist/prometheus-framework/src/modules/orders/store/orders.cjs +1 -1
  63. package/dist/prometheus-framework/src/modules/orders/store/orders.js +33 -34
  64. package/dist/prometheus-framework/src/modules/orders/store/shopcart.cjs +1 -1
  65. package/dist/prometheus-framework/src/modules/orders/store/shopcart.js +42 -42
  66. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.cjs +1 -1
  67. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.js +28 -26
  68. package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.cjs +1 -1
  69. package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.js +11 -11
  70. package/dist/prometheus-framework/src/modules/organizations/components/pages/Department.vue.cjs +1 -1
  71. package/dist/prometheus-framework/src/modules/organizations/components/pages/Department.vue.js +47 -44
  72. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +1 -1
  73. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.js +162 -168
  74. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.cjs +1 -1
  75. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.js +27 -26
  76. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.cjs +1 -1
  77. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.js +7 -7
  78. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +1 -1
  79. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.js +1 -1
  80. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.cjs +1 -1
  81. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.js +1 -1
  82. package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
  83. package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.js +1 -1
  84. package/dist/prometheus-framework/src/modules/organizations/store/memberships.cjs +1 -1
  85. package/dist/prometheus-framework/src/modules/organizations/store/memberships.js +1 -1
  86. package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.cjs +1 -1
  87. package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.js +1 -1
  88. package/dist/prometheus-framework/src/modules/products/components/blocks/CardProduct.vue.cjs +1 -1
  89. package/dist/prometheus-framework/src/modules/products/components/blocks/CardProduct.vue.js +13 -13
  90. package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.cjs +1 -1
  91. package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.js +1 -1
  92. package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.cjs +1 -1
  93. package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.js +1 -1
  94. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs +1 -1
  95. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js +14 -15
  96. package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.cjs +1 -1
  97. package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.js +22 -20
  98. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.cjs +1 -1
  99. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.js +1 -1
  100. package/dist/prometheus-framework/src/modules/products/components/sections/FilterProducts.vue.cjs +1 -1
  101. package/dist/prometheus-framework/src/modules/products/components/sections/FilterProducts.vue.js +1 -1
  102. package/dist/prometheus-framework/src/modules/products/store/products.cjs +1 -1
  103. package/dist/prometheus-framework/src/modules/products/store/products.js +59 -38
  104. package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.cjs +1 -1
  105. package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.js +1 -1
  106. package/dist/prometheus-framework/src/modules/spots/components/blocks/CardSpot.vue.cjs +1 -1
  107. package/dist/prometheus-framework/src/modules/spots/components/blocks/CardSpot.vue.js +23 -22
  108. package/dist/prometheus-framework/src/modules/users/components/blocks/CardUser.vue.cjs +1 -1
  109. package/dist/prometheus-framework/src/modules/users/components/blocks/CardUser.vue.js +17 -14
  110. package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.cjs +1 -1
  111. package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.js +1 -1
  112. package/dist/prometheus-framework.cjs.js +1 -1
  113. package/dist/prometheus-framework.es.js +1 -1
  114. package/dist/style.css +1 -1
  115. package/dist/web-CQQEUA9l.js +1 -0
  116. package/dist/web-D2Em-p-C.mjs +54 -0
  117. package/package.json +1 -1
  118. package/src/components/Address/Address.vue +23 -34
  119. package/src/components/LocationMarker/LocationMarker.vue +6 -1
  120. package/src/components/LocationSelection/LocationSelection.vue +4 -0
  121. package/src/components/Map/Map.vue +29 -15
  122. package/src/modules/constructor/components/elements/VideoPlayer.vue +2 -2
  123. package/src/modules/events/controllers/events.controller.js +4 -4
  124. package/src/modules/globals/components/blocks/CardHeader.vue +2 -2
  125. package/src/modules/integrations/stripe/controllers/services/stripe.service.js +17 -6
  126. package/src/modules/landing/components/pages/Farming.vue +226 -0
  127. package/src/modules/landing/components/pages/Governance.vue +3 -5
  128. package/src/modules/landing/components/pages/Home.vue +0 -3
  129. package/src/modules/landing/components/pages/Hotel.vue +1 -3
  130. package/src/modules/landing/components/pages/Page.vue +0 -3
  131. package/src/modules/landing/components/sections/Examples.vue +4 -56
  132. package/src/modules/landing/components/sections/SectionFeature.vue +41 -0
  133. package/src/modules/landing/components/sections/SectionFeaturesImages.vue +122 -0
  134. package/src/modules/landing/components/sections/SectionFocus.vue +59 -0
  135. package/src/modules/landing/components/sections/SectionHeroVideo.vue +164 -0
  136. package/src/modules/landing/router/landing.js +11 -0
  137. package/src/modules/marketplace/components/sections/Filters.vue +26 -23
  138. package/src/modules/orders/components/blocks/CardOrderItem.vue +8 -0
  139. package/src/modules/orders/components/blocks/StatusHistory.vue +25 -53
  140. package/src/modules/orders/components/pages/Order.vue +2 -6
  141. package/src/modules/orders/components/pages/OrderBackoffice.vue +393 -0
  142. package/src/modules/orders/components/pages/OrderCreate.vue +5 -4
  143. package/src/modules/orders/components/pages/OrderCreateBackoffice.vue +2 -3
  144. package/src/modules/orders/components/pages/Orders.vue +60 -11
  145. package/src/modules/orders/components/sections/FormDelivery.vue +2 -2
  146. package/src/modules/orders/controllers/orders.controller.js +30 -19
  147. package/src/modules/orders/models/order.model.js +8 -2
  148. package/src/modules/orders/router/orders.backoffice.router.js +1 -1
  149. package/src/modules/orders/router/orders.router.js +2 -2
  150. package/src/modules/orders/store/orders.js +3 -7
  151. package/src/modules/orders/store/shopcart.js +1 -1
  152. package/src/modules/organizations/components/blocks/CardDepartment.vue +2 -0
  153. package/src/modules/organizations/components/pages/Department.vue +5 -1
  154. package/src/modules/organizations/components/pages/DepartmentEdit.vue +65 -27
  155. package/src/modules/organizations/components/pages/Members.vue +2 -1
  156. package/src/modules/organizations/components/pages/Organization.vue +1 -1
  157. package/src/modules/organizations/controllers/memberships.controller.js +3 -1
  158. package/src/modules/organizations/store/memberships.js +1 -1
  159. package/src/modules/products/components/blocks/CardProduct.vue +2 -3
  160. package/src/modules/products/components/pages/ProductEdit.vue +10 -13
  161. package/src/modules/products/components/pages/Products.vue +2 -0
  162. package/src/modules/products/store/products.js +25 -2
  163. package/src/modules/spots/components/blocks/CardSpot.vue +2 -2
  164. package/src/modules/users/components/blocks/CardUser.vue +1 -0
  165. package/src/modules/landing/components/sections/AboutSection.vue +0 -69
@@ -6,13 +6,13 @@
6
6
  :tabs_current="tab"
7
7
  :tabs="[
8
8
  { name: 'All', value: 'all' },
9
- { name: 'Created', value: 'stock-in' },
10
- { name: 'Confirmed', value: 'stock-out' },
11
- { name: 'Preparing', value: 'stock-out' },
12
- { name: 'Prepared', value: 'stock-out' },
13
- { name: 'In delivery', value: 'stock-out' },
14
- { name: 'Delivered', value: 'stock-out' },
15
- { name: 'Closed', value: 'stock-out' }
9
+ { name: 'Created', value: 'created' },
10
+ { name: 'Confirmed', value: 'confirmed' },
11
+ { name: 'Preparing', value: 'preparing' },
12
+ { name: 'Prepared', value: 'prepared' },
13
+ { name: 'In delivery', value: 'in delivery' },
14
+ { name: 'Delivered', value: 'delivered' },
15
+ { name: 'Closed', value: 'closed' }
16
16
  ]"
17
17
  :actions="[
18
18
  { to: { name: 'AdminOrderAdd'}, label: 'Create Order' }
@@ -20,6 +20,29 @@
20
20
  class="mn-b-small bg-grey bg-grey radius-big"
21
21
  />
22
22
 
23
+
24
+
25
+ <Block
26
+ title="Balance"
27
+ class="mn-b-thin"
28
+ >
29
+ <div class="gap-micro flex-nowrap flex">
30
+ <div class="w-100 bg-white radius-small pd-small">
31
+ <p class="mn-b-thin">Total</p>
32
+ <h3>{{formatPrice(totalPrice)}}</h3>
33
+ </div>
34
+ <div class="w-100 bg-white radius-small pd-small">
35
+ <p class="mn-b-thin">Paid</p>
36
+ <h3>{{formatPrice(totalPriceUnpaid)}}</h3>
37
+ </div>
38
+ <div class="w-100 bg-white radius-small pd-small">
39
+ <p class="mn-b-thin">Unpaid</p>
40
+ <h3>{{formatPrice(totalPrice)}}</h3>
41
+ </div>
42
+ </div>
43
+
44
+ </Block>
45
+
23
46
  <Feed
24
47
  :search="true"
25
48
  :states="{
@@ -34,7 +57,7 @@
34
57
  :options="{
35
58
  limit: 15,
36
59
  owner: route.params._id,
37
- ...(tab !== 'all' && { type: tab })
60
+ ...(tab !== 'all' && { status: tab })
38
61
  }"
39
62
  v-slot="{
40
63
  items
@@ -121,8 +144,8 @@
121
144
 
122
145
 
123
146
  <div class="pd-small bg-white radius-small gap-micro flex-v-center flex-nowrap flex">
124
- <IconEvents class="i-semi t-transp" fill="rgb(var(--black)" />
125
- <p class="t-medium mn-r-auto">16:40, 21.04</p>
147
+ <IconTime class="i-semi t-transp" fill="rgb(var(--black)" />
148
+ <p class="t-medium mn-r-auto">{{formatDate(order.deadline)}}</p>
126
149
 
127
150
  <span
128
151
  class="flex-child flex-child-shrink-0 capitalize w-max t-medium radius-big pd-b-nano pd-t-nano pd-r-thin pd-l-thin bg-main"
@@ -155,6 +178,7 @@
155
178
  import '@vuepic/vue-datepicker/dist/main.css'
156
179
 
157
180
  import Tab from '@pf/src/components/Tab/Tab.vue'
181
+ import Block from '@pf/src/components/Block/Block.vue';
158
182
 
159
183
  import * as orders from '@pf/src/modules/orders/store/orders';
160
184
  import * as auth from '@pf/src/modules/auth/store/auth';
@@ -166,7 +190,7 @@
166
190
 
167
191
  import Feed from '@pf/src/components/Feed/Feed.vue'
168
192
 
169
- import IconEvents from '@pf/src/modules/icons/entities/IconEvents.vue'
193
+ import IconTime from '@pf/src/modules/icons/entities/IconTime.vue'
170
194
 
171
195
  const route = useRoute();
172
196
  const router = useRouter();
@@ -176,6 +200,31 @@
176
200
  // Tab logic
177
201
  const tab = ref('all')
178
202
 
203
+ const totalPrice = computed(() => {
204
+ return calculateTotalSum(orders.state.all)
205
+ });
206
+
207
+ const totalPriceUnpaid = computed(() => {
208
+ return calculateSum(orders.state.all,'unpaid')
209
+ });
210
+
211
+
212
+ function calculateTotalSum(orders) {
213
+ return orders.reduce((totalSum, item) => {
214
+ return totalSum + item.positions.reduce((sum, position) => sum + position.price, 0);
215
+ }, 0);
216
+ }
217
+
218
+ function calculateSum(orders, status) {
219
+ return orders.reduce((totalSum, item) => {
220
+ if (item.payment.status === status) {
221
+ return totalSum + item.positions.reduce((sum, position) => sum + position.price, 0);
222
+ }
223
+ return totalSum;
224
+ }, 0);
225
+ }
226
+
227
+
179
228
  onMounted(async () => {
180
229
 
181
230
  });
@@ -6,7 +6,7 @@
6
6
 
7
7
  </div>
8
8
 
9
- <h4 class="mn-b-thin">Shipping Method</h4>
9
+ <h4 class="mn-b-thin">Select zone</h4>
10
10
  <div class="mn-b-small flex-nowrap flex">
11
11
  <Radio
12
12
  v-model:radio="order.delivery.type"
@@ -22,7 +22,7 @@
22
22
  />
23
23
  <Radio
24
24
  v-model:radio="order.delivery.type"
25
- label="Mail"
25
+ label="Post"
26
26
  value="mail"
27
27
  class="bg-white pd-medium radius-small w-100 mn-r-small"
28
28
  />
@@ -1,4 +1,5 @@
1
1
  const { sendChatMessageTelegram } = require('@pf/src/modules/globals/utils/mailing');
2
+
2
3
  const queryProcessorGlobals = require('@pf/src/modules/globals/controllers/utils/queryProcessor');
3
4
 
4
5
  function formatPositions(positions) {
@@ -21,18 +22,8 @@ function formatOrderMessage(order) {
21
22
  `;
22
23
  }
23
24
 
24
- function initializeOrder(orderData, userId) {
25
- orderData.status = 'created';
26
- orderData.status_history = orderData.status_history || [];
27
- orderData.status_history.push({
28
- status: orderData.status,
29
- changedBy: userId,
30
- timestamp: new Date(),
31
- comment: ''
32
- });
33
- }
34
25
 
35
- async function findOrCreateCustomer(Customer, customerInfo, orderOwner, visitor) {
26
+ async function findOrCreateCustomer(Customer, customerInfo, orderOwner, orderCreator) {
36
27
  let searchCriteria = {};
37
28
 
38
29
  if (customerInfo.phone) {
@@ -55,8 +46,14 @@ async function findOrCreateCustomer(Customer, customerInfo, orderOwner, visitor)
55
46
  const newCustomerData = {
56
47
  ...customerInfo,
57
48
  owner: orderOwner,
58
- creator: customerInfo.creator || { type: 'Visitor', target: visitor || orderOwner.target },
59
- identity: customerInfo.indentity || { type: 'Visitor', target: visitor || orderOwner.target }
49
+ creator: {
50
+ type: customerInfo.creator.type || orderCreator.type,
51
+ target: customerInfo.creator.target || orderCreator.target,
52
+ },
53
+ identity: {
54
+ type: customerInfo.identity.type || orderCreator.type,
55
+ target: customerInfo.identity.target || orderCreator.target,
56
+ },
60
57
  };
61
58
  customer = await Customer.create(newCustomerData);
62
59
  }
@@ -73,6 +70,20 @@ async function findOrCreateCustomer(Customer, customerInfo, orderOwner, visitor)
73
70
  }
74
71
  }
75
72
 
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
+
76
87
  const controllerFactory = (db) => {
77
88
  const Order = db.order;
78
89
  const Customer = db.customer;
@@ -81,16 +92,16 @@ const controllerFactory = (db) => {
81
92
  const create = async (req, res) => {
82
93
  const orderData = req.body;
83
94
  const userId = req.userId;
84
-
95
+
85
96
  initializeOrder(orderData, userId);
86
97
 
87
98
  try {
88
99
  if (!orderData.customer.target) {
89
- let customer = await findOrCreateCustomer(Customer, orderData.customer, orderData.owner, orderData.visitor);
100
+ let customer = await findOrCreateCustomer(Customer, orderData.customer, orderData.owner, orderData.creator);
90
101
 
91
102
  orderData.customer = { type: 'Customer', target: customer._id };
92
103
 
93
- if (!orderData.creator?.target) {
104
+ if (!orderData.creator.target) {
94
105
  orderData.creator = { type: 'Customer', target: customer._id };
95
106
  }
96
107
  }
@@ -108,7 +119,7 @@ const controllerFactory = (db) => {
108
119
 
109
120
  const read = async (req, res) => {
110
121
 
111
- stages = [
122
+ let stages = [
112
123
  ...queryProcessorGlobals.getBasicOptions(
113
124
  req.query
114
125
  ),
@@ -162,7 +173,8 @@ const controllerFactory = (db) => {
162
173
 
163
174
  // Обновление заказа
164
175
  const update = async (req, res) => {
165
- const order = await Order.findById(new db.mongoose.Schema.Types.ObjectId(req.body._id));
176
+ console.log(req.body)
177
+ const order = await Order.findOne({ _id: req.body._id });
166
178
 
167
179
  if (!order) {
168
180
  return res.status(404).send({ errorCode: "ORDER_NOT_FOUND", message: "Order not found." });
@@ -178,7 +190,6 @@ const controllerFactory = (db) => {
178
190
  comment: ''
179
191
  });
180
192
  }
181
-
182
193
  try {
183
194
  await order.save(); // Сохранение обновленного заказа
184
195
  res.status(200).send(order);
@@ -23,6 +23,10 @@ module.exports = (db) => {
23
23
  status: {
24
24
  type: String
25
25
  },
26
+ deadline: {
27
+ type: Date,
28
+ default: () => new Date(Date.now() + 30 * 60000) // Добавляет 30 минут к текущему времени
29
+ },
26
30
  status_history: [{
27
31
  status: {
28
32
  type: String,
@@ -49,11 +53,13 @@ module.exports = (db) => {
49
53
  payment: {
50
54
  type: {
51
55
  type: String,
52
- trim: true
56
+ trim: true,
57
+ default: 'cash'
53
58
  },
54
59
  status: {
55
60
  type: String,
56
- trim: true
61
+ trim: true,
62
+ default: 'unpaid'
57
63
  }
58
64
  },
59
65
  delivery: {
@@ -27,7 +27,7 @@ const orders = [
27
27
  },{
28
28
  path: ':order',
29
29
  name: 'AdminOrderEdit',
30
- component: () => import(/* webpackChunkName: 'BackofficeOrders' */ '@pf/src/modules/orders/components/pages/OrderCreateBackoffice.vue')
30
+ component: () => import(/* webpackChunkName: 'BackofficeOrders' */ '@pf/src/modules/orders/components/pages/OrderBackoffice.vue')
31
31
  }]
32
32
  }
33
33
  ];
@@ -28,7 +28,7 @@ const orders = {
28
28
  ru: 'Заказ'
29
29
  }
30
30
  },
31
- component: () => import(/* webpackChunkName: 'Order' */ '@pf/src/modules/orders/components/pages/Order.vue')
31
+ component: () => import(/* webpackChunkName: 'Order' */ '@pf/src/modules/orders/components/pages/OrderBackoffice.vue')
32
32
  },
33
33
  {
34
34
  path: ':order/edit',
@@ -39,7 +39,7 @@ const orders = {
39
39
  ru: 'Заказ'
40
40
  }
41
41
  },
42
- component: () => import(/* webpackChunkName: 'Order' */ '@pf/src/modules/orders/components/pages/Order.vue')
42
+ component: () => import(/* webpackChunkName: 'Order' */ '@pf/src/modules/orders/components/pages/OrderBackoffice.vue')
43
43
  }]
44
44
  };
45
45
 
@@ -12,7 +12,7 @@ import customerInitState from "@pf/src/modules/orders/store/models/customer"
12
12
  const state = reactive({
13
13
  all: [],
14
14
  current: {
15
- _id: null,
15
+ _id: undefined,
16
16
  positions: [],
17
17
  status: null,
18
18
  comment: '',
@@ -58,11 +58,7 @@ const actions = {
58
58
  async read( options = {}) {
59
59
  try {
60
60
 
61
- if (options._id) {
62
- options.params = { _id: options._id };
63
- }
64
-
65
- const response = await $axios.get('/api/orders/read', { params: options.params });
61
+ const response = await $axios.get('/api/orders/read', { params: options });
66
62
 
67
63
  if (options._id) {
68
64
  set(response.data[0], 'current')
@@ -79,7 +75,7 @@ const actions = {
79
75
 
80
76
  async update(order) {
81
77
  try {
82
- const response = await $axios.post(`/api/orders/${order._id}`, order);
78
+ const response = await $axios.post(`/api/orders/update`, order);
83
79
 
84
80
  const index = state.all.findIndex(o => o._id === order._id);
85
81
 
@@ -124,7 +124,7 @@ const actions = {
124
124
  },
125
125
 
126
126
 
127
- resetShopcart({ state }) {
127
+ resetShopcart() {
128
128
  state.positions = [];
129
129
 
130
130
  localStorage.removeItem('shopcart');
@@ -36,6 +36,8 @@
36
36
  v-for="(member, index) in department.members"
37
37
  :key="index"
38
38
  :user="member.user"
39
+ :photo="member.user.profile.photo"
40
+ :name="member.user.profile.name || member.user.phone || member.user.email || member.user._id"
39
41
  :position="member.position"
40
42
  @click="$router.push(`/app/profile/${member.user._id}`)"
41
43
  />
@@ -39,7 +39,9 @@
39
39
  class="br-b br-solid br-grey"
40
40
  v-for="(member, index) in departments.state.department.members"
41
41
  :key="index"
42
- :user="member"
42
+ :user="member.user"
43
+ :photo="member.user.profile.photo"
44
+ :name="member.user.profile.name || member.user.phone || member.user.email || member.user._id"
43
45
  :position="member.position"
44
46
  @click="$router.push(`/app/profile/${member.user._id}`)"
45
47
  />
@@ -65,6 +67,8 @@ import DepartmentSub from '@pf/src/modules/organizations/components/blocks/Depar
65
67
  import User from '@pf/src/modules/users/components/blocks/CardUser.vue';
66
68
  import * as departments from '@pf/src/modules/organizations/store/departments';
67
69
 
70
+ import IconEdit from '@pf/src/modules/icons/navigation/IconEdit.vue'
71
+
68
72
  const router = useRouter();
69
73
  const route = useRoute();
70
74
 
@@ -5,8 +5,9 @@
5
5
  <h1 v-if="route.params.department" class="mn-r-auto">Edit Department</h1>
6
6
  <h1 v-else class="mn-r-auto">Create Department</h1>
7
7
 
8
- <section class="flex-nowrap flex pd-thin">
9
- <Button :submit="onSubmit" :callback="redirectTo" class="bg-main">Save Department</Button>
8
+ <section class="flex-nowrap flex gap-thin pd-thin">
9
+ <Button v-if="route.params.department" :submit="onDelete" :callback="redirectToDash" class="bg-red">Delete</Button>
10
+ <Button :submit="onSubmit" :callback="redirectTo" class="bg-main">Save</Button>
10
11
  </section>
11
12
 
12
13
  </header>
@@ -52,16 +53,18 @@
52
53
  }]"
53
54
  class="cols-1 gap-thin mn-b-thin"
54
55
  >
55
- <!-- {{departments.state.department.members[0]}} -->
56
- <User
57
- class="bg-grey o-hidden radius-small mn-b-thin"
56
+ <CardUser
57
+ class="bg-white pd-thin radius-medium w-100"
58
58
  v-for="(member, index) in departments.state.department.members"
59
59
  :key="index"
60
60
  :user="member.user"
61
61
  :photo="member.user.profile.photo"
62
62
  :name="member.user.profile.name || member.user.phone || member.user.email || member.user._id"
63
63
  :position="member.position"
64
- @click="openMemberPopup(index)"
64
+ :action="{
65
+ label: 'x',
66
+ method: () => removeMember(member)
67
+ }"
65
68
  />
66
69
  </Block>
67
70
 
@@ -71,12 +74,42 @@
71
74
  :isPopupOpen="isOpenAddMemberPopup"
72
75
  class="bg-white w-max-30r radius-big pd-big"
73
76
  >
74
- <DepartmentMemberModify
75
- :members="departments.state.department.members"
76
- :member="selectedMember"
77
- :users="memberships.state.memberships"
78
- @callback="closeMemberPopup"
79
- />
77
+ <Feed
78
+ :search="{
79
+ placeholder: 'Search customer...',
80
+ class: 'bg-grey mn-b-thin'
81
+ }"
82
+ :states="{
83
+ empty: {
84
+ title: 'No Products Found',
85
+ description: 'Currently, there are no such products available.'
86
+ }
87
+ }"
88
+ :store="{
89
+ read: (options) => memberships.actions.read(options),
90
+ state: null
91
+ }"
92
+ :options="{
93
+ target: route.params._id
94
+ }"
95
+ v-slot="{
96
+ items
97
+ }"
98
+ class="bg-grey pd-medium w-min-20r w-max-40r radius-big h-max-20r o-scroll"
99
+ >
100
+ <CardUser
101
+ v-for="(user, index) in items"
102
+ :key="user._id"
103
+ :user="user.user"
104
+ :photo="user.user.profile?.photo"
105
+ :name="user.user.profile?.name || user.user.phone || user.user.email"
106
+ @click="() => {
107
+ globals.actions.add(departments.state.department.members, { _id: user.user._id, user: user.user, position: 'Member'})
108
+ closeMemberPopup();
109
+ }"
110
+ class="bg-white pd-thin radius-medium w-100 mn-b-thin"
111
+ />
112
+ </Feed>
80
113
  </Popup>
81
114
 
82
115
 
@@ -178,13 +211,11 @@
178
211
 
179
212
  </div>
180
213
 
181
- <section v-if="route.params.department" class="flex-nowrap flex pd-thin">
182
- <Button :submit="onDelete" :callback="redirectToDash" class="bg-grey">Delete Department</Button>
183
- </section>
214
+
184
215
 
185
216
 
186
217
 
187
- <div id="dash" class="pd-medium bg-white">
218
+ <!-- <div id="dash" class="pd-medium bg-white">
188
219
 
189
220
  <Popup title="Добавить подотдел" @close-popup="closeDepartmentPopup" :isPopupOpen="isOpenDepartmentPopup">
190
221
  <DepartmentSubDepartmentModify
@@ -214,7 +245,7 @@
214
245
  </ul>
215
246
 
216
247
 
217
- </div>
248
+ </div> -->
218
249
  </div>
219
250
  </template>
220
251
 
@@ -234,13 +265,15 @@ import LocationMarker from "@pf/src/components/LocationMarker/LocationMarker.vue
234
265
  import Button from "@pf/src/components/Button/Button.vue";
235
266
  import Popup from "@pf/src/components/Popup/Popup.vue";
236
267
  import Block from '@pf/src/components/Block/Block.vue';
268
+ import Feed from '@pf/src/components/Feed/Feed.vue'
237
269
 
238
270
  import EditArray from "@pf/src/modules/organizations/components/blocks/EditArray.vue";
239
271
  import DepartmentSub from "@pf/src/modules/organizations/components/blocks/DepartmentSub.vue";
240
- import DepartmentMemberModify from "@pf/src/modules/organizations/components/blocks/DepartmentMemberModify.vue";
241
272
  import DepartmentSubDepartmentModify from "@pf/src/modules/organizations/components/blocks/DepartmentMemberModify.vue";
242
- import User from '@pf/src/modules/users/components/blocks/CardUser.vue';
243
273
 
274
+ import CardUser from '@pf/src/modules/users/components/blocks/CardUser.vue'
275
+
276
+ import * as globals from "@pf/src/modules/globals/store/globals";
244
277
  import * as departments from "@pf/src/modules/organizations/store/departments";
245
278
  import * as memberships from "@pf/src/modules/organizations/store/memberships";
246
279
 
@@ -248,11 +281,7 @@ const router = useRouter();
248
281
  const route = useRoute();
249
282
 
250
283
  async function fetchData() {
251
- if (route.params.department) {
252
- await memberships.actions.read({target: route.params._id});
253
- }
254
284
  const users = ref(memberships.state.memberships);
255
-
256
285
  // await departments.actions.read({organization: route.params._id});
257
286
  if (route.params.department) await departments.actions.readOne(route.params.department);
258
287
  }
@@ -307,10 +336,19 @@ function redirectTo() {
307
336
  }
308
337
 
309
338
  async function onDelete() {
310
- await departments.actions.delete(
311
- route.params._id,
312
- departments.state.department
313
- );
339
+ if (confirm("Are you sure you want to delete this department?")) {
340
+ await departments.actions.delete(
341
+ route.params._id,
342
+ departments.state.department
343
+ );
344
+ }
345
+
346
+ }
347
+
348
+ function removeMember(member) {
349
+ if (confirm("Are you sure you want to remove this member?")) {
350
+ globals.actions.delete(departments.state.department.members, { _id: member.user._id})
351
+ }
314
352
  }
315
353
 
316
354
  function redirectDash() {
@@ -82,7 +82,8 @@
82
82
  read: (options) => memberships.actions.read(options)
83
83
  }"
84
84
  :options="{
85
- target: route.params._id
85
+ target: route.params._id,
86
+ role: ['member','owner']
86
87
  }"
87
88
  v-slot="{
88
89
  items
@@ -129,7 +129,7 @@
129
129
  <button
130
130
  v-if="auth.state.user._id === organization.state.current.owner"
131
131
  @click="$router.push(`/spots/${organization.state.current._id}/spots/create`)"
132
- class="mn-b-thin button w-100"
132
+ class="mn-b-thin bg-main button w-100"
133
133
  >
134
134
  Add spot
135
135
  </button>
@@ -5,13 +5,15 @@ const controllerFactory = (db) => {
5
5
 
6
6
  const read = async (req, res) => {
7
7
  try {
8
+
8
9
  const memberships = await Membership.aggregate([
9
10
  {
10
11
  $match: {
11
12
  ...(req.query.user && { user: new ObjectId(req.query.user) }),
12
13
  ...(req.query.type && { type: req.query.type }),
13
14
  ...(req.query.target && { target: new ObjectId(req.query.target) }),
14
- ...(req.query.role && { role: req.query.role }),
15
+ // ...(req.query.role && { role: req.query.role }),
16
+ ...(req.query.role && { role: { $in: req.query.role } }),
15
17
  },
16
18
  },
17
19
  {
@@ -28,7 +28,7 @@ const actions = {
28
28
  if (options._id) params._id = options._id;
29
29
  if (options.user) params.user = options.user;
30
30
  if (options.target) params.target = options.target;
31
- if (options.roles) params.roles = options.roles;
31
+ if (options.role) params.role = options.role;
32
32
 
33
33
  try {
34
34
  const response = await $axios.get(`/api/memberships`, { params: params });
@@ -13,9 +13,8 @@
13
13
  : 'bg-white'
14
14
  "
15
15
  >
16
-
17
16
  <router-link
18
- v-if="user"
17
+ v-if="user && user.roles && (user.roles.includes('ROLE_MODERATOR') || user.roles.includes('ROLE_ADMIN'))"
19
18
  :to="{
20
19
  name: 'ProductEdit',
21
20
  params: {
@@ -34,7 +33,7 @@
34
33
  class="i-regular"
35
34
  classes="fill-white"
36
35
  />
37
- </router-link>
36
+ </router-link>
38
37
 
39
38
  <!-- Product Image Sqaure -->
40
39
 
@@ -270,10 +270,18 @@
270
270
  }
271
271
 
272
272
  onMounted(async() => {
273
+ products.mutations.resetProduct();
273
274
 
274
- // Data prefetching
275
- await categories.actions.fetchCategories()
275
+ if (route.params.product) {
276
+ await products.actions.read({ _id: route.params.product });
277
+ }
278
+
279
+ if (!products.state.current.ingredients) {
280
+ products.state.current.ingredients = []
281
+ }
276
282
 
283
+ // Data prefetching
284
+ await categories.actions.fetchCategories()
277
285
 
278
286
  try {
279
287
  const productsResponse = await products.actions.read({
@@ -284,17 +292,6 @@
284
292
  } catch (error) {
285
293
  console.error('error');
286
294
  }
287
-
288
- if (route.params.product) {
289
- await products.actions.read({ _id: route.params.product });
290
- } else {
291
- // await commit('products/clearProductState')
292
- }
293
-
294
- if (!products.state.current.ingredients) {
295
- products.state.current.ingredients = []
296
- }
297
-
298
295
  })
299
296
 
300
297
  function onImagesUpdate(newImages) {
@@ -68,6 +68,7 @@
68
68
  v-for="product in items"
69
69
  :key="product._id"
70
70
  :product="product"
71
+ :user="auth.state.access"
71
72
  class="h-max"
72
73
  @click.capture="$router.push({
73
74
  name: 'Product Organization',
@@ -99,6 +100,7 @@
99
100
  import CardProduct from '@pf/src/modules/products/components/blocks/CardProduct.vue'
100
101
 
101
102
  // Accessing router and store
103
+ import * as auth from '@pf/src/modules/auth/store/auth';
102
104
  import * as products from '@pf/src/modules/products/store/products';
103
105
 
104
106
  const route = useRoute()