<table class="form-table">
	<tbody>
		<tr>
			<th scope="row">
				<label for="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_FILTER; ?>">
					<?php echo rsvp_pro_get_admin_string( 'settings_public_attendee_list_only_status_label' ); ?>
				</label>
			</th>
			<td>
				<p>
					<span style="margin-left: 20px;"><?php esc_html_e( 'Available statuses', 'rsvp-pro-plugin' ); ?></span>
					<span style="margin-left: 85px;"><?php esc_html_e( 'Filtered statuses', 'rsvp-pro-plugin' ); ?></span>
				</p>
				<select name="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_FILTER; ?>[]" id="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_FILTER; ?>" multiple="multiple">
					<option value="yes" <?php echo ( in_array( 'yes', $attendeelistFilter ) ) ? 'selected="selected"' : ''; ?>>
						<?php echo rsvp_pro_get_frontend_string( 'yes_text' ); ?>
					</option>
					<option value="no" <?php echo ( in_array( 'no', $attendeelistFilter ) ) ? 'selected="selected"' : ''; ?>>
						<?php echo rsvp_pro_get_frontend_string( 'no_text' ); ?>
					</option>
					<option value="noresponse" <?php echo ( in_array( 'noresponse', $attendeelistFilter ) ) ? 'selected="selected"' : ''; ?>>
						<?php echo rsvp_pro_get_frontend_string( 'noresponse_text' ); ?>
					</option>
					<option value="waitlist" <?php echo ( in_array( 'waitlist', $attendeelistFilter ) ) ? 'selected="selected"' : ''; ?>>
						<?php echo rsvp_pro_get_frontend_string( 'waitlist_text' ); ?>
					</option>
					<option value="maybe" <?php echo ( in_array( 'maybe', $attendeelistFilter ) ) ? 'selected="selected"' : ''; ?>>
						<?php echo rsvp_pro_get_frontend_string( 'maybe_text' ); ?>
					</option>
					<option value="plusone" <?php echo ( in_array( 'plusone', $attendeelistFilter ) ) ? 'selected="selected"' : ''; ?>>
						<?php echo rsvp_pro_get_frontend_string( 'plusone_text' ); ?>
					</option>
				</select>
			</td>
		</tr>
		<tr>
			<th scope="row">
				<label for="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_ALLOW_RSVP_CHANGE; ?>">
					<?php echo rsvp_pro_get_admin_string( 'settings_allow_status_change_on_attendee_list_label' ); ?>
				</label>
			</th>
			<td>
				<input type="checkbox" name="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_ALLOW_RSVP_CHANGE; ?>" id="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_ALLOW_RSVP_CHANGE; ?>" value="Y" <?php echo ( $attendeeListAllowRsvp == 'Y' ) ? ' checked="checked"' : ''; ?> />
			</td>
		</tr>
		<tr>
			<th scope="row">
				<label for="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_SEARCH; ?>">
					<?php echo rsvp_pro_get_admin_string( 'settings_show_search_attendee_list_label' ); ?>
				</label>
			</th>
			<td>
				<input type="checkbox" name="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_SEARCH; ?>" id="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_SEARCH; ?>" value="Y" 
														<?php
														if ( $attendeelist_show_search == 'Y' ) {
															echo ' checked="checked"'; }
														?>
				 />
			</td>
		</tr>
		<tr>
			<th scope="row">
				<label for="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_EXPORT_BUTTON; ?>">
					<?php echo rsvp_pro_get_admin_string( 'settings_show_export_button_attendee_list_label' ); ?>
				</label>
			</th>
			<td>
				<input type="checkbox" name="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_EXPORT_BUTTON; ?>" id="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_EXPORT_BUTTON; ?>" value="Y" 
														<?php
														if ( $attendee_list_export_button === 'Y' ) {
															echo ' checked="checked"'; }
														?>
				 />
			</td>
		</tr>
		<tr>
			<th scope="row">
				<label for="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_FILTER_TEXT; ?>">
					<?php echo rsvp_pro_get_admin_string( 'settings_attendee_list_search_text_label' ); ?>
				</label>
			</th>
			<td>
				<input type="text" name="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_FILTER_TEXT; ?>" id="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_FILTER_TEXT; ?>" value="<?php echo esc_attr( $attendeelist_search_text ); ?>" />
				<br />
				<span class="description"><?php echo rsvp_pro_get_admin_string( 'settings_attendee_list_search_text_description' ); ?></span>
			</td>
		</tr>
		<tr>
			<th scope="row">
				<label for="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_ALLOW_CHECKIN; ?>">
					<?php echo rsvp_pro_get_admin_string( 'settings_attendee_list_allow_checkin_label' ); ?>
				</label>
			</th>
			<td>
				<input type="checkbox" name="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_ALLOW_CHECKIN; ?>" id="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_ALLOW_CHECKIN; ?>" value="Y" 
														<?php
														if ( $attendeelist_allow_checkin == 'Y' ) {
															echo ' checked="checked"'; }
														?>
				 />
				<span class="description"><?php echo rsvp_pro_get_admin_string( 'settings_attendee_list_allow_checkin_description' ); ?></span>
			</td>
		</tr>
		<tr>
			<th scope="row">
				<label for="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_CHECKIN_TEXT; ?>">
					<?php echo rsvp_pro_get_admin_string( 'settings_attendee_list_checkin_text_label' ); ?>
				</label>
			</th>
			<td>
				<input type="text" name="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_CHECKIN_TEXT; ?>" id="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_CHECKIN_TEXT; ?>" value="<?php echo esc_attr( $attendeelist_checkin_text ); ?>" />
				<br />
				<span class="description"><?php echo rsvp_pro_get_admin_string( 'settings_attendee_list_checkin_text_description' ); ?></span>
			</td>
		</tr>
		<tr>
			<th scope="row">
				<label for="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_CHECKED_IN_TEXT; ?>">
					<?php echo rsvp_pro_get_admin_string( 'settings_attendee_list_checkin_message_label' ); ?>
				</label>
			</th>
			<td>
				<input type="text" name="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_CHECKED_IN_TEXT; ?>" id="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_CHECKED_IN_TEXT; ?>" value="<?php echo esc_attr( $attendeelist_checked_in_text ); ?>" />
				<br />
				<span class="description"><?php echo rsvp_pro_get_admin_string( 'settings_attendee_list_checkin_message_description' ); ?></span>
			</td>
		</tr>
		<tr>
			<th scope="row">
				<label for="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_PAGE_SIZE; ?>">
					<?php echo rsvp_pro_get_admin_string( 'settings_attendee_list_page_size_label' ); ?>
				</label>
			</th>
			<td>
				<select name="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_PAGE_SIZE; ?>" id="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_PAGE_SIZE; ?>" size="1">
					<option value="">--</option>
					<option value="50" <?php echo ( '50' == $attendee_list_page_size ) ? 'selected="selected"' : ''; ?>><?php echo rsvp_pro_get_admin_string( 'settings_attendee_list_page_size_50' ); ?></option>
					<option value="100" <?php echo ( '100' == $attendee_list_page_size ) ? 'selected="selected"' : ''; ?>><?php echo rsvp_pro_get_admin_string( 'settings_attendee_list_page_size_100' ); ?></option>
					<option value="250" <?php echo ( '250' == $attendee_list_page_size ) ? 'selected="selected"' : ''; ?>><?php echo rsvp_pro_get_admin_string( 'settings_attendee_list_page_size_250' ); ?></option>
					<option value="500" <?php echo ( '500' == $attendee_list_page_size ) ? 'selected="selected"' : ''; ?>><?php echo rsvp_pro_get_admin_string( 'settings_attendee_list_page_size_500' ); ?></option>
					<option value="1000" <?php echo ( '1000' == $attendee_list_page_size ) ? 'selected="selected"' : ''; ?>><?php echo rsvp_pro_get_admin_string( 'settings_attendee_list_page_size_1000' ); ?></option>
					<option value="all" <?php echo ( 'all' == $attendee_list_page_size ) ? 'selected="selected"' : ''; ?>><?php echo rsvp_pro_get_admin_string( 'all_attendees_label' ); ?></option>
				</select> 
				<br />
				<span class="description"><?php echo rsvp_pro_get_admin_string( 'settings_attendee_list_page_size_description' ); ?></span>
			</td>
		</tr>
		<tr>
			<th scope="row">
				<label for="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_SORT_ORDER; ?>">
					<?php echo rsvp_pro_get_admin_string( 'settings_attendee_list_sort_order_label' ); ?>
				</label>
			</th>
			<td>
				<select name="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_SORT_ORDER; ?>" id="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_SORT_ORDER; ?>">
					<option value="">--</option>
					<option value="firstName" <?php echo ( $attendeelistSortOrder == 'firstName' ) ? 'selected="selected"' : ''; ?>>
						<?php echo rsvp_pro_get_frontend_string( 'first_name_label' ); ?>
					</option>
					<option value="lastName" <?php echo ( $attendeelistSortOrder == 'lastName' ) ? 'selected="selected"' : ''; ?>>
						<?php echo rsvp_pro_get_frontend_string( 'last_name_label' ); ?>
					</option>
					<option value="rsvpStatus" <?php echo ( $attendeelistSortOrder == 'rsvpStatus' ) ? 'selected="selected"' : ''; ?>>
						<?php echo rsvp_pro_get_frontend_string( 'rsvp_status_label' ); ?>
					</option>
					<option value="rsvpDate" <?php echo ( $attendeelistSortOrder == 'rsvpDate' ) ? 'selected="selected"' : ''; ?>>
						<?php echo rsvp_pro_get_admin_string( 'rsvp_date_label' ); ?>
					</option>
					<?php
					$sql       = 'SELECT id, question
            FROM ' . PRO_QUESTIONS_TABLE . '
            WHERE rsvpEventID = %d ';
					$questions = $wpdb->get_results( $wpdb->prepare( $sql, $eventID ) );
					foreach ( $questions as $q ) {
						?>
						<option value="cq_<?php echo $q->id; ?>" <?php echo ( $attendeelistSortOrder == 'cq_' . $q->id ) ? ' selected="selected"' : ''; ?>>
							<?php echo esc_html( rsvp_pro_admin_prepare_custom_question_for_display( $q->question ) ); ?>
						</option>
						<?php
					}
					?>
				</select>
				<br />
				<span class="description"><?php echo rsvp_pro_get_admin_string( 'settings_attendee_list_sort_order_description' ); ?></span>
			</td>
		</tr>
		<tr>
			<th scope="row">
				<label for="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_PROFILE; ?>">
					<?php echo rsvp_pro_get_admin_string( 'settings_attendee_list_show_profile_pic_label' ); ?>:</label>
			</th>
			<td>
				<input type="checkbox" name="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_PROFILE; ?>" id="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_PROFILE; ?>" value="Y" 
														<?php
														if ( 'Y' === $attendee_list_show_profile_pic ) {
															echo ' checked="checked"'; }
														?>
				 />
				 <span class="description"><?php echo rsvp_pro_get_admin_string( 'settings_attendee_list_show_profile_pic_description' ); ?></span>
			</td>
		</tr>
		<tr>
			<th scope="row">
				<label for="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_EMAIL; ?>">
					<?php echo rsvp_pro_get_admin_string( 'settings_attendee_list_show_email_label' ); ?>:</label>
			</th>
			<td>
				<input type="checkbox" name="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_EMAIL; ?>" id="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_EMAIL; ?>" value="Y" 
														<?php
														if ( 'Y' === $attendee_list_show_email ) {
															echo ' checked="checked"'; }
														?>
				 />
			</td>
		</tr>
		<tr>
			<th scope="row">
				<label for="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_NOTE; ?>">
					<?php echo rsvp_pro_get_admin_string( 'settings_attendee_list_show_note_label' ); ?>:</label>
			</th>
			<td>
				<input type="checkbox" name="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_NOTE; ?>" id="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_NOTE; ?>" value="Y" 
														<?php
														if ( 'Y' === $attendee_list_show_note ) {
															echo ' checked="checked"'; }
														?>
				 />
			</td>
		</tr>
		<tr>
			<th scope="row">
				<label for="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_ASSOCIATED; ?>">
					<?php echo rsvp_pro_get_admin_string( 'settings_attendee_list_show_associated_label' ); ?>:</label>
			</th>
			<td>
				<input type="checkbox" name="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_ASSOCIATED; ?>" id="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_ASSOCIATED; ?>" value="Y" 
														<?php
														if ( 'Y' === $attendee_list_show_associated ) {
															echo ' checked="checked"'; }
														?>
				 />
			</td>
		</tr>
		<tr>
			<th scope="row">
				<label for="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_QR_PREFILL; ?>">
					<?php echo rsvp_pro_get_admin_string( 'settings_attendee_list_show_qr_prefill_label' ); ?>:</label>
			</th>
			<td>
				<input type="checkbox" name="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_QR_PREFILL; ?>" id="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_QR_PREFILL; ?>" value="Y" 
														<?php
														if ( 'Y' === $event_options->get_attendee_list_show_qr_prefill() ) {
															echo ' checked="checked"'; }
														?>
				 />
			</td>
		</tr>
		<tr>
			<th scope="row">
				<label for="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_SUMMARY; ?>">
					<?php echo rsvp_pro_get_admin_string( 'settings_attendee_list_show_rsvp_count_label' ); ?>:</label>
			</th>
			<td>
				<input type="checkbox" name="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_SUMMARY; ?>" id="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_SUMMARY; ?>" value="Y" 
														<?php
														if ( 'Y' === $attendee_list_show_summary ) {
															echo ' checked="checked"'; }
														?>
				 />
			</td>
		</tr>
		<tr>
			<th scope="row">
				<label for="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_HIDE_STATUS; ?>">
					<?php echo rsvp_pro_get_admin_string( 'settings_attendee_list_hide_rsvp_status_label' ); ?>
				</label>
			</th>
			<td>
				<input type="checkbox" name="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_HIDE_STATUS; ?>" id="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_HIDE_STATUS; ?>" value="Y" 
														<?php
														if ( $attendeeListHideStatus == 'Y' ) {
															echo ' checked="checked"'; }
														?>
				 />
			</td>
		</tr>
		<tr>
			<th scope="row">
				<label for="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_CUSTOM_QUESTIONS; ?>">
					<?php echo rsvp_pro_get_admin_string( 'settings_attendee_list_show_custom_questions_label' ); ?>
				</label>
			</th>
			<td>
				<p>
					<span style="margin-left: -5px;"><?php echo rsvp_pro_get_admin_string( 'settings_available_custom_questions_label' ); ?></span>
					<span style="margin-left: 15px;"><?php echo rsvp_pro_get_admin_string( 'settings_custom_questions_displayed_label' ); ?></span>
				</p>
				<select name="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_CUSTOM_QUESTIONS; ?>[]" id="<?php echo RSVP_PRO_OPTION_ATTENDEE_LIST_CUSTOM_QUESTIONS; ?>" multiple="multiple" size="5">
					<?php
					$questions = $wpdb->get_results(
						$wpdb->prepare(
							'SELECT id, question
                                                                      FROM ' . PRO_QUESTIONS_TABLE . '
                                                                      WHERE rsvpEventID = %d ORDER BY question',
							( $parentEventID > 0 ) ? $parentEventID : $eventID
						)
					);
					foreach ( $questions as $q ) {
						?>
						<option value="<?php echo $q->id; ?>" <?php echo ( in_array( $q->id, $attendeeListCustomQs ) ) ? 'selected="selected"' : ''; ?>>
							<?php echo esc_html( rsvp_pro_admin_prepare_custom_question_for_display( $q->question ) ); ?>
						</option>
						<?php
					}
					?>
				</select>
			</td>
		</tr>
	</tbody>
</table>
