| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
- <template>
- <div class="AdminPaymentList"
- :style="localOptions.style">
- <entity-index v-if="mounted"
- ref="entityIndex"
- v-model:value="inputs"
- title="لیست ۲پرداخت ها"
- :api="api"
- :table="table"
- :table-keys="tableKeys"
- :create-route-name="createRouteName"
- :table-grid-size="$q.screen.lt.sm"
- :show-search-button="false"
- :show-expand-button="false"
- :show-reload-button="false">
- <template #toolbar>
- <q-btn color="primary"
- :loading="exportReportLoading"
- @click="getPaymentsListExcel">
- دریافت
- </q-btn>
- </template>
- <template #entity-index-table-cell="{inputData}">
- <template v-if="inputData.col.name === 'number'">
- {{ inputData.rowNumber }}
- </template>
- <template v-else-if="inputData.col.name === 'action'">
- <q-btn color="primary"
- :to="{name: 'Admin.Payment.Show', params: {id: inputData.props.row.id}}">
- مشاهده جزییات
- </q-btn>
- </template>
- <template v-else>
- {{ inputData.col.value }}
- </template>
- </template>
- <template #entity-index-table-item-cell="{inputData}">
- <entity-index-grid-item :input-data="inputData">
- <template #col="{col, row}">
- <template v-if="col.name === 'number'">
- {{ inputData.rowNumber }}
- </template>
- <template v-else-if="col.name === 'action'">
- <q-btn color="primary"
- :to="{name: 'Admin.Payment.Show', params: {id: row.id}}">
- مشاهده جزییات
- </q-btn>
- </template>
- </template>
- </entity-index-grid-item>
- </template>
- </entity-index>
- </div>
- </template>
- <script>
- import { shallowRef } from 'vue'
- import Assist from 'assets/js/Assist.js'
- import { EntityIndex } from 'quasar-crud'
- import { Payment } from 'src/models/Payment.js'
- import { mixinWidget } from 'src/mixin/Mixins.js'
- import { APIGateway } from 'src/api/APIGateway.js'
- import { FormBuilderAssist } from 'quasar-form-builder'
- import BtnControl from 'src/components/Control/btn.vue'
- import EntityIndexGridItem from 'src/components/EntityIndexGridItem.vue'
- import FormBuilderDateTime from 'src/components/FormBuilderCustumComponents/FormBuilderDateTime.vue'
- const BtnControlComp = shallowRef(BtnControl)
- const FormBuilderDateTimeComp = shallowRef(FormBuilderDateTime)
- export default {
- name: 'AdminPaymentList',
- components: { EntityIndex, EntityIndexGridItem },
- mixins: [mixinWidget],
- data: () => {
- return {
- api: APIGateway.payment.APIAdresses.base,
- tableKeys: {
- data: 'results',
- total: 'count',
- currentPage: 'current',
- perPage: 'per_page',
- pageKey: 'page'
- },
- inputs: [
- {
- type: FormBuilderDateTimeComp,
- name: 'creation_time__gte',
- outsideLabel: 'از تاریخ',
- col: 'col-md-3 col-12'
- },
- {
- type: FormBuilderDateTimeComp,
- name: 'creation_time__lt',
- outsideLabel: 'تا تاریخ',
- col: 'col-md-3 col-12'
- },
- { type: 'select', name: 'type', options: (new Payment()).typeEnums, label: 'نوع۲ تراکنش', placeholder: ' ', col: 'col-md-3 col-12' },
- { type: 'input', name: 'search', value: null, col: 'col-md-3 col-12', label: 'جست و جو', placeholder: ' ' },
- { type: BtnControlComp, name: 'btn', responseKey: 'btn', label: 'جستجو', placeholder: ' ', atClick: () => {}, col: 'col-md-2 col-12' }
- ],
- table: {
- columns: [
- {
- name: 'number',
- required: true,
- label: 'شماره',
- align: 'left',
- field: () => ''
- },
- {
- name: 'id',
- required: true,
- label: 'شناسه',
- align: 'left',
- field: row => row.id
- },
- {
- name: 'invoice_info.title',
- required: true,
- label: 'نام صاحب حساب',
- align: 'left',
- field: row => row.wallet_info?.owner_info?.firstname + ' ' + row.wallet_info?.owner_info?.lastname
- },
- {
- name: 'type',
- required: true,
- label: 'عنوان',
- align: 'left',
- field: row => row.title
- },
- {
- name: 'amount',
- required: true,
- label: 'مبلغ تراکنش (ریال)',
- align: 'left',
- field: row => row.amount.toLocaleString('fa')
- },
- {
- name: 'creation_time',
- required: true,
- label: 'زمان',
- align: 'left',
- field: row => Assist.miladiToShamsi(row.creation_time)
- },
- {
- name: 'action',
- required: true,
- label: 'جزییات',
- align: 'left',
- field: row => ''
- }
- ]
- },
- mounted: false,
- exportReportLoading: false,
- createRouteName: ''
- }
- },
- mounted() {
- this.setActionBtn()
- this.mounted = true
- },
- methods: {
- setActionBtn () {
- FormBuilderAssist.setAttributeByName(this.inputs, 'btn', 'atClick', this.search)
- },
- search () {
- this.$refs.entityIndex.search()
- },
- getPaymentsListExcel () {
- this.exportReportLoading = true
- const filter = this.$refs.entityIndex.createParams()
- filter.report_type = 'payments_list'
- APIGateway.payment.exportPaymentReport(filter)
- .then((xlsxData) => {
- // Assist.saveXlsx(xlsxData, this.classroomId)
- Assist.saveXlsx(xlsxData, 'پرداخت ها')
- this.exportReportLoading = false
- })
- .catch((e) => {
- this.exportReportLoading = false
- })
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .AdminPaymentList {
- .title {
- font-style: normal;
- font-weight: 700;
- font-size: 24px;
- line-height: 140%;
- color: #424242;
- margin-bottom: 27px;
- }
- :deep(.list) {
- .quasar-crud-index-table {
- padding: 0;
- .q-table__container {
- background-color: transparent;
- box-shadow: none;
- border: none;
- .q-table__top {
- display: none;
- }
- }
- }
- }
- }
- </style>
|