Work on CRUD v2 API calls. Added sessions without files report.
This commit is contained in:
@@ -271,6 +271,97 @@ export async function handle_load_ae_obj_li__event_session(
|
||||
}
|
||||
|
||||
|
||||
// Updated 2024-08-14
|
||||
export async function handle_qry__event_session(
|
||||
{
|
||||
api_cfg,
|
||||
event_id,
|
||||
qry_str,
|
||||
qry_files,
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any,
|
||||
event_id: any,
|
||||
qry_str?: string,
|
||||
qry_files?: null|boolean,
|
||||
params?: any,
|
||||
try_cache?: boolean,
|
||||
log_lvl?: number
|
||||
}
|
||||
) {
|
||||
console.log(`*** handle_qry__event_session() *** event_id=${event_id} qry_str=${qry_str}`);
|
||||
|
||||
let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled
|
||||
let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden
|
||||
let limit: number = (params.qry__limit ?? 25); // 99
|
||||
let offset: number = (params.qry__offset ?? 0); // 0
|
||||
|
||||
let params_json: key_val = {};
|
||||
|
||||
// if (qry_str && qry_str.length > 2) {
|
||||
// params_json['ft_qry'] = {};
|
||||
// params_json['ft_qry']['default_qry_str'] = qry_str;
|
||||
// }
|
||||
|
||||
params_json['qry'] = {};
|
||||
|
||||
if (qry_files === true) {
|
||||
params_json['qry'] = [
|
||||
{
|
||||
type: "AND",
|
||||
field: "file_count_all",
|
||||
operator: ">",
|
||||
value: 0
|
||||
},
|
||||
];
|
||||
} else if (qry_files === false) {
|
||||
params_json['qry'] = [
|
||||
{
|
||||
type: "AND",
|
||||
field: "file_count_all",
|
||||
operator: "IS",
|
||||
value: null
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
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_v2({
|
||||
api_cfg: api_cfg,
|
||||
obj_type: 'event_session',
|
||||
for_obj_type: 'event',
|
||||
for_obj_id: event_id,
|
||||
use_alt_tbl: true, // NOTE: We want to use the alt table for session searching
|
||||
use_alt_mdl: false,
|
||||
use_alt_exp: false,
|
||||
enabled: enabled,
|
||||
hidden: hidden,
|
||||
order_by_li: order_by_li,
|
||||
limit: limit,
|
||||
offset: offset,
|
||||
params_json: params_json,
|
||||
params: params,
|
||||
log_lvl: log_lvl
|
||||
})
|
||||
.then(function (event_session_obj_li_get_result) {
|
||||
if (event_session_obj_li_get_result) {
|
||||
handle_db_save_ae_obj_li__event_session({obj_type: 'event_session', obj_li: event_session_obj_li_get_result});
|
||||
return event_session_obj_li_get_result;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
});
|
||||
|
||||
if (log_lvl) {
|
||||
console.log('ae_promises.load__event_session_obj_li:', ae_promises.load__event_session_obj_li);
|
||||
}
|
||||
return ae_promises.load__event_session_obj_li;
|
||||
}
|
||||
|
||||
|
||||
export async function handle_search__event_session(
|
||||
{
|
||||
api_cfg,
|
||||
@@ -280,6 +371,7 @@ export async function handle_search__event_session(
|
||||
like_search_qry_str = null,
|
||||
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
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
@@ -291,6 +383,7 @@ export async function handle_search__event_session(
|
||||
like_search_qry_str?: null|string,
|
||||
like_presentation_search_qry_str?: null|string,
|
||||
like_presenter_search_qry_str?: null|string,
|
||||
file_count?: boolean,
|
||||
params?: any,
|
||||
try_cache?: boolean,
|
||||
log_lvl?: number
|
||||
@@ -348,9 +441,9 @@ export async function handle_search__event_session(
|
||||
|
||||
params_json['and_qry'] = {};
|
||||
|
||||
// if (session_type_code) {
|
||||
// params_json['and_qry']['session_type_code'] = session_type_code;
|
||||
// }
|
||||
if (file_count) {
|
||||
params_json['and_qry']['file_count'] = file_count;
|
||||
}
|
||||
|
||||
let order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'start_datetime': 'ASC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'};
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ import {
|
||||
import {
|
||||
handle_load_ae_obj_id__event_session,
|
||||
handle_load_ae_obj_li__event_session,
|
||||
handle_qry__event_session,
|
||||
handle_search__event_session,
|
||||
handle_db_save_ae_obj_li__event_session,
|
||||
handle_email_sign_in__event_session,
|
||||
@@ -87,6 +88,7 @@ let export_obj = {
|
||||
|
||||
handle_load_ae_obj_id__event_session: handle_load_ae_obj_id__event_session,
|
||||
handle_load_ae_obj_li__event_session: handle_load_ae_obj_li__event_session,
|
||||
handle_qry__event_session: handle_qry__event_session,
|
||||
handle_search__event_session: handle_search__event_session,
|
||||
handle_email_sign_in__event_session: handle_email_sign_in__event_session,
|
||||
handle_db_save_ae_obj_li__event_session: handle_db_save_ae_obj_li__event_session,
|
||||
|
||||
@@ -8,6 +8,8 @@ import { get_object } from './api_get_object'; // Exported at the end of this fi
|
||||
import { patch_object } from './api_patch_object'; // Exported at the end of this file
|
||||
import { post_object } from './api_post_object'; // Exported at the end of this file
|
||||
|
||||
import { get_ae_obj_li_for_obj_id_crud_v2 } from '$lib/api_get__crud_obj_li_v2';
|
||||
|
||||
|
||||
// Updated 2023-12-01
|
||||
export let get_ae_obj_id_crud = async function get_ae_obj_id_crud(
|
||||
@@ -25,7 +27,7 @@ export let get_ae_obj_id_crud = async function get_ae_obj_id_crud(
|
||||
offset=0,
|
||||
data={},
|
||||
// key,
|
||||
jwt=null,
|
||||
// jwt=null,
|
||||
headers={},
|
||||
params={},
|
||||
timeout=25000,
|
||||
@@ -45,7 +47,7 @@ export let get_ae_obj_id_crud = async function get_ae_obj_id_crud(
|
||||
offset?: number,
|
||||
data?: any,
|
||||
// key: string,
|
||||
jwt?: string,
|
||||
// jwt?: string,
|
||||
headers?: any,
|
||||
params?: any,
|
||||
timeout?: number,
|
||||
@@ -1309,6 +1311,7 @@ export let send_email = async function send_email(
|
||||
// }
|
||||
|
||||
let obj = {
|
||||
get_ae_obj_li_for_obj_id_crud_v2: get_ae_obj_li_for_obj_id_crud_v2,
|
||||
delete_object: delete_object,
|
||||
get_object: get_object,
|
||||
patch_object: patch_object,
|
||||
|
||||
234
src/lib/api_get__crud_obj_li_v2.ts
Normal file
234
src/lib/api_get__crud_obj_li_v2.ts
Normal file
@@ -0,0 +1,234 @@
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
import { get_object } from './api_get_object'; // Exported at the end of this file
|
||||
|
||||
// The lookup "obj_type" should broken out into a separate function. - 2024-08-07
|
||||
// Updated 2023-11-15
|
||||
export async function get_ae_obj_li_for_obj_id_crud_v2(
|
||||
{
|
||||
api_cfg,
|
||||
obj_type,
|
||||
for_obj_type,
|
||||
for_obj_id, // NOTE: Changed 2023-12-06 to no longer required
|
||||
use_alt_tbl=false,
|
||||
use_alt_mdl=false,
|
||||
use_alt_exp=false,
|
||||
inc={},
|
||||
enabled='enabled',
|
||||
hidden='not_hidden',
|
||||
order_by_li=null,
|
||||
limit=999999,
|
||||
offset=0,
|
||||
// key,
|
||||
// jwt=null,
|
||||
headers={},
|
||||
params_json=null, // NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the API endpoint. Example: { "fulltext_search": { "default_qry_str": "Search string for default", "address_default_qry_str": "Search string for address", "contact_1_default_qry_str": "Search string for contact_1" } }
|
||||
// json_obj=null, // NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the search endpoint.
|
||||
params={},
|
||||
return_meta=false,
|
||||
log_lvl=1
|
||||
}: {
|
||||
api_cfg: any,
|
||||
obj_type: string,
|
||||
for_obj_type: string,
|
||||
for_obj_id?: string,
|
||||
use_alt_tbl?: boolean|string,
|
||||
use_alt_mdl?: boolean|string,
|
||||
use_alt_exp?: boolean|string,
|
||||
inc?: key_val
|
||||
enabled?: string,
|
||||
hidden?: string,
|
||||
order_by_li?: any,
|
||||
limit?: number,
|
||||
offset?: number,
|
||||
// key: string,
|
||||
// jwt?: string,
|
||||
headers?: any,
|
||||
params_json?: any,
|
||||
// json_obj?: any,
|
||||
params?: key_val,
|
||||
return_meta?: boolean,
|
||||
log_lvl?: number
|
||||
}
|
||||
) {
|
||||
if (log_lvl) {
|
||||
console.log('*** get_ae_obj_li_for_obj_id_crud() ***');
|
||||
}
|
||||
|
||||
// data = {};
|
||||
// data['super_key'] = key;
|
||||
// data['jwt'] = jwt;
|
||||
// NOTE: The key and or JWT should be in the header of the DELETE, GET, PATCH, POST
|
||||
|
||||
// const endpoint = `/crud/${obj_type}/list`;
|
||||
|
||||
let endpoint = '';
|
||||
if (obj_type == 'account') {
|
||||
endpoint = `/crud/account/list`;
|
||||
} else if (obj_type == 'address') {
|
||||
endpoint = `/crud/address/list`;
|
||||
} else if (obj_type == 'archive') {
|
||||
endpoint = `/crud/archive/list`;
|
||||
} else if (obj_type == 'archive_content') {
|
||||
endpoint = `/crud/archive/content/list`;
|
||||
} else if (obj_type == 'contact') {
|
||||
endpoint = `/crud/contact/list`;
|
||||
} else if (obj_type == 'data_store') {
|
||||
endpoint = `/crud/data_store/list`;
|
||||
} else if (obj_type == 'event') {
|
||||
endpoint = `/crud/event/list`;
|
||||
} else if (obj_type == 'event_abstract') {
|
||||
endpoint = `/crud/event/abstract/list`;
|
||||
} else if (obj_type == 'event_badge') {
|
||||
endpoint = `/crud/event/badge/list`;
|
||||
} else if (obj_type == 'event_device') {
|
||||
endpoint = `/crud/event/device/list`;
|
||||
} else if (obj_type == 'event_exhibit') {
|
||||
endpoint = `/crud/event/exhibit/list`;
|
||||
} else if (obj_type == 'event_exhibit_tracking') {
|
||||
endpoint = `/crud/event/exhibit/tracking/list`;
|
||||
} else if (obj_type == 'event_file') {
|
||||
endpoint = `/crud/event/file/list`;
|
||||
} else if (obj_type == 'event_location') {
|
||||
endpoint = `/crud/event/location/list`;
|
||||
} else if (obj_type == 'event_person') {
|
||||
endpoint = `/crud/event/person/list`;
|
||||
} else if (obj_type == 'event_presentation') {
|
||||
endpoint = `/crud/event/presentation/list`;
|
||||
} else if (obj_type == 'event_presenter') {
|
||||
endpoint = `/crud/event/presenter/list`;
|
||||
} else if (obj_type == 'event_session') {
|
||||
endpoint = `/crud/event/session/list`;
|
||||
} else if (obj_type == 'event_track') {
|
||||
endpoint = `/crud/event/track/list`;
|
||||
} else if (obj_type == 'grant') {
|
||||
endpoint = `/crud/grant/list`;
|
||||
} else if (obj_type == 'hosted_file') {
|
||||
endpoint = `/crud/hosted_file/list`;
|
||||
} else if (obj_type == 'journal') {
|
||||
endpoint = `/crud/journal/list`;
|
||||
} else if (obj_type == 'journal_entry') {
|
||||
endpoint = `/crud/journal/entry/list`;
|
||||
} else if (obj_type == 'order') {
|
||||
endpoint = `/crud/order/list`;
|
||||
} else if (obj_type == 'order_line') {
|
||||
endpoint = `/crud/order/line/list`;
|
||||
} else if (obj_type == 'page') {
|
||||
endpoint = `/crud/page/list`;
|
||||
} else if (obj_type == 'person') {
|
||||
endpoint = `/crud/person/list`;
|
||||
} else if (obj_type == 'post') {
|
||||
endpoint = `/crud/post/list`;
|
||||
} else if (obj_type == 'post_comment') {
|
||||
endpoint = `/crud/post/comment/list`;
|
||||
} else if (obj_type == 'site') {
|
||||
endpoint = `/crud/site/list`;
|
||||
} else if (obj_type == 'sponsorship_cfg') {
|
||||
endpoint = `/crud/sponsorship/cfg/list`;
|
||||
} else if (obj_type == 'sponsorship') {
|
||||
endpoint = `/crud/sponsorship/list`;
|
||||
// } else if (obj_type == 'user') {
|
||||
// endpoint = `/crud/user/list`;
|
||||
// } else if (obj_type == 'lu' && for_obj_type == 'country_subdivision') {
|
||||
// endpoint = `/crud/lu/country_subdivision/list`;
|
||||
// for_obj_type = null;
|
||||
// } else if (obj_type == 'lu' && for_obj_type == 'country') {
|
||||
// endpoint = `/crud/lu/country/list`;
|
||||
// for_obj_type = null;
|
||||
// } else if (obj_type == 'lu' && for_obj_type == 'time_zone') {
|
||||
// endpoint = `/crud/lu/time_zone/list`;
|
||||
// for_obj_type = null;
|
||||
} else {
|
||||
console.log(`Unknown object type: ${obj_type}`);
|
||||
return false;
|
||||
}
|
||||
endpoint = `/v2${endpoint}`;
|
||||
if (log_lvl) {
|
||||
console.log('Endpoint:', endpoint);
|
||||
}
|
||||
|
||||
if (for_obj_type) {
|
||||
params['for_obj_type'] = for_obj_type;
|
||||
}
|
||||
if (for_obj_id) {
|
||||
params['for_obj_id'] = for_obj_id;
|
||||
}
|
||||
|
||||
if (use_alt_tbl === true) {
|
||||
params['tbl_alt'] = 'alt'; // Use alternate table or view name
|
||||
}
|
||||
if (use_alt_mdl === true) {
|
||||
params['mdl_alt'] = 'alt'; // Use alternate model name
|
||||
}
|
||||
if (use_alt_exp === true) {
|
||||
params['exp_alt'] = 'alt'; // Use alternate export table or view name
|
||||
}
|
||||
|
||||
/* Need to deal with inc params here */
|
||||
|
||||
let allowed_enabled_list = ['all', 'enabled', 'not_enabled']
|
||||
if (allowed_enabled_list.includes(enabled) ) {
|
||||
params['enabled'] = enabled;
|
||||
}
|
||||
|
||||
let allowed_hidden_list = ['all', 'hidden', 'not_hidden'];
|
||||
if (allowed_hidden_list.includes(hidden) ) {
|
||||
params['hidden'] = hidden;
|
||||
}
|
||||
|
||||
// NOTE: The order_by_li variable is in the "headers" because if is a the URL GET params do not handle multiple values very well. Maybe base64 encore in the future or something? Reminder that GET requests should not have a body (no JSON).
|
||||
// NOTE: The order_by_li should be a key value pair of the property/DB field to sort and how to sort (ASC or DESC)
|
||||
if (order_by_li) {
|
||||
headers['order_by_li'] = order_by_li;
|
||||
}
|
||||
|
||||
if (limit >= 0) {
|
||||
params['limit'] = limit;
|
||||
}
|
||||
|
||||
if (offset >= 0) {
|
||||
params['offset'] = offset;
|
||||
}
|
||||
|
||||
if (params_json) {
|
||||
// NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the search endpoint.
|
||||
// Max characters for a GET request is 2083. This is a limitation of the browser (Microsoft IE and Edge).
|
||||
console.log('JSON Object:', params_json);
|
||||
console.log(JSON.stringify(params_json));
|
||||
// NOTE: "jp" stands for "JSON Params"
|
||||
params['jp'] = encodeURIComponent(JSON.stringify(params_json));
|
||||
if (params['jp'].length > 2083) {
|
||||
console.log(`The JSON object is too large to be used as a GET parameter. The overall max URL length is 2083 characters. Please use the POST endpoint instead. Length = ${params['jp'].length} [THIS DOES NOT EXIST YET]`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// if (json_obj) {
|
||||
// // NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the search endpoint.
|
||||
// // Max characters for a GET request is 2083. This is a limitation of the browser (Microsoft IE and Edge).
|
||||
// console.log('JSON Object:', json_obj);
|
||||
// params['json_str'] = encodeURIComponent(JSON.stringify(json_obj));
|
||||
// if (params['json_str'].length > 2083) {
|
||||
// console.log(`The JSON object is too large to be used as a GET parameter. The overall max URL length is 2083 characters. Please use the POST endpoint instead. Length = ${params['json_str'].length} [THIS DOES NOT EXIST YET]`);
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
|
||||
if (log_lvl) {
|
||||
console.log('Params:', params);
|
||||
}
|
||||
|
||||
let object_li_get_promise = await get_object({
|
||||
api_cfg: api_cfg,
|
||||
endpoint: endpoint,
|
||||
headers: headers,
|
||||
params: params,
|
||||
return_meta: return_meta,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
|
||||
if (log_lvl > 1) {
|
||||
console.log(object_li_get_promise);
|
||||
}
|
||||
|
||||
return object_li_get_promise;
|
||||
}
|
||||
@@ -97,7 +97,8 @@ let lq_kv__event_file_obj_li = liveQuery(
|
||||
class="">
|
||||
{#each $lq_kv__event_file_obj_li as event_file_obj}
|
||||
<tr
|
||||
class:dim={event_file_obj?.hide}>
|
||||
class:dim={event_file_obj?.hide}
|
||||
>
|
||||
<td class="px-4 py-2">
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
<script lang="ts">
|
||||
// Imports
|
||||
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
|
||||
import { liveQuery } from "dexie";
|
||||
import { browser } from '$app/environment';
|
||||
import { core_func } from '$lib/ae_core_functions';
|
||||
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
||||
import { ae_util } from '$lib/ae_utils';
|
||||
// Imports - events specific
|
||||
import { events_loc, events_sess, events_slct, events_trigger, events_trig_kv } from '$lib/ae_events_stores';
|
||||
import { db_events } from "$lib/db_events";
|
||||
import { events_func } from '$lib/ae_events_functions';
|
||||
|
||||
// Exports
|
||||
export let container_class_li: string|Array<string> = [];
|
||||
// export let link_to_type: string;
|
||||
// export let link_to_id: string;
|
||||
// export let event_presenter_id_random_li: Array<string> = [''];
|
||||
export let event_session_id_random_li: Array<string>;
|
||||
// export let allow_basic: boolean = false;
|
||||
// export let allow_moderator: boolean = false;
|
||||
|
||||
// export let display_mode: string = 'default'; // 'default', 'compact', 'minimal', 'launcher';
|
||||
|
||||
// Functions and Logic
|
||||
if (browser) {
|
||||
console.log('Pres Mgmt [comp]: +ae_comp__event_session_obj_tbl.svelte');
|
||||
}
|
||||
|
||||
let lq_kv__event_session_obj_li = liveQuery(
|
||||
() => db_events.sessions
|
||||
.bulkGet(event_session_id_random_li)
|
||||
);
|
||||
</script>
|
||||
|
||||
|
||||
<section class="ae_comp event_session_obj_tbl container {container_class_li}">
|
||||
|
||||
{#if event_session_id_random_li && event_session_id_random_li?.length > 0 && $events_slct.event_session_obj_li?.length == $lq_kv__event_session_obj_li?.length}
|
||||
|
||||
<div class="container overflow-auto">
|
||||
<h2 class="h3">
|
||||
<span class="text-base">
|
||||
Results:
|
||||
</span>
|
||||
|
||||
{#if $lq_kv__event_session_obj_li?.length}
|
||||
<span class="text-3xl font-bold bg-success-100 px-4 border rounded-lg border-success-200"
|
||||
title="Count {$lq_kv__event_session_obj_li.length ?? 'None'}"
|
||||
>
|
||||
<span class="fas fa-list-ol mx-4"></span>
|
||||
{$lq_kv__event_session_obj_li.length ?? 'None'}
|
||||
</span>
|
||||
{/if}
|
||||
</h2>
|
||||
|
||||
<table
|
||||
class="table table-auto table-striped table-hover w-full text-xs lg:text-sm"
|
||||
>
|
||||
<thead
|
||||
class=""
|
||||
>
|
||||
<tr>
|
||||
<th class="px-4 py-2">Name</th>
|
||||
<th class="px-4 py-2">Start Datetime</th>
|
||||
<th class="px-4 py-2">Location</th>
|
||||
<th class="px-4 py-2">Session Files</th>
|
||||
<th class="px-4 py-2">Presenter Files</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody
|
||||
class="">
|
||||
{#each $lq_kv__event_session_obj_li as event_session_obj, index}
|
||||
<tr
|
||||
class:dim={event_session_obj?.hide}
|
||||
>
|
||||
<td class="px-4 py-2">
|
||||
<a
|
||||
href="/events/pres_mgmt/{event_session_obj?.event_id_random}/session/{event_session_obj?.event_session_id_random}"
|
||||
class="text-blue-500 hover:text-blue-800 hover:underline"
|
||||
>
|
||||
{event_session_obj?.name}
|
||||
</a>
|
||||
</td>
|
||||
<td class="px-4 py-2">
|
||||
{ae_util.iso_datetime_formatter(event_session_obj?.start_datetime, 'datetime_us_no_seconds')}
|
||||
</td>
|
||||
<td class="px-4 py-2">
|
||||
{event_session_obj?.event_location_name}
|
||||
</td>
|
||||
<td class="px-4 py-2">
|
||||
{event_session_obj?.file_count ?? '0'}
|
||||
</td>
|
||||
<td class="px-4 py-2">
|
||||
{event_session_obj?.file_count_all ?? '0'}
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{:else}
|
||||
<p class="text-sm">
|
||||
No sessions found.
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
|
||||
</section>
|
||||
@@ -11,6 +11,7 @@ import { ae_util } from '$lib/ae_utils';
|
||||
// import Element_ae_crud from '$lib/element_ae_crud.svelte';
|
||||
import Element_data_store from '$lib/element_data_store.svelte';
|
||||
import Comp_event_file_obj_tbl from '../../../ae_comp__event_file_obj_tbl.svelte';
|
||||
import Comp_event_session_obj_tbl from '../../../ae_comp__event_session_obj_tbl.svelte';
|
||||
// import Comp_event_presenter_obj_li from '../../../ae_comp__event_presenter_obj_li.svelte';
|
||||
import Comp_event_presenter_obj_tbl from '../../../ae_comp__event_presenter_obj_tbl.svelte';
|
||||
|
||||
@@ -37,10 +38,10 @@ let lq__event_obj = liveQuery(
|
||||
() => db_events.events.get($events_slct.event_id)
|
||||
);
|
||||
|
||||
let event_file_id_random_li: string[] = []; // ['NPKOzGFKZZU'];
|
||||
let event_session_id_random_li: string[] = ['VSBH-19-41-50'];
|
||||
let event_presentation_id_random_li: string[] = ['VSBH-19-41-50'];
|
||||
let event_presenter_id_random_li: string[] = [];// ['I245hLQ4aek'];
|
||||
let event_file_id_random_li: string[];
|
||||
let event_session_id_random_li: string[] = [];
|
||||
// let event_presentation_id_random_li: string[] = [];
|
||||
let event_presenter_id_random_li: string[] = [];
|
||||
|
||||
let load_obj_li_results: Promise<any>|key_val;
|
||||
let search_submit_results: Promise<any>|key_val;
|
||||
@@ -62,8 +63,6 @@ onMount(() => {
|
||||
|
||||
async function handle_search__event_file(
|
||||
{
|
||||
api_cfg,
|
||||
event_id,
|
||||
created_on = null,
|
||||
ft_search_str = '',
|
||||
lk_search_str = '',
|
||||
@@ -72,11 +71,9 @@ async function handle_search__event_file(
|
||||
'qry__hidden': $events_loc.pres_mgmt.qry_hidden ?? 'not_hidden',
|
||||
'qry__limit': $events_loc.pres_mgmt.qry_limit__session ?? 35,
|
||||
},
|
||||
try_cache=false,
|
||||
try_cache=true,
|
||||
log_lvl=0,
|
||||
}: {
|
||||
api_cfg: any,
|
||||
event_id: string,
|
||||
created_on?: null|string,
|
||||
ft_search_str?: string,
|
||||
lk_search_str?: string,
|
||||
@@ -141,23 +138,18 @@ async function handle_search__event_file(
|
||||
|
||||
async function handle_search__event_presenter(
|
||||
{
|
||||
api_cfg,
|
||||
event_id,
|
||||
agree = null,
|
||||
biography = null,
|
||||
ft_search_str = '',
|
||||
lk_search_str = '',
|
||||
search_delay = 0,
|
||||
max_tries = 5,
|
||||
params = {
|
||||
'qry__enabled': 'enabled',
|
||||
'qry__hidden': 'not_hidden',
|
||||
'qry__limit': 200,},
|
||||
try_cache=false,
|
||||
'qry__enabled': $events_loc.pres_mgmt.qry_enabled ?? 'enabled',
|
||||
'qry__hidden': $events_loc.pres_mgmt.qry_hidden ?? 'not_hidden',
|
||||
'qry__limit': $events_loc.pres_mgmt.qry_limit__presenters ?? 200,
|
||||
},
|
||||
try_cache=true,
|
||||
log_lvl=0,
|
||||
}: {
|
||||
api_cfg: any,
|
||||
event_id: string,
|
||||
agree?: null|boolean,
|
||||
biography?: null|boolean,
|
||||
ft_search_str?: string,
|
||||
@@ -226,19 +218,84 @@ async function handle_search__event_presenter(
|
||||
});
|
||||
}
|
||||
|
||||
// handle_search__event_presenter({
|
||||
// api_cfg: $ae_api,
|
||||
// event_id: $events_slct.event_id,
|
||||
// agree: true,
|
||||
// ft_search_str: '',
|
||||
// lk_search_str: '',
|
||||
// params: {
|
||||
// 'qry__enabled': 'enabled',
|
||||
// 'qry__hidden': 'not_hidden',
|
||||
// 'qry__limit': 35,},
|
||||
// try_cache: false,
|
||||
// log_lvl: 0,
|
||||
// });
|
||||
async function handle_qry__event_session(
|
||||
{
|
||||
qry_files = false,
|
||||
// file_count = false,
|
||||
// file_count_all = null,
|
||||
// ft_search_str = '',
|
||||
// lk_search_str = '',
|
||||
params = {
|
||||
'qry__enabled': $events_loc.pres_mgmt.qry_enabled ?? 'enabled',
|
||||
'qry__hidden': $events_loc.pres_mgmt.qry_hidden ?? 'not_hidden',
|
||||
'qry__limit': $events_loc.pres_mgmt.qry_limit__session ?? 150,
|
||||
},
|
||||
log_lvl=2,
|
||||
}: {
|
||||
qry_files?: boolean,
|
||||
// file_count?: boolean,
|
||||
// file_count_all?: null|number,
|
||||
// ft_search_str?: string,
|
||||
// lk_search_str?: string,
|
||||
params?: key_val,
|
||||
log_lvl?: number,
|
||||
}
|
||||
) {
|
||||
console.log('handle_qry__event_session()');
|
||||
|
||||
$events_sess.pres_mgmt.status_qry__search = 'loading';
|
||||
$events_sess.pres_mgmt.status_rpt[$events_sess.pres_mgmt.show_report] = 'loading';
|
||||
|
||||
ae_promises.handle_qry__event_session = events_func.handle_qry__event_session({
|
||||
api_cfg: $ae_api,
|
||||
event_id: $events_slct.event_id,
|
||||
// file_count_all: file_count_all,
|
||||
// fulltext_search_qry_str: ft_search_str,
|
||||
// like_search_qry_str: lk_search_str,
|
||||
// external_event_id: $events_loc.pres_mgmt.default__external_registration_id,
|
||||
qry_files: qry_files,
|
||||
params: params,
|
||||
log_lvl: log_lvl,
|
||||
})
|
||||
.then(function (search_results) {
|
||||
// Processing the results from the search.
|
||||
$events_sess.pres_mgmt.status_qry__search = 'processing';
|
||||
$events_sess.pres_mgmt.status_rpt[$events_sess.pres_mgmt.show_report] = 'processing';
|
||||
$events_slct.event_session_obj_li = search_results;
|
||||
console.log(search_results);
|
||||
// $events_sess.pres_mgmt.status_qry__search = 'done';
|
||||
})
|
||||
.finally(() => {
|
||||
if (log_lvl) {
|
||||
console.log('TEST SEARCH - Search done. Pulling out the event_session_id_randoms.');
|
||||
}
|
||||
// console.log(`TEST search: ${$lq_kv__event_session_obj_li}`);
|
||||
|
||||
event_session_id_random_li = [];
|
||||
|
||||
// We need to loop through the array of objects and get the event_session_id_random from each object a new list of event_session_id_randoms. Then we can use this list to get the full objects from the database.
|
||||
let tmp_li = []; // This is to prevent the array from constantly updating and triggering the liveQuery.
|
||||
if ($events_slct.event_session_obj_li) {
|
||||
for (let i = 0; i < $events_slct.event_session_obj_li.length; i++) {
|
||||
tmp_li.push($events_slct.event_session_obj_li[i].event_session_id_random);
|
||||
}
|
||||
}
|
||||
event_session_id_random_li = tmp_li;
|
||||
|
||||
// event_session_id_random_li = $events_slct.event_session_obj_li.map(session_obj => session_obj.event_session_id_random);
|
||||
|
||||
// Finally done with the search.
|
||||
$events_sess.pres_mgmt.status_qry__search = 'done';
|
||||
$events_sess.pres_mgmt.status_rpt[$events_sess.pres_mgmt.show_report] = 'done';
|
||||
|
||||
if (log_lvl > 1) {
|
||||
console.log(`TEST SEARCH - event_session_id_random_li:`, event_session_id_random_li);
|
||||
// console.log(`TEST SEARCH - search live query: ${$lq_kv__event_session_obj_li}`);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@@ -253,7 +310,7 @@ async function handle_search__event_presenter(
|
||||
<section
|
||||
class="
|
||||
ae_events_pres_mgmt_event
|
||||
h-full mx-auto
|
||||
md:container h-full mx-auto
|
||||
flex flex-col gap-1
|
||||
py-1 px-2 pb-16
|
||||
items-center
|
||||
@@ -280,23 +337,16 @@ async function handle_search__event_presenter(
|
||||
/>
|
||||
|
||||
|
||||
<div class="variant-ghost-success my-2 p-2 rounded-md flex flex-row items-center">
|
||||
<div class="variant-ghost-success my-2 p-2 rounded-md flex flex-row flex-wrap gap-1 items-center justify-center">
|
||||
|
||||
<button
|
||||
type="button"
|
||||
disabled={!$ae_loc.trusted_access}
|
||||
on:click={() => {
|
||||
ae_promises.handle_search__event_presenter = handle_search__event_presenter({
|
||||
api_cfg: $ae_api,
|
||||
event_id: $events_slct.event_id,
|
||||
agree: true,
|
||||
ft_search_str: '',
|
||||
lk_search_str: '',
|
||||
params: {
|
||||
'qry__enabled': 'enabled',
|
||||
'qry__hidden': 'not_hidden',
|
||||
'qry__limit': $events_sess.pres_mgmt.qry_limit__presenters,},
|
||||
try_cache: false,
|
||||
log_lvl: log_lvl,
|
||||
});
|
||||
$events_sess.pres_mgmt.show_report = 'presenters_agree';
|
||||
@@ -304,7 +354,7 @@ async function handle_search__event_presenter(
|
||||
// $events_sess.pres_mgmt.show_report__presenters_biography = false;
|
||||
// $events_sess.pres_mgmt.show_report__recent_files = false;
|
||||
}}
|
||||
class="btn btn-sm variant-ghost-success hover:variant-filled-success transition-all mx-1"
|
||||
class="btn btn-sm variant-ghost-success hover:variant-filled-success transition-all m-1"
|
||||
title="Show presenters who have agreed to present."
|
||||
>
|
||||
<!-- {#await ae_promises.handle_search__event_presenter}
|
||||
@@ -322,16 +372,9 @@ async function handle_search__event_presenter(
|
||||
disabled={!$ae_loc.trusted_access}
|
||||
on:click={() => {
|
||||
handle_search__event_presenter({
|
||||
api_cfg: $ae_api,
|
||||
event_id: $events_slct.event_id,
|
||||
biography: true,
|
||||
ft_search_str: '',
|
||||
lk_search_str: '',
|
||||
params: {
|
||||
'qry__enabled': 'enabled',
|
||||
'qry__hidden': 'not_hidden',
|
||||
'qry__limit': $events_sess.pres_mgmt.qry_limit__presenters,},
|
||||
try_cache: false,
|
||||
log_lvl: log_lvl,
|
||||
});
|
||||
$events_sess.pres_mgmt.show_report = 'presenters_biography';
|
||||
@@ -339,7 +382,7 @@ async function handle_search__event_presenter(
|
||||
// $events_sess.pres_mgmt.show_report__presenters_agree = false;
|
||||
// $events_sess.pres_mgmt.show_report__recent_files = false;
|
||||
}}
|
||||
class="btn btn-sm variant-ghost-success hover:variant-filled-success transition-all mx-1"
|
||||
class="btn btn-sm variant-ghost-success hover:variant-filled-success transition-all m-1"
|
||||
title="NOT READY YET: Show presenters with bios."
|
||||
>
|
||||
{#if $events_sess.pres_mgmt?.show_report == 'presenters_biography' && $events_sess.pres_mgmt.status_rpt[$events_sess.pres_mgmt?.show_report] == 'loading'}
|
||||
@@ -354,17 +397,9 @@ async function handle_search__event_presenter(
|
||||
disabled={!$ae_loc.trusted_access}
|
||||
on:click={() => {
|
||||
handle_search__event_file({
|
||||
api_cfg: $ae_api,
|
||||
event_id: $events_slct.event_id,
|
||||
created_on: null,
|
||||
ft_search_str: '',
|
||||
lk_search_str: '',
|
||||
params: {
|
||||
'qry__enabled': $events_loc.pres_mgmt.qry_enabled ?? 'enabled',
|
||||
'qry__hidden': $events_loc.pres_mgmt.qry_hidden ?? 'not_hidden',
|
||||
'qry__limit': $events_loc.pres_mgmt.qry_limit__files ?? 35,
|
||||
},
|
||||
try_cache: false,
|
||||
log_lvl: log_lvl,
|
||||
});
|
||||
$events_sess.pres_mgmt.show_report = 'recent_files';
|
||||
@@ -372,7 +407,7 @@ async function handle_search__event_presenter(
|
||||
// $events_sess.pres_mgmt.show_report__presenters_biography = false;
|
||||
// $events_sess.pres_mgmt.show_report__recent_files = !$events_sess.pres_mgmt.show_report__recent_files;
|
||||
}}
|
||||
class="btn btn-sm variant-ghost-success hover:variant-filled-success transition-all mx-1"
|
||||
class="btn btn-sm variant-ghost-success hover:variant-filled-success transition-all m-1"
|
||||
title="Show recent file uploads."
|
||||
>
|
||||
{#if $events_sess.pres_mgmt?.show_report == 'recent_files' && $events_sess.pres_mgmt.status_rpt[$events_sess.pres_mgmt?.show_report] == 'loading'}
|
||||
@@ -387,23 +422,12 @@ async function handle_search__event_presenter(
|
||||
type="button"
|
||||
disabled={!$ae_loc.administrator_access}
|
||||
on:click={() => {
|
||||
handle_search__event_session({
|
||||
api_cfg: $ae_api,
|
||||
event_id: $events_slct.event_id,
|
||||
created_on: null,
|
||||
ft_search_str: '',
|
||||
lk_search_str: '',
|
||||
params: {
|
||||
'qry__enabled': $events_loc.pres_mgmt.qry_enabled ?? 'enabled',
|
||||
'qry__hidden': $events_loc.pres_mgmt.qry_hidden ?? 'not_hidden',
|
||||
'qry__limit': $events_loc.pres_mgmt.qry_limit__files ?? 35,
|
||||
},
|
||||
try_cache: false,
|
||||
log_lvl: log_lvl,
|
||||
handle_qry__event_session({
|
||||
qry_files: false,
|
||||
});
|
||||
$events_sess.pres_mgmt.show_report = 'session_no_files';
|
||||
}}
|
||||
class="btn btn-sm variant-ghost-success hover:variant-filled-success transition-all mx-1"
|
||||
class="btn btn-sm variant-ghost-success hover:variant-filled-success transition-all m-1"
|
||||
title="Show sessions without files uploaded."
|
||||
>
|
||||
{#if $events_sess.pres_mgmt?.show_report == 'session_no_files' && $events_sess.pres_mgmt.status_rpt[$events_sess.pres_mgmt?.show_report] == 'loading'}
|
||||
@@ -459,7 +483,7 @@ async function handle_search__event_presenter(
|
||||
{/if}
|
||||
|
||||
<!-- Show recently uploaded files -->
|
||||
{#if $events_sess.pres_mgmt.show_report == 'recent_files' && event_file_id_random_li?.length > 0}
|
||||
{#if $events_sess.pres_mgmt.show_report == 'recent_files' && event_file_id_random_li}
|
||||
<h3 class="h4 text-center">Recent File Uploads</h3>
|
||||
|
||||
<Comp_event_file_obj_tbl
|
||||
@@ -472,12 +496,23 @@ async function handle_search__event_presenter(
|
||||
</Comp_event_file_obj_tbl>
|
||||
{/if}
|
||||
|
||||
|
||||
<!-- Show sessions without files -->
|
||||
{#if $events_sess.pres_mgmt.show_report == 'session_no_files' && event_session_id_random_li?.length > 0}
|
||||
<h3 class="h4 text-center">Sessions without Files</h3>
|
||||
|
||||
<Comp_event_session_obj_tbl
|
||||
bind:event_session_id_random_li={event_session_id_random_li}
|
||||
>
|
||||
</Comp_event_session_obj_tbl>
|
||||
{/if}
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<style lang="postcss">
|
||||
/* Use the div.ae_quick_modal_container to block background clicks when using the section.ae_quick_popover. */
|
||||
div.ae_quick_modal_container {
|
||||
/* div.ae_quick_modal_container {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
@@ -485,10 +520,10 @@ div.ae_quick_modal_container {
|
||||
height: 100%;
|
||||
z-index: 100;
|
||||
background-color: hsla(0, 0%, 0%, .5);
|
||||
}
|
||||
} */
|
||||
|
||||
/* The section.ae_quick_popover should be above the rest of the content and centered on the page. */
|
||||
section.ae_quick_popover {
|
||||
/* section.ae_quick_popover {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
@@ -501,5 +536,5 @@ section.ae_quick_popover {
|
||||
|
||||
min-height: 30%;
|
||||
min-width: 80%;
|
||||
}
|
||||
} */
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user