diff --git a/src/lib/db_events.ts b/src/lib/db_events.ts index 70b444c1..8a81324a 100644 --- a/src/lib/db_events.ts +++ b/src/lib/db_events.ts @@ -210,10 +210,6 @@ export interface Exhibit_tracking { } -export interface Registration { - // Nothing here yet -} - export interface File { id: string; id_random: string; @@ -329,87 +325,6 @@ export interface Location { } -// Updated 2024-06-19 -export interface Session { - id: string; - // id_random: string; - event_session_id: string; - event_session_id_random: string; - - external_id: null|string; - code: null|string; - - for_type: string; - for_id: string; - for_id_random: string; - - type_code?: string; - - event_id: string; - event_id_random: string; - event_location_id?: null|string; - event_location_id_random?: null|string; - - poc_person_id?: null|string; - poc_person_id_random?: null|string; - poc_agree?: null|boolean; // General catchall for agreement or consent by the POC - poc_kv_json?: null|key_val; // Key value list of the POC by type (examples: 'advocate', 'chair', 'champion', 'moderator', 'organizer') - - name: string; - description?: null|string; - - start_datetime?: null|Date; - end_datetime?: null|Date; - - passcode?: null|string; - - hide_event_launcher?: null|boolean; - - alert?: null|boolean; - alert_msg?: null|string; - - data_json?: null|string; - - ux_mode?: null|string; // 'colloquium', 'lecture', 'panel', 'poster', 'symposium', 'workshop' - // colloquium - Specialists present on related topics with questions - // symposium - A discussion, less formal - - enable: null|boolean; - hide: null|boolean; - priority: null|boolean - sort: null|number; - group: null|string; - notes: null|string; - created_on: Date; - updated_on: null|Date; - - // Additional fields for convenience (database views) - file_count?: null|number; // Only files directly under a session - file_count_all?: null|number; // All files under a session - internal_use_count?: null|number; // Files marked for internal use - event_file_id_li_json?: null|string; - - poc_person_given_name?: null|string; - poc_person_family_name?: null|string; - poc_person_full_name?: null|string; - poc_person_primary_email?: null|string; - poc_person_passcode?: null|string; - - - event_name?: null|string; - - event_location_code?: null|string; - event_location_name?: null|string; - - // A key value list of the presentations - event_presentation_kv?: null|key_val; - event_presentation_li?: null|list; - // A key value list of the files - event_file_kv?: null|key_val; - event_file_li?: null|list; -} - - // Updated 2024-06-10 export interface Presentation { id: string; @@ -553,6 +468,93 @@ export interface Presenter { } + +export interface Registration { + // Nothing here yet +} + + +// Updated 2024-06-19 +export interface Session { + id: string; + // id_random: string; + event_session_id: string; + event_session_id_random: string; + + external_id: null|string; + code: null|string; + + for_type: string; + for_id: string; + for_id_random: string; + + type_code?: string; + + event_id: string; + event_id_random: string; + event_location_id?: null|string; + event_location_id_random?: null|string; + + poc_person_id?: null|string; + poc_person_id_random?: null|string; + poc_agree?: null|boolean; // General catchall for agreement or consent by the POC + poc_kv_json?: null|key_val; // Key value list of the POC by type (examples: 'advocate', 'chair', 'champion', 'moderator', 'organizer') + + name: string; + description?: null|string; + + start_datetime?: null|Date; + end_datetime?: null|Date; + + passcode?: null|string; + + hide_event_launcher?: null|boolean; + + alert?: null|boolean; + alert_msg?: null|string; + + data_json?: null|string; + + ux_mode?: null|string; // 'colloquium', 'lecture', 'panel', 'poster', 'symposium', 'workshop' + // colloquium - Specialists present on related topics with questions + // symposium - A discussion, less formal + + enable: null|boolean; + hide: null|boolean; + priority: null|boolean + sort: null|number; + group: null|string; + notes: null|string; + created_on: Date; + updated_on: null|Date; + + // Additional fields for convenience (database views) + file_count?: null|number; // Only files directly under a session + file_count_all?: null|number; // All files under a session + internal_use_count?: null|number; // Files marked for internal use + event_file_id_li_json?: null|string; + + poc_person_given_name?: null|string; + poc_person_family_name?: null|string; + poc_person_full_name?: null|string; + poc_person_primary_email?: null|string; + poc_person_passcode?: null|string; + + + event_name?: null|string; + + event_location_code?: null|string; + event_location_name?: null|string; + + // A key value list of the presentations + event_presentation_kv?: null|key_val; + event_presentation_li?: null|[any]; + // A key value list of the files + event_file_kv?: null|key_val; + event_file_li?: null|[any]; +} + + // Updated 2024-06-10 export class MySubClassedDexie extends Dexie { // 'badges' is added by dexie when declaring the stores() @@ -569,7 +571,7 @@ export class MySubClassedDexie extends Dexie { constructor() { super('ae_events_db'); - this.version(2).stores({ + this.version(3).stores({ events: ` id, event_id, event_id_random, code, @@ -602,20 +604,6 @@ export class MySubClassedDexie extends Dexie { event_badge_full_name, event_badge_email, enable, hide, priority, sort, group, notes, created_on, updated_on`, - sessions: ` - id, event_session_id, event_session_id_random, - external_id, code, - for_type, for_id, for_id_random, - type_code, - event_id, event_location_id, - poc_person_id, - event_id_random, event_location_id_random, - poc_person_id_random, - name, start_datetime, end_datetime, - hide_event_launcher, - ux_mode, - enable, hide, priority, sort, group, created_on, updated_on`, - files: ` id, id_random, event_file_id, event_file_id_random, hosted_file_id, hosted_file_id_random, @@ -659,6 +647,20 @@ export class MySubClassedDexie extends Dexie { agree, hide_event_launcher, enable, hide, priority, sort, group, created_on, updated_on`, + + sessions: ` + id, event_session_id, event_session_id_random, + external_id, code, + for_type, for_id, for_id_random, + type_code, + event_id, event_location_id, + poc_person_id, + event_id_random, event_location_id_random, + poc_person_id_random, + name, start_datetime, end_datetime, + hide_event_launcher, + ux_mode, + enable, hide, priority, sort, group, created_on, updated_on`, }); } } diff --git a/src/routes/events/[event_id]/presenter/[presenter_id]/presenter_view.svelte b/src/routes/events/[event_id]/presenter/[presenter_id]/presenter_view.svelte index b4abdb00..843a8703 100644 --- a/src/routes/events/[event_id]/presenter/[presenter_id]/presenter_view.svelte +++ b/src/routes/events/[event_id]/presenter/[presenter_id]/presenter_view.svelte @@ -55,7 +55,7 @@ console.log(`event_presenter_id:`, $lq__event_presenter_obj?.event_presenter_id) // let event_presentation_id: null|string = $lq__event_presenter_obj?.event_presentation_id ?? ''; // event_presentation_id = $lq__event_presenter_obj?.event_presentation_id ?? event_presentation_id; -console.log(`event_presentation_id:`, $lq__event_presentation_obj?.event_presentation_id_random); +console.log(`event_presentation_id:`, $lq__event_presentation_obj?.event_presentation_id); // $events_slct.event_presentation_id = event_presentation_id; // event_presentation_id = $lq__event_presenter_obj?.event_presentation_id; // let lq__event_presentation_obj = liveQuery( @@ -95,169 +95,169 @@ onMount(() => { }); -async function handle_submit_form_files(event) { - console.log('*** handle_submit_form() ***'); +// async function handle_submit_form_files(event) { +// console.log('*** handle_submit_form() ***'); - $events_sess.pres_mgmt.disable_submit__event_file_obj = true; - $events_sess.pres_mgmt.submit_status = 'saving'; +// $events_sess.pres_mgmt.disable_submit__event_file_obj = true; +// $events_sess.pres_mgmt.submit_status = 'saving'; - let hosted_file_results; +// let hosted_file_results; - if (event.target.presenter_event_file.files.length > 0) { +// if (event.target.presenter_event_file.files.length > 0) { - hosted_file_results = await handle_input_upload_files(event.target.presenter_event_file.files); +// hosted_file_results = await handle_input_upload_files(event.target.presenter_event_file.files); - if (hosted_file_results) { - console.log(`hosted_file_results:`, hosted_file_results); - } else { - console.log(`hosted_file_results:`, hosted_file_results); - } - } +// if (hosted_file_results) { +// console.log(`hosted_file_results:`, hosted_file_results); +// } else { +// console.log(`hosted_file_results:`, hosted_file_results); +// } +// } - $events_sess.pres_mgmt.disable_submit__event_file_obj = false; -} +// $events_sess.pres_mgmt.disable_submit__event_file_obj = false; +// } -async function handle_input_upload_files(input_upload_files) { - console.log('*** handle_input_upload_files() ***'); +// async function handle_input_upload_files(input_upload_files: FileList) { +// console.log('*** handle_input_upload_files() ***'); - let link_to_type = 'event_presenter'; - let link_to_id = $lq__event_presenter_obj?.event_presenter_id; +// let link_to_type = 'event_presenter'; +// let link_to_id = $lq__event_presenter_obj?.event_presenter_id; - const form_data = new FormData(); +// const form_data = new FormData(); - form_data.append('account_id', $ae_loc.account_id); - form_data.append('link_to_type', link_to_type); - form_data.append('link_to_id', link_to_id); +// form_data.append('account_id', $ae_loc.account_id); +// form_data.append('link_to_type', link_to_type); +// form_data.append('link_to_id', link_to_id); - for (let i = 0; i < input_upload_files.length; i++) { - form_data.append(`file_list`, input_upload_files[i]); - } +// for (let i = 0; i < input_upload_files.length; i++) { +// form_data.append(`file_list`, input_upload_files[i]); +// } - let params = null; +// let params = null; - let endpoint = '/hosted_file/upload_files'; +// let endpoint = '/hosted_file/upload_files'; - console.log(form_data); +// console.log(form_data); - params = null; +// params = null; - // Uncomment and the post_promise is not seen by the "await" below - // post_promise = await api.post_object({api_cfg: $cfg.api, endpoint: endpoint, params: params, data:form_data}); - // Uncomment so that the post_promise is not seen by the "await" below - ae_promises.upload__hosted_file_obj = api.post_object({ - api_cfg: $ae_api, - endpoint: endpoint, - params: params, - form_data: form_data, - task_id: link_to_id, - log_lvl: 0 - }) - .then(async function (result) { - // NOTE: The /hosted_file/upload_files endpoint will always return a list of successful files uploaded. In this case we are only uploading one file and expecting a list of one item. - let x = 0; - console.log(result[x]); - let hosted_file_obj = result[x]; +// // Uncomment and the post_promise is not seen by the "await" below +// // post_promise = await api.post_object({api_cfg: $cfg.api, endpoint: endpoint, params: params, data:form_data}); +// // Uncomment so that the post_promise is not seen by the "await" below +// ae_promises.upload__hosted_file_obj = api.post_object({ +// api_cfg: $ae_api, +// endpoint: endpoint, +// params: params, +// form_data: form_data, +// task_id: link_to_id, +// log_lvl: 0 +// }) +// .then(async function (result) { +// // NOTE: The /hosted_file/upload_files endpoint will always return a list of successful files uploaded. In this case we are only uploading one file and expecting a list of one item. +// let x = 0; +// console.log(result[x]); +// let hosted_file_obj = result[x]; - let hosted_file_id = hosted_file_obj.hosted_file_id_random; +// let hosted_file_id = hosted_file_obj.hosted_file_id_random; - let event_file_data: key_val = {}; - event_file_data['hosted_file_id_random'] = hosted_file_id; - event_file_data['for_type'] = link_to_type; - event_file_data['for_id_random'] = link_to_id; - event_file_data['filename'] = hosted_file_obj.filename; - event_file_data['extension'] = hosted_file_obj.extension; - event_file_data['enable'] = true; - console.log(event_file_data); +// let event_file_data: key_val = {}; +// event_file_data['hosted_file_id_random'] = hosted_file_id; +// event_file_data['for_type'] = link_to_type; +// event_file_data['for_id_random'] = link_to_id; +// event_file_data['filename'] = hosted_file_obj.filename; +// event_file_data['extension'] = hosted_file_obj.extension; +// event_file_data['enable'] = true; +// console.log(event_file_data); - // $events_sess.pres_mgmt.new_upload_list[i].uploaded_bytes = 10; // fake 10 bytes at least... +// // $events_sess.pres_mgmt.new_upload_list[i].uploaded_bytes = 10; // fake 10 bytes at least... - let event_file_id = await events_func.create_event_file_obj_from_hosted_file_async({ - api_cfg: $ae_api, - hosted_file_id: hosted_file_id, - data: event_file_data, - log_lvl: 1 - }) - .then(function (create_result) { - console.log(create_result); // NOTE: This should be the event_file_id string - // let event_file_id = create_result; - return create_result; - }); +// let event_file_id = await events_func.create_event_file_obj_from_hosted_file_async({ +// api_cfg: $ae_api, +// hosted_file_id: hosted_file_id, +// data: event_file_data, +// log_lvl: 1 +// }) +// .then(function (create_result) { +// console.log(create_result); // NOTE: This should be the event_file_id string +// // let event_file_id = create_result; +// return create_result; +// }); - return event_file_id; - }) - .then(function (event_file_id) { - // NOTE: Need to make sure the event file records are created first. The update won't see the changes if too fast. - // dispatch( - // 'event_file_obj_li_updated', - // { - // link_to_type: link_to_type, - // link_to_id: link_to_id, - // } - // ); +// return event_file_id; +// }) +// .then(function (event_file_id) { +// // NOTE: Need to make sure the event file records are created first. The update won't see the changes if too fast. +// // dispatch( +// // 'event_file_obj_li_updated', +// // { +// // link_to_type: link_to_type, +// // link_to_id: link_to_id, +// // } +// // ); - // $ae_events.pres_mgmt.new_upload_list[i].uploaded = true; - // $ae_events.pres_mgmt.new_upload_list[i].uploaded_bytes = event.target.event_file_upload_file_list.files[i].size; +// // $ae_events.pres_mgmt.new_upload_list[i].uploaded = true; +// // $ae_events.pres_mgmt.new_upload_list[i].uploaded_bytes = event.target.event_file_upload_file_list.files[i].size; - return event_file_id; - }) - .catch(function (error) { - console.log('Something went wrong.'); - console.log(error); - return false; - }) - .finally(function (event_file_id) { - // $events_sess.pres_mgmt.files_uploading_count--; - $slct_trigger = 'load__event_file_obj_li'; +// return event_file_id; +// }) +// .catch(function (error) { +// console.log('Something went wrong.'); +// console.log(error); +// return false; +// }) +// .finally(function (event_file_id) { +// // $events_sess.pres_mgmt.files_uploading_count--; +// $slct_trigger = 'load__event_file_obj_li'; - return event_file_id; - }); +// return event_file_id; +// }); - console.log(ae_promises.upload__hosted_file_obj); - let hosted_file_result = ae_promises.upload__hosted_file_obj; +// console.log(ae_promises.upload__hosted_file_obj); +// let hosted_file_result = ae_promises.upload__hosted_file_obj; - return hosted_file_result; -} +// return hosted_file_result; +// } -async function handle_delete__event_file({event_file_id}) { - console.log(`*** handle_delete__event_file() *** event_file_id:`, event_file_id); +// async function handle_delete__event_file({event_file_id} : {event_file_id: string}) { +// console.log(`*** handle_delete__event_file() *** event_file_id:`, event_file_id); - let link_to_type = 'event_presenter'; - let link_to_id = $lq__event_presenter_obj?.event_presenter_id; +// let link_to_type = 'event_presenter'; +// let link_to_id = $lq__event_presenter_obj?.event_presenter_id; - ae_promises.delete__event_file_obj = await events_func.delete_ae_obj_id__event_file({ - api_cfg: $ae_api, - event_file_id: event_file_id, - log_lvl: 2 - }) - .then(function (event_file_obj_result) { - console.log(event_file_obj_result); - if (!event_file_obj_result) { - console.log('The result was null or false.'); - return false; - } else { - console.log(`event_file_obj_result = `, event_file_obj_result); - } +// ae_promises.delete__event_file_obj = await events_func.delete_ae_obj_id__event_file({ +// api_cfg: $ae_api, +// event_file_id: event_file_id, +// log_lvl: 2 +// }) +// .then(function (event_file_obj_result) { +// console.log(event_file_obj_result); +// if (!event_file_obj_result) { +// console.log('The result was null or false.'); +// return false; +// } else { +// console.log(`event_file_obj_result = `, event_file_obj_result); +// } - dispatch( - 'event_file_obj_deleted', - { - event_file_id: event_file_id, - link_to_type: link_to_type, - link_to_id: link_to_id, - } +// dispatch( +// 'event_file_obj_deleted', +// { +// event_file_id: event_file_id, +// link_to_type: link_to_type, +// link_to_id: link_to_id, +// } - ); - return event_file_obj_result; - }).catch(function (error) { - console.log('Something went wrong deleting the event file.'); - console.log(error); - return false; - }); +// ); +// return event_file_obj_result; +// }).catch(function (error) { +// console.log('Something went wrong deleting the event file.'); +// console.log(error); +// return false; +// }); - return ae_promises.delete__event_file_obj; -} +// return ae_promises.delete__event_file_obj; +// } ae_promises.generate_qr_code_url = null; $events_sess.pres_mgmt.presenter__updated_on = null; @@ -333,12 +333,12 @@ $: if ($lq__event_presenter_obj) { {/if} - {#if $lq__event_presenter_obj.person_id_random && $ae_loc.trusted_access} + {#if $lq__event_presenter_obj.person_id && $ae_loc.trusted_access} {/if} - {#if $ae_loc.administrator_access && !$lq__event_presenter_obj?.person_id_random} + {#if $ae_loc.administrator_access && !$lq__event_presenter_obj?.person_id}