Browse Source

update datatable dan perbaikan halaman

master
Gunawan19621 1 year ago
parent
commit
2d9a9e34d0
  1. 1
      app/Http/Controllers/HomeController.php
  2. 3
      resources/views/dashboard/Disposal/index.blade.php
  3. 6
      resources/views/dashboard/History/Peminjaman/index.blade.php
  4. 1
      resources/views/dashboard/History/Pengembalian/index.blade.php
  5. 11
      resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/index.blade.php
  6. 6
      resources/views/dashboard/Master_Data/Report/Pattern_lot_peti/index.blade.php
  7. 6
      resources/views/dashboard/Peminjaman/index.blade.php
  8. 1
      resources/views/dashboard/Pengembalian/index.blade.php
  9. 231
      resources/views/dashboard/index.blade.php
  10. 4
      resources/views/pages/layouts/sidebar_user.blade.php
  11. 79
      resources/views/pages/user/Master_Data/Manajemen_Peti/Peti/index.blade.php
  12. 9
      resources/views/pages/user/dashboard/disposal/index.blade.php
  13. 3
      resources/views/profil/profil.blade.php

1
app/Http/Controllers/HomeController.php

@ -91,6 +91,7 @@ class HomeController extends Controller
return compact('years', 'exitData', 'enterData', 'monthNames');
}
//data pertahun untuk pie chart
public function generateChartDataPie()
{
$years = [];

3
resources/views/dashboard/Disposal/index.blade.php

@ -21,7 +21,6 @@
<a href="{{ route('dashboard.disposal.create') }}" class="btn btn-success btn-icon-split">
<span class="text">Disposal Peti</span>
</a>
</a>
</div>
</div>
</div>
@ -48,7 +47,7 @@
<td>{{ $nodisposal++ }}</td>
<td>{{ optional($data_disposal->peti)->fix_lot }}</td>
<td>{{ optional($data_disposal->customer)->name }}</td>
<td>{{ \Carbon\Carbon::parse($data_disposal->date_disposal)->format('d/m/Y') }}</td>
<td>{{ \Carbon\Carbon::parse($data_disposal->date_disposal)->format('d-m-Y') }}</td>
<td>{{ $data_disposal->description }}</td>
{{-- <td>{{ $data_disposal->status_disposal }}</td> --}}
<td class="text-center">

6
resources/views/dashboard/History/Peminjaman/index.blade.php

@ -29,12 +29,6 @@
<option value="25" {{ request('perPage', 5) == '25' ? 'selected' : '' }}>25</option>
<option value="50" {{ request('perPage', 5) == '50' ? 'selected' : '' }}>50</option>
<option value="100" {{ request('perPage', 5) == '100' ? 'selected' : '' }}>100</option>
<option value="500" {{ request('perPage', 5) == '500' ? 'selected' : '' }}>500</option>
<option value="1000" {{ request('perPage', 5) == '1000' ? 'selected' : '' }}>1000</option>
<option value="2500" {{ request('perPage', 5) == '2500' ? 'selected' : '' }}>2500
</option>
<option value="5000" {{ request('perPage', 5) == '5000' ? 'selected' : '' }}>5000
</option>
<option value="{{ $peminjaman->total() }}"
{{ request('perPage', 5) == $peminjaman->total() ? 'selected' : '' }}>Semua</option>
</select>

1
resources/views/dashboard/History/Pengembalian/index.blade.php

@ -29,7 +29,6 @@
<option value="25" {{ request('perPage', 5) == '25' ? 'selected' : '' }}>25</option>
<option value="50" {{ request('perPage', 5) == '50' ? 'selected' : '' }}>50</option>
<option value="100" {{ request('perPage', 5) == '100' ? 'selected' : '' }}>100</option>
<option value="500" {{ request('perPage', 5) == '500' ? 'selected' : '' }}>500</option>
<option value="{{ $peminjaman->total() }}"
{{ request('perPage', 5) == $peminjaman->total() ? 'selected' : '' }}>Semua</option>
</select>

11
resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/index.blade.php

@ -53,13 +53,6 @@
<option value="25" {{ request('perPage', 5) == '25' ? 'selected' : '' }}>25</option>
<option value="50" {{ request('perPage', 5) == '50' ? 'selected' : '' }}>50</option>
<option value="100" {{ request('perPage', 5) == '100' ? 'selected' : '' }}>100</option>
<option value="500" {{ request('perPage', 5) == '500' ? 'selected' : '' }}>500</option>
<option value="1000" {{ request('perPage', 5) == '1000' ? 'selected' : '' }}>1000
</option>
<option value="2500" {{ request('perPage', 5) == '2500' ? 'selected' : '' }}>2500
</option>
<option value="5000" {{ request('perPage', 5) == '5000' ? 'selected' : '' }}>5000
</option>
<option value="{{ $peti->total() }}"
{{ request('perPage', 5) == $peti->total() ? 'selected' : '' }}>Semua</option>
</select>
@ -122,8 +115,8 @@
<a href="{{ route('dashboard.peti.edit', [$data_peti->id]) }}">
<i class="fa fa-edit mr-2" style="font-size: 20px"></i>
</a>
<form action="{{ route('dashboard.peti.destroy', $data_peti->id) }}"
method="POST" style="display: inline;">
<form action="{{ route('dashboard.peti.destroy', $data_peti->id) }}" method="POST"
style="display: inline;">
@csrf
@method('DELETE')
<button type="submit"

6
resources/views/dashboard/Master_Data/Report/Pattern_lot_peti/index.blade.php

@ -36,12 +36,6 @@
<option value="25" {{ request('perPage', 5) == '25' ? 'selected' : '' }}>25</option>
<option value="50" {{ request('perPage', 5) == '50' ? 'selected' : '' }}>50</option>
<option value="100" {{ request('perPage', 5) == '100' ? 'selected' : '' }}>100</option>
<option value="500" {{ request('perPage', 5) == '500' ? 'selected' : '' }}>500</option>
<option value="1000" {{ request('perPage', 5) == '1000' ? 'selected' : '' }}>1000</option>
<option value="2500" {{ request('perPage', 5) == '2500' ? 'selected' : '' }}>2500
</option>
<option value="5000" {{ request('perPage', 5) == '5000' ? 'selected' : '' }}>5000
</option>
<option value="{{ $peti->total() }}"
{{ request('perPage', 5) == $peti->total() ? 'selected' : '' }}>Semua</option>
</select>

6
resources/views/dashboard/Peminjaman/index.blade.php

@ -36,12 +36,6 @@
<option value="25" {{ request('perPage', 5) == '25' ? 'selected' : '' }}>25</option>
<option value="50" {{ request('perPage', 5) == '50' ? 'selected' : '' }}>50</option>
<option value="100" {{ request('perPage', 5) == '100' ? 'selected' : '' }}>100</option>
<option value="500" {{ request('perPage', 5) == '500' ? 'selected' : '' }}>500</option>
<option value="1000" {{ request('perPage', 5) == '1000' ? 'selected' : '' }}>1000</option>
<option value="2500" {{ request('perPage', 5) == '2500' ? 'selected' : '' }}>2500
</option>
<option value="5000" {{ request('perPage', 5) == '5000' ? 'selected' : '' }}>5000
</option>
<option value="{{ $peminjaman->total() }}"
{{ request('perPage', 5) == $peminjaman->total() ? 'selected' : '' }}>Semua</option>
</select>

1
resources/views/dashboard/Pengembalian/index.blade.php

@ -30,7 +30,6 @@
<option value="25" {{ request('perPage', 5) == '25' ? 'selected' : '' }}>25</option>
<option value="50" {{ request('perPage', 5) == '50' ? 'selected' : '' }}>50</option>
<option value="100" {{ request('perPage', 5) == '100' ? 'selected' : '' }}>100</option>
<option value="500" {{ request('perPage', 5) == '500' ? 'selected' : '' }}>500</option>
<option value="{{ $peminjaman->total() }}"
{{ request('perPage', 5) == $peminjaman->total() ? 'selected' : '' }}>Semua</option>
</select>

231
resources/views/dashboard/index.blade.php

@ -92,7 +92,7 @@
</div>
<!-- Area Bar Chart -->
<div class="col-xl-7 col-lg-7">
{{-- <div class="col-xl-7 col-lg-7">
<div class="card shadow mb-4" style="max-height: 600px;">
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Grafik Peminjaman VS Pengembalian</h6>
@ -113,6 +113,32 @@
<canvas id="ChartAssetStatus" style="width: 100px; height: 68px;"></canvas>
</div>
</div>
</div> --}}
<!-- Area Bar Chart -->
{{-- <div class="col-xl-7 col-lg-7">
<div class="card shadow mb-4" style="max-height: 600px;">
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Grafik Peminjaman VS Pengembalian</h6>
</div>
@php
$chartData = app('App\Http\Controllers\HomeController')->generateChartData();
@endphp
<div class="card-body" style="height: 80%;">
<label for="yearFilter">Pilih Tahun:</label>
<select id="yearFilter" class="form-control">
@foreach ($chartData['years'] as $year)
@if ($chartData['exitData'][$loop->index] || $chartData['enterData'][$loop->index])
<option value="{{ $year }}">{{ $year }}</option>
@endif
@endforeach
</select>
<!-- Add a container div for the chart -->
<div id="chartContainer" style="position: relative; height: 100%;">
<canvas id="ChartAssetStatus"></canvas>
</div>
</div>
</div>
</div>
<!-- Area Pie Chart -->
@ -139,8 +165,113 @@
<canvas id="myPieChartsiopas"></canvas>
</div>
</div>
</div> --}}
</div>
{{-- <div class="row">
<div class="col-6">
<div class="card shadow mb-4" style="max-height: 600px;">
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Grafik Peminjaman VS Pengembalian</h6>
</div>
@php
$chartData = app('App\Http\Controllers\HomeController')->generateChartData();
@endphp
<div class="card-body" style="height: 80%;">
<label for="yearFilter">Pilih Tahun:</label>
<select id="yearFilter" class="form-control">
@foreach ($chartData['years'] as $year)
@if ($chartData['exitData'][$loop->index] || $chartData['enterData'][$loop->index])
<option value="{{ $year }}">{{ $year }}</option>
@endif
@endforeach
</select>
<!-- Add a container div for the chart -->
<div id="chartContainer" style="position: relative; height: 100%;">
<canvas id="ChartAssetStatus"></canvas>
</div>
</div>
</div>
</div>
<div class="col-6">
<div class="card shadow mb-4">
<!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Grafik Pengadaan Peti</h6>
</div>
@php
$chartDataPie = app('App\Http\Controllers\HomeController')->generateChartDataPie();
@endphp
<div class="card-body">
<label for="yearFilterPie">Pilih Tahun:</label>
<select id="yearFilterPie" class="form-control">
@foreach ($chartDataPie['years'] as $year)
@if (count($chartDataPie['enterData']) > 0 && $chartDataPie['enterData'][$loop->index])
<option value="{{ $year }}">{{ $year }}</option>
@endif
@endforeach
</select>
<canvas id="myPieChartsiopas"></canvas>
</div>
</div>
</div>
</div> --}}
<div class="row">
<div class="col-6">
<div class="card shadow mb-4" style="height: 600px;">
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Grafik Peminjaman VS Pengembalian</h6>
</div>
@php
$chartData = app('App\Http\Controllers\HomeController')->generateChartData();
@endphp
<div class="card-body" style="height: 100%; display: flex; flex-direction: column;">
<label for="yearFilter">Pilih Tahun:</label>
<select id="yearFilter" class="form-control">
@foreach ($chartData['years'] as $year)
@if ($chartData['exitData'][$loop->index] || $chartData['enterData'][$loop->index])
<option value="{{ $year }}">{{ $year }}</option>
@endif
@endforeach
</select>
<!-- Add a container div for the chart with 100% height -->
<div id="chartContainer" style="position: relative; flex: 1;">
<canvas id="ChartAssetStatus"></canvas>
</div>
</div>
</div>
</div>
<div class="col-6">
<div class="card shadow mb-4" style="height: 600px;">
<!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Grafik Pengadaan Peti</h6>
</div>
@php
$chartDataPie = app('App\Http\Controllers\HomeController')->generateChartDataPie();
@endphp
<div class="card-body" style="height: 100%; display: flex; flex-direction: column;">
<label for="yearFilterPie">Pilih Tahun:</label>
<select id="yearFilterPie" class="form-control">
@foreach ($chartDataPie['years'] as $year)
@if (count($chartDataPie['enterData']) > 0 && $chartDataPie['enterData'][$loop->index])
<option value="{{ $year }}">{{ $year }}</option>
@endif
@endforeach
</select>
<div id="chartContainerPie" style="position: relative; flex: 1;">
<canvas id="myPieChartsiopas"></canvas>
</div>
</div>
</div>
</div>
</div>
@push('script')
<!-- script pie chart -->
@ -220,7 +351,7 @@
</script>
<!-- script bar chart -->
<script>
{{-- <script>
document.addEventListener('DOMContentLoaded', function() {
var ctx = document.getElementById('ChartAssetStatus').getContext('2d');
var myChart;
@ -291,8 +422,104 @@
updateChart(selectedYear);
}
});
</script> --}}
<script>
document.addEventListener('DOMContentLoaded', function() {
var ctx = document.getElementById('ChartAssetStatus').getContext('2d');
var myChart;
var chartData = @json($chartData);
function updateChart(selectedYear) {
var selectedYearIndex = chartData.years.indexOf(selectedYear);
// Mengambil data berdasarkan tahun yang dipilih
var updatedExitData = chartData.exitData[selectedYearIndex];
var updatedEnterData = chartData.enterData[selectedYearIndex];
// Memperbarui chart hanya dengan data tahun yang dipilih
myChart.data.labels = chartData.monthNames;
myChart.data.datasets[0].data = updatedExitData;
myChart.data.datasets[1].data = updatedEnterData;
myChart.update();
}
// Add a function to update chart size based on parent container size
function updateChartSize() {
var container = document.getElementById('chartContainer');
var parentWidth = container.clientWidth;
var parentHeight = container.clientHeight;
// Set canvas dimensions based on container size
ctx.canvas.width = parentWidth;
ctx.canvas.height = parentHeight;
// Update the chart
myChart.update();
}
myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: chartData.monthNames,
datasets: [{
label: 'Peminjaman',
data: chartData.exitData[0],
backgroundColor: 'rgba(75, 192, 192, 0.2)',
borderColor: 'rgba(75, 192, 192, 1)',
borderWidth: 1
},
{
label: 'Pengembalian',
data: chartData.enterData[0],
backgroundColor: 'rgba(255, 159, 64, 0.2)',
borderColor: 'rgba(255, 159, 64, 1)',
borderWidth: 1
}
]
},
options: {
scales: {
y: {
beginAtZero: true
}
},
responsive: true,
maintainAspectRatio: false // Allow chart to adjust size freely
}
});
// Event listener for year filter change
var yearFilter = document.getElementById('yearFilter');
yearFilter.addEventListener('change', function() {
var selectedYear = yearFilter.value;
updateChart(selectedYear);
// Simpan tahun yang dipilih ke local storage
localStorage.setItem('selectedYear', selectedYear);
});
// Kondisi Pertama: Setelah halaman dimuat
// Coba baca tahun yang disimpan di local storage
var selectedYear = localStorage.getItem('selectedYear');
if (selectedYear) {
yearFilter.value = selectedYear;
updateChart(selectedYear);
} else {
// Jika tidak ada tahun yang disimpan, pilih tahun saat ini
selectedYear = new Date().getFullYear();
yearFilter.value = selectedYear;
updateChart(selectedYear);
}
// Event listener for window resize
window.addEventListener('resize', updateChartSize);
// Set initial chart size
updateChartSize();
});
</script>
<!-- script generate report -->
<script>
function downloadReport(routeName) {

4
resources/views/pages/layouts/sidebar_user.blade.php

@ -56,7 +56,7 @@
<li
class="nav-item {{ $active == 'history-peminjaman' || $active == 'history-pengembalian' || $active == 'history-transfer' ? 'active' : '' }}">
<a class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#collapsehistory"
aria-controls="collapsehistory">
aria-expanded="true" aria-controls="collapsehistory">
<i class="fas fa-history"></i>
<span>History</span>
</a>
@ -117,6 +117,6 @@
<li class="nav-item {{ $active == 'menu-warehouse' ? 'active' : '' }}">
<a class="nav-link" href="{{ route('dashboard.warehouse.index') }}">
<i class="fas fa-fw fa-warehouse"></i>
<span>Warehouse</span>
<span>Gudang</span>
</a>
</li>

79
resources/views/pages/user/Master_Data/Manajemen_Peti/Peti/index.blade.php

@ -1,21 +1,46 @@
<div class="card shadow mb-4">
<div class="card-header py-3">
<div class="row">
<div class="col-9">
<nav class="navbar navbar-expand navbar-light bg-light mb-4 py-3" style="border-bottom: 1px solid #ddd;">
<h5 class="m-0 font-weight-bold text-primary mt-2">Data Peti</h5>
</nav>
<div class="card-body">
<div class="row mb-3">
<div class="col-6">
<!-- Fitur page -->
<form method="GET" action="{{ route('dashboard.peti.index') }}">
<label for="perPage">Tampilkan:</label>
<select id="perPage" name="perPage" class="form-select" onchange="this.form.submit()">
<option value="5" {{ request('perPage', 5) == '5' ? 'selected' : '' }}>5</option>
<option value="10" {{ request('perPage', 5) == '10' ? 'selected' : '' }}>10</option>
<option value="25" {{ request('perPage', 5) == '25' ? 'selected' : '' }}>25</option>
<option value="50" {{ request('perPage', 5) == '50' ? 'selected' : '' }}>50</option>
<option value="100" {{ request('perPage', 5) == '100' ? 'selected' : '' }}>100</option>
<option value="{{ $peti->total() }}"
{{ request('perPage', 5) == $peti->total() ? 'selected' : '' }}>Semua</option>
</select>
<input type="hidden" name="search" value="{{ $search }}">
<input type="hidden" name="page" value="{{ request('page', 1) }}">
</form>
</div>
<div class="col-6 d-flex justify-content-end mb-3">
<!-- Fitur search -->
<form method="GET" action="{{ route('dashboard.peti.index') }}" class="form-inline">
<input type="text" name="search" class="form-control mr-2" placeholder="Cari..."
value="{{ $search }}">
<input type="hidden" name="page" value="1">
<input type="hidden" name="perPage" value="{{ request('perPage', 5) }}">
<button type="submit" class="btn btn-primary">Cari</button>
</form>
</div>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="tablebarang" width="100%" cellspacing="0">
<table class="table table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th class="text-center" style="width: 10px">No</th>
<th>Fix Lot</th>
<th>User</th>
<th>Customer</th>
<th>WH</th>
<th>GD</th>
<th>Kode Customer</th>
<th>Tipe Peti</th>
<th>Ukuran Peti</th>
@ -26,12 +51,9 @@
</tr>
</thead>
<tbody>
@php
$nopeti = 1;
@endphp
@forelse ($peti as $data_peti)
<tr>
<td class="text-center">{{ $nopeti++ }}</td>
<td>{{ $i++ }}</td>
<td>{{ $data_peti->fix_lot }}</td>
<td>{{ $data_peti->created_by }}</td>
<td>{{ $data_peti->customer->name }}</td>
@ -45,10 +67,45 @@
<td>{{ $data_peti->status }}</td>
</tr>
@empty
<p>Data Kosong</p>
<tr>
<td colspan="14" class="text-center">Data Kosong</td>
</tr>
@endforelse
</tbody>
</table>
</div>
<div class="row mt-3">
<div class="col-4">
<!-- Tampilkan jumlah data yang ditampilkan -->
@if (!$peti->isEmpty())
<p class="d-inline-block">Showing {{ $peti->firstItem() }} to
{{ $peti->lastItem() }} of
{{ $peti->total() }} entries</p>
@endif
</div>
<div class="col-8 d-flex justify-content-end">
@if ($peti->total() > $peti->perPage())
<nav aria-label="Page navigation">
<ul class="pagination justify-content-center">
<li class="page-item {{ $peti->onFirstPage() ? 'disabled' : '' }}">
<a class="page-link"
href="{{ $peti->appends(['perPage' => Request::get('perPage')])->url(1) }}"
aria-label="First">
<span aria-hidden="true">First</span>
</a>
</li>
{{ $peti->appends(['perPage' => Request::get('perPage')])->links() }}
<li class="page-item {{ $peti->hasMorePages() ? '' : 'disabled' }}">
<a class="page-link"
href="{{ $peti->appends(['perPage' => Request::get('perPage')])->url($peti->lastPage()) }}"
aria-label="Last">
<span aria-hidden="true">Last</span>
</a>
</li>
</ul>
</nav>
@endif
</div>
</div>
</div>
</div>

9
resources/views/pages/user/dashboard/disposal/index.blade.php

@ -16,7 +16,6 @@
<th>Nama Customer</th>
<th>Tanggal Disposal</th>
<th>Alasan Disposal</th>
<th>Status Peti</th>
</tr>
</thead>
<tbody>
@ -26,14 +25,12 @@
@forelse ($disposal as $data_disposal)
<tr>
<td>{{ $nodisposal++ }}</td>
<td>{{ $data_disposal->peti->fix_lot }}</td>
<td>{{ $data_disposal->customer->name }}</td>
<td>{{ \Carbon\Carbon::parse($data_disposal->date_disposal)->format('d/m/Y') }}</td>
<td>{{ optional($data_disposal->peti)->fix_lot }}</td>
<td>{{ optional($data_disposal->customer)->name }}</td>
<td>{{ \Carbon\Carbon::parse($data_disposal->date_disposal)->format('d-m-Y') }}</td>
<td>{{ $data_disposal->description }}</td>
<td>{{ $data_disposal->status_disposal }}</td>
</tr>
@empty
<p>Data Kosong</p>
@endforelse
</tbody>
</table>

3
resources/views/profil/profil.blade.php

@ -64,8 +64,7 @@
</div>
<div class="col-12">
<div class="mb-2">
<label for="tgl_lahir" class="col-form-label" style="font-size: 14px;">Tanggal
Lahir</label>
<label for="tgl_lahir" class="col-form-label" style="font-size: 14px;">Tanggal Lahir</label>
<input class="form-control" name="tgl_lahir" type="date" id="tgl_lahir"
value="{{ \Carbon\Carbon::parse(old('tgl_lahir', auth()->user()->tgl_lahir))->format('Y-m-d') }}"
placeholder="Masukan Tanggal Asset" required>

Loading…
Cancel
Save