diff --git a/app/Http/Controllers/SurveyorController.php b/app/Http/Controllers/SurveyorController.php
index 0c936a0..48a5066 100644
--- a/app/Http/Controllers/SurveyorController.php
+++ b/app/Http/Controllers/SurveyorController.php
@@ -35,6 +35,7 @@ use Modules\Lpj\Models\FotoJaminan;
use Modules\Lpj\Models\Lingkungan;
use Modules\Lpj\Models\LantaiUnit;
use Modules\Lpj\Models\Lantai;
+use Modules\Lpj\Models\Teams;
use Modules\Lpj\Models\ViewUnit;
use Modules\Lpj\Models\ObjekJaminan;
use Modules\Lpj\Models\RuteJaminan;
@@ -149,41 +150,45 @@ class SurveyorController extends Controller
/**
* Store form inspeksi.
*/
- public function store(FormSurveyorRequest $request)
+ public function store(Request $request)
{
- $validatedData = $request->validated();
- DB::beginTransaction();
- try {
- $analisa = Analisa::create($validatedData);
- if ($analisa) {
- $validatedData['analisa_id'] = $analisa->id;
+ dd($request);
- switch ($validatedData['action']) {
- case 'tanah_bangunan':
- $this->handleTanahBangunan($validatedData, $request);
- break;
- case 'unit':
- $this->handleUnit($validatedData);
- break;
- default:
- throw new \Exception('Invalid action type');
- }
- AnalisaLingkungan::create($validatedData);
- $validatedData['foto_tempat'] = $this->uploadFile($request->file('foto_tempat'), 'foto_tempat');
- AnalisaFakta::create($validatedData);
- }
+ // $validatedData = $request->validated();
+ // DB::beginTransaction();
+ // try {
+ // $analisa = Analisa::create($validatedData);
- DB::commit();
- return redirect()->route('surveyor.show', [
- 'id' => $validatedData['permohonan_id'],
- 'form' => 'inspeksi'
- ])->with('success', 'Data form surveyor berhasil disimpan');
- } catch (Exception $e) {
- DB::rollback();
- return response()->json(['error' => 'Failed to save data', 'details' => $e->getMessage()], 500);
- }
+ // if ($analisa) {
+ // $validatedData['analisa_id'] = $analisa->id;
+
+ // switch ($validatedData['action']) {
+ // case 'tanah_bangunan':
+ // $this->handleTanahBangunan($validatedData, $request);
+ // break;
+ // case 'unit':
+ // $this->handleUnit($validatedData);
+ // break;
+ // default:
+ // throw new \Exception('Invalid action type');
+ // }
+
+ // AnalisaLingkungan::create($validatedData);
+ // $validatedData['foto_tempat'] = $this->uploadFile($request->file('foto_tempat'), 'foto_tempat');
+ // AnalisaFakta::create($validatedData);
+ // }
+
+ // DB::commit();
+ // return redirect()->route('surveyor.show', [
+ // 'id' => $validatedData['permohonan_id'],
+ // 'form' => 'inspeksi'
+ // ])->with('success', 'Data form surveyor berhasil disimpan');
+ // } catch (Exception $e) {
+ // DB::rollback();
+ // return response()->json(['error' => 'Failed to save data', 'details' => $e->getMessage()], 500);
+ // }
}
private function handleTanahBangunan(array $validatedData, FormSurveyorRequest $request)
@@ -567,8 +572,14 @@ class SurveyorController extends Controller
{
$permohonan = $this->getPermohonanJaminanId($id, $jaminanId);
+ // Auth::user()->id
+ $link_url_region = Teams::with('regions', 'teamsUsers')
+ ->whereHas('teamsUsers', function ($query) {
+ $query->where('user_id', Auth::user()->id);
+ })->first();
+
$branches = Branch::all();
$provinces = Province::all();
@@ -600,9 +611,6 @@ class SurveyorController extends Controller
->where('jenis_jaminan_id', $jaminanId)
->first();
- // return response()->json($permohonan);
-
-
return view('lpj::surveyor.components.inspeksi', compact(
'analisa',
'permohonan',
@@ -626,7 +634,8 @@ class SurveyorController extends Controller
'golMasySekitar',
'tingkatKeramaian',
'laluLintasLokasi',
- 'perkerasanJalan'
+ 'perkerasanJalan',
+ 'link_url_region'
));
}
diff --git a/app/Http/Controllers/TeamsController.php b/app/Http/Controllers/TeamsController.php
index 9efc3ca..d83184d 100644
--- a/app/Http/Controllers/TeamsController.php
+++ b/app/Http/Controllers/TeamsController.php
@@ -196,6 +196,9 @@ class TeamsController extends Controller
->leftJoin('teams_users', 'teams.id', '=', 'teams_users.teams_id')
->leftJoin('users', 'teams_users.user_id', '=', 'users.id')
->addSelect('users.id as user_id', 'users.name as user_name');
+
+
+
// Filter pencarian
if ($request->has('search') && !empty($request->get('search'))) {
diff --git a/app/Http/Requests/FormSurveyorRequest.php b/app/Http/Requests/FormSurveyorRequest.php
index b79014a..475960b 100644
--- a/app/Http/Requests/FormSurveyorRequest.php
+++ b/app/Http/Requests/FormSurveyorRequest.php
@@ -80,10 +80,22 @@ class FormSurveyorRequest extends FormRequest
$action = $this->input('action');
switch ($action) {
- case 'tanah_bangunan':
+ case 'tanah':
return $this->getTanahBangunanRules();
case 'unit':
return $this->getUnitRules();
+ case 'kapal':
+ return $this->getUnitRules();
+ case 'kendaraan':
+ return $this->getUnitRules();
+ case 'mesin':
+ return $this->getUnitRules();
+ case 'bangunan':
+ return $this->getTanahBangunanRules();
+ case 'tanah_bangunan':
+ return $this->getTanahBangunanRules();
+ case 'alat-berat':
+ return $this->getUnitRules();
default:
return [];
}
@@ -130,4 +142,40 @@ class FormSurveyorRequest extends FormRequest
'bentuk_unit' => 'required',
];
}
+
+
+
+ private function getKapalRules():array{
+ return [
+ 'action' => 'required',
+ 'kondisi_kapal' => 'required',
+ 'kondisi_kapal_lain' => 'required',
+ ];
+ }
+
+ public function getKendaraanRules():array{
+ return [
+ 'action' => 'required',
+ 'kondisi_kendaraan' => 'required',
+ 'kondisi_kendaraan_lain' => 'required',
+ ];
+ }
+
+
+ public function getMesinRules():array{
+ return [
+ 'action' => 'required',
+ 'kondisi_mesin' => 'required',
+ 'kondisi_mesin_lain' => 'required',
+ ];
+ }
+
+
+ public function getAlatBeratRules():array{
+ return [
+ 'action' => 'required',
+ 'kondisi_alat_berat' => 'required',
+ 'kondisi_alat_berat_lain' => 'required',
+ ];
+ }
}
diff --git a/app/Http/Requests/PenilaianRequest.php b/app/Http/Requests/PenilaianRequest.php
index 23b91bf..99e979a 100644
--- a/app/Http/Requests/PenilaianRequest.php
+++ b/app/Http/Requests/PenilaianRequest.php
@@ -25,8 +25,6 @@ class PenilaianRequest extends FormRequest
];
}
-
-
return [
'jenis_penilaian_id' => 'required|max:255',
'teams_id' => 'required|max:255',
diff --git a/app/Http/Requests/RegionRequest.php b/app/Http/Requests/RegionRequest.php
index fd9ab1d..250d926 100644
--- a/app/Http/Requests/RegionRequest.php
+++ b/app/Http/Requests/RegionRequest.php
@@ -14,6 +14,8 @@ class RegionRequest extends FormRequest
$rules = [
'name' => 'required|string|max:255',
'status' => 'nullable|boolean',
+ 'url' => 'nullable|string|max:255',
+ 'name_url' => 'nullable|string|max:255',
'authorized_at' => 'nullable|datetime',
'authorized_status' => 'nullable|string|max:1',
'authorized_by' => 'nullable|exists:users,id',
diff --git a/app/Models/Regions.php b/app/Models/Regions.php
index 28836b5..7b5519c 100644
--- a/app/Models/Regions.php
+++ b/app/Models/Regions.php
@@ -17,7 +17,7 @@ class Regions extends Model
protected $table = 'regions';
protected $fillable = [
- 'code', 'name', 'status', 'authorized_status', 'authorized_at', 'authorized_by'
+ 'code', 'name', 'status', 'name_url','url','authorized_status', 'authorized_at', 'authorized_by'
];
public function teams(){
diff --git a/database/migrations/2024_10_16_153558_create_analisa_tanah_bangunan_table.php b/database/migrations/2024_10_16_153558_create_analisa_tanah_bangunan_table.php
index 585dbf4..2c0cf23 100644
--- a/database/migrations/2024_10_16_153558_create_analisa_tanah_bangunan_table.php
+++ b/database/migrations/2024_10_16_153558_create_analisa_tanah_bangunan_table.php
@@ -20,7 +20,7 @@ return new class extends Migration
$table->string('kontur_tanah');
$table->string('ketinggian_jalan');
$table->string('kontur_jalan');
- $table->string('posis_kavling');
+ $table->string('posisi_kavling');
$table->enum('tusuk_sate', ['yes', 'no']);
$table->enum('lockland', ['yes', 'no']);
$table->string('kondisi_fisik_tanah');
diff --git a/database/migrations/2024_10_31_032940_create_penilai_team_table.php b/database/migrations/2024_10_31_032940_create_penilai_team_table.php
index db287b2..fe4f80e 100644
--- a/database/migrations/2024_10_31_032940_create_penilai_team_table.php
+++ b/database/migrations/2024_10_31_032940_create_penilai_team_table.php
@@ -14,7 +14,7 @@ return new class () extends Migration {
$table->id();
$table->unsignedBigInteger('penilaian_id');
$table->unsignedBigInteger('team_id');
- $table->unsignedBigInteger('user_id');
+ $table->unsignedBigInteger('user_id')->nullable();
$table->string('role');
$table->boolean('status')->default(true);
$table->char('authorized_status', 1)->nullable();
diff --git a/database/migrations/2024_11_08_065701_update_regions_table.php b/database/migrations/2024_11_08_065701_update_regions_table.php
new file mode 100644
index 0000000..5c40384
--- /dev/null
+++ b/database/migrations/2024_11_08_065701_update_regions_table.php
@@ -0,0 +1,30 @@
+string('url')->nullable()->after('name');
+ $table->string('name_url')->nullable()->after('url');
+
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::table('regions', function (Blueprint $table) {
+ $table->dropColumn('url');
+ $table->dropColumn('name_url');
+ });
+ }
+};
diff --git a/module.json b/module.json
index 572fe59..1531970 100644
--- a/module.json
+++ b/module.json
@@ -567,6 +567,14 @@
"attributes": [],
"permission": "",
"roles": ["administrator","surveyor"]
+ },
+ {
+ "title": "Perkerasan jalan",
+ "path": "basicdata.perkerasan-jalan",
+ "classes": "",
+ "attributes": [],
+ "permission": "",
+ "roles": ["administrator","surveyor"]
}
diff --git a/resources/views/region/create.blade.php b/resources/views/region/create.blade.php
index ed8ca6f..626414b 100644
--- a/resources/views/region/create.blade.php
+++ b/resources/views/region/create.blade.php
@@ -49,6 +49,30 @@
@enderror
+
+
+
+
+ @error('name_url')
+ {{ $message }}
+ @enderror
+
+
+
+
+
+
+ @error('url')
+ {{ $message }}
+ @enderror
+
+
-
-
Lokasi Jaminan
-
-
- @php
- $inputDataLoaksi = [];
+ {{-- lokasi jaminan --}}
+ @include('lpj::surveyor.components.lokasi-jaminan')
- $inputDataLoaksi = [
- ['label' => 'Nama Jalan', 'index' => 0],
- ['label' => 'Perumahan/Gang', 'index' => 1],
- ['label' => 'Blok/Nomor', 'index' => 2],
- ['label' => 'Desa/Kelurahan', 'index' => 3],
- ['label' => 'Kecamatan', 'index' => 4],
- ['label' => 'Kota/Kotamadya', 'index' => 5],
- ['label' => 'Provinsi', 'index' => 6]
- ];
-
- @endphp
-
- @if (count($inputDataLoaksi) > 0)
- @foreach ($inputDataLoaksi as $item)
-
-
-
-
-
-
- @error('bentuk_tanah')
- {{ $message }}
- @enderror
-
-
- @endforeach
- @endif
-
diff --git a/resources/views/surveyor/components/bangunan.blade.php b/resources/views/surveyor/components/bangunan.blade.php
index 524aace..c293814 100644
--- a/resources/views/surveyor/components/bangunan.blade.php
+++ b/resources/views/surveyor/components/bangunan.blade.php
@@ -1,6 +1,9 @@
{{-- @if ($analisaType == 'tanah_bangunan') --}}
-
+
+
+
+
Analisa Bangunan
@@ -29,21 +32,21 @@
-
+
-
+
-
+
-