From 1ee42703ba1afab7cd331bc609972df65155222a Mon Sep 17 00:00:00 2001 From: Andy Chaerudin Date: Thu, 22 Aug 2024 20:40:24 +0700 Subject: [PATCH 01/12] menerapkan generate code system di feature Jenis Fasilitas Kredit --- .../JenisFasilitasKreditController.php | 18 +++++++- app/Http/Library/LpjHelpers.php | 27 +++++++++++ .../Requests/JenisFasilitasKreditRequest.php | 8 ++-- ...24_08_11_023807_create_branches_table.php} | 0 ...4_08_22_093805_create_permohonan_table.php | 46 +++++++++++++++++++ .../jenis_fasilitas_kredit/create.blade.php | 11 +++-- 6 files changed, 100 insertions(+), 10 deletions(-) create mode 100644 app/Http/Library/LpjHelpers.php rename database/migrations/{2024_08_12_023807_create_branches_table.php => 2024_08_11_023807_create_branches_table.php} (100%) create mode 100644 database/migrations/2024_08_22_093805_create_permohonan_table.php diff --git a/app/Http/Controllers/JenisFasilitasKreditController.php b/app/Http/Controllers/JenisFasilitasKreditController.php index 59b481d..8d8a886 100644 --- a/app/Http/Controllers/JenisFasilitasKreditController.php +++ b/app/Http/Controllers/JenisFasilitasKreditController.php @@ -9,9 +9,11 @@ use Modules\Lpj\Exports\JenisFasilitasKreditExport; use Modules\Lpj\Http\Requests\JenisFasilitasKreditRequest; use Modules\Lpj\Models\JenisFasilitasKredit; + use Modules\Lpj\Http\Library\LpjHelpers; class JenisFasilitasKreditController extends Controller { + use LpjHelpers; // <---- Using the LpjHelpers Trait public $user; public function index() @@ -26,11 +28,18 @@ if ($validate) { try { // Save to database + // andy add + $lastNumberCodeJFK = LpjHelpers::onLastCodeJFK(); + + $validate['name'] =strtoupper($request->name); + $validate['code'] =$lastNumberCodeJFK; + // andy add + JenisFasilitasKredit::create($validate); return redirect() ->route('basicdata.jenis-fasilitas-kredit.index') ->with('success', 'Jenis Fasilitas Kredit created successfully'); - } catch (Exception $e) { + } catch (Exception $e) {dd($e); return redirect() ->route('basicdata.jenis-fasilitas-kredit.create') ->with('error', 'Failed to create jenis fasilitas kredit'); @@ -57,11 +66,16 @@ try { // Update in database $jenisFasilitasKredit = JenisFasilitasKredit::find($id); + + // andy add + $validate['name'] =strtoupper($request->name); + // andy add + $jenisFasilitasKredit->update($validate); return redirect() ->route('basicdata.jenis-fasilitas-kredit.index') ->with('success', 'Jenis Fasilitas Kredit updated successfully'); - } catch (Exception $e) { + } catch (Exception $e) {dd($e); return redirect() ->route('basicdata.jenis-fasilitas-kredit.edit', $id) ->with('error', 'Failed to update jenis fasilitas kredit'); diff --git a/app/Http/Library/LpjHelpers.php b/app/Http/Library/LpjHelpers.php new file mode 100644 index 0000000..f40380d --- /dev/null +++ b/app/Http/Library/LpjHelpers.php @@ -0,0 +1,27 @@ +max('code'); + + $noUrutAkhir=sprintf("%06s", 1); + $noUrutAwal = 'JFK'; + $noUrutAkhirString = $noUrutAkhir; + if($noUrutAkhir2){ + $noUrutAkhir = substr($noUrutAkhir2, 3, 6); + // $noUrutAwal = substr($noUrutAkhir2, 0, 3); + $noUrutAkhirString = sprintf("%06s", abs($noUrutAkhir + 1)); + } + + return $noUrutAwal . $noUrutAkhirString; + } +} diff --git a/app/Http/Requests/JenisFasilitasKreditRequest.php b/app/Http/Requests/JenisFasilitasKreditRequest.php index ea95974..60f8444 100644 --- a/app/Http/Requests/JenisFasilitasKreditRequest.php +++ b/app/Http/Requests/JenisFasilitasKreditRequest.php @@ -13,14 +13,16 @@ : array { $rules = [ - 'name' => 'required|max:255', + 'name' => 'required|max:255|unique:jenis_fasilitas_kredit,name' ]; if ($this->method() == 'PUT') { - $rules['code'] = 'required|max:50|unique:jenis_fasilitas_kredit,code,' . $this->id; + $rules['code'] = 'max:50|unique:jenis_fasilitas_kredit,code,' . $this->id; + $rules['name'] = 'required|unique:jenis_fasilitas_kredit,name,' . $this->id; } else { - $rules['code'] = 'required|max:50|unique:jenis_fasilitas_kredit,code'; + $rules['code'] = 'max:50|unique:jenis_fasilitas_kredit,code'; } + return $rules; } diff --git a/database/migrations/2024_08_12_023807_create_branches_table.php b/database/migrations/2024_08_11_023807_create_branches_table.php similarity index 100% rename from database/migrations/2024_08_12_023807_create_branches_table.php rename to database/migrations/2024_08_11_023807_create_branches_table.php diff --git a/database/migrations/2024_08_22_093805_create_permohonan_table.php b/database/migrations/2024_08_22_093805_create_permohonan_table.php new file mode 100644 index 0000000..e75f942 --- /dev/null +++ b/database/migrations/2024_08_22_093805_create_permohonan_table.php @@ -0,0 +1,46 @@ +id(); + $table->string('nomor_registrasi')->unique(); + $table->date('tanggal_permohonan'); + $table->foreignIdFor(User::class)->constrained(); + $table->foreignIdFor(Branch::class)->constrained(); + $table->foreignIdFor(TujuanPenilaian::class)->constrained('tujuan_penilaian')->onDelete('cascade'); + $table->foreignIdFor(Debiture::class)->constrained('debitures')->onDelete('cascade'); + $table->boolean('status')->default(true)->nullable(); + $table->timestamps(); + $table->timestamp('authorized_at')->nullable(); + $table->char('authorized_status', 1)->nullable(); + $table->softDeletes(); + + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('permohonan'); + } +}; diff --git a/resources/views/jenis_fasilitas_kredit/create.blade.php b/resources/views/jenis_fasilitas_kredit/create.blade.php index 6358c8b..02f73aa 100644 --- a/resources/views/jenis_fasilitas_kredit/create.blade.php +++ b/resources/views/jenis_fasilitas_kredit/create.blade.php @@ -1,3 +1,7 @@ +@php + $route = explode('.', Route::currentRouteName()); +@endphp + @extends('layouts.main') @section('breadcrumbs') @@ -28,11 +32,8 @@ -
- - @error('code') - {{ $message }} - @enderror +
+ {{ $jenisFasilitasKredit->code ?? '-' }}
From 7d09e3f77d08438a20e3e723d406062be297d15d Mon Sep 17 00:00:00 2001 From: Andy Chaerudin Date: Wed, 28 Aug 2024 15:34:50 +0700 Subject: [PATCH 02/12] menerapkan feature approve permohonan (blm selesai) --- .../Controllers/AuthorizationController.php | 200 ++++++++++++++++++ app/Models/PermohonanJaminan.php | 23 ++ ...075121_create_permohonan_jaminan_table.php | 37 ++++ ..._legalitas_jaminan_id_to_jenis_jaminan.php | 28 +++ module.json | 2 +- resources/views/authorization/index.blade.php | 138 ++++++++++++ routes/breadcrumbs.php | 6 + routes/web.php | 11 + 8 files changed, 444 insertions(+), 1 deletion(-) create mode 100644 app/Http/Controllers/AuthorizationController.php create mode 100644 app/Models/PermohonanJaminan.php create mode 100644 database/migrations/2024_08_23_075121_create_permohonan_jaminan_table.php create mode 100644 database/migrations/2024_08_27_083927_add_jenis_legalitas_jaminan_id_to_jenis_jaminan.php create mode 100644 resources/views/authorization/index.blade.php diff --git a/app/Http/Controllers/AuthorizationController.php b/app/Http/Controllers/AuthorizationController.php new file mode 100644 index 0000000..5f6d270 --- /dev/null +++ b/app/Http/Controllers/AuthorizationController.php @@ -0,0 +1,200 @@ +get()); + return view('lpj::authorization.index'); + } + + public function store(BranchRequest $request) + { + $validate = $request->validated(); + + if ($validate) { + try { + // Save to database + Branch::create($validate); + return redirect() + ->route('basicdata.branch.index') + ->with('success', 'Branch created successfully'); + } catch (Exception $e) { + return redirect() + ->route('basicdata.branch.create') + ->with('error', 'Failed to create branch'); + } + } + } + + public function create() + { + return view('lpj::branch.create'); + } + + public function edit($id) + { + $branch = Branch::find($id); + return view('lpj::branch.create', compact('branch')); + } + + public function update(BranchRequest $request, $id) + { + $validate = $request->validated(); + + if ($validate) { + try { + // Update in database + $branch = Branch::find($id); + $branch->update($validate); + return redirect() + ->route('basicdata.branch.index') + ->with('success', 'Branch updated successfully'); + } catch (Exception $e) { + return redirect() + ->route('basicdata.branch.edit', $id) + ->with('error', 'Failed to update branch'); + } + } + } + + public function destroy($id) + { + try { + // Delete from database + $branch = Branch::find($id); + $branch->delete(); + + echo json_encode(['success' => true, 'message' => 'Branch deleted successfully']); + } catch (Exception $e) { + echo json_encode(['success' => false, 'message' => 'Failed to delete branch']); + } + } + + public function dataForDatatables(Request $request) + { + // if (is_null($this->user) || !$this->user->can('branch.view')) { + //abort(403, 'Sorry! You are not allowed to view users.'); + // } + + // Retrieve data from the database + $query = Permohonan::query(); + // Get the total count of records + $totalRecords = $query->count(); + + // Apply pagination if provided + if ($request->has('page') && $request->has('size')) { + $page = $request->get('page'); + $size = $request->get('size'); + $offset = ($page - 1) * $size; // Calculate the offset + + $query->skip($offset)->take($size); + } + + // Get the filtered count of records + $filteredRecords = $query->count(); + + // Get the data for the current page + // $data = $query->get(); + $data = $query->select('permohonan.id', 'permohonan.nomor_registrasi' + , 'branches.name AS branche_name' + , 'debitures.name AS debiture_name' + // , 'tujuan_penilaian.name AS debiture_name' + , DB::raw("CONCAT(tujuan_penilaian.code,' - ', tujuan_penilaian.name) AS nama_tujuan_penilaian") + , 'users.name AS account_officer') + ->leftJoin('branches', 'branches.id', '=', 'permohonan.branch_id') + ->leftJoin('debitures', 'debitures.id', '=', 'permohonan.debiture_id') + ->leftJoin('tujuan_penilaian', 'tujuan_penilaian.id', '=', 'permohonan.tujuan_penilaian_id') + ->leftJoin('users', 'users.id', '=', 'permohonan.user_id') + ->get(); + // Calculate the page count + $pageCount = ceil($totalRecords / $request->get('size')); + + // Calculate the current page number + $currentPage = 0 + 1; + + // Return the response data as a JSON object + return response()->json([ + 'draw' => $request->get('draw'), + 'recordsTotal' => $totalRecords, + 'recordsFiltered' => $filteredRecords, + 'pageCount' => $pageCount, + 'page' => $currentPage, + 'totalCount' => $totalRecords, + 'data' => $data, + ]); + /* + // Apply search filter if provided + if ($request->has('search') && !empty($request->get('search'))) { + $search = $request->get('search'); + $query->where(function ($q) use ($search) { + $q->where('code', 'LIKE', "%$search%"); + $q->orWhere('name', 'LIKE', "%$search%"); + }); + } + + // Apply sorting if provided + if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) { + $order = $request->get('sortOrder'); + $column = $request->get('sortField'); + $query->orderBy($column, $order); + } + + // Get the total count of records + $totalRecords = $query->count(); + + // Apply pagination if provided + if ($request->has('page') && $request->has('size')) { + $page = $request->get('page'); + $size = $request->get('size'); + $offset = ($page - 1) * $size; // Calculate the offset + + $query->skip($offset)->take($size); + } + + // Get the filtered count of records + $filteredRecords = $query->count(); + + // Get the data for the current page + $data = $query->get(); + + // Calculate the page count + $pageCount = ceil($totalRecords / $request->get('size')); + + // Calculate the current page number + $currentPage = 0 + 1; + + // Return the response data as a JSON object + return response()->json([ + 'draw' => $request->get('draw'), + 'recordsTotal' => $totalRecords, + 'recordsFiltered' => $filteredRecords, + 'pageCount' => $pageCount, + 'page' => $currentPage, + 'totalCount' => $totalRecords, + 'data' => $data, + ]); + */ + } + + public function export() + { + return Excel::download(new BranchExport, 'branch.xlsx'); + } + } diff --git a/app/Models/PermohonanJaminan.php b/app/Models/PermohonanJaminan.php new file mode 100644 index 0000000..86e4b3f --- /dev/null +++ b/app/Models/PermohonanJaminan.php @@ -0,0 +1,23 @@ +id(); + $table->foreignIdFor(Permohonan::class)->constrained('permohonan'); + $table->foreignIdFor(DokumenJaminan::class)->contrained('dokumen_jaminan'); + $table->boolean('status')->default(true)->nullable(); + $table->timestamps(); + $table->softDeletes(); + + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('permohonan_jaminan'); + } +}; diff --git a/database/migrations/2024_08_27_083927_add_jenis_legalitas_jaminan_id_to_jenis_jaminan.php b/database/migrations/2024_08_27_083927_add_jenis_legalitas_jaminan_id_to_jenis_jaminan.php new file mode 100644 index 0000000..2d76120 --- /dev/null +++ b/database/migrations/2024_08_27_083927_add_jenis_legalitas_jaminan_id_to_jenis_jaminan.php @@ -0,0 +1,28 @@ +text('jenis_legalitas_jaminan_id')->nullable()->after('id')->comment('fk dari table jenis_legalitas_jaminan'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('jenis_jaminan', function (Blueprint $table) { + $table->dropColumn('jenis_legalitas_jaminan_id'); + }); + } +}; diff --git a/module.json b/module.json index edcf3c5..a534cd2 100644 --- a/module.json +++ b/module.json @@ -46,7 +46,7 @@ }, { "title": "Authorization", - "path": "", + "path": "authorization", "icon": "ki-filled ki-some-files text-lg", "classes": "", "attributes": [], diff --git a/resources/views/authorization/index.blade.php b/resources/views/authorization/index.blade.php new file mode 100644 index 0000000..320d9bb --- /dev/null +++ b/resources/views/authorization/index.blade.php @@ -0,0 +1,138 @@ +@extends('layouts.main') + +@section('breadcrumbs') + {{ Breadcrumbs::render('authorization') }} +@endsection + +@section('content') +
+
+
+

+ Daftar Authorization +

+ +
+
+
+ + + + + + + + + + + + +
+ + + Nomor Permohonan + + + Cabang + + + Debitur + + + Tujuan Penilain + + + Account Officer + + Action
+
+ +
+
+
+@endsection + +@push('scripts') + + +@endpush + diff --git a/routes/breadcrumbs.php b/routes/breadcrumbs.php index d2cdf88..980dc6f 100644 --- a/routes/breadcrumbs.php +++ b/routes/breadcrumbs.php @@ -232,4 +232,10 @@ $trail->parent('debitur.pemilik.index'); $trail->push('Edit Data Pemilik Jaminan Debitur'); }); + + // andy add + Breadcrumbs::for('authorization', function (BreadcrumbTrail $trail) { + $trail->push('Authorization', route('authorization.index')); + }); + // andy add diff --git a/routes/web.php b/routes/web.php index aa609f4..ba38e3e 100644 --- a/routes/web.php +++ b/routes/web.php @@ -16,6 +16,7 @@ use Modules\Lpj\Http\Controllers\NilaiPlafondController; use Modules\Lpj\Http\Controllers\PemilikJaminanController; use Modules\Lpj\Http\Controllers\TujuanPenilaianController; + use Modules\Lpj\Http\Controllers\AuthorizationController; /* |-------------------------------------------------------------------------- @@ -177,4 +178,14 @@ }); Route::resource('debitur', DebitureController::class); + + // andy + Route::name('authorization.')->prefix('authorization')->group(function () { + Route::get('/', [AuthorizationController::class, 'index'])->name('index'); + Route::get('datatables', [AuthorizationController::class, 'dataForDatatables']) + ->name('datatables'); + }); + + // Route::resource('authorization', AuthorizationController::class); + // andy }); From a7b69ff7d04eedfb6e60bbd3da72e04d46827336 Mon Sep 17 00:00:00 2001 From: Andy Chaerudin Date: Wed, 28 Aug 2024 17:13:46 +0700 Subject: [PATCH 03/12] rename 2024_08_22_080122_create_permohonan_table.php menjadi 2024_08_19_080122_create_permohonan_table.php (ganti tgl dari 20 menjadi 19) --- ..._08_19_080122_create_permohonan_table.php} | 0 ...4_08_22_093805_create_permohonan_table.php | 46 ------------------- 2 files changed, 46 deletions(-) rename database/migrations/{2024_08_22_080122_create_permohonan_table.php => 2024_08_19_080122_create_permohonan_table.php} (100%) delete mode 100644 database/migrations/2024_08_22_093805_create_permohonan_table.php diff --git a/database/migrations/2024_08_22_080122_create_permohonan_table.php b/database/migrations/2024_08_19_080122_create_permohonan_table.php similarity index 100% rename from database/migrations/2024_08_22_080122_create_permohonan_table.php rename to database/migrations/2024_08_19_080122_create_permohonan_table.php diff --git a/database/migrations/2024_08_22_093805_create_permohonan_table.php b/database/migrations/2024_08_22_093805_create_permohonan_table.php deleted file mode 100644 index e75f942..0000000 --- a/database/migrations/2024_08_22_093805_create_permohonan_table.php +++ /dev/null @@ -1,46 +0,0 @@ -id(); - $table->string('nomor_registrasi')->unique(); - $table->date('tanggal_permohonan'); - $table->foreignIdFor(User::class)->constrained(); - $table->foreignIdFor(Branch::class)->constrained(); - $table->foreignIdFor(TujuanPenilaian::class)->constrained('tujuan_penilaian')->onDelete('cascade'); - $table->foreignIdFor(Debiture::class)->constrained('debitures')->onDelete('cascade'); - $table->boolean('status')->default(true)->nullable(); - $table->timestamps(); - $table->timestamp('authorized_at')->nullable(); - $table->char('authorized_status', 1)->nullable(); - $table->softDeletes(); - - $table->unsignedBigInteger('created_by')->nullable(); - $table->unsignedBigInteger('updated_by')->nullable(); - $table->unsignedBigInteger('deleted_by')->nullable(); - $table->unsignedBigInteger('authorized_by')->nullable(); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::dropIfExists('permohonan'); - } -}; From 749dadfc887b57e32847062c09ce54d90b076044 Mon Sep 17 00:00:00 2001 From: Andy Chaerudin Date: Wed, 2 Oct 2024 11:33:23 +0700 Subject: [PATCH 04/12] upload feature registrasi view --- ...024_08_12_022025_create_branches_table.php | 39 ++++ ...23_073833_create_dokumen_jaminan_table.php | 52 +++++ resources/views/registrasi/edit.blade.php | 96 +++++++++ resources/views/registrasi/index.blade.php | 170 +++++++++++++++ .../views/registrasi/js/editjs.blade.php | 196 ++++++++++++++++++ .../views/registrasi/js/showjs.blade.php | 148 +++++++++++++ resources/views/registrasi/show.blade.php | 40 ++++ 7 files changed, 741 insertions(+) create mode 100644 database/migrations/2024_08_12_022025_create_branches_table.php create mode 100644 database/migrations/2024_08_23_073833_create_dokumen_jaminan_table.php create mode 100644 resources/views/registrasi/edit.blade.php create mode 100644 resources/views/registrasi/index.blade.php create mode 100644 resources/views/registrasi/js/editjs.blade.php create mode 100644 resources/views/registrasi/js/showjs.blade.php create mode 100644 resources/views/registrasi/show.blade.php diff --git a/database/migrations/2024_08_12_022025_create_branches_table.php b/database/migrations/2024_08_12_022025_create_branches_table.php new file mode 100644 index 0000000..bf4e9a8 --- /dev/null +++ b/database/migrations/2024_08_12_022025_create_branches_table.php @@ -0,0 +1,39 @@ +id(); + $table->string('code', 9)->unique(); + $table->string('name'); + $table->boolean('status')->default(true)->nullable(); + $table->timestamps(); + $table->timestamp('authorized_at')->nullable(); + $table->char('authorized_status', 1)->nullable(); + $table->softDeletes(); + + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down() + : void + { + Schema::dropIfExists('branches'); + } + }; diff --git a/database/migrations/2024_08_23_073833_create_dokumen_jaminan_table.php b/database/migrations/2024_08_23_073833_create_dokumen_jaminan_table.php new file mode 100644 index 0000000..2e663c9 --- /dev/null +++ b/database/migrations/2024_08_23_073833_create_dokumen_jaminan_table.php @@ -0,0 +1,52 @@ +id(); + $table->foreignIdFor(Debiture::class)->constrained('debitures')->onDelete('cascade'); + $table->foreignIdFor(Permohonan::class)->nullable()->constrained('permohonan')->onDelete('cascade'); + $table->foreignIdFor(JenisJaminan::class)->constrained('jenis_jaminan')->onDelete('cascade'); + $table->foreignIdFor(PemilikJaminan::class)->constrained('pemilik_jaminan')->onDelete('cascade'); + $table->string('province_code')->nullable()->index(); + $table->string('city_code')->nullable()->index(); + $table->string('district_code')->nullable()->index(); + $table->string('village_code')->nullable()->index(); + $table->string('postal_code', 5)->nullable(); + $table->text('address')->nullable(); + + $table->boolean('status')->default(true)->nullable(); + $table->timestamps(); + $table->timestamp('authorized_at')->nullable(); + $table->char('authorized_status', 1)->nullable(); + $table->softDeletes(); + + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('dokumen_jaminan'); + } +}; diff --git a/resources/views/registrasi/edit.blade.php b/resources/views/registrasi/edit.blade.php new file mode 100644 index 0000000..167fa25 --- /dev/null +++ b/resources/views/registrasi/edit.blade.php @@ -0,0 +1,96 @@ +@extends('layouts.main') + +@section('breadcrumbs') + {{ Breadcrumbs::render(request()->route()->getName()) }} +@endsection +@php + // $route = Route::currentRouteName(); + // dd($route); + $route = explode('.', Route::currentRouteName()); +@endphp + +@section('content') +
+ +
+ + @method('PUT') + @csrf +
+
+

+ Tambah Registrasi +

+ +
+
+
+ +
+ +
+
+
+ +
+    + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+
+
+
+
+@endsection +@include('lpj::registrasi.js.editjs') diff --git a/resources/views/registrasi/index.blade.php b/resources/views/registrasi/index.blade.php new file mode 100644 index 0000000..8a98fa4 --- /dev/null +++ b/resources/views/registrasi/index.blade.php @@ -0,0 +1,170 @@ +@extends('layouts.main') + +@section('breadcrumbs') + {{ Breadcrumbs::render('registrasi') }} +@endsection + +@section('content') +
+
+
+

+ Daftar Registrasi +

+
+
+ +
+ +
+
+
+
+ + + + + + + + + + + + + + +
+ + + Nomor Registrasi + + + Tanggal Permohonan + + + User Pemohon + + + Cabang Pemohon + + + Debitur + + + Tujuan Penilaian + + + Status + + Action
+
+ +
+
+
+@endsection + +@push('scripts') + + + +@endpush + diff --git a/resources/views/registrasi/js/editjs.blade.php b/resources/views/registrasi/js/editjs.blade.php new file mode 100644 index 0000000..bb23884 --- /dev/null +++ b/resources/views/registrasi/js/editjs.blade.php @@ -0,0 +1,196 @@ +@push('scripts') + +@endpush diff --git a/resources/views/registrasi/js/showjs.blade.php b/resources/views/registrasi/js/showjs.blade.php new file mode 100644 index 0000000..97a5110 --- /dev/null +++ b/resources/views/registrasi/js/showjs.blade.php @@ -0,0 +1,148 @@ +@push('scripts') + +@endpush diff --git a/resources/views/registrasi/show.blade.php b/resources/views/registrasi/show.blade.php new file mode 100644 index 0000000..7fbdcec --- /dev/null +++ b/resources/views/registrasi/show.blade.php @@ -0,0 +1,40 @@ +@extends('layouts.main') + +@section('breadcrumbs') + {{ Breadcrumbs::render(request()->route()->getName()) }} +@endsection +@php + // $route = Route::currentRouteName(); + // dd($route); registrasi.show + $route = explode('.', Route::currentRouteName()); +@endphp +@section('content') +
+
+
+

+ Detail Permohonan +

+ +
+
+ +
+ +
+ +
+
+ +
+
+
+@endsection +@include('lpj::registrasi.js.showjs') \ No newline at end of file From 024e3155721c08f27e281c6dae76ae533c42160c Mon Sep 17 00:00:00 2001 From: Andy Chaerudin Date: Wed, 2 Oct 2024 11:43:41 +0700 Subject: [PATCH 05/12] upload feature registrasi lengkap --- app/Http/Controllers/RegistrasiController.php | 270 ++++++++++++++++++ app/Models/Permohonan.php | 6 + ...4_10_01_095350_update_permohonan_table.php | 32 +++ module.json | 13 + routes/breadcrumbs.php | 15 + routes/registrasi.php | 25 ++ routes/web.php | 4 + 7 files changed, 365 insertions(+) create mode 100644 app/Http/Controllers/RegistrasiController.php create mode 100644 database/migrations/2024_10_01_095350_update_permohonan_table.php create mode 100644 routes/registrasi.php diff --git a/app/Http/Controllers/RegistrasiController.php b/app/Http/Controllers/RegistrasiController.php new file mode 100644 index 0000000..5f04aa6 --- /dev/null +++ b/app/Http/Controllers/RegistrasiController.php @@ -0,0 +1,270 @@ +user) || !$this->user->can('debitur.view')) { + //abort(403, 'Sorry! You are not allowed to view users.'); + } + + // Retrieve data from the database + $query = Permohonan::query()->where('status','=','preregister'); + + // Apply search filter if provided + if ($request->has('search') && !empty($request->get('search'))) { + $search = $request->get('search'); + $query->where(function ($q) use ($search) { + $q->where('nomor_registrasi', 'LIKE', '%' . $search . '%'); + $q->orWhere('tanggal_permohonan', 'LIKE', '%' . $search . '%'); + $q->orWhereRelation('user', 'name', 'LIKE', '%' . $search . '%'); + $q->orWhereRelation('debiture', 'name', 'LIKE', '%' . $search . '%'); + $q->orWhereRelation('tujuanPenilaian', 'name', 'LIKE', '%' . $search . '%'); + $q->orWhereRelation('branch', 'name', 'LIKE', '%' . $search . '%'); + $q->orWhere('status', 'LIKE', '%' . $search . '%'); + }); + } + + // Apply sorting if provided + if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) { + $order = $request->get('sortOrder'); + $column = $request->get('sortField'); + $query->orderBy($column, $order); + } + + // Get the total count of records + $totalRecords = $query->count(); + + // Apply pagination if provided + if ($request->has('page') && $request->has('size')) { + $page = $request->get('page'); + $size = $request->get('size'); + $offset = ($page - 1) * $size; // Calculate the offset + + $query->skip($offset)->take($size); + } + + // Get the filtered count of records + $filteredRecords = $query->count(); + + // Get the data for the current page + $data = $query->with(['user', 'debiture', 'branch', 'tujuanPenilaian'])->get(); + + // Calculate the page count + $pageCount = ceil($totalRecords / $request->get('size')); + + // Calculate the current page number + $currentPage = 0 + 1; + + // Return the response data as a JSON object + return response()->json([ + 'draw' => $request->get('draw'), + 'recordsTotal' => $totalRecords, + 'recordsFiltered' => $filteredRecords, + 'pageCount' => $pageCount, + 'page' => $currentPage, + 'totalCount' => $totalRecords, + 'data' => $data, + ]); + } + + public function edit($id) + { + return view('lpj::registrasi.edit', compact('id')); + } + + public function setData(Request $request): JsonResponse + { + $data = array(); + $datas = array(); + + if (request()->ajax()) { + $id = $request->id; + $datas = Permohonan::findOrFail($id); + $data['status'] = 'success'; + if ($datas) { + $jenisPenilaians=null; + $regions=null; + $regions=Regions::pluck('name', 'id'); + $jenisPenilaians=JenisPenilaian::pluck('name', 'id'); + + $data['regions'] = $regions; + $data['jenisPenilaians'] = $jenisPenilaians; + $data['datas'] = $datas; + $data['message'] = 'data successfully found'; + } else { + $data['datas'] = null; + $data['message'] = 'data not found'; + } + } else { + $data['status'] = 'error'; + $data['message'] = 'no ajax request'; + } + + return response()->json($data); + } + + public function update(Request $request, $id): JsonResponse + { + // init + $data = array(); + $dataku = array(); + $tindakan = null; + if (request()->ajax()) { + $validator = RegistrasiController::rulesEditnya($request, $id); + + if ($validator['fails']) { + $data['message'] = $validator['errors']; + $data['status'] = 'error'; + } + else + { + try { + + $tindakan=$request->tindakan; + $dataku = ['registrasi_by' => Auth::id(), + 'registrasi_at' => now() + ]; + + if($tindakan==0) + { + $dataku['jenis_penilaian_id'] =$request->jenis_penilaian; + $dataku['region_id'] =$request->region; + $dataku['status'] = 'registered'; + } + else + { + $dataku['registrasi_catatan'] =$request->catatan; + $dataku['status'] = 'revisi'; + } + + $data['dataku'] =$dataku; + + $modal = Permohonan::find($id); + + $modal->update($dataku); + // + $data['status'] = 'success'; + $data['message'] = 'Regitrasi '.$modal->nomor_registrasi.' successfully'; + } catch (Exception $e) { + + $data['status'] = 'error'; + $data['message'] = 'Jenis Fasilitas Kredit updated failed.'; + } + } + + } else { + $data['status'] = 'error'; + $data['message'] = 'no ajax request'; + } + + return response()->json($data); + + } + + public function rulesEditnya($request, $id) + { + $tindakan=null; + $jenis_penilaian=null; + $validate_catatan=''; + $tindakan=$request->tindakan; + $jenis_penilaian=$request->jenis_penilaian; + + $validateIt = [ + // 'name' diambil dari definisi parameter yang di kirim pada POST Data + 'tindakan' => 'required', + ]; + + $messageIt = [ + 'tindakan.required' => 'Silahkan pilih Tindakan' + ]; + + if($tindakan==0) + { + $validateIt['jenis_penilaian'] = ['required']; + $messageIt ['jenis_penilaian.required']= 'Silahkan pilih Jenis Penilaian'; + + // INTERNAL + if(1==$jenis_penilaian) + { + $validateIt['region'] = ['required']; + $messageIt ['region.required']= 'Silahkan pilih Region'; + } + } + elseif($tindakan==1) + { + $validateIt['catatan'] = ['required']; + $messageIt ['catatan.required']= 'Silahkan isi Catatan'; + } + + $validator = Validator::make($request->all(), $validateIt, $messageIt); + + $data['fails'] = $validator->fails(); + $data['errors'] = $validator->errors(); + + return $data; + } + + public function show($id) + { + return view('lpj::registrasi.show', compact('id')); + } + + public function showData(Request $request): JsonResponse + { + $data = array(); + $datas = array(); + + if (request()->ajax()) { + $id = $request->id; + $datas = Permohonan::findOrFail($id); + $data['status'] = 'success'; + if ($datas) { + $data['datas'] = $datas; + $data['message'] = 'data successfully found'; + } else { + $data['datas'] = null; + $data['message'] = 'data not found'; + } + } else { + $data['status'] = 'error'; + $data['message'] = 'no ajax request'; + } + + return response()->json($data); + } + } diff --git a/app/Models/Permohonan.php b/app/Models/Permohonan.php index 28b6de5..7b3329f 100644 --- a/app/Models/Permohonan.php +++ b/app/Models/Permohonan.php @@ -21,6 +21,12 @@ class Permohonan extends Base 'authorized_at', 'authorized_status', 'authorized_by', + // andy add + 'registrasi_catatan', + 'registrasi_by', + 'registrasi_at', + 'jenis_penilaian_id', + 'region_id' ]; public function user(){ diff --git a/database/migrations/2024_10_01_095350_update_permohonan_table.php b/database/migrations/2024_10_01_095350_update_permohonan_table.php new file mode 100644 index 0000000..98794df --- /dev/null +++ b/database/migrations/2024_10_01_095350_update_permohonan_table.php @@ -0,0 +1,32 @@ +text('registrasi_catatan')->nullable()->comment('kebutuhan untuk feature Registrasi'); + $table->unsignedBigInteger('registrasi_by')->nullable()->after('registrasi_catatan')->comment('kebutuhan untuk feature Registrasi'); + $table->timestamp('registrasi_at')->nullable()->after('registrasi_by')->comment('kebutuhan untuk feature Registrasi'); + $table->unsignedBigInteger('jenis_penilaian_id')->nullable()->after('registrasi_at')->comment('kebutuhan untuk feature Registrasi'); + $table->unsignedBigInteger('region_id')->nullable()->after('jenis_penilaian_id')->comment('kebutuhan untuk feature Registrasi'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('permohonan', function (Blueprint $table) { + + }); + } +}; diff --git a/module.json b/module.json index a3feab5..a5d9986 100644 --- a/module.json +++ b/module.json @@ -33,6 +33,19 @@ "Administrator" ] }, + { + "_comment1": "andy add", + "title": "Registrasi", + "path": "registrasi", + "icon": "ki-filled ki-some-files text-lg", + "classes": "", + "attributes": [], + "permission": "", + "roles": [ + "Administrator" + ], + "_comment2": "andy add" + }, { "title": "Data Debitur", "path": "debitur", diff --git a/routes/breadcrumbs.php b/routes/breadcrumbs.php index 162cfff..54cf9ac 100644 --- a/routes/breadcrumbs.php +++ b/routes/breadcrumbs.php @@ -268,3 +268,18 @@ $trail->push('Data Permohonan'); }); + // andy add + Breadcrumbs::for('registrasi', function (BreadcrumbTrail $trail) { + $trail->push('Registrasi', route('registrasi.index')); + }); + + Breadcrumbs::for('registrasi.edit', function (BreadcrumbTrail $trail) { + $trail->parent('registrasi'); + $trail->push('Tambah Registrasi'); + }); + + Breadcrumbs::for('registrasi.show', function (BreadcrumbTrail $trail) { + $trail->parent('registrasi'); + $trail->push('Detail Permohona'); + }); + // andy add diff --git a/routes/registrasi.php b/routes/registrasi.php new file mode 100644 index 0000000..8beb9ae --- /dev/null +++ b/routes/registrasi.php @@ -0,0 +1,25 @@ +group(function () { + + // andy add + // Route::name('registrasi.')->prefix('registrasi')->group(function () { + Route::controller(RegistrasiController::class)->group(function(){ + // Route::get('/', [RegistrasiController::class, 'index'])->name('registrasi.index'); + Route::get('/registrasi', 'index')->name('registrasi.index'); + Route::get('/registrasi/datatables', 'dataForDatatables')->name('registrasi.datatables'); + + // show data + Route::get('/registrasi/{registrasi}', 'show')->name('registrasi.show'); + Route::post('registrasi/showData', 'setData')->name('registrasi.showData'); + + Route::post('registrasi/setData', 'setData')->name('registrasi.setData'); + Route::get('/registrasi/{registrasi}/edit', 'edit')->name('registrasi.edit'); + Route::put('/registrasi/{registrasi}', 'update')->name('registrasi.update'); + + }); + // andy add +}); + diff --git a/routes/web.php b/routes/web.php index 86c6f6e..fc35e6c 100644 --- a/routes/web.php +++ b/routes/web.php @@ -210,3 +210,7 @@ // Route::resource('authorization', AuthorizationController::class); // andy }); + +// andy add +require __DIR__ . '/registrasi.php'; +// andy add From 01181aa9459f8e6e9db9d88acc56940b848e89f4 Mon Sep 17 00:00:00 2001 From: Andy Chaerudin Date: Wed, 2 Oct 2024 13:37:42 +0700 Subject: [PATCH 06/12] hapus script sweetalert pada file registrasi/index --- resources/views/registrasi/index.blade.php | 1 - 1 file changed, 1 deletion(-) diff --git a/resources/views/registrasi/index.blade.php b/resources/views/registrasi/index.blade.php index 8a98fa4..71b81ca 100644 --- a/resources/views/registrasi/index.blade.php +++ b/resources/views/registrasi/index.blade.php @@ -81,7 +81,6 @@ @endsection @push('scripts') - + \ No newline at end of file diff --git a/resources/views/registrasi/js/editjs.blade.php b/resources/views/registrasi/js/editjs.blade.php index bb23884..ac66b2e 100644 --- a/resources/views/registrasi/js/editjs.blade.php +++ b/resources/views/registrasi/js/editjs.blade.php @@ -1,4 +1,5 @@ @push('scripts') + @include('lpj::assetsku.includenya') + \ No newline at end of file diff --git a/resources/views/prosespenawaran/edit.blade.php b/resources/views/prosespenawaran/edit.blade.php new file mode 100644 index 0000000..53c318a --- /dev/null +++ b/resources/views/prosespenawaran/edit.blade.php @@ -0,0 +1,82 @@ +@extends('layouts.main') + +@section('breadcrumbs') + {{ Breadcrumbs::render(request()->route()->getName()) }} +@endsection +@php + // $route = Route::currentRouteName(); + // dd($route); + $route = explode('.', Route::currentRouteName()); +@endphp + +@section('content') +
+ + + + +
+
+

+ Tambah Data Proses Penawaran +

+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+
+
+

Data KJPP

+
+
+ + + + + + + + + + + + +
NoKJPPBiaya PenawaranUpload PenawaranAction
+
+
+
+ +
+ +
+
+
+
+@endsection +@include('lpj::prosespenawaran.js.editjs') \ No newline at end of file diff --git a/resources/views/prosespenawaran/index.blade.php b/resources/views/prosespenawaran/index.blade.php new file mode 100644 index 0000000..d07fe91 --- /dev/null +++ b/resources/views/prosespenawaran/index.blade.php @@ -0,0 +1,153 @@ +@extends('layouts.main') + +@section('breadcrumbs') + {{ Breadcrumbs::render('tender.prosespenawaran') }} +@endsection + +@section('content') +
+
+
+

+ Daftar Proses Penawaran +

+
+
+ +
+ +
+
+
+
+ + + + + + + + + + + + + +
+ + + Nomor Registrasi + + + Kode Penawaran + + + Tanggal Penawaran + + + Tujuan Penilaian + + + Total KJPP + + + Status + + Action
+
+ +
+
+
+@endsection + +@push('scripts') + + +@endpush diff --git a/resources/views/prosespenawaran/js/editextjs.blade.php b/resources/views/prosespenawaran/js/editextjs.blade.php new file mode 100644 index 0000000..cc9580e --- /dev/null +++ b/resources/views/prosespenawaran/js/editextjs.blade.php @@ -0,0 +1,147 @@ + \ No newline at end of file diff --git a/resources/views/prosespenawaran/js/editjs.blade.php b/resources/views/prosespenawaran/js/editjs.blade.php new file mode 100644 index 0000000..fb460fd --- /dev/null +++ b/resources/views/prosespenawaran/js/editjs.blade.php @@ -0,0 +1,136 @@ +@push('scripts') + @include('lpj::assetsku.includenya') + @include('lpj::prosespenawaran.js.editextjs') + +@endpush \ No newline at end of file diff --git a/resources/views/prosespenawaran/show.blade.php b/resources/views/prosespenawaran/show.blade.php new file mode 100644 index 0000000..1ef200f --- /dev/null +++ b/resources/views/prosespenawaran/show.blade.php @@ -0,0 +1,43 @@ +@extends('layouts.main') + +@section('breadcrumbs') + {{ Breadcrumbs::render(request()->route()->getName()) }} +@endsection +@php + $route = explode('.', Route::currentRouteName()); +@endphp +@section('content') +
+
+
+

+ Detail Data Proses Penawaran +

+ +
+
+
+

+ Nomor Register Permohonan: +

+ + {{ $prosespenawaran->nomor_registrasi }} + +
+
+

+ Kode Penawaran: +

+ + {{ $prosespenawaran->code }} + +
+
+
+
+ + +@endsection diff --git a/routes/breadcrumbs.php b/routes/breadcrumbs.php index 80e4d87..37ebef7 100644 --- a/routes/breadcrumbs.php +++ b/routes/breadcrumbs.php @@ -428,3 +428,19 @@ Breadcrumbs::for('registrasi.show', function (BreadcrumbTrail $trail) { $trail->push('Detail Permohona'); }); // andy add +// andy add 20241009 +Breadcrumbs::for('tender.prosespenawaran', function (BreadcrumbTrail $trail) { + $trail->parent('tender'); + $trail->push('Data Proses Penawaran', route('tender.prosespenawaran.index')); +}); + +Breadcrumbs::for('tender.prosespenawaran.edit', function (BreadcrumbTrail $trail) { + $trail->parent('tender.prosespenawaran'); + $trail->push('Tambah Data Proses Penawaran'); +}); + +Breadcrumbs::for('tender.prosespenawaran.show', function (BreadcrumbTrail $trail) { + $trail->parent('tender.prosespenawaran'); + $trail->push('Detail Data Proses Penawaran'); +}); +// andy add 20241009 diff --git a/routes/registrasi.php b/routes/registrasi.php index 8beb9ae..e57bb56 100644 --- a/routes/registrasi.php +++ b/routes/registrasi.php @@ -1,6 +1,7 @@ group(function () { @@ -21,5 +22,28 @@ Route::middleware(['auth'])->group(function () { }); // andy add + + + Route::name('tender.')->prefix('tender')->group(function () { + + // Proses Penawaran + Route::controller(ProsesPenawaranController::class)->group(function(){ + + Route::get('prosespenawaran', 'index')->name('prosespenawaran.index'); + Route::get('prosespenawaran/datatables', 'dataForDatatables')->name('prosespenawaran.datatables'); + Route::get('prosespenawaran/datatableskjppList_1', 'dataForDatatablesKJPPList_1')->name('prosespenawaran.datatableskjppList_1'); + + // show data + Route::get('/prosespenawaran/{prosespenawaran}', 'show')->name('prosespenawaran.show'); + Route::post('prosespenawaran/setData', 'setData')->name('prosespenawaran.setData'); + + Route::get('prosespenawaran/{prosespenawaran}/edit', 'edit')->name('prosespenawaran.edit'); + + Route::put('/prosespenawaran/{prosespenawaran}', 'update')->name('prosespenawaran.update'); + Route::put('/prosespenawaranAll/{prosespenawaran}', 'updateAll')->name('prosespenawaran.updateAll'); + Route::put('/prosespenawaranStatusKJPP/{prosespenawaran}', 'updateStatusPenawaranKJPP')->name('prosespenawaran.updateStatusPenawaranKJPP'); + + }); + }); });