Tambahkan fitur pembatalan permohonan
- Menambahkan controller, view, dan route untuk mengelola pembatalan permohonan. - Memperbarui tampilan daftar permohonan dan menyesuaikan elemen UI terkait pembatalan. - Integrasi logika validasi dan penyimpanan data pembatalan. - Membuat endpoint datatable untuk kelola data pembatalan permohonan.
This commit is contained in:
147
app/Http/Controllers/PembatalanController.php
Normal file
147
app/Http/Controllers/PembatalanController.php
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Lpj\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Barryvdh\DomPDF\Facade\Pdf;
|
||||||
|
use Exception;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
|
use Modules\Location\Models\City;
|
||||||
|
use Modules\Location\Models\District;
|
||||||
|
use Modules\Location\Models\Province;
|
||||||
|
use Modules\Location\Models\Village;
|
||||||
|
use Modules\Lpj\Exports\PermohonanExport;
|
||||||
|
use Modules\Lpj\Http\Requests\PermohonanRequest;
|
||||||
|
use Modules\Lpj\Models\Branch;
|
||||||
|
use Modules\Lpj\Models\Debiture;
|
||||||
|
use Modules\Lpj\Models\DokumenJaminan;
|
||||||
|
use Modules\Lpj\Models\JenisFasilitasKredit;
|
||||||
|
use Modules\Lpj\Models\NilaiPlafond;
|
||||||
|
use Modules\Lpj\Models\Permohonan;
|
||||||
|
use Modules\Lpj\Models\PermohonanPembatalan;
|
||||||
|
use Modules\Lpj\Models\StatusPermohonan;
|
||||||
|
use Modules\Lpj\Models\TujuanPenilaian;
|
||||||
|
use Modules\Lpj\Services\PermohonanHistoryService;
|
||||||
|
|
||||||
|
class PembatalanController extends Controller
|
||||||
|
{
|
||||||
|
public $user;
|
||||||
|
protected $historyService;
|
||||||
|
|
||||||
|
public function __construct(PermohonanHistoryService $historyService)
|
||||||
|
{
|
||||||
|
$this->historyService = $historyService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
return view('lpj::pembatalan.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$pembatalan = PermohonanPembatalan::with(['permohonan.debiture','permohonan.branch'])->find($id);
|
||||||
|
|
||||||
|
return view(
|
||||||
|
'lpj::pembatalan.form',
|
||||||
|
compact(
|
||||||
|
'pembatalan'
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$pembatalan = PermohonanPembatalan::findOrFail($id);
|
||||||
|
$permohonan = Permohonan::find($pembatalan->permohonan_id);
|
||||||
|
$beforeRequest = $permohonan->toArray();
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Update Permohonan Pembatalan
|
||||||
|
if($request->status=='approved'){
|
||||||
|
$pembatalan->status = 'approved';
|
||||||
|
$pembatalan->save();
|
||||||
|
|
||||||
|
$permohonan->status = 'batal';
|
||||||
|
$permohonan->save();
|
||||||
|
} else{
|
||||||
|
$pembatalan->status = 'rejected';
|
||||||
|
$pembatalan->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('pembatalan.index')->with('success', 'Permohonan Pembatalan updated successfully');
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return redirect()
|
||||||
|
->route('pembatalan.edit', $id)->with('error', 'Failed to update permohonan Pembatalan');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function dataForDatatables(Request $request)
|
||||||
|
{
|
||||||
|
if (is_null($this->user) || !$this->user->can('debitur.view')) {
|
||||||
|
//abort(403, 'Sorry! You are not allowed to view users.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Retrieve data from the database
|
||||||
|
$query = PermohonanPembatalan::query();
|
||||||
|
$query = $query->orderBy('created_at', 'desc');
|
||||||
|
// Apply search filter if provided
|
||||||
|
if ($request->has('search') && !empty($request->get('search'))) {
|
||||||
|
$search = $request->get('search');
|
||||||
|
$query->where(function ($q) use ($search) {
|
||||||
|
$q->orWhereRelation('permohonan', 'nomor_registrasi', 'LIKE', '%' . $search . '%');
|
||||||
|
$q->orWhereRelation('permohonan.debiture', 'name', 'LIKE', '%' . $search . '%');
|
||||||
|
$q->orWhere('alasan_pembatalan', '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();
|
||||||
|
$size = $request->get('size', 10);
|
||||||
|
if ($size == 0) {
|
||||||
|
$size = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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(['permohonan.debiture','permohonan.branch','creator'])->get();
|
||||||
|
|
||||||
|
// Calculate the page count
|
||||||
|
$pageCount = ceil($totalRecords / $size);
|
||||||
|
|
||||||
|
// Calculate the current page number
|
||||||
|
$currentPage = max(1, $request->get('page', 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,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,6 +11,7 @@
|
|||||||
use Modules\Location\Models\District;
|
use Modules\Location\Models\District;
|
||||||
use Modules\Location\Models\Province;
|
use Modules\Location\Models\Province;
|
||||||
use Modules\Location\Models\Village;
|
use Modules\Location\Models\Village;
|
||||||
|
use Modules\Lpj\Models\PermohonanPembatalan;
|
||||||
use Modules\Lpj\Exports\PermohonanExport;
|
use Modules\Lpj\Exports\PermohonanExport;
|
||||||
use Modules\Lpj\Http\Requests\PermohonanRequest;
|
use Modules\Lpj\Http\Requests\PermohonanRequest;
|
||||||
use Modules\Lpj\Models\Branch;
|
use Modules\Lpj\Models\Branch;
|
||||||
@@ -25,7 +26,7 @@
|
|||||||
|
|
||||||
class PermohonanController extends Controller
|
class PermohonanController extends Controller
|
||||||
{
|
{
|
||||||
public $user;
|
public $user;
|
||||||
protected $historyService;
|
protected $historyService;
|
||||||
|
|
||||||
public function __construct(PermohonanHistoryService $historyService)
|
public function __construct(PermohonanHistoryService $historyService)
|
||||||
@@ -46,7 +47,7 @@
|
|||||||
// Process file upload
|
// Process file upload
|
||||||
$filePath = null;
|
$filePath = null;
|
||||||
if ($request->hasFile('attachment')) {
|
if ($request->hasFile('attachment')) {
|
||||||
$file = $request->file('attachment');
|
$file = $request->file('attachment');
|
||||||
$fileName = time() . '_' . $file->getClientOriginalName();
|
$fileName = time() . '_' . $file->getClientOriginalName();
|
||||||
$filePath = $file->storeAs('permohonan_attachments', $fileName, 'public');
|
$filePath = $file->storeAs('permohonan_attachments', $fileName, 'public');
|
||||||
}
|
}
|
||||||
@@ -65,7 +66,7 @@
|
|||||||
$keterangan,
|
$keterangan,
|
||||||
[], // beforeRequest is empty for new permohonan
|
[], // beforeRequest is empty for new permohonan
|
||||||
$permohonan->toArray(),
|
$permohonan->toArray(),
|
||||||
$filePath
|
$filePath,
|
||||||
);
|
);
|
||||||
return redirect()
|
return redirect()
|
||||||
->route('permohonan.index')->with('success', 'Permohonan created successfully');
|
->route('permohonan.index')->with('success', 'Permohonan created successfully');
|
||||||
@@ -136,7 +137,7 @@
|
|||||||
|
|
||||||
public function update(PermohonanRequest $request, $id)
|
public function update(PermohonanRequest $request, $id)
|
||||||
{
|
{
|
||||||
$permohonan = Permohonan::findOrFail($id);
|
$permohonan = Permohonan::findOrFail($id);
|
||||||
$beforeRequest = $permohonan->toArray();
|
$beforeRequest = $permohonan->toArray();
|
||||||
|
|
||||||
$validate = $request->validated();
|
$validate = $request->validated();
|
||||||
@@ -203,10 +204,10 @@
|
|||||||
|
|
||||||
// Get the total count of records
|
// Get the total count of records
|
||||||
$totalRecords = $query->count();
|
$totalRecords = $query->count();
|
||||||
$size = $request->get('size', 10);
|
$size = $request->get('size', 10);
|
||||||
if ($size == 0) {
|
if ($size == 0) {
|
||||||
$size = 10;
|
$size = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply pagination if provided
|
// Apply pagination if provided
|
||||||
if ($request->has('page') && $request->has('size')) {
|
if ($request->has('page') && $request->has('size')) {
|
||||||
@@ -221,7 +222,7 @@
|
|||||||
$filteredRecords = $query->count();
|
$filteredRecords = $query->count();
|
||||||
|
|
||||||
// Get the data for the current page
|
// Get the data for the current page
|
||||||
$data = $query->with(['user', 'debiture', 'branch', 'tujuanPenilaian','penilaian'])->get();
|
$data = $query->with(['user', 'debiture', 'branch', 'tujuanPenilaian', 'penilaian'])->get();
|
||||||
|
|
||||||
// Calculate the page count
|
// Calculate the page count
|
||||||
$pageCount = ceil($totalRecords / $size);
|
$pageCount = ceil($totalRecords / $size);
|
||||||
|
|||||||
14
module.json
14
module.json
@@ -26,6 +26,18 @@
|
|||||||
"pemohon-eo"
|
"pemohon-eo"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"title": "Pembatalan",
|
||||||
|
"path": "pembatalan",
|
||||||
|
"icon": "ki-filled ki-file-deleted text-lg text-danger",
|
||||||
|
"classes": "",
|
||||||
|
"attributes": [],
|
||||||
|
"permission": "",
|
||||||
|
"roles": [
|
||||||
|
"administrator",
|
||||||
|
"pemohon-eo"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"title": "Persetujuan Penawaran",
|
"title": "Persetujuan Penawaran",
|
||||||
"path": "persetujuan-penawaran",
|
"path": "persetujuan-penawaran",
|
||||||
@@ -167,7 +179,7 @@
|
|||||||
{
|
{
|
||||||
"title": "Authorization",
|
"title": "Authorization",
|
||||||
"path": "authorization",
|
"path": "authorization",
|
||||||
"icon": "ki-filled ki-security-user text-lg text-primary",
|
"icon": "ki-filled ki-security-user text-lg text-info",
|
||||||
"classes": "",
|
"classes": "",
|
||||||
"attributes": [],
|
"attributes": [],
|
||||||
"permission": "",
|
"permission": "",
|
||||||
|
|||||||
80
resources/views/pembatalan/form.blade.php
Normal file
80
resources/views/pembatalan/form.blade.php
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
@extends('layouts.main')
|
||||||
|
|
||||||
|
@section('breadcrumbs')
|
||||||
|
{{ Breadcrumbs::render(request()->route()->getName()) }}
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
||||||
|
<div class="card pb-2.5">
|
||||||
|
<div class="card-header">
|
||||||
|
<h3 class="card-title">Form Pembatalan Permohonan</h3>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<a href="{{ route('pembatalan.index') }}" class="btn btn-xs btn-info"><i class="ki-filled ki-exit-left"></i> Back</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<form action="{{ route('pembatalan.update', $pembatalan) }}" method="POST" class="grid gap-5">
|
||||||
|
@method('PUT')
|
||||||
|
@csrf
|
||||||
|
|
||||||
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
|
<label class="form-label max-w-56">
|
||||||
|
Nomor Registrasi
|
||||||
|
</label>
|
||||||
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
|
<input type="hidden" name="permohonan_id" value="{{ $pembatalan->permohonan->id }}">
|
||||||
|
<input type="text" class="input" value="{{ $pembatalan->permohonan->nomor_registrasi ?? '' }}" readonly>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
|
<label class="form-label max-w-56">
|
||||||
|
Nama Debitur
|
||||||
|
</label>
|
||||||
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
|
<input type="text" class="input" value="{{ $pembatalan->permohonan->debiture->name ?? '' }}" readonly>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
|
<label class="form-label max-w-56">
|
||||||
|
Alasan Pembatalan
|
||||||
|
</label>
|
||||||
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
|
<textarea readonly class="textarea @error('alasan_pembatalan') border-danger bg-danger-light @enderror"
|
||||||
|
name="alasan_pembatalan"
|
||||||
|
rows="4">{{ old('alasan_pembatalan', $pembatalan->alasan_pembatalan ) }}</textarea>
|
||||||
|
@error('alasan_pembatalan')
|
||||||
|
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
|
<label class="form-label max-w-56">
|
||||||
|
Dokumen Pendukung
|
||||||
|
</label>
|
||||||
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
|
@if($pembatalan->file_pembatalan)
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<a href="{{ Storage::url($pembatalan->file_pembatalan) }}" target="_blank" class="btn btn-xs btn-info">
|
||||||
|
<i class="ki-filled ki-eye"></i> Lihat Dokumen Pendukung
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
@error('file_pembatalan')
|
||||||
|
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex justify-end">
|
||||||
|
<button type="submit" class="btn btn-primary mr-3" name="status" value="approved">Approve</button>
|
||||||
|
<button type="submit" class="btn btn-danger" name="status" value="rejected">Reject</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
185
resources/views/pembatalan/index.blade.php
Normal file
185
resources/views/pembatalan/index.blade.php
Normal file
@@ -0,0 +1,185 @@
|
|||||||
|
@extends('layouts.main')
|
||||||
|
|
||||||
|
@section('breadcrumbs')
|
||||||
|
{{ Breadcrumbs::render('pembatalan') }}
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
||||||
|
<div class="card card-grid min-w-full" data-datatable="false" data-datatable-page-size="10" data-datatable-state-save="false" id="pembatalan-table" data-api-url="{{ route('pembatalan.datatables') }}">
|
||||||
|
<div class="card-header py-5 flex-wrap">
|
||||||
|
<h3 class="card-title">
|
||||||
|
Daftar Pembatalan Permohonan
|
||||||
|
</h3>
|
||||||
|
<div class="flex flex-wrap gap-2 lg:gap-5">
|
||||||
|
<div class="flex">
|
||||||
|
<label class="input input-sm"> <i class="ki-filled ki-magnifier"> </i>
|
||||||
|
<input placeholder="Search Pembatalan Peprmohonan" id="search" type="text" value="">
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-wrap gap-2.5">
|
||||||
|
<div class="h-[24px] border border-r-gray-200"></div>
|
||||||
|
<a class="btn btn-sm btn-light" href="#"> Export to Excel </a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="scrollable-x-auto">
|
||||||
|
<table class="table table-auto table-border align-middle text-gray-700 font-medium text-sm" data-datatable-table="true">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="w-14">
|
||||||
|
<input class="checkbox checkbox-sm" data-datatable-check="true" type="checkbox"/>
|
||||||
|
</th>
|
||||||
|
<th class="min-w-[150px]" data-datatable-column="nomor_registrasi">
|
||||||
|
<span class="sort"> <span class="sort-label"> Nomor Registrasi </span>
|
||||||
|
<span class="sort-icon"> </span> </span>
|
||||||
|
</th>
|
||||||
|
<th class="min-w-[150px]" data-datatable-column="nama_debitur">
|
||||||
|
<span class="sort"> <span class="sort-label"> Nama Debitur </span>
|
||||||
|
<span class="sort-icon"> </span> </span>
|
||||||
|
</th>
|
||||||
|
<th class="min-w-[150px]" data-datatable-column="cabang">
|
||||||
|
<span class="sort"> <span class="sort-label"> Cabang </span>
|
||||||
|
<span class="sort-icon"> </span> </span>
|
||||||
|
</th>
|
||||||
|
<th class="min-w-[150px]" data-datatable-column="user_pemohon">
|
||||||
|
<span class="sort"> <span class="sort-label"> User Pemohon</span>
|
||||||
|
<span class="sort-icon"> </span> </span>
|
||||||
|
</th>
|
||||||
|
<th class="min-w-[150px]" data-datatable-column="alasan_pembatalan">
|
||||||
|
<span class="sort"> <span class="sort-label"> Alasan Pembatalan </span>
|
||||||
|
<span class="sort-icon"> </span> </span>
|
||||||
|
</th>
|
||||||
|
<th class="min-w-[150px]" data-datatable-column="file_pembatalan">
|
||||||
|
<span class="sort"> <span class="sort-label"> Dokumen Pendukung </span>
|
||||||
|
<span class="sort-icon"> </span> </span>
|
||||||
|
</th>
|
||||||
|
|
||||||
|
<th class="min-w-[150px]" data-datatable-column="status">
|
||||||
|
<span class="sort"> <span class="sort-label"> Status </span>
|
||||||
|
<span class="sort-icon"> </span> </span>
|
||||||
|
</th>
|
||||||
|
<th class="min-w-[50px] text-center" data-datatable-column="actions">Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="card-footer justify-center md:justify-between flex-col md:flex-row gap-3 text-gray-600 text-2sm font-medium">
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
Show
|
||||||
|
<select class="select select-sm w-16" data-datatable-size="true" name="perpage"> </select> per
|
||||||
|
page
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-4">
|
||||||
|
<span data-datatable-info="true"> </span>
|
||||||
|
<div class="pagination" data-datatable-pagination="true">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@push('scripts')
|
||||||
|
<script type="module">
|
||||||
|
const element = document.querySelector('#pembatalan-table');
|
||||||
|
const searchInput = document.getElementById('search');
|
||||||
|
|
||||||
|
const apiUrl = element.getAttribute('data-api-url');
|
||||||
|
const dataTableOptions = {
|
||||||
|
apiEndpoint: apiUrl,
|
||||||
|
pageSize: 5,
|
||||||
|
columns: {
|
||||||
|
select: {
|
||||||
|
render: (item, data, context) => {
|
||||||
|
const checkbox = document.createElement('input');
|
||||||
|
checkbox.className = 'checkbox checkbox-sm';
|
||||||
|
checkbox.type = 'checkbox';
|
||||||
|
checkbox.value = data.id.toString();
|
||||||
|
checkbox.setAttribute('data-datatable-row-check', 'true');
|
||||||
|
return checkbox.outerHTML.trim();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
nomor_registrasi: {
|
||||||
|
title: 'Nomor Registrasi',
|
||||||
|
render: (item, data) => {
|
||||||
|
return `${data.permohonan.nomor_registrasi}`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
nama_debitur: {
|
||||||
|
title: 'Nama Debitur',
|
||||||
|
render: (item, data) => {
|
||||||
|
return `${data.permohonan.debiture.name}`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
cabang: {
|
||||||
|
title: 'Cabang',
|
||||||
|
render: (item, data) => {
|
||||||
|
return `${data.permohonan.branch.name}`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
user_pemohon: {
|
||||||
|
title: 'User Pemohon',
|
||||||
|
render: (item, data) => {
|
||||||
|
return `${data.creator.name}`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
alasan_pembatalan: {
|
||||||
|
title: 'Alasan Pembatalan'
|
||||||
|
},
|
||||||
|
status: {
|
||||||
|
title: 'Status',
|
||||||
|
render: (item, data) => {
|
||||||
|
if (data.status === 'pending') {
|
||||||
|
return `<span class="badge badge-sm badge-warning">Pending</span>`;
|
||||||
|
} else if (data.status === 'approved') {
|
||||||
|
return `<span class="badge badge-sm badge-success">Diterima</span>`;
|
||||||
|
} else if (data.status === 'rejected') {
|
||||||
|
return `<span class="badge badge-sm badge-danger">Ditolak</span>`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
file_pembatalan: {
|
||||||
|
title: 'Dokumen Pendukung',
|
||||||
|
render: (item, data) => {
|
||||||
|
if (data.file_pembatalan) {
|
||||||
|
return `<a href="storage/${data.file_pembatalan}" download="${data.file_pembatalan}" target="_blank" class="badge badge-sm badge-outline"> Download <i class="ki-filled ki-cloud-download"></i>
|
||||||
|
</a>`;
|
||||||
|
} else {
|
||||||
|
return 'Tidak ada dokumen';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
title: 'Action',
|
||||||
|
render: (item, data) => {
|
||||||
|
@if(auth()->user()->roles()->first()->name === "administrator" || auth()->user()->roles()->first()->name === "pemohon-eo")
|
||||||
|
if (data.status === 'pending') {
|
||||||
|
return `<div class="flex flex-nowrap justify-center">
|
||||||
|
<a class="btn btn-sm btn-outline btn-warning" href="pembatalan/${data.id}/edit">
|
||||||
|
<i class="ki-filled ki-eye"></i>
|
||||||
|
</a>
|
||||||
|
</div>`;
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
@else
|
||||||
|
return '';
|
||||||
|
@endif
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
let dataTable = new KTDataTable(element, dataTableOptions);
|
||||||
|
// Custom search functionality
|
||||||
|
searchInput.addEventListener('input', function () {
|
||||||
|
const searchValue = this.value.trim();
|
||||||
|
dataTable.search(searchValue, true);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
@@ -31,44 +31,44 @@
|
|||||||
<table class="table table-auto table-border align-middle text-gray-700 font-medium text-sm"
|
<table class="table table-auto table-border align-middle text-gray-700 font-medium text-sm"
|
||||||
data-datatable-table="true">
|
data-datatable-table="true">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="w-14">
|
<th class="w-14">
|
||||||
<input class="checkbox checkbox-sm" data-datatable-check="true" type="checkbox" />
|
<input class="checkbox checkbox-sm" data-datatable-check="true" type="checkbox"/>
|
||||||
</th>
|
</th>
|
||||||
<th class="min-w-[150px]" data-datatable-column="nomor_registrasi">
|
<th class="min-w-[150px]" data-datatable-column="nomor_registrasi">
|
||||||
<span class="sort"> <span class="sort-label"> Nomor Registrasi </span>
|
<span class="sort"> <span class="sort-label"> Nomor Registrasi </span>
|
||||||
<span class="sort-icon"> </span> </span>
|
<span class="sort-icon"> </span> </span>
|
||||||
</th>
|
</th>
|
||||||
<th class="min-w-[150px]" data-datatable-column="tanggal_permohonan">
|
<th class="min-w-[150px]" data-datatable-column="tanggal_permohonan">
|
||||||
<span class="sort"> <span class="sort-label"> Tanggal Permohonan </span>
|
<span class="sort"> <span class="sort-label"> Tanggal Permohonan </span>
|
||||||
<span class="sort-icon"> </span> </span>
|
<span class="sort-icon"> </span> </span>
|
||||||
</th>
|
</th>
|
||||||
<th class="min-w-[150px]" data-datatable-column="user_id">
|
<th class="min-w-[150px]" data-datatable-column="user_id">
|
||||||
<span class="sort"> <span class="sort-label"> User Pemohon </span>
|
<span class="sort"> <span class="sort-label"> User Pemohon </span>
|
||||||
<span class="sort-icon"> </span> </span>
|
<span class="sort-icon"> </span> </span>
|
||||||
</th>
|
</th>
|
||||||
<th class="min-w-[150px]" data-datatable-column="branch_id">
|
<th class="min-w-[150px]" data-datatable-column="branch_id">
|
||||||
<span class="sort"> <span class="sort-label"> Cabang Pemohon </span>
|
<span class="sort"> <span class="sort-label"> Cabang Pemohon </span>
|
||||||
<span class="sort-icon"> </span> </span>
|
<span class="sort-icon"> </span> </span>
|
||||||
</th>
|
</th>
|
||||||
<th class="min-w-[150px]" data-datatable-column="debitur_id">
|
<th class="min-w-[150px]" data-datatable-column="debitur_id">
|
||||||
<span class="sort"> <span class="sort-label"> Debitur </span>
|
<span class="sort"> <span class="sort-label"> Debitur </span>
|
||||||
<span class="sort-icon"> </span> </span>
|
<span class="sort-icon"> </span> </span>
|
||||||
</th>
|
</th>
|
||||||
<th class="min-w-[150px]" data-datatable-column="tujuan_penilaian_id">
|
<th class="min-w-[150px]" data-datatable-column="tujuan_penilaian_id">
|
||||||
<span class="sort"> <span class="sort-label"> Tujuan Penilaian </span>
|
<span class="sort"> <span class="sort-label"> Tujuan Penilaian </span>
|
||||||
<span class="sort-icon"> </span> </span>
|
<span class="sort-icon"> </span> </span>
|
||||||
</th>
|
</th>
|
||||||
<th class="min-w-[150px]" data-datatable-column="status">
|
<th class="min-w-[150px] text-center" data-datatable-column="status">
|
||||||
<span class="sort"> <span class="sort-label"> Status </span>
|
<span class="sort"> <span class="sort-label"> Status </span>
|
||||||
<span class="sort-icon"> </span> </span>
|
<span class="sort-icon"> </span> </span>
|
||||||
</th>
|
</th>
|
||||||
<th class="min-w-[150px]" data-datatable-column="keterangan">
|
<th class="min-w-[150px]" data-datatable-column="keterangan">
|
||||||
<span class="sort"> <span class="sort-label"> Keterangan </span>
|
<span class="sort"> <span class="sort-label"> Keterangan </span>
|
||||||
<span class="sort-icon"> </span> </span>
|
<span class="sort-icon"> </span> </span>
|
||||||
</th>
|
</th>
|
||||||
<th class="min-w-[50px] text-center" data-datatable-column="actions">Action</th>
|
<th class="min-w-[50px] text-right" data-datatable-column="actions">Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@@ -186,7 +186,10 @@
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
status: {
|
status: {
|
||||||
title: 'Status'
|
title: 'Status',
|
||||||
|
render: (item, data) => {
|
||||||
|
return `<span class="badge badge-sm badge-default uppercase flex justify-center">${data.status}</span>`;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
keterangan: {
|
keterangan: {
|
||||||
title: 'Keterangan'
|
title: 'Keterangan'
|
||||||
@@ -194,7 +197,7 @@
|
|||||||
actions: {
|
actions: {
|
||||||
title: 'Actions',
|
title: 'Actions',
|
||||||
render: (item, data) => {
|
render: (item, data) => {
|
||||||
let actionHtml = `<div class="flex flex-nowrap justify-center gap-1.5">`;
|
let actionHtml = `<div class="flex flex-nowrap justify-end gap-1.5">`;
|
||||||
|
|
||||||
if (data && data.penilaian && data.penilaian.waktu_penilaian !== null && data.status !==
|
if (data && data.penilaian && data.penilaian.waktu_penilaian !== null && data.status !==
|
||||||
'done' && data.penilaian.authorized_status == null) {
|
'done' && data.penilaian.authorized_status == null) {
|
||||||
@@ -233,7 +236,7 @@
|
|||||||
|
|
||||||
let dataTable = new KTDataTable(element, dataTableOptions);
|
let dataTable = new KTDataTable(element, dataTableOptions);
|
||||||
// Custom search functionality
|
// Custom search functionality
|
||||||
searchInput.addEventListener('input', function() {
|
searchInput.addEventListener('input', function () {
|
||||||
const searchValue = this.value.trim();
|
const searchValue = this.value.trim();
|
||||||
dataTable.search(searchValue, true);
|
dataTable.search(searchValue, true);
|
||||||
|
|
||||||
@@ -267,19 +270,19 @@
|
|||||||
cache: false,
|
cache: false,
|
||||||
data: input_data,
|
data: input_data,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(response) {
|
success: function (response) {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
if ('success' == response.status) {
|
if ('success' == response.status) {
|
||||||
swal.fire('Sukses Menyetujui!', response.message, 'success').then(
|
swal.fire('Sukses Menyetujui!', response.message, 'success').then(
|
||||||
() => {
|
() => {
|
||||||
location.reload(true);
|
location.reload(true);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Swal.fire('Error!', response.message, 'error');
|
Swal.fire('Error!', response.message, 'error');
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
error: function(response, textStatus, errorThrown) {
|
error: function (response, textStatus, errorThrown) {
|
||||||
// var errors = response.responseJSON.errors;
|
// var errors = response.responseJSON.errors;
|
||||||
// console.log(errors);
|
// console.log(errors);
|
||||||
console.log(response);
|
console.log(response);
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ use Modules\Lpj\Http\Controllers\KJPPController;
|
|||||||
use Modules\Lpj\Http\Controllers\LaporanController;
|
use Modules\Lpj\Http\Controllers\LaporanController;
|
||||||
use Modules\Lpj\Http\Controllers\NilaiPlafondController;
|
use Modules\Lpj\Http\Controllers\NilaiPlafondController;
|
||||||
use Modules\Lpj\Http\Controllers\NocController;
|
use Modules\Lpj\Http\Controllers\NocController;
|
||||||
|
use Modules\Lpj\Http\Controllers\PembatalanController;
|
||||||
use Modules\Lpj\Http\Controllers\PemilikJaminanController;
|
use Modules\Lpj\Http\Controllers\PemilikJaminanController;
|
||||||
use Modules\Lpj\Http\Controllers\PenilaianController;
|
use Modules\Lpj\Http\Controllers\PenilaianController;
|
||||||
use Modules\Lpj\Http\Controllers\PenilaiController;
|
use Modules\Lpj\Http\Controllers\PenilaiController;
|
||||||
@@ -372,6 +373,11 @@ Route::middleware(['auth'])->group(function () {
|
|||||||
|
|
||||||
Route::resource('permohonan', PermohonanController::class);
|
Route::resource('permohonan', PermohonanController::class);
|
||||||
|
|
||||||
|
Route::name('pembatalan.')->prefix('pembatalan')->group(function () {
|
||||||
|
Route::get('datatables', [PembatalanController::class, 'dataForDatatables'])->name('datatables');
|
||||||
|
});
|
||||||
|
Route::resource('pembatalan', PembatalanController::class);
|
||||||
|
|
||||||
Route::get('authorization', [PermohonanController::class, 'authorization'])->name('authorization.index');
|
Route::get('authorization', [PermohonanController::class, 'authorization'])->name('authorization.index');
|
||||||
Route::get('authorization/datatables', [PermohonanController::class, 'dataForAuthorization'])->name(
|
Route::get('authorization/datatables', [PermohonanController::class, 'dataForAuthorization'])->name(
|
||||||
'authorization.datatables',
|
'authorization.datatables',
|
||||||
|
|||||||
Reference in New Issue
Block a user