pdf result

This commit is contained in:
nurafrinaalimi16
2024-04-29 16:56:53 +08:00
parent 2a7f91199e
commit eac65986a6
8 changed files with 577 additions and 7 deletions
@@ -3,7 +3,7 @@
<div class="panel-body">
<h4>Undian Terkini</h4>
<div class="form-group">
<button class="btn btn-success" v-if="data.election.status == 1 && data.user.role==1"
<button class="btn btn-success" v-if="data.election.status == 1 && data.user.role == 1"
@click="util.showModal('#start-election-modal')">Mula Undian</button>
<router-link :to="{ name: 'Current Result' }" class="btn btn-info" v-if="data.election.status == 2">
@@ -37,6 +37,9 @@
<td>
<router-link :to="{ name: 'Election Result', params: { election_id: election.id } }"
class="btn btn-info">Keputusan Undian</router-link>
<a class="btn btn-warning" :href="getPDFurl(election.id)">Muat Turun PDF</a>
</td>
</tr>
<tr v-if="data.elections.length < 1">
@@ -60,7 +63,8 @@
<div class="modal-body">
<div class="form-group">
<label for="name">Nama Undian</label>
<input type="text" name="name" autocomplete="on" class="form-control" placeholder="(Optional)" />
<input type="text" name="name" autocomplete="on" class="form-control"
placeholder="(Optional)" />
</div>
<div class="form-group">
@@ -91,12 +95,14 @@
<div class="modal-body">
<div class="form-group">
<label for="name">Nama Undian</label>
<input type="text" name="name" :value="data.election.name" autocomplete="on" class="form-control" placeholder="(Optional)" />
<input type="text" name="name" :value="data.election.name" autocomplete="on"
class="form-control" placeholder="(Optional)" />
</div>
<div class="form-group">
<label for="password">Kata Laluan</label>
<input type="password" name="password" autocomplete="on" class="form-control" required />
<input type="password" name="password" autocomplete="on" class="form-control"
required />
</div>
</div>
<div class="modal-footer">
@@ -112,6 +118,12 @@
</div>
</template>
<style>
.center-header {
text-align: center;
}
</style>
<script>
export default {
data: () => ({
@@ -181,6 +193,12 @@ export default {
$.notifyClose();
vm.util.showResult(error, 'error');
})
},
getPDFurl(Id) {
// Construct and return the URL based on the item ID
return `/result/${Id}`;
}
}
}
+92
View File
@@ -0,0 +1,92 @@
<div class="container">
<div class="row">
<div class="col-md-12">
@foreach ($positions as $position)
<h5>{{ $position->name }}</h5>
<div class="table-responsive">
<table class="table table-striped table-condensed">
<thead>
<tr>
<th width="20%">No. Anggota</th>
<th width="30%">Nama</th>
<th width="15%">Unit</th>
<th width="10%">Undian</th>
<th width="15%">Peratus (%)</th>
</tr>
</thead>
<tbody>
@foreach ($results as $result)
@if ($result->position_id == $position->id)
<tr>
<td>{{ $result->nominee->no_anggota }}</td>
<td>{{ $result->nominee->name }}</td>
<td>{{ $result->nominee->unit }}</td>
{{-- <td>{{ $result->votes}}</td> --}}
<td>{{ $result->votes($result->nominee->id) }}</td>
<td>{{ ($result->votes($result->nominee->id) / $total_votes) * 100 }} %</td>
</tr>
@endif
@endforeach
@foreach ($no_votes as $no_vote)
@if ($no_vote->position_id == $position->id)
<tr>
<td>{{ $no_vote->no_anggota }}</td>
<td>{{ $no_vote->name }}</td>
<td>{{ $no_vote->unit }}</td>
<td>0</td>
<td>0</td>
</tr>
@endif
@endforeach
<tr>
<td colspan="3"><b>Jumlah Undian</b></td>
<td><b>{{ $total_votes }}</b></td>
</tr>
</tbody>
</table>
</div>
<hr />
@endforeach
</div>
</div>
</div>
<!-- Verified By column -->
<div class="container mt-4">
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table>
<tbody>
<tr>
<td colspan="4"><b>Disahkan Oleh :</b></td>
</tr>
<tr>
<td><b>...................................</b></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<style>
/* Style for table body */
.table tbody td {
border-bottom: 1px solid #ddd;
padding: 8px;
}
/* Add space between specific columns */
.table tbody td:nth-child(3),
/* Unit column */
.table tbody td:nth-child(4),
/* Undian column */
.table tbody td:nth-child(5) {
/* Peratus (%) column */
padding-right: 20px;
/* Adjust this value as needed */
}
</style>