Now with search by location name!
This commit is contained in:
@@ -399,6 +399,7 @@ export async function search__event_session(
|
||||
like_presentation_search_qry_str = null,
|
||||
like_presenter_search_qry_str = null,
|
||||
file_count = false, // If true then only show those that have a file count
|
||||
location_name = null,
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
@@ -411,6 +412,7 @@ export async function search__event_session(
|
||||
like_presentation_search_qry_str?: null|string,
|
||||
like_presenter_search_qry_str?: null|string,
|
||||
file_count?: boolean,
|
||||
location_name?: null|string,
|
||||
params?: any,
|
||||
try_cache?: boolean,
|
||||
log_lvl?: number
|
||||
@@ -472,6 +474,11 @@ export async function search__event_session(
|
||||
params_json['and_qry']['file_count'] = file_count;
|
||||
}
|
||||
|
||||
// This should be using a like with surrounded by %'s
|
||||
if (location_name) {
|
||||
params_json['and_qry']['event_location_name'] = location_name;
|
||||
}
|
||||
|
||||
let order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'start_datetime': 'ASC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'};
|
||||
|
||||
ae_promises.load__event_session_obj_li = await api.get_ae_obj_li_for_obj_id_crud({
|
||||
|
||||
@@ -206,6 +206,7 @@ let events_local_data_struct: key_val = {
|
||||
show_content__session_presentations: false,
|
||||
show_content__session_search_view: null,
|
||||
show_content__session_search_help: true,
|
||||
show_content__session_search_room_name: false,
|
||||
show_content__session_view: null,
|
||||
show_content__session_qr: true,
|
||||
hide__session_poc: true,
|
||||
@@ -377,6 +378,7 @@ let events_session_data_struct: key_val = {
|
||||
presenter__updated_on: null,
|
||||
session_updated_on: null,
|
||||
|
||||
location_name_qry_str: null,
|
||||
fulltext_search_qry_str: null,
|
||||
status_qry__search: null,
|
||||
|
||||
|
||||
@@ -124,6 +124,9 @@ let ae_triggers: key_val = {};
|
||||
if ($events_loc.pres_mgmt?.save_search_text && $events_loc.pres_mgmt?.saved_search__session) {
|
||||
$events_sess.pres_mgmt.fulltext_search_qry_str = $events_loc.pres_mgmt.saved_search__session;
|
||||
}
|
||||
if ($events_loc.pres_mgmt?.save_search_text && $events_loc.pres_mgmt?.saved_search__session_location_name) {
|
||||
$events_sess.pres_mgmt.location_name_qry_str = $events_loc.pres_mgmt.saved_search__session_location_name;
|
||||
}
|
||||
|
||||
|
||||
// Functions and Logic
|
||||
@@ -144,6 +147,7 @@ $: if ($events_trigger == 'load__event_session_obj_li' && $events_slct.event_id)
|
||||
console.log(`*** Save search text *** ${$events_loc.pres_mgmt.save_search_text}`);
|
||||
}
|
||||
$events_loc.pres_mgmt.saved_search__session = $events_sess.pres_mgmt.fulltext_search_qry_str;
|
||||
$events_loc.pres_mgmt.saved_search__session_location_name = $events_sess.pres_mgmt.location_name_qry_str;
|
||||
}
|
||||
|
||||
if ( $events_sess.pres_mgmt.fulltext_search_qry_str?.length > 2 ) {
|
||||
@@ -197,10 +201,17 @@ function process_search_string(search_str: string) {
|
||||
|
||||
console.log(`"${search_str}"`);
|
||||
|
||||
let location_name = '';
|
||||
if ($events_sess.pres_mgmt.location_name_qry_str?.length) {
|
||||
location_name = $events_sess.pres_mgmt.location_name_qry_str;
|
||||
console.log(`Location name: ${location_name}`);
|
||||
}
|
||||
|
||||
|
||||
handle_search__event_session({
|
||||
ft_search_str: ft_search_str_new,
|
||||
lk_search_str: lk_search_str_new,
|
||||
and_lk_location_name: location_name,
|
||||
// fulltext_search_qry_str: ft_search_str_new,
|
||||
// ft_presenter_search_qry_str: null,
|
||||
// like_search_qry_str: lk_search_str_new,
|
||||
@@ -217,6 +228,7 @@ async function handle_search__event_session(
|
||||
{
|
||||
ft_search_str = '',
|
||||
lk_search_str = '',
|
||||
and_lk_location_name = '',
|
||||
search_delay = 0,
|
||||
max_tries = 5,
|
||||
params = {
|
||||
@@ -229,6 +241,7 @@ async function handle_search__event_session(
|
||||
}: {
|
||||
ft_search_str?: string,
|
||||
lk_search_str?: string,
|
||||
and_lk_location_name?: string,
|
||||
search_delay?: number, // In milliseconds
|
||||
max_tries?: number,
|
||||
params?: key_val,
|
||||
@@ -277,6 +290,7 @@ async function handle_search__event_session(
|
||||
like_presentation_search_qry_str: lk_search_str,
|
||||
like_presenter_search_qry_str: lk_search_str,
|
||||
// external_event_id: $events_loc.pres_mgmt.default__external_registration_id,
|
||||
location_name: and_lk_location_name,
|
||||
params: params,
|
||||
try_cache: try_cache,
|
||||
log_lvl: 0,
|
||||
@@ -368,6 +382,38 @@ async function handle_search__event_session(
|
||||
autocomplete="off"
|
||||
class="form flex-grow flex flex-row flex-wrap gap-1 justify-center items-center w-full"
|
||||
>
|
||||
|
||||
|
||||
<!-- Show/Hide session location name search button -->
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-sm variant-ghost-warning hover:variant-filled-warning transition-all mx-1"
|
||||
class:hidden={!$ae_loc.authenticated_access}
|
||||
on:click={() => {
|
||||
$events_sess.pres_mgmt.location_name_qry_str = '';
|
||||
$events_loc.pres_mgmt.show_content__session_search_room_name = !$events_loc.pres_mgmt.show_content__session_search_room_name;
|
||||
}}
|
||||
>
|
||||
<span class="fas fa-search-location"></span>
|
||||
</button>
|
||||
|
||||
<input
|
||||
type="search"
|
||||
name="location_name"
|
||||
placeholder="Location"
|
||||
id="session_location_name"
|
||||
bind:value={$events_sess.pres_mgmt.location_name_qry_str}
|
||||
on:keyup={() => {
|
||||
if ($events_sess.pres_mgmt?.location_name_qry_str && $events_sess.pres_mgmt.location_name_qry_str.length >= 3) {
|
||||
$events_trigger = 'load__event_session_obj_li';
|
||||
}
|
||||
}}
|
||||
class="input text-xs hover:text-lg font-bold font-mono w-28 transition-all mx-1"
|
||||
class:hidden={!$ae_loc.authenticated_access || !$events_loc.pres_mgmt.show_content__session_search_room_name}
|
||||
suggest="off"
|
||||
data-ignore="true"
|
||||
/>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-sm variant-ghost-warning hover:variant-filled-warning transition-all mx-1"
|
||||
|
||||
Reference in New Issue
Block a user