update data pembading surveyor
This commit is contained in:
@@ -6,6 +6,7 @@ use Illuminate\Http\Request;
|
||||
use Modules\Lpj\Models\Permohonan;
|
||||
use Modules\Lpj\Models\Inspeksi;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class PenilaiController extends Controller
|
||||
{
|
||||
@@ -22,7 +23,8 @@ class PenilaiController extends Controller
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function lampiran($id){
|
||||
public function lampiran($id)
|
||||
{
|
||||
$permohonan = Permohonan::with('debiture.documents')->find($id);
|
||||
|
||||
$jaminanId = $permohonan->debiture->documents->first()->jenis_jaminan_id;
|
||||
@@ -87,27 +89,32 @@ class PenilaiController extends Controller
|
||||
}
|
||||
|
||||
public function dataForDatatables(Request $request)
|
||||
{
|
||||
{
|
||||
if (is_null($this->user) || !$this->user->can('penilai.view')) {
|
||||
//abort(403, 'Sorry! You are not allowed to view users.');
|
||||
}
|
||||
|
||||
// Retrieve data from the database
|
||||
$query = Permohonan::query()->where('status', '=', 'done');
|
||||
$query = Permohonan::query();
|
||||
|
||||
// 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->orWhereRelation('debiture', 'name', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhereRelation('branch', 'name', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhereRelation('user', 'name', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhereRelation('tujuanPenilaian', 'name', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhereRelation('jenisfasilitasKredit', 'name', 'LIKE', '%' . $search . '%');
|
||||
$columns = ['nomor_registrasi', 'debiture.name', 'branch.name', 'user.name', 'tujuanPenilaian.name', 'jenisfasilitasKredit.name'];
|
||||
|
||||
$query->where(function ($q) use ($search, $columns) {
|
||||
foreach ($columns as $column) {
|
||||
$q->orWhereRelation(explode('.', $column)[0], explode('.', $column)[1], 'LIKE', '%' . $search . '%');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 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
|
||||
});
|
||||
|
||||
// Apply sorting if provided
|
||||
if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) {
|
||||
$order = $request->get('sortOrder');
|
||||
@@ -122,7 +129,7 @@ class PenilaiController extends Controller
|
||||
if ($request->has('page') && $request->has('size')) {
|
||||
$page = $request->get('page');
|
||||
$size = $request->get('size');
|
||||
$offset = ($page - 1) * $size; // Calculate the offset
|
||||
$offset = ($page - 1) * $size;
|
||||
|
||||
$query->skip($offset)->take($size);
|
||||
}
|
||||
@@ -131,13 +138,20 @@ class PenilaiController extends Controller
|
||||
$filteredRecords = $query->count();
|
||||
|
||||
// Get the data for the current page
|
||||
$data = $query->with(['user', 'debiture', 'branch', 'tujuanPenilaian', 'jenisfasilitasKredit'])->get();
|
||||
$data = $query->with([
|
||||
'user',
|
||||
'debiture',
|
||||
'branch',
|
||||
'tujuanPenilaian',
|
||||
'jenisfasilitasKredit',
|
||||
'penilaian.userPenilai' // Ensure this relation is included
|
||||
])->get();
|
||||
|
||||
// Calculate the page count
|
||||
$pageCount = ceil($totalRecords / $request->get('size'));
|
||||
|
||||
// Calculate the current page number
|
||||
$currentPage = 0 + 1;
|
||||
$currentPage = $request->get('page', 1);
|
||||
|
||||
// Return the response data as a JSON object
|
||||
return response()->json([
|
||||
@@ -149,5 +163,9 @@ class PenilaiController extends Controller
|
||||
'totalCount' => $totalRecords,
|
||||
'data' => $data,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace Modules\Lpj\Http\Controllers;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Modules\Lpj\Exports\BasicDataSurveyorExport;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -116,6 +117,7 @@ class SurveyorController extends Controller
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
return view('lpj::surveyor.detail', compact(
|
||||
'permohonan',
|
||||
'surveyor',
|
||||
@@ -340,14 +342,14 @@ class SurveyorController extends Controller
|
||||
}
|
||||
|
||||
private function categoryHasNewFiles(Request $request, array $fields): bool
|
||||
{
|
||||
{
|
||||
$photoField = $fields[0]; // First element is usually the photo field
|
||||
return $request->hasFile($photoField) ||
|
||||
(is_array($request->file($photoField)) && count($request->file($photoField)) > 0);
|
||||
}
|
||||
}
|
||||
|
||||
private function deleteFilesForCategory($categoryData)
|
||||
{
|
||||
private function deleteFilesForCategory($categoryData)
|
||||
{
|
||||
if (!is_array($categoryData)) {
|
||||
return;
|
||||
}
|
||||
@@ -357,14 +359,14 @@ private function deleteFilesForCategory($categoryData)
|
||||
$this->deleteOfFile($item['foto']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function deleteOfFile($filePath)
|
||||
{
|
||||
private function deleteOfFile($filePath)
|
||||
{
|
||||
if ($filePath && Storage::exists($filePath)) {
|
||||
Storage::delete($filePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -377,7 +379,7 @@ private function deleteOfFile($filePath)
|
||||
return $request->validate([
|
||||
'permohonan_id' => 'required',
|
||||
'jenis_jaminan_id' => 'required',
|
||||
'pendamping' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
|
||||
'pendamping' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
|
||||
'foto_objek.*' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
|
||||
'name_objek.*' => 'required|string|max:255',
|
||||
'foto_lingkungan.*' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
|
||||
@@ -399,7 +401,7 @@ private function deleteOfFile($filePath)
|
||||
}
|
||||
|
||||
public function submitSurveyor($id)
|
||||
{
|
||||
{
|
||||
try {
|
||||
// Get button status check result
|
||||
$buttonStatusCheck = $this->checkButtonStatus($id);
|
||||
@@ -432,7 +434,7 @@ private function deleteOfFile($filePath)
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -548,41 +550,141 @@ private function deleteOfFile($filePath)
|
||||
}
|
||||
|
||||
|
||||
public function storeDataPembanding(Request $request)
|
||||
private function formatDataPembanding($request)
|
||||
{
|
||||
$data = $request->all();
|
||||
if (!$data) {
|
||||
return response()->json(['success' => false, 'message' => 'Invalid data'], 400);
|
||||
$dataPembanding = [];
|
||||
$pembandingCount = count($request->input('alamat_pembanding', []));
|
||||
|
||||
for ($i = 0; $i < $pembandingCount; $i++) {
|
||||
$pembanding = $this->formatSinglePembanding($request, $i);
|
||||
|
||||
// Perbaikan penanganan foto pembanding
|
||||
$fotoKey = "foto_objek_pembanding_{$i}"; // Sesuaikan dengan nama field di form
|
||||
if ($request->hasFile($fotoKey)) {
|
||||
$pembanding['foto_objek'] = $this->handleFileUpload(
|
||||
$request->file($fotoKey),
|
||||
'pembanding',
|
||||
"pembanding_{$i}"
|
||||
);
|
||||
}
|
||||
|
||||
$dataPembanding[] = $pembanding;
|
||||
}
|
||||
|
||||
return $dataPembanding;
|
||||
}
|
||||
|
||||
private function handleFileUpload($file, $folder, $prefix)
|
||||
{
|
||||
if (!$file) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
// Buat nama file yang unik
|
||||
$extension = $file->getClientOriginalExtension();
|
||||
$fileName = $prefix . '_' . time() . '_' . uniqid() . '.' . $extension;
|
||||
|
||||
// Pastikan folder exists
|
||||
$path = storage_path("app/public/{$folder}");
|
||||
if (!File::exists($path)) {
|
||||
File::makeDirectory($path, 0777, true);
|
||||
}
|
||||
|
||||
// Simpan file
|
||||
$file->storeAs("public/{$folder}", $fileName);
|
||||
|
||||
// Log untuk debugging
|
||||
\Log::info("File berhasil disimpan: {$folder}/{$fileName}");
|
||||
|
||||
return $fileName;
|
||||
} catch (\Exception $e) {
|
||||
\Log::error("Error saat upload file: " . $e->getMessage());
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
private function formatSinglePembanding($request, $index)
|
||||
{
|
||||
$fields = [
|
||||
'alamat', 'desa', 'kecamatan', 'kabupaten', 'provinsi',
|
||||
'tahun', 'luas_tanah', 'luas_bangunan', 'tahun_bangunan',
|
||||
'status_nara_sumber', 'harga', 'nama_nara_sumber',
|
||||
'peruntukan', 'penawaran_transaksi', 'nomor_tlp',
|
||||
'kordinat_lat', 'kordinat_lng', 'jenis_aset',
|
||||
];
|
||||
|
||||
$pembanding = [];
|
||||
foreach ($fields as $field) {
|
||||
$inputName = "{$field}_pembanding";
|
||||
$pembanding[$field] = $request->input($inputName)[$index] ?? null;
|
||||
}
|
||||
|
||||
// Inisialisasi foto_objek sebagai null
|
||||
$pembanding['foto_objek'] = null;
|
||||
|
||||
return $pembanding;
|
||||
}
|
||||
|
||||
public function storeDataPembanding(Request $request)
|
||||
{
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
|
||||
// $action = $request->input('type');
|
||||
// $rules = $this->getActionSpecificRules($data, $action, $request);
|
||||
|
||||
$inspeksi = Inspeksi::where('permohonan_id', $request->input('permohonan_id'))->where('jenis_jaminan_id', $request->input('jenis_jaminan_id'))->first();
|
||||
|
||||
if (!$inspeksi) {
|
||||
Inspeksi::create([
|
||||
'permohonan_id' => $request->input('permohonan_id'),
|
||||
'data_pembanding' => json_encode($data),
|
||||
'name' => $request->input('type'),
|
||||
'jenis_jaminan_id' => $request->input('jenis_jaminan_id'),
|
||||
$validator = $request->validate([
|
||||
'permohonan_id' => 'required|exists:permohonan,id',
|
||||
'type' => 'required|string',
|
||||
'jenis_jaminan_id' => 'required',
|
||||
'foto_objek' => 'nullable|image|max:2048',
|
||||
'foto_objek_pembanding_*' => 'nullable|image|max:2048',
|
||||
]);
|
||||
} else {
|
||||
$inspeksi->update(['data_pembanding' => json_encode($data)]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Validasi gagal',
|
||||
'errors' => $validator->errors()
|
||||
], 422);
|
||||
}
|
||||
|
||||
$objekPenilaian = $this->formatObjekPenilaian($request);
|
||||
if ($request->hasFile('foto_objek')) {
|
||||
$objekPenilaian['foto_objek'] = $this->handleFileUpload(
|
||||
$request->file('foto_objek'),
|
||||
'pembanding',
|
||||
'objek_penilaian'
|
||||
);
|
||||
}
|
||||
|
||||
$formattedData = [
|
||||
'permohonan_id' => $request->input('permohonan_id'),
|
||||
'type' => $request->input('type'),
|
||||
'jenis_jaminan_id' => $request->input('jenis_jaminan_id'),
|
||||
'objek_penilaian' => $objekPenilaian,
|
||||
'data_pembanding' => $this->formatDataPembanding($request)
|
||||
];
|
||||
|
||||
$inspeksi = $this->saveInspeksi($formattedData);
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json(['success' => true, 'message' => 'Data saved successfully', 'data' => json_encode($data)], 200);
|
||||
} catch (Exception $e) {
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => 'Data berhasil disimpan',
|
||||
'data' => $formattedData
|
||||
], 200);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
return response()->json(['success' => false, 'message' => 'Failed to save data: ' . $e->getMessage()], 500);
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Gagal menyimpan data: ' . $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Form inspeksi.
|
||||
*/
|
||||
@@ -737,8 +839,9 @@ private function deleteOfFile($filePath)
|
||||
|
||||
public function dataPembanding($id, $jaminanId)
|
||||
{
|
||||
$permohonan = Permohonan::with(
|
||||
[
|
||||
try {
|
||||
// Ambil data permohonan dengan eager loading
|
||||
$permohonan = Permohonan::with([
|
||||
'user',
|
||||
'debiture.province',
|
||||
'debiture.city',
|
||||
@@ -747,28 +850,65 @@ private function deleteOfFile($filePath)
|
||||
'branch',
|
||||
'tujuanPenilaian',
|
||||
'penilaian'
|
||||
],
|
||||
)->findOrFail($id);
|
||||
$surveyor = $id;
|
||||
])->findOrFail($id);
|
||||
|
||||
// Ambil data inspeksi
|
||||
$inspeksi = Inspeksi::where([
|
||||
'permohonan_id' => $id,
|
||||
'jenis_jaminan_id' => $jaminanId
|
||||
])->first();
|
||||
|
||||
// Inisialisasi variabel
|
||||
$inspectionData = null;
|
||||
$comparisons = null;
|
||||
$fotoForm = null;
|
||||
|
||||
|
||||
if ($inspeksi) {
|
||||
|
||||
$inspectionData = json_decode($inspeksi->data_form, true);
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
throw new \Exception('Error decoding inspection data: ' . json_last_error_msg());
|
||||
}
|
||||
|
||||
if ($inspeksi->data_pembanding) {
|
||||
$comparisons = json_decode($inspeksi->data_pembanding, true);
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
throw new \Exception('Error decoding comparison data: ' . json_last_error_msg());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
$fotoForm = json_decode($inspeksi->foto_form, true);
|
||||
|
||||
}
|
||||
|
||||
// Ambil data pendukung
|
||||
$data = $this->getCommonData();
|
||||
$branches = Branch::all();
|
||||
$provinces = Province::all();
|
||||
|
||||
$data = $this->getCommonData();
|
||||
return view('lpj::surveyor.components.data-pembanding', compact(
|
||||
'permohonan',
|
||||
'id',
|
||||
'branches',
|
||||
'provinces',
|
||||
'inspectionData',
|
||||
'comparisons',
|
||||
'data',
|
||||
'jaminanId',
|
||||
'fotoForm'
|
||||
));
|
||||
|
||||
$inpeksi = Inspeksi::where('permohonan_id', $id)->where('jenis_jaminan_id', $jaminanId)->first();
|
||||
$forminspeksi = null;
|
||||
if ($inpeksi) {
|
||||
$forminspeksi = $inpeksi;
|
||||
// $forminspeksi = json_decode($inpeksi->data_form, true);
|
||||
} catch (\Exception $e) {
|
||||
return redirect()
|
||||
->back()
|
||||
->with('error', 'Terjadi kesalahan saat memuat data: ' . $e->getMessage());
|
||||
}
|
||||
|
||||
// return response()->json($forminspeksi);
|
||||
return view('lpj::surveyor.components.data-pembanding', compact('permohonan', 'surveyor', 'branches', 'provinces', 'forminspeksi', 'data'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private function getHeader(string $type): array
|
||||
{
|
||||
return self::HEADERS[$type] ?? [];
|
||||
@@ -1407,23 +1547,23 @@ private function deleteOfFile($filePath)
|
||||
$data = $request->all();
|
||||
$result = [];
|
||||
|
||||
foreach ($data['nama_bagunan'] as $index => $bangunan) {
|
||||
$bangunanData = [
|
||||
'bangunan' => $bangunan,
|
||||
'kategori' => []
|
||||
];
|
||||
// foreach ($data['nama_bangunan'] as $index => $bangunan) {
|
||||
// $bangunanData = [
|
||||
// 'bangunan' => $bangunan,
|
||||
// 'kategori' => []
|
||||
// ];
|
||||
|
||||
foreach ($data['spek_kategori_bangunan'] as $kategoriIndex => $kategori) {
|
||||
if (isset($data['spek_bangunan'][$kategori])) {
|
||||
$bangunanData['kategori'][] = [
|
||||
'kategori' => $kategori,
|
||||
'spesifikasi' => $data['spek_bangunan'][$kategori]
|
||||
];
|
||||
}
|
||||
}
|
||||
// foreach ($data['spek_kategori_bangunan'] as $kategoriIndex => $kategori) {
|
||||
// if (isset($data['spek_bangunan'][$kategori])) {
|
||||
// $bangunanData['kategori'][] = [
|
||||
// 'kategori' => $kategori,
|
||||
// 'spesifikasi' => $data['spek_bangunan'][$kategori]
|
||||
// ];
|
||||
// }
|
||||
// }
|
||||
|
||||
$result[] = $bangunanData;
|
||||
}
|
||||
// $result[] = $bangunanData;
|
||||
// }
|
||||
|
||||
return [
|
||||
'bangunan' => [
|
||||
@@ -1459,7 +1599,10 @@ private function deleteOfFile($filePath)
|
||||
'gol_mas_sekitar' => $data['gol_mas_sekitar'] ?? null,
|
||||
'tingkat_keramaian' => $data['tingkat_keramaian'] ?? null,
|
||||
'terletak_diarea' => $data['terletak_diarea'] ?? null,
|
||||
'disekitar_lokasi' => $data['disekitar_lokasi'] ?? null,
|
||||
'disekitar_lokasi' => $data['disekitar_lokasi'] === 'yes' ? [
|
||||
'kondisi' => $data['kondisi_bagunan_disekitar_lokasi'] ?? null,
|
||||
'sifat' => $data['sifat_bagunan_disekitar_lokasi'] ?? null,
|
||||
] : $data['disekitar_lokasi'],
|
||||
'kondisi_bangunan_sekitar' => $data['kondisi_bangunan_sekitar'] ?? null,
|
||||
'sifat_bangunan_sekitar' => $data['sifat_bangunan_sekitar'] ?? null,
|
||||
'dekat_makam' => $data['dekat_makam'] ?? null,
|
||||
@@ -1917,7 +2060,6 @@ private function deleteOfFile($filePath)
|
||||
'luas_unit',
|
||||
true
|
||||
),
|
||||
'jenis_unit' => $data['jenis_unit'] ?? null,
|
||||
'kondisi_unit' => $data['kondisi_unit'] ?? null,
|
||||
'posisi_unit' => $data['posisi_unit'] ?? null,
|
||||
'lantai' => $data['lantai'] ?? null,
|
||||
|
||||
@@ -104,7 +104,7 @@ class FormSurveyorRequest extends FormRequest
|
||||
'kondisi_bangunan' => 'nullable',
|
||||
'sifat_bangunan' => 'required|array',
|
||||
'sifat_bangunan_input' => 'nullable|array',
|
||||
'nama_bagunan' => 'required',
|
||||
'nama_bagunan' => 'required|nullable',
|
||||
'spek_kategori_bangunan.*' => 'required',
|
||||
'spek_bangunan.*' => 'required',
|
||||
'sarana_pelengkap' => 'required',
|
||||
@@ -122,7 +122,6 @@ class FormSurveyorRequest extends FormRequest
|
||||
'luas_unit' => 'required',
|
||||
'luas_unit_sesuai' => 'nullable',
|
||||
'luas_unit_tidak_sesuai' => 'nullable',
|
||||
'jenis_unit' => 'required|array',
|
||||
'kondisi_unit' => 'required|array',
|
||||
'posisi_unit' => 'required|array',
|
||||
'lantai' => 'required|array',
|
||||
@@ -150,8 +149,8 @@ class FormSurveyorRequest extends FormRequest
|
||||
'tingkat_keramaian' => 'nullable',
|
||||
'terletak_diarea' => 'nullable',
|
||||
'disekitar_lokasi' => 'nullable',
|
||||
'kondisi_bangunan_sekitar' => 'nullable',
|
||||
'sifat_bangunan_sekitar' => 'nullable',
|
||||
'kondisi_bagunan_disekitar_lokasi' => 'nullable',
|
||||
'sifat_bagunan_disekitar_lokasi' => 'nullable',
|
||||
'dekat_makam' => 'nullable',
|
||||
'jarak_makam' => 'nullable',
|
||||
'nama_makam' => 'nullable',
|
||||
|
||||
@@ -14,7 +14,7 @@ class Inspeksi extends Model
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = ['data_form', 'foto_form', 'denah_form','permohonan_id', 'name', 'status', 'authorized_status', 'authorized_at', 'authorized_by', 'created_by', 'updated_by', 'deleted_by','jenis_jaminan_id'];
|
||||
protected $fillable = ['data_form', 'foto_form', 'denah_form','permohonan_id', 'name', 'status', 'authorized_status', 'authorized_at', 'authorized_by', 'created_by', 'updated_by', 'deleted_by','jenis_jaminan_id','data_pembanding'];
|
||||
|
||||
public function permohonan()
|
||||
{
|
||||
|
||||
@@ -23,4 +23,8 @@ class Regions extends Model
|
||||
public function teams(){
|
||||
return $this->hasMany(Teams::class, 'regions_id', 'id');
|
||||
}
|
||||
|
||||
public function penilaiTeam(){
|
||||
return $this->hasMany(PenilaianTeam::class, 'team_id', 'id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,13 +51,12 @@
|
||||
@php
|
||||
|
||||
$sortedTeamsActivity = $teamsActivity->sortBy(function ($item) {
|
||||
return $item->team->penilaianTeam
|
||||
->filter(function ($penilaianTeam) use ($item) {
|
||||
return $penilaianTeam->user_id == $item->user->id;
|
||||
return $item->team->regions->penilaiTeam
|
||||
->filter(function ($penilaiTeam) use ($item) {
|
||||
return $penilaiTeam->user_id == $item->user->id;
|
||||
})
|
||||
->count();
|
||||
});
|
||||
|
||||
@endphp
|
||||
|
||||
@foreach ($sortedTeamsActivity as $index => $item)
|
||||
@@ -75,9 +74,9 @@
|
||||
<th class="min-w-[150px]">
|
||||
<span class="text-base text-gray-900 font-normal">
|
||||
@php
|
||||
$totalTasks = $item->team->penilaianTeam
|
||||
->filter(function ($penilaianTeam) use ($item) {
|
||||
return $penilaianTeam->user_id == $item->user->id;
|
||||
$totalTasks = $item->team->regions->penilaiTeam
|
||||
->filter(function ($penilaiTeam) use ($item) {
|
||||
return $penilaiTeam->user_id == $item->user->id;
|
||||
})
|
||||
->count();
|
||||
@endphp
|
||||
@@ -208,7 +207,7 @@
|
||||
tanggal_kunjungan: {
|
||||
title: 'Tgl Kunjungan',
|
||||
render: (item, data) =>
|
||||
`${formatDateFromISO(data.tanggal_kunjungan) || ''}`,
|
||||
`${formatDateFromISO(data.waktu_penilaian) || ''}`,
|
||||
},
|
||||
progress: {
|
||||
title: 'Progress',
|
||||
@@ -222,6 +221,7 @@
|
||||
return `${mulai.getDate()}-${mulai.getMonth() + 1}-${mulai.getFullYear()} - ${selesai.getDate()}-${selesai.getMonth() + 1}-${selesai.getFullYear()}`
|
||||
},
|
||||
},
|
||||
|
||||
paparan: {
|
||||
title: 'Paparan',
|
||||
render: (item, data) => `${data.paparan || ''}`,
|
||||
|
||||
@@ -26,24 +26,29 @@
|
||||
<input type="radio"
|
||||
onclick="toggleFieldVisibility('luas_tanah_bagunan', 'luas_tanah_bagunan_tidak_sesuai', ['tidak sesuai'])"
|
||||
class="radio" name="luas_tanah_bagunan" value="sesuai"
|
||||
{{ old('luas_tanah_bagunan', $forminspeksi['bangunan']['luas_tanah_bagunan'] ?? '') == 'sesuai' ? 'checked' : '' }}>
|
||||
{{ old('luas_tanah_bagunan', isset($forminspeksi['bangunan']['luas_tanah_bagunan']['sesuai'])) ? 'checked' : '' }}>
|
||||
<span class="ml-2">Sesuai</span>
|
||||
</label>
|
||||
<label class="form-label flex items-center gap-2.5 text-nowrap">
|
||||
<input type="radio" class="radio" name="luas_tanah_bagunan"
|
||||
onclick="toggleFieldVisibility('luas_tanah_bagunan', 'luas_tanah_bagunan_tidak_sesuai', ['tidak sesuai'])"
|
||||
value="tidak sesuai"
|
||||
{{ old('luas_tanah_bagunan', $forminspeksi['bangunan']['luas_tanah_bagunan'] ?? '') == 'tidak sesuai' ? 'checked' : '' }}>
|
||||
{{ old('luas_tanah_bagunan', isset($forminspeksi['bangunan']['luas_tanah_bagunan']['tidak sesuai'])) ? 'checked' : '' }}>
|
||||
<span class="ml-2">Tidak Sesuai</span>
|
||||
</label>
|
||||
|
||||
<div id="luas_tanah_bagunan_tidak_sesuai" class="flex items-baseline gap-2"
|
||||
style="{{ old('luas_tanah_bagunan_bagunan', $forminspeksi['bangunan']['luas_tanah_bagunan_bagunan'] ?? '') == 'tidak sesuai' ? '' : 'display: none;' }}">
|
||||
<input type="text"id="analisa_bangunan_tidak_sesuai" name="luas_tanah_bagunan_tidak_sesuai" class="input w-full"
|
||||
style="{{ isset($forminspeksi['bangunan']['luas_tanah_bagunan']['tidak_sesuai']) ? '' : 'display: none;' }}">
|
||||
<input type="text" id="analisa_bangunan_tidak_sesuai"
|
||||
name="luas_tanah_bagunan_tidak_sesuai" class="input w-full"
|
||||
placeholder="Masukan Luas Bangunan Tidak Sesuai..."
|
||||
value="{{ old('luas_tanah_bagunan_tidak_sesuai', $forminspeksi['bangunan']['luas_tanah_bagunan_tidak_sesuai'] ?? '') }}">
|
||||
<button type="button" class="btn btn-md btn-primary" onclick="updateAnalisa('analisa_bangunan')">Save</button>
|
||||
value="{{ old('luas_tanah_bagunan_tidak_sesuai', $forminspeksi['bangunan']['luas_tanah_bagunan']['tidak_sesuai'] ?? '') }}">
|
||||
<button type="button" class="btn btn-md btn-primary"
|
||||
onclick="updateAnalisa('analisa_bangunan')">
|
||||
Save
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<em id="error-luas_tanah_bagunan" class="alert text-danger text-sm"></em>
|
||||
</div>
|
||||
@@ -62,8 +67,7 @@
|
||||
<input class="checkbox" name="jenis_bangunan[]" type="checkbox"
|
||||
value="{{ $item->name }}"
|
||||
{{ old('jenis_bangunan') == $item->name || isset($forminspeksi['bangunan']['jenis_bangunan']) == $item->name ? 'checked' : '' }}
|
||||
onclick="toggleCheckboxVisibility('jenis_bangunan', 'jenis_bangunan_lainnya', ['lainnya'])"
|
||||
/>
|
||||
onclick="toggleCheckboxVisibility('jenis_bangunan', 'jenis_bangunan_lainnya', ['lainnya'])" />
|
||||
{{ $item->name }}
|
||||
</label>
|
||||
@if (strcasecmp($item->name, 'Lainnya') == 0)
|
||||
@@ -196,16 +200,28 @@
|
||||
<div class="flex flex-col items-start gap-4">
|
||||
@if (isset($saranaPelengkap))
|
||||
@foreach ($saranaPelengkap as $item)
|
||||
@php
|
||||
$isChecked = false;
|
||||
$inputValue = '';
|
||||
|
||||
if (isset($forminspeksi['bangunan']['sarana_pelengkap'])) {
|
||||
foreach ($forminspeksi['bangunan']['sarana_pelengkap'] as $key => $value) {
|
||||
if ($key === $item->name) {
|
||||
$isChecked = true;
|
||||
$inputValue = $value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56 gap-2.5" style="width: 500px">
|
||||
<input class="checkbox" name="sarana_pelengkap[]" type="checkbox"
|
||||
value="{{ $item->name }}"
|
||||
{{ in_array($item->name, old('sarana_pelengkap', $forminspeksi['bangunan']['sarana_pelengkap'] ?? [])) ? 'checked' : '' }} />
|
||||
value="{{ $item->name }}" {{ $isChecked ? 'checked' : '' }} />
|
||||
{{ $item->name }}
|
||||
</label>
|
||||
<input type="text" name="sarana_pelengkap_input[]" class="input w-full"
|
||||
id="bentukTanahInput" placeholder="Masukkan {{ $item->name }}..."
|
||||
value="{{ old('sarana_pelengkap_input.' . $loop->index, $forminspeksi['bangunan']['sarana_pelengkap_input'][$loop->index] ?? '') }}">
|
||||
placeholder="Masukkan {{ $item->name }}..." value="{{ $inputValue }}">
|
||||
</div>
|
||||
@endforeach
|
||||
@endif
|
||||
@@ -213,6 +229,7 @@
|
||||
<em id="error-sarana_pelengkap" class="alert text-danger text-sm"></em>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -57,7 +57,14 @@
|
||||
<div class="card-group flex items-center flex-wrap sm:flex-nowrap justify-between py-4 gap-2.5">
|
||||
<div class="flex items-center gap-3.5">
|
||||
<div class="relative size-[50px] shrink-0">
|
||||
<!-- SVG code remains the same -->
|
||||
<svg class="w-full h-full stroke-brand-clarity fill-light" fill="none" height="48"
|
||||
viewBox="0 0 44 48" width="44" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M16 2.4641C19.7128 0.320509 24.2872 0.320508 28 2.4641L37.6506 8.0359C41.3634 10.1795 43.6506 14.141 43.6506 18.4282V29.5718C43.6506 33.859 41.3634 37.8205 37.6506 39.9641L28 45.5359C24.2872 47.6795 19.7128 47.6795 16 45.5359L6.34937 39.9641C2.63655 37.8205 0.349365 33.859 0.349365 29.5718V18.4282C0.349365 14.141 2.63655 10.1795 6.34937 8.0359L16 2.4641Z" fill=""></path>
|
||||
<path d="M16.25 2.89711C19.8081 0.842838 24.1919 0.842837 27.75 2.89711L37.4006 8.46891C40.9587 10.5232 43.1506 14.3196 43.1506 18.4282V29.5718C43.1506 33.6804 40.9587 37.4768 37.4006 39.5311L27.75 45.1029C24.1919 47.1572 19.8081 47.1572 16.25 45.1029L6.59937 39.5311C3.04125 37.4768 0.849365 33.6803 0.849365 29.5718V18.4282C0.849365 14.3196 3.04125 10.5232 6.59937 8.46891L16.25 2.89711Z" stroke=""></path>
|
||||
</svg>
|
||||
<div class="absolute leading-none left-2/4 top-2/4 -translate-y-2/4 -translate-x-2/4">
|
||||
<i class="ki-filled ki-additem text-2xl text-brand"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center gap-2.5">
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,7 @@
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
@include('lpj::assetsku.includenya')
|
||||
@include('lpj::assetsku.includenya')
|
||||
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
||||
<div class="card min-w-full">
|
||||
<div class="card min-w-full">
|
||||
@@ -142,7 +142,8 @@
|
||||
<div class="w-full grid gap-5">
|
||||
<img id="foto_denah-preview"
|
||||
src="{{ isset($formDenah['foto_denah']) ? asset('storage/' . old('foto_denah', $formDenah['foto_denah'])) : '' }}"
|
||||
alt="Gambar foto_denah" style="{{ isset($formDenah['foto_denah']) ? 'width: 30rem;' : 'display: none;' }}">
|
||||
alt="Gambar foto_denah"
|
||||
style="{{ isset($formDenah['foto_denah']) ? 'width: 30rem;' : 'display: none;' }}">
|
||||
|
||||
|
||||
|
||||
@@ -150,9 +151,7 @@
|
||||
<input type="file"
|
||||
value="{{ old('foto_denah', isset($formDenah['foto_denah']) ? $formDenah['foto_denah'] : '') }}"
|
||||
name="foto_denah" class="file-input file-input-bordered w-full "
|
||||
accept="image/*"
|
||||
onchange="previewImage(this, 'foto_denah-preview')"
|
||||
>
|
||||
accept="image/*" onchange="previewImage(this, 'foto_denah-preview')">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -185,16 +184,19 @@
|
||||
<div class="flex justify-end gap-2" style="margin-right: 20px; margin-top: 20px">
|
||||
<button type="button" class="btn btn-success" id="saveButton" onclick="submitDenah()">
|
||||
<span id="saveButtonText">Save</span>
|
||||
<div class="spinner-border spinner-border-sm text-light" role="status" style="display: none;"
|
||||
id="saveButtonSpinner">
|
||||
<span class="visually-hidden">Loading...</span>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="loadingOverlay" class="fixed inset-0 bg-black bg-opacity-50 hidden items-center justify-center z-50">
|
||||
<div class="bg-white p-4 rounded-lg">
|
||||
<div class="loader"></div>
|
||||
<p class="mt-2 text-center">Sedang memproses...</p>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
|
||||
@@ -213,15 +215,13 @@
|
||||
}
|
||||
|
||||
function submitDenah() {
|
||||
const loadingOverlay = document.getElementById('loadingOverlay');
|
||||
loadingOverlay.classList.remove('hidden');
|
||||
loadingOverlay.classList.add('flex');
|
||||
|
||||
const formElement = $('#formDenah')[0];
|
||||
const formData = new FormData(formElement);
|
||||
|
||||
// Disable the button and show the spinner
|
||||
$('#saveButton').prop('disabled', true);
|
||||
$('#saveButtonText').hide();
|
||||
$('#saveButtonSpinner').show();
|
||||
|
||||
$.ajax({
|
||||
url: '{{ route('surveyor.storeDenah') }}',
|
||||
type: 'POST',
|
||||
@@ -233,9 +233,24 @@
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
Swal.fire({
|
||||
title: 'Berhasil!',
|
||||
text: response.message,
|
||||
icon: 'success',
|
||||
confirmButtonText: 'OK'
|
||||
}).then((response) => {
|
||||
if (response.isConfirmed) {
|
||||
window.location.href =
|
||||
'{{ route('surveyor.show', ['id' => $permohonan->id]) }}?form=denah';
|
||||
toastrSuccessBuild(response.message);
|
||||
'{{ route('surveyor.show', ['id' => $permohonan->id]) }}';
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: 'Error!',
|
||||
text: response.message || 'Terjadi kesalahan',
|
||||
icon: 'error',
|
||||
confirmButtonText: 'OK'
|
||||
});
|
||||
}
|
||||
console.log(response);
|
||||
},
|
||||
@@ -255,13 +270,32 @@
|
||||
|
||||
},
|
||||
complete: function() {
|
||||
// Re-enable the button and hide the spinner
|
||||
$('#saveButton').prop('disabled', false);
|
||||
$('#saveButtonText').show();
|
||||
$('#saveButtonSpinner').hide();
|
||||
loadingOverlay.classList.add('hidden');
|
||||
loadingOverlay.classList.remove('flex');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
<style>
|
||||
.loader {
|
||||
border: 4px solid #f3f3f3;
|
||||
border-radius: 50%;
|
||||
border-top: 4px solid #3498db;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
animation: spin 1s linear infinite;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -76,19 +76,32 @@
|
||||
<label class="form-label max-w-56">Batas batas</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<div class="grid grid-cols-1 gap-4 items-center w-full">
|
||||
|
||||
@if (isset($arahMataAngin))
|
||||
@foreach ($arahMataAngin as $item)
|
||||
@php
|
||||
$isChecked = false;
|
||||
$inputValue = '';
|
||||
|
||||
if (isset($forminspeksi['fakta']['batas_batas'])) {
|
||||
foreach ($forminspeksi['fakta']['batas_batas'] as $key => $value) {
|
||||
if ($key === $item->name) {
|
||||
$isChecked = true;
|
||||
$inputValue = $value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56 gap-2.5" style="width: 500px">
|
||||
<input class="checkbox" name="batas_batas[]" type="checkbox"
|
||||
value="{{ $item->name }}"
|
||||
{{ in_array($item->name, old('batas_batas', $forminspeksi['fakta']['batas_batas'] ?? [])) ? 'checked' : '' }} />
|
||||
{{ $isChecked ? 'checked' : '' }} />
|
||||
{{ $item->name }}
|
||||
</label>
|
||||
<input type="text" name="batas_batas_input[]" class="input w-full"
|
||||
id="bentukTanahInput" placeholder="Masukkan Batas {{ $item->name }}..."
|
||||
value="{{ old('batas_batas_input.' . $loop->index, $forminspeksi['fakta']['batas_batas_input'][$loop->index] ?? '') }}">
|
||||
placeholder="Masukkan Batas {{ $item->name }}..."
|
||||
value="{{ $inputValue }}">
|
||||
</div>
|
||||
@endforeach
|
||||
@endif
|
||||
@@ -98,6 +111,7 @@
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">Kondisi lain terkait lingkungan</label>
|
||||
<div class="flex flex-wrap items-baseline w-full" id="kondisi-lingkungan-container">
|
||||
|
||||
@@ -585,8 +585,12 @@
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
</div>
|
||||
<div id="loadingOverlay" class="fixed inset-0 bg-black bg-opacity-50 hidden items-center justify-center z-50">
|
||||
<div class="bg-white p-4 rounded-lg">
|
||||
<div class="loader"></div>
|
||||
<p class="mt-2 text-center">Sedang memproses...</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal Kamera -->
|
||||
@@ -598,17 +602,16 @@
|
||||
@push('scripts')
|
||||
<script>
|
||||
function submitFoto() {
|
||||
const loadingOverlay = document.getElementById('loadingOverlay');
|
||||
loadingOverlay.classList.remove('hidden');
|
||||
loadingOverlay.classList.add('flex');
|
||||
|
||||
const formElement = $('#formFoto')[0];
|
||||
const formData = new FormData(formElement);
|
||||
// for (const [key, value] of formData.entries()) {
|
||||
// console.log(`Key: ${key}, Value: ${value}`);
|
||||
// }
|
||||
|
||||
// Disable the button and show the spinner
|
||||
$('#saveButtonFoto').prop('disabled', true);
|
||||
$('#saveButtonFotoText').hide();
|
||||
$('#saveButtonSpinner').show();
|
||||
|
||||
$.ajax({
|
||||
url: '{{ route('surveyor.storeFoto') }}',
|
||||
type: 'POST',
|
||||
@@ -621,9 +624,24 @@
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
// window.location.href =
|
||||
// '{{ route('surveyor.show', ['id' => $permohonan->id]) }}?form=foto';
|
||||
toastrSuccessBuild(response.message);
|
||||
Swal.fire({
|
||||
title: 'Berhasil!',
|
||||
text: response.message,
|
||||
icon: 'success',
|
||||
confirmButtonText: 'OK'
|
||||
}).then((response) => {
|
||||
if (response.isConfirmed) {
|
||||
window.location.href =
|
||||
'{{ route('surveyor.show', ['id' => $permohonan->id]) }}';
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: 'Error!',
|
||||
text: response.message || 'Terjadi kesalahan',
|
||||
icon: 'error',
|
||||
confirmButtonText: 'OK'
|
||||
});
|
||||
}
|
||||
console.log(response);
|
||||
|
||||
@@ -645,9 +663,8 @@
|
||||
},
|
||||
complete: function() {
|
||||
// Re-enable the button and hide the spinner
|
||||
$('#saveButtonFoto').prop('disabled', false);
|
||||
$('#saveButtonFotoText').show();
|
||||
$('#saveButtonSpinner').hide();
|
||||
loadingOverlay.classList.add('hidden');
|
||||
loadingOverlay.classList.remove('flex');
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -655,6 +672,28 @@
|
||||
@include('lpj::surveyor.js.camera-editor')
|
||||
@endpush
|
||||
|
||||
<style>
|
||||
.loader {
|
||||
border: 4px solid #f3f3f3;
|
||||
border-radius: 50%;
|
||||
border-top: 4px solid #3498db;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
animation: spin 1s linear infinite;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -37,12 +37,20 @@
|
||||
<span id="saveButtonText">Save</span>
|
||||
<div class="spinner-border spinner-border-sm text-light" role="status" style="display: none;"
|
||||
id="saveButtonSpinner">
|
||||
<span class="visually-hidden">Loading...</span>
|
||||
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Loading Overlay -->
|
||||
<div id="loadingOverlay" class="fixed inset-0 bg-black bg-opacity-50 hidden items-center justify-center z-50">
|
||||
<div class="bg-white p-4 rounded-lg">
|
||||
<div class="loader"></div>
|
||||
<p class="mt-2 text-center">Sedang memproses...</p>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@push('scripts')
|
||||
<script type="text/javascript">
|
||||
@@ -118,14 +126,14 @@
|
||||
|
||||
|
||||
function submitData() {
|
||||
|
||||
const loadingOverlay = document.getElementById('loadingOverlay');
|
||||
loadingOverlay.classList.remove('hidden');
|
||||
loadingOverlay.classList.add('flex');
|
||||
|
||||
const formElement = $('#formInspeksi')[0];
|
||||
const formData = new FormData(formElement);
|
||||
|
||||
// Disable the button and show the spinner
|
||||
$('#saveButton').prop('disabled', true);
|
||||
$('#saveButtonText').hide();
|
||||
$('#saveButtonSpinner').show();
|
||||
|
||||
$.ajax({
|
||||
url: '{{ route('surveyor.store') }}',
|
||||
type: 'POST',
|
||||
@@ -136,12 +144,26 @@
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
},
|
||||
success: function(response) {
|
||||
// if (response.success) {
|
||||
// toastrSuccessBuild(response.message)
|
||||
// window.location.href =
|
||||
// '{{ route('surveyor.show', ['id' => $permohonan->id]) }}?form=inspeksi';
|
||||
// }
|
||||
|
||||
if (response.success) {
|
||||
Swal.fire({
|
||||
title: 'Berhasil!',
|
||||
text: response.message,
|
||||
icon: 'success',
|
||||
confirmButtonText: 'OK'
|
||||
}).then((response) => {
|
||||
if (response.isConfirmed) {
|
||||
window.location.href =
|
||||
'{{ route('surveyor.show', ['id' => $permohonan->id]) }}';
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: 'Error!',
|
||||
text: response.message || 'Terjadi kesalahan',
|
||||
icon: 'error',
|
||||
confirmButtonText: 'OK'
|
||||
});
|
||||
}
|
||||
console.log(response);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
@@ -160,9 +182,8 @@
|
||||
},
|
||||
complete: function() {
|
||||
// Re-enable the button and hide the spinner
|
||||
$('#saveButton').prop('disabled', false);
|
||||
$('#saveButtonText').show();
|
||||
$('#saveButtonSpinner').hide();
|
||||
loadingOverlay.classList.add('hidden');
|
||||
loadingOverlay.classList.remove('flex');
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -239,10 +260,9 @@
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
if (response.success) {
|
||||
if (response.jenis_asset) {
|
||||
window.location.href =
|
||||
'{{ route('surveyor.show', ['id' => $permohonan->id]) }}?form=inspeksi';
|
||||
}
|
||||
'{{ route('surveyor.show', ['id' => $permohonan->id]) }}';
|
||||
|
||||
toastrSuccessBuild(response.message);
|
||||
}
|
||||
},
|
||||
@@ -260,3 +280,34 @@
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
<style>
|
||||
.loader {
|
||||
border: 4px solid #f3f3f3;
|
||||
border-radius: 50%;
|
||||
border-top: 4px solid #3498db;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
animation: spin 1s linear infinite;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.scrollable-x-auto {
|
||||
overflow-x: auto;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.table {
|
||||
min-width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -169,25 +169,38 @@
|
||||
<span class="ml-2">Telah ada bangunan</span>
|
||||
</label>
|
||||
<div class="flex w-full items-center gap-4">
|
||||
|
||||
<div id="disekitar_lokasi_sesuai" class="grid grid-cols-2 gap-4 mt-5 mb-5"
|
||||
style="display: none;">
|
||||
style="{{ old('disekitar_lokasi', $forminspeksi['lingkungan']['disekitar_lokasi'] ?? '') == 'ya' ? '' : 'display: none;' }}">
|
||||
<div class="flex items-center gap-2">
|
||||
<label for="" class="text-sm text-gray-700">Kondisi bangunan</label>
|
||||
|
||||
@php
|
||||
$kondisi = ['Cukup', 'Baik', 'Kurang'];
|
||||
@endphp
|
||||
|
||||
<select class="select" name="kondisi_bagunan_disekitar_lokasi" id="">
|
||||
<option value="">pilih kondisi</option>
|
||||
<option value="Cukup">Cukup</option>
|
||||
<option value="Baik">Baik</option>
|
||||
<option value="Kurang">Kurang</option>
|
||||
@foreach ($kondisi as $item)
|
||||
<option value="{{ $item }}"
|
||||
{{ old('kondisi_bagunan_disekitar_lokasi', $forminspeksi['lingkungan']['disekitar_lokasi'] ?? '') == $item ? 'selected' : '' }}>
|
||||
{{ $item }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<label for="" class="text-sm text-gray-700">Sifat bangunan</label>
|
||||
@php
|
||||
$sifat = ['Permanen', 'Semi Permanen', 'Tidak Permanen'];
|
||||
@endphp
|
||||
<select class="select" name="sifat_bagunan_disekitar_lokasi" id="">
|
||||
<option value="">pilih sifat bagunan</option>
|
||||
<option value="Permanen">Permanen</option>
|
||||
<option value="Semi Permanen">Semi Permanen</option>
|
||||
<option value="Tidak Permanen">Tidak Permanen</option>
|
||||
@foreach ($sifat as $item)
|
||||
<option value="{{ $item }}"
|
||||
{{ old('sifat_bagunan_disekitar_lokasi', $forminspeksi['lingkungan']['disekitar_lokasi'] ?? '') == $item ? 'selected' : '' }}>
|
||||
{{ $item }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
style="{{ old('luas_tanah', isset($forminspeksi['tanah']['luas_tanah']['tidak sesuai'])) ? '' : 'display: none;' }}">
|
||||
<input id="analisa_tanah_tidak_sesuai" type="text" name="luas_tanah_tidak_sesuai"
|
||||
class="input w-full" placeholder="Masukan Luas Tanah"
|
||||
value="{{ old('luas_tanah_tidak_sesuai', $forminspeksi['tanah']['luas_tanah_tidak_sesuai'] ?? '') }}">
|
||||
value="{{ old('luas_tanah_tidak_sesuai', $forminspeksi['tanah']['luas_tanah']['tidak sesuai'] ?? '') }}">
|
||||
<button type="button" class="btn btn-md btn-primary"
|
||||
onclick="updateAnalisa('analisa_tanah')">Save</button>
|
||||
</div>
|
||||
@@ -85,6 +85,7 @@
|
||||
</label>
|
||||
|
||||
<!-- Select dropdown untuk "Tidak Sesuai" -->
|
||||
|
||||
<div id="hadap_mata_angin_tidak_sesuai" class="flex items-baseline gap-2"
|
||||
style="{{ old('hadap_mata_angin', isset($forminspeksi['tanah']['hadap_mata_angin']['tidak sesuai'])) ? '' : 'display: none;' }}">
|
||||
<select class="input w-full
|
||||
@@ -94,7 +95,7 @@
|
||||
@if (isset($arahMataAngin))
|
||||
@foreach ($arahMataAngin as $item)
|
||||
<option value="{{ $item->name }}"
|
||||
{{ old('hadap_mata_angin_tidak_sesuai', $forminspeksi['tanah']['hadap_mata_angin_tidak_sesuai'] ?? '') == $item->name ? 'selected' : '' }}>
|
||||
{{ old('hadap_mata_angin_tidak_sesuai', $forminspeksi['tanah']['hadap_mata_angin']['tidak sesuai'] ?? '') == $item->name ? 'selected' : '' }}>
|
||||
{{ $item->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
@@ -233,14 +234,14 @@
|
||||
<label class="form-label flex items-center gap-2.5 text-nowrap">
|
||||
<input class="checkbox" name="posisi_kavling[]" type="checkbox"
|
||||
value="{{ $item->name }}"
|
||||
{{ in_array($item->name, old('posisi_kavling', $forminspeksi['tanah']['posisi_kavling'] ?? [])) ? 'checked' : '' }}
|
||||
{{ in_array($item->name, old('posisi_kavling', $forminspeksi['tanah']['posisi_kavling']['posisi_kavling'] ?? [])) ? 'checked' : '' }}
|
||||
onclick="toggleCheckboxVisibility('posisi_kavling', 'posisi_kavling_lainnya', ['Lainnya'])" />
|
||||
{{ $item->name }}
|
||||
</label>
|
||||
@if (strcasecmp($item->name, 'Lainnya') == 0)
|
||||
<input id="posisi_kavling_lainnya" type="text" style="display: none;"
|
||||
name="posisi_kavling_lainnya" class="input w-full mt-2"
|
||||
placeholder="Masukkan Posisi Kavling lainnya..." />
|
||||
placeholder="Masukkan Posisi Kavling lainnya..." value="{{ old('posisi_kavling_lainnya', $forminspeksi['tanah']['posisi_kavling']['lainnya'] ?? '') }}" />
|
||||
@endif
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
Reference in New Issue
Block a user