pdf maya dan fizikal
This commit is contained in:
@@ -0,0 +1,104 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\App;
|
||||||
|
use App\Voter;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
|
||||||
|
class FizikalController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function index($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
$physicals = $this->getFizikalKehadiran($id);
|
||||||
|
$total_physicals = Voter::where('kehadiran', 1)->count();
|
||||||
|
$votes = Voter::where('election_id', $id)->count();
|
||||||
|
$voters = \App\Voter::where('election_id', $id)->get();
|
||||||
|
|
||||||
|
|
||||||
|
$pdf = App::make('dompdf.wrapper');
|
||||||
|
$pdf->loadView('report.fizikal', compact('physicals', 'voters','total_physicals','votes'));
|
||||||
|
return $pdf->stream();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getFizikalKehadiran($id)
|
||||||
|
{
|
||||||
|
return \App\Voter::where('kehadiran', 1)->get();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\App;
|
||||||
|
use App\Voter;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class MayaController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function index($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
$virtuals = $this->getMayaKehadiran($id);
|
||||||
|
$total_virtuals = Voter::where('kehadiran', 2)->count();
|
||||||
|
$votes = Voter::where('election_id', $id)->count();
|
||||||
|
$voters = \App\Voter::where('election_id', $id)->get();
|
||||||
|
|
||||||
|
|
||||||
|
$pdf = App::make('dompdf.wrapper');
|
||||||
|
$pdf->loadView('report.maya', compact('virtuals', 'voters','total_virtuals','votes'));
|
||||||
|
return $pdf->stream();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getMayaKehadiran($id)
|
||||||
|
{
|
||||||
|
return \App\Voter::where('kehadiran', 2)->get();
|
||||||
|
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 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)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,8 @@
|
|||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<h4>Kedatangan Fizikal</h4>
|
<h4>Kedatangan Fizikal</h4>
|
||||||
|
|
||||||
|
<a class="btn btn-warning" :href="getFizikalPDFurl(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>
|
||||||
@@ -93,16 +95,11 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// downloadPDF() {
|
getFizikalPDFurl(Id) {
|
||||||
// const table = document.getElementById('voterTable');
|
// Construct and return the URL based on the item ID
|
||||||
|
return `/fizikalpdf/${Id}`;
|
||||||
|
},
|
||||||
|
|
||||||
// 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');
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<h4>Kedatangan Maya</h4>
|
<h4>Kedatangan Maya</h4>
|
||||||
|
|
||||||
|
<a class="btn btn-warning" :href="getMayaPDFurl(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>
|
||||||
@@ -93,16 +95,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// downloadPDF() {
|
getMayaPDFurl(Id) {
|
||||||
// const table = document.getElementById('voterTable');
|
// Construct and return the URL based on the item ID
|
||||||
|
return `/mayapdf/1`;
|
||||||
// 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');
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,122 @@
|
|||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<h3>Kehadiran Anggota Koperasi (Fizikal)</h3>
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped table-condensed">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Bil.</th>
|
||||||
|
<th>Nama Anggota</th>
|
||||||
|
<th>No. Kad Pengenalan</th>
|
||||||
|
<th>No. Anggota</th>
|
||||||
|
<th>Unit</th>
|
||||||
|
<th>Kehadiran</th>
|
||||||
|
<th>Tarikh/Masa</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach ($physicals as $physical)
|
||||||
|
<tr>
|
||||||
|
{{-- <td>{{ $index + 1 }}</td> <!-- Display the serial number --> --}}
|
||||||
|
<td>{{ $loop->iteration }}</td>
|
||||||
|
<td>{{ $physical['name'] }}</td>
|
||||||
|
<td>{{ $physical['no_kp'] }}</td>
|
||||||
|
<td>{{ $physical['no_anggota'] }}</td>
|
||||||
|
<td>{{ $physical['unit'] }}</td>
|
||||||
|
<td> @php
|
||||||
|
switch ($physical['kehadiran']) {
|
||||||
|
case 1:
|
||||||
|
echo 'Fizikal';
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
echo 'Maya';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
echo '-';
|
||||||
|
}
|
||||||
|
@endphp</td>
|
||||||
|
<td>{{ $physical['updated_at'] }}</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{{-- @if ($result->position_id == $position->id) --}}
|
||||||
|
|
||||||
|
{{-- @endif --}}
|
||||||
|
@endforeach
|
||||||
|
<tr>
|
||||||
|
<td colspan="2"><b>Peratus Fizikal</b></td>
|
||||||
|
<td><b>{{ ($total_physicals/$votes)*100 }}%</b></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Verified By column -->
|
||||||
|
<div class="container mt-4">
|
||||||
|
<div class ="signature-section row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td colspan="4"><b>Disahkan Oleh :</b></td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
<tr class="table-row">
|
||||||
|
<td><b>...................................</b></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/* Style for table body */
|
||||||
|
.signature-section{
|
||||||
|
margin-top: 80px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-row{
|
||||||
|
margin-top: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.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>
|
||||||
|
|
||||||
|
@push('scripts')
|
||||||
|
<script>
|
||||||
|
// Define the getKehadiranString function here
|
||||||
|
function getKehadiranString(kehadiran) {
|
||||||
|
switch (kehadiran) {
|
||||||
|
case 1:
|
||||||
|
return 'Fizikal';
|
||||||
|
case 2:
|
||||||
|
return 'Maya';
|
||||||
|
default:
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<h3>Kehadiran Anggota Koperasi (Maya)</h3>
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped table-condensed">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Bil.</th>
|
||||||
|
<th>Nama Anggota</th>
|
||||||
|
<th>No. Kad Pengenalan</th>
|
||||||
|
<th>No. Anggota</th>
|
||||||
|
<th>Unit</th>
|
||||||
|
<th>Kehadiran</th>
|
||||||
|
<th>Tarikh/Masa</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach ($virtuals as $virtual)
|
||||||
|
<tr>
|
||||||
|
{{-- <td>{{ $index + 1 }}</td> <!-- Display the serial number --> --}}
|
||||||
|
<td>{{ $loop->iteration }}</td>
|
||||||
|
<td>{{ $virtual['name'] }}</td>
|
||||||
|
<td>{{ $virtual['no_kp'] }}</td>
|
||||||
|
<td>{{ $virtual['no_anggota'] }}</td>
|
||||||
|
<td>{{ $virtual['unit'] }}</td>
|
||||||
|
<td> @php
|
||||||
|
switch ($virtual['kehadiran']) {
|
||||||
|
case 1:
|
||||||
|
echo 'Fizikal';
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
echo 'Maya';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
echo '-';
|
||||||
|
}
|
||||||
|
@endphp</td>
|
||||||
|
<td>{{ $virtual['updated_at'] }}</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{{-- @if ($result->position_id == $position->id) --}}
|
||||||
|
|
||||||
|
{{-- @endif --}}
|
||||||
|
@endforeach
|
||||||
|
<tr>
|
||||||
|
<td colspan="2"><b>Peratus Fizikal</b></td>
|
||||||
|
<td><b>{{ ($total_virtuals/$votes)*100 }}%</b></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Verified By column -->
|
||||||
|
<div class="container mt-4">
|
||||||
|
<div class="row signature-section">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td colspan="4"><b>Disahkan Oleh :</b></td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
<div class="table-row">
|
||||||
|
<tr>
|
||||||
|
<td><b>...................................</b></td>
|
||||||
|
</tr>
|
||||||
|
</div>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/* Style for table body */
|
||||||
|
.signature-section{
|
||||||
|
margin-top: 80px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-row{
|
||||||
|
margin-top: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.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>
|
||||||
@@ -52,8 +52,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Verified By column -->
|
<!-- Verified By column -->
|
||||||
<div class="container mt-4">
|
<div class="container">
|
||||||
<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>
|
||||||
@@ -74,6 +74,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;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use App\Http\Controllers\MayaController;
|
||||||
|
use App\Http\Controllers\FizikalController;
|
||||||
use App\Http\Controllers\KehadiranController;
|
use App\Http\Controllers\KehadiranController;
|
||||||
use App\Http\Controllers\ResultController;
|
use App\Http\Controllers\ResultController;
|
||||||
use App\Result;
|
use App\Result;
|
||||||
@@ -35,5 +37,9 @@ Route::get('/pdftest', function(){
|
|||||||
|
|
||||||
Route::get('/kehadiranpdf/{id}', [KehadiranController::class, 'index']);
|
Route::get('/kehadiranpdf/{id}', [KehadiranController::class, 'index']);
|
||||||
|
|
||||||
|
Route::get('/fizikalpdf/{id}', [FizikalController::class, 'index']);
|
||||||
|
|
||||||
|
Route::get('/mayapdf/{id}', [MayaController::class, 'index']);
|
||||||
|
|
||||||
|
|
||||||
Route::view('/{any}', 'index')->where('any', '.*');
|
Route::view('/{any}', 'index')->where('any', '.*');
|
||||||
|
|||||||
Reference in New Issue
Block a user