Show.vue 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <script setup>
  2. import { detailTable } from './config'
  3. import AppPagination from '@/components/AppPagination.vue'
  4. import AppDateRangeFilter from '@/components/AppDateRangeFilter.vue'
  5. import AppSearchFilter from '@/components/AppSearchFilter.vue'
  6. import AppButtonLink from '@/components/AppButtonLink.vue'
  7. import AppResetFilter from '@/components/AppResetFilter.vue'
  8. import DashboardLayout from '@/layouts/Dashboard/DashboardLayout.vue'
  9. defineProps({
  10. initialFilters: Object,
  11. customer: Object,
  12. historyPurchase: {
  13. type: Object,
  14. default: {
  15. data: [],
  16. links: [],
  17. total: 0,
  18. },
  19. },
  20. })
  21. const exportExcel = () => {
  22. return '/customers/history-purchase/excel' + location.search
  23. }
  24. </script>
  25. <template>
  26. <DashboardLayout title="Detail Pembelian">
  27. <div class="grid">
  28. <div class="col-12">
  29. <Card>
  30. <template #title>
  31. <h2 class="text-2xl font-bold">History Pembelian</h2>
  32. </template>
  33. <template #content>
  34. <div class="grid">
  35. <div class="col-12">
  36. <div class="grid">
  37. <div class="col">
  38. <h3 class="text-base">Nama</h3>
  39. <span>{{ customer.name }}</span>
  40. </div>
  41. <div class="col">
  42. <h3 class="text-base">Alamat</h3>
  43. <span>{{ customer.address }}</span>
  44. </div>
  45. <div class="col">
  46. <h3 class="text-base">No HP</h3>
  47. <span>{{ customer.phone }}</span>
  48. </div>
  49. <div class="col">
  50. <h3 class="text-base">NPWP</h3>
  51. <span>{{ customer.npwp }}</span>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. </template>
  57. </Card>
  58. </div>
  59. <div class="col-12">
  60. <DataTable
  61. responsiveLayout="scroll"
  62. :value="historyPurchase.data"
  63. :rowHover="true"
  64. :stripedRows="true"
  65. >
  66. <template #header>
  67. <div class="grid">
  68. <div class="col-12 sm:col-6 lg:col-4">
  69. <AppDateRangeFilter
  70. placeholder="filter waktu..."
  71. :name-param="['start_date', 'end_date']"
  72. :initial-date-rage="initialFilters"
  73. />
  74. </div>
  75. <div class="col-12 sm:col-6 lg:col-4">
  76. <AppSearchFilter
  77. placeholder="Nomor Produk"
  78. name-param="product_number"
  79. :initial-search="initialFilters"
  80. />
  81. </div>
  82. <div class="col-12 sm:col-6 lg:col-4">
  83. <AppResetFilter :url="route('customers.show', customer.id)" />
  84. </div>
  85. <div class="col-12 flex flex-column sm:flex-row">
  86. <AppButtonLink
  87. v-if="historyPurchase.total"
  88. label="Export excel"
  89. class-button="p-button-outlined md:w-16rem"
  90. icon="pi pi-file-excel"
  91. :inertia-link="false"
  92. :href="exportExcel()"
  93. />
  94. </div>
  95. </div>
  96. </template>
  97. <Column
  98. v-for="value in detailTable"
  99. :key="value.field"
  100. :field="value.field"
  101. :header="value.header"
  102. />
  103. <Column>
  104. <template #body="{ data }">
  105. <AppButtonLink
  106. icon="pi pi-chevron-right"
  107. class="p-button-icon-only p-button-rounded p-button-text"
  108. v-tooltip.bottom="'Lihat Detail Penjualan'"
  109. :href="route('customers.history-purchases', data.id)"
  110. />
  111. </template>
  112. </Column>
  113. </DataTable>
  114. </div>
  115. </div>
  116. <AppPagination :links="historyPurchase.links" />
  117. </DashboardLayout>
  118. </template>