Merge branch 'staging' of https://git.putrakuningan.com/daengdeni/lpj into tender
This commit is contained in:
@@ -403,8 +403,8 @@ class PenilaiController extends Controller
|
|||||||
$jaminanId = $request->query('jaminanId');
|
$jaminanId = $request->query('jaminanId');
|
||||||
$provinces = Province::all();
|
$provinces = Province::all();
|
||||||
$permohonan = $this->surveyorController->getPermohonanJaminanId($permohonanId, $documentId, $jaminanId);
|
$permohonan = $this->surveyorController->getPermohonanJaminanId($permohonanId, $documentId, $jaminanId);
|
||||||
// $nomorLaporan = $this->generateNoLaporan($permohonan, $documentId, 'rap');
|
$nomorLaporan = $this->generateNoLaporan($permohonan, $documentId, 'call-report');
|
||||||
// $basicData = $this->surveyorController->getCommonData();
|
$basicData = $this->surveyorController->getCommonData();
|
||||||
// $inspeksi = Inspeksi::where('permohonan_id', $permohonanId)->where('dokument_id', $documentId)->first();
|
// $inspeksi = Inspeksi::where('permohonan_id', $permohonanId)->where('dokument_id', $documentId)->first();
|
||||||
// Penilai::updateOrCreate(
|
// Penilai::updateOrCreate(
|
||||||
// [
|
// [
|
||||||
@@ -462,7 +462,7 @@ class PenilaiController extends Controller
|
|||||||
// return view('lpj::penilai.components.call-report', compact('permohonan', 'rap', 'provinces', 'cities',
|
// return view('lpj::penilai.components.call-report', compact('permohonan', 'rap', 'provinces', 'cities',
|
||||||
// 'districts',
|
// 'districts',
|
||||||
// 'villages','forminspeksi', 'noLpRAP', 'basicData','cekAlamat'));
|
// 'villages','forminspeksi', 'noLpRAP', 'basicData','cekAlamat'));
|
||||||
return view('lpj::penilai.components.call-report', compact('permohonan'));
|
return view('lpj::penilai.components.call-report', compact('permohonan','basicData', 'nomorLaporan'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1183,7 +1183,7 @@ class PenilaiController extends Controller
|
|||||||
|
|
||||||
public function generateNoLaporan($permohonan, $documentId, $type)
|
public function generateNoLaporan($permohonan, $documentId, $type)
|
||||||
{
|
{
|
||||||
$typeMapping = ['lpj' => 'LPJ', 'memo' => 'MAK', 'rap' => 'RAP'];
|
$typeMapping = ['lpj' => 'LPJ', 'memo' => 'MAK', 'rap' => 'RAP', 'call-report' => 'CR'];
|
||||||
|
|
||||||
// Cek apakah data sudah ada
|
// Cek apakah data sudah ada
|
||||||
$laporan = Laporan::where([
|
$laporan = Laporan::where([
|
||||||
|
|||||||
@@ -1,407 +1,481 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Modules\Lpj\Http\Controllers;
|
namespace Modules\Lpj\Http\Controllers;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use Barryvdh\DomPDF\Facade\Pdf;
|
use Barryvdh\DomPDF\Facade\Pdf;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Maatwebsite\Excel\Facades\Excel;
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
use Modules\Location\Models\City;
|
use Modules\Location\Models\City;
|
||||||
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\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;
|
||||||
use Modules\Lpj\Models\Debiture;
|
use Modules\Lpj\Models\Debiture;
|
||||||
use Modules\Lpj\Models\DokumenJaminan;
|
use Modules\Lpj\Models\DokumenJaminan;
|
||||||
use Modules\Lpj\Models\JenisFasilitasKredit;
|
use Modules\Lpj\Models\JenisFasilitasKredit;
|
||||||
use Modules\Lpj\Models\NilaiPlafond;
|
use Modules\Lpj\Models\NilaiPlafond;
|
||||||
use Modules\Lpj\Models\Permohonan;
|
use Modules\Lpj\Models\Permohonan;
|
||||||
use Modules\Lpj\Models\StatusPermohonan;
|
use Modules\Lpj\Models\StatusPermohonan;
|
||||||
use Modules\Lpj\Models\TujuanPenilaian;
|
use Modules\Lpj\Models\TujuanPenilaian;
|
||||||
use Modules\Lpj\Services\PermohonanHistoryService;
|
use Modules\Lpj\Services\PermohonanHistoryService;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Modules\Lpj\Models\Penilaian;
|
||||||
|
|
||||||
class PermohonanController extends Controller
|
class PermohonanController extends Controller
|
||||||
|
{
|
||||||
|
public $user;
|
||||||
|
protected $historyService;
|
||||||
|
|
||||||
|
public function __construct(PermohonanHistoryService $historyService)
|
||||||
{
|
{
|
||||||
public $user;
|
$this->historyService = $historyService;
|
||||||
protected $historyService;
|
}
|
||||||
|
|
||||||
public function __construct(PermohonanHistoryService $historyService)
|
public function index()
|
||||||
{
|
{
|
||||||
$this->historyService = $historyService;
|
return view('lpj::permohonan.index');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index()
|
public function store(PermohonanRequest $request)
|
||||||
{
|
{
|
||||||
return view('lpj::permohonan.index');
|
$validate = $request->validated();
|
||||||
}
|
if ($validate) {
|
||||||
|
try {
|
||||||
public function store(PermohonanRequest $request)
|
// Process file upload
|
||||||
{
|
$filePath = null;
|
||||||
$validate = $request->validated();
|
if ($request->hasFile('attachment')) {
|
||||||
if ($validate) {
|
$file = $request->file('attachment');
|
||||||
try {
|
$fileName = time() . '_' . $file->getClientOriginalName();
|
||||||
// Process file upload
|
$filePath = $file->storeAs('permohonan_attachments', $fileName, 'public');
|
||||||
$filePath = null;
|
}
|
||||||
if ($request->hasFile('attachment')) {
|
|
||||||
$file = $request->file('attachment');
|
// Get keterangan if provided
|
||||||
$fileName = time() . '_' . $file->getClientOriginalName();
|
$keterangan = $request->input('keterangan') ?? null;
|
||||||
$filePath = $file->storeAs('permohonan_attachments', $fileName, 'public');
|
|
||||||
}
|
|
||||||
|
// Save to database
|
||||||
// Get keterangan if provided
|
$permohonan = Permohonan::create($validate);
|
||||||
$keterangan = $request->input('keterangan') ?? null;
|
|
||||||
|
// Create history
|
||||||
|
$this->historyService->createHistory(
|
||||||
// Save to database
|
$permohonan,
|
||||||
$permohonan = Permohonan::create($validate);
|
$validate['status'],
|
||||||
|
$keterangan,
|
||||||
// Create history
|
[], // beforeRequest is empty for new permohonan
|
||||||
$this->historyService->createHistory(
|
$permohonan->toArray(),
|
||||||
$permohonan,
|
$filePath,
|
||||||
$validate['status'],
|
);
|
||||||
$keterangan,
|
|
||||||
[], // beforeRequest is empty for new permohonan
|
$documents = DokumenJaminan::where('permohonan_id', $permohonan->id)->get();
|
||||||
$permohonan->toArray(),
|
if (count($documents) < 1) {
|
||||||
$filePath,
|
return redirect()->route('debitur.jaminan.create', array_merge(['permohonan_id' => $permohonan->id], ['id' => $permohonan->debiture->id]))->with('success', 'Permohonan created successfully, Lengkapi data jaminan terlebih dahulu');
|
||||||
);
|
|
||||||
|
|
||||||
$documents = DokumenJaminan::where('permohonan_id', $permohonan->id)->get();
|
|
||||||
if(count($documents)<1){
|
|
||||||
return redirect()->route('debitur.jaminan.create', array_merge(['permohonan_id'=>$permohonan->id],['id'=> $permohonan->debiture->id]))->with('success', 'Permohonan created successfully, Lengkapi data jaminan terlebih dahulu');
|
|
||||||
}
|
|
||||||
return redirect()
|
|
||||||
->route('permohonan.index')->with('success', 'Permohonan created successfully');
|
|
||||||
} catch (Exception $e) {
|
|
||||||
return redirect()
|
|
||||||
->route('permohonan.create')->with('error', 'Failed to create permohonan' . $e->getMessage());
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return redirect()
|
return redirect()
|
||||||
->route('permohonan.create')->with('success', 'error naon iye')->withInput();
|
->route('permohonan.index')->with('success', 'Permohonan created successfully');
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return redirect()
|
||||||
|
->route('permohonan.create')->with('error', 'Failed to create permohonan' . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return redirect()
|
||||||
|
->route('permohonan.create')->with('success', 'error naon iye')->withInput();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
return view('lpj::permohonan.create');
|
return view('lpj::permohonan.create');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createPermohonan($debitur)
|
public function createPermohonan($debitur)
|
||||||
{
|
{
|
||||||
$branches = Branch::all();
|
$branches = Branch::all();
|
||||||
$debitur = Debiture::find($debitur);
|
$debitur = Debiture::find($debitur);
|
||||||
$tujuanPenilaian = TujuanPenilaian::all();
|
$tujuanPenilaian = TujuanPenilaian::all();
|
||||||
$status = StatusPermohonan::all();
|
$status = StatusPermohonan::all();
|
||||||
$fasilitasKredit = JenisFasilitasKredit::all();
|
$fasilitasKredit = JenisFasilitasKredit::all();
|
||||||
$plafond = NilaiPlafond::all();
|
$plafond = NilaiPlafond::all();
|
||||||
|
|
||||||
return view(
|
return view(
|
||||||
'lpj::permohonan.form',
|
'lpj::permohonan.form',
|
||||||
compact('branches', 'debitur', 'tujuanPenilaian', 'status', 'fasilitasKredit', 'plafond'),
|
compact('branches', 'debitur', 'tujuanPenilaian', 'status', 'fasilitasKredit', 'plafond'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit($id)
|
public function edit($id)
|
||||||
{
|
{
|
||||||
$permohonan = Permohonan::find($id);
|
$permohonan = Permohonan::find($id);
|
||||||
$branches = Branch::all();
|
$branches = Branch::all();
|
||||||
$debitur = Debiture::find($permohonan->debiture_id);
|
$debitur = Debiture::find($permohonan->debiture_id);
|
||||||
$tujuanPenilaian = TujuanPenilaian::all();
|
$tujuanPenilaian = TujuanPenilaian::all();
|
||||||
$status = StatusPermohonan::all();
|
$status = StatusPermohonan::all();
|
||||||
$provinces = Province::all();
|
$provinces = Province::all();
|
||||||
$cities = City::where('province_code', $debitur->province_code)->get();
|
$cities = City::where('province_code', $debitur->province_code)->get();
|
||||||
$districts = District::where('city_code', $debitur->city_code)->get();
|
$districts = District::where('city_code', $debitur->city_code)->get();
|
||||||
$villages = Village::where('district_code', $debitur->district_code)->get();
|
$villages = Village::where('district_code', $debitur->district_code)->get();
|
||||||
$documents = DokumenJaminan::with('pemilik', 'detail')->where('debiture_id', $id)->get();
|
$documents = DokumenJaminan::with('pemilik', 'detail')->where('debiture_id', $id)->get();
|
||||||
|
|
||||||
$fasilitasKredit = JenisFasilitasKredit::all();
|
$fasilitasKredit = JenisFasilitasKredit::all();
|
||||||
$plafond = NilaiPlafond::all();
|
$plafond = NilaiPlafond::all();
|
||||||
|
|
||||||
return view(
|
return view(
|
||||||
'lpj::permohonan.form',
|
'lpj::permohonan.form',
|
||||||
compact(
|
compact(
|
||||||
'permohonan',
|
'permohonan',
|
||||||
'branches',
|
'branches',
|
||||||
'debitur',
|
'debitur',
|
||||||
'tujuanPenilaian',
|
'tujuanPenilaian',
|
||||||
'status',
|
'status',
|
||||||
'provinces',
|
'provinces',
|
||||||
'cities',
|
'cities',
|
||||||
'districts',
|
'districts',
|
||||||
'villages',
|
'villages',
|
||||||
'documents',
|
'documents',
|
||||||
'fasilitasKredit',
|
'fasilitasKredit',
|
||||||
'plafond',
|
'plafond',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
if ($validate) {
|
if ($validate) {
|
||||||
try {
|
try {
|
||||||
// Update in database
|
// Update in database
|
||||||
|
|
||||||
if ($permohonan->status == 'revisi') {
|
if ($permohonan->status == 'revisi') {
|
||||||
$validate['status'] = 'order';
|
$validate['status'] = 'order';
|
||||||
}
|
|
||||||
$permohonan->update($validate);
|
|
||||||
|
|
||||||
$documents = DokumenJaminan::where('permohonan_id', $permohonan->id)->get();
|
|
||||||
if(count($documents)<1){
|
|
||||||
return redirect()->route('debitur.jaminan.create', array_merge(['permohonan_id'=>$permohonan->id],['id'=> $permohonan->debiture->id]))->with('success', 'Permohonan created successfully, Lengkapi data jaminan terlebih dahulu');
|
|
||||||
}
|
|
||||||
|
|
||||||
return redirect()
|
|
||||||
->route('permohonan.index')->with('success', 'Permohonan updated successfully');
|
|
||||||
} catch (Exception $e) {
|
|
||||||
return redirect()
|
|
||||||
->route('permohonan.edit', $id)->with('error', 'Failed to update permohonan');
|
|
||||||
}
|
}
|
||||||
}
|
$permohonan->update($validate);
|
||||||
}
|
|
||||||
|
|
||||||
public function destroy($id)
|
$documents = DokumenJaminan::where('permohonan_id', $permohonan->id)->get();
|
||||||
{
|
if (count($documents) < 1) {
|
||||||
try {
|
return redirect()->route('debitur.jaminan.create', array_merge(['permohonan_id' => $permohonan->id], ['id' => $permohonan->debiture->id]))->with('success', 'Permohonan created successfully, Lengkapi data jaminan terlebih dahulu');
|
||||||
// Delete from database
|
}
|
||||||
$permohonan = Permohonan::find($id);
|
|
||||||
$permohonan->delete();
|
|
||||||
|
|
||||||
echo json_encode(['success' => true, 'message' => 'Permohonan deleted successfully']);
|
return redirect()
|
||||||
|
->route('permohonan.index')->with('success', 'Permohonan updated successfully');
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
echo json_encode(['success' => false, 'message' => 'Failed to delete permohonan']);
|
return redirect()
|
||||||
|
->route('permohonan.edit', $id)->with('error', 'Failed to update permohonan');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function dataForDatatables(Request $request)
|
public function destroy($id)
|
||||||
{
|
{
|
||||||
if (is_null($this->user) || !$this->user->can('debitur.view')) {
|
try {
|
||||||
//abort(403, 'Sorry! You are not allowed to view users.');
|
// Delete from database
|
||||||
}
|
|
||||||
|
|
||||||
// Retrieve data from the database
|
|
||||||
$query = Permohonan::query();
|
|
||||||
|
|
||||||
if(!Auth::user()->hasAnyRole(['administrator'])) {
|
|
||||||
$query = $query->where('branch_id', Auth::user()->branch_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = $query->orderBy('nomor_registrasi', '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->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();
|
|
||||||
$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(['user', 'debiture', 'branch', 'tujuanPenilaian', 'penilaian','documents'])->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,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function export()
|
|
||||||
{
|
|
||||||
return Excel::download(new PermohonanExport, 'permohonan.xlsx');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function authorization()
|
|
||||||
{
|
|
||||||
return view('lpj::permohonan.authorization.index');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function dataForAuthorization(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 = Permohonan::query()->with('documents')->has('documents', '>', 0)->where('status', '=', 'order');
|
|
||||||
|
|
||||||
// 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 showAuthorization($id)
|
|
||||||
{
|
|
||||||
$permohonan = Permohonan::find($id);
|
$permohonan = Permohonan::find($id);
|
||||||
return view('lpj::permohonan.authorization.show', compact('permohonan'));
|
$permohonan->delete();
|
||||||
|
|
||||||
|
echo json_encode(['success' => true, 'message' => 'Permohonan deleted successfully']);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Failed to delete permohonan']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateAuthorization(Request $request, $id)
|
// Retrieve data from the database
|
||||||
{
|
$query = Permohonan::query();
|
||||||
|
|
||||||
|
if (!Auth::user()->hasAnyRole(['administrator'])) {
|
||||||
|
$query = $query->where('branch_id', Auth::user()->branch_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = $query->orderBy('nomor_registrasi', '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->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();
|
||||||
|
$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(['user', 'debiture', 'branch', 'tujuanPenilaian', 'penilaian','documents'])->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,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function export()
|
||||||
|
{
|
||||||
|
return Excel::download(new PermohonanExport(), 'permohonan.xlsx');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function authorization()
|
||||||
|
{
|
||||||
|
return view('lpj::permohonan.authorization.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function dataForAuthorization(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 = Permohonan::query()->with('documents')->has('documents', '>', 0)->where('status', '=', 'order');
|
||||||
|
|
||||||
|
// 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 showAuthorization($id)
|
||||||
|
{
|
||||||
|
$permohonan = Permohonan::find($id);
|
||||||
|
return view('lpj::permohonan.authorization.show', compact('permohonan'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateAuthorization(Request $request, $id)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$permohonan = Permohonan::find($id);
|
||||||
|
$permohonan->status = $request->status;
|
||||||
|
$permohonan->keterangan = $request->keterangan;
|
||||||
|
$permohonan->save();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return redirect()->route('authorization.show', $id)->with('error', 'Failed to update permohonan');
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->route('authorization.index')->with('success', 'Permohonan updated successfully');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
$permohonan = Permohonan::find($id);
|
||||||
|
|
||||||
|
return view('lpj::permohonan.show', compact('permohonan'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function print($id)
|
||||||
|
{
|
||||||
|
$permohonan = Permohonan::find($id);
|
||||||
|
return view('lpj::permohonan.print', compact('permohonan'));
|
||||||
|
|
||||||
|
// $pdf = Pdf::loadView('lpj::permohonan.print', compact('permohonan'));
|
||||||
|
// return $pdf->stream();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function showPembatalan($id)
|
||||||
|
{
|
||||||
|
$permohonan = Permohonan::with(['pembatalan','debiture'])->findOrFail($id);
|
||||||
|
return view('lpj::permohonan.pembatalan-form', compact('permohonan'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function pembatalan(Request $request)
|
||||||
|
{
|
||||||
|
// Validate the request
|
||||||
|
$validatedData = $request->validate([
|
||||||
|
'permohonan_id' => 'required|exists:permohonan,id',
|
||||||
|
'alasan_pembatalan' => 'required|string',
|
||||||
|
'file_pembatalan' => 'required|file|mimes:pdf,doc,docx|max:2048',
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Handle file upload
|
||||||
|
if ($request->hasFile('file_pembatalan')) {
|
||||||
|
$file = $request->file('file_pembatalan');
|
||||||
|
$filename = time() . '_' . $file->getClientOriginalName();
|
||||||
|
$filePath = $file->storeAs('pembatalan', $filename, 'public');
|
||||||
|
$validatedData['file_pembatalan'] = $filePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add created_by
|
||||||
|
$validatedData['created_by'] = auth()->id();
|
||||||
|
|
||||||
|
// Create new PermohonanPembatalan
|
||||||
|
$pembatalan = PermohonanPembatalan::create($validatedData);
|
||||||
|
|
||||||
|
return redirect()->route('permohonan.index')->with('success', 'Pembatalan Permohonan Menunggu Approval');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function storeAproved(Request $request, $id): JsonResponse
|
||||||
|
{
|
||||||
|
$data = [];
|
||||||
|
if (request()->ajax()) {
|
||||||
try {
|
try {
|
||||||
$permohonan = Permohonan::find($id);
|
$penilaian = Penilaian::findOrFail($id);
|
||||||
$permohonan->status = $request->status;
|
$penilaian->update([
|
||||||
$permohonan->keterangan = $request->keterangan;
|
'authorized_status' => 1,
|
||||||
$permohonan->save();
|
]);
|
||||||
} catch (Exception $e) {
|
|
||||||
return redirect()->route('authorization.show', $id)->with('error', 'Failed to update permohonan');
|
$permohonan = Permohonan::findOrFail($request->permohonan_id);
|
||||||
|
|
||||||
|
$permohonan->update([
|
||||||
|
'status' => 'proses-survey'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$data['status'] = 'success';
|
||||||
|
$data['message'] = 'Jadwal '.$request->noReg.' berhasil di aprove';
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$data['status'] = 'error';
|
||||||
|
$data['message'] = 'Gagal membuat jadwal: ' . $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->route('authorization.index')->with('success', 'Permohonan updated successfully');
|
} else {
|
||||||
|
$data['status'] = 'error';
|
||||||
|
$data['message'] = "no ajax request";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show($id)
|
return response()->json($data);
|
||||||
{
|
}
|
||||||
$permohonan = Permohonan::find($id);
|
|
||||||
|
|
||||||
return view('lpj::permohonan.show', compact('permohonan'));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function print($id)
|
|
||||||
{
|
|
||||||
$permohonan = Permohonan::find($id);
|
|
||||||
return view('lpj::permohonan.print', compact('permohonan'));
|
|
||||||
|
|
||||||
// $pdf = Pdf::loadView('lpj::permohonan.print', compact('permohonan'));
|
|
||||||
// return $pdf->stream();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function showPembatalan($id)
|
|
||||||
{
|
|
||||||
$permohonan = Permohonan::with(['pembatalan','debiture'])->findOrFail($id);
|
|
||||||
return view('lpj::permohonan.pembatalan-form', compact('permohonan'));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function pembatalan(Request $request)
|
public function storeRescheduleSurvey(Request $request, $id)
|
||||||
{
|
{
|
||||||
// Validate the request
|
try {
|
||||||
$validatedData = $request->validate([
|
$validatedData = $request->validate([
|
||||||
'permohonan_id' => 'required|exists:permohonan,id',
|
'permohonan_id' => 'required|exists:permohonan,id',
|
||||||
'alasan_pembatalan' => 'required|string',
|
'penilaian_id' => 'nullable',
|
||||||
'file_pembatalan' => 'required|file|mimes:pdf,doc,docx|max:2048',
|
'nomor_registrasi' => 'required',
|
||||||
|
'reschedule_note' => 'required',
|
||||||
|
'reschedule_date' => 'required',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Handle file upload
|
DB::beginTransaction();
|
||||||
if ($request->hasFile('file_pembatalan')) {
|
|
||||||
$file = $request->file('file_pembatalan');
|
|
||||||
$filename = time() . '_' . $file->getClientOriginalName();
|
|
||||||
$filePath = $file->storeAs('pembatalan', $filename, 'public');
|
|
||||||
$validatedData['file_pembatalan'] = $filePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add created_by
|
$permohonan = Permohonan::findOrFail($request->permohonan_id);
|
||||||
$validatedData['created_by'] = auth()->id();
|
$permohonan->update([
|
||||||
|
'status' => 'request-reschedule'
|
||||||
|
]);
|
||||||
|
|
||||||
// Create new PermohonanPembatalan
|
$penilaian = Penilaian::findOrFail($id);
|
||||||
$pembatalan = PermohonanPembatalan::create($validatedData);
|
|
||||||
|
|
||||||
return redirect()->route('permohonan.index')->with('success', 'Pembatalan Permohonan Menunggu Approval');
|
$penilaian->update([
|
||||||
|
'reschedule_date' => $request->reschedule_date,
|
||||||
|
'reschedule_note' => $request->reschedule_note,
|
||||||
|
]);
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
return response()->json([
|
||||||
|
'status' => 'success',
|
||||||
|
'message' => 'Proses request reschedule permohonan Nomor registrasi '.$request->nomor_registrasi.' berhasil',
|
||||||
|
]);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
return response()->json([
|
||||||
|
'status' => 'error',
|
||||||
|
'message' => 'Gagal membuat request reschedule: ' . $e->getMessage(),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -929,46 +929,14 @@ class SurveyorController extends Controller
|
|||||||
->route('surveyor.index')
|
->route('surveyor.index')
|
||||||
->with('success', 'Jadwal berhasil dibuat.');
|
->with('success', 'Jadwal berhasil dibuat.');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
\Log::error('Error sending email: ' . $e->getMessage());
|
||||||
return redirect()
|
return redirect()
|
||||||
->route('surveyor.index')
|
->route('surveyor.index')
|
||||||
->with('error', 'Tanggal dan catatan tidak boleh kosong');
|
->with('error', 'Internal Server Error: ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function storeAproved(Request $request, $id): JsonResponse
|
|
||||||
{
|
|
||||||
$data = [];
|
|
||||||
if (request()->ajax()) {
|
|
||||||
try {
|
|
||||||
$penilaian = Penilaian::findOrFail($id);
|
|
||||||
$penilaian->update([
|
|
||||||
'authorized_status' => 1,
|
|
||||||
]);
|
|
||||||
|
|
||||||
$permohonan = Permohonan::findOrFail($request->permohonan_id);
|
|
||||||
|
|
||||||
$permohonan->update([
|
|
||||||
'status' => 'survey'
|
|
||||||
]);
|
|
||||||
|
|
||||||
$data['status'] = 'success';
|
|
||||||
$data['message'] = 'Jadwal '.$request->noReg.' berhasil di aprove';
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
$data['status'] = 'error';
|
|
||||||
$data['message'] = 'Gagal membuat jadwal: ' . $e->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$data['status'] = 'error';
|
|
||||||
$data['message'] = "no ajax request";
|
|
||||||
}
|
|
||||||
|
|
||||||
return response()->json($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function storeFreeze($id, Request $request)
|
public function storeFreeze($id, Request $request)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -2048,7 +2016,7 @@ class SurveyorController extends Controller
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$query->whereRaw('LOWER(status) IN (?, ?)', ['assign', 'survey']);
|
$query->whereRaw('LOWER(status) IN (?, ?, ?, ?, ?, ? ,?)', ['assign', 'survey', 'proses-survey', 'request-reschedule', 'reschedule', 'rejected-reschedule', 'approved-reschedule' ]);
|
||||||
|
|
||||||
|
|
||||||
if (!Auth::user()->hasRole('administrator')) {
|
if (!Auth::user()->hasRole('administrator')) {
|
||||||
@@ -3553,5 +3521,117 @@ class SurveyorController extends Controller
|
|||||||
return $pdf->download($fileName);
|
return $pdf->download($fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function approveReschedule(Request $request, $id)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
// Validasi data yang diterima
|
||||||
|
$validatedData = $request->validate([
|
||||||
|
'permohonan_id' => 'required|exists:permohonan,id',
|
||||||
|
'nomor_registrasi' => 'required'
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Memulai transaksi
|
||||||
|
DB::beginTransaction();
|
||||||
|
|
||||||
|
// Update status permohonan menjadi "reschedule"
|
||||||
|
$permohonan = Permohonan::findOrFail($validatedData['permohonan_id']);
|
||||||
|
$permohonan->update([
|
||||||
|
'status' => 'approved-reschedule',
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Update data penilaian dengan waktu reschedule
|
||||||
|
$penilaian = Penilaian::findOrFail($id);
|
||||||
|
$penilaian->update([
|
||||||
|
'waktu_penilaian' => $penilaian->reschedule_date,
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Commit transaksi
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => 'success',
|
||||||
|
'message' => 'Reschedule jadwal dengan nomor registrasi ' . $validatedData['nomor_registrasi'] . ' berhasil disetujui.',
|
||||||
|
]);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// Rollback jika ada error
|
||||||
|
DB::rollBack();
|
||||||
|
return response()->json([
|
||||||
|
'status' => 'error',
|
||||||
|
'message' => 'Gagal menyetujui reschedule: ' . $e->getMessage(),
|
||||||
|
], 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reject reschedule request.
|
||||||
|
*/
|
||||||
|
public function rejectReschedule(Request $request, $id)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
// Validasi data yang diterima
|
||||||
|
$validatedData = $request->validate([
|
||||||
|
'permohonan_id' => 'required|exists:permohonan,id',
|
||||||
|
'rejected_note' => 'required|string|max:255',
|
||||||
|
'nomor_registrasi' => 'required|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Memulai transaksi
|
||||||
|
DB::beginTransaction();
|
||||||
|
|
||||||
|
// Update status permohonan menjadi "rejected-reschedule"
|
||||||
|
$permohonan = Permohonan::findOrFail($validatedData['permohonan_id']);
|
||||||
|
$permohonan->update([
|
||||||
|
'status' => 'rejected-reschedule',
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Update data penilaian dengan catatan penolakan
|
||||||
|
$penilaian = Penilaian::findOrFail($id);
|
||||||
|
$penilaian->update([
|
||||||
|
'rejected_note' => $validatedData['rejected_note'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Commit transaksi
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => 'success',
|
||||||
|
'message' => 'Reschedule jadwal dengan nomor registrasi ' . $validatedData['nomor_registrasi'] . ' berhasil ditolak dengan alasan: ' . $validatedData['rejected_note'],
|
||||||
|
]);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// Rollback jika ada error
|
||||||
|
DB::rollBack();
|
||||||
|
return response()->json([
|
||||||
|
'status' => 'error',
|
||||||
|
'message' => 'Gagal menolak reschedule: ' . $e->getMessage(),
|
||||||
|
], 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function storeProsesSurvey(Request $request, $id)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
|
||||||
|
$validated = $request->validate([
|
||||||
|
'permohonan_id' => 'required|integer|exists:permohonan,id',
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
$permohonan = Permohonan::findOrFail($id);
|
||||||
|
|
||||||
|
$permohonan->status = 'survey';
|
||||||
|
$permohonan->save();
|
||||||
|
|
||||||
|
// Berikan respons JSON
|
||||||
|
return response()->json([
|
||||||
|
'status' => 'success',
|
||||||
|
'message' => 'Status permohonan berhasil diubah menjadi "survey".',
|
||||||
|
]);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// Tangani error
|
||||||
|
return response()->json([
|
||||||
|
'status' => 'error',
|
||||||
|
'message' => $e->getMessage(),
|
||||||
|
], 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class Penilaian extends Model
|
|||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'jenis_penilaian_id', 'penilaian_id', 'tanggal_kunjungan', 'keterangan','nomor_registrasi',
|
'jenis_penilaian_id', 'penilaian_id', 'tanggal_kunjungan', 'keterangan','nomor_registrasi',
|
||||||
'status', 'authorized_status', 'authorized_at', 'authorized_by', 'created_at',
|
'status', 'authorized_status', 'authorized_at', 'authorized_by', 'created_at',
|
||||||
'created_by', 'updated_at', 'updated_by', 'deleted_at', 'deleted_by','waktu_penilaian', 'deskripsi_penilaian'
|
'created_by', 'updated_at', 'updated_by', 'deleted_at', 'deleted_by','waktu_penilaian', 'deskripsi_penilaian', 'reschedule_date','reschedule_note','rejected_note'
|
||||||
];
|
];
|
||||||
|
|
||||||
public function jenis_penilaian()
|
public function jenis_penilaian()
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<?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::table('penilaian', function (Blueprint $table) {
|
||||||
|
$table->datetime('reschedule_date')->nullable()->after('waktu_penilaian');
|
||||||
|
$table->text('reschedule_note')->nullable()->after('reschedule_date');
|
||||||
|
$table->text('rejected_note')->nullable()->after('reschedule_note');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('penilaian', function (Blueprint $table) {
|
||||||
|
$table->dropColumn(['reschedule_date', 'reschedule_note', 'rejected_note']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -6,13 +6,15 @@
|
|||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
||||||
@php
|
@php
|
||||||
$senior_officer = null;
|
$senior_officer = null;
|
||||||
|
$jenisJaminan = null;
|
||||||
if ($permohonan->debiture && $permohonan->documents) {
|
if ($permohonan->debiture && $permohonan->documents) {
|
||||||
foreach ($permohonan->documents as $dokumen) {
|
foreach ($permohonan->documents as $dokumen) {
|
||||||
$penilai = $permohonan->penilaian->userPenilai->where('role', 'penilai')->first();
|
$penilai = $permohonan->penilaian->userPenilai->where('role', 'penilai')->first();
|
||||||
$teams = $permohonan->region->teams;
|
$teams = $permohonan->region->teams;
|
||||||
|
|
||||||
|
$jenisJaminan = $dokumen->jenisJaminan->name;
|
||||||
if ($teams) {
|
if ($teams) {
|
||||||
foreach ($teams as $team) {
|
foreach ($teams as $team) {
|
||||||
$team_users = $team->teamsUsers;
|
$team_users = $team->teamsUsers;
|
||||||
@@ -35,8 +37,8 @@
|
|||||||
@endphp
|
@endphp
|
||||||
<form id="formInspeksi" method="POST" enctype="multipart/form-data" class="grid gap-5">
|
<form id="formInspeksi" method="POST" enctype="multipart/form-data" class="grid gap-5">
|
||||||
@csrf
|
@csrf
|
||||||
<input type="hidden" name="nomor_registrasi" value="{{ $permohonan->nomor_registrasi ?? ''}}">
|
<input type="hidden" name="nomor_registrasi" value="{{ $permohonan->nomor_registrasi ?? '' }}">
|
||||||
<input type="hidden" name="permohonan_id" value="{{ $permohonan->id ?? "" }}">
|
<input type="hidden" name="permohonan_id" value="{{ $permohonan->id ?? '' }}">
|
||||||
<input type="hidden" name="dokument_id" value="{{ request('documentId') }}">
|
<input type="hidden" name="dokument_id" value="{{ request('documentId') }}">
|
||||||
<input type="hidden" name="action" value="callReport">
|
<input type="hidden" name="action" value="callReport">
|
||||||
<input type="hidden" name="type" value="callReport">
|
<input type="hidden" name="type" value="callReport">
|
||||||
@@ -62,7 +64,7 @@
|
|||||||
<label class="form-label max-w-56">Dari</label>
|
<label class="form-label max-w-56">Dari</label>
|
||||||
<div class="flex flex-wrap items-baseline w-full">
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
<input type="text" name="dari" class="input w-full" placeholder="Masukkan..."
|
<input type="text" name="dari" class="input w-full" placeholder="Masukkan..."
|
||||||
value="{{ $callReport['dari'] ?? '' }}">
|
value="{{ $callReport['dari'] ?? $permohonan->branch->name ?? "" }}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
@@ -92,11 +94,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="card border border-agi-100 w-full bg-white rounded-lg shadow-md ">
|
<div class="card border border-agi-100 w-full bg-white rounded-lg shadow-md ">
|
||||||
<div class="card-header bg-agi-50">
|
<div class="card-header bg-agi-50">
|
||||||
<h1 class="text-md font-medium text-gray-900 uppercase">Menindak lanjuti permintaan <b>
|
<h1 class="text-md font-medium text-gray-900 uppercase">Menindak lanjuti permintaan <b>
|
||||||
{{$permohonan->tujuanPenilaian->name ?? ''}}</b>, BAG CABang <b>{{ $permohonan->branch->name }}</b>
|
{{ $permohonan->tujuanPenilaian->name ?? '' }}</b>, BAG CABang
|
||||||
disampaikan hal sebagai berikut:
|
<b>{{ $permohonan->branch->name }}</b>
|
||||||
|
disampaikan hal sebagai berikut:
|
||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@@ -105,72 +110,47 @@
|
|||||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
<div class="grid gap-2.5 w-full">
|
<div class="grid gap-2.5 w-full">
|
||||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||||
<label for="lokasi" class="form-label max-w-56">Nama Debitur</label>
|
<label for="nama_debiture" class="form-label max-w-56">Nama Debitur</label>
|
||||||
<div class="flex flex-wrap items-baseline w-full">
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
<input type="text" id="lokasi" name="lokasi" class="input w-full"
|
<input type="text" id="nama_debiture" name="nama_debiture" class="input w-full"
|
||||||
placeholder="Masukkan Jl."
|
placeholder="Nama Debiture"
|
||||||
value="{{ $memo->lokasi->lokasi ?? old('lokasi') }}">
|
value="{{ $permohonan->debiture->name ?? old('nama_debiture') }}" @readonly(true)>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||||
<label for="penilai" class="form-label max-w-56">KJPP</label>
|
<label for="kjjp" class="form-label max-w-56">KJPP</label>
|
||||||
<div class="flex flex-wrap items-baseline w-full">
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
<input type="text" id="penilai" name="penilai" class="input w-full"
|
<input type="text" id="kjjp" name="kjjp" class="input w-full"
|
||||||
placeholder="Masukkan Penilai"
|
placeholder="Masukkan kjjp"
|
||||||
value="{{ $memo->lokasi->penilai ?? old('penilai') }}">
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
<label class="form-label max-w-56">Jenis Aset</label>
|
<label class="form-label max-w-56">Jenis Aset</label>
|
||||||
|
|
||||||
<div class="flex flex-wrap items-baseline w-full">
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
|
<input type="text" id="jenis_asset" name="jenis_asset" class="input w-full"
|
||||||
<select id="jenis_asset_tidak_sesuai" class="input w-full" name="jenis_asset_tidak_sesuai">
|
placeholder="Masukkan jenis_asset" value="{{ $jenisJaminan ?? old('jenis_asset') }}"
|
||||||
<option value="">Select Jenis asset</option>
|
@readonly(true)>
|
||||||
@isset($basicData['jenisJaminan'] )
|
|
||||||
@foreach ($basicData['jenisJaminan'] as $item)
|
|
||||||
<option value="{{ $item->name }}"
|
|
||||||
{{ ($memo->jenis_asset_tidak_sesuai ?? '') == $item->name ? 'selected' : '' }}>
|
|
||||||
{{ $item->name }}
|
|
||||||
</option>
|
|
||||||
@endforeach
|
|
||||||
@endisset
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
|
||||||
<label for="penilai" class="form-label max-w-56">Lokasi Objek Penilaian</label>
|
|
||||||
<div class="flex flex-wrap items-baseline w-full">
|
|
||||||
<input type="text" id="penilai" name="penilai" class="input w-full"
|
|
||||||
placeholder="Masukkan Penilai"
|
|
||||||
value="{{ $memo->lokasi->penilai ?? old('penilai') }}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
|
||||||
<label for="penilai" class="form-label max-w-56">Dokumen </label>
|
|
||||||
<div class="flex flex-wrap items-baseline w-full">
|
|
||||||
<input type="text" id="penilai" name="penilai" class="input w-full"
|
|
||||||
placeholder="Masukkan Penilai"
|
|
||||||
value="{{ $memo->lokasi->penilai ?? old('penilai') }}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||||
<label for="penilai" class="form-label max-w-56">Tanggal Penilaian </label>
|
<label for="penilai" class="form-label max-w-56">Tanggal Penilaian </label>
|
||||||
<div class="flex flex-wrap items-baseline w-full">
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
<input type="text" id="penilai" name="penilai" class="input w-full"
|
<input type="date" id="tanggal_penilaian" name="tanggal_penilaian" class="input w-full"
|
||||||
placeholder="Masukkan Penilai"
|
placeholder="Masukkan Tanggal Penilai"
|
||||||
value="{{ $memo->lokasi->penilai ?? old('penilai') }}">
|
value="{{ $memo->lokasi->penilai ?? old('penilai') }}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||||
<label for="penilai" class="form-label max-w-56">Lelang ke </label>
|
<label for="Lelang" class="form-label max-w-56">Lelang ke </label>
|
||||||
<div class="flex flex-wrap items-baseline w-full">
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
<input type="text" id="penilai" name="penilai" class="input w-full"
|
<input type="text" id="lelang" name="lelang" class="input w-full"
|
||||||
placeholder="Masukkan Penilai"
|
placeholder="Masukkan Lelang"
|
||||||
value="{{ $memo->lokasi->penilai ?? old('penilai') }}">
|
value="{{ $memo->lokasi->penilai ?? old('penilai') }}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -178,16 +158,14 @@
|
|||||||
<label for="penilai" class="form-label max-w-56">Nilai Pasar Wajar (NPW)</label>
|
<label for="penilai" class="form-label max-w-56">Nilai Pasar Wajar (NPW)</label>
|
||||||
<div class="flex flex-wrap items-baseline w-full">
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
<input type="text" id="likuidasi" name="likuidasi" class="input w-full"
|
<input type="text" id="likuidasi" name="likuidasi" class="input w-full"
|
||||||
placeholder="Masukkan likuidasi"
|
placeholder="Masukkan likuidasi" value="{{ old('likuidasi') }}">
|
||||||
value="{{ old('likuidasi') }}">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||||
<label for="penilai" class="form-label max-w-56">Nilai Likuidasi (NL)</label>
|
<label for="likuidasi_nilai_1" class="form-label max-w-56">Nilai Likuidasi (NL)</label>
|
||||||
<div class="flex flex-wrap items-baseline w-full">
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
<input type="text" id="penilai" name="penilai" class="input w-full"
|
<input type="text" id="likuidasi_nilai_1" name="likuidasi_nilai_1" class="input w-full"
|
||||||
placeholder="Masukkan Penilai"
|
placeholder="Masukkan likuidasi_nilai_1" value="">
|
||||||
value="">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -202,7 +180,8 @@
|
|||||||
|
|
||||||
<div class="card border border-agi-100 w-full bg-white rounded-lg shadow-md ">
|
<div class="card border border-agi-100 w-full bg-white rounded-lg shadow-md ">
|
||||||
<div class="card-header bg-agi-50">
|
<div class="card-header bg-agi-50">
|
||||||
<h1 class="text-md font-medium text-gray-900 uppercase">Penilaian ke lokasi objek telah dilakukan oleh :
|
<h1 class="text-md font-medium text-gray-900 uppercase">Penilaian ke lokasi objek telah dilakukan oleh
|
||||||
|
:
|
||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@@ -215,7 +194,7 @@
|
|||||||
<div class="flex flex-wrap items-baseline w-full">
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
<input type="text" id="staf" name="staf" class="input w-full"
|
<input type="text" id="staf" name="staf" class="input w-full"
|
||||||
placeholder="Masukkan Nama Staff"
|
placeholder="Masukkan Nama Staff"
|
||||||
value="{{ $penilai->userPenilaiTeam->name ?? "" }}" @readonly(true)>
|
value="{{ $penilai->userPenilaiTeam->name ?? '' }}" @readonly(true)>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -224,24 +203,25 @@
|
|||||||
<label for="penilai" class="form-label max-w-56">Pihak KJPP</label>
|
<label for="penilai" class="form-label max-w-56">Pihak KJPP</label>
|
||||||
<div class="flex flex-wrap items-baseline w-full">
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
<input type="text" id="penilai" name="pihak_kjjpp" class="input w-full"
|
<input type="text" id="penilai" name="pihak_kjjpp" class="input w-full"
|
||||||
placeholder="Masukkan Pihak KJPP"
|
value="{{$forminspeksi['signature']['kjjp']['name'] ?? ''}}" @readonly(true) placeholder="Masukkan Nama KJPP">
|
||||||
value="">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||||
<label for="pihak_bag" class="form-label max-w-56">Pihak BAGI Cab </label>
|
<label for="pihak_bag" class="form-label max-w-56">Pihak BAGI Cab </label>
|
||||||
<div class="flex flex-wrap items-baseline w-full">
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
|
|
||||||
<input type="text" id="pihak_bag" name="pihak_bag" class="input w-full"
|
<input type="text" id="pihak_bag" name="pihak_bag" class="input w-full"
|
||||||
placeholder="Masukkan Pihak Bag"
|
placeholder="Masukkan Pihak Bag" value="{{ $permohonan->user->name ?? '' }} || {{ $permohonan->branch->name }}"
|
||||||
value="{{ $permohonan->user->name ?? '' }}" @readonly(true)>
|
@readonly(true)>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||||
<label for="debitur_perwakilan" class="form-label max-w-56">Debitur/perwakilan debitur </label>
|
<label for="debitur_perwakilan" class="form-label max-w-56">Debitur/perwakilan debitur
|
||||||
|
</label>
|
||||||
<div class="flex flex-wrap items-baseline w-full">
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
<input type="text" id="debitur_perwakilan" name="debitur_perwakilan" class="input w-full"
|
<input type="text" id="debitur_perwakilan" name="debitur_perwakilan"
|
||||||
placeholder="Masukkan Penilai"
|
class="input w-full" placeholder="Masukkan Penilai"
|
||||||
value="{{ $permohonan->debiture->name ?? '' }}" @readonly(true)>
|
value="{{ $permohonan->debiture->name ?? '' }}" @readonly(true)>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -274,7 +254,8 @@
|
|||||||
@else
|
@else
|
||||||
<div class="fakta_positif flex items-center gap-2 mt-2 textarea-group w-full">
|
<div class="fakta_positif flex items-center gap-2 mt-2 textarea-group w-full">
|
||||||
<textarea class="textarea mt-2" name="fakta_positif[]" rows="3">{{ old('fakta_positif.0', '') }}</textarea>
|
<textarea class="textarea mt-2" name="fakta_positif[]" rows="3">{{ old('fakta_positif.0', '') }}</textarea>
|
||||||
<button class="btn btn-danger btn-sm remove-btn" type="button" style="display: none;">
|
<button class="btn btn-danger btn-sm remove-btn" type="button"
|
||||||
|
style="display: none;">
|
||||||
<i class="ki-outline ki-trash"></i>
|
<i class="ki-outline ki-trash"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -302,7 +283,8 @@
|
|||||||
@else
|
@else
|
||||||
<div class="fakta_negatif flex items-center gap-2 mt-2 textarea-group w-full">
|
<div class="fakta_negatif flex items-center gap-2 mt-2 textarea-group w-full">
|
||||||
<textarea class="textarea mt-2" name="fakta_negatif[]" rows="3">{{ old('fakta_negatif.0', $callReport['fakta']['fakta_negatif'][0] ?? '') }}</textarea>
|
<textarea class="textarea mt-2" name="fakta_negatif[]" rows="3">{{ old('fakta_negatif.0', $callReport['fakta']['fakta_negatif'][0] ?? '') }}</textarea>
|
||||||
<button class="btn btn-danger btn-sm remove-btn" type="button" style="display: none;">
|
<button class="btn btn-danger btn-sm remove-btn" type="button"
|
||||||
|
style="display: none;">
|
||||||
<i class="ki-outline ki-trash"></i>
|
<i class="ki-outline ki-trash"></i>
|
||||||
</button>
|
</button>
|
||||||
<em id="error-fakta_negatif" class="alert text-danger text-sm"></em>
|
<em id="error-fakta_negatif" class="alert text-danger text-sm"></em>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
||||||
|
|
||||||
<div class="card border border-agi-100 card-grid min-w-full" data-datatable="false" data-datatable-page-size="10"
|
<div class="card border border-agi-100 card-grid min-w-full" data-datatable="false" data-datatable-page-size="10"
|
||||||
data-datatable-state-save="false" id="permohonan-table" data-api-url="{{ route('permohonan.datatables') }}">
|
data-datatable-state-save="false" id="permohonan-table" data-api-url="{{ route('permohonan.datatables') }}">
|
||||||
<div class="card-header bg-agi-50 py-5 flex-wrap">
|
<div class="card-header bg-agi-50 py-5 flex-wrap">
|
||||||
<h3 class="card-title">
|
<h3 class="card-title">
|
||||||
Daftar Permohonan
|
Daftar Permohonan
|
||||||
@@ -29,46 +29,46 @@
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="scrollable-x-auto">
|
<div class="scrollable-x-auto">
|
||||||
<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] text-center" 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-right" 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>
|
||||||
@@ -189,7 +189,7 @@
|
|||||||
title: 'Status',
|
title: 'Status',
|
||||||
render: (item, data) => {
|
render: (item, data) => {
|
||||||
console.log(data.documents.length);
|
console.log(data.documents.length);
|
||||||
if(data.documents.length > 0) {
|
if (data.documents.length > 0) {
|
||||||
return `<span class="badge badge-sm badge-default uppercase flex justify-center">${data.status}</span>`;
|
return `<span class="badge badge-sm badge-default uppercase flex justify-center">${data.status}</span>`;
|
||||||
}
|
}
|
||||||
return `<span class="badge badge-sm badge-danger uppercase flex justify-center">Lengkapi Aset Jaminan</span>`;
|
return `<span class="badge badge-sm badge-danger uppercase flex justify-center">Lengkapi Aset Jaminan</span>`;
|
||||||
@@ -204,8 +204,15 @@
|
|||||||
render: (item, data) => {
|
render: (item, data) => {
|
||||||
let actionHtml = `<div class="flex flex-nowrap justify-end gap-1.5">`;
|
let actionHtml = `<div class="flex flex-nowrap justify-end gap-1.5">`;
|
||||||
|
|
||||||
|
if (data.status === 'proses-survey' || data.status == 'rejected-reschedule') {
|
||||||
|
actionHtml += `
|
||||||
|
<a onclick="surveyorRescheduleJadwalSurvey(${data.id},${data.penilaian.id},'${data.nomor_registrasi}', '${data.debiture.name}', '${data.penilaian.waktu_penilaian}', '${data.penilaian.rejected_note}')" class="delete btn btn-sm btn-outline btn-light" title="Reschedule Jadwal Survey">
|
||||||
|
<i class="ki-filled ki-calendar-remove"></i>
|
||||||
|
</a>`;
|
||||||
|
}
|
||||||
|
|
||||||
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 || data.status === 'approved-reschedule') {
|
||||||
actionHtml += `
|
actionHtml += `
|
||||||
<a class="btn btn-sm btn-outline btn-primary" href="javascript:void(0)" onclick="surveyorApproveKunjungan(${data.id},${data.penilaian.id},'${data.nomor_registrasi}', '${data.debiture.name}', '${data.penilaian.waktu_penilaian}')" title="Approve Jadwal Kunjungan No Reg ${data.nomor_registrasi}" >
|
<a class="btn btn-sm btn-outline btn-primary" href="javascript:void(0)" onclick="surveyorApproveKunjungan(${data.id},${data.penilaian.id},'${data.nomor_registrasi}', '${data.debiture.name}', '${data.penilaian.waktu_penilaian}')" title="Approve Jadwal Kunjungan No Reg ${data.nomor_registrasi}" >
|
||||||
<i class="ki-filled ki-calendar-edit"></i>
|
<i class="ki-filled ki-calendar-edit"></i>
|
||||||
@@ -225,12 +232,15 @@
|
|||||||
<a class="btn btn-sm btn-outline btn-info" href="permohonan/${data.id}/edit" title="Edit Permohonan">
|
<a class="btn btn-sm btn-outline btn-info" href="permohonan/${data.id}/edit" title="Edit Permohonan">
|
||||||
<i class="ki-outline ki-notepad-edit"></i>
|
<i class="ki-outline ki-notepad-edit"></i>
|
||||||
</a>`;
|
</a>`;
|
||||||
if(data.status !== 'batal') {
|
if (data.status !== 'batal') {
|
||||||
actionHtml += `
|
actionHtml += `
|
||||||
<a onclick="deleteData(${data.id}, '${data.nomor_registrasi}','${data.debiture.name}')" class="delete btn btn-sm btn-outline btn-danger" title="Batalkan Permohonan">
|
<a onclick="deleteData(${data.id}, '${data.nomor_registrasi}','${data.debiture.name}')" class="delete btn btn-sm btn-outline btn-danger" title="Batalkan Permohonan">
|
||||||
<i class="ki-outline ki-cross-square"></i>
|
<i class="ki-outline ki-cross-square"></i>
|
||||||
</a>`;
|
</a>`;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
actionHtml += `</div>`;
|
actionHtml += `</div>`;
|
||||||
|
|
||||||
return actionHtml;
|
return actionHtml;
|
||||||
@@ -241,14 +251,14 @@
|
|||||||
|
|
||||||
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);
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function surveyorApproveKunjungan(permohonanId,idPenilaian, noReg, debitur, waktuPenilaian) {
|
function surveyorApproveKunjungan(permohonanId, idPenilaian, noReg, debitur, waktuPenilaian) {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: ' ',
|
title: ' ',
|
||||||
text: "Yakin akan Menyetujui Jadwal Kunjungan " + noReg + " untuk Debitur " + debitur +
|
text: "Yakin akan Menyetujui Jadwal Kunjungan " + noReg + " untuk Debitur " + debitur +
|
||||||
@@ -263,7 +273,7 @@
|
|||||||
//define variable
|
//define variable
|
||||||
// $id ==> penilaian.id
|
// $id ==> penilaian.id
|
||||||
let token = "{{ csrf_token() }}";
|
let token = "{{ csrf_token() }}";
|
||||||
let useURL = "{{ URL::to('/surveyor/storeAproved') }}" + "/" + idPenilaian;
|
let useURL = "{{ URL::to('/permohonan/store-approved') }}" + "/" + idPenilaian;
|
||||||
|
|
||||||
var input_data = new Object();
|
var input_data = new Object();
|
||||||
input_data._token = token;
|
input_data._token = token;
|
||||||
@@ -276,7 +286,7 @@
|
|||||||
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(
|
||||||
@@ -288,7 +298,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
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);
|
||||||
@@ -300,6 +310,95 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function surveyorRescheduleJadwalSurvey(permohonanId, idPenilaian, noReg, debitur, waktuPenilaian, rejectedNote) {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Reschedule Jadwal Kunjungan',
|
||||||
|
html: `
|
||||||
|
<div class="text-left space-y-4">
|
||||||
|
|
||||||
|
<p class="text-gray-700">
|
||||||
|
Yakin akan Reschedule Jadwal Kunjungan
|
||||||
|
<span class="font-semibold text-blue-600">${noReg}</span>
|
||||||
|
untuk Debitur
|
||||||
|
<span class="font-semibold text-blue-600">${debitur}</span>
|
||||||
|
pada waktu
|
||||||
|
<span class="font-semibold">${window.formatTanggalWaktuIndonesia(waktuPenilaian)}</span>?
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label for="reschedule_date" class="block text-sm font-medium text-gray-700 mb-1">Tanggal Baru</label>
|
||||||
|
<input type="datetime-local" id="reschedule_date"
|
||||||
|
class="block w-full px-4 py-2 border border-gray-300 rounded-lg shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label for="reschedule_note" class="block text-sm font-medium text-gray-700 mb-1">Catatan</label>
|
||||||
|
<textarea id="reschedule_note"
|
||||||
|
class="block w-full px-4 py-2 border border-gray-300 rounded-lg shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm"
|
||||||
|
placeholder="Masukkan alasan reschedule..."></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
${rejectedNote ? `
|
||||||
|
<p class="text-gray-700"><strong>Catatan Reject:</strong> ${rejectedNote}</p>
|
||||||
|
` : ''}
|
||||||
|
</div>
|
||||||
|
`,
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: '#3085d6',
|
||||||
|
cancelButtonColor: '#d33',
|
||||||
|
confirmButtonText: 'Reschedule',
|
||||||
|
preConfirm: () => {
|
||||||
|
const rescheduleDate = document.getElementById('reschedule_date').value;
|
||||||
|
const rescheduleNote = document.getElementById('reschedule_note').value;
|
||||||
|
|
||||||
|
if (!rescheduleDate || !rescheduleNote) {
|
||||||
|
Swal.showValidationMessage('Semua inputan wajib diisi!');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return { rescheduleDate, rescheduleNote };
|
||||||
|
}
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
const { rescheduleDate, rescheduleNote } = result.value;
|
||||||
|
|
||||||
|
// Data to send
|
||||||
|
const data = {
|
||||||
|
_token: "{{ csrf_token() }}",
|
||||||
|
penilaian_id: idPenilaian,
|
||||||
|
nomor_registrasi: noReg,
|
||||||
|
permohonan_id: permohonanId,
|
||||||
|
reschedule_date: rescheduleDate,
|
||||||
|
reschedule_note: rescheduleNote
|
||||||
|
};
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: `{{ URL::to('/permohonan/store-reschedule-survey') }}/${idPenilaian}`,
|
||||||
|
type: "PUT",
|
||||||
|
cache: false,
|
||||||
|
data: data,
|
||||||
|
dataType: "json",
|
||||||
|
success: function(response) {
|
||||||
|
if (response.status === 'success') {
|
||||||
|
Swal.fire('Sukses Reschedule!', response.message, 'success').then(() => {
|
||||||
|
location.reload();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Swal.fire('Error!', response.message, 'error');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(response) {
|
||||||
|
const errorMessage = response.responseJSON?.message || 'Terjadi kesalahan saat memproses data.';
|
||||||
|
Swal.fire('Error!', errorMessage, 'error');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// window.formatTanggalIndonesia(date)
|
// window.formatTanggalIndonesia(date)
|
||||||
</script>
|
</script>
|
||||||
@endpush
|
@endpush
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
$luas_bangunan = 'N/A';
|
$luas_bangunan = 'N/A';
|
||||||
if ($item->detail) {
|
if ($item->detail) {
|
||||||
foreach ($item->detail as $luas) {
|
foreach ($item->detail as $luas) {
|
||||||
if (isset($luas->name) && $luas->name === 'IMB') {
|
if (isset($luas->name) && $luas->jenis_legalitas_jaminan_id === 10) {
|
||||||
$details = json_decode($luas->details, true);
|
$details = json_decode($luas->details, true);
|
||||||
$luas_bangunan = isset($details['luas_bangunan']) ? $details['luas_bangunan'] : 'N/A';
|
$luas_bangunan = isset($details['luas_bangunan']) ? $details['luas_bangunan'] : 'N/A';
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -471,7 +471,7 @@
|
|||||||
<label for="city" class="form-label max-w-56">Kabupaten/Kota</label>
|
<label for="city" class="form-label max-w-56">Kabupaten/Kota</label>
|
||||||
<div class="flex flex-wrap items-baseline w-full">
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
<input type="text" id="city" class="input w-full cursor-not-allowed" readonly
|
<input type="text" id="city" class="input w-full cursor-not-allowed" readonly
|
||||||
value="{{ isset($permohonan->debiture->city) ? $permohonan->debiture->city->name : '' }}">
|
value="{{ isset($permohonan->debiture->city) ? strtolower($permohonan->debiture->city->name) : '' }}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<input type="hidden" name="district_code"
|
<input type="hidden" name="district_code"
|
||||||
@@ -559,9 +559,32 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function loadCities() {
|
||||||
|
const citySelect = document.getElementById("city_code");
|
||||||
|
|
||||||
|
if (citySelect) {
|
||||||
|
// Hapus semua opsi sebelumnya
|
||||||
|
citySelect.innerHTML = '<option value="">Pilih Kota/Kabupaten</option>';
|
||||||
|
|
||||||
|
cities.forEach((city) => {
|
||||||
|
// Ubah nama kota menjadi lowercase
|
||||||
|
const cityNameLowercase = city.name.toLowerCase();
|
||||||
|
|
||||||
|
// Tambahkan opsi ke dropdown
|
||||||
|
const option = document.createElement("option");
|
||||||
|
option.value = city.code;
|
||||||
|
option.textContent = cityNameLowercase; // Nama dalam lowercase
|
||||||
|
citySelect.appendChild(option);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.error("Element with ID 'city_code' not found.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
loadSavedLocationData();
|
loadSavedLocationData();
|
||||||
|
loadCities();
|
||||||
});
|
});
|
||||||
// Fungsi untuk memuat data lokasi yang tersimpan
|
|
||||||
</script>
|
</script>
|
||||||
@include('lpj::surveyor.js.utils')
|
@include('lpj::surveyor.js.utils')
|
||||||
|
|||||||
@@ -217,7 +217,7 @@
|
|||||||
}
|
}
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
<img id="foto_tempat-preview" src="{{ $fotoSrc ?: asset('images/default-placeholder.png') }}"
|
<img id="foto_tempat-preview" src="{{ $fotoSrc ?: '' }}"
|
||||||
alt="Foto Tempat" class="mt-2 max-w-full h-auto"
|
alt="Foto Tempat" class="mt-2 max-w-full h-auto"
|
||||||
style="max-width: 30rem; {{ $fotoSrc ? '' : 'display: none;' }}">
|
style="max-width: 30rem; {{ $fotoSrc ? '' : 'display: none;' }}">
|
||||||
|
|
||||||
|
|||||||
@@ -23,12 +23,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-sm font-medium text-gray-700">Jarak ke CBD Point</label>
|
<label class="block text-sm font-medium text-gray-700">Jarak ke CBD Point</label>
|
||||||
<input type="text" class="input mt-2" name="jarak_cbd_point" placeholder="Km"
|
<input type="text" class="input mt-2" name="jarak_cbd_point" placeholder="Masukkan Jarak ke CBD Point"
|
||||||
value="{{ old('jarak_cbd_point', isset($forminspeksi['lingkungan']['jarak_cbd_point']) ? $forminspeksi['lingkungan']['jarak_cbd_point'] : '') }}">
|
value="{{ old('jarak_cbd_point', isset($forminspeksi['lingkungan']['jarak_cbd_point']) ? $forminspeksi['lingkungan']['jarak_cbd_point'] : '') }}">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-sm font-medium text-gray-700">Nama CBD Point</label>
|
<label class="block text-sm font-medium text-gray-700">Nama CBD Point</label>
|
||||||
<input type="text" class="input mt-2" name="nama_cbd_point" placeholder="Km"
|
<input type="text" class="input mt-2" name="nama_cbd_point" placeholder="Masukkan Nama CBD Point"
|
||||||
value="{{ old('nama_cbd_point', isset($forminspeksi['lingkungan']['nama_cbd_point']) ? $forminspeksi['lingkungan']['nama_cbd_point'] : '') }}">
|
value="{{ old('nama_cbd_point', isset($forminspeksi['lingkungan']['nama_cbd_point']) ? $forminspeksi['lingkungan']['nama_cbd_point'] : '') }}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
$forminspeksi['lingkungan']['lebar_perkerasan_jalan'] ?? '',
|
$forminspeksi['lingkungan']['lebar_perkerasan_jalan'] ?? '',
|
||||||
);
|
);
|
||||||
@endphp
|
@endphp
|
||||||
<input type="text" name="lebar_perkerasan_jalan" class="input mt-2" placeholder="Meter"
|
<input type="text" name="lebar_perkerasan_jalan" class="input mt-2" placeholder="Masukkan Lebar Perkerasan Jalan"
|
||||||
value="{{ $lebarPerkerasanJalan }}">
|
value="{{ $lebarPerkerasanJalan }}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
$luas_tanah = 'N/A';
|
$luas_tanah = 'N/A';
|
||||||
if ($item->detail) {
|
if ($item->detail) {
|
||||||
foreach ($item->detail as $luas) {
|
foreach ($item->detail as $luas) {
|
||||||
if (isset($luas->name) && $luas->name === 'Sertifikat') {
|
if (isset($luas->name) && $luas->jenis_legalitas_jaminan_id === 1) {
|
||||||
$details = json_decode($luas->details, true);
|
$details = json_decode($luas->details, true);
|
||||||
$luas_tanah = isset($details['luas_tanah']) ? $details['luas_tanah'] : 'N/A';
|
$luas_tanah = isset($details['luas_tanah']) ? $details['luas_tanah'] : 'N/A';
|
||||||
break;
|
break;
|
||||||
@@ -191,7 +191,7 @@
|
|||||||
@elseif (strcasecmp($item->name, 'Lebih Rendah') == 0)
|
@elseif (strcasecmp($item->name, 'Lebih Rendah') == 0)
|
||||||
<input id="input-lebih-rendah" type="text"
|
<input id="input-lebih-rendah" type="text"
|
||||||
style="{{ isset($forminspeksi['tanah']['ketinggian_tanah']['lebih_rendah']) && $forminspeksi['tanah']['ketinggian_tanah']['lebih_rendah'] ? '' : 'display: none;' }}"
|
style="{{ isset($forminspeksi['tanah']['ketinggian_tanah']['lebih_rendah']) && $forminspeksi['tanah']['ketinggian_tanah']['lebih_rendah'] ? '' : 'display: none;' }}"
|
||||||
name="ketinggian_lebih_rendah" class="input w-full mt-2" placeholder="m2"
|
name="ketinggian_lebih_rendah" class="input w-full mt-2" placeholder="m"
|
||||||
value="{{ old('ketinggian_lebih_rendah', $forminspeksi['tanah']['ketinggian_tanah']['lebih_rendah'] ?? '') }}"/>
|
value="{{ old('ketinggian_lebih_rendah', $forminspeksi['tanah']['ketinggian_tanah']['lebih_rendah'] ?? '') }}"/>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@@ -217,6 +217,11 @@
|
|||||||
{{ old('kontur_jalan', isset($forminspeksi['tanah']['kontur_jalan']) ? $forminspeksi['tanah']['kontur_jalan'] : '') == 'rata' ? 'checked' : '' }}>
|
{{ old('kontur_jalan', isset($forminspeksi['tanah']['kontur_jalan']) ? $forminspeksi['tanah']['kontur_jalan'] : '') == 'rata' ? 'checked' : '' }}>
|
||||||
<span class="ml-2">Rata</span>
|
<span class="ml-2">Rata</span>
|
||||||
</label>
|
</label>
|
||||||
|
<label class="form-label flex items-center gap-2.5 text-nowrap">
|
||||||
|
<input type="radio" class="radio" name="kontur_jalan" value="Menanjak"
|
||||||
|
{{ old('kontur_jalan', isset($forminspeksi['tanah']['kontur_jalan']) ? $forminspeksi['tanah']['kontur_jalan'] : '') == 'Menanjak' ? 'checked' : '' }}>
|
||||||
|
<span class="ml-2">Menanjak</span>
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<em id="error-kontur_jalan" class="alert text-danger text-sm"></em>
|
<em id="error-kontur_jalan" class="alert text-danger text-sm"></em>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -200,6 +200,149 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function approveReschedule(penilaianId,permohonanId, noReg, debitur, reschedule_date, reschedule_note) {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Konfirmasi',
|
||||||
|
html: `
|
||||||
|
<p>Yakin akan Menyetujui atau Menolak Reschedule Jadwal Kunjungan <b>${noReg}</b> untuk Debitur <b>${debitur}</b>
|
||||||
|
pada waktu <b>${window.formatTanggalWaktuIndonesia(reschedule_date)}</b>?</p>
|
||||||
|
<p><b>Catatan: </b> <br/>${reschedule_note}</p>
|
||||||
|
`,
|
||||||
|
icon: 'warning',
|
||||||
|
showDenyButton: true,
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: '#3085d6',
|
||||||
|
denyButtonColor: '#d33',
|
||||||
|
confirmButtonText: 'Approve',
|
||||||
|
denyButtonText: 'Reject'
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
// Approve action
|
||||||
|
let token = "{{ csrf_token() }}";
|
||||||
|
let useURL = "{{ URL::to('/surveyor/store-approve-reschedule') }}" + "/" + penilaianId;
|
||||||
|
|
||||||
|
var input_data = {
|
||||||
|
_token : token,
|
||||||
|
permohonan_id : permohonanId,
|
||||||
|
nomor_registrasi: noReg
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url: useURL,
|
||||||
|
type: "PUT",
|
||||||
|
cache: false,
|
||||||
|
data: input_data,
|
||||||
|
success: function(response) {
|
||||||
|
console.log(response);
|
||||||
|
if ('success' == response.status) {
|
||||||
|
Swal.fire('Sukses!', response.message, 'success').then(() => {
|
||||||
|
location.reload(true);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Swal.fire('Error!', response.message, 'error');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(response, textStatus, errorThrown) {
|
||||||
|
console.log(response);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (result.isDenied) {
|
||||||
|
// Reject action
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Masukkan Keterangan',
|
||||||
|
input: 'textarea',
|
||||||
|
inputPlaceholder: 'Tuliskan alasan penolakan di sini...',
|
||||||
|
inputAttributes: {
|
||||||
|
'aria-label': 'Tuliskan alasan penolakan di sini'
|
||||||
|
},
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonText: 'Submit',
|
||||||
|
cancelButtonText: 'Batal'
|
||||||
|
}).then((rejectResult) => {
|
||||||
|
if (rejectResult.isConfirmed && rejectResult.value) {
|
||||||
|
let token = "{{ csrf_token() }}";
|
||||||
|
let useURL = "{{ URL::to('/surveyor/store-rejected-reschedule') }}" + "/" + penilaianId;
|
||||||
|
|
||||||
|
|
||||||
|
var input_data = {
|
||||||
|
_token : token,
|
||||||
|
permohonan_id : permohonanId,
|
||||||
|
nomor_registrasi: noReg,
|
||||||
|
rejected_note : rejectResult.value
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url: useURL,
|
||||||
|
type: "PUT",
|
||||||
|
cache: false,
|
||||||
|
data: input_data,
|
||||||
|
|
||||||
|
success: function(response) {
|
||||||
|
console.log(response);
|
||||||
|
if ('success' == response.status) {
|
||||||
|
Swal.fire('Ditolak!', response.message, 'success').then(() => {
|
||||||
|
location.reload(true);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Swal.fire('Error!', response.message, 'error');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(response, textStatus, errorThrown) {
|
||||||
|
console.log(response);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (rejectResult.dismiss === Swal.DismissReason.cancel) {
|
||||||
|
Swal.fire('Dibatalkan', 'Aksi penolakan dibatalkan.', 'info');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function prosesSurvey(permohonanId, nomor_registrasi) {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Konfirmasi',
|
||||||
|
text: `Yakin akan Melakukan Inspeksi dengan nomor registrasi ${nomor_registrasi}?`,
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: '#3085d6',
|
||||||
|
cancelButtonColor: '#d33',
|
||||||
|
confirmButtonText: 'Ya, Setujui',
|
||||||
|
cancelButtonText: 'Batal',
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
// Mendefinisikan URL dan data
|
||||||
|
let token = "{{ csrf_token() }}";
|
||||||
|
let useURL = `{{ URL::to('/surveyor/store-proses-survey') }}/${permohonanId}`;
|
||||||
|
|
||||||
|
let input_data = {
|
||||||
|
_token: token,
|
||||||
|
permohonan_id: permohonanId
|
||||||
|
};
|
||||||
|
|
||||||
|
// Melakukan AJAX request
|
||||||
|
$.ajax({
|
||||||
|
url: useURL,
|
||||||
|
type: "PUT",
|
||||||
|
cache: false,
|
||||||
|
data: input_data,
|
||||||
|
dataType: "json",
|
||||||
|
success: function(response) {
|
||||||
|
if (response.status === 'success') {
|
||||||
|
// Arahkan langsung ke halaman inspeksi
|
||||||
|
window.location.href = `surveyor/${permohonanId}/show?form=inspeksi`;
|
||||||
|
} else {
|
||||||
|
Swal.fire('Error!', response.message, 'error');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(response) {
|
||||||
|
const errorMessage = response.responseJSON?.message || 'Terjadi kesalahan saat memproses data.';
|
||||||
|
Swal.fire('Error!', errorMessage, 'error');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
@@ -254,14 +397,23 @@
|
|||||||
render: (item, data) => data.jenis_fasilitas_kredit ? `${data.jenis_fasilitas_kredit.name}` : 'N/A',
|
render: (item, data) => data.jenis_fasilitas_kredit ? `${data.jenis_fasilitas_kredit.name}` : 'N/A',
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
title: 'Action',
|
title: 'Action',
|
||||||
render: (item, data) => {
|
render: (item, data) => {
|
||||||
let actionHtml = '';
|
let actionHtml = '';
|
||||||
// if (data.documents.length > 0) {
|
|
||||||
|
|
||||||
if (data.penilaian.waktu_penilaian == null ||
|
if (data.status === 'request-reschedule') {
|
||||||
(data.penilaian.waktu_penilaian && data.penilaian.authorized_status == null)) {
|
actionHtml += `
|
||||||
actionHtml += `
|
<button class="btn btn-sm btn-icon btn-clear btn-success"
|
||||||
|
onclick="approveReschedule('${data.penilaian.id}','${data.id}', '${data.nomor_registrasi}', '${data.debiture?.name}', '${data.penilaian.reschedule_date}', '${data.penilaian.reschedule_note}')"
|
||||||
|
title="Approve Reschedule">
|
||||||
|
<i class="ki-filled ki-double-check"></i>
|
||||||
|
</button>
|
||||||
|
`;
|
||||||
|
} else {
|
||||||
|
if (data.penilaian.waktu_penilaian == null ||
|
||||||
|
(data.penilaian.waktu_penilaian && data.penilaian.authorized_status == null)) {
|
||||||
|
// Tombol Buat Jadwal Kunjungan
|
||||||
|
actionHtml += `
|
||||||
<a class="btn btn-sm btn-icon btn-clear btn-primary"
|
<a class="btn btn-sm btn-icon btn-clear btn-primary"
|
||||||
data-modal-toggle="#modal_jadwal"
|
data-modal-toggle="#modal_jadwal"
|
||||||
onclick="jadwal(${data.penilaian.id})"
|
onclick="jadwal(${data.penilaian.id})"
|
||||||
@@ -269,9 +421,28 @@
|
|||||||
<i class="ki-filled ki-calendar-edit"></i>
|
<i class="ki-filled ki-calendar-edit"></i>
|
||||||
</a>
|
</a>
|
||||||
`;
|
`;
|
||||||
} else {
|
|
||||||
|
|
||||||
actionHtml += `
|
if (data.penilaian.waktu_penilaian && data.penilaian.authorized_status == null) {
|
||||||
|
// Tambahkan elemen berdampingan
|
||||||
|
actionHtml += `
|
||||||
|
<span class="badge badge-xs badge-outline badge-warning text-4xs">Menunggu Pemohon</span>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
} else if (data.status === 'approved-reschedule' || data.status === 'rejected-reschedule') {
|
||||||
|
actionHtml += `
|
||||||
|
<span class="badge badge-xs badge-outline badge-warning text-4xs">Menunggu Pemohon</span>
|
||||||
|
`;
|
||||||
|
} else if(data.status === 'proses-survey'){
|
||||||
|
actionHtml += `
|
||||||
|
<a class="btn btn-sm btn-icon btn-clear btn-clarity"
|
||||||
|
onclick="prosesSurvey(${data.id}, '${data.nomor_registrasi}')"
|
||||||
|
title="Masuk Form Inspeksi">
|
||||||
|
<i class="ki-filled ki-tablet-ok"></i>
|
||||||
|
</a>
|
||||||
|
`;
|
||||||
|
}else {
|
||||||
|
// Tombol Lihat Form Inspeksi dan Freeze Survey
|
||||||
|
actionHtml += `
|
||||||
<a class="btn btn-sm btn-icon btn-clear btn-warning"
|
<a class="btn btn-sm btn-icon btn-clear btn-warning"
|
||||||
href="surveyor/${data.id}/show?form=inspeksi"
|
href="surveyor/${data.id}/show?form=inspeksi"
|
||||||
title="Lihat Form Inspeksi">
|
title="Lihat Form Inspeksi">
|
||||||
@@ -284,16 +455,13 @@
|
|||||||
<i class="ki-filled ki-arrow-circle-right"></i>
|
<i class="ki-filled ki-arrow-circle-right"></i>
|
||||||
</button>
|
</button>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
// } else {
|
}
|
||||||
|
|
||||||
// actionHtml =
|
return actionHtml;
|
||||||
// `<span class="badge badge-sm badge-danger uppercase flex justify-center">Lengkapi Aset Jaminan</span>`;
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
return actionHtml;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -382,6 +382,8 @@ Route::middleware(['auth'])->group(function () {
|
|||||||
Route::get('datatables', [PermohonanController::class, 'dataForDatatables'])->name('datatables');
|
Route::get('datatables', [PermohonanController::class, 'dataForDatatables'])->name('datatables');
|
||||||
Route::get('export', [PermohonanController::class, 'export'])->name('export');
|
Route::get('export', [PermohonanController::class, 'export'])->name('export');
|
||||||
Route::get('print/{id}', [PermohonanController::class, 'print'])->name('print');
|
Route::get('print/{id}', [PermohonanController::class, 'print'])->name('print');
|
||||||
|
Route::put('store-approved/{id}', [PermohonanController::class, 'storeAproved'])->name('storeAproved');
|
||||||
|
Route::put('store-reschedule-survey/{id}', [PermohonanController::class, 'storeRescheduleSurvey'])->name('storeRescheduleSurvey');
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::get('authorization', [PermohonanController::class, 'authorization'])->name('authorization.index');
|
Route::get('authorization', [PermohonanController::class, 'authorization'])->name('authorization.index');
|
||||||
@@ -551,7 +553,7 @@ Route::middleware(['auth'])->group(function () {
|
|||||||
Route::post('store', [SurveyorController::class, 'store'])->name('store');
|
Route::post('store', [SurveyorController::class, 'store'])->name('store');
|
||||||
Route::post('storeDenah', [SurveyorController::class, 'storeDenah'])->name('storeDenah');
|
Route::post('storeDenah', [SurveyorController::class, 'storeDenah'])->name('storeDenah');
|
||||||
Route::put('storeJadwal', [SurveyorController::class, 'storeJadwal'])->name('storeJadwal');
|
Route::put('storeJadwal', [SurveyorController::class, 'storeJadwal'])->name('storeJadwal');
|
||||||
Route::put('storeAproved/{storeAproved}', [SurveyorController::class, 'storeAproved'])->name('storeAproved');
|
|
||||||
Route::post('storeFreeze/{id}', [SurveyorController::class, 'storeFreeze'])->name('storeFreeze');
|
Route::post('storeFreeze/{id}', [SurveyorController::class, 'storeFreeze'])->name('storeFreeze');
|
||||||
Route::post('storeFoto', [SurveyorController::class, 'storeFoto'])->name('storeFoto');
|
Route::post('storeFoto', [SurveyorController::class, 'storeFoto'])->name('storeFoto');
|
||||||
Route::put('updateFoto', [SurveyorController::class, 'updateFoto'])->name('updateFoto');
|
Route::put('updateFoto', [SurveyorController::class, 'updateFoto'])->name('updateFoto');
|
||||||
@@ -577,6 +579,11 @@ Route::middleware(['auth'])->group(function () {
|
|||||||
|
|
||||||
Route::get('/print-out-inspeksi/{permohonan_id}/{dokument_id}/{jenis_jaminan_id}', [SurveyorController::class, 'print_out_inspeksi'])->name('print_out_inspeksi');
|
Route::get('/print-out-inspeksi/{permohonan_id}/{dokument_id}/{jenis_jaminan_id}', [SurveyorController::class, 'print_out_inspeksi'])->name('print_out_inspeksi');
|
||||||
|
|
||||||
|
// resedule
|
||||||
|
Route::put('store-approve-reschedule/{id}', [SurveyorController::class, 'approveReschedule'])->name('approveReschedule');
|
||||||
|
Route::put('store-rejected-reschedule/{id}', [SurveyorController::class, 'rejectReschedule'])->name('rejectReschedule');
|
||||||
|
Route::put('store-proses-survey/{id}', [SurveyorController::class, 'storeProsesSurvey'])->name('storeProsesSurvey');
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::name('penilai.')->prefix('penilai')->group(function () {
|
Route::name('penilai.')->prefix('penilai')->group(function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user