2024-06-08 21:01:38 -04:00
|
|
|
<div
|
2024-06-08 22:48:56 -04:00
|
|
|
class="mt-4 pb-2 flex flex-row gap-2 max-w-full overflow-x-auto whitespace-nowrap"
|
|
|
|
>
|
2024-06-09 01:12:33 -04:00
|
|
|
<button
|
|
|
|
id="all"
|
|
|
|
class="flex gap-2 items-center px-4 border border-gray-200 rounded-lg focus:outline-none"
|
|
|
|
onclick="window.location.href = '/catalog'"
|
|
|
|
>
|
2024-06-09 22:12:59 -04:00
|
|
|
<span class="text-xs p-2 font-medium text-gray-900">All</span>
|
2024-06-09 01:12:33 -04:00
|
|
|
</button>
|
2024-06-08 22:48:56 -04:00
|
|
|
{{ $uniqueCategories := slice }} {{ range .Params.catalog }} {{ if not (in
|
|
|
|
$uniqueCategories .cat) }} {{ $uniqueCategories = $uniqueCategories | append
|
|
|
|
.cat }}
|
2024-06-10 19:21:08 -04:00
|
|
|
<div
|
|
|
|
class="flex gap-2 items-center px-3 py-2 border border-gray-200 rounded-lg"
|
|
|
|
>
|
2024-06-08 22:48:56 -04:00
|
|
|
<input
|
|
|
|
id="radio-button-{{ .cat }}"
|
|
|
|
type="radio"
|
|
|
|
value="{{ .cat }}"
|
|
|
|
name="category"
|
|
|
|
class="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 focus:ring-2"
|
|
|
|
/>
|
|
|
|
<label
|
|
|
|
for="radio-button-{{ .cat }}"
|
2024-07-06 17:48:22 -04:00
|
|
|
class="noselect text-xs sm:p-0 font-medium text-gray-900"
|
2024-06-08 22:48:56 -04:00
|
|
|
>{{ .cat }}</label
|
|
|
|
>
|
|
|
|
</div>
|
|
|
|
{{ end }} {{ end }}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div
|
|
|
|
class="mt-2 grid grid-cols-1 sm:grid-cols-2 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-3 gap-4"
|
2024-06-08 21:01:38 -04:00
|
|
|
>
|
|
|
|
{{ range .Params.catalog }} {{ if ne .item "" }}
|
2024-07-12 22:37:31 -04:00
|
|
|
<div
|
|
|
|
class="flex flex-col justify-between bg-white rounded-lg border p-4 relative"
|
|
|
|
>
|
2024-07-13 16:45:56 -04:00
|
|
|
{{ if .thumbnail }}
|
2024-06-08 21:01:38 -04:00
|
|
|
<img
|
2024-07-06 17:48:22 -04:00
|
|
|
loading="lazy"
|
2024-07-12 22:34:17 -04:00
|
|
|
src="{{ .thumbnail }}"
|
|
|
|
alt="Thumbnail"
|
|
|
|
class="w-full h-52 rounded-md object-cover"
|
2024-06-08 21:01:38 -04:00
|
|
|
/>
|
2024-07-13 16:45:56 -04:00
|
|
|
{{ else }}
|
|
|
|
|
|
|
|
<div class="w-full h-52 rounded-md object-cover border-2 border-gray-200 bg-gray-100"></div>
|
|
|
|
|
|
|
|
{{ end }}
|
2024-06-08 21:01:38 -04:00
|
|
|
<div class="px-1 pt-4">
|
|
|
|
<div class="flex flex-row gap-2 justify-between font-bold text-xl mb-2">
|
|
|
|
{{ .item }} {{ if ne .cat "" }}
|
2024-06-09 01:25:43 -04:00
|
|
|
<div>
|
2024-06-08 21:01:38 -04:00
|
|
|
<span
|
2024-06-08 22:48:56 -04:00
|
|
|
class="bg-blue-100 text-blue-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded-full"
|
2024-06-08 21:01:38 -04:00
|
|
|
>{{ .cat }}</span
|
|
|
|
>
|
2024-06-09 01:25:43 -04:00
|
|
|
</div>
|
2024-06-08 21:01:38 -04:00
|
|
|
{{ end }}
|
|
|
|
</div>
|
2024-07-12 22:34:17 -04:00
|
|
|
<div class="text-sm text-gray-800 text-base mb-4">
|
2024-06-08 21:01:38 -04:00
|
|
|
{{ if ne .quant "" }}
|
|
|
|
<div class="flex flex-row justify-between">
|
|
|
|
<strong>Quantity:</strong>
|
|
|
|
<span>{{ .quant }}</span>
|
|
|
|
</div>
|
|
|
|
{{ end }} {{ if ne .dimensions "" }}
|
2024-06-08 21:32:47 -04:00
|
|
|
<div class="gap-1 text-right flex flex-row justify-between">
|
2024-06-08 21:01:38 -04:00
|
|
|
<strong>Dimensions:</strong>
|
2024-07-12 22:37:31 -04:00
|
|
|
<span>{{ .dimensions }}</span>
|
2024-06-08 21:01:38 -04:00
|
|
|
</div>
|
|
|
|
{{ end }} {{ if ne .baseCost "" }}
|
|
|
|
<div class="flex flex-row justify-between">
|
2024-07-12 22:34:17 -04:00
|
|
|
<strong>Rental Cost:</strong>
|
2024-06-08 21:01:38 -04:00
|
|
|
<span>{{ .baseCost }}</span>
|
|
|
|
</div>
|
|
|
|
{{ end }} {{ if ne .deliveryPickup "" }}
|
|
|
|
<div class="flex flex-row justify-between">
|
2024-06-10 19:21:08 -04:00
|
|
|
<strong>+ Pickup & Delivery:</strong>
|
2024-06-08 21:01:38 -04:00
|
|
|
<span>{{ .deliveryPickup }}</span>
|
|
|
|
</div>
|
|
|
|
{{ end }} {{ if ne .installBreakdown "" }}
|
|
|
|
<div class="flex flex-row justify-between">
|
2024-06-09 22:12:59 -04:00
|
|
|
<strong>+ Setup & Breakdown:</strong>
|
2024-06-08 21:01:38 -04:00
|
|
|
<span>{{ .installBreakdown }}</span>
|
|
|
|
</div>
|
2024-07-12 22:34:17 -04:00
|
|
|
{{ end }}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="flex flex-col gap-4">
|
|
|
|
{{ if ne .purchaseCost "" }}
|
2024-07-12 22:37:31 -04:00
|
|
|
<div
|
2024-07-13 20:50:53 -04:00
|
|
|
class="flex flex-row justify-between border-[1px] rounded-lg px-4 h-10 py-[0.275rem] w-full"
|
2024-07-12 22:37:31 -04:00
|
|
|
>
|
|
|
|
<strong>Purchase Cost:</strong>
|
|
|
|
<span>{{ .purchaseCost }}</span>
|
|
|
|
</div>
|
|
|
|
{{ else }}
|
|
|
|
<div
|
2024-07-13 20:50:53 -04:00
|
|
|
class="flex justify-center border-[1px] rounded-lg px-4 h-10 py-[0.275rem] text-gray-600 mt-4 w-full"
|
2024-07-12 22:37:31 -04:00
|
|
|
>
|
|
|
|
<strong>Purchase Unavailable</strong>
|
|
|
|
</div>
|
|
|
|
{{ end }}
|
2024-07-12 22:34:17 -04:00
|
|
|
<a class="w-full h-8" href="#modal-{{ .item | urlize }}">
|
2024-06-08 21:01:38 -04:00
|
|
|
<button
|
|
|
|
type="button"
|
|
|
|
class="w-full px-3 py-2 text-xs font-medium text-center text-white bg-black rounded-lg hover:bg-gray-800 focus:ring-4 focus:outline-none transition-all duration-200"
|
|
|
|
>
|
|
|
|
Expand
|
|
|
|
</button>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<div
|
|
|
|
id="modal-{{ .item | urlize }}"
|
|
|
|
class="fixed z-10 inset-0 overflow-y-auto hidden bg-gray-500 bg-opacity-75 transition-opacity"
|
|
|
|
aria-labelledby="modal-title"
|
|
|
|
role="dialog"
|
|
|
|
aria-modal="true"
|
|
|
|
>
|
|
|
|
<div
|
|
|
|
class="flex items-end justify-center min-h-screen p-4 text-center sm:block sm:p-0"
|
|
|
|
>
|
|
|
|
<div class="fixed inset-0" aria-hidden="true"></div>
|
|
|
|
<span
|
|
|
|
class="hidden sm:inline-block sm:align-middle sm:h-screen"
|
|
|
|
aria-hidden="true"
|
|
|
|
>​</span
|
|
|
|
>
|
|
|
|
<div
|
|
|
|
class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle self-center sm:max-w-lg w-full"
|
|
|
|
>
|
|
|
|
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
|
|
|
|
<div class="sm:flex sm:items-start">
|
|
|
|
<div
|
|
|
|
class="w-full mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-black sm:mx-0 sm:h-10 sm:w-10"
|
|
|
|
>
|
|
|
|
<svg
|
|
|
|
class="h-6 w-6 text-white"
|
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
fill="none"
|
|
|
|
viewBox="0 0 24 24"
|
|
|
|
stroke="currentColor"
|
|
|
|
aria-hidden="true"
|
|
|
|
>
|
|
|
|
<path
|
|
|
|
stroke-linecap="round"
|
|
|
|
stroke-linejoin="round"
|
|
|
|
stroke-width="2"
|
|
|
|
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
|
|
/>
|
|
|
|
</svg>
|
|
|
|
</div>
|
|
|
|
<div class="w-full mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left">
|
|
|
|
<h3 class="text-xl mb-2" id="modal-title">
|
|
|
|
<strong>{{ .item }}</strong>
|
|
|
|
</h3>
|
2024-06-08 21:59:09 -04:00
|
|
|
{{ if .gallery }}
|
2024-07-06 17:48:22 -04:00
|
|
|
<div
|
2024-07-13 20:36:32 -04:00
|
|
|
class="w-full mt-8 columns-1 gap-2 sm:columns-2 sm:gap-4 [&>div:not(:first-child)]:mt-4"
|
2024-07-06 17:48:22 -04:00
|
|
|
>
|
|
|
|
{{ range .gallery }}
|
2024-07-06 16:00:51 -04:00
|
|
|
<div
|
2024-07-06 17:48:22 -04:00
|
|
|
class="relative hover:scale-105 ease-in-out duration-200 transition-all hover:shadow-2xl"
|
2024-06-10 19:21:08 -04:00
|
|
|
>
|
2024-07-06 17:48:22 -04:00
|
|
|
<img
|
|
|
|
loading="lazy"
|
|
|
|
class="rounded-lg w-full"
|
|
|
|
src="{{ .image }}"
|
|
|
|
/>
|
|
|
|
<button class="absolute right-2 top-2">
|
2024-06-10 19:21:08 -04:00
|
|
|
<svg
|
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
2024-07-06 17:48:22 -04:00
|
|
|
viewBox="0 0 448 512"
|
2024-07-06 17:53:34 -04:00
|
|
|
class="fill-black w-6 h-6 bg-white p-1 rounded-sm"
|
2024-06-10 19:21:08 -04:00
|
|
|
>
|
|
|
|
<path
|
2024-07-06 17:48:22 -04:00
|
|
|
d="M32 32C14.3 32 0 46.3 0 64v96c0 17.7 14.3 32 32 32s32-14.3 32-32V96h64c17.7 0 32-14.3 32-32s-14.3-32-32-32H32zM64 352c0-17.7-14.3-32-32-32s-32 14.3-32 32v96c0 17.7 14.3 32 32 32h96c17.7 0 32-14.3 32-32s-14.3-32-32-32H64V352zM320 32c-17.7 0-32 14.3-32 32s14.3 32 32 32h64v64c0 17.7 14.3 32 32 32s32-14.3 32-32V64c0-17.7-14.3-32-32-32H320zM448 352c0-17.7-14.3-32-32-32s-32 14.3-32 32v64H320c-17.7 0-32 14.3-32 32s14.3 32 32 32h96c17.7 0 32-14.3 32-32V352z"
|
2024-06-10 19:21:08 -04:00
|
|
|
/>
|
|
|
|
</svg>
|
2024-07-06 16:00:51 -04:00
|
|
|
</button>
|
|
|
|
</div>
|
2024-07-06 17:48:22 -04:00
|
|
|
{{ end }}
|
|
|
|
</div>
|
2024-06-08 21:59:09 -04:00
|
|
|
{{ end }}
|
2024-06-08 21:01:38 -04:00
|
|
|
<div class="px-1 pt-4 w-full">
|
|
|
|
<div class="text-gray-800 text-base">
|
|
|
|
{{ if ne .quant "" }}
|
|
|
|
<div class="flex flex-row justify-between">
|
|
|
|
<strong>Quantity:</strong>
|
|
|
|
<span>{{ .quant }}</span>
|
|
|
|
</div>
|
|
|
|
{{ end }} {{ if ne .dimensions "" }}
|
|
|
|
<div class="flex flex-row justify-between">
|
|
|
|
<strong>Dimensions:</strong>
|
|
|
|
<span>{{ .dimensions }}</span>
|
2024-06-04 14:15:20 -04:00
|
|
|
</div>
|
2024-06-08 21:01:38 -04:00
|
|
|
{{ end }} {{ if ne .baseCost "" }}
|
|
|
|
<div class="flex flex-row justify-between">
|
|
|
|
<strong>Base Cost:</strong>
|
|
|
|
<span>{{ .baseCost }}</span>
|
2024-06-04 14:15:20 -04:00
|
|
|
</div>
|
2024-06-08 21:01:38 -04:00
|
|
|
{{ end }} {{ if ne .deliveryPickup "" }}
|
|
|
|
<div class="flex flex-row justify-between">
|
2024-06-10 19:21:08 -04:00
|
|
|
<strong>Pickup & Delivery:</strong>
|
2024-06-08 21:01:38 -04:00
|
|
|
<span>{{ .deliveryPickup }}</span>
|
|
|
|
</div>
|
|
|
|
{{ end }} {{ if ne .installBreakdown "" }}
|
|
|
|
<div class="flex flex-row justify-between">
|
2024-06-09 22:12:59 -04:00
|
|
|
<strong>Setup & Breakdown:</strong>
|
2024-06-08 21:01:38 -04:00
|
|
|
<span>{{ .installBreakdown }}</span>
|
|
|
|
</div>
|
|
|
|
{{ end }} {{ if ne .purchaseCost "" }}
|
2024-07-12 22:37:31 -04:00
|
|
|
<div
|
2024-07-13 20:50:53 -04:00
|
|
|
class="flex flex-row justify-between border-[1px] rounded-lg px-4 h-10 py-[0.275rem] w-full mt-4"
|
2024-07-12 22:37:31 -04:00
|
|
|
>
|
2024-06-08 21:01:38 -04:00
|
|
|
<strong>Purchase Cost:</strong>
|
|
|
|
<span>{{ .purchaseCost }}</span>
|
|
|
|
</div>
|
2024-07-12 22:37:31 -04:00
|
|
|
{{ else }}
|
|
|
|
<div
|
2024-07-13 20:50:53 -04:00
|
|
|
class="flex justify-center border-[1px] rounded-lg px-4 h-10 py-[0.275rem] text-gray-600 mt-4 w-full"
|
2024-07-12 22:37:31 -04:00
|
|
|
>
|
|
|
|
<strong>Purchase Unavailable</strong>
|
|
|
|
</div>
|
2024-06-08 21:01:38 -04:00
|
|
|
{{ end }}
|
2024-06-04 14:15:20 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-06-08 21:01:38 -04:00
|
|
|
<div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
|
|
|
|
<button
|
|
|
|
id="close-modal"
|
|
|
|
class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-black text-base font-medium text-white hover:bg-gray-800 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-black sm:ml-3 sm:w-auto sm:text-sm"
|
|
|
|
@click="open = false"
|
|
|
|
>
|
|
|
|
Close
|
|
|
|
</button>
|
|
|
|
</div>
|
2024-06-04 05:12:29 -04:00
|
|
|
</div>
|
2024-06-08 21:01:38 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
2024-06-04 05:12:29 -04:00
|
|
|
</div>
|
2024-06-08 21:01:38 -04:00
|
|
|
{{ end }} {{ end }}
|
|
|
|
</div>
|
|
|
|
<script>
|
|
|
|
document.addEventListener("DOMContentLoaded", function () {
|
|
|
|
const modalButtons = document.querySelectorAll(".grid-cols-1 a");
|
|
|
|
const closeButtons = document.querySelectorAll("#close-modal");
|
|
|
|
const modals = document.querySelectorAll(".fixed");
|
2024-06-08 22:48:56 -04:00
|
|
|
const radioButtons = document.querySelectorAll(
|
|
|
|
'input[type="radio"][name="category"]'
|
|
|
|
);
|
2024-06-08 21:01:38 -04:00
|
|
|
|
2024-06-08 21:59:09 -04:00
|
|
|
function filterItems(category) {
|
|
|
|
console.log("Filtering items for category:", category);
|
|
|
|
const items = document.querySelectorAll(".grid > div");
|
|
|
|
|
|
|
|
items.forEach((item) => {
|
|
|
|
const itemCategory = item.querySelector(".bg-blue-100");
|
2024-06-08 22:48:56 -04:00
|
|
|
if (!category || itemCategory.textContent === category) {
|
2024-06-08 21:59:09 -04:00
|
|
|
item.classList.remove("hidden");
|
|
|
|
} else {
|
|
|
|
item.classList.add("hidden");
|
2024-06-08 22:48:56 -04:00
|
|
|
|
2024-06-08 21:59:09 -04:00
|
|
|
const modalId = item.id.replace("modal-", "");
|
|
|
|
const modal = document.getElementById(modalId);
|
|
|
|
if (modal) modal.classList.add("hidden");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2024-06-08 22:48:56 -04:00
|
|
|
function updateUrl(category) {
|
|
|
|
const url = window.location.href.split("#")[0];
|
|
|
|
const newUrl = category ? `${url}#${category}` : url;
|
|
|
|
window.history.replaceState({}, "", newUrl);
|
|
|
|
}
|
|
|
|
|
2024-06-08 21:59:09 -04:00
|
|
|
const category = window.location.hash.substring(1);
|
|
|
|
console.log("Initial category:", category);
|
|
|
|
filterItems(category);
|
|
|
|
|
|
|
|
window.addEventListener("hashchange", function () {
|
|
|
|
const newCategory = window.location.hash.substring(1);
|
|
|
|
console.log("New category:", newCategory);
|
|
|
|
filterItems(newCategory);
|
|
|
|
});
|
|
|
|
|
2024-06-08 22:48:56 -04:00
|
|
|
radioButtons.forEach((radio) => {
|
|
|
|
radio.addEventListener("change", function () {
|
|
|
|
const category = this.value;
|
|
|
|
console.log("Selected category:", category);
|
|
|
|
updateUrl(category);
|
|
|
|
filterItems(category);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2024-06-08 21:01:38 -04:00
|
|
|
modalButtons.forEach((button) => {
|
|
|
|
button.addEventListener("click", function (e) {
|
|
|
|
e.preventDefault();
|
|
|
|
const modalId = this.getAttribute("href").substring(1);
|
|
|
|
const modal = document.getElementById(modalId);
|
|
|
|
modal.classList.remove("hidden");
|
2024-06-04 14:15:20 -04:00
|
|
|
});
|
|
|
|
});
|
2024-06-08 21:01:38 -04:00
|
|
|
|
|
|
|
closeButtons.forEach((button) => {
|
|
|
|
button.addEventListener("click", function (e) {
|
|
|
|
e.preventDefault();
|
2024-06-08 21:59:09 -04:00
|
|
|
const modal = this.closest(".fixed");
|
|
|
|
modal.classList.add("hidden");
|
2024-06-04 14:15:20 -04:00
|
|
|
});
|
|
|
|
});
|
2024-06-08 22:48:56 -04:00
|
|
|
|
|
|
|
if (category) {
|
|
|
|
const radioToSelect = document.querySelector(
|
|
|
|
`input[type="radio"][name="category"][value="${category}"]`
|
|
|
|
);
|
|
|
|
if (radioToSelect) {
|
|
|
|
radioToSelect.checked = true;
|
|
|
|
filterItems(category);
|
|
|
|
}
|
|
|
|
}
|
2024-06-08 21:01:38 -04:00
|
|
|
});
|
|
|
|
</script>
|