diff --git a/src/routes/idaa/(idaa)/archives/[archive_id]/+page.svelte b/src/routes/idaa/(idaa)/archives/[archive_id]/+page.svelte index 6d1f29db..d5f7d22e 100644 --- a/src/routes/idaa/(idaa)/archives/[archive_id]/+page.svelte +++ b/src/routes/idaa/(idaa)/archives/[archive_id]/+page.svelte @@ -1,5 +1,4 @@ diff --git a/src/routes/idaa/(idaa)/archives/[archive_id]/+page.ts b/src/routes/idaa/(idaa)/archives/[archive_id]/+page.ts index 553b4c69..429045e5 100644 --- a/src/routes/idaa/(idaa)/archives/[archive_id]/+page.ts +++ b/src/routes/idaa/(idaa)/archives/[archive_id]/+page.ts @@ -1,11 +1,12 @@ -/** @type {import('./$types').PageLoad} */ -// import { error } from '@sveltejs/kit'; +import type { PageLoad } from './$types'; + console.log(`ae_p_idaa_archives [archive_id] +page.ts start`); +import { error } from '@sveltejs/kit'; import { browser } from '$app/environment'; import { archives_func } from '$lib/ae_archives/ae_archives_functions'; -export async function load({ params, parent }) { // route +export const load = (async ({ params, parent }) => { // route let log_lvl: number = 0; let data = await parent(); @@ -15,71 +16,38 @@ export async function load({ params, parent }) { // route let ae_acct = data[account_id]; let archive_id = params.archive_id; - // if (!archive_id) { - // console.log(`ae_idaa_archives archives [archive_id] +page.ts: The archive_id was not found in the params!!!`); - // error(404, { - // message: 'IDAA Archives - Archive ID not found' - // }); - // } + ae_acct.slct.archive_id = archive_id; if (browser) { if (log_lvl) { console.log(`ae_idaa_archives archives [archive_id] +page.ts: archive_id = `, archive_id); } - // Load event archive object + // Load archive object let load_archive_obj = await archives_func.load_ae_obj_id__archive({ api_cfg: ae_acct.api, archive_id: archive_id, inc_content_li: true, - try_cache: true, log_lvl: log_lvl + }) + .then((results) => { + if (!results) { + error(404, { + message: 'IDAA Archives - Archive not found' + }); + } else { + // ae_acct.slct.post_obj = results; + } }); + if (log_lvl) { console.log(`load_archive_obj = `, load_archive_obj); } ae_acct.slct.archive_obj = load_archive_obj; - - // Load archive contents for the archive - // let load_archive_content_obj_li = archives_func.load_ae_obj_li__archive_content({ - // api_cfg: ae_acct.api, - // for_obj_type: 'archive', - // for_obj_id: archive_id, - // params: {qry__enabled: 'all', qry__limit: 99}, - // try_cache: true - // }) - // .then((archive_content_obj_li) => { - // if (log_lvl) { - // console.log(`archive_content_obj_li = `, archive_content_obj_li); - // } - // for (let index = 0; index < archive_content_obj_li.length; index++) { - // let archive_content_obj = archive_content_obj_li[index]; - // let archive_content_id = archive_content_obj.archive_content_id_random; - - // let load_archive_content_obj_li = archives_func.load_ae_obj_li__archive_content({ - // api_cfg: ae_acct.api, - // for_obj_type: 'archive_content', - // for_obj_id: archive_content_id, - // params: {qry__enabled: 'all', qry__limit: 15}, - // try_cache: true - // }); - // if (log_lvl) { - // console.log(`load_archive_content_obj_li = `, load_archive_content_obj_li); - // } - // archive_content_obj_li[index].archive_content_li = load_archive_content_obj_li; - // } - - // return archive_content_obj_li; - // }); - // if (log_lvl) { - // console.log(`load_archive_content_obj_li = `, load_archive_content_obj_li); - // } - // ae_acct.slct.archive_content_obj_li = load_archive_content_obj_li; - } // WARNING: Precaution against shared data between sites and presentations. data[account_id] = ae_acct; return data; -} +}) satisfies PageLoad; diff --git a/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_content_obj_id_edit.svelte b/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_content_obj_id_edit.svelte index 8159a351..066620c8 100644 --- a/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_content_obj_id_edit.svelte +++ b/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_content_obj_id_edit.svelte @@ -31,6 +31,10 @@ let upload__hosted_file_obj_promise: any; let prom_api__archive_content_obj: any = $state(); let prom_api__archive_content_obj__hosted_file: any = $state(); +let description_new_html = $state(''); +let description_changed = $state(false); +let notes_new_html = $state(''); +let notes_changed = $state(false); let disable_submit_btn = $state(false); let slct_hosted_file_kv: key_val = $state({}); @@ -139,9 +143,9 @@ async function handle_submit_form(event) { archive_content_do['name'] = archive_content_di.name; // Check if the description_new_html exists and is a string - if (typeof $idaa_slct.archive_content_obj.description_new_html === 'string') { + if (typeof description_new_html === 'string') { console.log('New description is a string'); - archive_content_do['description'] = $idaa_slct.archive_content_obj.description_new_html; + archive_content_do['description'] = description_new_html; } else { console.log('New description is not a string. Do nothing.'); // archive_content_do['description'] = event_meeting_fd.description; @@ -193,9 +197,9 @@ async function handle_submit_form(event) { archive_content_do['enable'] = !!archive_content_di.enable; // Check if the notes_new_html exists and is a string - if (typeof $idaa_slct.archive_content_obj.notes_new_html === 'string') { + if (typeof notes_new_html === 'string') { console.log('New notes is a string'); - archive_content_do['notes'] = $idaa_slct.archive_content_obj.notes_new_html; + archive_content_do['notes'] = notes_new_html; } else { console.log('New notes is not a string. Do nothing.'); // archive_content_do['notes'] = event_meeting_fd.notes; @@ -360,26 +364,45 @@ $effect(() => { - - Name of Content - + + + + + + Name of Content + + - - Description + + + Description + + - + {#if $idaa_slct.archive_content_id} - @@ -616,17 +639,17 @@ $effect(() => { {/if} - + {:else} - Save the form first before uploading a file. - + {/if} - + Original @@ -664,24 +687,40 @@ $effect(() => { - + {#if $ae_loc.trusted_access} { $idaa_loc.archives.show__admin_options = !$idaa_loc.archives.show__admin_options; }} > + {#if $idaa_loc.archives.show__admin_options} + + {:else} + {/if} {$idaa_loc.archives.show__admin_options ? 'Hide' : 'Show'} Admin - - + @@ -693,10 +732,10 @@ $effect(() => { class="flex flex-col md:flex-row flex-wrap gap-2 items-center justify-center md:justify-stretch w-full" > - - Hide + + Hide { name="hide" value={true} bind:group={$idaa_slct.archive_content_obj.hide} - class="radio" + class="radio form-check-input" > Yes @@ -715,14 +754,14 @@ $effect(() => { name="hide" value={false} bind:group={$idaa_slct.archive_content_obj.hide} - class="radio" + class="radio form-check-input" > No - - Priority + + Priority { name="priority" value={true} bind:group={$idaa_slct.archive_content_obj.priority} - class="radio" + class="radio form-check-input" > Yes @@ -741,23 +780,29 @@ $effect(() => { name="priority" value={false} bind:group={$idaa_slct.archive_content_obj.priority} - class="radio" + class="radio form-check-input" > No - - Sort + + Sort - Group + Group {#if $ae_loc.administrator_access} - - Enable + + Enable { name="enable" value={true} bind:group={$idaa_slct.archive_content_obj.enable} - class="radio" + class="radio form-check-input" > Yes @@ -776,7 +821,7 @@ $effect(() => { name="enable" value={false} bind:group={$idaa_slct.archive_content_obj.enable} - class="radio" + class="radio form-check-input" > No @@ -792,12 +837,15 @@ $effect(() => { for="notes" class="w-full" > - Internal Staff Notes + Internal Staff Notes {/if} @@ -807,18 +855,34 @@ $effect(() => { {$idaa_slct.archive_content_obj?.updated_on ? `SLCT Updated on: ${$idaa_slct.archive_content_obj?.updated_on}` : ''} - + {/if} - + - - Save Archive Content + {#await prom_api__archive_content_obj} + Saving + {:then} + Save Changes + {/await} + + {#if $idaa_slct.archive_content_id && !$idaa_slct.archive_content_obj?.hosted_file_id} @@ -839,7 +903,12 @@ $effect(() => { $idaa_sess.archives.show__modal_edit__archive_content_id = false; $idaa_sess.archives.show__modal_view__archive_content_id = false; }} - class="novi_btn btn btn-sm preset-tonal-warning" + class=" + novi_btn + btn btn-sm + preset-filled-warning-200-800 hover:preset-filled-error-200-800 + transition + " title="Disable this archive content" > @@ -853,7 +922,7 @@ $effect(() => { Can not delete. Remove hosted file first. {/if} {/if} - + 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 448543a2..277d1279 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 @@ -28,6 +28,10 @@ let upload__hosted_file_obj_promise: any; let prom_api__archive_obj: any; let prom_api__archive_obj__hosted_file: any; +let description_new_html = $state(''); +let description_changed = $state(false); +let notes_new_html = $state(''); +let notes_changed = $state(false); let disable_submit_btn = true; let lu_time_zone_list:any = $state(localStorage.getItem('lu_time_zone_list') ? JSON.parse(localStorage.getItem('lu_time_zone_list')) : []); @@ -102,9 +106,9 @@ async function handle_submit_form(event) { archive_do['name'] = archive_di.name; // Check if the description_new_html exists and is a string - if (typeof $idaa_slct.archive_obj.description_new_html === 'string') { + if (typeof description_new_html === 'string') { console.log('New description is a string'); - archive_do['description'] = $idaa_slct.archive_obj.description_new_html; + archive_do['description'] = description_new_html; } else { console.log('New description is not a string. Do nothing.'); // archive_do['description'] = event_meeting_fd.description; @@ -157,9 +161,9 @@ async function handle_submit_form(event) { archive_do['enable'] = !!archive_di.enable; // Check if the notes_new_html exists and is a string - if (typeof $idaa_slct.archive_obj.notes_new_html === 'string') { + if (typeof notes_new_html === 'string') { console.log('New notes is a string'); - archive_do['notes'] = $idaa_slct.archive_obj.notes_new_html; + archive_do['notes'] = notes_new_html; } else { console.log('New notes is not a string. Do nothing.'); // archive_do['notes'] = event_meeting_fd.notes; @@ -197,6 +201,7 @@ async function handle_submit_form(event) { return create_archive_obj_promise; } else { + prom_api__archive_obj = archives_func.update_ae_obj__archive({ api_cfg: $ae_api, archive_id: $idaa_slct.archive_id, @@ -226,6 +231,7 @@ async function handle_submit_form(event) { }); return prom_api__archive_obj; + } } @@ -293,23 +299,43 @@ async function handle_delete_archive_obj( - - Name of Archive + + + + + + Name of Archive + + - - Description + + + Description + @@ -322,9 +348,9 @@ async function handle_delete_archive_obj( /> --> - + - + Original @@ -395,7 +421,7 @@ async function handle_delete_archive_obj( - + @@ -437,18 +463,34 @@ async function handle_delete_archive_obj( {#if $ae_loc.trusted_access} { $idaa_loc.archives.show__admin_options = !$idaa_loc.archives.show__admin_options; }} > + {#if $idaa_loc.archives.show__admin_options} + + {:else} + {/if} {$idaa_loc.archives.show__admin_options ? 'Hide' : 'Show'} Admin - - + @@ -460,10 +502,10 @@ async function handle_delete_archive_obj( class="flex flex-col md:flex-row flex-wrap gap-2 items-center justify-center md:justify-stretch w-full" > - - Hide + + Hide Yes @@ -482,14 +524,14 @@ async function handle_delete_archive_obj( name="hide" value={false} bind:group={$idaa_slct.archive_obj.hide} - class="radio" + class="radio form-check-input" > No - - Priority + + Priority Yes @@ -508,23 +550,29 @@ async function handle_delete_archive_obj( name="priority" value={false} bind:group={$idaa_slct.archive_obj.priority} - class="radio" + class="radio form-check-input" > No - - Sort + + Sort - Group + Group {#if $ae_loc.administrator_access} - - Enable + + Enable Yes @@ -543,7 +591,7 @@ async function handle_delete_archive_obj( name="enable" value={false} bind:group={$idaa_slct.archive_obj.enable} - class="radio" + class="radio form-check-input" > No @@ -559,12 +607,15 @@ async function handle_delete_archive_obj( for="notes" class="w-full" > - Internal Staff Notes + Internal Staff Notes {/if} @@ -574,11 +625,11 @@ async function handle_delete_archive_obj( {$idaa_slct.archive_obj?.updated_on ? `SLCT Updated on: ${$idaa_slct.archive_obj?.updated_on}` : ''} - + {/if} - + Delete {/if} - + 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 e42277f8..97941fdf 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 @@ -51,8 +51,17 @@ let { lq__archive_obj_li }: Props = $props(); - - Open + + + + Open {#if idaa_archive_obj?.archive_content_count} @@ -61,7 +70,7 @@ let { lq__archive_obj_li }: Props = $props(); {/if} - {#if $ae_loc.administrator_access && $ae_loc.edit_mode} + {#if 1==3 && $ae_loc.administrator_access && $ae_loc.edit_mode} { diff --git a/src/routes/idaa/(idaa)/bb/[post_id]/+page.svelte b/src/routes/idaa/(idaa)/bb/[post_id]/+page.svelte index 22a536d1..668cb36a 100644 --- a/src/routes/idaa/(idaa)/bb/[post_id]/+page.svelte +++ b/src/routes/idaa/(idaa)/bb/[post_id]/+page.svelte @@ -1,9 +1,12 @@