diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index b7cd008a..58fc4ef4 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -364,7 +364,7 @@ if (browser) { // Check if in the array of: super > manager > administrator > trusted > public > authenticated > anonymous const access_type_li = ['super', 'manager', 'administrator', 'trusted', 'public', 'authenticated', 'anonymous']; $effect(() => { - if (browser && $ae_loc.access_type && access_type_li.includes($ae_loc.access_type)) { + if (browser && $ae_loc.access_type && access_type_li.includes($ae_loc.access_type)) { document.getElementsByTagName('html')[0].classList.remove('super_access', 'manager_access', 'administrator_access', 'trusted_access', 'public_access', 'authenticated_access', 'anonymous_access'); document.getElementsByTagName('html')[0].classList.add(`${$ae_loc.access_type}_access`); } else if (browser) { diff --git a/src/routes/idaa/(idaa)/bb/+page.svelte b/src/routes/idaa/(idaa)/bb/+page.svelte index e4b8b4ea..ab4b2e93 100644 --- a/src/routes/idaa/(idaa)/bb/+page.svelte +++ b/src/routes/idaa/(idaa)/bb/+page.svelte @@ -1,6 +1,14 @@ @@ -177,7 +199,7 @@ $: if ($idaa_trig.post_id) { -{#if $lq__post_obj_li && $lq__post_obj_li?.length } +{#if $lq__post_obj_li && $lq__post_obj_li?.length} @@ -204,13 +226,14 @@ $: if ($idaa_trig.post_id) { }} > - + {#snippet header()} - - - {#if $ae_loc.trusted_access || $lq__post_obj?.external_person_id === $idaa_loc.novi_uuid} - { + + + + {#if $ae_loc.trusted_access || $lq__post_obj?.external_person_id === $idaa_loc.novi_uuid} + { // const url = new URL(location); // url.searchParams.set('post_id', $lq__post_obj?.post_id_random); // history.pushState({}, '', url); @@ -222,26 +245,27 @@ $: if ($idaa_trig.post_id) { $idaa_sess.bb.show__inline_edit__post_obj = true; } }} - class="novi_btn btn btn-sm variant-ghost-warning hover:variant-filled-warning transition" - title={`Edit meeting: ${$lq__post_obj?.title}`} - > - {#if $idaa_sess.bb.show__inline_edit__post_obj} - Cancel Edit - {:else} - Edit - {/if} - - {/if} - - - - {@html $lq__post_obj?.title ?? 'New Post'} - - - {#if $lq__post_obj?.topic_id} {$lq__post_obj?.topic_name}{/if} - - - + class="novi_btn btn btn-sm variant-ghost-warning hover:variant-filled-warning transition" + title={`Edit meeting: ${$lq__post_obj?.title}`} + > + {#if $idaa_sess.bb.show__inline_edit__post_obj} + Cancel Edit + {:else} + Edit + {/if} + + {/if} + + + + {@html $lq__post_obj?.title ?? 'New Post'} + + + {#if $lq__post_obj?.topic_id} {$lq__post_obj?.topic_name}{/if} + + + + {/snippet} -export let log_lvl: number = 0; +import { preventDefault } from 'svelte/legacy'; + // import { createEventDispatcher, onDestroy, onMount } from 'svelte'; import { fade } from 'svelte/transition'; @@ -12,17 +13,24 @@ import { idaa_loc, idaa_sess, idaa_slct } from '$lib/ae_idaa_stores'; import { posts_func } from '$lib/ae_posts/ae_posts_functions'; import Tiptap_editor from '$lib/element_tiptap_editor.svelte'; -export let lq__post_obj: any; -export let lq__post_comment_obj: any; +interface Props { + log_lvl?: number; + lq__post_obj: any; + lq__post_comment_obj: any; +} -let prom_api__post_comment_obj: any; +let { log_lvl = $bindable(2), lq__post_obj, lq__post_comment_obj }: Props = $props(); -let disable_submit_btn = false; +let prom_api__post_comment_obj: any = $state(); + +let disable_submit_btn = $state(false); async function handle_submit_form(event: any) { if (log_lvl > 1) { console.log('*** handle_submit_form() ***', event.target); + console.log($lq__post_obj); + console.log($lq__post_comment_obj); } disable_submit_btn = true; @@ -217,7 +225,7 @@ async function handle_delete_post_comment_obj( function send_staff_notification_email() { - log_lvl = 2; + log_lvl = 1; if (log_lvl) { console.log(`*** send_staff_notification_email() *** Post ID: ${$idaa_slct.post_id} Post Title: ${$idaa_slct?.post_obj?.title}`); } @@ -225,8 +233,9 @@ function send_staff_notification_email() { console.log(`Selected Post Object:`, $idaa_slct.post_obj); console.log(`Selected Post Comment Object:`, $idaa_slct.post_comment_obj); - console.log($lq__post_obj?.title); - console.log($lq__post_obj?.content); + // console.log($lq__post_obj); + // console.log($lq__post_obj?.title); + // console.log($lq__post_obj?.content); } let link_base_url = $ae_loc.site_cfg_json.novi_bb_base_url ?? `${$ae_loc.url_origin}/idaa/bb`; @@ -262,8 +271,8 @@ function send_staff_notification_email() { api_cfg: $ae_api, from_email: $ae_loc.site_cfg_json?.noreply_email ?? 'noreply+idaabb@oneskyit.com', from_name: $ae_loc.site_cfg_json?.noreply_name ?? 'IDAA BB NoReply', - // to_email: $ae_loc.site_cfg_json?.admin_email ?? 'admin+bbcomment@oneskyit.com', // 'scott+idaabb@oneskyit.com', // $idaa_slct.post_comment_obj.email, - to_email: 'scott+idaabbstaff@oneskyit.com', + to_email: $ae_loc.site_cfg_json?.admin_email ?? 'admin+bbcomment@oneskyit.com', // 'scott+idaabb@oneskyit.com', // $idaa_slct.post_comment_obj.email, + // to_email: 'scott+idaabbstaff@oneskyit.com', to_name: $ae_loc.site_cfg_json?.admin_name ?? 'IDAA BB Admin', subject: subject, body_html: body_html, @@ -297,8 +306,8 @@ function send_poster_notification_email() { from_email: $ae_loc.site_cfg_json?.noreply_email ?? 'noreply+idaabb@oneskyit.com', from_name: $ae_loc.site_cfg_json?.noreply_name ?? 'IDAA BB NoReply', // to_email: $ae_loc.site_cfg_json?.admin_email ?? 'admin+bbpost@oneskyit.com', // 'scott+idaabb@oneskyit.com', - // to_email: $idaa_slct.post_obj.email, - to_email: 'scott+idaabb@oneskyit.com', + to_email: $idaa_slct.post_obj.email, + // to_email: 'scott+idaabb@oneskyit.com', to_name: $idaa_slct.post_obj.full_name ?? 'IDAA BB Poster', subject: subject, body_html: body_html, @@ -314,7 +323,7 @@ function send_poster_notification_email() { bind:clientHeight={$ae_loc.iframe_height_modal_body} > - + {#await prom_api__post_comment_obj} Saving... @@ -329,7 +338,7 @@ function send_poster_notification_email() { { + onclick={() => { $idaa_sess.bb.show__inline_edit__post_comment_id = false; }} class="novi_btn btn btn-sm variant-ghost-warning hover:variant-filled-warning transition" @@ -463,7 +472,7 @@ function send_poster_notification_email() { { + onclick={() => { $idaa_loc.bb.show__admin_options = !$idaa_loc.bb.show__admin_options; }} > @@ -614,7 +623,7 @@ function send_poster_notification_email() { { + onclick={() => { if (!confirm('Are you sure you want to create this post?')) {return false;} // handle_save_post_comment_obj({post_id: $idaa_slct.post_id, method: 'create'}); }} @@ -632,7 +641,7 @@ function send_poster_notification_email() { {#if $ae_loc.administrator_access} { + onclick={() => { if (!confirm('Are you sure you want to delete this post comment?')) {return false;} handle_delete_post_comment_obj({post_comment_id: $idaa_slct.post_comment_id, method: 'delete'}); }} @@ -644,7 +653,7 @@ function send_poster_notification_email() { {:else if $ae_loc.trusted_access} { + onclick={() => { if (!confirm('Are you sure you want to disable this post comment?')) {return false;} handle_delete_post_comment_obj({post_comment_id: $idaa_slct.post_comment_id, method: 'disable'}); }} @@ -656,7 +665,7 @@ function send_poster_notification_email() { {:else} { + onclick={() => { if (!confirm('Are you sure you want to hide this post comment?')) {return false;} handle_delete_post_comment_obj({post_comment_id: $idaa_slct.post_comment_id, method: 'hide'}); }} @@ -672,7 +681,7 @@ function send_poster_notification_email() { { + onclick={() => { $idaa_sess.bb.show__inline_edit__post_comment_id = false; }} class="novi_btn btn btn-sm variant-ghost-warning hover:variant-filled-warning transition" diff --git a/src/routes/idaa/(idaa)/bb/ae_idaa_comp__post_obj_id_view.svelte b/src/routes/idaa/(idaa)/bb/ae_idaa_comp__post_obj_id_view.svelte index eff3ac24..59c0599e 100644 --- a/src/routes/idaa/(idaa)/bb/ae_idaa_comp__post_obj_id_view.svelte +++ b/src/routes/idaa/(idaa)/bb/ae_idaa_comp__post_obj_id_view.svelte @@ -20,7 +20,8 @@ let ae_promises: key_val = {}; if ($idaa_slct.post_id) { console.log(`Post ID selected: ${$idaa_slct.post_id}`); - console.log(`Post Object selected: ${$lq__post_obj}`); + console.log(`Post Object selected: ${lq__post_obj}`); + console.log(`Post Object title: ${$lq__post_obj?.title}`); $idaa_trig.post_id = $idaa_slct.post_id; }