@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
@@ -17,18 +17,19 @@ const CardPosition = require("../blocks/CardPosition.vue.cjs");
17
17
  const CardOrderItem = require("../../../orders/components/blocks/CardOrderItem.vue.cjs");
18
18
  const EditProductInfo = require("../sections/EditProductInfo.vue.cjs");
19
19
  const globals = require("../../../globals/views/store/globals.cjs");
20
+ const auth = require("../../../auth/views/store/auth.cjs");
20
21
  const products = require("../../store/products.cjs");
21
22
  const categories = require("../../store/categories.cjs");
22
23
  ;/* empty css */
23
- const _hoisted_1 = { class: "for-transition w-100 cols-1 pd-thin gap-thin" };
24
- const _hoisted_2 = { class: "mn-r-auto" };
24
+ const _hoisted_1 = { class: "for-transition w-100 cols-1 bg-white pd-thin gap-thin" };
25
+ const _hoisted_2 = { class: "t-nowrap mn-r-auto" };
25
26
  const _hoisted_3 = { class: "cols-2 gap-thin" };
26
- const _hoisted_4 = {
27
+ const _hoisted_4 = { class: "radius-small h-100 i-big flex-center flex aspect-1x1 bg-red" };
28
+ const _hoisted_5 = {
27
29
  key: 0,
28
30
  class: "cols-1 gap-thin"
29
31
  };
30
- const _hoisted_5 = { class: "bg-light mn-b-thin h-min-20r h-max-20r o-scroll pd-medium radius-big" };
31
- const _hoisted_6 = { class: "radius-small h-100 i-big flex-center flex aspect-1x1 bg-red" };
32
+ const _hoisted_6 = { class: "bg-light mn-b-thin h-min-20r h-max-20r o-scroll pd-medium radius-big" };
32
33
  const _hoisted_7 = { class: "radius-small pd-small flex-center flex aspect-1x1 bg-red" };
33
34
  const _sfc_main = {
34
35
  __name: "ProductEdit",
@@ -62,11 +63,25 @@ const _sfc_main = {
62
63
  console.error("error");
63
64
  }
64
65
  });
65
- function onSubmit() {
66
- if (route.params.product) {
67
- products.actions.update(route.params.product, products.state.current);
68
- } else {
69
- products.actions.create(route.params._id, products.state.current);
66
+ async function onSubmit() {
67
+ try {
68
+ if (route.params.product) {
69
+ await products.actions.update(route.params.product, products.state.current);
70
+ } else {
71
+ products.state.current.owner = {
72
+ target: route.params._id || auth.state.user._id,
73
+ type: route.params._id ? "organization" : "user"
74
+ };
75
+ products.state.current.creator = {
76
+ target: auth.state.user._id,
77
+ type: "user",
78
+ hidden: false
79
+ };
80
+ await products.actions.create(products.state.current);
81
+ }
82
+ } catch (error) {
83
+ globals.setError({ response: { data: { errorCode: "PRODUCT_NOT_CREATED" } } });
84
+ console.error("Product creation error:", error);
70
85
  }
71
86
  }
72
87
  function onDelete() {
@@ -82,9 +97,12 @@ const _sfc_main = {
82
97
  }
83
98
  return (_ctx, _cache) => {
84
99
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
85
- vue.createVNode(Block.default, { class: "flex-nowrap flex-v-center flex" }, {
100
+ !_ctx.MOBILE_APP ? (vue.openBlock(), vue.createBlock(Block.default, {
101
+ key: 0,
102
+ class: "flex-nowrap gap-small flex-v-center flex"
103
+ }, {
86
104
  default: vue.withCtx(() => [
87
- vue.createElementVNode("h1", _hoisted_2, vue.toDisplayString(vue.unref(route).params.product ? products.state.current.name : "Create Product"), 1),
105
+ vue.createElementVNode("h2", _hoisted_2, vue.toDisplayString(vue.unref(route).params.product ? products.state.current.name : "Create Product"), 1),
88
106
  vue.unref(route).params.product ? (vue.openBlock(), vue.createBlock(Button.default, {
89
107
  key: 0,
90
108
  submit: onDelete,
@@ -108,7 +126,7 @@ const _sfc_main = {
108
126
  })
109
127
  ]),
110
128
  _: 1
111
- }),
129
+ })) : vue.createCommentVNode("", true),
112
130
  vue.createVNode(Block.default, {
113
131
  placeholder: "The product doesn't have any images yet.",
114
132
  class: "h-min"
@@ -133,6 +151,70 @@ const _sfc_main = {
133
151
  ]),
134
152
  _: 1
135
153
  }),
154
+ vue.createVNode(Block.default, {
155
+ title: "Categories",
156
+ actions: [{
157
+ label: "+",
158
+ function: () => vue.unref(router).push({
159
+ name: "Categories",
160
+ params: {
161
+ _id: vue.unref(route).params._id
162
+ }
163
+ })
164
+ }]
165
+ }, {
166
+ default: vue.withCtx(() => [
167
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(categories.state.all, (category, index) => {
168
+ return vue.openBlock(), vue.createBlock(Checkbox.default, {
169
+ label: category.name,
170
+ name: "categories",
171
+ value: category.url,
172
+ class: "w-100 mn-t-small bg-white radius-small pd-small",
173
+ radio: products.state.current.category,
174
+ "onUpdate:radio": (event) => products.state.current.category = event
175
+ }, null, 8, ["label", "value", "radio", "onUpdate:radio"]);
176
+ }), 256))
177
+ ]),
178
+ _: 1
179
+ }, 8, ["actions"]),
180
+ vue.createVNode(Block.default, {
181
+ title: "Parameters",
182
+ placeholder: "No parameters added yet",
183
+ actions: [{
184
+ label: "+",
185
+ function: () => products.state.current.information.push({ name: "", value: "" })
186
+ }],
187
+ class: "cols-1 gap-thin"
188
+ }, {
189
+ default: vue.withCtx(() => [
190
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(products.state.current.information, (item, index) => {
191
+ return vue.openBlock(), vue.createElementBlock("div", {
192
+ class: "gap-thin flex-nowrap flex",
193
+ key: index
194
+ }, [
195
+ vue.createVNode(Field.default, {
196
+ field: item.name,
197
+ "onUpdate:field": ($event) => item.name = $event,
198
+ placeholder: "Название параметра",
199
+ class: "w-100 bg-white radius-small pd-medium"
200
+ }, null, 8, ["field", "onUpdate:field"]),
201
+ vue.createVNode(Field.default, {
202
+ field: item.value,
203
+ "onUpdate:field": ($event) => item.value = $event,
204
+ placeholder: "Значение параметра",
205
+ class: "w-100 bg-white radius-small pd-medium"
206
+ }, null, 8, ["field", "onUpdate:field"]),
207
+ vue.createElementVNode("div", _hoisted_4, [
208
+ vue.createVNode(IconDelete.default, {
209
+ onClick: () => products.state.current.information.splice(index, 1),
210
+ class: "i-medium"
211
+ }, null, 8, ["onClick"])
212
+ ])
213
+ ]);
214
+ }), 128))
215
+ ]),
216
+ _: 1
217
+ }, 8, ["actions"]),
136
218
  vue.createVNode(Block.default, {
137
219
  title: "Ingredients",
138
220
  placeholder: "No ingridients added yet",
@@ -142,7 +224,7 @@ const _sfc_main = {
142
224
  }]
143
225
  }, {
144
226
  default: vue.withCtx(() => [
145
- products.state.current.ingredients.length > 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4, [
227
+ products.state.current.ingredients.length > 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5, [
146
228
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(products.state.current.ingredients, (product, index) => {
147
229
  return vue.openBlock(), vue.createBlock(CardPosition.default, {
148
230
  key: product._id,
@@ -175,7 +257,7 @@ const _sfc_main = {
175
257
  class: "bg-white w-min-30r w-max-30r radius-big pd-medium"
176
258
  }, {
177
259
  default: vue.withCtx(() => [
178
- vue.createElementVNode("div", _hoisted_5, [
260
+ vue.createElementVNode("div", _hoisted_6, [
179
261
  vue.createVNode(Feed.default, {
180
262
  search: {
181
263
  class: "bg-white mn-b-thin"
@@ -221,70 +303,6 @@ const _sfc_main = {
221
303
  _: 1
222
304
  }, 8, ["isPopupOpen"])
223
305
  ]),
224
- vue.createVNode(Block.default, {
225
- title: "Categories",
226
- actions: [{
227
- label: "+",
228
- function: () => vue.unref(router).push({
229
- name: "Categories Organization",
230
- params: {
231
- _id: vue.unref(route).params._id
232
- }
233
- })
234
- }]
235
- }, {
236
- default: vue.withCtx(() => [
237
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(categories.state.all, (category, index) => {
238
- return vue.openBlock(), vue.createBlock(Checkbox.default, {
239
- label: category.name,
240
- name: "categories",
241
- value: category.url,
242
- class: "w-100 mn-t-small bg-white radius-small pd-small",
243
- radio: products.state.current.category,
244
- "onUpdate:radio": (event) => products.state.current.category = event
245
- }, null, 8, ["label", "value", "radio", "onUpdate:radio"]);
246
- }), 256))
247
- ]),
248
- _: 1
249
- }, 8, ["actions"]),
250
- vue.createVNode(Block.default, {
251
- title: "Parameters",
252
- placeholder: "No parameters added yet",
253
- actions: [{
254
- label: "+",
255
- function: () => products.state.current.information.push({ name: "", value: "" })
256
- }],
257
- class: "cols-1 gap-thin"
258
- }, {
259
- default: vue.withCtx(() => [
260
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(products.state.current.information, (item, index) => {
261
- return vue.openBlock(), vue.createElementBlock("div", {
262
- class: "gap-thin flex-nowrap flex",
263
- key: index
264
- }, [
265
- vue.createVNode(Field.default, {
266
- field: item.name,
267
- "onUpdate:field": ($event) => item.name = $event,
268
- placeholder: "Название параметра",
269
- class: "w-100 bg-white radius-small pd-medium"
270
- }, null, 8, ["field", "onUpdate:field"]),
271
- vue.createVNode(Field.default, {
272
- field: item.value,
273
- "onUpdate:field": ($event) => item.value = $event,
274
- placeholder: "Значение параметра",
275
- class: "w-100 bg-white radius-small pd-medium"
276
- }, null, 8, ["field", "onUpdate:field"]),
277
- vue.createElementVNode("div", _hoisted_6, [
278
- vue.createVNode(IconDelete.default, {
279
- onClick: () => products.state.current.information.splice(index, 1),
280
- class: "i-medium"
281
- }, null, 8, ["onClick"])
282
- ])
283
- ]);
284
- }), 128))
285
- ]),
286
- _: 1
287
- }, 8, ["actions"]),
288
306
  vue.createVNode(Block.default, {
289
307
  title: "Localization",
290
308
  placeholder: "No localizations added yet",
@@ -321,7 +339,28 @@ const _sfc_main = {
321
339
  }), 128))
322
340
  ]),
323
341
  _: 1
324
- }, 8, ["actions"])
342
+ }, 8, ["actions"]),
343
+ vue.unref(route).params.product ? (vue.openBlock(), vue.createBlock(Button.default, {
344
+ key: 1,
345
+ submit: onDelete,
346
+ callback: redirectTo,
347
+ class: "bg-red w-100 mn-b-thin"
348
+ }, {
349
+ default: vue.withCtx(() => _cache[4] || (_cache[4] = [
350
+ vue.createTextVNode(" Delete ")
351
+ ])),
352
+ _: 1
353
+ })) : vue.createCommentVNode("", true),
354
+ vue.createVNode(Button.default, {
355
+ submit: onSubmit,
356
+ callback: redirectTo,
357
+ class: "w-100 bg-main"
358
+ }, {
359
+ default: vue.withCtx(() => _cache[5] || (_cache[5] = [
360
+ vue.createTextVNode(" Save ")
361
+ ])),
362
+ _: 1
363
+ })
325
364
  ]);
326
365
  };
327
366
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ProductEdit.vue.cjs","sources":["../../../../../../../src/modules/products/components/pages/ProductEdit.vue"],"sourcesContent":["<template>\n\t<div class=\"for-transition w-100 cols-1 pd-thin gap-thin\">\n \n <Block class=\"flex-nowrap flex-v-center flex\">\n \n <h1 class=\"mn-r-auto\">\n\t\t\t {{ route.params.product ? products.state.current.name : 'Create Product' }}\n\t\t\t</h1>\n\n\t\t\t<Button \n\t\t\t\tv-if=\"route.params.product\"\n \t:submit=\"onDelete\" \n \t:callback=\"redirectTo\"\n \tclass=\"bg-red mn-r-thin\"\n >\n \t\tDelete \n \t</Button>\n\n <Button \n \t:submit=\"onSubmit\" \n \t:callback=\"redirectTo\"\n \tclass=\"bg-main\"\n >\n \t\tSave\n \t</Button>\n </Block>\n\n <Block\n\t\t\tplaceholder=\"The product doesn't have any images yet.\"\n\t\t\tclass=\"h-min\"\n\t\t>\n\t\t\t<EditImages \n\t\t\t\t:images=\"products.state.current.images\"\n\t\t\t\t:uploadPath=\"'photos'\" \n\t\t\t\t@update:images=\"(imagesNew) => { products.state.current.images = imagesNew }\" \n\t\t\t/>\n\t\t</Block>\n\n <div class=\"cols-2 gap-thin\">\n\n \t<Block\n \t\t\ttitle=\"Profile\"\n \t\t>\n\t\t\t\t<EditProductInfo \t\t\n\t\t\t\t\t:product=\"products.state.current\"\n\t\t\t\t/>\n\t\t\t</Block>\n\n\t\t\t<Block\n\t\t title=\"Ingredients\"\n\t\t\t\tplaceholder=\"No ingridients added yet\"\n\t\t\t\t:actions=\"[{\n\t label: '+',\n\t function: () => openIngredientPopup()\n\t }]\"\n\t\t >\n\t\t \t<div v-if=\"products.state.current.ingredients.length > 0\" class=\"cols-1 gap-thin\">\n\t\t\t <CardPosition \n\t\t\t v-for=\"(product, index) in products.state.current.ingredients\" \n\t\t\t :key=\"product._id\" \n\t\t\t :product=\"product\"\n\t\t\t :array=\"products.state.current.ingredients\"\n\t\t\t :products=\"Products\"\n\t\t :showPrice=\"false\"\n\t\t\t @add=\"(item) => {\n\t\t\t\t\t globals.actions.add(products.state.current.ingredients, item);\n\t\t\t\t\t closeIngredientPopup();\n\t\t\t\t\t }\"\n\t\t\t\t\t @update=\"(item) => {\n\t\t\t\t\t globals.actions.update(products.state.current.ingredients, item, index);\n\t\t\t\t\t closeIngredientPopup();\n\t\t\t\t\t }\"\n\t\t\t\t\t @delete=\"(item) => {\n\t\t\t\t\t globals.actions.delete(products.state.current.ingredients, item, index);\n\t\t\t\t\t closeIngredientPopup();\n\t\t\t\t\t }\"\n\t\t\t />\n\t\t\t </div>\n\t\t </Block>\n\n\t\t <Popup \n\t title=\"Add ingredient\" \n\t @close-popup=\"closeIngredientPopup\" \n\t :isPopupOpen=\"isOpenIngredientPopup\"\n\t class=\"bg-white w-min-30r w-max-30r radius-big pd-medium\"\n\t >\n\t <div class=\"bg-light mn-b-thin h-min-20r h-max-20r o-scroll pd-medium radius-big\">\n\t <Feed\n\t :search=\"{\n\t \tclass: 'bg-white mn-b-thin'\n\t }\"\n\t :states=\"{\n\t empty: {\n\t title: 'No Products Found',\n\t description: 'Currently, there are no such products available.'\n\t }\n\t }\"\n\t :store=\"{\n\t read: (options) => products.actions.read(options),\n\t state: null\n\t }\"\n\t :options=\"{\n\t organization: route.params._id\n\t }\"\n\t v-slot=\"{ \n\t items \n\t }\"\n\t class=\"\"\n\t >\n\t <CardOrderItem\n\t v-for=\"(product, index) in items\" :key=\"product._id\"\n\t :editable=\"false\" \n\t :product=\"product\" \n\t @click=\"() => { \n\t let p = { ...product };\n\t p.quantity = 1;\n\t p.type = 'pcs'\n\t globals.actions.add(products.state.current.ingredients,p)\n\t closeIngredientPopup();\n\t }\"\n\t class=\"bg-white pd-thin radius-medium w-100 mn-b-thin\"\n\t />\n\t </Feed>\n\t </div>\n\t </Popup>\n\n\n\t\t</div> \n\n\t\t\t<Block\n \t\t\ttitle=\"Categories\"\n \t\t\t:actions=\"[{\n\t label: '+',\n\t function: () => router.push({\n\t\t\t\t\t\tname: 'Categories Organization', \n\t\t\t\t\t\tparams: { \n\t\t\t\t\t\t\t_id: route.params._id\n\t\t\t\t\t\t} \n\t\t\t\t\t})\n\t }]\"\n \t\t>\n\t\t\t\t<Checkbox \n\t\t\t\t\tv-for=\"(category, index) in categories.state.all\"\n :label=\"category.name\"\n name=\"categories\"\n :value=\"category.url\"\n class=\"w-100 mn-t-small bg-white radius-small pd-small\"\n :radio=\"products.state.current.category\"\n @update:radio=\"event => products.state.current.category = event\"\n />\n\t\t\t</Block>\n\n\n\t\t\t<Block\n\t\t\t\ttitle=\"Parameters\"\n\t\t\t\tplaceholder=\"No parameters added yet\"\n\t\t\t\t:actions=\"[{\n\t\t\t\t\tlabel: '+',\n\t\t\t\t\tfunction: () => products.state.current.information.push({name: '', value: ''})\n\t\t\t\t}]\"\n\t\t\t\tclass=\"cols-1 gap-thin\"\n\t\t\t>\n <div \n \tclass=\"gap-thin flex-nowrap flex\" \n \tv-for=\"(item, index) in products.state.current.information\" \n \t:key=\"index\"\n > \n <Field\n v-model:field=\"item.name\"\n placeholder=\"Название параметра\"\n class=\"w-100 bg-white radius-small pd-medium\"\n /> \n <Field\n v-model:field=\"item.value\"\n placeholder=\"Значение параметра\"\n class=\"w-100 bg-white radius-small pd-medium\"\n />\n <div class=\"radius-small h-100 i-big flex-center flex aspect-1x1 bg-red\">\n\t <IconDelete \n\t \t@click=\"() => products.state.current.information.splice(index, 1)\" \n\t \tclass=\"i-medium\"\n\t />\n\t </div>\n </div>\n\t\t\t</Block>\n\n\n\t\t\t<Block\n\t\t\t\ttitle=\"Localization\"\n\t\t\t\tplaceholder=\"No localizations added yet\"\n\t\t\t\t:actions=\"[{\n\t\t\t\t\tlabel: '+',\n\t\t\t\t\tfunction: () => products.state.current.localization.push({name: '', value: ''})\n\t\t\t\t}]\"\n\t\t\t>\n <div \n \tclass=\"gap-thin mn-b-thin flex-nowrap flex\" \n \tv-for=\"(item, index) in products.state.current.localization\" \n \t:key=\"index\"\n > \n <Field\n v-model:field=\"item.name\"\n placeholder=\"Название параметра\"\n class=\"w-100 bg-white radius-small pd-medium\"\n /> \n <Field\n v-model:field=\"item.value\"\n placeholder=\"Значение параметра\"\n class=\"w-100 bg-white radius-small pd-medium\"\n />\n <div class=\"radius-small pd-small flex-center flex aspect-1x1 bg-red\">\n\t <IconDelete \n\t \t@click=\"() => products.state.current.localization.splice(index, 1)\" \n\t \tclass=\"i-medium\"\n\t />\n </div>\n </div>\n\t\t\t</Block>\n\n\t\n\t\t\n\t\t<!-- <Block\n\t title=\"Quantity Discount\"\n\t class=\"mn-b-semi\"\n\t :actions=\"[{\n\t\t\t\tlabel: '+',\n\t\t\t\tfunction: () => products.state.current.quantityDiscount.push({name: '', value: ''})\n\t\t\t}]\"\n\t >\n\t \t<div \n \tclass=\"gap-thin mn-b-thin flex-nowrap flex\" \n \tv-for=\"(item, index) in products.state.current.quantityDiscount\" \n \t:key=\"index\"\n > \n <Field\n v-model:field=\"item.name\"\n placeholder=\"Quantity\"\n class=\"w-100 bg-white radius-small pd-medium\"\n /> \n <Field\n v-model:field=\"item.value\"\n placeholder=\"Discount\"\n class=\"w-100 bg-white radius-small pd-medium\"\n />\n <div class=\"radius-small pd-small flex-center flex aspect-1x1 bg-red\">\n <IconDelete \n \t@click=\"() => products.state.current.quantityDiscount.splice(index, 1)\" \n \tclass=\"i-medium\"\n />\n </div>\n </div>\n\t\t</Block> -->\n\n\t\t<!-- <EditModifications\n\t\t\t:product=\"products.state.current\"\n\t\t/> -->\n\n\n\n\t\t\n\n</div>\n\t\n</template>\n\n<script setup>\n\t// Import libs\n\timport { reactive, computed, onMounted, ref } from 'vue'\n\timport { useRoute, useRouter } from 'vue-router'\n\t// Import components\n\timport Breadcrumbs from '@pf/src/components/Breadcrumbs/Breadcrumbs.vue'\n\n\timport Block from '@pf/src/components/Block/Block.vue';\n\timport Tab from \"@pf/src/components/Tab/Tab.vue\";\n\timport Field from \"@pf/src/components/Field/Field.vue\";\n\timport Checkbox from \"@pf/src/components/Checkbox/Checkbox.vue\";\n\timport Button from \"@pf/src/components/Button/Button.vue\";\n\timport Popup from \"@pf/src/components/Popup/Popup.vue\";\n\timport Feed from \"@pf/src/components/Feed/Feed.vue\";\n\n\timport EditImages from '@pf/src/components/EditImages/EditImages.vue';\n\n\timport IconDelete from '@pf/src/modules/icons/navigation/IconDelete.vue';\n\n \timport CardPosition from '@pf/src/modules/products/components/blocks/CardPosition.vue';\n import CardOrderItem from '@pf/src/modules/orders/components/blocks/CardOrderItem.vue'\n\n\n\timport EditProductInfo from '@pf/src/modules/products/components/sections/EditProductInfo.vue';\n import EditModifications from '@pf/src/modules/products/components/sections/EditModifications.vue';\n \n\t// Accessing router and store\n\timport * as globals from '@pf/src/modules/globals/views/store/globals';\n \timport * as products from '@pf/src/modules/products/store/products';\n import * as categories from '@pf/src/modules/products/store/categories';\n\n\tconst route = useRoute()\n\tconst router = useRouter()\n\n const Products = ref(products.state.all);\n const isOpenIngredientPopup = ref(false);\n\n\n function openIngredientPopup(member) {\n\t isOpenIngredientPopup.value = true;\n\t // if (typeof member === \"number\") selectedMember.value = member;\n\t}\n\n\tfunction closeIngredientPopup() {\n\t isOpenIngredientPopup.value = false;\n\t // selectedMember.value = null;\n\t}\n\n onMounted(async() => { \n\t products.mutations.resetProduct();\n\n \tif (route.params.product) {\n\t\t await products.actions.read({ _id: route.params.product });\n\t } \n\n\t if (!products.state.current.ingredients) {\n\t \tproducts.state.current.ingredients = []\n\t }\n\n \t// Data prefetching\n\t \tawait categories.actions.fetchCategories()\n\n try {\n const productsResponse = await products.actions.read({\n organization: route.params._id,\n limit: 100\n });\n Products.value = productsResponse;\n } catch (error) {\n console.error('error');\n }\n })\n\n\tfunction onImagesUpdate(newImages) {\n\t products.state.current.images = newImages;\n\t}\n\t\n\tfunction onSubmit() {\n\t\tif (route.params.product) {\n\t\t\tproducts.actions.update(route.params.product, products.state.current)\n\t\t} else {\n\t\t\tproducts.actions.create(route.params._id, products.state.current)\n\t\t}\n\t}\n\n\tfunction onDelete() {\n\t\tproducts.actions.deleteProduct(products.state.current._id)\n\t}\n\n\tfunction redirectTo () {\n\t\trouter.push({\n\t\t\tname: 'Organization', \n\t\t\tparams: { \n\t\t\t\t_id: route.params._id\n\t\t\t} \n\t\t})\n\t}\n</script>\n\n<style lang=\"scss\">\n\t.main-photo {\n\t\tmax-width: 50%;\n\t\timg { width: 100%; }\n\t}\n</style>\n"],"names":["useRoute","useRouter","ref","products.state","onMounted","products.mutations","products.actions","categories.actions"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwSC,UAAM,QAAQA,UAAAA,SAAU;AACxB,UAAM,SAASC,UAAAA,UAAW;AAEzB,UAAM,WAAWC,IAAAA,IAAIC,SAAc,MAAC,GAAG;AACvC,UAAM,wBAAwBD,QAAI,KAAK;AAGvC,aAAS,oBAAoB,QAAQ;AACpC,4BAAsB,QAAQ;AAAA,IAE/B;AAED,aAAS,uBAAuB;AAC9B,4BAAsB,QAAQ;AAAA,IAE/B;AAEAE,QAAAA,UAAU,YAAW;AACpBC,eAAkB,UAAC,aAAY;AAE/B,UAAI,MAAM,OAAO,SAAS;AACzB,cAAMC,SAAAA,QAAiB,KAAK,EAAE,KAAK,MAAM,OAAO,QAAO,CAAE;AAAA,MACzD;AAED,UAAI,CAACH,SAAAA,MAAe,QAAQ,aAAa;AACxCA,uBAAe,QAAQ,cAAc,CAAE;AAAA,MACvC;AAGD,YAAMI,WAAAA,QAAmB,gBAAiB;AAEzC,UAAI;AACF,cAAM,mBAAmB,MAAMD,SAAgB,QAAC,KAAK;AAAA,UACnD,cAAc,MAAM,OAAO;AAAA,UAC3B,OAAO;AAAA,QACf,CAAO;AACD,iBAAS,QAAQ;AAAA,MAClB,SAAQ,OAAO;AACd,gBAAQ,MAAM,OAAO;AAAA,MACtB;AAAA,IACL,CAAG;AAMF,aAAS,WAAW;AACnB,UAAI,MAAM,OAAO,SAAS;AACzBA,iBAAgB,QAAC,OAAO,MAAM,OAAO,SAASH,SAAc,MAAC,OAAO;AAAA,MACvE,OAAS;AACNG,iBAAgB,QAAC,OAAO,MAAM,OAAO,KAAKH,SAAc,MAAC,OAAO;AAAA,MAChE;AAAA,IACD;AAED,aAAS,WAAW;AACnBG,eAAAA,QAAiB,cAAcH,eAAe,QAAQ,GAAG;AAAA,IACzD;AAED,aAAS,aAAc;AACtB,aAAO,KAAK;AAAA,QACX,MAAM;AAAA,QACN,QAAQ;AAAA,UACP,KAAK,MAAM,OAAO;AAAA,QAClB;AAAA,MACJ,CAAG;AAAA,IACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"ProductEdit.vue.cjs","sources":["../../../../../../../src/modules/products/components/pages/ProductEdit.vue"],"sourcesContent":["<template>\n\t<div class=\"for-transition w-100 cols-1 bg-white pd-thin gap-thin\">\n \n <Block v-if=\"!MOBILE_APP\" class=\"flex-nowrap gap-small flex-v-center flex\">\n \n <h2 class=\"t-nowrap mn-r-auto\">\n\t\t\t {{ route.params.product ? products.state.current.name : 'Create Product' }}\n\t\t\t</h2>\n\n\t\t\t<Button \n\t\t\t\tv-if=\"route.params.product\"\n \t:submit=\"onDelete\" \n \t:callback=\"redirectTo\"\n \tclass=\"bg-red mn-r-thin\"\n >\n \t\tDelete \n \t</Button>\n\n <Button \n \t:submit=\"onSubmit\" \n \t:callback=\"redirectTo\"\n \tclass=\"bg-main\"\n >\n \t\tSave\n \t</Button>\n </Block>\n\n <Block\n\t\t\tplaceholder=\"The product doesn't have any images yet.\"\n\t\t\tclass=\"h-min\"\n\t\t>\n\t\t\t<EditImages \n\t\t\t\t:images=\"products.state.current.images\"\n\t\t\t\t:uploadPath=\"'photos'\" \n\t\t\t\t@update:images=\"(imagesNew) => { products.state.current.images = imagesNew }\" \n\t\t\t/>\n\t\t</Block>\n\n <div class=\"cols-2 gap-thin\">\n\n \t<Block\n \t\t\ttitle=\"Profile\"\n \t\t>\n\t\t\t\t<EditProductInfo \t\t\n\t\t\t\t\t:product=\"products.state.current\"\n\t\t\t\t/>\n\t\t\t</Block>\n\n\t\t\t<Block\n\t\t\t\ttitle=\"Categories\"\n\t\t\t\t:actions=\"[{\n\t\t label: '+',\n\t\t function: () => router.push({\n\t\t\t\t\t\tname: 'Categories', \n\t\t\t\t\t\tparams: { \n\t\t\t\t\t\t\t_id: route.params._id\n\t\t\t\t\t\t} \n\t\t\t\t\t})\n\t\t }]\"\n\t\t\t>\n\t\t\t\t<Checkbox \n\t\t\t\t\tv-for=\"(category, index) in categories.state.all\"\n\t\t :label=\"category.name\"\n\t\t name=\"categories\"\n\t\t :value=\"category.url\"\n\t\t class=\"w-100 mn-t-small bg-white radius-small pd-small\"\n\t\t :radio=\"products.state.current.category\"\n\t\t @update:radio=\"event => products.state.current.category = event\"\n\t\t />\n\t\t\t</Block>\n\n\t\t\t<Block\n\t\t\t\ttitle=\"Parameters\"\n\t\t\t\tplaceholder=\"No parameters added yet\"\n\t\t\t\t:actions=\"[{\n\t\t\t\t\tlabel: '+',\n\t\t\t\t\tfunction: () => products.state.current.information.push({name: '', value: ''})\n\t\t\t\t}]\"\n\t\t\t\tclass=\"cols-1 gap-thin\"\n\t\t\t>\n <div \n \tclass=\"gap-thin flex-nowrap flex\" \n \tv-for=\"(item, index) in products.state.current.information\" \n \t:key=\"index\"\n > \n <Field\n v-model:field=\"item.name\"\n placeholder=\"Название параметра\"\n class=\"w-100 bg-white radius-small pd-medium\"\n /> \n <Field\n v-model:field=\"item.value\"\n placeholder=\"Значение параметра\"\n class=\"w-100 bg-white radius-small pd-medium\"\n />\n <div class=\"radius-small h-100 i-big flex-center flex aspect-1x1 bg-red\">\n\t <IconDelete \n\t \t@click=\"() => products.state.current.information.splice(index, 1)\" \n\t \tclass=\"i-medium\"\n\t />\n\t </div>\n </div>\n\t\t\t</Block>\n\n\n\t\t\t<Block\n\t\t title=\"Ingredients\"\n\t\t\t\tplaceholder=\"No ingridients added yet\"\n\t\t\t\t:actions=\"[{\n\t label: '+',\n\t function: () => openIngredientPopup()\n\t }]\"\n\t\t >\n\t\t \t<div v-if=\"products.state.current.ingredients.length > 0\" class=\"cols-1 gap-thin\">\n\t\t\t <CardPosition \n\t\t\t v-for=\"(product, index) in products.state.current.ingredients\" \n\t\t\t :key=\"product._id\" \n\t\t\t :product=\"product\"\n\t\t\t :array=\"products.state.current.ingredients\"\n\t\t\t :products=\"Products\"\n\t\t :showPrice=\"false\"\n\t\t\t @add=\"(item) => {\n\t\t\t\t\t globals.actions.add(products.state.current.ingredients, item);\n\t\t\t\t\t closeIngredientPopup();\n\t\t\t\t\t }\"\n\t\t\t\t\t @update=\"(item) => {\n\t\t\t\t\t globals.actions.update(products.state.current.ingredients, item, index);\n\t\t\t\t\t closeIngredientPopup();\n\t\t\t\t\t }\"\n\t\t\t\t\t @delete=\"(item) => {\n\t\t\t\t\t globals.actions.delete(products.state.current.ingredients, item, index);\n\t\t\t\t\t closeIngredientPopup();\n\t\t\t\t\t }\"\n\t\t\t />\n\t\t\t </div>\n\t\t </Block>\n\n\t\t <Popup \n\t title=\"Add ingredient\" \n\t @close-popup=\"closeIngredientPopup\" \n\t :isPopupOpen=\"isOpenIngredientPopup\"\n\t class=\"bg-white w-min-30r w-max-30r radius-big pd-medium\"\n\t >\n\t <div class=\"bg-light mn-b-thin h-min-20r h-max-20r o-scroll pd-medium radius-big\">\n\t <Feed\n\t :search=\"{\n\t \tclass: 'bg-white mn-b-thin'\n\t }\"\n\t :states=\"{\n\t empty: {\n\t title: 'No Products Found',\n\t description: 'Currently, there are no such products available.'\n\t }\n\t }\"\n\t :store=\"{\n\t read: (options) => products.actions.read(options),\n\t state: null\n\t }\"\n\t :options=\"{\n\t organization: route.params._id\n\t }\"\n\t v-slot=\"{ \n\t items \n\t }\"\n\t class=\"\"\n\t >\n\t <CardOrderItem\n\t v-for=\"(product, index) in items\" :key=\"product._id\"\n\t :editable=\"false\" \n\t :product=\"product\" \n\t @click=\"() => { \n\t let p = { ...product };\n\t p.quantity = 1;\n\t p.type = 'pcs'\n\t globals.actions.add(products.state.current.ingredients,p)\n\t closeIngredientPopup();\n\t }\"\n\t class=\"bg-white pd-thin radius-medium w-100 mn-b-thin\"\n\t />\n\t </Feed>\n\t </div>\n\t </Popup>\n\n\n\t\t</div> \n\n\t\t\t<Block\n\t\t\t\ttitle=\"Localization\"\n\t\t\t\tplaceholder=\"No localizations added yet\"\n\t\t\t\t:actions=\"[{\n\t\t\t\t\tlabel: '+',\n\t\t\t\t\tfunction: () => products.state.current.localization.push({name: '', value: ''})\n\t\t\t\t}]\"\n\t\t\t>\n <div \n \tclass=\"gap-thin mn-b-thin flex-nowrap flex\" \n \tv-for=\"(item, index) in products.state.current.localization\" \n \t:key=\"index\"\n > \n <Field\n v-model:field=\"item.name\"\n placeholder=\"Название параметра\"\n class=\"w-100 bg-white radius-small pd-medium\"\n /> \n <Field\n v-model:field=\"item.value\"\n placeholder=\"Значение параметра\"\n class=\"w-100 bg-white radius-small pd-medium\"\n />\n <div class=\"radius-small pd-small flex-center flex aspect-1x1 bg-red\">\n\t <IconDelete \n\t \t@click=\"() => products.state.current.localization.splice(index, 1)\" \n\t \tclass=\"i-medium\"\n\t />\n </div>\n </div>\n\t\t\t</Block>\n\n\t\t\t<Button \n\t\t\t\tv-if=\"route.params.product\"\n \t:submit=\"onDelete\" \n \t:callback=\"redirectTo\"\n \tclass=\"bg-red w-100 mn-b-thin\"\n >\n \t\tDelete \n \t</Button>\n\n <Button \n \t:submit=\"onSubmit\" \n \t:callback=\"redirectTo\"\n \tclass=\"w-100 bg-main\"\n >\n \t\tSave\n \t</Button>\n\n\t\n\t\t\n\t\t<!-- <Block\n\t title=\"Quantity Discount\"\n\t class=\"mn-b-semi\"\n\t :actions=\"[{\n\t\t\t\tlabel: '+',\n\t\t\t\tfunction: () => products.state.current.quantityDiscount.push({name: '', value: ''})\n\t\t\t}]\"\n\t >\n\t \t<div \n \tclass=\"gap-thin mn-b-thin flex-nowrap flex\" \n \tv-for=\"(item, index) in products.state.current.quantityDiscount\" \n \t:key=\"index\"\n > \n <Field\n v-model:field=\"item.name\"\n placeholder=\"Quantity\"\n class=\"w-100 bg-white radius-small pd-medium\"\n /> \n <Field\n v-model:field=\"item.value\"\n placeholder=\"Discount\"\n class=\"w-100 bg-white radius-small pd-medium\"\n />\n <div class=\"radius-small pd-small flex-center flex aspect-1x1 bg-red\">\n <IconDelete \n \t@click=\"() => products.state.current.quantityDiscount.splice(index, 1)\" \n \tclass=\"i-medium\"\n />\n </div>\n </div>\n\t\t</Block> -->\n\n\t\t<!-- <EditModifications\n\t\t\t:product=\"products.state.current\"\n\t\t/> -->\n\n\n\n\t\t\n\n</div>\n\t\n</template>\n\n<script setup>\n\t// Import libs\n\timport { reactive, computed, onMounted, ref } from 'vue'\n\timport { useRoute, useRouter } from 'vue-router'\n\t// Import components\n\timport Breadcrumbs from '@pf/src/components/Breadcrumbs/Breadcrumbs.vue'\n\n\timport Block from '@pf/src/components/Block/Block.vue';\n\timport Tab from \"@pf/src/components/Tab/Tab.vue\";\n\timport Field from \"@pf/src/components/Field/Field.vue\";\n\timport Checkbox from \"@pf/src/components/Checkbox/Checkbox.vue\";\n\timport Button from \"@pf/src/components/Button/Button.vue\";\n\timport Popup from \"@pf/src/components/Popup/Popup.vue\";\n\timport Feed from \"@pf/src/components/Feed/Feed.vue\";\n\n\timport EditImages from '@pf/src/components/EditImages/EditImages.vue';\n\n\timport IconDelete from '@pf/src/modules/icons/navigation/IconDelete.vue';\n\n \timport CardPosition from '@pf/src/modules/products/components/blocks/CardPosition.vue';\n import CardOrderItem from '@pf/src/modules/orders/components/blocks/CardOrderItem.vue'\n\n\n\timport EditProductInfo from '@pf/src/modules/products/components/sections/EditProductInfo.vue';\n import EditModifications from '@pf/src/modules/products/components/sections/EditModifications.vue';\n \n\t// Accessing router and store\n\timport * as globals from '@pf/src/modules/globals/views/store/globals';\n\timport * as auth from '@pf/src/modules/auth/views/store/auth';\n \timport * as products from '@pf/src/modules/products/store/products';\n import * as categories from '@pf/src/modules/products/store/categories';\n\n\timport { setError } from '@pf/src/modules/globals/views/store/globals'\n\t\n\tconst route = useRoute()\n\tconst router = useRouter()\n\n const Products = ref(products.state.all);\n const isOpenIngredientPopup = ref(false);\n\n\n function openIngredientPopup(member) {\n\t isOpenIngredientPopup.value = true;\n\t // if (typeof member === \"number\") selectedMember.value = member;\n\t}\n\n\tfunction closeIngredientPopup() {\n\t isOpenIngredientPopup.value = false;\n\t // selectedMember.value = null;\n\t}\n\n onMounted(async() => { \n\t products.mutations.resetProduct();\n\n \tif (route.params.product) {\n\t\t await products.actions.read({ _id: route.params.product });\n\t } \n\n\t if (!products.state.current.ingredients) {\n\t \tproducts.state.current.ingredients = []\n\t }\n\n \t// Data prefetching\n\t \tawait categories.actions.fetchCategories()\n\n try {\n const productsResponse = await products.actions.read({\n organization: route.params._id,\n limit: 100\n });\n Products.value = productsResponse;\n } catch (error) {\n console.error('error');\n }\n })\n\n\tfunction onImagesUpdate(newImages) {\n\t products.state.current.images = newImages;\n\t}\n\t\n\tasync function onSubmit() {\n\t try {\n\t if (route.params.product) {\n\t await products.actions.update(route.params.product, products.state.current)\n\t } else {\n\t products.state.current.owner = {\n\t target: route.params._id || auth.state.user._id,\n\t type: route.params._id ? 'organization' : 'user'\n\t }\n\t \n\t products.state.current.creator = {\n\t target: auth.state.user._id,\n\t type: 'user',\n\t hidden: false\n\t }\n\t await products.actions.create(products.state.current)\n\t }\n\t } catch (error) {\n\t \tsetError({ response: { data: { errorCode: \"PRODUCT_NOT_CREATED\" }} })\n\t console.error('Product creation error:', error)\n\t // Здесь можно добавить обработку ошибки, например:\n\t // - показать уведомление пользователю\n\t // - отправить ошибку в систему мониторинга\n\t // - выполнить откат изменений при необходимости\n\t }\n\t}\n\n\tfunction onDelete() {\n\t\tproducts.actions.deleteProduct(products.state.current._id)\n\t}\n\n\tfunction redirectTo () {\n\t\trouter.push({\n\t\t\tname: 'Organization', \n\t\t\tparams: { \n\t\t\t\t_id: route.params._id\n\t\t\t} \n\t\t})\n\t}\n</script>\n\n<style lang=\"scss\">\n\t.main-photo {\n\t\tmax-width: 50%;\n\t\timg { width: 100%; }\n\t}\n</style>\n"],"names":["useRoute","useRouter","ref","products.state","onMounted","products.mutations","products.actions","categories.actions","auth.state","setError"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2TC,UAAM,QAAQA,UAAAA,SAAU;AACxB,UAAM,SAASC,UAAAA,UAAW;AAEzB,UAAM,WAAWC,IAAAA,IAAIC,SAAc,MAAC,GAAG;AACvC,UAAM,wBAAwBD,QAAI,KAAK;AAGvC,aAAS,oBAAoB,QAAQ;AACpC,4BAAsB,QAAQ;AAAA,IAE/B;AAED,aAAS,uBAAuB;AAC9B,4BAAsB,QAAQ;AAAA,IAE/B;AAEAE,QAAAA,UAAU,YAAW;AACpBC,eAAkB,UAAC,aAAY;AAE/B,UAAI,MAAM,OAAO,SAAS;AACzB,cAAMC,SAAAA,QAAiB,KAAK,EAAE,KAAK,MAAM,OAAO,QAAO,CAAE;AAAA,MACzD;AAED,UAAI,CAACH,SAAAA,MAAe,QAAQ,aAAa;AACxCA,uBAAe,QAAQ,cAAc,CAAE;AAAA,MACvC;AAGD,YAAMI,WAAAA,QAAmB,gBAAiB;AAEzC,UAAI;AACF,cAAM,mBAAmB,MAAMD,SAAgB,QAAC,KAAK;AAAA,UACnD,cAAc,MAAM,OAAO;AAAA,UAC3B,OAAO;AAAA,QACf,CAAO;AACD,iBAAS,QAAQ;AAAA,MAClB,SAAQ,OAAO;AACd,gBAAQ,MAAM,OAAO;AAAA,MACtB;AAAA,IACL,CAAG;AAMF,mBAAe,WAAW;AACxB,UAAI;AACF,YAAI,MAAM,OAAO,SAAS;AACxB,gBAAMA,SAAAA,QAAiB,OAAO,MAAM,OAAO,SAASH,SAAc,MAAC,OAAO;AAAA,QACjF,OAAY;AACLA,mBAAc,MAAC,QAAQ,QAAQ;AAAA,YAC7B,QAAQ,MAAM,OAAO,OAAOK,KAAU,MAAC,KAAK;AAAA,YAC5C,MAAM,MAAM,OAAO,MAAM,iBAAiB;AAAA,UAC3C;AAEDL,mBAAc,MAAC,QAAQ,UAAU;AAAA,YAC/B,QAAQK,KAAAA,MAAW,KAAK;AAAA,YACxB,MAAM;AAAA,YACN,QAAQ;AAAA,UACT;AACD,gBAAMF,iBAAiB,OAAOH,SAAc,MAAC,OAAO;AAAA,QACrD;AAAA,MACF,SAAQ,OAAO;AACfM,gBAAQ,SAAC,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,sBAAuB,EAAA,GAAG;AACnE,gBAAQ,MAAM,2BAA2B,KAAK;AAAA,MAK/C;AAAA,IACF;AAED,aAAS,WAAW;AACnBH,eAAAA,QAAiB,cAAcH,eAAe,QAAQ,GAAG;AAAA,IACzD;AAED,aAAS,aAAc;AACtB,aAAO,KAAK;AAAA,QACX,MAAM;AAAA,QACN,QAAQ;AAAA,UACP,KAAK,MAAM,OAAO;AAAA,QAClB;AAAA,MACJ,CAAG;AAAA,IACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,32 +1,33 @@
1
- import { ref, onMounted, openBlock, createElementBlock, createVNode, withCtx, createElementVNode, toDisplayString, unref, createBlock, createTextVNode, createCommentVNode, Fragment, renderList } from "vue";
1
+ import { ref, onMounted, openBlock, createElementBlock, createBlock, withCtx, createElementVNode, toDisplayString, unref, createTextVNode, createCommentVNode, createVNode, Fragment, renderList } from "vue";
2
2
  import { useRoute, useRouter } from "vue-router";
3
3
  import "vue-i18n";
4
4
  /* empty css */
5
5
  import _sfc_main$1 from "../../../../components/Block/Block.vue.js";
6
6
  /* empty css */
7
7
  import Field from "../../../../components/Field/Field.vue2.js";
8
- import _sfc_main$9 from "../../../../components/Checkbox/Checkbox.vue.js";
8
+ import _sfc_main$5 from "../../../../components/Checkbox/Checkbox.vue.js";
9
9
  import _sfc_main$2 from "../../../../components/Button/Button.vue2.js";
10
- import _sfc_main$6 from "../../../../components/Popup/Popup.vue.js";
11
- import _sfc_main$7 from "../../../../components/Feed/Feed.vue.js";
10
+ import _sfc_main$8 from "../../../../components/Popup/Popup.vue.js";
11
+ import _sfc_main$9 from "../../../../components/Feed/Feed.vue.js";
12
12
  import _sfc_main$3 from "../../../../components/EditImages/EditImages.vue2.js";
13
- import _sfc_main$a from "../../../icons/navigation/IconDelete.vue.js";
14
- import _sfc_main$5 from "../blocks/CardPosition.vue.js";
15
- import _sfc_main$8 from "../../../orders/components/blocks/CardOrderItem.vue.js";
13
+ import _sfc_main$6 from "../../../icons/navigation/IconDelete.vue.js";
14
+ import _sfc_main$7 from "../blocks/CardPosition.vue.js";
15
+ import _sfc_main$a from "../../../orders/components/blocks/CardOrderItem.vue.js";
16
16
  import _sfc_main$4 from "../sections/EditProductInfo.vue.js";
17
- import { actions as actions$2 } from "../../../globals/views/store/globals.js";
17
+ import { actions as actions$2, setError } from "../../../globals/views/store/globals.js";
18
+ import { state as state$2 } from "../../../auth/views/store/auth.js";
18
19
  import { state, mutations, actions } from "../../store/products.js";
19
20
  import { actions as actions$1, state as state$1 } from "../../store/categories.js";
20
21
  /* empty css */
21
- const _hoisted_1 = { class: "for-transition w-100 cols-1 pd-thin gap-thin" };
22
- const _hoisted_2 = { class: "mn-r-auto" };
22
+ const _hoisted_1 = { class: "for-transition w-100 cols-1 bg-white pd-thin gap-thin" };
23
+ const _hoisted_2 = { class: "t-nowrap mn-r-auto" };
23
24
  const _hoisted_3 = { class: "cols-2 gap-thin" };
24
- const _hoisted_4 = {
25
+ const _hoisted_4 = { class: "radius-small h-100 i-big flex-center flex aspect-1x1 bg-red" };
26
+ const _hoisted_5 = {
25
27
  key: 0,
26
28
  class: "cols-1 gap-thin"
27
29
  };
28
- const _hoisted_5 = { class: "bg-light mn-b-thin h-min-20r h-max-20r o-scroll pd-medium radius-big" };
29
- const _hoisted_6 = { class: "radius-small h-100 i-big flex-center flex aspect-1x1 bg-red" };
30
+ const _hoisted_6 = { class: "bg-light mn-b-thin h-min-20r h-max-20r o-scroll pd-medium radius-big" };
30
31
  const _hoisted_7 = { class: "radius-small pd-small flex-center flex aspect-1x1 bg-red" };
31
32
  const _sfc_main = {
32
33
  __name: "ProductEdit",
@@ -60,11 +61,25 @@ const _sfc_main = {
60
61
  console.error("error");
61
62
  }
62
63
  });
63
- function onSubmit() {
64
- if (route.params.product) {
65
- actions.update(route.params.product, state.current);
66
- } else {
67
- actions.create(route.params._id, state.current);
64
+ async function onSubmit() {
65
+ try {
66
+ if (route.params.product) {
67
+ await actions.update(route.params.product, state.current);
68
+ } else {
69
+ state.current.owner = {
70
+ target: route.params._id || state$2.user._id,
71
+ type: route.params._id ? "organization" : "user"
72
+ };
73
+ state.current.creator = {
74
+ target: state$2.user._id,
75
+ type: "user",
76
+ hidden: false
77
+ };
78
+ await actions.create(state.current);
79
+ }
80
+ } catch (error) {
81
+ setError({ response: { data: { errorCode: "PRODUCT_NOT_CREATED" } } });
82
+ console.error("Product creation error:", error);
68
83
  }
69
84
  }
70
85
  function onDelete() {
@@ -80,9 +95,12 @@ const _sfc_main = {
80
95
  }
81
96
  return (_ctx, _cache) => {
82
97
  return openBlock(), createElementBlock("div", _hoisted_1, [
83
- createVNode(_sfc_main$1, { class: "flex-nowrap flex-v-center flex" }, {
98
+ !_ctx.MOBILE_APP ? (openBlock(), createBlock(_sfc_main$1, {
99
+ key: 0,
100
+ class: "flex-nowrap gap-small flex-v-center flex"
101
+ }, {
84
102
  default: withCtx(() => [
85
- createElementVNode("h1", _hoisted_2, toDisplayString(unref(route).params.product ? state.current.name : "Create Product"), 1),
103
+ createElementVNode("h2", _hoisted_2, toDisplayString(unref(route).params.product ? state.current.name : "Create Product"), 1),
86
104
  unref(route).params.product ? (openBlock(), createBlock(_sfc_main$2, {
87
105
  key: 0,
88
106
  submit: onDelete,
@@ -106,7 +124,7 @@ const _sfc_main = {
106
124
  })
107
125
  ]),
108
126
  _: 1
109
- }),
127
+ })) : createCommentVNode("", true),
110
128
  createVNode(_sfc_main$1, {
111
129
  placeholder: "The product doesn't have any images yet.",
112
130
  class: "h-min"
@@ -131,6 +149,70 @@ const _sfc_main = {
131
149
  ]),
132
150
  _: 1
133
151
  }),
152
+ createVNode(_sfc_main$1, {
153
+ title: "Categories",
154
+ actions: [{
155
+ label: "+",
156
+ function: () => unref(router).push({
157
+ name: "Categories",
158
+ params: {
159
+ _id: unref(route).params._id
160
+ }
161
+ })
162
+ }]
163
+ }, {
164
+ default: withCtx(() => [
165
+ (openBlock(true), createElementBlock(Fragment, null, renderList(state$1.all, (category, index) => {
166
+ return openBlock(), createBlock(_sfc_main$5, {
167
+ label: category.name,
168
+ name: "categories",
169
+ value: category.url,
170
+ class: "w-100 mn-t-small bg-white radius-small pd-small",
171
+ radio: state.current.category,
172
+ "onUpdate:radio": (event) => state.current.category = event
173
+ }, null, 8, ["label", "value", "radio", "onUpdate:radio"]);
174
+ }), 256))
175
+ ]),
176
+ _: 1
177
+ }, 8, ["actions"]),
178
+ createVNode(_sfc_main$1, {
179
+ title: "Parameters",
180
+ placeholder: "No parameters added yet",
181
+ actions: [{
182
+ label: "+",
183
+ function: () => state.current.information.push({ name: "", value: "" })
184
+ }],
185
+ class: "cols-1 gap-thin"
186
+ }, {
187
+ default: withCtx(() => [
188
+ (openBlock(true), createElementBlock(Fragment, null, renderList(state.current.information, (item, index) => {
189
+ return openBlock(), createElementBlock("div", {
190
+ class: "gap-thin flex-nowrap flex",
191
+ key: index
192
+ }, [
193
+ createVNode(Field, {
194
+ field: item.name,
195
+ "onUpdate:field": ($event) => item.name = $event,
196
+ placeholder: "Название параметра",
197
+ class: "w-100 bg-white radius-small pd-medium"
198
+ }, null, 8, ["field", "onUpdate:field"]),
199
+ createVNode(Field, {
200
+ field: item.value,
201
+ "onUpdate:field": ($event) => item.value = $event,
202
+ placeholder: "Значение параметра",
203
+ class: "w-100 bg-white radius-small pd-medium"
204
+ }, null, 8, ["field", "onUpdate:field"]),
205
+ createElementVNode("div", _hoisted_4, [
206
+ createVNode(_sfc_main$6, {
207
+ onClick: () => state.current.information.splice(index, 1),
208
+ class: "i-medium"
209
+ }, null, 8, ["onClick"])
210
+ ])
211
+ ]);
212
+ }), 128))
213
+ ]),
214
+ _: 1
215
+ }, 8, ["actions"]),
134
216
  createVNode(_sfc_main$1, {
135
217
  title: "Ingredients",
136
218
  placeholder: "No ingridients added yet",
@@ -140,9 +222,9 @@ const _sfc_main = {
140
222
  }]
141
223
  }, {
142
224
  default: withCtx(() => [
143
- state.current.ingredients.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_4, [
225
+ state.current.ingredients.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_5, [
144
226
  (openBlock(true), createElementBlock(Fragment, null, renderList(state.current.ingredients, (product, index) => {
145
- return openBlock(), createBlock(_sfc_main$5, {
227
+ return openBlock(), createBlock(_sfc_main$7, {
146
228
  key: product._id,
147
229
  product,
148
230
  array: state.current.ingredients,
@@ -166,15 +248,15 @@ const _sfc_main = {
166
248
  ]),
167
249
  _: 1
168
250
  }, 8, ["actions"]),
169
- createVNode(_sfc_main$6, {
251
+ createVNode(_sfc_main$8, {
170
252
  title: "Add ingredient",
171
253
  onClosePopup: closeIngredientPopup,
172
254
  isPopupOpen: isOpenIngredientPopup.value,
173
255
  class: "bg-white w-min-30r w-max-30r radius-big pd-medium"
174
256
  }, {
175
257
  default: withCtx(() => [
176
- createElementVNode("div", _hoisted_5, [
177
- createVNode(_sfc_main$7, {
258
+ createElementVNode("div", _hoisted_6, [
259
+ createVNode(_sfc_main$9, {
178
260
  search: {
179
261
  class: "bg-white mn-b-thin"
180
262
  },
@@ -197,7 +279,7 @@ const _sfc_main = {
197
279
  items
198
280
  }) => [
199
281
  (openBlock(true), createElementBlock(Fragment, null, renderList(items, (product, index) => {
200
- return openBlock(), createBlock(_sfc_main$8, {
282
+ return openBlock(), createBlock(_sfc_main$a, {
201
283
  key: product._id,
202
284
  editable: false,
203
285
  product,
@@ -219,70 +301,6 @@ const _sfc_main = {
219
301
  _: 1
220
302
  }, 8, ["isPopupOpen"])
221
303
  ]),
222
- createVNode(_sfc_main$1, {
223
- title: "Categories",
224
- actions: [{
225
- label: "+",
226
- function: () => unref(router).push({
227
- name: "Categories Organization",
228
- params: {
229
- _id: unref(route).params._id
230
- }
231
- })
232
- }]
233
- }, {
234
- default: withCtx(() => [
235
- (openBlock(true), createElementBlock(Fragment, null, renderList(state$1.all, (category, index) => {
236
- return openBlock(), createBlock(_sfc_main$9, {
237
- label: category.name,
238
- name: "categories",
239
- value: category.url,
240
- class: "w-100 mn-t-small bg-white radius-small pd-small",
241
- radio: state.current.category,
242
- "onUpdate:radio": (event) => state.current.category = event
243
- }, null, 8, ["label", "value", "radio", "onUpdate:radio"]);
244
- }), 256))
245
- ]),
246
- _: 1
247
- }, 8, ["actions"]),
248
- createVNode(_sfc_main$1, {
249
- title: "Parameters",
250
- placeholder: "No parameters added yet",
251
- actions: [{
252
- label: "+",
253
- function: () => state.current.information.push({ name: "", value: "" })
254
- }],
255
- class: "cols-1 gap-thin"
256
- }, {
257
- default: withCtx(() => [
258
- (openBlock(true), createElementBlock(Fragment, null, renderList(state.current.information, (item, index) => {
259
- return openBlock(), createElementBlock("div", {
260
- class: "gap-thin flex-nowrap flex",
261
- key: index
262
- }, [
263
- createVNode(Field, {
264
- field: item.name,
265
- "onUpdate:field": ($event) => item.name = $event,
266
- placeholder: "Название параметра",
267
- class: "w-100 bg-white radius-small pd-medium"
268
- }, null, 8, ["field", "onUpdate:field"]),
269
- createVNode(Field, {
270
- field: item.value,
271
- "onUpdate:field": ($event) => item.value = $event,
272
- placeholder: "Значение параметра",
273
- class: "w-100 bg-white radius-small pd-medium"
274
- }, null, 8, ["field", "onUpdate:field"]),
275
- createElementVNode("div", _hoisted_6, [
276
- createVNode(_sfc_main$a, {
277
- onClick: () => state.current.information.splice(index, 1),
278
- class: "i-medium"
279
- }, null, 8, ["onClick"])
280
- ])
281
- ]);
282
- }), 128))
283
- ]),
284
- _: 1
285
- }, 8, ["actions"]),
286
304
  createVNode(_sfc_main$1, {
287
305
  title: "Localization",
288
306
  placeholder: "No localizations added yet",
@@ -310,7 +328,7 @@ const _sfc_main = {
310
328
  class: "w-100 bg-white radius-small pd-medium"
311
329
  }, null, 8, ["field", "onUpdate:field"]),
312
330
  createElementVNode("div", _hoisted_7, [
313
- createVNode(_sfc_main$a, {
331
+ createVNode(_sfc_main$6, {
314
332
  onClick: () => state.current.localization.splice(index, 1),
315
333
  class: "i-medium"
316
334
  }, null, 8, ["onClick"])
@@ -319,7 +337,28 @@ const _sfc_main = {
319
337
  }), 128))
320
338
  ]),
321
339
  _: 1
322
- }, 8, ["actions"])
340
+ }, 8, ["actions"]),
341
+ unref(route).params.product ? (openBlock(), createBlock(_sfc_main$2, {
342
+ key: 1,
343
+ submit: onDelete,
344
+ callback: redirectTo,
345
+ class: "bg-red w-100 mn-b-thin"
346
+ }, {
347
+ default: withCtx(() => _cache[4] || (_cache[4] = [
348
+ createTextVNode(" Delete ")
349
+ ])),
350
+ _: 1
351
+ })) : createCommentVNode("", true),
352
+ createVNode(_sfc_main$2, {
353
+ submit: onSubmit,
354
+ callback: redirectTo,
355
+ class: "w-100 bg-main"
356
+ }, {
357
+ default: withCtx(() => _cache[5] || (_cache[5] = [
358
+ createTextVNode(" Save ")
359
+ ])),
360
+ _: 1
361
+ })
323
362
  ]);
324
363
  };
325
364
  }