diff --git a/app/Http/Controllers/KehadiranController.php b/app/Http/Controllers/KehadiranController.php
new file mode 100644
index 0000000..4621538
--- /dev/null
+++ b/app/Http/Controllers/KehadiranController.php
@@ -0,0 +1,105 @@
+get();
+
+
+ $pdf = App::make('dompdf.wrapper');
+ $pdf->loadView('report.kehadiran-pdf', compact('voters'));
+ return $pdf->stream();
+ }
+
+ protected function getKehadiranString($kehadiran)
+ {
+ // Map integer values to corresponding string representations
+ switch ($kehadiran) {
+ case 1:
+ return 'Fizikal';
+ case 2:
+ return 'Maya';
+ default:
+ return '-';
+ }
+ }
+
+ /**
+ * Show the form for creating a new resource.
+ *
+ * @return \Illuminate\Http\Response
+ */
+ public function create()
+ {
+ //
+ }
+
+ /**
+ * Store a newly created resource in storage.
+ *
+ * @param \Illuminate\Http\Request $request
+ * @return \Illuminate\Http\Response
+ */
+ public function store(Request $request)
+ {
+ //
+ }
+
+ /**
+ * Display the specified resource.
+ *
+ * @param int $id
+ * @return \Illuminate\Http\Response
+ */
+ public function show($id)
+ {
+ //
+ }
+
+ /**
+ * Show the form for editing the specified resource.
+ *
+ * @param int $id
+ * @return \Illuminate\Http\Response
+ */
+ public function edit($id)
+ {
+ //
+ }
+
+ /**
+ * Update the specified resource in storage.
+ *
+ * @param \Illuminate\Http\Request $request
+ * @param int $id
+ * @return \Illuminate\Http\Response
+ */
+ public function update(Request $request, $id)
+ {
+ //
+ }
+
+ /**
+ * Remove the specified resource from storage.
+ *
+ * @param int $id
+ * @return \Illuminate\Http\Response
+ */
+ public function destroy($id)
+ {
+ //
+ }
+}
diff --git a/resources/assets/js/components/demo/admin/voter/kehadiran.vue b/resources/assets/js/components/demo/admin/voter/kehadiran.vue
index fc71bb3..eb877d2 100644
--- a/resources/assets/js/components/demo/admin/voter/kehadiran.vue
+++ b/resources/assets/js/components/demo/admin/voter/kehadiran.vue
@@ -13,6 +13,8 @@
Maya
+
+
@@ -108,17 +110,7 @@ export default {
}
},
- // downloadPDF() {
- // const table = document.getElementById('voterTable');
-
- // html2canvas(table).then(canvas => {
- // const imgData = canvas.toDataURL('image/png');
- // const pdf = new jsPDF();
- // pdf.addImage(imgData, 'PNG', 0, 0);
- // pdf.save('kehadiran-pengundi.pdf');
- // });
- // },
-
+
},
watch: {
@@ -160,6 +152,11 @@ export default {
const totalAttendance = fizikalCount + mayaCount;
const totalMembers = this.data.voters.data.length;
return totalMembers === 0 ? 0 : ((totalAttendance / totalMembers) * 100).toFixed(2);
+ },
+
+ getPDFKehadiranurl() {
+ // Construct and return the URL based on the item ID
+ return `/kehadiranpdf/1`;
}
}
diff --git a/resources/views/report/kehadiran-pdf.blade.php b/resources/views/report/kehadiran-pdf.blade.php
new file mode 100644
index 0000000..cec1096
--- /dev/null
+++ b/resources/views/report/kehadiran-pdf.blade.php
@@ -0,0 +1,109 @@
+
+
+
+
Kehadiran Anggota Koperasi
+
+
+
+
+ | Bil. |
+ Nama Anggota |
+ No. Kad Pengenalan |
+ No. Anggota |
+ Unit |
+ Kehadiran |
+ Tarikh/Masa |
+
+
+
+ @foreach ($voters as $voter)
+
+ {{-- | {{ $index + 1 }} | --}}
+ {{ $loop->iteration }} |
+ {{ $voter['name'] }} |
+ {{ $voter['no_kp'] }} |
+ {{ $voter['no_anggota'] }} |
+ {{ $voter['unit'] }} |
+ @php
+ switch ($voter['kehadiran']) {
+ case 1:
+ echo 'Fizikal';
+ break;
+ case 2:
+ echo 'Maya';
+ break;
+ default:
+ echo '-';
+ }
+ @endphp |
+ {{ $voter['updated_at'] }} |
+
+
+ {{-- @if ($result->position_id == $position->id) --}}
+
+ {{-- @endif --}}
+ @endforeach
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | Disahkan Oleh : |
+
+
+
+ | ................................... |
+
+
+
+
+
+
+
+
+
+
+@push('scripts')
+
+@endpush