top of page

Please use this form to check availability /

request luggage transfer or any other queries:

Accommodation / Luggage Enquiry

Bodfari B&B
Lletty Yr Eos Ucha

off Mold Road
Bodfari

Tel: 01745 316770

Location
Call us now to book
01745 316770

© 2023 by Llettyr Yr Eos Ucha B&B

Powered and secured by EV

bottom of page
///////////// SEARCH FUNCTIONALITY FOR CMS / DATABASE ///////////// import wixData from 'wix-data'; $w.onReady(() => { // Real-time search as the user types in the search bar. $w("#SearchbarHome").onInput(() => { performSearch(); }); }); function performSearch() { const searchQuery = $w("#SearchbarHome").value.trim(); if (searchQuery.length > 0) { // Apply the filter based on the search query $w("#collectionDatasetName").setFilter( wixData.filter() .contains("title", searchQuery) .or(wixData.filter().contains("shortDescription", searchQuery)) .or(wixData.filter().contains("level", searchQuery)) .or(wixData.filter().contains("servings", searchQuery)) ) .then(() => { console.log("Dataset filtered"); // Automatically expand the repeater if there are items to display updateRepeaterVisibility(); }) .catch((err) => { console.error("Failed to filter dataset:", err); $w("#repeaterSearch").collapse(); // Show the notFound element if there's an error $w("#notFound").show(); }); } else { // Clear the filter and collapse the repeater if search query is empty $w("#collectionDatasetName").setFilter(wixData.filter()) .then(() => { console.log("Filter cleared"); $w("#repeaterSearch").collapse(); // Hide the notFound element when the filter is cleared $w("#notFound").hide(); }) .catch((err) => { console.error("Failed to clear filter:", err); $w("#repeaterSearch").collapse(); // Optionally, hide the notFound element if there's an error $w("#notFound").hide(); }); } } function updateRepeaterVisibility() { // Check if the dataset has items to display after filtering $w("#collectionDatasetName").getItems(0, 1).then((results) => { if (results.totalCount > 0) { $w("#repeaterSearch").expand(); // Hide the notFound element when there are items to display $w("#notFound").hide(); } else { $w("#repeaterSearch").collapse(); // Show the notFound element when there are no items to display $w("#notFound").show(); } }); }