update assigment lintas region
This commit is contained in:
@@ -30,31 +30,44 @@ class ActivityController extends Controller
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
public function progres_activity()
|
public function progres_activity()
|
||||||
{
|
{
|
||||||
// Ambil user yang sedang login
|
// Ambil user yang sedang login
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
$roles = $user->load('roles');
|
$roles = $user->load('roles');
|
||||||
$regionId = null;
|
|
||||||
|
|
||||||
// Cek apakah user memiliki role 'senior officer'
|
// Inisialisasi regionId dan teamId sebagai null agar bisa dinamis
|
||||||
if ($roles->roles->pluck('name')->contains('senior officer')) {
|
$regionId = null;
|
||||||
$regionId = TeamsUsers::with('team.regions')
|
$teamId = null;
|
||||||
->where('user_id', $user->id)
|
|
||||||
->first()?->team->regions_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
$teamsActivity = TeamsUsers::with(['user', 'team', 'team.regions'])
|
if ($roles->roles->pluck('name')->contains('senior-officer')) {
|
||||||
->whereHas('team', function ($q) use ($regionId) {
|
$userTeam = TeamsUsers::with('team')
|
||||||
if ($regionId) {
|
->where('user_id', $user->id)
|
||||||
$q->where('regions_id', $regionId);
|
->first();
|
||||||
}
|
$regionId = $userTeam?->team->regions_id;
|
||||||
})
|
$teamId = $userTeam?->teams_id;
|
||||||
->where('user_id', '!=', $user->id)
|
|
||||||
->get();
|
}
|
||||||
|
|
||||||
|
$teamsActivity = TeamsUsers::with(['user', 'team', 'team.regions', 'user.roles'])
|
||||||
|
->whereHas('team', function ($q) use ($regionId, $teamId) {
|
||||||
|
if ($regionId) {
|
||||||
|
$q->where('regions_id', $regionId);
|
||||||
|
}
|
||||||
|
if ($teamId) {
|
||||||
|
$q->where('id', $teamId); // Hanya tim yang sama
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->where('user_id', '!=', $user->id)
|
||||||
|
->whereHas('user.roles', function ($query) {
|
||||||
|
// Filter hanya peran 'surveyor' atau 'surveyor-penilai'
|
||||||
|
$query->whereIn('name', ['surveyor', 'surveyor-penilai']);
|
||||||
|
})
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return view('lpj::activity.progres_activity.index', compact('teamsActivity'));
|
||||||
|
}
|
||||||
|
|
||||||
return view('lpj::activity.progres_activity.index', compact('teamsActivity'));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function senior()
|
public function senior()
|
||||||
@@ -194,13 +207,23 @@ class ActivityController extends Controller
|
|||||||
|
|
||||||
public function dataTablesForActivity(Request $request, $id)
|
public function dataTablesForActivity(Request $request, $id)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (is_null($this->user) || !$this->user->can('debitur.view')) {
|
||||||
|
// abort(403, 'Sorry! You are not allowed to view users.');
|
||||||
|
}
|
||||||
// Query Penilaian dengan relasi yang diperlukan
|
// Query Penilaian dengan relasi yang diperlukan
|
||||||
$query = Penilaian::with(['permohonan', 'permohonan.debiture', 'permohonan.tujuanPenilaian', 'permohonan.debiture.documents.jenisJaminan'])
|
$query = Penilaian::with([
|
||||||
->where(function($q) use ($id) {
|
'permohonan',
|
||||||
$q->where('surveyor_id', $id)
|
'permohonan.debiture',
|
||||||
->orWhere('penilaian_id', $id)
|
'permohonan.tujuanPenilaian',
|
||||||
->orWhere('penilai_surveyor_id', $id);
|
'permohonan.debiture.documents.jenisJaminan',
|
||||||
});
|
'userPenilai'
|
||||||
|
])
|
||||||
|
->whereHas('userPenilai', function ($q) use ($id) {
|
||||||
|
$q->where('user_id', $id);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Filter pencarian
|
// Filter pencarian
|
||||||
if ($request->has('search') && !empty($request->get('search'))) {
|
if ($request->has('search') && !empty($request->get('search'))) {
|
||||||
|
|||||||
@@ -5,14 +5,18 @@ namespace Modules\Lpj\Http\Controllers;
|
|||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
use Modules\Lpj\Http\Requests\PenilaianRequest;
|
use Modules\Lpj\Http\Requests\PenilaianRequest;
|
||||||
use Modules\Lpj\Models\JenisPenilaian;
|
use Modules\Lpj\Models\JenisPenilaian;
|
||||||
use Modules\Lpj\Models\Penilaian;
|
use Modules\Lpj\Models\Penilaian;
|
||||||
|
use Modules\Lpj\Models\PenilaianTeam;
|
||||||
use Modules\Lpj\Models\Permohonan;
|
use Modules\Lpj\Models\Permohonan;
|
||||||
use Modules\Lpj\Models\StatusPermohonan;
|
use Modules\Lpj\Models\StatusPermohonan;
|
||||||
use Modules\Lpj\Models\Teams;
|
use Modules\Lpj\Models\Teams;
|
||||||
|
use Modules\Lpj\Models\Regions;
|
||||||
use Modules\Lpj\Models\TeamsUsers;
|
use Modules\Lpj\Models\TeamsUsers;
|
||||||
use Modules\Usermanagement\Models\User;
|
use Modules\Usermanagement\Models\User;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
class PenilaianController extends Controller
|
class PenilaianController extends Controller
|
||||||
{
|
{
|
||||||
@@ -37,17 +41,84 @@ class PenilaianController extends Controller
|
|||||||
|
|
||||||
if ($validatedData) {
|
if ($validatedData) {
|
||||||
try {
|
try {
|
||||||
$penilaian = Penilaian::create($validatedData);
|
DB::beginTransaction();
|
||||||
|
|
||||||
|
$penilaian = Penilaian::create($validatedData);
|
||||||
|
$validatedData['penilaian_id'] = $penilaian->id;
|
||||||
|
|
||||||
|
$teams_ids = [];
|
||||||
|
$user_ids = [];
|
||||||
|
$roles = [];
|
||||||
|
|
||||||
|
if ($validatedData['surveyor_id'] === 'pilih_dari_region') {
|
||||||
|
$surveyor_region_id = $validatedData['surveyor_region_id'];
|
||||||
|
|
||||||
|
// Hapus team_id sebelumnya di Permohonan jika ada
|
||||||
|
$permohonan = Permohonan::where('nomor_registrasi', $request->nomor_registrasi)->first();
|
||||||
|
if ($permohonan) {
|
||||||
|
$permohonan->update([
|
||||||
|
'region_id' => $surveyor_region_id,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$teams_ids[] = $surveyor_region_id;
|
||||||
|
$user_ids[] = null;
|
||||||
|
$roles[] = 'surveyor';
|
||||||
|
} else {
|
||||||
|
$permohonan = Permohonan::where('nomor_registrasi', $request->nomor_registrasi)->first();
|
||||||
|
$teams_ids[] = $validatedData['teams_id'];
|
||||||
|
$user_ids[] = $validatedData['surveyor_id'];
|
||||||
|
$roles[] = 'surveyor';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($validatedData['penilai_id'] === 'pilih_dari_region') {
|
||||||
|
$penilaian_region_id = $validatedData['penilai_region_id'];
|
||||||
|
|
||||||
|
// Hapus team_id sebelumnya di Permohonan jika ada
|
||||||
|
$permohonan = Permohonan::where('nomor_registrasi', $request->nomor_registrasi)->first();
|
||||||
|
if ($permohonan) {
|
||||||
|
$permohonan->update([
|
||||||
|
'region_id' => $penilaian_region_id,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$teams_ids[] = $penilaian_region_id;
|
||||||
|
$user_ids[] = null;
|
||||||
|
$roles[] = 'penilai';
|
||||||
|
} else {
|
||||||
|
$permohonan = Permohonan::where('nomor_registrasi', $request->nomor_registrasi)->first();
|
||||||
|
$teams_ids[] = $validatedData['teams_id'];
|
||||||
|
$user_ids[] = $validatedData['penilai_id'];
|
||||||
|
$roles[] = 'penilai';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($teams_ids as $key => $teams_id) {
|
||||||
|
PenilaianTeam::create([
|
||||||
|
'penilaian_id' => $validatedData['penilaian_id'],
|
||||||
|
'team_id' => $teams_id,
|
||||||
|
'user_id' => $user_ids[$key],
|
||||||
|
'role' => $roles[$key],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($validatedData['surveyor_id'] === 'pilih_dari_region' || $validatedData['penilai_id'] === 'pilih_dari_region') {
|
||||||
|
$status = 'registered';
|
||||||
|
} else {
|
||||||
|
$status = 'assign';
|
||||||
|
}
|
||||||
|
|
||||||
$permohonan = Permohonan::where('nomor_registrasi', $request->nomor_registrasi);
|
|
||||||
$permohonan->update([
|
$permohonan->update([
|
||||||
'status' => 'assign',
|
'status' => $status,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
return redirect()->route('penilaian.index')->with('success', 'Penilaian berhasil disimpan');
|
return redirect()->route('penilaian.index')->with('success', 'Penilaian berhasil disimpan');
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
DB::rollBack();
|
||||||
return redirect()->route('penilaian.index')->with('error', $e->getMessage());
|
return response()->json(array('error' => $e->getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -63,22 +134,43 @@ class PenilaianController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Update the specified resource in storage.
|
* Update the specified resource in storage.
|
||||||
*/
|
*/
|
||||||
public function update(PenilaianRequest $request, $id)
|
public function update(Request $request, $id)
|
||||||
{
|
{
|
||||||
$validate = $request->validated();
|
try {
|
||||||
if ($validate) {
|
DB::beginTransaction();
|
||||||
try {
|
$penilaian = Penilaian::where('nomor_registrasi', $request->nomor_registrasi)->first();
|
||||||
$penilaian = Penilaian::where('nomor_registrasi', $request->nomor_registrasi)->firstOrFail();
|
|
||||||
$penilaian->update($validate);
|
$penilaianId = $penilaian->id;
|
||||||
$permohonan = Permohonan::where('nomor_registrasi', $request->nomor_registrasi);
|
|
||||||
$permohonan->update([
|
$penilainTeam = PenilaianTeam::where('penilaian_id', $penilaianId)->get();
|
||||||
'status' => 'assign',
|
|
||||||
]);
|
|
||||||
|
foreach ($penilainTeam as $item) {
|
||||||
|
if ($item->role === 'surveyor' && $item->user_id === null) {
|
||||||
|
$item->update([
|
||||||
|
'user_id' => $request->surveyor_id,
|
||||||
|
'role' => 'surveyor',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($item->role === 'penilai' && $item->user_id === null) {
|
||||||
|
$item->update([
|
||||||
|
'user_id' => $request->penilai_id,
|
||||||
|
'role' => 'penilai',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
return redirect()->route('penilaian.index', $id)->with('success', 'Penilaian berhasil diubah');
|
|
||||||
} catch (Exception $e) {
|
|
||||||
return redirect()->route('penilaian.index', $id)->with('error', $e->getMessage());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$permohonan = Permohonan::where('nomor_registrasi', $request->nomor_registrasi);
|
||||||
|
$permohonan->update([
|
||||||
|
'status' => 'assign',
|
||||||
|
]);
|
||||||
|
DB::commit();
|
||||||
|
return redirect()->route('penilaian.index')->with('success', 'Penilaian berhasil disimpan');
|
||||||
|
} catch (Exception $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
return response()->json(array('error' => $e->getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,29 +179,36 @@ class PenilaianController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function assignment($id)
|
public function assignment($id)
|
||||||
{
|
{
|
||||||
$permohonan = Permohonan::with(
|
$permohonan = Permohonan::with([
|
||||||
[
|
'user',
|
||||||
'user',
|
'debiture.province',
|
||||||
'debiture.province',
|
'debiture.city',
|
||||||
'debiture.city',
|
'debiture.district',
|
||||||
'debiture.district',
|
'debiture.village',
|
||||||
'debiture.village',
|
'branch',
|
||||||
'branch',
|
'tujuanPenilaian',
|
||||||
'tujuanPenilaian',
|
])->findOrFail($id);
|
||||||
],
|
|
||||||
)->findOrFail($id);
|
|
||||||
|
|
||||||
$idPenilaian = $permohonan->jenis_penilaian_id;
|
$idPenilaian = $permohonan->jenis_penilaian_id;
|
||||||
$idRegion = $permohonan->region_id;
|
$idRegion = $permohonan->region_id;
|
||||||
|
|
||||||
$jenisPenilaian = JenisPenilaian::find($idPenilaian);
|
$jenisPenilaian = JenisPenilaian::find($idPenilaian);
|
||||||
|
|
||||||
|
$userTeam = Teams::with(['regions', 'teamsUsers.user'])
|
||||||
|
->whereHas('regions', function ($q) use ($idRegion) {
|
||||||
|
$q->where('id', $idRegion);
|
||||||
|
})
|
||||||
|
->get();
|
||||||
|
|
||||||
$teamPenilai = Teams::with(['regions', 'teamsUsers', 'teamsUsers.user'])
|
$teamPenilai = $userTeam->flatMap(function ($team) {
|
||||||
->whereHas('regions', function ($q) use ($idRegion) {
|
return $team->teamsUsers->filter(function ($teamUser) {
|
||||||
$q->where('id', $idRegion);
|
return $teamUser->user->roles->contains(function ($role) {
|
||||||
})->get();
|
return $role->name === 'surveyor' || $role->name === 'surveyor-penilai';
|
||||||
|
});
|
||||||
|
})->map(function ($teamUser) {
|
||||||
|
return $teamUser->user;
|
||||||
|
});
|
||||||
|
})->unique('id');
|
||||||
|
|
||||||
$existingTeamIds = $teamPenilai->pluck('id')->toArray();
|
$existingTeamIds = $teamPenilai->pluck('id')->toArray();
|
||||||
|
|
||||||
@@ -117,19 +216,29 @@ class PenilaianController extends Controller
|
|||||||
->whereNotIn('id', $existingTeamIds)
|
->whereNotIn('id', $existingTeamIds)
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
|
||||||
$regionName = null;
|
$regionName = null;
|
||||||
foreach ($teamPenilai as $item) {
|
foreach ($userTeam as $item) {
|
||||||
$regionName = $item->regions;
|
$regionName = $item->regions;
|
||||||
}
|
}
|
||||||
|
// $regionName = $userTeam->first()?->regions->name;
|
||||||
|
|
||||||
|
|
||||||
// dd($teamPenilai);
|
|
||||||
|
|
||||||
$penilaian = Penilaian::where('nomor_registrasi', $permohonan->nomor_registrasi)->first();
|
$penilaian = Penilaian::where('nomor_registrasi', $permohonan->nomor_registrasi)->first();
|
||||||
|
|
||||||
return view('lpj::penilaian.form', compact('permohonan', 'teamPenilai', 'jenisPenilaian', 'penilaian', 'regionName', 'updateTeamPenilai'));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$penilaianTeam = collect();
|
||||||
|
if ($penilaian && $penilaian->id) {
|
||||||
|
$penilaianTeam = PenilaianTeam::where('penilaian_id', $penilaian->id)->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
// return response()->json([
|
||||||
|
// 'penilaianTeam' => $penilaianTeam
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
|
||||||
|
return view('lpj::penilaian.form', compact('permohonan', 'teamPenilai', 'jenisPenilaian', 'penilaian', 'regionName', 'updateTeamPenilai', 'penilaianTeam'));
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Remove the specified resource from storage.
|
* Remove the specified resource from storage.
|
||||||
*/
|
*/
|
||||||
@@ -167,8 +276,9 @@ class PenilaianController extends Controller
|
|||||||
|
|
||||||
public function dataForDatatables(Request $request)
|
public function dataForDatatables(Request $request)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (is_null($this->user) || !$this->user->can('debitur.view')) {
|
if (is_null($this->user) || !$this->user->can('debitur.view')) {
|
||||||
// abort(403, 'Sorry! You are not allowed to view users.');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = Permohonan::query();
|
$query = Permohonan::query();
|
||||||
@@ -187,6 +297,9 @@ class PenilaianController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$query->whereRaw('LOWER(status) = ?', ['registered']);
|
$query->whereRaw('LOWER(status) = ?', ['registered']);
|
||||||
|
$query->whereHas('region.teams.teamsUsers.user', function ($q) {
|
||||||
|
$q->where('id', Auth::user()->id);
|
||||||
|
});
|
||||||
|
|
||||||
if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) {
|
if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) {
|
||||||
$order = $request->get('sortOrder');
|
$order = $request->get('sortOrder');
|
||||||
@@ -209,7 +322,7 @@ class PenilaianController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$filteredRecords = $query->count();
|
$filteredRecords = $query->count();
|
||||||
$data = $query->with(['user', 'debiture', 'branch', 'tujuanPenilaian'])->get();
|
$data = $query->with(['user', 'debiture', 'branch', 'tujuanPenilaian', 'region.teams.teamsUsers.user'])->get();
|
||||||
|
|
||||||
$pageCount = ceil($totalRecords / $size);
|
$pageCount = ceil($totalRecords / $size);
|
||||||
|
|
||||||
@@ -312,7 +425,7 @@ class PenilaianController extends Controller
|
|||||||
if (!empty($otorisator)) {
|
if (!empty($otorisator)) {
|
||||||
if ($status == 'proses') {
|
if ($status == 'proses') {
|
||||||
$query->whereIn('status_bayar', ['sudah_bayar', 'belum_bayar']);
|
$query->whereIn('status_bayar', ['sudah_bayar', 'belum_bayar']);
|
||||||
}else{
|
} else {
|
||||||
$query->whereRaw('LOWER(status) = ?', [strtolower($status)]);
|
$query->whereRaw('LOWER(status) = ?', [strtolower($status)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ use App\Http\Controllers\Controller;
|
|||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
use Modules\Lpj\Models\Permohonan;
|
use Modules\Lpj\Models\Permohonan;
|
||||||
use Modules\Lpj\Models\Branch;
|
use Modules\Lpj\Models\Branch;
|
||||||
@@ -47,6 +48,7 @@ use Modules\Lpj\Http\Requests\FormSurveyorRequest;
|
|||||||
class SurveyorController extends Controller
|
class SurveyorController extends Controller
|
||||||
{
|
{
|
||||||
public $user;
|
public $user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display a listing of the resource.
|
* Display a listing of the resource.
|
||||||
*/
|
*/
|
||||||
@@ -118,6 +120,8 @@ class SurveyorController extends Controller
|
|||||||
->where('permohonan_id', $id)
|
->where('permohonan_id', $id)
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return view('lpj::surveyor.detail', compact(
|
return view('lpj::surveyor.detail', compact(
|
||||||
'buttonDisable',
|
'buttonDisable',
|
||||||
'fotojaminan',
|
'fotojaminan',
|
||||||
@@ -513,6 +517,11 @@ class SurveyorController extends Controller
|
|||||||
|
|
||||||
$query->whereRaw('LOWER(status) = ?', ['assign']);
|
$query->whereRaw('LOWER(status) = ?', ['assign']);
|
||||||
|
|
||||||
|
$query->whereHas('region.teams.teamsUsers.user', function ($q) {
|
||||||
|
$q->where('id', Auth::user()->id);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) {
|
if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) {
|
||||||
$order = $request->get('sortOrder');
|
$order = $request->get('sortOrder');
|
||||||
$column = $request->get('sortField');
|
$column = $request->get('sortField');
|
||||||
@@ -614,7 +623,6 @@ class SurveyorController extends Controller
|
|||||||
'golMasySekitar',
|
'golMasySekitar',
|
||||||
'tingkatKeramaian',
|
'tingkatKeramaian',
|
||||||
'laluLintasLokasi'
|
'laluLintasLokasi'
|
||||||
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -693,7 +701,7 @@ class SurveyorController extends Controller
|
|||||||
|
|
||||||
$spekKategoriBagunan = SpekKategoritBangunan::all();
|
$spekKategoriBagunan = SpekKategoritBangunan::all();
|
||||||
$header = $this->getHeader($type);
|
$header = $this->getHeader($type);
|
||||||
return view('lpj::surveyor.data.form', compact('header','spekKategoriBagunan'));
|
return view('lpj::surveyor.data.form', compact('header', 'spekKategoriBagunan'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -713,7 +721,7 @@ class SurveyorController extends Controller
|
|||||||
->with('error', 'Invalid type specified.');
|
->with('error', 'Invalid type specified.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if($type == 'spek-bangunan') {
|
if ($type == 'spek-bangunan') {
|
||||||
$validate['spek_kategori_bagunan_id'] = $request->spek_kategori_bagunan_id;
|
$validate['spek_kategori_bagunan_id'] = $request->spek_kategori_bagunan_id;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -764,7 +772,7 @@ class SurveyorController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return view('lpj::surveyor.data.form', compact('header', 'model','spekKategoriBagunan'));
|
return view('lpj::surveyor.data.form', compact('header', 'model', 'spekKategoriBagunan'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -774,7 +782,7 @@ class SurveyorController extends Controller
|
|||||||
if ($validate) {
|
if ($validate) {
|
||||||
$modelClass = $this->getModelClass($type);
|
$modelClass = $this->getModelClass($type);
|
||||||
|
|
||||||
if($type == 'spek-bangunan') {
|
if ($type == 'spek-bangunan') {
|
||||||
$validate['spek_kategori_bagunan_id'] = $request->spek_kategori_bagunan_id;
|
$validate['spek_kategori_bagunan_id'] = $request->spek_kategori_bagunan_id;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -931,6 +939,8 @@ class SurveyorController extends Controller
|
|||||||
|
|
||||||
public function submitSurveyor(Request $request, $id)
|
public function submitSurveyor(Request $request, $id)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
$permohonan = Permohonan::find($id);
|
$permohonan = Permohonan::find($id);
|
||||||
$permohonan->update([
|
$permohonan->update([
|
||||||
'status' => 'done',
|
'status' => 'done',
|
||||||
@@ -942,6 +952,11 @@ class SurveyorController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function validateSubmit(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private function getModelClass(string $type): ?string
|
private function getModelClass(string $type): ?string
|
||||||
{
|
{
|
||||||
return $this->modelClasses[$type] ?? null;
|
return $this->modelClasses[$type] ?? null;
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class TeamsController extends Controller
|
|||||||
|
|
||||||
$user = $usersWithRole->filter(function ($user) {
|
$user = $usersWithRole->filter(function ($user) {
|
||||||
return $user->roles->contains(function ($role) {
|
return $user->roles->contains(function ($role) {
|
||||||
return $role->name === 'surveyor' || $role->name === 'surveyor-penilai';
|
return $role->name === 'surveyor' || $role->name === 'surveyor-penilai' || $role->name === 'senior-officer';
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ class TeamsController extends Controller
|
|||||||
|
|
||||||
$user = $usersWithRole->filter(function ($user) {
|
$user = $usersWithRole->filter(function ($user) {
|
||||||
return $user->roles->contains(function ($role) {
|
return $user->roles->contains(function ($role) {
|
||||||
return $role->name === 'surveyor' || $role->name === 'surveyor-penilai';
|
return $role->name === 'surveyor' || $role->name === 'surveyor-penilai' || $role->name === 'senior-officer';
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -33,9 +33,12 @@ class PenilaianRequest extends FormRequest
|
|||||||
'tanggal_kunjungan' => 'required|max:255',
|
'tanggal_kunjungan' => 'required|max:255',
|
||||||
'status' => 'required|string',
|
'status' => 'required|string',
|
||||||
'nomor_registrasi' => 'required|string',
|
'nomor_registrasi' => 'required|string',
|
||||||
'surveyor_id' => 'nullable|required_without:penilai_surveyor_id',
|
'surveyor_id' => 'nullable| required_without:penilai_surveyor_id',
|
||||||
'penilaian_id' => 'nullable|required_without:penilai_surveyor_id',
|
'penilai_id' => 'nullable|required_without:penilai_surveyor_id',
|
||||||
'penilai_surveyor_id' => 'nullable|required_without_all:surveyor_id,penilaian_id',
|
'penilai_surveyor_id' => 'nullable|required_without_all:surveyor_id,penilai_id',
|
||||||
|
'surveyor_region_id' => 'nullable|required_without:surveyor_id',
|
||||||
|
'penilai_region_id' => 'nullable|required_without:penilai_id',
|
||||||
|
|
||||||
'keterangan' => 'nullable',
|
'keterangan' => 'nullable',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class Penilaian extends Model
|
|||||||
*/
|
*/
|
||||||
protected $table = 'penilaian';
|
protected $table = 'penilaian';
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'jenis_penilaian_id', 'teams_id', 'tanggal_kunjungan', 'keterangan','nomor_registrasi','penilaian_id','surveyor_id','penilai_surveyor_id',
|
'jenis_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'
|
'created_by', 'updated_at', 'updated_by', 'deleted_at', 'deleted_by'
|
||||||
];
|
];
|
||||||
@@ -39,18 +39,9 @@ class Penilaian extends Model
|
|||||||
|
|
||||||
public function userPenilai()
|
public function userPenilai()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(User::class, 'penilaian_id', 'id');
|
return $this->hasMany(PenilaianTeam::class, 'penilaian_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function userSurveyor()
|
|
||||||
{
|
|
||||||
return $this->belongsTo(User::class, 'surveyor_id', 'id');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function userPenilaiSurveyor()
|
|
||||||
{
|
|
||||||
return $this->belongsTo(User::class, 'penilai_surveyor_id', 'id');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function permohonan()
|
public function permohonan()
|
||||||
{
|
{
|
||||||
|
|||||||
39
app/Models/PenilaianTeam.php
Normal file
39
app/Models/PenilaianTeam.php
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Lpj\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Modules\Lpj\Database\Factories\PenilaianTeamFactory;
|
||||||
|
|
||||||
|
class PenilaianTeam extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'penilaian_team';
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*/
|
||||||
|
protected $fillable = ['penilaian_id', 'team_id', 'user_id','role'];
|
||||||
|
|
||||||
|
|
||||||
|
public function userPenilaiTeam()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class, 'user_id', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function team(){
|
||||||
|
|
||||||
|
return $this->belongsTo(Team::class, 'team_id', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function penilaian(){
|
||||||
|
|
||||||
|
return $this->belongsTo(Penilaian::class, 'penilaian_id', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static function newFactory(): PenilaianTeamFactory
|
||||||
|
{
|
||||||
|
//return PenilaianTeamFactory::new();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -83,4 +83,9 @@ class Permohonan extends Base
|
|||||||
{
|
{
|
||||||
return $this->belongsTo(Penilaian::class, 'nomor_registrasi', 'nomor_registrasi');
|
return $this->belongsTo(Penilaian::class, 'nomor_registrasi', 'nomor_registrasi');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function region()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Regions::class, 'region_id');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ class Teams extends Model
|
|||||||
return $this->hasMany(TeamsUsers::class, 'teams_id', 'id');
|
return $this->hasMany(TeamsUsers::class, 'teams_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function penilaian(){
|
public function penilaianTeam(){
|
||||||
return $this->hasMany(Penilaian::class, 'teams_id', 'id');
|
return $this->hasMany(penilaianTeam::class, 'team_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<?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::create('kategori_jenis_aset', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('name');
|
||||||
|
$table->string('code');
|
||||||
|
$table->boolean('status')->default(true);
|
||||||
|
$table->char('authorized_status', 1)->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
$table->timestamp('authorized_at')->nullable();
|
||||||
|
$table->unsignedBigInteger('authorized_by')->nullable();
|
||||||
|
$table->softDeletes();
|
||||||
|
$table->unsignedBigInteger('created_by')->nullable();
|
||||||
|
$table->unsignedBigInteger('updated_by')->nullable();
|
||||||
|
$table->unsignedBigInteger('deleted_by')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('kategori_jenis_aset');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?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->dropColumn('teams_id');
|
||||||
|
|
||||||
|
|
||||||
|
$table->dropColumn('surveyor_id');
|
||||||
|
$table->dropColumn('penilaian_id');
|
||||||
|
|
||||||
|
$table->dropColumn('penilai_surveyor_id');
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('penilaian', function (Blueprint $table) {
|
||||||
|
$table->foreignIdFor(Teams::class);
|
||||||
|
$table->foreignIdFor(User::class);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?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::create('penilaian_team', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->unsignedBigInteger('penilaian_id');
|
||||||
|
$table->unsignedBigInteger('team_id');
|
||||||
|
$table->unsignedBigInteger('user_id');
|
||||||
|
$table->string('role');
|
||||||
|
$table->boolean('status')->default(true);
|
||||||
|
$table->char('authorized_status', 1)->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
$table->timestamp('authorized_at')->nullable();
|
||||||
|
$table->unsignedBigInteger('authorized_by')->nullable();
|
||||||
|
$table->softDeletes();
|
||||||
|
$table->unsignedBigInteger('created_by')->nullable();
|
||||||
|
$table->unsignedBigInteger('updated_by')->nullable();
|
||||||
|
$table->unsignedBigInteger('deleted_by')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('penilai_team');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?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::create('kategori_form_analisa_inspeksi', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('name');
|
||||||
|
$table->string('code');
|
||||||
|
$table->foreign('kategori_jenis_aset_id')->references('id')->on('kategori_jenis_aset');
|
||||||
|
$table->boolean('status')->default(true);
|
||||||
|
$table->char('authorized_status', 1)->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
$table->timestamp('authorized_at')->nullable();
|
||||||
|
$table->unsignedBigInteger('authorized_by')->nullable();
|
||||||
|
$table->softDeletes();
|
||||||
|
$table->unsignedBigInteger('created_by')->nullable();
|
||||||
|
$table->unsignedBigInteger('updated_by')->nullable();
|
||||||
|
$table->unsignedBigInteger('deleted_by')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('kategori_form_analisa_inspeksi');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?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::create('label_name_inspeksi', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('label_name_inspeksi');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -46,14 +46,14 @@
|
|||||||
@php
|
@php
|
||||||
|
|
||||||
$sortedTeamsActivity = $teamsActivity->sortBy(function ($item) {
|
$sortedTeamsActivity = $teamsActivity->sortBy(function ($item) {
|
||||||
return $item->team->penilaian
|
|
||||||
->filter(function ($penilaian) use ($item) {
|
return $item->team->penilaianTeam
|
||||||
return $penilaian->penilaian_id == $item->user->id ||
|
->filter(function ($penilaianTeam) use ($item) {
|
||||||
$penilaian->surveyor_id == $item->user->id ||
|
return $penilaianTeam->user_id == $item->user->id;
|
||||||
$penilaian->penilai_surveyor_id == $item->user->id;
|
|
||||||
})
|
})
|
||||||
->count();
|
->count();
|
||||||
});
|
});
|
||||||
|
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
@foreach ($sortedTeamsActivity as $index => $item)
|
@foreach ($sortedTeamsActivity as $index => $item)
|
||||||
@@ -70,11 +70,9 @@
|
|||||||
<th class="min-w-[150px]">
|
<th class="min-w-[150px]">
|
||||||
<span class="text-base text-gray-900 font-normal">
|
<span class="text-base text-gray-900 font-normal">
|
||||||
@php
|
@php
|
||||||
$totalTasks = $item->team->penilaian
|
$totalTasks = $item->team->penilaianTeam
|
||||||
->filter(function ($penilaian) use ($item) {
|
->filter(function ($penilaianTeam) use ($item) {
|
||||||
return $penilaian->penilaian_id == $item->user->id ||
|
return $penilaianTeam->user_id == $item->user->id;
|
||||||
$penilaian->surveyor_id == $item->user->id ||
|
|
||||||
$penilaian->penilai_surveyor_id == $item->user->id;
|
|
||||||
})
|
})
|
||||||
->count();
|
->count();
|
||||||
@endphp
|
@endphp
|
||||||
@@ -156,8 +154,6 @@
|
|||||||
const apiUrl = accordion.querySelector('.card-grid').getAttribute(
|
const apiUrl = accordion.querySelector('.card-grid').getAttribute(
|
||||||
'data-api-url');
|
'data-api-url');
|
||||||
|
|
||||||
console.log("This is the API URL: " + apiUrl);
|
|
||||||
|
|
||||||
const dataTableOptions = {
|
const dataTableOptions = {
|
||||||
apiEndpoint: apiUrl,
|
apiEndpoint: apiUrl,
|
||||||
pageSize: 5,
|
pageSize: 5,
|
||||||
|
|||||||
@@ -308,8 +308,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{-- @php
|
||||||
|
var_dump($penilaianTeam);
|
||||||
|
@endphp --}}
|
||||||
|
|
||||||
<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 {{ $penilaianTeam->isEmpty() ? '' : 'hidden' }}">
|
||||||
<label class="form-label max-w-56">
|
<label class="form-label max-w-56">
|
||||||
Pilih Surveyor dan Penilai
|
Pilih Surveyor dan Penilai
|
||||||
</label>
|
</label>
|
||||||
@@ -328,6 +332,7 @@
|
|||||||
@enderror
|
@enderror
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="same_surveyor_penilai" class="hidden">
|
<div id="same_surveyor_penilai" class="hidden">
|
||||||
<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">
|
<label class="form-label max-w-56">
|
||||||
@@ -338,8 +343,8 @@
|
|||||||
<select id="penilai_surveyor_id" name="penilai_surveyor_id"
|
<select id="penilai_surveyor_id" name="penilai_surveyor_id"
|
||||||
class="input tomselect @error('penilai_surveyor_id') border-danger bg-danger-light @enderror w-full">
|
class="input tomselect @error('penilai_surveyor_id') border-danger bg-danger-light @enderror w-full">
|
||||||
<option value="">Pilih Surveyor dan Penilai</option>
|
<option value="">Pilih Surveyor dan Penilai</option>
|
||||||
@foreach ($teamPenilai->first()->teamsUsers as $item)
|
@foreach ($teamPenilai as $item)
|
||||||
<option value="{{ $item->user->id }}">{{ $item->user->name }}</option>
|
<option value="{{ $item->id }}">{{ $item->name }}</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@@ -351,99 +356,167 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div id="different_surveyor_penilai" class="hidden">
|
<div id="different_surveyor_penilai" class="{{ $penilaianTeam->isNotEmpty() ? '' : 'hidden' }}">
|
||||||
<div class="grid gap-2.5">
|
<div class="grid gap-2.5">
|
||||||
<div id="surveyorId" class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
||||||
<label class="form-label max-w-56">
|
|
||||||
Surveyor yang di tunjuk
|
|
||||||
</label>
|
|
||||||
<div class="flex flex-wrap items-baseline w-full">
|
|
||||||
<div class="input-group w-full">
|
|
||||||
<select id="surveyor_id" name="surveyor_id"
|
|
||||||
class="tomselect input @error('surveyor_id') border-danger bg-danger-light @enderror w-full">
|
|
||||||
<option value="">Pilih Surveyor</option>
|
|
||||||
|
|
||||||
@foreach ($teamPenilai->first()->teamsUsers as $item)
|
@if (
|
||||||
<option value="{{ $item->user->id }}">{{ $item->user->name }}</option>
|
$penilaianTeam->isNotEmpty() &&
|
||||||
@endforeach
|
$penilaianTeam->contains(fn($item) => $item->role == 'surveyor' && is_null($item->user_id))
|
||||||
<option value="pilih_dari_region">pilih dari region berdeda</option>
|
)
|
||||||
</select>
|
<div id="surveyorId" class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
|
<label class="form-label max-w-56">
|
||||||
|
Surveyor yang di tunjuk
|
||||||
|
</label>
|
||||||
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
|
<div class="input-group w-full">
|
||||||
|
<select id="surveyor_id" name="surveyor_id"
|
||||||
|
class="tomselect input @error('surveyor_id') border-danger bg-danger-light @enderror w-full">
|
||||||
|
<option value="">Pilih Surveyor</option>
|
||||||
|
@foreach ($teamPenilai as $item)
|
||||||
|
<option value="{{ $item->id }}">{{ $item->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
@if ($penilaianTeam->isEmpty())
|
||||||
|
<option value="pilih_dari_region">pilih dari region berdeda
|
||||||
|
</option>
|
||||||
|
@endif
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
@error('surveyor_id')
|
||||||
|
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@elseif($penilaianTeam->isEmpty())
|
||||||
|
<div id="surveyorId" class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
|
<label class="form-label max-w-56">
|
||||||
|
Surveyor yang di tunjuk
|
||||||
|
</label>
|
||||||
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
|
<div class="input-group w-full">
|
||||||
|
<select id="surveyor_id" name="surveyor_id"
|
||||||
|
class="tomselect input @error('surveyor_id') border-danger bg-danger-light @enderror w-full">
|
||||||
|
<option value="">Pilih Surveyor</option>
|
||||||
|
@foreach ($teamPenilai as $item)
|
||||||
|
<option value="{{ $item->id }}">{{ $item->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
@if ($penilaianTeam->isEmpty())
|
||||||
|
<option value="pilih_dari_region">pilih dari region berdeda
|
||||||
|
</option>
|
||||||
|
@endif
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
@error('surveyor_id')
|
||||||
|
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
|
||||||
|
<div id="surveyorRegion" class="hidden items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
|
<label class="form-label max-w-56">
|
||||||
|
Pilih Region
|
||||||
|
</label>
|
||||||
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
|
<div class="input-group w-full">
|
||||||
|
<select id="surveyor_region_id" name="surveyor_region_id"
|
||||||
|
class="tomselect input @error('surveyor_region_id') border-danger bg-danger-light @enderror w-full">
|
||||||
|
<option value="">Pilih Region</option>
|
||||||
|
|
||||||
|
@if (isset($updateTeamPenilai))
|
||||||
|
@foreach ($updateTeamPenilai as $item)
|
||||||
|
<option value="{{ $item->regions->id }}">
|
||||||
|
{{ $item->regions->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
@endif
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
@error('surveyor_region_id')
|
||||||
|
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
@if (
|
||||||
|
$penilaianTeam->isNotEmpty() &&
|
||||||
|
$penilaianTeam->contains(fn($item) => $item->role == 'penilai' && is_null($item->user_id))
|
||||||
|
)
|
||||||
|
|
||||||
|
<div id="penilaiId" class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
|
<label class="form-label max-w-56">
|
||||||
|
Penilai yang di tunjuk
|
||||||
|
</label>
|
||||||
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
|
<div class="input-group w-full">
|
||||||
|
<select id="penilai_id" name="penilai_id"
|
||||||
|
class="input tomselect @error('penilai_id') border-danger bg-danger-light @enderror w-full">
|
||||||
|
<option value="">Pilih Penilai</option>
|
||||||
|
@foreach ($teamPenilai as $item)
|
||||||
|
<option value="{{ $item->id }}">{{ $item->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
@if ($penilaianTeam->isEmpty())
|
||||||
|
<option value="pilih_dari_region">pilih dari region berdeda
|
||||||
|
</option>
|
||||||
|
@endif
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
@error('penilai_id')
|
||||||
|
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@elseif($penilaianTeam->isEmpty())
|
||||||
|
<div id="penilaiId" class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
|
<label class="form-label max-w-56">
|
||||||
|
Penilai yang di tunjuk
|
||||||
|
</label>
|
||||||
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
|
<div class="input-group w-full">
|
||||||
|
<select id="penilai_id" name="penilai_id"
|
||||||
|
class="input tomselect @error('penilai_id') border-danger bg-danger-light @enderror w-full">
|
||||||
|
<option value="">Pilih Penilai</option>
|
||||||
|
@foreach ($teamPenilai as $item)
|
||||||
|
<option value="{{ $item->id }}">{{ $item->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
@if ($penilaianTeam->isEmpty())
|
||||||
|
<option value="pilih_dari_region">pilih dari region berdeda
|
||||||
|
</option>
|
||||||
|
@endif
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
@error('penilai_id')
|
||||||
|
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
<div id="penilaiRegion" class="hidden items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
|
<label class="form-label max-w-56">
|
||||||
|
Pilih Region
|
||||||
|
</label>
|
||||||
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
|
<div class="input-group w-full">
|
||||||
|
<select id="penilai_region_id" name="penilai_region_id"
|
||||||
|
class="tomselect input @error('penilai_region_id') border-danger bg-danger-light @enderror w-full">
|
||||||
|
<option value="">Pilih Region</option>
|
||||||
|
|
||||||
|
@if (isset($updateTeamPenilai))
|
||||||
|
@foreach ($updateTeamPenilai as $item)
|
||||||
|
<option value="{{ $item->regions->id }}">
|
||||||
|
{{ $item->regions->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
@endif
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
@error('penilai_region_id')
|
||||||
|
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||||
|
@enderror
|
||||||
</div>
|
</div>
|
||||||
@error('surveyor_id')
|
|
||||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
|
||||||
@enderror
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div id="surveyorRegion" class="hidden items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
||||||
<label class="form-label max-w-56">
|
|
||||||
Pilih Region
|
|
||||||
</label>
|
|
||||||
<div class="flex flex-wrap items-baseline w-full">
|
|
||||||
<div class="input-group w-full">
|
|
||||||
<select id="surveyor_id" name="surveyor_id"
|
|
||||||
class="tomselect input @error('surveyor_id') border-danger bg-danger-light @enderror w-full">
|
|
||||||
<option value="">Pilih Region</option>
|
|
||||||
|
|
||||||
@if (isset($updateTeamPenilai))
|
|
||||||
@foreach ($updateTeamPenilai as $item)
|
|
||||||
<option value="{{ $item->regions->id }}">{{ $item->regions->name }}</option>
|
|
||||||
@endforeach
|
|
||||||
@endif
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
@error('surveyor_id')
|
|
||||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
|
||||||
@enderror
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="penilaiId" class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
||||||
<label class="form-label max-w-56">
|
|
||||||
Penilai yang di tunjuk
|
|
||||||
</label>
|
|
||||||
<div class="flex flex-wrap items-baseline w-full">
|
|
||||||
<div class="input-group w-full">
|
|
||||||
<select id="penilaian_id" name="penilaian_id"
|
|
||||||
class="input tomselect @error('penilaian_id') border-danger bg-danger-light @enderror w-full">
|
|
||||||
<option value="">Pilih Penilai</option>
|
|
||||||
@foreach ($teamPenilai->first()->teamsUsers as $item)
|
|
||||||
<option value="{{ $item->user->id }}">{{ $item->user->name }}</option>
|
|
||||||
@endforeach
|
|
||||||
<option value="pilih_dari_region">pilih dari region berdeda</option>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
@error('penilaian_id')
|
|
||||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
|
||||||
@enderror
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="penilaiRegion" class="hidden items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
||||||
<label class="form-label max-w-56">
|
|
||||||
Pilih Region
|
|
||||||
</label>
|
|
||||||
<div class="flex flex-wrap items-baseline w-full">
|
|
||||||
<div class="input-group w-full">
|
|
||||||
<select id="surveyor_id" name="surveyor_id"
|
|
||||||
class="tomselect input @error('surveyor_id') border-danger bg-danger-light @enderror w-full">
|
|
||||||
<option value="">Pilih Region</option>
|
|
||||||
|
|
||||||
@if (isset($updateTeamPenilai))
|
|
||||||
@foreach ($updateTeamPenilai as $item)
|
|
||||||
<option value="{{ $item->regions->id }}">{{ $item->regions->name }}</option>
|
|
||||||
@endforeach
|
|
||||||
@endif
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
@error('surveyor_id')
|
|
||||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
|
||||||
@enderror
|
|
||||||
</div>
|
|
||||||
</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">
|
||||||
@@ -567,29 +640,29 @@
|
|||||||
|
|
||||||
document.getElementById('surveyor_id').addEventListener('change', function() {
|
document.getElementById('surveyor_id').addEventListener('change', function() {
|
||||||
const selectedValue = this.value;
|
const selectedValue = this.value;
|
||||||
const surveyorRegion = document.getElementById('surveyorRegion');
|
const surveyorRegion = document.getElementById('surveyorRegion');
|
||||||
|
|
||||||
if (selectedValue === 'pilih_dari_region') {
|
if (selectedValue === 'pilih_dari_region') {
|
||||||
surveyorRegion.classList.remove('hidden');
|
surveyorRegion.classList.remove('hidden');
|
||||||
surveyorRegion.classList.add('flex');
|
surveyorRegion.classList.add('flex');
|
||||||
}else{
|
} else {
|
||||||
surveyorRegion.classList.add('hidden');
|
surveyorRegion.classList.add('hidden');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById('penilaian_id').addEventListener('change', function() {
|
document.getElementById('penilaian_id').addEventListener('change', function() {
|
||||||
const selectedValue = this.value;
|
const selectedValue = this.value;
|
||||||
const penilaiRegion = document.getElementById('penilaiRegion');
|
const penilaiRegion = document.getElementById('penilaiRegion');
|
||||||
|
|
||||||
if (selectedValue === 'pilih_dari_region') {
|
if (selectedValue === 'pilih_dari_region') {
|
||||||
penilaiRegion.classList.remove('hidden');
|
penilaiRegion.classList.remove('hidden');
|
||||||
penilaiRegion.classList.add('flex');
|
penilaiRegion.classList.add('flex');
|
||||||
}else{
|
} else {
|
||||||
penilaiRegion.classList.add('hidden');
|
penilaiRegion.classList.add('hidden');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -668,8 +668,10 @@
|
|||||||
</label>
|
</label>
|
||||||
<div class="input-group w-full flex gap-2">
|
<div class="input-group w-full flex gap-2">
|
||||||
<input class="name_rute" type="hidden" name="name_rute[]" value="rute">
|
<input class="name_rute" type="hidden" name="name_rute[]" value="rute">
|
||||||
<input id="inputRute" type="file" name="foto_rute" class="file-input file-input-bordered w-full" accept="image/*">
|
<input id="inputRute" type="file" name="foto_rute"
|
||||||
<button id="mod" type="button" class="btn btn-light" onclick="openModal('gistaru')">
|
class="file-input file-input-bordered w-full" accept="image/*">
|
||||||
|
<button id="gistaru" type="button" class="btn btn-light"
|
||||||
|
onclick="openModal('gistaru')">
|
||||||
<i class="ki-outline ki-abstract-33"></i> Gistaru
|
<i class="ki-outline ki-abstract-33"></i> Gistaru
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -679,9 +681,11 @@
|
|||||||
<span class="form-label">Bumi</span>
|
<span class="form-label">Bumi</span>
|
||||||
</label>
|
</label>
|
||||||
<div class="input-group w-full flex gap-2">
|
<div class="input-group w-full flex gap-2">
|
||||||
<input class="name_rute" type="hidden" name="name_rute[]" value="rute">
|
<input class="name_rute" type="hidden" name="name_rute" value="rute">
|
||||||
<input id="inputRute" type="file" name="foto_rute" class="file-input file-input-bordered w-full" accept="image/*" capture="camera">
|
<input id="inputRute" type="file" name="foto_rute"
|
||||||
<button id="mod" type="button" class="btn btn-light" onclick="openModal('bumi')">
|
class="file-input file-input-bordered w-full" accept="image/*" capture="camera">
|
||||||
|
<button id="bumi" type="button" class="btn btn-light"
|
||||||
|
onclick="openModal('bumi')">
|
||||||
<i class="ki-outline ki-abstract-33"></i> Bumi
|
<i class="ki-outline ki-abstract-33"></i> Bumi
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -759,7 +763,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body" id="screenshotContainer" style="height: 500px">
|
<div class="modal-body" id="screenshotContainer" style="height: 500px">
|
||||||
<iframe id="mapFrameGis" frameborder="0" style="width: 100%; height: 100%;"></iframe>
|
<iframe id="mapFrameGis" style="width: 100%; height: 100%;"></iframe>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer flex justify-end">
|
<div class="modal-footer flex justify-end">
|
||||||
<button id="takeScreenshot" class="btn btn-success">Take Screenshot</button>
|
<button id="takeScreenshot" class="btn btn-success">Take Screenshot</button>
|
||||||
@@ -770,47 +774,53 @@
|
|||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
@push('scripts')
|
@push('scripts')
|
||||||
<script>
|
<script>
|
||||||
function getMap(params) {
|
function getMap(params) {
|
||||||
const iframe = document.getElementById('mapFrameGis');
|
const iframe = document.getElementById('mapFrameGis');
|
||||||
const maps = [
|
const maps = [
|
||||||
'https://gistaru.atrbpn.go.id/rtronline/',
|
'https://gistaru.atrbpn.go.id/rtronline/',
|
||||||
'https://bhumi.atrbpn.go.id/peta'
|
'https://bhumi.atrbpn.go.id/peta'
|
||||||
];
|
];
|
||||||
|
|
||||||
iframe.src = maps[params];
|
iframe.src = maps[params];
|
||||||
}
|
}
|
||||||
|
|
||||||
function openModal(type) {
|
function openModal(type) {
|
||||||
const modal = document.getElementById('mod');
|
const modalGistaru = document.getElementById('gistaru');
|
||||||
modal.setAttribute('data-modal-toggle', '#modal');
|
const modalBumi = document.getElementById('bumi');
|
||||||
|
|
||||||
getMap(type === 'gistaru' ? 0 : 1);
|
if (type === 'bumi') {
|
||||||
}
|
modalBumi.setAttribute('data-modal-toggle', '#modal');
|
||||||
|
}else if (type === 'gistaru') {
|
||||||
|
modalGistaru.setAttribute('data-modal-toggle', '#modal');
|
||||||
|
}
|
||||||
|
|
||||||
document.getElementById('takeScreenshot').addEventListener('click', () => {
|
getMap(type === 'gistaru' ? 0 : 1);
|
||||||
const screenshotContainer = document.getElementById('screenshotContainer');
|
}
|
||||||
const canvas = document.createElement('canvas');
|
|
||||||
canvas.width = screenshotContainer.offsetWidth;
|
|
||||||
canvas.height = screenshotContainer.offsetHeight;
|
|
||||||
const ctx = canvas.getContext('2d');
|
|
||||||
ctx.drawImage(document.getElementById('mapFrame'), 0, 0, canvas.width, canvas.height);
|
|
||||||
const dataURL = canvas.toDataURL('image/jpeg');
|
|
||||||
|
|
||||||
// Tampilkan gambar di atas input
|
document.getElementById('takeScreenshot').addEventListener('click', () => {
|
||||||
const inputRute = document.getElementById('inputRute');
|
const screenshotContainer = document.getElementById('screenshotContainer');
|
||||||
const img = document.createElement('img');
|
const canvas = document.createElement('canvas');
|
||||||
img.src = dataURL;
|
canvas.width = screenshotContainer.offsetWidth;
|
||||||
img.style.maxWidth = '100%';
|
canvas.height = screenshotContainer.offsetHeight;
|
||||||
img.style.maxHeight = '200px';
|
const ctx = canvas.getContext('2d');
|
||||||
inputRute.parentNode.insertBefore(img, inputRute);
|
ctx.drawImage(document.getElementById('mapFrame'), 0, 0, canvas.width, canvas.height);
|
||||||
|
const dataURL = canvas.toDataURL('image/jpeg');
|
||||||
|
|
||||||
// Isi input dengan data URL gambar
|
// Tampilkan gambar di atas input
|
||||||
inputRute.value = dataURL;
|
const inputRute = document.getElementById('inputRute');
|
||||||
});
|
const img = document.createElement('img');
|
||||||
</script>
|
img.src = dataURL;
|
||||||
|
img.style.maxWidth = '100%';
|
||||||
|
img.style.maxHeight = '200px';
|
||||||
|
inputRute.parentNode.insertBefore(img, inputRute);
|
||||||
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
|
// Isi input dengan data URL gambar
|
||||||
|
inputRute.value = dataURL;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
// Fungsi untuk mengambil lokasi pengguna
|
// Fungsi untuk mengambil lokasi pengguna
|
||||||
function getUserLocation() {
|
function getUserLocation() {
|
||||||
|
|||||||
@@ -196,7 +196,7 @@
|
|||||||
|
|
||||||
@if (request()->has('form') && request('form') !== 'data-pembanding')
|
@if (request()->has('form') && request('form') !== 'data-pembanding')
|
||||||
<div class="card-footer">
|
<div class="card-footer">
|
||||||
<form action="{{ route('surveyor.submitSurveyor', $surveyor) }}" method="POST">
|
<form action="{{ route('surveyor.submitSurveyor', $surveyor ) }}" method="POST">
|
||||||
@csrf
|
@csrf
|
||||||
@method('PUT')
|
@method('PUT')
|
||||||
<button type="submit" class="btn btn-primary " {{ $buttonDisable ? 'disabled' : '' }}>
|
<button type="submit" class="btn btn-primary " {{ $buttonDisable ? 'disabled' : '' }}>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
@push('styles')
|
@push('styles')
|
||||||
<style>
|
<style>
|
||||||
.modal {
|
.modal {
|
||||||
|
|
||||||
width: 50%;
|
width: 50%;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@@ -202,10 +202,10 @@
|
|||||||
},
|
},
|
||||||
tanggal_permohonan: {
|
tanggal_permohonan: {
|
||||||
title: 'Tanggal Assigned',
|
title: 'Tanggal Assigned',
|
||||||
render: (item, data) => {
|
// render: (item, data) => {
|
||||||
const createdAt = convertDate(data.penilaian.created_at);
|
// const createdAt = convertDate(data.penilaian.created_at);
|
||||||
return createdAt;
|
// return createdAt;
|
||||||
},
|
// },
|
||||||
},
|
},
|
||||||
|
|
||||||
user_id: {
|
user_id: {
|
||||||
@@ -250,10 +250,10 @@
|
|||||||
dataTable.search(searchValue, true);
|
dataTable.search(searchValue, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
statusFilter.addEventListener('change', function() {
|
// statusFilter.addEventListener('change', function() {
|
||||||
const selectedStatus = this.value;
|
// const selectedStatus = this.value;
|
||||||
dataTable.search(selectedStatus);
|
// dataTable.search(selectedStatus);
|
||||||
});
|
// });
|
||||||
|
|
||||||
function convertDate(date) {
|
function convertDate(date) {
|
||||||
const createdAt = new Date(date);
|
const createdAt = new Date(date);
|
||||||
|
|||||||
Reference in New Issue
Block a user