@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
@@ -1 +1 @@
1
- {"version":3,"file":"Categories.vue.js","sources":["../../../../../../../src/modules/products/components/pages/Categories.vue"],"sourcesContent":["<template>\n <div class=\"pd-thin\">\n <Block class=\"radius-big mn-b-thin flex-nowrap flex-v-center flex\">\n <h1 class=\"mn-r-auto\">\n Product Categories\n </h1>\n\n <router-link \n :to=\"{\n name: 'CategoryAdd', \n params: { \n _id: $route.params._id\n } \n }\"\n class=\"mn-r-medium uppercase t-medium pd-small radius-big bg-white nav-link\"\n >\n Add category\n </router-link>\n\n <Button \n @click=\"updateCategoriesOrder\" \n class=\"pd-small radius-big bg-black t-white uppercase t-medium\"\n >\n Change Order\n </Button>\n </Block>\n\n <VueDraggableNext \n class=\"dragArea list-group w-full\" \n :list=\"categories.state.all\" \n item-key=\"order\" \n @end=\"updateOrder\"\n >\n <CardCategory \n v-for=\"(category, index) in categories.state.all\"\n :key=\"category.id\"\n :category=\"category\" \n @delete=\"deleteCategory\"\n class=\"pd-medium bg-light radius-medium mn-b-thin\"\n />\n </VueDraggableNext>\n </div>\n</template>\n\n<script setup>\n import { onMounted } from 'vue';\n import { VueDraggableNext } from 'vue-draggable-next';\n\n import { useRoute, useRouter } from 'vue-router';\n\n import * as categories from '@pf/src/modules/products/store/categories'; \n\n const route = useRoute();\n const router = useRouter();\n\n import Button from \"@pf/src/components/Button/Button.vue\";\n import Block from '@pf/src/components/Block/Block.vue';\n import CardCategory from '@pf/src/modules/products/components/blocks/CardCategory.vue';\n\n onMounted(async () => {\n await categories.actions.fetchCategories();\n });\n\n function updateOrder() {\n categories.state.all.forEach((category, index) => {\n category.order = index;\n });\n updateCategoriesOrder();\n }\n\n async function updateCategoriesOrder() {\n await categories.actions.updateCategories(categories.state.all);\n }\n\n async function deleteCategory(category) {\n // Запрашиваем подтверждение у пользователя\n const isConfirmed = confirm(`Are you sure you want to delete the category \"${category.name}\"?`);\n \n // Если пользователь подтвердил удаление, продолжаем процесс\n if (isConfirmed) {\n await categories.actions.deleteCategory(category.url);\n } else {\n alert('Category deletion cancelled'); \n }\n }\n\n</script>\n\n<style lang=\"scss\">\n</style>\n"],"names":["categories.actions","categories.state"],"mappings":";;;;;;;;;;;AAoDgB,aAAW;AACV,cAAY;AAM3B,cAAU,YAAY;AACpB,YAAMA,QAAmB;IAC7B,CAAG;AAED,aAAS,cAAc;AACrBC,YAAiB,IAAI,QAAQ,CAAC,UAAU,UAAU;AAChD,iBAAS,QAAQ;AAAA,MACvB,CAAK;AACD;IACD;AAED,mBAAe,wBAAwB;AACrC,YAAMD,QAAmB,iBAAiBC,MAAiB,GAAG;AAAA,IAC/D;AAED,mBAAe,eAAe,UAAU;AAEtC,YAAM,cAAc,QAAQ,iDAAiD,SAAS,IAAI,IAAI;AAG9F,UAAI,aAAa;AACf,cAAMD,QAAmB,eAAe,SAAS,GAAG;AAAA,MAC1D,OAAW;AACL,cAAM,6BAA6B;AAAA,MACpC;AAAA,IACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Categories.vue.js","sources":["../../../../../../../src/modules/products/components/pages/Categories.vue"],"sourcesContent":["<template>\n <div class=\"pd-thin bg-white\">\n <Block v-if=\"!MOBILE_APP\" \n class=\"radius-big mn-b-thin flex-nowrap flex-v-center flex\"\n >\n <h2 class=\"mn-r-auto\">\n Product Categories\n </h2>\n\n <router-link \n :to=\"{\n name: 'Category Add', \n params: { \n _id: $route.params._id\n } \n }\"\n class=\"mn-r-medium uppercase t-medium pd-small radius-big bg-white nav-link\"\n >\n Add category\n </router-link>\n\n <Button \n @click=\"updateCategoriesOrder\" \n class=\"pd-small radius-big bg-black t-white uppercase t-medium\"\n >\n Change Order\n </Button>\n </Block>\n <!-- <Feed\n :states=\"{\n empty: {\n title: 'No Events Found',\n description: 'Currently, there are no events available.'\n }\n }\"\n :store=\"{\n read: (options) => categories.actions.read(options),\n state: categories.state\n }\"\n :options=\"{\n user: auth.state.user._id,\n rootOnly: true,\n limit: 10\n }\"\n v-slot=\"{ \n items \n }\"\n > -->\n <CategoryList \n v-if=\"categories.state.all\" \n :items=\"categories.state.all\" \n :state=\"categories.state.all\" \n @update=\"updateCategoriesOrder\" \n />\n\n <!-- <VueDraggableNext \n class=\"dragArea list-group w-full\" \n :list=\"items\" \n item-key=\"order\" \n @end=\"updateOrder\"\n >\n <CardCategory \n v-for=\"(category,index) in items\"\n :key=\"category.id\"\n :category=\"category\" \n @delete=\"deleteCategory\"\n class=\"pd-medium bg-light radius-medium mn-b-thin\"\n />\n </VueDraggableNext> -->\n <!-- </Feed> -->\n </div>\n</template>\n\n<script setup>\n import { onMounted, onUnmounted, computed } from 'vue';\n import { VueDraggableNext } from 'vue-draggable-next';\n\n import { useRoute, useRouter } from 'vue-router';\n\n import * as globals from '@pf/src/modules/globals/views/store/globals';\n import * as auth from '@pf/src/modules/auth/views/store/auth'; \n import * as categories from '@pf/src/modules/products/store/categories'; \n\n const route = useRoute();\n const router = useRouter();\n\n import Button from \"@pf/src/components/Button/Button.vue\";\n import Block from '@pf/src/components/Block/Block.vue';\n import Feed from '@pf/src/components/Feed/Feed.vue'\n\n import CardCategory from '@pf/src/modules/products/components/blocks/CardCategory.vue';\n import CategoryList from '@pf/src/modules/products/components/sections/CategoriesTree.vue';\n\n import IconPlus from '@pf/src/modules/icons/navigation/IconPlus.vue'\n\n globals.state.navigation_bar.actions = [{\n component: IconPlus,\n props: {\n fill: \"rgb(var(--main))\" \n },\n condition: () => auth.state.user && auth.state.user._id,\n action: () => route.params._id ? router.push({ name: 'Category Add', params: { _id: route.params._id} }) : router.push({ name: 'Category Add' })\n }],\n\n onUnmounted(() => {\n globals.state.navigation_bar.actions = [];\n });\n\ncategories.state.all = await categories.actions.read({\n user: auth.state.user._id,\n rootOnly: true,\n limit: 10\n })\n onMounted(async () => {\n \n });\n\n const mappedCategories = computed(() => {\n const recursiveMap = (data) => {\n return data.map(item => ({\n // id: item._id, \n parent: item.parent,\n _id: item._id,\n order: item.order,\n name: item.name, \n children: item.children ? recursiveMap(item.children) : []\n }));\n };\n \n return recursiveMap(categories.state.all);\n });\n\n function flattenCategoryTree(categories) {\n let flatCategories = [];\n \n function flatten(category) {\n const { children, ...categoryWithoutChildren } = category;\n flatCategories.push(categoryWithoutChildren);\n \n if (children && Array.isArray(children)) {\n children.forEach(child => flatten(child));\n }\n }\n \n categories.forEach(category => flatten(category));\n return flatCategories;\n }\n\n // Обновленная функция для обновления порядка категорий\n async function updateCategoriesOrder(category) {\n try {\n // Получаем все категории и преобразуем их в плоский массив\n const allCategories = categories.state.all;\n const flattenedCategories = flattenCategoryTree(allCategories);\n \n // Обновляем порядок для всех категорий\n console.log('flated', flattenedCategories)\n await categories.actions.update(flattenedCategories);\n \n console.log('Categories order updated successfully');\n } catch (error) {\n console.error('Error updating categories order:', error);\n throw error;\n }\n }\n\n async function deleteCategory(category) {\n // Запрашиваем подтверждение у пользователя\n const isConfirmed = confirm(`Are you sure you want to delete the category \"${category.name}\"?`);\n \n // Если пользователь подтвердил удаление, продолжаем процесс\n if (isConfirmed) {\n await categories.actions.deleteCategory(category.url);\n } else {\n alert('Category deletion cancelled'); \n }\n }\n\n</script>\n\n<style lang=\"scss\">\n</style>\n"],"names":["globals.state","IconPlus","auth.state","categories.state","_withAsyncContext","categories.actions"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmFE,UAAM,QAAQ;AACd,UAAM,SAAS;AAWfA,UAAc,eAAe,UAAU,CAAC;AAAA,MACtC,WAAWC;AAAAA,MACX,OAAO;AAAA,QACL,MAAM;AAAA,MACP;AAAA,MACD,WAAW,MAAMC,QAAW,QAAQA,QAAW,KAAK;AAAA,MACpD,QAAQ,MAAM,MAAM,OAAO,MAAM,OAAO,KAAK,EAAE,MAAM,gBAAgB,QAAQ,EAAE,KAAK,MAAM,OAAO,IAAG,EAAG,CAAA,IAAI,OAAO,KAAK,EAAE,MAAM,gBAAgB;AAAA,IACnJ,CAAG,GAEF,YAAY,MAAM;AACfF,YAAc,eAAe,UAAU;IAC3C,CAAG;AAEHG,YAAiB,OAAY,CAAA,QAAA,SAAA,IAAAC,iBAAA,MAAAC,QAAmB,KAAK;AAAA,MAC/C,MAAMH,QAAW,KAAK;AAAA,MACtB,UAAU;AAAA,MACV,OAAO;AAAA,IACb,CAAK,CAAA;AACH,cAAU,YAAY;AAAA,IAExB,CAAG;AAEwB,aAAS,MAAM;AACvC,YAAM,eAAe,CAAC,SAAS;AAC7B,eAAO,KAAK,IAAI,WAAS;AAAA;AAAA,UAExB,QAAQ,KAAK;AAAA,UACb,KAAK,KAAK;AAAA,UACV,OAAO,KAAK;AAAA,UACZ,MAAM,KAAK;AAAA,UACX,UAAU,KAAK,WAAW,aAAa,KAAK,QAAQ,IAAI,CAAE;AAAA,QAC1D,EAAC;AAAA,MACP;AAEG,aAAO,aAAaC,QAAiB,GAAG;AAAA,IAC3C,CAAG;AAED,aAAS,oBAAoB,YAAY;AACvC,UAAI,iBAAiB,CAAA;AAErB,eAAS,QAAQ,UAAU;AACzB,cAAM,EAAE,UAAU,GAAG,wBAAuB,IAAK;AACjD,uBAAe,KAAK,uBAAuB;AAE3C,YAAI,YAAY,MAAM,QAAQ,QAAQ,GAAG;AACvC,mBAAS,QAAQ,WAAS,QAAQ,KAAK,CAAC;AAAA,QACzC;AAAA,MACF;AAED,iBAAW,QAAQ,cAAY,QAAQ,QAAQ,CAAC;AAChD,aAAO;AAAA,IACR;AAGD,mBAAe,sBAAsB,UAAU;AAC7C,UAAI;AAEF,cAAM,gBAAgBA,QAAiB;AACvC,cAAM,sBAAsB,oBAAoB,aAAa;AAG7D,gBAAQ,IAAI,UAAU,mBAAmB;AACzC,cAAME,QAAmB,OAAO,mBAAmB;AAEnD,gBAAQ,IAAI,uCAAuC;AAAA,MACpD,SAAQ,OAAO;AACd,gBAAQ,MAAM,oCAAoC,KAAK;AACvD,cAAM;AAAA,MACP;AAAA,IACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -4,34 +4,50 @@ const vue = require("vue");
4
4
  const vueRouter = require("vue-router");
5
5
  const IconDelete = require("../../../icons/navigation/IconDelete.vue.cjs");
6
6
  const Button = require("../../../../components/Button/Button.vue2.cjs");
7
- const Select = require("../../../../components/Select/Select.vue.cjs");
7
+ const Select = require("../../../../components/Select/Select.vue2.cjs");
8
8
  const Field = require("../../../../components/Field/Field.vue2.cjs");
9
+ const Feed = require("../../../../components/Feed/Feed.vue.cjs");
9
10
  const Block = require("../../../../components/Block/Block.vue.cjs");
11
+ const IconCheckmark = require("../../../icons/navigation/IconCheckmark.vue.cjs");
12
+ const globals = require("../../../globals/views/store/globals.cjs");
13
+ const auth = require("../../../auth/views/store/auth.cjs");
10
14
  const categories = require("../../store/categories.cjs");
11
15
  ;/* empty css */
12
- const _hoisted_1 = { class: "mn-r-auto" };
13
- const _hoisted_2 = { class: "mn-b-medium w-100 flex-nowrap gap-thin flex" };
14
- const _hoisted_3 = { class: "flex-v-center flex-nowrap flex" };
15
- const _hoisted_4 = ["onClick"];
16
+ const _hoisted_1 = { class: "pd-thin bg-white for-transition w-100" };
17
+ const _hoisted_2 = { class: "mn-r-auto" };
18
+ const _hoisted_3 = { class: "mn-b-medium w-100 flex-nowrap gap-thin flex" };
19
+ const _hoisted_4 = { class: "flex-v-center flex-nowrap flex" };
16
20
  const _hoisted_5 = ["onClick"];
17
21
  const _hoisted_6 = ["onClick"];
22
+ const _hoisted_7 = ["onClick"];
23
+ const _hoisted_8 = ["onClick"];
18
24
  const _sfc_main = {
19
25
  __name: "CategoryEdit",
20
26
  setup(__props) {
21
27
  const route = vueRouter.useRoute();
22
28
  const router = vueRouter.useRouter();
23
29
  if (route.params.category) {
24
- categories.actions.fetchCategory(route.params.category);
30
+ categories.actions.read({ url: route.params.category });
25
31
  } else {
26
- categories.actions.resetCategory();
32
+ categories.actions.clean();
27
33
  }
28
34
  vue.computed(() => categories.state.current);
29
35
  vue.computed(() => route.name);
36
+ globals.state.navigation_bar.actions = [{
37
+ component: IconCheckmark.default,
38
+ props: {
39
+ fill: "rgb(var(--main))"
40
+ },
41
+ condition: () => auth.state.user && auth.state.user._id,
42
+ action: () => onSubmit()
43
+ }], vue.onUnmounted(() => {
44
+ globals.state.navigation_bar.actions = [];
45
+ });
30
46
  function onSubmit() {
31
47
  if (route.params.category) {
32
- categories.actions.updateCategory(route.params.category);
48
+ categories.actions.update(categories.state.current);
33
49
  } else {
34
- categories.actions.addCategory();
50
+ categories.actions.create(categories.state.current);
35
51
  }
36
52
  }
37
53
  function redirectTo() {
@@ -43,10 +59,13 @@ const _sfc_main = {
43
59
  });
44
60
  }
45
61
  return (_ctx, _cache) => {
46
- return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
47
- vue.createVNode(Block.default, { class: "radius-big mn-b-thin flex-nowrap flex-v-center flex" }, {
62
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
63
+ !_ctx.MOBILE_APP ? (vue.openBlock(), vue.createBlock(Block.default, {
64
+ key: 0,
65
+ class: "radius-big mn-b-thin flex-nowrap flex-v-center flex"
66
+ }, {
48
67
  default: vue.withCtx(() => [
49
- vue.createElementVNode("h1", _hoisted_1, vue.toDisplayString(vue.unref(route).params.category ? "Edit Category" : "Add Category"), 1),
68
+ vue.createElementVNode("h1", _hoisted_2, vue.toDisplayString(vue.unref(route).params.category ? "Edit Category" : "Add Category"), 1),
50
69
  vue.createVNode(Button.default, {
51
70
  submit: onSubmit,
52
71
  callback: redirectTo,
@@ -59,19 +78,19 @@ const _sfc_main = {
59
78
  })
60
79
  ]),
61
80
  _: 1
62
- }),
81
+ })) : vue.createCommentVNode("", true),
63
82
  vue.createVNode(Block.default, {
64
83
  title: "Profile",
65
84
  class: "mn-b-thin"
66
85
  }, {
67
86
  default: vue.withCtx(() => [
68
- vue.createElementVNode("div", _hoisted_2, [
87
+ vue.createElementVNode("div", _hoisted_3, [
69
88
  vue.createVNode(Field.default, {
70
89
  field: categories.state.current.order,
71
90
  "onUpdate:field": _cache[0] || (_cache[0] = ($event) => categories.state.current.order = $event),
72
91
  label: "Order",
73
92
  disabled: true,
74
- class: "w-25 bg-white radius-small pd-medium"
93
+ class: "w-40 bg-white radius-small pd-medium"
75
94
  }, null, 8, ["field"]),
76
95
  vue.createVNode(Field.default, {
77
96
  field: categories.state.current.url,
@@ -79,15 +98,15 @@ const _sfc_main = {
79
98
  label: "URL",
80
99
  placeholder: "Enter category URL",
81
100
  class: "w-100 bg-white radius-small pd-medium"
82
- }, null, 8, ["field"]),
83
- vue.createVNode(Field.default, {
84
- field: categories.state.current.name,
85
- "onUpdate:field": _cache[2] || (_cache[2] = ($event) => categories.state.current.name = $event),
86
- label: "Name",
87
- placeholder: "Enter category name",
88
- class: "w-100 bg-white radius-small pd-medium"
89
101
  }, null, 8, ["field"])
90
102
  ]),
103
+ vue.createVNode(Field.default, {
104
+ field: categories.state.current.name,
105
+ "onUpdate:field": _cache[2] || (_cache[2] = ($event) => categories.state.current.name = $event),
106
+ label: "Name",
107
+ placeholder: "Enter category name",
108
+ class: "w-100 mn-b-small bg-white radius-small pd-medium"
109
+ }, null, 8, ["field"]),
91
110
  vue.createVNode(Select.default, {
92
111
  select: categories.state.current.status,
93
112
  "onUpdate:select": _cache[3] || (_cache[3] = ($event) => categories.state.current.status = $event),
@@ -101,7 +120,7 @@ const _sfc_main = {
101
120
  placeholder: "Display product",
102
121
  class: "pos-relative w-100 mn-b-small bg-white radius-small pd-medium"
103
122
  }, null, 8, ["select"]),
104
- vue.createElementVNode("div", _hoisted_3, [
123
+ vue.createElementVNode("div", _hoisted_4, [
105
124
  _cache[6] || (_cache[6] = vue.createElementVNode("h4", { class: "mn-r-thin t-medium" }, "Localization", -1)),
106
125
  vue.createElementVNode("button", {
107
126
  onClick: _cache[4] || (_cache[4] = () => categories.state.current.localization.push({ locale: "", text: "" })),
@@ -130,7 +149,7 @@ const _sfc_main = {
130
149
  class: "radius-small pd-small flex-center flex aspect-1x1 bg-red"
131
150
  }, [
132
151
  vue.createVNode(IconDelete.default, { class: "i-medium" })
133
- ], 8, _hoisted_4)
152
+ ], 8, _hoisted_5)
134
153
  ]);
135
154
  }), 128))
136
155
  ]),
@@ -141,12 +160,43 @@ const _sfc_main = {
141
160
  placeholder: "No subcategories added yet",
142
161
  actions: [{
143
162
  label: "+",
144
- function: () => categories.state.current.subcategories.push({ name: "", url: "" })
163
+ function: () => categories.state.current.children.push({ name: "", url: "" })
145
164
  }],
146
165
  class: "mn-b-thin"
147
166
  }, {
148
167
  default: vue.withCtx(() => [
149
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(categories.state.current.subcategories, (item, index) => {
168
+ vue.createTextVNode(vue.toDisplayString(categories.state.current.children) + " ", 1),
169
+ vue.createVNode(Feed.default, {
170
+ states: {
171
+ empty: {
172
+ title: "No Events Found",
173
+ description: "Currently, there are no events available."
174
+ }
175
+ },
176
+ store: {
177
+ read: (options) => categories.actions.read(options),
178
+ state: categories.state
179
+ },
180
+ options: {
181
+ user: auth.state.user._id,
182
+ limit: 10
183
+ }
184
+ }, {
185
+ default: vue.withCtx(({
186
+ items
187
+ }) => [
188
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(items, (category, index) => {
189
+ return vue.openBlock(), vue.createElementBlock("div", {
190
+ onClick: () => {
191
+ categories.state.current.children.push(category._id);
192
+ },
193
+ class: "bg-white pd-medium radius-small mn-b-medium"
194
+ }, vue.toDisplayString(category.name), 9, _hoisted_6);
195
+ }), 256))
196
+ ]),
197
+ _: 1
198
+ }, 8, ["store", "options"]),
199
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(categories.state.current.children, (item, index) => {
150
200
  return vue.openBlock(), vue.createElementBlock("div", {
151
201
  class: "gap-thin mn-b-thin flex-nowrap flex",
152
202
  key: index
@@ -164,11 +214,11 @@ const _sfc_main = {
164
214
  class: "w-100 bg-white radius-small pd-medium"
165
215
  }, null, 8, ["field", "onUpdate:field"]),
166
216
  vue.createElementVNode("div", {
167
- onClick: () => categories.state.current.subcategories.splice(index, 1),
217
+ onClick: () => categories.state.current.children.splice(index, 1),
168
218
  class: "radius-small pd-small flex-center flex aspect-1x1 bg-red"
169
219
  }, [
170
220
  vue.createVNode(IconDelete.default, { class: "i-medium" })
171
- ], 8, _hoisted_5)
221
+ ], 8, _hoisted_7)
172
222
  ]);
173
223
  }), 128))
174
224
  ]),
@@ -205,13 +255,13 @@ const _sfc_main = {
205
255
  class: "radius-small pd-small flex-center flex aspect-1x1 bg-red"
206
256
  }, [
207
257
  vue.createVNode(IconDelete.default, { class: "i-medium" })
208
- ], 8, _hoisted_6)
258
+ ], 8, _hoisted_8)
209
259
  ]);
210
260
  }), 128))
211
261
  ]),
212
262
  _: 1
213
263
  }, 8, ["actions"])
214
- ], 64);
264
+ ]);
215
265
  };
216
266
  }
217
267
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CategoryEdit.vue.cjs","sources":["../../../../../../../src/modules/products/components/pages/CategoryEdit.vue"],"sourcesContent":["<template>\n <Block class=\"radius-big mn-b-thin flex-nowrap flex-v-center flex\">\n <h1 class=\"mn-r-auto\">\n {{route.params.category ? 'Edit Category' : 'Add Category'}}\n </h1>\n\n <Button \n :submit=\"onSubmit\"\n :callback=\"redirectTo\"\n class=\"pd-small radius-big bg-main t-black uppercase t-medium\"\n >\n Save Category \n </Button>\n </Block>\n \n <Block \n title=\"Profile\"\n class=\"mn-b-thin\"\n >\n <div class=\"mn-b-medium w-100 flex-nowrap gap-thin flex\">\n <Field\n v-model:field=\"categories.state.current.order\"\n label=\"Order\"\n :disabled=\"true\"\n class=\"w-25 bg-white radius-small pd-medium\"\n /> \n <Field\n v-model:field=\"categories.state.current.url\"\n label=\"URL\"\n placeholder=\"Enter category URL\"\n class=\"w-100 bg-white radius-small pd-medium\"\n /> \n <Field\n v-model:field=\"categories.state.current.name\"\n label=\"Name\"\n placeholder=\"Enter category name\"\n class=\"w-100 bg-white radius-small pd-medium\"\n /> \n </div>\n\n <Select \n v-model:select=\"categories.state.current.status\"\n label=\"Status\"\n :options=\"[\n 'draft', \n 'internal',\n 'published',\n 'removed'\n ]\"\n placeholder=\"Display product\"\n class=\"pos-relative w-100 mn-b-small bg-white radius-small pd-medium\"\n />\n\n <div class=\"flex-v-center flex-nowrap flex\">\n <h4 class=\"mn-r-thin t-medium\">Localization</h4>\n \n <button \n @click=\"() => categories.state.current.localization.push({locale: '', text: ''})\" \n class=\"i-small pd-thin button-delete button\"\n >\n +\n </button>\n </div>\n <div \n class=\"gap-thin mn-b-thin flex-nowrap flex\" \n v-for=\"(item, index) in categories.state.current.localization\" \n :key=\"index\"\n > \n <Field\n v-model:field=\"item.locale\"\n placeholder=\"Locale\"\n class=\"w-100 bg-white radius-small pd-medium\"\n /> \n <Field\n v-model:field=\"item.text\"\n placeholder=\"Text\"\n class=\"w-100 bg-white radius-small pd-medium\"\n />\n <div\n @click=\"() => categories.state.current.localization.splice(index, 1)\" \n class=\"radius-small pd-small flex-center flex aspect-1x1 bg-red\"\n >\n <IconDelete \n class=\"i-medium\"\n />\n </div>\n </div>\n\n \n </Block>\n <!-- Subcategories -->\n <Block\n title=\"Subcategories\"\n placeholder=\"No subcategories added yet\"\n :actions=\"[{\n label: '+',\n function: () => categories.state.current.subcategories.push({name: '', url: ''})\n }]\"\n class=\"mn-b-thin\"\n >\n <div \n class=\"gap-thin mn-b-thin flex-nowrap flex\" \n v-for=\"(item, index) in categories.state.current.subcategories\" \n :key=\"index\"\n > \n <Field\n v-model:field=\"item.name\"\n placeholder=\"Subcategory name\"\n class=\"w-100 bg-white radius-small pd-medium\"\n /> \n <Field\n v-model:field=\"item.url\"\n placeholder=\"Subcategory\"\n class=\"w-100 bg-white radius-small pd-medium\"\n />\n <div\n @click=\"() => categories.state.current.subcategories.splice(index, 1)\" \n class=\"radius-small pd-small flex-center flex aspect-1x1 bg-red\"\n >\n <IconDelete \n class=\"i-medium\"\n />\n </div>\n </div> \n </Block>\n <!-- Filters -->\n <Block\n title=\"Filters\"\n placeholder=\"No filters added yet\"\n :actions=\"[{\n label: '+',\n function: () => categories.state.current.filters.push({name: '', url: ''})\n }]\"\n >\n <div \n class=\"gap-thin mn-b-thin flex-nowrap flex\" \n v-for=\"(item, index) in categories.state.current.filters\" \n :key=\"index\"\n > \n <Field\n v-model:field=\"item.name\"\n placeholder=\"Filter name\"\n class=\"w-100 bg-white radius-small pd-medium\"\n /> \n <Field\n v-model:field=\"item.options\"\n placeholder=\"Filter options divided by ,\"\n class=\"w-100 bg-white radius-small pd-medium\"\n />\n <div\n @click=\"() => categories.state.current.filters.splice(index, 1)\" \n class=\"radius-small pd-small flex-center flex aspect-1x1 bg-red\"\n >\n <IconDelete \n class=\"i-medium\"\n />\n </div>\n </div> \n </Block>\n \n</template>\n\n<script setup>\n // Import libs\n import { computed } from 'vue'\n import { useRoute,useRouter } from 'vue-router'\n \n import IconDelete from '@pf/src/modules/icons/navigation/IconDelete.vue';\n\n import Button from \"@pf/src/components/Button/Button.vue\";\n import Select from \"@pf/src/components/Select/Select.vue\";\n import Field from \"@pf/src/components/Field/Field.vue\";\n\n import Block from '@pf/src/components/Block/Block.vue';\n\n // Import the new store structure\n import * as categories from '@pf/src/modules/products/store/categories';\n\n const route = useRoute()\n const router = useRouter()\n\n // Data prefetching\n if (route.params.category) {\n categories.actions.fetchCategory(route.params.category)\n } else {\n categories.actions.resetCategory() // Adjusted based on the new store's method to reset the category state\n }\n\n // Accessing state\n const category = computed(() => categories.state.current)\n const routePath = computed(() => route.name)\n\n // Functions\n function onSubmit() {\n if (route.params.category) {\n categories.actions.updateCategory(route.params.category)\n } else {\n categories.actions.addCategory()\n }\n }\n\n function redirectTo () {\n router.push({\n name: 'Categories Organization', \n params: { \n _id: route.params._id\n } \n })\n }\n</script>\n\n<style lang=\"scss\">\n /* Your styles here */\n</style>\n"],"names":["useRoute","useRouter","categories.actions","computed","categories.state"],"mappings":";;;;;;;;;;;;;;;;;;;;AAkLE,UAAM,QAAQA,UAAAA,SAAU;AACxB,UAAM,SAASC,UAAAA,UAAW;AAG1B,QAAI,MAAM,OAAO,UAAU;AACzBC,iBAAAA,QAAmB,cAAc,MAAM,OAAO,QAAQ;AAAA,IAC1D,OAAS;AACLA,iBAAAA,QAAmB,cAAe;AAAA,IACnC;AAGgBC,iBAAS,MAAMC,WAAgB,MAAC,OAAO;AACtCD,iBAAS,MAAM,MAAM,IAAI;AAG3C,aAAS,WAAW;AAClB,UAAI,MAAM,OAAO,UAAU;AACzBD,mBAAAA,QAAmB,eAAe,MAAM,OAAO,QAAQ;AAAA,MAC7D,OAAW;AACLA,mBAAAA,QAAmB,YAAa;AAAA,MACjC;AAAA,IACF;AAED,aAAS,aAAc;AACrB,aAAO,KAAK;AAAA,QACV,MAAM;AAAA,QACN,QAAQ;AAAA,UACN,KAAK,MAAM,OAAO;AAAA,QACnB;AAAA,MACP,CAAK;AAAA,IACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"CategoryEdit.vue.cjs","sources":["../../../../../../../src/modules/products/components/pages/CategoryEdit.vue"],"sourcesContent":["<template>\n <div class=\"pd-thin bg-white for-transition w-100\">\n <Block v-if=\"!MOBILE_APP\" class=\"radius-big mn-b-thin flex-nowrap flex-v-center flex\">\n <h1 class=\"mn-r-auto\">\n {{route.params.category ? 'Edit Category' : 'Add Category'}}\n </h1>\n\n <Button \n :submit=\"onSubmit\"\n :callback=\"redirectTo\"\n class=\"pd-small radius-big bg-main t-black uppercase t-medium\"\n >\n Save Category \n </Button>\n </Block>\n \n <Block \n title=\"Profile\"\n class=\"mn-b-thin\"\n >\n <div class=\"mn-b-medium w-100 flex-nowrap gap-thin flex\">\n <Field\n v-model:field=\"categories.state.current.order\"\n label=\"Order\"\n :disabled=\"true\"\n class=\"w-40 bg-white radius-small pd-medium\"\n /> \n <Field\n v-model:field=\"categories.state.current.url\"\n label=\"URL\"\n placeholder=\"Enter category URL\"\n class=\"w-100 bg-white radius-small pd-medium\"\n /> \n \n </div>\n <Field\n v-model:field=\"categories.state.current.name\"\n label=\"Name\"\n placeholder=\"Enter category name\"\n class=\"w-100 mn-b-small bg-white radius-small pd-medium\"\n /> \n\n <Select \n v-model:select=\"categories.state.current.status\"\n label=\"Status\"\n :options=\"[\n 'draft', \n 'internal',\n 'published',\n 'removed'\n ]\"\n placeholder=\"Display product\"\n class=\"pos-relative w-100 mn-b-small bg-white radius-small pd-medium\"\n />\n\n <div class=\"flex-v-center flex-nowrap flex\">\n <h4 class=\"mn-r-thin t-medium\">Localization</h4>\n \n <button \n @click=\"() => categories.state.current.localization.push({locale: '', text: ''})\" \n class=\"i-small pd-thin button-delete button\"\n >\n +\n </button>\n </div>\n <div \n class=\"gap-thin mn-b-thin flex-nowrap flex\" \n v-for=\"(item, index) in categories.state.current.localization\" \n :key=\"index\"\n > \n <Field\n v-model:field=\"item.locale\"\n placeholder=\"Locale\"\n class=\"w-100 bg-white radius-small pd-medium\"\n /> \n <Field\n v-model:field=\"item.text\"\n placeholder=\"Text\"\n class=\"w-100 bg-white radius-small pd-medium\"\n />\n <div\n @click=\"() => categories.state.current.localization.splice(index, 1)\" \n class=\"radius-small pd-small flex-center flex aspect-1x1 bg-red\"\n >\n <IconDelete \n class=\"i-medium\"\n />\n </div>\n </div>\n\n \n </Block>\n <!-- Subcategories -->\n <Block\n title=\"Subcategories\"\n placeholder=\"No subcategories added yet\"\n :actions=\"[{\n label: '+',\n function: () => categories.state.current.children.push({name: '', url: ''})\n }]\"\n class=\"mn-b-thin\"\n >\n\n {{categories.state.current.children}}\n <Feed\n :states=\"{\n empty: {\n title: 'No Events Found',\n description: 'Currently, there are no events available.'\n }\n }\"\n :store=\"{\n read: (options) => categories.actions.read(options),\n state: categories.state\n }\"\n :options=\"{\n user: auth.state.user._id,\n limit: 10\n }\"\n v-slot=\"{ \n items \n }\"\n >\n <div \n v-for=\"(category,index) in items\"\n @click=\"() => { categories.state.current.children.push(category._id) }\"\n class=\"bg-white pd-medium radius-small mn-b-medium\"\n >\n {{category.name}}\n </div>\n \n </Feed>\n \n <div \n class=\"gap-thin mn-b-thin flex-nowrap flex\" \n v-for=\"(item, index) in categories.state.current.children\" \n :key=\"index\"\n > \n <Field\n v-model:field=\"item.name\"\n placeholder=\"Subcategory name\"\n class=\"w-100 bg-white radius-small pd-medium\"\n /> \n <Field\n v-model:field=\"item.url\"\n placeholder=\"Subcategory\"\n class=\"w-100 bg-white radius-small pd-medium\"\n />\n <div\n @click=\"() => categories.state.current.children.splice(index, 1)\" \n class=\"radius-small pd-small flex-center flex aspect-1x1 bg-red\"\n >\n <IconDelete \n class=\"i-medium\"\n />\n </div>\n </div> \n </Block>\n <!-- Filters -->\n <Block\n title=\"Filters\"\n placeholder=\"No filters added yet\"\n :actions=\"[{\n label: '+',\n function: () => categories.state.current.filters.push({name: '', url: ''})\n }]\"\n >\n <div \n class=\"gap-thin mn-b-thin flex-nowrap flex\" \n v-for=\"(item, index) in categories.state.current.filters\" \n :key=\"index\"\n > \n <Field\n v-model:field=\"item.name\"\n placeholder=\"Filter name\"\n class=\"w-100 bg-white radius-small pd-medium\"\n /> \n <Field\n v-model:field=\"item.options\"\n placeholder=\"Filter options divided by ,\"\n class=\"w-100 bg-white radius-small pd-medium\"\n />\n <div\n @click=\"() => categories.state.current.filters.splice(index, 1)\" \n class=\"radius-small pd-small flex-center flex aspect-1x1 bg-red\"\n >\n <IconDelete \n class=\"i-medium\"\n />\n </div>\n </div> \n </Block>\n </div>\n \n</template>\n\n<script setup>\n // Import libs\n import { computed, onUnmounted } from 'vue'\n import { useRoute,useRouter } from 'vue-router'\n \n import IconDelete from '@pf/src/modules/icons/navigation/IconDelete.vue';\n\n import Button from \"@pf/src/components/Button/Button.vue\";\n import Select from \"@pf/src/components/Select/Select.vue\";\n import Field from \"@pf/src/components/Field/Field.vue\";\n import Feed from '@pf/src/components/Feed/Feed.vue'\n\n import Block from '@pf/src/components/Block/Block.vue';\n\n import IconCheckmark from '@pf/src/modules/icons/navigation/IconCheckmark.vue'\n\n // Import the new store structure\n import * as globals from '@pf/src/modules/globals/views/store/globals';\n import * as auth from '@pf/src/modules/auth/views/store/auth'; \n import * as categories from '@pf/src/modules/products/store/categories';\n\n const route = useRoute()\n const router = useRouter()\n\n // Data prefetching\n if (route.params.category) {\n categories.actions.read({url: route.params.category})\n } else {\n categories.actions.clean() // Adjusted based on the new store's method to reset the category state\n }\n\n // Accessing state\n const category = computed(() => categories.state.current)\n const routePath = computed(() => route.name)\n\n // Navigation Bar\n globals.state.navigation_bar.actions = [{\n component: IconCheckmark,\n props: {\n fill: \"rgb(var(--main))\" \n },\n condition: () => auth.state.user && auth.state.user._id,\n action: () => onSubmit()\n }],\n\n onUnmounted(() => {\n globals.state.navigation_bar.actions = [];\n });\n\n\n\n // Functions\n function onSubmit() {\n if (route.params.category) {\n categories.actions.update(categories.state.current)\n } else {\n categories.actions.create(categories.state.current)\n }\n }\n\n function redirectTo () {\n router.push({\n name: 'Categories Organization', \n params: { \n _id: route.params._id\n } \n })\n }\n</script>\n\n<style lang=\"scss\">\n /* Your styles here */\n</style>\n"],"names":["useRoute","useRouter","categories.actions","computed","categories.state","globals.state","IconCheckmark","auth.state","onUnmounted"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyNE,UAAM,QAAQA,UAAAA,SAAU;AACxB,UAAM,SAASC,UAAAA,UAAW;AAG1B,QAAI,MAAM,OAAO,UAAU;AACzBC,iBAAkB,QAAC,KAAK,EAAC,KAAK,MAAM,OAAO,SAAQ,CAAC;AAAA,IACxD,OAAS;AACLA,iBAAAA,QAAmB,MAAO;AAAA,IAC3B;AAGgBC,iBAAS,MAAMC,WAAgB,MAAC,OAAO;AACtCD,iBAAS,MAAM,MAAM,IAAI;AAG3CE,kBAAc,eAAe,UAAU,CAAC;AAAA,MACtC,WAAWC,cAAa;AAAA,MACxB,OAAO;AAAA,QACL,MAAM;AAAA,MACP;AAAA,MACD,WAAW,MAAMC,KAAU,MAAC,QAAQA,KAAU,MAAC,KAAK;AAAA,MACpD,QAAQ,MAAM,SAAU;AAAA,IAC5B,CAAG,GAEFC,IAAAA,YAAY,MAAM;AACfH,oBAAc,eAAe,UAAU;IAC3C,CAAG;AAKD,aAAS,WAAW;AAClB,UAAI,MAAM,OAAO,UAAU;AACzBH,2BAAmB,OAAOE,WAAgB,MAAC,OAAO;AAAA,MACxD,OAAW;AACLF,2BAAmB,OAAOE,WAAgB,MAAC,OAAO;AAAA,MACnD;AAAA,IACF;AAED,aAAS,aAAc;AACrB,aAAO,KAAK;AAAA,QACV,MAAM;AAAA,QACN,QAAQ;AAAA,UACN,KAAK,MAAM,OAAO;AAAA,QACnB;AAAA,MACP,CAAK;AAAA,IACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,35 +1,51 @@
1
- import { computed, openBlock, createElementBlock, Fragment, createVNode, withCtx, createElementVNode, toDisplayString, unref, createTextVNode, renderList } from "vue";
1
+ import { computed, onUnmounted, openBlock, createElementBlock, createBlock, withCtx, createElementVNode, toDisplayString, unref, createVNode, createTextVNode, createCommentVNode, Fragment, renderList } from "vue";
2
2
  import { useRoute, useRouter } from "vue-router";
3
- import _sfc_main$3 from "../../../icons/navigation/IconDelete.vue.js";
4
- import _sfc_main$2 from "../../../../components/Button/Button.vue2.js";
5
- import Select from "../../../../components/Select/Select.vue.js";
3
+ import _sfc_main$4 from "../../../icons/navigation/IconDelete.vue.js";
4
+ import _sfc_main$3 from "../../../../components/Button/Button.vue2.js";
5
+ import Select from "../../../../components/Select/Select.vue2.js";
6
6
  import Field from "../../../../components/Field/Field.vue2.js";
7
- import _sfc_main$1 from "../../../../components/Block/Block.vue.js";
7
+ import _sfc_main$5 from "../../../../components/Feed/Feed.vue.js";
8
+ import _sfc_main$2 from "../../../../components/Block/Block.vue.js";
9
+ import _sfc_main$1 from "../../../icons/navigation/IconCheckmark.vue.js";
10
+ import { state as state$1 } from "../../../globals/views/store/globals.js";
11
+ import { state as state$2 } from "../../../auth/views/store/auth.js";
8
12
  import { actions, state } from "../../store/categories.js";
9
13
  /* empty css */
10
- const _hoisted_1 = { class: "mn-r-auto" };
11
- const _hoisted_2 = { class: "mn-b-medium w-100 flex-nowrap gap-thin flex" };
12
- const _hoisted_3 = { class: "flex-v-center flex-nowrap flex" };
13
- const _hoisted_4 = ["onClick"];
14
+ const _hoisted_1 = { class: "pd-thin bg-white for-transition w-100" };
15
+ const _hoisted_2 = { class: "mn-r-auto" };
16
+ const _hoisted_3 = { class: "mn-b-medium w-100 flex-nowrap gap-thin flex" };
17
+ const _hoisted_4 = { class: "flex-v-center flex-nowrap flex" };
14
18
  const _hoisted_5 = ["onClick"];
15
19
  const _hoisted_6 = ["onClick"];
20
+ const _hoisted_7 = ["onClick"];
21
+ const _hoisted_8 = ["onClick"];
16
22
  const _sfc_main = {
17
23
  __name: "CategoryEdit",
18
24
  setup(__props) {
19
25
  const route = useRoute();
20
26
  const router = useRouter();
21
27
  if (route.params.category) {
22
- actions.fetchCategory(route.params.category);
28
+ actions.read({ url: route.params.category });
23
29
  } else {
24
- actions.resetCategory();
30
+ actions.clean();
25
31
  }
26
32
  computed(() => state.current);
27
33
  computed(() => route.name);
34
+ state$1.navigation_bar.actions = [{
35
+ component: _sfc_main$1,
36
+ props: {
37
+ fill: "rgb(var(--main))"
38
+ },
39
+ condition: () => state$2.user && state$2.user._id,
40
+ action: () => onSubmit()
41
+ }], onUnmounted(() => {
42
+ state$1.navigation_bar.actions = [];
43
+ });
28
44
  function onSubmit() {
29
45
  if (route.params.category) {
30
- actions.updateCategory(route.params.category);
46
+ actions.update(state.current);
31
47
  } else {
32
- actions.addCategory();
48
+ actions.create(state.current);
33
49
  }
34
50
  }
35
51
  function redirectTo() {
@@ -41,11 +57,14 @@ const _sfc_main = {
41
57
  });
42
58
  }
43
59
  return (_ctx, _cache) => {
44
- return openBlock(), createElementBlock(Fragment, null, [
45
- createVNode(_sfc_main$1, { class: "radius-big mn-b-thin flex-nowrap flex-v-center flex" }, {
60
+ return openBlock(), createElementBlock("div", _hoisted_1, [
61
+ !_ctx.MOBILE_APP ? (openBlock(), createBlock(_sfc_main$2, {
62
+ key: 0,
63
+ class: "radius-big mn-b-thin flex-nowrap flex-v-center flex"
64
+ }, {
46
65
  default: withCtx(() => [
47
- createElementVNode("h1", _hoisted_1, toDisplayString(unref(route).params.category ? "Edit Category" : "Add Category"), 1),
48
- createVNode(_sfc_main$2, {
66
+ createElementVNode("h1", _hoisted_2, toDisplayString(unref(route).params.category ? "Edit Category" : "Add Category"), 1),
67
+ createVNode(_sfc_main$3, {
49
68
  submit: onSubmit,
50
69
  callback: redirectTo,
51
70
  class: "pd-small radius-big bg-main t-black uppercase t-medium"
@@ -57,19 +76,19 @@ const _sfc_main = {
57
76
  })
58
77
  ]),
59
78
  _: 1
60
- }),
61
- createVNode(_sfc_main$1, {
79
+ })) : createCommentVNode("", true),
80
+ createVNode(_sfc_main$2, {
62
81
  title: "Profile",
63
82
  class: "mn-b-thin"
64
83
  }, {
65
84
  default: withCtx(() => [
66
- createElementVNode("div", _hoisted_2, [
85
+ createElementVNode("div", _hoisted_3, [
67
86
  createVNode(Field, {
68
87
  field: state.current.order,
69
88
  "onUpdate:field": _cache[0] || (_cache[0] = ($event) => state.current.order = $event),
70
89
  label: "Order",
71
90
  disabled: true,
72
- class: "w-25 bg-white radius-small pd-medium"
91
+ class: "w-40 bg-white radius-small pd-medium"
73
92
  }, null, 8, ["field"]),
74
93
  createVNode(Field, {
75
94
  field: state.current.url,
@@ -77,15 +96,15 @@ const _sfc_main = {
77
96
  label: "URL",
78
97
  placeholder: "Enter category URL",
79
98
  class: "w-100 bg-white radius-small pd-medium"
80
- }, null, 8, ["field"]),
81
- createVNode(Field, {
82
- field: state.current.name,
83
- "onUpdate:field": _cache[2] || (_cache[2] = ($event) => state.current.name = $event),
84
- label: "Name",
85
- placeholder: "Enter category name",
86
- class: "w-100 bg-white radius-small pd-medium"
87
99
  }, null, 8, ["field"])
88
100
  ]),
101
+ createVNode(Field, {
102
+ field: state.current.name,
103
+ "onUpdate:field": _cache[2] || (_cache[2] = ($event) => state.current.name = $event),
104
+ label: "Name",
105
+ placeholder: "Enter category name",
106
+ class: "w-100 mn-b-small bg-white radius-small pd-medium"
107
+ }, null, 8, ["field"]),
89
108
  createVNode(Select, {
90
109
  select: state.current.status,
91
110
  "onUpdate:select": _cache[3] || (_cache[3] = ($event) => state.current.status = $event),
@@ -99,7 +118,7 @@ const _sfc_main = {
99
118
  placeholder: "Display product",
100
119
  class: "pos-relative w-100 mn-b-small bg-white radius-small pd-medium"
101
120
  }, null, 8, ["select"]),
102
- createElementVNode("div", _hoisted_3, [
121
+ createElementVNode("div", _hoisted_4, [
103
122
  _cache[6] || (_cache[6] = createElementVNode("h4", { class: "mn-r-thin t-medium" }, "Localization", -1)),
104
123
  createElementVNode("button", {
105
124
  onClick: _cache[4] || (_cache[4] = () => state.current.localization.push({ locale: "", text: "" })),
@@ -127,24 +146,55 @@ const _sfc_main = {
127
146
  onClick: () => state.current.localization.splice(index, 1),
128
147
  class: "radius-small pd-small flex-center flex aspect-1x1 bg-red"
129
148
  }, [
130
- createVNode(_sfc_main$3, { class: "i-medium" })
131
- ], 8, _hoisted_4)
149
+ createVNode(_sfc_main$4, { class: "i-medium" })
150
+ ], 8, _hoisted_5)
132
151
  ]);
133
152
  }), 128))
134
153
  ]),
135
154
  _: 1
136
155
  }),
137
- createVNode(_sfc_main$1, {
156
+ createVNode(_sfc_main$2, {
138
157
  title: "Subcategories",
139
158
  placeholder: "No subcategories added yet",
140
159
  actions: [{
141
160
  label: "+",
142
- function: () => state.current.subcategories.push({ name: "", url: "" })
161
+ function: () => state.current.children.push({ name: "", url: "" })
143
162
  }],
144
163
  class: "mn-b-thin"
145
164
  }, {
146
165
  default: withCtx(() => [
147
- (openBlock(true), createElementBlock(Fragment, null, renderList(state.current.subcategories, (item, index) => {
166
+ createTextVNode(toDisplayString(state.current.children) + " ", 1),
167
+ createVNode(_sfc_main$5, {
168
+ states: {
169
+ empty: {
170
+ title: "No Events Found",
171
+ description: "Currently, there are no events available."
172
+ }
173
+ },
174
+ store: {
175
+ read: (options) => actions.read(options),
176
+ state
177
+ },
178
+ options: {
179
+ user: state$2.user._id,
180
+ limit: 10
181
+ }
182
+ }, {
183
+ default: withCtx(({
184
+ items
185
+ }) => [
186
+ (openBlock(true), createElementBlock(Fragment, null, renderList(items, (category, index) => {
187
+ return openBlock(), createElementBlock("div", {
188
+ onClick: () => {
189
+ state.current.children.push(category._id);
190
+ },
191
+ class: "bg-white pd-medium radius-small mn-b-medium"
192
+ }, toDisplayString(category.name), 9, _hoisted_6);
193
+ }), 256))
194
+ ]),
195
+ _: 1
196
+ }, 8, ["store", "options"]),
197
+ (openBlock(true), createElementBlock(Fragment, null, renderList(state.current.children, (item, index) => {
148
198
  return openBlock(), createElementBlock("div", {
149
199
  class: "gap-thin mn-b-thin flex-nowrap flex",
150
200
  key: index
@@ -162,17 +212,17 @@ const _sfc_main = {
162
212
  class: "w-100 bg-white radius-small pd-medium"
163
213
  }, null, 8, ["field", "onUpdate:field"]),
164
214
  createElementVNode("div", {
165
- onClick: () => state.current.subcategories.splice(index, 1),
215
+ onClick: () => state.current.children.splice(index, 1),
166
216
  class: "radius-small pd-small flex-center flex aspect-1x1 bg-red"
167
217
  }, [
168
- createVNode(_sfc_main$3, { class: "i-medium" })
169
- ], 8, _hoisted_5)
218
+ createVNode(_sfc_main$4, { class: "i-medium" })
219
+ ], 8, _hoisted_7)
170
220
  ]);
171
221
  }), 128))
172
222
  ]),
173
223
  _: 1
174
224
  }, 8, ["actions"]),
175
- createVNode(_sfc_main$1, {
225
+ createVNode(_sfc_main$2, {
176
226
  title: "Filters",
177
227
  placeholder: "No filters added yet",
178
228
  actions: [{
@@ -202,14 +252,14 @@ const _sfc_main = {
202
252
  onClick: () => state.current.filters.splice(index, 1),
203
253
  class: "radius-small pd-small flex-center flex aspect-1x1 bg-red"
204
254
  }, [
205
- createVNode(_sfc_main$3, { class: "i-medium" })
206
- ], 8, _hoisted_6)
255
+ createVNode(_sfc_main$4, { class: "i-medium" })
256
+ ], 8, _hoisted_8)
207
257
  ]);
208
258
  }), 128))
209
259
  ]),
210
260
  _: 1
211
261
  }, 8, ["actions"])
212
- ], 64);
262
+ ]);
213
263
  };
214
264
  }
215
265
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CategoryEdit.vue.js","sources":["../../../../../../../src/modules/products/components/pages/CategoryEdit.vue"],"sourcesContent":["<template>\n <Block class=\"radius-big mn-b-thin flex-nowrap flex-v-center flex\">\n <h1 class=\"mn-r-auto\">\n {{route.params.category ? 'Edit Category' : 'Add Category'}}\n </h1>\n\n <Button \n :submit=\"onSubmit\"\n :callback=\"redirectTo\"\n class=\"pd-small radius-big bg-main t-black uppercase t-medium\"\n >\n Save Category \n </Button>\n </Block>\n \n <Block \n title=\"Profile\"\n class=\"mn-b-thin\"\n >\n <div class=\"mn-b-medium w-100 flex-nowrap gap-thin flex\">\n <Field\n v-model:field=\"categories.state.current.order\"\n label=\"Order\"\n :disabled=\"true\"\n class=\"w-25 bg-white radius-small pd-medium\"\n /> \n <Field\n v-model:field=\"categories.state.current.url\"\n label=\"URL\"\n placeholder=\"Enter category URL\"\n class=\"w-100 bg-white radius-small pd-medium\"\n /> \n <Field\n v-model:field=\"categories.state.current.name\"\n label=\"Name\"\n placeholder=\"Enter category name\"\n class=\"w-100 bg-white radius-small pd-medium\"\n /> \n </div>\n\n <Select \n v-model:select=\"categories.state.current.status\"\n label=\"Status\"\n :options=\"[\n 'draft', \n 'internal',\n 'published',\n 'removed'\n ]\"\n placeholder=\"Display product\"\n class=\"pos-relative w-100 mn-b-small bg-white radius-small pd-medium\"\n />\n\n <div class=\"flex-v-center flex-nowrap flex\">\n <h4 class=\"mn-r-thin t-medium\">Localization</h4>\n \n <button \n @click=\"() => categories.state.current.localization.push({locale: '', text: ''})\" \n class=\"i-small pd-thin button-delete button\"\n >\n +\n </button>\n </div>\n <div \n class=\"gap-thin mn-b-thin flex-nowrap flex\" \n v-for=\"(item, index) in categories.state.current.localization\" \n :key=\"index\"\n > \n <Field\n v-model:field=\"item.locale\"\n placeholder=\"Locale\"\n class=\"w-100 bg-white radius-small pd-medium\"\n /> \n <Field\n v-model:field=\"item.text\"\n placeholder=\"Text\"\n class=\"w-100 bg-white radius-small pd-medium\"\n />\n <div\n @click=\"() => categories.state.current.localization.splice(index, 1)\" \n class=\"radius-small pd-small flex-center flex aspect-1x1 bg-red\"\n >\n <IconDelete \n class=\"i-medium\"\n />\n </div>\n </div>\n\n \n </Block>\n <!-- Subcategories -->\n <Block\n title=\"Subcategories\"\n placeholder=\"No subcategories added yet\"\n :actions=\"[{\n label: '+',\n function: () => categories.state.current.subcategories.push({name: '', url: ''})\n }]\"\n class=\"mn-b-thin\"\n >\n <div \n class=\"gap-thin mn-b-thin flex-nowrap flex\" \n v-for=\"(item, index) in categories.state.current.subcategories\" \n :key=\"index\"\n > \n <Field\n v-model:field=\"item.name\"\n placeholder=\"Subcategory name\"\n class=\"w-100 bg-white radius-small pd-medium\"\n /> \n <Field\n v-model:field=\"item.url\"\n placeholder=\"Subcategory\"\n class=\"w-100 bg-white radius-small pd-medium\"\n />\n <div\n @click=\"() => categories.state.current.subcategories.splice(index, 1)\" \n class=\"radius-small pd-small flex-center flex aspect-1x1 bg-red\"\n >\n <IconDelete \n class=\"i-medium\"\n />\n </div>\n </div> \n </Block>\n <!-- Filters -->\n <Block\n title=\"Filters\"\n placeholder=\"No filters added yet\"\n :actions=\"[{\n label: '+',\n function: () => categories.state.current.filters.push({name: '', url: ''})\n }]\"\n >\n <div \n class=\"gap-thin mn-b-thin flex-nowrap flex\" \n v-for=\"(item, index) in categories.state.current.filters\" \n :key=\"index\"\n > \n <Field\n v-model:field=\"item.name\"\n placeholder=\"Filter name\"\n class=\"w-100 bg-white radius-small pd-medium\"\n /> \n <Field\n v-model:field=\"item.options\"\n placeholder=\"Filter options divided by ,\"\n class=\"w-100 bg-white radius-small pd-medium\"\n />\n <div\n @click=\"() => categories.state.current.filters.splice(index, 1)\" \n class=\"radius-small pd-small flex-center flex aspect-1x1 bg-red\"\n >\n <IconDelete \n class=\"i-medium\"\n />\n </div>\n </div> \n </Block>\n \n</template>\n\n<script setup>\n // Import libs\n import { computed } from 'vue'\n import { useRoute,useRouter } from 'vue-router'\n \n import IconDelete from '@pf/src/modules/icons/navigation/IconDelete.vue';\n\n import Button from \"@pf/src/components/Button/Button.vue\";\n import Select from \"@pf/src/components/Select/Select.vue\";\n import Field from \"@pf/src/components/Field/Field.vue\";\n\n import Block from '@pf/src/components/Block/Block.vue';\n\n // Import the new store structure\n import * as categories from '@pf/src/modules/products/store/categories';\n\n const route = useRoute()\n const router = useRouter()\n\n // Data prefetching\n if (route.params.category) {\n categories.actions.fetchCategory(route.params.category)\n } else {\n categories.actions.resetCategory() // Adjusted based on the new store's method to reset the category state\n }\n\n // Accessing state\n const category = computed(() => categories.state.current)\n const routePath = computed(() => route.name)\n\n // Functions\n function onSubmit() {\n if (route.params.category) {\n categories.actions.updateCategory(route.params.category)\n } else {\n categories.actions.addCategory()\n }\n }\n\n function redirectTo () {\n router.push({\n name: 'Categories Organization', \n params: { \n _id: route.params._id\n } \n })\n }\n</script>\n\n<style lang=\"scss\">\n /* Your styles here */\n</style>\n"],"names":["categories.actions","categories.state"],"mappings":";;;;;;;;;;;;;;;;;;AAkLE,UAAM,QAAQ,SAAU;AACxB,UAAM,SAAS,UAAW;AAG1B,QAAI,MAAM,OAAO,UAAU;AACzBA,cAAmB,cAAc,MAAM,OAAO,QAAQ;AAAA,IAC1D,OAAS;AACLA,cAAmB,cAAe;AAAA,IACnC;AAGgB,aAAS,MAAMC,MAAiB,OAAO;AACtC,aAAS,MAAM,MAAM,IAAI;AAG3C,aAAS,WAAW;AAClB,UAAI,MAAM,OAAO,UAAU;AACzBD,gBAAmB,eAAe,MAAM,OAAO,QAAQ;AAAA,MAC7D,OAAW;AACLA,gBAAmB,YAAa;AAAA,MACjC;AAAA,IACF;AAED,aAAS,aAAc;AACrB,aAAO,KAAK;AAAA,QACV,MAAM;AAAA,QACN,QAAQ;AAAA,UACN,KAAK,MAAM,OAAO;AAAA,QACnB;AAAA,MACP,CAAK;AAAA,IACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"CategoryEdit.vue.js","sources":["../../../../../../../src/modules/products/components/pages/CategoryEdit.vue"],"sourcesContent":["<template>\n <div class=\"pd-thin bg-white for-transition w-100\">\n <Block v-if=\"!MOBILE_APP\" class=\"radius-big mn-b-thin flex-nowrap flex-v-center flex\">\n <h1 class=\"mn-r-auto\">\n {{route.params.category ? 'Edit Category' : 'Add Category'}}\n </h1>\n\n <Button \n :submit=\"onSubmit\"\n :callback=\"redirectTo\"\n class=\"pd-small radius-big bg-main t-black uppercase t-medium\"\n >\n Save Category \n </Button>\n </Block>\n \n <Block \n title=\"Profile\"\n class=\"mn-b-thin\"\n >\n <div class=\"mn-b-medium w-100 flex-nowrap gap-thin flex\">\n <Field\n v-model:field=\"categories.state.current.order\"\n label=\"Order\"\n :disabled=\"true\"\n class=\"w-40 bg-white radius-small pd-medium\"\n /> \n <Field\n v-model:field=\"categories.state.current.url\"\n label=\"URL\"\n placeholder=\"Enter category URL\"\n class=\"w-100 bg-white radius-small pd-medium\"\n /> \n \n </div>\n <Field\n v-model:field=\"categories.state.current.name\"\n label=\"Name\"\n placeholder=\"Enter category name\"\n class=\"w-100 mn-b-small bg-white radius-small pd-medium\"\n /> \n\n <Select \n v-model:select=\"categories.state.current.status\"\n label=\"Status\"\n :options=\"[\n 'draft', \n 'internal',\n 'published',\n 'removed'\n ]\"\n placeholder=\"Display product\"\n class=\"pos-relative w-100 mn-b-small bg-white radius-small pd-medium\"\n />\n\n <div class=\"flex-v-center flex-nowrap flex\">\n <h4 class=\"mn-r-thin t-medium\">Localization</h4>\n \n <button \n @click=\"() => categories.state.current.localization.push({locale: '', text: ''})\" \n class=\"i-small pd-thin button-delete button\"\n >\n +\n </button>\n </div>\n <div \n class=\"gap-thin mn-b-thin flex-nowrap flex\" \n v-for=\"(item, index) in categories.state.current.localization\" \n :key=\"index\"\n > \n <Field\n v-model:field=\"item.locale\"\n placeholder=\"Locale\"\n class=\"w-100 bg-white radius-small pd-medium\"\n /> \n <Field\n v-model:field=\"item.text\"\n placeholder=\"Text\"\n class=\"w-100 bg-white radius-small pd-medium\"\n />\n <div\n @click=\"() => categories.state.current.localization.splice(index, 1)\" \n class=\"radius-small pd-small flex-center flex aspect-1x1 bg-red\"\n >\n <IconDelete \n class=\"i-medium\"\n />\n </div>\n </div>\n\n \n </Block>\n <!-- Subcategories -->\n <Block\n title=\"Subcategories\"\n placeholder=\"No subcategories added yet\"\n :actions=\"[{\n label: '+',\n function: () => categories.state.current.children.push({name: '', url: ''})\n }]\"\n class=\"mn-b-thin\"\n >\n\n {{categories.state.current.children}}\n <Feed\n :states=\"{\n empty: {\n title: 'No Events Found',\n description: 'Currently, there are no events available.'\n }\n }\"\n :store=\"{\n read: (options) => categories.actions.read(options),\n state: categories.state\n }\"\n :options=\"{\n user: auth.state.user._id,\n limit: 10\n }\"\n v-slot=\"{ \n items \n }\"\n >\n <div \n v-for=\"(category,index) in items\"\n @click=\"() => { categories.state.current.children.push(category._id) }\"\n class=\"bg-white pd-medium radius-small mn-b-medium\"\n >\n {{category.name}}\n </div>\n \n </Feed>\n \n <div \n class=\"gap-thin mn-b-thin flex-nowrap flex\" \n v-for=\"(item, index) in categories.state.current.children\" \n :key=\"index\"\n > \n <Field\n v-model:field=\"item.name\"\n placeholder=\"Subcategory name\"\n class=\"w-100 bg-white radius-small pd-medium\"\n /> \n <Field\n v-model:field=\"item.url\"\n placeholder=\"Subcategory\"\n class=\"w-100 bg-white radius-small pd-medium\"\n />\n <div\n @click=\"() => categories.state.current.children.splice(index, 1)\" \n class=\"radius-small pd-small flex-center flex aspect-1x1 bg-red\"\n >\n <IconDelete \n class=\"i-medium\"\n />\n </div>\n </div> \n </Block>\n <!-- Filters -->\n <Block\n title=\"Filters\"\n placeholder=\"No filters added yet\"\n :actions=\"[{\n label: '+',\n function: () => categories.state.current.filters.push({name: '', url: ''})\n }]\"\n >\n <div \n class=\"gap-thin mn-b-thin flex-nowrap flex\" \n v-for=\"(item, index) in categories.state.current.filters\" \n :key=\"index\"\n > \n <Field\n v-model:field=\"item.name\"\n placeholder=\"Filter name\"\n class=\"w-100 bg-white radius-small pd-medium\"\n /> \n <Field\n v-model:field=\"item.options\"\n placeholder=\"Filter options divided by ,\"\n class=\"w-100 bg-white radius-small pd-medium\"\n />\n <div\n @click=\"() => categories.state.current.filters.splice(index, 1)\" \n class=\"radius-small pd-small flex-center flex aspect-1x1 bg-red\"\n >\n <IconDelete \n class=\"i-medium\"\n />\n </div>\n </div> \n </Block>\n </div>\n \n</template>\n\n<script setup>\n // Import libs\n import { computed, onUnmounted } from 'vue'\n import { useRoute,useRouter } from 'vue-router'\n \n import IconDelete from '@pf/src/modules/icons/navigation/IconDelete.vue';\n\n import Button from \"@pf/src/components/Button/Button.vue\";\n import Select from \"@pf/src/components/Select/Select.vue\";\n import Field from \"@pf/src/components/Field/Field.vue\";\n import Feed from '@pf/src/components/Feed/Feed.vue'\n\n import Block from '@pf/src/components/Block/Block.vue';\n\n import IconCheckmark from '@pf/src/modules/icons/navigation/IconCheckmark.vue'\n\n // Import the new store structure\n import * as globals from '@pf/src/modules/globals/views/store/globals';\n import * as auth from '@pf/src/modules/auth/views/store/auth'; \n import * as categories from '@pf/src/modules/products/store/categories';\n\n const route = useRoute()\n const router = useRouter()\n\n // Data prefetching\n if (route.params.category) {\n categories.actions.read({url: route.params.category})\n } else {\n categories.actions.clean() // Adjusted based on the new store's method to reset the category state\n }\n\n // Accessing state\n const category = computed(() => categories.state.current)\n const routePath = computed(() => route.name)\n\n // Navigation Bar\n globals.state.navigation_bar.actions = [{\n component: IconCheckmark,\n props: {\n fill: \"rgb(var(--main))\" \n },\n condition: () => auth.state.user && auth.state.user._id,\n action: () => onSubmit()\n }],\n\n onUnmounted(() => {\n globals.state.navigation_bar.actions = [];\n });\n\n\n\n // Functions\n function onSubmit() {\n if (route.params.category) {\n categories.actions.update(categories.state.current)\n } else {\n categories.actions.create(categories.state.current)\n }\n }\n\n function redirectTo () {\n router.push({\n name: 'Categories Organization', \n params: { \n _id: route.params._id\n } \n })\n }\n</script>\n\n<style lang=\"scss\">\n /* Your styles here */\n</style>\n"],"names":["categories.actions","categories.state","globals.state","IconCheckmark","auth.state"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAyNE,UAAM,QAAQ,SAAU;AACxB,UAAM,SAAS,UAAW;AAG1B,QAAI,MAAM,OAAO,UAAU;AACzBA,cAAmB,KAAK,EAAC,KAAK,MAAM,OAAO,SAAQ,CAAC;AAAA,IACxD,OAAS;AACLA,cAAmB,MAAO;AAAA,IAC3B;AAGgB,aAAS,MAAMC,MAAiB,OAAO;AACtC,aAAS,MAAM,MAAM,IAAI;AAG3CC,YAAc,eAAe,UAAU,CAAC;AAAA,MACtC,WAAWC;AAAAA,MACX,OAAO;AAAA,QACL,MAAM;AAAA,MACP;AAAA,MACD,WAAW,MAAMC,QAAW,QAAQA,QAAW,KAAK;AAAA,MACpD,QAAQ,MAAM,SAAU;AAAA,IAC5B,CAAG,GAEF,YAAY,MAAM;AACfF,cAAc,eAAe,UAAU;IAC3C,CAAG;AAKD,aAAS,WAAW;AAClB,UAAI,MAAM,OAAO,UAAU;AACzBF,gBAAmB,OAAOC,MAAiB,OAAO;AAAA,MACxD,OAAW;AACLD,gBAAmB,OAAOC,MAAiB,OAAO;AAAA,MACnD;AAAA,IACF;AAED,aAAS,aAAc;AACrB,aAAO,KAAK;AAAA,QACV,MAAM;AAAA,QACN,QAAQ;AAAA,UACN,KAAK,MAAM,OAAO;AAAA,QACnB;AAAA,MACP,CAAK;AAAA,IACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -4,7 +4,7 @@ const vue = require("vue");
4
4
  const Block = require("../../../../components/Block/Block.vue.cjs");
5
5
  const Field = require("../../../../components/Field/Field.vue2.cjs");
6
6
  const Feed = require("../../../../components/Feed/Feed.vue.cjs");
7
- const Select = require("../../../../components/Select/Select.vue.cjs");
7
+ const Select = require("../../../../components/Select/Select.vue2.cjs");
8
8
  const Popup = require("../../../../components/Popup/Popup.vue.cjs");
9
9
  ;/* empty css */
10
10
  const CardPosition = require("../blocks/CardPosition.vue.cjs");
@@ -2,7 +2,7 @@ import { ref, computed, onMounted, openBlock, createElementBlock, createElementV
2
2
  import _sfc_main$4 from "../../../../components/Block/Block.vue.js";
3
3
  import Field from "../../../../components/Field/Field.vue2.js";
4
4
  import _sfc_main$2 from "../../../../components/Feed/Feed.vue.js";
5
- import Select from "../../../../components/Select/Select.vue.js";
5
+ import Select from "../../../../components/Select/Select.vue2.js";
6
6
  import _sfc_main$1 from "../../../../components/Popup/Popup.vue.js";
7
7
  /* empty css */
8
8
  import _sfc_main$5 from "../blocks/CardPosition.vue.js";