update
This commit is contained in:
@@ -13,15 +13,15 @@
|
||||
<i class="fa fa-file-excel-o"></i> Download Full Excel (CSV)
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@foreach (['A', 'B', 'C'] as $tableKey)
|
||||
<div class="table-responsive" style="margin-bottom: 24px;">
|
||||
<h4>TABEL {{ $tableKey }}</h4>
|
||||
<table class="table table-bordered table-sm">
|
||||
<button type="button" class="btn btn-primary" id="btnexporttabel{{ $tableKey }}"><i class="fa fa-print"></i> Export</button>
|
||||
<table class="table table-bordered table-sm" id="tabel{{ $tableKey }}">
|
||||
<thead>
|
||||
<tr>
|
||||
@foreach (($glassHeaders[$tableKey] ?? []) as $header)
|
||||
<th>{{ $header }}</th>
|
||||
<th>{{ $header }}</th>`
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -47,3 +47,39 @@
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@push('script')
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||
<script type="text/javascript">
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
|
||||
document.getElementById('btnexporttabelA').addEventListener('click', function() {
|
||||
var table = document.getElementById('tabelA');
|
||||
if (table) {
|
||||
var wb = XLSX.utils.table_to_book(table, { sheet: "Bakteri" });
|
||||
XLSX.writeFile(wb, "TABEL_A_{{$bulan}}_Tahun{{$tahun}}.xlsx");
|
||||
} else {
|
||||
console.error('Tabel dengan ID "tabelA" tidak ditemukan.');
|
||||
}
|
||||
});
|
||||
document.getElementById('btnexporttabelB').addEventListener('click', function() {
|
||||
var table = document.getElementById('tabelB');
|
||||
if (table) {
|
||||
var wb = XLSX.utils.table_to_book(table, { sheet: "Jamur" });
|
||||
XLSX.writeFile(wb, "TABEL_B_{{$bulan}}_Tahun{{$tahun}}.xlsx");
|
||||
} else {
|
||||
console.error('Tabel dengan ID "tabelB" tidak ditemukan.');
|
||||
}
|
||||
});
|
||||
document.getElementById('btnexporttabelC').addEventListener('click', function() {
|
||||
var table = document.getElementById('tabelC');
|
||||
if (table) {
|
||||
var wb = XLSX.utils.table_to_book(table, { sheet: "No Growth" });
|
||||
XLSX.writeFile(wb, "TABEL_C_{{$bulan}}_Tahun{{$tahun}}.xlsx");
|
||||
} else {
|
||||
console.error('Tabel dengan ID "tabelC" tidak ditemukan.');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
Reference in New Issue
Block a user