Merge branch 'backup' of https://gitlab.com/erahn/voting into hotfix/pdf

This commit is contained in:
nurafrinaalimi16
2025-04-20 11:07:03 +08:00
5 changed files with 49 additions and 38 deletions
+7 -11
View File
@@ -16,25 +16,21 @@ class KehadiranController extends Controller
public function index($id) public function index($id)
{ {
// //
$kehadiranAll = $this->getKehadiranAll($id);
$totalkehadiranAll = Voter::where('kehadiran','!=', 0)->count();
$votes = Voter::where('election_id', $id)->count();
$voters = \App\Voter::where('election_id', $id)->get(); $voters = \App\Voter::where('election_id', $id)->get();
$pdf = App::make('dompdf.wrapper'); $pdf = App::make('dompdf.wrapper');
$pdf->loadView('report.kehadiran-pdf', compact('voters')); $pdf->loadView('report.kehadiran-pdf', compact('voters', 'kehadiranAll', 'totalkehadiranAll', 'votes'));
return $pdf->stream(); return $pdf->stream();
} }
protected function getKehadiranString($kehadiran) private function getKehadiranAll($id)
{ {
// Map integer values to corresponding string representations return \App\Voter::where('kehadiran','!=', 0)->get();
switch ($kehadiran) {
case 1:
return 'Fizikal';
case 2:
return 'Maya';
default:
return '-';
}
} }
/** /**
@@ -5,21 +5,20 @@
<i class="fa fa-refresh"></i> Kemaskini Pengundi <i class="fa fa-refresh"></i> Kemaskini Pengundi
</button> </button>
<router-link class="btn btn-info" :to="{ name: 'Fizikal' }" > <router-link class="btn btn-info" :to="{ name: 'Fizikal' }">
Fizikal Fizikal
</router-link> </router-link>
<router-link class="btn btn-info" :to="{ name: 'Maya' }" > <router-link class="btn btn-info" :to="{ name: 'Maya' }">
Maya Maya
</router-link> </router-link>
<!-- <a class="btn btn-warning" :href="getPDFKehadiranurl()">Muat Turun PDF</a> -->
<!-- <button class="btn btn-primary" @click="downloadPDF()"> <a class="pdf-button-container btn btn-warning" :href="getPDFKehadiranurl(1)"><i class="fa fa-download"></i> Muat Turun PDF</a>
<i class="fa fa-download"></i> Muat Turun PDF
</button> -->
<!-- <a class="btn btn-warning" :href="getPDFKehadiranurl(1)">Muat Turun PDF</a> -->
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-hover"> <table class="table table-hover">
<thead> <thead>
@@ -65,6 +64,12 @@
</div> </div>
</template> </template>
<style>
.pdf-button-container {
text-align: right;
}
</style>
<script> <script>
export default { export default {
@@ -110,6 +115,11 @@ export default {
} }
}, },
getPDFKehadiranurl(Id) {
// Construct and return the URL based on the item ID
return `/kehadiranpdf/${Id}`;
}
}, },
@@ -154,10 +164,7 @@ export default {
return totalMembers === 0 ? 0 : ((totalAttendance / totalMembers) * 100).toFixed(2); return totalMembers === 0 ? 0 : ((totalAttendance / totalMembers) * 100).toFixed(2);
}, },
getPDFKehadiranurl() {
// Construct and return the URL based on the item ID
return `/kehadiranpdf/1`;
}
} }
} }
@@ -20,7 +20,7 @@
</router-link> </router-link>
<router-link :to="{name: 'Mat'}" tag="li" exact> <router-link :to="{name: 'Mat'}" tag="li" exact>
<a href="#"><b>MAT KE-27</b></a> <a href="#"><b>MAT KE-28</b></a>
</router-link> </router-link>
<router-link :to="{name: 'Attendance'}" tag="li" exact> <router-link :to="{name: 'Attendance'}" tag="li" exact>
@@ -32,7 +32,7 @@
</router-link> </router-link>
<router-link :to="{name: 'Zoom'}" v-if="data.user.kehadiran != 0" tag="li" exact> <router-link :to="{name: 'Zoom'}" v-if="data.user.kehadiran != 0" tag="li" exact>
<a href="#"><b>PAUTAN ZOOM</b></a> <a href="#"><b>PAUTAN MESYUARAT</b></a>
</router-link> </router-link>
<!-- <router-link :to="{name: 'Result'}" v-if="data.election.status==2 && hasVoted()" tag="li"> <!-- <router-link :to="{name: 'Result'}" v-if="data.election.status==2 && hasVoted()" tag="li">
+10 -2
View File
@@ -1,7 +1,7 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<h5>Kehadiran Anggota Koperasi</h5> <h3>Kehadiran Anggota Koperasi</h3>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped table-condensed"> <table class="table table-striped table-condensed">
<thead> <thead>
@@ -43,6 +43,10 @@
{{-- @endif --}} {{-- @endif --}}
@endforeach @endforeach
<tr>
<td colspan="2"><b>Peratus Kehadiran</b></td>
<td><b>{{ ($totalkehadiranAll / $votes) * 100 }}%</b></td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>
@@ -54,7 +58,7 @@
<!-- Verified By column --> <!-- Verified By column -->
<div class="container mt-4"> <div class="container mt-4">
<div class="row"> <div class="signature-section row">
<div class="col-md-12"> <div class="col-md-12">
<div class="table-responsive"> <div class="table-responsive">
<table> <table>
@@ -75,6 +79,10 @@
<style> <style>
/* Style for table body */ /* Style for table body */
.signature-section{
margin-top: 80px;
}
.table tbody td { .table tbody td {
border-bottom: 1px solid #ddd; border-bottom: 1px solid #ddd;
padding: 8px; padding: 8px;
+8 -8
View File
@@ -45,7 +45,7 @@
@endforeach @endforeach
<tr> <tr>
<td colspan="2"><b>Peratus Fizikal</b></td> <td colspan="2"><b>Peratus Fizikal</b></td>
<td><b>{{ ($total_virtuals/$votes)*100 }}%</b></td> <td><b>{{ ($total_virtuals / $votes) * 100 }}%</b></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@@ -67,11 +67,11 @@
<td colspan="4"><b>Disahkan Oleh :</b></td> <td colspan="4"><b>Disahkan Oleh :</b></td>
</tr> </tr>
<div class="table-row">
<tr> <tr>
<td><b>...................................</b></td> <td><b>...................................</b></td>
</tr> </tr>
</div>
</tbody> </tbody>
</table> </table>
</div> </div>
@@ -81,11 +81,11 @@
<style> <style>
/* Style for table body */ /* Style for table body */
.signature-section{ .signature-section {
margin-top: 80px; margin-top: 80px;
} }
.table-row{ .table-row {
margin-top: 50px; margin-top: 50px;
} }