feat(master-land-officer): create master land page for officer
This commit is contained in:
parent
5f072c208c
commit
77ec8b40fe
|
@ -427,7 +427,10 @@ function getDistricts(regencyId) {
|
|||
});
|
||||
}
|
||||
|
||||
async function updateData(land) {
|
||||
async function updateData(data) {
|
||||
const land = data.land;
|
||||
const userRole = data.role;
|
||||
|
||||
var ownerEditField = formEdit.querySelector("#owner-edit-field");
|
||||
var noHpEditField = formEdit.querySelector("#nohp-edit-field");
|
||||
var rentalPriceEditField = formEdit.querySelector(
|
||||
|
@ -550,15 +553,27 @@ async function updateData(land) {
|
|||
latEditField.value = land.latitude;
|
||||
lngEditField.value = land.longitude;
|
||||
|
||||
formEdit.action = "/data-lahan/" + land.id;
|
||||
if (userRole === "admin") {
|
||||
formEdit.action = "/data-lahan/" + land.id;
|
||||
} else {
|
||||
formEdit.action = "/data-lahan-petugas/" + land.id;
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
function deleteData(id) {
|
||||
function deleteData(data) {
|
||||
const landId = data.landId;
|
||||
const userRole = data.role;
|
||||
|
||||
var form = document.getElementById("delete-form");
|
||||
form.action = "/data-lahan/" + id;
|
||||
|
||||
if (userRole === "admin") {
|
||||
form.action = "/data-lahan/" + landId;
|
||||
} else {
|
||||
form.action = "/data-lahan-petugas/" + landId;
|
||||
}
|
||||
}
|
||||
|
||||
var perPage = 10,
|
||||
|
|
|
@ -100,13 +100,13 @@ class="fw-medium link-primary">#VZ2101</a></td>
|
|||
<div class="edit">
|
||||
<button class="btn btn-sm btn-warning edit-item-btn"
|
||||
data-bs-toggle="modal" data-bs-target="#editModal"
|
||||
onclick="updateData({{ $land }})">Edit</button>
|
||||
onclick="updateData({{ json_encode(['land' => $land, 'role' => Auth::user()->role]) }})">Edit</button>
|
||||
</div>
|
||||
<div class="remove">
|
||||
<button class="btn btn-sm btn-danger remove-item-btn"
|
||||
data-bs-toggle="modal"
|
||||
data-bs-target="#deleteRecordModal"
|
||||
onclick="deleteData({{ $land->id }})">Hapus</button>
|
||||
onclick="deleteData({{ json_encode(['landId' => $land->id, 'role' => Auth::user()->role]) }})">Hapus</button>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
@ -154,8 +154,9 @@ class="fw-medium link-primary">#VZ2101</a></td>
|
|||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"
|
||||
id="close-modal"></button>
|
||||
</div>
|
||||
<form action="{{ route('master_data.lahan.store') }}" class="needs-validation" method="POST"
|
||||
novalidate id="add-form">
|
||||
<form
|
||||
action="{{ Auth::user()->role == 'admin' ? route('master_data.lahan.store') : route('lahan.store') }}"
|
||||
class="needs-validation" method="POST" novalidate id="add-form">
|
||||
@csrf
|
||||
<div class="modal-body">
|
||||
|
||||
|
|
|
@ -93,6 +93,12 @@ class="nav-link {{ request()->routeIs('master_data.aturan.*') ? 'active' : '' }}
|
|||
data-key="t-dashboards">Dashboards</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link menu-link {{ request()->routeIs('lahan.index') ? 'active' : '' }}"
|
||||
href="{{ route('lahan.index') }}">
|
||||
<i class="ri-plant-fill"></i> <span data-key="t-dashboards">Data Lahan</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link menu-link {{ request()->routeIs('assesment_form.index') ? 'active' : '' }}"
|
||||
href="{{ route('assesment_form.index') }}">
|
||||
|
|
|
@ -116,5 +116,12 @@
|
|||
Route::prefix('riwayat-penilaian-lahan')->controller(AssessmentHistoryController::class)->name('assessment_history_officer.')->group(function () {
|
||||
Route::get('/', 'officer')->name('index');
|
||||
});
|
||||
|
||||
Route::prefix('data-lahan-petugas')->controller(LandController::class)->name('lahan.')->group(function () {
|
||||
Route::get('/', 'index')->name('index');
|
||||
Route::post('/', 'store')->name('store');
|
||||
Route::put('/{id}', 'update')->name('update');
|
||||
Route::delete('/{id}', 'destroy')->name('destroy');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue