OverdueInstalments.vue 5.5 KB

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