Making things work better. Adding CRUD select option list.

This commit is contained in:
Scott Idem
2024-06-25 14:05:03 -04:00
parent 21ad9d900c
commit a62ea7dc8d
5 changed files with 128 additions and 108 deletions

View File

@@ -232,6 +232,9 @@ onMount(() => {
function presenter_sign_in() {
console.log('Presenter sign in with URL values');
$ae_loc.authenticated_access = true;
$ae_loc.access_type = 'authenticated';
$events_loc.auth__person.id = $events_sess.auth__entered_key; // person_id
$events_loc.auth__person.entered_key = $events_sess.auth__entered_key; // also person_id in this case
$events_loc.auth__person.email = 'test@example.com';
@@ -250,6 +253,9 @@ function presenter_sign_in() {
function session_sign_in() {
console.log('Session sign in with URL values');
$ae_loc.authenticated_access = true;
$ae_loc.access_type = 'authenticated';
$events_loc.auth__person.id = $events_sess.auth__entered_key; // person_id
$events_loc.auth__person.entered_key = $events_sess.auth__entered_key; // also person_id in this case
$events_loc.auth__person.email = 'test@example.com';
@@ -266,6 +272,9 @@ function session_sign_in() {
}
function sign_out() {
$ae_loc.authenticated_access = false;
$ae_loc.access_type = 'anonymous';
$events_loc.auth__person = {
id: null,
email: null,
@@ -428,97 +437,61 @@ function send_sign_in_poc_email(
class="space-y-2 px-4"
>
<li>
<strong class="text-sm">Name/Title:</strong> {$lq__event_session_obj.name}
<span class="text-sm text-gray-500 bg-yellow-100 p-1 rounded-md border border-yellow-200"
title="Session code {$lq__event_session_obj.code}"
>
<span class="fas fa-barcode"></span>
{$lq__event_session_obj.code}
</span>
{#if $ae_loc.trusted_access}
<Element_ae_crud
trigger_patch={ae_triggers.update_event_session}
api_cfg={$ae_api}
object_type={'event_session'}
object_id={$lq__event_session_obj?.event_session_id_random}
field_name={'name'}
field_type={'text'}
field_value={ae_tmp.name}
field_value={$lq__event_session_obj?.name}
allow_null={false}
hide_edit_btn={true}
hide_edit_btn={!$ae_loc.trusted_access}
outline_element={false}
show_crud={false}
display_inline={true}
class_li={'m-1'}
display_block_edit={true}
class_li={''}
on:ae_crud_updated={e => {
console.log(`ae_crud_updated:`, e.detail);
events_func.handle_load_ae_obj_id__event_session({api_cfg: $ae_api, event_session_id: $lq__event_session_obj?.event_session_id_random, log_lvl: 1})
.then(function (load_results) {
ae_tmp.name = null;
ae_tmp.show__edit_name = false;
// Maybe reload page?
// window.location.reload();
});
}}
>
{#if ae_tmp?.show__edit_name}
<input
type="text"
bind:value={ae_tmp.name}
class="input min-w-fit max-w-md text-sm"
/>
<button
type="button"
disabled={ae_tmp.name == $lq__event_session_obj?.name}
on:click={() => {
console.log('Save the session name.');
let name = ae_tmp.name;
console.log('New session name:', name);
ae_triggers.update_event_session = true;
}}
class="btn btn-sm variant-soft-warning hover:variant-ghost-warning"
>
<span class="fas fa-save mx-1"></span>
Save
</button>
{/if}
{#if ae_tmp.show__edit_name}
<button
type="button"
on:click={() => {
console.log('Cancel the session name.');
ae_tmp.name = null;
ae_tmp.show__edit_name = false;
}}
class="btn btn-sm variant-soft-warning hover:variant-ghost-warning"
>
<span class="fas fa-times mx-1"></span>
Cancel
</button>
{:else}
<button
type="button"
on:click={() => {
console.log('Edit the session name.');
ae_tmp.name = $lq__event_session_obj?.name;
ae_tmp.show__edit_name = true;
}}
class="btn btn-sm variant-soft-warning hover:variant-ghost-warning"
>
<span class="fas fa-edit mx-1"></span>
Edit
</button>
{/if}
<strong class="text-sm">Name/Title:</strong> {$lq__event_session_obj.name}
</Element_ae_crud>
<Element_ae_crud
api_cfg={$ae_api}
object_type={'event_session'}
object_id={$lq__event_session_obj?.event_session_id_random}
field_name={'code'}
field_type={'text'}
field_value={$lq__event_session_obj?.code}
allow_null={false}
hide_edit_btn={!$ae_loc.trusted_access}
outline_element={false}
show_crud={false}
display_inline={true}
display_block_edit={false}
class_li={''}
on:ae_crud_updated={e => {
console.log(`ae_crud_updated:`, e.detail);
events_func.handle_load_ae_obj_id__event_session({api_cfg: $ae_api, event_session_id: $lq__event_session_obj?.event_session_id_random, log_lvl: 1})
.then(function (load_results) {
});
}}
>
<span class="text-sm text-gray-500 bg-yellow-100 p-1 rounded-md border border-yellow-200"
title="Session code {$lq__event_session_obj.code}"
>
<strong class="text-sm">code:</strong>
<span class="fas fa-barcode"></span>
{$lq__event_session_obj.code}
</span>
</Element_ae_crud>
{/if}
</li>
<li>
<strong class="text-sm">Date time:</strong>

View File

@@ -382,6 +382,7 @@ async function handle_delete__event_file({event_file_id}) {
outline_element={false}
show_crud={false}
display_inline={true}
display_block_edit={false}
class_li={''}
>
{$events_slct.presenter_obj.given_name}