Working on ability to change the presentation name and session name... Making progress. Need to figure out why the file list does not reload correctly right after saving.
This commit is contained in:
@@ -447,7 +447,7 @@ function send_sign_in_poc_email(
|
||||
{$lq__event_session_obj.poc_person_full_name ? $lq__event_session_obj.poc_person_full_name : '-- not set --'}
|
||||
</span>
|
||||
|
||||
{#if $ae_loc.trusted_access }
|
||||
{#if $ae_loc.trusted_access}
|
||||
<Element_ae_crud
|
||||
trigger_patch={ae_triggers.update_person_poc}
|
||||
api_cfg={$ae_api}
|
||||
|
||||
@@ -19,11 +19,14 @@ import { ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_st
|
||||
import { db_events } from "$lib/db_events";
|
||||
import { events_loc, events_sess, events_slct, events_trigger } from '$lib/ae_events_stores';
|
||||
import { events_func } from '$lib/ae_events_functions';
|
||||
import ElementAeCrud from '$lib/element_ae_crud.svelte';
|
||||
|
||||
|
||||
let ae_triggers: key_val = {};
|
||||
let ae_promises: key_val = {}; // Promise<any>;
|
||||
let ae_placeholder_li: key_val = {};
|
||||
let ae_promises: key_val = {}; // Promise<any>;
|
||||
let ae_tmp: key_val = {};
|
||||
ae_tmp.show__file_li = true;
|
||||
let ae_triggers: key_val = {};
|
||||
|
||||
let lq__event_session_obj = liveQuery(
|
||||
() => db_events.sessions.get($events_slct.event_session_id)
|
||||
@@ -39,7 +42,7 @@ let lq__event_presenter_obj = liveQuery(
|
||||
);
|
||||
|
||||
let lq__event_file_obj_li = liveQuery(
|
||||
() => db_events.files.where('event_presenter_id_random').equals($events_slct.event_presenter_id).toArray()
|
||||
async () => await db_events.files.where('event_presenter_id_random').equals($events_slct.event_presenter_id).toArray()
|
||||
);
|
||||
|
||||
// $events_slct.event_presenter_obj = $lq__event_presenter_obj;
|
||||
@@ -57,7 +60,9 @@ let lq__event_file_obj_li = liveQuery(
|
||||
onMount(() => {
|
||||
console.log('Events Session [slug]: presenter_view.svelte');
|
||||
console.log(`$events_slct.event_presenter_id:`, $events_slct.event_presenter_id);
|
||||
console.log(`$lq__event_presenter_obj:`, $lq__event_presenter_obj);
|
||||
// console.log(`$lq__event_presenter_obj:`, $lq__event_presenter_obj);
|
||||
|
||||
$slct_trigger = 'load__event_file_obj_li';
|
||||
});
|
||||
|
||||
|
||||
@@ -324,6 +329,68 @@ async function handle_delete__event_file({event_file_id}) {
|
||||
|
||||
<section class="p-2">
|
||||
<h3 class="h4">Title: "{$events_slct.presentation_obj.name}"</h3>
|
||||
<!-- Edit the presentation title -->
|
||||
<Element_ae_crud
|
||||
trigger_patch={ae_triggers.update_event_presentation_name}
|
||||
api_cfg={$ae_api}
|
||||
object_type={'event_presentation'}
|
||||
object_id={$events_slct.presentation_obj.event_presentation_id_random}
|
||||
field_name={'name'}
|
||||
field_type={'input'}
|
||||
field_value={$events_slct.presentation_obj.name}
|
||||
allow_null={false}
|
||||
hide_edit_btn={true}
|
||||
outline_element={false}
|
||||
show_crud={false}
|
||||
display_inline={true}
|
||||
class_li={'m-1'}
|
||||
on:ae_crud_updated={e => {
|
||||
console.log(`ae_crud_updated:`, e.detail);
|
||||
|
||||
events_func.handle_load_ae_obj_id__event_presentation({api_cfg: $ae_api, event_presentation_id: $events_slct.presentation_obj.event_presentation_id_random, log_lvl: 1})
|
||||
.then(function (load_results) {
|
||||
// We need to force reload the Indexed DB - Dexie.js?
|
||||
// Sometimes the changes are not seen. The file disappears when the Save button is pressed.
|
||||
|
||||
// Maybe reload page?
|
||||
// window.location.reload();
|
||||
})
|
||||
.finally(function () {
|
||||
// ae_tmp.show__file_li = false;
|
||||
// Careful with the trigger_patch. It will keep firing if not reset.
|
||||
ae_triggers.update_event_presentation_name = false;
|
||||
});
|
||||
}}
|
||||
>
|
||||
<input
|
||||
bind:value={$events_slct.presentation_obj.name}
|
||||
class="input min-w-96 max-w-96 text-sm"
|
||||
/>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
on:click={() => {
|
||||
console.log('*** Save button clicked ***');
|
||||
// if (!confirm('Are you sure you want to save this event_presenter?')) {return false;}
|
||||
|
||||
console.log(`Selected event_presentation_id: ${$events_slct.presentation_obj.event_presentation_id_random}`);
|
||||
|
||||
ae_triggers.update_event_presentation_name = true;
|
||||
// ae_triggers.update_event_presentation_name = $events_slct.presentation_obj.event_presentation_id_random;
|
||||
}}
|
||||
class="btn btn-sm variant-soft-success hover:variant-ghost-success mx-1"
|
||||
>
|
||||
<span class="fas fa-save mx-1"></span>
|
||||
Save
|
||||
</button>
|
||||
</Element_ae_crud>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h3 class="h4">Presenter:</h3>
|
||||
<ul
|
||||
class="space-y-2 px-4"
|
||||
@@ -367,7 +434,23 @@ async function handle_delete__event_file({event_file_id}) {
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3 class="h4">Files: {$events_slct.presenter_obj.file_count ? `${$events_slct.presenter_obj.file_count}x` : '-- none --'}</h3>
|
||||
<h3 class="h4">
|
||||
Files: {$events_slct.presenter_obj.file_count ? `${$events_slct.presenter_obj.file_count}x` : '-- none --'}
|
||||
</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-secondary 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.
|
||||
@@ -422,7 +505,7 @@ WARNING: The file upload and management is a work in progress. You can upload an
|
||||
</form>
|
||||
|
||||
|
||||
{#if $lq__event_file_obj_li}
|
||||
{#if ae_tmp.show__file_li && $lq__event_file_obj_li && $lq__event_file_obj_li.length > 0}
|
||||
<ul
|
||||
class="space-y-2 px-4"
|
||||
>
|
||||
@@ -472,10 +555,103 @@ WARNING: The file upload and management is a work in progress. You can upload an
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<!-- Select from options for the purpose of this file -->
|
||||
{#if ae_tmp[event_file_obj.event_file_id_random] && ae_tmp[event_file_obj.event_file_id_random]?.show__edit_file_purpose === true}
|
||||
<Element_ae_crud
|
||||
trigger_patch={ae_triggers.update_event_file_purpose}
|
||||
api_cfg={$ae_api}
|
||||
object_type={'event_file'}
|
||||
object_id={event_file_obj.event_file_id_random}
|
||||
field_name={'file_purpose'}
|
||||
field_type={'button'}
|
||||
field_value={ae_tmp[event_file_obj.event_file_id_random].file_purpose}
|
||||
allow_null={false}
|
||||
hide_edit_btn={true}
|
||||
outline_element={false}
|
||||
show_crud={false}
|
||||
display_inline={true}
|
||||
class_li={'m-1'}
|
||||
on:ae_crud_updated={e => {
|
||||
console.log(`ae_crud_updated:`, e.detail);
|
||||
|
||||
events_func.handle_load_ae_obj_id__event_file({api_cfg: $ae_api, event_file_id: event_file_obj.event_file_id_random, log_lvl: 1})
|
||||
.then(function (load_results) {
|
||||
// We need to force reload the Indexed DB - Dexie.js?
|
||||
// Sometimes the changes are not seen. The file disappears when the Save button is pressed.
|
||||
|
||||
// Maybe reload page?
|
||||
// window.location.reload();
|
||||
})
|
||||
.finally(function () {
|
||||
// ae_tmp[event_file_obj.event_file_id_random].file_purpose = null;
|
||||
ae_tmp[event_file_obj.event_file_id_random].show__edit_file_purpose = false;
|
||||
// Careful with the trigger_patch. It will keep firing if not reset.
|
||||
ae_triggers.update_event_file_purpose = false;
|
||||
});
|
||||
}}
|
||||
>
|
||||
|
||||
<select
|
||||
bind:value={ae_tmp[event_file_obj.event_file_id_random].file_purpose}
|
||||
class="select min-w-fit max-w-fit text-sm mx-1"
|
||||
>
|
||||
<option value="outline" selected={event_file_obj.file_purpose === 'outline'}>1. Outline</option>
|
||||
<option value="draft" selected={event_file_obj.file_purpose === 'draft'}>2. Draft</option>
|
||||
<option value="final" selected={event_file_obj.file_purpose === 'final'}>3. Final</option>
|
||||
<option value="supporting">X. Supporting File (audio, video, data, etc)</option>
|
||||
<option value="handout">X. Handout</option>
|
||||
<option value="other">X. Other</option>
|
||||
<!-- <option value="poster">Final - Poster</option> -->
|
||||
<!-- <option value="presentation">Final - Presentation</option> -->
|
||||
<!-- Shows in session room -->
|
||||
</select>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
on:click={() => {
|
||||
console.log('*** Save button clicked ***');
|
||||
// if (!confirm('Are you sure you want to save this event_presenter?')) {return false;}
|
||||
|
||||
console.log(`Selected event_file_id: ${event_file_obj.event_file_id_random}`);
|
||||
|
||||
ae_triggers.update_event_file_purpose = true;
|
||||
// ae_triggers.update_event_file_purpose = event_file_obj.event_file_id_random;
|
||||
|
||||
|
||||
|
||||
// ae_tmp.show__file_li = false;
|
||||
}}
|
||||
class="btn btn-sm variant-soft-success hover:variant-ghost-success mx-1"
|
||||
>
|
||||
<span class="fas fa-save mx-1"></span>
|
||||
Save
|
||||
</button>
|
||||
</Element_ae_crud>
|
||||
{:else}
|
||||
<button
|
||||
type="button"
|
||||
title="Edit the purpose of this file"
|
||||
on:click={() => {
|
||||
ae_tmp[event_file_obj.event_file_id_random] = {
|
||||
file_purpose: event_file_obj.file_purpose,
|
||||
show__edit_file_purpose: true
|
||||
}
|
||||
|
||||
// ae_tmp[event_file_obj.event_file_id_random].file_purpose = event_file_obj.file_purpose;
|
||||
// ae_tmp[event_file_obj.event_file_id_random].show__edit_file_purpose = true;
|
||||
}}
|
||||
class="btn btn-sm variant-soft-primary hover:variant-ghost-primary mx-1"
|
||||
>
|
||||
<span class="fas fa-edit mx-1"></span>
|
||||
Edit
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
|
||||
<button type="button"
|
||||
title="Delete this file"
|
||||
on:click={async () => {
|
||||
if (!confirm('Are you sure you want to delete this file?')) {return false;}
|
||||
if (!confirm(`Are you sure you want to delete this file?\n${event_file_obj.filename} [${event_file_obj.event_file_id_random}]`)) {return false;}
|
||||
|
||||
ae_promises[event_file_obj.event_file_id_random] = handle_delete__event_file({event_file_id: event_file_obj.event_file_id_random});
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user