menyamakan staging
This commit is contained in:
@@ -5,16 +5,25 @@ namespace Modules\Lpj\Http\Controllers;
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\Lpj\Models\Permohonan;
|
||||
use Modules\Lpj\Models\Inspeksi;
|
||||
use Modules\Lpj\Models\Penilai;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Modules\Lpj\Exports\KertasKerjaExport;
|
||||
use Modules\Lpj\Http\Controllers\SurveyorController;
|
||||
use Modules\Location\Models\Province;
|
||||
|
||||
class PenilaiController extends Controller
|
||||
{
|
||||
public $user;
|
||||
|
||||
protected $surveyorController;
|
||||
|
||||
public function __construct(SurveyorController $surveyorController)
|
||||
{
|
||||
$this->surveyorController = $surveyorController;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
@@ -26,20 +35,21 @@ class PenilaiController extends Controller
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function lampiran($id)
|
||||
public function lampiran(Request $request, $id)
|
||||
{
|
||||
$permohonan = Permohonan::with('debiture.documents')->find($id);
|
||||
|
||||
$jaminanId = $permohonan->debiture->documents->first()->jenis_jaminan_id;
|
||||
$permohonanId = $request->query('permohonanId');
|
||||
$documentId = $request->query('documentId');
|
||||
$jaminanId = $request->query('jaminanId');
|
||||
|
||||
$inpeksi = Inspeksi::where('permohonan_id', $id)->where('jenis_jaminan_id', $jaminanId)->first();
|
||||
$permohonan = $this->surveyorController->getPermohonanJaminanId($id, $documentId, $jaminanId);
|
||||
$inpeksi = Inspeksi::where('permohonan_id', $id)->where('dokument_id', $documentId)->first();
|
||||
|
||||
$formFoto = null;
|
||||
if ($inpeksi) {
|
||||
$formFoto = json_decode($inpeksi->foto_form, true);
|
||||
}
|
||||
|
||||
|
||||
return view('lpj::penilai.lampiran', compact('permohonan', 'formFoto'));
|
||||
}
|
||||
|
||||
@@ -56,48 +66,103 @@ class PenilaiController extends Controller
|
||||
//
|
||||
}
|
||||
|
||||
public function sederhana($id)
|
||||
public function sederhana(Request $request, $id)
|
||||
{
|
||||
$data = new SurveyorController();
|
||||
$basicData = $data->getCommonData();
|
||||
|
||||
$permohonan = Permohonan::with(['debiture.documents.jenisjaminan', 'region.teams.teamsUsers.user', 'penilaian'])->find($id);
|
||||
$jaminanId = $permohonan->debiture->documents->first()->jenis_jaminan_id;
|
||||
$inspeksi = Inspeksi::where('permohonan_id', $id)->where('jenis_jaminan_id', $jaminanId)->first();
|
||||
$forminspeksi = null;
|
||||
if ($inspeksi) {
|
||||
$forminspeksi = json_decode($inspeksi->data_form, true);
|
||||
}
|
||||
return view('lpj::penilai.components.lpj-sederhana-standard', compact('permohonan', 'basicData', 'forminspeksi', 'inspeksi'));
|
||||
}
|
||||
$basicData = $this->surveyorController->getCommonData();
|
||||
|
||||
public function standard($id)
|
||||
{
|
||||
$permohonan = Permohonan::with(['debiture.documents.jenisjaminan', 'region.teams.teamsUsers.user', 'penilaian'])->find($id);
|
||||
$documentId = $request->query('documentId');
|
||||
$inspeksiId = $request->query('inspeksiId');
|
||||
$jaminanId = $request->query('jaminanId');
|
||||
|
||||
$jaminanId = $permohonan->debiture->documents->first()->jenis_jaminan_id;
|
||||
$permohonan = $this->surveyorController->getPermohonanJaminanId($id, $documentId, $jaminanId);
|
||||
|
||||
$inspeksi = Inspeksi::where('permohonan_id', $id)->where('jenis_jaminan_id', $jaminanId)->first();
|
||||
$forminspeksi = null;
|
||||
|
||||
|
||||
$inspeksi = Inspeksi::where('permohonan_id', $id)->where('dokument_id', $documentId)->first();
|
||||
$lpj = Penilai::where('permohonan_id', $id)->where('dokument_id', $documentId)->first();
|
||||
|
||||
$lpjData = null;
|
||||
if ($inspeksi) {
|
||||
$forminspeksi = json_decode($inspeksi->data_form, true);
|
||||
}
|
||||
|
||||
$data = new SurveyorController();
|
||||
$basicData = $data->getCommonData();
|
||||
if ($lpj) {
|
||||
$lpjData = json_decode($lpj->lpj, true);
|
||||
}
|
||||
|
||||
return view('lpj::penilai.components.lpj-sederhana-standard', compact('permohonan', 'forminspeksi', 'basicData', 'inspeksi'));
|
||||
return view('lpj::penilai.components.lpj-sederhana-standard', compact('permohonan', 'basicData', 'forminspeksi', 'inspeksi', 'lpjData'));
|
||||
}
|
||||
|
||||
public function resume($id)
|
||||
public function standard(Request $request, $id)
|
||||
{
|
||||
$permohonan = Permohonan::with(['debiture.documents.jenisjaminan', 'region.teams.teamsUsers.user', 'penilaian'])->find($id);
|
||||
return view('lpj::penilai.components.resume', compact('permohonan'));
|
||||
|
||||
$documentId = $request->query('documentId');
|
||||
$jaminanId = $request->query('jaminanId');
|
||||
|
||||
$permohonan = $this->surveyorController->getPermohonanJaminanId($id, $documentId, $jaminanId);
|
||||
$basicData = $this->surveyorController->getCommonData();
|
||||
|
||||
$inspeksi = Inspeksi::where('permohonan_id', $id)->where('dokument_id', $documentId)->first();
|
||||
$lpj = Penilai::where('permohonan_id', $id)->where('dokument_id', $documentId)->first();
|
||||
|
||||
$forminspeksi = null;
|
||||
$lpjData = null;
|
||||
if ($inspeksi) {
|
||||
$forminspeksi = json_decode($inspeksi->data_form, true);
|
||||
}
|
||||
|
||||
if ($lpj) {
|
||||
$lpjData = json_decode($lpj->lpj, true);
|
||||
}
|
||||
|
||||
return view('lpj::penilai.components.lpj-sederhana-standard', compact('permohonan', 'forminspeksi', 'basicData', 'inspeksi', 'lpjData'));
|
||||
}
|
||||
|
||||
public function memo()
|
||||
public function resume(Request $request)
|
||||
{
|
||||
return view('lpj::resume.index');
|
||||
$permohonanId = $request->query('permohonanId');
|
||||
$documentId = $request->query('documentId');
|
||||
$inspeksiId = $request->query('inspeksiId');
|
||||
$jaminanId = $request->query('jaminanId');
|
||||
|
||||
$permohonan = $this->surveyorController->getPermohonanJaminanId($permohonanId, $documentId, $jaminanId);
|
||||
$inspeksi = Inspeksi::where('permohonan_id', $permohonanId)->where('dokument_id', $documentId)->first();
|
||||
|
||||
|
||||
$resume = Penilai::where('permohonan_id', $permohonanId)->where('dokument_id', $documentId)->first();
|
||||
$lpjData = null;
|
||||
if ($resume) {
|
||||
$resumeData = json_decode($resume->resume, true);
|
||||
}
|
||||
|
||||
return view('lpj::penilai.components.resume', compact('permohonan', 'resumeData'));
|
||||
}
|
||||
|
||||
public function memo(Request $request)
|
||||
{
|
||||
$permohonanId = $request->query('permohonanId');
|
||||
$documentId = $request->query('documentId');
|
||||
$inspeksiId = $request->query('inspeksiId');
|
||||
$jaminanId = $request->query('jaminanId');
|
||||
|
||||
$permohonan = $this->surveyorController->getPermohonanJaminanId($permohonanId, $documentId, $jaminanId);
|
||||
$inspeksi = Inspeksi::where('permohonan_id', $permohonanId)->where('dokument_id', $documentId)->first();
|
||||
|
||||
$provinces = Province::all();
|
||||
$basicData = $this->surveyorController->getCommonData();
|
||||
|
||||
$formFoto = null;
|
||||
$formPeta = null;
|
||||
if ($inspeksi) {
|
||||
$formFoto = json_decode($inspeksi->foto_form, true);
|
||||
$formPeta = json_decode($inspeksi->data_form, true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return view('lpj::penilai.components.memo', compact('permohonan', 'formFoto', 'formPeta', 'provinces', 'basicData'));
|
||||
}
|
||||
|
||||
|
||||
@@ -106,7 +171,7 @@ class PenilaiController extends Controller
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$permohonan = Permohonan::with(['debiture.documents.jenisjaminan', 'region.teams.teamsUsers.user', 'penilaian'])->find($id);
|
||||
$permohonan = Permohonan::with(['debiture.documents.jenisjaminan', 'region.teams.teamsUsers.user', 'penilaian', 'documents.inspeksi'])->find($id);
|
||||
|
||||
// return response()->json(['permohonan' => $permohonan]);
|
||||
return view('lpj::penilai.show', compact('permohonan'));
|
||||
@@ -123,11 +188,34 @@ class PenilaiController extends Controller
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
public function paparan(Request $request)
|
||||
{
|
||||
//
|
||||
|
||||
$permohonanId = $request->query('permohonanId');
|
||||
$documentId = $request->query('documentId');
|
||||
$inspeksiId = $request->query('inspeksiId');
|
||||
$jaminanId = $request->query('jaminanId');
|
||||
|
||||
$permohonan = $this->surveyorController->getPermohonanJaminanId($permohonanId, $documentId, $jaminanId);
|
||||
$penilai = Penilai::where('permohonan_id', $permohonanId)->where('dokument_id', $documentId)->first();
|
||||
$inspeksi = Inspeksi::where('permohonan_id', $permohonanId)->where
|
||||
('dokument_id', $documentId)->first();
|
||||
$formFoto = null;
|
||||
if ($inspeksi) {
|
||||
$formFoto = json_decode($inspeksi->foto_form, true);
|
||||
}
|
||||
|
||||
return view('lpj::penilai.components.paparan', compact('permohonan', 'formFoto', 'penilai'));
|
||||
}
|
||||
|
||||
|
||||
public function rap(Request $request)
|
||||
{
|
||||
$permohonanId = $request->query('permohonanId');
|
||||
return view('lpj::penilai.components.paparan');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
@@ -157,10 +245,10 @@ class PenilaiController extends Controller
|
||||
});
|
||||
}
|
||||
|
||||
// Apply whereHas to check penilai_id, role, and user_id specifically for 'penilai' role
|
||||
|
||||
$query->whereHas('penilaian.userPenilai', function ($q) {
|
||||
$q->where('role', 'penilai') // Ensure the role is 'penilai'
|
||||
->where('user_id', 12); // Ganti dengan Auth::user()->id jika dinamis
|
||||
$q->where('role', 'penilai')
|
||||
->where('user_id', Auth::user()->id);
|
||||
});
|
||||
|
||||
// Apply sorting if provided
|
||||
@@ -213,26 +301,226 @@ class PenilaiController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
public function kertas_kerja($id, $jaminanId)
|
||||
public function export_kertas_kerja(Request $request)
|
||||
{
|
||||
$data = Inspeksi::where('permohonan_id', $id)->where('jenis_jaminan_id', $jaminanId)->first();
|
||||
|
||||
// $data = null;
|
||||
// $headerInfo = [
|
||||
// 'tanggal_penilaian' => '',
|
||||
// 'nama_pemilik' => '',
|
||||
// 'nama_pemberi_tugas' => '',
|
||||
// 'lokasi_lengkap' => '',
|
||||
// 'nama_debitur' => ''
|
||||
// ];
|
||||
$permohonanId = $request->query('permohonanId');
|
||||
$documentId = $request->query('documentId');
|
||||
$inspeksiId = $request->query('inspeksiId');
|
||||
$jaminanId = $request->query('jaminanId');
|
||||
|
||||
// $datas = json_decode($data->data_pembanding);
|
||||
// return response()->json(['data' =>$datas ]);
|
||||
$data = Inspeksi::where('permohonan_id', $permohonanId)->where('dokument_id', $documentId)->first();
|
||||
|
||||
// return view('lpj::component.kertas-kerja', compact('data'));
|
||||
return Excel::download(new KertasKerjaExport($data), 'kertas-kerja.xlsx');
|
||||
return view('lpj::component.kertas-kerja', compact('data'));
|
||||
// return Excel::download(new KertasKerjaExport($data), 'kertas-kerja.xlsx');
|
||||
}
|
||||
|
||||
|
||||
public function import_kertas_kerja(Request $request)
|
||||
{
|
||||
|
||||
$validatedData = $request->validate([
|
||||
'permohonan_id' => 'required|integer',
|
||||
'document_id' => 'required|integer',
|
||||
'inspeksi_id' => 'required|integer',
|
||||
'kertas_kerja' => 'required|file|mimes:pdf,doc,docx,xls,xlsx,xlsx',
|
||||
]);
|
||||
|
||||
try {
|
||||
// Simpan file kertas kerja
|
||||
if ($request->hasFile('kertas_kerja')) {
|
||||
$file = $request->file('kertas_kerja');
|
||||
$filePath = $this->surveyorController->uploadFile($file, 'kertas_kerja');
|
||||
Penilai::updateOrCreate(
|
||||
[
|
||||
'permohonan_id' => $validatedData['permohonan_id'],
|
||||
'dokument_id' => $validatedData['document_id'],
|
||||
'inspeksi_id' => $validatedData['inspeksi_id'],
|
||||
],
|
||||
[
|
||||
'kertas_kerja' => $filePath,
|
||||
]
|
||||
);
|
||||
|
||||
return response()->json(['success' => true, 'message' => 'Kertas kerja berhasil diunggah.']);
|
||||
}
|
||||
|
||||
return response()->json(['success' => false, 'message' => 'File kertas kerja tidak ditemukan.'], 400);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['success' => false, 'message' => 'Terjadi kesalahan: ' . $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function status($id)
|
||||
{
|
||||
$penilai = Penilai::find($id);
|
||||
return response()->json(['data' => $penilai]);
|
||||
}
|
||||
|
||||
public function checkStatusLpj(Request $request)
|
||||
{
|
||||
$permohonanId = $request->query('permohonanId');
|
||||
$documentId = $request->query('documentId');
|
||||
$inspeksiId = $request->query('inspeksiId');
|
||||
|
||||
$statusLpj = Penilai::where('permohonan_id', $permohonanId)
|
||||
->where('dokument_id', $documentId)
|
||||
->where('inspeksi_id', $inspeksiId)
|
||||
->first();
|
||||
|
||||
return response()->json(['status' => $statusLpj ? $statusLpj->type : null]);
|
||||
}
|
||||
|
||||
public function saveStatusLpj(Request $request)
|
||||
{
|
||||
|
||||
Penilai::updateOrCreate(
|
||||
[
|
||||
'permohonan_id' => $request->permohonan_id,
|
||||
'dokument_id' => $request->document_id,
|
||||
'inspeksi_id' => $request->inspeksi_id,
|
||||
],
|
||||
[
|
||||
'type' => $request->type,
|
||||
]
|
||||
);
|
||||
|
||||
return response()->json(['success' => true]);
|
||||
}
|
||||
|
||||
|
||||
public function storePenilaian($id)
|
||||
{
|
||||
try {
|
||||
$permohonan = Permohonan::findOrFail($id);
|
||||
$permohonan->update([
|
||||
'status' => 'proses-laporan',
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => 'Berhasil menyimpan penilaian'
|
||||
], 200);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Terjadi kesalahan',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function storeResume(Request $request)
|
||||
{
|
||||
try {
|
||||
|
||||
// dd($request->all());
|
||||
$validatedData = $request->validate([
|
||||
'permohonan_id' => 'required',
|
||||
'document_id' => 'required',
|
||||
'inspeksi_id' => 'required',
|
||||
'resume' => 'required|array',
|
||||
]);
|
||||
|
||||
// Simpan atau update data
|
||||
Penilai::updateOrCreate(
|
||||
[
|
||||
'permohonan_id' => $validatedData['permohonan_id'],
|
||||
'dokument_id' => $validatedData['document_id'],
|
||||
'inspeksi_id' => $validatedData['inspeksi_id'],
|
||||
],
|
||||
[
|
||||
'resume' => json_encode($validatedData['resume']),
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => 'Berhasil saved resume'
|
||||
], 200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Terjadi kesalahan',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function storeMemo(Request $request)
|
||||
{
|
||||
try {
|
||||
|
||||
$validatedData = $request->validate([
|
||||
'permohonan_id' => 'required|integer',
|
||||
'document_id' => 'required|integer',
|
||||
'inspeksi_id' => 'required|integer',
|
||||
'memo' => 'required',
|
||||
]);
|
||||
Penilai::updateOrCreate(
|
||||
[
|
||||
'permohonan_id' => $validatedData['permohonan_id'],
|
||||
'dokument_id' => $validatedData['document_id'],
|
||||
'inspeksi_id' => $validatedData['inspeksi_id'],
|
||||
],
|
||||
[
|
||||
'memo' => json_encode($validatedData['memo']),
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => 'Berhasil saved memo'
|
||||
], 200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Terjadi kesalahan',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function storeLpjSederhanadanStandard(Request $request)
|
||||
{
|
||||
|
||||
try {
|
||||
|
||||
$validatedData = $request->validate([
|
||||
'permohonan_id' => 'required|integer',
|
||||
'document_id' => 'required|integer',
|
||||
'inspeksi_id' => 'required|integer',
|
||||
'lpj' => 'required',
|
||||
]);
|
||||
Penilai::updateOrCreate(
|
||||
[
|
||||
'permohonan_id' => $validatedData['permohonan_id'],
|
||||
'dokument_id' => $validatedData['document_id'],
|
||||
'inspeksi_id' => $validatedData['inspeksi_id'],
|
||||
],
|
||||
[
|
||||
'lpj' => json_encode($validatedData['lpj']),
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => 'Berhasil saved lpj'
|
||||
], 200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Terjadi kesalahan',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
@php
|
||||
$luas = $item->detail;
|
||||
$details = json_decode($luas[0]->details, true);
|
||||
$luas_tanah = isset($details['luas_tanah']) ? $details['luas_tanah'] : 'N/A';
|
||||
$luas_tanah = isset($details['luas']) ? $details['luas'] : 'N/A';
|
||||
@endphp
|
||||
<input type="hidden" name="luas_tanah_sesuai" class="input" value="{{ $luas_tanah }}">
|
||||
<p class="text-2sm text-gray-700">{{ $luas_tanah }} m<sup>2</sup></p>
|
||||
|
||||
Reference in New Issue
Block a user