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
33 changes: 12 additions & 21 deletions app/Helpers/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
class Helper
{
/**
* @var array $akun_persediaan
*
* @var array
*
* This static property holds an array of account inventory data.
*/
public static $akun_persediaan = [
Expand All @@ -39,7 +39,7 @@ class Helper
];

/**
* @var array $akun_perjalanan An array containing account information for travel.
* @var array An array containing account information for travel.
*/
public static $akun_perjalanan = [
'524111',
Expand Down Expand Up @@ -135,7 +135,7 @@ class Helper
'IV/e' => 'Pembina Utama',
];

/**
/**
* Mengubah tanggal ke nama hari.
*
* @param Date $tanggal
Expand Down Expand Up @@ -214,7 +214,6 @@ public static function jangkaWaktuHariKalender($awal, $akhir)
return $selisih.' ( '.self::terbilang($selisih).') Hari Kalender';
}


/**
* Mengubah Angka ke Suku Kata.
*
Expand Down Expand Up @@ -263,7 +262,6 @@ public static function hapusTitikAkhirKalimat($kalimat)
return rtrim($kalimat, '.');
}


/**
* Mengubah Angka ke Kata.
*
Expand Down Expand Up @@ -320,7 +318,6 @@ public static function terbilangTanggal($tanggal, $format = 's')
}
}


public static function getYearFromDate($tanggal, $typeIsDate = true)
{
return $typeIsDate ? Carbon::createFromFormat('Y-m-d', $tanggal->format('Y-m-d'))->year : Carbon::createFromFormat('Y-m-d', $tanggal)->year;
Expand Down Expand Up @@ -398,8 +395,8 @@ public static function getPengelola($role)
* This method fetches all cached DataPegawai records, filters them by the provided user ID
* and date, sorts them in descending order by date, and returns the first record.
*
* @param int $user_id The ID of the user whose DataPegawai record is to be retrieved.
* @param string $tanggal The date up to which the DataPegawai records should be considered.
* @param int $user_id The ID of the user whose DataPegawai record is to be retrieved.
* @param string $tanggal The date up to which the DataPegawai records should be considered.
* @return DataPegawai|null The most recent DataPegawai record for the given user ID up to the specified date, or null if no record is found.
*/
public static function getDataPegawaiByUserId($user_id, $tanggal)
Expand Down Expand Up @@ -683,7 +680,6 @@ public static function getJenisKontrak($tahun, $bulan): array
return JenisKontrak::cache()->get('all')->where('tanggal', '<=', $tanggal)->sortByDesc('tanggal')->first()->jenis ?? '';
}


/**
* Mengambil batas SBML.
*
Expand Down Expand Up @@ -817,20 +813,18 @@ public static function getTataNaskahId($tanggal)
return TataNaskah::cache()->get('all')->where('tanggal', '<=', $tanggal)->sortByDesc('tanggal')->first()->id ?? '';
}


/**
* Sets options for Derajat Naskah based on the given date.
*
* This method retrieves all Derajat Naskah records from the cache, filters them
* by the 'tata_naskah_id' corresponding to the provided date, and then sets the
* options using the 'kode' and 'derajat' fields.
*
* @param string $tanggal The date used to determine the 'tata_naskah_id'.
* @param string $tanggal The date used to determine the 'tata_naskah_id'.
* @return mixed The result of setting the options.
*/
public static function setOptionsDerajatNaskah($tanggal)
{

return self::setOptions(DerajatNaskah::cache()->get('all')->where('tata_naskah_id', self::getTataNaskahId($tanggal)), 'kode', 'derajat');
}

Expand All @@ -842,12 +836,12 @@ public static function setOptionsDerajatNaskah($tanggal)
* sets the options for Jenis Naskah by filtering the cached JenisNaskah records
* using the retrieved `kode_naskah_id`.
*
* @param string $tanggal The date used to determine the `tata_naskah_id`.
* @param string $tanggal The date used to determine the `tata_naskah_id`.
* @return array The options for Jenis Naskah with keys as 'id' and values as 'jenis'.
*/
public static function setOptionsJenisNaskah($tanggal)
{
$kode_naskah_id = KodeNaskah::cache()->get("all")->where("tata_naskah_id", self::getTataNaskahId($tanggal))->pluck("id");
$kode_naskah_id = KodeNaskah::cache()->get('all')->where('tata_naskah_id', self::getTataNaskahId($tanggal))->pluck('id');

return self::setOptions(JenisNaskah::cache()->get('all')->whereIn('kode_naskah_id', $kode_naskah_id), 'id', 'jenis');
}
Expand All @@ -859,28 +853,27 @@ public static function setOptionsJenisNaskah($tanggal)
* by the 'tata_naskah_id' that corresponds to the given date. It then
* sets options using the filtered records.
*
* @param string $tanggal The date used to determine the 'tata_naskah_id'.
* @param string $tanggal The date used to determine the 'tata_naskah_id'.
* @return mixed The result of the setOptions method.
*/
public static function setOptionsKodeArsip($tanggal)
{

return self::setOptions(KodeArsip::cache()->get('all')->where('tata_naskah_id', self::getTataNaskahId($tanggal)), 'id', 'detail', 'group');
}


/**
* Sets options for Mata Anggaran based on the given year.
*
* This method retrieves the DIPA ID for the specified year and uses it to filter
* the Mata Anggaran options. It then sets these options using the 'mak' field.
*
* @param int $tahun The year for which to set the Mata Anggaran options.
* @param int $tahun The year for which to set the Mata Anggaran options.
* @return array The filtered and set options for Mata Anggaran.
*/
public static function setOptionsMataAnggaran($tahun)
{
$dipa_id = self::getDipa($tahun)->id ?? '';

return self::setOptions(MataAnggaran::cache()->get('all')->where('dipa_id', $dipa_id), 'mak', 'mak');
}

Expand Down Expand Up @@ -937,6 +930,4 @@ public static function setOptionTahun()
{
return array_combine(range(date('Y'), 2024), range(date('Y'), 2024));
}


}
1 change: 0 additions & 1 deletion app/Models/NaskahKeluar.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use App\Helpers\Helper;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Auth;

class NaskahKeluar extends Model
Expand Down
2 changes: 1 addition & 1 deletion app/Models/SpesifikasiKerangkaAcuan.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class SpesifikasiKerangkaAcuan extends Model
{
use HasFactory;

/**
* Define a relationship where the AnggaranKerangkaAcuan model belongs to the KerangkaAcuan model.
*
Expand Down
1 change: 0 additions & 1 deletion app/Nova/NaskahKeluar.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Laravel\Nova\Fields\Date;
use Laravel\Nova\Fields\File;
use Laravel\Nova\Fields\FormData;
use Laravel\Nova\Fields\Hidden;
use Laravel\Nova\Fields\Line;
use Laravel\Nova\Fields\Select;
use Laravel\Nova\Fields\Stack;
Expand Down
2 changes: 1 addition & 1 deletion app/Policies/AnggaranKerangkaAcuanPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function create(): bool
public function update(): bool
{
return Policy::make()
->allowedFor('koordinator,anggota')
->allowedFor('koordinator,anggota')
->get();
}

Expand Down
4 changes: 2 additions & 2 deletions app/Policies/SpesifikasiKerangkaAcuanPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function view(): bool
public function create(): bool
{
return Policy::make()
->allowedFor('koordinator,anggota')
->allowedFor('koordinator,anggota')
->get();
}

Expand All @@ -43,7 +43,7 @@ public function create(): bool
public function update(): bool
{
return Policy::make()
->allowedFor('koordinator,anggota')
->allowedFor('koordinator,anggota')
->get();
}

Expand Down
2 changes: 1 addition & 1 deletion app/Providers/NovaServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ protected function dashboards()
public function tools()
{
return [

];
}

Expand Down
1 change: 0 additions & 1 deletion database/seeders/DatabaseSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,5 @@ public function run(): void
Template::cache()->updateAll();
UnitKerja::cache()->updateAll();
User::cache()->updateAll();

}
}