ali 1 anno fa
parent
commit
4736acbf3e

+ 2 - 2
package.json

@@ -48,8 +48,8 @@
     "process": "^0.11.10",
     "quasar": "^2.14.2",
     "quasar-app-extension-q-page-builder": "^0.4.4",
-    "quasar-crud": "^2.2.5",
-    "quasar-form-builder": "^3.5.2",
+    "quasar-crud": "^2.2.6",
+    "quasar-form-builder": "^3.5.3",
     "quasar-template-builder": "^1.0.23",
     "quasar-ui-q-page-builder": "^0.4.4",
     "socket.io-client": "^4.6.1",

+ 31 - 9
src/components/FormBuilderCustumComponents/ContentCategorySelector.vue

@@ -102,7 +102,11 @@ export default {
     mainCategory (newValue) {
       this.subCategory = null
       this.subCategoryOptions = []
-      if (!newValue.item.children) {
+      if (this.categoryType === 'content') {
+        const selectedCategoryId = newValue?.value ? newValue?.value : null
+        this.$emit('update:value', selectedCategoryId)
+        return
+      } else if (!newValue.item.children) {
         this.$emit('update:value', newValue.value)
         return
       }
@@ -113,14 +117,21 @@ export default {
           value: item.id
         }
       })
-      if (this.categoryType === 'content') {
-        this.$emit('update:value', newValue.value)
-      }
     },
     subCategory (newValue) {
       this.bakhshCategory = null
       this.bakhshCategoryOptions = []
-      if (!newValue?.item?.children) {
+      if (this.categoryType === 'content') {
+        let selectedCategoryId = newValue?.value ? newValue?.value : null
+        if (this.mainCategory.value) {
+          selectedCategoryId = this.mainCategory.value
+        }
+        if (newValue?.value) {
+          selectedCategoryId = this.subCategory.value
+        }
+        this.$emit('update:value', selectedCategoryId)
+        return
+      } else if (!newValue?.item?.children) {
         this.$emit('update:value', null)
         return
       }
@@ -131,13 +142,24 @@ export default {
           value: item.id
         }
       })
-      if (this.categoryType === 'content') {
-        this.$emit('update:value', newValue.value)
-      }
     },
     bakhshCategory (newValue) {
+      let selectedCategoryId = null
       const categoryId = newValue ? newValue.value : null
-      this.$emit('update:value', categoryId)
+      if (this.categoryType === 'content') {
+        if (this.mainCategory.value) {
+          selectedCategoryId = this.mainCategory.value
+        }
+        if (this.subCategory.value) {
+          selectedCategoryId = this.subCategory.value
+        }
+        if (categoryId) {
+          selectedCategoryId = categoryId
+        }
+      } else {
+        selectedCategoryId = categoryId
+      }
+      this.$emit('update:value', selectedCategoryId)
     }
   },
   mounted() {

+ 1 - 1
src/components/Widgets/Content/AdminContentCreate/AdminContentCreate.vue

@@ -54,7 +54,7 @@ export default {
         { type: 'input', name: 'title', responseKey: 'title', label: 'عنوان', placeholder: ' ', col: 'col-md-6 col-12' },
         { type: 'file', name: 'thumbnail', responseKey: 'thumbnail', label: 'عکس', placeholder: ' ', col: 'col-md-6 col-12' },
         { type: 'checkbox', name: 'is_hidden', responseKey: 'is_hidden', label: 'پنهان باشد؟', placeholder: ' ', value: true, col: 'col-12' },
-        { type: ContentCategorySelectorComp, name: 'category', responseKey: 'category', col: 'col-12' },
+        { type: ContentCategorySelectorComp, name: 'category', responseKey: 'category', sendNull: true, col: 'col-12' },
         { type: 'inputEditor', name: 'description', responseKey: 'description', label: 'توضیحات', col: 'col-12' },
         { type: ContentMediasComp, name: 'medias', responseKey: 'medias_info', col: 'col-12' },
         { type: BtnControlComp, name: 'btn', responseKey: 'btn', label: 'ایجاد محتوا', placeholder: ' ', atClick: () => {}, col: 'col-md-6' }

+ 1 - 1
src/components/Widgets/Content/AdminContentShow/AdminContentShow.vue

@@ -88,7 +88,7 @@ export default {
         { type: 'input', name: 'title', responseKey: 'title', label: 'عنوان', placeholder: ' ', col: 'col-md-6 col-12' },
         { type: 'file', name: 'thumbnail', responseKey: 'thumbnail', label: 'عکس', placeholder: ' ', col: 'col-md-6 col-12' },
         { type: 'checkbox', name: 'is_hidden', responseKey: 'is_hidden', label: 'پنهان باشد؟', placeholder: ' ', col: 'col-12' },
-        { type: ContentCategorySelectorComp, name: 'category', responseKey: 'category_info', col: 'col-md-12 col-12' },
+        { type: ContentCategorySelectorComp, name: 'category', responseKey: 'category_info', sendNull: true, col: 'col-md-12 col-12' },
         { type: 'inputEditor', name: 'description', responseKey: 'description', label: 'توضیحات', col: 'col-md-12 col-12' },
         { type: ContentMediasComp, name: 'medias', responseKey: 'medias_info', col: 'col-md-12 col-12' },
         { type: BtnControlComp, name: 'btn', responseKey: 'btn', label: 'ویرایش محتوا', placeholder: ' ', ignoreValue: true, atClick: this.edit, col: 'col-md-6' }

+ 9 - 9
yarn.lock

@@ -4957,22 +4957,22 @@ quasar-app-extension-q-page-builder@^0.4.4:
   dependencies:
     quasar-ui-q-page-builder "^0.4.7"
 
-quasar-crud@^2.2.5:
-  version "2.2.5"
-  resolved "https://registry.yarnpkg.com/quasar-crud/-/quasar-crud-2.2.5.tgz#7b5a3faea71fe25508f3f1776b64fdc01e9a9e98"
-  integrity sha512-Qjy6jt6CwANvNCcI3Fab6m6TKPq1uRe3VZkL73+zMFkUARzHvs7aYGD3uO6aMOBk3doV2eNGoRuAHrMJ1C5ggA==
+quasar-crud@^2.2.6:
+  version "2.2.6"
+  resolved "https://registry.yarnpkg.com/quasar-crud/-/quasar-crud-2.2.6.tgz#f6be1c52935af331997769cd0a0c27d2e4d0fff3"
+  integrity sha512-t2386MWsn8sDalEldvY8Sn+rG/8uObEdiu7V9+XaUVwFyiPUnsZ4o/+QORgmyyE5Mz8okJLliAldlpFYM4E8vw==
   dependencies:
     "@quasar/extras" "^1.16.9"
     axios "^1.6.8"
     quasar "^2.14.2"
-    quasar-form-builder "^3.5.2"
+    quasar-form-builder "^3.5.3"
     shvl "^3.0.0"
     vue "^3.4.21"
 
-quasar-form-builder@^3.5.2:
-  version "3.5.2"
-  resolved "https://registry.yarnpkg.com/quasar-form-builder/-/quasar-form-builder-3.5.2.tgz#9f63fb4cc4b4656651a6b6c210c5f59d84f6ab0e"
-  integrity sha512-bP9v4TtXybxzGnL8GtfyQyt604mnHb2SJsN90PCrifdAZ9bRCLNo1sZwg6sQe9kFc2deICLyp7Y59iPThY1Siw==
+quasar-form-builder@^3.5.3:
+  version "3.5.3"
+  resolved "https://registry.yarnpkg.com/quasar-form-builder/-/quasar-form-builder-3.5.3.tgz#f30135e1fa7294e0e27f726f2f15d0b2353030f5"
+  integrity sha512-mVVouB2hgNFSfOHy/OwYujNPBcjdQqgoPqDLoQKDiP+UkmfVcY9POXP9UNPc1FpWKJ42cyhy+JmiaZlzX90ikA==
   dependencies:
     "@quasar/extras" "^1.16.9"
     core-js "^3.34.0"