Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions app/Models/HonorSurvei.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -120,7 +117,6 @@ protected static function booted(): void
}
}
}

}
});
// static::deleting(function(Survei $survei) {
Expand Down
6 changes: 3 additions & 3 deletions app/Models/KerangkaAcuan.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 3 additions & 5 deletions app/Nova/HonorSurvei.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.
*
Expand Down Expand Up @@ -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');
}
Expand All @@ -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')
Expand Down Expand Up @@ -274,5 +273,4 @@ public function actions(NovaRequest $request)
return [];
}
}

}