feat: Implement tabbed interface for sidebar inquiry modal
This commit is contained in:
1 parent
b70c7ba301
commit
6488f33844
1 file changed
+133
-71
@@ -17,47 +17,125 @@
|
||||
</div>
|
||||
<!-- Modal Body -->
|
||||
<div class="flex-1 overflow-y-auto p-4 sm:p-6">
|
||||
|
||||
<!-- Inquiry Form View -->
|
||||
<div id="inquiry-form-view">
|
||||
<!-- Modal Content -->
|
||||
<div class="bg-white h-auto lg:h-full overflow-y-auto">
|
||||
<h2 class="text-lg font-semibold text-gray-800 mb-1 font-heading">Cozy coworking space in the heart of the south</h2>
|
||||
<p class="text-xs text-gray-600 mb-2">Incub8 space, Centennial Road, Brgy. Batong Dalig, Kawit, Cavite</p>
|
||||
<p class="text-xs text-gray-500 mb-3">5 hrs ago</p>
|
||||
|
||||
<!-- Image -->
|
||||
<img src="assets/img/SAMPLE3.png" alt="Sample" class="h-48 sm:h-56 w-full object-cover rounded-base mb-4">
|
||||
<!-- Static Info: Title, Address Snippet, Posted Ago -->
|
||||
<div class="mb-4">
|
||||
<h2 class="text-xl font-semibold text-gray-800 mb-1 font-heading">Cozy coworking space in the heart of the south</h2>
|
||||
<p class="text-xs text-gray-600 mb-1">Incub8 space, Centennial Road, Brgy. Batong Dalig, Kawit, Cavite</p>
|
||||
<p class="text-xs text-gray-500">Posted 5 hrs ago</p>
|
||||
</div>
|
||||
|
||||
<!-- Action Buttons -->
|
||||
<div class="flex justify-between items-center gap-2 mb-4 flex-wrap">
|
||||
<div class="flex gap-2"> <!-- Group for left-aligned icons -->
|
||||
<div class="w-10 h-10 bg-gray-100 rounded-full flex items-center justify-center hover:border-indigo-700 border-2 border-transparent cursor-pointer">
|
||||
<div class="w-10 h-10 bg-gray-100 rounded-full flex items-center justify-center hover:border-indigo-700 border-2 border-transparent cursor-pointer" title="Call">
|
||||
<img src="assets/svg/icon_call.svg" class="w-5 h-5" alt="Call">
|
||||
</div>
|
||||
<div onclick="showMapView()" class="w-10 h-10 bg-gray-100 rounded-full flex items-center justify-center hover:border-indigo-700 border-2 border-transparent cursor-pointer" title="View Map & Directions">
|
||||
<img src="assets/svg/icon_directions.svg" class="w-5 h-5" alt="Pin">
|
||||
<div onclick="switchInquiryTab('location')" class="w-10 h-10 bg-gray-100 rounded-full flex items-center justify-center hover:border-indigo-700 border-2 border-transparent cursor-pointer" title="View Map & Directions">
|
||||
<img src="assets/svg/icon_directions.svg" class="w-5 h-5" alt="Directions">
|
||||
</div>
|
||||
<div class="w-10 h-10 bg-gray-100 rounded-full flex items-center justify-center hover:border-indigo-700 border-2 border-transparent cursor-pointer">
|
||||
<div class="w-10 h-10 bg-gray-100 rounded-full flex items-center justify-center hover:border-indigo-700 border-2 border-transparent cursor-pointer" title="Copy Link">
|
||||
<img src="assets/svg/icon_link.svg" class="w-5 h-5" alt="Link">
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex gap-2"> <!-- Group for right-aligned icons -->
|
||||
<div class="w-10 h-10 bg-gray-100 rounded-full flex items-center justify-center hover:border-indigo-700 border-2 border-transparent cursor-pointer">
|
||||
<div class="w-10 h-10 bg-gray-100 rounded-full flex items-center justify-center hover:border-indigo-700 border-2 border-transparent cursor-pointer" title="Report Listing">
|
||||
<img src="assets/svg/icon_report.svg" class="w-5 h-5" alt="Report">
|
||||
</div>
|
||||
<div class="w-10 h-10 bg-gray-100 rounded-full flex items-center justify-center hover:border-indigo-700 border-2 border-transparent cursor-pointer">
|
||||
<div class="w-10 h-10 bg-gray-100 rounded-full flex items-center justify-center hover:border-indigo-700 border-2 border-transparent cursor-pointer" title="Add to Favorites">
|
||||
<img src="assets/svg/icon_like.svg" class="w-5 h-5" alt="Like">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Form Fields -->
|
||||
<!-- Tab Navigation -->
|
||||
<div class="border-b border-gray-200 mb-4">
|
||||
<nav class="-mb-px flex space-x-4" aria-label="Tabs">
|
||||
<button onclick="switchInquiryTab('details')" id="tab-details" class="inquiry-tab-button whitespace-nowrap py-3 px-1 border-b-2 font-medium text-sm text-indigo-600 border-indigo-500" aria-current="page">
|
||||
Details
|
||||
</button>
|
||||
<button onclick="switchInquiryTab('location')" id="tab-location" class="inquiry-tab-button whitespace-nowrap py-3 px-1 border-b-2 font-medium text-sm text-gray-500 hover:text-gray-700 hover:border-gray-300 border-transparent">
|
||||
Location
|
||||
</button>
|
||||
<button onclick="switchInquiryTab('inquire')" id="tab-inquire" class="inquiry-tab-button whitespace-nowrap py-3 px-1 border-b-2 font-medium text-sm text-gray-500 hover:text-gray-700 hover:border-gray-300 border-transparent">
|
||||
Inquire
|
||||
</button>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<!-- Tab Content Panels -->
|
||||
<div id="details-tab-content" class="inquiry-tab-content space-y-4">
|
||||
<!-- Listing Photo -->
|
||||
<img src="assets/img/SAMPLE3.png" alt="Listing Photo" class="h-56 w-full object-cover rounded-base mb-4">
|
||||
|
||||
<!-- Description -->
|
||||
<div>
|
||||
<h3 class="text-md font-semibold text-gray-800 mb-1 font-heading">Description</h3>
|
||||
<p class="text-sm text-gray-600">
|
||||
A vibrant and fully-equipped coworking space designed for productivity and collaboration. Enjoy high-speed internet, comfortable workstations, meeting rooms, and a supportive community. Perfect for freelancers, startups, and remote teams.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Space Type -->
|
||||
<div>
|
||||
<h3 class="text-md font-semibold text-gray-800 mb-1 font-heading">Space Type</h3>
|
||||
<p class="text-sm text-gray-600">Coworking Desk</p>
|
||||
</div>
|
||||
|
||||
<!-- Pricing -->
|
||||
<div>
|
||||
<h3 class="text-md font-semibold text-gray-800 mb-1 font-heading">Pricing</h3>
|
||||
<p class="text-sm text-gray-600">₱1,200 / Daily</p>
|
||||
</div>
|
||||
|
||||
<!-- Availability Date Range -->
|
||||
<div>
|
||||
<h3 class="text-md font-semibold text-gray-800 mb-2 font-heading">Availability Dates</h3>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-3">
|
||||
{% include calendar_input.liquid id="inquiry_start_date" label="Available From" placeholder="YYYY-MM-DD" %}
|
||||
{% include calendar_input.liquid id="inquiry_end_date" label="Available Until" placeholder="YYYY-MM-DD" align_popup="right" %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Weekly Availability -->
|
||||
<div>
|
||||
<h3 class="text-md font-semibold text-gray-800 mb-1 font-heading">Weekly Hours</h3>
|
||||
<ul class="text-sm text-gray-600 list-disc pl-5 space-y-1">
|
||||
<li>Monday: 9:00 AM - 6:00 PM</li>
|
||||
<li>Wednesday: 9:00 AM - 6:00 PM</li>
|
||||
<li>Friday: 9:00 AM - 5:00 PM</li>
|
||||
<li>Saturday: 10:00 AM - 4:00 PM (By appointment)</li>
|
||||
<li><span class="font-medium">Tuesday, Thursday, Sunday:</span> Closed</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="location-tab-content" class="inquiry-tab-content hidden space-y-4">
|
||||
<button type="button" onclick="switchInquiryTab('details')" class="mb-2 inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md bg-gray-100 text-indigo-900 font-semibold hover:border-indigo-700 font-heading">
|
||||
<svg class="w-5 h-5 mr-2 -ml-1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
||||
<path fill-rule="evenodd" d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
Back to Details
|
||||
</button>
|
||||
<h3 class="text-md font-semibold text-gray-800 mb-1 font-heading">Location for Cozy coworking space</h3>
|
||||
<p class="text-sm text-gray-600 mb-3">Incub8 space, Centennial Road, Brgy. Batong Dalig, Kawit, Cavite</p>
|
||||
|
||||
<div id="mapbox-map-container-inquiry" class="h-64 sm:h-80 w-full bg-gray-200 rounded-base mb-4 border border-gray-300 flex items-center justify-center text-gray-500 p-4 text-center">
|
||||
Map will load here. Ensure Mapbox GL JS is initialized and targets this container.
|
||||
</div>
|
||||
<a href="https://www.google.com/maps/dir/?api=1&destination=Incub8+space,+Centennial+Road,+Brgy.+Batong+Dalig,+Kawit,+Cavite" target="_blank" rel="noopener noreferrer" class="w-full bg-indigo-900 text-gray-100 font-semibold py-2 px-4 rounded-lg inline-flex items-center justify-center border-2 border-transparent hover:border-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 font-heading">
|
||||
Get Directions
|
||||
</a>
|
||||
<p class="text-xs mt-2 text-gray-600 font-thin text-center">
|
||||
Opens Google Maps in a new tab.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="inquire-tab-content" class="inquiry-tab-content hidden space-y-3">
|
||||
<form class="space-y-3">
|
||||
<div>
|
||||
<label for="inquiry-full-name" class="block text-xs font-medium text-gray-700 mb-1 font-heading">Full Name</label>
|
||||
<input type="text" id="inquiry-full-name" placeholder="Full Name" class="w-full px-3 py-2 border border-gray-300 rounded-sm focus:outline-none focus:border-indigo-600 text-sm" required>
|
||||
<p class="text-xs text-red-500 mt-1 hidden">Invalid Name</p> <!-- Example error message, initially hidden -->
|
||||
<p class="text-xs text-red-500 mt-1 hidden">Invalid Name</p>
|
||||
</div>
|
||||
<div class="flex gap-3">
|
||||
<div class="w-1/2">
|
||||
@@ -85,68 +163,52 @@
|
||||
</p>
|
||||
</div>
|
||||
</form>
|
||||
</div> <!-- Closes div class="bg-white h-auto lg:h-full overflow-y-auto" -->
|
||||
</div> <!-- Closes inquiry-form-view -->
|
||||
|
||||
<!-- Map View -->
|
||||
<div id="inquiry-map-view" class="hidden">
|
||||
<div class="bg-white h-auto lg:h-full overflow-y-auto">
|
||||
<!-- Back Button -->
|
||||
<button type="button" onclick="showFormView()" class="mb-4 inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md bg-gray-100 text-indigo-900 font-semibold py-2 px-4 rounded-lg inline-flex items-center justify-between border-2 border-transparent hover:border-indigo-700 font-heading">
|
||||
<svg class="w-5 h-5 mr-2 -ml-1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
||||
<path fill-rule="evenodd" d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
Back to Inquiry
|
||||
</button>
|
||||
|
||||
<h2 class="text-lg font-semibold text-gray-800 mb-1 font-heading">Location for Cozy coworking space</h2>
|
||||
<p class="text-xs text-gray-600 mb-3">Incub8 space, Centennial Road, Brgy. Batong Dalig, Kawit, Cavite</p>
|
||||
|
||||
<!-- Map Placeholder -->
|
||||
<div id="mapbox-map-container" class="h-64 sm:h-80 w-full bg-gray-200 rounded-base mb-4 border border-gray-300 flex items-center justify-center text-gray-500 p-4 text-center">
|
||||
<!-- This div will be targeted by Mapbox JS for map rendering. -->
|
||||
Map will load here. Ensure Mapbox GL JS is initialized and targets this container.
|
||||
</div>
|
||||
|
||||
<!-- Directions Button -->
|
||||
<a href="https://www.google.com/maps/dir/?api=1&destination=Incub8+space,+Centennial+Road,+Brgy.+Batong+Dalig,+Kawit,+Cavite" target="_blank" rel="noopener noreferrer" id="get-directions-link" class="w-full bg-indigo-900 text-gray-100 font-semibold py-2 px-4 rounded-lg inline-flex items-center justify-center border-2 border-transparent hover:border-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 font-heading">
|
||||
Get Directions
|
||||
</a>
|
||||
<p class="text-xs mt-2 text-gray-600 font-thin text-center">
|
||||
Opens Google Maps in a new tab.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Map View -->
|
||||
</div> <!-- Closes Modal Body -->
|
||||
|
||||
<script type="text/javascript">
|
||||
function showMapView() {
|
||||
document.getElementById('inquiry-form-view').classList.add('hidden');
|
||||
document.getElementById('inquiry-map-view').classList.remove('hidden');
|
||||
document.getElementById('inquiry-modal-title').textContent = 'Location & Directions';
|
||||
function switchInquiryTab(tabId) {
|
||||
const tabContents = document.querySelectorAll('.inquiry-tab-content');
|
||||
tabContents.forEach(content => {
|
||||
content.classList.add('hidden');
|
||||
});
|
||||
|
||||
// Placeholder: Dynamically set address for directions if needed
|
||||
// const listingAddress = "Incub8 space, Centennial Road, Brgy. Batong Dalig, Kawit, Cavite"; // Or get from Liquid variable
|
||||
// const directionsLink = document.getElementById('get-directions-link');
|
||||
// if (directionsLink) {
|
||||
// directionsLink.href = `https://www.google.com/maps/dir/?api=1&destination=${encodeURIComponent(listingAddress)}`;
|
||||
const tabButtons = document.querySelectorAll('.inquiry-tab-button');
|
||||
tabButtons.forEach(button => {
|
||||
button.classList.remove('text-indigo-600', 'border-indigo-500');
|
||||
button.classList.add('text-gray-500', 'hover:text-gray-700', 'hover:border-gray-300', 'border-transparent');
|
||||
button.removeAttribute('aria-current');
|
||||
});
|
||||
|
||||
document.getElementById(tabId + '-tab-content').classList.remove('hidden');
|
||||
const activeButton = document.getElementById('tab-' + tabId);
|
||||
activeButton.classList.add('text-indigo-600', 'border-indigo-500');
|
||||
activeButton.classList.remove('text-gray-500', 'hover:text-gray-700', 'hover:border-gray-300', 'border-transparent');
|
||||
activeButton.setAttribute('aria-current', 'page');
|
||||
|
||||
// Update modal title based on tab - optional
|
||||
// if (tabId === 'location') {
|
||||
// document.getElementById('inquiry-modal-title').textContent = 'Location & Directions';
|
||||
// } else if (tabId === 'inquire') {
|
||||
// document.getElementById('inquiry-modal-title').textContent = 'Send Inquiry';
|
||||
// } else {
|
||||
// document.getElementById('inquiry-modal-title').textContent = 'Listing Details';
|
||||
// }
|
||||
|
||||
// Placeholder: Initialize Mapbox map here if it's not already initialized
|
||||
// This is a conceptual placeholder for actual Mapbox initialization logic.
|
||||
// e.g., if (typeof mapboxgl !== 'undefined' && !mapInstance) {
|
||||
// mapInstance = new mapboxgl.Map({ container: 'mapbox-map-container', style: 'YOUR_MAPBOX_STYLE_URL', center: [lng, lat], zoom: 15 });
|
||||
// new mapboxgl.Marker().setLngLat([lng, lat]).addTo(mapInstance);
|
||||
// Placeholder for Mapbox initialization if the location tab is active
|
||||
if (tabId === 'location') {
|
||||
// e.g., if (typeof mapboxgl !== 'undefined' && !mapInstanceInquiry) {
|
||||
// mapInstanceInquiry = new mapboxgl.Map({ container: 'mapbox-map-container-inquiry', style: 'YOUR_MAPBOX_STYLE_URL', center: [lng, lat], zoom: 15 });
|
||||
// new mapboxgl.Marker().setLngLat([lng, lat]).addTo(mapInstanceInquiry);
|
||||
// }
|
||||
}
|
||||
|
||||
function showFormView() {
|
||||
document.getElementById('inquiry-map-view').classList.add('hidden');
|
||||
document.getElementById('inquiry-form-view').classList.remove('hidden');
|
||||
document.getElementById('inquiry-modal-title').textContent = 'Inquire this Listing';
|
||||
}
|
||||
|
||||
// Set initial tab
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
switchInquiryTab('details');
|
||||
});
|
||||
</script>
|
||||
|
||||
</div> <!-- Closing div for "flex-1 overflow-y-auto p-4 sm:p-6" -->
|
||||
</div> <!-- Closing div for "relative w-full h-full max-w-lg ml-auto..." -->
|
||||
</aside>
|
||||
|
||||
Reference in new issue
Block a user