334 lines
15 KiB
PHP
334 lines
15 KiB
PHP
@extends('layouts.master')
|
|
@section('page-title')
|
|
Permits | {{ $page_title }}
|
|
@endsection
|
|
@section('page-css')
|
|
@media (max-width: 768px) {
|
|
#permit-map { height: 350px; }
|
|
}
|
|
|
|
@endsection
|
|
@section('page-content')
|
|
@include('permits.partials.pdf-modal')
|
|
@include('layouts.partials.permits-navbar')
|
|
<div class="container">
|
|
<div class="row">
|
|
<div class="col-md-7">
|
|
<div class="d-flex justify-content-between align-items-center mb-4 mt-2">
|
|
<h1 class="display-6 fw-bold text-dark">{{ $permit_arr['application_code'] }} <span class="badge bg-warning text-dark">{{ $permit_arr['status'] }}</span></h1>
|
|
</div>
|
|
|
|
<!-- Map Area -->
|
|
<!-- <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> -->
|
|
<!-- <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">
|
|
|
|
|
|
<h3 class="section-title">Actual Project Location</h3>
|
|
|
|
<div class="row mb-3">
|
|
<label for="permitLocation" class="form-label fw-bold text-primary">Coordinates *</label>
|
|
<input type="text" name="permit_location" id="permitLocation" class="form-control">
|
|
</div>
|
|
<div class="row mb-3">
|
|
<label for="permitUPN" class="form-label fw-bold text-primary">UPN</label>
|
|
<input type="text" name="permit_upn" id="permitUPN" class="form-control">
|
|
</div>
|
|
<div class="row mb-3">
|
|
<div class="d-flex gap-1">
|
|
<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">
|
|
<label for="processingFee" class="form-label fw-bold text-primary">Permit Fee *</label>
|
|
<input type="text" name="processing_fees" id="processingFee" class="form-control">
|
|
</div>
|
|
<div class="row mb-3">
|
|
<div class="d-flex gap-1">
|
|
<button class="btn btn-primary flex-fill"><i class="fa-solid fa-paper-plane"></i> Submit</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-5">
|
|
<!-- Remarks -->
|
|
<div class="details-section mt-2">
|
|
<h2 class="section-title text-primary">
|
|
Applicant & Property Details
|
|
</h2>
|
|
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<!-- <h6 class="detail-label">Project Description</h6> -->
|
|
<p class="detail-value"></p>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<h6 class="detail-label">Name</h6>
|
|
<p class="detail-value">{{ $permit_arr['applicant_name'] }}</p>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<h6 class="detail-label">Nationality</h6>
|
|
<p class="detail-value">{{ $permit_arr['nationality'] }}</p>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<h6 class="detail-label">Email</h6>
|
|
<p class="detail-value">{{ $permit_arr['email'] }}</p>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<h6 class="detail-label">Telephone Number</h6>
|
|
<p class="detail-value">{{ $permit_arr['phone'] }}</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<h6 class="detail-label">Address</h6>
|
|
<p class="detail-value">{{ $permit_arr['address'] }}, {{ $permit_arr['city'] }}, {{ $permit_arr['region'] }}</p>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<h6 class="detail-label">Project Location</h6>
|
|
<p class="detail-value">{{ $permit_arr['project_location'] }}</p>
|
|
</div>
|
|
<!-- <div class="col-md-4">
|
|
<h6 class="detail-label">Parcel Size</h6>
|
|
<p class="detail-value">0.25 Acre</p>
|
|
</div> -->
|
|
<div class="col-md-6">
|
|
<h6 class="detail-label">Permit Type</h6>
|
|
<p class="detail-value">{{ $permit_arr['permit_type'] }}</p>
|
|
</div>
|
|
|
|
<div class="col-md-12">
|
|
<h6 class="detail-label">Description</h6>
|
|
<p class="detail-value">{{ $permit_arr['project_description'] }}</p>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<h6 class="detail-label">Purpose</h6>
|
|
<p class="detail-value">{{ $permit_arr['land_request_use'] }}</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Planning Permit Application -->
|
|
<div class="details-section mt-4">
|
|
<h2 class="section-title text-primary">Documents</h2>
|
|
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<!-- <h6 class="detail-label">Architectural Drawings</h6> -->
|
|
<p class="detail-value">
|
|
<a href="#" class="btn btn-link" data-bs-toggle="modal" data-bs-target="#pdfModal" data-pdf-url="{{ route('view.pdf', ['filename' => 'site_plan.pdf']) }}">
|
|
<i class="fa-solid fa-paperclip"></i> Site Plan
|
|
</a>
|
|
<!-- <a href="" class="btn btn-link"><i class="fa-solid fa-paperclip"></i> Site Plan</a> -->
|
|
</p>
|
|
<p class="detail-value">
|
|
<!-- <a href="" class="btn btn-link"><i class="fa-solid fa-paperclip"></i> Architectural Drawings</a> -->
|
|
<a href="#" class="btn btn-link" data-bs-toggle="modal" data-bs-target="#pdfModal" data-pdf-url="{{ route('view.pdf', ['filename' => 'architectural_drawing.pdf']) }}">
|
|
<i class="fa-solid fa-paperclip"></i> Architectural Drawings
|
|
</a>
|
|
</p>
|
|
<!-- <p class="detail-value"><a href="" class="btn btn-link"><i class="fa-solid fa-paperclip"></i> Working Drawing</a></p> -->
|
|
|
|
</div>
|
|
<div class="col-md-6">
|
|
<!-- <h6 class="detail-label">Others</h6> -->
|
|
|
|
<p class="detail-value">
|
|
<!-- <a href="" class="btn btn-link"><i class="fa-solid fa-paperclip"></i> Block Plan</a> -->
|
|
<a href="#" class="btn btn-link" data-bs-toggle="modal" data-bs-target="#pdfModal" data-pdf-url="{{ route('view.pdf', ['filename' => 'block_plan.pdf']) }}">
|
|
<i class="fa-solid fa-paperclip"></i> Block Plan
|
|
</a>
|
|
</p>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<!-- <h6 class="detail-label">Architectural Drawings</h6> -->
|
|
<!-- <p class="detail-value"><a href="" class="btn btn-link"><i class="fa-solid fa-paperclip"></i> Zoning Report</a></p> -->
|
|
<!-- <p class="detail-value"><a href="" class="btn btn-link"><i class="fa-solid fa-paperclip"></i> Working Drawing</a></p> -->
|
|
|
|
</div>
|
|
<!-- <div class="col-md-6">
|
|
<p class="detail-value"><a href="" class="btn btn-link"><i class="fa-solid fa-paperclip"></i> Site Plan</a></p>
|
|
<p class="detail-value"><a href="" class="btn btn-link"><i class="fa-solid fa-paperclip"></i> Title Certificate</a></p>
|
|
</div> -->
|
|
</div>
|
|
</div>
|
|
<div class="details-section mt-4">
|
|
<h2 class="section-title text-primary">Duration</h2>
|
|
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<h6 class="detail-label">Date of Application</h6>
|
|
<p class="detail-value">
|
|
<?php
|
|
$originalDate = "2023-05-31 01:16:06";
|
|
$unixTime = strtotime($permit_arr['submitted_at']);
|
|
$normal_datetime = date("jS F, Y @ g:i A", $unixTime);
|
|
|
|
echo $normal_datetime;
|
|
?>
|
|
</p>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<h6 class="detail-label">Processing Days Remaining</h6>
|
|
<p class="detail-value">
|
|
<span class="badge bg-warning text-dark">
|
|
<?php
|
|
if ($permit_arr['status'] == 'submitted') {
|
|
echo "N/A";
|
|
}
|
|
?>
|
|
</span>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="remarks-section">
|
|
<h3 class="section-title">Remarks</h3>
|
|
<div class="row mb-3">
|
|
<label for="permitCurrentStatus" class="form-label fw-bold text-primary"><i class="fa-solid fa-temperature-three-quarters"></i> Status Update</label>
|
|
@if(in_array(session('current_user.ua_position'), $allowed_users_to_comment))
|
|
<select class="form-select form-select-lg" id="permitCurrentStatus">
|
|
<option value="" selected disabled>First select status ...</option>
|
|
<option value="status_five">Applicant to Review</option>
|
|
<option value="status_one">Application Received</option>
|
|
<option value="status_two" disabled>Application Accepted</option>
|
|
<option value="status_three" disabled>Permit Pending TSC Review</option>
|
|
<option value="status_four" disabled>Permit Pending SPC Decision</option>
|
|
<option value="status_five" disabled>Permit Approved (In Principle)</option>
|
|
<option value="status_size" disabled>Permit Approved</option>
|
|
<option value="status_seven" disabled>Permit Refused</option>
|
|
<option value="status_eight" disabled>Permit Deferred</option>
|
|
</select>
|
|
@else
|
|
<p class="badge bg-success text-dark">You don't have the right permission to update the status.</p>
|
|
@endif
|
|
</div>
|
|
<div class="row mb-3">
|
|
@if(in_array(session('current_user.ua_position'), $allowed_users_to_comment))
|
|
<textarea class="form-control mb-3" rows="4" placeholder="Write a message" ></textarea>
|
|
@else
|
|
<p class="badge bg-info text-dark">You don't have the right permission to add comments.</p>
|
|
@endif
|
|
|
|
</div>
|
|
<div class="row mb-3">
|
|
<div class="d-flex gap-1">
|
|
<button class="btn btn-primary flex-fill"><i class="fa-solid fa-paper-plane"></i> Submit</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
@endsection
|
|
@section('page-js')
|
|
<!-- <script src="{{ url('public/assets/libs/select2/dist/js/select2.full.min.js') }}" type="text/javascript" ></script> -->
|
|
|
|
|
|
<!-- <script src="{{ url('public/assets/js/permit_tools.js') }}" type="text/javascript" ></script> -->
|
|
|
|
<script type="text/javascript">
|
|
$(document).ready(function(){
|
|
|
|
var pdfModal = document.getElementById('pdfModal');
|
|
pdfModal.addEventListener('show.bs.modal', function (event) {
|
|
// Button that triggered the modal
|
|
var button = event.relatedTarget;
|
|
// Extract info from data-bs-* attributes
|
|
var pdfUrl = button.getAttribute('data-pdf-url');
|
|
// Update the modal's iframe src
|
|
var pdfIframe = document.getElementById('pdfIframe');
|
|
pdfIframe.src = pdfUrl;
|
|
});
|
|
|
|
// Optional: Clear the iframe src when the modal is closed to stop the stream
|
|
pdfModal.addEventListener('hidden.bs.modal', function () {
|
|
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>
|
|
|
|
@endsection
|