added integration for permit details page map
This commit is contained in:
parent
d027b5f128
commit
7f17a8ec91
@ -138,6 +138,18 @@ class AdminController extends Controller
|
||||
];
|
||||
return view('common.notready', $data);
|
||||
}
|
||||
public function feefixing(){
|
||||
$data = [
|
||||
'page_title' => "Page Under Development"
|
||||
];
|
||||
return view('common.notready', $data);
|
||||
}
|
||||
public function districtsettings(){
|
||||
$data = [
|
||||
'page_title' => "Page Under Development"
|
||||
];
|
||||
return view('common.notready', $data);
|
||||
}
|
||||
public function systempermissions(){
|
||||
$data = [
|
||||
'page_title' => "System Permissions"
|
||||
|
||||
@ -18,6 +18,14 @@ class PermitsController extends Controller
|
||||
]);
|
||||
$result = ApiCalls::CurlPost($data, $url);
|
||||
// dd($result);
|
||||
|
||||
|
||||
// { "id":163,"applicant_id":376,"client_generated_id":"7d707dc2-938f-47e7-8979-2def086d4a8d","application_code":"REQ-20260310-2ZK4","permit_type":"Development Permit","permit_form_type":"structural_alteration","project_description":"jkhghhjghjgh","project_location":"mbvmbnv","project_region_id":10,"project_district_id":122,"estimated_cost":0.00,"status":"submitted","property_size":null,"expected_completion_date":null,"is_paid":null,"submitted_at":"2026-03-10T09:18:04.224672","updated_at":"2026-03-10T09:18:04.224672"},
|
||||
// {"id":313,"applicant_id":482,"client_generated_id":"34ceb996-c809-4dbe-ba27-df1527e75538","application_code":"REQ-20260312-22AL","permit_type":"Development Permit","permit_form_type":"erection_of_building","project_description":"Two floor residence","project_location":"Butumagyabu","project_region_id":10,"project_district_id":122,"estimated_cost":0.00,"status":"submitted","property_size":null,"expected_completion_date":null,"is_paid":null,"submitted_at":"2026-03-12T13:14:04.420739","updated_at":"2026-03-12T13:14:04.420739"}]}
|
||||
|
||||
|
||||
|
||||
|
||||
$result = json_decode($result, true);
|
||||
// dd(is_array($result['data']));
|
||||
|
||||
|
||||
@ -197,7 +197,7 @@ class UsersController extends Controller
|
||||
$user_data = [
|
||||
'full_name' => $request['full_name'],
|
||||
'username' => $request['username'],
|
||||
// 'ua_position' => $request['ua_position'],
|
||||
'ua_position' => $request['ua_position'],
|
||||
'user_id' => $request['user_id'],
|
||||
'email' => $request['email'],
|
||||
'title' => $request['title'],
|
||||
@ -214,7 +214,8 @@ class UsersController extends Controller
|
||||
$result = ApiCalls::CurlPost($data, $url);
|
||||
$result = json_decode($result, true);
|
||||
// dd($result);
|
||||
if (request()->expectsJson()) {
|
||||
// return response()->json($result);
|
||||
if ($request->expectsJson()) {
|
||||
return response()->json($result);
|
||||
}
|
||||
}
|
||||
|
||||
@ -207,8 +207,20 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
card.addEventListener("click", function () {
|
||||
const title = card.querySelector(".card-title").textContent;
|
||||
console.log(title);
|
||||
window.location.href = "/admin/permissions";
|
||||
|
||||
if (title === 'Permissions') {
|
||||
window.location.href = "/admin/permissions";
|
||||
}
|
||||
else if(title === 'Fee Fixing'){
|
||||
window.location.href = "/admin/feefixing";
|
||||
}
|
||||
else if(title === 'District Settings'){
|
||||
window.location.href = "/admin/districtsettings";
|
||||
}
|
||||
else{
|
||||
console.log('no show');
|
||||
return false;
|
||||
}
|
||||
// Map settings to placeholder pages (can be updated later)
|
||||
// const settingsMap = {
|
||||
// General: "#general-settings",
|
||||
|
||||
@ -99,9 +99,10 @@ $(document).ready(function(){
|
||||
},
|
||||
beforeSend: function() {
|
||||
$('#editSuccessArea').text("");
|
||||
$('#editErrorArea').text("Please wait ... loading user details!");
|
||||
$('#editErrorArea').text("Please wait ... loading user details!!");
|
||||
},
|
||||
success: function(data) {
|
||||
$('#editErrorArea').text('');
|
||||
var jason = data.data;
|
||||
if(data.success == true){
|
||||
var allowedAppsArray = [];
|
||||
@ -246,6 +247,7 @@ $(document).ready(function(){
|
||||
url: base_url + '/userupdate',
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
beforeSend: function() {
|
||||
@ -255,7 +257,8 @@ $(document).ready(function(){
|
||||
// $('#updateResultsParagraph').text("Processing Please wait ...");
|
||||
},
|
||||
success: function(data) {
|
||||
// console.log(data['success']);
|
||||
console.log(data);
|
||||
console.log(data['success']);
|
||||
if (data['success'] == true) {
|
||||
$('#editSuccessArea').removeClass('d-none');
|
||||
$('#editErrorArea').addClass('d-none');
|
||||
|
||||
@ -52,7 +52,7 @@
|
||||
<div class="card-icon mb-3">
|
||||
<i class="fas fa-credit-card"></i>
|
||||
</div>
|
||||
<h3 class="card-title mb-2">Fee Fixing </h3>
|
||||
<h3 class="card-title mb-2">Fee Fixing</h3>
|
||||
<p class="card-description mb-0">View current fees</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -56,7 +56,9 @@
|
||||
<input type="hidden" class="userIdinput" value="<?php echo $row['user_id'] ?>" name="userId">
|
||||
|
||||
<!-- <a href="" data-bs-toggle="modal" data-bs-target="#viewUserModal" ><img src="{{ url('public/assets/libs/bootstrap-icons/eye.svg') }}" alt="view icon" width="16" height="16"></a> -->
|
||||
<a href="" class="editUserBtn" data-bs-toggle="modal" data-bs-target="#editUserModal"><img src="{{ url('public/assets/libs/bootstrap-icons/pencil-square.svg') }}" alt="edit icon" width="16" height="16"></a>
|
||||
<a href="" class="editUserBtn" data-bs-toggle="modal" data-bs-target="#editUserModal">
|
||||
<img src="{{ url('public/assets/libs/bootstrap-icons/pencil-square.svg') }}" alt="edit icon" width="16" height="16">
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
|
||||
@ -3,6 +3,9 @@
|
||||
Permits | {{ $page_title }}
|
||||
@endsection
|
||||
@section('page-css')
|
||||
@media (max-width: 768px) {
|
||||
#permit-map { height: 350px; }
|
||||
}
|
||||
|
||||
@endsection
|
||||
@section('page-content')
|
||||
@ -16,12 +19,22 @@
|
||||
</div>
|
||||
|
||||
<!-- Map Area -->
|
||||
<div class="map-container mb-4">
|
||||
<!-- <div class="map-container mb-4"> -->
|
||||
<!-- <div id="applicationmap" class="applicationmap" style="width: 100%; height: 100vH;"></div> -->
|
||||
<div><img src="{{ url('public/assets/images/grey-map-with-location-pin.jpg') }}" height="500px" width="801px"></div>
|
||||
<!-- <div><img src="{{ url('public/assets/images/grey-map-with-location-pin.jpg') }}" height="500px" width="801px"></div> -->
|
||||
<!-- <img src="https://placeholdit.com/900x200/dddddd/999999?text=Project+Location" alt="Project Location" class="img-fluid" /> -->
|
||||
<!-- </div> -->
|
||||
<div class="map-container mb-4">
|
||||
<iframe id="permit-map"
|
||||
src="https://pwa.lupmis4luspa.org/embed?mode=permit&application_code={{ urlencode($permit_arr['application_code']) }}{{ !empty($permit_arr['lon']) ? '&lon='.urlencode($permit_arr['lon']).'&lat='.urlencode($permit_arr['lat']) : '' }}{{ !empty($permit_arr['upn']) ? '&upn='.urlencode($permit_arr['upn']) : '' }}"
|
||||
style="width:100%;height:500px;border:0;border-radius:8px;"
|
||||
allow="geolocation; clipboard-write"
|
||||
referrerpolicy="strict-origin-when-cross-origin"
|
||||
loading="lazy"
|
||||
title="Permit location map"></iframe>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Applicant & Property Details -->
|
||||
<div class="remarks-section">
|
||||
|
||||
@ -38,7 +51,7 @@
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="d-flex gap-1">
|
||||
<button class="btn btn-warning btn-sm flex-fill"><i class="fa-solid fa-map"></i> Check Compliance</button>
|
||||
<button class="btn btn-warning btn-sm flex-fill" id="checkComplianceBtn"><i class="fa-solid fa-map"></i> Check Compliance</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
@ -254,6 +267,66 @@
|
||||
var pdfIframe = document.getElementById('pdfIframe');
|
||||
pdfIframe.src = '';
|
||||
});
|
||||
|
||||
const MAP_ORIGIN = 'https://pwa.lupmis4luspa.org';
|
||||
const iframe = document.getElementById('permit-map');
|
||||
const upnInput = document.getElementById('permitUPN');
|
||||
const locInput = document.getElementById('permitLocation');
|
||||
|
||||
// --- Receive events FROM the map ---
|
||||
window.addEventListener('message', function (event) {
|
||||
if (event.origin !== MAP_ORIGIN) return; // SECURITY
|
||||
const msg = event.data;
|
||||
if (!msg || typeof msg !== 'object') return;
|
||||
|
||||
switch (msg.type) {
|
||||
case 'ready':
|
||||
@if(!empty($permit_arr['upn']))
|
||||
iframe.contentWindow.postMessage(
|
||||
{ type: 'set:selected', upn: @json($permit_arr['upn']) },
|
||||
MAP_ORIGIN);
|
||||
@endif
|
||||
break;
|
||||
|
||||
case 'parcel:select':
|
||||
upnInput.value = msg.upn || '';
|
||||
locInput.value = (msg.lon != null && msg.lat != null)
|
||||
? msg.lat.toFixed(6) + ', ' + msg.lon.toFixed(6)
|
||||
: '';
|
||||
upnInput.dataset.parcelId = msg.parcel_id || '';
|
||||
upnInput.dataset.zoneCode = msg.zone_code || '';
|
||||
break;
|
||||
|
||||
case 'parcel:cleared':
|
||||
upnInput.value = '';
|
||||
locInput.value = '';
|
||||
delete upnInput.dataset.parcelId;
|
||||
delete upnInput.dataset.zoneCode;
|
||||
break;
|
||||
|
||||
case 'error':
|
||||
console.warn('[permit-map]', msg.code, msg.message);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
// --- Wire "Check Compliance" to use what the map gave us ---
|
||||
// $('button:contains("Check Compliance")').on('click', function (e) {
|
||||
|
||||
$('#checkComplianceBtn').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
const payload = {
|
||||
application_code: @json($permit_arr['application_code']),
|
||||
upn: upnInput.value,
|
||||
parcel_id: upnInput.dataset.parcelId || null,
|
||||
coordinates: locInput.value,
|
||||
zone_code: upnInput.dataset.zoneCode || null,
|
||||
};
|
||||
$.ajax({ url: '{{ route("permits.checkCompliance") }}',
|
||||
method: 'POST', data: payload })
|
||||
.done(function (res) { /* render compliance result */ });
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@ -53,6 +53,8 @@ Route::middleware([CheckBackendSession::class])->group(function () {
|
||||
|
||||
Route::get('/admin/search', [App\Http\Controllers\AdminController::class, 'index']);
|
||||
Route::get('/admin/districtparams', [App\Http\Controllers\AdminController::class, 'districtparams']);
|
||||
Route::get('/admin/feefixing', [App\Http\Controllers\AdminController::class, 'feefixing']);
|
||||
Route::get('/admin/districtsettings', [App\Http\Controllers\AdminController::class, 'districtsettings']);
|
||||
Route::get('/admin/luspaparams', [App\Http\Controllers\AdminController::class, 'luspaparams']);
|
||||
Route::get('/admin/reports', [App\Http\Controllers\AdminController::class, 'reports']);
|
||||
Route::get('/admin/districts/{region_id}', [App\Http\Controllers\AdminController::class, 'districts']);
|
||||
@ -72,6 +74,7 @@ Route::middleware([CheckBackendSession::class])->group(function () {
|
||||
|
||||
|
||||
Route::get('/permits/home', [App\Http\Controllers\PermitsController::class, 'index']);
|
||||
Route::post('/permits/checkcompliance', [App\Http\Controllers\PermitsController::class, 'checkCompliance'])->name('permits.checkCompliance');
|
||||
Route::get('/permits/districtsettings', [App\Http\Controllers\PermitsController::class, 'settings']);
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user