diff --git a/app/Models/HonorSurvei.php b/app/Models/HonorSurvei.php index eae7ed3f..c87593e2 100644 --- a/app/Models/HonorSurvei.php +++ b/app/Models/HonorSurvei.php @@ -3,9 +3,6 @@ namespace App\Models; use App\Helpers\Helper; -use App\Models\JenisNaskah; -use App\Models\KodeArsip; -use App\Models\NaskahKeluar; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; @@ -76,8 +73,8 @@ protected static function booted(): void $honor->st_naskah_keluar_id = null; } if ($honor->bulan != null) { - if ($honor->generate_sk =='Ya') { - if ($honor->sk_naskah_keluar_id === null ) { + if ($honor->generate_sk == 'Ya') { + if ($honor->sk_naskah_keluar_id === null) { $jenis_naskah = JenisNaskah::cache()->get('all')->where('jenis', 'Keputusan')->first(); $kode_arsip = KodeArsip::cache()->get('all')->where('kode', 'VS.220')->first(); $naskahkeluar = new NaskahKeluar; @@ -99,8 +96,8 @@ protected static function booted(): void } } - if ($honor->generate_st =='Ya') { - if ($honor->st_naskah_keluar_id === null ) { + if ($honor->generate_st == 'Ya') { + if ($honor->st_naskah_keluar_id === null) { $jenis_naskah = JenisNaskah::cache()->get('all')->where('jenis', 'Surat Tugas')->first(); $naskahkeluar = new NaskahKeluar; $naskahkeluar->tanggal = $honor->tanggal_st; @@ -120,7 +117,6 @@ protected static function booted(): void } } } - } }); // static::deleting(function(Survei $survei) { diff --git a/app/Models/KerangkaAcuan.php b/app/Models/KerangkaAcuan.php index c6338e0b..6bef22c0 100644 --- a/app/Models/KerangkaAcuan.php +++ b/app/Models/KerangkaAcuan.php @@ -82,9 +82,9 @@ protected static function booted(): void $honor->tanggal_spj = $kak->akhir; $honor->mak = Helper::getSingleAkunHonor($kak->anggaran); $honor->kegiatan = $kak->kegiatan; - if ($kak->wasChanged('tanggal')){ - $honor->generate_sk =='Ya' ? $honor->tanggal_sk = $kak->tanggal: null; - $honor->generate_st == 'Ya' ? $honor->tanggal_st = $kak->tanggal: null; + if ($kak->wasChanged('tanggal')) { + $honor->generate_sk == 'Ya' ? $honor->tanggal_sk = $kak->tanggal : null; + $honor->generate_st == 'Ya' ? $honor->tanggal_st = $kak->tanggal : null; } $honor->save(); } else { diff --git a/app/Nova/HonorSurvei.php b/app/Nova/HonorSurvei.php index eacf0f55..2744914e 100644 --- a/app/Nova/HonorSurvei.php +++ b/app/Nova/HonorSurvei.php @@ -4,7 +4,6 @@ use App\Helpers\Helper; use App\Models\KodeArsip; -use App\Models\NaskahKeluar; use App\Models\User; use App\Nova\Actions\ImportDaftarHonor; use Illuminate\Database\Eloquent\Model; @@ -25,7 +24,7 @@ class HonorSurvei extends Resource { - public static $with = ['kerangkaAcuan.naskahKeluar', 'daftarHonor', 'skNaskahKeluar','stNaskahKeluar']; + public static $with = ['kerangkaAcuan.naskahKeluar', 'daftarHonor', 'skNaskahKeluar', 'stNaskahKeluar']; /** * The model the resource corresponds to. * @@ -147,7 +146,7 @@ public function fields(NovaRequest $request) ->hide() ->displayUsing(fn ($tanggal) => Helper::terbilangTanggal($tanggal)) ->dependsOn('generate_sk', function (Date $field, NovaRequest $request, FormData $formData) { - if ($formData->generate_sk=="Ya") { + if ($formData->generate_sk == 'Ya') { $field->show() ->rules('required', 'before_or_equal:today', 'after_or_equal:tanggal_kak'); } @@ -173,7 +172,7 @@ public function fields(NovaRequest $request) })->hideFromIndex(), BelongsTo::make('Nomor ST', 'stNaskahKeluar', 'App\Nova\NaskahKeluar') ->onlyOnDetail(), - + Text::make('Uraian Tugas', 'uraian_tugas') ->hide() ->help('Contoh: Melakukan Pencacahan Lapangan Sensus Penduduk 2020') @@ -274,5 +273,4 @@ public function actions(NovaRequest $request) return []; } } - }