diff --git a/app/Http/Controllers/KJPPController.php b/app/Http/Controllers/KJPPController.php index a3b5711..801d6a8 100644 --- a/app/Http/Controllers/KJPPController.php +++ b/app/Http/Controllers/KJPPController.php @@ -3,9 +3,11 @@ namespace Modules\Lpj\Http\Controllers; use App\Http\Controllers\Controller; -use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Http\Response; +use Modules\Lpj\Models\Branch; +use Modules\Lpj\Models\IjinUsaha; +use Modules\Lpj\Models\JenisAset; use Modules\Lpj\Models\KJPP; class KJPPController extends Controller @@ -24,13 +26,17 @@ class KJPPController extends Controller */ public function create() { - return view('lpj::create'); + $branch = Branch::all(); + $ijin_usaha = IjinUsaha::all(); + $jenis_aset = JenisAset::all(); + + return view('lpj::kjpp.create', compact('branch', 'ijin_usaha', 'jenis_aset')); } /** * Store a newly created resource in storage. */ - public function store(Request $request): RedirectResponse + public function store(Request $request) { // } @@ -54,7 +60,7 @@ class KJPPController extends Controller /** * Update the specified resource in storage. */ - public function update(Request $request, $id): RedirectResponse + public function update(Request $request, $id) { // } diff --git a/app/Http/Requests/IjinUsahaRequest.php b/app/Http/Requests/IjinUsahaRequest.php index 1acbe41..6f5cd80 100644 --- a/app/Http/Requests/IjinUsahaRequest.php +++ b/app/Http/Requests/IjinUsahaRequest.php @@ -12,9 +12,15 @@ class IjinUsahaRequest extends FormRequest public function rules(): array { $rules = [ - 'nama_ijin_usaha' => 'required|string|not_regex:/^\d+$/|max:255' + 'name' => 'required|string|not_regex:/^\d+$/|max:255' ]; + if ($this->method() == 'PUT') { + $rules['code'] = 'required|max:50|unique:ijin_usaha,code,' . $this->id; + } else { + $rules['code'] = 'required|max:50|unique:ijin_usaha,code'; + } + return $rules; } @@ -29,9 +35,12 @@ class IjinUsahaRequest extends FormRequest public function messages(): array { return [ - 'nama_ijin_usaha.required' => 'Nama Ijin Usaha harus diisi!', - 'nama_ijin_usaha.not_regex' => 'Nama Ijin Usaha harus berupa huruf!', - 'nama_ijin_usaha.max' => 'Nama Ijin Usaha maksimal 255 huruf!' + 'code.required' => 'Kode Ijin Usaha harus diisi!', + 'code.max' => 'Kode Ijin Usaha maksimal 255 huruf!', + 'code.unique' => 'Kode Ijin Usaha tidak boleh sama!', + 'name.required' => 'Nama Ijin Usaha harus diisi!', + 'name.not_regex' => 'Nama Ijin Usaha harus berupa huruf!', + 'name.max' => 'Nama Ijin Usaha maksimal 255 huruf!' ]; } } diff --git a/app/Models/Branch.php b/app/Models/Branch.php index 836cca5..834b5cc 100644 --- a/app/Models/Branch.php +++ b/app/Models/Branch.php @@ -1,16 +1,16 @@ hasMany(Debiture::class, 'branch_id', 'id'); - } + return $this->hasMany(Debiture::class, 'branch_id', 'id'); } +} diff --git a/app/Models/IjinUsaha.php b/app/Models/IjinUsaha.php index f1486fa..e2e464a 100644 --- a/app/Models/IjinUsaha.php +++ b/app/Models/IjinUsaha.php @@ -4,7 +4,6 @@ namespace Modules\Lpj\Models; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Factories\HasFactory; -use Modules\Lpj\Database\Factories\IjinUsahaFactory; class IjinUsaha extends Model { @@ -15,10 +14,5 @@ class IjinUsaha extends Model /** * The attributes that are mass assignable. */ - protected $fillable = ['nama_ijin_usaha']; - - // protected static function newFactory(): IjinUsahaFactory - // { - // //return IjinUsahaFactory::new(); - // } + protected $fillable = ['code', 'name']; } diff --git a/app/Models/JenisAset.php b/app/Models/JenisAset.php index 4a3edf8..6d18441 100644 --- a/app/Models/JenisAset.php +++ b/app/Models/JenisAset.php @@ -1,11 +1,11 @@ 'array', - 'pengalaman' => 'array', - 'kerjasama_sejak' => 'date', // For date fields - ]; - - // protected static function newFactory(): KJPPFactory - // { - // //return KJPPFactory::new(); - // } } diff --git a/database/migrations/2024_09_18_014746_create_ijin_usaha_table.php b/database/migrations/2024_09_18_014746_create_ijin_usaha_table.php index 9766587..af9e74f 100644 --- a/database/migrations/2024_09_18_014746_create_ijin_usaha_table.php +++ b/database/migrations/2024_09_18_014746_create_ijin_usaha_table.php @@ -13,8 +13,16 @@ return new class extends Migration { Schema::create('ijin_usaha', function (Blueprint $table) { $table->id(); - $table->string('nama_ijin_usaha'); + $table->string('code')->unique()->index(); + $table->string('name'); + $table->boolean('status')->default(true)->nullable(); + $table->char('authorized_status', 1)->nullable(); + $table->timestamp('authorized_at')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); $table->timestamps(); + $table->softDeletes(); + + $table->unsignedBigInteger('deleted_by')->nullable(); }); } diff --git a/database/migrations/2024_09_18_084905_create_kjpp_table.php b/database/migrations/2024_09_18_084905_create_kjpp_table.php index a7e747e..1a086d7 100644 --- a/database/migrations/2024_09_18_084905_create_kjpp_table.php +++ b/database/migrations/2024_09_18_084905_create_kjpp_table.php @@ -13,28 +13,35 @@ return new class extends Migration { Schema::create('kjpp', function (Blueprint $table) { $table->id(); - $table->string('nomor'); - $table->string('nama_kjpp'); - $table->string('kantor_pusat'); + $table->string('code'); + $table->string('name'); + $table->string('jenis_kantor'); $table->string('nomor_ijin_usaha'); - $table->string('kota'); - $table->date('kerjasama_sejak'); - $table->text('alamat_kantor'); - $table->string('no_tlp_kantor', 15); - $table->string('alamat_email'); - $table->string('nama_pimpinan_kantor'); - $table->string('no_hp_pimpinan', 15); + $table->string('province_code'); + $table->string('city_code'); + $table->string('district_code'); + $table->string('village_code'); + $table->string('address'); + $table->string('postal_code'); + $table->string('nomor_telepon_kantor'); + $table->string('email_kantor'); + $table->string('nomor_hp_pimpinan'); $table->string('nama_pic_reviewer'); - $table->string('no_pic_reviewer', 15); + $table->string('nomor_hp_pic_reviewer'); $table->string('nama_pic_admin'); - $table->string('no_pic_admin', 15); + $table->string('nomor_hp_pic_admin'); $table->string('nama_pic_marketing'); - $table->string('no_pic_marketing', 15); - $table->json('ijin_usaha'); - $table->json('pengalaman'); - $table->string('company_name'); - $table->string('ijin_ijin'); - $table->string('npwp'); + $table->string('nomor_hp_pic_marketing'); + $table->foreignId('ijin_usaha_id')->constrained()->onDelete('cascade'); + $table->foreignId('jenis_aset_id')->constrained()->onDelete('cascade'); + $table->string('attachment'); + $table->boolean('status')->default(true)->nullable(); + $table->char('authorized_status', 1)->nullable(); + $table->timestamp('authorized_at')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + $table->softDeletes(); + + $table->unsignedBigInteger('deleted_by')->nullable(); $table->timestamps(); }); } diff --git a/resources/views/Ijin_usaha/create.blade.php b/resources/views/Ijin_usaha/create.blade.php index 1bec879..507268d 100644 --- a/resources/views/Ijin_usaha/create.blade.php +++ b/resources/views/Ijin_usaha/create.blade.php @@ -25,15 +25,42 @@
+ @if (isset($ijin_usaha->id)) +
+ +
+ + @error('code') + {{ $message }} + @enderror +
+
+ @else +
+ +
+ + @error('code') + {{ $message }} + @enderror +
+
+ @endif
- - @error('nama_ijin_usaha') + + @error('name') {{ $message }} @enderror
diff --git a/resources/views/Ijin_usaha/index.blade.php b/resources/views/Ijin_usaha/index.blade.php index 3262d52..8364f63 100644 --- a/resources/views/Ijin_usaha/index.blade.php +++ b/resources/views/Ijin_usaha/index.blade.php @@ -35,7 +35,11 @@ - + + Kode Ijin Usaha + + + Nama Ijin Usaha @@ -114,7 +118,10 @@ return checkbox.outerHTML.trim(); }, }, - nama_ijin_usaha: { + code: { + title: 'Kode Ijin Usaha', + }, + name: { title: 'Nama Ijin Usaha', }, actions: { diff --git a/resources/views/jenis_jaminan/create.blade.php b/resources/views/jenis_jaminan/create.blade.php index ed04b81..0f9d930 100644 --- a/resources/views/jenis_jaminan/create.blade.php +++ b/resources/views/jenis_jaminan/create.blade.php @@ -6,75 +6,94 @@ @section('content')
- @if(isset($jenisJaminan->id)) + @if (isset($jenisJaminan->id))
@method('PUT') - @else - - @endif - @csrf -
-
-

- {{ isset($jenisJaminan->id) ? 'Edit' : 'Tambah' }} Jenis Jaminan -

-
- Back -
-
-
- @if(isset($jenisJaminan->id)) -
- -
- - @error('code') - {{ $message }} - @enderror -
-
- @endif -
- -
- - @error('name') - {{ $message }} - @enderror -
-
- -
- -
- @foreach($jenisLegalitasJaminan as $row) - - @endforeach -
-
-
- -
-
+ @else + + @endif + @csrf +
+
+

+ {{ isset($jenisJaminan->id) ? 'Edit' : 'Tambah' }} Jenis Jaminan +

+
+ Back +
+
+
+ @if (isset($jenisJaminan->id)) +
+ +
+ + @error('code') + {{ $message }} + @enderror
- +
+ @else +
+ +
+ + @error('code') + {{ $message }} + @enderror +
+
+ @endif +
+ +
+ + @error('name') + {{ $message }} + @enderror +
+
+ +
+ +
+ @foreach ($jenisLegalitasJaminan as $row) + + @endforeach +
+
+
+ +
+
+
+
@endsection diff --git a/resources/views/kjpp/create.blade.php b/resources/views/kjpp/create.blade.php new file mode 100644 index 0000000..3082354 --- /dev/null +++ b/resources/views/kjpp/create.blade.php @@ -0,0 +1,90 @@ +@extends('layouts.main') + +@section('breadcrumbs') + {{ Breadcrumbs::render(request()->route()->getName()) }} +@endsection + +@section('content') +
+ @if (isset($kjpp->id)) +
+ + @method('PUT') + @else + + @endif + @csrf +
+
+

+ {{ isset($kjpp->id) ? 'Edit' : 'Tambah' }} KJPP +

+
+ + Back +
+
+
+
+ +
+ + @error('nomor') + {{ $message }} + @enderror +
+
+
+ +
+ + @error('nama_kjpp') + {{ $message }} + @enderror +
+
+
+ +
+ +
+
+
+ +
+ + @error('nomor_ijin_usaha') + {{ $message }} + @enderror +
+
+
+ +
+
+
+
+
+@endsection diff --git a/routes/breadcrumbs.php b/routes/breadcrumbs.php index 9e78119..04ee52d 100644 --- a/routes/breadcrumbs.php +++ b/routes/breadcrumbs.php @@ -193,6 +193,16 @@ Breadcrumbs::for('basicdata.kjpp', function (BreadcrumbTrail $trail) { $trail->push('KJPP', route('basicdata.kjpp.index')); }); +Breadcrumbs::for('basicdata.kjpp.create', function (BreadcrumbTrail $trail) { + $trail->parent('basicdata.kjpp'); + $trail->push('Tambah KJPP', route('basicdata.kjpp.create')); +}); + +Breadcrumbs::for('basicdata.kjpp.edit', function (BreadcrumbTrail $trail) { + $trail->parent('basicdata.kjpp'); + $trail->push('Edit KJPP'); +}); + Breadcrumbs::for('basicdata.ijin_usaha', function (BreadcrumbTrail $trail) { $trail->parent('basicdata'); $trail->push('Ijin Usaha', route('basicdata.ijin_usaha.index'));