Report.vue 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <script setup>
  2. import { reportTable } from './config'
  3. import AppFilterDateRange from '@/components/AppFilterDateRange.vue'
  4. import AppButtonLink from '@/components/AppButtonLink.vue'
  5. import AppPagination from '@/components/AppPagination.vue'
  6. import DashboardLayout from '@/layouts/Dashboard/DashboardLayout.vue'
  7. defineProps({
  8. filters: Object,
  9. sales: {
  10. type: Object,
  11. default: {
  12. data: [],
  13. links: [],
  14. total: 0,
  15. },
  16. },
  17. })
  18. const exportExcel = () => {
  19. return `/sales/excel/report${location.search}`
  20. }
  21. </script>
  22. <template>
  23. <DashboardLayout title="Laporan Penjualan">
  24. <DataTable
  25. responsive-layout="scroll"
  26. column-resize-mode="expand"
  27. :value="sales.data"
  28. :rowHover="true"
  29. :stripedRows="true"
  30. >
  31. <template #header>
  32. <h1>Laporan Penjualan</h1>
  33. <div class="grid">
  34. <div class="col-12 sm:col-6 lg:col-4">
  35. <AppFilterDateRange
  36. placeholder="filter waktu..."
  37. refresh-data="sales"
  38. :initial-filter="filters"
  39. />
  40. </div>
  41. <div class="col-12">
  42. <AppButtonLink
  43. v-if="sales.total"
  44. label="Export excel"
  45. class-button="p-button-outlined md:w-16rem"
  46. icon="pi pi-file-excel"
  47. :inertia-link="false"
  48. :href="exportExcel()"
  49. />
  50. </div>
  51. </div>
  52. </template>
  53. <Column
  54. v-for="value in reportTable"
  55. :field="value.field"
  56. :header="value.header"
  57. :key="value.field"
  58. />
  59. </DataTable>
  60. <AppPagination :links="sales.links" />
  61. </DashboardLayout>
  62. </template>