[Warning] Penambahan Simulasi dan Aturan Jurnal SINTA
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Perhitungan\PlenoPenunjang;
|
||||
|
||||
use App\Exports\RasioP2Export;
|
||||
use App\Exports\RasioP2PoinExport;
|
||||
use App\Helpers\AturanPerhitunganHelper;
|
||||
use App\Helpers\BeritaAcaraHelper;
|
||||
use App\Helpers\JabatanPegawaiTambahanHelper;
|
||||
use App\Helpers\TotalTersisaRemunerasiHelper;
|
||||
@@ -14,6 +15,7 @@ use App\Models\Verifikator\Team;
|
||||
use App\Models\Verifikator\UnitKerja as UnitKerjaVerifikator;
|
||||
use App\Models\Verifikator\View\Pegawai;
|
||||
use App\Services\PerhitunganKegiatanService;
|
||||
use App\Services\PerhitunganKegiatanSimulasiService;
|
||||
use Exception;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
@@ -382,7 +384,6 @@ class RasioP2Controller extends Controller
|
||||
abort(404, 'Pegawai tidak ditemukan');
|
||||
}
|
||||
|
||||
$kegiatanService = new PerhitunganKegiatanService;
|
||||
$periode = $request->periode ?? Periode::where('status', true)->first()->id_periode;
|
||||
$bulan = $periode % 2 === 1 ? [1, 2, 3, 4, 5, 6] : [7, 8, 9, 10, 11, 12];
|
||||
|
||||
@@ -393,19 +394,10 @@ class RasioP2Controller extends Controller
|
||||
10 => 'Oktober', 11 => 'November', 12 => 'Desember',
|
||||
];
|
||||
|
||||
$forceAturanBaru = ($request->boolean('force_standar') || request()->routeIs('lainnya.simulasi-p2-mengajar-2026.*')) ? false : null;
|
||||
$useDataApi = $request->boolean('data_api');
|
||||
$isSimulasi = $this->isSimulasiStandar($request);
|
||||
|
||||
try {
|
||||
$kegiatans = $kegiatanService->listKegiatan(
|
||||
$nip,
|
||||
$periode,
|
||||
$bulan,
|
||||
$unit,
|
||||
idJabatan: $request->version,
|
||||
forceAturanBaru: $forceAturanBaru,
|
||||
useDataApi: $useDataApi
|
||||
);
|
||||
$kegiatans = $this->listKegiatan($request, $nip, $periode, $bulan, $unit, $request->boolean('data_api'));
|
||||
} catch (\Throwable $th) {
|
||||
return redirect()->back()->with('warning', $th->getMessage());
|
||||
}
|
||||
@@ -413,10 +405,11 @@ class RasioP2Controller extends Controller
|
||||
['monthSections' => $monthSections, 'grandUnits' => $grandUnits, 'grandTotals' => $grandTotals] =
|
||||
$this->prepareViewData($kegiatans, $months);
|
||||
|
||||
$title = ($forceAturanBaru === false ? 'Simulasi P2 (Standar) - ' : 'Detail - ') . $pegawai->nama;
|
||||
$aturanBaru = $this->aturanBaruSimulasi($request, $periode);
|
||||
$title = ($isSimulasi ? ($aturanBaru ? 'Simulasi P2 (Aturan Baru) - ' : 'Simulasi P2 (Standar) - ') : 'Detail - ') . $pegawai->nama;
|
||||
|
||||
return view('perhitungan.pleno-penunjang.rasio-p2.detail', compact(
|
||||
'title', 'pegawai', 'periode', 'unit', 'isAdmin',
|
||||
'title', 'pegawai', 'periode', 'unit', 'isAdmin', 'aturanBaru',
|
||||
'monthSections', 'grandUnits', 'grandTotals'
|
||||
));
|
||||
}
|
||||
@@ -448,20 +441,8 @@ class RasioP2Controller extends Controller
|
||||
abort(404, 'Bulan tidak valid');
|
||||
}
|
||||
|
||||
$kegiatanService = new PerhitunganKegiatanService;
|
||||
$forceAturanBaru = ($request->boolean('force_standar') || request()->routeIs('lainnya.simulasi-p2-mengajar-2026.*')) ? false : null;
|
||||
$useDataApi = $request->boolean('data_api');
|
||||
|
||||
try {
|
||||
$kegiatans = $kegiatanService->listKegiatan(
|
||||
$nip,
|
||||
$periode,
|
||||
[$bulan],
|
||||
$unit,
|
||||
idJabatan: $request->version,
|
||||
forceAturanBaru: $forceAturanBaru,
|
||||
useDataApi: $useDataApi
|
||||
);
|
||||
$kegiatans = $this->listKegiatan($request, $nip, $periode, [$bulan], $unit, $request->boolean('data_api'));
|
||||
} catch (\Throwable $th) {
|
||||
return redirect()->back()->with('warning', $th->getMessage());
|
||||
}
|
||||
@@ -954,6 +935,50 @@ class RasioP2Controller extends Controller
|
||||
return ['pengali660' => $pengali660, 'pengaliBiasa' => $pengaliBiasa];
|
||||
}
|
||||
|
||||
/**
|
||||
* Simulasi aturan standar (sebelum 401): lewat opsi force_standar atau menu Simulasi P2 Mengajar 2026.
|
||||
*/
|
||||
private function isSimulasiStandar(Request $request): bool
|
||||
{
|
||||
return $request->boolean('force_standar') || request()->routeIs('lainnya.simulasi-p2-mengajar-2026.*');
|
||||
}
|
||||
|
||||
/**
|
||||
* Aturan yang dipakai: pilihan `aturan` (standar|baru) bila ada, selain itu mengikuti aturan yang aktif
|
||||
* di menu Aturan Perhitungan untuk periode tersebut.
|
||||
*/
|
||||
private function aturanBaruSimulasi(Request $request, int|string $periode): bool
|
||||
{
|
||||
$aturan = $request->input('aturan');
|
||||
|
||||
return in_array($aturan, ['baru', 'standar'], true)
|
||||
? $aturan === 'baru'
|
||||
: AturanPerhitunganHelper::isAturanBaruActive($periode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mode simulasi (aturan standar atau data API) memakai service simulasi yang tidak menulis ke database,
|
||||
* selain itu memakai service perhitungan biasa.
|
||||
*/
|
||||
private function listKegiatan(Request $request, string $nip, int|string $periode, array $bulan, ?int $unit, bool $useDataApi = false): array
|
||||
{
|
||||
$simulasi = $this->isSimulasiStandar($request);
|
||||
|
||||
if (! $simulasi && ! $useDataApi) {
|
||||
return (new PerhitunganKegiatanService)->listKegiatan($nip, $periode, $bulan, $unit, idJabatan: $request->version);
|
||||
}
|
||||
|
||||
return (new PerhitunganKegiatanSimulasiService)->listKegiatan(
|
||||
$nip,
|
||||
$periode,
|
||||
$bulan,
|
||||
$unit,
|
||||
idJabatan: $request->version,
|
||||
aturanBaru: $this->aturanBaruSimulasi($request, $periode),
|
||||
useDataApi: $useDataApi
|
||||
);
|
||||
}
|
||||
|
||||
public function detailNew(Request $request, $nip): View|RedirectResponse
|
||||
{
|
||||
$team = Team::find(session('team_id'));
|
||||
@@ -968,7 +993,6 @@ class RasioP2Controller extends Controller
|
||||
abort(404, 'Pegawai tidak ditemukan');
|
||||
}
|
||||
|
||||
$kegiatanService = new PerhitunganKegiatanService;
|
||||
$periode = $request->periode ?? Periode::where('status', true)->first()->id_periode;
|
||||
|
||||
if ($periode % 2 === 1) {
|
||||
@@ -992,10 +1016,8 @@ class RasioP2Controller extends Controller
|
||||
12 => 'Desember',
|
||||
];
|
||||
|
||||
$forceAturanBaru = ($request->boolean('force_standar') || request()->routeIs('lainnya.simulasi-p2-mengajar-2026.*')) ? false : null;
|
||||
|
||||
try {
|
||||
$kegiatans = $kegiatanService->listKegiatan($nip, $periode, $bulan, $unit, idJabatan: $request->version, forceAturanBaru: $forceAturanBaru);
|
||||
$kegiatans = $this->listKegiatan($request, $nip, $periode, $bulan, $unit, false);
|
||||
} catch (\Throwable $th) {
|
||||
return redirect()->back()->with('warning', $th->getMessage());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user