@ozdao/prometheus-framework 0.2.60 → 0.2.61
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/auth.server.js +12 -223
- package/dist/auth.server.mjs +12 -223
- package/dist/community.server.js +3 -2
- package/dist/community.server.mjs +2 -1
- package/dist/events.server.js +101 -29
- package/dist/events.server.mjs +100 -28
- package/dist/files.server.js +7 -7
- package/dist/files.server.mjs +7 -7
- package/dist/gallery.server.js +2 -2
- package/dist/gallery.server.mjs +2 -2
- package/dist/main-DsseFd2d.mjs +13753 -0
- package/dist/main-U466Gwzt.js +91 -0
- package/dist/main.css +1 -1
- package/dist/metadata.schema-CS6_9GLU.js +174 -0
- package/dist/metadata.schema-D88c1Ebp.mjs +175 -0
- package/dist/organizations.server.js +212 -16
- package/dist/organizations.server.mjs +212 -16
- package/dist/ownership.schema-DN0SlQL6.js +36 -0
- package/dist/ownership.schema-oyx6eNkZ.mjs +37 -0
- package/dist/products.server.js +8 -5
- package/dist/products.server.mjs +8 -5
- package/dist/prometheus-framework/src/components/Chips/Chips.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Chips/Chips.vue.js +19 -14
- package/dist/prometheus-framework/src/components/Feed/Feed.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Feed/Feed.vue.js +27 -27
- package/dist/prometheus-framework/src/components/Loader/Loader.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Loader/Loader.vue.js +1 -51
- package/dist/prometheus-framework/src/components/Loader/Loader.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Loader/Loader.vue2.js +51 -1
- package/dist/prometheus-framework/src/components/Popup/Popup.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Popup/Popup.vue.js +1 -72
- package/dist/prometheus-framework/src/components/Popup/Popup.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Popup/Popup.vue2.js +72 -1
- package/dist/prometheus-framework/src/components/Select/Select.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Select/Select.vue.js +1 -97
- package/dist/prometheus-framework/src/components/Select/Select.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Select/Select.vue2.js +97 -1
- package/dist/prometheus-framework/src/components/Slider/Slider.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Slider/Slider.vue.js +1 -1
- package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue.js +1 -36
- package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue2.js +36 -1
- package/dist/prometheus-framework/src/components/Tab/Tab.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Tab/Tab.vue.js +46 -1
- package/dist/prometheus-framework/src/components/Tab/Tab.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Tab/Tab.vue2.js +1 -46
- package/dist/prometheus-framework/src/components/UploadImageMultiple/UploadImageMultiple.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/UploadImageMultiple/UploadImageMultiple.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/auth/auth.client.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/auth.client.js +12 -14
- 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 +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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +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/BlogPost.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/pages/BlogPost.vue.js +1 -1
- 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 +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 +1 -1
- package/dist/prometheus-framework/src/modules/community/components/sections/Feed.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/sections/Feed.vue.js +1 -1
- 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/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 +198 -184
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.cjs +1 -0
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.js +168 -0
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue2.cjs +1 -0
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue2.js +1 -0
- package/dist/prometheus-framework/src/modules/events/components/pages/Event.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/Event.vue.js +1 -1
- 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 +3 -3
- package/dist/prometheus-framework/src/modules/events/components/sections/Feed.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/sections/Feed.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/events/components/sections/List.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/sections/List.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/events/router/events.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/router/events.js +11 -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 +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/globals/components/blocks/CardHeader.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.js +67 -64
- 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 +2 -2
- 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 +1 -1
- 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 +1 -1
- 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/Department.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Department.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 +4 -4
- 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 +3 -3
- 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 +24 -24
- 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 +3 -3
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Organizations.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Organizations.vue.js +1 -1
- 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/Feed.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Feed.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 +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 +3 -3
- package/dist/prometheus-framework/src/modules/organizations/organizations.client.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/organizations.client.js +40 -38
- package/dist/prometheus-framework/src/modules/organizations/store/departments.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/store/departments.js +19 -19
- package/dist/prometheus-framework/src/modules/organizations/store/invites.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/store/invites.js +5 -5
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardLeftover.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardLeftover.vue.js +36 -27
- 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/Images360.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/Images360.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 +7 -7
- package/dist/prometheus-framework/src/modules/products/components/pages/Leftovers.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Leftovers.vue.js +21 -21
- 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 +2 -2
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductRecommmendation.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductRecommmendation.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.js +36 -50
- 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/products/components/sections/FilterProducts.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/FilterProducts.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/PopularProducts.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/PopularProducts.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/ProfileBlogposts.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileBlogposts.vue.js +1 -1
- 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 +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEvents.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEvents.vue.js +1 -1
- 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-D7bW32Ul.mjs +54 -0
- package/dist/web-DpE9HxA3.js +1 -0
- package/package.json +1 -1
- package/src/components/Chips/Chips.vue +2 -2
- package/src/components/Feed/Feed.vue +2 -1
- package/src/modules/auth/auth.client.js +0 -2
- package/src/modules/auth/auth.server.js +1 -7
- package/src/modules/auth/components/pages/Invite.vue +1 -1
- package/src/modules/events/components/pages/EditEvent.vue +19 -0
- package/src/modules/events/components/pages/EditEventTickets.vue +194 -0
- package/src/modules/events/controllers/tickets.controller.js +103 -28
- package/src/modules/events/models/ticket.model.js +22 -4
- package/src/modules/events/router/events.js +5 -0
- package/src/modules/events/routes/tickets.routes.js +2 -2
- package/src/modules/events/store/tickets.js +1 -0
- package/src/modules/globals/components/blocks/CardHeader.vue +6 -6
- package/src/modules/organizations/components/pages/Members.vue +1 -1
- package/src/modules/organizations/components/pages/Organization.vue +4 -4
- package/src/modules/organizations/components/sections/MembersAdd.vue +1 -1
- package/src/modules/organizations/controllers/departments.controller.js +14 -1
- package/src/modules/organizations/models/department.model.js +5 -1
- package/src/modules/organizations/organizations.client.js +2 -0
- package/src/modules/organizations/organizations.server.js +6 -2
- package/src/modules/organizations/routes/departments.routes.js +1 -1
- package/src/modules/organizations/store/departments.js +3 -2
- package/src/modules/products/components/blocks/CardLeftover.vue +19 -7
- package/src/modules/products/components/pages/EditLeftover.vue +1 -1
- package/src/modules/products/components/pages/Leftovers.vue +14 -3
- package/src/modules/products/components/pages/Products.vue +8 -8
- package/src/modules/products/models/leftover.model.js +9 -5
- package/src/modules/users/models/client.model.js +60 -0
- /package/src/modules/{auth → organizations}/controllers/invites.controller.js +0 -0
- /package/src/modules/{auth → organizations}/models/invite.model.js +0 -0
- /package/src/modules/{auth → organizations}/routes/invites.routes.js +0 -0
- /package/src/modules/{auth → organizations}/store/invites.js +0 -0
@@ -2,12 +2,14 @@ import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-CUmg6egw.mjs";
|
|
2
2
|
import require$$0$1 from "jsonwebtoken";
|
3
3
|
import "axios";
|
4
4
|
import "bcryptjs";
|
5
|
-
import "uuidv4";
|
5
|
+
import require$$3 from "uuidv4";
|
6
6
|
import require$$0 from "mongoose";
|
7
7
|
import require$$5 from "@googlemaps/google-maps-services-js";
|
8
8
|
import { a as addUserStatusFields_1, b as addMembersQuantity_1 } from "./addMembersQuantity-BXp_LeQd.mjs";
|
9
|
+
import { m as mailing } from "./mailing-DT2ZSkCD.mjs";
|
10
|
+
import { s as server } from "./index-CGIn4v5E.mjs";
|
9
11
|
import require$$0$2 from "mongodb";
|
10
|
-
const controllerFactory$
|
12
|
+
const controllerFactory$6 = (db) => {
|
11
13
|
const Department = db.department;
|
12
14
|
const readOne = (req, res) => {
|
13
15
|
Department.findOne({ _id: req.params._id }).populate("members.user").populate("subdepartments").then((department) => {
|
@@ -20,7 +22,16 @@ const controllerFactory$5 = (db) => {
|
|
20
22
|
});
|
21
23
|
};
|
22
24
|
const read = (req, res) => {
|
23
|
-
|
25
|
+
let query = {};
|
26
|
+
let options = {};
|
27
|
+
console.log(req.query);
|
28
|
+
if (req.query.organization) {
|
29
|
+
query.organization = new db.mongoose.Types.ObjectId(req.query.organization);
|
30
|
+
}
|
31
|
+
if (req.query.hidden) {
|
32
|
+
query.hidden = req.query.hidden;
|
33
|
+
}
|
34
|
+
Department.find(query, null, options).populate("members.user").populate("subdepartments").then((departments) => {
|
24
35
|
if (!departments) {
|
25
36
|
return res.status(404).send({ message: "Departments not found" });
|
26
37
|
}
|
@@ -69,14 +80,14 @@ const controllerFactory$5 = (db) => {
|
|
69
80
|
delete: deleteDepartment
|
70
81
|
};
|
71
82
|
};
|
72
|
-
var departments_controller = controllerFactory$
|
83
|
+
var departments_controller = controllerFactory$6;
|
73
84
|
const jwt = require$$0$1;
|
74
85
|
const ObjectId$2 = require$$0.Types.ObjectId;
|
75
86
|
const { Client } = require$$5;
|
76
87
|
const client = new Client({});
|
77
88
|
const addUserStatusFields = addUserStatusFields_1;
|
78
89
|
const addMembersQuantity = addMembersQuantity_1;
|
79
|
-
const controllerFactory$
|
90
|
+
const controllerFactory$5 = (db) => {
|
80
91
|
const Organization = db.organization;
|
81
92
|
const Membership = db.membership;
|
82
93
|
db.user;
|
@@ -437,9 +448,9 @@ const controllerFactory$4 = (db) => {
|
|
437
448
|
// Map the method to 'delete' key
|
438
449
|
};
|
439
450
|
};
|
440
|
-
var organizations_controller = controllerFactory$
|
451
|
+
var organizations_controller = controllerFactory$5;
|
441
452
|
const ObjectId$1 = require$$0.Types.ObjectId;
|
442
|
-
const controllerFactory$
|
453
|
+
const controllerFactory$4 = (db) => {
|
443
454
|
const Membership = db.membership;
|
444
455
|
const read = async (req, res) => {
|
445
456
|
try {
|
@@ -521,10 +532,108 @@ const controllerFactory$3 = (db) => {
|
|
521
532
|
deleteMembership
|
522
533
|
};
|
523
534
|
};
|
524
|
-
var memberships_controller = controllerFactory$
|
525
|
-
const
|
535
|
+
var memberships_controller = controllerFactory$4;
|
536
|
+
const { uuid } = require$$3;
|
537
|
+
const { sendEmail, sendSms } = mailing;
|
538
|
+
const сontrollerFactory = (db) => {
|
539
|
+
const User = db.user;
|
540
|
+
const Invite = db.invite;
|
541
|
+
const Membership = db.membership;
|
542
|
+
const getOneByCode = async (req, res) => {
|
543
|
+
try {
|
544
|
+
const invite = await Invite.findOne({ code: req.params._id });
|
545
|
+
if (!invite) {
|
546
|
+
return res.status(404).send({ message: "Приглашение не найдено" });
|
547
|
+
}
|
548
|
+
res.send(invite);
|
549
|
+
} catch (err) {
|
550
|
+
res.status(500).send({ message: err.message });
|
551
|
+
}
|
552
|
+
};
|
553
|
+
const read = async (req, res) => {
|
554
|
+
try {
|
555
|
+
const invites = await Invite.find({ organization: req.params._id });
|
556
|
+
if (!invites) {
|
557
|
+
return res.status(404).send({ message: "Invites not found" });
|
558
|
+
}
|
559
|
+
res.send(invites);
|
560
|
+
} catch (err) {
|
561
|
+
res.status(500).send({ message: err.message });
|
562
|
+
}
|
563
|
+
};
|
564
|
+
const create = async (req, res) => {
|
565
|
+
const userInviter = JSON.parse(req.cookies.user);
|
566
|
+
const organizationId = req.params._id;
|
567
|
+
try {
|
568
|
+
const invites = req.body;
|
569
|
+
for (let invite of invites) {
|
570
|
+
let user2 = null;
|
571
|
+
if (invite.contact.includes("@")) {
|
572
|
+
user2 = await User.findOne({ email: invite.contact });
|
573
|
+
} else {
|
574
|
+
user2 = await User.findOne({ phone: invite.contact });
|
575
|
+
}
|
576
|
+
if (user2) {
|
577
|
+
console.log(invite);
|
578
|
+
const membership = new Membership({
|
579
|
+
user: user2._id,
|
580
|
+
type: "organization",
|
581
|
+
target: organizationId,
|
582
|
+
role: invite.role
|
583
|
+
});
|
584
|
+
await membership.save();
|
585
|
+
res.status(200).json({ message: "Invites sent successfully!" });
|
586
|
+
} else {
|
587
|
+
const newInvite = new Invite({
|
588
|
+
code: uuid(),
|
589
|
+
organization: organizationId,
|
590
|
+
role: invite.role,
|
591
|
+
createdBy: userInviter._id,
|
592
|
+
invitedEmail: invite.contact.includes("@") ? invite.contact : null,
|
593
|
+
invitedPhone: !invite.contact.includes("@") ? invite.contact : null
|
594
|
+
});
|
595
|
+
const savedInvite = await newInvite.save();
|
596
|
+
if (savedInvite.invitedEmail) {
|
597
|
+
const to = savedInvite.invitedEmail;
|
598
|
+
const subject = "You have been added to the organization";
|
599
|
+
const text = `You have been invited to join an organization on ${process.env.APP_NAME}! Use this link to register: ${process.env.API_URL}/auth/invite?inviteCode=${newInvite.code}&type=email"`;
|
600
|
+
await sendEmail(to, subject, text);
|
601
|
+
}
|
602
|
+
if (savedInvite.invitedPhone !== null) {
|
603
|
+
const phone = savedInvite.invitedPhone;
|
604
|
+
const message = `You have been invited to join an organization on ${process.env.APP_NAME}! Use this link to register: ${process.env.API_URL}/auth/invite?inviteCode=${newInvite.code}&type=phone`;
|
605
|
+
await sendSms(phone, message);
|
606
|
+
}
|
607
|
+
res.status(200).json({ message: "Invites sent successfully!" });
|
608
|
+
}
|
609
|
+
}
|
610
|
+
} catch (error) {
|
611
|
+
console.error(error);
|
612
|
+
res.status(500).json({ message: "Something went wrong" });
|
613
|
+
}
|
614
|
+
};
|
615
|
+
const deleteInvite = async (req, res) => {
|
616
|
+
try {
|
617
|
+
const invite = await Invite.findOneAndDelete({ _id: req.params._id });
|
618
|
+
if (!invite) {
|
619
|
+
return res.status(404).send({ message: "Invite not found" });
|
620
|
+
}
|
621
|
+
res.send({ message: "Invite deleted successfully" });
|
622
|
+
} catch (err) {
|
623
|
+
res.status(500).send({ message: err.message });
|
624
|
+
}
|
625
|
+
};
|
626
|
+
return {
|
627
|
+
getOneByCode,
|
628
|
+
read,
|
629
|
+
create,
|
630
|
+
delete: deleteInvite
|
631
|
+
};
|
632
|
+
};
|
633
|
+
var invites_controller = сontrollerFactory;
|
634
|
+
const controllerFactory$3 = departments_controller;
|
526
635
|
var departments_routes = function(app, db) {
|
527
|
-
const controller = controllerFactory$
|
636
|
+
const controller = controllerFactory$3(db);
|
528
637
|
app.use(function(req, res, next) {
|
529
638
|
res.header(
|
530
639
|
"Access-Control-Allow-Headers",
|
@@ -533,15 +642,15 @@ var departments_routes = function(app, db) {
|
|
533
642
|
);
|
534
643
|
next();
|
535
644
|
});
|
536
|
-
app.get("/api/departments
|
645
|
+
app.get("/api/departments/read", controller.read);
|
537
646
|
app.get("/api/departments/get/:_id", controller.readOne);
|
538
647
|
app.post("/api/departments/:_id/create", controller.create);
|
539
648
|
app.post("/api/departments/:_id/update", controller.update);
|
540
649
|
app.delete("/api/departments/:_id/delete", controller.delete);
|
541
650
|
};
|
542
|
-
const controllerFactory$
|
651
|
+
const controllerFactory$2 = organizations_controller;
|
543
652
|
var organizations_routes = function(app, db) {
|
544
|
-
const controller = controllerFactory$
|
653
|
+
const controller = controllerFactory$2(db);
|
545
654
|
app.use(function(req, res, next) {
|
546
655
|
res.header(
|
547
656
|
"Access-Control-Allow-Headers",
|
@@ -567,9 +676,9 @@ var organizations_routes = function(app, db) {
|
|
567
676
|
controller.delete
|
568
677
|
);
|
569
678
|
};
|
570
|
-
const controllerFactory = memberships_controller;
|
679
|
+
const controllerFactory$1 = memberships_controller;
|
571
680
|
var memberships_routes = function(app, db) {
|
572
|
-
const controller = controllerFactory(db);
|
681
|
+
const controller = controllerFactory$1(db);
|
573
682
|
app.use(function(req, res, next) {
|
574
683
|
res.header(
|
575
684
|
"Access-Control-Allow-Headers",
|
@@ -595,6 +704,40 @@ var memberships_routes = function(app, db) {
|
|
595
704
|
controller.deleteMembership
|
596
705
|
);
|
597
706
|
};
|
707
|
+
const controllerFactory = invites_controller;
|
708
|
+
const middlewareFactory = server;
|
709
|
+
var invites_routes = function(app, db) {
|
710
|
+
const controller = controllerFactory(db);
|
711
|
+
const { verifyInvites } = middlewareFactory(db);
|
712
|
+
app.use(function(req, res, next) {
|
713
|
+
res.header(
|
714
|
+
"Access-Control-Allow-Headers",
|
715
|
+
"Access-Control-Allow-Origin",
|
716
|
+
"x-access-token, Origin, Content-Type, Accept"
|
717
|
+
);
|
718
|
+
next();
|
719
|
+
});
|
720
|
+
app.get(
|
721
|
+
"/api/invites/get/:_id",
|
722
|
+
controller.getOneByCode
|
723
|
+
);
|
724
|
+
app.get(
|
725
|
+
"/api/invites/:_id",
|
726
|
+
controller.read
|
727
|
+
);
|
728
|
+
app.post(
|
729
|
+
"/api/invites/:_id/create",
|
730
|
+
[
|
731
|
+
verifyInvites.checkInviteExist,
|
732
|
+
verifyInvites.checkUsersExist
|
733
|
+
],
|
734
|
+
controller.create
|
735
|
+
);
|
736
|
+
app.delete(
|
737
|
+
"/api/invites/:_id/delete",
|
738
|
+
controller.delete
|
739
|
+
);
|
740
|
+
};
|
598
741
|
var department_model = (mongoose) => {
|
599
742
|
const departmentSchema = new mongoose.Schema({
|
600
743
|
owner: {
|
@@ -618,6 +761,10 @@ var department_model = (mongoose) => {
|
|
618
761
|
end: String
|
619
762
|
}
|
620
763
|
}],
|
764
|
+
hidden: {
|
765
|
+
type: Boolean,
|
766
|
+
default: false
|
767
|
+
},
|
621
768
|
// Marketplace options
|
622
769
|
delivery: [String],
|
623
770
|
payment: [String],
|
@@ -747,25 +894,74 @@ var membership_model = (mongoose) => {
|
|
747
894
|
const Membership = mongoose.model("Membership", MembershipSchema);
|
748
895
|
return Membership;
|
749
896
|
};
|
897
|
+
var invite_model = (mongoose) => {
|
898
|
+
const InviteSchema = new mongoose.Schema({
|
899
|
+
code: {
|
900
|
+
type: String,
|
901
|
+
required: true,
|
902
|
+
unique: true
|
903
|
+
},
|
904
|
+
organization: {
|
905
|
+
type: mongoose.Schema.Types.ObjectId,
|
906
|
+
ref: "Organization",
|
907
|
+
required: true
|
908
|
+
},
|
909
|
+
status: {
|
910
|
+
type: String,
|
911
|
+
enum: ["active", "used"],
|
912
|
+
default: "active"
|
913
|
+
},
|
914
|
+
role: {
|
915
|
+
name: {
|
916
|
+
type: String,
|
917
|
+
default: "Сотрудник"
|
918
|
+
},
|
919
|
+
value: {
|
920
|
+
type: String,
|
921
|
+
default: "member"
|
922
|
+
}
|
923
|
+
},
|
924
|
+
createdBy: {
|
925
|
+
type: mongoose.Schema.Types.ObjectId,
|
926
|
+
ref: "User"
|
927
|
+
},
|
928
|
+
invitedEmail: {
|
929
|
+
type: String
|
930
|
+
},
|
931
|
+
invitedPhone: {
|
932
|
+
type: String
|
933
|
+
}
|
934
|
+
}, {
|
935
|
+
timestamps: true
|
936
|
+
});
|
937
|
+
const Invite = mongoose.model("Invite", InviteSchema);
|
938
|
+
return Invite;
|
939
|
+
};
|
750
940
|
const DepartmentsController = departments_controller;
|
751
941
|
const OrganizationsController = organizations_controller;
|
752
942
|
const MembershipsController = memberships_controller;
|
943
|
+
const InvitesController = invites_controller;
|
753
944
|
const departmentsRoutes = departments_routes;
|
754
945
|
const organizationsRoutes = organizations_routes;
|
755
946
|
const membershipsRoutes = memberships_routes;
|
947
|
+
const invitesRoutes = invites_routes;
|
756
948
|
const DepartmentModel = department_model;
|
757
949
|
const OrganizationModel = organization_model;
|
758
950
|
const MembershipModel = membership_model;
|
951
|
+
const InviteModel = invite_model;
|
759
952
|
var organizations_server = {
|
760
953
|
DepartmentsController,
|
761
954
|
OrganizationsController,
|
762
955
|
MembershipsController,
|
956
|
+
InvitesController,
|
763
957
|
departmentsRoutes,
|
764
958
|
organizationsRoutes,
|
765
959
|
membershipsRoutes,
|
960
|
+
invitesRoutes,
|
766
961
|
DepartmentModel,
|
767
962
|
OrganizationModel,
|
768
|
-
MembershipModel
|
963
|
+
MembershipModel,
|
964
|
+
InviteModel
|
769
965
|
};
|
770
966
|
const organizations_server$1 = /* @__PURE__ */ getDefaultExportFromCjs(organizations_server);
|
771
967
|
export {
|
@@ -0,0 +1,36 @@
|
|
1
|
+
"use strict";
|
2
|
+
var ownership_schema = function applyOwnershipSchema(schema, db) {
|
3
|
+
schema.add({
|
4
|
+
owner: {
|
5
|
+
type: {
|
6
|
+
type: String,
|
7
|
+
required: true
|
8
|
+
},
|
9
|
+
target: {
|
10
|
+
type: db.mongoose.Schema.Types.ObjectId,
|
11
|
+
refPath: "owner.type",
|
12
|
+
required: true
|
13
|
+
}
|
14
|
+
},
|
15
|
+
creator: {
|
16
|
+
hidden: {
|
17
|
+
type: Boolean,
|
18
|
+
default: false
|
19
|
+
},
|
20
|
+
type: {
|
21
|
+
type: String,
|
22
|
+
required: true
|
23
|
+
},
|
24
|
+
target: {
|
25
|
+
type: db.mongoose.Schema.Types.ObjectId,
|
26
|
+
refPath: "creator.type",
|
27
|
+
required: true
|
28
|
+
}
|
29
|
+
}
|
30
|
+
});
|
31
|
+
schema.index({
|
32
|
+
"owner.target": 1,
|
33
|
+
"creator.target": 1
|
34
|
+
});
|
35
|
+
};
|
36
|
+
exports.ownership_schema = ownership_schema;
|
@@ -0,0 +1,37 @@
|
|
1
|
+
var ownership_schema = function applyOwnershipSchema(schema, db) {
|
2
|
+
schema.add({
|
3
|
+
owner: {
|
4
|
+
type: {
|
5
|
+
type: String,
|
6
|
+
required: true
|
7
|
+
},
|
8
|
+
target: {
|
9
|
+
type: db.mongoose.Schema.Types.ObjectId,
|
10
|
+
refPath: "owner.type",
|
11
|
+
required: true
|
12
|
+
}
|
13
|
+
},
|
14
|
+
creator: {
|
15
|
+
hidden: {
|
16
|
+
type: Boolean,
|
17
|
+
default: false
|
18
|
+
},
|
19
|
+
type: {
|
20
|
+
type: String,
|
21
|
+
required: true
|
22
|
+
},
|
23
|
+
target: {
|
24
|
+
type: db.mongoose.Schema.Types.ObjectId,
|
25
|
+
refPath: "creator.type",
|
26
|
+
required: true
|
27
|
+
}
|
28
|
+
}
|
29
|
+
});
|
30
|
+
schema.index({
|
31
|
+
"owner.target": 1,
|
32
|
+
"creator.target": 1
|
33
|
+
});
|
34
|
+
};
|
35
|
+
export {
|
36
|
+
ownership_schema as o
|
37
|
+
};
|
package/dist/products.server.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
3
3
|
const _commonjsHelpers = require("./_commonjsHelpers-DHfMLFPC.js");
|
4
|
+
const ownership_schema = require("./ownership.schema-DN0SlQL6.js");
|
4
5
|
require("uuid");
|
5
6
|
const require$$0 = require("mongoose");
|
6
7
|
require("path");
|
@@ -183,10 +184,11 @@ var modification_model = (mongoose) => {
|
|
183
184
|
return Modification;
|
184
185
|
};
|
185
186
|
const modification_model$1 = /* @__PURE__ */ _commonjsHelpers.getDefaultExportFromCjs(modification_model);
|
186
|
-
|
187
|
-
|
187
|
+
const applyOwnershipSchema = ownership_schema.ownership_schema;
|
188
|
+
var leftover_model = (db) => {
|
189
|
+
const LeftoverSchema = new db.mongoose.Schema({
|
188
190
|
organization: {
|
189
|
-
type: mongoose.Schema.Types.ObjectId,
|
191
|
+
type: db.mongoose.Schema.Types.ObjectId,
|
190
192
|
ref: "Organization"
|
191
193
|
},
|
192
194
|
type: {
|
@@ -203,7 +205,7 @@ var leftover_model = (mongoose) => {
|
|
203
205
|
},
|
204
206
|
positions: [{
|
205
207
|
_id: {
|
206
|
-
type: mongoose.Schema.Types.ObjectId,
|
208
|
+
type: db.mongoose.Schema.Types.ObjectId,
|
207
209
|
ref: "Product"
|
208
210
|
},
|
209
211
|
name: {
|
@@ -224,8 +226,9 @@ var leftover_model = (mongoose) => {
|
|
224
226
|
currentTime: () => Date.now()
|
225
227
|
}
|
226
228
|
});
|
229
|
+
applyOwnershipSchema(LeftoverSchema, db);
|
227
230
|
LeftoverSchema.index({ user: 1, type: 1, target: 1 });
|
228
|
-
const Leftover = mongoose.model("Leftover", LeftoverSchema);
|
231
|
+
const Leftover = db.mongoose.model("Leftover", LeftoverSchema);
|
229
232
|
return Leftover;
|
230
233
|
};
|
231
234
|
const leftover_model$1 = /* @__PURE__ */ _commonjsHelpers.getDefaultExportFromCjs(leftover_model);
|
package/dist/products.server.mjs
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-CUmg6egw.mjs";
|
2
|
+
import { o as ownership_schema } from "./ownership.schema-oyx6eNkZ.mjs";
|
2
3
|
import "uuid";
|
3
4
|
import require$$0 from "mongoose";
|
4
5
|
import "path";
|
@@ -181,10 +182,11 @@ var modification_model = (mongoose) => {
|
|
181
182
|
return Modification;
|
182
183
|
};
|
183
184
|
const modification_model$1 = /* @__PURE__ */ getDefaultExportFromCjs(modification_model);
|
184
|
-
|
185
|
-
|
185
|
+
const applyOwnershipSchema = ownership_schema;
|
186
|
+
var leftover_model = (db) => {
|
187
|
+
const LeftoverSchema = new db.mongoose.Schema({
|
186
188
|
organization: {
|
187
|
-
type: mongoose.Schema.Types.ObjectId,
|
189
|
+
type: db.mongoose.Schema.Types.ObjectId,
|
188
190
|
ref: "Organization"
|
189
191
|
},
|
190
192
|
type: {
|
@@ -201,7 +203,7 @@ var leftover_model = (mongoose) => {
|
|
201
203
|
},
|
202
204
|
positions: [{
|
203
205
|
_id: {
|
204
|
-
type: mongoose.Schema.Types.ObjectId,
|
206
|
+
type: db.mongoose.Schema.Types.ObjectId,
|
205
207
|
ref: "Product"
|
206
208
|
},
|
207
209
|
name: {
|
@@ -222,8 +224,9 @@ var leftover_model = (mongoose) => {
|
|
222
224
|
currentTime: () => Date.now()
|
223
225
|
}
|
224
226
|
});
|
227
|
+
applyOwnershipSchema(LeftoverSchema, db);
|
225
228
|
LeftoverSchema.index({ user: 1, type: 1, target: 1 });
|
226
|
-
const Leftover = mongoose.model("Leftover", LeftoverSchema);
|
229
|
+
const Leftover = db.mongoose.model("Leftover", LeftoverSchema);
|
227
230
|
return Leftover;
|
228
231
|
};
|
229
232
|
const leftover_model$1 = /* @__PURE__ */ getDefaultExportFromCjs(leftover_model);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("./Chips.vue2.cjs");const
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("./Chips.vue2.cjs");const l=require("../../../../_virtual/_plugin-vue_export-helper.cjs"),i={class:"t-trimmed"},o={class:"t-truncate"},c={key:1,class:"pd-b-micro pd-t-micro pd-r-thin pd-l-thin radius-small t-semi bg-white"},a={__name:"Chips",props:["chips"],setup(n){return(s,u)=>{var r;return e.openBlock(),e.createElementBlock("div",i,[(r=n.chips)!=null&&r.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(n.chips,(t,m)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass([s.$attrs.class||"p-medium","mn-r-nano d-inline-block w-max pd-b-micro pd-t-micro pd-r-thin pd-l-thin radius-small t-medium bg-main"])},[e.createElementVNode("span",o,e.toDisplayString(t.text?t.text:t),1)],2))),256)):(e.openBlock(),e.createElementBlock("div",c,[e.renderSlot(s.$slots,"default",{},void 0,!0)]))])}}},d=l.default(a,[["__scopeId","data-v-5db8d9f5"]]);exports.default=d;
|
@@ -1,22 +1,27 @@
|
|
1
|
-
import { openBlock as t, createElementBlock as e, Fragment as
|
1
|
+
import { openBlock as t, createElementBlock as e, Fragment as d, renderList as a, normalizeClass as o, createElementVNode as m, toDisplayString as c, renderSlot as l } from "vue";
|
2
2
|
import "./Chips.vue2.js";
|
3
|
-
import
|
4
|
-
const
|
3
|
+
import p from "../../../../_virtual/_plugin-vue_export-helper.js";
|
4
|
+
const u = { class: "t-trimmed" }, h = { class: "t-truncate" }, _ = {
|
5
5
|
key: 1,
|
6
6
|
class: "pd-b-micro pd-t-micro pd-r-thin pd-l-thin radius-small t-semi bg-white"
|
7
|
-
},
|
7
|
+
}, f = {
|
8
8
|
__name: "Chips",
|
9
9
|
props: ["chips"],
|
10
|
-
setup(
|
11
|
-
return (r,
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
10
|
+
setup(i) {
|
11
|
+
return (r, b) => {
|
12
|
+
var n;
|
13
|
+
return t(), e("div", u, [
|
14
|
+
(n = i.chips) != null && n.length ? (t(!0), e(d, { key: 0 }, a(i.chips, (s, g) => (t(), e("span", {
|
15
|
+
class: o([r.$attrs.class || "p-medium", "mn-r-nano d-inline-block w-max pd-b-micro pd-t-micro pd-r-thin pd-l-thin radius-small t-medium bg-main"])
|
16
|
+
}, [
|
17
|
+
m("span", h, c(s.text ? s.text : s), 1)
|
18
|
+
], 2))), 256)) : (t(), e("div", _, [
|
19
|
+
l(r.$slots, "default", {}, void 0, !0)
|
20
|
+
]))
|
21
|
+
]);
|
22
|
+
};
|
18
23
|
}
|
19
|
-
},
|
24
|
+
}, y = /* @__PURE__ */ p(f, [["__scopeId", "data-v-5db8d9f5"]]);
|
20
25
|
export {
|
21
|
-
|
26
|
+
y as default
|
22
27
|
};
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),f=require("../../modules/icons/skeletons/SkeletonEvent.vue.cjs");require("../Loader/Loader.
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),f=require("../../modules/icons/skeletons/SkeletonEvent.vue.cjs");require("../Loader/Loader.vue.cjs");const g=require("../EmptyState/EmptyState.vue.cjs");require("vue-i18n");const h=require("../../modules/globals/components/blocks/BlockSearch.vue.cjs"),k={__name:"Feed",props:{search:{type:Boolean,default:!1},showLoadMore:{type:Boolean,default:!0},states:{type:Object,default:()=>({empty:{title:String,description:String}})},store:{type:Object,default:()=>({read:Function,state:Object})},options:{type:Object,default:()=>({category:null,limit:20,skip:0,owner:null,creator:null,user:null,status:null,period:null,contain:null})}},setup(s){const a=s,r=e.ref([]),o=e.ref(!1);let i=e.ref(!0),u=e.ref(a.options.skip?a.options.skip:0),l=e.ref(a.options.limit?a.options.limit:10);const d=async()=>{if(o.value){u.value+=l.value;const t=await a.store.read({skip:u.value,limit:l.value,...a.options});t.length===0||t.length<l.value?o.value=!1:o.value=!0,r.value=[...r.value,...t]}},c=async()=>{const t=await a.store.read({skip:u.value,limit:l.value,...a.options});t.length===0||t.length<l.value?o.value=!1:o.value=!0,console.log(t),r.value=t,i.value=!1};e.watch(()=>a.options,(t,n)=>{(t.organization!==n.organization||t.categories!==n.categories||t.prices!==n.prices||t.delivery!==n.delivery||t.search!==n.search||t.status!==n.status||t.hidden!==n.hidden)&&c()},{deep:!0});function m(t){a.options.search=t,console.log(t),c()}return e.onMounted(async()=>{await c()}),(t,n)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.TransitionGroup,{tag:"ul",name:"scaleTransition"},{default:e.withCtx(()=>[s.search?(e.openBlock(),e.createBlock(h.default,{key:0,onSearch:m,placeholder:"Enter product name",class:"bg-white mn-b-thin"})):e.createCommentVNode("",!0)]),_:1}),e.unref(i)?(e.openBlock(),e.createBlock(e.TransitionGroup,{key:0,tag:"ul",name:"scaleTransition",class:"o-hidden bg-grey radius-big"},{default:e.withCtx(()=>[e.unref(i)?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(l),p=>(e.openBlock(),e.createBlock(f.default,{key:p}))),128)):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.Transition,{name:"scaleTransition"},{default:e.withCtx(()=>[!e.unref(i)&&r.value.length<1?(e.openBlock(),e.createBlock(g.default,{key:0,title:s.states.empty.title,description:s.states.empty.description,class:"pd-medium mn-b-thin bg-grey radius-big"},null,8,["title","description"])):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.TransitionGroup,{tag:"ul",name:"scaleTransition",class:e.normalizeClass(t.$attrs.class)},{default:e.withCtx(()=>[!e.unref(i)&&r.value.length>0?e.renderSlot(t.$slots,"default",{key:0,items:r.value,user:t.user}):e.createCommentVNode("",!0),s.showLoadMore&&o.value&&r.value.length>0?(e.openBlock(),e.createElementBlock("button",{key:1,onClick:d,class:"col-w-100 w-100 bg-main button"}," Load more ")):e.createCommentVNode("",!0)]),_:3},8,["class"])],64))}};exports.default=k;
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { ref as c, watch as
|
1
|
+
import { ref as c, watch as T, onMounted as w, openBlock as n, createElementBlock as h, Fragment as k, createVNode as v, TransitionGroup as y, withCtx as d, createBlock as p, createCommentVNode as o, unref as m, renderList as B, Transition as M, normalizeClass as j, renderSlot as C } from "vue";
|
2
2
|
import O from "../../modules/icons/skeletons/SkeletonEvent.vue.js";
|
3
|
-
import "../Loader/Loader.
|
3
|
+
import "../Loader/Loader.vue.js";
|
4
4
|
import $ from "../EmptyState/EmptyState.vue.js";
|
5
5
|
import "vue-i18n";
|
6
6
|
import z from "../../modules/globals/components/blocks/BlockSearch.vue.js";
|
@@ -47,41 +47,41 @@ const q = {
|
|
47
47
|
}
|
48
48
|
},
|
49
49
|
setup(r) {
|
50
|
-
const t = r,
|
51
|
-
let u = c(!0), f = c(t.options.skip ? t.options.skip : 0),
|
50
|
+
const t = r, i = c([]), a = c(!1);
|
51
|
+
let u = c(!0), f = c(t.options.skip ? t.options.skip : 0), l = c(t.options.limit ? t.options.limit : 10);
|
52
52
|
const b = async () => {
|
53
53
|
if (a.value) {
|
54
|
-
f.value +=
|
54
|
+
f.value += l.value;
|
55
55
|
const e = await t.store.read({
|
56
56
|
skip: f.value,
|
57
|
-
limit:
|
57
|
+
limit: l.value,
|
58
58
|
...t.options
|
59
59
|
});
|
60
|
-
e.length === 0 || e.length <
|
60
|
+
e.length === 0 || e.length < l.value ? a.value = !1 : a.value = !0, i.value = [...i.value, ...e];
|
61
61
|
}
|
62
62
|
}, g = async () => {
|
63
63
|
const e = await t.store.read({
|
64
64
|
skip: f.value,
|
65
|
-
limit:
|
65
|
+
limit: l.value,
|
66
66
|
...t.options
|
67
67
|
});
|
68
|
-
e.length === 0 || e.length <
|
68
|
+
e.length === 0 || e.length < l.value ? a.value = !1 : a.value = !0, console.log(e), i.value = e, u.value = !1;
|
69
69
|
};
|
70
|
-
|
71
|
-
(e.organization !==
|
70
|
+
T(() => t.options, (e, s) => {
|
71
|
+
(e.organization !== s.organization || e.categories !== s.categories || e.prices !== s.prices || e.delivery !== s.delivery || e.search !== s.search || e.status !== s.status || e.hidden !== s.hidden) && g();
|
72
72
|
}, { deep: !0 });
|
73
73
|
function L(e) {
|
74
74
|
t.options.search = e, console.log(e), g();
|
75
75
|
}
|
76
|
-
return
|
76
|
+
return w(async () => {
|
77
77
|
await g();
|
78
|
-
}), (e,
|
79
|
-
|
78
|
+
}), (e, s) => (n(), h(k, null, [
|
79
|
+
v(y, {
|
80
80
|
tag: "ul",
|
81
81
|
name: "scaleTransition"
|
82
82
|
}, {
|
83
|
-
default:
|
84
|
-
r.search ? (
|
83
|
+
default: d(() => [
|
84
|
+
r.search ? (n(), p(z, {
|
85
85
|
key: 0,
|
86
86
|
onSearch: L,
|
87
87
|
placeholder: "Enter product name",
|
@@ -90,20 +90,20 @@ const q = {
|
|
90
90
|
]),
|
91
91
|
_: 1
|
92
92
|
}),
|
93
|
-
m(u) ? (
|
93
|
+
m(u) ? (n(), p(y, {
|
94
94
|
key: 0,
|
95
95
|
tag: "ul",
|
96
96
|
name: "scaleTransition",
|
97
97
|
class: "o-hidden bg-grey radius-big"
|
98
98
|
}, {
|
99
|
-
default:
|
100
|
-
m(u) ? (
|
99
|
+
default: d(() => [
|
100
|
+
m(u) ? (n(!0), h(k, { key: 0 }, B(m(l), (S) => (n(), p(O, { key: S }))), 128)) : o("", !0)
|
101
101
|
]),
|
102
102
|
_: 1
|
103
103
|
})) : o("", !0),
|
104
|
-
|
105
|
-
default:
|
106
|
-
!m(u) &&
|
104
|
+
v(M, { name: "scaleTransition" }, {
|
105
|
+
default: d(() => [
|
106
|
+
!m(u) && i.value.length < 1 ? (n(), p($, {
|
107
107
|
key: 0,
|
108
108
|
title: r.states.empty.title,
|
109
109
|
description: r.states.empty.description,
|
@@ -112,18 +112,18 @@ const q = {
|
|
112
112
|
]),
|
113
113
|
_: 1
|
114
114
|
}),
|
115
|
-
|
115
|
+
v(y, {
|
116
116
|
tag: "ul",
|
117
117
|
name: "scaleTransition",
|
118
118
|
class: j(e.$attrs.class)
|
119
119
|
}, {
|
120
|
-
default:
|
121
|
-
!m(u) &&
|
120
|
+
default: d(() => [
|
121
|
+
!m(u) && i.value.length > 0 ? C(e.$slots, "default", {
|
122
122
|
key: 0,
|
123
|
-
items:
|
123
|
+
items: i.value,
|
124
124
|
user: e.user
|
125
125
|
}) : o("", !0),
|
126
|
-
r.showLoadMore && a.value &&
|
126
|
+
r.showLoadMore && a.value && i.value.length > 0 ? (n(), h("button", {
|
127
127
|
key: 1,
|
128
128
|
onClick: b,
|
129
129
|
class: "col-w-100 w-100 bg-main button"
|