@ozdao/prometheus-framework 0.2.94 → 0.2.96
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/auth.server.js +15 -14
- package/dist/auth.server.mjs +15 -14
- package/dist/main-BJvlNekm.mjs +13631 -0
- package/dist/main-pGo7JpSP.js +92 -0
- package/dist/orders.server.js +26 -22
- package/dist/orders.server.mjs +26 -22
- package/dist/organizations.server.js +31 -10
- package/dist/organizations.server.mjs +31 -10
- package/dist/prometheus-framework/src/components/Block/Block.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Block/Block.vue.js +2 -2
- package/dist/prometheus-framework/src/components/Button/Button.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Button/Button.vue.js +94 -1
- package/dist/prometheus-framework/src/components/Button/Button.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Button/Button.vue2.js +1 -94
- package/dist/prometheus-framework/src/components/EditImages/EditImages.vue.js +19 -19
- package/dist/prometheus-framework/src/components/Field/Field.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Field/Field.vue.js +84 -1
- package/dist/prometheus-framework/src/components/Field/Field.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Field/Field.vue2.js +1 -84
- package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.js +1 -1
- package/dist/prometheus-framework/src/components/Popup/Popup.vue.js +12 -12
- package/dist/prometheus-framework/src/components/Tooltip/Tooltip.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Tooltip/Tooltip.vue.js +45 -1
- package/dist/prometheus-framework/src/components/Tooltip/Tooltip.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Tooltip/Tooltip.vue2.js +1 -45
- package/dist/prometheus-framework/src/components/Upload/Upload.vue.js +21 -21
- package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/auth/components/pages/EnterCode.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/EnterCode.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/auth/router/auth.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/router/auth.js +4 -0
- package/dist/prometheus-framework/src/modules/backoffice/router/backoffice.cjs +1 -1
- package/dist/prometheus-framework/src/modules/backoffice/router/backoffice.js +8 -8
- package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.js +2 -2
- 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 +3 -3
- package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/constructor/components/elements/Embed.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/constructor/components/elements/Embed.vue.js +1 -1
- 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 +66 -0
- 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 +0 -66
- 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/elements/ButtonCheck.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/elements/ButtonCheck.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/events/components/elements/ButtonJoin.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/elements/ButtonJoin.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 +3 -3
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.js +2 -2
- 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 +60 -60
- 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 +2 -2
- package/dist/prometheus-framework/src/modules/globals/components/blocks/BlockSearch.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/globals/components/blocks/BlockSearch.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/icons/navigation/IconCross.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/icons/navigation/IconCross.vue.js +22 -21
- 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 +2 -2
- package/dist/prometheus-framework/src/modules/orders/components/blocks/StatusHistory.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/orders/components/blocks/StatusHistory.vue.js +48 -37
- package/dist/prometheus-framework/src/modules/orders/components/pages/OrderBackoffice.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/pages/OrderBackoffice.vue.js +160 -167
- package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js +50 -49
- package/dist/prometheus-framework/src/modules/orders/components/pages/Orders.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/pages/Orders.vue.js +113 -110
- package/dist/prometheus-framework/src/modules/orders/components/partials/ShopCart.vue.js +14 -14
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormCustomerDetails.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormCustomerDetails.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormDelivery.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormDelivery.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/orders/store/models/order.cjs +1 -0
- package/dist/prometheus-framework/src/modules/orders/store/models/order.js +28 -0
- package/dist/prometheus-framework/src/modules/orders/store/orders.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/store/orders.js +25 -43
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.js +19 -19
- package/dist/prometheus-framework/src/modules/organizations/components/elements/ButtonToggleMembership.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/elements/ButtonToggleMembership.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 +47 -47
- 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 +143 -131
- 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 +3 -3
- 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 +2 -2
- 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/organizations.client.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/organizations.client.js +32 -34
- package/dist/prometheus-framework/src/modules/organizations/router/members.router.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/router/members.router.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/store/departments.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/store/departments.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/store/memberships.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/store/memberships.js +30 -32
- 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/LeftoverPositions.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/LeftoverPositions.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/ListPositions.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/ListPositions.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Categories.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 +2 -2
- 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 +155 -187
- package/dist/prometheus-framework/src/modules/products/components/sections/EditModifications.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/EditModifications.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 +19 -19
- package/dist/prometheus-framework/src/modules/products/components/sections/SectionProduct.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/SectionProduct.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 +1 -1
- package/dist/prometheus-framework/src/modules/users/components/blocks/CardUser.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/users/components/blocks/CardUser.vue.js +26 -22
- 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 +68 -65
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/wallet/views/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-B2xhKZNK.js +1 -0
- package/dist/web-DTzbVshr.mjs +54 -0
- package/package.json +1 -1
- package/src/components/Block/Block.vue +1 -1
- package/src/components/Completion/Completion.vue +2 -2
- package/src/modules/auth/controllers/auth.controller.js +19 -16
- package/src/modules/auth/router/auth.js +4 -0
- package/src/modules/backoffice/router/backoffice.js +3 -3
- package/src/modules/chats/routes/chats.routes.js +1 -2
- package/src/modules/gallery/components/sections/BackofficeGallery.vue +2 -1
- package/src/modules/globals/services/globals.crud.js +2 -0
- package/src/modules/icons/navigation/IconCross.vue +11 -7
- package/src/modules/orders/components/blocks/StatusHistory.vue +8 -11
- package/src/modules/orders/components/pages/OrderBackoffice.vue +37 -50
- package/src/modules/orders/components/pages/OrderCreateBackoffice.vue +8 -4
- package/src/modules/orders/components/pages/Orders.vue +1 -1
- package/src/modules/orders/controllers/orders.controller.js +26 -25
- package/src/modules/orders/models/order.model.js +1 -1
- package/src/modules/orders/routes/orders.routes.js +9 -3
- package/src/modules/orders/store/customers.store.js +1 -1
- package/src/modules/orders/store/models/order.js +33 -0
- package/src/modules/orders/store/orders.js +7 -28
- package/src/modules/organizations/components/blocks/CardDepartment.vue +2 -2
- package/src/modules/organizations/components/pages/DepartmentEdit.vue +7 -5
- package/src/modules/organizations/components/pages/Members.vue +50 -38
- package/src/modules/organizations/components/pages/Organization.vue +1 -1
- package/src/modules/organizations/components/pages/Organizations.vue +2 -1
- package/src/modules/organizations/controllers/invites.controller.js +2 -0
- package/src/modules/organizations/controllers/memberships.controller.js +35 -11
- package/src/modules/organizations/controllers/organizations.controller.js +5 -4
- package/src/modules/organizations/models/invite.model.js +4 -0
- package/src/modules/organizations/organizations.client.js +0 -2
- package/src/modules/organizations/router/members.router.js +1 -1
- package/src/modules/organizations/store/departments.js +0 -1
- package/src/modules/organizations/store/memberships.js +1 -8
- package/src/modules/products/components/pages/ProductEdit.vue +39 -33
- package/src/modules/products/components/sections/EditProductInfo.vue +3 -3
- package/src/modules/users/components/blocks/CardUser.vue +9 -5
- package/src/modules/users/components/pages/Profile.vue +5 -3
- package/src/modules/users/components/pages/ProfileBlogposts.vue +1 -1
- package/src/modules/users/components/sections/ProfileCompletion.vue +2 -2
- package/src/modules/organizations/components/blocks/DepartmentMemberModify.vue +0 -126
- package/src/modules/users/components/pages/ProfileOrganizations.vue +0 -97
package/dist/orders.server.js
CHANGED
@@ -3,8 +3,8 @@ const _commonjsHelpers = require("./_commonjsHelpers-DHfMLFPC.js");
|
|
3
3
|
const ownership_schema = require("./ownership.schema-DN0SlQL6.js");
|
4
4
|
const profile_schema = require("./profile.schema-CkOhhf37.js");
|
5
5
|
const credentials_schema = require("./credentials.schema-B-KD_ozQ.js");
|
6
|
-
const mailing = require("./mailing-BX0q8DIs.js");
|
7
6
|
const queryProcessor = require("./queryProcessor-DRMo_GWK.js");
|
7
|
+
const mailing = require("./mailing-BX0q8DIs.js");
|
8
8
|
const index = require("./index-BCCiEK_u.js");
|
9
9
|
const require$$0 = require("node-cache");
|
10
10
|
const applyOwnershipSchema$1 = ownership_schema.ownership_schema;
|
@@ -40,7 +40,7 @@ var order_model = (db) => {
|
|
40
40
|
type: String,
|
41
41
|
trim: true
|
42
42
|
},
|
43
|
-
|
43
|
+
user: {
|
44
44
|
type: db.mongoose.Schema.Types.ObjectId,
|
45
45
|
ref: "User"
|
46
46
|
},
|
@@ -200,8 +200,8 @@ var application_model = (db) => {
|
|
200
200
|
const Application = db.mongoose.model("Application", ApplicationSchema);
|
201
201
|
return Application;
|
202
202
|
};
|
203
|
-
const { sendChatMessageTelegram } = mailing.mailing;
|
204
203
|
const queryProcessorGlobals = queryProcessor.queryProcessor;
|
204
|
+
const { sendChatMessageTelegram } = mailing.mailing;
|
205
205
|
function formatPositions(positions) {
|
206
206
|
return positions.map((pos) => `🔹 ${pos.name} - Price: $${pos.price}, Quantity: ${pos.quantity}`).join("\n");
|
207
207
|
}
|
@@ -229,6 +229,7 @@ async function findOrCreateCustomer(Customer, customerInfo, orderOwner, orderCre
|
|
229
229
|
searchCriteria.email = customerInfo.email;
|
230
230
|
}
|
231
231
|
let customer = null;
|
232
|
+
console.log(searchCriteria);
|
232
233
|
if (Object.keys(searchCriteria).length > 0) {
|
233
234
|
customer = await Customer.findOne({ $or: [searchCriteria] });
|
234
235
|
}
|
@@ -237,12 +238,12 @@ async function findOrCreateCustomer(Customer, customerInfo, orderOwner, orderCre
|
|
237
238
|
...customerInfo,
|
238
239
|
owner: orderOwner,
|
239
240
|
creator: {
|
240
|
-
type: customerInfo.creator
|
241
|
-
target: customerInfo.creator
|
241
|
+
type: customerInfo.creator?.type || orderCreator.type,
|
242
|
+
target: customerInfo.creator?.target || orderCreator.target
|
242
243
|
},
|
243
244
|
identity: {
|
244
|
-
type: customerInfo.identity
|
245
|
-
target: customerInfo.identity
|
245
|
+
type: customerInfo.identity?.type || orderCreator.type,
|
246
|
+
target: customerInfo.identity?.target || orderCreator.target
|
246
247
|
}
|
247
248
|
};
|
248
249
|
customer = await Customer.create(newCustomerData);
|
@@ -257,23 +258,20 @@ async function sendOrderMessage(orderData) {
|
|
257
258
|
console.error(err);
|
258
259
|
}
|
259
260
|
}
|
260
|
-
function initializeOrder(orderData, userId) {
|
261
|
-
orderData.status = "created";
|
262
|
-
orderData.status_history = orderData.status_history || [];
|
263
|
-
orderData.status_history.push({
|
264
|
-
status: orderData.status,
|
265
|
-
changedBy: userId,
|
266
|
-
timestamp: /* @__PURE__ */ new Date(),
|
267
|
-
comment: ""
|
268
|
-
});
|
269
|
-
}
|
270
261
|
const controllerFactory$1 = (db) => {
|
271
262
|
const Order = db.order;
|
272
263
|
const Customer = db.customer;
|
273
264
|
const create = async (req, res) => {
|
274
265
|
const orderData = req.body;
|
275
|
-
|
276
|
-
|
266
|
+
req.userId;
|
267
|
+
orderData.status = "created";
|
268
|
+
orderData.status_history = orderData.status_history || [];
|
269
|
+
orderData.status_history.push({
|
270
|
+
status: orderData.status,
|
271
|
+
user: new db.mongoose.Types.ObjectId(req.userId),
|
272
|
+
timestamp: /* @__PURE__ */ new Date(),
|
273
|
+
comment: ""
|
274
|
+
});
|
277
275
|
try {
|
278
276
|
if (!orderData.customer.target) {
|
279
277
|
let customer = await findOrCreateCustomer(Customer, orderData.customer, orderData.owner, orderData.creator);
|
@@ -339,16 +337,16 @@ const controllerFactory$1 = (db) => {
|
|
339
337
|
}
|
340
338
|
};
|
341
339
|
const update = async (req, res) => {
|
342
|
-
console.log(req.body);
|
343
340
|
const order = await Order.findOne({ _id: req.body._id });
|
344
341
|
if (!order) {
|
345
342
|
return res.status(404).send({ errorCode: "ORDER_NOT_FOUND", message: "Order not found." });
|
346
343
|
}
|
344
|
+
console.log("order status is", req.userId);
|
347
345
|
if (req.body.status && req.body.status !== order.status) {
|
348
346
|
order.status = req.body.status;
|
349
347
|
order.status_history.push({
|
350
348
|
status: req.body.status,
|
351
|
-
|
349
|
+
user: new db.mongoose.Types.ObjectId(req.userId),
|
352
350
|
timestamp: /* @__PURE__ */ new Date(),
|
353
351
|
comment: ""
|
354
352
|
});
|
@@ -364,7 +362,7 @@ const controllerFactory$1 = (db) => {
|
|
364
362
|
try {
|
365
363
|
const order = await Order.findOneAndUpdate(
|
366
364
|
{ _id: req.params._id },
|
367
|
-
{ status: "
|
365
|
+
{ status: "closed", payment: { type: "Cash", status: "paid" } },
|
368
366
|
{ new: true }
|
369
367
|
).exec();
|
370
368
|
if (!order) {
|
@@ -402,6 +400,9 @@ var orders_routes = function(app, db, origins, publicPath) {
|
|
402
400
|
const middleware = middlewareFactory(db);
|
403
401
|
app.post(
|
404
402
|
"/api/orders/create",
|
403
|
+
[
|
404
|
+
middleware.authJwt.verifyToken
|
405
|
+
],
|
405
406
|
controller.create
|
406
407
|
);
|
407
408
|
app.get(
|
@@ -417,6 +418,9 @@ var orders_routes = function(app, db, origins, publicPath) {
|
|
417
418
|
);
|
418
419
|
app.post(
|
419
420
|
"/api/orders/delete",
|
421
|
+
[
|
422
|
+
middleware.authJwt.verifyToken
|
423
|
+
],
|
420
424
|
controller.deleteOrder
|
421
425
|
);
|
422
426
|
};
|
package/dist/orders.server.mjs
CHANGED
@@ -2,8 +2,8 @@ import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-CUmg6egw.mjs";
|
|
2
2
|
import { o as ownership_schema } from "./ownership.schema-oyx6eNkZ.mjs";
|
3
3
|
import { p as profile_schema } from "./profile.schema-24ZpZQJe.mjs";
|
4
4
|
import { c as credentials_schema } from "./credentials.schema-C9dmNy7o.mjs";
|
5
|
-
import { m as mailing } from "./mailing-Cdp8NXhP.mjs";
|
6
5
|
import { q as queryProcessor } from "./queryProcessor-BJdKh0Ow.mjs";
|
6
|
+
import { m as mailing } from "./mailing-Cdp8NXhP.mjs";
|
7
7
|
import { s as server } from "./index-B6a1mPgp.mjs";
|
8
8
|
import require$$0 from "node-cache";
|
9
9
|
const applyOwnershipSchema$1 = ownership_schema;
|
@@ -39,7 +39,7 @@ var order_model = (db) => {
|
|
39
39
|
type: String,
|
40
40
|
trim: true
|
41
41
|
},
|
42
|
-
|
42
|
+
user: {
|
43
43
|
type: db.mongoose.Schema.Types.ObjectId,
|
44
44
|
ref: "User"
|
45
45
|
},
|
@@ -199,8 +199,8 @@ var application_model = (db) => {
|
|
199
199
|
const Application = db.mongoose.model("Application", ApplicationSchema);
|
200
200
|
return Application;
|
201
201
|
};
|
202
|
-
const { sendChatMessageTelegram } = mailing;
|
203
202
|
const queryProcessorGlobals = queryProcessor;
|
203
|
+
const { sendChatMessageTelegram } = mailing;
|
204
204
|
function formatPositions(positions) {
|
205
205
|
return positions.map((pos) => `🔹 ${pos.name} - Price: $${pos.price}, Quantity: ${pos.quantity}`).join("\n");
|
206
206
|
}
|
@@ -228,6 +228,7 @@ async function findOrCreateCustomer(Customer, customerInfo, orderOwner, orderCre
|
|
228
228
|
searchCriteria.email = customerInfo.email;
|
229
229
|
}
|
230
230
|
let customer = null;
|
231
|
+
console.log(searchCriteria);
|
231
232
|
if (Object.keys(searchCriteria).length > 0) {
|
232
233
|
customer = await Customer.findOne({ $or: [searchCriteria] });
|
233
234
|
}
|
@@ -236,12 +237,12 @@ async function findOrCreateCustomer(Customer, customerInfo, orderOwner, orderCre
|
|
236
237
|
...customerInfo,
|
237
238
|
owner: orderOwner,
|
238
239
|
creator: {
|
239
|
-
type: customerInfo.creator
|
240
|
-
target: customerInfo.creator
|
240
|
+
type: customerInfo.creator?.type || orderCreator.type,
|
241
|
+
target: customerInfo.creator?.target || orderCreator.target
|
241
242
|
},
|
242
243
|
identity: {
|
243
|
-
type: customerInfo.identity
|
244
|
-
target: customerInfo.identity
|
244
|
+
type: customerInfo.identity?.type || orderCreator.type,
|
245
|
+
target: customerInfo.identity?.target || orderCreator.target
|
245
246
|
}
|
246
247
|
};
|
247
248
|
customer = await Customer.create(newCustomerData);
|
@@ -256,23 +257,20 @@ async function sendOrderMessage(orderData) {
|
|
256
257
|
console.error(err);
|
257
258
|
}
|
258
259
|
}
|
259
|
-
function initializeOrder(orderData, userId) {
|
260
|
-
orderData.status = "created";
|
261
|
-
orderData.status_history = orderData.status_history || [];
|
262
|
-
orderData.status_history.push({
|
263
|
-
status: orderData.status,
|
264
|
-
changedBy: userId,
|
265
|
-
timestamp: /* @__PURE__ */ new Date(),
|
266
|
-
comment: ""
|
267
|
-
});
|
268
|
-
}
|
269
260
|
const controllerFactory$1 = (db) => {
|
270
261
|
const Order = db.order;
|
271
262
|
const Customer = db.customer;
|
272
263
|
const create = async (req, res) => {
|
273
264
|
const orderData = req.body;
|
274
|
-
|
275
|
-
|
265
|
+
req.userId;
|
266
|
+
orderData.status = "created";
|
267
|
+
orderData.status_history = orderData.status_history || [];
|
268
|
+
orderData.status_history.push({
|
269
|
+
status: orderData.status,
|
270
|
+
user: new db.mongoose.Types.ObjectId(req.userId),
|
271
|
+
timestamp: /* @__PURE__ */ new Date(),
|
272
|
+
comment: ""
|
273
|
+
});
|
276
274
|
try {
|
277
275
|
if (!orderData.customer.target) {
|
278
276
|
let customer = await findOrCreateCustomer(Customer, orderData.customer, orderData.owner, orderData.creator);
|
@@ -338,16 +336,16 @@ const controllerFactory$1 = (db) => {
|
|
338
336
|
}
|
339
337
|
};
|
340
338
|
const update = async (req, res) => {
|
341
|
-
console.log(req.body);
|
342
339
|
const order = await Order.findOne({ _id: req.body._id });
|
343
340
|
if (!order) {
|
344
341
|
return res.status(404).send({ errorCode: "ORDER_NOT_FOUND", message: "Order not found." });
|
345
342
|
}
|
343
|
+
console.log("order status is", req.userId);
|
346
344
|
if (req.body.status && req.body.status !== order.status) {
|
347
345
|
order.status = req.body.status;
|
348
346
|
order.status_history.push({
|
349
347
|
status: req.body.status,
|
350
|
-
|
348
|
+
user: new db.mongoose.Types.ObjectId(req.userId),
|
351
349
|
timestamp: /* @__PURE__ */ new Date(),
|
352
350
|
comment: ""
|
353
351
|
});
|
@@ -363,7 +361,7 @@ const controllerFactory$1 = (db) => {
|
|
363
361
|
try {
|
364
362
|
const order = await Order.findOneAndUpdate(
|
365
363
|
{ _id: req.params._id },
|
366
|
-
{ status: "
|
364
|
+
{ status: "closed", payment: { type: "Cash", status: "paid" } },
|
367
365
|
{ new: true }
|
368
366
|
).exec();
|
369
367
|
if (!order) {
|
@@ -401,6 +399,9 @@ var orders_routes = function(app, db, origins, publicPath) {
|
|
401
399
|
const middleware = middlewareFactory(db);
|
402
400
|
app.post(
|
403
401
|
"/api/orders/create",
|
402
|
+
[
|
403
|
+
middleware.authJwt.verifyToken
|
404
|
+
],
|
404
405
|
controller.create
|
405
406
|
);
|
406
407
|
app.get(
|
@@ -416,6 +417,9 @@ var orders_routes = function(app, db, origins, publicPath) {
|
|
416
417
|
);
|
417
418
|
app.post(
|
418
419
|
"/api/orders/delete",
|
420
|
+
[
|
421
|
+
middleware.authJwt.verifyToken
|
422
|
+
],
|
419
423
|
controller.deleteOrder
|
420
424
|
);
|
421
425
|
};
|
@@ -456,16 +456,18 @@ const controllerFactory$4 = (db) => {
|
|
456
456
|
const Membership = db.membership;
|
457
457
|
const read = async (req, res2) => {
|
458
458
|
try {
|
459
|
+
let search = req.query.search;
|
460
|
+
let regexPattern = "";
|
461
|
+
if (search) {
|
462
|
+
search = search.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
|
463
|
+
const parts = search.split(".");
|
464
|
+
if (parts.length === 2) {
|
465
|
+
regexPattern = parts.map((part) => part.substr(0, part.length - 1) + ".{1}").join("\\.");
|
466
|
+
} else {
|
467
|
+
regexPattern = search.substr(0, search.length - 1) + ".{1}";
|
468
|
+
}
|
469
|
+
}
|
459
470
|
const memberships = await Membership.aggregate([
|
460
|
-
{
|
461
|
-
$match: {
|
462
|
-
...req.query.user && { user: new ObjectId$1(req.query.user) },
|
463
|
-
...req.query.type && { type: req.query.type },
|
464
|
-
...req.query.target && { target: new ObjectId$1(req.query.target) },
|
465
|
-
// ...(req.query.role && { role: req.query.role }),
|
466
|
-
...req.query.role && { role: { $in: req.query.role } }
|
467
|
-
}
|
468
|
-
},
|
469
471
|
{
|
470
472
|
$lookup: {
|
471
473
|
from: "users",
|
@@ -474,6 +476,21 @@ const controllerFactory$4 = (db) => {
|
|
474
476
|
as: "user"
|
475
477
|
}
|
476
478
|
},
|
479
|
+
{
|
480
|
+
$match: {
|
481
|
+
...req.query.user && { user: new ObjectId$1(req.query.user) },
|
482
|
+
...req.query.type && { type: req.query.type },
|
483
|
+
...req.query.target && { target: new ObjectId$1(req.query.target) },
|
484
|
+
...req.query.role && { role: { $in: req.query.role } },
|
485
|
+
...req.query.search && {
|
486
|
+
$or: [
|
487
|
+
{ "user.profile.name": { $regex: regexPattern, $options: "i" } },
|
488
|
+
{ "user.email": { $regex: regexPattern, $options: "i" } },
|
489
|
+
{ "user.phone": { $regex: regexPattern, $options: "i" } }
|
490
|
+
]
|
491
|
+
}
|
492
|
+
}
|
493
|
+
},
|
477
494
|
{
|
478
495
|
$unwind: "$user"
|
479
496
|
}
|
@@ -481,6 +498,7 @@ const controllerFactory$4 = (db) => {
|
|
481
498
|
if (!memberships || memberships.length === 0) {
|
482
499
|
return res2.status(404).send({ errorCode: "MEMBERSHIPS_NOT_FOUND" });
|
483
500
|
}
|
501
|
+
console.log("membership is", memberships[0].user);
|
484
502
|
res2.send(memberships);
|
485
503
|
} catch (err) {
|
486
504
|
console.log(err);
|
@@ -488,7 +506,6 @@ const controllerFactory$4 = (db) => {
|
|
488
506
|
}
|
489
507
|
};
|
490
508
|
const create = async (req, res2) => {
|
491
|
-
console.log(req.body);
|
492
509
|
const newMembership = new Membership({
|
493
510
|
user: req.body.user,
|
494
511
|
type: req.body.type,
|
@@ -1044,6 +1061,10 @@ var invite_model = (db) => {
|
|
1044
1061
|
type: String,
|
1045
1062
|
enum: ["active", "used", "deactivated"],
|
1046
1063
|
default: "active"
|
1064
|
+
},
|
1065
|
+
role: {
|
1066
|
+
type: String,
|
1067
|
+
default: "member"
|
1047
1068
|
}
|
1048
1069
|
}, {
|
1049
1070
|
timestamps: true
|
@@ -455,16 +455,18 @@ const controllerFactory$4 = (db) => {
|
|
455
455
|
const Membership = db.membership;
|
456
456
|
const read = async (req, res2) => {
|
457
457
|
try {
|
458
|
+
let search = req.query.search;
|
459
|
+
let regexPattern = "";
|
460
|
+
if (search) {
|
461
|
+
search = search.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
|
462
|
+
const parts = search.split(".");
|
463
|
+
if (parts.length === 2) {
|
464
|
+
regexPattern = parts.map((part) => part.substr(0, part.length - 1) + ".{1}").join("\\.");
|
465
|
+
} else {
|
466
|
+
regexPattern = search.substr(0, search.length - 1) + ".{1}";
|
467
|
+
}
|
468
|
+
}
|
458
469
|
const memberships = await Membership.aggregate([
|
459
|
-
{
|
460
|
-
$match: {
|
461
|
-
...req.query.user && { user: new ObjectId$1(req.query.user) },
|
462
|
-
...req.query.type && { type: req.query.type },
|
463
|
-
...req.query.target && { target: new ObjectId$1(req.query.target) },
|
464
|
-
// ...(req.query.role && { role: req.query.role }),
|
465
|
-
...req.query.role && { role: { $in: req.query.role } }
|
466
|
-
}
|
467
|
-
},
|
468
470
|
{
|
469
471
|
$lookup: {
|
470
472
|
from: "users",
|
@@ -473,6 +475,21 @@ const controllerFactory$4 = (db) => {
|
|
473
475
|
as: "user"
|
474
476
|
}
|
475
477
|
},
|
478
|
+
{
|
479
|
+
$match: {
|
480
|
+
...req.query.user && { user: new ObjectId$1(req.query.user) },
|
481
|
+
...req.query.type && { type: req.query.type },
|
482
|
+
...req.query.target && { target: new ObjectId$1(req.query.target) },
|
483
|
+
...req.query.role && { role: { $in: req.query.role } },
|
484
|
+
...req.query.search && {
|
485
|
+
$or: [
|
486
|
+
{ "user.profile.name": { $regex: regexPattern, $options: "i" } },
|
487
|
+
{ "user.email": { $regex: regexPattern, $options: "i" } },
|
488
|
+
{ "user.phone": { $regex: regexPattern, $options: "i" } }
|
489
|
+
]
|
490
|
+
}
|
491
|
+
}
|
492
|
+
},
|
476
493
|
{
|
477
494
|
$unwind: "$user"
|
478
495
|
}
|
@@ -480,6 +497,7 @@ const controllerFactory$4 = (db) => {
|
|
480
497
|
if (!memberships || memberships.length === 0) {
|
481
498
|
return res2.status(404).send({ errorCode: "MEMBERSHIPS_NOT_FOUND" });
|
482
499
|
}
|
500
|
+
console.log("membership is", memberships[0].user);
|
483
501
|
res2.send(memberships);
|
484
502
|
} catch (err) {
|
485
503
|
console.log(err);
|
@@ -487,7 +505,6 @@ const controllerFactory$4 = (db) => {
|
|
487
505
|
}
|
488
506
|
};
|
489
507
|
const create = async (req, res2) => {
|
490
|
-
console.log(req.body);
|
491
508
|
const newMembership = new Membership({
|
492
509
|
user: req.body.user,
|
493
510
|
type: req.body.type,
|
@@ -1043,6 +1060,10 @@ var invite_model = (db) => {
|
|
1043
1060
|
type: String,
|
1044
1061
|
enum: ["active", "used", "deactivated"],
|
1045
1062
|
default: "active"
|
1063
|
+
},
|
1064
|
+
role: {
|
1065
|
+
type: String,
|
1066
|
+
default: "member"
|
1046
1067
|
}
|
1047
1068
|
}, {
|
1048
1069
|
timestamps: true
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),i=require("../Tooltip/Tooltip.
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),i=require("../Tooltip/Tooltip.vue.cjs"),a={class:"bg-grey pd-medium radius-big"},c={key:0,class:"mn-b-small flex-v-center flex-nowrap flex"},s={key:0,class:"mn-r-thin t-medium p-big"},u=["onClick"],d=e.createElementVNode("p",{class:"bg-main radius-small t-center i-medium"},"i",-1),m={key:1,class:"w-100"},k={__name:"Block",props:{title:{type:String,default:null},tooltip:{type:String,default:null},actions:{type:Array,default:null},placeholder:{type:String,default:"Nothing here"},options:{type:Object,default:{theme:"white"}}},setup(t){e.useSlots();const r=(n,o={})=>n?n(o).some(l=>Array.isArray(l.children)?!!l.children.length:l.type!==e.Comment):!1;return(n,o)=>(e.openBlock(),e.createElementBlock("div",a,[t.title||t.actions?(e.openBlock(),e.createElementBlock("div",c,[t.title?(e.openBlock(),e.createElementBlock("p",s,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.actions,l=>(e.openBlock(),e.createElementBlock("button",{onClick:l.function,class:e.normalizeClass(["pd-thin button-delete button",l.class||"bg-main radius-small t-center i-medium"])},e.toDisplayString(l.label),11,u))),256)),t.tooltip?(e.openBlock(),e.createBlock(i.default,{key:1,text:t.tooltip},{default:e.withCtx(()=>[d]),_:1},8,["text"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),r(n.$slots.default)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",m,e.toDisplayString(t.placeholder),1)),e.renderSlot(n.$slots,"default")]))}};exports.default=k;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { useSlots as u, openBlock as l, createElementBlock as n, toDisplayString as o, createCommentVNode as r, Fragment as c, renderList as d, normalizeClass as m, createBlock as h, withCtx as f, renderSlot as y, createElementVNode as p, Comment as g } from "vue";
|
2
|
-
import b from "../Tooltip/Tooltip.
|
3
|
-
const k = { class: "bg-grey pd-medium radius-
|
2
|
+
import b from "../Tooltip/Tooltip.vue.js";
|
3
|
+
const k = { class: "bg-grey pd-medium radius-big" }, C = {
|
4
4
|
key: 0,
|
5
5
|
class: "mn-b-small flex-v-center flex-nowrap flex"
|
6
6
|
}, S = {
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),f=require("../Loader/Loader.vue2.cjs");require("./Button.vue2.cjs");const v=["disabled"],b={key:2,class:"t-semi loading t-black"},m={key:3,class:"error"},y={key:0,class:"button-counter"},k={__name:"Button",props:{submit:{type:Function,default:async()=>{console.log("Button click.")}},text:{type:Object,default:t=>(console.log(t),t={...t.text,success:"✔",error:"✖"})},counter:{type:Object},callback:{type:Function,default:async()=>{console.log("Button callback.")}},callbackDelay:{type:Number,default:750},showSucces:{type:Boolean,default:!0},showLoader:{type:Boolean,default:!0},validation:{type:Boolean,default:!1}},emits:["error"],setup(t,{emit:r}){const o=t,i=r,l=e.ref(null),a=e.ref(null),s=e.ref(!1),n=e.ref(!1);async function d(){l.value.style["pointer-events"]="none",a.value=null,s.value=!0;const c=()=>{l.value&&(l.value.classList.replace("bg-second","bg-main"),l.value.style.pointerEvents="auto",s.value=!1,n.value=!1,a.value=null)};try{await o.submit(),l.value.classList.replace("bg-main","bg-second"),s.value=!1,o.showSucces?(n.value=!0,setTimeout(c,500)):c(),o.callback&&setTimeout(()=>o.callback(),o.callbackDelay)}catch(u){i("error",u),l.value.classList.replace("bg-main","bg-fourth-nano"),a.value=o.error,setTimeout(()=>{c(),l.value.classList.replace("bg-fourth-nano","bg-main")},1330)}}return(c,u)=>(e.openBlock(),e.createElementBlock("button",{onClick:e.withModifiers(d,["stop"]),disabled:t.validation,ref_key:"button",ref:l,class:"button"},[e.createVNode(e.Transition,{name:"moveFromTopAbsolute"},{default:e.withCtx(()=>[!s.value&&!a.value&&!n.value||!t.showLoader?e.renderSlot(c.$slots,"default",{key:0}):s.value&&!a.value&&t.showLoader?(e.openBlock(),e.createBlock(f.default,{key:1,class:"pos-relative pos-t-0 pos-l-0 loading"})):n.value&&t.showSucces?(e.openBlock(),e.createElementBlock("span",b,e.toDisplayString(t.text.success),1)):a.value?(e.openBlock(),e.createElementBlock("span",m,e.toDisplayString(a.value),1)):e.createCommentVNode("",!0)]),_:3}),t.counter?(e.openBlock(),e.createElementBlock("p",y,e.toDisplayString(t.counter),1)):e.createCommentVNode("",!0)],8,v))}};exports.default=k;
|
@@ -1 +1,94 @@
|
|
1
|
-
|
1
|
+
import { ref as n, openBlock as c, createElementBlock as r, withModifiers as y, createVNode as k, Transition as h, withCtx as p, renderSlot as g, createBlock as B, toDisplayString as i, createCommentVNode as f } from "vue";
|
2
|
+
import w from "../Loader/Loader.vue2.js";
|
3
|
+
import "./Button.vue2.js";
|
4
|
+
const L = ["disabled"], S = {
|
5
|
+
key: 2,
|
6
|
+
class: "t-semi loading t-black"
|
7
|
+
}, T = {
|
8
|
+
key: 3,
|
9
|
+
class: "error"
|
10
|
+
}, x = {
|
11
|
+
key: 0,
|
12
|
+
class: "button-counter"
|
13
|
+
}, j = {
|
14
|
+
__name: "Button",
|
15
|
+
props: {
|
16
|
+
submit: {
|
17
|
+
type: Function,
|
18
|
+
default: async () => {
|
19
|
+
console.log("Button click.");
|
20
|
+
}
|
21
|
+
},
|
22
|
+
text: {
|
23
|
+
type: Object,
|
24
|
+
default: (e) => (console.log(e), e = {
|
25
|
+
...e.text,
|
26
|
+
success: "✔",
|
27
|
+
error: "✖"
|
28
|
+
})
|
29
|
+
},
|
30
|
+
counter: {
|
31
|
+
type: Object
|
32
|
+
},
|
33
|
+
callback: {
|
34
|
+
type: Function,
|
35
|
+
default: async () => {
|
36
|
+
console.log("Button callback.");
|
37
|
+
}
|
38
|
+
},
|
39
|
+
callbackDelay: {
|
40
|
+
type: Number,
|
41
|
+
default: 750
|
42
|
+
},
|
43
|
+
showSucces: {
|
44
|
+
type: Boolean,
|
45
|
+
default: !0
|
46
|
+
},
|
47
|
+
showLoader: {
|
48
|
+
type: Boolean,
|
49
|
+
default: !0
|
50
|
+
},
|
51
|
+
validation: {
|
52
|
+
type: Boolean,
|
53
|
+
default: !1
|
54
|
+
}
|
55
|
+
},
|
56
|
+
emits: ["error"],
|
57
|
+
setup(e, { emit: b }) {
|
58
|
+
const l = e, v = b, t = n(null), a = n(null), o = n(!1), u = n(!1);
|
59
|
+
async function m() {
|
60
|
+
t.value.style["pointer-events"] = "none", a.value = null, o.value = !0;
|
61
|
+
const s = () => {
|
62
|
+
t.value && (t.value.classList.replace("bg-second", "bg-main"), t.value.style.pointerEvents = "auto", o.value = !1, u.value = !1, a.value = null);
|
63
|
+
};
|
64
|
+
try {
|
65
|
+
await l.submit(), t.value.classList.replace("bg-main", "bg-second"), o.value = !1, l.showSucces ? (u.value = !0, setTimeout(s, 500)) : s(), l.callback && setTimeout(() => l.callback(), l.callbackDelay);
|
66
|
+
} catch (d) {
|
67
|
+
v("error", d), t.value.classList.replace("bg-main", "bg-fourth-nano"), a.value = l.error, setTimeout(() => {
|
68
|
+
s(), t.value.classList.replace("bg-fourth-nano", "bg-main");
|
69
|
+
}, 1330);
|
70
|
+
}
|
71
|
+
}
|
72
|
+
return (s, d) => (c(), r("button", {
|
73
|
+
onClick: y(m, ["stop"]),
|
74
|
+
disabled: e.validation,
|
75
|
+
ref_key: "button",
|
76
|
+
ref: t,
|
77
|
+
class: "button"
|
78
|
+
}, [
|
79
|
+
k(h, { name: "moveFromTopAbsolute" }, {
|
80
|
+
default: p(() => [
|
81
|
+
!o.value && !a.value && !u.value || !e.showLoader ? g(s.$slots, "default", { key: 0 }) : o.value && !a.value && e.showLoader ? (c(), B(w, {
|
82
|
+
key: 1,
|
83
|
+
class: "pos-relative pos-t-0 pos-l-0 loading"
|
84
|
+
})) : u.value && e.showSucces ? (c(), r("span", S, i(e.text.success), 1)) : a.value ? (c(), r("span", T, i(a.value), 1)) : f("", !0)
|
85
|
+
]),
|
86
|
+
_: 3
|
87
|
+
}),
|
88
|
+
e.counter ? (c(), r("p", x, i(e.counter), 1)) : f("", !0)
|
89
|
+
], 8, L));
|
90
|
+
}
|
91
|
+
};
|
92
|
+
export {
|
93
|
+
j as default
|
94
|
+
};
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";
|
1
|
+
"use strict";
|
@@ -1,94 +1 @@
|
|
1
|
-
|
2
|
-
import w from "../Loader/Loader.vue2.js";
|
3
|
-
import "./Button.vue.js";
|
4
|
-
const L = ["disabled"], S = {
|
5
|
-
key: 2,
|
6
|
-
class: "t-semi loading t-black"
|
7
|
-
}, T = {
|
8
|
-
key: 3,
|
9
|
-
class: "error"
|
10
|
-
}, x = {
|
11
|
-
key: 0,
|
12
|
-
class: "button-counter"
|
13
|
-
}, j = {
|
14
|
-
__name: "Button",
|
15
|
-
props: {
|
16
|
-
submit: {
|
17
|
-
type: Function,
|
18
|
-
default: async () => {
|
19
|
-
console.log("Button click.");
|
20
|
-
}
|
21
|
-
},
|
22
|
-
text: {
|
23
|
-
type: Object,
|
24
|
-
default: (e) => (console.log(e), e = {
|
25
|
-
...e.text,
|
26
|
-
success: "✔",
|
27
|
-
error: "✖"
|
28
|
-
})
|
29
|
-
},
|
30
|
-
counter: {
|
31
|
-
type: Object
|
32
|
-
},
|
33
|
-
callback: {
|
34
|
-
type: Function,
|
35
|
-
default: async () => {
|
36
|
-
console.log("Button callback.");
|
37
|
-
}
|
38
|
-
},
|
39
|
-
callbackDelay: {
|
40
|
-
type: Number,
|
41
|
-
default: 750
|
42
|
-
},
|
43
|
-
showSucces: {
|
44
|
-
type: Boolean,
|
45
|
-
default: !0
|
46
|
-
},
|
47
|
-
showLoader: {
|
48
|
-
type: Boolean,
|
49
|
-
default: !0
|
50
|
-
},
|
51
|
-
validation: {
|
52
|
-
type: Boolean,
|
53
|
-
default: !1
|
54
|
-
}
|
55
|
-
},
|
56
|
-
emits: ["error"],
|
57
|
-
setup(e, { emit: b }) {
|
58
|
-
const l = e, v = b, t = n(null), a = n(null), o = n(!1), u = n(!1);
|
59
|
-
async function m() {
|
60
|
-
t.value.style["pointer-events"] = "none", a.value = null, o.value = !0;
|
61
|
-
const s = () => {
|
62
|
-
t.value && (t.value.classList.replace("bg-second", "bg-main"), t.value.style.pointerEvents = "auto", o.value = !1, u.value = !1, a.value = null);
|
63
|
-
};
|
64
|
-
try {
|
65
|
-
await l.submit(), t.value.classList.replace("bg-main", "bg-second"), o.value = !1, l.showSucces ? (u.value = !0, setTimeout(s, 500)) : s(), l.callback && setTimeout(() => l.callback(), l.callbackDelay);
|
66
|
-
} catch (d) {
|
67
|
-
v("error", d), t.value.classList.replace("bg-main", "bg-fourth-nano"), a.value = l.error, setTimeout(() => {
|
68
|
-
s(), t.value.classList.replace("bg-fourth-nano", "bg-main");
|
69
|
-
}, 1330);
|
70
|
-
}
|
71
|
-
}
|
72
|
-
return (s, d) => (c(), r("button", {
|
73
|
-
onClick: y(m, ["stop"]),
|
74
|
-
disabled: e.validation,
|
75
|
-
ref_key: "button",
|
76
|
-
ref: t,
|
77
|
-
class: "button"
|
78
|
-
}, [
|
79
|
-
k(h, { name: "moveFromTopAbsolute" }, {
|
80
|
-
default: p(() => [
|
81
|
-
!o.value && !a.value && !u.value || !e.showLoader ? g(s.$slots, "default", { key: 0 }) : o.value && !a.value && e.showLoader ? (c(), B(w, {
|
82
|
-
key: 1,
|
83
|
-
class: "pos-relative pos-t-0 pos-l-0 loading"
|
84
|
-
})) : u.value && e.showSucces ? (c(), r("span", S, i(e.text.success), 1)) : a.value ? (c(), r("span", T, i(a.value), 1)) : f("", !0)
|
85
|
-
]),
|
86
|
-
_: 3
|
87
|
-
}),
|
88
|
-
e.counter ? (c(), r("p", x, i(e.counter), 1)) : f("", !0)
|
89
|
-
], 8, L));
|
90
|
-
}
|
91
|
-
};
|
92
|
-
export {
|
93
|
-
j as default
|
94
|
-
};
|
1
|
+
|