More work on using the new Element_ae_crud_v2 component
This commit is contained in:
@@ -22,7 +22,7 @@ import { events_loc, events_sess, events_slct, events_trigger, events_trig_kv }
|
||||
import { events_func } from '$lib/ae_events_functions';
|
||||
|
||||
import Comp_event_session_obj_li from '../../ae_comp__event_session_obj_li_wrapper.svelte';
|
||||
import Element_ae_crud from '$lib/element_ae_crud.svelte';
|
||||
import Element_ae_crud_v2 from '$lib/element_ae_crud_v2.svelte';
|
||||
import Comp_event_device_obj_li from './../device/ae_comp__event_device_obj_li_wrapper.svelte';
|
||||
|
||||
// if (log_lvl) {
|
||||
@@ -121,38 +121,34 @@ if (!$events_loc.pres_mgmt?.location_kv) {
|
||||
|
||||
<h4 class="h5 rounded-md p-2 bg-gray-200 flex flex-row gap-1 items-center justify-between">
|
||||
<span>
|
||||
<Element_ae_crud
|
||||
<Element_ae_crud_v2
|
||||
api_cfg={$ae_api}
|
||||
|
||||
object_type={'event_location'}
|
||||
object_id={event_location_obj?.event_location_id_random}
|
||||
object_reload={true}
|
||||
|
||||
field_name={'name'}
|
||||
field_type={'text'}
|
||||
field_value={event_location_obj?.name}
|
||||
allow_null={false}
|
||||
hide_edit_btn={!$ae_loc.trusted_access || !$ae_loc.edit_mode}
|
||||
outline_element={false}
|
||||
show_crud={false}
|
||||
display_inline={true}
|
||||
display_block_edit={true}
|
||||
class_li={''}
|
||||
on:ae_crud_updated={e => {
|
||||
console.log(`ae_crud_updated:`, e.detail);
|
||||
|
||||
events_func.load_ae_obj_id__event_location({
|
||||
api_cfg: $ae_api, event_location_id: event_location_obj.event_location_id_random, log_lvl: 1
|
||||
})
|
||||
.then(function (load_results) {
|
||||
})
|
||||
.then(function (load_results) {
|
||||
// $events_trigger = 'load__event_location_obj_id';
|
||||
// $events_trig_kv['event_location_id'] = event_location_obj.event_location_id_random;
|
||||
});
|
||||
}}
|
||||
current_field_value={event_location_obj?.name}
|
||||
|
||||
allow_null={false}
|
||||
|
||||
hide_element={!$ae_loc.edit_mode}
|
||||
hide_edit_btn={false}
|
||||
|
||||
outline_element={false}
|
||||
display_block={false}
|
||||
display_absolute_edit={false}
|
||||
|
||||
class_li={'m-1'}
|
||||
>
|
||||
<!-- <strong class="text-sm">Name/Title:</strong> -->
|
||||
<span class="fas fa-map-marker-alt m-1 text-neutral-800/80"></span>
|
||||
"{event_location_obj?.name ?? '-- not set --'}"
|
||||
</Element_ae_crud>
|
||||
</Element_ae_crud_v2>
|
||||
|
||||
<!-- "{event_location_obj.name}" -->
|
||||
{#if event_location_obj?.code && !$events_loc.pres_mgmt?.hide__location_code}
|
||||
<span class="text-sm text-gray-500 bg-yellow-100 p-1 rounded-md border border-yellow-200"
|
||||
@@ -234,7 +230,7 @@ if (!$events_loc.pres_mgmt?.location_kv) {
|
||||
<div
|
||||
class:hidden={!$events_loc.pres_mgmt.show_content__location_description}
|
||||
>
|
||||
<Element_ae_crud
|
||||
<!-- <Element_ae_crud
|
||||
api_cfg={$ae_api}
|
||||
object_type={'event_location'}
|
||||
object_id={event_location_obj?.event_location_id_random}
|
||||
@@ -295,15 +291,73 @@ if (!$events_loc.pres_mgmt?.location_kv) {
|
||||
{:else}
|
||||
{@html ae_snip.html__not_set}
|
||||
{/if}
|
||||
<!-- {:else}
|
||||
<div class="text-sm text-gray-500 bg-gray-100 p-1 rounded-md border border-gray-200"
|
||||
class:hidden={!$ae_loc.administrator_access}
|
||||
</Element_ae_crud> -->
|
||||
|
||||
<Element_ae_crud_v2
|
||||
api_cfg={$ae_api}
|
||||
|
||||
object_type={'event_location'}
|
||||
object_id={event_location_obj?.event_location_id_random}
|
||||
object_reload={true}
|
||||
|
||||
field_name={'description'}
|
||||
field_type={'textarea'}
|
||||
|
||||
current_field_value={event_location_obj?.description}
|
||||
|
||||
allow_null={true}
|
||||
|
||||
hide_element={!$ae_loc.edit_mode}
|
||||
hide_edit_btn={!$ae_loc.trusted_access || !$ae_loc.edit_mode}
|
||||
|
||||
outline_element={false}
|
||||
display_block={false}
|
||||
display_absolute_edit={false}
|
||||
|
||||
textarea_rows={15}
|
||||
|
||||
class_li={'m-1'}
|
||||
>
|
||||
<strong class="text-sm">
|
||||
Description:
|
||||
</strong>
|
||||
|
||||
{#if event_location_obj?.description}
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => {
|
||||
console.log('Show/Hide Description');
|
||||
if ($events_sess.pres_mgmt.show_content__location_description == event_location_obj.event_location_id_random) {
|
||||
$events_sess.pres_mgmt.show_content__location_description = null;
|
||||
|
||||
// Was testing with LiveQuery
|
||||
$events_slct.event_location_id = null;
|
||||
} else {
|
||||
$events_sess.pres_mgmt.show_content__location_description = event_location_obj.event_location_id_random;
|
||||
|
||||
// Was testing with LiveQuery
|
||||
$events_slct.event_location_id = event_location_obj.event_location_id_random;
|
||||
}
|
||||
}}
|
||||
class="btn btn-sm preset-tonal-surface hover:preset-filled-surface-500 text-xs"
|
||||
>
|
||||
<span class="fas fa-exclamation-triangle mx-1"></span>
|
||||
No description provided.
|
||||
</div>
|
||||
{/if} -->
|
||||
</Element_ae_crud>
|
||||
{#if $events_sess.pres_mgmt.show_content__location_description == event_location_obj.event_location_id_random}
|
||||
<span class="fas fa-eye-slash mx-1"></span>
|
||||
<span>Hide Description</span>
|
||||
{:else}
|
||||
<span class="fas fa-eye mx-1"></span>
|
||||
<span>Show</span>
|
||||
{/if}
|
||||
</button>
|
||||
|
||||
<pre
|
||||
class="whitespace-pre-wrap p-2 bg-gray-100 rounded-md"
|
||||
class:hidden={$events_sess.pres_mgmt.show_content__location_description !== event_location_obj.event_location_id_random}
|
||||
>{event_location_obj.description}</pre>
|
||||
{:else}
|
||||
{@html ae_snip.html__not_set}
|
||||
{/if}
|
||||
</Element_ae_crud_v2>
|
||||
</div>
|
||||
|
||||
{#if !$events_loc.pres_mgmt.show_content__location_devices_sessions || $events_loc.pres_mgmt.show_content__location_devices_sessions == 'default' || $events_loc.pres_mgmt.show_content__location_devices_sessions == 'sessions'}
|
||||
|
||||
Reference in New Issue
Block a user