feat(breadcrumbs): tambahkan breadcrumbs pada halaman laporan SLA, debiture, user, dan monitoring; perbarui route laporan SLA, debiture, user, dan monitoring
This commit is contained in:
@@ -3,7 +3,9 @@
|
||||
namespace Modules\Lpj\Services;
|
||||
|
||||
use Modules\Lpj\Models\Laporan;
|
||||
|
||||
use Modules\Lpj\Models\Noc;
|
||||
use Modules\Lpj\Models\Permohonan;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
class DashboardService
|
||||
{
|
||||
public function getDashboardData($start_date, $end_date)
|
||||
@@ -11,11 +13,13 @@ class DashboardService
|
||||
$countLpjInternal = $this->getTotalLpjInternal($start_date, $end_date);
|
||||
$countLpjExternal = $this->getTotalLpjEksternal($start_date, $end_date);
|
||||
$countResume = $this->getResumeCabang($start_date, $end_date);
|
||||
$countPendapatan = $this->getPendapatanAppraisal($start_date, $end_date);
|
||||
|
||||
return [
|
||||
'count_lpj_internal' => $countLpjInternal,
|
||||
'count_lpj_eksternal' => $countLpjExternal,
|
||||
'count_resume' => $countResume
|
||||
'count_resume' => $countResume,
|
||||
'count_pendapatan' => $countPendapatan
|
||||
];
|
||||
|
||||
}
|
||||
@@ -43,12 +47,16 @@ class DashboardService
|
||||
|
||||
$totalLaporan = Laporan::whereBetween('created_at', [$start_date, $end_date])
|
||||
->count();
|
||||
$totalDebitur = Permohonan::whereBetween('created_at', [$start_date, $end_date])
|
||||
->where('status', 'done')
|
||||
->distinct()
|
||||
->count('debiture_id');
|
||||
|
||||
|
||||
|
||||
$data[$month][$region] = [
|
||||
'total_laporan' => $totalLaporan,
|
||||
'total_debiture' => 20,
|
||||
'total_debiture' => $totalDebitur,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -58,11 +66,37 @@ class DashboardService
|
||||
|
||||
|
||||
|
||||
public function getPendapatanAppraisal()
|
||||
{
|
||||
|
||||
public function getPendapatanAppraisal($start_date, $end_date)
|
||||
{
|
||||
$months = $this->getMonthly();
|
||||
$data = [];
|
||||
|
||||
foreach ($months as $index => $month) {
|
||||
$monthNumber = $index + 1;
|
||||
|
||||
if ($monthNumber > now()->month) {
|
||||
// Bulan belum terjadi
|
||||
$data[$month] = [
|
||||
'total_jumlah' => 0,
|
||||
'total_akumulasi' => 0,
|
||||
];
|
||||
} else {
|
||||
// Hitung jumlah nominal_bayar pada bulan ini
|
||||
$totalJumlah = Noc::whereYear('tanggal_pembayaran', now()->year)
|
||||
->whereMonth('tanggal_pembayaran', $monthNumber)
|
||||
->sum('nominal_bayar');
|
||||
|
||||
|
||||
$data[$month] = [
|
||||
'total_jumlah' => $totalJumlah,
|
||||
'total_akumulasi' => $totalJumlah,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getResumeCabang($start_date, $end_date)
|
||||
{
|
||||
$regions = $this->getRegion();
|
||||
@@ -72,7 +106,12 @@ class DashboardService
|
||||
foreach ($status as $item) {
|
||||
$data[$item] = [];
|
||||
foreach ($regions as $region) {
|
||||
$totalLaporan = Laporan::where('created_at', '>=', $start_date)->where('created_at', '<=', $end_date)->count();
|
||||
$totalLaporan = DB::table('laporan')
|
||||
->join('permohonan', 'laporan.permohonan_id', '=', 'permohonan.id')
|
||||
->where('permohonan.status', $item)
|
||||
->whereBetween('laporan.created_at', [$start_date, $end_date])
|
||||
->count();
|
||||
|
||||
$data[$item][$region] = [
|
||||
'count_report' => $totalLaporan,
|
||||
];
|
||||
@@ -95,9 +134,15 @@ class DashboardService
|
||||
];
|
||||
} else {
|
||||
$totalLaporan = Laporan::where('created_at', '>=', $start_date)->where('created_at', '<=', $end_date)->count();
|
||||
|
||||
$totalDebitur = Permohonan::whereBetween('created_at', [$start_date, $end_date])
|
||||
->where('status', 'done')
|
||||
->distinct()
|
||||
->count('debiture_id');
|
||||
|
||||
$data[$month] = [
|
||||
'total_laporan' => $totalLaporan,
|
||||
'total_debiture' => 20,
|
||||
'total_debiture' => $totalDebitur,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user