@ozdao/prometheus-framework 0.2.309 → 0.2.311

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. package/dist/products.server.js +192 -195
  2. package/dist/products.server.mjs +192 -195
  3. package/dist/prometheus-framework/src/components/Block/Block.vue.cjs +1 -1
  4. package/dist/prometheus-framework/src/components/Block/Block.vue.cjs.map +1 -1
  5. package/dist/prometheus-framework/src/components/Block/Block.vue.js +1 -1
  6. package/dist/prometheus-framework/src/components/Block/Block.vue.js.map +1 -1
  7. package/dist/prometheus-framework/src/components/Chips/Chips.vue2.cjs +2 -1
  8. package/dist/prometheus-framework/src/components/Chips/Chips.vue2.cjs.map +1 -1
  9. package/dist/prometheus-framework/src/components/Chips/Chips.vue2.js +3 -2
  10. package/dist/prometheus-framework/src/components/Chips/Chips.vue2.js.map +1 -1
  11. package/dist/prometheus-framework/src/components/EditImages/EditImages.vue2.cjs +1 -1
  12. package/dist/prometheus-framework/src/components/EditImages/EditImages.vue2.cjs.map +1 -1
  13. package/dist/prometheus-framework/src/components/EditImages/EditImages.vue2.js +1 -1
  14. package/dist/prometheus-framework/src/components/EditImages/EditImages.vue2.js.map +1 -1
  15. package/dist/prometheus-framework/src/components/Field/Field.vue.cjs +13 -12
  16. package/dist/prometheus-framework/src/components/Field/Field.vue.cjs.map +1 -1
  17. package/dist/prometheus-framework/src/components/Field/Field.vue.js +13 -12
  18. package/dist/prometheus-framework/src/components/Field/Field.vue.js.map +1 -1
  19. package/dist/prometheus-framework/src/modules/auth/views/middlewares/auth.validation.cjs +1 -0
  20. package/dist/prometheus-framework/src/modules/auth/views/middlewares/auth.validation.cjs.map +1 -1
  21. package/dist/prometheus-framework/src/modules/auth/views/middlewares/auth.validation.js +1 -0
  22. package/dist/prometheus-framework/src/modules/auth/views/middlewares/auth.validation.js.map +1 -1
  23. package/dist/prometheus-framework/src/modules/auth/views/store/auth.cjs +6 -2
  24. package/dist/prometheus-framework/src/modules/auth/views/store/auth.cjs.map +1 -1
  25. package/dist/prometheus-framework/src/modules/auth/views/store/auth.js +6 -2
  26. package/dist/prometheus-framework/src/modules/auth/views/store/auth.js.map +1 -1
  27. package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.cjs +2 -4
  28. package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.cjs.map +1 -1
  29. package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.js +3 -5
  30. package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.js.map +1 -1
  31. package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.cjs +1 -1
  32. package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.js +1 -1
  33. package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.cjs +1 -1
  34. package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.js +1 -1
  35. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +1 -1
  36. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.js +1 -1
  37. package/dist/prometheus-framework/src/modules/globals/views/components/partials/BottomNavigationBar.vue.cjs +3 -3
  38. package/dist/prometheus-framework/src/modules/globals/views/components/partials/BottomNavigationBar.vue.cjs.map +1 -1
  39. package/dist/prometheus-framework/src/modules/globals/views/components/partials/BottomNavigationBar.vue.js +3 -3
  40. package/dist/prometheus-framework/src/modules/globals/views/components/partials/BottomNavigationBar.vue.js.map +1 -1
  41. package/dist/prometheus-framework/src/modules/globals/views/components/partials/Header.vue.cjs +1 -1
  42. package/dist/prometheus-framework/src/modules/globals/views/components/partials/Header.vue.js +1 -1
  43. package/dist/prometheus-framework/src/modules/globals/views/components/partials/NavigationBar.vue.cjs +18 -15
  44. package/dist/prometheus-framework/src/modules/globals/views/components/partials/NavigationBar.vue.cjs.map +1 -1
  45. package/dist/prometheus-framework/src/modules/globals/views/components/partials/NavigationBar.vue.js +21 -18
  46. package/dist/prometheus-framework/src/modules/globals/views/components/partials/NavigationBar.vue.js.map +1 -1
  47. package/dist/prometheus-framework/src/modules/globals/views/store/globals.cjs +4 -0
  48. package/dist/prometheus-framework/src/modules/globals/views/store/globals.cjs.map +1 -1
  49. package/dist/prometheus-framework/src/modules/globals/views/store/globals.js +4 -0
  50. package/dist/prometheus-framework/src/modules/globals/views/store/globals.js.map +1 -1
  51. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs +1 -1
  52. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js +1 -1
  53. package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.cjs +1 -1
  54. package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.js +1 -1
  55. package/dist/prometheus-framework/src/modules/orders/components/sections/FormCustomerDetails.vue.cjs +1 -1
  56. package/dist/prometheus-framework/src/modules/orders/components/sections/FormCustomerDetails.vue.js +1 -1
  57. package/dist/prometheus-framework/src/modules/orders/components/sections/FormPayment.vue.cjs +1 -1
  58. package/dist/prometheus-framework/src/modules/orders/components/sections/FormPayment.vue.js +1 -1
  59. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +1 -1
  60. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.js +1 -1
  61. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.cjs +1 -1
  62. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.cjs.map +1 -1
  63. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.js +1 -1
  64. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.js.map +1 -1
  65. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationBackoffice.vue.cjs +1 -2
  66. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationBackoffice.vue.cjs.map +1 -1
  67. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationBackoffice.vue.js +2 -3
  68. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationBackoffice.vue.js.map +1 -1
  69. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +1 -1
  70. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.js +1 -1
  71. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.cjs +1 -1
  72. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.js +1 -1
  73. package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
  74. package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.js +1 -1
  75. package/dist/prometheus-framework/src/modules/pages/pages.client.cjs +554 -554
  76. package/dist/prometheus-framework/src/modules/pages/pages.client.js +554 -554
  77. package/dist/prometheus-framework/src/modules/products/components/blocks/CardCategory.vue.cjs +3 -3
  78. package/dist/prometheus-framework/src/modules/products/components/blocks/CardCategory.vue.cjs.map +1 -1
  79. package/dist/prometheus-framework/src/modules/products/components/blocks/CardCategory.vue.js +3 -3
  80. package/dist/prometheus-framework/src/modules/products/components/blocks/CardCategory.vue.js.map +1 -1
  81. package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.cjs +1 -1
  82. package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.js +1 -1
  83. package/dist/prometheus-framework/src/modules/products/components/blocks/CardProduct.vue.cjs +11 -10
  84. package/dist/prometheus-framework/src/modules/products/components/blocks/CardProduct.vue.cjs.map +1 -1
  85. package/dist/prometheus-framework/src/modules/products/components/blocks/CardProduct.vue.js +11 -10
  86. package/dist/prometheus-framework/src/modules/products/components/blocks/CardProduct.vue.js.map +1 -1
  87. package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.cjs +78 -43
  88. package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.cjs.map +1 -1
  89. package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.js +83 -48
  90. package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.js.map +1 -1
  91. package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.cjs +80 -30
  92. package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.cjs.map +1 -1
  93. package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.js +91 -41
  94. package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.js.map +1 -1
  95. package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.cjs +1 -1
  96. package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.js +1 -1
  97. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs +119 -80
  98. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs.map +1 -1
  99. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js +132 -93
  100. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js.map +1 -1
  101. package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.cjs +39 -21
  102. package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.cjs.map +1 -1
  103. package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.js +51 -33
  104. package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.js.map +1 -1
  105. package/dist/prometheus-framework/src/modules/products/components/sections/CategoriesTree.vue.cjs +96 -0
  106. package/dist/prometheus-framework/src/modules/products/components/sections/CategoriesTree.vue.cjs.map +1 -0
  107. package/dist/prometheus-framework/src/modules/products/components/sections/CategoriesTree.vue.js +96 -0
  108. package/dist/prometheus-framework/src/modules/products/components/sections/CategoriesTree.vue.js.map +1 -0
  109. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.cjs +21 -7
  110. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.cjs.map +1 -1
  111. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.js +21 -7
  112. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.js.map +1 -1
  113. package/dist/prometheus-framework/src/modules/products/components/sections/Filters.vue.cjs +1 -1
  114. package/dist/prometheus-framework/src/modules/products/components/sections/Filters.vue.js +1 -1
  115. package/dist/prometheus-framework/src/modules/products/products.client.cjs.map +1 -1
  116. package/dist/prometheus-framework/src/modules/products/products.client.js.map +1 -1
  117. package/dist/prometheus-framework/src/modules/products/router/categories.router.cjs +17 -5
  118. package/dist/prometheus-framework/src/modules/products/router/categories.router.cjs.map +1 -1
  119. package/dist/prometheus-framework/src/modules/products/router/categories.router.js +17 -5
  120. package/dist/prometheus-framework/src/modules/products/router/categories.router.js.map +1 -1
  121. package/dist/prometheus-framework/src/modules/products/router/products.router.cjs +1 -12
  122. package/dist/prometheus-framework/src/modules/products/router/products.router.cjs.map +1 -1
  123. package/dist/prometheus-framework/src/modules/products/router/products.router.js +1 -12
  124. package/dist/prometheus-framework/src/modules/products/router/products.router.js.map +1 -1
  125. package/dist/prometheus-framework/src/modules/products/store/categories.cjs +52 -71
  126. package/dist/prometheus-framework/src/modules/products/store/categories.cjs.map +1 -1
  127. package/dist/prometheus-framework/src/modules/products/store/categories.js +52 -71
  128. package/dist/prometheus-framework/src/modules/products/store/categories.js.map +1 -1
  129. package/dist/prometheus-framework/src/modules/products/store/products.cjs +6 -8
  130. package/dist/prometheus-framework/src/modules/products/store/products.cjs.map +1 -1
  131. package/dist/prometheus-framework/src/modules/products/store/products.js +6 -8
  132. package/dist/prometheus-framework/src/modules/products/store/products.js.map +1 -1
  133. package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.cjs +1 -1
  134. package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.js +1 -1
  135. package/dist/prometheus-framework/src/modules/spots/components/blocks/SpotMemberModify.vue.cjs +1 -1
  136. package/dist/prometheus-framework/src/modules/spots/components/blocks/SpotMemberModify.vue.js +1 -1
  137. package/dist/prometheus-framework/src/modules/spots/components/pages/SpotEdit.vue.cjs +1 -1
  138. package/dist/prometheus-framework/src/modules/spots/components/pages/SpotEdit.vue.js +1 -1
  139. package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CryptoDeposit.vue.cjs +1 -1
  140. package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CryptoDeposit.vue.js +1 -1
  141. package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.cjs +1 -1
  142. package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.js +1 -1
  143. package/package.json +1 -1
  144. package/src/components/Block/Block.vue +1 -1
  145. package/src/components/EditImages/EditImages.vue +1 -1
  146. package/src/modules/auth/views/middlewares/auth.validation.js +1 -0
  147. package/src/modules/auth/views/store/auth.js +6 -2
  148. package/src/modules/backoffice/components/pages/Dashboard.vue +1 -3
  149. package/src/modules/globals/views/components/partials/BottomNavigationBar.vue +3 -3
  150. package/src/modules/globals/views/components/partials/NavigationBar.vue +4 -4
  151. package/src/modules/globals/views/store/globals.js +5 -0
  152. package/src/modules/organizations/components/pages/Organization.vue +1 -1
  153. package/src/modules/organizations/components/pages/OrganizationBackoffice.vue +1 -2
  154. package/src/modules/products/components/blocks/CardCategory.vue +14 -3
  155. package/src/modules/products/components/blocks/CardProduct.vue +12 -11
  156. package/src/modules/products/components/pages/Categories.vue +120 -28
  157. package/src/modules/products/components/pages/CategoryEdit.vue +206 -151
  158. package/src/modules/products/components/pages/ProductEdit.vue +107 -69
  159. package/src/modules/products/components/pages/Products.vue +35 -20
  160. package/src/modules/products/components/sections/CategoriesTree.vue +102 -0
  161. package/src/modules/products/components/sections/EditProductInfo.vue +53 -40
  162. package/src/modules/products/controllers/categories.controller.js +175 -97
  163. package/src/modules/products/controllers/products.controller.js +4 -2
  164. package/src/modules/products/models/category.model.js +15 -66
  165. package/src/modules/products/models/product.model.js +15 -12
  166. package/src/modules/products/products.client.js +0 -1
  167. package/src/modules/products/router/categories.router.js +17 -5
  168. package/src/modules/products/router/products.router.js +0 -12
  169. package/src/modules/products/routes/categories.routes.js +5 -34
  170. package/src/modules/products/store/categories.js +69 -83
  171. package/src/modules/products/store/products.js +6 -8
@@ -8,7 +8,13 @@ import { q as queryProcessor } from "./queryProcessor-CyQch65j.mjs";
8
8
  const applyOwnershipSchema$1 = ownership_schema;
9
9
  var product_model = (db) => {
10
10
  const ProductSchema = new db.mongoose.Schema({
11
- status: { type: String },
11
+ status: {
12
+ type: String
13
+ },
14
+ listing: {
15
+ type: String,
16
+ enum: ["sale", "rent"]
17
+ },
12
18
  name: { type: String },
13
19
  category: { type: Array },
14
20
  description: { type: String },
@@ -23,7 +29,13 @@ var product_model = (db) => {
23
29
  value: { type: String }
24
30
  }],
25
31
  // ЗАДАЧА: Нужно отрефачить price, перенести его в default variant
26
- price: { type: Number },
32
+ price: {
33
+ type: Number
34
+ },
35
+ price_currency: {
36
+ type: String,
37
+ default: "$"
38
+ },
27
39
  prices: { type: Array },
28
40
  //
29
41
  variants: [{
@@ -70,16 +82,7 @@ var product_model = (db) => {
70
82
  min: [0, "Quantity-based discount cannot be less than 0"],
71
83
  max: [100, "Quantity-based discount cannot be more than 100"]
72
84
  }
73
- }],
74
- // Refactor
75
- owner: {
76
- type: db.mongoose.Schema.Types.ObjectId,
77
- ref: "User"
78
- },
79
- organization: {
80
- type: db.mongoose.Schema.Types.ObjectId,
81
- ref: "Organization"
82
- }
85
+ }]
83
86
  }, {
84
87
  timestamps: {
85
88
  currentTime: () => Date.now()
@@ -92,76 +95,26 @@ var product_model = (db) => {
92
95
  return Product;
93
96
  };
94
97
  var category_model = (db) => {
95
- const СategorySchema = new db.mongoose.Schema({
96
- name: {
97
- type: String,
98
- required: true,
99
- trim: true
100
- },
98
+ const CategorySchema = new db.mongoose.Schema({
99
+ name: { type: String, required: true, trim: true },
101
100
  status: {
102
101
  type: String,
103
102
  enum: ["draft", "internal", "published", "removed"],
104
103
  default: "draft",
105
104
  required: true
106
105
  },
107
- order: {
108
- type: Number,
109
- required: true
110
- },
111
- url: {
112
- type: String,
113
- required: true,
114
- trim: true
115
- },
116
- subcategories: {
117
- type: Array
118
- },
119
- localization: {
120
- type: Array
121
- },
122
- filters: {
123
- type: Array
124
- }
125
- // owner: {
126
- // type: {
127
- // type: String,
128
- // required: true
129
- // },
130
- // target: {
131
- // type: mongoose.Schema.Types.ObjectId,
132
- // ref: function (value) {
133
- // if (this.owner.type === 'user') return 'User';
134
- // if (this.owner.type === 'organization') return 'Organization';
135
- // },
136
- // required: true,
137
- // },
138
- // },
139
- // creator: {
140
- // hidden: {
141
- // type: Boolean,
142
- // required: true
143
- // },
144
- // type: {
145
- // type: String,
146
- // required: true
147
- // },
148
- // target: {
149
- // type: mongoose.Schema.Types.ObjectId,
150
- // ref: function (value) {
151
- // if (this.owner.type === 'user') return 'User';
152
- // if (this.owner.type === 'organization') return 'Organization';
153
- // },
154
- // required: true,
155
- // },
156
- // }
106
+ order: { type: Number, required: true },
107
+ url: { type: String, required: true, trim: true },
108
+ parent: { type: db.mongoose.Schema.Types.ObjectId, ref: "Category" },
109
+ localization: { type: Array },
110
+ filters: { type: Array }
157
111
  }, {
158
- timestamps: {
159
- currentTime: () => Date.now()
160
- }
112
+ timestamps: { currentTime: () => Date.now() }
161
113
  });
162
- СategorySchema.index({ "owner.target": 1, "creator.target": 1 });
163
- const Сategory = db.mongoose.model("Сategory", СategorySchema, "categories");
164
- return Сategory;
114
+ CategorySchema.index({ parent: 1 });
115
+ CategorySchema.index({ "owner.target": 1, "creator.target": 1 });
116
+ const Category = db.mongoose.model("Category", CategorySchema, "categories");
117
+ return Category;
165
118
  };
166
119
  const applyOwnershipSchema = ownership_schema;
167
120
  var leftover_model = (db) => {
@@ -236,8 +189,8 @@ const controllerFactory$5 = (db) => {
236
189
  const Read = async (req, res) => {
237
190
  try {
238
191
  const query = {};
239
- if (req.query.organization) {
240
- query.organization = new ObjectId(req.query.organization);
192
+ if (req.query.owner) {
193
+ query["owner.target"] = new ObjectId(req.query.owner);
241
194
  }
242
195
  if (req.query._id) {
243
196
  query._id = new ObjectId(req.query._id);
@@ -410,8 +363,10 @@ const controllerFactory$5 = (db) => {
410
363
  {
411
364
  name: req.body.name,
412
365
  status: req.body.status,
366
+ listing: req.body.listing,
413
367
  description: req.body.description,
414
368
  price: req.body.price,
369
+ price_currency: req.body.price_currency,
415
370
  sale: req.body.sale,
416
371
  category: req.body.category,
417
372
  images: req.body.images,
@@ -550,104 +505,167 @@ var products_routes = function(app, db, allowedOrigins) {
550
505
  controller.getProductRecommendation
551
506
  );
552
507
  };
508
+ var categories_routes = { exports: {} };
553
509
  const controllerFactory$3 = (db) => {
554
510
  const Category = db.category;
555
- const getCategories = async (req, res) => {
556
- console.log(Category);
557
- try {
558
- let query = {};
559
- let options = {};
560
- if (req.query.status) {
561
- query.status = req.query.status;
562
- }
563
- const categories = await Category.find(query, null, options).sort({ "order": "asc" }).exec();
564
- if (!categories) {
565
- return res.status(404).send({ message: "Categories not found." });
511
+ return {
512
+ async read(req, res) {
513
+ try {
514
+ let buildTree = function(items) {
515
+ const itemMap = {};
516
+ const roots = [];
517
+ items.forEach((item) => {
518
+ itemMap[item._id.toString()] = {
519
+ ...item,
520
+ children: []
521
+ };
522
+ });
523
+ items.forEach((item) => {
524
+ const itemId = item._id.toString();
525
+ const parentId = item.parent?._id?.toString();
526
+ if (parentId && itemMap[parentId]) {
527
+ itemMap[parentId].children.push(itemMap[itemId]);
528
+ } else {
529
+ roots.push(itemMap[itemId]);
530
+ }
531
+ });
532
+ const sortByOrder = (a, b) => {
533
+ const orderA = a.order ?? Number.MAX_SAFE_INTEGER;
534
+ const orderB = b.order ?? Number.MAX_SAFE_INTEGER;
535
+ return orderA - orderB;
536
+ };
537
+ const sortChildren = (node) => {
538
+ if (node.children && node.children.length > 0) {
539
+ node.children.sort(sortByOrder);
540
+ node.children.forEach(sortChildren);
541
+ }
542
+ };
543
+ roots.sort(sortByOrder);
544
+ roots.forEach(sortChildren);
545
+ return roots;
546
+ };
547
+ const {
548
+ parent,
549
+ url,
550
+ search,
551
+ sort = "order",
552
+ order = 1,
553
+ page = 1,
554
+ limit = 10,
555
+ excludeChildren = false,
556
+ rootOnly = false
557
+ } = req.query;
558
+ const matchStage = {
559
+ ...req.query.status && { status: req.query.status },
560
+ ...req.query.url && { url: req.query.url },
561
+ ...search && { name: { $regex: search, $options: "i" } },
562
+ ...parent ? { parent: new db.mongoose.Types.ObjectId(parent) } : {},
563
+ ...rootOnly ? { parent: null } : {}
564
+ };
565
+ const pipeline = [
566
+ { $match: matchStage },
567
+ {
568
+ $graphLookup: {
569
+ from: "categories",
570
+ startWith: "$_id",
571
+ connectFromField: "_id",
572
+ connectToField: "parent",
573
+ as: "allDescendants",
574
+ maxDepth: 10
575
+ }
576
+ },
577
+ { $sort: { [sort]: order === "asc" ? 1 : -1 } },
578
+ { $skip: (page - 1) * limit },
579
+ { $limit: Number(limit) }
580
+ ];
581
+ const flatResults = await Category.aggregate(pipeline);
582
+ const treeResults = flatResults.map((doc) => {
583
+ const descendants = doc.allDescendants || [];
584
+ const allItems = [doc, ...descendants];
585
+ const tree = buildTree(allItems);
586
+ return tree.find((node) => node._id.toString() === doc._id.toString());
587
+ });
588
+ treeResults.sort((a, b) => {
589
+ const orderA = a.order ?? Number.MAX_SAFE_INTEGER;
590
+ const orderB = b.order ?? Number.MAX_SAFE_INTEGER;
591
+ return orderA - orderB;
592
+ });
593
+ res.json(treeResults);
594
+ } catch (err) {
595
+ res.status(500).json({ message: err.message });
566
596
  }
567
- res.status(200).send(categories);
568
- } catch (err) {
569
- console.log(err);
570
- res.status(500).send({ message: err });
571
- }
572
- };
573
- const updateCategories = async (req, res) => {
574
- console.log(req.body);
575
- try {
576
- const bulkOps = req.body.map((categoryUpdated) => ({
577
- updateOne: {
578
- filter: { url: categoryUpdated.url },
579
- update: { $set: categoryUpdated },
580
- upsert: false
597
+ },
598
+ async create(req, res) {
599
+ try {
600
+ const highestOrder = await Category.findOne().sort("-order");
601
+ const order = highestOrder ? highestOrder.order + 1 : 1;
602
+ const category = new Category({ ...req.body, order });
603
+ if (req.body.parent) {
604
+ const parent = await Category.findByIdAndUpdate(
605
+ req.body.parent,
606
+ { $push: { children: category._id } },
607
+ { new: true }
608
+ );
609
+ if (!parent) throw new Error("Parent category not found");
610
+ category.parent = parent._id;
581
611
  }
582
- }));
583
- const result = await Category.bulkWrite(bulkOps, { ordered: false });
584
- console.log("Success", result);
585
- res.status(200).send({ message: "Categories updated successfully." });
586
- } catch (err) {
587
- console.error("Error processing bulk update", err);
588
- res.status(500).send({ message: err.message });
589
- }
590
- };
591
- const getCategory = async (req, res) => {
592
- try {
593
- const category = await Category.findOne({ url: req.params.url }).exec();
594
- if (!category) {
595
- return res.status(404).send({ message: "Category not found." });
596
- }
597
- res.status(200).send(category);
598
- } catch (err) {
599
- res.status(500).send({ message: err });
600
- }
601
- };
602
- const addCategory = async (req, res) => {
603
- try {
604
- const highestOrderDoc = await Category.findOne().sort("-order");
605
- req.body.order = highestOrderDoc ? highestOrderDoc.order + 1 : 1;
606
- const category = await Category.create(req.body);
607
- if (!category) {
608
- return res.status(404).send({ message: "Category is not created." });
612
+ if (req.body.children && req.body.children.length > 0) {
613
+ await Category.updateMany(
614
+ { _id: { $in: req.body.children } },
615
+ { $set: { parent: category._id } }
616
+ );
617
+ }
618
+ await category.save();
619
+ res.status(201).json(category);
620
+ } catch (err) {
621
+ res.status(err.message === "Parent category not found" ? 404 : 500).json({ message: err.message });
609
622
  }
610
- res.status(200).send(category);
611
- } catch (err) {
612
- console.log(req.body);
613
- console.log(req.category);
614
- res.status(500).send({ message: err });
615
- }
616
- };
617
- const updateCategory = async (req, res) => {
618
- try {
619
- const category = await Category.findOneAndUpdate(
620
- { url: req.params.url },
621
- { $set: req.body },
622
- { new: true }
623
- ).exec();
624
- if (!category) {
625
- return res.status(404).send({ message: "Something wrong when updating category." });
623
+ },
624
+ async update(req, res) {
625
+ try {
626
+ const { categories } = req.body;
627
+ const bulkOps = categories.map((category) => ({
628
+ updateOne: {
629
+ filter: { _id: category._id },
630
+ update: {
631
+ $set: {
632
+ order: category.order,
633
+ parent: category.parent ? new db.mongoose.Types.ObjectId(category.parent) : null
634
+ }
635
+ }
636
+ }
637
+ }));
638
+ await Category.bulkWrite(bulkOps);
639
+ const updatedCategories = await Category.find().sort({ order: "asc" }).lean();
640
+ res.status(200).json(updatedCategories);
641
+ } catch (err) {
642
+ console.error("Category update error:", err);
643
+ res.status(500).json({ message: "Failed to update categories" });
626
644
  }
627
- res.status(200).send(category);
628
- } catch (err) {
629
- res.status(500).send({ message: err });
630
- }
631
- };
632
- const deleteCategory = async (req, res) => {
633
- try {
634
- const category = await Category.findOneAndDelete({ url: req.params.url }).exec();
635
- if (!category) {
636
- return res.status(404).send({ message: "Category is not deleted." });
645
+ },
646
+ async delete(req, res) {
647
+ try {
648
+ const category = await Category.findOne({ url: req.body.url });
649
+ if (!category) throw new Error("Category not found");
650
+ const deleteSubcategories = async (categoryId) => {
651
+ const cat = await Category.findById(categoryId);
652
+ if (cat) {
653
+ for (const childId of cat.children) {
654
+ await deleteSubcategories(childId);
655
+ }
656
+ await Category.findByIdAndDelete(categoryId);
657
+ }
658
+ };
659
+ if (category.parent) {
660
+ await Category.findByIdAndUpdate(category.parent, { $pull: { children: category._id } });
661
+ }
662
+ await deleteSubcategories(category._id);
663
+ res.status(200).json({ message: "Category deleted successfully" });
664
+ } catch (err) {
665
+ res.status(err.message === "Category not found" ? 404 : 500).json({ message: err.message });
637
666
  }
638
- res.status(200).send(category);
639
- } catch (err) {
640
- res.status(500).send({ message: err });
641
667
  }
642
668
  };
643
- return {
644
- getCategories,
645
- updateCategories,
646
- getCategory,
647
- addCategory,
648
- updateCategory,
649
- deleteCategory
650
- };
651
669
  };
652
670
  var categories_controller = controllerFactory$3;
653
671
  var verifyCategory;
@@ -685,37 +703,16 @@ const middlewareIndexFactory = (db) => {
685
703
  var middlewares = middlewareIndexFactory;
686
704
  const controllerFactory$2 = categories_controller;
687
705
  const middlewareFactoryProducts = middlewares;
688
- var categories_routes = function(app, db) {
706
+ categories_routes.exports = function(app, db) {
689
707
  const controller = controllerFactory$2(db);
690
708
  const { verifyCategory: verifyCategory2 } = middlewareFactoryProducts(db);
691
- app.get(
692
- "/categories",
693
- controller.getCategories
694
- );
695
- app.post(
696
- "/categories",
697
- controller.updateCategories
698
- );
699
- app.get(
700
- "/categories/:url",
701
- controller.getCategory
702
- );
703
- app.post(
704
- "/categories/add",
705
- [
706
- verifyCategory2.checkCategoryExistOrNot
707
- ],
708
- controller.addCategory
709
- );
710
- app.post(
711
- "/categories/:url",
712
- controller.updateCategory
713
- );
714
- app.delete(
715
- "/categories/:url",
716
- controller.deleteCategory
717
- );
709
+ app.get("/api/categories", controller.read);
710
+ app.post("/api/categories/create", [verifyCategory2.checkCategoryExistOrNot], controller.create);
711
+ app.post("/api/categories/update", controller.update);
712
+ app.post("/api/categories/delete", controller.delete);
718
713
  };
714
+ categories_routes.exports.controllerFactory = controllerFactory$2;
715
+ var categories_routesExports = categories_routes.exports;
719
716
  const queryProcessorGlobals = queryProcessor;
720
717
  const controllerFactory$1 = (db) => {
721
718
  const Leftover = db.leftover;
@@ -863,7 +860,7 @@ const ProductModel = product_model;
863
860
  const CategoryModel = category_model;
864
861
  const LeftoverModel = leftover_model;
865
862
  const productsRoutes = products_routes;
866
- const categoriesRoutes = categories_routes;
863
+ const categoriesRoutes = categories_routesExports;
867
864
  const leftoversRoutes = leftovers_routes;
868
865
  const ProductController = products_controller;
869
866
  const CategoryController = categories_controller;
@@ -874,7 +871,7 @@ function initializeProduct(app, db, origins, publicPath) {
874
871
  db.leftover = LeftoverModel(db);
875
872
  if (app) {
876
873
  productsRoutes(app, db);
877
- categoriesRoutes(app, db);
874
+ categoriesRoutes(app, db, origins, publicPath);
878
875
  leftoversRoutes(app, db);
879
876
  }
880
877
  }
@@ -2,7 +2,7 @@
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
3
  const vue = require("vue");
4
4
  const Tooltip = require("../Tooltip/Tooltip.vue2.cjs");
5
- const _hoisted_1 = { class: "bg-light pd-medium radius-big" };
5
+ const _hoisted_1 = { class: "bg-light pd-medium radius-medium" };
6
6
  const _hoisted_2 = {
7
7
  key: 0,
8
8
  class: "mn-b-small flex-v-center flex-nowrap flex"
@@ -1 +1 @@
1
- {"version":3,"file":"Block.vue.cjs","sources":["../../../../../src/components/Block/Block.vue"],"sourcesContent":["<template>\n\t<div \n class=\"bg-light pd-medium radius-big\"\n >\n \t<div v-if=\"title || actions\" class=\"mn-b-small flex-v-center flex-nowrap flex\">\n \t\t<h4 v-if=\"title\" class=\"mn-r-thin t-medium\">{{title}}</h4>\n \t\t\t\n \t\t<button \n \t\t\tv-for=\"action in actions\" \n \t\t\t@click=\"action.function\" \n \t\t\tclass=\"pd-thin button-delete button\"\n \t\t\t:class=\"action.class || 'bg-main radius-small t-center i-medium'\"\n \t\t>\n \t\t\t{{action.label}}\n \t\t</button>\n\n \t\t<Tooltip v-if=\"tooltip\" :text=\"tooltip\">\n\t <p class=\"bg-main radius-small t-center i-medium\">i</p>\n\t </Tooltip>\n \t</div>\n\n \t<span \n v-if=\"!hasSlotContent($slots.default)\" \n class=\"w-100\"\n >\n {{placeholder}}\n </span> \n\n \t<slot></slot>\n\t</div>\n</template>\n\n<script setup>\nimport { ref, defineProps, useSlots, Comment } from 'vue';\n\n\nimport Tooltip from '@pf/src/components/Tooltip/Tooltip.vue'\n\nconst slots = useSlots()\n\nconst hasSlotContent = (slot, slotProps = {}) => {\n\tif (!slot) return false;\n\n\treturn slot(slotProps).some((vnode) => {\n\t\tif (Array.isArray(vnode.children)) {\n\t\t\treturn !!vnode.children.length;\n\t\t}\n\n\t\treturn vnode.type !== Comment;\n\t});\n};\n\n// defineProps объявление\nconst props = defineProps({\n\ttitle: {\n\t\ttype: String,\n\t\tdefault: null\n\t},\n\ttooltip: {\n\t\ttype: String,\n\t\tdefault: null\n\t},\n\tactions: {\n\t\ttype: Array,\n\t\tdefault: null\n\t},\n\tplaceholder: {\n\t\ttype: String,\n\t\tdefault: 'Nothing here'\n\t},\n options: {\n type: Object,\n default: {\n \ttheme: 'white'\n }\n },\n})\n</script>"],"names":["useSlots","Comment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCcA,QAAAA,SAAU;AAExB,UAAM,iBAAiB,CAAC,MAAM,YAAY,OAAO;AAChD,UAAI,CAAC,KAAM,QAAO;AAElB,aAAO,KAAK,SAAS,EAAE,KAAK,CAAC,UAAU;AACtC,YAAI,MAAM,QAAQ,MAAM,QAAQ,GAAG;AAClC,iBAAO,CAAC,CAAC,MAAM,SAAS;AAAA,QACxB;AAED,eAAO,MAAM,SAASC;MACxB,CAAE;AAAA,IACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Block.vue.cjs","sources":["../../../../../src/components/Block/Block.vue"],"sourcesContent":["<template>\n\t<div \n class=\"bg-light pd-medium radius-medium\"\n >\n \t<div v-if=\"title || actions\" class=\"mn-b-small flex-v-center flex-nowrap flex\">\n \t\t<h4 v-if=\"title\" class=\"mn-r-thin t-medium\">{{title}}</h4>\n \t\t\t\n \t\t<button \n \t\t\tv-for=\"action in actions\" \n \t\t\t@click=\"action.function\" \n \t\t\tclass=\"pd-thin button-delete button\"\n \t\t\t:class=\"action.class || 'bg-main radius-small t-center i-medium'\"\n \t\t>\n \t\t\t{{action.label}}\n \t\t</button>\n\n \t\t<Tooltip v-if=\"tooltip\" :text=\"tooltip\">\n\t <p class=\"bg-main radius-small t-center i-medium\">i</p>\n\t </Tooltip>\n \t</div>\n\n \t<span \n v-if=\"!hasSlotContent($slots.default)\" \n class=\"w-100\"\n >\n {{placeholder}}\n </span> \n\n \t<slot></slot>\n\t</div>\n</template>\n\n<script setup>\nimport { ref, defineProps, useSlots, Comment } from 'vue';\n\n\nimport Tooltip from '@pf/src/components/Tooltip/Tooltip.vue'\n\nconst slots = useSlots()\n\nconst hasSlotContent = (slot, slotProps = {}) => {\n\tif (!slot) return false;\n\n\treturn slot(slotProps).some((vnode) => {\n\t\tif (Array.isArray(vnode.children)) {\n\t\t\treturn !!vnode.children.length;\n\t\t}\n\n\t\treturn vnode.type !== Comment;\n\t});\n};\n\n// defineProps объявление\nconst props = defineProps({\n\ttitle: {\n\t\ttype: String,\n\t\tdefault: null\n\t},\n\ttooltip: {\n\t\ttype: String,\n\t\tdefault: null\n\t},\n\tactions: {\n\t\ttype: Array,\n\t\tdefault: null\n\t},\n\tplaceholder: {\n\t\ttype: String,\n\t\tdefault: 'Nothing here'\n\t},\n options: {\n type: Object,\n default: {\n \ttheme: 'white'\n }\n },\n})\n</script>"],"names":["useSlots","Comment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCcA,QAAAA,SAAU;AAExB,UAAM,iBAAiB,CAAC,MAAM,YAAY,OAAO;AAChD,UAAI,CAAC,KAAM,QAAO;AAElB,aAAO,KAAK,SAAS,EAAE,KAAK,CAAC,UAAU;AACtC,YAAI,MAAM,QAAQ,MAAM,QAAQ,GAAG;AAClC,iBAAO,CAAC,CAAC,MAAM,SAAS;AAAA,QACxB;AAED,eAAO,MAAM,SAASC;MACxB,CAAE;AAAA,IACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { useSlots, openBlock, createElementBlock, toDisplayString, createCommentVNode, Fragment, renderList, normalizeClass, createBlock, withCtx, createElementVNode, renderSlot, Comment } from "vue";
2
2
  import _sfc_main$1 from "../Tooltip/Tooltip.vue2.js";
3
- const _hoisted_1 = { class: "bg-light pd-medium radius-big" };
3
+ const _hoisted_1 = { class: "bg-light pd-medium radius-medium" };
4
4
  const _hoisted_2 = {
5
5
  key: 0,
6
6
  class: "mn-b-small flex-v-center flex-nowrap flex"
@@ -1 +1 @@
1
- {"version":3,"file":"Block.vue.js","sources":["../../../../../src/components/Block/Block.vue"],"sourcesContent":["<template>\n\t<div \n class=\"bg-light pd-medium radius-big\"\n >\n \t<div v-if=\"title || actions\" class=\"mn-b-small flex-v-center flex-nowrap flex\">\n \t\t<h4 v-if=\"title\" class=\"mn-r-thin t-medium\">{{title}}</h4>\n \t\t\t\n \t\t<button \n \t\t\tv-for=\"action in actions\" \n \t\t\t@click=\"action.function\" \n \t\t\tclass=\"pd-thin button-delete button\"\n \t\t\t:class=\"action.class || 'bg-main radius-small t-center i-medium'\"\n \t\t>\n \t\t\t{{action.label}}\n \t\t</button>\n\n \t\t<Tooltip v-if=\"tooltip\" :text=\"tooltip\">\n\t <p class=\"bg-main radius-small t-center i-medium\">i</p>\n\t </Tooltip>\n \t</div>\n\n \t<span \n v-if=\"!hasSlotContent($slots.default)\" \n class=\"w-100\"\n >\n {{placeholder}}\n </span> \n\n \t<slot></slot>\n\t</div>\n</template>\n\n<script setup>\nimport { ref, defineProps, useSlots, Comment } from 'vue';\n\n\nimport Tooltip from '@pf/src/components/Tooltip/Tooltip.vue'\n\nconst slots = useSlots()\n\nconst hasSlotContent = (slot, slotProps = {}) => {\n\tif (!slot) return false;\n\n\treturn slot(slotProps).some((vnode) => {\n\t\tif (Array.isArray(vnode.children)) {\n\t\t\treturn !!vnode.children.length;\n\t\t}\n\n\t\treturn vnode.type !== Comment;\n\t});\n};\n\n// defineProps объявление\nconst props = defineProps({\n\ttitle: {\n\t\ttype: String,\n\t\tdefault: null\n\t},\n\ttooltip: {\n\t\ttype: String,\n\t\tdefault: null\n\t},\n\tactions: {\n\t\ttype: Array,\n\t\tdefault: null\n\t},\n\tplaceholder: {\n\t\ttype: String,\n\t\tdefault: 'Nothing here'\n\t},\n options: {\n type: Object,\n default: {\n \ttheme: 'white'\n }\n },\n})\n</script>"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCc,aAAU;AAExB,UAAM,iBAAiB,CAAC,MAAM,YAAY,OAAO;AAChD,UAAI,CAAC,KAAM,QAAO;AAElB,aAAO,KAAK,SAAS,EAAE,KAAK,CAAC,UAAU;AACtC,YAAI,MAAM,QAAQ,MAAM,QAAQ,GAAG;AAClC,iBAAO,CAAC,CAAC,MAAM,SAAS;AAAA,QACxB;AAED,eAAO,MAAM,SAAS;AAAA,MACxB,CAAE;AAAA,IACF;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Block.vue.js","sources":["../../../../../src/components/Block/Block.vue"],"sourcesContent":["<template>\n\t<div \n class=\"bg-light pd-medium radius-medium\"\n >\n \t<div v-if=\"title || actions\" class=\"mn-b-small flex-v-center flex-nowrap flex\">\n \t\t<h4 v-if=\"title\" class=\"mn-r-thin t-medium\">{{title}}</h4>\n \t\t\t\n \t\t<button \n \t\t\tv-for=\"action in actions\" \n \t\t\t@click=\"action.function\" \n \t\t\tclass=\"pd-thin button-delete button\"\n \t\t\t:class=\"action.class || 'bg-main radius-small t-center i-medium'\"\n \t\t>\n \t\t\t{{action.label}}\n \t\t</button>\n\n \t\t<Tooltip v-if=\"tooltip\" :text=\"tooltip\">\n\t <p class=\"bg-main radius-small t-center i-medium\">i</p>\n\t </Tooltip>\n \t</div>\n\n \t<span \n v-if=\"!hasSlotContent($slots.default)\" \n class=\"w-100\"\n >\n {{placeholder}}\n </span> \n\n \t<slot></slot>\n\t</div>\n</template>\n\n<script setup>\nimport { ref, defineProps, useSlots, Comment } from 'vue';\n\n\nimport Tooltip from '@pf/src/components/Tooltip/Tooltip.vue'\n\nconst slots = useSlots()\n\nconst hasSlotContent = (slot, slotProps = {}) => {\n\tif (!slot) return false;\n\n\treturn slot(slotProps).some((vnode) => {\n\t\tif (Array.isArray(vnode.children)) {\n\t\t\treturn !!vnode.children.length;\n\t\t}\n\n\t\treturn vnode.type !== Comment;\n\t});\n};\n\n// defineProps объявление\nconst props = defineProps({\n\ttitle: {\n\t\ttype: String,\n\t\tdefault: null\n\t},\n\ttooltip: {\n\t\ttype: String,\n\t\tdefault: null\n\t},\n\tactions: {\n\t\ttype: Array,\n\t\tdefault: null\n\t},\n\tplaceholder: {\n\t\ttype: String,\n\t\tdefault: 'Nothing here'\n\t},\n options: {\n type: Object,\n default: {\n \ttheme: 'white'\n }\n },\n})\n</script>"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCc,aAAU;AAExB,UAAM,iBAAiB,CAAC,MAAM,YAAY,OAAO;AAChD,UAAI,CAAC,KAAM,QAAO;AAElB,aAAO,KAAK,SAAS,EAAE,KAAK,CAAC,UAAU;AACtC,YAAI,MAAM,QAAQ,MAAM,QAAQ,GAAG;AAClC,iBAAO,CAAC,CAAC,MAAM,SAAS;AAAA,QACxB;AAED,eAAO,MAAM,SAAS;AAAA,MACxB,CAAE;AAAA,IACF;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
3
  const vue = require("vue");
4
4
  ;/* empty css */
5
- const _hoisted_1 = { class: "t-trimmed font-main" };
5
+ const _hoisted_1 = { class: "font-main" };
6
6
  const _hoisted_2 = { class: "t-truncate" };
7
7
  const _hoisted_3 = {
8
8
  key: 1,
@@ -15,6 +15,7 @@ const _sfc_main = {
15
15
  return (_ctx, _cache) => {
16
16
  var _a;
17
17
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
18
+ vue.renderSlot(_ctx.$slots, "default"),
18
19
  ((_a = __props.chips) == null ? void 0 : _a.length) ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(__props.chips, (chip, index) => {
19
20
  return vue.openBlock(), vue.createElementBlock("span", {
20
21
  class: vue.normalizeClass([_ctx.$attrs.class || "p-medium font-main", "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"])
@@ -1 +1 @@
1
- {"version":3,"file":"Chips.vue2.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Chips.vue2.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,6 +1,6 @@
1
- import { openBlock, createElementBlock, Fragment, renderList, normalizeClass, createElementVNode, toDisplayString, renderSlot } from "vue";
1
+ import { openBlock, createElementBlock, renderSlot, Fragment, renderList, normalizeClass, createElementVNode, toDisplayString } from "vue";
2
2
  /* empty css */
3
- const _hoisted_1 = { class: "t-trimmed font-main" };
3
+ const _hoisted_1 = { class: "font-main" };
4
4
  const _hoisted_2 = { class: "t-truncate" };
5
5
  const _hoisted_3 = {
6
6
  key: 1,
@@ -13,6 +13,7 @@ const _sfc_main = {
13
13
  return (_ctx, _cache) => {
14
14
  var _a;
15
15
  return openBlock(), createElementBlock("div", _hoisted_1, [
16
+ renderSlot(_ctx.$slots, "default"),
16
17
  ((_a = __props.chips) == null ? void 0 : _a.length) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(__props.chips, (chip, index) => {
17
18
  return openBlock(), createElementBlock("span", {
18
19
  class: normalizeClass([_ctx.$attrs.class || "p-medium font-main", "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"])
@@ -1 +1 @@
1
- {"version":3,"file":"Chips.vue2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Chips.vue2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -85,7 +85,7 @@ const _sfc_main = {
85
85
  uploadPath: props.uploadPath,
86
86
  text: props.text,
87
87
  options: props.options,
88
- class: "w-100 pd-extra"
88
+ class: "w-100 pd-medium"
89
89
  }, null, 8, ["uploadPath", "text", "options"])) : vue.createCommentVNode("", true)
90
90
  ]);
91
91
  };
@@ -1 +1 @@
1
- {"version":3,"file":"EditImages.vue2.cjs","sources":["../../../../../src/components/EditImages/EditImages.vue"],"sourcesContent":["<template>\n\t<div class=\"flex-nowrap flex gap-small\">\n <VueDraggableNext v-if=\"localImages.length > 0\" class=\"gap-small flex dragArea list-group w-full\" v-model=\"localImages\" @change=\"emitChanges\">\n\t\t\t<div v-for=\"(image, index) in localImages\" class=\"pos-relative\">\n\t\t\t\t<img loading=\"lazy\" class=\"i-extra object-fit-contain bg-black-transp-5 pd-nano radius-small o-hidden\" :src=\"(FILE_SERVER_URL || '') + image\" />\n\t\t\t\t\n <IconCross \n @click=\"deleteImage(index)\" \n class=\"cursor-pointer pos-absolute t-center flex-center flex radius-extra i-medium bg-red pos-t-10-negative pos-r-10-negative pd-micro\"\n />\n\t\t\t</div>\n\t\t</VueDraggableNext>\n <div\n v-if=\"localImages.length > 0\" \n class=\"i-extra uppercase flex-center flex radius-small o-hidden br-solid br-main br-2px pd-small\"\n >\n <UploadImageMultiple \n @update:images=\"onImagesUpdate\"\n text=\"Add\"\n :options=\"{\n showText: false\n }\"\n :uploadPath=\"'photos'\"\n class=\"radius-big\"\n />\n </div>\n\n\n\t\t<UploadImageMultiple \t\n v-if=\"localImages.length < 1\" \n @update:images=\"onImagesUpdate\"\n :uploadPath=\"props.uploadPath\"\n :text=\"props.text\"\n :options=\"props.options\"\n class=\"w-100 pd-extra\"\n />\n\t</div>\t\n</template>\n\n<script setup>\nimport { ref, defineProps, watchEffect } from 'vue';\nimport { VueDraggableNext } from 'vue-draggable-next'\nimport UploadImageMultiple from \"@pf/src/components/UploadImageMultiple/UploadImageMultiple.vue\";\nimport IconCross from '@pf/src/modules/icons/navigation/IconCross.vue';\n\nconst props = defineProps({\n images: Array,\n text: Object,\n options: Object,\n uploadPath: {\n type: Object,\n default: 'unsorted'\n }\n});\n\nconst emit = defineEmits(['update:images'])\n\nconst localImages = ref([...props.images])\n\nwatchEffect(() => {\n localImages.value = [...props.images]; // Обновление localImages при изменении props.images\n});\n\nconst emitChanges = () => {\n emit('update:images', localImages.value)\n}\n\nconst onImagesUpdate = (newImages) => {\n localImages.value = [...localImages.value, ...newImages]\n emitChanges()\n}\n\nconst deleteImage = (index) => {\n localImages.value.splice(index, 1)\n emitChanges()\n}\n</script>\n\n<style lang=\"scss\">\n// Your styles here\n</style>\n"],"names":["ref","watchEffect"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,UAAM,QAAQ;AAUd,UAAM,OAAO;AAEb,UAAM,cAAcA,IAAAA,IAAI,CAAC,GAAG,MAAM,MAAM,CAAC;AAEzCC,QAAAA,YAAY,MAAM;AAChB,kBAAY,QAAQ,CAAC,GAAG,MAAM,MAAM;AAAA,IACtC,CAAC;AAED,UAAM,cAAc,MAAM;AACxB,WAAK,iBAAiB,YAAY,KAAK;AAAA,IACzC;AAEA,UAAM,iBAAiB,CAAC,cAAc;AACpC,kBAAY,QAAQ,CAAC,GAAG,YAAY,OAAO,GAAG,SAAS;AACvD,kBAAa;AAAA,IACf;AAEA,UAAM,cAAc,CAAC,UAAU;AAC7B,kBAAY,MAAM,OAAO,OAAO,CAAC;AACjC,kBAAa;AAAA,IACf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"EditImages.vue2.cjs","sources":["../../../../../src/components/EditImages/EditImages.vue"],"sourcesContent":["<template>\n\t<div class=\"flex-nowrap flex gap-small\">\n <VueDraggableNext v-if=\"localImages.length > 0\" class=\"gap-small flex dragArea list-group w-full\" v-model=\"localImages\" @change=\"emitChanges\">\n\t\t\t<div v-for=\"(image, index) in localImages\" class=\"pos-relative\">\n\t\t\t\t<img loading=\"lazy\" class=\"i-extra object-fit-contain bg-black-transp-5 pd-nano radius-small o-hidden\" :src=\"(FILE_SERVER_URL || '') + image\" />\n\t\t\t\t\n <IconCross \n @click=\"deleteImage(index)\" \n class=\"cursor-pointer pos-absolute t-center flex-center flex radius-extra i-medium bg-red pos-t-10-negative pos-r-10-negative pd-micro\"\n />\n\t\t\t</div>\n\t\t</VueDraggableNext>\n <div\n v-if=\"localImages.length > 0\" \n class=\"i-extra uppercase flex-center flex radius-small o-hidden br-solid br-main br-2px pd-small\"\n >\n <UploadImageMultiple \n @update:images=\"onImagesUpdate\"\n text=\"Add\"\n :options=\"{\n showText: false\n }\"\n :uploadPath=\"'photos'\"\n class=\"radius-big\"\n />\n </div>\n\n\n\t\t<UploadImageMultiple \t\n v-if=\"localImages.length < 1\" \n @update:images=\"onImagesUpdate\"\n :uploadPath=\"props.uploadPath\"\n :text=\"props.text\"\n :options=\"props.options\"\n class=\"w-100 pd-medium\"\n />\n\t</div>\t\n</template>\n\n<script setup>\nimport { ref, defineProps, watchEffect } from 'vue';\nimport { VueDraggableNext } from 'vue-draggable-next'\nimport UploadImageMultiple from \"@pf/src/components/UploadImageMultiple/UploadImageMultiple.vue\";\nimport IconCross from '@pf/src/modules/icons/navigation/IconCross.vue';\n\nconst props = defineProps({\n images: Array,\n text: Object,\n options: Object,\n uploadPath: {\n type: Object,\n default: 'unsorted'\n }\n});\n\nconst emit = defineEmits(['update:images'])\n\nconst localImages = ref([...props.images])\n\nwatchEffect(() => {\n localImages.value = [...props.images]; // Обновление localImages при изменении props.images\n});\n\nconst emitChanges = () => {\n emit('update:images', localImages.value)\n}\n\nconst onImagesUpdate = (newImages) => {\n localImages.value = [...localImages.value, ...newImages]\n emitChanges()\n}\n\nconst deleteImage = (index) => {\n localImages.value.splice(index, 1)\n emitChanges()\n}\n</script>\n\n<style lang=\"scss\">\n// Your styles here\n</style>\n"],"names":["ref","watchEffect"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,UAAM,QAAQ;AAUd,UAAM,OAAO;AAEb,UAAM,cAAcA,IAAAA,IAAI,CAAC,GAAG,MAAM,MAAM,CAAC;AAEzCC,QAAAA,YAAY,MAAM;AAChB,kBAAY,QAAQ,CAAC,GAAG,MAAM,MAAM;AAAA,IACtC,CAAC;AAED,UAAM,cAAc,MAAM;AACxB,WAAK,iBAAiB,YAAY,KAAK;AAAA,IACzC;AAEA,UAAM,iBAAiB,CAAC,cAAc;AACpC,kBAAY,QAAQ,CAAC,GAAG,YAAY,OAAO,GAAG,SAAS;AACvD,kBAAa;AAAA,IACf;AAEA,UAAM,cAAc,CAAC,UAAU;AAC7B,kBAAY,MAAM,OAAO,OAAO,CAAC;AACjC,kBAAa;AAAA,IACf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -83,7 +83,7 @@ const _sfc_main = {
83
83
  uploadPath: props.uploadPath,
84
84
  text: props.text,
85
85
  options: props.options,
86
- class: "w-100 pd-extra"
86
+ class: "w-100 pd-medium"
87
87
  }, null, 8, ["uploadPath", "text", "options"])) : createCommentVNode("", true)
88
88
  ]);
89
89
  };
@@ -1 +1 @@
1
- {"version":3,"file":"EditImages.vue2.js","sources":["../../../../../src/components/EditImages/EditImages.vue"],"sourcesContent":["<template>\n\t<div class=\"flex-nowrap flex gap-small\">\n <VueDraggableNext v-if=\"localImages.length > 0\" class=\"gap-small flex dragArea list-group w-full\" v-model=\"localImages\" @change=\"emitChanges\">\n\t\t\t<div v-for=\"(image, index) in localImages\" class=\"pos-relative\">\n\t\t\t\t<img loading=\"lazy\" class=\"i-extra object-fit-contain bg-black-transp-5 pd-nano radius-small o-hidden\" :src=\"(FILE_SERVER_URL || '') + image\" />\n\t\t\t\t\n <IconCross \n @click=\"deleteImage(index)\" \n class=\"cursor-pointer pos-absolute t-center flex-center flex radius-extra i-medium bg-red pos-t-10-negative pos-r-10-negative pd-micro\"\n />\n\t\t\t</div>\n\t\t</VueDraggableNext>\n <div\n v-if=\"localImages.length > 0\" \n class=\"i-extra uppercase flex-center flex radius-small o-hidden br-solid br-main br-2px pd-small\"\n >\n <UploadImageMultiple \n @update:images=\"onImagesUpdate\"\n text=\"Add\"\n :options=\"{\n showText: false\n }\"\n :uploadPath=\"'photos'\"\n class=\"radius-big\"\n />\n </div>\n\n\n\t\t<UploadImageMultiple \t\n v-if=\"localImages.length < 1\" \n @update:images=\"onImagesUpdate\"\n :uploadPath=\"props.uploadPath\"\n :text=\"props.text\"\n :options=\"props.options\"\n class=\"w-100 pd-extra\"\n />\n\t</div>\t\n</template>\n\n<script setup>\nimport { ref, defineProps, watchEffect } from 'vue';\nimport { VueDraggableNext } from 'vue-draggable-next'\nimport UploadImageMultiple from \"@pf/src/components/UploadImageMultiple/UploadImageMultiple.vue\";\nimport IconCross from '@pf/src/modules/icons/navigation/IconCross.vue';\n\nconst props = defineProps({\n images: Array,\n text: Object,\n options: Object,\n uploadPath: {\n type: Object,\n default: 'unsorted'\n }\n});\n\nconst emit = defineEmits(['update:images'])\n\nconst localImages = ref([...props.images])\n\nwatchEffect(() => {\n localImages.value = [...props.images]; // Обновление localImages при изменении props.images\n});\n\nconst emitChanges = () => {\n emit('update:images', localImages.value)\n}\n\nconst onImagesUpdate = (newImages) => {\n localImages.value = [...localImages.value, ...newImages]\n emitChanges()\n}\n\nconst deleteImage = (index) => {\n localImages.value.splice(index, 1)\n emitChanges()\n}\n</script>\n\n<style lang=\"scss\">\n// Your styles here\n</style>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,UAAM,QAAQ;AAUd,UAAM,OAAO;AAEb,UAAM,cAAc,IAAI,CAAC,GAAG,MAAM,MAAM,CAAC;AAEzC,gBAAY,MAAM;AAChB,kBAAY,QAAQ,CAAC,GAAG,MAAM,MAAM;AAAA,IACtC,CAAC;AAED,UAAM,cAAc,MAAM;AACxB,WAAK,iBAAiB,YAAY,KAAK;AAAA,IACzC;AAEA,UAAM,iBAAiB,CAAC,cAAc;AACpC,kBAAY,QAAQ,CAAC,GAAG,YAAY,OAAO,GAAG,SAAS;AACvD,kBAAa;AAAA,IACf;AAEA,UAAM,cAAc,CAAC,UAAU;AAC7B,kBAAY,MAAM,OAAO,OAAO,CAAC;AACjC,kBAAa;AAAA,IACf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"EditImages.vue2.js","sources":["../../../../../src/components/EditImages/EditImages.vue"],"sourcesContent":["<template>\n\t<div class=\"flex-nowrap flex gap-small\">\n <VueDraggableNext v-if=\"localImages.length > 0\" class=\"gap-small flex dragArea list-group w-full\" v-model=\"localImages\" @change=\"emitChanges\">\n\t\t\t<div v-for=\"(image, index) in localImages\" class=\"pos-relative\">\n\t\t\t\t<img loading=\"lazy\" class=\"i-extra object-fit-contain bg-black-transp-5 pd-nano radius-small o-hidden\" :src=\"(FILE_SERVER_URL || '') + image\" />\n\t\t\t\t\n <IconCross \n @click=\"deleteImage(index)\" \n class=\"cursor-pointer pos-absolute t-center flex-center flex radius-extra i-medium bg-red pos-t-10-negative pos-r-10-negative pd-micro\"\n />\n\t\t\t</div>\n\t\t</VueDraggableNext>\n <div\n v-if=\"localImages.length > 0\" \n class=\"i-extra uppercase flex-center flex radius-small o-hidden br-solid br-main br-2px pd-small\"\n >\n <UploadImageMultiple \n @update:images=\"onImagesUpdate\"\n text=\"Add\"\n :options=\"{\n showText: false\n }\"\n :uploadPath=\"'photos'\"\n class=\"radius-big\"\n />\n </div>\n\n\n\t\t<UploadImageMultiple \t\n v-if=\"localImages.length < 1\" \n @update:images=\"onImagesUpdate\"\n :uploadPath=\"props.uploadPath\"\n :text=\"props.text\"\n :options=\"props.options\"\n class=\"w-100 pd-medium\"\n />\n\t</div>\t\n</template>\n\n<script setup>\nimport { ref, defineProps, watchEffect } from 'vue';\nimport { VueDraggableNext } from 'vue-draggable-next'\nimport UploadImageMultiple from \"@pf/src/components/UploadImageMultiple/UploadImageMultiple.vue\";\nimport IconCross from '@pf/src/modules/icons/navigation/IconCross.vue';\n\nconst props = defineProps({\n images: Array,\n text: Object,\n options: Object,\n uploadPath: {\n type: Object,\n default: 'unsorted'\n }\n});\n\nconst emit = defineEmits(['update:images'])\n\nconst localImages = ref([...props.images])\n\nwatchEffect(() => {\n localImages.value = [...props.images]; // Обновление localImages при изменении props.images\n});\n\nconst emitChanges = () => {\n emit('update:images', localImages.value)\n}\n\nconst onImagesUpdate = (newImages) => {\n localImages.value = [...localImages.value, ...newImages]\n emitChanges()\n}\n\nconst deleteImage = (index) => {\n localImages.value.splice(index, 1)\n emitChanges()\n}\n</script>\n\n<style lang=\"scss\">\n// Your styles here\n</style>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,UAAM,QAAQ;AAUd,UAAM,OAAO;AAEb,UAAM,cAAc,IAAI,CAAC,GAAG,MAAM,MAAM,CAAC;AAEzC,gBAAY,MAAM;AAChB,kBAAY,QAAQ,CAAC,GAAG,MAAM,MAAM;AAAA,IACtC,CAAC;AAED,UAAM,cAAc,MAAM;AACxB,WAAK,iBAAiB,YAAY,KAAK;AAAA,IACzC;AAEA,UAAM,iBAAiB,CAAC,cAAc;AACpC,kBAAY,QAAQ,CAAC,GAAG,YAAY,OAAO,GAAG,SAAS;AACvD,kBAAa;AAAA,IACf;AAEA,UAAM,cAAc,CAAC,UAAU;AAC7B,kBAAY,MAAM,OAAO,OAAO,CAAC;AACjC,kBAAa;AAAA,IACf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}