feat(noc): tambahkan fitur Noc untuk pengelolaan data penyelesaian
- Menambahkan model baru untuk tabel `noc` beserta relasinya pada `Permohonan` dan `PersetujuanPenawaran`. - Menambahkan migrasi untuk membuat tabel `noc` di database. - Memodifikasi logika dan format data pada `NocController` untuk mendukung data terkait `noc`. - Mendefinisikan relasi baru di model `Permohonan` dan `PersetujuanPenawaran` untuk mendukung fitur `noc`. Signed-off-by: Daeng Deni Mardaeni <ddeni05@gmail.com>
This commit is contained in:
@@ -109,7 +109,7 @@
|
|||||||
/**
|
/**
|
||||||
* Display the specified resource.
|
* Display the specified resource.
|
||||||
*/
|
*/
|
||||||
public function show($id) { }
|
public function show($id) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the form for editing the specified resource.
|
* Show the form for editing the specified resource.
|
||||||
@@ -181,10 +181,13 @@
|
|||||||
'nomor_registrasi' => $persetujuanPenawaran->permohonan->nomor_registrasi ?? $persetujuanPenawaran->penawaran->nomor_registrasi,
|
'nomor_registrasi' => $persetujuanPenawaran->permohonan->nomor_registrasi ?? $persetujuanPenawaran->penawaran->nomor_registrasi,
|
||||||
'nama_debitur' => $persetujuanPenawaran->permohonan->debiture->name ?? $persetujuanPenawaran->penawaran->permohonan->debiture->name,
|
'nama_debitur' => $persetujuanPenawaran->permohonan->debiture->name ?? $persetujuanPenawaran->penawaran->permohonan->debiture->name,
|
||||||
'cabang' => $persetujuanPenawaran->permohonan->branch->name ?? $persetujuanPenawaran->penawaran->permohonan->branch->name,
|
'cabang' => $persetujuanPenawaran->permohonan->branch->name ?? $persetujuanPenawaran->penawaran->permohonan->branch->name,
|
||||||
'tanggal_setor' => formatTanggalIndonesia($persetujuanPenawaran->created_at, true),
|
'tanggal_setor' => dateFormat($persetujuanPenawaran->moc->created_at ?? $persetujuanPenawaran->created_at, true),
|
||||||
'nominal_bayar' => format_currency($persetujuanPenawaran->nominal_bayar ?? 0),
|
'nominal_bayar' => currencyFormat($persetujuanPenawaran->noc->nominal_bayar ?? $persetujuanPenawaran->nominal_bayar ?? 0),
|
||||||
'bukti_ksl' => $persetujuanPenawaran->bukti_ksl ?? null,
|
'bukti_ksl' => $persetujuanPenawaran->noc->bukti_ksl ?? $persetujuanPenawaran->bukti_ksl ?? null,
|
||||||
'tanggal_penyelesaian' => formatTanggalIndonesia($persetujuanPenawaran->updated_at, true),
|
'memo_penyelesaian' => $persetujuanPenawaran->noc->memo_penyelesaian ?? $persetujuanPenawaran->memo_penyelesaian ?? null,
|
||||||
|
'nominal_penyelesaian' => currencyFormat($persetujuanPenawaran->noc->nominal_penyelesaian ?? $persetujuanPenawaran->nominal_penyelesaian ?? 0),
|
||||||
|
'bukti_penyelesaian' => $persetujuanPenawaran->noc->bukti_penyelesaian ?? $persetujuanPenawaran->bukti_penyelesaian ?? null,
|
||||||
|
'tanggal_penyelesaian' => dateFormat($persetujuanPenawaran->noc->tanggal_penyelesaian ?? $persetujuanPenawaran->updated_at, true),
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
61
app/Models/Noc.php
Normal file
61
app/Models/Noc.php
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Lpj\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
// use Modules\Lpj\Database\Factories\NocFactory;
|
||||||
|
|
||||||
|
class Noc extends Base
|
||||||
|
{
|
||||||
|
protected $table = 'noc';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'permohonan_id',
|
||||||
|
'persetujuan_penawaran_id',
|
||||||
|
'bukti_bayar',
|
||||||
|
'nominal_bayar',
|
||||||
|
'status_bayar',
|
||||||
|
'tanggal_pembayaran',
|
||||||
|
'nominal_penyelesaian',
|
||||||
|
'status_penyelesaiaan',
|
||||||
|
'tanggal_penyelesaian',
|
||||||
|
'bukti_penyelesaian',
|
||||||
|
'bukti_ksl',
|
||||||
|
'memo_penyelesaian',
|
||||||
|
'status',
|
||||||
|
'authorized_status',
|
||||||
|
'authorized_at',
|
||||||
|
'authorized_by',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'nominal_bayar' => 'decimal:2',
|
||||||
|
'status_bayar' => 'boolean',
|
||||||
|
'tanggal_pembayaran' => 'date',
|
||||||
|
'nominal_penyelesaian' => 'decimal:2',
|
||||||
|
'status_penyelesaiaan' => 'boolean',
|
||||||
|
'tanggal_penyelesaian' => 'date',
|
||||||
|
'status' => 'boolean',
|
||||||
|
'authorized_status' => 'boolean',
|
||||||
|
'authorized_at' => 'datetime',
|
||||||
|
];
|
||||||
|
|
||||||
|
// Relationship with Permohonan
|
||||||
|
public function permohonan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Permohonan::class, 'permohonan_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Relationship with PersetujuanPenawaran
|
||||||
|
public function persetujuanPenawaran()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(PersetujuanPenawaran::class, 'persetujuan_penawaran_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Relationship with User (for authorized_by)
|
||||||
|
public function authorizedBy()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class, 'authorized_by');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -259,4 +259,10 @@
|
|||||||
return $this->belongsTo(Inspeksi::class, 'permohonan_id');
|
return $this->belongsTo(Inspeksi::class, 'permohonan_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add this relationship
|
||||||
|
public function noc()
|
||||||
|
{
|
||||||
|
return $this->hasOne(Noc::class, 'permohonan_id');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
'authorized_status',
|
'authorized_status',
|
||||||
'authorized_at',
|
'authorized_at',
|
||||||
'authorized_by',
|
'authorized_by',
|
||||||
'status',
|
|
||||||
'catatan',
|
'catatan',
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -58,4 +57,10 @@
|
|||||||
{
|
{
|
||||||
return $this->belongsTo(User::class, 'authorized_by');
|
return $this->belongsTo(User::class, 'authorized_by');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Relationship with Noc
|
||||||
|
public function noc()
|
||||||
|
{
|
||||||
|
return $this->hasOne(Noc::class, 'persetujuan_penawaran_id');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
51
database/migrations/2025_05_04_124217_create_nocs_table.php
Normal file
51
database/migrations/2025_05_04_124217_create_nocs_table.php
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration {
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
: void
|
||||||
|
{
|
||||||
|
Schema::create('noc', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->unsignedBigInteger('permohonan_id');
|
||||||
|
$table->unsignedBigInteger('persetujuan_penawaran_id');
|
||||||
|
$table->string('bukti_bayar')->nullable();
|
||||||
|
$table->decimal('nominal_bayar', 15, 2)->nullable();
|
||||||
|
$table->boolean('status_bayar')->default(false);
|
||||||
|
$table->date('tanggal_pembayaran')->nullable();
|
||||||
|
$table->decimal('nominal_penyelesaian', 15, 2)->nullable();
|
||||||
|
$table->boolean('status_penyelesaiaan')->default(false);
|
||||||
|
$table->date('tanggal_penyelesaian')->nullable();
|
||||||
|
$table->string('bukti_penyelesaian')->nullable();
|
||||||
|
$table->string('bukti_ksl')->nullable();
|
||||||
|
$table->text('memo_penyelesaian')->nullable();
|
||||||
|
$table->boolean('status')->default(true);
|
||||||
|
$table->char('authorized_status', 1)->nullable();
|
||||||
|
$table->timestamp('authorized_at')->nullable();
|
||||||
|
$table->unsignedBigInteger('authorized_by')->nullable();
|
||||||
|
$table->unsignedBigInteger('created_by')->nullable();
|
||||||
|
$table->unsignedBigInteger('updated_by')->nullable();
|
||||||
|
$table->unsignedBigInteger('deleted_by')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
$table->softDeletes();
|
||||||
|
|
||||||
|
$table->foreign('permohonan_id')->references('id')->on('permohonan');
|
||||||
|
$table->foreign('persetujuan_penawaran_id')->references('id')->on('persetujuan_penawaran');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
: void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('noc');
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user