General clean up and renaming of functions.
This commit is contained in:
@@ -36,7 +36,7 @@ export async function handle_load_ae_obj_id__event_file(
|
|||||||
.then(function (event_file_obj_get_result) {
|
.then(function (event_file_obj_get_result) {
|
||||||
if (event_file_obj_get_result) {
|
if (event_file_obj_get_result) {
|
||||||
// This is expecting a list
|
// This is expecting a list
|
||||||
handle_db_save_ae_obj_li__event_file({obj_type: 'event_file', obj_li: [event_file_obj_get_result]});
|
db_save_ae_obj_li__event_file({obj_type: 'event_file', obj_li: [event_file_obj_get_result]});
|
||||||
return event_file_obj_get_result;
|
return event_file_obj_get_result;
|
||||||
} else {
|
} else {
|
||||||
console.log('No results returned.');
|
console.log('No results returned.');
|
||||||
@@ -106,7 +106,7 @@ export async function handle_load_ae_obj_li__event_file(
|
|||||||
.then(function (event_file_obj_li_get_result) {
|
.then(function (event_file_obj_li_get_result) {
|
||||||
if (event_file_obj_li_get_result) {
|
if (event_file_obj_li_get_result) {
|
||||||
if (try_cache) {
|
if (try_cache) {
|
||||||
handle_db_save_ae_obj_li__event_file({obj_type: 'event_file', obj_li: event_file_obj_li_get_result});
|
db_save_ae_obj_li__event_file({obj_type: 'event_file', obj_li: event_file_obj_li_get_result});
|
||||||
}
|
}
|
||||||
return event_file_obj_li_get_result;
|
return event_file_obj_li_get_result;
|
||||||
} else {
|
} else {
|
||||||
@@ -252,9 +252,9 @@ export async function handle_update_ae_obj__event_file(
|
|||||||
})
|
})
|
||||||
.then(function (event_file_obj_update_result) {
|
.then(function (event_file_obj_update_result) {
|
||||||
if (event_file_obj_update_result) {
|
if (event_file_obj_update_result) {
|
||||||
// handle_db_save_ae_obj_li__event_file({obj_type: 'event_file', obj_li: [event_file_obj_update_result]});
|
// db_save_ae_obj_li__event_file({obj_type: 'event_file', obj_li: [event_file_obj_update_result]});
|
||||||
// Very important: The results returned from the API does not include fields from the DB views. It is the actual table fields only.
|
// Very important: The results returned from the API does not include fields from the DB views. It is the actual table fields only.
|
||||||
handle_db_update_ae_obj_id__event_file({obj_type: 'event_file', obj_id: event_file_id, data_kv: event_file_obj_update_result});
|
db_update_ae_obj_id__event_file({obj_type: 'event_file', obj_id: event_file_id, data_kv: event_file_obj_update_result});
|
||||||
return event_file_obj_update_result;
|
return event_file_obj_update_result;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
@@ -274,7 +274,7 @@ export async function handle_update_ae_obj__event_file(
|
|||||||
|
|
||||||
|
|
||||||
// Updated 2024-07-12
|
// Updated 2024-07-12
|
||||||
export async function handle_search__event_file(
|
export async function search__event_file(
|
||||||
{
|
{
|
||||||
api_cfg,
|
api_cfg,
|
||||||
event_id,
|
event_id,
|
||||||
@@ -304,7 +304,7 @@ export async function handle_search__event_file(
|
|||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
if (log_lvl) {
|
if (log_lvl) {
|
||||||
console.log(`*** handle_search__event_file() *** event_id=${event_id}`);
|
console.log(`*** search__event_file() *** event_id=${event_id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled
|
let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled
|
||||||
@@ -379,7 +379,7 @@ export async function handle_search__event_file(
|
|||||||
})
|
})
|
||||||
.then(function (event_file_obj_li_get_result) {
|
.then(function (event_file_obj_li_get_result) {
|
||||||
if (event_file_obj_li_get_result) {
|
if (event_file_obj_li_get_result) {
|
||||||
handle_db_save_ae_obj_li__event_file({obj_type: 'event_file', obj_li: event_file_obj_li_get_result});
|
db_save_ae_obj_li__event_file({obj_type: 'event_file', obj_li: event_file_obj_li_get_result});
|
||||||
return event_file_obj_li_get_result;
|
return event_file_obj_li_get_result;
|
||||||
} else {
|
} else {
|
||||||
return [];
|
return [];
|
||||||
@@ -399,7 +399,7 @@ export async function handle_search__event_file(
|
|||||||
|
|
||||||
|
|
||||||
// This function will loop through the event_file_obj_li and save each one to the DB.
|
// This function will loop through the event_file_obj_li and save each one to the DB.
|
||||||
export function handle_db_save_ae_obj_li__event_file(
|
export function db_save_ae_obj_li__event_file(
|
||||||
{
|
{
|
||||||
obj_type,
|
obj_type,
|
||||||
obj_li,
|
obj_li,
|
||||||
@@ -411,7 +411,7 @@ export function handle_db_save_ae_obj_li__event_file(
|
|||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
if (log_lvl) {
|
if (log_lvl) {
|
||||||
console.log(`*** handle_db_save_ae_obj_li__event_file() ***`);
|
console.log(`*** db_save_ae_obj_li__event_file() ***`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj_li && obj_li.length) {
|
if (obj_li && obj_li.length) {
|
||||||
@@ -494,7 +494,7 @@ export function handle_db_save_ae_obj_li__event_file(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function handle_db_update_ae_obj_id__event_file(
|
export function db_update_ae_obj_id__event_file(
|
||||||
{
|
{
|
||||||
obj_type,
|
obj_type,
|
||||||
obj_id,
|
obj_id,
|
||||||
@@ -505,7 +505,7 @@ export function handle_db_update_ae_obj_id__event_file(
|
|||||||
data_kv: key_val
|
data_kv: key_val
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
console.log(`*** handle_db_update_ae_obj_id__event_file() ***`);
|
console.log(`*** db_update_ae_obj_id__event_file() ***`);
|
||||||
|
|
||||||
if (obj_id) {
|
if (obj_id) {
|
||||||
console.log(`ae_obj ${obj_type}:`, obj_id);
|
console.log(`ae_obj ${obj_type}:`, obj_id);
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ import {
|
|||||||
handle_delete_ae_obj_id__event_file,
|
handle_delete_ae_obj_id__event_file,
|
||||||
create_event_file_obj_from_hosted_file_async,
|
create_event_file_obj_from_hosted_file_async,
|
||||||
handle_update_ae_obj__event_file,
|
handle_update_ae_obj__event_file,
|
||||||
handle_search__event_file,
|
search__event_file,
|
||||||
handle_db_save_ae_obj_li__event_file,
|
db_save_ae_obj_li__event_file,
|
||||||
} from "$lib/ae_events__event_file";
|
} from "$lib/ae_events__event_file";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -78,8 +78,8 @@ let export_obj = {
|
|||||||
handle_load_ae_obj_li__event_file: handle_load_ae_obj_li__event_file,
|
handle_load_ae_obj_li__event_file: handle_load_ae_obj_li__event_file,
|
||||||
handle_delete_ae_obj_id__event_file: handle_delete_ae_obj_id__event_file,
|
handle_delete_ae_obj_id__event_file: handle_delete_ae_obj_id__event_file,
|
||||||
handle_update_ae_obj__event_file: handle_update_ae_obj__event_file,
|
handle_update_ae_obj__event_file: handle_update_ae_obj__event_file,
|
||||||
handle_search__event_file: handle_search__event_file,
|
search__event_file: search__event_file,
|
||||||
handle_db_save_ae_obj_li__event_file: handle_db_save_ae_obj_li__event_file,
|
db_save_ae_obj_li__event_file: db_save_ae_obj_li__event_file,
|
||||||
|
|
||||||
load_ae_obj_id__event_location: load_ae_obj_id__event_location,
|
load_ae_obj_id__event_location: load_ae_obj_id__event_location,
|
||||||
load_ae_obj_li__event_location: load_ae_obj_li__event_location,
|
load_ae_obj_li__event_location: load_ae_obj_li__event_location,
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import { ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_st
|
|||||||
import { db_events } from "$lib/db_events";
|
import { db_events } from "$lib/db_events";
|
||||||
import { events_loc, events_sess, events_slct, events_trigger } from '$lib/ae_events_stores';
|
import { events_loc, events_sess, events_slct, events_trigger } from '$lib/ae_events_stores';
|
||||||
import { events_func } from '$lib/ae_events_functions';
|
import { events_func } from '$lib/ae_events_functions';
|
||||||
import { hide } from '@floating-ui/dom';
|
|
||||||
|
|
||||||
export let container_class_li: string|Array<string> = [];
|
export let container_class_li: string|Array<string> = [];
|
||||||
export let link_to_type: string;
|
export let link_to_type: string;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ let dq__where_eq_id_val: string = link_to_id;
|
|||||||
|
|
||||||
// Functions and Logic
|
// Functions and Logic
|
||||||
import { browser } from '$app/environment';
|
import { browser } from '$app/environment';
|
||||||
import { hide } from '@floating-ui/dom';
|
|
||||||
if (browser) {
|
if (browser) {
|
||||||
console.log('Browser environment detected.');
|
console.log('Browser environment detected.');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ async function handle_search__event_file(
|
|||||||
$events_sess.pres_mgmt.status_qry__search = 'loading';
|
$events_sess.pres_mgmt.status_qry__search = 'loading';
|
||||||
$events_sess.pres_mgmt.status_rpt[$events_sess.pres_mgmt.show_report] = 'loading';
|
$events_sess.pres_mgmt.status_rpt[$events_sess.pres_mgmt.show_report] = 'loading';
|
||||||
|
|
||||||
ae_promises.handle_search__event_file = events_func.handle_search__event_file({
|
ae_promises.search__event_file = events_func.search__event_file({
|
||||||
api_cfg: $ae_api,
|
api_cfg: $ae_api,
|
||||||
event_id: $events_slct.event_id,
|
event_id: $events_slct.event_id,
|
||||||
created_on: created_on,
|
created_on: created_on,
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import { ae_util } from '$lib/ae_utils';
|
|||||||
import { api } from '$lib/api';
|
import { api } from '$lib/api';
|
||||||
import Element_ae_crud from '$lib/element_ae_crud.svelte';
|
import Element_ae_crud from '$lib/element_ae_crud.svelte';
|
||||||
// import Element_data_store from '$lib/element_data_store.svelte';
|
// import Element_data_store from '$lib/element_data_store.svelte';
|
||||||
import Element_manage_event_file_li from '$lib/element_manage_event_file_li.svelte';
|
|
||||||
|
|
||||||
import { core_func } from '$lib/ae_core_functions';
|
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_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
||||||
@@ -1433,103 +1432,6 @@ $: if ($lq__event_presenter_obj) {
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<!-- <h3 class="h4">
|
|
||||||
Upload File(s):
|
|
||||||
</h3> -->
|
|
||||||
<!-- <button
|
|
||||||
type="button"
|
|
||||||
on:click={() => {
|
|
||||||
console.log('*** Refresh button clicked ***');
|
|
||||||
ae_tmp.show__file_li = false;
|
|
||||||
console.log(`$lq__event_file_obj_li:`, $lq__event_file_obj_li);
|
|
||||||
$slct_trigger = 'load__event_file_obj_li';
|
|
||||||
ae_tmp.show__file_li = true;
|
|
||||||
}}
|
|
||||||
class="btn btn-sm variant-soft-tertiary hover:variant-ghost-warning float-right transition hover:transition-all"
|
|
||||||
>
|
|
||||||
<span class="fas fa-sync-alt mx-1"></span>
|
|
||||||
Refresh Files
|
|
||||||
</button> -->
|
|
||||||
|
|
||||||
<!-- <div class="text-sm text-center bg-orange-100 rounded-md p-2">
|
|
||||||
WARNING: The file upload and management is a work in progress. You can upload and delete files, but not yet rename them. You may need to refresh the page if your changes are not showing up.
|
|
||||||
</div> -->
|
|
||||||
<!-- <form
|
|
||||||
on:submit|preventDefault={handle_submit_form_files}
|
|
||||||
class:hidden={!$ae_loc.trusted_access && !$events_loc.auth__kv.presenter[$lq__event_presenter_obj?.event_presenter_id_random] && !$events_loc.auth__kv.session[$lq__event_presenter_obj.event_session_id_random]}
|
|
||||||
class="modal-form {$ae_loc.hub.classes__form} flex flex-col space-y-2 items-center w-full"
|
|
||||||
>
|
|
||||||
|
|
||||||
<label for="input__presenter_event_file">
|
|
||||||
Upload outline or draft file(s):
|
|
||||||
<FileDropzone
|
|
||||||
id="input__presenter_event_file"
|
|
||||||
name="presenter_event_file"
|
|
||||||
padding="p-1"
|
|
||||||
accept="*"
|
|
||||||
class="w-96 variant-glass-warning"
|
|
||||||
on:change={(e) => {
|
|
||||||
console.log('*** FileDropzone change event ***', e);
|
|
||||||
|
|
||||||
if (e.target.files.length) {
|
|
||||||
ae_placeholder_li.new_file = `Ready to upload: ${e.target.files[0].name}`;
|
|
||||||
$events_sess.pres_mgmt.disable_submit__event_file_obj = false;
|
|
||||||
} else {
|
|
||||||
$events_sess.pres_mgmt.disable_submit__event_file_obj = true;
|
|
||||||
ae_placeholder_li.new_file = null;
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<svelte:fragment slot="lead"><span class="fas fa-file-upload"></svelte:fragment>
|
|
||||||
<svelte:fragment slot="message"><strong>Upload your file</strong> (drag and drop)</svelte:fragment>
|
|
||||||
<svelte:fragment slot="meta">Presentation related files only<br>(PowerPoint, Keynote, PDF, mp4, Word Doc, Excel, txt, etc)</svelte:fragment>
|
|
||||||
|
|
||||||
{ae_placeholder_li.new_file ?? 'No files selected.'}
|
|
||||||
</FileDropzone>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<button
|
|
||||||
type="submit"
|
|
||||||
class="btn btn-md variant-ghost-secondary m-2"
|
|
||||||
disabled={($events_sess.pres_mgmt.disable_submit__event_file_obj)}
|
|
||||||
on:click={() => {
|
|
||||||
console.log('*** Save button clicked ***');
|
|
||||||
// if (!confirm('Are you sure you want to save this event_presenter?')) {return false;}
|
|
||||||
// handle_submit_form();
|
|
||||||
// handle_submit_form;
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{#await ae_promises.upload__hosted_file_obj}
|
|
||||||
<span class="fas fa-spinner fa-spin mx-1"></span>
|
|
||||||
<span class="">
|
|
||||||
Uploading
|
|
||||||
{#if $ae_sess.api_upload_kv[$lq__event_presenter_obj?.event_presenter_id_random]}
|
|
||||||
{$ae_sess.api_upload_kv[$lq__event_presenter_obj?.event_presenter_id_random].percent_completed}%
|
|
||||||
{/if}
|
|
||||||
</span>
|
|
||||||
{:then}
|
|
||||||
<span class="fas fa-upload mx-1"></span>
|
|
||||||
<span class="text-sm">
|
|
||||||
Upload:
|
|
||||||
</span>
|
|
||||||
<span class="grow">
|
|
||||||
File
|
|
||||||
</span>
|
|
||||||
{/await}
|
|
||||||
</button>
|
|
||||||
|
|
||||||
</form> -->
|
|
||||||
|
|
||||||
<!-- <div class="overflow-x-auto w-max max-w-full">
|
|
||||||
<Element_manage_event_file_li
|
|
||||||
link_to_type={'event_presenter'}
|
|
||||||
link_to_id={$lq__event_presenter_obj?.event_presenter_id_random}
|
|
||||||
allow_basic={$events_loc.auth__kv.session[$lq__event_presenter_obj.event_session_id_random] || $events_loc.auth__kv.presenter[$lq__event_presenter_obj?.event_presenter_id_random]}
|
|
||||||
allow_moderator={$events_loc.auth__kv.session[$lq__event_presenter_obj.event_session_id_random]}
|
|
||||||
container_class_li={''}
|
|
||||||
/>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
Reference in New Issue
Block a user