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
5 changes: 2 additions & 3 deletions app/Models/JenisBelanja.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class JenisBelanja extends Model
{
use LaraCache;
protected $fillable = ['kode', 'dipa_id'];
protected $fillable = ['kode', 'dipa_id'];

public static function cacheEntities(): array
{
Expand All @@ -28,7 +28,6 @@ public function dipa(): BelongsTo
return $this->belongsTo(Dipa::class);
}


public function targetSerapanAnggaran(): HasMany
{
return $this->hasMany(TargetSerapanAnggaran::class);
Expand All @@ -45,7 +44,7 @@ protected static function booted(): void
});
static::created(function (JenisBelanja $jenis) {
foreach (range(1, 12) as $bulan) {
$targetSerapan = New TargetSerapanAnggaran();
$targetSerapan = new TargetSerapanAnggaran();
$targetSerapan->jenis_belanja_id = $jenis->id;
$targetSerapan->bulan = $bulan;
$targetSerapan->nilai = 100;
Expand Down
2 changes: 0 additions & 2 deletions app/Models/MataAnggaran.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace App\Models;

use App\Nova\Lenses\SerapanAnggaran;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Mostafaznv\LaraCache\CacheEntity;
Expand Down Expand Up @@ -32,7 +31,6 @@ public function realisasiAnggaran(): HasMany
return $this->hasMany(RealisasiAnggaran::class);
}


protected static function booted(): void
{
static::deleting(function (MataAnggaran $mataAnggaran) {
Expand Down
3 changes: 1 addition & 2 deletions app/Models/RealisasiAnggaran.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ class RealisasiAnggaran extends Model
protected $casts = [
'tanggal_sp2d' => 'date',
];
protected $fillable = ['dipa_id', 'mata_anggaran_id' ,'nomor_sp2d'];

protected $fillable = ['dipa_id', 'mata_anggaran_id', 'nomor_sp2d'];
}
1 change: 0 additions & 1 deletion app/Models/TargetSerapanAnggaran.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Mostafaznv\LaraCache\CacheEntity;
use Mostafaznv\LaraCache\Traits\LaraCache;

Expand Down
2 changes: 1 addition & 1 deletion app/Nova/Actions/ImportMataAnggaran.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public function fields(NovaRequest $request)
Text::make('Kode Satker/Kementrian', 'kode')
->rules('required')
->default('054.01'),
Number::make('Revisi ke- ' , 'revisi')
Number::make('Revisi ke- ', 'revisi')
->rules('required', 'gt:0')
->step(1),
Date::make('Tanggal Revisi', 'tanggal_revisi')
Expand Down
9 changes: 3 additions & 6 deletions app/Nova/Actions/ImportRealisasiAnggaran.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

namespace App\Nova\Actions;

use App\Helpers\Helper;
use App\Models\MataAnggaran;
use App\Models\RealisasiAnggaran;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Laravel\Nova\Actions\Action;
use Laravel\Nova\Fields\ActionFields;
Expand All @@ -32,9 +30,9 @@ public function handle(ActionFields $fields, Collection $models)
$model = $models->first();
RealisasiAnggaran::where('dipa_id', $model->id)->update(['updated_at' => null]);
$mataAnggarans = MataAnggaran::cache()
->get("all")
->pluck("id", "coa_id")
->all();
->get('all')
->pluck('id', 'coa_id')
->all();
(new FastExcel)->import($fields->file, function ($row) use ($model, $mataAnggarans) {
$array_coa = explode('.', $row['KODE COA']);
$coa_id = end($array_coa);
Expand All @@ -52,7 +50,6 @@ public function handle(ActionFields $fields, Collection $models)
$realisasiAnggaran->nilai = $row['NILAI RUPIAH'];
$realisasiAnggaran->updated_at = now();
$realisasiAnggaran->save();

});
RealisasiAnggaran::where('updated_at', null)->delete();
$model->tanggal_realisasi = RealisasiAnggaran::max('tanggal_sp2d');
Expand Down
8 changes: 4 additions & 4 deletions app/Nova/Filters/BulanFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ class BulanFilter extends Filter
/**
* Apply the filter to the given query.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Database\Eloquent\Builder $query
* @param mixed $value
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Database\Eloquent\Builder $query
* @param mixed $value
* @return \Illuminate\Database\Eloquent\Builder
*/
public function apply(Request $request, $query, $value)
Expand Down Expand Up @@ -46,4 +46,4 @@ public function options(Request $request)
'Desember' => '12',
];
}
}
}
6 changes: 2 additions & 4 deletions app/Nova/MataAnggaran.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use App\Helpers\Policy;
use App\Nova\Actions\AddHasManyModel;
use App\Nova\Actions\ImportRealisasiAnggaran;
use Illuminate\Validation\Rule;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Http\Requests\NovaRequest;
Expand Down Expand Up @@ -106,18 +105,17 @@ public function lenses(NovaRequest $request)
public function actions(NovaRequest $request)
{
$actions = [];
if (Policy::make()->allowedFor('koordinator,anggota')->get())
if (Policy::make()->allowedFor('koordinator,anggota')->get()) {
$actions[] =
AddHasManyModel::make('MataAnggaran', 'Dipa', $request->viaResourceId)
->confirmButtonText('Tambah')
// ->size('7xl')
->standalone()
->onlyOnIndex()
->addFields($this->fields($request));

}

return $actions;

}

/**
Expand Down
4 changes: 2 additions & 2 deletions app/Nova/TargetSerapanAnggaran.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

class TargetSerapanAnggaran extends Resource
{

public static $with = ['jenisBelanja'];

public static $globalSearchResults = 12;
Expand All @@ -33,7 +32,7 @@ public function title()

public function subtitle()
{
return 'Target: '.$this->nilai. '%';
return 'Target: '.$this->nilai.'%';
}

/**
Expand All @@ -44,6 +43,7 @@ public function subtitle()
public static $search = [
'jenisBelanja.kode',
];

/**
* Get the fields displayed by the resource.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function up(): void
{
Schema::create('jenis_belanjas', function (Blueprint $table) {
$table->id();
$table->string('kode', 2)->nullable();
$table->string('kode', 2)->nullable();
$table->mediumInteger('dipa_id')->nullable()->unsigned();
$table->timestamps();
});
Expand Down