Now able to do stuff with the locations
This commit is contained in:
@@ -11,7 +11,8 @@ import type { key_val } from '$lib/ae_stores';
|
||||
// import { ae_util } from '$lib/ae_utils';
|
||||
import { api } from '$lib/api';
|
||||
import { ae_loc, ae_sess, ae_api, slct } from '$lib/ae_stores';
|
||||
import { events_loc, events_slct, events_trigger } from '$lib/ae_events_stores';
|
||||
import { events_loc, events_slct, events_trigger, events_trig_kv } from '$lib/ae_events_stores';
|
||||
import { events_func } from '$lib/ae_events_functions';
|
||||
|
||||
// import Element_data_store from '$lib/element_data_store.svelte';
|
||||
|
||||
@@ -39,6 +40,26 @@ onMount(() => {
|
||||
console.log($events_slct.event_obj_li);
|
||||
});
|
||||
|
||||
|
||||
// Updated 2024-06-25
|
||||
$: if ($events_trigger == 'load__event_session_obj_id' && $events_trig_kv['event_session_id']) {
|
||||
console.log(`load__event_session_obj_id() $events_slct.event_session_id=${$events_slct.event_session_id}`);
|
||||
|
||||
$events_trigger = null;
|
||||
|
||||
if ($events_slct.event_session_id) {
|
||||
$events_trig_kv['event_session_id'] = events_func.handle_load_ae_obj_id__event_session({
|
||||
api_cfg: $ae_api,
|
||||
event_session_id: $events_slct.event_session_id,
|
||||
log_lvl: 1
|
||||
})
|
||||
.then(function (load_results) {
|
||||
console.log(`ae_event_session_get_promise:`, load_results);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@@ -202,8 +202,6 @@ $: if ($events_trigger == 'load__event_session_obj_li' && $events_slct.event_id)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import { liveQuery } from "dexie";
|
||||
import { core_func } from '$lib/ae_core_functions';
|
||||
import { db_events } from "$lib/db_events";
|
||||
import { ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
||||
import { events_loc, events_sess, events_slct, events_trigger } from '$lib/ae_events_stores';
|
||||
import { events_loc, events_sess, events_slct, events_trigger, events_trig_kv } from '$lib/ae_events_stores';
|
||||
import { events_func } from '$lib/ae_events_functions';
|
||||
|
||||
import Form_agree from './form_agree.svelte';
|
||||
@@ -514,9 +514,12 @@ function send_sign_in_poc_email(
|
||||
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});
|
||||
events_func.handle_load_ae_obj_id__event_session({api_cfg: $ae_api, event_session_id: $lq__event_session_obj?.event_session_id_random});
|
||||
// $events_trigger = 'load__event_session_obj_id';
|
||||
// $events_trig_kv['event_session_id'] = $lq__event_session_obj?.event_session_id_random;
|
||||
}}
|
||||
>
|
||||
{ae_util.iso_datetime_formatter($lq__event_session_obj.start_datetime, 'dddd')},
|
||||
{ae_util.iso_datetime_formatter($lq__event_session_obj.start_datetime, 'datetime_long')}
|
||||
</Element_ae_crud>
|
||||
-
|
||||
@@ -536,14 +539,120 @@ function send_sign_in_poc_email(
|
||||
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});
|
||||
events_func.handle_load_ae_obj_id__event_session({api_cfg: $ae_api, event_session_id: $lq__event_session_obj?.event_session_id_random});
|
||||
// $events_trigger = 'load__event_session_obj_id';
|
||||
// $events_trig_kv['event_session_id'] = $lq__event_session_obj?.event_session_id_random;
|
||||
}}
|
||||
>
|
||||
{ae_util.iso_datetime_formatter($lq__event_session_obj.end_datetime, 'datetime_long')}
|
||||
{ae_util.iso_datetime_formatter($lq__event_session_obj.end_datetime, 'time_short')}
|
||||
</Element_ae_crud>
|
||||
</li>
|
||||
<li>
|
||||
<strong class="text-sm">Location/Room:</strong> {$lq__event_session_obj.event_location_name ? $lq__event_session_obj.event_location_name : '-- not set --'}
|
||||
|
||||
{#if $ae_loc.trusted_access}
|
||||
<Element_ae_crud
|
||||
trigger_patch={ae_triggers.update_event_location}
|
||||
api_cfg={$ae_api}
|
||||
object_type={'event_session'}
|
||||
object_id={$lq__event_session_obj?.event_session_id_random}
|
||||
field_name={'event_location_id_random'}
|
||||
field_type={'select'}
|
||||
field_value={ae_tmp.event_location_id}
|
||||
select_option_li={$slct.event_location_obj_kv}
|
||||
allow_null={true}
|
||||
hide_edit_btn={true}
|
||||
outline_element={false}
|
||||
show_crud={ae_tmp.show__edit_event_location}
|
||||
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_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.event_location_id = null;
|
||||
ae_tmp.show__edit_event_location = false;
|
||||
|
||||
// Maybe reload page?
|
||||
// window.location.reload();
|
||||
});
|
||||
}}
|
||||
>
|
||||
{#if ae_tmp?.show__edit_location}
|
||||
|
||||
{#await $slct.event_location_obj_li}
|
||||
<span class="fas fa-spinner fa-spin mx-1"></span>
|
||||
{:then event_location_obj_li}
|
||||
<!-- {#if event_location_obj_li && event_location_obj_li.length > 0}
|
||||
|
||||
{/if} -->
|
||||
{/await}
|
||||
|
||||
<button
|
||||
type="button"
|
||||
on:click={() => {
|
||||
console.log('Cancel editing the location for the session.');
|
||||
|
||||
ae_tmp.event_location_id = null;
|
||||
ae_tmp.show__edit_event_location = 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 location for the session.');
|
||||
|
||||
let params = {
|
||||
qry__limit: 50,
|
||||
}
|
||||
|
||||
// $slct.event_location_obj_li = await core_func.handle_load_ae_obj_li__event_location({api_cfg: $ae_api, account_id: $slct.account_id, params: params});
|
||||
|
||||
$slct.event_location_obj_li = events_func.handle_load_ae_obj_li__event_location({api_cfg: $ae_api, event_id: $slct.event_id, params: params, log_lvl: 1})
|
||||
.then(function (load_results) {
|
||||
console.log(`Loaded event_location_obj_li:`, load_results);
|
||||
|
||||
// We need to make this ready for the select option list. Convert the list to a key value pair with the event_location_id_random as the key. We also need to set the option text value to: name (room)
|
||||
if (load_results) {
|
||||
let event_location_obj_li = load_results;
|
||||
let event_location_obj_kv = {};
|
||||
event_location_obj_kv[''] = '-- Select a location --';
|
||||
event_location_obj_li.forEach((event_location_obj) => {
|
||||
let option_text = `${event_location_obj.name} (${event_location_obj.code})`;
|
||||
event_location_obj_kv[event_location_obj.event_location_id_random] = option_text;
|
||||
});
|
||||
$slct.event_location_obj_kv = event_location_obj_kv;
|
||||
}
|
||||
// $slct.event_location_obj_kv = $slct.event_location_obj_kv;
|
||||
console.log(`$slct.event_location_obj_kv = `, $slct.event_location_obj_kv);
|
||||
|
||||
return load_results;
|
||||
})
|
||||
.finally(function () {
|
||||
console.log(`Finally...`);
|
||||
ae_tmp.event_location_id = $lq__event_session_obj?.event_location_id_random;
|
||||
ae_tmp.show__edit_event_location = true;
|
||||
});
|
||||
}}
|
||||
class="btn btn-sm variant-soft-warning hover:variant-ghost-warning"
|
||||
>
|
||||
<span class="fas fa-edit mx-1"></span>
|
||||
Edit
|
||||
</button>
|
||||
|
||||
{/if}
|
||||
|
||||
|
||||
|
||||
</Element_ae_crud>
|
||||
{/if}
|
||||
</li>
|
||||
<li>
|
||||
<strong class="text-sm">Moderator/Champion:</strong>
|
||||
@@ -741,7 +850,7 @@ function send_sign_in_poc_email(
|
||||
|
||||
</li>
|
||||
|
||||
{#if $ae_loc.trusted_access}
|
||||
{#if $ae_loc.administrator_access}
|
||||
<li>
|
||||
<strong class="text-sm">Session passcode:</strong> {$lq__event_session_obj.passcode ? $lq__event_session_obj.passcode : '-- not set --'}
|
||||
</li>
|
||||
@@ -760,9 +869,15 @@ function send_sign_in_poc_email(
|
||||
hide_edit_btn={!$ae_loc.trusted_access}
|
||||
outline_element={false}
|
||||
show_crud={false}
|
||||
display_inline={false}
|
||||
display_inline={true}
|
||||
display_block_edit={true}
|
||||
textarea_rows={15}
|
||||
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});
|
||||
}}
|
||||
>
|
||||
<strong class="text-sm">
|
||||
Session description:
|
||||
@@ -1173,9 +1288,15 @@ function send_sign_in_poc_email(
|
||||
hide_edit_btn={!$ae_loc.trusted_access}
|
||||
outline_element={false}
|
||||
show_crud={false}
|
||||
display_inline={false}
|
||||
display_inline={true}
|
||||
display_block_edit={true}
|
||||
textarea_rows={15}
|
||||
class_li={''}
|
||||
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: event_presentation_obj.event_presentation_id_random, log_lvl: 1});
|
||||
}}
|
||||
>
|
||||
{#if event_presentation_obj.description}
|
||||
<strong class="text-sm">
|
||||
|
||||
Reference in New Issue
Block a user