@ozdao/prometheus-framework 0.2.53 → 0.2.55

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. package/dist/main-180a9315.js +91 -0
  2. package/dist/main-3b7bd446.mjs +13631 -0
  3. package/dist/main-B7GT1EB5.js +91 -0
  4. package/dist/main-Im8ovDCi.mjs +13609 -0
  5. package/dist/main-MjvO1l5U.js +91 -0
  6. package/dist/main-N_5Jg8Gx.mjs +13693 -0
  7. package/dist/main.css +1 -1
  8. package/dist/organizations.server.js +17 -3
  9. package/dist/organizations.server.mjs +17 -3
  10. package/dist/products.server.js +1 -1
  11. package/dist/products.server.mjs +1 -1
  12. package/dist/prometheus-framework/src/components/EditImages/EditImages.vue.cjs +1 -1
  13. package/dist/prometheus-framework/src/components/EditImages/EditImages.vue.js +20 -20
  14. package/dist/prometheus-framework/src/components/Field/Field.vue2.cjs +1 -1
  15. package/dist/prometheus-framework/src/components/Field/Field.vue2.js +28 -25
  16. package/dist/prometheus-framework/src/components/Popup/Popup.vue.cjs +1 -1
  17. package/dist/prometheus-framework/src/components/Popup/Popup.vue.js +70 -2
  18. package/dist/prometheus-framework/src/components/Popup/Popup.vue2.cjs +1 -1
  19. package/dist/prometheus-framework/src/components/Popup/Popup.vue2.js +2 -70
  20. package/dist/prometheus-framework/src/components/Select/Select.vue.cjs +1 -1
  21. package/dist/prometheus-framework/src/components/Select/Select.vue.js +95 -2
  22. package/dist/prometheus-framework/src/components/Select/Select.vue2.cjs +1 -1
  23. package/dist/prometheus-framework/src/components/Select/Select.vue2.js +2 -95
  24. package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.cjs +1 -1
  25. package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.js +57 -77
  26. package/dist/prometheus-framework/src/modules/backoffice/router/backoffice.cjs +1 -1
  27. package/dist/prometheus-framework/src/modules/backoffice/router/backoffice.js +1 -1
  28. package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.cjs +1 -1
  29. package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.js +1 -1
  30. package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.cjs +1 -1
  31. package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.js +2 -2
  32. package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue.cjs +5 -1
  33. package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue.js +65 -2
  34. package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue2.cjs +1 -5
  35. package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue2.js +2 -65
  36. package/dist/prometheus-framework/src/modules/constructor/components/sections/Constructor.vue.cjs +1 -1
  37. package/dist/prometheus-framework/src/modules/constructor/components/sections/Constructor.vue.js +1 -1
  38. package/dist/prometheus-framework/src/modules/events/components/layouts/layoutEvents.vue.cjs +1 -1
  39. package/dist/prometheus-framework/src/modules/events/components/layouts/layoutEvents.vue.js +1 -1
  40. package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.cjs +1 -1
  41. package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.js +98 -94
  42. package/dist/prometheus-framework/src/modules/events/components/pages/Events.vue.cjs +1 -1
  43. package/dist/prometheus-framework/src/modules/events/components/pages/Events.vue.js +2 -2
  44. package/dist/prometheus-framework/src/modules/events/components/sections/HeroEvent.vue.cjs +1 -1
  45. package/dist/prometheus-framework/src/modules/events/components/sections/HeroEvent.vue.js +59 -52
  46. package/dist/prometheus-framework/src/modules/events/components/sections/SectionPreviousEvents.vue.cjs +1 -1
  47. package/dist/prometheus-framework/src/modules/events/components/sections/SectionPreviousEvents.vue.js +1 -1
  48. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +1 -1
  49. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.js +1 -1
  50. package/dist/prometheus-framework/src/modules/gallery/components/sections/GalleryWithCategories.vue.cjs +1 -1
  51. package/dist/prometheus-framework/src/modules/gallery/components/sections/GalleryWithCategories.vue.js +1 -1
  52. package/dist/prometheus-framework/src/modules/landing/components/sections/MobileApp.vue.cjs +1 -1
  53. package/dist/prometheus-framework/src/modules/landing/components/sections/MobileApp.vue.js +8 -13
  54. package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.cjs +1 -1
  55. package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.js +1 -1
  56. package/dist/prometheus-framework/src/modules/mobile/components/Menu/Menu.vue.cjs +1 -1
  57. package/dist/prometheus-framework/src/modules/mobile/components/Menu/Menu.vue.js +11 -2
  58. package/dist/prometheus-framework/src/modules/mobile/components/Menu/Menu.vue2.cjs +1 -1
  59. package/dist/prometheus-framework/src/modules/mobile/components/Menu/Menu.vue2.js +2 -11
  60. package/dist/prometheus-framework/src/modules/orders/components/pages/EditOrder.vue.cjs +1 -1
  61. package/dist/prometheus-framework/src/modules/orders/components/pages/EditOrder.vue.js +53 -77
  62. package/dist/prometheus-framework/src/modules/orders/store/orders.cjs +1 -1
  63. package/dist/prometheus-framework/src/modules/orders/store/orders.js +42 -32
  64. package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.cjs +1 -1
  65. package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.js +1 -1
  66. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +1 -1
  67. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.js +2 -2
  68. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.cjs +1 -1
  69. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.js +1 -1
  70. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.cjs +1 -1
  71. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.js +1 -1
  72. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +1 -1
  73. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.js +2 -2
  74. package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.cjs +1 -1
  75. package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.js +1 -1
  76. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.cjs +1 -1
  77. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.js +1 -1
  78. package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
  79. package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.js +2 -2
  80. package/dist/prometheus-framework/src/modules/organizations/router/organizations.cjs +1 -1
  81. package/dist/prometheus-framework/src/modules/organizations/router/organizations.js +5 -3
  82. package/dist/prometheus-framework/src/modules/organizations/router/organizations.router.cjs +1 -1
  83. package/dist/prometheus-framework/src/modules/organizations/router/organizations.router.js +20 -5
  84. package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.cjs +1 -1
  85. package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.js +1 -1
  86. package/dist/prometheus-framework/src/modules/products/components/blocks/ImagesThumbnails.vue.cjs +1 -1
  87. package/dist/prometheus-framework/src/modules/products/components/blocks/ImagesThumbnails.vue.js +1 -1
  88. package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.cjs +1 -1
  89. package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.js +1 -1
  90. package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.cjs +1 -1
  91. package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.js +1 -1
  92. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs +1 -1
  93. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js +1 -1
  94. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.cjs +1 -1
  95. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.js +1 -1
  96. package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.cjs +1 -1
  97. package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.js +2 -2
  98. package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.cjs +1 -1
  99. package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.js +61 -75
  100. package/dist/prometheus-framework/src/modules/wallet/components/pages/Wallet.vue.cjs +1 -1
  101. package/dist/prometheus-framework/src/modules/wallet/components/pages/Wallet.vue.js +2 -2
  102. package/dist/prometheus-framework.cjs.js +1 -1
  103. package/dist/prometheus-framework.es.js +1 -1
  104. package/dist/style.css +1 -1
  105. package/dist/web-8b404cc2.js +1 -0
  106. package/dist/web-e9b09dc6.mjs +55 -0
  107. package/dist/web-i-suCpLM.mjs +55 -0
  108. package/dist/web-ktBiiov5.js +1 -0
  109. package/dist/web-vB7UhMOt.js +1 -0
  110. package/dist/web-xvjLzsHu.mjs +55 -0
  111. package/package.json +1 -1
  112. package/src/components/EditImages/EditImages.vue +1 -1
  113. package/src/components/Feed/Feed.vue +26 -0
  114. package/src/components/Field/Field.vue +5 -0
  115. package/src/components/LocationSelection/LocationSelection.vue +2 -2
  116. package/src/modules/backoffice/components/pages/Dashboard.vue +4 -25
  117. package/src/modules/backoffice/router/admin.js +0 -14
  118. package/src/modules/backoffice/router/backoffice.js +4 -1
  119. package/src/modules/events/components/pages/EditEvent.vue +10 -6
  120. package/src/modules/events/components/sections/HeroEvent.vue +12 -2
  121. package/src/modules/events/components/sections/SectionPreviousEvents.vue +1 -1
  122. package/src/modules/gallery/models/photo.model.js +5 -1
  123. package/src/modules/globals/components/blocks/BlockSearch.vue +4 -3
  124. package/src/modules/globals/store/globals.js +33 -2
  125. package/src/modules/landing/components/sections/MobileApp.vue +2 -6
  126. package/src/modules/orders/components/blocks/CardOrderItem.vue +24 -3
  127. package/src/modules/orders/components/blocks/StatusHistory.vue +91 -31
  128. package/src/modules/orders/components/pages/EditOrder.vue +114 -125
  129. package/src/modules/orders/components/pages/FormOrder.vue +53 -15
  130. package/src/modules/orders/components/pages/Order.vue +2 -2
  131. package/src/modules/orders/components/sections/FormClientDetails.vue +63 -0
  132. package/src/modules/orders/components/sections/FormDelivery.vue +72 -0
  133. package/src/modules/orders/components/sections/FormPayment.vue +27 -0
  134. package/src/modules/orders/controllers/orders.controller.js +63 -49
  135. package/src/modules/orders/models/order.model.js +9 -13
  136. package/src/modules/orders/routes/orders.routes.js +6 -20
  137. package/src/modules/orders/store/orders.js +24 -12
  138. package/src/modules/organizations/components/pages/Organization.vue +1 -0
  139. package/src/modules/organizations/controllers/organizations.controller.js +28 -9
  140. package/src/modules/organizations/router/organizations.js +4 -1
  141. package/src/modules/organizations/router/organizations.router.js +18 -2
  142. package/src/modules/products/components/blocks/CardPosition.vue +7 -7
  143. package/src/modules/products/controllers/products.controller.js +3 -2
  144. package/src/modules/products/store/products.js +2 -0
  145. package/src/modules/users/components/pages/Profile.vue +2 -2
  146. package/src/modules/orders/components/sections/FormOrderDetails.vue +0 -220
@@ -1,55 +1,29 @@
1
1
  const { sendChatMessageTelegram } = require('@pf/src/modules/globals/utils/mailing');
2
-
2
+ const queryProcessorGlobals = require('@pf/src/modules/globals/controllers/utils/queryProcessor');
3
+
4
+ function formatPositions(positions) {
5
+ return positions.map(pos => `🔹 ${pos.name} - Price: $${pos.price}, Quantity: ${pos.quantity}`).join('\n');
6
+ }
7
+
8
+ // Функция для форматирования сообщения об ордере
9
+ function formatOrderMessage(order) {
10
+ return `
11
+ 🆕 New Order Received!
12
+ 👤 Client: ${order.user.name} (${order.user.phone.number ? order.user.phone.number : 'No phone'})
13
+ 💬 Messenger: ${order.user.messenger ? order.user.messenger.type + ' ' + order.user.messenger.value : 'None'}
14
+ 🏢 Organization: ${order.organization}
15
+ 📦 Positions:\n${formatPositions(order.positions)}
16
+ 📝 Comment: ${order.comment ? order.comment : 'No comment'}
17
+ 💳 Payment: ${order.payment.type}
18
+ 🚚 Delivery: ${order.delivery.type} to ${order.delivery.address}
19
+ 📌 Status: ${order.status}
20
+ `;
21
+ }
3
22
 
4
23
  const controllerFactory = (db) => {
5
24
  const Order = db.order;
6
25
 
7
- // Получение всех заказов
8
- const read = async (req, res) => {
9
- try {
10
- const orders = await Order.find({}).exec();
11
- if (!orders) {
12
- return res.status(404).send({ errorCode: "ORDER_NOT_FOUND", message: "Orders not found." });
13
- }
14
- res.status(200).send(orders);
15
- } catch (err) {
16
- res.status(500).send({ errorCode: "GET_ORDERS_FAILED", message: "Error occurred while fetching orders.", error: err });
17
- }
18
- };
19
-
20
- // Получение одного заказа
21
- const getOrder = async (req, res) => {
22
- try {
23
- const order = await Order.findOne({ _id: req.params._id }).exec();
24
- if (!order) {
25
- return res.status(404).send({ errorCode: "SINGLE_ORDER_NOT_FOUND", message: "Order not found." });
26
- }
27
- res.status(200).send(order);
28
- } catch (err) {
29
- res.status(500).send({ errorCode: "GET_ORDER_FAILED", message: "Error occurred while fetching the order.", error: err });
30
- }
31
- };
32
-
33
- function formatPositions(positions) {
34
- return positions.map(pos => `🔹 ${pos.name} - Price: $${pos.price}, Quantity: ${pos.quantity}`).join('\n');
35
- }
36
-
37
- // Функция для форматирования сообщения об ордере
38
- function formatOrderMessage(order) {
39
- return `
40
- 🆕 New Order Received!
41
- 👤 Client: ${order.user.name} (${order.user.phone.number ? order.user.phone.number : 'No phone'})
42
- 💬 Messenger: ${order.user.messenger ? order.user.messenger.type + ' ' + order.user.messenger.value : 'None'}
43
- 🏢 Organization: ${order.organization}
44
- 📦 Positions:\n${formatPositions(order.positions)}
45
- 📝 Comment: ${order.comment ? order.comment : 'No comment'}
46
- 💳 Payment: ${order.payment.type}
47
- 🚚 Delivery: ${order.delivery.type} to ${order.delivery.address}
48
- 📌 Status: ${order.status}
49
- `;
50
- }
51
-
52
- // Создание заказа
26
+ // Создание заказа
53
27
  const create = async (req, res) => {
54
28
  delete req.body._id;
55
29
 
@@ -81,9 +55,50 @@ const controllerFactory = (db) => {
81
55
  }
82
56
  };
83
57
 
58
+ const read = async (req, res) => {
59
+
60
+ let stages = [];
61
+
62
+ stages = [
63
+ ...queryProcessorGlobals.getBasicOptions(
64
+ req.query
65
+ ),
66
+ // For creator
67
+ queryProcessorGlobals.getCreatorUserLookupStage(),
68
+ queryProcessorGlobals.getCreatorOrganizationLookupStage(),
69
+ // For owner
70
+ queryProcessorGlobals.getOwnerUserLookupStage(),
71
+ queryProcessorGlobals.getOwnerOrganizationLookupStage(),
72
+ queryProcessorGlobals.getAddFieldsCreatorOwnerStage(),
73
+ // Pagination
74
+ ...queryProcessorGlobals.getSortingOptions(
75
+ req.query.sortParam,
76
+ req.query.sortOrder,
77
+ ),
78
+ ...queryProcessorGlobals.getPaginationOptions(
79
+ req.query.skip,
80
+ req.query.limit
81
+ )
82
+ ];
83
+
84
+ try {
85
+ const orders = await Order.aggregate(stages);
86
+
87
+ if (!orders) {
88
+ return res.status(404).send({ errorCode: "ORDER_NOT_FOUND", message: "Orders not found." });
89
+ }
90
+
91
+ res.status(200).send(orders);
92
+
93
+ } catch (err) {
94
+ console.log(err);
95
+ res.status(500).send({ errorCode: "GET_ORDERS_FAILED", message: "Error occurred while fetching orders.", error: err });
96
+ }
97
+ };
98
+
84
99
  // Обновление заказа
85
100
  const update = async (req, res) => {
86
- const order = await Order.findById(req.body._id);
101
+ const order = await Order.findById(new db.mongoose.Schema.Types.ObjectId(req.body._id));
87
102
 
88
103
  if (!order) {
89
104
  return res.status(404).send({ errorCode: "ORDER_NOT_FOUND", message: "Order not found." });
@@ -141,7 +156,6 @@ const controllerFactory = (db) => {
141
156
  return {
142
157
  create,
143
158
  read,
144
- getOrder,
145
159
  update,
146
160
  changePaymentStatus,
147
161
  deleteOrder
@@ -1,30 +1,24 @@
1
+ const applyOwnershipSchema = require('@pf/src/modules/globals/models/ownership.schema.js');
2
+
1
3
  module.exports = (db) => {
2
-
4
+
3
5
  const OrderSchema = new db.mongoose.Schema({
4
- owner: {
5
- type: db.mongoose.Schema.Types.ObjectId,
6
- ref: 'User',
7
- },
8
- user: {
9
- _id: { type: Boolean },
6
+ client: {
10
7
  name: { type: String, trim: true },
11
8
  phone: { type: Object, trim: true },
12
- number: { type: String, trim: true },
9
+ email: { type: String, trim: true },
13
10
  messenger: {
14
11
  type: { type: String, trim: true },
15
12
  value: { type: String, trim: true }
16
13
  }
17
14
  },
18
- organization: {
19
- type: db.mongoose.Schema.Types.ObjectId,
20
- ref: 'Organization',
21
- },
22
15
  positions: {
23
16
  type: Array
24
17
  },
25
18
  status: {
26
19
  type: String
27
20
  },
21
+
28
22
  status_history: [{
29
23
  status: {
30
24
  type: String,
@@ -42,8 +36,8 @@ module.exports = (db) => {
42
36
  type: String,
43
37
  trim: true
44
38
  }
45
- // Здесь вы можете добавить любые другие поля, которые считаете нужными
46
39
  }],
40
+
47
41
  comment: {
48
42
  type: String,
49
43
  trim: true
@@ -78,6 +72,8 @@ module.exports = (db) => {
78
72
  }
79
73
  });
80
74
 
75
+ applyOwnershipSchema(OrderSchema,db);
76
+
81
77
  const Order = db.mongoose.model("Order", OrderSchema);
82
78
 
83
79
  return Order;
@@ -5,6 +5,7 @@ const middlewareFactory = require('@pf/src/modules/middlewares/server');
5
5
  // Routes
6
6
  module.exports = function(app, db) {
7
7
  const controller = controllerFactory(db);
8
+
8
9
  const { authJwt } = middlewareFactory(db);
9
10
 
10
11
  app.use(function(req, res, next) {
@@ -20,11 +21,6 @@ module.exports = function(app, db) {
20
21
  app.post(
21
22
  "/api/orders/create",
22
23
  controller.create
23
- );
24
- // Get order
25
- app.get(
26
- "/api/orders/:_id",
27
- controller.getOrder
28
24
  );
29
25
  // Get orders
30
26
  app.get(
@@ -37,27 +33,17 @@ module.exports = function(app, db) {
37
33
  authJwt.verifyToken
38
34
  ],
39
35
  controller.update
40
- );
41
- // Update order
42
- app.post(
43
- "/api/orders/:_id",
44
- controller.update
45
- );
46
- // Get orders
47
- app.post(
48
- "/api/orders/payment/:_id",
49
- controller.changePaymentStatus
50
- );
51
- // Delete product
52
- app.delete(
53
- "/api/orders/:_id",
54
- controller.deleteOrder
55
36
  );
56
37
  app.post(
57
38
  "/api/orders/delete",
58
39
  controller.deleteOrder
59
40
  );
60
41
 
42
+ // Change Payment status
43
+ // app.post(
44
+ // "/api/orders/payment/:_id",
45
+ // controller.changePaymentStatus
46
+ // );
61
47
 
62
48
  };
63
49
 
@@ -10,22 +10,32 @@ import { setError } from '@pf/src/modules/globals/store/globals'
10
10
  const state = reactive({
11
11
  all: [],
12
12
  current: {
13
- _id: '',
14
- organization: '',
13
+ _id: null,
14
+
15
15
  positions: [],
16
16
  status: null,
17
17
  comment: '',
18
18
 
19
- user: {
20
- _id: null,
21
- name: '',
19
+ owner: {
20
+ type: 'organization',
21
+ target: null,
22
+ },
23
+
24
+ creator: {
25
+ type: 'client',
26
+ target: null,
27
+ },
28
+
29
+ client: {
30
+ name: null,
22
31
  phone: null,
23
32
  messenger: {
24
- type: '',
25
- value: ''
33
+ type: null,
34
+ value: null
26
35
  },
27
36
  },
28
37
 
38
+
29
39
  payment: {
30
40
  type: '',
31
41
  status: '',
@@ -40,12 +50,14 @@ const state = reactive({
40
50
  });
41
51
 
42
52
  const actions = {
43
- async create(order, organization) {
53
+ async create(positions, owner, creator) {
44
54
  try {
45
- state.current.positions = order
46
- state.current.organization = organization
47
-
48
- const response = await $axios.post('/api/orders/create', state.current);
55
+ let order = {
56
+ positions: positions,
57
+ owner: owner,
58
+ creator: creator
59
+ }
60
+ const response = await $axios.post('/api/orders/create', order);
49
61
 
50
62
  state.all.push(response.data);
51
63
 
@@ -109,6 +109,7 @@
109
109
  Change Invetory
110
110
  </router-link>
111
111
 
112
+
112
113
  <router-link
113
114
  class="d-block mn-l-auto uppercase t-semi bg-white pd-thin radius-extra "
114
115
  :to="{
@@ -168,16 +168,35 @@ const controllerFactory = (db) => {
168
168
  userLocation.coordinates = [lng,lat]
169
169
  }
170
170
 
171
- matchConditions.push({
172
- "spots.location.coordinates": {
173
- $geoWithin: {
174
- $centerSphere: [
175
- [parseFloat(lng), parseFloat(lat)],
176
- (locationRadius || 50) / 6378.1
177
- ]
171
+ // Determine the search radius based on the level of specificity
172
+ const earthRadiusKm = 6378.1;
173
+
174
+ let radius = null;
175
+
176
+ if (locationRadius) {
177
+ radius = parseFloat(locationRadius) / earthRadiusKm;
178
+ } else if (city) {
179
+ radius = 500 / earthRadiusKm;
180
+ } else if (state) {
181
+ radius = 1000 / earthRadiusKm;
182
+ } else {
183
+ radius = null
184
+ }
185
+
186
+ const geoWithinCondition = {
187
+ "spots.location.coordinates": {
188
+ $geoWithin: {
189
+ $centerSphere: [
190
+ [parseFloat(lng), parseFloat(lat)],
191
+ radius
192
+ ]
193
+ }
178
194
  }
179
- }
180
- });
195
+ };
196
+
197
+ if (radius !== null) {
198
+ matchConditions.push(geoWithinCondition);
199
+ }
181
200
  }
182
201
 
183
202
  const matchStage = matchConditions.length > 0 ? { $match: { $and: matchConditions } } : null;
@@ -6,6 +6,8 @@ import { membersRoutes } from './members.router.js';
6
6
  import departmentRoutes from './departments.router.js'
7
7
  import productRoutes from './products.router.js';
8
8
 
9
+ import backofficeRoutes from '@pf/src/modules/backoffice/router/backoffice.js'
10
+
9
11
  const organizations = [{
10
12
  path: 'organizations',
11
13
  component: layoutEmpty,
@@ -19,7 +21,8 @@ const organizations = [{
19
21
  ...organizationRoutes,
20
22
  ...membersRoutes,
21
23
  ...departmentRoutes,
22
- ...productRoutes
24
+ ...productRoutes,
25
+ // ...backofficeRoutes
23
26
 
24
27
  ]
25
28
  }];
@@ -1,16 +1,32 @@
1
1
  import layoutEmpty from '@pf/src/modules/globals/components/layouts/Empty.vue';
2
2
  import * as validationAuth from '@pf/src/modules/middlewares/client/auth.validation.js';
3
3
 
4
+ import backofficeRoutes from '@pf/src/modules/backoffice/router/backoffice.js'
5
+
4
6
  const organizationRoutes = [{
5
7
  path: ':_id',
6
- name: 'Organization',
8
+ name: 'OrganizationRoot',
7
9
  meta: {
8
10
  title: {
9
11
  en: 'Organization',
10
12
  ru: 'Организация'
11
13
  }
12
14
  },
13
- component: () => import('@pf/src/modules/organizations/components/pages/Organization.vue'),
15
+ component: () => layoutEmpty,
16
+ children: [
17
+ {
18
+ path: '',
19
+ name: 'Organization',
20
+ meta: {
21
+ title: {
22
+ en: 'Organization',
23
+ ru: 'Организация'
24
+ }
25
+ },
26
+ component: () => import('@pf/src/modules/organizations/components/pages/Organization.vue'),
27
+ },
28
+ ...backofficeRoutes
29
+ ],
14
30
  }, {
15
31
  path: 'create',
16
32
  name: 'Create Organization',
@@ -75,9 +75,9 @@
75
75
  ])
76
76
 
77
77
  const productSelected = ref(null);
78
- const productQuantity = ref(null);
78
+ const productQuantity = ref(1);
79
79
  const productQuantityType = ref('pcs');
80
- const productPrice = ref(null);
80
+ const productPrice = ref(0);
81
81
 
82
82
  const isProductValid = computed(() =>
83
83
  productSelected.value
@@ -87,14 +87,14 @@
87
87
 
88
88
  watch(props.array, () => {
89
89
  productSelected.value = props.product
90
- productQuantity.value = props.product.quantity
90
+ productQuantity.value = props.product.quantity || 1
91
91
  productPrice.value = props.product.price
92
92
  productQuantityType.value = props.product.type
93
93
  });
94
94
 
95
95
  if (props.product) {
96
96
  productSelected.value = props.product
97
- productQuantity.value = props.product.quantity
97
+ productQuantity.value = props.product.quantity || 1
98
98
  productPrice.value = props.product.price
99
99
  productQuantityType.value = props.product.type
100
100
  }
@@ -105,7 +105,7 @@
105
105
  emits('update', {
106
106
  ...productSelected.value,
107
107
  price: productPrice.value,
108
- quantity: productQuantity.value,
108
+ quantity: productQuantity.value || 1,
109
109
  type: productQuantityType.value
110
110
  });
111
111
  });
@@ -115,7 +115,7 @@
115
115
  emits('add', {
116
116
  ...productSelected.value,
117
117
  price: productPrice.value,
118
- quantity: productQuantity.value,
118
+ quantity: productQuantity.value || 1,
119
119
  type: productQuantityType.value
120
120
  });
121
121
  }
@@ -124,7 +124,7 @@
124
124
  emits('delete', {
125
125
  ...productSelected.value,
126
126
  price: productPrice.value,
127
- quantity: productQuantity.value,
127
+ quantity: productQuantity.value || 1,
128
128
  type: productQuantityType.value
129
129
  });
130
130
  }
@@ -5,11 +5,12 @@ const path = require('path');
5
5
 
6
6
  const OpenAI = require("openai");
7
7
 
8
- console.log(process.env.OPENAI_API_KEY)
9
8
  const openai = new OpenAI({
10
- apiKey: process.env.OPENAI_API_KEY
9
+ organization: process.env.OPENAI_ORG_KEY,
10
+ apiKey: process.env.OPENAI_API_KEY,
11
11
  });
12
12
 
13
+
13
14
  // Factory
14
15
  const controllerFactory = (db) => {
15
16
  const Product = db.product;
@@ -96,6 +96,8 @@ const actions = {
96
96
  query.search = options.search;
97
97
  }
98
98
 
99
+ console.log(options.search)
100
+
99
101
  query.sort = 'createdAt';
100
102
 
101
103
  query.skip = options.skip || 0;
@@ -203,7 +203,7 @@
203
203
  </span>
204
204
  </MenuItem>
205
205
 
206
- <MenuItem
206
+ <!-- <MenuItem
207
207
  @click="router.push({
208
208
  name: 'Legal',
209
209
  params: {
@@ -214,7 +214,7 @@
214
214
  <span>
215
215
  About
216
216
  </span>
217
- </MenuItem>
217
+ </MenuItem> -->
218
218
 
219
219
  <MenuItem
220
220
  class="cursor-pointer"