From 547845ed627f250022aa5d07d7e35cc3b4c8892c Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Fri, 15 Nov 2024 13:03:58 -0500 Subject: [PATCH] Work on the delete functions. General clean up. --- src/routes/idaa/(idaa)/archives/+page.svelte | 8 ++++ .../(idaa)/archives/[archive_id]/+page.svelte | 9 ++++ ...a_comp__archive_content_obj_id_edit.svelte | 1 + ...e_idaa_comp__archive_content_obj_li.svelte | 5 +-- .../ae_idaa_comp__archive_obj_id_edit.svelte | 44 +++++++++++++++++-- .../ae_idaa_comp__archive_obj_li.svelte | 10 ++--- .../bb/ae_idaa_comp__post_obj_id_edit.svelte | 3 ++ .../bb/ae_idaa_comp__post_obj_li.svelte | 12 ++--- .../(idaa)/recovery_meetings/+page.svelte | 9 ++++ .../ae_idaa_comp__event_obj_id_edit.svelte | 9 ---- 10 files changed, 85 insertions(+), 25 deletions(-) diff --git a/src/routes/idaa/(idaa)/archives/+page.svelte b/src/routes/idaa/(idaa)/archives/+page.svelte index 1a048202..daccaed3 100644 --- a/src/routes/idaa/(idaa)/archives/+page.svelte +++ b/src/routes/idaa/(idaa)/archives/+page.svelte @@ -65,6 +65,14 @@ $: lq__archive_content_obj = liveQuery(async () => { + + + IDAA Archives: + - Novi - {$ae_loc?.title} + + + +
{idaa_archive_content_obj.original_location} {/if} - {#if idaa_archive_content_obj.description}
{@html idaa_archive_content_obj.description}
{/if} @@ -232,13 +231,13 @@ let ae_promises: key_val = {}; - Created on: {ae_util.iso_datetime_formatter(idaa_archive_content_obj.created_on, 'datetime_12_short')} + Created on: {ae_util.iso_datetime_formatter(idaa_archive_content_obj.created_on, 'datetime_12_long')} - Updated on: {ae_util.iso_datetime_formatter(idaa_archive_content_obj.updated_on, 'datetime_12_short')} + Updated on: {ae_util.iso_datetime_formatter(idaa_archive_content_obj.updated_on, 'datetime_12_long')}
diff --git a/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_obj_id_edit.svelte b/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_obj_id_edit.svelte index e0655e4f..dac6181a 100644 --- a/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_obj_id_edit.svelte +++ b/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_obj_id_edit.svelte @@ -224,6 +224,47 @@ async function handle_submit_form(event) { } } + +// Updated 2024-11-15 +async function handle_delete_archive_obj( + { + archive_id, + method = 'disable' + }: { + archive_id: string, + method?: string + } + ) { + if (log_lvl) { + console.log('*** handle_delete_archive_obj() ***'); + } + + prom_api__archive_obj = archives_func.delete_ae_obj_id__archive({ + api_cfg: $ae_api, + archive_id: archive_id, + method: method, + log_lvl: log_lvl + }) + .then(function (archive_obj_delete_result) { + $idaa_sess.archives.show__modal_edit__archive_id = false; + $idaa_sess.archives.show__modal_view__archive_id = false; + $idaa_sess.archives.show__modal_edit__archive_content_id = false; + $idaa_sess.archives.show__modal_view__archive_content_id = false; + }) + .catch(function (error) { + console.log('The result was null or false when trying to delete.', error); + }) + .finally(() => { + // $idaa_sess.recovery_meetings.show__modal_edit = false; + $idaa_slct.archive_id = null; + $idaa_slct.archive_obj = null; + $idaa_slct.archive_content_id = null; + $idaa_slct.archive_content_obj = null; + }); + + return prom_api__archive_obj; +} + @@ -547,9 +588,6 @@ async function handle_submit_form(event) { on:click={() => { if (!confirm('Are you sure you want to delete this archive?')) {return false;} handle_delete_archive_obj({archive_id: $idaa_slct.archive_id}); - - $idaa_slct.archive_id = null; - $idaa_slct.archive_obj = {}; }} class="btn btn-sm variant-soft-warning" > diff --git a/src/routes/idaa/(idaa)/archives/ae_idaa_comp__archive_obj_li.svelte b/src/routes/idaa/(idaa)/archives/ae_idaa_comp__archive_obj_li.svelte index b5b2cabb..7e65f8f9 100644 --- a/src/routes/idaa/(idaa)/archives/ae_idaa_comp__archive_obj_li.svelte +++ b/src/routes/idaa/(idaa)/archives/ae_idaa_comp__archive_obj_li.svelte @@ -17,12 +17,12 @@ onMount(() => { -
+
{#if $lq__archive_obj_li && $lq__archive_obj_li.length} {#each $lq__archive_obj_li as idaa_archive_obj, index}
@@ -107,21 +107,21 @@ onMount(() => { {/if}
-