TransactionList.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <div class="TransactionList"
  3. :style="localOptions.style">
  4. <div class="title">
  5. لیست تراکنش ها
  6. </div>
  7. <q-card class="list"
  8. flat>
  9. <entity-index v-if="mounted"
  10. v-model:value="inputs"
  11. title=""
  12. :api="api"
  13. :table="table"
  14. :table-keys="tableKeys"
  15. :create-route-name="createRouteName"
  16. :show-search-button="false"
  17. :show-expand-button="false"
  18. :show-reload-button="false"
  19. :default-layout="false">
  20. <template #entity-index-table-cell="{inputData}">
  21. <template v-if="inputData.col.name === 'action'">
  22. <q-btn flat
  23. color="primary"
  24. :to="{name: 'UserPanel.Invoice.Show', params: {id: inputData.props.row.id}}">
  25. مشاهده جزییات
  26. </q-btn>
  27. </template>
  28. <template v-else>
  29. {{ inputData.col.value }}
  30. </template>
  31. </template>
  32. </entity-index>
  33. </q-card>
  34. </div>
  35. </template>
  36. <script>
  37. import Assist from 'assets/js/Assist.js'
  38. import { EntityIndex } from 'quasar-crud'
  39. import { Invoice } from 'src/models/Invoice.js'
  40. import { mixinWidget } from 'src/mixin/Mixins.js'
  41. import { APIGateway } from 'src/api/APIGateway.js'
  42. export default {
  43. name: 'TransactionList',
  44. components: { EntityIndex },
  45. mixins: [mixinWidget],
  46. data: () => {
  47. return {
  48. api: APIGateway.invoice.APIAdresses.base,
  49. tableKeys: {
  50. data: 'results',
  51. total: 'count',
  52. currentPage: 'current',
  53. perPage: 'per_page',
  54. pageKey: 'page'
  55. },
  56. inputs: [],
  57. table: {
  58. columns: [
  59. {
  60. name: 'id',
  61. required: true,
  62. label: 'صورت‌حساب',
  63. align: 'left',
  64. field: row => row.id
  65. },
  66. {
  67. name: 'title',
  68. required: true,
  69. label: 'پکیج یا خدمت',
  70. align: 'left',
  71. field: row => row.title
  72. },
  73. {
  74. name: 'creation_time',
  75. required: true,
  76. label: 'تاریخ صورت‌حساب',
  77. align: 'left',
  78. field: row => Assist.miladiToShamsi(row.creation_time)
  79. },
  80. {
  81. name: 'creation_time',
  82. required: true,
  83. label: 'تاریخ سررسید',
  84. align: 'left',
  85. field: row => Assist.miladiToShamsi(row.creation_time)
  86. },
  87. {
  88. name: 'amount',
  89. required: true,
  90. label: 'کل',
  91. align: 'left',
  92. field: row => row.amount.toLocaleString('fa')
  93. },
  94. {
  95. name: 'status',
  96. required: true,
  97. label: 'وضعیت',
  98. align: 'left',
  99. field: row => (new Invoice(row)).status_info.label
  100. },
  101. {
  102. name: 'action',
  103. required: true,
  104. label: 'جزییات',
  105. align: 'left',
  106. field: row => ''
  107. }
  108. ]
  109. },
  110. mounted: false,
  111. createRouteName: ''
  112. }
  113. },
  114. mounted() {
  115. this.mounted = true
  116. }
  117. }
  118. </script>
  119. <style scoped lang="scss">
  120. .TransactionList {
  121. .title {
  122. font-style: normal;
  123. font-weight: 700;
  124. font-size: 24px;
  125. line-height: 140%;
  126. color: #424242;
  127. margin-bottom: 27px;
  128. }
  129. :deep(.list) {
  130. .quasar-crud-index-table {
  131. padding: 0;
  132. .q-table__container {
  133. background-color: transparent;
  134. box-shadow: none;
  135. border: none;
  136. .q-table__top {
  137. display: none;
  138. }
  139. }
  140. }
  141. }
  142. }
  143. </style>