AdminPaymentList.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <template>
  2. <div class="AdminPaymentList"
  3. :style="localOptions.style">
  4. <entity-index v-if="mounted"
  5. ref="entityIndex"
  6. v-model:value="inputs"
  7. title="لیست پرداخت ها"
  8. :api="api"
  9. :table="table"
  10. :table-keys="tableKeys"
  11. :create-route-name="createRouteName"
  12. :table-grid-size="$q.screen.lt.sm"
  13. :show-search-button="false"
  14. :show-expand-button="false"
  15. :show-reload-button="false">
  16. <template #entity-index-table-cell="{inputData}">
  17. <template v-if="inputData.col.name === 'number'">
  18. {{ inputData.rowNumber }}
  19. </template>
  20. <template v-else-if="inputData.col.name === 'action'">
  21. <q-btn color="primary"
  22. :to="{name: 'Admin.Payment.Show', params: {id: inputData.props.row.id}}">
  23. مشاهده جزییات
  24. </q-btn>
  25. </template>
  26. <template v-else>
  27. {{ inputData.col.value }}
  28. </template>
  29. </template>
  30. <template #entity-index-table-item-cell="{inputData}">
  31. <entity-index-grid-item :input-data="inputData">
  32. <template #col="{col, row}">
  33. <template v-if="col.name === 'number'">
  34. {{ inputData.rowNumber }}
  35. </template>
  36. <template v-else-if="col.name === 'action'">
  37. <q-btn color="primary"
  38. :to="{name: 'Admin.Payment.Show', params: {id: row.id}}">
  39. مشاهده جزییات
  40. </q-btn>
  41. </template>
  42. </template>
  43. </entity-index-grid-item>
  44. </template>
  45. </entity-index>
  46. </div>
  47. </template>
  48. <script>
  49. import { shallowRef } from 'vue'
  50. import Assist from 'assets/js/Assist.js'
  51. import { EntityIndex } from 'quasar-crud'
  52. import { Payment } from 'src/models/Payment.js'
  53. import { mixinWidget } from 'src/mixin/Mixins.js'
  54. import { APIGateway } from 'src/api/APIGateway.js'
  55. import { FormBuilderAssist } from 'quasar-form-builder'
  56. import BtnControl from 'src/components/Control/btn.vue'
  57. import EntityIndexGridItem from 'src/components/EntityIndexGridItem.vue'
  58. const BtnControlComp = shallowRef(BtnControl)
  59. export default {
  60. name: 'AdminPaymentList',
  61. components: { EntityIndex, EntityIndexGridItem },
  62. mixins: [mixinWidget],
  63. data: () => {
  64. return {
  65. api: APIGateway.payment.APIAdresses.base,
  66. tableKeys: {
  67. data: 'results',
  68. total: 'count',
  69. currentPage: 'current',
  70. perPage: 'per_page',
  71. pageKey: 'page'
  72. },
  73. inputs: [
  74. {
  75. type: 'dateTime',
  76. name: 'creation_time__gte',
  77. label: 'از تاریخ',
  78. placeholder: ' ',
  79. col: 'col-md-3 col-12'
  80. },
  81. {
  82. type: 'dateTime',
  83. name: 'creation_time__lt',
  84. label: 'تا تاریخ',
  85. placeholder: ' ',
  86. col: 'col-md-3 col-12'
  87. },
  88. { type: 'select', name: 'type', options: (new Payment()).typeEnums, label: 'نوع تراکنش', placeholder: ' ', col: 'col-md-3 col-12' },
  89. { type: BtnControlComp, name: 'btn', responseKey: 'btn', label: 'جستجو', placeholder: ' ', atClick: () => {}, col: 'col-md-2 col-12' }
  90. ],
  91. table: {
  92. columns: [
  93. {
  94. name: 'number',
  95. required: true,
  96. label: 'شماره',
  97. align: 'left',
  98. field: () => ''
  99. },
  100. {
  101. name: 'id',
  102. required: true,
  103. label: 'شناسه',
  104. align: 'left',
  105. field: row => row.id
  106. },
  107. {
  108. name: 'invoice_info.title',
  109. required: true,
  110. label: 'نام صاحب حساب',
  111. align: 'left',
  112. field: row => row.creator_info?.firstname + ' ' + row.creator_info?.lastname
  113. },
  114. {
  115. name: 'type',
  116. required: true,
  117. label: 'نوع تراکنش',
  118. align: 'left',
  119. field: row => (new Payment(row)).type_info.label
  120. },
  121. {
  122. name: 'amount',
  123. required: true,
  124. label: 'مبلغ تراکنش (ریال)',
  125. align: 'left',
  126. field: row => row.amount.toLocaleString('fa')
  127. },
  128. {
  129. name: 'creation_time',
  130. required: true,
  131. label: 'زمان',
  132. align: 'left',
  133. field: row => Assist.miladiToShamsi(row.creation_time)
  134. },
  135. {
  136. name: 'action',
  137. required: true,
  138. label: 'جزییات',
  139. align: 'left',
  140. field: row => ''
  141. }
  142. ]
  143. },
  144. mounted: false,
  145. createRouteName: ''
  146. }
  147. },
  148. mounted() {
  149. this.setActionBtn()
  150. this.mounted = true
  151. },
  152. methods: {
  153. setActionBtn () {
  154. FormBuilderAssist.setAttributeByName(this.inputs, 'btn', 'atClick', this.search)
  155. },
  156. search () {
  157. this.$refs.entityIndex.search()
  158. }
  159. }
  160. }
  161. </script>
  162. <style scoped lang="scss">
  163. .AdminPaymentList {
  164. .title {
  165. font-style: normal;
  166. font-weight: 700;
  167. font-size: 24px;
  168. line-height: 140%;
  169. color: #424242;
  170. margin-bottom: 27px;
  171. }
  172. :deep(.list) {
  173. .quasar-crud-index-table {
  174. padding: 0;
  175. .q-table__container {
  176. background-color: transparent;
  177. box-shadow: none;
  178. border: none;
  179. .q-table__top {
  180. display: none;
  181. }
  182. }
  183. }
  184. }
  185. }
  186. </style>