Jelajahi Sumber

see also #448

ali 1 tahun lalu
induk
melakukan
63aa059072

+ 29 - 6
src/components/FormBuilderCustumComponents/ProductSelector.vue

@@ -82,11 +82,18 @@ export default {
             field: row => (new Product(row)).is_physical_info.label
           },
           {
-            name: 'content_category',
+            name: 'store_category',
             required: true,
             label: 'دسته فروشگاه',
             align: 'left',
-            field: row => row.store_category_info?.parent?.parent?.title + '، ' + row.store_category_info?.parent?.title + '، ' + row.store_category_info?.title
+            field: row => (row.store_category_info?.parent?.parent?.title || '-') + '، ' + (row.store_category_info?.parent?.title || '-') + '، ' + (row.store_category_info?.title || '-')
+          },
+          {
+            name: 'store_category1',
+            required: true,
+            label: 'دسته محتوا',
+            align: 'left',
+            field: row => (row.content_category_info?.parent?.parent?.title || '-') + '، ' + (row.content_category_info?.parent?.title || '-') + '، ' + (row.content_category_info?.title || '-')
           },
           {
             name: 'unit_price',
@@ -105,14 +112,29 @@ export default {
         ]
       },
       itemIdentifyKey: 'id',
-      itemIndicatorKey: (product) => product ? product.title + '(' + product.id + ')' : '-'
+      itemIndicatorKey: (product) => {
+        return product ? product.title + '(' + product.id + ')' : '-'
+      }
     }
   },
   watch: {
     value: {
       handler (newValue) {
-        if (newValue) {
-          this.selected = newValue
+        if (!newValue) {
+          return
+        }
+        if (this.selectionMode === 'multiple') {
+          if (isNaN(newValue[0])) {
+            this.selected = newValue
+          } else {
+            this.inputData = newValue
+          }
+        } else {
+          if (isNaN(newValue)) {
+            this.selected = newValue
+          } else {
+            this.inputData = newValue
+          }
         }
       },
       immediate: true
@@ -132,10 +154,11 @@ export default {
         }
       })
       this.selected = selected
-      this.inputData = selected
       if (this.selectionMode === 'multiple') {
+        this.inputData = selected.map(product => product.id)
         this.$emit('update:value', selected.map(product => product.id))
       } else {
+        this.inputData = selected.id
         this.$emit('update:value', selected.id)
       }
     }

+ 2 - 2
src/components/Widgets/Store/StorePackage/AdminStorePackageCreate/AdminStorePackageCreate.vue

@@ -46,10 +46,10 @@ export default {
     return {
       mounted: false,
       entityLoading: false,
-      api: APIGateway.content.APIAdresses.base,
+      api: APIGateway.package.APIAdresses.base,
       entityIdKey: 'id',
       entityParamKey: 'id',
-      showRouteName: 'Admin.Content.Show',
+      showRouteName: 'Admin.Store.Package.Show',
       inputs: [
         { 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' },