Browse Source

update report StockOpname

master
Gunawan19621 1 year ago
parent
commit
477986e797
  1. 11
      app/Http/Controllers/PetternLotPetiController.php
  2. 83
      app/Http/Controllers/StokOpNameController.php
  3. 1
      app/Models/Peti.php
  4. 24
      resources/views/dashboard/History/Peminjaman/index.blade.php
  5. 10
      resources/views/dashboard/History/Pengembalian/index.blade.php
  6. 96
      resources/views/dashboard/Master_Data/Report/PATTERN LOT PETI/detail_peti.blade.php
  7. 6
      resources/views/dashboard/Master_Data/Report/PATTERN LOT PETI/index.blade.php
  8. 157
      resources/views/dashboard/Master_Data/Report/Stok_opname/index.blade.php
  9. 2
      resources/views/dashboard/Peminjaman/index.blade.php
  10. 16
      resources/views/dashboard/Pengembalian/index.blade.php
  11. 18
      resources/views/dashboard/Transfer/create.blade.php
  12. 125
      resources/views/dashboard/index.blade.php
  13. 8
      resources/views/layouts/sidebar.blade.php
  14. 11
      routes/web.php

11
app/Http/Controllers/PetternLotPetiController.php

@ -6,6 +6,7 @@ use App\Models\Peti;
use Illuminate\Http\Request;
use Maatwebsite\Excel\Facades\Excel;
use App\Exports\PetternLotPetiExport;
use App\Models\asset_status;
class PetternLotPetiController extends Controller
{
@ -19,6 +20,16 @@ class PetternLotPetiController extends Controller
return view('dashboard.Master_Data.Report.PATTERN LOT PETI.index', $data);
}
public function show($id)
{
$data = [
'peti' => Peti::find($id),
'assetStatus' => asset_status::where('peti_id', $id)->get(),
'active' => 'menu-Pettern_Lot_Peti'
];
return view('dashboard.Master_Data.Report.PATTERN LOT PETI.detail_peti', $data);
}
public function export()
{
return Excel::download(new PetternLotPetiExport, 'PATTERN LOT PETI.xlsx');

83
app/Http/Controllers/StokOpNameController.php

@ -0,0 +1,83 @@
<?php
namespace App\Http\Controllers;
use App\Models\asset_status;
use App\Models\Peti;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class StokOpNameController extends Controller
{
public function index()
{
// Total Peti Berdasarkan Tanggal Sekarang
$todayStokOpnames = Peti::with('customer', 'tipe_peti')
->select('customer_id', 'tipe_peti_id', DB::raw('COUNT(*) as total_petis'))
->whereDate('created_at', today())
->groupBy('customer_id', 'tipe_peti_id')
->get();
// Total Peti Berdasarkan Tanggal Sebelum Tanggal Sekarang
$yesterdayStokOpnames = Peti::with('customer', 'tipe_peti')
->select('customer_id', 'tipe_peti_id', DB::raw('COUNT(*) as total_petis'))
->whereDate('created_at', today()->subDays(1))
->groupBy('customer_id', 'tipe_peti_id')
->get();
// Total Peti Berdasarkan Tabel asset_status
// $totalPetiAssetStatus = asset_status::select('peti_id', DB::raw('COUNT(*) as total_petis'))
// ->groupBy('peti_id')
// ->get();
$petiIds = asset_status::whereHas('peti', function ($query) {
$query->groupBy('customer_id', 'tipe_peti_id');
})
->pluck('peti_id');
// Total Peti
$stokOpnames = Peti::with('customer', 'tipe_peti')
->select('customer_id', 'tipe_peti_id', DB::raw('COUNT(*) as total_petis'))
->groupBy('customer_id', 'tipe_peti_id')
->get();
$petis = Peti::get();
$data = [
'stokOpnames' => $stokOpnames,
'todayStokOpnames' => $todayStokOpnames, // tambahin ini di array data 'todayStokOpnames' => $todayStokOpnames,
'yesterdayStokOpnames' => $yesterdayStokOpnames, // tambahin ini di array data 'yesterdayStokOpnames' => $yesterdayStokOpnames,
'totalPetiAssetStatus' => $petiIds, // Sesuaikan dengan model dan kolom yang sesuai
'assetStatus' => asset_status::get(),
'petis' => $petis,
'active' => 'menu-Stok_Opname'
];
return view('dashboard.Master_Data.Report.Stok_opname.index', $data);
}
// public function index()
// {
// // // Total Peti Berdasarkan Gudang
// // $gudangStokOpnames = Peti::with('customer', 'tipe_peti')
// // ->select('customer_id', 'tipe_peti_id', DB::raw('COUNT(*) as total_petis'))
// // ->groupBy('customer_id', 'tipe_peti_id')
// // ->get();
// $stokOpnames = Peti::with('customer', 'tipe_peti')
// ->select('customer_id', 'tipe_peti_id', DB::raw('COUNT(*) as total_petis'))
// ->groupBy('customer_id', 'tipe_peti_id')
// ->get();
// $data = [
// 'stokOpnames ' => $stokOpnames,
// // 'todayStokOpnames' => $todayStokOpnames,
// // 'yesterdayStokOpnames' => $yesterdayStokOpnames,
// // 'gudangStokOpnames' => $gudangStokOpnames,
// 'active' => 'menu-Stok_Opname'
// ];
// return view('dashboard.Master_Data.Report.Stok_opname.index', $data);
// }
}

1
app/Models/Peti.php

@ -16,7 +16,6 @@ class Peti extends Model
protected $table = 'petis';
protected $fillable = [
'id_incre',
'tipe_peti_id',
'warna',
'customer_id',

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

@ -29,7 +29,7 @@
<th>Kode</th>
<th>Tgl Peminjaman</th>
<th>PJ Peminjaman</th>
<th>Asal Gudang</th>
<th>WH Peminjam</th>
</tr>
</thead>
<tbody>
@ -37,18 +37,16 @@
$no_peminjaman = 1;
@endphp
@forelse ($peminjaman as $data_peminjaman)
@if ($data_peminjaman->enter_warehouse == null)
<tr>
<td class="text-center">{{ $no_peminjaman++ }}</td>
<td>{{ $data_peminjaman->peti->fix_lot }}</td>
<td>{{ $data_peminjaman->peti->customer->name }}</td>
<td>{{ $data_peminjaman->peti->customer->code_customer }} -
{{ $data_peminjaman->peti->tipe_peti->type }}</td>
<td>{{ \Carbon\Carbon::parse($data_peminjaman->exit_at)->format('d/m/Y') }}</td>
<td>{{ $data_peminjaman->exit_pic }}</td>
<td>{{ $data_peminjaman->warehouse->name }}</td>
</tr>
@endif
<tr>
<td class="text-center">{{ $no_peminjaman++ }}</td>
<td>{{ $data_peminjaman->peti->fix_lot }}</td>
<td>{{ $data_peminjaman->peti->customer->name }}</td>
<td>{{ $data_peminjaman->peti->customer->code_customer }} -
{{ $data_peminjaman->peti->tipe_peti->type }}</td>
<td>{{ \Carbon\Carbon::parse($data_peminjaman->exit_at)->format('d/m/Y') }}</td>
<td>{{ $data_peminjaman->exit_pic }}</td>
<td>{{ $data_peminjaman->warehouse->name }}</td>
</tr>
@empty
<p>Data Kosong</p>
@endforelse

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

@ -50,7 +50,13 @@
<td>{{ \Carbon\Carbon::parse($data->exit_at)->format('d/m/Y') }}</td>
<td>{{ \Carbon\Carbon::parse($data->est_pengembalian)->format('d/m/Y') }}</td>
<td>{{ $data->exit_pic }}</td>
<td>{{ $data->warehouse->name }}</td>
<td>
@if ($data->exit_warehouse)
{{ $data->warehouse->name }}
@else
<p class="text-center font-weight-bold">-</p>
@endif
</td>
<td>
@if ($data->enter_at)
{{ \Carbon\Carbon::parse($data->enter_at)->format('d-m-Y') }}
@ -67,7 +73,7 @@
</td>
<td>
@if ($data->enter_warehouse)
{{ $data->warehouse->name }}
{{ $data->warehouseEnter->name }}
@else
<p class="text-center font-weight-bold">-</p>
@endif

96
resources/views/dashboard/Master_Data/Report/PATTERN LOT PETI/detail_peti.blade.php

@ -0,0 +1,96 @@
@extends('layouts.main')
@section('content')
<style>
.table th {
white-space: nowrap;
}
.table td {
white-space: nowrap;
}
</style>
<div class="card shadow mb-4">
<div class="card-header py-3">
<div class="row">
<div class="col-6">
<h5 class="m-0 font-weight-bold text-primary mt-2">Detail Histori Peti</h5>
</div>
</div>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="tablebarang" width="100%" cellspacing="0">
<thead>
<tr>
<th>No</th>
<th>Kode Peti</th>
<th>Customer</th>
<th>Tgl Peinjaman</th>
<th>Estimasi Pengembalian</th>
<th>PJ Peminjaman</th>
<th>Asal WH Peminjaman</th>
<th>Tgl Pengembalian</th>
<th>PJ Pengembalian</th>
<th>Tujuan WH Pengembalian</th>
<th>Kondisi Peti</th>
<th>Status</th>
</tr>
</thead>
<tbody>
@php
$no_peminjaman = 1;
@endphp
@forelse ($assetStatus as $data_assetStatus)
<tr>
<td class="text-center">{{ $no_peminjaman++ }}</td>
<td>{{ $data_assetStatus->peti->fix_lot }}</td>
<td>{{ $data_assetStatus->peti->customer->name }}</td>
<td>{{ \Carbon\Carbon::parse($data_assetStatus->exit_at)->format('d/m/Y') }}</td>
<td>{{ \Carbon\Carbon::parse($data_assetStatus->est_pengembalian)->format('d/m/Y') }}</td>
<td>{{ $data_assetStatus->exit_pic }}</td>
<td>{{ $data_assetStatus->warehouse->name }}</td>
<td>
@if ($data_assetStatus->enter_at)
{{ \Carbon\Carbon::parse($data_assetStatus->enter_at)->format('d-m-Y') }}
@else
<p class="text-center font-weight-bold">-</p>
@endif
</td>
<td>
@if ($data_assetStatus->enter_pic)
{{ $data_assetStatus->enter_pic }}
@else
<p class="text-center font-weight-bold">-</p>
@endif
</td>
<td>
@if ($data_assetStatus->enter_warehouse)
{{ $data_assetStatus->warehouse->name }}
@else
<p class="text-center font-weight-bold">-</p>
@endif
</td>
<td>
@if ($data_assetStatus->kondisi_peti)
{{ $data_assetStatus->kondisi_peti->nama_kondisi }}
@else
<p class="text-center font-weight-bold">-</p>
@endif
</td>
<td>
@if ($data_assetStatus->enter_warehouse === null)
Not Return
@else
Return
@endif
</td>
</tr>
@empty
<p>Data Kosong</p>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
@endsection

6
resources/views/dashboard/Master_Data/Report/PATTERN LOT PETI/index.blade.php

@ -1,6 +1,5 @@
@extends('layouts.main')
@section('content')
@include('layouts.components.alert-prompt')
<style>
.table th {
white-space: nowrap;
@ -60,7 +59,10 @@
<td>{{ $data_peti->tipe_peti->size_peti }}</td>
<td>{{ $data_peti->customer->lot_no }}</td>
<td class="text-right">{{ $data_peti->packing_no }}</td>
<td>{{ $data_peti->fix_lot }}</td>
<td>
<a
href="{{ route('dashboard.Pettern_Lot_Peti.show', $data_peti->id) }}">{{ $data_peti->fix_lot }}</a>
</td>
</tr>
@empty
<p>Data Kosong</p>

157
resources/views/dashboard/Master_Data/Report/Stok_opname/index.blade.php

@ -0,0 +1,157 @@
@extends('layouts.main')
@section('content')
<style>
.table th {
white-space: nowrap;
}
.table td {
white-space: nowrap;
}
</style>
{{-- <p>Halaman Stop Op Name</p> --}}
<div class="card shadow mb-4">
<div class="card-header py-3">
<div class="row">
<div class="col-6">
<h5 class="m-0 font-weight-bold text-primary mt-2">Report Stok Opname</h5>
</div>
<div class="col-6 text-right">
<a href="#" class="btn btn-success btn-icon-split ml-auto" target="_blank">
<span class="text">Cetak PDF</span>
</a>
<a href="{{ route('dashboard.Pettern_Lot_Peti.export') }}" class="btn btn-info btn-icon-split ml-auto"
target="_blank">
<span class="text">Cetak Exel</span>
</a>
</div>
</div>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="tablebarang" width="100%" cellspacing="0">
<thead>
<tr>
<th rowspan="2" style="vertical-align: middle; text-align: center;">No</th>
<th rowspan="2"style="vertical-align: middle; text-align: center;">Customer</th>
<th rowspan="2"style="vertical-align: middle; text-align: center;">Kode</th>
<th rowspan="2" style="vertical-align: middle; text-align: center;">Ukuran Peti</th>
<th rowspan="2" style="vertical-align: middle; text-align: center;">Bagginning</th>
<th rowspan="2" style="vertical-align: middle; text-align: center;">Add</th>
<th rowspan="2" style="vertical-align: middle; text-align: center;">Total</th>
<th colspan="4" style="text-align: center; vertical-align: middle;">Stock</th>
<th rowspan="2" style="vertical-align: middle; text-align: center;">Stok Opname</th>
<th rowspan="2" style="vertical-align: middle; text-align: center;">Total</th>
</tr>
<tr>
<th>DI ISTW</th>
<th>Gudang A</th>
<th>Gudang B</th>
<th>Gudang C</th>
</tr>
</thead>
<tbody>
@php
$noreport = 1;
@endphp
@forelse ($stokOpnames as $data_StokOpname)
<tr>
<td>{{ $noreport++ }}</td>
<td>{{ $data_StokOpname->customer->name }}</td>
<td>{{ $data_StokOpname->customer->code_customer }} -
{{ $data_StokOpname->tipe_peti->type }}</td>
<td>{{ $data_StokOpname->tipe_peti->size_peti }}</td>
<td>
@php
// Temukan data dari tanggal sebelum sekarang (kemarin) berdasarkan id
$yesterdayStokOpname = $yesterdayStokOpnames
->where('customer_id', $data_StokOpname->customer_id)
->where('tipe_peti_id', $data_StokOpname->tipe_peti_id)
->first();
@endphp
{{-- Jumlah total peti pada tanggal sebelum sekarang (kemarin) --}}
@if ($yesterdayStokOpname && $yesterdayStokOpname->total_petis > 0)
{{ $yesterdayStokOpname->total_petis }}
@else
-
@endif
</td>
<td>
@php
$todayStokOpname = $todayStokOpnames
->where('customer_id', $data_StokOpname->customer_id)
->where('tipe_peti_id', $data_StokOpname->tipe_peti_id)
->first();
@endphp
@if ($todayStokOpname && $todayStokOpname->total_petis > 0)
{{ $todayStokOpname->total_petis }}
@else
-
@endif
</td>
<td>
@if ($data_StokOpname->total_petis > 0)
{{ $data_StokOpname->total_petis }}
@else
-
@endif
</td>
<td>
-
</td>
<td>Gudang A</td>
<td>Gudang B</td>
<td>
@php
$totalNullableCount = 0;
@endphp
@foreach ($petis as $peti)
@php
$totalNullableCount += $assetStatus
->where('peti_id', $peti->id)
->where('enter_warehouse', '=', 0)
// ->where('customer_id', $peti->customer_id)
->count();
@endphp
@endforeach
{{ $totalNullableCount }}
{{-- @foreach ($petis as $item)
@php
$totalAsset = \App\Models\asset_status::get();
$totalAssetStatus = $totalAsset
->where('customer_id', $item->customer_id)
->where('peti_id', $item->id)
->count();
@endphp
@if ($totalAssetStatus > 0)
{{ $totalAssetStatus }}
@else
0
@endif
@endforeach --}}
</td>
<td> - </td>
<td>
@if ($data_StokOpname->total_petis > 0)
{{ $data_StokOpname->total_petis }}
@else
-
@endif
</td>
</tr>
@empty
<p>Data Kosong</p>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
@endsection

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

@ -36,7 +36,7 @@
<th>Kode</th>
<th>Tgl Peminjaman</th>
<th>PJ Peminjaman</th>
<th>Asal Gudang</th>
<th>WH Peminjam</th>
<th class="text-center">Action</th>
</tr>
</thead>

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

@ -30,10 +30,10 @@
<th>Tgl Peinjaman</th>
<th>Estimasi Pengembalian</th>
<th>PJ Peminjaman</th>
<th>Asal WH Peminjaman</th>
<th>WH Peminjam</th>
<th>Tgl Pengembalian</th>
<th>PJ Pengembalian</th>
<th>Tujuan WH Pengembalian</th>
<th>WH Pengembalian</th>
<th>Kondisi Peti</th>
<th>Status</th>
<th class="text-center">Action</th>
@ -52,7 +52,13 @@
<td>{{ \Carbon\Carbon::parse($data->exit_at)->format('d/m/Y') }}</td>
<td>{{ \Carbon\Carbon::parse($data->est_pengembalian)->format('d/m/Y') }}</td>
<td>{{ $data->exit_pic }}</td>
<td>{{ $data->warehouse->name }}</td>
<td>
@if ($data->exit_warehouse)
{{ $data->warehouse->name }}
@else
<p class="text-center font-weight-bold">-</p>
@endif
</td>
<td>
@if ($data->enter_at)
{{ \Carbon\Carbon::parse($data->enter_at)->format('d-m-Y') }}
@ -69,14 +75,14 @@
</td>
<td>
@if ($data->enter_warehouse)
{{ $data->warehouse->name }}
{{ $data->warehouseEnter->name }}
@else
<p class="text-center font-weight-bold">-</p>
@endif
</td>
<td>
@if ($data->kondisi_peti)
{{ $data->kondisi_peti_id }}
{{ $data->kondisi_peti->nama_kondisi }}
@else
<p class="text-center font-weight-bold">-</p>
@endif

18
resources/views/dashboard/Transfer/create.blade.php

@ -33,7 +33,7 @@
<label for="name_customer" class="col-form-label">Customer: <span class="text-danger">*</span></label>
<select class="form-control" name="name_customer" type="text" id="name_customer" required>
<option disabled selected>Nama Customer akan otomatis terpilih ketika memilih detail peti.</option>
<option disabled selected>Pilih Nama Customer</option>
@foreach ($customer as $data_customer)
<option value="{{ $data_customer->id }}">{{ $data_customer->name }}</option>
@endforeach
@ -81,7 +81,7 @@
const source_warehouseSelect = document.getElementById('source_warehouse');
// Mendapatkan elemen select Customer
const name_customerSelect = document.getElementById('name_customer');
// const name_customerSelect = document.getElementById('name_customer');
// Menambahkan event listener ke select detail peti
petiSelect.addEventListener('change', function() {
@ -90,18 +90,18 @@
const warehouseId = selectedOption.getAttribute('data-warehouse-id');
// Mendapatkan data-customer-name dari option yang dipilih
const customerName = selectedOption.getAttribute('data-customer-name');
// const customerName = selectedOption.getAttribute('data-customer-name');
// Memilih asal gudang berdasarkan data-warehouse-id
source_warehouseSelect.value = warehouseId;
// Memilih customer berdasarkan data-customer-name
for (let i = 0; i < name_customerSelect.options.length; i++) {
if (name_customerSelect.options[i].text === customerName) {
name_customerSelect.selectedIndex = i;
break;
}
}
// for (let i = 0; i < name_customerSelect.options.length; i++) {
// if (name_customerSelect.options[i].text === customerName) {
// name_customerSelect.selectedIndex = i;
// break;
// }
// }
});
</script>
@endsection

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

@ -85,6 +85,8 @@
</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">
@ -108,7 +110,6 @@
</div>
</div>
<!-- Area Pie Chart -->
<div class="col-xl-5 col-lg-5">
<div class="card shadow mb-4">
@ -121,8 +122,8 @@
@endphp
<div class="card-body">
<label for="yearFilter">Pilih Tahun:</label>
<select id="yearFilter" class="form-control">
<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>
@ -134,6 +135,30 @@
</div>
</div>
</div>
{{-- <div class="col-xl-5 col-lg-5">
<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>
@push('script')
@ -143,27 +168,30 @@
// Function to update the pie chart based on selected year
function updatePieChart(selectedYear) {
// Call the controller function to get data for the selected year
var chartData = {!! json_encode(app('App\Http\Controllers\HomeController')->generateChartDataPie()) !!};
var yearIndex = chartData.years.indexOf(selectedYear);
var chartDataPie = {!! json_encode(app('App\Http\Controllers\HomeController')->generateChartDataPie()) !!};
var yearIndex = chartDataPie.years.indexOf(selectedYear);
// Update the pie chart data
myPieChart.data.datasets[0].data = chartData.enterData[yearIndex];
myPieChart.data.datasets[0].data = chartDataPie.enterData[yearIndex];
myPieChart.update();
// Save selected year to local storage
localStorage.setItem('selectedYearPie', selectedYear);
}
// Initial chart data
var initialChartData = {!! json_encode(app('App\Http\Controllers\HomeController')->generateChartDataPie()) !!};
var initialChartDataPie = {!! json_encode(app('App\Http\Controllers\HomeController')->generateChartDataPie()) !!};
// Get the canvas element for the pie chart
var ctx = document.getElementById("myPieChartsiopas").getContext('2d');
var ctxPie = document.getElementById("myPieChartsiopas").getContext('2d');
// Create the initial pie chart instance
var myPieChart = new Chart(ctx, {
var myPieChart = new Chart(ctxPie, {
type: 'pie',
data: {
labels: initialChartData.monthNames,
labels: initialChartDataPie.monthNames,
datasets: [{
data: initialChartData.enterData[0],
data: initialChartDataPie.enterData[0],
backgroundColor: ["#4e73df", "#1cc88a", "#36b9cc", "#ff6384", "#ff9f40", "#9966ff",
"#cc65fe",
"#ffcc29", "#a4e56d", "#ff3d00", "#9c9c9c", "#0d47a1"
@ -193,16 +221,83 @@
},
});
// Custom legend using legendCallback
document.getElementById('chart-legend').innerHTML = myPieChart.generateLegend();
// Event listener for year filter change
document.getElementById('yearFilter').addEventListener('change', function() {
document.getElementById('yearFilterPie').addEventListener('change', function() {
var selectedYear = this.value;
updatePieChart(selectedYear);
});
// On page load, try to retrieve the selected year from local storage
document.addEventListener('DOMContentLoaded', function() {
var selectedYear = localStorage.getItem('selectedYearPie');
if (selectedYear) {
// If a year is found, set the dropdown value and update the chart
document.getElementById('yearFilterPie').value = selectedYear;
updatePieChart(selectedYear);
}
});
</script>
{{-- <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
// Function to update the pie chart based on selected year
function updatePieChart(selectedYear) {
// Call the controller function to get data for the selected year
var chartDataPie = {!! json_encode(app('App\Http\Controllers\HomeController')->generateChartDataPie()) !!};
var yearIndex = chartDataPie.years.indexOf(selectedYear);
// Update the pie chart data
myPieChart.data.datasets[0].data = chartDataPie.enterData[yearIndex];
myPieChart.update();
}
// Initial chart data
var initialChartDataPie = {!! json_encode(app('App\Http\Controllers\HomeController')->generateChartDataPie()) !!};
// Get the canvas element for the pie chart
var ctxPie = document.getElementById("myPieChartsiopas").getContext('2d');
// Create the initial pie chart instance
var myPieChart = new Chart(ctxPie, {
type: 'pie',
data: {
labels: initialChartDataPie.monthNames,
datasets: [{
data: initialChartDataPie.enterData[0],
backgroundColor: ["#4e73df", "#1cc88a", "#36b9cc", "#ff6384", "#ff9f40", "#9966ff",
"#cc65fe",
"#ffcc29", "#a4e56d", "#ff3d00", "#9c9c9c", "#0d47a1"
],
}]
},
options: {
responsive: true,
plugins: {
legend: {
position: 'right',
maxHeight: 200,
},
tooltip: {
callbacks: {
label: function(context) {
var label = context.label || '';
if (label) {
label += ' : ';
}
label += Math.round(context.parsed * 1) + ' Peti';
return label;
}
}
}
}
},
});
// Event listener for year filter change
document.getElementById('yearFilterPie').addEventListener('change', function() {
var selectedYear = this.value;
updatePieChart(selectedYear);
});
</script> --}}
<!-- script bar chart -->
<script>

8
resources/views/layouts/sidebar.blade.php

@ -148,12 +148,8 @@
<a class="collapse-item {{ $active == 'menu-Pettern_Lot_Peti' ? 'active' : '' }}"
href="{{ route('dashboard.Pettern_Lot_Peti.index') }}">PATTERN LOT
PETI</a>
<a class="collapse-item {{ $active == 'menu-user' ? 'active' : '' }}" href="#">Report
Peti</a>
<a class="collapse-item {{ $active == 'menu-user' ? 'active' : '' }}" href="#">Report
Peminjaman</a>
<a class="collapse-item {{ $active == 'menu-user' ? 'active' : '' }}" href="#">Report
Pengembalian</a>
<a class="collapse-item {{ $active == 'menu-Stok_Opname' ? 'active' : '' }}"
href="{{ route('dashboard.StokOpname.index') }}">Stok Opname</a>
</div>
</div>
</li>

11
routes/web.php

@ -16,6 +16,7 @@ use App\Http\Controllers\PeminjamanController;
use App\Http\Controllers\KondisiPetiController;
use App\Http\Controllers\PengembalianController;
use App\Http\Controllers\PetternLotPetiController;
use App\Http\Controllers\StokOpNameController;
use App\Http\Controllers\TransaksiKeluarMasukController;
/*
@ -195,11 +196,19 @@ Route::prefix('dashboard')->name('dashboard.')->middleware(['auth'])->group(func
Route::delete('warehouse/delete/{id}', 'destroy')->name('warehouse.destroy');
});
//halaman Report
//halaman Report Peti
Route::controller(PetternLotPetiController::class)->group(function () {
Route::get('Pettern_Lot_Peti', 'index')->name('Pettern_Lot_Peti.index');
Route::get('Pettern_Lot_Peti/{id}', 'show')->name('Pettern_Lot_Peti.show');
Route::get('Pettern_Lot_Peti/export', 'export')->name('Pettern_Lot_Peti.export');
});
//halaman Report Stok
Route::controller(StokOpNameController::class)->group(function () {
Route::get('StokOpname', 'index')->name('StokOpname.index');
// Route::get('StokOpname/{id}', 'show')->name('StokOpname.show');
// Route::get('StokOpname/export', 'export')->name('StokOpname.export');
});
});

Loading…
Cancel
Save