ali 1 ano atrás
pai
commit
f86e304a87

+ 14 - 12
src/components/Widgets/Store/Shop/components/packageItem.vue

@@ -34,18 +34,20 @@
              outline>
         مشاهده جزییات
       </q-btn>
-      <q-btn v-if="!basketItem"
-             class="package-item__actions-add-to-cart"
-             :loading="addToCartLoading"
-             color="primary"
-             @click="addToCart">
-        افزودن به سبد
-      </q-btn>
-      <cart-count-action v-else
-                         :basket-item="basketItem"
-                         @increase="onIncrease"
-                         @decrease="onDecrease"
-                         @remove="onRemove" />
+      <template v-if="packageItem.is_add_to_basket_disabled">
+        <q-btn v-if="!basketItem"
+               class="package-item__actions-add-to-cart"
+               :loading="addToCartLoading"
+               color="primary"
+               @click="addToCart">
+          افزودن به سبد
+        </q-btn>
+        <cart-count-action v-else
+                           :basket-item="basketItem"
+                           @increase="onIncrease"
+                           @decrease="onDecrease"
+                           @remove="onRemove" />
+      </template>
     </div>
   </div>
 </template>

+ 15 - 13
src/components/Widgets/Store/Shop/components/productItem.vue

@@ -43,25 +43,27 @@
              outline>
         مشاهده جزییات
       </q-btn>
-      <q-btn v-if="!basketItem && product.inventory > 0"
-             class="product-item__actions-add-to-cart"
-             :loading="addToCartLoading"
-             color="primary"
-             @click="addToCart">
-        افزودن به سبد
-      </q-btn>
-      <q-btn v-if="!basketItem && product.inventory === 0"
+      <template v-if="product.is_add_to_basket_disabled">
+        <q-btn v-if="!basketItem && product.inventory > 0"
+               class="product-item__actions-add-to-cart"
+               :loading="addToCartLoading"
+               color="primary"
+               @click="addToCart">
+          افزودن به سبد
+        </q-btn>
+        <cart-count-action v-else
+                           :basket-item="basketItem"
+                           @increase="onIncrease"
+                           @decrease="onDecrease"
+                           @remove="onRemove" />
+      </template>
+      <q-btn v-if="product.inventory === 0"
              class="product-btn-add-to-cart"
              :loading="addToCartLoading"
              disable
              color="primary">
         ناموجود
       </q-btn>
-      <cart-count-action v-else
-                         :basket-item="basketItem"
-                         @increase="onIncrease"
-                         @decrease="onDecrease"
-                         @remove="onRemove" />
     </div>
   </div>
 </template>

+ 15 - 13
src/components/Widgets/Store/StoreProduct/ProductCarousel/productItem.vue

@@ -43,25 +43,27 @@
              outline>
         مشاهده جزییات
       </q-btn>
-      <q-btn v-if="!basketItem && product.inventory > 0"
-             class="product-item__actions-add-to-cart"
-             :loading="addToCartLoading"
-             color="primary"
-             @click="addToCart">
-        افزودن به سبد
-      </q-btn>
-      <q-btn v-if="!basketItem && product.inventory === 0"
+      <template v-if="product.is_add_to_basket_disabled">
+        <q-btn v-if="!basketItem && product.inventory > 0"
+               class="product-item__actions-add-to-cart"
+               :loading="addToCartLoading"
+               color="primary"
+               @click="addToCart">
+          افزودن به سبد
+        </q-btn>
+        <cart-count-action v-else
+                           :basket-item="basketItem"
+                           @increase="onIncrease"
+                           @decrease="onDecrease"
+                           @remove="onRemove" />
+      </template>
+      <q-btn v-if="product.inventory === 0"
              class="product-btn-add-to-cart"
              :loading="addToCartLoading"
              disable
              color="primary">
         ناموجود
       </q-btn>
-      <cart-count-action v-else
-                         :basket-item="basketItem"
-                         @increase="onIncrease"
-                         @decrease="onDecrease"
-                         @remove="onRemove" />
     </div>
   </div>
 </template>

+ 15 - 13
src/components/Widgets/Store/StoreProduct/StoreProductShow/StoreProductShow.vue

@@ -67,25 +67,27 @@
           ریال
         </div>
         <div class="product-show__summery-price-action">
-          <q-btn v-if="!basketItem && product.inventory > 0"
-                 class="product-btn-add-to-cart"
-                 :loading="addToCartLoading"
-                 color="primary"
-                 @click="addToCart">
-            افزودن به سبد
-          </q-btn>
-          <q-btn v-if="!basketItem && product.inventory === 0"
+          <template v-if="product.is_add_to_basket_disabled">
+            <q-btn v-if="!basketItem && product.inventory > 0"
+                   class="product-btn-add-to-cart"
+                   :loading="addToCartLoading"
+                   color="primary"
+                   @click="addToCart">
+              افزودن به سبد
+            </q-btn>
+            <cart-count-action v-else
+                               :basket-item="basketItem"
+                               @increase="onIncrease"
+                               @decrease="onDecrease"
+                               @remove="onRemove" />
+          </template>
+          <q-btn v-if="product.inventory === 0"
                  class="product-btn-add-to-cart"
                  :loading="addToCartLoading"
                  disable
                  color="primary">
             ناموجود
           </q-btn>
-          <cart-count-action v-else
-                             :basket-item="basketItem"
-                             @increase="onIncrease"
-                             @decrease="onDecrease"
-                             @remove="onRemove" />
         </div>
       </div>
     </div>

+ 16 - 14
src/components/Widgets/Store/StoreProduct/StoreRelatedProducts/components/productItem.vue

@@ -47,26 +47,28 @@
         </div>
       </div>
       <div class="product-item__price-action">
-        <q-btn v-if="!basketItem && product.inventory > 0"
-               class="product-btn-add-to-cart"
-               :loading="addToCartLoading"
-               color="primary"
-               @click="addToCart">
-          افزودن به سبد
-        </q-btn>
-        <q-btn v-if="!basketItem && product.inventory === 0"
+        <template v-if="product.is_add_to_basket_disabled">
+          <q-btn v-if="!basketItem && product.inventory > 0"
+                 class="product-btn-add-to-cart"
+                 :loading="addToCartLoading"
+                 color="primary"
+                 @click="addToCart">
+            افزودن به سبد
+          </q-btn>
+          <cart-count-action v-else
+                             :basket-item="basketItem"
+                             :loading="addToCartLoading"
+                             @increase="onIncrease"
+                             @decrease="onDecrease"
+                             @remove="onRemove" />
+        </template>
+        <q-btn v-if="product.inventory === 0"
                class="product-btn-add-to-cart"
                :loading="addToCartLoading"
                disable
                color="primary">
           ناموجود
         </q-btn>
-        <cart-count-action v-else
-                           :basket-item="basketItem"
-                           :loading="addToCartLoading"
-                           @increase="onIncrease"
-                           @decrease="onDecrease"
-                           @remove="onRemove" />
       </div>
     </div>
   </div>

+ 4 - 0
src/models/Package.js

@@ -17,6 +17,10 @@ class Package extends Model {
       { key: 'is_physical' },
       { key: 'maximum_order_count' },
       { key: 'weight' },
+      {
+        key: 'is_add_to_basket_disabled',
+        default: true
+      },
       { key: 'specification' },
       { key: 'products' },
       {

+ 5 - 1
src/models/Product.js

@@ -22,9 +22,13 @@ class Product extends Model {
       { key: 'weight' },
       { key: 'physical_type' },
       { key: 'specification' },
+      {
+        key: 'is_add_to_basket_disabled',
+        default: true
+      },
       {
         key: 'medias',
-        defalut: []
+        default: []
       },
       {
         key: 'medias_info',