@ozdao/prometheus-framework 0.2.53 → 0.2.54
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/main-180a9315.js +91 -0
- package/dist/main-3b7bd446.mjs +13631 -0
- package/dist/main-Im8ovDCi.mjs +13609 -0
- package/dist/main-MjvO1l5U.js +91 -0
- package/dist/main.css +1 -1
- package/dist/organizations.server.js +17 -3
- package/dist/organizations.server.mjs +17 -3
- package/dist/products.server.js +1 -1
- package/dist/products.server.mjs +1 -1
- package/dist/prometheus-framework/src/components/EditImages/EditImages.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/EditImages/EditImages.vue.js +20 -20
- package/dist/prometheus-framework/src/components/Field/Field.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Field/Field.vue2.js +28 -25
- package/dist/prometheus-framework/src/components/Popup/Popup.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Popup/Popup.vue.js +70 -2
- package/dist/prometheus-framework/src/components/Popup/Popup.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Popup/Popup.vue2.js +2 -70
- package/dist/prometheus-framework/src/components/Select/Select.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Select/Select.vue.js +95 -2
- package/dist/prometheus-framework/src/components/Select/Select.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Select/Select.vue2.js +2 -95
- package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.js +57 -77
- package/dist/prometheus-framework/src/modules/backoffice/router/backoffice.cjs +1 -1
- package/dist/prometheus-framework/src/modules/backoffice/router/backoffice.js +1 -1
- package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue.cjs +5 -1
- package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue.js +65 -2
- package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue2.cjs +1 -5
- package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue2.js +2 -65
- package/dist/prometheus-framework/src/modules/constructor/components/sections/Constructor.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/constructor/components/sections/Constructor.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/events/components/layouts/layoutEvents.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/layouts/layoutEvents.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.js +98 -94
- package/dist/prometheus-framework/src/modules/events/components/pages/Events.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/Events.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/events/components/sections/HeroEvent.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/sections/HeroEvent.vue.js +59 -52
- package/dist/prometheus-framework/src/modules/events/components/sections/SectionPreviousEvents.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/sections/SectionPreviousEvents.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/gallery/components/sections/GalleryWithCategories.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/gallery/components/sections/GalleryWithCategories.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/landing/components/sections/MobileApp.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/landing/components/sections/MobileApp.vue.js +8 -13
- package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/mobile/components/Menu/Menu.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/mobile/components/Menu/Menu.vue.js +11 -2
- package/dist/prometheus-framework/src/modules/mobile/components/Menu/Menu.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/modules/mobile/components/Menu/Menu.vue2.js +2 -11
- package/dist/prometheus-framework/src/modules/orders/components/pages/EditOrder.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/pages/EditOrder.vue.js +53 -77
- package/dist/prometheus-framework/src/modules/orders/store/orders.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/store/orders.js +42 -32
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/organizations/router/organizations.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/router/organizations.js +5 -3
- package/dist/prometheus-framework/src/modules/organizations/router/organizations.router.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/router/organizations.router.js +20 -5
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/ImagesThumbnails.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/ImagesThumbnails.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.js +61 -75
- package/dist/prometheus-framework/src/modules/wallet/components/pages/Wallet.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/wallet/components/pages/Wallet.vue.js +2 -2
- package/dist/prometheus-framework.cjs.js +1 -1
- package/dist/prometheus-framework.es.js +1 -1
- package/dist/style.css +1 -1
- package/dist/web-8b404cc2.js +1 -0
- package/dist/web-e9b09dc6.mjs +55 -0
- package/dist/web-i-suCpLM.mjs +55 -0
- package/dist/web-vB7UhMOt.js +1 -0
- package/package.json +1 -1
- package/src/components/EditImages/EditImages.vue +1 -1
- package/src/components/Field/Field.vue +5 -0
- package/src/components/LocationSelection/LocationSelection.vue +2 -2
- package/src/modules/backoffice/components/pages/Dashboard.vue +4 -25
- package/src/modules/backoffice/router/admin.js +0 -14
- package/src/modules/backoffice/router/backoffice.js +1 -1
- package/src/modules/events/components/pages/EditEvent.vue +10 -6
- package/src/modules/events/components/sections/HeroEvent.vue +12 -2
- package/src/modules/events/components/sections/SectionPreviousEvents.vue +1 -1
- package/src/modules/landing/components/sections/MobileApp.vue +2 -6
- package/src/modules/orders/components/blocks/StatusHistory.vue +91 -31
- package/src/modules/orders/components/pages/EditOrder.vue +4 -21
- package/src/modules/orders/components/pages/FormOrder.vue +53 -15
- package/src/modules/orders/components/pages/Order.vue +2 -2
- package/src/modules/orders/components/sections/FormClientDetails.vue +63 -0
- package/src/modules/orders/components/sections/FormDelivery.vue +72 -0
- package/src/modules/orders/components/sections/FormPayment.vue +27 -0
- package/src/modules/orders/controllers/orders.controller.js +63 -49
- package/src/modules/orders/models/order.model.js +9 -13
- package/src/modules/orders/routes/orders.routes.js +6 -20
- package/src/modules/orders/store/orders.js +24 -12
- package/src/modules/organizations/controllers/organizations.controller.js +28 -9
- package/src/modules/organizations/router/organizations.js +4 -1
- package/src/modules/organizations/router/organizations.router.js +18 -2
- package/src/modules/products/controllers/products.controller.js +3 -2
- package/src/modules/users/components/pages/Profile.vue +2 -2
- 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
|
-
|
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
|
-
|
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
|
-
|
13
|
+
_id: null,
|
14
|
+
|
15
15
|
positions: [],
|
16
16
|
status: null,
|
17
17
|
comment: '',
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
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(
|
53
|
+
async create(positions, owner, creator) {
|
44
54
|
try {
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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
|
|
@@ -168,16 +168,35 @@ const controllerFactory = (db) => {
|
|
168
168
|
userLocation.coordinates = [lng,lat]
|
169
169
|
}
|
170
170
|
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
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: '
|
8
|
+
name: 'OrganizationRoot',
|
7
9
|
meta: {
|
8
10
|
title: {
|
9
11
|
en: 'Organization',
|
10
12
|
ru: 'Организация'
|
11
13
|
}
|
12
14
|
},
|
13
|
-
component: () =>
|
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',
|
@@ -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
|
-
|
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;
|
@@ -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"
|
@@ -1,220 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<div class="order-form col">
|
3
|
-
<!-- Client info -->
|
4
|
-
<Block
|
5
|
-
title="Personal Data"
|
6
|
-
class="mn-b-thin"
|
7
|
-
>
|
8
|
-
<!-- Name and surname -->
|
9
|
-
<Field
|
10
|
-
v-model:field="order.user.name"
|
11
|
-
label="Name*"
|
12
|
-
placeholder="Enter your name"
|
13
|
-
class="
|
14
|
-
bg-white
|
15
|
-
pd-medium
|
16
|
-
radius-small
|
17
|
-
mn-b-thin
|
18
|
-
"
|
19
|
-
/>
|
20
|
-
<!-- Phone -->
|
21
|
-
<FieldPhone
|
22
|
-
v-model:modelValue="order.user.phone"
|
23
|
-
@country="(country) => { order.user.number = country }"
|
24
|
-
:inputOptions="{
|
25
|
-
placeholder: 'Enter contact phone number',
|
26
|
-
type: 'tel',
|
27
|
-
}"
|
28
|
-
:defaultCountry="'TH'"
|
29
|
-
:validCharactersOnly="true"
|
30
|
-
:dropdownOptions="{
|
31
|
-
showDialCodeInSelection: true,
|
32
|
-
showFlags: true,
|
33
|
-
showDialCodeInList: true
|
34
|
-
}"
|
35
|
-
mode="national"
|
36
|
-
class="bg-white pd-small radius-small mn-b-thin"
|
37
|
-
/>
|
38
|
-
|
39
|
-
<p class="mn-b-small">
|
40
|
-
Prefer to chat instead of calling? Just drop your messenger info here:
|
41
|
-
</p>
|
42
|
-
|
43
|
-
<div class="flex-nowrap flex">
|
44
|
-
<Select
|
45
|
-
:options="[
|
46
|
-
{name: 'Telegram', value: 'telegram'},
|
47
|
-
{name: 'WhatsApp', value: 'whatsapp'},
|
48
|
-
{name: 'Line', value: 'line'},
|
49
|
-
]"
|
50
|
-
@update:select="(option) => order.user.messenger.type = option.value"
|
51
|
-
placeholder="Messenger"
|
52
|
-
size="small"
|
53
|
-
class="
|
54
|
-
bg-white
|
55
|
-
pd-medium
|
56
|
-
radius-small
|
57
|
-
mn-r-small
|
58
|
-
"
|
59
|
-
/>
|
60
|
-
|
61
|
-
<Field
|
62
|
-
v-model:field="order.user.messenger.value"
|
63
|
-
placeholder="Enter your contact here"
|
64
|
-
class="
|
65
|
-
bg-white
|
66
|
-
pd-medium
|
67
|
-
radius-small
|
68
|
-
w-100
|
69
|
-
"
|
70
|
-
/>
|
71
|
-
</div>
|
72
|
-
</Block>
|
73
|
-
|
74
|
-
<!-- Delivery -->
|
75
|
-
<Block
|
76
|
-
title="Delivery"
|
77
|
-
class="mn-b-thin"
|
78
|
-
:tooltip="'Delivery by mail takes 3-5 days.'"
|
79
|
-
>
|
80
|
-
<!-- Type of delivery -->
|
81
|
-
<div class="mn-b-small flex-nowrap flex">
|
82
|
-
<Radio
|
83
|
-
v-model:radio="order.delivery.type"
|
84
|
-
label="Courier"
|
85
|
-
value="courier"
|
86
|
-
class="
|
87
|
-
bg-white
|
88
|
-
pd-medium
|
89
|
-
radius-small
|
90
|
-
w-100
|
91
|
-
mn-r-small
|
92
|
-
"
|
93
|
-
/>
|
94
|
-
<Radio
|
95
|
-
v-model:radio="order.delivery.type"
|
96
|
-
label="Post"
|
97
|
-
value="Post"
|
98
|
-
class="
|
99
|
-
bg-white
|
100
|
-
pd-medium
|
101
|
-
radius-small
|
102
|
-
w-100
|
103
|
-
mn-r-small
|
104
|
-
"
|
105
|
-
/>
|
106
|
-
</div>
|
107
|
-
<!-- Adress-->
|
108
|
-
<Address
|
109
|
-
label="Address"
|
110
|
-
|
111
|
-
apiKey="AIzaSyDDR6WgYB7XMt7yTDDzQNEdF_gTdUiq8dI"
|
112
|
-
|
113
|
-
:address="order.delivery.address"
|
114
|
-
:location="order.delivery.location"
|
115
|
-
|
116
|
-
placeholder="Enter your address"
|
117
|
-
|
118
|
-
class="
|
119
|
-
bg-white radius-tl-medium radius-tr-medium t-black br-grey br-solid br-2px pd-medium
|
120
|
-
"
|
121
|
-
|
122
|
-
@update:location="newLocation => {
|
123
|
-
order.delivery.location = newLocation;
|
124
|
-
}"
|
125
|
-
@update:address="newAddress => {
|
126
|
-
order.delivery.address = newAddress;
|
127
|
-
}"
|
128
|
-
/>
|
129
|
-
|
130
|
-
<LocationMarker
|
131
|
-
apiKey="AIzaSyDDR6WgYB7XMt7yTDDzQNEdF_gTdUiq8dI"
|
132
|
-
|
133
|
-
:address="order.delivery.address"
|
134
|
-
:location="order.delivery.location"
|
135
|
-
|
136
|
-
class="mn-b-thin radius-bl-medium radius-br-medium h-15r o-hidden"
|
137
|
-
|
138
|
-
@update:location="newLocation => {
|
139
|
-
order.delivery.location = newLocation;
|
140
|
-
}"
|
141
|
-
@update:address="newAddress => {
|
142
|
-
order.delivery.address = newAddress;
|
143
|
-
}"
|
144
|
-
/>
|
145
|
-
<Field
|
146
|
-
v-model:field="order.comment"
|
147
|
-
placeholder="Comments regarding the address (apartment unit, floor level, building section)"
|
148
|
-
type="textarea"
|
149
|
-
class="
|
150
|
-
bg-white
|
151
|
-
pd-medium
|
152
|
-
radius-small
|
153
|
-
"
|
154
|
-
/>
|
155
|
-
</Block>
|
156
|
-
<!-- Type of payment -->
|
157
|
-
<Block
|
158
|
-
title="Payment"
|
159
|
-
>
|
160
|
-
<div class="mn-b-small flex-nowrap flex">
|
161
|
-
<Select
|
162
|
-
v-model:select="order.payment.type"
|
163
|
-
:property="'value'"
|
164
|
-
:options="[
|
165
|
-
{name: 'Cash On Delivery', value: 'cash'},
|
166
|
-
{name: 'Bank Transfer', value: 'bank'},
|
167
|
-
{name: 'Crypto', value: 'crypto'},
|
168
|
-
]"
|
169
|
-
|
170
|
-
placeholder="Select type of payment"
|
171
|
-
size="small"
|
172
|
-
class="
|
173
|
-
bg-white
|
174
|
-
pd-medium
|
175
|
-
radius-small
|
176
|
-
w-100
|
177
|
-
"
|
178
|
-
/>
|
179
|
-
</div>
|
180
|
-
</Block>
|
181
|
-
|
182
|
-
|
183
|
-
</div>
|
184
|
-
|
185
|
-
</template>
|
186
|
-
|
187
|
-
<script setup="props">
|
188
|
-
import { computed, onMounted, watch } from 'vue'
|
189
|
-
|
190
|
-
import * as globals from '@pf/src/modules/globals/store/globals';
|
191
|
-
import * as orders from '@pf/src/modules/orders/store/orders';
|
192
|
-
/////////////////////////////
|
193
|
-
// COMPONENT DEPENDENCIES
|
194
|
-
/////////////////////////////
|
195
|
-
import Block from '@pf/src/components/Block/Block.vue'
|
196
|
-
import Field from '@pf/src/components/Field/Field.vue'
|
197
|
-
import FieldPhone from '@pf/src/components/FieldPhone/FieldPhone2.vue'
|
198
|
-
import Select from '@pf/src/components/Select/Select.vue'
|
199
|
-
import Address from '@pf/src/components/Address/Address.vue'
|
200
|
-
|
201
|
-
import LocationMarker from "@pf/src/components/LocationMarker/LocationMarker.vue";
|
202
|
-
import Radio from '@pf/src/components/Radio/Radio.vue'
|
203
|
-
/////////////////////////////
|
204
|
-
// CREATED
|
205
|
-
/////////////////////////////
|
206
|
-
const props = defineProps({
|
207
|
-
order: Object,
|
208
|
-
});
|
209
|
-
/////////////////////////////
|
210
|
-
// MOUNTED
|
211
|
-
/////////////////////////////
|
212
|
-
onMounted(() => {
|
213
|
-
if (globals.state.position) props.order.delivery.address = globals.state.position.address
|
214
|
-
if (globals.state.position) props.order.delivery.location = globals.state.position.location
|
215
|
-
})
|
216
|
-
</script>
|
217
|
-
|
218
|
-
<style lang="scss">
|
219
|
-
|
220
|
-
</style>
|