Discussion:
The organisation (Seniors Social Centre) needs to display staff members’ Image, Name, Description, Phone and Email for members to easily find the person they need get in touch with. A bit like a staff phonebook, available in a page accessible only to users with an active subscription (the active members of the Centre).
What are you trying to achieve:
Since the default Bookings Staff Widget is rather basic (no sorting, no searching/filtering) and we’ve got several dozens of staff members to browse through, I’m trying to make my own using Velo with a custom search box, a search button and a repeater in which I display the results matching the search term in the box (or all results if the search term is blank).
I’m using wixData.query('Bookings/Staff')
to get the items and then filtering based on matches in items’ name
and eventually in their description
.
All works good but the returned items only contain _id
, name
, image
. The query does not return Description, Phone or Email
I’m scratching my head a bit why the data returned is only partial and not just all the info of the Staff Members?
export async function search() {
let searchTerm = $w('#txtSearch').value;
console.log('Search term: "' + searchTerm + '"');
// Get data from a database collection
let {items: collectionData} = await wixData.query('Bookings/Staff').find();
if (searchTerm) {
collectionData = collectionData.filter((staff) => staff.name.toLowerCase().includes(searchTerm.toLowerCase() /* || staff.description.toLowerCase().includes(searchTerm.toLowerCase()) */ ))
}
if (collectionData.length == 0) {
$w('#repeaterStaff').hide();
$w('#textNotFound').show("fade");
} else {
$w('#textNotFound').hide();
$w('#repeaterStaff').data = collectionData;
$w('#repeaterStaff').show("fade");
}
}
Additional information:
In our implementation, we’re using Booking Services (30+ of them, all “courses”) to advertise each “activity” that the organization offers, add participants to them and keep track of fees paid, etc.
Acting as “coordinators”, we got almost as many Staff Members that are responsible for handling all questions and issues regarding their assigned activity. These staff members have their Description set to the activity they oversee so people know who their coordinator is if they look up for the activity’s name.
With the clientele being Seniors, they mostly operate by phone and love to TALK with their coordinators when they have questions, making Wix’s usual reliance on email communications… impractical.