ali 3 lat temu
rodzic
commit
56db616d9d

+ 12 - 4
src/components/Widgets/Invoice/InvoiceShow/InvoiceShow.vue

@@ -4,7 +4,8 @@
     <div class="title q-pb-lg">
     <div class="title q-pb-lg">
       <div class="static-title" />
       <div class="static-title" />
       <div class="dynamic-title" />
       <div class="dynamic-title" />
-      <div class="back-action">
+      <div v-if="localOptions.showBackBtn"
+           class="back-action">
         <q-btn flat
         <q-btn flat
                :to="{name: 'UserPanel.Invoice.List'}"
                :to="{name: 'UserPanel.Invoice.List'}"
                color="grey">
                color="grey">
@@ -20,7 +21,7 @@
       <q-card-section>
       <q-card-section>
         صورتحساب شناسه
         صورتحساب شناسه
         {{ invoice.id }}
         {{ invoice.id }}
-        <q-btn v-if="!invoice.loading && invoice.status === 'PAYING'"
+        <q-btn v-if="!invoice.loading && invoice.status === 'PAYING' && localOptions.showNeedInstallmentBtn"
                outline
                outline
                color="primary"
                color="primary"
                class="btn-need-installment"
                class="btn-need-installment"
@@ -128,7 +129,11 @@ export default {
     return {
     return {
       user: new User(),
       user: new User(),
       wallet: new Wallet(),
       wallet: new Wallet(),
-      invoice: new Invoice()
+      invoice: new Invoice(),
+      defaultOptions: {
+        showBackBtn: true,
+        showNeedInstallmentBtn: true
+      }
     }
     }
   },
   },
   mounted() {
   mounted() {
@@ -199,9 +204,12 @@ export default {
           this.depositLoading = false
           this.depositLoading = false
         })
         })
     },
     },
+    getInvoiceId () {
+      return this.localOptions.invoiceId || this.$route.params.id
+    },
     getInvoice () {
     getInvoice () {
       this.invoice.loading = true
       this.invoice.loading = true
-      const invoiceId = this.$route.params.id
+      const invoiceId = this.getInvoiceId()
       APIGateway.invoice.get({ data: { id: invoiceId } })
       APIGateway.invoice.get({ data: { id: invoiceId } })
         .then((invoice) => {
         .then((invoice) => {
           this.invoice = new Invoice(invoice)
           this.invoice = new Invoice(invoice)

+ 20 - 1
src/components/Widgets/Ticket/AdminTicketShow/AdminTicketShow.vue

@@ -105,6 +105,10 @@
       </div>
       </div>
     </q-card>
     </q-card>
 
 
+    <!--    <show-source :source-type="ticket.source_type"-->
+    <!--                 :source-id="ticket.source_id"-->
+    <!--                 :source="ticket.source" />-->
+
     <admin-invoice-show v-if="ticket.source_type === 'INVOICE' && ticket.source_id"
     <admin-invoice-show v-if="ticket.source_type === 'INVOICE' && ticket.source_id"
                         :options="{invoiceId: ticket.source_id, showBackBtn: false}"
                         :options="{invoiceId: ticket.source_id, showBackBtn: false}"
                         class="q-mt-lg" />
                         class="q-mt-lg" />
@@ -139,6 +143,7 @@ import { APIGateway } from 'src/api/APIGateway.js'
 import { FormBuilderAssist } from 'quasar-form-builder'
 import { FormBuilderAssist } from 'quasar-form-builder'
 import { TicketCategoryList } from 'src/models/TicketCategory.js'
 import { TicketCategoryList } from 'src/models/TicketCategory.js'
 import { InstalmentOfferList } from 'src/models/InstalmentOffer.js'
 import { InstalmentOfferList } from 'src/models/InstalmentOffer.js'
+// import ShowSource from 'src/components/Widgets/Ticket/AdminTicketShow/ShowSource.vue'
 import AdminInvoiceShow from 'src/components/Widgets/Invoice/AdminInvoiceShow/AdminInvoiceShow.vue'
 import AdminInvoiceShow from 'src/components/Widgets/Invoice/AdminInvoiceShow/AdminInvoiceShow.vue'
 import InstallmentOffers from 'src/components/Widgets/Ticket/AdminTicketShow/InstallmentOffers.vue'
 import InstallmentOffers from 'src/components/Widgets/Ticket/AdminTicketShow/InstallmentOffers.vue'
 import CreateInstallment from 'src/components/Widgets/Ticket/AdminTicketShow/CreateInstallment.vue'
 import CreateInstallment from 'src/components/Widgets/Ticket/AdminTicketShow/CreateInstallment.vue'
@@ -147,6 +152,7 @@ export default {
   name: 'AdminTicketShow',
   name: 'AdminTicketShow',
   components: {
   components: {
     EntityEdit,
     EntityEdit,
+    // ShowSource,
     AdminInvoiceShow,
     AdminInvoiceShow,
     CreateInstallment,
     CreateInstallment,
     InstallmentOffers
     InstallmentOffers
@@ -167,7 +173,20 @@ export default {
       showRouteName: 'AdminPanel.Ticket.Show',
       showRouteName: 'AdminPanel.Ticket.Show',
       indexRouteName: 'AdminPanel.Ticket.List',
       indexRouteName: 'AdminPanel.Ticket.List',
       inputs: [
       inputs: [
-        { type: 'select', name: 'source_type', responseKey: 'source_type', options: [{ label: 'مالی', value: 'INVOICE' }, { label: 'آموزش', value: 'CLASSROOM' }], label: 'دپارتمان', placeholder: ' ', col: 'col-md-4 col-12' },
+        {
+          type: 'select',
+          name: 'source_type',
+          responseKey: 'category_info.type',
+          options: [
+            { label: 'مالی', value: 'FINANCIAL' },
+            { label: 'آموزش', value: 'EDUCATIONAL' },
+            { label: 'محتوا', value: 'CONTENT' },
+            { label: 'عمومی', value: 'GENERAL' }
+          ],
+          label: 'معاونت',
+          placeholder: ' ',
+          col: 'col-md-4 col-12'
+        },
         { type: 'select', name: 'category', responseKey: 'category', placeholder: ' ', options: [], label: 'دسته', col: 'col-md-4 col-12' },
         { type: 'select', name: 'category', responseKey: 'category', placeholder: ' ', options: [], label: 'دسته', col: 'col-md-4 col-12' },
         { type: 'select', name: 'status', responseKey: 'status', options: (new Ticket()).statusEnums, multiple: false, label: 'وضعیت', placeholder: ' ', col: 'col-md-4 col-12' },
         { type: 'select', name: 'status', responseKey: 'status', options: (new Ticket()).statusEnums, multiple: false, label: 'وضعیت', placeholder: ' ', col: 'col-md-4 col-12' },
         { type: 'input', name: 'title', responseKey: 'title', label: 'عنوان', placeholder: ' ', col: 'col-md-12 col-12' },
         { type: 'input', name: 'title', responseKey: 'title', label: 'عنوان', placeholder: ' ', col: 'col-md-12 col-12' },

+ 90 - 0
src/components/Widgets/Ticket/AdminTicketShow/ShowSource.vue

@@ -0,0 +1,90 @@
+<template>
+  <div class="ShowSource">
+    <admin-invoice-show v-if="sourceType === 'INVOICE' && sourceId"
+                        :options="{invoiceId: sourceId, showBackBtn: false}"
+                        class="q-mt-lg" />
+
+    <!--    <q-card v-if="sourceType === 'INVOICE' && sourceId"-->
+    <!--            class="q-mt-lg">-->
+    <!--      <q-card-section>-->
+    <!--        اقساط-->
+    <!--      </q-card-section>-->
+    <!--      <q-separator />-->
+    <!--      <q-card-section>-->
+    <!--        <installment-offers :installment-offers="instalmentOffers"-->
+    <!--                            :loading="entityLoading"-->
+    <!--                            @onReject="onReject"-->
+    <!--                            @onAccept="onAccept" />-->
+    <!--      </q-card-section>-->
+    <!--      <q-separator />-->
+    <!--      <q-card-section>-->
+    <!--        <create-installment :invoice-id="sourceId"-->
+    <!--                            @onCreated="onCreateInstallmentOffer" />-->
+    <!--      </q-card-section>-->
+    <!--    </q-card>-->
+  </div>
+</template>
+
+<script>
+import Assist from 'src/assets/js/Assist.js'
+import { InstalmentOfferList } from 'src/models/InstalmentOffer.js'
+import AdminInvoiceShow from 'src/components/Widgets/Invoice/AdminInvoiceShow/AdminInvoiceShow.vue'
+
+export default {
+  name: 'ShowSource',
+  components: {
+    AdminInvoiceShow
+  },
+  props: {
+    source: {
+      type: Object,
+      default: null
+    },
+    sourceType: {
+      type: String,
+      default: null
+    },
+    sourceId: {
+      type: Number,
+      default: null
+    }
+  },
+  data: () => {
+    return {
+    }
+  },
+  computed: {
+    instalmentOffers () {
+      return new InstalmentOfferList(this.source?.instalment_offers_info)
+    }
+  },
+  methods: {
+    toShamsi (miladi) {
+      return Assist.miladiToShamsi(miladi, 'jYYYY/jMM/jDD')
+    },
+    create() {
+      this.entityLoading = true
+      this.$refs.entityCreate.createEntity(false)
+        .then(() => {
+          this.entityLoading = false
+          this.$emit('onCreated')
+        })
+        .catch(() => {
+          this.entityLoading = false
+        })
+    },
+    onReject (offer) {
+      this.$emit('onReject', offer)
+    },
+    onAccept (offer) {
+      this.$emit('onAccept', offer)
+    }
+  }
+}
+</script>
+
+<style scoped lang="scss">
+.ShowSource {
+
+}
+</style>

+ 6 - 0
src/components/Widgets/Ticket/TicketShow/TicketShow.vue

@@ -96,6 +96,10 @@
       </div>
       </div>
     </q-card>
     </q-card>
 
 
+    <invoice-show v-if="ticket.source_type === 'INVOICE' && ticket.source_id"
+                  :options="{invoiceId: ticket.source_id, showBackBtn: false, showNeedInstallmentBtn: false}"
+                  class="q-mt-lg" />
+
     <q-card v-if="ticket.source_type === 'INVOICE' && ticket.source_id"
     <q-card v-if="ticket.source_type === 'INVOICE' && ticket.source_id"
             class="q-mt-lg">
             class="q-mt-lg">
       <q-card-section>
       <q-card-section>
@@ -121,12 +125,14 @@ import { APIGateway } from 'src/api/APIGateway.js'
 import { FormBuilderAssist } from 'quasar-form-builder'
 import { FormBuilderAssist } from 'quasar-form-builder'
 import { TicketCategoryList } from 'src/models/TicketCategory.js'
 import { TicketCategoryList } from 'src/models/TicketCategory.js'
 import { InstalmentOfferList } from 'src/models/InstalmentOffer.js'
 import { InstalmentOfferList } from 'src/models/InstalmentOffer.js'
+import InvoiceShow from 'src/components/Widgets/Invoice/InvoiceShow/InvoiceShow.vue'
 import InstallmentOffers from 'src/components/Widgets/Ticket/TicketShow/InstallmentOffers.vue'
 import InstallmentOffers from 'src/components/Widgets/Ticket/TicketShow/InstallmentOffers.vue'
 
 
 export default {
 export default {
   name: 'TicketShow',
   name: 'TicketShow',
   components: {
   components: {
     EntityShow,
     EntityShow,
+    InvoiceShow,
     InstallmentOffers
     InstallmentOffers
   },
   },
   mixins: [mixinWidget],
   mixins: [mixinWidget],

+ 1 - 1
src/pages/Admin/Invoice/Ticket/Show.vue

@@ -13,7 +13,7 @@ export default {
   mixins: [mixinPageOptions],
   mixins: [mixinPageOptions],
   data: () => {
   data: () => {
     return {
     return {
-      sections: [{ data: { rows: [{ cols: [{ widgets: [{ name: 'TicketShow', options: { style: {}, defaultSourceType: { label: 'مالی', value: 'INVOICE' } } }], options: { style: { paddingTop: '124px', paddingBottom: '100px' } } }], options: { className: '', height: 'auto', boxed: true, boxedWidth: 1200, gutterXSize: 'md', gutterYSize: 'md', absolute: 'none', paddingOfBoxedInFullWidth: '30px', style: { maxWidth: '1200px', width: '1200px' } } }] } }]
+      sections: [{ data: { rows: [{ cols: [{ widgets: [{ name: 'AdminTicketShow' }], options: { style: { paddingTop: '124px', paddingBottom: '100px' } } }], options: { className: '', height: 'auto', boxed: true, boxedWidth: 1200, gutterXSize: 'md', gutterYSize: 'md', absolute: 'none', paddingOfBoxedInFullWidth: '30px', style: { maxWidth: '1200px', width: '1200px' } } }] } }]
     }
     }
   },
   },
   created() {
   created() {

+ 1 - 1
src/router/routes.js

@@ -34,7 +34,7 @@ const routes = [
     },
     },
     component: () => import('layouts/MainLayout.vue'),
     component: () => import('layouts/MainLayout.vue'),
     meta: {
     meta: {
-      hasDynamicSetting: false
+      hasDynamicSetting: true
     },
     },
     children: [
     children: [
       {
       {