So I tried to customise a second if statement but it will only honour the first one. I am sure this will be a simple fix for someone who knows what they are doing.
import wixData from ‘wix-data’ ;
$w . onReady ( function () {
wixData . query ( “Events/Events” )
. ascending ( “start” )
. eq ( “scheduled” )
. limit ( 6 )
. find ()
. then (( results ) => {
if ( results.totalCount > 0 ) {
$w ( “#upcomingrepeater” ). data = results.items ;
}
})
. catch (( error ) => {
console . log ( “Error:” , error.message );
});
//here you are applying the returned data from above to the repeater elements
$w ( “#upcomingrepeater” ). onItemReady (( $item , itemData , index ) => {
//use a switch statement to manage your cases and adj the text
switch ( itemData.registrationStatus ) {
case ‘OPEN_TICKETS’ :
itemData.registrationStatus = ‘BOOKINGS OPEN’
break ;
case ‘CLOSED_MANUALLY’ :
itemData.registrationStatus = ‘BOOKINGS CLOSED’
break ;
case ‘CLOSED’ :
itemData.registrationStatus = ‘RALLY FULL’
break ;
case ‘OPEN_EXTERNAL’ :
itemData.registrationStatus = ‘BOOK EXTERNALLY’
break ;
default :
itemData.registrationStatus = ‘default status’
}
if ( itemData.registrationStatus === ‘RALLY FULL’ ){
let value = $item ( “#bookingstatustext” ). text ;
$item ( “#bookingstatustext” ). html = “
” + value + “
” ;if ( itemData.registrationStatus === ‘BOOKINGS CLOSED’ ){
let value = $item ( “#bookingstatustext” ). text ;
$item ( “#bookingstatustext” ). html = “
” + value + “
” ;}
}
//here you are manually pointing the repeater elements to each value you want
$item ( “#bookingstatustext” ). text = itemData.registrationStatus ;
});
});