Work on the delete functions. General clean up.
This commit is contained in:
@@ -65,6 +65,14 @@ $: lq__archive_content_obj = liveQuery(async () => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<svelte:head>
|
||||||
|
<title>
|
||||||
|
IDAA Archives:
|
||||||
|
- Novi - {$ae_loc?.title}
|
||||||
|
</title>
|
||||||
|
</svelte:head>
|
||||||
|
|
||||||
|
|
||||||
<section
|
<section
|
||||||
class="
|
class="
|
||||||
ae_idaa__bb
|
ae_idaa__bb
|
||||||
|
|||||||
@@ -98,6 +98,15 @@ if (browser) {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<svelte:head>
|
||||||
|
<title>
|
||||||
|
IDAA Archives:
|
||||||
|
{$lq__archive_obj?.name ? ae_util.shorten_string({ string: $lq__archive_obj?.name, max_length: 20, begin_length: 10, end_length: 4 }) : ''}
|
||||||
|
- Novi - {$ae_loc?.title}
|
||||||
|
</title>
|
||||||
|
</svelte:head>
|
||||||
|
|
||||||
|
|
||||||
<section
|
<section
|
||||||
class="
|
class="
|
||||||
ae_idaa__bb
|
ae_idaa__bb
|
||||||
|
|||||||
@@ -740,6 +740,7 @@ async function handle_hosted_files_uploaded(hosted_file_id_li: string[], hosted_
|
|||||||
$idaa_slct.archive_content_id = null;
|
$idaa_slct.archive_content_id = null;
|
||||||
$idaa_slct.archive_content_obj = {};
|
$idaa_slct.archive_content_obj = {};
|
||||||
$idaa_sess.archives.show__modal_edit__archive_content_id = false;
|
$idaa_sess.archives.show__modal_edit__archive_content_id = false;
|
||||||
|
$idaa_sess.archives.show__modal_view__archive_content_id = false;
|
||||||
}}
|
}}
|
||||||
class="btn btn-sm variant-soft-warning"
|
class="btn btn-sm variant-soft-warning"
|
||||||
title="Disable this archive content"
|
title="Disable this archive content"
|
||||||
|
|||||||
@@ -77,7 +77,6 @@ let ae_promises: key_val = {};
|
|||||||
<span class="ae_value">{idaa_archive_content_obj.original_location}</span>
|
<span class="ae_value">{idaa_archive_content_obj.original_location}</span>
|
||||||
</h4>
|
</h4>
|
||||||
{/if}
|
{/if}
|
||||||
<!-- <span>group: {idaa_archive_content_obj.group}</span> -->
|
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
{#if idaa_archive_content_obj.description}<pre class="archive__description p-2 bg-white shadow-md rounded-lg text-wrap text-sm font-normal whitespace-pre-wrap">{@html idaa_archive_content_obj.description}</pre>{/if}
|
{#if idaa_archive_content_obj.description}<pre class="archive__description p-2 bg-white shadow-md rounded-lg text-wrap text-sm font-normal whitespace-pre-wrap">{@html idaa_archive_content_obj.description}</pre>{/if}
|
||||||
@@ -232,13 +231,13 @@ let ae_promises: key_val = {};
|
|||||||
<span
|
<span
|
||||||
class="archive_content__created_on"
|
class="archive_content__created_on"
|
||||||
>
|
>
|
||||||
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')}
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
class="archive_content__updated_on"
|
class="archive_content__updated_on"
|
||||||
class:hidden={!idaa_archive_content_obj.updated_on}
|
class:hidden={!idaa_archive_content_obj.updated_on}
|
||||||
>
|
>
|
||||||
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')}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
@@ -547,9 +588,6 @@ async function handle_submit_form(event) {
|
|||||||
on:click={() => {
|
on:click={() => {
|
||||||
if (!confirm('Are you sure you want to delete this archive?')) {return false;}
|
if (!confirm('Are you sure you want to delete this archive?')) {return false;}
|
||||||
handle_delete_archive_obj({archive_id: $idaa_slct.archive_id});
|
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"
|
class="btn btn-sm variant-soft-warning"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ onMount(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<section class="archive_list">
|
<section class="archive_list flex flex-col gap-2 items-center justify-center w-full">
|
||||||
{#if $lq__archive_obj_li && $lq__archive_obj_li.length}
|
{#if $lq__archive_obj_li && $lq__archive_obj_li.length}
|
||||||
|
|
||||||
{#each $lq__archive_obj_li as idaa_archive_obj, index}
|
{#each $lq__archive_obj_li as idaa_archive_obj, index}
|
||||||
<div
|
<div
|
||||||
class="container archive archive_obj border border-1 rounded p-2 mb-2 space-y-2"
|
class="container archive archive_obj border border-1 rounded p-2 mb-2 space-y-2 w-full max-w-screen-lg flex flex-col items-center justify-center"
|
||||||
class:dim={idaa_archive_obj.hide}
|
class:dim={idaa_archive_obj.hide}
|
||||||
class:bg-warning-100={!idaa_archive_obj?.enable}
|
class:bg-warning-100={!idaa_archive_obj?.enable}
|
||||||
>
|
>
|
||||||
@@ -107,21 +107,21 @@ onMount(() => {
|
|||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<section class="ae_section ae_footer ae_meta archive__meta">
|
<section class="ae_section ae_footer ae_meta archive__meta mt-2 flex flex-col sm:flex-row gap-1 items-center justify-center flex flex-col text-sm text-gray-500">
|
||||||
<div class="ae_group">
|
<div class="ae_group">
|
||||||
{#if !idaa_archive_obj.updated_on}
|
{#if !idaa_archive_obj.updated_on}
|
||||||
<span
|
<span
|
||||||
class="archive__created_on"
|
class="archive__created_on"
|
||||||
>
|
>
|
||||||
<span class="ae_label">Created on:</span>
|
<span class="ae_label">Created on:</span>
|
||||||
<span class="ae_value">{ae_util.iso_datetime_formatter(idaa_archive_obj.created_on, 'datetime_short')}</span>
|
<span class="ae_value">{ae_util.iso_datetime_formatter(idaa_archive_obj.created_on, 'datetime_12_long')}</span>
|
||||||
</span>
|
</span>
|
||||||
{:else}
|
{:else}
|
||||||
<span
|
<span
|
||||||
class="archive__updated_on"
|
class="archive__updated_on"
|
||||||
>
|
>
|
||||||
<span class="ae_label">Updated on:</span>
|
<span class="ae_label">Updated on:</span>
|
||||||
<span class="ae_value">{ae_util.iso_datetime_formatter(idaa_archive_obj.updated_on, 'datetime_short')}</span>
|
<span class="ae_value">{ae_util.iso_datetime_formatter(idaa_archive_obj.updated_on, 'datetime_12_long')}</span>
|
||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -194,6 +194,7 @@ async function handle_delete_post_obj(
|
|||||||
.then(function (post_obj_delete_result) {
|
.then(function (post_obj_delete_result) {
|
||||||
$idaa_sess.bb.show__modal_view__post_id = false;
|
$idaa_sess.bb.show__modal_view__post_id = false;
|
||||||
$idaa_sess.bb.show__inline_edit__post_obj = false;
|
$idaa_sess.bb.show__inline_edit__post_obj = false;
|
||||||
|
$idaa_sess.bb.show__inline_edit__post_comment_id = false;
|
||||||
})
|
})
|
||||||
.catch(function (error) {
|
.catch(function (error) {
|
||||||
console.log('The result was null or false when trying to delete.', error);
|
console.log('The result was null or false when trying to delete.', error);
|
||||||
@@ -202,6 +203,8 @@ async function handle_delete_post_obj(
|
|||||||
// $idaa_sess.recovery_meetings.show__modal_edit = false;
|
// $idaa_sess.recovery_meetings.show__modal_edit = false;
|
||||||
$idaa_slct.post_id = null;
|
$idaa_slct.post_id = null;
|
||||||
$idaa_slct.post_obj = null;
|
$idaa_slct.post_obj = null;
|
||||||
|
$idaa_slct.post_comment_id = null;
|
||||||
|
$idaa_slct.post_comment_obj = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
return prom_api__post_obj;
|
return prom_api__post_obj;
|
||||||
|
|||||||
@@ -105,11 +105,13 @@ onMount(() => {
|
|||||||
<div class="ae_section ae_footer ae_meta post__meta text-sm text-gray-500 mt-4 flex flex-row gap-2 items-center justify-center">
|
<div class="ae_section ae_footer ae_meta post__meta text-sm text-gray-500 mt-4 flex flex-row gap-2 items-center justify-center">
|
||||||
{#if (idaa_post_obj.anonymous)}
|
{#if (idaa_post_obj.anonymous)}
|
||||||
<div class="post__posted_by">
|
<div class="post__posted_by">
|
||||||
Posted by: <span class="fas fa-user-secret"></span> <span class="post__full_name">Anonymous</span>
|
<span class="text-xs">Posted by:</span>
|
||||||
|
<span class="fas fa-user-secret"></span> <span class="post__full_name">Anonymous</span>
|
||||||
</div>
|
</div>
|
||||||
{:else if (idaa_post_obj.full_name)}
|
{:else if (idaa_post_obj.full_name)}
|
||||||
<div class="post__posted_by">
|
<div class="post__posted_by">
|
||||||
Posted by: <span class="fas fa-user"></span> <span class="post__full_name">{idaa_post_obj.full_name}
|
<span class="text-xs">Posted by:</span>
|
||||||
|
<span class="fas fa-user"></span> <span class="post__full_name">{idaa_post_obj.full_name}
|
||||||
{#if $ae_loc.trusted_access && idaa_post_obj.email}
|
{#if $ae_loc.trusted_access && idaa_post_obj.email}
|
||||||
(<a href="mailto:{idaa_post_obj.email}?subject=IDAA BB Post">{idaa_post_obj.email}</a>)
|
(<a href="mailto:{idaa_post_obj.email}?subject=IDAA BB Post">{idaa_post_obj.email}</a>)
|
||||||
{/if}
|
{/if}
|
||||||
@@ -122,19 +124,19 @@ onMount(() => {
|
|||||||
<span
|
<span
|
||||||
class="post__created_on"
|
class="post__created_on"
|
||||||
>
|
>
|
||||||
<span class="ae_label">Created on:</span>
|
<span class="ae_label text-xs">Created on:</span>
|
||||||
<span class="ae_value">{ae_util.iso_datetime_formatter(idaa_post_obj.created_on, 'datetime_iso_12_no_seconds')}</span>
|
<span class="ae_value">{ae_util.iso_datetime_formatter(idaa_post_obj.created_on, 'datetime_iso_12_no_seconds')}</span>
|
||||||
</span>
|
</span>
|
||||||
{:else}
|
{:else}
|
||||||
<span
|
<span
|
||||||
class="post__updated_on"
|
class="post__updated_on"
|
||||||
>
|
>
|
||||||
<span class="ae_label">Updated on:</span>
|
<span class="ae_label text-xs">Updated on:</span>
|
||||||
<span class="ae_value">{ae_util.iso_datetime_formatter(idaa_post_obj.updated_on, 'datetime_iso_12_no_seconds')}</span>
|
<span class="ae_value">{ae_util.iso_datetime_formatter(idaa_post_obj.updated_on, 'datetime_iso_12_no_seconds')}</span>
|
||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
{#if idaa_post_obj.archive_on}
|
{#if idaa_post_obj.archive_on}
|
||||||
<span class="post__archive_on">Archive on: {ae_util.iso_datetime_formatter(idaa_post_obj.archive_on, 'datetime_iso_12_no_seconds')}</span>
|
<span class="post__archive_on text-xs">Archive on: {ae_util.iso_datetime_formatter(idaa_post_obj.archive_on, 'datetime_iso_12_no_seconds')}</span>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -80,6 +80,15 @@ $: lq_new__event_obj_li = liveQuery(async () => {
|
|||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<!-- ({$lq__event_obj?.event_id ?? ''}) -->
|
||||||
|
<svelte:head>
|
||||||
|
<title>
|
||||||
|
IDAA Recovery Meetings:
|
||||||
|
{$lq__event_obj?.name ? ae_util.shorten_string({ string: $lq__event_obj?.name, max_length: 20, begin_length: 10, end_length: 4 }) : ''}
|
||||||
|
- Novi - {$ae_loc?.title}
|
||||||
|
</title>
|
||||||
|
</svelte:head>
|
||||||
|
|
||||||
|
|
||||||
<section
|
<section
|
||||||
class="
|
class="
|
||||||
|
|||||||
@@ -1237,9 +1237,6 @@ async function handle_delete_event_obj(
|
|||||||
on:click={() => {
|
on:click={() => {
|
||||||
if (!confirm('Are you sure you want to delete this event?')) {return false;}
|
if (!confirm('Are you sure you want to delete this event?')) {return false;}
|
||||||
handle_delete_event_obj({event_id: $idaa_slct.event_id, method: 'delete'});
|
handle_delete_event_obj({event_id: $idaa_slct.event_id, method: 'delete'});
|
||||||
|
|
||||||
// $idaa_slct.event_id = null;
|
|
||||||
// $lq__event_obj = {};
|
|
||||||
}}
|
}}
|
||||||
class="btn btn-sm variant-soft-warning"
|
class="btn btn-sm variant-soft-warning"
|
||||||
title="Delete record permanently"
|
title="Delete record permanently"
|
||||||
@@ -1252,9 +1249,6 @@ async function handle_delete_event_obj(
|
|||||||
on:click={() => {
|
on:click={() => {
|
||||||
if (!confirm('Are you sure you want to disable this event?')) {return false;}
|
if (!confirm('Are you sure you want to disable this event?')) {return false;}
|
||||||
handle_delete_event_obj({event_id: $idaa_slct.event_id, method: 'disable'});
|
handle_delete_event_obj({event_id: $idaa_slct.event_id, method: 'disable'});
|
||||||
|
|
||||||
// $idaa_slct.event_id = null;
|
|
||||||
// $lq__event_obj = {};
|
|
||||||
}}
|
}}
|
||||||
class="btn btn-sm variant-soft-warning"
|
class="btn btn-sm variant-soft-warning"
|
||||||
title="Disable record to delete"
|
title="Disable record to delete"
|
||||||
@@ -1267,9 +1261,6 @@ async function handle_delete_event_obj(
|
|||||||
on:click={() => {
|
on:click={() => {
|
||||||
if (!confirm('Are you sure you want to hide this event?')) {return false;}
|
if (!confirm('Are you sure you want to hide this event?')) {return false;}
|
||||||
handle_delete_event_obj({event_id: $idaa_slct.event_id, method: 'hide'});
|
handle_delete_event_obj({event_id: $idaa_slct.event_id, method: 'hide'});
|
||||||
|
|
||||||
// $idaa_slct.event_id = null;
|
|
||||||
// $lq__event_obj = {};
|
|
||||||
}}
|
}}
|
||||||
class="btn btn-sm variant-soft-warning"
|
class="btn btn-sm variant-soft-warning"
|
||||||
title="Hide record to delete"
|
title="Hide record to delete"
|
||||||
|
|||||||
Reference in New Issue
Block a user