Removing old files.
This commit is contained in:
@@ -1,697 +0,0 @@
|
||||
<script lang="ts">
|
||||
type key_val = {
|
||||
[key: string]: any;
|
||||
};
|
||||
// *** Import Svelte core
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
// *** Import Aether core variables and functions
|
||||
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
||||
import { idaa_loc, idaa_sess, idaa_slct } from '$lib/ae_idaa_stores';
|
||||
|
||||
// *** Import Aether core components
|
||||
|
||||
// *** Import Aether module variables and functions
|
||||
|
||||
// *** Import Aether module components
|
||||
import Edit_post_obj from './del 10_edit__post_obj.svelte';
|
||||
import View_post_obj from './ae_idaa_comp__post_obj_id_view.svelte';
|
||||
|
||||
// *** Export/Exposed variables and functions for component
|
||||
export let account_id: string = $ae_loc.account_id;
|
||||
export let post_id: string = $idaa_loc.bb.post_id;
|
||||
|
||||
export let novi_uuid: string = $idaa_loc.novi_uuid;
|
||||
export let novi_email: string = $idaa_loc.novi_email;
|
||||
export let novi_full_name: string = $idaa_loc.novi_full_name;
|
||||
export let novi_admin_li: string = $idaa_loc.novi_admin_li;
|
||||
export let novi_trusted_li: string = $idaa_loc.novi_trusted_li;
|
||||
|
||||
// *** Set initial variables
|
||||
$idaa_loc.novi_uuid = novi_uuid;
|
||||
$idaa_loc.novi_email = decodeURIComponent(novi_email);
|
||||
$idaa_loc.novi_full_name = decodeURIComponent(novi_full_name);
|
||||
$idaa_loc.novi_admin_li = novi_admin_li;
|
||||
$idaa_loc.novi_trusted_li = novi_trusted_li;
|
||||
|
||||
$idaa_loc.bb.show_main__options = true;
|
||||
$idaa_loc.bb.show_list__post_obj_li = true;
|
||||
|
||||
// NOTE: Check if the novi_uuid is in the novi_admin_li list
|
||||
if ($idaa_loc.novi_uuid && $idaa_loc.novi_admin_li) {
|
||||
if ($idaa_loc.novi_admin_li.includes($idaa_loc.novi_uuid)) {
|
||||
$ae_loc.access_type = 'administrator';
|
||||
$ae_loc.administrator_access = true;
|
||||
$ae_loc.trusted_access = true;
|
||||
}
|
||||
}
|
||||
// NOTE: Check if the novi_uuid is in the novi_trusted_li list
|
||||
if ($idaa_loc.novi_uuid && $idaa_loc.novi_trusted_li) {
|
||||
if ($idaa_loc.novi_trusted_li.includes($idaa_loc.novi_uuid)) {
|
||||
$ae_loc.access_type = 'trusted';
|
||||
$ae_loc.trusted_access = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($ae_loc.administrator_access) {
|
||||
$idaa_loc.bb.enabled = 'enabled';
|
||||
$idaa_loc.bb.hidden = 'not_hidden';
|
||||
$idaa_loc.bb.limit = 150;
|
||||
} else if ($ae_loc.trusted_access) {
|
||||
$idaa_loc.bb.enabled = 'enabled';
|
||||
$idaa_loc.bb.hidden = 'not_hidden';
|
||||
$idaa_loc.bb.limit = 75;
|
||||
} else {
|
||||
$idaa_loc.bb.enabled = 'enabled';
|
||||
$idaa_loc.bb.hidden = 'not_hidden';
|
||||
$idaa_loc.bb.limit = 50;
|
||||
}
|
||||
|
||||
let idaa_post_obj_li_get_promise;
|
||||
let idaa_post_obj_get_promise;
|
||||
let idaa_post_comment_obj_li_get_promise;
|
||||
|
||||
if (account_id) {
|
||||
$slct.account_id = account_id;
|
||||
handle_load_idaa_post_obj_li({account_id: $slct.account_id, try_cache: false});
|
||||
}
|
||||
|
||||
// NOTE: This if post_id is not fully ready yet -2023-09-08
|
||||
if (post_id) {
|
||||
console.log(`Selected Post ID: ${post_id}`);
|
||||
$slct.post_id = post_id;
|
||||
$slct_trigger = 'load__post_obj';
|
||||
$slct_trigger = 'load__post_comment_obj_li';
|
||||
// handle_load_post_id_obj({post_id: $slct.post_id, try_cache: false});
|
||||
// handle_load_post_comment_obj_li({post_id: $slct.post_id, try_cache: false});
|
||||
|
||||
// Auto show the selected Post ID
|
||||
// Is this pushState needed here?
|
||||
// Set the URL param "post_id" to the current Post ID. This is a just in case.
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.set('post_id', $slct.post_id);
|
||||
// history.pushState({}, '', url);
|
||||
|
||||
$idaa_loc.bb.show_main__options = true;
|
||||
$idaa_loc.bb.show_list__post_obj_li = true;
|
||||
$idaa_loc.bb.show_edit__post_id = false;
|
||||
$idaa_loc.bb.show_view__post_id = true;
|
||||
}
|
||||
|
||||
if (!$ae_app.client_content) {
|
||||
$ae_app.client_content = {};
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** IDAA Bulletin Board - AE Posts: Main');
|
||||
});
|
||||
|
||||
|
||||
$: if ($ae_app.iframe_height && $ae_app.iframe_height_modal_body) {
|
||||
console.log('getting new dimensions for iframe:', $ae_app.iframe_height, $ae_app.iframe_height_modal_body);
|
||||
|
||||
let iframe_height = 0;
|
||||
|
||||
if ($ae_app.iframe_height > $ae_app.iframe_height_modal_body) {
|
||||
iframe_height = $ae_app.iframe_height;
|
||||
} else {
|
||||
iframe_height = $ae_app.iframe_height_modal_body;
|
||||
|
||||
// console.log($ae_app.modal_dimensions);
|
||||
|
||||
if ($ae_app.modal_dimensions && $ae_app.modal_dimensions.header_height) {
|
||||
iframe_height = iframe_height + $ae_app.modal_dimensions.header_height;
|
||||
}
|
||||
if ($ae_app.modal_dimensions && $ae_app.modal_dimensions.footer_height) {
|
||||
iframe_height = iframe_height + $ae_app.modal_dimensions.footer_height;
|
||||
}
|
||||
// iframe_height = iframe_height + 50; // Just in case
|
||||
}
|
||||
|
||||
console.log(`Suggested new iframe_height: ${iframe_height}`);
|
||||
window.parent.postMessage({'iframe_height': iframe_height}, "*"); // This should be in pixels
|
||||
} else if ($ae_app.iframe_height) {
|
||||
console.log('setting new iframe_height:', $ae_app.iframe_height);
|
||||
|
||||
// let iframe_height = $ae_app.iframe_height;
|
||||
|
||||
window.parent.postMessage({'iframe_height': $ae_app.iframe_height}, "*"); // This should be in pixels
|
||||
}
|
||||
|
||||
|
||||
$: if ($slct_trigger == 'load__post_obj_li' && $slct.account_id) {
|
||||
$slct_trigger = null;
|
||||
|
||||
handle_load_idaa_post_obj_li({account_id: $slct.account_id, try_cache: false});
|
||||
}
|
||||
|
||||
async function handle_load_idaa_post_obj_li({account_id, try_cache=false}) {
|
||||
console.log('*** handle_load_idaa_post_obj_li() ***');
|
||||
|
||||
let enabled = $idaa_loc.bb.enabled;
|
||||
let hidden = $idaa_loc.bb.hidden;
|
||||
let limit = $idaa_loc.bb.limit;
|
||||
let offset = $idaa_loc.bb.offset;
|
||||
|
||||
let params = {};
|
||||
|
||||
idaa_post_obj_li_get_promise = api.get_ae_obj_li_for_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'post', // Post in this case is a person's bulletin board post.
|
||||
for_obj_type: 'account',
|
||||
for_obj_id: account_id,
|
||||
enabled: enabled,
|
||||
hidden: hidden,
|
||||
order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'created_on': 'DESC', 'updated_on': 'DESC'},
|
||||
limit: limit,
|
||||
offset: offset,
|
||||
params_json: null,
|
||||
params: params,
|
||||
log_lvl: 2
|
||||
})
|
||||
.then(function (post_obj_li_get_result) {
|
||||
if (post_obj_li_get_result) {
|
||||
$slct.post_obj_li = post_obj_li_get_result;
|
||||
console.log(`Post list:`, $slct.post_obj_li);
|
||||
} else {
|
||||
$slct.post_obj_li = [];
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
|
||||
return idaa_post_obj_li_get_promise;
|
||||
}
|
||||
|
||||
|
||||
$: if ($slct_trigger == 'load__post_obj' && $slct.post_id) {
|
||||
$slct_trigger = null;
|
||||
|
||||
handle_load_post_id_obj({post_id: $slct.post_id, try_cache: false});
|
||||
|
||||
// // Auto show the selected Event ID
|
||||
// // Set the URL param "post_id" to the current Event ID. This is a just in case.
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.set('post_id', $slct.post_id);
|
||||
// history.pushState({}, '', url);
|
||||
|
||||
// let message = {'post_id': $slct.post_id};
|
||||
// window.parent.postMessage(message, "*");
|
||||
|
||||
// $idaa_loc.bb.show_main__options = false;
|
||||
// $idaa_loc.bb.show_list__post_li = false;
|
||||
// $idaa_loc.bb.show_view__post_id = true;
|
||||
// $idaa_loc.bb.show_edit__post_id = false;
|
||||
}
|
||||
|
||||
async function handle_load_post_id_obj({post_id, try_cache=false}) {
|
||||
console.log('*** handle_load_post_id_obj() ***');
|
||||
|
||||
// let enabled = $idaa_loc.bb.enabled;
|
||||
// let hidden = $idaa_loc.bb.hidden;
|
||||
// let limit = $idaa_loc.bb.limit;
|
||||
// let offset = $idaa_loc.bb.offset;
|
||||
|
||||
let params = {};
|
||||
|
||||
idaa_post_obj_get_promise = api.get_ae_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'post',
|
||||
obj_id: post_id,
|
||||
params: params,
|
||||
log_lvl: 0
|
||||
})
|
||||
.then(function (post_obj_get_result) {
|
||||
if (post_obj_get_result) {
|
||||
$slct.post_obj = post_obj_get_result;
|
||||
console.log(`Post object:`, $slct.post_obj);
|
||||
}
|
||||
|
||||
// Auto show the selected Post ID
|
||||
// Set the URL param "post_id" to the current Post ID.
|
||||
const url = new URL(location);
|
||||
url.searchParams.set('post_id', $slct.post_id);
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {'post_id': $slct.post_id};
|
||||
window.parent.postMessage(message, "*");
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
|
||||
return idaa_post_obj_get_promise;
|
||||
}
|
||||
|
||||
|
||||
$: if ($slct_trigger == 'load__post_comment_obj_li' && $slct.post_id) {
|
||||
$slct_trigger = null;
|
||||
|
||||
handle_load_post_comment_obj_li({post_id: $slct.post_id, try_cache: false});
|
||||
}
|
||||
|
||||
async function handle_load_post_comment_obj_li({post_id, try_cache=false}) {
|
||||
console.log('*** handle_load_post_comment_obj_li() ***');
|
||||
|
||||
let enabled = $idaa_loc.bb.enabled;
|
||||
let hidden = $idaa_loc.bb.hidden;
|
||||
let limit = $idaa_loc.bb.limit;
|
||||
let offset = $idaa_loc.bb.offset;
|
||||
|
||||
let params = {};
|
||||
|
||||
idaa_post_comment_obj_li_get_promise = api.get_ae_obj_li_for_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'post_comment', // Post comment in this case is a person's bulletin board post comment.
|
||||
for_obj_type: 'post',
|
||||
for_obj_id: post_id,
|
||||
enabled: enabled,
|
||||
hidden: hidden,
|
||||
order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'created_on': 'DESC', 'updated_on': 'DESC'},
|
||||
limit: limit,
|
||||
offset: offset,
|
||||
params_json: null,
|
||||
params: params,
|
||||
log_lvl: 0
|
||||
})
|
||||
.then(function (post_comment_obj_li_get_result) {
|
||||
if (post_comment_obj_li_get_result) {
|
||||
$slct.post_comment_obj_li = post_comment_obj_li_get_result;
|
||||
console.log(`Post Comment list:`, $slct.post_comment_obj_li);
|
||||
} else {
|
||||
$slct.post_comment_obj_li = [];
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
|
||||
return idaa_post_comment_obj_li_get_promise;
|
||||
}
|
||||
|
||||
function handle_post_obj_created(event) {
|
||||
console.log('*** handle_post_obj_created() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
// $slct.post_id = event.detail.post_id_random;
|
||||
// $slct.post_obj = event.detail;
|
||||
|
||||
$slct_trigger = 'load__post_obj_li';
|
||||
|
||||
$idaa_loc.bb.show_list__post_obj_li = true;
|
||||
$idaa_loc.bb.show_edit__post_id = false;
|
||||
$idaa_loc.bb.show_view__post_id = false;
|
||||
}
|
||||
|
||||
function handle_post_obj_updated(event) {
|
||||
console.log('*** handle_post_obj_updated() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
// $slct.post_id = event.detail.post_id_random;
|
||||
// $slct.post_obj = event.detail;
|
||||
|
||||
$slct_trigger = 'load__post_obj_li';
|
||||
|
||||
$idaa_loc.bb.show_list__post_obj_li = true;
|
||||
$idaa_loc.bb.show_edit__post_id = false;
|
||||
$idaa_loc.bb.show_view__post_id = false;
|
||||
}
|
||||
|
||||
function handle_post_obj_deleted(event) {
|
||||
console.log('*** handle_post_obj_deleted() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
// $slct.post_id = null;
|
||||
// $slct.post_obj = {};
|
||||
|
||||
$slct_trigger = 'load__post_obj_li';
|
||||
|
||||
$idaa_loc.bb.show_list__post_obj_li = true;
|
||||
$idaa_loc.bb.show_edit__post_id = false;
|
||||
$idaa_loc.bb.show_view__post_id = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<section id="osit_idaa_bb" class="osit_posts ae_main c_idaa c_idaa_bb" bind:clientHeight={$ae_app.iframe_height}>
|
||||
<!-- <header>
|
||||
<h1>IDAA BB Posts</h1>
|
||||
</header> -->
|
||||
|
||||
<section class="ae_section ae_meta">
|
||||
<p>
|
||||
Novi: {$idaa_loc.novi_full_name}
|
||||
<span class="details">
|
||||
(
|
||||
{$idaa_loc.novi_email}
|
||||
{#if $ae_loc.administrator_access}
|
||||
<span class="access_type administrator_access">Administrator</span>
|
||||
{:else if $ae_loc.trusted_access}
|
||||
<span class="access_type trusted_access">Trusted</span>
|
||||
{/if}
|
||||
<span class="novi_uuid">UUID: {$idaa_loc.novi_uuid}</span>
|
||||
)
|
||||
</span>
|
||||
</p>
|
||||
<!-- <p>Page height: {window.innerHeight}</p> -->
|
||||
</section>
|
||||
|
||||
{#if $idaa_loc.bb.show_main__options}
|
||||
<section class="ae_section ae_options ae_row post_obj__options">
|
||||
|
||||
{#if $ae_loc.trusted_access && $idaa_loc.bb.hidden == 'not_hidden'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$idaa_loc.bb.hidden = 'all';
|
||||
$slct_trigger = 'load__post_obj_li';
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-info"
|
||||
>
|
||||
<span class="fas fa-eye"></span> Show Hidden Posts
|
||||
</button>
|
||||
{:else if $ae_loc.trusted_access && $idaa_loc.bb.hidden == 'all'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$idaa_loc.bb.hidden = 'not_hidden';
|
||||
$slct_trigger = 'load__post_obj_li';
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-info"
|
||||
>
|
||||
<span class="fas fa-eye-slash"></span> Hide Hidden Posts
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
{#if $ae_loc.administrator_access}
|
||||
{#if $idaa_loc.bb.enabled == 'enabled'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$idaa_loc.bb.hidden = 'all';
|
||||
$idaa_loc.bb.enabled = 'all';
|
||||
$idaa_loc.bb.limit = 500;
|
||||
$slct_trigger = 'load__post_obj_li';
|
||||
}}
|
||||
class="ae_btn btn_xs ae_smallest btn btn-xs btn-warning"
|
||||
>
|
||||
<span class="fas fa-eye"></span> Show Disabled Posts
|
||||
</button>
|
||||
{:else}
|
||||
<button
|
||||
on:click={() => {
|
||||
$idaa_loc.bb.enabled = 'enabled';
|
||||
$slct_trigger = 'load__post_obj_li';
|
||||
}}
|
||||
class="ae_btn btn_xs ae_smallest btn btn-xs btn-warning"
|
||||
>
|
||||
<span class="fas fa-eye-slash"></span> Hide Disabled Posts
|
||||
</button>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
<button
|
||||
on:click={() => {
|
||||
$slct.post_id = null;
|
||||
$slct.post_obj = {};
|
||||
$slct.post_comment_obj_li = [];
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete('post_id');
|
||||
history.pushState({}, '', url);
|
||||
|
||||
$idaa_loc.bb.show_main__options = true;
|
||||
$idaa_loc.bb.show_list__post_obj_li = true;
|
||||
$idaa_loc.bb.show_edit__post_id = true;
|
||||
$idaa_loc.bb.show_view__post_id = false;
|
||||
}}
|
||||
class="btn_new_bb_post btn btn-secondary"
|
||||
>
|
||||
<span class="fas fa-plus"></span> Create new BB post
|
||||
</button>
|
||||
|
||||
</section>
|
||||
{/if}
|
||||
|
||||
{#if $idaa_loc.bb.show_list__post_obj_li}
|
||||
<section class="bb_post_list">
|
||||
{#if $slct.post_obj_li}
|
||||
<!-- <ul> -->
|
||||
{#each $slct.post_obj_li as idaa_post_obj, index}
|
||||
<div
|
||||
id={`idaa_bb_post_id__${idaa_post_obj.post_id_random}`}
|
||||
class="container bb_post post_obj"
|
||||
class:post__hide={idaa_post_obj.hide}
|
||||
class:post__priority={idaa_post_obj.priority}
|
||||
class:post__group={idaa_post_obj.group}
|
||||
>
|
||||
<header class="ae_header post__header">
|
||||
<h3 class="post__title">
|
||||
{@html idaa_post_obj.title}
|
||||
{#if idaa_post_obj.topic_id}<span class="badge badge-info bg-info"><span class="fas fa-user-md"></span> {idaa_post_obj.topic_name}</span>{/if}
|
||||
</h3>
|
||||
</header>
|
||||
|
||||
{#if idaa_post_obj.content}<div class="post__content">{@html idaa_post_obj.content}</div>{/if}
|
||||
|
||||
<div class="ae_options post_obj__options">
|
||||
<button
|
||||
on:click={() => {
|
||||
$slct.post_id = idaa_post_obj.post_id_random;
|
||||
$slct.post_obj = idaa_post_obj;
|
||||
|
||||
handle_load_post_comment_obj_li({post_id: $slct.post_id, try_cache: false});
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.set('post_id', idaa_post_obj.post_id_random);
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {'post_id': idaa_post_obj.post_id_random};
|
||||
window.parent.postMessage(message, "*");
|
||||
|
||||
$idaa_loc.bb.show_main__options = true;
|
||||
$idaa_loc.bb.show_list__post_obj_li = true;
|
||||
// $idaa_loc.bb.show_edit__post_id = false;
|
||||
$idaa_loc.bb.show_view__post_id = true;
|
||||
}}
|
||||
class="btn btn-primary"
|
||||
title={`View: ${idaa_post_obj.title}`}
|
||||
>
|
||||
<span class="fas fa-envelope-open"></span> Open
|
||||
|
||||
{#if idaa_post_obj.post_comment_count}
|
||||
<span class="ae_badge ae_info post__post_comment_count">
|
||||
<span class="fas fa-comment"></span> {(idaa_post_obj.post_comment_count == 1 ? `${idaa_post_obj.post_comment_count} comment` : `${idaa_post_obj.post_comment_count} comments` )}
|
||||
</span>
|
||||
{/if}
|
||||
</button>
|
||||
|
||||
{#if $ae_loc.trusted_access || idaa_post_obj.external_person_id === $idaa_loc.novi_uuid || idaa_post_obj.email === $idaa_loc.novi_email}
|
||||
<button
|
||||
on:click={() => {
|
||||
$slct.post_id = idaa_post_obj.post_id_random;
|
||||
$slct.post_obj = idaa_post_obj;
|
||||
$slct_trigger = 'load__post_obj';
|
||||
|
||||
$idaa_loc.bb.show_main__options = true;
|
||||
$idaa_loc.bb.show_list__post_obj_li = true;
|
||||
$idaa_loc.bb.show_edit__post_id = true;
|
||||
// $idaa_loc.bb.show_view__post_id = false;
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-secondary"
|
||||
title={`Edit post: ${idaa_post_obj.title}`}
|
||||
>
|
||||
<span class="fas fa-edit"></span> Edit Post
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
<!-- <button
|
||||
on:click={() => {
|
||||
$slct.post_id = idaa_post_obj.post_id_random;
|
||||
$slct.post_obj = idaa_post_obj;
|
||||
|
||||
$idaa_loc.bb.show_post_comment_crud = true;
|
||||
}}
|
||||
class="ae_btn btn_md btn_outline_warning"
|
||||
title={`New comment on: ${idaa_post_obj.title}`}
|
||||
>
|
||||
<span class="fas fa-plus"></span> New Comment
|
||||
</button> -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="ae_section ae_footer ae_meta post__meta">
|
||||
{#if (idaa_post_obj.anonymous)}
|
||||
<div class="post__posted_by">
|
||||
Posted by: <span class="fas fa-user-secret"></span> <span class="post__full_name">Anonymous</span>
|
||||
</div>
|
||||
{:else if (idaa_post_obj.full_name)}
|
||||
<div class="post__posted_by">
|
||||
Posted by: <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}
|
||||
(<a href="mailto:{idaa_post_obj.email}?subject=IDAA BB Post">{idaa_post_obj.email}</a>)
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if idaa_post_obj.created_on}
|
||||
<div class="post__created_on_updated_on">
|
||||
{#if !idaa_post_obj.updated_on}
|
||||
<span
|
||||
class="post__created_on"
|
||||
>
|
||||
<span class="ae_label">Created on:</span>
|
||||
<span class="ae_value">{ae.util.iso_datetime_formatter(idaa_post_obj.created_on, 'datetime_iso_no_seconds')}</span>
|
||||
</span>
|
||||
{:else}
|
||||
<span
|
||||
class="post__updated_on"
|
||||
>
|
||||
<span class="ae_label">Updated on:</span>
|
||||
<span class="ae_value">{ae.util.iso_datetime_formatter(idaa_post_obj.updated_on, 'datetime_iso_no_seconds')}</span>
|
||||
</span>
|
||||
{/if}
|
||||
{#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_no_seconds')}</span>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
<!-- <div style="font-size: smaller">json={encodeURIComponent(JSON.stringify({idaa_post_obj}))}</div> -->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{/each}
|
||||
<!-- </ul> -->
|
||||
{:else}
|
||||
No posts found at this time
|
||||
{/if}
|
||||
</section>
|
||||
{/if}
|
||||
|
||||
|
||||
{#if $idaa_loc.bb.show_edit__post_id}
|
||||
<Element_modal_v3
|
||||
show = { true }
|
||||
modal_cover_body = { false }
|
||||
report_client_dimensions = { true }
|
||||
on:close={ () => {
|
||||
$idaa_loc.bb.show_main__options = true;
|
||||
$idaa_loc.bb.show_list__post_obj_li = true;
|
||||
$idaa_loc.bb.show_edit__post_id = false;
|
||||
// $idaa_loc.bb.show_view__post_id = false;
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete('post_id');
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {'post_id': null};
|
||||
window.parent.postMessage(message, "*");
|
||||
}}
|
||||
on:report__modal_dimensions={ (event) => {
|
||||
console.log('*** on:report__modal_dimensions ***');
|
||||
console.log(event.detail);
|
||||
|
||||
$ae_app.modal_dimensions = event.detail.modal_dimensions;
|
||||
}}
|
||||
>
|
||||
<span slot="header_title">{@html ($slct.post_obj.title ? $slct.post_obj.title : 'New BB Post')}</span>
|
||||
|
||||
<span slot="body">
|
||||
<section class="post_obj_view">
|
||||
<Edit_post_obj on:created__post_obj={handle_post_obj_created} on:updated__post_obj={handle_post_obj_updated} on:deleted__post_obj={handle_post_obj_deleted} />
|
||||
</section>
|
||||
</span>
|
||||
</Element_modal_v3>
|
||||
{/if}
|
||||
|
||||
|
||||
{#if $idaa_loc.bb.show_view__post_id && $slct.post_obj}
|
||||
<Element_modal_v3
|
||||
show = { true }
|
||||
modal_cover_body = { false }
|
||||
report_client_dimensions = { true }
|
||||
on:close={ () => {
|
||||
$slct.post_comment_id = null; // NOTE: Reset in case the post comment was being edited.
|
||||
$slct.post_comment_obj = {}; // NOTE: Reset in case the post comment was being edited.
|
||||
$slct.post_comment_obj_li = [];
|
||||
|
||||
$idaa_loc.bb.show_main__options = true;
|
||||
$idaa_loc.bb.show_list__post_obj_li = true;
|
||||
// $idaa_loc.bb.show_edit__post_id = false;
|
||||
$idaa_loc.bb.show_view__post_id = false;
|
||||
$idaa_loc.bb.show_edit__post_comment = false;
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete('post_id');
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {'post_id': null};
|
||||
window.parent.postMessage(message, "*");
|
||||
}}
|
||||
on:report__modal_dimensions={ (event) => {
|
||||
console.log('*** on:report__modal_dimensions ***');
|
||||
console.log(event.detail);
|
||||
|
||||
$ae_app.modal_dimensions = event.detail.modal_dimensions;
|
||||
}}
|
||||
>
|
||||
<span slot="header_title">{$slct.post_obj.title}</span>
|
||||
|
||||
<span slot="body">
|
||||
|
||||
<View_post_obj />
|
||||
|
||||
</span>
|
||||
</Element_modal_v3>
|
||||
{/if}
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<style>
|
||||
.ae_header h3 {
|
||||
font-size: 1.2em;
|
||||
margin: 0;
|
||||
/* padding: 0; */
|
||||
}
|
||||
|
||||
.post_obj .ae_meta {
|
||||
font-size: smaller;
|
||||
color: hsla(0,0%,50%,1);
|
||||
}
|
||||
|
||||
.post_obj {
|
||||
border: solid thin hsla(0,0%,90%,1);
|
||||
margin: 1em .5em;
|
||||
padding: .5em .5em;
|
||||
}
|
||||
|
||||
.post__header {
|
||||
background-color: hsla(0,0%,90%,1);
|
||||
}
|
||||
|
||||
/* .ae_meta.post_obj {
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
} */
|
||||
|
||||
/* :global(.bb_post_crud .element_ae_modal) {
|
||||
border: dashed thin hsla(0,0%,70%,1);
|
||||
|
||||
margin: .5em .25em;
|
||||
padding: .5em .25em;
|
||||
|
||||
background-color: hsla(0,0%,90%,1);
|
||||
} */
|
||||
|
||||
/* :global(.bb_post_id_view .element_ae_modal) {
|
||||
border: dashed thin blue;
|
||||
} */
|
||||
|
||||
/* :global(.bb_post_comment_crud .element_ae_modal) {
|
||||
border: dashed thin hsla(0,0%,70%,1);
|
||||
|
||||
margin: .5em .25em;
|
||||
padding: .5em .25em;
|
||||
|
||||
background-color: hsla(0,0%,90%,1);
|
||||
} */
|
||||
</style>
|
||||
@@ -1,476 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher, onDestroy, onMount } from 'svelte';
|
||||
import { fade } from 'svelte/transition';
|
||||
|
||||
import { ae, api, Element_input } from 'aether_npm_lib';
|
||||
import { slct, ae_app } from './stores';
|
||||
|
||||
export let container_class_li = [];
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
let create_post_comment_obj_promise: any;
|
||||
let delete_post_comment_obj_promise: any;
|
||||
let update_post_comment_obj_promise: any;
|
||||
|
||||
let disable_submit_btn = true;
|
||||
|
||||
if ($slct.post_comment_id) {
|
||||
console.log(`Post Comment ID selected: ${$slct.post_comment_id}`);
|
||||
console.log(`Post Comment Object selected: ${$slct.post_comment_obj}`);
|
||||
} else {
|
||||
$slct.post_comment_id = null;
|
||||
$slct.post_comment_obj = {
|
||||
title: null,
|
||||
content: null,
|
||||
anonymous: false,
|
||||
external_person_id: $idaa_loc.novi_uuid,
|
||||
full_name: $idaa_loc.novi_full_name,
|
||||
email: $idaa_loc.novi_email,
|
||||
|
||||
sort: null,
|
||||
// notes: null,
|
||||
};
|
||||
console.log(`Post Comment Object started: ${$slct.post_comment_obj}`);
|
||||
}
|
||||
|
||||
|
||||
if ($slct.post_comment_obj) {
|
||||
} else {
|
||||
console.log(`Post Comment Object started: ${$slct.post_comment_obj}`)
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** Edit - Posts Comment Obj');
|
||||
|
||||
tinymce_remove(); // This seems to fix rendering issues
|
||||
tinymce_init();
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
console.log('** Component Destroyed: ** Edit - Post Obj');
|
||||
tinymce_remove(); // This seems like the right thing to do
|
||||
});
|
||||
|
||||
|
||||
function tinymce_init() {
|
||||
// REFERENCE: https://www.tiny.cloud/docs/tinymce/6/basic-setup/
|
||||
// plugins: [
|
||||
// 'advlist', 'autolink', 'link', 'image', 'lists', 'charmap', 'preview', 'anchor', 'pagebreak',
|
||||
// 'searchreplace', 'wordcount', 'visualblocks', 'visualchars', 'code', 'fullscreen', 'insertdatetime',
|
||||
// 'media', 'table', 'emoticons', 'template', 'help'
|
||||
// ],
|
||||
// 'undo redo | styles | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent'
|
||||
|
||||
// NOTE: Basic version of the TinyMCE editor
|
||||
tinymce.init({
|
||||
selector: '.tinymce_editor.editor_basic',
|
||||
// width: 600,
|
||||
height: 400,
|
||||
plugins: [ 'lists', 'code', 'help' ],
|
||||
menubar: false,
|
||||
toolbar: 'undo redo | styles | bold italic | alignleft aligncenter | bullist numlist outdent indent | code | help',
|
||||
});
|
||||
|
||||
// NOTE: Minimal version of the TinyMCE editor
|
||||
tinymce.init({
|
||||
selector: '.tinymce_editor.editor_basic_200',
|
||||
// width: 600,
|
||||
height: 200,
|
||||
plugins: [ 'lists', 'code', 'help' ],
|
||||
menubar: false,
|
||||
toolbar: 'undo redo | styles | bold italic | alignleft aligncenter | bullist numlist outdent indent | code | help',
|
||||
});
|
||||
|
||||
// NOTE: Less is more version of the TinyMCE editor
|
||||
tinymce.init({
|
||||
selector: '.tinymce_editor.editor_less_100',
|
||||
// width: 600,
|
||||
height: 100,
|
||||
// plugins: [ 'lists', 'code', 'help' ],
|
||||
menubar: false,
|
||||
toolbar: false,
|
||||
statusbar: false,
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function tinymce_remove() {
|
||||
tinymce.remove('.tinymce_editor.editor_basic');
|
||||
tinymce.remove('.tinymce_editor.editor_basic_200');
|
||||
tinymce.remove('.tinymce_editor.editor_less_100');
|
||||
}
|
||||
|
||||
|
||||
$: if ($slct.post_comment_obj) {
|
||||
console.log('Selected post comment object changed?');
|
||||
console.log($slct.post_comment_obj);
|
||||
|
||||
if ($slct.post_comment_obj == null) {
|
||||
$slct.post_comment_obj = {title: null, content: null, name: null, description: null, notes: null, created_on: null, updated_on: null};
|
||||
} else {
|
||||
disable_submit_btn = false;
|
||||
}
|
||||
|
||||
// ae.input_template['event']['timezone'] = 'EDT';
|
||||
}
|
||||
|
||||
|
||||
async function handle_submit_form(event) {
|
||||
console.log('*** handle_submit_form() ***');
|
||||
// console.log(event.target);
|
||||
|
||||
disable_submit_btn = true;
|
||||
|
||||
let form_data = new FormData(event.target);
|
||||
// console.log(form_data);
|
||||
|
||||
// Form Post Comment object data incoming
|
||||
let post_comment_di = ae.util.extract_prefixed_form_data({prefix: null, form_data: form_data, trim_values: true, bool_tf_str: true, log_lvl: 1});
|
||||
// console.log(post_comment_di);
|
||||
|
||||
// Form Post Comment object data outgoing
|
||||
let post_comment_do: key_val = {};
|
||||
|
||||
if (!$slct.post_comment_id) {
|
||||
post_comment_do['post_id_random'] = $slct.post_id;
|
||||
post_comment_do['enable'] = true;
|
||||
}
|
||||
|
||||
if (tinyMCE.get('content')) {
|
||||
post_comment_do['content'] = tinyMCE.get('content').getContent();
|
||||
} else {
|
||||
post_comment_do['content'] = post_comment_di.content;
|
||||
}
|
||||
if (!post_comment_do['content']) {
|
||||
console.log('The content is required.');
|
||||
disable_submit_btn = false;
|
||||
alert('The text for the post comment is required.');
|
||||
return false;
|
||||
}
|
||||
|
||||
post_comment_do['anonymous'] = post_comment_di.anonymous;
|
||||
|
||||
post_comment_do['external_person_id'] = post_comment_di.external_person_id;
|
||||
post_comment_do['full_name'] = post_comment_di.full_name;
|
||||
post_comment_do['email'] = post_comment_di.email;
|
||||
|
||||
post_comment_do['hide'] = !!post_comment_di.hide;
|
||||
|
||||
if (post_comment_di.enable) {
|
||||
post_comment_do['enable'] = !!post_comment_di.enable;
|
||||
}
|
||||
|
||||
console.log(post_comment_do);
|
||||
|
||||
if (!$slct.post_comment_id) {
|
||||
create_post_comment_obj_promise = api.create_ae_obj_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'post_comment',
|
||||
fields: post_comment_do,
|
||||
key: $ae_app.ae_api.api_crud_super_key,
|
||||
log_lvl: 1
|
||||
})
|
||||
.then(function (post_comment_obj_create_result) {
|
||||
if (!post_comment_obj_create_result) {
|
||||
console.log('The result was null or false.');
|
||||
return false;
|
||||
}
|
||||
|
||||
$slct.post_comment_id = post_comment_obj_create_result;
|
||||
|
||||
dispatch(
|
||||
'post_comment_obj_created',
|
||||
{
|
||||
post_comment_id: $slct.post_comment_id,
|
||||
}
|
||||
);
|
||||
|
||||
return post_comment_obj_create_result;
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('Something went wrong.');
|
||||
console.log(error);
|
||||
return false;
|
||||
});
|
||||
|
||||
return create_post_comment_obj_promise;
|
||||
|
||||
} else {
|
||||
update_post_comment_obj_promise = api.update_ae_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'post_comment',
|
||||
obj_id: $slct.post_comment_id,
|
||||
fields: post_comment_do,
|
||||
key: $ae_app.ae_api.api_crud_super_key,
|
||||
log_lvl: 1
|
||||
})
|
||||
.then(function (post_comment_obj_update_result) {
|
||||
if (!post_comment_obj_update_result) {
|
||||
console.log('The result was null or false.');
|
||||
return false;
|
||||
}
|
||||
|
||||
dispatch(
|
||||
'post_comment_obj_updated',
|
||||
{
|
||||
post_comment_id: $slct.post_comment_id,
|
||||
}
|
||||
);
|
||||
|
||||
return post_comment_obj_update_result;
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('Something went wrong.');
|
||||
console.log(error);
|
||||
return false;
|
||||
});
|
||||
|
||||
return update_post_comment_obj_promise;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function handle_delete_post_comment_obj({post_comment_id, method='disable'}) {
|
||||
console.log('*** handle_delete_post_comment_obj() ***');
|
||||
|
||||
delete_post_comment_obj_promise = api.delete_ae_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'post_comment',
|
||||
obj_id: post_comment_id,
|
||||
method: method,
|
||||
// params: params,
|
||||
key: $ae_app.ae_api.api_crud_super_key,
|
||||
log_lvl: 0
|
||||
})
|
||||
.then(function (post_comment_obj_delete_result) {
|
||||
if (post_comment_obj_delete_result) {
|
||||
// console.log(`Result:`, post_comment_obj_delete_result);
|
||||
|
||||
dispatch(
|
||||
'post_comment_obj_deleted',
|
||||
{
|
||||
post_comment_id: post_comment_id,
|
||||
}
|
||||
);
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('The result was null or false when trying to delete.', error);
|
||||
});
|
||||
|
||||
return delete_post_comment_obj_promise;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<section class="svelte_component ae_edit post_comment_obj {container_class_li.join(' ')}">
|
||||
|
||||
<form on:submit|preventDefault={handle_submit_form} class="">
|
||||
|
||||
{#await update_post_comment_obj_promise}
|
||||
<div class="awaiting alert_msg_pulse" out:fade={{ duration: 2000 }}>Saving...</div>
|
||||
{:then}
|
||||
{#if update_post_comment_obj_promise}
|
||||
<div class="awaiting" out:fade={{ duration: 2000 }}>Finished saving</div>
|
||||
{:else}
|
||||
<!-- <div class="awaiting" out:fade={{ duration: 2000 }}>Nothing here yet</div> -->
|
||||
{/if}
|
||||
{/await}
|
||||
|
||||
<h3>Post Comment</h3>
|
||||
|
||||
<!-- <label for="title">Title of BB post
|
||||
<input type="text" id="title" name="title" required max="20" value={$slct.post_comment_obj.title ? $slct.post_comment_obj.title : '' } placeholder="BB post title">
|
||||
</label> -->
|
||||
|
||||
<label for="content">Content (post comment body)
|
||||
<textarea id="content" name="content" rows="6" cols="70" value={$slct.post_comment_obj.content ? $slct.post_comment_obj.content : ''} class="ae_value ae__post_comment__content tinymce_editor editor_basic_200" placeholder="The text of the Bulletin Board post comment"></textarea>
|
||||
</label>
|
||||
|
||||
<h3>Poster's Information</h3>
|
||||
<fieldset class="">
|
||||
<legend class="">Post as Anonymous</legend>
|
||||
<div class="">
|
||||
<input type="radio" class="" id="anonymous_no" name="anonymous" value="0" checked={(!$slct.post_comment_obj.anonymous)} required>
|
||||
<label for="anonymous_no" class="">No, include my name and email address</label>
|
||||
</div>
|
||||
<div class="">
|
||||
<input type="radio" class="" id="anonymous_yes" name="anonymous" value="1" checked={($slct.post_comment_obj.anonymous)} required >
|
||||
<label for="anonymous_yes" class="">Yes, the post will be listed as Anonymous</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<label for="external_person_id"><span class="fas fa-link"></span> Linked with Novi ID
|
||||
{#if !$ae_loc.trusted_access}
|
||||
<span class="fas fa-lock" title="Field is locked"></span>
|
||||
<input
|
||||
type="text"
|
||||
id="external_person_id"
|
||||
name="external_person_id"
|
||||
value={($slct.post_comment_obj.external_person_id ? $slct.post_comment_obj.external_person_id : $idaa_loc.novi_uuid)}
|
||||
readonly={true}
|
||||
class="ae_width_lg"
|
||||
>
|
||||
{:else}
|
||||
<div class="ae_highlight">Primary link using the Novi API UUID. This must be empty, a staff person, or an active member of IDAA and should be the primary contact for this meeting.</div>
|
||||
<span class="fas fa-unlock" title="Field is unlocked"></span>
|
||||
<input
|
||||
type="text"
|
||||
id="external_person_id"
|
||||
name="external_person_id"
|
||||
value={($slct.post_comment_obj.external_person_id ? $slct.post_comment_obj.external_person_id : '')}
|
||||
readonly={false}
|
||||
class="ae_width_lg"
|
||||
>
|
||||
{/if}
|
||||
</label>
|
||||
|
||||
<label for="full_name">Your name
|
||||
{#if !$ae_loc.trusted_access}
|
||||
<span class="fas fa-lock" title="Field is locked"></span>
|
||||
{:else}
|
||||
<span class="fas fa-unlock" title="Field is unlocked"></span>
|
||||
{/if}
|
||||
<input
|
||||
type="text"
|
||||
id="full_name"
|
||||
name="full_name"
|
||||
value={($slct.post_comment_obj.full_name ? $slct.post_comment_obj.full_name : $idaa_loc.novi_full_name)}
|
||||
>
|
||||
</label>
|
||||
|
||||
{#if $ae_loc.trusted_access}
|
||||
<label for="email">Your email
|
||||
{#if !$ae_loc.trusted_access}
|
||||
<span class="fas fa-lock" title="Field is locked"></span>
|
||||
{:else}
|
||||
<span class="fas fa-unlock" title="Field is unlocked"></span>
|
||||
{/if}
|
||||
<input
|
||||
type="text"
|
||||
name="email"
|
||||
value={($slct.post_comment_obj.email ? $slct.post_comment_obj.email : $idaa_loc.novi_email)}
|
||||
readonly={!$ae_loc.trusted_access}
|
||||
>
|
||||
<span class="ae_highlight">Secondary link using the Novi email address</span>
|
||||
</label>
|
||||
{/if}
|
||||
|
||||
|
||||
{#if $ae_loc.trusted_access}
|
||||
<section class="ae_section post_comment__admin_options"> <!-- BEGIN: section post_comment__admin_options -->
|
||||
|
||||
<h3>
|
||||
Admin Options
|
||||
<button type="button" class="ae_btn ae_d_none_toggle ae_float_right ae_smallest btn btn-xs btn-info" on:click={() => {document.querySelector('.ae_d_none_content').classList.toggle('ae_fade_out'); document.querySelector('.ae_d_none_content').classList.toggle('ae_fade_in');}}><span class="fas fa-eye"></span> Show/Hide Admin</button>
|
||||
</h3>
|
||||
|
||||
<span class="ae_d_none_content ae_fade_out">
|
||||
<label>Hide
|
||||
<input
|
||||
type="checkbox"
|
||||
name="hide"
|
||||
id="hide"
|
||||
bind:checked={$slct.post_comment_obj.hide}
|
||||
>
|
||||
</label>
|
||||
|
||||
<!-- <label>Priority
|
||||
<input
|
||||
type="checkbox"
|
||||
name="priority"
|
||||
id="priority"
|
||||
bind:checked={$slct.post_comment_obj.priority}
|
||||
>
|
||||
</label> -->
|
||||
|
||||
<!-- <label>Sort <input type="number" name="sort" value={$slct.post_comment_obj.sort} /></label> -->
|
||||
|
||||
<!-- <label>Group <input type="text" name="group" value={$slct.post_comment_obj.group} max="100" /></label> -->
|
||||
|
||||
{#if $ae_loc.administrator_access}
|
||||
<label>Enable
|
||||
<input
|
||||
type="checkbox"
|
||||
name="enable"
|
||||
id="enable"
|
||||
bind:checked={$slct.post_comment_obj.enable}
|
||||
>
|
||||
</label>
|
||||
{/if}
|
||||
|
||||
<!-- {#if $ae_loc.trusted_access}
|
||||
<label>Internal Staff Notes
|
||||
<textarea id="notes" name="notes" class="ae_value post__notes tinymce_editor editor_basic_200" rows="2" cols="70" value={$slct.post_comment_obj.notes}></textarea>
|
||||
</label>
|
||||
{/if} -->
|
||||
|
||||
</span> <!-- END: span ae_show_hide_content -->
|
||||
|
||||
</section> <!-- END: section post_comment__admin_options -->
|
||||
{/if}
|
||||
|
||||
|
||||
<section class="ae_section ae_options ae_row">
|
||||
<button type="submit" class="ae_btn btn btn-primary"><span class="fas fa-check"></span> Save Post Comment</button>
|
||||
|
||||
{#if $slct.post_comment_id}
|
||||
{#if $ae_loc.administrator_access}
|
||||
<button
|
||||
on:click={() => {
|
||||
if (!confirm('Are you sure you want to delete this post comment?')) {return false;}
|
||||
handle_delete_post_comment_obj({post_comment_id: $slct.post_comment_id, method: 'delete'});
|
||||
|
||||
$slct.post_comment_id = null;
|
||||
$slct.post_comment_obj = {};
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-danger" type="button"
|
||||
title="Delete record permanently"
|
||||
>
|
||||
<span class="fas fa-minus"></span> Delete
|
||||
</button>
|
||||
{:else if $ae_loc.trusted_access}
|
||||
<button
|
||||
on:click={() => {
|
||||
if (!confirm('Are you sure you want to disable this post comment?')) {return false;}
|
||||
handle_delete_post_comment_obj({post_comment_id: $slct.post_comment_id, method: 'disable'});
|
||||
|
||||
$slct.post_comment_id = null;
|
||||
$slct.post_comment_obj = {};
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-danger" type="button"
|
||||
title="Disable record to delete"
|
||||
>
|
||||
<span class="fas fa-minus"></span> Delete
|
||||
</button>
|
||||
{:else}
|
||||
<button
|
||||
on:click={() => {
|
||||
if (!confirm('Are you sure you want to hide this post comment?')) {return false;}
|
||||
handle_delete_post_comment_obj({post_comment_id: $slct.post_comment_id, method: 'hide'});
|
||||
|
||||
$slct.post_comment_id = null;
|
||||
$slct.post_comment_obj = {};
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-danger" type="button"
|
||||
title="Hide record to delete"
|
||||
>
|
||||
<span class="fas fa-comment-slash"></span> Delete
|
||||
</button>
|
||||
{/if}
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<style>
|
||||
.svelte_component.ae_edit {
|
||||
/* outline: dashed thin pink; */
|
||||
}
|
||||
</style>
|
||||
@@ -1,598 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher, onDestroy, onMount } from 'svelte';
|
||||
import { fade } from 'svelte/transition';
|
||||
|
||||
import { ae, api, Element_input } from 'aether_npm_lib';
|
||||
import { slct, ae_app } from './stores';
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
type key_val = {
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
let create_post_obj_promise: any;
|
||||
let delete_post_obj_promise: any;
|
||||
let update_post_obj_promise: any;
|
||||
|
||||
let disable_submit_btn = true;
|
||||
|
||||
if ($slct.post_id) {
|
||||
console.log(`Post ID selected: ${$slct.post_id}`);
|
||||
console.log(`Post Object selected: ${$slct.post_obj}`);
|
||||
|
||||
if ($slct.post_obj) {
|
||||
// if (!$slct.post_obj.external_person_id) {
|
||||
// $slct.post_obj['external_person_id'] = $idaa_loc.novi_uuid;
|
||||
// }
|
||||
// if (!$slct.post_obj.full_name) {
|
||||
// $slct.post_obj['full_name'] = $idaa_loc.novi_full_name;
|
||||
// }
|
||||
// if (!$slct.post_obj.email) {
|
||||
// $slct.post_obj['email'] = $idaa_loc.novi_email;
|
||||
// }
|
||||
}
|
||||
} else {
|
||||
$slct.post_id = null;
|
||||
$slct.post_obj = {
|
||||
title: '',
|
||||
content: '',
|
||||
topic_id: null,
|
||||
anonymous: false,
|
||||
external_person_id: $idaa_loc.novi_uuid,
|
||||
full_name: $idaa_loc.novi_full_name,
|
||||
email: $idaa_loc.novi_email,
|
||||
|
||||
sort: null,
|
||||
notes: null,
|
||||
};
|
||||
console.log(`Post Object started: ${$slct.post_obj}`);
|
||||
}
|
||||
|
||||
|
||||
if ($slct.post_obj) {
|
||||
} else {
|
||||
console.log(`Post Object started: ${$slct.post_obj}`)
|
||||
}
|
||||
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** Edit - Post Obj');
|
||||
|
||||
tinymce_remove(); // This seems to fix rendering issues
|
||||
tinymce_init();
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
console.log('** Component Destroyed: ** Edit - Post Obj');
|
||||
tinymce_remove(); // This seems like the right thing to do
|
||||
});
|
||||
|
||||
|
||||
function tinymce_init() {
|
||||
// REFERENCE: https://www.tiny.cloud/docs/tinymce/6/basic-setup/
|
||||
// plugins: [
|
||||
// 'advlist', 'autolink', 'link', 'image', 'lists', 'charmap', 'preview', 'anchor', 'pagebreak',
|
||||
// 'searchreplace', 'wordcount', 'visualblocks', 'visualchars', 'code', 'fullscreen', 'insertdatetime',
|
||||
// 'media', 'table', 'emoticons', 'template', 'help'
|
||||
// ],
|
||||
// 'undo redo | styles | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent'
|
||||
|
||||
// NOTE: Basic version of the TinyMCE editor
|
||||
tinymce.init({
|
||||
selector: '.tinymce_editor.editor_basic',
|
||||
// width: 600,
|
||||
height: 400,
|
||||
plugins: [ 'lists', 'code', 'help' ],
|
||||
menubar: false,
|
||||
toolbar: 'undo redo | styles | bold italic | alignleft aligncenter | bullist numlist outdent indent | code | help',
|
||||
});
|
||||
|
||||
// NOTE: Minimal version of the TinyMCE editor
|
||||
tinymce.init({
|
||||
selector: '.tinymce_editor.editor_basic_200',
|
||||
// width: 600,
|
||||
height: 200,
|
||||
plugins: [ 'lists', 'code', 'help' ],
|
||||
menubar: false,
|
||||
toolbar: 'undo redo | styles | bold italic | alignleft aligncenter | bullist numlist outdent indent | code | help',
|
||||
});
|
||||
|
||||
// NOTE: Less is more version of the TinyMCE editor
|
||||
tinymce.init({
|
||||
selector: '.tinymce_editor.editor_less_100',
|
||||
// width: 600,
|
||||
height: 100,
|
||||
// plugins: [ 'lists', 'code', 'help' ],
|
||||
menubar: false,
|
||||
toolbar: false,
|
||||
statusbar: false,
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function tinymce_remove() {
|
||||
tinymce.remove('.tinymce_editor.editor_basic');
|
||||
tinymce.remove('.tinymce_editor.editor_basic_200');
|
||||
tinymce.remove('.tinymce_editor.editor_less_100');
|
||||
}
|
||||
|
||||
|
||||
// let ae_iframe_height = window.outerHeight;
|
||||
let ae_iframe_height = window.innerHeight;
|
||||
console.log(`ae_iframe_height: ${ae_iframe_height}`);
|
||||
$: if (ae_iframe_height) {
|
||||
console.log('ae_iframe_height changed:', ae_iframe_height);
|
||||
|
||||
let iframe_height = ae_iframe_height; // TESTING!!!
|
||||
|
||||
// window.parent.postMessage({'iframe_height': `${iframe_height}px`}, "*");
|
||||
window.parent.postMessage({'iframe_height': iframe_height}, "*");
|
||||
}
|
||||
|
||||
|
||||
$: if ($slct.post_obj) {
|
||||
console.log('Selected post object changed?');
|
||||
console.log($slct.post_obj);
|
||||
|
||||
if ($slct.post_obj == null) {
|
||||
$slct.post_obj = {title: null, content: null, name: null, description: null, notes: null, created_on: null, updated_on: null};
|
||||
} else {
|
||||
disable_submit_btn = false;
|
||||
}
|
||||
|
||||
// ae.input_template['event']['timezone'] = 'EDT';
|
||||
}
|
||||
|
||||
|
||||
async function handle_submit_form(event) {
|
||||
console.log('*** handle_submit_form() ***');
|
||||
// console.log(event.target);
|
||||
|
||||
disable_submit_btn = true;
|
||||
|
||||
let form_data = new FormData(event.target);
|
||||
// console.log(form_data);
|
||||
|
||||
// Form Post object data incoming
|
||||
let post_di = ae.util.extract_prefixed_form_data({prefix: null, form_data: form_data, trim_values: true, bool_tf_str: true, log_lvl: 1});
|
||||
// console.log(post_di);
|
||||
|
||||
// Form Post object data outgoing
|
||||
let post_do: key_val = {};
|
||||
|
||||
if (!$slct.post_id) {
|
||||
post_do['account_id_random'] = $ae_app.account_id;
|
||||
post_do['enable'] = true;
|
||||
}
|
||||
|
||||
post_do['title'] = post_di.title;
|
||||
|
||||
if (tinyMCE.get('content')) {
|
||||
post_do['content'] = tinyMCE.get('content').getContent();
|
||||
} else {
|
||||
post_do['content'] = post_di.content;
|
||||
}
|
||||
if (!post_do['content']) {
|
||||
console.log('The content is required.');
|
||||
disable_submit_btn = false;
|
||||
alert('The text for the post is required.');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (post_di.topic_id) {
|
||||
post_do['topic_id'] = Number(post_di.topic_id);
|
||||
// post_do['topic_id'] = post_di.topic_id;
|
||||
} else {
|
||||
post_do['topic_id'] = null;
|
||||
}
|
||||
|
||||
console.log(post_di.anonymous);
|
||||
console.log(typeof post_di.anonymous);
|
||||
|
||||
// console.log(Boolean(post_di.anonymous));
|
||||
// console.log(Number((post_di.anonymous)));
|
||||
// console.log(Boolean(Number((post_di.anonymous))));
|
||||
// let anonymous_test = Boolean(post_di.anonymous)
|
||||
|
||||
// console.log(!anonymous_test);
|
||||
// console.log(!!anonymous_test);
|
||||
// console.log(!!!anonymous_test);
|
||||
|
||||
post_do['anonymous'] = post_di.anonymous;
|
||||
|
||||
post_do['external_person_id'] = post_di.external_person_id;
|
||||
post_do['full_name'] = post_di.full_name;
|
||||
post_do['email'] = post_di.email;
|
||||
|
||||
post_do['hide'] = !!post_di.hide;
|
||||
post_do['priority'] = !!post_di.priority;
|
||||
if (post_di.sort) {
|
||||
post_do['sort'] = Number(post_di.sort);
|
||||
} else {
|
||||
post_do['sort'] = null;
|
||||
}
|
||||
if (post_di.group) {
|
||||
post_do['group'] = post_di.group;
|
||||
} else {
|
||||
post_do['group'] = null;
|
||||
}
|
||||
|
||||
if (post_di.enable) {
|
||||
post_do['enable'] = !!post_di.enable;
|
||||
}
|
||||
|
||||
if (tinyMCE.get('notes')) {
|
||||
post_do['notes'] = tinyMCE.get('notes').getContent();
|
||||
} else {
|
||||
post_do['notes'] = post_di.notes;
|
||||
}
|
||||
|
||||
console.log(post_do);
|
||||
|
||||
if (!$slct.post_id) {
|
||||
create_post_obj_promise = api.create_ae_obj_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'post',
|
||||
fields: post_do,
|
||||
key: $ae_app.ae_api.api_crud_super_key,
|
||||
log_lvl: 1
|
||||
})
|
||||
.then(function (post_obj_create_result) {
|
||||
if (!post_obj_create_result) {
|
||||
console.log('The result was null or false.');
|
||||
return false;
|
||||
}
|
||||
|
||||
$slct.post_id = post_obj_create_result.obj_id_random;
|
||||
|
||||
dispatch(
|
||||
'created__post_obj',
|
||||
{
|
||||
post_id: $slct.post_id,
|
||||
}
|
||||
);
|
||||
|
||||
return post_obj_create_result;
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('Something went wrong.');
|
||||
console.log(error);
|
||||
return false;
|
||||
});
|
||||
|
||||
return create_post_obj_promise;
|
||||
|
||||
} else {
|
||||
update_post_obj_promise = api.update_ae_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'post',
|
||||
obj_id: $slct.post_id,
|
||||
fields: post_do,
|
||||
key: $ae_app.ae_api.api_crud_super_key,
|
||||
log_lvl: 1
|
||||
})
|
||||
.then(function (post_obj_update_result) {
|
||||
if (!post_obj_update_result) {
|
||||
console.log('The result was null or false.');
|
||||
return false;
|
||||
}
|
||||
|
||||
dispatch(
|
||||
'updated__post_obj',
|
||||
{
|
||||
post_id: $slct.post_id,
|
||||
}
|
||||
);
|
||||
|
||||
return post_obj_update_result;
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('Something went wrong.');
|
||||
console.log(error);
|
||||
return false;
|
||||
});
|
||||
|
||||
return update_post_obj_promise;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function handle_delete_post_obj({post_id, method='disable'}) {
|
||||
console.log('*** handle_delete_post_obj() ***');
|
||||
|
||||
delete_post_obj_promise = api.delete_ae_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'post',
|
||||
obj_id: post_id,
|
||||
method: method,
|
||||
// params: params,
|
||||
key: $ae_app.ae_api.api_crud_super_key,
|
||||
log_lvl: 0
|
||||
})
|
||||
.then(function (post_obj_delete_result) {
|
||||
if (post_obj_delete_result) {
|
||||
// console.log(`Result:`, post_obj_delete_result);
|
||||
|
||||
dispatch(
|
||||
'deleted__post_obj',
|
||||
{
|
||||
post_id: post_id,
|
||||
}
|
||||
);
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('The result was null or false when trying to delete.', error);
|
||||
});
|
||||
|
||||
return delete_post_obj_promise;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<section
|
||||
class="svelte_component ae_edit post_obj"
|
||||
class:ae_create={!$slct.post_id}
|
||||
bind:clientHeight={$ae_app.iframe_height_modal_body}
|
||||
>
|
||||
|
||||
<form on:submit|preventDefault={handle_submit_form} class="">
|
||||
|
||||
{#await update_post_obj_promise}
|
||||
<div class="awaiting alert_msg_pulse" out:fade={{ duration: 2000 }}>Saving...</div>
|
||||
{:then}
|
||||
{#if update_post_obj_promise}
|
||||
<div class="awaiting" out:fade={{ duration: 2000 }}>Finished saving</div>
|
||||
{:else}
|
||||
<!-- <div class="awaiting" out:fade={{ duration: 2000 }}>Nothing here yet</div> -->
|
||||
{/if}
|
||||
{/await}
|
||||
|
||||
<h3>Post</h3>
|
||||
|
||||
<label for="title">Title of BB post
|
||||
<input type="text" id="title" name="title" class="ae_width_lg" required max="200" value={$slct.post_obj.title ? $slct.post_obj.title : '' } placeholder="The title of the BB post">
|
||||
</label>
|
||||
|
||||
<label class="ae_label post__content" for="content">Content (post body)
|
||||
<textarea id="content" name="content" rows="6" cols="70" bind:value={$slct.post_obj.content} class="ae_value post__content tinymce_editor editor_basic_200" placeholder="The text of the Bulletin Board post"></textarea>
|
||||
</label>
|
||||
|
||||
<label for="topic_id">BB post topic
|
||||
<select id="topic_id" name="topic_id" value={$slct.post_obj.topic_id}>
|
||||
<option value="">-- None --</option>
|
||||
<option value={16}>Licensing/ monitoring/ credentialing issues</option>
|
||||
<option value={17}>Return to practice</option>
|
||||
<option value={18}>Contacts/ sponsorship in my area</option>
|
||||
<option value={19}>Professional positions</option>
|
||||
<option value={21}
|
||||
disabled={!$ae_loc.trusted_access}
|
||||
>
|
||||
Announcement
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<h3>Poster's Information</h3>
|
||||
<fieldset class="">
|
||||
<legend class="">Post as Anonymous</legend>
|
||||
<div class="">
|
||||
<input
|
||||
type="radio"
|
||||
id="anonymous_no"
|
||||
name="anonymous"
|
||||
value={false}
|
||||
bind:group={$slct.post_obj.anonymous}
|
||||
|
||||
>
|
||||
<label for="anonymous_no">No, include my name and email address</label>
|
||||
</div>
|
||||
<div class="">
|
||||
<input
|
||||
type="radio"
|
||||
id="anonymous_yes"
|
||||
name="anonymous"
|
||||
value={true}
|
||||
bind:group={$slct.post_obj.anonymous}
|
||||
|
||||
>
|
||||
<label for="anonymous_yes">Yes, the post will be listed as Anonymous</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<label for="external_person_id"><span class="fas fa-link"></span> Linked with Novi ID
|
||||
{#if !$ae_loc.trusted_access}
|
||||
<span class="fas fa-lock" title="Field is locked"></span>
|
||||
<input
|
||||
type="text"
|
||||
id="external_person_id"
|
||||
name="external_person_id"
|
||||
value={($slct.post_obj.external_person_id ? $slct.post_obj.external_person_id : $idaa_loc.novi_uuid)}
|
||||
readonly={true}
|
||||
class="ae_width_lg"
|
||||
>
|
||||
{:else}
|
||||
<div class="ae_highlight">Primary link using the Novi API UUID. This must be empty, a staff person, or an active member of IDAA and should be the primary contact for this meeting.</div>
|
||||
<span class="fas fa-unlock" title="Field is unlocked"></span>
|
||||
<input
|
||||
type="text"
|
||||
id="external_person_id"
|
||||
name="external_person_id"
|
||||
value={($slct.post_obj.external_person_id ? $slct.post_obj.external_person_id : '')}
|
||||
readonly={false}
|
||||
class="ae_width_lg"
|
||||
>
|
||||
{/if}
|
||||
</label>
|
||||
|
||||
<label for="full_name">Name
|
||||
{#if !$ae_loc.trusted_access}
|
||||
<span class="fas fa-lock" title="Field is locked"></span>
|
||||
{:else}
|
||||
<span class="fas fa-unlock" title="Field is unlocked"></span>
|
||||
{/if}
|
||||
<input
|
||||
type="text"
|
||||
id="full_name"
|
||||
name="full_name"
|
||||
value={($slct.post_obj.full_name ? $slct.post_obj.full_name : $idaa_loc.novi_full_name)}
|
||||
readonly={!$ae_loc.trusted_access}
|
||||
>
|
||||
</label>
|
||||
|
||||
{#if $ae_loc.trusted_access}
|
||||
<label for="email">Email
|
||||
{#if !$ae_loc.trusted_access}
|
||||
<span class="fas fa-lock" title="Field is locked"></span>
|
||||
{:else}
|
||||
<span class="fas fa-unlock" title="Field is unlocked"></span>
|
||||
{/if}
|
||||
<input
|
||||
type="text"
|
||||
name="email"
|
||||
value={($slct.post_obj.email ? $slct.post_obj.email : $idaa_loc.novi_email)}
|
||||
readonly={!$ae_loc.trusted_access}
|
||||
>
|
||||
<span class="ae_highlight">Secondary link using the Novi email address</span>
|
||||
</label>
|
||||
{/if}
|
||||
|
||||
<!-- <h3>Poster's Options</h3> -->
|
||||
|
||||
<!-- <fieldset class="">
|
||||
<legend class="">Official or Member Post</legend>
|
||||
<div class="">
|
||||
<input type="radio" class="" id="group_official" name="group" value="official">
|
||||
<label for="group_official" class="">Post as Official/Leadership</label>
|
||||
</div>
|
||||
<div class="">
|
||||
<input type="radio" class="" id="group_member" name="group" value="member" checked="">
|
||||
<label for="group_member" class="">Post as Member</label>
|
||||
</div>
|
||||
</fieldset> -->
|
||||
|
||||
<!-- <fieldset class="">
|
||||
<legend class="">Enable Comments</legend>
|
||||
<div class="">
|
||||
<input type="radio" class="" id="enable_comments_no" name="enable_comments" value="0">
|
||||
<label for="enable_comments_no" class="">No, do not allow comments</label>
|
||||
</div>
|
||||
<div class="">
|
||||
<input type="radio" class="" id="enable_comments_yes" name="enable_comments" value="1" checked>
|
||||
<label for="enable_comments_yes" class="">Yes, allow comments</label>
|
||||
</div>
|
||||
</fieldset> -->
|
||||
|
||||
|
||||
{#if $ae_loc.trusted_access}
|
||||
<section class="ae_section post__admin_options"> <!-- BEGIN: section post__admin_options -->
|
||||
|
||||
<h3>
|
||||
Admin Options
|
||||
<button type="button" class="ae_btn ae_d_none_toggle ae_float_right ae_smallest btn btn-xs btn-info" on:click={() => {document.querySelector('.ae_d_none_content').classList.toggle('ae_fade_out'); document.querySelector('.ae_d_none_content').classList.toggle('ae_fade_in');}}><span class="fas fa-eye"></span> Show/Hide Admin</button>
|
||||
</h3>
|
||||
|
||||
<span class="ae_d_none_content ae_fade_out">
|
||||
<label>Hide
|
||||
<input
|
||||
type="checkbox"
|
||||
name="hide"
|
||||
id="hide"
|
||||
bind:checked={$slct.post_obj.hide}
|
||||
>
|
||||
</label>
|
||||
|
||||
<label>Priority
|
||||
<input
|
||||
type="checkbox"
|
||||
name="priority"
|
||||
id="priority"
|
||||
bind:checked={$slct.post_obj.priority}
|
||||
>
|
||||
</label>
|
||||
|
||||
<label>Sort <input type="number" name="sort" value={$slct.post_obj.sort} /></label>
|
||||
|
||||
<label>Group <input type="text" name="group" value={$slct.post_obj.group ? $slct.post_obj.group : ''} max="100" /></label>
|
||||
|
||||
{#if $ae_loc.administrator_access}
|
||||
<label>Enable
|
||||
<input
|
||||
type="checkbox"
|
||||
name="enable"
|
||||
id="enable"
|
||||
bind:checked={$slct.post_obj.enable}
|
||||
>
|
||||
</label>
|
||||
{/if}
|
||||
|
||||
{#if $ae_loc.trusted_access}
|
||||
<label>Internal Staff Notes
|
||||
<textarea id="notes" name="notes" class="ae_value post__notes" rows="2" cols="70" value={$slct.post_obj.notes}></textarea>
|
||||
</label>
|
||||
{/if}
|
||||
|
||||
</span> <!-- END: span ae_show_hide_content -->
|
||||
|
||||
</section> <!-- END: section post__admin_options -->
|
||||
{/if}
|
||||
|
||||
|
||||
<section class="ae_section ae_options ae_row">
|
||||
<button type="submit" class="ae_btn btn btn-primary"><span class="fas fa-check"></span> Save Post</button>
|
||||
|
||||
{#if $slct.post_id}
|
||||
{#if $ae_loc.administrator_access}
|
||||
<button
|
||||
on:click={() => {
|
||||
if (!confirm('Are you sure you want to delete this post?')) {return false;}
|
||||
handle_delete_post_obj({post_id: $slct.post_id, method: 'delete'});
|
||||
|
||||
$slct.post_id = null;
|
||||
$slct.post_obj = {};
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-danger" type="button"
|
||||
title="Delete record permanently"
|
||||
>
|
||||
<span class="fas fa-minus"></span> Delete
|
||||
</button>
|
||||
{:else if $ae_loc.trusted_access}
|
||||
<button
|
||||
on:click={() => {
|
||||
if (!confirm('Are you sure you want to disable this post?')) {return false;}
|
||||
handle_delete_post_obj({post_id: $slct.post_id, method: 'disable'});
|
||||
|
||||
$slct.post_id = null;
|
||||
$slct.post_obj = {};
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-danger" type="button"
|
||||
title="Disable record to delete"
|
||||
>
|
||||
<span class="fas fa-minus"></span> Disable
|
||||
</button>
|
||||
{:else}
|
||||
<button
|
||||
on:click={() => {
|
||||
if (!confirm('Are you sure you want to hide this post?')) {return false;}
|
||||
handle_delete_post_obj({post_id: $slct.post_id, method: 'hide'});
|
||||
|
||||
$slct.post_id = null;
|
||||
$slct.post_obj = {};
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-danger" type="button"
|
||||
title="Hide record to delete"
|
||||
>
|
||||
<span class="fas fa-comment-slash"></span> Delete
|
||||
</button>
|
||||
{/if}
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
</form>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<style>
|
||||
</style>
|
||||
@@ -1,835 +0,0 @@
|
||||
<script lang="ts">
|
||||
type key_val = {
|
||||
[key: string]: any;
|
||||
};
|
||||
// *** Import Svelte core
|
||||
import { onMount } from 'svelte';
|
||||
// import { Spinner } from 'flowbite-svelte';
|
||||
|
||||
// *** Import Aether core variables and functions
|
||||
import { ae, api, Element_modal_v3 } from 'aether_npm_lib';
|
||||
|
||||
import { slct, slct_trigger, ae_app } from './stores';
|
||||
|
||||
// *** Import Aether core components
|
||||
// import { get_data_store_obj_w_code } from '../data_store/stores_data_store_api.js';
|
||||
|
||||
// *** Import Aether module variables and functions
|
||||
|
||||
// *** Import Aether module components
|
||||
import Edit_event_obj from './ae_idaa_comp__event_obj_id_edit.svelte';
|
||||
import List_event_obj from './ae_idaa_comp__event_obj_li.svelte';
|
||||
import View_event_obj from './ae_idaa_comp__event_obj_id_view.svelte';
|
||||
|
||||
// *** Export/Exposed variables and functions for component
|
||||
// export let account_id: string = $page['page_for']['account_id'];
|
||||
export let account_id: string = $ae_app.account_id;
|
||||
export let event_id: string = $idaa_loc.recovery_meetings.event_id;
|
||||
|
||||
export let novi_uuid: string = $idaa_loc.novi_uuid;
|
||||
export let novi_email: string = $idaa_loc.novi_email;
|
||||
export let novi_full_name: string = $idaa_loc.novi_full_name;
|
||||
export let novi_admin_li: string = $idaa_loc.novi_admin_li;
|
||||
export let novi_trusted_li: string = $idaa_loc.novi_trusted_li;
|
||||
|
||||
// *** Set initial variables
|
||||
$idaa_loc.novi_uuid = novi_uuid;
|
||||
$idaa_loc.novi_email = decodeURIComponent(novi_email);
|
||||
$idaa_loc.novi_full_name = decodeURIComponent(novi_full_name);
|
||||
$idaa_loc.novi_admin_li = novi_admin_li;
|
||||
$idaa_loc.novi_trusted_li = novi_trusted_li;
|
||||
|
||||
$ae_app.current_timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||
if (!$ae_app.lu_country_subdivision_list) {
|
||||
$ae_app.lu_country_subdivision_list = [];
|
||||
}
|
||||
if (!$ae_app.lu_country_list ) {
|
||||
$ae_app.lu_country_list = [];
|
||||
}
|
||||
if (!$ae_app.lu_timezone_list) {
|
||||
$ae_app.lu_timezone_list = [];
|
||||
}
|
||||
|
||||
$idaa_loc.recovery_meetings.show_main__options = true; // Section for: search area, buttons for filtering events, create new event (Meeting).
|
||||
$idaa_loc.recovery_meetings.show_list__event_obj_li = true;
|
||||
$idaa_loc.recovery_meetings.fulltext_search_qry_str = '';
|
||||
$idaa_loc.recovery_meetings.qry_virtual = false;
|
||||
$idaa_loc.recovery_meetings.qry_physical = false;
|
||||
$idaa_loc.recovery_meetings.qry_type = '';
|
||||
|
||||
// NOTE: Check if the novi_uuid is in the novi_admin_li list
|
||||
if ($idaa_loc.novi_uuid && $idaa_loc.novi_admin_li) {
|
||||
if ($idaa_loc.novi_admin_li.includes($idaa_loc.novi_uuid)) {
|
||||
$ae_loc.access_type = 'administrator';
|
||||
$ae_loc.administrator_access = true;
|
||||
$ae_loc.trusted_access = true;
|
||||
}
|
||||
}
|
||||
// NOTE: Check if the novi_uuid is in the novi_trusted_li list
|
||||
if ($idaa_loc.novi_uuid && $idaa_loc.novi_trusted_li) {
|
||||
if ($idaa_loc.novi_trusted_li.includes($idaa_loc.novi_uuid)) {
|
||||
$ae_loc.access_type = 'trusted';
|
||||
$ae_loc.trusted_access = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($ae_loc.administrator_access) {
|
||||
$idaa_loc.recovery_meetings.enabled = 'enabled';
|
||||
$idaa_loc.recovery_meetings.hidden = 'not_hidden';
|
||||
$idaa_loc.recovery_meetings.limit = 150;
|
||||
} else if ($ae_loc.trusted_access) {
|
||||
$idaa_loc.recovery_meetings.enabled = 'enabled';
|
||||
$idaa_loc.recovery_meetings.hidden = 'not_hidden';
|
||||
$idaa_loc.recovery_meetings.limit = 75;
|
||||
} else {
|
||||
$idaa_loc.recovery_meetings.enabled = 'enabled';
|
||||
$idaa_loc.recovery_meetings.hidden = 'not_hidden';
|
||||
$idaa_loc.recovery_meetings.limit = 25;
|
||||
}
|
||||
|
||||
let idaa_event_obj_li_get_promise;
|
||||
let idaa_event_obj_get_promise;
|
||||
let data_store_obj_get_promise;
|
||||
let get_ds_submitter_help_promise = handle_get_data_store_obj_w_code({code: 'recovery_meetings_info'});
|
||||
|
||||
if (account_id) {
|
||||
$slct.account_id = account_id;
|
||||
handle_load_idaa_event_obj_li({account_id: $slct.account_id, try_cache: false});
|
||||
}
|
||||
|
||||
// NOTE: This if event_id is not fully ready yet -2023-09-08
|
||||
if (event_id) {
|
||||
console.log(`Selected Event ID: ${event_id}`);
|
||||
$slct.event_id = event_id;
|
||||
$slct_trigger = 'load__event_obj';
|
||||
|
||||
// handle_load_event_id_obj({event_id: $slct.event_id, try_cache: false});
|
||||
|
||||
// // Auto show the selected Event ID
|
||||
// // Set the URL param "event_id" to the current Event ID. This is a just in case.
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.set('event_id', $slct.event_id);
|
||||
// history.pushState({}, '', url);
|
||||
|
||||
// let message = {'event_id': $slct.event_id};
|
||||
// window.parent.postMessage(message, "*");
|
||||
|
||||
$idaa_loc.recovery_meetings.show_main__options = true;
|
||||
$idaa_loc.recovery_meetings.show_list__event_obj_li = true;
|
||||
$idaa_loc.recovery_meetings.show_view__event_obj = true;
|
||||
$idaa_loc.recovery_meetings.show_edit__event_obj = false;
|
||||
}
|
||||
|
||||
if (!$ae_app.client_content) {
|
||||
$ae_app.client_content = {};
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** IDAA Recovery Meetings - AE Events: Main');
|
||||
|
||||
document.getElementById('meeting_fulltext_search_qry_str').focus();
|
||||
});
|
||||
|
||||
|
||||
$: if ($ae_app.iframe_height && $ae_app.iframe_height_modal_body) {
|
||||
console.log('getting new dimensions for iframe:', $ae_app.iframe_height, $ae_app.iframe_height_modal_body);
|
||||
|
||||
let iframe_height = 0;
|
||||
|
||||
if ($ae_app.iframe_height > $ae_app.iframe_height_modal_body) {
|
||||
iframe_height = $ae_app.iframe_height;
|
||||
} else {
|
||||
iframe_height = $ae_app.iframe_height_modal_body;
|
||||
|
||||
// console.log($ae_app.modal_dimensions);
|
||||
|
||||
if ($ae_app.modal_dimensions && $ae_app.modal_dimensions.header_height) {
|
||||
iframe_height = iframe_height + $ae_app.modal_dimensions.header_height;
|
||||
}
|
||||
if ($ae_app.modal_dimensions && $ae_app.modal_dimensions.footer_height) {
|
||||
iframe_height = iframe_height + $ae_app.modal_dimensions.footer_height;
|
||||
}
|
||||
// iframe_height = iframe_height + 50; // Just in case
|
||||
}
|
||||
|
||||
console.log(`Suggested new iframe_height: ${iframe_height}`);
|
||||
window.parent.postMessage({'iframe_height': iframe_height}, "*"); // This should be in pixels
|
||||
} else if ($ae_app.iframe_height) {
|
||||
console.log('setting new iframe_height:', $ae_app.iframe_height);
|
||||
|
||||
// let iframe_height = $ae_app.iframe_height;
|
||||
|
||||
window.parent.postMessage({'iframe_height': $ae_app.iframe_height}, "*"); // This should be in pixels
|
||||
}
|
||||
|
||||
|
||||
$: if ($slct_trigger == 'load__event_obj_li' && $slct.account_id) {
|
||||
if ($idaa_loc.recovery_meetings.qry_status == 'loading') {
|
||||
console.log('*** $idaa_loc.recovery_meetings.qry_status == loading ***');
|
||||
|
||||
setTimeout(() => {
|
||||
console.log("Delayed for X second.");
|
||||
$slct_trigger = null;
|
||||
handle_load_idaa_event_obj_li({account_id: $slct.account_id, try_cache: false});
|
||||
}, 250);
|
||||
} else {
|
||||
console.log('*** $idaa_loc.recovery_meetings.qry_status != loading ***');
|
||||
$slct_trigger = null;
|
||||
handle_load_idaa_event_obj_li({account_id: $slct.account_id, try_cache: false});
|
||||
}
|
||||
}
|
||||
|
||||
async function handle_load_idaa_event_obj_li({account_id, try_cache=true}) {
|
||||
console.log('*** handle_load_idaa_event_obj_li() ***');
|
||||
console.log($idaa_loc.recovery_meetings);
|
||||
|
||||
// The fulltext search should be lower case
|
||||
// let fulltext_search_qry_str = $idaa_loc.recovery_meetings.fulltext_search_qry_str.toLowerCase();
|
||||
let fulltext_search_qry_str = $idaa_loc.recovery_meetings.fulltext_search_qry_str;
|
||||
let qry_virtual = $idaa_loc.recovery_meetings.qry_virtual;
|
||||
let qry_physical = $idaa_loc.recovery_meetings.qry_physical;
|
||||
let qry_type = $idaa_loc.recovery_meetings.qry_type;
|
||||
|
||||
let enabled = $idaa_loc.recovery_meetings.enabled;
|
||||
let hidden = $idaa_loc.recovery_meetings.hidden;
|
||||
let limit = $idaa_loc.recovery_meetings.limit;
|
||||
let offset = $idaa_loc.recovery_meetings.offset;
|
||||
|
||||
let params = {};
|
||||
|
||||
let params_json: key_val = {};
|
||||
if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) {
|
||||
params_json['ft_qry'] = {
|
||||
'default_qry_str': fulltext_search_qry_str,
|
||||
'location_address_json_ext': fulltext_search_qry_str, // JSON extracted text DB field
|
||||
'contact_li_json_ext': fulltext_search_qry_str, // JSON extracted text DB field
|
||||
};
|
||||
}
|
||||
|
||||
if (qry_virtual || qry_physical || qry_type) {
|
||||
params_json['and_qry'] = {};
|
||||
if (qry_virtual) params_json['and_qry']['virtual'] = true;
|
||||
if (qry_physical) params_json['and_qry']['physical'] = true;
|
||||
if (qry_type) params_json['and_qry']['type'] = qry_type;
|
||||
}
|
||||
|
||||
console.log('params_json:', params_json);
|
||||
console.log(params_json);
|
||||
|
||||
// NOTE: I am not sure if this is actually needed. It may save a little space in the URL.
|
||||
// if (JSON.stringify(params_json) == JSON.stringify({})) {
|
||||
// params_json = null;
|
||||
// }
|
||||
$idaa_loc.recovery_meetings.qry_status = 'loading';
|
||||
idaa_event_obj_li_get_promise = api.get_ae_obj_li_for_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'event', // Event in this case is a recovery meeting.
|
||||
for_obj_type: 'account',
|
||||
for_obj_id: account_id,
|
||||
use_alt_table: true, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config.
|
||||
use_alt_base: true, // NOTE: This will use the base_name_alt value instead of the base_name value in the API config.
|
||||
enabled: enabled,
|
||||
hidden: hidden,
|
||||
order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC'},
|
||||
// order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'created_on': 'DESC', 'updated_on': 'DESC'},
|
||||
limit: limit,
|
||||
offset: offset,
|
||||
params_json: params_json,
|
||||
params: params,
|
||||
log_lvl: 1
|
||||
})
|
||||
|
||||
.then(function (event_obj_li_get_result) {
|
||||
if (event_obj_li_get_result) {
|
||||
$slct.event_obj_li = event_obj_li_get_result;
|
||||
console.log(`Event list:`, $slct.event_obj_li);
|
||||
} else {
|
||||
$slct.event_obj_li = [];
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
})
|
||||
.finally(function () {
|
||||
$idaa_loc.recovery_meetings.qry_status = 'done';
|
||||
});
|
||||
|
||||
return idaa_event_obj_li_get_promise;
|
||||
}
|
||||
|
||||
|
||||
$: if ($slct_trigger == 'load__event_obj' && $slct.event_id) {
|
||||
$slct_trigger = null;
|
||||
|
||||
handle_load_event_id_obj({event_id: $slct.event_id, try_cache: false});
|
||||
|
||||
// Auto show the selected Event ID
|
||||
// Is this pushState needed here?
|
||||
// Set the URL param "event_id" to the current Event ID. This is a just in case.
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.set('event_id', $slct.event_id);
|
||||
// history.pushState({}, '', url);
|
||||
|
||||
// Is this postMessage needed here?
|
||||
// let message = {'event_id': $slct.event_id};
|
||||
// window.parent.postMessage(message, "*");
|
||||
|
||||
// $idaa_loc.recovery_meetings.show_main__options = false;
|
||||
// $idaa_loc.recovery_meetings.show_list__event_obj_li = false;
|
||||
// $idaa_loc.recovery_meetings.show_view__event_obj = true;
|
||||
// $idaa_loc.recovery_meetings.show_edit__event_obj = false;
|
||||
}
|
||||
|
||||
async function handle_load_event_id_obj({event_id, try_cache=false}) {
|
||||
console.log('*** handle_load_event_id_obj() ***');
|
||||
|
||||
// let enabled = $idaa_loc.recovery_meetings.enabled;
|
||||
// let hidden = $idaa_loc.recovery_meetings.hidden;
|
||||
// let limit = $idaa_loc.recovery_meetings.limit;
|
||||
// let offset = $idaa_loc.recovery_meetings.offset;
|
||||
|
||||
let params = {};
|
||||
|
||||
idaa_event_obj_get_promise = api.get_ae_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'event',
|
||||
obj_id: event_id,
|
||||
use_alt_table: true, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config.
|
||||
use_alt_base: true, // NOTE: This will use the base_name_alt value instead of the base_name value in the API config.
|
||||
params: params,
|
||||
log_lvl: 0
|
||||
})
|
||||
.then(function (event_obj_get_result) {
|
||||
if (event_obj_get_result) {
|
||||
$slct.event_obj = event_obj_get_result;
|
||||
console.log(`Event object:`, $slct.event_obj);
|
||||
}
|
||||
|
||||
// Auto show the selected Event ID
|
||||
// Is this pushState needed here?
|
||||
// Set the URL param "event_id" to the current Event ID.
|
||||
const url = new URL(location);
|
||||
url.searchParams.set('event_id', $slct.event_id);
|
||||
history.pushState({}, '', url);
|
||||
|
||||
// Is this postMessage needed here?
|
||||
let message = {'event_id': $slct.event_id};
|
||||
window.parent.postMessage(message, "*");
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
|
||||
return idaa_event_obj_get_promise;
|
||||
}
|
||||
|
||||
function handle_created_event_obj(event) {
|
||||
console.log('*** handle_created_event_obj() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
handle_load_event_id_obj({event_id: $slct.event_id, try_cache: false});
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.set('event_id', $slct.event_id);
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {'event_id': $slct.event_id};
|
||||
window.parent.postMessage(message, "*");
|
||||
|
||||
// $slct_trigger = 'load__event_obj';
|
||||
$slct_trigger = 'load__event_obj_li';
|
||||
|
||||
$idaa_loc.recovery_meetings.show_main__options = false;
|
||||
$idaa_loc.recovery_meetings.show_list__event_obj_li = false;
|
||||
$idaa_loc.recovery_meetings.show_view__event_obj = true;
|
||||
$idaa_loc.recovery_meetings.show_edit__event_obj = false;
|
||||
}
|
||||
|
||||
function handle_updated_event_obj(event) {
|
||||
console.log('*** handle_updated_event_obj() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
// $slct_trigger = 'load__event_obj';
|
||||
$slct_trigger = 'load__event_obj_li';
|
||||
|
||||
$idaa_loc.recovery_meetings.show_main__options = false;
|
||||
$idaa_loc.recovery_meetings.show_list__event_obj_li = false;
|
||||
$idaa_loc.recovery_meetings.show_view__event_obj = true;
|
||||
$idaa_loc.recovery_meetings.show_edit__event_obj = false;
|
||||
}
|
||||
|
||||
function handle_deleted_event_obj(event) {
|
||||
console.log('*** handle_deleted_event_obj() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete('event_id');
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {'event_id': null};
|
||||
window.parent.postMessage(message, "*");
|
||||
|
||||
$slct_trigger = 'load__event_obj_li';
|
||||
|
||||
$idaa_loc.recovery_meetings.show_main__options = true;
|
||||
$idaa_loc.recovery_meetings.show_list__event_obj_li = true;
|
||||
$idaa_loc.recovery_meetings.show_view__event_obj = false;
|
||||
$idaa_loc.recovery_meetings.show_edit__event_obj = false;
|
||||
}
|
||||
|
||||
|
||||
function handle_submit_form(event) {
|
||||
console.log('*** handle_submit_form() ***');
|
||||
console.log(event);
|
||||
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
return false;
|
||||
}
|
||||
function handle_cancel_form(event) {
|
||||
console.log('*** handle_cancel_form() ***');
|
||||
console.log(event);
|
||||
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function handle_oninput_fulltext_search_qry_str(event) {
|
||||
console.log('*** handle_oninput_fulltext_search_qry_str() ***');
|
||||
console.log(event);
|
||||
|
||||
// Check if this variable is a promise. The last query may still be being processed.
|
||||
// if (!idaa_event_obj_li_get_promise.promise) {
|
||||
// console.log('*** handle_oninput_fulltext_search_qry_str() ***');
|
||||
// console.log('*** Promise is still processing. ***');
|
||||
// console.log(idaa_event_obj_li_get_promise);
|
||||
// idaa_event_obj_li_get_promise.promise.finally(() => { idaa_event_obj_li_get_promise.promise.done = true; });
|
||||
// } else {
|
||||
// $slct_trigger = 'load__event_obj_li';
|
||||
// }
|
||||
// if (idaa_event_obj_li_get_promise && idaa_event_obj_li_get_promise.then) {
|
||||
// console.log('*** handle_oninput_fulltext_search_qry_str() ***');
|
||||
// console.log('*** Promise is still processing. ***');
|
||||
// console.log(idaa_event_obj_li_get_promise);
|
||||
// $slct_trigger = 'load__event_obj_li';
|
||||
// return;
|
||||
// }
|
||||
|
||||
// fulltext_search_qry_str = event.target.value;
|
||||
|
||||
// if ($idaa_loc.recovery_meetings.fulltext_search_qry_str.length > 2) {
|
||||
// } else {
|
||||
// $idaa_loc.recovery_meetings.fulltext_search_qry_str = '';
|
||||
// }
|
||||
$slct_trigger = 'load__event_obj_li';
|
||||
}
|
||||
|
||||
async function handle_get_data_store_obj_w_code({code, data_type='text'}) {
|
||||
console.log('*** handle_get_data_store_obj_w_code() ***');
|
||||
|
||||
let get_item_result = window.localStorage.getItem(code);
|
||||
if (get_item_result) {
|
||||
$idaa_loc.recovery_meetings.ds[code] = get_item_result;
|
||||
} else {
|
||||
console.log('Get local storage item miss.');
|
||||
}
|
||||
|
||||
data_store_obj_get_promise = api.get_data_store_obj_w_code({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
data_store_code: code,
|
||||
data_type: data_type,
|
||||
log_lvl: 1
|
||||
})
|
||||
.then(function (get_data_store_result) {
|
||||
if (get_data_store_result) {
|
||||
|
||||
if (data_type == 'text') {
|
||||
// console.log(get_data_store_result.text);
|
||||
$idaa_loc.recovery_meetings.ds[code] = get_data_store_result.text;
|
||||
} else if (data_type == 'json') {
|
||||
// console.log(get_data_store_result.json);
|
||||
$idaa_loc.recovery_meetings.ds[code] = get_data_store_result.json;
|
||||
}
|
||||
|
||||
// console.log(`Code: ${$idaa_loc.recovery_meetings.ds[code]}`);
|
||||
// console.log(`Code:`, $idaa_loc.recovery_meetings.ds[code]);
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- <svelte:window
|
||||
bind:outerHeight={ae_iframe_height}
|
||||
/> -->
|
||||
|
||||
|
||||
<section id="osit_idaa_recovery_meetings" class="osit_events ae_main c_idaa c_idaa_recovery_meetings ae_main" bind:clientHeight={$ae_app.iframe_height}>
|
||||
<!-- <header>
|
||||
<h1>Recovery Meetings for Healthcare Professionals</h1>
|
||||
</header> -->
|
||||
|
||||
<section class="ae_section ae_meta">
|
||||
<p>
|
||||
Novi: {$idaa_loc.novi_full_name}
|
||||
<span class="details">
|
||||
(
|
||||
{$idaa_loc.novi_email}
|
||||
{#if $ae_loc.administrator_access}
|
||||
<span class="access_type administrator_access">Administrator</span>
|
||||
{:else if $ae_loc.trusted_access}
|
||||
<span class="access_type trusted_access">Trusted</span>
|
||||
{/if}
|
||||
<span class="novi_uuid">UUID: {$idaa_loc.novi_uuid}</span>
|
||||
)
|
||||
</span>
|
||||
</p>
|
||||
<!-- <p>Page height: {window.innerHeight}</p> -->
|
||||
</section>
|
||||
|
||||
<!-- <div class="ae_overview">
|
||||
<p>IDAA-inclusive for all addictions. If a meeting is listed as an IDAA meeting, anyone may attend if they choose and are respectful of others. <strong>The door may be closed, but it is never locked.</strong></p>
|
||||
<p>Caduceus—Includes some IDAA members, but other healthcare workers attend depending on the individual meeting. These are listed as a courtesy.</p>
|
||||
<p>If a member wishes to start a virtual meeting with specific focus for IDAA members only, that may be indicated in the description. An announcement or invitation can also be placed on the Bulletin Board.</p>
|
||||
|
||||
<p>If you are interested in Starting a Meeting, IDAA has developed a guide. <a href="https://static.oneskyit.com/c/IDAA/files/IDAA_-_How_to_Start_A_Meeting_Guide.pdf" class="ae_btn btn_md btn_outline_info"><span class="fas fa-file-pdf"></span> Open IDAA's How to Start an IDAA Recovery Meeting PDF</a> for additional information.</p>
|
||||
</div> -->
|
||||
|
||||
{#if $idaa_loc.recovery_meetings.show_main__options}
|
||||
<section class="ae_section ae_options ae_column event_obj__options">
|
||||
|
||||
<div class="filters_and_search">
|
||||
<div class="ae_info recovery_meetings_info note">
|
||||
{@html $idaa_loc.recovery_meetings.ds.recovery_meetings_info}
|
||||
</div>
|
||||
<!-- <div class="note">Note: The state/province filter only includes states and provinces that are set for at least one meeting. Many virtual/online meetings do not have a state/province set. Some in-person meetings also do not have a state/province set. Please ask one of the meeting contacts to update this information if it is missing.</div> -->
|
||||
|
||||
<form on:submit|preventDefault={handle_submit_form} on:keydown={e => e.key === 'Escape' && handle_cancel_form} class="search_form">
|
||||
<!-- <div class="ae_group">
|
||||
<input
|
||||
type="search"
|
||||
placeholder="Search (day of week, location, time, chair, etc.)"
|
||||
name="fulltext_search_qry_str"
|
||||
on:keyup={handle_oninput_fulltext_search_qry_str}
|
||||
bind:value={$idaa_loc.recovery_meetings.fulltext_search_qry_str}
|
||||
>
|
||||
</div> -->
|
||||
<div class="ae_group">
|
||||
<input
|
||||
type="search"
|
||||
placeholder="Search (day of week, location, chair, etc.)"
|
||||
id="meeting_fulltext_search_qry_str"
|
||||
name="fulltext_search_qry_str"
|
||||
bind:value={$idaa_loc.recovery_meetings.fulltext_search_qry_str}
|
||||
style="width: 50%;"
|
||||
class="bs-input"
|
||||
>
|
||||
<button
|
||||
on:click={handle_oninput_fulltext_search_qry_str}
|
||||
>
|
||||
<span class="fas fa-search"></span> Search
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<fieldset>
|
||||
<legend>Location?</legend>
|
||||
<div class="ae_row ae_flex_justify_around ae_width_md">
|
||||
<label>Virtual
|
||||
<input
|
||||
name="qry_virtual"
|
||||
type="checkbox"
|
||||
bind:checked={$idaa_loc.recovery_meetings.qry_virtual}
|
||||
on:change={() => {$slct_trigger = 'load__event_obj_li';}}
|
||||
>
|
||||
</label>
|
||||
<label>In-person
|
||||
<input
|
||||
name="qry_physical"
|
||||
type="checkbox"
|
||||
bind:checked={$idaa_loc.recovery_meetings.qry_physical}
|
||||
on:change={() => {$slct_trigger = 'load__event_obj_li';}}
|
||||
>
|
||||
</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Type?</legend>
|
||||
<div class="ae_row ae_flex_justify_around ae_width_100">
|
||||
<label>All
|
||||
<input
|
||||
name="qry_type"
|
||||
type="radio"
|
||||
value=""
|
||||
bind:group={$idaa_loc.recovery_meetings.qry_type}
|
||||
on:change={() => {$slct_trigger = 'load__event_obj_li';}}
|
||||
title="Show all meeting types"
|
||||
>
|
||||
</label>
|
||||
<label>IDAA
|
||||
<input
|
||||
name="qry_type"
|
||||
type="radio"
|
||||
value="IDAA"
|
||||
bind:group={$idaa_loc.recovery_meetings.qry_type}
|
||||
on:change={() => {$slct_trigger = 'load__event_obj_li';}}
|
||||
title="Open to IDAA members only"
|
||||
>
|
||||
</label>
|
||||
<label>Caduceus
|
||||
<input
|
||||
name="qry_type"
|
||||
type="radio"
|
||||
value="Caduceus"
|
||||
bind:group={$idaa_loc.recovery_meetings.qry_type}
|
||||
on:change={() => {$slct_trigger = 'load__event_obj_li';}}
|
||||
title="Open to all healthcare workers including those who do not qualify for IDAA"
|
||||
>
|
||||
</label>
|
||||
<label>Family Recovery
|
||||
<input
|
||||
name="qry_type"
|
||||
type="radio"
|
||||
value="Family Recovery"
|
||||
bind:group={$idaa_loc.recovery_meetings.qry_type}
|
||||
on:change={() => {$slct_trigger = 'load__event_obj_li';}}
|
||||
title="Open to spouses, parents, and children of medical professionals who have substance use disorder."
|
||||
>
|
||||
</label>
|
||||
<!-- {#if $ae_loc.administrator_access}
|
||||
<label>Al-Anon (old)
|
||||
<input
|
||||
name="qry_type"
|
||||
type="radio"
|
||||
value="Al-Anon"
|
||||
bind:group={$idaa_loc.recovery_meetings.qry_type}
|
||||
on:change={() => {$slct_trigger = 'load__event_obj_li';}}
|
||||
>
|
||||
</label>
|
||||
<label>Other (old)
|
||||
<input
|
||||
name="qry_type"
|
||||
type="radio"
|
||||
value="Other"
|
||||
bind:group={$idaa_loc.recovery_meetings.qry_type}
|
||||
on:change={() => {$slct_trigger = 'load__event_obj_li';}}
|
||||
>
|
||||
</label>
|
||||
{/if} -->
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
</form>
|
||||
|
||||
<!-- {#await idaa_event_obj_li_get_promise}
|
||||
<div>Loading events...</div>
|
||||
{:catch error}
|
||||
<div>Error: {error.message}</div>
|
||||
{/await} -->
|
||||
|
||||
<div class="ae_group ae_row">
|
||||
|
||||
{#if $ae_loc.trusted_access && $idaa_loc.recovery_meetings.hidden == 'not_hidden'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$idaa_loc.recovery_meetings.hidden = 'all';
|
||||
$idaa_loc.recovery_meetings.limit = 150;
|
||||
$slct_trigger = 'load__event_obj_li';
|
||||
}}
|
||||
class="btn_show_bb_post ae_btn btn btn-info"
|
||||
>
|
||||
<span class="fas fa-eye"></span> Show Hidden Events
|
||||
</button>
|
||||
{:else if $ae_loc.trusted_access && $idaa_loc.recovery_meetings.hidden == 'all'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$idaa_loc.recovery_meetings.hidden = 'not_hidden';
|
||||
$slct_trigger = 'load__event_obj_li';
|
||||
}}
|
||||
class="btn_hide_bb_post ae_btn btn btn-info"
|
||||
>
|
||||
<span class="fas fa-eye-slash"></span> Hide Hidden Events
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
{#if $ae_loc.administrator_access && $idaa_loc.recovery_meetings.enabled == 'enabled'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$idaa_loc.recovery_meetings.hidden = 'all';
|
||||
$idaa_loc.recovery_meetings.enabled = 'all';
|
||||
$idaa_loc.recovery_meetings.limit = 500;
|
||||
$slct_trigger = 'load__event_obj_li';
|
||||
}}
|
||||
class="btn_show_bb_post ae_btn btn btn-warning"
|
||||
>
|
||||
<span class="fas fa-eye"></span> Show Disabled Events
|
||||
</button>
|
||||
{:else if $ae_loc.administrator_access && $idaa_loc.recovery_meetings.enabled == 'all'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$idaa_loc.recovery_meetings.enabled = 'enabled';
|
||||
$slct_trigger = 'load__event_obj_li';
|
||||
}}
|
||||
class="btn_hide_bb_post ae_btn btn btn-warning"
|
||||
>
|
||||
<span class="fas fa-eye-slash"></span> Hide Disabled Events
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
<button
|
||||
on:click={() => {
|
||||
$slct.event_id = null;
|
||||
$slct.event_obj = {};
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete('event_id');
|
||||
history.pushState({}, '', url);
|
||||
|
||||
$idaa_loc.recovery_meetings.show_main__options = false;
|
||||
$idaa_loc.recovery_meetings.show_list__event_obj_li = false;
|
||||
$idaa_loc.recovery_meetings.show_view__event_obj = false;
|
||||
$idaa_loc.recovery_meetings.show_edit__event_obj = true;
|
||||
}}
|
||||
class="btn_new_recovery_meeting ae_btn btn btn-secondary"
|
||||
>
|
||||
<span class="fas fa-plus"></span> Create new Meeting
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div> <!-- END: div filters_and_search -->
|
||||
|
||||
</section>
|
||||
{/if}
|
||||
|
||||
|
||||
{#if $idaa_loc.recovery_meetings.show_list__event_obj_li}
|
||||
<List_event_obj />
|
||||
{/if}
|
||||
|
||||
|
||||
{#if $idaa_loc.recovery_meetings.show_edit__event_obj}
|
||||
<!-- <section class="ae_edit event_obj event_id idaa_event_id_edit"> -->
|
||||
<Element_modal_v3
|
||||
show = { true }
|
||||
modal_cover_body = { false }
|
||||
report_client_dimensions = { true }
|
||||
on:close={ () => {
|
||||
$idaa_loc.recovery_meetings.show_main__options = true;
|
||||
$idaa_loc.recovery_meetings.show_list__event_obj_li = true;
|
||||
$idaa_loc.recovery_meetings.show_edit__event_obj = false;
|
||||
$idaa_loc.recovery_meetings.show_view__event_obj = false;
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete('event_id');
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {'event_id': null};
|
||||
window.parent.postMessage(message, "*");
|
||||
}}
|
||||
on:report__modal_dimensions={ (event) => {
|
||||
console.log('*** on:report__modal_dimensions ***');
|
||||
console.log(event.detail);
|
||||
|
||||
$ae_app.modal_dimensions = event.detail.modal_dimensions;
|
||||
}}
|
||||
>
|
||||
<span slot="header_title">{@html ($slct.event_obj.name ? $slct.event_obj.name : 'New Recovery Meeting')}</span>
|
||||
|
||||
<span slot="body">
|
||||
|
||||
<Edit_event_obj
|
||||
on:created__meeting_obj={handle_created_event_obj}
|
||||
on:updated__meeting_obj={handle_updated_event_obj}
|
||||
on:deleted__meeting_obj={handle_deleted_event_obj}
|
||||
/>
|
||||
|
||||
</span>
|
||||
</Element_modal_v3>
|
||||
<!-- </section> -->
|
||||
{/if}
|
||||
|
||||
|
||||
{#if $idaa_loc.recovery_meetings.show_view__event_obj && $slct.event_obj}
|
||||
<!-- <section class="ae_view event_obj event_id idaa_event_id_view"> -->
|
||||
<Element_modal_v3
|
||||
show = { true }
|
||||
modal_cover_body = { false }
|
||||
report_client_dimensions = { true }
|
||||
on:close={ () => {
|
||||
$slct.event_id = null;
|
||||
$slct.event_obj = {};
|
||||
|
||||
$idaa_loc.recovery_meetings.show_main__options = true;
|
||||
$idaa_loc.recovery_meetings.show_list__event_obj_li = true;
|
||||
$idaa_loc.recovery_meetings.show_view__event_obj = false;
|
||||
$idaa_loc.recovery_meetings.show_edit__event_obj = false;
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete('event_id');
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {'event_id': null};
|
||||
window.parent.postMessage(message, "*");
|
||||
}}
|
||||
on:report__modal_dimensions={ (event) => {
|
||||
console.log('*** on:report__modal_dimensions ***');
|
||||
console.log(event.detail);
|
||||
|
||||
$ae_app.modal_dimensions = event.detail.modal_dimensions;
|
||||
}}
|
||||
>
|
||||
<span slot="header_title">{@html $slct.event_obj.name}</span>
|
||||
|
||||
<span slot="body">
|
||||
|
||||
<View_event_obj />
|
||||
|
||||
</span>
|
||||
</Element_modal_v3>
|
||||
<!-- </section> -->
|
||||
{/if}
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<style>
|
||||
|
||||
|
||||
/* .ae_meta {
|
||||
font-size: smaller;
|
||||
color: hsla(0,0%,50%,1);
|
||||
} */
|
||||
|
||||
/* .ae_edit.event_obj {
|
||||
border: dashed thin hsla(0,0%,70%,1);
|
||||
|
||||
margin: .5em .25em;
|
||||
padding: .5em .25em;
|
||||
|
||||
background-color: hsla(0,0%,90%,1);
|
||||
} */
|
||||
|
||||
/* .ae_view.event_obj {
|
||||
border: dashed thin hsla(0,0%,70%,1);
|
||||
|
||||
margin: .5em .25em;
|
||||
padding: .5em .25em;
|
||||
|
||||
background-color: hsla(0,0%,90%,1);
|
||||
} */
|
||||
|
||||
/* :global(.ae_edit.event_id .element_ae_modal) {
|
||||
border: dashed thin hsla(0,0%,70%,1);
|
||||
|
||||
margin: .5em .25em;
|
||||
padding: .5em .25em;
|
||||
|
||||
background-color: hsla(0,0%,90%,1);
|
||||
} */
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user