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)
{
//
$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();
$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();
}
protected function getKehadiranString($kehadiran)
private function getKehadiranAll($id)
{
// Map integer values to corresponding string representations
switch ($kehadiran) {
case 1:
return 'Fizikal';
case 2:
return 'Maya';
default:
return '-';
}
return \App\Voter::where('kehadiran','!=', 0)->get();
}
/**
@@ -5,21 +5,20 @@
<i class="fa fa-refresh"></i> Kemaskini Pengundi
</button>
<router-link class="btn btn-info" :to="{ name: 'Fizikal' }" >
Fizikal
<router-link class="btn btn-info" :to="{ name: 'Fizikal' }">
Fizikal
</router-link>
<router-link class="btn btn-info" :to="{ name: 'Maya' }" >
Maya
<router-link class="btn btn-info" :to="{ name: 'Maya' }">
Maya
</router-link>
<!-- <a class="btn btn-warning" :href="getPDFKehadiranurl()">Muat Turun PDF</a> -->
<!-- <button class="btn btn-primary" @click="downloadPDF()">
<i class="fa fa-download"></i> Muat Turun PDF
</button> -->
<a class="pdf-button-container btn btn-warning" :href="getPDFKehadiranurl(1)"><i class="fa fa-download"></i> Muat Turun PDF</a>
<!-- <a class="btn btn-warning" :href="getPDFKehadiranurl(1)">Muat Turun PDF</a> -->
<div class="table-responsive">
<table class="table table-hover">
<thead>
@@ -65,6 +64,12 @@
</div>
</template>
<style>
.pdf-button-container {
text-align: right;
}
</style>
<script>
export default {
@@ -110,7 +115,12 @@ export default {
}
},
getPDFKehadiranurl(Id) {
// Construct and return the URL based on the item ID
return `/kehadiranpdf/${Id}`;
}
},
watch: {
@@ -154,10 +164,7 @@ export default {
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 :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 :to="{name: 'Attendance'}" tag="li" exact>
@@ -32,7 +32,7 @@
</router-link>
<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 :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="row">
<div class="col-md-12">
<h5>Kehadiran Anggota Koperasi</h5>
<h3>Kehadiran Anggota Koperasi</h3>
<div class="table-responsive">
<table class="table table-striped table-condensed">
<thead>
@@ -43,6 +43,10 @@
{{-- @endif --}}
@endforeach
<tr>
<td colspan="2"><b>Peratus Kehadiran</b></td>
<td><b>{{ ($totalkehadiranAll / $votes) * 100 }}%</b></td>
</tr>
</tbody>
</table>
</div>
@@ -54,7 +58,7 @@
<!-- Verified By column -->
<div class="container mt-4">
<div class="row">
<div class="signature-section row">
<div class="col-md-12">
<div class="table-responsive">
<table>
@@ -75,6 +79,10 @@
<style>
/* Style for table body */
.signature-section{
margin-top: 80px;
}
.table tbody td {
border-bottom: 1px solid #ddd;
padding: 8px;
+8 -8
View File
@@ -45,7 +45,7 @@
@endforeach
<tr>
<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>
</tbody>
</table>
@@ -67,11 +67,11 @@
<td colspan="4"><b>Disahkan Oleh :</b></td>
</tr>
<div class="table-row">
<tr>
<td><b>...................................</b></td>
</tr>
</div>
<tr>
<td><b>...................................</b></td>
</tr>
</tbody>
</table>
</div>
@@ -81,11 +81,11 @@
<style>
/* Style for table body */
.signature-section{
.signature-section {
margin-top: 80px;
}
.table-row{
.table-row {
margin-top: 50px;
}