141 lines
6.6 KiB
PHP
141 lines
6.6 KiB
PHP
@extends('layout.app')
|
|
|
|
@section('content')
|
|
<div class="py-5">
|
|
<div class="grid lg:grid-cols-3 md:grid-cols-3 sm:grid-cols-1 gap-4">
|
|
<!-- Card Barang -->
|
|
<div class="w-full bg-white p-3 rounded-lg flex justify-between items-center shadow-lg">
|
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-20 h-20 mr-2">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M13.5 21v-7.5a.75.75 0 0 1 .75-.75h3a.75.75 0 0 1 .75.75V21m-4.5 0H2.36m11.14 0H18m0 0h3.64m-1.39 0V9.349M3.75 21V9.349m0 0a3.001 3.001 0 0 0 3.75-.615A2.993 2.993 0 0 0 9.75 9.75c.896 0 1.7-.393 2.25-1.016a2.993 2.993 0 0 0 2.25 1.016c.896 0 1.7-.393 2.25-1.015a3.001 3.001 0 0 0 3.75.614m-16.5 0a3.004 3.004 0 0 1-.621-4.72l1.189-1.19A1.5 1.5 0 0 1 5.378 3h13.243a1.5 1.5 0 0 1 1.06.44l1.19 1.189a3 3 0 0 1-.621 4.72M6.75 18h3.75a.75.75 0 0 0 .75-.75V13.5a.75.75 0 0 0-.75-.75H6.75a.75.75 0 0 0-.75.75v3.75c0 .414.336.75.75.75Z" />
|
|
</svg>
|
|
<div class="items-center mb-3 pr-5">
|
|
<h3 class="text-2xl font-semibold">Barang</h3>
|
|
<p class="text-2xl my-5">{{ $data['barang'] }}</p>
|
|
</div>
|
|
</div>
|
|
<!-- Card Pendapatan -->
|
|
<div class="w-full bg-white p-3 rounded-lg flex justify-between items-center shadow-lg">
|
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-20 h-20 mr-2">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M15 19.128a9.38 9.38 0 0 0 2.625.372 9.337 9.337 0 0 0 4.121-.952 4.125 4.125 0 0 0-7.533-2.493M15 19.128v-.003c0-1.113-.285-2.16-.786-3.07M15 19.128v.106A12.318 12.318 0 0 1 8.624 21c-2.331 0-4.512-.645-6.374-1.766l-.001-.109a6.375 6.375 0 0 1 11.964-3.07M12 6.375a3.375 3.375 0 1 1-6.75 0 3.375 3.375 0 0 1 6.75 0Zm8.25 2.25a2.625 2.625 0 1 1-5.25 0 2.625 2.625 0 0 1 5.25 0Z" />
|
|
</svg>
|
|
<div class="items-center mb-3 pr-5">
|
|
<h3 class="text-2xl font-semibold">Pendapatan</h3>
|
|
<p class="text-2xl my-5">{{ $data['totalPendapatan'] }}</p>
|
|
</div>
|
|
</div>
|
|
<!-- Card Penjualan -->
|
|
<div class="w-full bg-white p-3 rounded-lg flex justify-between items-center shadow-lg">
|
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-20 h-20 mr-2">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M2.25 3h1.386c.51 0 .955.343 1.087.835l.383 1.437M7.5 14.25a3 3 0 0 0-3 3h15.75m-12.75-3h11.218c1.121-2.3 2.1-4.684 2.924-7.138a60.114 60.114 0 0 0-16.536-1.84M7.5 14.25 5.106 5.272M6 20.25a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0Zm12.75 0a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0Z" />
|
|
</svg>
|
|
<div class="items-center mb-3 pr-5">
|
|
<h3 class="text-2xl font-semibold">Penjualan</h3>
|
|
<p class="text-2xl my-5">{{ $data['totalPenjualan'] }}</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="grid lg:grid-cols-2 md:grid-cols-2 sm:grid-cols-1 gap-4 mt-10">
|
|
<div class="w-full bg-white p-3 rounded-lg shadow-lg">
|
|
<canvas id="barangTerjual"></canvas>
|
|
</div>
|
|
<div class="w-full bg-white p-3 rounded-lg shadow-lg">
|
|
<canvas id="barangTerjualSesuaiSize"></canvas>
|
|
</div>
|
|
</div>
|
|
<div class="w-full bg-white p-3 rounded-lg shadow-lg mt-5">
|
|
<canvas id="ssAndStok"></canvas>
|
|
</div>
|
|
</div>
|
|
@endsection
|
|
@section('script')
|
|
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
|
|
|
<script>
|
|
const stokSaldoPerBulanPerBarang = {!! json_encode($data['SSperBarang']) !!};
|
|
const currentStockPerBarang = {!! json_encode($data['currentStockPerBarang']) !!};
|
|
const barangTerjualThisMonthPerBarang = {!! json_encode($data['barangKeluarThisMonthPerBarang']) !!};
|
|
const barangKeluarThisMonthPerSize = {!! json_encode($data['barangKeluarThisMonthPerSize']) !!};
|
|
|
|
const labels = Object.keys(currentStockPerBarang);
|
|
const labels_permonth = Object.keys(barangTerjualThisMonthPerBarang);
|
|
const labelsUkuran = Object.keys(barangKeluarThisMonthPerSize);
|
|
const ssValues = Object.values(stokSaldoPerBulanPerBarang);
|
|
const currentStockValues = Object.values(currentStockPerBarang);
|
|
const barangTerjualValues = Object.values(barangTerjualThisMonthPerBarang);
|
|
const barangTerjualPersizeValues = Object.values(barangKeluarThisMonthPerSize);
|
|
|
|
const ctx = document.getElementById('ssAndStok').getContext('2d');
|
|
new Chart(ctx, {
|
|
type: 'bar',
|
|
data: {
|
|
labels: labels,
|
|
datasets: [{
|
|
label: 'Safety Stock',
|
|
data: ssValues,
|
|
backgroundColor: 'rgba(54, 162, 235, 0.2)',
|
|
borderColor: 'rgba(54, 162, 235, 1)',
|
|
borderWidth: 1
|
|
},
|
|
{
|
|
label: 'Stock',
|
|
data: currentStockValues,
|
|
backgroundColor: 'rgba(255, 99, 132, 0.2)',
|
|
borderColor: 'rgba(255, 99, 132, 1)',
|
|
borderWidth: 1
|
|
}]
|
|
},
|
|
options: {
|
|
scales: {
|
|
y: {
|
|
beginAtZero: true
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
const barangTerjualCtx = document.getElementById('barangTerjual').getContext('2d');
|
|
new Chart(barangTerjualCtx, {
|
|
type: 'bar',
|
|
data: {
|
|
labels: labels_permonth,
|
|
datasets: [{
|
|
label: 'Barang Terjual PerBulan',
|
|
data: barangTerjualValues,
|
|
backgroundColor: 'rgba(75, 192, 192, 0.2)',
|
|
borderColor: 'rgba(75, 192, 192, 1)',
|
|
borderWidth: 1
|
|
}]
|
|
},
|
|
options: {
|
|
scales: {
|
|
y: {
|
|
beginAtZero: true
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
const barangTerjualSesuaiSizeCtx = document.getElementById('barangTerjualSesuaiSize').getContext('2d');
|
|
new Chart(barangTerjualSesuaiSizeCtx, {
|
|
type: 'bar',
|
|
data: {
|
|
labels: labelsUkuran,
|
|
datasets: [{
|
|
label: 'Ukuran terbanyak yang dibeli',
|
|
data: barangTerjualPersizeValues ,
|
|
backgroundColor: 'rgba(75, 192, 192, 0.2)',
|
|
borderColor: 'rgba(75, 192, 192, 1)',
|
|
borderWidth: 1
|
|
}]
|
|
},
|
|
options: {
|
|
scales: {
|
|
y: {
|
|
beginAtZero: true
|
|
}
|
|
}
|
|
}
|
|
});
|
|
</script>
|
|
@endsection
|