Просмотр исходного кода

update InvoiceShow.vue for user

ali 3 лет назад
Родитель
Сommit
dc1463256e
1 измененных файлов с 15 добавлено и 78 удалено
  1. 15 78
      src/components/Widgets/Invoice/InvoiceShow/InvoiceShow.vue

+ 15 - 78
src/components/Widgets/Invoice/InvoiceShow/InvoiceShow.vue

@@ -13,24 +13,10 @@
         </q-btn>
         </q-btn>
       </div>
       </div>
     </div>
     </div>
-    <entity-show v-if="mounted"
-                 ref="entityEdit"
-                 v-model:value="inputs"
-                 :title="'مشاهده صورتحساب شماره: ' + entityId"
-                 :api="api"
-                 :entity-id-key="entityIdKey"
-                 :entity-param-key="entityParamKey"
-                 :show-route-name="showRouteName"
-                 :show-close-button="false"
-                 :show-edit-button="false"
-                 :show-expand-button="false"
-                 :show-save-button="false"
-                 :show-reload-button="false"
-                 :redirect-after-edit="false"
-                 :show-index-button="false"
-                 :after-load-input-data="afterLoadInputData" />
     <q-card v-if="invoice.item_info"
     <q-card v-if="invoice.item_info"
             class="q-mt-lg">
             class="q-mt-lg">
+      <q-linear-progress v-if="invoice.loading"
+                         indeterminate />
       <q-card-section>
       <q-card-section>
         <div class="row">
         <div class="row">
           <div class="col-md-3 col-12">
           <div class="col-md-3 col-12">
@@ -84,13 +70,14 @@
       </q-card-section>
       </q-card-section>
     </q-card>
     </q-card>
     <div class="action q-mt-lg">
     <div class="action q-mt-lg">
-      <q-card v-if="invoice.status!=='PAYING'"
+      <q-card v-if="invoice.status!=='PAYING' && invoice.status!=='PAID_FULL' && invoice.status!=='PAID_IN_INSTALMENT'"
               class="q-mb-md">
               class="q-mb-md">
         <q-card-section>
         <q-card-section>
           تنها در صورتی که وضعیت سفارش در حال پرداخت باشد امکان پرداخت با کیف پول وجود دارد
           تنها در صورتی که وضعیت سفارش در حال پرداخت باشد امکان پرداخت با کیف پول وجود دارد
         </q-card-section>
         </q-card-section>
       </q-card>
       </q-card>
-      <q-btn color="green"
+      <q-btn v-if="invoice.status!=='PAYING' && invoice.status!=='PAID_FULL' && invoice.status!=='PAID_IN_INSTALMENT'"
+             color="green"
              :disable="invoice.status!=='PAYING'"
              :disable="invoice.status!=='PAYING'"
              class="q-px-xl"
              class="q-px-xl"
              @click="pay">
              @click="pay">
@@ -102,16 +89,12 @@
 
 
 <script>
 <script>
 import Assist from 'assets/js/Assist.js'
 import Assist from 'assets/js/Assist.js'
-import { EntityShow } from 'quasar-crud'
 import { Invoice } from 'src/models/Invoice.js'
 import { Invoice } from 'src/models/Invoice.js'
 import { mixinWidget } from 'src/mixin/Mixins.js'
 import { mixinWidget } from 'src/mixin/Mixins.js'
 import { APIGateway } from 'src/api/APIGateway.js'
 import { APIGateway } from 'src/api/APIGateway.js'
 
 
 export default {
 export default {
   name: 'InvoiceShow',
   name: 'InvoiceShow',
-  components: {
-    EntityShow
-  },
   mixins: [mixinWidget],
   mixins: [mixinWidget],
   props: {
   props: {
     invoiceId: {
     invoiceId: {
@@ -121,49 +104,11 @@ export default {
   },
   },
   data: () => {
   data: () => {
     return {
     return {
-      mounted: false,
-      entityLoading: true,
-      invoice: new Invoice(),
-      entityId: '',
-      api: null,
-      entityIdKey: 'id',
-      entityParamKey: 'id',
-      showRouteName: 'UserPanel.Invoice.Show',
-      indexRouteName: 'UserPanel.Invoice.List',
-      inputs: [
-        {
-          type: 'date',
-          name: 'creation_time',
-          responseKey: 'creation_time',
-          label: 'تاریخ صورت‌حساب',
-          placeholder: ' ',
-          col: 'col-md-6 col-12'
-        },
-        {
-          type: 'select',
-          name: 'status',
-          responseKey: 'status',
-          label: 'وضعیت',
-          placeholder: ' ',
-          options: (new Invoice()).statusEnums,
-          col: 'col-md-6 col-12'
-        },
-        {
-          type: 'hidden',
-          name: 'id',
-          responseKey: 'id'
-        }
-      ]
-    }
-  },
-  computed: {
-    localInvoiceId () {
-      return this.invoiceId || this.$route.params.id
+      invoice: new Invoice()
     }
     }
   },
   },
   mounted() {
   mounted() {
-    this.api = APIGateway.invoice.APIAdresses.byId(this.localInvoiceId)
-    this.mounted = true
+    this.getInvoice()
   },
   },
   methods: {
   methods: {
     getDateTime (dateTime) {
     getDateTime (dateTime) {
@@ -180,24 +125,16 @@ export default {
           this.invoice.loading = false
           this.invoice.loading = false
         })
         })
     },
     },
-    onUpdateServices () {
-      this.$refs.entityEdit.getData()
-    },
-    afterLoadInputData (response) {
-      this.invoice = new Invoice(response)
-      this.entityId = response.id
-      this.entityLoading = false
-    },
-    edit() {
-      this.entityLoading = true
-      this.$refs.entityEdit.editEntity()
-        .then(() => {
-          this.$refs.entityEdit.getData()
-          this.entityLoading = false
+    getInvoice () {
+      this.invoice.loading = true
+      const invoiceId = this.$route.params.id
+      APIGateway.invoice.get({ data: { id: invoiceId } })
+        .then((invoice) => {
+          this.invoice = new Invoice(invoice)
+          this.invoice.loading = false
         })
         })
         .catch(() => {
         .catch(() => {
-          this.$refs.entityEdit.getData()
-          this.entityLoading = false
+          this.invoice.loading = false
         })
         })
     }
     }
   }
   }