Starting to import the IDAA files.
This commit is contained in:
0
src/routes/idaa/(idaa)/+layout.svelte
Normal file
0
src/routes/idaa/(idaa)/+layout.svelte
Normal file
0
src/routes/idaa/(idaa)/+page.svelte
Normal file
0
src/routes/idaa/(idaa)/+page.svelte
Normal file
587
src/routes/idaa/(idaa)/app.pcss
Normal file
587
src/routes/idaa/(idaa)/app.pcss
Normal file
@@ -0,0 +1,587 @@
|
||||
/* Write your global styles here, in PostCSS syntax */
|
||||
|
||||
/* @tailwind base; */
|
||||
|
||||
:root {
|
||||
font-family: system-ui, Helvetica, Arial, sans-serif;
|
||||
/* line-height: 1.5; */
|
||||
/* font-weight: 400; */
|
||||
|
||||
color-scheme: light dark;
|
||||
/* color: rgba(255, 255, 255, 0.87); */
|
||||
/* background-color: #242424; */
|
||||
|
||||
/* font-synthesis: none; */
|
||||
/* text-rendering: optimizeLegibility; */
|
||||
/* -webkit-font-smoothing: antialiased; */
|
||||
/* -moz-osx-font-smoothing: grayscale; */
|
||||
/* -webkit-text-size-adjust: 100%; */
|
||||
}
|
||||
|
||||
body {
|
||||
/* margin: 0; */
|
||||
/* display: flex;
|
||||
place-items: center; */
|
||||
/* min-width: 320px; */
|
||||
|
||||
min-height: 100vh;
|
||||
/* min-height: fit-content; */
|
||||
/* height: 100%; */
|
||||
|
||||
min-width: 100vw;
|
||||
/* width: 100%; */
|
||||
|
||||
/* contain: layout; */
|
||||
/* contain: size; */
|
||||
}
|
||||
|
||||
address {
|
||||
margin-bottom: 0.25em;
|
||||
padding-left: 0.5em;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
pre {
|
||||
white-space: pre-wrap;
|
||||
word-break: normal;
|
||||
word-wrap: normal;
|
||||
|
||||
border: none;
|
||||
}
|
||||
|
||||
textarea {
|
||||
/* width: calc(fit-content - 1em); */
|
||||
width: 100%;
|
||||
max-width: calc(fit-content - 0.5em);
|
||||
}
|
||||
|
||||
button.ae_normal,
|
||||
.btn.ae_normal {
|
||||
/* font: normal 1em sans-serif; */
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
button.ae_smaller,
|
||||
.btn.ae_smaller {
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
button.ae_smallest,
|
||||
.btn.ae_smallest {
|
||||
font-size: 0.65rem;
|
||||
}
|
||||
|
||||
/* h1 {
|
||||
font-size: 3.2em;
|
||||
line-height: 1.1;
|
||||
} */
|
||||
|
||||
/* .card {
|
||||
padding: 2em;
|
||||
} */
|
||||
|
||||
/* #app {
|
||||
max-width: 1280px;
|
||||
margin: 0 auto;
|
||||
padding: 2rem;
|
||||
text-align: center;
|
||||
} */
|
||||
|
||||
/* button {
|
||||
border-radius: 8px;
|
||||
border: 1px solid transparent;
|
||||
padding: 0.6em 1.2em;
|
||||
font-size: 1em;
|
||||
font-weight: 500;
|
||||
font-family: inherit;
|
||||
background-color: #1a1a1a;
|
||||
cursor: pointer;
|
||||
transition: border-color 0.25s;
|
||||
}
|
||||
button:hover {
|
||||
border-color: #646cff;
|
||||
}
|
||||
button:focus,
|
||||
button:focus-visible {
|
||||
outline: 4px auto -webkit-focus-ring-color;
|
||||
} */
|
||||
|
||||
/* @media (prefers-color-scheme: light) {
|
||||
:root {
|
||||
color: #213547;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
a:hover {
|
||||
color: #747bff;
|
||||
}
|
||||
button {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
} */
|
||||
|
||||
/* BEGIN: Novi and Bootstrap specific fixes */
|
||||
/* .ae_btn .btn_xs, .btn .btn-xs {
|
||||
font-size: .65rem;
|
||||
} */
|
||||
|
||||
.ae_btn.btn-danger,
|
||||
.ae_btn.btn-info,
|
||||
.ae_btn.btn-warning {
|
||||
border-radius: 60px;
|
||||
}
|
||||
|
||||
/* END: Novi and Bootstrap specific fixes */
|
||||
|
||||
.ae_main {
|
||||
/* min-height: fit-content; */
|
||||
/* min-height: 100vh; */
|
||||
/* height: 100%; */
|
||||
|
||||
/* min-width: 100vw; */
|
||||
/* width: 100%; */
|
||||
|
||||
/* contain: layout; */
|
||||
/* contain: content; */
|
||||
/* contain: size; */
|
||||
}
|
||||
|
||||
.ae_dev_in_progress {
|
||||
background-color: hsla(300, 80%, 50%, 1);
|
||||
}
|
||||
|
||||
.c_idaa_bb,
|
||||
.c_idaa_recovery_meetings {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
/* align-items: center; */
|
||||
/* justify-content: center; */
|
||||
/* min-height: 100vh; */
|
||||
|
||||
gap: 1em;
|
||||
}
|
||||
|
||||
.c_idaa_archives > .ae_meta,
|
||||
.c_idaa_bb > .ae_meta,
|
||||
.c_idaa_recovery_meetings > .ae_meta {
|
||||
background-color: lightgray;
|
||||
}
|
||||
|
||||
.ae_list.archive_obj_li {
|
||||
/* border: solid thin gray; */
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
/* align-items: stretch; */
|
||||
/* justify-content: stretch; */
|
||||
gap: 0.5em;
|
||||
}
|
||||
|
||||
.ae_list.archive_obj_li .ae_object.archive_obj,
|
||||
.ae_list.archive_content_obj_li .ae_object.archive_content_obj {
|
||||
border-top: solid medium hsla(0, 0%, 90%, 1);
|
||||
/* border-bottom: solid thin hsla(0,0%,90%,1); */
|
||||
/* margin: 1em .5em; */
|
||||
padding: 0.5em 0.5em;
|
||||
|
||||
width: 100%;
|
||||
|
||||
/* flex-grow: 1; */
|
||||
}
|
||||
|
||||
.c_idaa_recovery_meetings section.ae_options fieldset {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.c_idaa_recovery_meetings section.ae_options fieldset legend {
|
||||
display: inline;
|
||||
/* border: none; */
|
||||
margin: 0;
|
||||
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.ae_list.event_obj_li {
|
||||
/* border: solid thin gray; */
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
/* align-items: stretch; */
|
||||
/* justify-content: stretch; */
|
||||
gap: 0.5em;
|
||||
}
|
||||
|
||||
.ae_list.event_obj_li .ae_object.event_obj {
|
||||
border-top: solid medium hsla(0, 0%, 90%, 1);
|
||||
/* border-bottom: solid thin hsla(0,0%,90%,1); */
|
||||
/* margin: 1em .5em; */
|
||||
padding: 0.5em 0.5em;
|
||||
|
||||
width: 100%;
|
||||
|
||||
/* flex-grow: 1; */
|
||||
}
|
||||
|
||||
/* For now this only affects the IDAA Recovery Meetings when viewing a specific meeting. */
|
||||
.view__event_obj a,
|
||||
.view__event_obj a.ae_link {
|
||||
/* color: #007bff; */
|
||||
color: #82b6e1;
|
||||
/* text-decoration: underline; */
|
||||
/* background-color: transparent; */
|
||||
}
|
||||
.view__event_obj a:hover,
|
||||
.view__event_obj a:focus,
|
||||
.view__event_obj a.ae_link:hover,
|
||||
.view__event_obj a.ae_link:focus {
|
||||
color: #0056b3;
|
||||
text-decoration: underline;
|
||||
/* background-color: transparent; */
|
||||
|
||||
/* scale: 1.1; */
|
||||
}
|
||||
|
||||
.svelte_component {
|
||||
margin: 0em;
|
||||
padding: 0em;
|
||||
}
|
||||
|
||||
.ae_section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.ae_warning {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.ae_highlight {
|
||||
background-color: hsla(60, 100%, 50%, 1);
|
||||
}
|
||||
|
||||
.ae_d_none,
|
||||
.d-none {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.ae_group {
|
||||
/* display: flex; */
|
||||
/* flex-direction: row; */
|
||||
/* align-items: center; */
|
||||
/* justify-content: space-between; */
|
||||
/* justify-content: space-evenly; */
|
||||
}
|
||||
|
||||
.ae_column {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
/* align-items: center; */
|
||||
/* justify-content: space-between; */
|
||||
justify-content: space-evenly;
|
||||
}
|
||||
|
||||
.ae_row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
||||
align-items: center;
|
||||
/* justify-content: space-between; */
|
||||
justify-content: space-evenly;
|
||||
}
|
||||
|
||||
.ae_flex_justify_around {
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.ae_flex_justify_center {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
|
||||
.ae_width_25 {
|
||||
width: 25%;
|
||||
/* max-width: 25%; */
|
||||
}
|
||||
.ae_width_30 {
|
||||
width: 30%;
|
||||
/* max-width: 30%; */
|
||||
}
|
||||
.ae_width_50 {
|
||||
width: 50%;
|
||||
/* max-width: 50%; */
|
||||
}
|
||||
.ae_width_100 {
|
||||
width: 100%;
|
||||
/* max-width: 100%; */
|
||||
}
|
||||
|
||||
.ae_width_md {
|
||||
min-width: 16em;
|
||||
width: 16em;
|
||||
max-width: 16em;
|
||||
}
|
||||
|
||||
.ae_width_lg {
|
||||
min-width: 20em;
|
||||
width: 22em;
|
||||
max-width: 24em;
|
||||
}
|
||||
|
||||
.ae_margin_xs {
|
||||
margin: 0.25em;
|
||||
}
|
||||
.ae_margin_sm {
|
||||
margin: 0.5em;
|
||||
}
|
||||
.ae_margin_md {
|
||||
margin: 0.75em;
|
||||
}
|
||||
.ae_margin_lg {
|
||||
margin: 1em;
|
||||
}
|
||||
.ae_margin_lg {
|
||||
margin: 1.25em;
|
||||
}
|
||||
|
||||
.ae_padding_md {
|
||||
padding: 0.75em;
|
||||
}
|
||||
|
||||
.ae_float_right {
|
||||
float: right;
|
||||
align-self: flex-end;
|
||||
}
|
||||
|
||||
.ae_options {
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
.ae_fade_in {
|
||||
/* animation: fadein 1s; */
|
||||
opacity: 1;
|
||||
/* height: initial; */
|
||||
/* max-height: 100%; */
|
||||
/* width: initial; */
|
||||
/* max-width: 100%; */
|
||||
transition:
|
||||
opacity,
|
||||
height,
|
||||
width,
|
||||
0.25s ease-in;
|
||||
|
||||
/* transition: height 1s ease-in; */
|
||||
/* width: initial; */
|
||||
/* transition: opacity, height, width 1s ease-in 1s; */
|
||||
}
|
||||
.ae_fade_out {
|
||||
/* animation: fadeout 1s; */
|
||||
opacity: 0;
|
||||
height: 0;
|
||||
max-height: 0;
|
||||
width: 0;
|
||||
max-width: 0;
|
||||
transition:
|
||||
opacity,
|
||||
height,
|
||||
width,
|
||||
0.25s ease-out;
|
||||
}
|
||||
|
||||
/* .ae_section.ae_options {
|
||||
border: solid thin hsla(0,0%,90%,.75); */
|
||||
|
||||
/* Display options using flex (row, wrap, space elements equally) */
|
||||
/* display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center; */
|
||||
/* justify-content: space-evenly; */
|
||||
/* align-content: center;
|
||||
align-items: center;
|
||||
} */
|
||||
|
||||
.ae_section.ae_meta {
|
||||
font-size: smaller;
|
||||
color: hsla(0, 0%, 50%, 1);
|
||||
}
|
||||
|
||||
.svelte_component.ae_edit {
|
||||
/* outline: dashed thin pink; */
|
||||
border: solid medium hsla(220, 100%, 50%, 0.1);
|
||||
}
|
||||
|
||||
.svelte_component.ae_create {
|
||||
border: solid medium hsla(0, 100%, 50%, 0.1);
|
||||
}
|
||||
|
||||
/* element_ae_modal ae_modal_showing_container ae_modal modal_cover_body */
|
||||
.ae_modal {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 1000;
|
||||
|
||||
min-height: 100vh;
|
||||
height: 100%;
|
||||
/* max-height: 100vh; */
|
||||
|
||||
min-width: 100vw;
|
||||
width: 100%;
|
||||
max-width: 100vw;
|
||||
|
||||
/* background-color: hsla(180,75%,90%,.75); */
|
||||
background-color: hsla(180, 0%, 90%, 0.75);
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
align-items: center;
|
||||
/* align-items: flex-start; */
|
||||
/* justify-content: center; */
|
||||
/* justify-content: flex-start; */
|
||||
|
||||
/* contain: layout; */
|
||||
contain: strict;
|
||||
/* contain: size; */
|
||||
|
||||
/* Margin should stay 0 and padding can be used to create space within the modal for the actual content. */
|
||||
margin: 0;
|
||||
padding: 1em;
|
||||
|
||||
/* pointer-events: auto; */
|
||||
}
|
||||
|
||||
.ae_modal .modal_content {
|
||||
z-index: 1001;
|
||||
position: relative;
|
||||
|
||||
box-sizing: content-box;
|
||||
|
||||
background-color: white;
|
||||
/* margin: 1em;
|
||||
padding: .25em .5em; */
|
||||
margin: 0em;
|
||||
padding: 0em;
|
||||
|
||||
border: solid thin lightgray;
|
||||
border-radius: 0.5em;
|
||||
|
||||
/* box-shadow: .5em .5em 1.5em .5em hsla(0, 0%, 0%, .9); */
|
||||
box-shadow: 0em 0em 1.5em 0.5em hsla(0, 0%, 0%, 0.9);
|
||||
|
||||
/* min-height: 50vh; */
|
||||
max-height: calc(100vh - 2em);
|
||||
/* max-height: fit-content; */
|
||||
|
||||
/* min-width: 50vw; */
|
||||
max-width: calc(100vw - 2em);
|
||||
/* max-width: 100vw; */
|
||||
|
||||
/* scroll-behavior: auto; */
|
||||
/* overflow: scroll; */
|
||||
/* overflow: auto; */
|
||||
/* contain: content; */
|
||||
/* contain: strict; */
|
||||
/* overflow: auto; */
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.ae_modal .modal_header {
|
||||
background-color: hsla(0, 0%, 90%, 0.5);
|
||||
border-bottom: solid thin lightgray;
|
||||
|
||||
margin: 0em;
|
||||
padding: 0.25em 0.25em;
|
||||
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.ae_modal .modal_body {
|
||||
/* outline: dashed medium pink; */
|
||||
|
||||
margin: 0em;
|
||||
padding: 0.25em 0.25em;
|
||||
|
||||
/* height: 100vh; */
|
||||
|
||||
/* contain: content; */
|
||||
/* pointer-events: auto; */
|
||||
overflow: scroll;
|
||||
/* overflow-x: auto; */
|
||||
/* overflow-y: scroll; */
|
||||
}
|
||||
|
||||
.ae_modal .modal_footer {
|
||||
background-color: hsla(0, 0%, 90%, 0.5);
|
||||
border-top: solid thin lightgray;
|
||||
|
||||
margin: 0em;
|
||||
padding: 0.25em 0.25em;
|
||||
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
/* body.modal_cover_body {
|
||||
pointer-events: none;
|
||||
overflow-y: hidden;
|
||||
height: fit-content;
|
||||
contain: size;
|
||||
} */
|
||||
|
||||
body.modal_cover_body .ae_modal {
|
||||
margin: 0em;
|
||||
padding: 0em;
|
||||
/* max-width: 100vw; */
|
||||
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
body.modal_cover_body .ae_modal .modal_content {
|
||||
/* outline: dashed thin pink; */
|
||||
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
|
||||
box-shadow: none;
|
||||
|
||||
max-height: calc(100vh - 0.5em);
|
||||
|
||||
max-width: calc(100vw);
|
||||
}
|
||||
|
||||
body.modal_cover_body .ae_modal .modal_body {
|
||||
/* outline: dashed medium pink; */
|
||||
}
|
||||
|
||||
form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
/* justify-content: flex-start; */
|
||||
/* align-items: center; */
|
||||
|
||||
padding: 0.75em;
|
||||
}
|
||||
|
||||
form fieldset {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
/* justify-content: flex-start; */
|
||||
/* align-items: center; */
|
||||
}
|
||||
|
||||
/* Make readonly input fields grayed out and hide border*/
|
||||
form input:read-only {
|
||||
/* background-color: hsla(0,0%,90%,1); */
|
||||
border: none;
|
||||
}
|
||||
/* @tailwind components; */
|
||||
@tailwind utilities;
|
||||
617
src/routes/idaa/(idaa)/archives/0_archives__main.svelte
Normal file
617
src/routes/idaa/(idaa)/archives/0_archives__main.svelte
Normal file
@@ -0,0 +1,617 @@
|
||||
<script lang="ts">
|
||||
type key_val = {
|
||||
[key: string]: any;
|
||||
};
|
||||
// *** Import Svelte core
|
||||
import { onMount } from '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 { get_account_archive_obj_list } from './stores_ae_api.js';
|
||||
|
||||
// *** Import Aether module components
|
||||
import Edit_archive_obj from './10_edit__archive_obj.svelte';
|
||||
import List_archive_obj from './10_list__archive_obj.svelte';
|
||||
import View_archive_obj from './10_view__archive_obj.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 archive_id: string = $ae_app.archives.archive_id;
|
||||
|
||||
export let novi_uuid: string = $ae_app.novi_uuid;
|
||||
export let novi_email: string = $ae_app.novi_email;
|
||||
export let novi_full_name: string = $ae_app.novi_full_name;
|
||||
export let novi_admin_li: string = $ae_app.novi_admin_li;
|
||||
export let novi_trusted_li: string = $ae_app.novi_trusted_li;
|
||||
|
||||
// *** Set initial variables
|
||||
$ae_app.novi_uuid = novi_uuid;
|
||||
$ae_app.novi_email = decodeURIComponent(novi_email);
|
||||
$ae_app.novi_full_name = decodeURIComponent(novi_full_name);
|
||||
$ae_app.novi_admin_li = novi_admin_li;
|
||||
$ae_app.novi_trusted_li = novi_trusted_li;
|
||||
|
||||
$ae_app.current_timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||
if (!$ae_app.lu_timezone_list) {
|
||||
$ae_app.lu_timezone_list = [];
|
||||
}
|
||||
|
||||
$ae_app.archives.show_main__options = true; // Section for: buttons for creating new archives, show/hide archives, and search archives
|
||||
// $ae_app.archives.show_list__archive_obj_li = true;
|
||||
// $ae_app.archives.show_view__archive_obj = $ae_app.archives.show_view__archive_obj;
|
||||
$ae_app.archives.fulltext_search_qry_str = '';
|
||||
$ae_app.archives.qry_type = false
|
||||
|
||||
// NOTE: Check if the novi_uuid is in the novi_admin_li list
|
||||
if ($ae_app.novi_uuid && $ae_app.novi_admin_li) {
|
||||
if ($ae_app.novi_admin_li.includes($ae_app.novi_uuid)) {
|
||||
$ae_app.access_type = 'administrator';
|
||||
$ae_app.administrator_access = true;
|
||||
$ae_app.trusted_access = true;
|
||||
}
|
||||
}
|
||||
// NOTE: Check if the novi_uuid is in the novi_trusted_li list
|
||||
if ($ae_app.novi_uuid && $ae_app.novi_trusted_li) {
|
||||
if ($ae_app.novi_trusted_li.includes($ae_app.novi_uuid)) {
|
||||
$ae_app.access_type = 'trusted';
|
||||
$ae_app.trusted_access = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($ae_app.administrator_access) {
|
||||
$ae_app.archives.enabled = 'enabled';
|
||||
$ae_app.archives.hidden = 'not_hidden';
|
||||
$ae_app.archives.limit = 150;
|
||||
} else if ($ae_app.trusted_access) {
|
||||
$ae_app.archives.enabled = 'enabled';
|
||||
$ae_app.archives.hidden = 'not_hidden';
|
||||
$ae_app.archives.limit = 75;
|
||||
} else {
|
||||
$ae_app.archives.enabled = 'enabled';
|
||||
$ae_app.archives.hidden = 'not_hidden';
|
||||
$ae_app.archives.limit = 75;
|
||||
}
|
||||
|
||||
let idaa_archive_obj_li_get_promise;
|
||||
let idaa_archive_obj_get_promise;
|
||||
|
||||
if (account_id) {
|
||||
$slct.account_id = account_id;
|
||||
handle_load_archive_obj_li({account_id: $slct.account_id, try_cache: false});
|
||||
}
|
||||
|
||||
if (archive_id) {
|
||||
console.log(`Selected Archive ID: ${archive_id}`);
|
||||
$slct.archive_id = archive_id;
|
||||
$slct_trigger = 'load__archive_obj';
|
||||
|
||||
// $ae_app.archives.show_main__options = true;
|
||||
$ae_app.archives.show_list__archive_obj_li = false;
|
||||
$ae_app.archives.show_view__archive_obj = true;
|
||||
$ae_app.archives.show_edit__archive_obj = false;
|
||||
} else {
|
||||
// $ae_app.archives.show_main__options = true;
|
||||
$ae_app.archives.show_list__archive_obj_li = true;
|
||||
$ae_app.archives.show_view__archive_obj = false;
|
||||
$ae_app.archives.show_edit__archive_obj = false;
|
||||
}
|
||||
|
||||
if (!$ae_app.client_content) {
|
||||
$ae_app.client_content = {};
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** IDAA Archives - AE Archives: 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__archive_obj' && $slct.archive_id) {
|
||||
console.log('*** $slct_trigger == load__archive_obj ***');
|
||||
$slct_trigger = null;
|
||||
|
||||
handle_load_archive_obj({archive_id: $slct.archive_id, try_cache: false});
|
||||
|
||||
// Auto show the selected Archive ID
|
||||
// Is this pushState needed here?
|
||||
// Set the URL param "archive_id" to the current Archive ID. This is a just in case.
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.set('archive_id', $slct.archive_id);
|
||||
// history.pushState({}, '', url);
|
||||
|
||||
// Is this postMessage needed here?
|
||||
let message = {'archive_id': $slct.archive_id};
|
||||
window.parent.postMessage(message, "*");
|
||||
|
||||
// $ae_app.archives.show_main__options = false;
|
||||
// $ae_app.archives.show_list__archive_obj_li = false;
|
||||
// $ae_app.archives.show_view__archive_obj = true;
|
||||
// $ae_app.archives.show_edit__archive_obj = false;
|
||||
}
|
||||
|
||||
$: if ($slct_trigger == 'load__archive_obj_li' && $slct.account_id) {
|
||||
console.log('*** $slct_trigger == load__archive_obj_li ***');
|
||||
$slct_trigger = null;
|
||||
|
||||
handle_load_archive_obj_li({account_id: $slct.account_id, try_cache: false});
|
||||
}
|
||||
|
||||
async function handle_load_archive_obj_li({account_id, try_cache=true}) {
|
||||
console.log('*** handle_load_archive_obj_li() ***');
|
||||
console.log($ae_app.archives);
|
||||
|
||||
let enabled = $ae_app.archives.enabled;
|
||||
let hidden = $ae_app.archives.hidden;
|
||||
let limit = $ae_app.archives.limit;
|
||||
let offset = $ae_app.archives.offset;
|
||||
|
||||
let params = {};
|
||||
|
||||
let params_json: key_val = {};
|
||||
if ($ae_app.archives.fulltext_search_qry_str && $ae_app.archives.fulltext_search_qry_str.length > 2) {
|
||||
params_json['ft_qry'] = {
|
||||
'default_qry_str': $ae_app.archives.fulltext_search_qry_str,
|
||||
};
|
||||
}
|
||||
|
||||
if ($ae_app.archives.qry_audio || $ae_app.archives.qry_video || $ae_app.archives.qry_other) {
|
||||
params_json['and_qry'] = {};
|
||||
if ($ae_app.archives.qry_audio) params_json['and_qry']['audio'] = true;
|
||||
if ($ae_app.archives.qry_video) params_json['and_qry']['video'] = true;
|
||||
if ($ae_app.archives.qry_other) params_json['and_qry']['other'] = $ae_app.archives.qry_other;
|
||||
}
|
||||
|
||||
console.log('params_json:', params_json);
|
||||
|
||||
idaa_archive_obj_li_get_promise = api.get_ae_obj_li_for_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'archive', // Archive in this case is an IDAA archive.
|
||||
for_obj_type: 'account',
|
||||
for_obj_id: account_id,
|
||||
use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config.
|
||||
use_alt_base: false, // 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', 'created_on': 'DESC', 'updated_on': 'DESC'},
|
||||
limit: limit,
|
||||
offset: offset,
|
||||
params_json: params_json,
|
||||
params: params,
|
||||
log_lvl: 1
|
||||
})
|
||||
|
||||
.then(function (archive_obj_li_get_result) {
|
||||
if (archive_obj_li_get_result) {
|
||||
$slct.archive_obj_li = archive_obj_li_get_result;
|
||||
console.log(`Archive list:`, $slct.archive_obj_li);
|
||||
} else {
|
||||
$slct.archive_obj_li = [];
|
||||
}
|
||||
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
|
||||
return idaa_archive_obj_li_get_promise;
|
||||
}
|
||||
|
||||
async function handle_load_archive_obj({archive_id, try_cache=false}) {
|
||||
console.log('*** handle_load_archive_obj() ***');
|
||||
|
||||
// let enabled = $ae_app.archives.enabled;
|
||||
// let hidden = $ae_app.archives.hidden;
|
||||
// let limit = $ae_app.archives.limit;
|
||||
// let offset = $ae_app.archives.offset;
|
||||
|
||||
let params = {};
|
||||
|
||||
idaa_archive_obj_get_promise = api.get_ae_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'archive',
|
||||
obj_id: archive_id,
|
||||
use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config.
|
||||
use_alt_base: false, // 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 (archive_obj_get_result) {
|
||||
if (archive_obj_get_result) {
|
||||
$slct.archive_obj = archive_obj_get_result;
|
||||
// console.log($slct.archive_obj.cfg_json.content_group_sort);
|
||||
$ae_app.archives.content_group_sort = $slct.archive_obj.cfg_json.content_group_sort;
|
||||
console.log(`Archive object:`, $slct.archive_obj);
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
|
||||
return idaa_archive_obj_get_promise;
|
||||
}
|
||||
|
||||
function handle_created_archive_obj(event) {
|
||||
console.log('*** handle_created_archive_obj() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
handle_load_archive_obj({archive_id: $slct.archive_id, try_cache: false});
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.set('archive_id', $slct.archive_id);
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {'archive_id': $slct.archive_id};
|
||||
window.parent.postMessage(message, "*");
|
||||
|
||||
// $slct_trigger = 'load__archive_obj';
|
||||
$slct_trigger = 'load__archive_obj_li';
|
||||
|
||||
// $ae_app.archives.show_main__options = false;
|
||||
$ae_app.archives.show_list__archive_obj_li = false;
|
||||
$ae_app.archives.show_view__archive_obj = true;
|
||||
$ae_app.archives.show_edit__archive_obj = false;
|
||||
}
|
||||
|
||||
function handle_updated_archive_obj(event) {
|
||||
console.log('*** handle_updated_archive_obj() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
$slct_trigger = 'load__archive_obj';
|
||||
// NOTE: If the next trigger is set too quickly it will cause the one above to be missed.
|
||||
// $slct_trigger = 'load__archive_obj_li';
|
||||
|
||||
// $ae_app.archives.show_main__options = false;
|
||||
$ae_app.archives.show_list__archive_obj_li = false;
|
||||
$ae_app.archives.show_view__archive_obj = true;
|
||||
$ae_app.archives.show_edit__archive_obj = false;
|
||||
}
|
||||
|
||||
function handle_deleted_archive_obj(event) {
|
||||
console.log('*** handle_deleted_archive_obj() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete('archive_id');
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {'archive_id': null};
|
||||
window.parent.postMessage(message, "*");
|
||||
|
||||
$slct_trigger = 'load__archive_obj_li';
|
||||
|
||||
$ae_app.archives.show_main__options = true;
|
||||
$ae_app.archives.show_list__archive_obj_li = true;
|
||||
$ae_app.archives.show_view__archive_obj = false;
|
||||
$ae_app.archives.show_edit__archive_obj = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<section id="osit_idaa_archives" class="osit_archives ae_main c_idaa c_idaa_archives" bind:clientHeight={$ae_app.iframe_height}>
|
||||
<!-- <header>
|
||||
<h1>IDAA Archives</h1>
|
||||
</header> -->
|
||||
|
||||
<section class="ae_section ae_meta">
|
||||
<p>
|
||||
Novi: {$ae_app.novi_full_name}
|
||||
<span class="details">
|
||||
(
|
||||
{$ae_app.novi_email}
|
||||
{#if $ae_app.administrator_access}
|
||||
<span class="access_type administrator_access">Administrator</span>
|
||||
{:else if $ae_app.trusted_access}
|
||||
<span class="access_type trusted_access">Trusted</span>
|
||||
{/if}
|
||||
<span class="novi_uuid">UUID: {$ae_app.novi_uuid}</span>
|
||||
)
|
||||
</span>
|
||||
</p>
|
||||
<!-- <p>Page height: {window.innerHeight}</p> -->
|
||||
</section>
|
||||
|
||||
{#if $ae_app.archives.show_main__options}
|
||||
<section class="ae_section ae_options ae_column archive_obj__options">
|
||||
|
||||
<!-- <div class="note">A comment about the IDAA archives in general can go here.</div> -->
|
||||
|
||||
<div class="filters_and_search ae_group ae_row">
|
||||
|
||||
<!-- Show/hide hidden content -->
|
||||
|
||||
{#if $ae_app.trusted_access}
|
||||
{#if $ae_app.archives.hidden == 'not_hidden'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.archives.hidden = 'all';
|
||||
$ae_app.archives.limit = 150;
|
||||
$slct_trigger = 'load__archive_obj_li';
|
||||
}}
|
||||
class="btn_new_bb_post ae_btn btn_xs ae_smallest btn btn-xs btn-info"
|
||||
>
|
||||
<span class="fas fa-eye"></span> Show Hidden Archives
|
||||
</button>
|
||||
{:else}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.archives.hidden = 'not_hidden';
|
||||
$slct_trigger = 'load__archive_obj_li';
|
||||
}}
|
||||
class="btn_new_bb_post ae_btn btn_xs btn btn-xs btn-info"
|
||||
>
|
||||
<span class="fas fa-eye-slash"></span> Hide Hidden Archives
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
<!-- We only want these options to show if a specific archive is showing. -->
|
||||
{#if $ae_app.archives.show_view__archive_obj}
|
||||
{#if $ae_app.archives.hidden == 'not_hidden'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.archives.hidden = 'all';
|
||||
$ae_app.archives.limit = 150;
|
||||
$slct_trigger = 'load__archive_content_obj_li';
|
||||
}}
|
||||
class="btn_new_bb_post ae_btn btn_xs ae_smallest btn btn-xs btn-info"
|
||||
>
|
||||
<span class="fas fa-eye"></span> Show Hidden Content
|
||||
</button>
|
||||
{:else}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.archives.hidden = 'not_hidden';
|
||||
$slct_trigger = 'load__archive_content_obj_li';
|
||||
}}
|
||||
class="btn_new_bb_post ae_btn btn_xs btn btn-xs btn-info"
|
||||
>
|
||||
<span class="fas fa-eye-slash"></span> Hide Hidden Content
|
||||
</button>
|
||||
{/if}
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
<!-- For administrator access: Show/hide disabled content -->
|
||||
|
||||
{#if $ae_app.administrator_access}
|
||||
{#if $ae_app.archives.enabled == 'enabled'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.archives.hidden = 'all';
|
||||
$ae_app.archives.enabled = 'all';
|
||||
$ae_app.archives.limit = 500;
|
||||
$slct_trigger = 'load__archive_obj_li';
|
||||
}}
|
||||
class="ae_btn btn_xs ae_smallest btn btn-xs btn-warning"
|
||||
>
|
||||
<span class="fas fa-eye"></span> Show Disabled Archives
|
||||
</button>
|
||||
{:else}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.archives.enabled = 'enabled';
|
||||
$slct_trigger = 'load__archive_obj_li';
|
||||
}}
|
||||
class="ae_btn btn_xs ae_smallest btn btn-xs btn-warning"
|
||||
>
|
||||
<span class="fas fa-eye-slash"></span> Hide Disabled Archives
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
{#if $ae_app.archives.enabled == 'enabled'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.archives.hidden = 'all';
|
||||
$ae_app.archives.enabled = 'all';
|
||||
$ae_app.archives.limit = 500;
|
||||
$slct_trigger = 'load__archive_content_obj_li';
|
||||
}}
|
||||
class="ae_btn btn_xs ae_smallest btn btn-xs btn-warning"
|
||||
>
|
||||
<span class="fas fa-eye"></span> Show Disabled Content
|
||||
</button>
|
||||
{:else}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.archives.enabled = 'enabled';
|
||||
$slct_trigger = 'load__archive_content_obj_li';
|
||||
}}
|
||||
class="ae_btn btn_xs btn btn-xs btn-warning"
|
||||
>
|
||||
<span class="fas fa-eye-slash"></span> Hide Disabled Content
|
||||
</button>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
<!-- END: div filters_and_search -->
|
||||
|
||||
<div class="view_archvies_create_archive ae_group ae_row">
|
||||
{#if $slct.archive_id}
|
||||
<button
|
||||
on:click={ () => {
|
||||
|
||||
$slct.archive_id = null;
|
||||
$slct.archive_obj = {};
|
||||
|
||||
$ae_app.archives.show_main__options = true;
|
||||
$ae_app.archives.show_list__archive_obj_li = true;
|
||||
$ae_app.archives.show_view__archive_obj = false;
|
||||
$ae_app.archives.show_edit__archive_obj = false;
|
||||
// $ae_app.iframe_height_modal_body = 0;
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete('archive_id');
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {'archive_id': null};
|
||||
window.parent.postMessage(message, "*");
|
||||
}}
|
||||
class="btn_new_archive ae_btn btn btn-secondary"
|
||||
>
|
||||
<span class="fas fa-times"></span> View Other Archives
|
||||
</button>
|
||||
{/if}
|
||||
{#if $ae_app.trusted_access}
|
||||
<button
|
||||
on:click={() => {
|
||||
$slct.archive_id = null;
|
||||
$slct.archive_obj = {};
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete('archive_id');
|
||||
history.pushState({}, '', url);
|
||||
|
||||
$ae_app.archives.show_main__options = true;
|
||||
$ae_app.archives.show_list__archive_obj_li = false;
|
||||
$ae_app.archives.show_view__archive_obj = false;
|
||||
$ae_app.archives.show_edit__archive_obj = true;
|
||||
}}
|
||||
class="ae_btn ae_smallest btn_new_archive ae_btn btn btn-warning"
|
||||
>
|
||||
<span class="fas fa-plus"></span> Create new Archive
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
</section>
|
||||
{/if}
|
||||
|
||||
|
||||
{#if $ae_app.archives.show_list__archive_obj_li}
|
||||
<List_archive_obj
|
||||
on:created__archive_obj={handle_created_archive_obj}
|
||||
on:updated__archive_obj={handle_updated_archive_obj}
|
||||
on:deleted__archive_obj={handle_deleted_archive_obj}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
|
||||
{#if $ae_app.archives.show_view__archive_obj && $slct.archive_obj}
|
||||
<View_archive_obj />
|
||||
{/if}
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
{#if $ae_app.archives.show_edit__archive_obj}
|
||||
<Element_modal_v3
|
||||
show = { true }
|
||||
modal_cover_body = { false }
|
||||
report_client_dimensions = { true }
|
||||
on:close={ () => {
|
||||
$ae_app.archives.show_main__options = true;
|
||||
$ae_app.archives.show_list__archive_obj_li = true;
|
||||
$ae_app.archives.show_edit__archive_obj = false;
|
||||
$ae_app.archives.show_view__archive_obj = false;
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete('archive_id');
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {'archive_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.archive_obj.name ? $slct.archive_obj.name : 'New Archive Group')}</span>
|
||||
|
||||
<span slot="body">
|
||||
|
||||
<Edit_archive_obj
|
||||
on:created__archive_obj={handle_created_archive_obj}
|
||||
on:updated__archive_obj={handle_updated_archive_obj}
|
||||
on:deleted__archive_obj={handle_deleted_archive_obj}
|
||||
/>
|
||||
|
||||
</span>
|
||||
</Element_modal_v3>
|
||||
{/if}
|
||||
|
||||
|
||||
<!-- {#if $ae_app.archives.show_view__archive_obj && $slct.archive_obj}
|
||||
<Element_modal_v3
|
||||
show = { true }
|
||||
modal_cover_body = { true }
|
||||
report_modal_dimensions = { true }
|
||||
on:close={ () => {
|
||||
|
||||
$slct.archive_id = null;
|
||||
$slct.archive_obj = {};
|
||||
|
||||
$ae_app.archives.show_main__options = true;
|
||||
$ae_app.archives.show_list__archive_obj_li = true;
|
||||
$ae_app.archives.show_view__archive_obj = false;
|
||||
$ae_app.archives.show_edit__archive_obj = false;
|
||||
$ae_app.iframe_height_modal_body = 0;
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete('archive_id');
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {'archive_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.archive_obj.name}</span>
|
||||
|
||||
<span slot="body">
|
||||
|
||||
<View_archive_obj />
|
||||
|
||||
</span>
|
||||
</Element_modal_v3>
|
||||
{/if} -->
|
||||
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,706 @@
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher, onDestroy, onMount } from 'svelte';
|
||||
import { fade } from 'svelte/transition';
|
||||
|
||||
import { ae, api, Element_input, Element_input_file_hashing } from 'aether_npm_lib';
|
||||
import { slct, ae_app } from './stores';
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
type key_val = {
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
$ae_app.archives.input_file_list = []
|
||||
|
||||
let create_archive_content_obj_promise: any;
|
||||
let delete_archive_content_obj_promise: any;
|
||||
let update_archive_content_obj_promise: any;
|
||||
let upload__hosted_file_obj_promise: any;
|
||||
|
||||
let disable_submit_btn = true;
|
||||
|
||||
if ($slct.archive_content_id) {
|
||||
console.log(`Archive Content ID selected: ${$slct.archive_content_id}`);
|
||||
console.log(`Archive Content Object selected: ${$slct.archive_content_obj}`)
|
||||
} else {
|
||||
$slct.archive_content_id = null;
|
||||
$slct.archive_content_obj = {
|
||||
archive_id_random: null,
|
||||
// archive_content_id_random: null,
|
||||
archive_content_type: null,
|
||||
name: null,
|
||||
description: null,
|
||||
content_html: null,
|
||||
// hosted_file_id_random: null,
|
||||
file_path: null,
|
||||
filename: null,
|
||||
file_extension: null,
|
||||
original_datetime: null,
|
||||
original_timezone: null,
|
||||
original_location: null,
|
||||
original_url: null,
|
||||
original_url_text: null,
|
||||
access_key: null, // or passcode?
|
||||
|
||||
enable: true,
|
||||
hide: false,
|
||||
priority: null,
|
||||
sort: null,
|
||||
notes: null,
|
||||
};
|
||||
console.log(`Archive Content Object started: ${$slct.archive_content_obj}`)
|
||||
}
|
||||
|
||||
|
||||
if ($slct.archive_content_obj) {
|
||||
|
||||
} else {
|
||||
console.log(`Archive Content Object started: ${$slct.archive_content_obj}`)
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** Edit - Archive Content Obj');
|
||||
|
||||
tinymce_remove(); // This seems to fix rendering issues
|
||||
tinymce_init();
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
console.log('** Component Destroyed: ** Edit - Event Obj');
|
||||
tinymce_remove(); // This seems like the right thing to do
|
||||
});
|
||||
|
||||
|
||||
// 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.archive_content_obj) {
|
||||
console.log('Selected archive_content object changed?');
|
||||
console.log($slct.archive_content_obj);
|
||||
|
||||
if ($slct.archive_content_obj == null) {
|
||||
$slct.archive_content_obj = {title: null, content: null, name: null, description: null, notes: null, created_on: null, updated_on: null};
|
||||
} else {
|
||||
disable_submit_btn = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function handle_submit_form(event) {
|
||||
console.log('*** handle_submit_form() ***');
|
||||
|
||||
disable_submit_btn = true;
|
||||
|
||||
let form_data = new FormData(event.target);
|
||||
console.log(form_data);
|
||||
|
||||
let form_archive_content_data = ae.util.extract_prefixed_form_data({prefix: null, form_data: form_data, trim_values: true, bool_tf_str: true, log_lvl: 0});
|
||||
console.log(form_archive_content_data);
|
||||
|
||||
let archive_content_data: key_val = {};
|
||||
|
||||
if (!$slct.archive_content_id) {
|
||||
archive_content_data['account_id_random'] = $ae_app.account_id;
|
||||
archive_content_data['archive_id_random'] = $slct.archive_id;
|
||||
// archive_content_data['enable'] = true;
|
||||
}
|
||||
|
||||
archive_content_data['name'] = form_archive_content_data.name;
|
||||
if (tinyMCE.get('description')) {
|
||||
archive_content_data['description'] = tinyMCE.get('description').getContent();
|
||||
} else {
|
||||
archive_content_data['description'] = form_archive_content_data.description;
|
||||
}
|
||||
|
||||
if (tinyMCE.get('content_html')) {
|
||||
archive_content_data['content_html'] = tinyMCE.get('content_html').getContent();
|
||||
} else {
|
||||
archive_content_data['content_html'] = form_archive_content_data.content_html;
|
||||
}
|
||||
|
||||
if (form_archive_content_data.archive_content_type) {
|
||||
archive_content_data['archive_content_type'] = form_archive_content_data.archive_content_type;
|
||||
} else {
|
||||
archive_content_data['archive_content_type'] = null;
|
||||
}
|
||||
|
||||
archive_content_data['enable_for_public'] = !!!form_archive_content_data.enable_for_public;
|
||||
|
||||
archive_content_data['file_path'] = form_archive_content_data.file_path;
|
||||
archive_content_data['filename'] = form_archive_content_data.filename.trim();
|
||||
archive_content_data['file_extension'] = form_archive_content_data.file_extension.trim();
|
||||
|
||||
let date_time_str = null;
|
||||
let date_part = form_archive_content_data.original_datetime_date.trim();
|
||||
let time_part = form_archive_content_data.original_datetime_time.trim();
|
||||
if (date_part && time_part) {
|
||||
date_time_str = `${date_part} ${time_part}`;
|
||||
} else if (date_part) {
|
||||
date_time_str = `${date_part}T00:00:00`;
|
||||
} else if (time_part) {
|
||||
// date_time_str = `${time_part}`;
|
||||
date_time_str = false;
|
||||
}
|
||||
archive_content_data['original_datetime'] = date_time_str;
|
||||
|
||||
archive_content_data['original_timezone'] = form_archive_content_data.original_timezone;
|
||||
|
||||
archive_content_data['original_location'] = form_archive_content_data.original_location;
|
||||
|
||||
archive_content_data['hide'] = !!form_archive_content_data.hide;
|
||||
archive_content_data['priority'] = !!form_archive_content_data.priority;
|
||||
if (form_archive_content_data.sort) {
|
||||
// Change this to a number type
|
||||
archive_content_data['sort'] = Number(form_archive_content_data.sort);
|
||||
} else {
|
||||
archive_content_data['sort'] = null;
|
||||
}
|
||||
if (form_archive_content_data.group) {
|
||||
archive_content_data['group'] = form_archive_content_data.group;
|
||||
} else {
|
||||
archive_content_data['group'] = null;
|
||||
}
|
||||
if (archive_content_data['enable']) {
|
||||
archive_content_data['enable'] = !!form_archive_content_data.enable;
|
||||
}
|
||||
|
||||
if (tinyMCE.get('notes')) {
|
||||
archive_content_data['notes'] = tinyMCE.get('notes').getContent();
|
||||
} else {
|
||||
archive_content_data['notes'] = form_archive_content_data.notes;
|
||||
}
|
||||
|
||||
console.log(archive_content_data);
|
||||
|
||||
if (!$slct.archive_content_id) {
|
||||
create_archive_content_obj_promise = api.create_ae_obj_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'archive_content',
|
||||
fields: archive_content_data,
|
||||
key: $ae_app.ae_api.api_crud_super_key,
|
||||
log_lvl: 1
|
||||
})
|
||||
.then(async function (archive_content_obj_create_result) {
|
||||
if (!archive_content_obj_create_result) {
|
||||
console.log('The result was null or false.');
|
||||
return false;
|
||||
}
|
||||
|
||||
$slct.archive_content_id = archive_content_obj_create_result.obj_id_random;
|
||||
|
||||
// Get ready to upload the file now that we have a new archive_content_id.
|
||||
const form_data = new FormData();
|
||||
|
||||
form_data.append('account_id', $ae_app.account_id);
|
||||
form_data.append('link_to_type', 'archive_content');
|
||||
form_data.append('link_to_id', $slct.archive_content_id);
|
||||
|
||||
for (let i = 0; i < event.target.file_list.files.length; i++) {
|
||||
form_data.append(`file_list`, event.target.archive_content_file_upload_list.files[i]);
|
||||
}
|
||||
|
||||
let params = null;
|
||||
|
||||
let endpoint = '/hosted_file/upload_files';
|
||||
|
||||
console.log(form_data);
|
||||
|
||||
params = null;
|
||||
|
||||
// Uncomment and the post_promise is not seen by the "await" below
|
||||
// post_promise = await api.post_object({api_cfg: $cfg.api, endpoint: endpoint, params: params, data:form_data});
|
||||
// Uncomment so that the post_promise is not seen by the "await" below
|
||||
upload__hosted_file_obj_promise = await api.post_object({api_cfg: $ae_app.ae_api, endpoint: endpoint, params: params, form_data: form_data});
|
||||
console.log(upload__hosted_file_obj_promise);
|
||||
let hosted_file_id = upload__hosted_file_obj_promise[0].hosted_file_id_random;
|
||||
|
||||
archive_content_data = {};
|
||||
archive_content_data['hosted_file_id_random'] = hosted_file_id;
|
||||
archive_content_data['file_path'] = `/hosted_file/download/${hosted_file_id}?filename=${form_archive_content_data.filename.trim()}`;
|
||||
archive_content_data['archive_content_type'] = 'hosted_file';
|
||||
|
||||
update_archive_content_obj_promise = await api.update_ae_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'archive_content',
|
||||
obj_id: $slct.archive_content_id,
|
||||
fields: archive_content_data,
|
||||
key: $ae_app.ae_api.api_crud_super_key,
|
||||
log_lvl: 1
|
||||
})
|
||||
.then(function (archive_content_obj_update_result) {
|
||||
if (!archive_content_obj_update_result) {
|
||||
console.log('The result was null or false.');
|
||||
return false;
|
||||
}
|
||||
return archive_content_obj_update_result;
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('Something went wrong.');
|
||||
console.log(error);
|
||||
return false;
|
||||
});
|
||||
|
||||
// update_archive_content_obj_promise = await update_archive_content_obj({archive_content_id: $slct.archive_content_id, data: archive_content_data})
|
||||
// console.log(update_archive_content_obj_promise);
|
||||
return update_archive_content_obj_promise
|
||||
})
|
||||
.then(function (archive_content_obj_create_result) {
|
||||
|
||||
dispatch(
|
||||
'created__archive_content_obj',
|
||||
{
|
||||
archive_content_id: $slct.archive_content_id,
|
||||
}
|
||||
);
|
||||
|
||||
return archive_content_obj_create_result;
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('Something went wrong.');
|
||||
console.log(error);
|
||||
return false;
|
||||
});
|
||||
|
||||
return create_archive_content_obj_promise;
|
||||
|
||||
} else {
|
||||
update_archive_content_obj_promise = api.update_ae_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'archive_content',
|
||||
obj_id: $slct.archive_content_id,
|
||||
fields: archive_content_data,
|
||||
key: $ae_app.ae_api.api_crud_super_key,
|
||||
log_lvl: 1
|
||||
})
|
||||
.then(function (archive_content_obj_update_result) {
|
||||
if (!archive_content_obj_update_result) {
|
||||
console.log('The result was null or false.');
|
||||
return false;
|
||||
}
|
||||
|
||||
dispatch(
|
||||
'updated__archive_content_obj',
|
||||
{
|
||||
archive_content_id: $slct.archive_content_id,
|
||||
}
|
||||
);
|
||||
|
||||
return archive_content_obj_update_result;
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('Something went wrong.');
|
||||
console.log(error);
|
||||
return false;
|
||||
});
|
||||
|
||||
return update_archive_content_obj_promise;
|
||||
}
|
||||
}
|
||||
|
||||
function handle_input_file_list_updated(event) {
|
||||
console.log(event.detail.element_id);
|
||||
console.log(event.detail.input_file_list);
|
||||
console.log(event.detail.input_file_list_processed);
|
||||
|
||||
// This now needs be reviewed and possibly updated with additional information. Check if any files have already been uploaded in the past and ignore.
|
||||
let new_upload_list = event.detail.input_file_list_processed;
|
||||
$ae_app.archives.input_file_list = new_upload_list;
|
||||
// Setting the first file as the default. For now other files are ignored?
|
||||
if (new_upload_list.length) {
|
||||
$ae_app.archives.input_filename = new_upload_list[0].filename;
|
||||
$ae_app.archives.input_file_extension = new_upload_list[0].guessed_extension;
|
||||
} else {
|
||||
$ae_app.archives.input_filename = '';
|
||||
$ae_app.archives.input_file_extension = '';
|
||||
}
|
||||
|
||||
// for (let file_upload_item of new_upload_list) {
|
||||
// console.log(file_upload_item);
|
||||
|
||||
// filename = file_upload_item.filename;
|
||||
// file_extension = file_upload_item.guessed_extension;
|
||||
// }
|
||||
}
|
||||
|
||||
$ae_app.archives.form_file_upload_list = [];
|
||||
|
||||
async function handle_delete_archive_content_obj({archive_content_id, hosted_file_id=null, method='delete'}) {
|
||||
console.log('*** handle_delete_archive_content_obj() ***');
|
||||
|
||||
if (hosted_file_id) {
|
||||
let delete_hosted_file_obj_promise = api.delete_hosted_file({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
hosted_file_id: hosted_file_id,
|
||||
link_to_type: 'archive_content',
|
||||
link_to_id: archive_content_id,
|
||||
rm_orphan: true,
|
||||
// params: params,
|
||||
key: $ae_app.ae_api.api_crud_super_key,
|
||||
log_lvl: 2
|
||||
})
|
||||
.then(function (hosted_file_obj_delete_result) {
|
||||
if (hosted_file_obj_delete_result) {
|
||||
// console.log(`Result:`, hosted_file_obj_delete_result);
|
||||
|
||||
dispatch(
|
||||
'deleted__hosted_file_obj',
|
||||
{
|
||||
hosted_file_id: hosted_file_id,
|
||||
}
|
||||
);
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('The result was null or false when trying to delete.', error);
|
||||
});
|
||||
}
|
||||
|
||||
delete_archive_content_obj_promise = api.delete_ae_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'archive_content',
|
||||
obj_id: archive_content_id,
|
||||
method: method,
|
||||
// params: params,
|
||||
key: $ae_app.ae_api.api_crud_super_key,
|
||||
log_lvl: 0
|
||||
})
|
||||
.then(function (archive_content_obj_delete_result) {
|
||||
if (archive_content_obj_delete_result) {
|
||||
// console.log(`Result:`, archive_content_obj_delete_result);
|
||||
|
||||
dispatch(
|
||||
'deleted__archive_content_obj',
|
||||
{
|
||||
archive_content_id: archive_content_id,
|
||||
}
|
||||
);
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('The result was null or false when trying to delete.', error);
|
||||
});
|
||||
|
||||
return delete_archive_content_obj_promise;
|
||||
}
|
||||
|
||||
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: Regular version of the TinyMCE editor
|
||||
tinymce.init({
|
||||
selector: '.tinymce_editor.editor_regular',
|
||||
// width: 600,
|
||||
height: 400,
|
||||
plugins: [ 'advlist', 'autolink', 'link', 'lists', 'anchor', 'code', 'help' ],
|
||||
menubar: false,
|
||||
toolbar: 'undo redo | styles | bold italic | alignleft aligncenter alignright | bullist numlist outdent indent | link | code | help',
|
||||
});
|
||||
|
||||
// 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_regular');
|
||||
tinymce.remove('.tinymce_editor.editor_basic');
|
||||
tinymce.remove('.tinymce_editor.editor_basic_200');
|
||||
tinymce.remove('.tinymce_editor.editor_less_100');
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<section
|
||||
class="svelte_component ae_edit archive_content_obj"
|
||||
class:ae_create={!$slct.archive_content_id}
|
||||
>
|
||||
<!-- bind:clientHeight={ae_iframe_height} -->
|
||||
|
||||
<form on:submit|preventDefault={handle_submit_form} class="">
|
||||
|
||||
{#await update_archive_content_obj_promise}
|
||||
<div class="awaiting alert_msg_pulse" out:fade={{ duration: 2000 }}>Saving...</div>
|
||||
{:then}
|
||||
{#if update_archive_content_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>Archive Content</h3>
|
||||
|
||||
<label for="title">Name of Content
|
||||
<input type="text" id="name" name="name" required max="200" value={$slct.archive_content_obj.name ? $slct.archive_content_obj.name : '' } placeholder="Content name">
|
||||
</label>
|
||||
|
||||
<label for="description">Description
|
||||
<textarea id="description" name="description" rows="6" cols="80" value={$slct.archive_content_obj.description ? $slct.archive_content_obj.description : ''} class="ae_value archive_content__description tinymce_editor editor_basic_200"></textarea>
|
||||
</label>
|
||||
|
||||
<label for="content_html">Content (HTML)
|
||||
<textarea id="content_html" name="content_html" rows="6" cols="80" value={$slct.archive_content_obj.content_html ? $slct.archive_content_obj.content_html : ''} class="ae_value archive_content__content_html tinymce_editor editor_regular"></textarea>
|
||||
</label>
|
||||
|
||||
<label for="archive_content_type">Type
|
||||
<select id="archive_content_type" name="archive_content_type" value={$slct.archive_content_obj.archive_content_type}>
|
||||
<option value="">-- None --</option>
|
||||
<option value="hosted_file">Hosted File in Æ</option>
|
||||
<option value="html">Hosted HTML in Æ</option>
|
||||
<option value="json">Hosted JSON in Æ</option>
|
||||
<option value="url">External URL</option>
|
||||
<option value="other">Other</option>
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<fieldset class="">
|
||||
<legend class="">Public Access with Rotating Access Key/Passcode</legend>
|
||||
<label for="enable_for_public_no" class="">No, disable public access
|
||||
<input
|
||||
type="radio"
|
||||
class=""
|
||||
id="enable_for_public_no"
|
||||
name="enable_for_public"
|
||||
value={false}
|
||||
bind:group={$slct.archive_content_obj.enable_for_public}
|
||||
>
|
||||
<!-- <input type="radio" class="" id="enable_for_public_no" name="enable_for_public" value="0" checked={(!$slct.archive_content_obj.enable_for_public)} required> -->
|
||||
</label>
|
||||
<label for="enable_for_public_yes" class="">Yes, allow public access
|
||||
<input
|
||||
type="radio"
|
||||
class=""
|
||||
id="enable_for_public_yes"
|
||||
name="enable_for_public"
|
||||
value={true}
|
||||
bind:group={$slct.archive_content_obj.enable_for_public}
|
||||
>
|
||||
<!-- <input type="radio" class="" id="enable_for_public_yes" name="enable_for_public" value="1" checked={($slct.archive_content_obj.enable_for_public)} required > -->
|
||||
</label>
|
||||
</fieldset>
|
||||
|
||||
|
||||
<h3>File?</h3>
|
||||
{#if !$slct.archive_content_id}
|
||||
<Element_input_file_hashing
|
||||
multiple = {false}
|
||||
required = {true}
|
||||
accept = {''}
|
||||
element_id = {'archive_content_file_upload_list'}
|
||||
|
||||
on:input_file_list_updated = {handle_input_file_list_updated}
|
||||
use_selected_file_table={true}
|
||||
/>
|
||||
<!-- bind:input_file_list = {$ae_app.archives.form_file_upload_list} -->
|
||||
{/if}
|
||||
|
||||
<label for="file_path">File Path
|
||||
{#if !$ae_app.administrator_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="file_path"
|
||||
name="file_path"
|
||||
value={($slct.archive_content_obj.file_path ? $slct.archive_content_obj.file_path : '')}
|
||||
readonly={!$ae_app.administrator_access}
|
||||
>
|
||||
</label>
|
||||
|
||||
<label for="filename">Filename
|
||||
<input type="text" id="filename" name="filename" value={($slct.archive_content_obj.filename ? $slct.archive_content_obj.filename : $ae_app.archives.input_filename)}>
|
||||
</label>
|
||||
|
||||
<label for="file_extension">File Extension
|
||||
{#if !$ae_app.administrator_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="file_extension"
|
||||
name="file_extension"
|
||||
value={($slct.archive_content_obj.file_extension ? $slct.archive_content_obj.file_extension : $ae_app.archives.input_file_extension)}
|
||||
readonly={!$ae_app.administrator_access}
|
||||
>
|
||||
</label>
|
||||
|
||||
<h3>Original</h3>
|
||||
<label for="original_datetime">Original Date/Time
|
||||
<input type="date" id="original_datetime_date" name="original_datetime_date" value={($slct.archive_content_obj.original_datetime ? ae.util.iso_datetime_formatter($slct.archive_content_obj.original_datetime,'date_iso') : '')} placeholder="YYYY-MM-DD">
|
||||
<input type="time" id="original_datetime_time" name="original_datetime_time" value={($slct.archive_content_obj.original_datetime ? ae.util.iso_datetime_formatter($slct.archive_content_obj.original_datetime,'time_iso') : '')} placeholder="HH:MM AM/PM">
|
||||
</label>
|
||||
|
||||
<fieldset class="flex_row flex_gap_md flex_justify_around">
|
||||
<label for="original_timezone">Original Timezone
|
||||
{#if $ae_app.lu_time_zone_list}
|
||||
<select name="original_timezone" id="original_timezone" required>
|
||||
{#each $ae_app.lu_time_zone_list as lu_timezone}
|
||||
<option value="{lu_timezone.name}" selected={((($slct.archive_content_obj.original_timezone && lu_timezone.name == $slct.archive_content_obj.original_timezone) || lu_timezone.name == $ae_app.current_timezone) ? 'selected' : '')}>{lu_timezone.name}</option>
|
||||
{/each}
|
||||
</select>
|
||||
{:else}
|
||||
<input type="text" name="timezone" value={($slct.archive_content_obj.original_timezone ? $slct.archive_content_obj.original_timezone : $ae_app.current_timezone)} />
|
||||
{/if}
|
||||
</label>
|
||||
</fieldset>
|
||||
|
||||
<!-- <label for="original_timezone">Original Timezone
|
||||
<input type="text" id="original_timezone" name="original_timezone" value={$slct.archive_content_obj.original_timezone} list="timezones">
|
||||
<datalist id="timezones">
|
||||
<option value="UTC">UTC</option>
|
||||
<option value="America/New_York">America/New York</option>
|
||||
<option value="America/Chicago">America/Chicago</option>
|
||||
<option value="America/Denver">America/Denver</option>
|
||||
<option value="America/Phoenix">America/Phoenix</option>
|
||||
<option value="America/Los_Angeles">America/Los Angeles</option>
|
||||
<option value="America/Anchorage">America/Anchorage</option>
|
||||
<option value="America/Adak">America/Adak</option>
|
||||
<option value="Pacific/Honolulu">Pacific/Honolulu</option>
|
||||
<option value="Pacific/Midway">Pacific/Midway</option>
|
||||
<option value="US/Eastern">US/Eastern</option>
|
||||
<option value="US/Central">US/Central</option>
|
||||
<option value="US/Mountain">US/Mountain</option>
|
||||
<option value="US/Pacific">US/Pacific</option>
|
||||
<option value="US/Alaska">US/Alaska</option>
|
||||
<option value="US/Hawaii">US/Hawaii</option>
|
||||
<option value="US/Samoa">US/Samoa</option>
|
||||
<option value="US/Aleutian">US/Aleutian</option>
|
||||
<option value="US/Arizona">US/Arizona</option>
|
||||
<option value="US/Michigan">US/Michigan</option>
|
||||
</datalist>
|
||||
</label> -->
|
||||
|
||||
<label for="original_location">Original Location
|
||||
<input type="text" id="original_location" name="original_location" value={$slct.archive_content_obj.original_location}>
|
||||
</label>
|
||||
|
||||
|
||||
{#if $ae_app.trusted_access}
|
||||
<section class="ae_section archive_content__admin_options"> <!-- BEGIN: section archive_content__admin_options -->
|
||||
|
||||
<h3>
|
||||
Admin Options
|
||||
<button type="button" class="ae_btn ae_smallest ae_d_none_toggle ae_float_right btn btn-xs btn-info" on:click={() => {document.querySelector('.ae_d_none_content').classList.toggle('ae_d_none');}}><span class="fas fa-eye"></span> Show/Hide Admin</button>
|
||||
</h3>
|
||||
|
||||
<span class="ae_d_none_content ae_d_none">
|
||||
<label>Hide
|
||||
<input
|
||||
type="checkbox"
|
||||
name="hide"
|
||||
id="hide"
|
||||
bind:checked={$slct.archive_content_obj.hide}
|
||||
>
|
||||
<!-- <input type="checkbox" name="hide" value={$slct.archive_content_obj.hide} /> -->
|
||||
</label>
|
||||
|
||||
<label>Priority
|
||||
<input
|
||||
type="checkbox"
|
||||
name="priority"
|
||||
id="priority"
|
||||
bind:checked={$slct.archive_content_obj.priority}
|
||||
>
|
||||
<!-- <input type="checkbox" name="priority" value={$slct.archive_content_obj.priority} /> -->
|
||||
</label>
|
||||
|
||||
<label>Sort <input type="number" name="sort" value={$slct.archive_content_obj.sort} /></label>
|
||||
|
||||
<label>Group <input type="text" name="group" value={$slct.archive_content_obj.group} max="100" /></label>
|
||||
|
||||
{#if $ae_app.administrator_access}
|
||||
<label>Enable
|
||||
<input
|
||||
type="checkbox"
|
||||
name="enable"
|
||||
id="enable"
|
||||
bind:checked={$slct.archive_content_obj.enable}
|
||||
>
|
||||
<!-- <input type="checkbox" name="enable" value={$slct.archive_content_obj.enable} checked={$slct.archive_content_obj.enable} /> -->
|
||||
</label>
|
||||
{/if}
|
||||
|
||||
<label>Internal Staff Notes
|
||||
<textarea id="notes" name="notes" class="ae_value archive_content__notes tinymce_editor editor_basic_200" rows="2" cols="70" value={$slct.archive_content_obj.notes}></textarea>
|
||||
</label>
|
||||
|
||||
</span> <!-- END: span ae_show_hide_content -->
|
||||
|
||||
</section> <!-- END: section archive_content__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 Archive Content</button>
|
||||
|
||||
{#if $slct.archive_content_id}
|
||||
<button
|
||||
on:click={() => {
|
||||
if (!confirm('Are you sure you want to delete this archive content?')) {return false;}
|
||||
handle_delete_archive_content_obj({archive_content_id: $slct.archive_content_id, hosted_file_id: $slct.archive_content_obj.hosted_file_id_random});
|
||||
|
||||
$slct.archive_content_id = null;
|
||||
$slct.archive_content_obj = {};
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-danger" type="button">
|
||||
<span class="fas fa-minus"></span> Delete
|
||||
</button>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
</form>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<style>
|
||||
</style>
|
||||
588
src/routes/idaa/(idaa)/archives/10_edit__archive_obj.svelte
Normal file
588
src/routes/idaa/(idaa)/archives/10_edit__archive_obj.svelte
Normal file
@@ -0,0 +1,588 @@
|
||||
<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_archive_obj_promise: any;
|
||||
let delete_archive_obj_promise: any;
|
||||
let update_archive_obj_promise: any;
|
||||
|
||||
let disable_submit_btn = true;
|
||||
|
||||
if ($slct.archive_id) {
|
||||
console.log(`Archive ID selected: ${$slct.archive_id}`);
|
||||
console.log(`Archive Object selected: ${$slct.archive_obj}`)
|
||||
} else {
|
||||
$slct.archive_id = null;
|
||||
$slct.archive_obj = {
|
||||
title: null,
|
||||
content: null,
|
||||
topic_id: null,
|
||||
anonymous: false,
|
||||
external_person_id: $ae_app.novi_uuid,
|
||||
full_name: $ae_app.novi_full_name,
|
||||
email: $ae_app.novi_email,
|
||||
|
||||
sort: null,
|
||||
notes: null,
|
||||
};
|
||||
console.log(`Archive Object started: ${$slct.archive_obj}`)
|
||||
}
|
||||
|
||||
|
||||
if ($slct.archive_obj) {
|
||||
|
||||
} else {
|
||||
// $slct.archive_obj = {name: 'null', description: 'null'};
|
||||
console.log(`Archive Object started: ${$slct.archive_obj}`)
|
||||
}
|
||||
|
||||
if ($ae_app.lu_time_zone_list && $ae_app.lu_time_zone_list.length > 0) {
|
||||
// console.log('Already have time zone list!', $ae_app.lu_time_zone_list);
|
||||
} else {
|
||||
console.log('No time zone list');
|
||||
|
||||
let lu_time_zone_li_get_promise = api.get_ae_obj_li_for_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'lu', // "lu" = a lookup table
|
||||
for_obj_type: 'time_zone',
|
||||
enabled: null,
|
||||
hidden: null,
|
||||
// order_by_li: {'name': 'ASC'},
|
||||
log_lvl: 1
|
||||
})
|
||||
|
||||
.then(function (lu_time_zone_li_get_result) {
|
||||
if (lu_time_zone_li_get_result) {
|
||||
$ae_app.lu_time_zone_list = lu_time_zone_li_get_result;
|
||||
console.log(`Time zone list:`, $ae_app.lu_time_zone_list);
|
||||
console.log($ae_app.lu_time_zone_list[0]);
|
||||
console.log($ae_app.lu_time_zone_list[10]);
|
||||
} else {
|
||||
console.log(`No time zones returned!`);
|
||||
$ae_app.lu_time_zone_list = [];
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** Edit - Event Obj');
|
||||
|
||||
tinymce_remove(); // This seems to fix rendering issues
|
||||
tinymce_init();
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
console.log('** Component Destroyed: ** Edit - Event Obj');
|
||||
tinymce_remove(); // This seems like the right thing to do
|
||||
});
|
||||
|
||||
|
||||
// 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.archive_obj) {
|
||||
console.log('Selected archive object changed?');
|
||||
console.log($slct.archive_obj);
|
||||
|
||||
if ($slct.archive_obj == null) {
|
||||
$slct.archive_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() ***');
|
||||
|
||||
disable_submit_btn = true;
|
||||
|
||||
let form_data = new FormData(event.target);
|
||||
console.log(form_data);
|
||||
|
||||
let form_archive_data = ae.util.extract_prefixed_form_data({prefix: null, form_data: form_data, trim_values: true, bool_tf_str: true, log_lvl: 0});
|
||||
console.log(form_archive_data);
|
||||
|
||||
let archive_data: key_val = {};
|
||||
|
||||
if (!$slct.archive_id) {
|
||||
archive_data['account_id_random'] = $ae_app.account_id;
|
||||
archive_data['enable'] = true;
|
||||
}
|
||||
|
||||
archive_data['name'] = form_archive_data.name;
|
||||
if (tinyMCE.get('description')) {
|
||||
archive_data['description'] = tinyMCE.get('description').getContent();
|
||||
} else {
|
||||
archive_data['description'] = form_archive_data.description;
|
||||
}
|
||||
|
||||
if (tinyMCE.get('content_html')) {
|
||||
archive_data['content_html'] = tinyMCE.get('content_html').getContent();
|
||||
} else {
|
||||
archive_data['content_html'] = form_archive_data.content_html;
|
||||
}
|
||||
|
||||
let date_time_str = null;
|
||||
let date_part = form_archive_data.original_datetime_date.trim();
|
||||
let time_part = form_archive_data.original_datetime_time.trim();
|
||||
if (date_part && time_part) {
|
||||
date_time_str = `${date_part} ${time_part}`;
|
||||
} else if (date_part) {
|
||||
date_time_str = `${date_part}T00:00:00`;
|
||||
} else if (time_part) {
|
||||
// date_time_str = `${time_part}`;
|
||||
date_time_str = false;
|
||||
}
|
||||
archive_data['original_datetime'] = date_time_str;
|
||||
|
||||
archive_data['original_timezone'] = form_archive_data.original_timezone;
|
||||
|
||||
archive_data['original_location'] = form_archive_data.original_location;
|
||||
|
||||
archive_data['original_url'] = form_archive_data.original_url;
|
||||
archive_data['original_url_text'] = form_archive_data.original_url_text;
|
||||
|
||||
archive_data['hide'] = !!form_archive_data.hide;
|
||||
archive_data['priority'] = !!form_archive_data.priority;
|
||||
if (form_archive_data.sort) {
|
||||
archive_data['sort'] = Number(form_archive_data.sort);
|
||||
} else {
|
||||
archive_data['sort'] = null;
|
||||
}
|
||||
if (form_archive_data.group) {
|
||||
archive_data['group'] = form_archive_data.group;
|
||||
} else {
|
||||
archive_data['group'] = null;
|
||||
}
|
||||
|
||||
if (form_archive_data.enable) {
|
||||
archive_data['enable'] = !!form_archive_data.enable;
|
||||
}
|
||||
|
||||
if (tinyMCE.get('notes')) {
|
||||
archive_data['notes'] = tinyMCE.get('notes').getContent();
|
||||
} else {
|
||||
archive_data['notes'] = form_archive_data.notes;
|
||||
}
|
||||
|
||||
console.log(archive_data);
|
||||
|
||||
if (!$slct.archive_id) {
|
||||
create_archive_obj_promise = api.create_ae_obj_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'archive',
|
||||
fields: archive_data,
|
||||
key: $ae_app.ae_api.api_crud_super_key,
|
||||
log_lvl: 1
|
||||
})
|
||||
.then(function (archive_obj_create_result) {
|
||||
if (!archive_obj_create_result) {
|
||||
console.log('The result was null or false.');
|
||||
return false;
|
||||
}
|
||||
|
||||
$slct.archive_id = archive_obj_create_result.obj_id_random;
|
||||
|
||||
dispatch(
|
||||
'created__archive_obj',
|
||||
{
|
||||
archive_id: $slct.archive_id,
|
||||
}
|
||||
);
|
||||
|
||||
return archive_obj_create_result;
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('Something went wrong.');
|
||||
console.log(error);
|
||||
return false;
|
||||
});
|
||||
|
||||
return create_archive_obj_promise;
|
||||
|
||||
} else {
|
||||
update_archive_obj_promise = api.update_ae_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'archive',
|
||||
obj_id: $slct.archive_id,
|
||||
fields: archive_data,
|
||||
key: $ae_app.ae_api.api_crud_super_key,
|
||||
log_lvl: 1
|
||||
})
|
||||
.then(function (archive_obj_update_result) {
|
||||
if (!archive_obj_update_result) {
|
||||
console.log('The result was null or false.');
|
||||
return false;
|
||||
}
|
||||
|
||||
dispatch(
|
||||
'updated__archive_obj',
|
||||
{
|
||||
archive_id: $slct.archive_id,
|
||||
}
|
||||
);
|
||||
|
||||
return archive_obj_update_result;
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('Something went wrong.');
|
||||
console.log(error);
|
||||
return false;
|
||||
});
|
||||
|
||||
return update_archive_obj_promise;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function handle_delete_archive_obj({archive_id, method='delete'}) {
|
||||
console.log('*** handle_delete_archive_obj() ***');
|
||||
|
||||
delete_archive_obj_promise = api.delete_ae_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'archive',
|
||||
obj_id: archive_id,
|
||||
method: method,
|
||||
// params: params,
|
||||
key: $ae_app.ae_api.api_crud_super_key,
|
||||
log_lvl: 0
|
||||
})
|
||||
.then(function (archive_obj_delete_result) {
|
||||
if (archive_obj_delete_result) {
|
||||
// console.log(`Result:`, archive_obj_delete_result);
|
||||
|
||||
dispatch(
|
||||
'deleted__archive_obj',
|
||||
{
|
||||
archive_id: archive_id,
|
||||
}
|
||||
);
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('The result was null or false when trying to delete.', error);
|
||||
});
|
||||
|
||||
return delete_archive_obj_promise;
|
||||
}
|
||||
|
||||
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: Regular version of the TinyMCE editor
|
||||
tinymce.init({
|
||||
selector: '.tinymce_editor.editor_regular',
|
||||
// width: 600,
|
||||
height: 400,
|
||||
plugins: [ 'advlist', 'autolink', 'link', 'lists', 'anchor', 'code', 'help' ],
|
||||
menubar: false,
|
||||
toolbar: 'undo redo | styles | bold italic | alignleft aligncenter alignright | bullist numlist outdent indent | link | code | help',
|
||||
});
|
||||
|
||||
// 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_regular');
|
||||
tinymce.remove('.tinymce_editor.editor_basic');
|
||||
tinymce.remove('.tinymce_editor.editor_basic_200');
|
||||
tinymce.remove('.tinymce_editor.editor_less_100');
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<section
|
||||
class="svelte_component ae_edit archive_obj"
|
||||
class:ae_create={!$slct.archive_id}
|
||||
bind:clientHeight={$ae_app.iframe_height_modal_body}
|
||||
>
|
||||
|
||||
<form on:submit|preventDefault={handle_submit_form} class="">
|
||||
|
||||
{#await update_archive_obj_promise}
|
||||
<div class="awaiting alert_msg_pulse" out:fade={{ duration: 2000 }}>Saving...</div>
|
||||
{:then}
|
||||
{#if update_archive_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>Archive</h3>
|
||||
|
||||
<label for="name">Name of Archive
|
||||
<input type="text" id="name" name="name" required max="20" value={$slct.archive_obj.name ? $slct.archive_obj.name : 'Testing!' } placeholder="Name of Archive">
|
||||
</label>
|
||||
|
||||
<label for="description">Description
|
||||
<textarea id="description" name="description" rows="6" cols="80" value={$slct.archive_obj.description ? $slct.archive_obj.description : ''} class="ae_value archive__description tinymce_editor editor_basic_200"></textarea>
|
||||
</label>
|
||||
|
||||
<label for="content_html">Content (HTML)
|
||||
<textarea id="content_html" name="content_html" rows="6" cols="80" value={$slct.archive_obj.content_html ? $slct.archive_obj.content_html : ''} class="ae_value archive__content_html tinymce_editor editor_regular"></textarea>
|
||||
</label>
|
||||
|
||||
<h3>Original</h3>
|
||||
<label for="original_datetime">Original Date/Time
|
||||
<input type="date" id="original_datetime_date" name="original_datetime_date" value={($slct.archive_obj.original_datetime ? ae.util.iso_datetime_formatter($slct.archive_obj.original_datetime,'date_iso') : '')} placeholder="YYYY-MM-DD">
|
||||
<input type="time" id="original_datetime_time" name="original_datetime_time" value={($slct.archive_obj.original_datetime ? ae.util.iso_datetime_formatter($slct.archive_obj.original_datetime,'time_iso') : '')} placeholder="HH:MM AM/PM">
|
||||
</label>
|
||||
|
||||
<fieldset class="flex_row flex_gap_md flex_justify_around">
|
||||
<label for="original_timezone">Original Timezone
|
||||
{#if $ae_app.lu_time_zone_list}
|
||||
<select name="original_timezone" id="original_timezone" required>
|
||||
{#each $ae_app.lu_time_zone_list as lu_timezone}
|
||||
<option value="{lu_timezone.name}" selected={((($slct.archive_obj.original_timezone && lu_timezone.name == $slct.archive_obj.original_timezone) || lu_timezone.name == $ae_app.current_timezone) ? 'selected' : '')}>{lu_timezone.name}</option>
|
||||
{/each}
|
||||
</select>
|
||||
{:else}
|
||||
<input type="text" name="timezone" value={($slct.archive_obj.original_timezone ? $slct.archive_obj.original_timezone : $ae_app.current_timezone)} />
|
||||
{/if}
|
||||
</label>
|
||||
</fieldset>
|
||||
|
||||
<!-- <label for="original_timezone">Original Timezone
|
||||
<input type="text" id="original_timezone" name="original_timezone" value={($slct.archive_obj.original_timezone ? $slct.archive_obj.original_timezone : $ae_app.current_timezone)} placeholder="Timezone" list="timezones">
|
||||
<datalist id="timezones">
|
||||
<option value="UTC">UTC</option>
|
||||
<option value="America/New_York">America/New York</option>
|
||||
<option value="America/Chicago">America/Chicago</option>
|
||||
<option value="America/Denver">America/Denver</option>
|
||||
<option value="America/Phoenix">America/Phoenix</option>
|
||||
<option value="America/Los_Angeles">America/Los Angeles</option>
|
||||
<option value="America/Anchorage">America/Anchorage</option>
|
||||
<option value="America/Adak">America/Adak</option>
|
||||
<option value="Pacific/Honolulu">Pacific/Honolulu</option>
|
||||
<option value="Pacific/Midway">Pacific/Midway</option>
|
||||
<option value="US/Eastern">US/Eastern</option>
|
||||
<option value="US/Central">US/Central</option>
|
||||
<option value="US/Mountain">US/Mountain</option>
|
||||
<option value="US/Pacific">US/Pacific</option>
|
||||
<option value="US/Alaska">US/Alaska</option>
|
||||
<option value="US/Hawaii">US/Hawaii</option>
|
||||
<option value="US/Samoa">US/Samoa</option>
|
||||
<option value="US/Aleutian">US/Aleutian</option>
|
||||
<option value="US/Arizona">US/Arizona</option>
|
||||
<option value="US/Michigan">US/Michigan</option>
|
||||
</datalist>
|
||||
</label> -->
|
||||
|
||||
<label for="original_location">Original Location
|
||||
<input type="text" id="original_location" name="original_location" value={($slct.archive_obj.original_location ? $slct.archive_obj.original_location : '')} placeholder="Location">
|
||||
</label>
|
||||
|
||||
<label for="original_url">Original URL
|
||||
<input type="text" id="original_url" name="original_url" max="255" value={$slct.archive_obj.original_url ? $slct.archive_obj.original_url : '' } placeholder="URL">
|
||||
</label>
|
||||
|
||||
<label for="original_url_text">Original URL Text/Title
|
||||
<input type="text" id="original_url_text" name="original_url_text" max="255" value={$slct.archive_obj.original_url_text ? $slct.archive_obj.original_url_text : '' } placeholder="URL text or title">
|
||||
</label>
|
||||
|
||||
|
||||
<!-- <label for="topic_id">BB post topic
|
||||
<select id="topic_id" name="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">Announcement</option>
|
||||
</select>
|
||||
</label> -->
|
||||
|
||||
<!-- <h3>Archiveer's Information</h3>
|
||||
<fieldset class="">
|
||||
<legend class="">Archive as Anonymous</legend>
|
||||
<div class="">
|
||||
<input type="radio" class="" id="anonymous_no" name="anonymous" value="0" checked={(!$slct.archive_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.archive_obj.anonymous)} required >
|
||||
<label for="anonymous_yes" class="">Yes, the post will be listed as Anonymous</label>
|
||||
</div>
|
||||
</fieldset> -->
|
||||
|
||||
<!-- <label for="external_person_id">Your ID
|
||||
<input type="text" id="external_person_id" name="external_person_id" value={$slct.archive_obj.external_person_id} readonly>
|
||||
</label>
|
||||
|
||||
<label for="full_name">Your name
|
||||
<input type="text" id="full_name" name="full_name" value={$slct.archive_obj.full_name}>
|
||||
</label>
|
||||
|
||||
<label for="email">Your email
|
||||
<input type="text" name="email" value={$slct.archive_obj.email} readonly>
|
||||
</label> -->
|
||||
|
||||
<!-- <h3>Archiveer's Options</h3> -->
|
||||
|
||||
<!-- <fieldset class="">
|
||||
<legend class="">Official or Member Archive</legend>
|
||||
<div class="">
|
||||
<input type="radio" class="" id="group_official" name="group" value="official">
|
||||
<label for="group_official" class="">Archive as Official/Leadership</label>
|
||||
</div>
|
||||
<div class="">
|
||||
<input type="radio" class="" id="group_member" name="group" value="member" checked="">
|
||||
<label for="group_member" class="">Archive 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_app.trusted_access}
|
||||
<section class="ae_section archive__admin_options"> <!-- BEGIN: section archive__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.archive_obj.hide}
|
||||
>
|
||||
<!-- <input type="checkbox" name="hide" value={$slct.archive_obj.hide} /> -->
|
||||
</label>
|
||||
|
||||
<label>Priority
|
||||
<input
|
||||
type="checkbox"
|
||||
name="priority"
|
||||
id="priority"
|
||||
bind:checked={$slct.archive_obj.priority}
|
||||
>
|
||||
<!-- <input type="checkbox" name="priority" value={$slct.archive_obj.priority} /> -->
|
||||
</label>
|
||||
|
||||
<label>Sort <input type="number" name="sort" value={$slct.archive_obj.sort} /></label>
|
||||
|
||||
<label>Group <input type="text" name="group" value={$slct.archive_obj.group} max="100" /></label>
|
||||
|
||||
{#if $ae_app.administrator_access}
|
||||
<label>Enable
|
||||
<input
|
||||
type="checkbox"
|
||||
name="enable"
|
||||
id="enable"
|
||||
bind:checked={$slct.archive_obj.enable}
|
||||
>
|
||||
<!-- <input type="checkbox" name="enable" value={$slct.archive_obj.enable} checked={$slct.archive_obj.enable} /> -->
|
||||
</label>
|
||||
{/if}
|
||||
|
||||
<label>Internal Staff Notes
|
||||
<textarea id="notes" name="notes" class="ae_value archive__notes tinymce_editor editor_basic_200" rows="2" cols="70" value={$slct.archive_obj.notes}></textarea>
|
||||
</label>
|
||||
|
||||
</span> <!-- END: span ae_show_hide_content -->
|
||||
|
||||
</section> <!-- END: section archive__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 Archive</button>
|
||||
|
||||
{#if $slct.archive_id}
|
||||
<button
|
||||
on:click={() => {
|
||||
if (!confirm('Are you sure you want to delete this archive?')) {return false;}
|
||||
handle_delete_archive_obj({archive_id: $slct.archive_id});
|
||||
|
||||
$slct.archive_id = null;
|
||||
$slct.archive_obj = {};
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-danger" type="button">
|
||||
<span class="fas fa-minus"></span> Delete
|
||||
</button>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
</form>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<style>
|
||||
</style>
|
||||
@@ -0,0 +1,489 @@
|
||||
<script lang="ts">
|
||||
// *** Import Svelte core
|
||||
import { onMount } from 'svelte';
|
||||
import { fade } from 'svelte/transition';
|
||||
|
||||
// *** Import Aether core variables and functions
|
||||
import { ae, api, Element_modal_v3 } from 'aether_npm_lib';
|
||||
import { slct, ae_app, slct_trigger } from './stores';
|
||||
|
||||
import Edit_archive_content_obj from './10_edit__archive_content_obj.svelte';
|
||||
import Player_archive_content_obj from './10_player__archive_content_obj.svelte';
|
||||
|
||||
let idaa_archive_content_obj_li_get_promise: Promise<any>;
|
||||
let idaa_archive_content_obj_get_promise: Promise<any>;
|
||||
|
||||
let file_icons:any = {}
|
||||
file_icons['ac3'] = 'file-audio';
|
||||
file_icons['aac'] = 'file-audio';
|
||||
file_icons['csv'] = 'file-csv';
|
||||
file_icons['doc'] = 'file-word';
|
||||
file_icons['docx'] = 'file-word';
|
||||
file_icons['gif'] = 'file-image';
|
||||
file_icons['htm'] = 'file-code';
|
||||
file_icons['html'] = 'file-code';
|
||||
file_icons['jpeg'] = 'file-image';
|
||||
file_icons['jpg'] = 'file-image';
|
||||
file_icons['key'] = 'file-powerpoint';
|
||||
file_icons['mkv'] = 'file-video';
|
||||
file_icons['mov'] = 'file-video';
|
||||
file_icons['mp3'] = 'file-audio';
|
||||
file_icons['mp4'] = 'file-video';
|
||||
file_icons['pdf'] = 'file-pdf';
|
||||
file_icons['png'] = 'file-image';
|
||||
file_icons['ppt'] = 'file-powerpoint';
|
||||
file_icons['pptx'] = 'file-powerpoint';
|
||||
file_icons['txt'] = 'file-alt';
|
||||
file_icons['wav'] = 'file-audio';
|
||||
file_icons['webp'] = 'file-image';
|
||||
file_icons['xls'] = 'file-excel';
|
||||
file_icons['xlsx'] = 'file-excel';
|
||||
file_icons['zip'] = 'file-archive';
|
||||
|
||||
let media_play_extension_li = ['m4a', 'mp4', 'mp3'];
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** List - Archive Content Obj Li');
|
||||
});
|
||||
|
||||
$: if ($slct_trigger == 'load__archive_content_obj_li' && $slct.archive_id) {
|
||||
$slct_trigger = null;
|
||||
|
||||
handle_load_archive_content_obj_li({archive_id: $slct.archive_id, try_cache: false});
|
||||
}
|
||||
|
||||
async function handle_load_archive_content_obj_li({archive_id, try_cache=false}) {
|
||||
console.log('*** handle_load_archive_content_obj_li() ***');
|
||||
|
||||
let enabled = $ae_app.archives.enabled;
|
||||
let hidden = $ae_app.archives.hidden;
|
||||
let limit = $ae_app.archives.limit;
|
||||
let offset = $ae_app.archives.offset;
|
||||
// $ae_app.archives.content_group_sort = 'DESC'; // 'ASC' or 'DESC'
|
||||
let group_sort = $ae_app.archives.content_group_sort; // 'ASC' or 'DESC'
|
||||
|
||||
let params = {};
|
||||
|
||||
idaa_archive_content_obj_li_get_promise = api.get_ae_obj_li_for_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'archive_content',
|
||||
for_obj_type: 'archive',
|
||||
for_obj_id: archive_id,
|
||||
enabled: enabled,
|
||||
hidden: hidden,
|
||||
order_by_li: {'group': group_sort, 'priority': 'DESC', 'sort': 'DESC', 'name': 'ASC', 'created_on': 'DESC', 'updated_on': 'DESC'},
|
||||
limit: limit,
|
||||
offset: offset,
|
||||
params_json: null,
|
||||
params: params,
|
||||
log_lvl: 0
|
||||
})
|
||||
.then(function (archive_content_obj_li_get_result) {
|
||||
if (archive_content_obj_li_get_result) {
|
||||
$slct.archive_content_obj_li = archive_content_obj_li_get_result;
|
||||
console.log(`Archive Content list:`, $slct.archive_content_obj_li);
|
||||
|
||||
// console.log(ae.dynamic_sort());
|
||||
// $slct.archive_content_obj_li.sort(ae.util.dynamic_sort_multiple('group ASC', 'created_on DESC', 'updated_on DESC'));
|
||||
} else {
|
||||
$slct.archive_content_obj_li = [];
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
|
||||
return idaa_archive_content_obj_li_get_promise;
|
||||
}
|
||||
|
||||
|
||||
$: if ($slct_trigger == 'load__archive_content_obj' && $slct.archive_content_id) {
|
||||
$slct_trigger = null;
|
||||
|
||||
handle_load_archive_content_obj({archive_content_id: $slct.archive_content_id, try_cache: false});
|
||||
}
|
||||
|
||||
|
||||
async function handle_load_archive_content_obj({archive_content_id, try_cache=false}) {
|
||||
console.log('*** handle_load_archive_content_obj() ***');
|
||||
|
||||
let params = {};
|
||||
|
||||
idaa_archive_content_obj_get_promise = api.get_ae_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'archive_content',
|
||||
obj_id: archive_content_id,
|
||||
use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config.
|
||||
use_alt_base: false, // 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 (archive_content_obj_get_result) {
|
||||
if (archive_content_obj_get_result) {
|
||||
$slct.archive_content_obj = archive_content_obj_get_result;
|
||||
console.log(`Archive object:`, $slct.archive_content_obj);
|
||||
}
|
||||
|
||||
// handle_resize_document();
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
|
||||
return idaa_archive_content_obj_get_promise;
|
||||
}
|
||||
|
||||
function handle_created_archive_content_obj(event) {
|
||||
console.log('*** handle_created_archive_content_obj() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
$slct_trigger = 'load__archive_content_obj_li';
|
||||
|
||||
$ae_app.archives.show_list__event_obj_li = true;
|
||||
$ae_app.archives.show_edit__archive_content_id = false;
|
||||
$ae_app.archives.show_view__archive_content_id = false;
|
||||
}
|
||||
|
||||
function handle_updated_archive_content_obj(event) {
|
||||
console.log('*** handle_updated_archive_content_obj() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
$slct_trigger = 'load__archive_content_obj_li';
|
||||
|
||||
$ae_app.archives.show_list__event_obj_li = true;
|
||||
$ae_app.archives.show_edit__archive_content_id = false;
|
||||
$ae_app.archives.show_view__archive_content_id = false;
|
||||
}
|
||||
|
||||
function handle_deleted_archive_content_obj(event) {
|
||||
console.log('*** handle_deleted_archive_content_obj() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
$slct_trigger = 'load__archive_content_obj_li';
|
||||
|
||||
$ae_app.archives.show_list__event_obj_li = true;
|
||||
$ae_app.archives.show_edit__archive_content_id = false;
|
||||
$ae_app.archives.show_view__archive_content_id = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<section class="svelte_component ae_section ae_list archive_content_obj_li list__archive_content_obj">
|
||||
{#if $slct.archive_content_obj_li}
|
||||
|
||||
{#each $slct.archive_content_obj_li as idaa_archive_content_obj, index}
|
||||
<!-- {#each $slct.archive_content_obj_li.sort(ae.util.dynamic_sort_multiple('group ASC', 'priority DESC')) as idaa_archive_content_obj, index} -->
|
||||
{#if idaa_archive_content_obj.group && idaa_archive_content_obj.group != $slct.archive_content_obj_li[index - 1]?.group}
|
||||
<div class="ae_row archive_content__group">
|
||||
<button
|
||||
class="ae_btn btn btn-info ae_margin_sm"
|
||||
on:click={() => {
|
||||
if ($ae_app.archives.show_list__archive_content_li_group == idaa_archive_content_obj.group) {
|
||||
$ae_app.archives.show_list__archive_content_li_group = null;
|
||||
} else {
|
||||
$ae_app.archives.show_list__archive_content_li_group = idaa_archive_content_obj.group;
|
||||
}
|
||||
}}
|
||||
>
|
||||
{#if $ae_app.archives.show_list__archive_content_li_group == idaa_archive_content_obj.group}
|
||||
<span class="fas fa-caret-down" in:fade={{ duration: 250 }}
|
||||
out:fade={{ duration: 0 }}></span>
|
||||
<!-- <span class="fas fa-minus"></span> -->
|
||||
<span class="ae_label">Hide:</span>
|
||||
{:else}
|
||||
<span class="fas fa-caret-right" in:fade={{ duration: 250 }}
|
||||
out:fade={{ duration: 0 }}></span>
|
||||
<!-- <span class="fas fa-plus"></span> -->
|
||||
<span class="ae_label">Show:</span>
|
||||
{/if}
|
||||
<!-- <span class="fas fa-caret-down"></span> -->
|
||||
<!-- <span class="ae_label">Show:</span> -->
|
||||
<span class="ae_value">{idaa_archive_content_obj.group}</span>
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
{#if $ae_app.archives.show_list__archive_content_li_group == idaa_archive_content_obj.group}
|
||||
<!-- class:ae_d_none={$ae_app.archives.show_list__archive_content_li_group != idaa_archive_content_obj.group} -->
|
||||
<div
|
||||
id={`idaa_archive_content_id__${idaa_archive_content_obj.archive_content_id_random}`}
|
||||
class="container archive_content ae_object archive_content_obj"
|
||||
class:archive__content_type={idaa_archive_content_obj.type}
|
||||
|
||||
in:fade={{ duration: 125 }}
|
||||
out:fade={{ duration: 250 }}
|
||||
>
|
||||
|
||||
<header class="ae_header archive_content__header">
|
||||
<h3>
|
||||
<span class="archive_content__name">{idaa_archive_content_obj.name}</span>
|
||||
|
||||
{#if idaa_archive_content_obj.type}<span class="badge badge-info bg-info"><span class="fas fa-user-md"></span> {idaa_archive_content_obj.type}</span>{/if}
|
||||
|
||||
{#if $ae_app.trusted_access && idaa_archive_content_obj.hide}<span class="badge badge-warning"><span class="fas fa-exclamation-triangle"></span> Hidden</span>{/if}
|
||||
{#if $ae_app.administrator_access && !idaa_archive_content_obj.enable}<span class="badge badge-warning"><span class="fas fa-exclamation-triangle"></span> Not enabled</span>{/if}
|
||||
</h3>
|
||||
</header>
|
||||
|
||||
<section class="ae_options archive_content_obj__options">
|
||||
{#if idaa_archive_content_obj.archive_content_id_random != $ae_app.archives.show_view__archive_content_media}
|
||||
<button
|
||||
on:click={ () => {
|
||||
$slct.archive_content_id = idaa_archive_content_obj.archive_content_id_random;
|
||||
$slct.archive_content_obj = idaa_archive_content_obj;
|
||||
$ae_app.archives.show_view__archive_content_media = $slct.archive_content_id;
|
||||
// idaa_archive_content_obj.show_view__archive_content_media = true;
|
||||
}}
|
||||
class="ae_btn btn_md btn btn-md btn-primary"
|
||||
title="Open this file">
|
||||
{#if media_play_extension_li.includes( idaa_archive_content_obj.file_extension)}
|
||||
<span class="fas fa-play"></span>
|
||||
Play <!-- This really should check the file type: view, show, play, listen, watch -->
|
||||
{:else}
|
||||
<span class="fas fa-eye"></span>
|
||||
View
|
||||
{/if}
|
||||
<span class="badge">
|
||||
{#if file_icons[idaa_archive_content_obj.file_extension]}
|
||||
<span class="fas fa-{file_icons[idaa_archive_content_obj.file_extension]}"></span>
|
||||
{:else}
|
||||
<span class="fas fa-file"></span>
|
||||
{/if}
|
||||
.{idaa_archive_content_obj.file_extension}</span>
|
||||
</button>
|
||||
{:else}
|
||||
<button
|
||||
on:click={ () => {
|
||||
$slct.archive_content_id = idaa_archive_content_obj.archive_content_id_random;
|
||||
$slct.archive_content_obj = idaa_archive_content_obj;
|
||||
|
||||
$ae_app.archives.show_view__archive_content_media = false;
|
||||
// idaa_archive_content_obj.show_view__archive_content_media = false;
|
||||
}}
|
||||
class="ae_btn btn_md btn btn-md btn-secondary"
|
||||
title="Hide this file">
|
||||
<span class="fas fa-play"></span>
|
||||
Hide <!-- This really should check the file type: view, show, play, listen, watch -->
|
||||
<span class="badge">
|
||||
{#if file_icons[idaa_archive_content_obj.file_extension]}
|
||||
<span class="fas fa-{file_icons[idaa_archive_content_obj.file_extension]}"></span>
|
||||
{:else}
|
||||
<span class="fas fa-file"></span>
|
||||
{/if}
|
||||
.{idaa_archive_content_obj.file_extension}</span>
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
{#if $ae_app.trusted_access}
|
||||
<a href="{$ae_app.app.base_url}{idaa_archive_content_obj.hosted_file_path}" class="ae_btn btn_md btn btn-md btn-secondary" title="Download this file">
|
||||
<span class="fas fa-download"></span>
|
||||
Download <!-- This really should check the file type: view, show, play, listen, watch -->
|
||||
<span class="badge">
|
||||
{#if file_icons[idaa_archive_content_obj.file_extension]}
|
||||
<span class="fas fa-{file_icons[idaa_archive_content_obj.file_extension]}"></span>
|
||||
{:else}
|
||||
<span class="fas fa-file"></span>
|
||||
{/if}
|
||||
.{idaa_archive_content_obj.file_extension}</span>
|
||||
</a>
|
||||
{/if}
|
||||
|
||||
{#if $ae_app.trusted_access}
|
||||
<button
|
||||
on:click={() => {
|
||||
$slct.archive_content_id = idaa_archive_content_obj.archive_content_id_random;
|
||||
$slct.archive_content_obj = idaa_archive_content_obj;
|
||||
$slct_trigger = 'load__archive_content_obj';
|
||||
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.set('archive_content_id', idaa_archive_content_obj.archive_content_id_random);
|
||||
// history.pushState({}, '', url);
|
||||
|
||||
// $ae_app.archives.show_main__options = true;
|
||||
// $ae_app.archives.show_list__archive_content_li = true;
|
||||
// $ae_app.archives.show_view__archive_content_id = false;
|
||||
$ae_app.archives.show_view__archive_content_media = false;
|
||||
$ae_app.archives.show_edit__archive_content_id = true;
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-warning"
|
||||
title={`Edit content: ${idaa_archive_content_obj.name}`}
|
||||
>
|
||||
<span class="fas fa-edit"></span> Edit Content
|
||||
</button>
|
||||
<!-- <button
|
||||
on:click={() => {
|
||||
// Copy URL to clipboard
|
||||
// Is there a URL anymore?
|
||||
// const copy_text = document.getElementById(`archive_edit_url_${idaa_archive_content_obj.archive_content_id_random}`);
|
||||
}}
|
||||
class="ae_btn btn_sm btn_outline_info archive_edit_help"
|
||||
>
|
||||
<span class="fas fa-link"></span> URL
|
||||
</button> -->
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
|
||||
<!-- Doing some checks before the media player/viewer shows. The player should be the only one showing. So there is a sort of global check first. -->
|
||||
{#if idaa_archive_content_obj.archive_content_id_random == $ae_app.archives.show_view__archive_content_media}
|
||||
<Player_archive_content_obj archive_content_id={idaa_archive_content_obj.archive_content_id_random} />
|
||||
{/if}
|
||||
|
||||
|
||||
<section class="ae_section archive_content__content">
|
||||
{#if idaa_archive_content_obj.description}
|
||||
<div
|
||||
class="archive_content__description ae_description"
|
||||
>
|
||||
<div class="ae_label archive_content__description">Description:</div>
|
||||
<div class="ae_value archive_content__description">
|
||||
{idaa_archive_content_obj.description}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if idaa_archive_content_obj.content_html}
|
||||
<div
|
||||
class="archive_content__content_html ae_content_html"
|
||||
>
|
||||
<div class="ae_label archive_content__content_html">Content:</div>
|
||||
<div class="ae_value archive_content__content_html">
|
||||
{@html idaa_archive_content_obj.content_html}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div
|
||||
class="ae_group"
|
||||
class:ae_d_none={!idaa_archive_content_obj.original_datetime && !idaa_archive_content_obj.original_timezone}
|
||||
>
|
||||
<span class="ae_label">Original date/time:</span>
|
||||
{#if idaa_archive_content_obj.original_datetime}
|
||||
<span class="ae_value ae_prop prop_original_datetime fs_smaller">{ae.util.iso_datetime_formatter(idaa_archive_content_obj.original_datetime, 'datetime_long')}</span>
|
||||
{/if}
|
||||
{#if idaa_archive_content_obj.original_timezone}
|
||||
<span class="ae_label">Timezone:</span>
|
||||
<span class="ae_value">{idaa_archive_content_obj.original_timezone}</span>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<section
|
||||
class="ae_section ae_footer ae_meta archive_content__meta"
|
||||
class:ae_d_none={!$ae_app.administrator_access}
|
||||
>
|
||||
<span
|
||||
class="archive_content__archive_content_type"
|
||||
class:ae_d_none={!idaa_archive_content_obj.archive_content_type}
|
||||
>
|
||||
Type: {idaa_archive_content_obj.archive_content_type}
|
||||
</span>
|
||||
<span class="ae_group">
|
||||
<span
|
||||
class="archive_content__created_on"
|
||||
>
|
||||
Created on: {ae.util.iso_datetime_formatter(idaa_archive_content_obj.created_on, 'datetime_short')}
|
||||
</span>
|
||||
<span
|
||||
class="archive_content__updated_on"
|
||||
class:ae_d_none={!idaa_archive_content_obj.updated_on}
|
||||
>
|
||||
Updated on: {ae.util.iso_datetime_formatter(idaa_archive_content_obj.updated_on, 'datetime_short')}
|
||||
</span>
|
||||
</span>
|
||||
</section>
|
||||
</div>
|
||||
{/if}
|
||||
{/each}
|
||||
|
||||
{:else}
|
||||
<div>No archives avalible to show at this time</div>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
|
||||
{#if $ae_app.archives.show_edit__archive_content_id}
|
||||
<!-- <section class="ae_edit archive_content_obj archive_content_id idaa_archive_content_id_edit"> -->
|
||||
<Element_modal_v3
|
||||
show = { true }
|
||||
modal_cover_body = { false }
|
||||
on:close={ () => {
|
||||
$slct.archive_content_id = null;
|
||||
$slct.archive_content_obj = {};
|
||||
|
||||
// $ae_app.archives.show_main__options = true;
|
||||
// $ae_app.archives.show_list__archive_content_li = true;
|
||||
$ae_app.archives.show_view__archive_content_media = false;
|
||||
$ae_app.archives.show_edit__archive_content_id = false;
|
||||
// $ae_app.archives.show_view__archive_content_id = false;
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete('archive_content_id');
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {'archive_content_id': null};
|
||||
window.parent.postMessage(message, "*");
|
||||
}}
|
||||
>
|
||||
<span slot="header_title">{@html ($slct.archive_content_obj.name ? $slct.archive_content_obj.name : 'New Archive Content')}</span>
|
||||
|
||||
<span slot="body">
|
||||
|
||||
<Edit_archive_content_obj
|
||||
on:created__archive_content_obj={handle_created_archive_content_obj}
|
||||
on:updated__archive_content_obj={handle_updated_archive_content_obj}
|
||||
on:deleted__archive_content_obj={handle_deleted_archive_content_obj}
|
||||
/>
|
||||
|
||||
</span>
|
||||
</Element_modal_v3>
|
||||
<!-- </section> -->
|
||||
{/if}
|
||||
|
||||
|
||||
<style>
|
||||
.ae_label {
|
||||
font-size: smaller;
|
||||
}
|
||||
.ae_value {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.ae_header h3 {
|
||||
font-size: 1.2em;
|
||||
margin: 0;
|
||||
/* padding: 0; */
|
||||
}
|
||||
|
||||
.ae_row.archive_content__group {
|
||||
width: 100%;
|
||||
}
|
||||
.ae_row.archive_content__group button {
|
||||
width: 100%;
|
||||
}
|
||||
.ae_value.archive_content__group {
|
||||
font-size: 1.4em;
|
||||
font-weight: bold;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
text-align: center;
|
||||
|
||||
border-bottom: solid thin black;
|
||||
}
|
||||
|
||||
.archive_content_obj .ae_meta {
|
||||
flex-direction: column;
|
||||
/* justify-content: space-between; */
|
||||
}
|
||||
|
||||
.archive_content_obj .ae_meta .ae_group {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.archive_content_obj .ae_meta .ae_options {
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
}
|
||||
</style>
|
||||
151
src/routes/idaa/(idaa)/archives/10_list__archive_obj.svelte
Normal file
151
src/routes/idaa/(idaa)/archives/10_list__archive_obj.svelte
Normal file
@@ -0,0 +1,151 @@
|
||||
<script lang="ts">
|
||||
// *** Import Svelte core
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
// *** Import Aether core variables and functions
|
||||
import { ae } from 'aether_npm_lib';
|
||||
import { slct, ae_app, slct_trigger } from './stores';
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** List - Archive Obj Li');
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<section class="svelte_component ae_section ae_list archive_obj_li list__archive_obj archive_list">
|
||||
{#if $slct.archive_obj_li}
|
||||
|
||||
{#each $slct.archive_obj_li as idaa_archive_obj, index}
|
||||
<div
|
||||
id={`idaa_archive_id__${idaa_archive_obj.archive_id_random}`}
|
||||
class="archive ae_object archive_obj"
|
||||
>
|
||||
|
||||
<div class="ae_header archive__header">
|
||||
<span class="archive__name">{idaa_archive_obj.name}</span>
|
||||
{#if idaa_archive_obj.original_location}
|
||||
<span>(
|
||||
<!-- <span class="ae_label">Location:</span> -->
|
||||
<span class="ae_value">{idaa_archive_obj.original_location}</span>
|
||||
)
|
||||
</span>
|
||||
{/if}
|
||||
|
||||
{#if $ae_app.trusted_access && idaa_archive_obj.hide}<span class="badge badge-warning"><span class="fas fa-exclamation-triangle"></span> Hidden</span>{/if}
|
||||
{#if $ae_app.administrator_access && !idaa_archive_obj.enable}<span class="badge badge-warning"><span class="fas fa-exclamation-triangle"></span> Not enabled</span>{/if}
|
||||
</div>
|
||||
|
||||
<div class="ae_options archive_obj__options">
|
||||
<button
|
||||
on:click={() => {
|
||||
$slct.archive_id = idaa_archive_obj.archive_id_random;
|
||||
$slct.archive_obj = idaa_archive_obj;
|
||||
$ae_app.archives.content_group_sort = $slct.archive_obj.cfg_json.content_group_sort;
|
||||
$slct_trigger = 'load__archive_obj';
|
||||
|
||||
$ae_app.archives.show_main__options = true;
|
||||
$ae_app.archives.show_list__archive_obj_li = false;
|
||||
$ae_app.archives.show_view__archive_obj = true;
|
||||
$ae_app.archives.show_edit__archive_obj = false;
|
||||
}}
|
||||
class="btn btn-secondary"
|
||||
title={`View: ${idaa_archive_obj.name}`}
|
||||
>
|
||||
<span class="fas fa-envelope-open"></span> Open
|
||||
</button>
|
||||
|
||||
{#if $ae_app.trusted_access}
|
||||
<button
|
||||
on:click={() => {
|
||||
$slct.archive_id = idaa_archive_obj.archive_id_random;
|
||||
$slct.archive_obj = idaa_archive_obj;
|
||||
$slct_trigger = 'load__archive_obj';
|
||||
|
||||
// $ae_app.archives.show_main__options = true;
|
||||
// $ae_app.archives.show_list__archive_obj_li = true;
|
||||
$ae_app.archives.show_view__archive_obj = false;
|
||||
$ae_app.archives.show_edit__archive_obj = true;
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-warning"
|
||||
title={`Edit archive: ${idaa_archive_obj.name}`}
|
||||
>
|
||||
<span class="fas fa-edit"></span> Edit Archive
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
|
||||
<section class="ae_section archive__content">
|
||||
<div
|
||||
class="archive_description description"
|
||||
>
|
||||
<!-- <div class="ae_label archive__description">Description:</div> -->
|
||||
<div class="ae_value archive__description">
|
||||
{@html idaa_archive_obj.description}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
<section class="ae_section ae_footer ae_meta archive__meta">
|
||||
<div class="ae_group">
|
||||
{#if !idaa_archive_obj.updated_on}
|
||||
<span
|
||||
class="archive__created_on"
|
||||
>
|
||||
<span class="ae_label">Created on:</span>
|
||||
<span class="ae_value">{ae.util.iso_datetime_formatter(idaa_archive_obj.created_on, 'datetime_short')}</span>
|
||||
</span>
|
||||
{:else}
|
||||
<span
|
||||
class="archive__updated_on"
|
||||
>
|
||||
<span class="ae_label">Updated on:</span>
|
||||
<span class="ae_value">{ae.util.iso_datetime_formatter(idaa_archive_obj.updated_on, 'datetime_short')}</span>
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
{/each}
|
||||
|
||||
{:else}
|
||||
<div>No archives avalible to show at this time</div>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
|
||||
<style>
|
||||
.archive_obj {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 1em;
|
||||
}
|
||||
|
||||
.archive__name {
|
||||
font-size: 1.5em;
|
||||
font-weight: bold;
|
||||
}
|
||||
.archive__content {
|
||||
display: none;
|
||||
}
|
||||
.archive__meta {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.archive_obj .ae_meta {
|
||||
flex-direction: column;
|
||||
/* justify-content: space-between; */
|
||||
}
|
||||
|
||||
.archive_obj .ae_meta .ae_group {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.archive_obj .ae_meta .ae_options {
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,78 @@
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher, onMount } from 'svelte';
|
||||
import { fade } from 'svelte/transition';
|
||||
|
||||
// import { ae, Element_modal_v3 } from 'aether_npm_lib';
|
||||
import { slct, slct_trigger, ae_app } from './stores';
|
||||
|
||||
// export let archive_content_id = null;
|
||||
|
||||
let file_icons:any = {}
|
||||
file_icons['ac3'] = 'file-audio';
|
||||
file_icons['aac'] = 'file-audio';
|
||||
file_icons['csv'] = 'file-csv';
|
||||
file_icons['doc'] = 'file-word';
|
||||
file_icons['docx'] = 'file-word';
|
||||
file_icons['gif'] = 'file-image';
|
||||
file_icons['htm'] = 'file-code';
|
||||
file_icons['html'] = 'file-code';
|
||||
file_icons['jpeg'] = 'file-image';
|
||||
file_icons['jpg'] = 'file-image';
|
||||
file_icons['key'] = 'file-powerpoint';
|
||||
file_icons['mkv'] = 'file-video';
|
||||
file_icons['mov'] = 'file-video';
|
||||
file_icons['mp3'] = 'file-audio';
|
||||
file_icons['mp4'] = 'file-video';
|
||||
file_icons['pdf'] = 'file-pdf';
|
||||
file_icons['png'] = 'file-image';
|
||||
file_icons['ppt'] = 'file-powerpoint';
|
||||
file_icons['pptx'] = 'file-powerpoint';
|
||||
file_icons['txt'] = 'file-alt';
|
||||
file_icons['wav'] = 'file-audio';
|
||||
file_icons['webp'] = 'file-image';
|
||||
file_icons['xls'] = 'file-excel';
|
||||
file_icons['xlsx'] = 'file-excel';
|
||||
file_icons['zip'] = 'file-archive';
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** Player - Archive Content Obj');
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- <h3 class="ae_title">Viewing: {$slct.archive_content_obj.name}</h3> -->
|
||||
|
||||
<section class="ae_content">
|
||||
{#if file_icons[$slct.archive_content_obj.file_extension] == 'file-audio'}
|
||||
<audio id="view_archive_content_audio" width="" height="" autoplay controls style="max-width: 100%; max-height: 65vh;">
|
||||
<source id="view_archive_content_audio_source" src="{$ae_app.app.base_url}{$slct.archive_content_obj.file_path}" type="audio/mpeg">
|
||||
<!--<source src="audio.ogg" type="audio/ogg">-->
|
||||
Your browser does not support the audio tag.
|
||||
</audio>
|
||||
|
||||
{:else if file_icons[$slct.archive_content_obj.file_extension] == 'file-video'}
|
||||
<video id="view_archive_content_video" width="" height="" autoplay controls style="max-width: 100%; max-height: 65vh;">
|
||||
<source id="view_archive_content_video_source" src="{$ae_app.app.base_url}{$slct.archive_content_obj.file_path}" type="video/mp4">
|
||||
<!--<source src="video.ogg" type="video/ogg">-->
|
||||
<track kind="captions" src="" srclang="en" label="English">
|
||||
Your browser does not support the video tag.
|
||||
</video>
|
||||
|
||||
{:else if file_icons[$slct.archive_content_obj.file_extension] == 'file-image'}
|
||||
<img id="view_archive_content_image" src="{$ae_app.app.base_url}{$slct.archive_content_obj.file_path}" alt="{$slct.archive_content_obj.name}" style="max-width: 100%; max-height: 65vh;" />
|
||||
{:else}
|
||||
<a href="{$ae_app.app.base_url}{$slct.archive_content_obj.file_path}">{$slct.archive_content_obj.filename}</a>
|
||||
{/if}
|
||||
|
||||
{#if $slct.archive_content_obj.description}
|
||||
<div id="archive_content__description" class="archive_content__description">
|
||||
{$slct.archive_content_obj.description}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if $slct.archive_content_obj.content_html}
|
||||
<div id="archive_content__content_html" class="archive_content__content_html">
|
||||
{@html $slct.archive_content_obj.content_html}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
</section>
|
||||
244
src/routes/idaa/(idaa)/archives/10_view__archive_obj.svelte
Normal file
244
src/routes/idaa/(idaa)/archives/10_view__archive_obj.svelte
Normal file
@@ -0,0 +1,244 @@
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher, onMount } from 'svelte';
|
||||
import { fade } from 'svelte/transition';
|
||||
|
||||
import { ae, Element_modal_v3 } from 'aether_npm_lib';
|
||||
import { slct, slct_trigger, ae_app } from './stores';
|
||||
|
||||
// import Edit_archive_content_obj from './10_edit__archive_content_obj.svelte';
|
||||
import List_archive_content_obj from './10_list__archive_content_obj.svelte';
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
if ($slct.archive_id) {
|
||||
console.log(`Archive ID selected: ${$slct.archive_id}`);
|
||||
console.log(`Archive Object selected: ${$slct.archive_obj}`)
|
||||
|
||||
$slct_trigger = 'load__archive_obj';
|
||||
$slct_trigger = 'load__archive_content_obj_li';
|
||||
|
||||
// Auto show the selected Archive ID
|
||||
// Set the URL param "archive_id" to the current Archive ID. This is a just in case.
|
||||
const url = new URL(location);
|
||||
url.searchParams.set('archive_id', $slct.archive_id);
|
||||
history.pushState({}, '', url);
|
||||
|
||||
// $ae_app.archives.show_main__options = true;
|
||||
$ae_app.archives.show_list__archive_obj_li = false;
|
||||
$ae_app.archives.show_edit__archive_obj = false;
|
||||
$ae_app.archives.show_view__archive_obj = true;
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** View - Archive Obj');
|
||||
});
|
||||
|
||||
function handle_archive_content_obj_created(event) {
|
||||
console.log('*** handle_archive_content_obj_created() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
$slct.archive_content_id = null;
|
||||
$slct.archive_content_obj = {};
|
||||
|
||||
$slct_trigger = 'load__archive_obj_li';
|
||||
$slct_trigger = 'load__archive_obj';
|
||||
$slct_trigger = 'load__archive_content_obj_li';
|
||||
|
||||
// $ae_app.archives.show_list__archive_obj_li = false;
|
||||
// $ae_app.archives.show_edit__archive_obj = false;
|
||||
// $ae_app.archives.show_view__archive_obj = true;
|
||||
$ae_app.archives.show_edit__archive_content_id = false;
|
||||
}
|
||||
function handle_archive_content_obj_updated(event) {
|
||||
console.log('*** handle_archive_content_obj_updated() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
$slct_trigger = 'load__archive_obj';
|
||||
$slct_trigger = 'load__archive_content_obj_li';
|
||||
|
||||
// $ae_app.archives.show_list__archive_obj_li = false;
|
||||
// $ae_app.archives.show_edit__archive_obj = false;
|
||||
// $ae_app.archives.show_view__archive_obj = true;
|
||||
$ae_app.archives.show_edit__archive_content_id = false;
|
||||
}
|
||||
function handle_archive_content_obj_deleted(event) {
|
||||
console.log('*** handle_archive_content_obj_deleted() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
$slct_trigger = 'load__archive_obj_li';
|
||||
$slct_trigger = 'load__archive_obj';
|
||||
$slct_trigger = 'load__archive_content_obj_li';
|
||||
|
||||
// $ae_app.archives.show_list__archive_obj_li = false;
|
||||
// $ae_app.archives.show_edit__archive_obj = false;
|
||||
// $ae_app.archives.show_view__archive_obj = true;
|
||||
$ae_app.archives.show_edit__archive_content_id = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<section class="svelte_component ae_section ae_view archive_obj view__archive_obj" bind:clientHeight={$ae_app.iframe_height_modal_body}>
|
||||
|
||||
<header class="ae_header archive__header">
|
||||
<h2 class="archive__name">{@html $slct.archive_obj.name}</h2>
|
||||
</header>
|
||||
|
||||
<section class="archive__content">
|
||||
{#if $slct.archive_obj.description}<div class="ae_value archive__description">{@html $slct.archive_obj.description}</div>{/if}
|
||||
{#if $slct.archive_obj.content_html}<div class="ae_value">{@html $slct.archive_obj.content_html}</div>{/if}
|
||||
{#if $slct.archive_obj.original_url}
|
||||
<div>
|
||||
<span class="ae_label">URL:</span>
|
||||
<span class="ae_value">{$slct.archive_obj.original_url}</span>
|
||||
</div>
|
||||
{/if}
|
||||
{#if $slct.archive_obj.original_datetime}
|
||||
<div class="archive__original_datetime">
|
||||
<span class="ae_label">Start Date:</span>
|
||||
<span class="ae_value">{ae.util.iso_datetime_formatter($slct.archive_obj.original_datetime, 'datetime_long')}</span>
|
||||
</div>
|
||||
{/if}
|
||||
{#if $slct.archive_obj.original_timezone}
|
||||
<span class="ae_label">Timezone:</span>
|
||||
<span class="ae_value">{$slct.archive_obj.original_timezone}</span>
|
||||
{/if}
|
||||
{#if $slct.archive_obj.original_location}
|
||||
<div>
|
||||
<span class="ae_label">Location:</span>
|
||||
<span class="ae_value">{$slct.archive_obj.original_location}</span>
|
||||
</div>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
<section
|
||||
class="ae_section ae_meta archive__meta"
|
||||
class:ae_d_none={!$ae_app.administrator_access}
|
||||
>
|
||||
<div class="ae_group">
|
||||
<div class="archive__created_on_updated_on">
|
||||
<span class="ae_label">Created on:</span>
|
||||
<span class="ae_value archive__created_on">{ae.util.iso_datetime_formatter($slct.archive_obj.created_on, 'datetime_iso_no_seconds')}</span>
|
||||
{#if $slct.archive_obj.updated_on}
|
||||
<span class="ae_label">Updated on:</span>
|
||||
<span class="ae_value">{ae.util.iso_datetime_formatter($slct.archive_obj.updated_on, 'datetime_iso_no_seconds')}</span>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if $ae_app.trusted_access}
|
||||
<div class="ae_options">
|
||||
{#if $ae_app.trusted_access || $slct.archive_obj.external_person_id === $ae_app.novi_uuid}
|
||||
<button
|
||||
on:click={() => {
|
||||
$slct.archive_content_id = null;
|
||||
$slct.archive_content_obj = {};
|
||||
$ae_app.archives.show_edit__archive_content_id = true;
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-warning"
|
||||
title={`Add content for: ${$slct.archive_obj.name}`}
|
||||
>
|
||||
<span class="fas fa-plus"></span> Add Content
|
||||
</button>
|
||||
|
||||
<button
|
||||
on:click={() => {
|
||||
// $slct.archive_id = $slct.archive_obj.archive_id_random;
|
||||
// $slct.archive_obj = $slct.archive_obj;
|
||||
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.set('archive_id', $slct.archive_obj.archive_id_random);
|
||||
// history.pushState({}, '', url);
|
||||
|
||||
// $ae_app.archives.show_main__options = false;
|
||||
// $ae_app.archives.show_list__archive_obj_li = false;
|
||||
$ae_app.archives.show_view__archive_obj = false;
|
||||
$ae_app.archives.show_edit__archive_obj = true;
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-xs btn-warning"
|
||||
title={`Edit archive: ${$slct.archive_obj.name}`}
|
||||
>
|
||||
<span class="fas fa-edit"></span> Edit Archive
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
{#if $slct.archive_obj}
|
||||
<!-- {#each $slct.archive_content_obj_li as idaa_archive_content_obj, index} -->
|
||||
<List_archive_content_obj />
|
||||
<!-- {/each} -->
|
||||
{/if}
|
||||
|
||||
|
||||
|
||||
<!-- {#if $slct.archive_content_obj_li && $slct.archive_content_obj_li.length} -->
|
||||
<!-- {#each $slct.archive_content_obj_li as idaa_archive_content_obj, index}
|
||||
<hr />
|
||||
<span class="archive_content__name">{idaa_archive_content_obj.name}</span>
|
||||
<pre class="archive_content__content">{@html idaa_archive_content_obj.content}</pre>
|
||||
|
||||
<section class="ae_section ae_meta archive_content__meta">
|
||||
<div class="ae_group">
|
||||
<div class="archive_content__created_on_updated_on">
|
||||
Created on:
|
||||
<span class="archive_content__created_on">{ae.util.iso_datetime_formatter(idaa_archive_content_obj.created_on, 'datetime_iso_no_seconds')}
|
||||
{#if idaa_archive_content_obj.updated_on}
|
||||
Updated on:
|
||||
{ae.util.iso_datetime_formatter(idaa_archive_content_obj.updated_on, 'datetime_iso_no_seconds')}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if $ae_app.trusted_access || idaa_archive_content_obj.external_person_id === $ae_app.novi_uuid}
|
||||
<div class="ae_options">
|
||||
<button on:click={() => {
|
||||
$slct.archive_content_id = idaa_archive_content_obj.archive_content_id_random;
|
||||
$slct.archive_content_obj = idaa_archive_content_obj;
|
||||
|
||||
// $ae_app.archives.show_archive_content_list = false;
|
||||
$ae_app.archives.show_edit__archive_content_id = true;
|
||||
// $ae_app.archives.show_view__archive_obj = false;
|
||||
}}
|
||||
class="btn btn-default"
|
||||
>
|
||||
<span class="fas fa-edit"></span> Edit Content
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
{/each} -->
|
||||
<!-- {/if} -->
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<style>
|
||||
.ae_label {
|
||||
font-size: smaller;
|
||||
}
|
||||
.ae_value {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.archive_obj .ae_meta {
|
||||
flex-direction: column;
|
||||
/* justify-content: space-between; */
|
||||
}
|
||||
|
||||
.archive_obj .ae_meta .ae_group {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.archive_obj .ae_meta .ae_options {
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.archive__created_on_updated_on, .archive_content__created_on_updated_on {
|
||||
/* font-size: smaller; */
|
||||
/* background-color: hsla(0,80%,50%,1); */
|
||||
/* color: hsla(0,0%,50%,1); */
|
||||
}
|
||||
</style>
|
||||
73
src/routes/idaa/(idaa)/main.ts
Normal file
73
src/routes/idaa/(idaa)/main.ts
Normal file
@@ -0,0 +1,73 @@
|
||||
import { ae } from "aether_npm_lib";
|
||||
import "./app.pcss";
|
||||
import App from "./App.svelte";
|
||||
import Archives from "./0_archives__main.svelte";
|
||||
import Events from "./0_events__main.svelte";
|
||||
import Posts from "./0_posts__main.svelte";
|
||||
|
||||
let url_params = ae.util.get_url_params();
|
||||
// console.log(url_params);
|
||||
// IMPORTANT: The URL paramater 'uuid' is used to determine if the user is logged in or not. If the user is logged in, the uuid will be passed in as a url param. If the user is not logged in, the uuid will not be passed in as a url param.
|
||||
|
||||
if (document.getElementById("app")) {
|
||||
const app = new App({
|
||||
target: document.getElementById("app"),
|
||||
});
|
||||
}
|
||||
|
||||
if (document.querySelector(".svelte_target.idaa_archives_main")) {
|
||||
const archives_main_app = new Archives({
|
||||
target: document.querySelector(".svelte_target.idaa_archives_main"),
|
||||
props: {
|
||||
archive_id: url_params.archive_id,
|
||||
novi_uuid: url_params.uuid ? url_params.uuid : false,
|
||||
novi_email: decodeURIComponent(url_params.email), // decodeURIComponent() is needed because the email is passed in as a url param. Should this be takenc are of by the ae.util.get_url_params() function?
|
||||
novi_full_name: decodeURIComponent(url_params.full_name),
|
||||
novi_admin_li: ["2b078deb-b4e7-4203-99da-9f7cd62159a5"],
|
||||
novi_trusted_li: [
|
||||
"c9ea07b5-06b0-4a43-a2d0-8d06558c8a82",
|
||||
"58db22ee-4b0a-49a7-9f34-53d2ba85a84b",
|
||||
],
|
||||
results_limit_administrator: 200,
|
||||
results_limit_trusted: 75,
|
||||
results_limit_authenticated: 50,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (document.querySelector(".svelte_target.idaa_events_main")) {
|
||||
const events_main_app = new Events({
|
||||
target: document.querySelector(".svelte_target.idaa_events_main"),
|
||||
props: {
|
||||
event_id: url_params.event_id,
|
||||
novi_uuid: url_params.uuid ? url_params.uuid : false,
|
||||
novi_email: decodeURIComponent(url_params.email), // decodeURIComponent() is needed because the email is passed in as a url param. Should this be takenc are of by the ae.util.get_url_params() function?
|
||||
novi_full_name: decodeURIComponent(url_params.full_name),
|
||||
novi_admin_li: ["2b078deb-b4e7-4203-99da-9f7cd62159a5"],
|
||||
novi_trusted_li: [
|
||||
"c9ea07b5-06b0-4a43-a2d0-8d06558c8a82",
|
||||
"58db22ee-4b0a-49a7-9f34-53d2ba85a84b",
|
||||
],
|
||||
results_limit_administrator: 200,
|
||||
results_limit_trusted: 200,
|
||||
results_limit_authenticated: 50,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (document.querySelector(".svelte_target.idaa_posts_main")) {
|
||||
const posts_main_app = new Posts({
|
||||
target: document.querySelector(".svelte_target.idaa_posts_main"),
|
||||
props: {
|
||||
post_id: url_params.post_id,
|
||||
novi_uuid: url_params.uuid ? url_params.uuid : false,
|
||||
novi_email: url_params.email,
|
||||
novi_full_name: url_params.full_name,
|
||||
novi_admin_li: ["2b078deb-b4e7-4203-99da-9f7cd62159a5"],
|
||||
novi_trusted_li: [
|
||||
"c9ea07b5-06b0-4a43-a2d0-8d06558c8a82",
|
||||
"58db22ee-4b0a-49a7-9f34-53d2ba85a84b",
|
||||
],
|
||||
},
|
||||
});
|
||||
}
|
||||
698
src/routes/idaa/(idaa)/posts/0_posts__main.svelte
Normal file
698
src/routes/idaa/(idaa)/posts/0_posts__main.svelte
Normal file
@@ -0,0 +1,698 @@
|
||||
<script lang="ts">
|
||||
type key_val = {
|
||||
[key: string]: any;
|
||||
};
|
||||
// *** Import Svelte core
|
||||
import { onMount } from '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 Aether module variables and functions
|
||||
|
||||
// *** Import Aether module components
|
||||
import Edit_post_obj from './10_edit__post_obj.svelte';
|
||||
import View_post_obj from './10_view__post_obj.svelte';
|
||||
|
||||
// *** Export/Exposed variables and functions for component
|
||||
export let account_id: string = $ae_app.account_id;
|
||||
export let post_id: string = $ae_app.posts.post_id;
|
||||
|
||||
export let novi_uuid: string = $ae_app.novi_uuid;
|
||||
export let novi_email: string = $ae_app.novi_email;
|
||||
export let novi_full_name: string = $ae_app.novi_full_name;
|
||||
export let novi_admin_li: string = $ae_app.novi_admin_li;
|
||||
export let novi_trusted_li: string = $ae_app.novi_trusted_li;
|
||||
|
||||
// *** Set initial variables
|
||||
$ae_app.novi_uuid = novi_uuid;
|
||||
$ae_app.novi_email = decodeURIComponent(novi_email);
|
||||
$ae_app.novi_full_name = decodeURIComponent(novi_full_name);
|
||||
$ae_app.novi_admin_li = novi_admin_li;
|
||||
$ae_app.novi_trusted_li = novi_trusted_li;
|
||||
|
||||
$ae_app.posts.show_main__options = true;
|
||||
$ae_app.posts.show_list__post_obj_li = true;
|
||||
|
||||
// NOTE: Check if the novi_uuid is in the novi_admin_li list
|
||||
if ($ae_app.novi_uuid && $ae_app.novi_admin_li) {
|
||||
if ($ae_app.novi_admin_li.includes($ae_app.novi_uuid)) {
|
||||
$ae_app.access_type = 'administrator';
|
||||
$ae_app.administrator_access = true;
|
||||
$ae_app.trusted_access = true;
|
||||
}
|
||||
}
|
||||
// NOTE: Check if the novi_uuid is in the novi_trusted_li list
|
||||
if ($ae_app.novi_uuid && $ae_app.novi_trusted_li) {
|
||||
if ($ae_app.novi_trusted_li.includes($ae_app.novi_uuid)) {
|
||||
$ae_app.access_type = 'trusted';
|
||||
$ae_app.trusted_access = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($ae_app.administrator_access) {
|
||||
$ae_app.posts.enabled = 'enabled';
|
||||
$ae_app.posts.hidden = 'not_hidden';
|
||||
$ae_app.events.limit = 150;
|
||||
} else if ($ae_app.trusted_access) {
|
||||
$ae_app.posts.enabled = 'enabled';
|
||||
$ae_app.posts.hidden = 'not_hidden';
|
||||
$ae_app.events.limit = 75;
|
||||
} else {
|
||||
$ae_app.posts.enabled = 'enabled';
|
||||
$ae_app.posts.hidden = 'not_hidden';
|
||||
$ae_app.events.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);
|
||||
|
||||
$ae_app.events.show_main__options = true;
|
||||
$ae_app.posts.show_list__post_obj_li = true;
|
||||
$ae_app.posts.show_edit__post_id = false;
|
||||
$ae_app.posts.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 = $ae_app.posts.enabled;
|
||||
let hidden = $ae_app.posts.hidden;
|
||||
let limit = $ae_app.posts.limit;
|
||||
let offset = $ae_app.posts.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, "*");
|
||||
|
||||
// $ae_app.posts.show_main__options = false;
|
||||
// $ae_app.posts.show_list__post_li = false;
|
||||
// $ae_app.posts.show_view__post_id = true;
|
||||
// $ae_app.posts.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 = $ae_app.posts.enabled;
|
||||
// let hidden = $ae_app.posts.hidden;
|
||||
// let limit = $ae_app.posts.limit;
|
||||
// let offset = $ae_app.posts.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 = $ae_app.posts.enabled;
|
||||
let hidden = $ae_app.posts.hidden;
|
||||
let limit = $ae_app.posts.limit;
|
||||
let offset = $ae_app.posts.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';
|
||||
|
||||
$ae_app.posts.show_list__post_obj_li = true;
|
||||
$ae_app.posts.show_edit__post_id = false;
|
||||
$ae_app.posts.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';
|
||||
|
||||
$ae_app.posts.show_list__post_obj_li = true;
|
||||
$ae_app.posts.show_edit__post_id = false;
|
||||
$ae_app.posts.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';
|
||||
|
||||
$ae_app.posts.show_list__post_obj_li = true;
|
||||
$ae_app.posts.show_edit__post_id = false;
|
||||
$ae_app.posts.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: {$ae_app.novi_full_name}
|
||||
<span class="details">
|
||||
(
|
||||
{$ae_app.novi_email}
|
||||
{#if $ae_app.administrator_access}
|
||||
<span class="access_type administrator_access">Administrator</span>
|
||||
{:else if $ae_app.trusted_access}
|
||||
<span class="access_type trusted_access">Trusted</span>
|
||||
{/if}
|
||||
<span class="novi_uuid">UUID: {$ae_app.novi_uuid}</span>
|
||||
)
|
||||
</span>
|
||||
</p>
|
||||
<!-- <p>Page height: {window.innerHeight}</p> -->
|
||||
</section>
|
||||
|
||||
{#if $ae_app.posts.show_main__options}
|
||||
<section class="ae_section ae_options ae_row post_obj__options">
|
||||
|
||||
{#if $ae_app.trusted_access && $ae_app.posts.hidden == 'not_hidden'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.posts.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_app.trusted_access && $ae_app.posts.hidden == 'all'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.posts.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_app.administrator_access}
|
||||
{#if $ae_app.posts.enabled == 'enabled'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.posts.hidden = 'all';
|
||||
$ae_app.posts.enabled = 'all';
|
||||
$ae_app.posts.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={() => {
|
||||
$ae_app.posts.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);
|
||||
|
||||
$ae_app.posts.show_main__options = true;
|
||||
$ae_app.posts.show_list__post_obj_li = true;
|
||||
$ae_app.posts.show_edit__post_id = true;
|
||||
$ae_app.posts.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 $ae_app.posts.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, "*");
|
||||
|
||||
$ae_app.posts.show_main__options = true;
|
||||
$ae_app.posts.show_list__post_obj_li = true;
|
||||
// $ae_app.posts.show_edit__post_id = false;
|
||||
$ae_app.posts.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_app.trusted_access || idaa_post_obj.external_person_id === $ae_app.novi_uuid || idaa_post_obj.email === $ae_app.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';
|
||||
|
||||
$ae_app.posts.show_main__options = true;
|
||||
$ae_app.posts.show_list__post_obj_li = true;
|
||||
$ae_app.posts.show_edit__post_id = true;
|
||||
// $ae_app.posts.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;
|
||||
|
||||
$ae_app.posts.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_app.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 $ae_app.posts.show_edit__post_id}
|
||||
<Element_modal_v3
|
||||
show = { true }
|
||||
modal_cover_body = { false }
|
||||
report_client_dimensions = { true }
|
||||
on:close={ () => {
|
||||
$ae_app.posts.show_main__options = true;
|
||||
$ae_app.posts.show_list__post_obj_li = true;
|
||||
$ae_app.posts.show_edit__post_id = false;
|
||||
// $ae_app.posts.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 $ae_app.posts.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 = [];
|
||||
|
||||
$ae_app.posts.show_main__options = true;
|
||||
$ae_app.posts.show_list__post_obj_li = true;
|
||||
// $ae_app.posts.show_edit__post_id = false;
|
||||
$ae_app.posts.show_view__post_id = false;
|
||||
$ae_app.posts.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>
|
||||
476
src/routes/idaa/(idaa)/posts/10_edit__post_comment_obj.svelte
Normal file
476
src/routes/idaa/(idaa)/posts/10_edit__post_comment_obj.svelte
Normal file
@@ -0,0 +1,476 @@
|
||||
<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: $ae_app.novi_uuid,
|
||||
full_name: $ae_app.novi_full_name,
|
||||
email: $ae_app.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_app.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 : $ae_app.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_app.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 : $ae_app.novi_full_name)}
|
||||
>
|
||||
</label>
|
||||
|
||||
{#if $ae_app.trusted_access}
|
||||
<label for="email">Your email
|
||||
{#if !$ae_app.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 : $ae_app.novi_email)}
|
||||
readonly={!$ae_app.trusted_access}
|
||||
>
|
||||
<span class="ae_highlight">Secondary link using the Novi email address</span>
|
||||
</label>
|
||||
{/if}
|
||||
|
||||
|
||||
{#if $ae_app.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_app.administrator_access}
|
||||
<label>Enable
|
||||
<input
|
||||
type="checkbox"
|
||||
name="enable"
|
||||
id="enable"
|
||||
bind:checked={$slct.post_comment_obj.enable}
|
||||
>
|
||||
</label>
|
||||
{/if}
|
||||
|
||||
<!-- {#if $ae_app.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_app.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_app.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>
|
||||
598
src/routes/idaa/(idaa)/posts/10_edit__post_obj.svelte
Normal file
598
src/routes/idaa/(idaa)/posts/10_edit__post_obj.svelte
Normal file
@@ -0,0 +1,598 @@
|
||||
<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'] = $ae_app.novi_uuid;
|
||||
// }
|
||||
// if (!$slct.post_obj.full_name) {
|
||||
// $slct.post_obj['full_name'] = $ae_app.novi_full_name;
|
||||
// }
|
||||
// if (!$slct.post_obj.email) {
|
||||
// $slct.post_obj['email'] = $ae_app.novi_email;
|
||||
// }
|
||||
}
|
||||
} else {
|
||||
$slct.post_id = null;
|
||||
$slct.post_obj = {
|
||||
title: '',
|
||||
content: '',
|
||||
topic_id: null,
|
||||
anonymous: false,
|
||||
external_person_id: $ae_app.novi_uuid,
|
||||
full_name: $ae_app.novi_full_name,
|
||||
email: $ae_app.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_app.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_app.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 : $ae_app.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_app.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 : $ae_app.novi_full_name)}
|
||||
readonly={!$ae_app.trusted_access}
|
||||
>
|
||||
</label>
|
||||
|
||||
{#if $ae_app.trusted_access}
|
||||
<label for="email">Email
|
||||
{#if !$ae_app.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 : $ae_app.novi_email)}
|
||||
readonly={!$ae_app.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_app.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_app.administrator_access}
|
||||
<label>Enable
|
||||
<input
|
||||
type="checkbox"
|
||||
name="enable"
|
||||
id="enable"
|
||||
bind:checked={$slct.post_obj.enable}
|
||||
>
|
||||
</label>
|
||||
{/if}
|
||||
|
||||
{#if $ae_app.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_app.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_app.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>
|
||||
261
src/routes/idaa/(idaa)/posts/10_view__post_obj.svelte
Normal file
261
src/routes/idaa/(idaa)/posts/10_view__post_obj.svelte
Normal file
@@ -0,0 +1,261 @@
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher, onMount } from 'svelte';
|
||||
import { fade } from 'svelte/transition';
|
||||
|
||||
import { ae, Element_modal_v3 } from 'aether_npm_lib';
|
||||
import { slct, slct_trigger, ae_app } from './stores';
|
||||
|
||||
import Edit_post_comment_obj from './10_edit__post_comment_obj.svelte';
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
if ($slct.post_id) {
|
||||
console.log(`Post ID selected: ${$slct.post_id}`);
|
||||
console.log(`Post Object selected: ${$slct.post_obj}`)
|
||||
|
||||
$slct_trigger = 'load__post_obj';
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** View - Post Obj');
|
||||
});
|
||||
|
||||
function handle_post_comment_obj_created(event) {
|
||||
console.log('*** handle_post_comment_obj_created() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
$slct.post_comment_id = null;
|
||||
$slct.post_comment_obj = {};
|
||||
|
||||
$slct_trigger = 'load__post_obj_li';
|
||||
$slct_trigger = 'load__post_obj';
|
||||
$slct_trigger = 'load__post_comment_obj_li';
|
||||
|
||||
// $ae_app.posts.show_post_list = false;
|
||||
// $ae_app.posts.show_edit__post_id = false;
|
||||
// $ae_app.posts.show_view__post_id = true;
|
||||
$ae_app.posts.show_edit__post_comment = false;
|
||||
}
|
||||
function handle_post_comment_obj_updated(event) {
|
||||
console.log('*** handle_post_comment_obj_updated() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
$slct_trigger = 'load__post_obj';
|
||||
$slct_trigger = 'load__post_comment_obj_li';
|
||||
|
||||
// $ae_app.posts.show_post_list = false;
|
||||
// $ae_app.posts.show_edit__post_id = false;
|
||||
// $ae_app.posts.show_view__post_id = true;
|
||||
$ae_app.posts.show_edit__post_comment = false;
|
||||
}
|
||||
function handle_post_comment_obj_deleted(event) {
|
||||
console.log('*** handle_post_comment_obj_deleted() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
$slct_trigger = 'load__post_obj_li';
|
||||
$slct_trigger = 'load__post_obj';
|
||||
$slct_trigger = 'load__post_comment_obj_li';
|
||||
|
||||
// $ae_app.posts.show_post_list = false;
|
||||
// $ae_app.posts.show_edit__post_id = false;
|
||||
// $ae_app.posts.show_view__post_id = true;
|
||||
$ae_app.posts.show_edit__post_comment = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<section
|
||||
bind:clientHeight={$ae_app.iframe_height_modal_body}
|
||||
class="svelte_component ae_section ae_view post_obj view__post_obj"
|
||||
>
|
||||
|
||||
<div class="post__header">
|
||||
<h2 class="post__title">
|
||||
{@html $slct.post_obj.title}
|
||||
{#if $slct.post_obj.topic_id}<span class="badge badge-info bg-info"><span class="fas fa-user-md"></span> {$slct.post_obj.topic_name}</span>{/if}
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<div class="post__content">{@html $slct.post_obj.content}</div>
|
||||
|
||||
<section class="ae_section ae_meta post__meta">
|
||||
<div class="ae_group">
|
||||
{#if ($slct.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 ($slct.post_obj.full_name)}
|
||||
<div class="post__posted_by">
|
||||
Posted by: <span class="fas fa-user"></span> <span class="post__full_name">{$slct.post_obj.full_name}
|
||||
{#if $ae_app.trusted_access && $slct.post_obj.email}
|
||||
<a href="mailto:{$slct.post_obj.email}?subject=IDAA BB Post">{$slct.post_obj.email}</a>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="post__created_on_updated_on">
|
||||
{#if !$slct.post_obj.updated_on}
|
||||
<span class="ae_label">Created on:</span>
|
||||
<span class="ae_value post__created_on">{ae.util.iso_datetime_formatter($slct.post_obj.created_on, 'datetime_iso_no_seconds')}</span>
|
||||
{:else}
|
||||
<span class="ae_label">Updated on:</span>
|
||||
<span class="ae_value post__updated_on">
|
||||
{ae.util.iso_datetime_formatter($slct.post_obj.updated_on, 'datetime_iso_no_seconds')}</span>
|
||||
{/if}
|
||||
<span class="post__archive_on">
|
||||
<span class="ae_label">Archive on:</span>
|
||||
<span class="ae_value">{ae.util.iso_datetime_formatter($slct.post_obj.archive_on, 'datetime_iso_no_seconds')}</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ae_options">
|
||||
{#if $slct.post_obj.post_comment_count}
|
||||
<span class="ae_badge ae_info post__post_comment_count">
|
||||
<span class="fas fa-comment"></span> {($slct.post_obj.post_comment_count == 1 ? `${$slct.post_obj.post_comment_count} comment` : `${$slct.post_obj.post_comment_count} comments` )}
|
||||
</span>
|
||||
{/if}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.posts.show_edit__post_comment = true;
|
||||
}}
|
||||
class="btn btn-primary"
|
||||
title={`New comment on: ${$slct.post_obj.title}`}
|
||||
>
|
||||
<span class="fas fa-plus"></span> New Comment
|
||||
</button>
|
||||
|
||||
{#if $ae_app.trusted_access || $slct.post_obj.external_person_id === $ae_app.novi_uuid || $slct.post_obj.email === $ae_app.novi_email}
|
||||
<button
|
||||
on:click={() => {
|
||||
// $slct.post_id = $slct.post_obj.post_id_random;
|
||||
// $slct.post_obj = $slct.post_obj;
|
||||
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.set('post_id', $slct.post_obj.post_id_random);
|
||||
// history.pushState({}, '', url);
|
||||
|
||||
// $ae_app.posts.show_main__options = false;
|
||||
// $ae_app.posts.show_list__post_li = false;
|
||||
$ae_app.posts.show_view__post_id = false;
|
||||
$ae_app.posts.show_edit__post_id = true;
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-xs btn-secondary"
|
||||
title={`Edit post: ${$slct.post_obj.name}`}
|
||||
>
|
||||
<span class="fas fa-edit"></span> Edit
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
{#if $ae_app.posts.show_edit__post_comment}
|
||||
<section class="bb_post_comment_crud">
|
||||
|
||||
<Element_modal_v3
|
||||
show = { true }
|
||||
modal_cover_body = { true }
|
||||
on:close={ () => {
|
||||
$slct.post_comment_id = null;
|
||||
$slct.post_comment_obj = {};
|
||||
|
||||
// $ae_app.posts.show_post_list = true;
|
||||
// $ae_app.posts.show_edit__post_id = false;
|
||||
// $ae_app.posts.show_view__post_id = false;
|
||||
$ae_app.posts.show_edit__post_comment = false;
|
||||
}}
|
||||
>
|
||||
<span slot="header_title">Comment on: {($slct.post_obj.title ? $slct.post_obj.title : '')}</span>
|
||||
|
||||
<span slot="body">
|
||||
<section class="post_comment_obj_view">
|
||||
<Edit_post_comment_obj on:post_comment_obj_created={handle_post_comment_obj_created} on:post_comment_obj_updated={handle_post_comment_obj_updated} on:post_comment_obj_deleted={handle_post_comment_obj_deleted} />
|
||||
</section>
|
||||
</span>
|
||||
</Element_modal_v3>
|
||||
</section>
|
||||
{/if}
|
||||
|
||||
{#if $slct.post_comment_obj_li.length}
|
||||
{#each $slct.post_comment_obj_li as idaa_post_comment_obj, index}
|
||||
<hr />
|
||||
<div class="post_comment__content">{@html idaa_post_comment_obj.content}</div>
|
||||
|
||||
|
||||
<section class="ae_section ae_meta post_comment__meta">
|
||||
<div class="ae_group">
|
||||
<span class="post_comment__posted_by `comment_by_container">
|
||||
<span class="comment_by_lable">Comment by:</span>
|
||||
{#if idaa_post_comment_obj.anonymous}
|
||||
<span class="fas fa-user-secret"></span>
|
||||
<span class="comment_by_full_name anonymous">Anonymous</span>
|
||||
{:else}
|
||||
<span class="fas fa-user"></span>
|
||||
<span class="comment_by_full_name">{idaa_post_comment_obj.full_name}</span>
|
||||
<!-- {#if idaa_post_comment_obj.email}
|
||||
(<a href="mailto:{idaa_post_comment_obj.email}"><span class="comment_by_email">{idaa_post_comment_obj.email}</span></a>)
|
||||
{/if} -->
|
||||
{/if}
|
||||
<div class="post_comment__created_on_updated_on">
|
||||
Created on:
|
||||
<span class="post_comment__created_on">{ae.util.iso_datetime_formatter(idaa_post_comment_obj.created_on, 'datetime_iso_no_seconds')}
|
||||
{#if idaa_post_comment_obj.updated_on}
|
||||
Updated on:
|
||||
{ae.util.iso_datetime_formatter(idaa_post_comment_obj.updated_on, 'datetime_iso_no_seconds')}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if $ae_app.trusted_access || idaa_post_comment_obj.external_person_id === $ae_app.novi_uuid}
|
||||
<div class="ae_options">
|
||||
<button on:click={() => {
|
||||
$slct.post_comment_id = idaa_post_comment_obj.post_comment_id_random;
|
||||
$slct.post_comment_obj = idaa_post_comment_obj;
|
||||
|
||||
// $ae_app.posts.show_post_comment_list = false;
|
||||
$ae_app.posts.show_edit__post_comment = true;
|
||||
// $ae_app.posts.show_view__post_id = false;
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-secondary"
|
||||
>
|
||||
<span class="fas fa-edit"></span> Edit Comment
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
{/each}
|
||||
{/if}
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<style>
|
||||
.post_obj .ae_meta {
|
||||
flex-direction: column;
|
||||
/* justify-content: space-between; */
|
||||
}
|
||||
|
||||
.post_obj .ae_meta .ae_group {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.post_obj .ae_meta .ae_options {
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.post__posted_by, .post_comment__posted_by {
|
||||
/* font-size: smaller; */
|
||||
/* background-color: hsla(0,80%,50%,1); */
|
||||
/* color: hsla(0,0%,50%,1); */
|
||||
}
|
||||
|
||||
.post__created_on_updated_on, .post_comment__created_on_updated_on {
|
||||
/* font-size: smaller; */
|
||||
/* background-color: hsla(0,80%,50%,1); */
|
||||
/* color: hsla(0,0%,50%,1); */
|
||||
}
|
||||
</style>
|
||||
835
src/routes/idaa/(idaa)/recovery_meetings/0_events__main.svelte
Normal file
835
src/routes/idaa/(idaa)/recovery_meetings/0_events__main.svelte
Normal file
@@ -0,0 +1,835 @@
|
||||
<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 './10_edit__event_obj.svelte';
|
||||
import List_event_obj from './10_list__event_obj.svelte';
|
||||
import View_event_obj from './10_view__event_obj.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 = $ae_app.events.event_id;
|
||||
|
||||
export let novi_uuid: string = $ae_app.novi_uuid;
|
||||
export let novi_email: string = $ae_app.novi_email;
|
||||
export let novi_full_name: string = $ae_app.novi_full_name;
|
||||
export let novi_admin_li: string = $ae_app.novi_admin_li;
|
||||
export let novi_trusted_li: string = $ae_app.novi_trusted_li;
|
||||
|
||||
// *** Set initial variables
|
||||
$ae_app.novi_uuid = novi_uuid;
|
||||
$ae_app.novi_email = decodeURIComponent(novi_email);
|
||||
$ae_app.novi_full_name = decodeURIComponent(novi_full_name);
|
||||
$ae_app.novi_admin_li = novi_admin_li;
|
||||
$ae_app.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 = [];
|
||||
}
|
||||
|
||||
$ae_app.events.show_main__options = true; // Section for: search area, buttons for filtering events, create new event (Meeting).
|
||||
$ae_app.events.show_list__event_obj_li = true;
|
||||
$ae_app.events.fulltext_search_qry_str = '';
|
||||
$ae_app.events.qry_virtual = false;
|
||||
$ae_app.events.qry_physical = false;
|
||||
$ae_app.events.qry_type = '';
|
||||
|
||||
// NOTE: Check if the novi_uuid is in the novi_admin_li list
|
||||
if ($ae_app.novi_uuid && $ae_app.novi_admin_li) {
|
||||
if ($ae_app.novi_admin_li.includes($ae_app.novi_uuid)) {
|
||||
$ae_app.access_type = 'administrator';
|
||||
$ae_app.administrator_access = true;
|
||||
$ae_app.trusted_access = true;
|
||||
}
|
||||
}
|
||||
// NOTE: Check if the novi_uuid is in the novi_trusted_li list
|
||||
if ($ae_app.novi_uuid && $ae_app.novi_trusted_li) {
|
||||
if ($ae_app.novi_trusted_li.includes($ae_app.novi_uuid)) {
|
||||
$ae_app.access_type = 'trusted';
|
||||
$ae_app.trusted_access = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($ae_app.administrator_access) {
|
||||
$ae_app.events.enabled = 'enabled';
|
||||
$ae_app.events.hidden = 'not_hidden';
|
||||
$ae_app.events.limit = 150;
|
||||
} else if ($ae_app.trusted_access) {
|
||||
$ae_app.events.enabled = 'enabled';
|
||||
$ae_app.events.hidden = 'not_hidden';
|
||||
$ae_app.events.limit = 75;
|
||||
} else {
|
||||
$ae_app.events.enabled = 'enabled';
|
||||
$ae_app.events.hidden = 'not_hidden';
|
||||
$ae_app.events.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, "*");
|
||||
|
||||
$ae_app.events.show_main__options = true;
|
||||
$ae_app.events.show_list__event_obj_li = true;
|
||||
$ae_app.events.show_view__event_obj = true;
|
||||
$ae_app.events.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 ($ae_app.events.qry_status == 'loading') {
|
||||
console.log('*** $ae_app.events.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('*** $ae_app.events.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($ae_app.events);
|
||||
|
||||
// The fulltext search should be lower case
|
||||
// let fulltext_search_qry_str = $ae_app.events.fulltext_search_qry_str.toLowerCase();
|
||||
let fulltext_search_qry_str = $ae_app.events.fulltext_search_qry_str;
|
||||
let qry_virtual = $ae_app.events.qry_virtual;
|
||||
let qry_physical = $ae_app.events.qry_physical;
|
||||
let qry_type = $ae_app.events.qry_type;
|
||||
|
||||
let enabled = $ae_app.events.enabled;
|
||||
let hidden = $ae_app.events.hidden;
|
||||
let limit = $ae_app.events.limit;
|
||||
let offset = $ae_app.events.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;
|
||||
// }
|
||||
$ae_app.events.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 () {
|
||||
$ae_app.events.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, "*");
|
||||
|
||||
// $ae_app.events.show_main__options = false;
|
||||
// $ae_app.events.show_list__event_obj_li = false;
|
||||
// $ae_app.events.show_view__event_obj = true;
|
||||
// $ae_app.events.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 = $ae_app.events.enabled;
|
||||
// let hidden = $ae_app.events.hidden;
|
||||
// let limit = $ae_app.events.limit;
|
||||
// let offset = $ae_app.events.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';
|
||||
|
||||
$ae_app.events.show_main__options = false;
|
||||
$ae_app.events.show_list__event_obj_li = false;
|
||||
$ae_app.events.show_view__event_obj = true;
|
||||
$ae_app.events.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';
|
||||
|
||||
$ae_app.events.show_main__options = false;
|
||||
$ae_app.events.show_list__event_obj_li = false;
|
||||
$ae_app.events.show_view__event_obj = true;
|
||||
$ae_app.events.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';
|
||||
|
||||
$ae_app.events.show_main__options = true;
|
||||
$ae_app.events.show_list__event_obj_li = true;
|
||||
$ae_app.events.show_view__event_obj = false;
|
||||
$ae_app.events.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 ($ae_app.events.fulltext_search_qry_str.length > 2) {
|
||||
// } else {
|
||||
// $ae_app.events.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) {
|
||||
$ae_app.events.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);
|
||||
$ae_app.events.ds[code] = get_data_store_result.text;
|
||||
} else if (data_type == 'json') {
|
||||
// console.log(get_data_store_result.json);
|
||||
$ae_app.events.ds[code] = get_data_store_result.json;
|
||||
}
|
||||
|
||||
// console.log(`Code: ${$ae_app.events.ds[code]}`);
|
||||
// console.log(`Code:`, $ae_app.events.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: {$ae_app.novi_full_name}
|
||||
<span class="details">
|
||||
(
|
||||
{$ae_app.novi_email}
|
||||
{#if $ae_app.administrator_access}
|
||||
<span class="access_type administrator_access">Administrator</span>
|
||||
{:else if $ae_app.trusted_access}
|
||||
<span class="access_type trusted_access">Trusted</span>
|
||||
{/if}
|
||||
<span class="novi_uuid">UUID: {$ae_app.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 $ae_app.events.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 $ae_app.events.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={$ae_app.events.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={$ae_app.events.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={$ae_app.events.qry_virtual}
|
||||
on:change={() => {$slct_trigger = 'load__event_obj_li';}}
|
||||
>
|
||||
</label>
|
||||
<label>In-person
|
||||
<input
|
||||
name="qry_physical"
|
||||
type="checkbox"
|
||||
bind:checked={$ae_app.events.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={$ae_app.events.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={$ae_app.events.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={$ae_app.events.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={$ae_app.events.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_app.administrator_access}
|
||||
<label>Al-Anon (old)
|
||||
<input
|
||||
name="qry_type"
|
||||
type="radio"
|
||||
value="Al-Anon"
|
||||
bind:group={$ae_app.events.qry_type}
|
||||
on:change={() => {$slct_trigger = 'load__event_obj_li';}}
|
||||
>
|
||||
</label>
|
||||
<label>Other (old)
|
||||
<input
|
||||
name="qry_type"
|
||||
type="radio"
|
||||
value="Other"
|
||||
bind:group={$ae_app.events.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_app.trusted_access && $ae_app.events.hidden == 'not_hidden'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.events.hidden = 'all';
|
||||
$ae_app.events.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_app.trusted_access && $ae_app.events.hidden == 'all'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.events.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_app.administrator_access && $ae_app.events.enabled == 'enabled'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.events.hidden = 'all';
|
||||
$ae_app.events.enabled = 'all';
|
||||
$ae_app.events.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_app.administrator_access && $ae_app.events.enabled == 'all'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.events.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);
|
||||
|
||||
$ae_app.events.show_main__options = false;
|
||||
$ae_app.events.show_list__event_obj_li = false;
|
||||
$ae_app.events.show_view__event_obj = false;
|
||||
$ae_app.events.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 $ae_app.events.show_list__event_obj_li}
|
||||
<List_event_obj />
|
||||
{/if}
|
||||
|
||||
|
||||
{#if $ae_app.events.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={ () => {
|
||||
$ae_app.events.show_main__options = true;
|
||||
$ae_app.events.show_list__event_obj_li = true;
|
||||
$ae_app.events.show_edit__event_obj = false;
|
||||
$ae_app.events.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 $ae_app.events.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 = {};
|
||||
|
||||
$ae_app.events.show_main__options = true;
|
||||
$ae_app.events.show_list__event_obj_li = true;
|
||||
$ae_app.events.show_view__event_obj = false;
|
||||
$ae_app.events.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>
|
||||
1207
src/routes/idaa/(idaa)/recovery_meetings/10_edit__event_obj.svelte
Normal file
1207
src/routes/idaa/(idaa)/recovery_meetings/10_edit__event_obj.svelte
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,303 @@
|
||||
<script lang="ts">
|
||||
// *** Import Svelte core
|
||||
import { onMount } from 'svelte';
|
||||
import { Spinner } from 'flowbite-svelte';
|
||||
|
||||
// *** Import Aether core variables and functions
|
||||
import { ae } from 'aether_npm_lib';
|
||||
import { slct, ae_app, slct_trigger } from './stores';
|
||||
|
||||
export let container_class_li = [];
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** List - Event Obj');
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<section class="svelte_component ae_section ae_list event_obj_li list__event_obj recovery_meeting_list {container_class_li.join(' ')}">
|
||||
{#if $slct.event_obj_li && $slct.event_obj_li.length}
|
||||
|
||||
{#each $slct.event_obj_li as idaa_event_obj, index}
|
||||
<div
|
||||
id={`idaa_recovery_meeting_id__${idaa_event_obj.event_id_random}`}
|
||||
class="container recovery_meeting ae_object event_obj"
|
||||
class:meeting_physical={idaa_event_obj.physical}
|
||||
class:meeting_virtual={idaa_event_obj.virtual}
|
||||
>
|
||||
|
||||
<header class="ae_header event__header">
|
||||
<h3>
|
||||
<span class="event__name">{idaa_event_obj.name}</span>
|
||||
<span class="badge badge-info bg-info">{#if idaa_event_obj.physical && idaa_event_obj.virtual}<span class="fas fa-home"></span> F2F and <span class="fas fa-laptop"></span> Virtual{:else if idaa_event_obj.physical}<span class="fas fa-home"></span> F2F{:else if idaa_event_obj.virtual}<span class="fas fa-laptop"></span> Virtual{/if}</span>
|
||||
{#if idaa_event_obj.type}<span class="badge badge-info bg-info"><span class="fas fa-user-md"></span> {idaa_event_obj.type}</span>{/if}
|
||||
|
||||
{#if $ae_app.trusted_access && idaa_event_obj.hide}<span class="badge badge-warning"><span class="fas fa-exclamation-triangle"></span> Hidden</span>{/if}
|
||||
{#if $ae_app.administrator_access && !idaa_event_obj.enable}<span class="badge badge-warning"><span class="fas fa-exclamation-triangle"></span> Not enabled</span>{/if}
|
||||
</h3>
|
||||
</header>
|
||||
|
||||
<div class="ae_options event_obj__options">
|
||||
<button
|
||||
on:click={() => {
|
||||
$slct.event_id = idaa_event_obj.event_id_random;
|
||||
$slct.event_obj = idaa_event_obj;
|
||||
$slct_trigger = 'load__event_obj';
|
||||
|
||||
// // handle_load_event_id_obj({event_id: $slct.event_id, try_cache: false});
|
||||
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.set('event_id', idaa_event_obj.event_id_random);
|
||||
// history.pushState({}, '', url);
|
||||
|
||||
// let message = {'event_id': idaa_event_obj.event_id_random};
|
||||
// window.parent.postMessage(message, "*");
|
||||
|
||||
$ae_app.events.show_main__options = true;
|
||||
$ae_app.events.show_list__event_obj_li = true;
|
||||
$ae_app.events.show_view__event_obj = true;
|
||||
$ae_app.events.show_edit__event_obj = false;
|
||||
}}
|
||||
class="btn btn-primary"
|
||||
title={`Open to see details: ${idaa_event_obj.name}`}
|
||||
>
|
||||
<span class="fas fa-envelope-open"></span>
|
||||
<!-- <span class="fas fa-info-circle"></span> -->
|
||||
Info
|
||||
</button>
|
||||
|
||||
<!-- This checks if the currently logged in Novi user has a matching UUID or email address. -->
|
||||
{#if $ae_app.trusted_access || idaa_event_obj.external_person_id === $ae_app.novi_uuid || idaa_event_obj.contact_li_json[0].email === $ae_app.novi_email}
|
||||
<button
|
||||
on:click={() => {
|
||||
$slct.event_id = idaa_event_obj.event_id_random;
|
||||
$slct.event_obj = idaa_event_obj;
|
||||
$slct_trigger = 'load__event_obj';
|
||||
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.set('event_id', idaa_event_obj.event_id_random);
|
||||
// history.pushState({}, '', url);
|
||||
|
||||
// $ae_app.events.show_main__options = true;
|
||||
// $ae_app.events.show_list__event_obj_li = true;
|
||||
$ae_app.events.show_view__event_obj = false;
|
||||
$ae_app.events.show_edit__event_obj = true;
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-secondary"
|
||||
title={`Edit meeting: ${idaa_event_obj.name}`}
|
||||
>
|
||||
<span class="fas fa-edit"></span> Edit Meeting
|
||||
</button>
|
||||
<!-- <button
|
||||
on:click={() => {
|
||||
// Copy URL to clipboard
|
||||
// Is there a URL anymore?
|
||||
// const copy_text = document.getElementById(`meeting_edit_url_${idaa_event_obj.event_id_random}`);
|
||||
}}
|
||||
class="ae_btn btn_sm btn_outline_info meeting_edit_help"
|
||||
>
|
||||
<span class="fas fa-link"></span> URL
|
||||
</button> -->
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
|
||||
<section class="ae_section event__content">
|
||||
<!-- <div
|
||||
class="meeting_description description"
|
||||
>
|
||||
<div class="ae_label event__description">Description:</div>
|
||||
<pre class="ae_value event__description">
|
||||
{@html idaa_event_obj.description}
|
||||
</pre>
|
||||
</div> -->
|
||||
|
||||
<div
|
||||
class="event__type"
|
||||
class:ae_d_none={!idaa_event_obj.type}
|
||||
>
|
||||
<span class="ae_label">Type of Recovery Meeting:</span>
|
||||
<span class="ae_value">{idaa_event_obj.type}</span>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="ae_group event__timezone event__recurring_start_time"
|
||||
>
|
||||
<span class="ae_label">
|
||||
<span class="fas fa-clock"></span>
|
||||
When:
|
||||
</span>
|
||||
<!-- class:ae_d_none={!idaa_event_obj.timezone} -->
|
||||
{#if idaa_event_obj.weekday_sunday || idaa_event_obj.weekday_monday || idaa_event_obj.weekday_tuesday || idaa_event_obj.weekday_wednesday || idaa_event_obj.weekday_thursday || idaa_event_obj.weekday_friday || idaa_event_obj.weekday_saturday}
|
||||
<span class="event__weekdays event__recurring_days_of_week">
|
||||
<!-- <span class="ae_label">Days of week:</span> -->
|
||||
{#if idaa_event_obj.weekday_sunday}<span class="ae_value">Sunday</span>{/if}
|
||||
{#if idaa_event_obj.weekday_monday}<span class="ae_value">Monday</span>{/if}
|
||||
{#if idaa_event_obj.weekday_tuesday}<span class="ae_value">Tuesday</span>{/if}
|
||||
{#if idaa_event_obj.weekday_wednesday}<span class="ae_value">Wednesday</span>{/if}
|
||||
{#if idaa_event_obj.weekday_thursday}<span class="ae_value">Thursday</span>{/if}
|
||||
{#if idaa_event_obj.weekday_friday}<span class="ae_value">Friday</span>{/if}
|
||||
{#if idaa_event_obj.weekday_saturday}<span class="ae_value">Saturday</span>{/if}
|
||||
</span>
|
||||
{/if}
|
||||
|
||||
{#if idaa_event_obj.recurring_start_time}
|
||||
<!-- <span class="ae_label">Time:</span> -->
|
||||
<span class="ae_value">{ae.util.iso_datetime_formatter(`2023-01-01 ${idaa_event_obj.recurring_start_time}`, 'time_short')}</span>
|
||||
{/if}
|
||||
{#if idaa_event_obj.timezone}
|
||||
<!-- <span class="ae_label">Timezone:</span> -->
|
||||
(<span class="ae_value">{idaa_event_obj.timezone}</span>)
|
||||
{:else}
|
||||
<div class="event__tiemzone ae_warning">Required: No timezone was given!</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="event__contacts">
|
||||
|
||||
{#if idaa_event_obj.contact_li_json && idaa_event_obj.contact_li_json.length && idaa_event_obj.contact_li_json[0].full_name}
|
||||
<div class="event__contact"
|
||||
class:ae_d_none={!idaa_event_obj.contact_li_json[0].full_name}
|
||||
>
|
||||
<span class="ae_label">
|
||||
<span class="fas fa-user"></span> Contact:
|
||||
</span>
|
||||
{idaa_event_obj.contact_li_json[0].full_name}
|
||||
{#if idaa_event_obj.contact_li_json[0].email}
|
||||
| <a href="mailto:{idaa_event_obj.contact_li_json[0].email}?Subject={idaa_event_obj.full_name}">{idaa_event_obj.contact_li_json[0].email}</a>
|
||||
{/if}
|
||||
{#if idaa_event_obj.contact_li_json[0].phone_mobile}
|
||||
<span class="ae_label">| Mobile:</span>
|
||||
<a href="tel:{idaa_event_obj.contact_li_json[0].phone_mobile}">{idaa_event_obj.contact_li_json[0].phone_mobile}</a>
|
||||
{/if}
|
||||
{#if idaa_event_obj.contact_li_json[0].phone_home}
|
||||
<span class="ae_label">| Home:</span>
|
||||
<a href="tel:{idaa_event_obj.contact_li_json[0].phone_home}">{idaa_event_obj.contact_li_json[0].phone_home}</a>
|
||||
{/if}
|
||||
{#if idaa_event_obj.contact_li_json[0].phone_office}
|
||||
<span class="ae_label">| Office:</span>
|
||||
<a href="tel:{idaa_event_obj.contact_li_json[0].phone_office}">{idaa_event_obj.contact_li_json[0].phone_office}</a>
|
||||
{/if}
|
||||
{#if idaa_event_obj.contact_li_json[0].other_text}| {idaa_event_obj.contact_li_json[0].other_text}{/if}
|
||||
</div>
|
||||
{:else}
|
||||
{#if $ae_app.trusted_access}
|
||||
<div class="event__contact ae_warning">
|
||||
ALERT: The primary contact information may be missing? This meeting should be checked and updated. Please Edit and Save to use the new format.
|
||||
<!-- This must be done by March 1, 2024. -->
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{#if idaa_event_obj.contact_li_json && idaa_event_obj.contact_li_json.length && idaa_event_obj.contact_li_json[1].full_name}
|
||||
<div class="event__contact"
|
||||
class:ae_d_none={!idaa_event_obj.contact_li_json[1].full_name}
|
||||
>
|
||||
<span class="ae_label">
|
||||
<span class="fas fa-user"></span> Contact:
|
||||
</span>
|
||||
{idaa_event_obj.contact_li_json[1].full_name}
|
||||
{#if idaa_event_obj.contact_li_json[1].email}
|
||||
| <a href="mailto:{idaa_event_obj.contact_li_json[1].email}?Subject={idaa_event_obj.full_name}">{idaa_event_obj.contact_li_json[1].email}</a>
|
||||
{/if}
|
||||
{#if idaa_event_obj.contact_li_json[1].phone_mobile}
|
||||
<span class="ae_label">| Mobile:</span>
|
||||
<a href="tel:{idaa_event_obj.contact_li_json[1].phone_mobile}">{idaa_event_obj.contact_li_json[1].phone_mobile}</a>
|
||||
{/if}
|
||||
{#if idaa_event_obj.contact_li_json[1].phone_home}
|
||||
<span class="ae_label">| Home:</span>
|
||||
<a href="tel:{idaa_event_obj.contact_li_json[1].phone_home}">{idaa_event_obj.contact_li_json[1].phone_home}</a>
|
||||
{/if}
|
||||
{#if idaa_event_obj.contact_li_json[1].phone_office}
|
||||
<span class="ae_label">| Office:</span>
|
||||
<a href="tel:{idaa_event_obj.contact_li_json[1].phone_office}">{idaa_event_obj.contact_li_json[1].phone_office}</a>
|
||||
{/if}
|
||||
{#if idaa_event_obj.contact_li_json[0].other_text}| {idaa_event_obj.contact_li_json[0].other_text}{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{#if $ae_app.trusted_access}
|
||||
{#if (idaa_event_obj.contact_li_json && idaa_event_obj.contact_li_json.length && !idaa_event_obj.contact_li_json[0].full_name)}
|
||||
<div class="event__contact ae_warning">Required: No primary contact information was found!</div>
|
||||
{/if}
|
||||
{#if !idaa_event_obj.external_person_id}
|
||||
<div class="event__contact ae_warning">Warning: Not linked to a Novi record!</div>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
{#if $ae_app.administrator_access}
|
||||
<section class="ae_section ae_footer ae_meta event__meta">
|
||||
<!-- {#if idaa_event_obj.location_address_json}
|
||||
<span
|
||||
class="event__location_address_json"
|
||||
>
|
||||
Found location JSON: {idaa_event_obj.location_address_json}
|
||||
</span>
|
||||
{/if}
|
||||
|
||||
{#if idaa_event_obj.contact_li_json && idaa_event_obj.contact_li_json.length}
|
||||
<span
|
||||
class="event__contact_li_json"
|
||||
>
|
||||
Found contact JSON: {idaa_event_obj.contact_li_json}
|
||||
</span>
|
||||
{/if} -->
|
||||
<div class="ae_group">
|
||||
<span
|
||||
class="event__created_on"
|
||||
>
|
||||
Created on: {ae.util.iso_datetime_formatter(idaa_event_obj.created_on, 'datetime_short')}
|
||||
</span>
|
||||
<span
|
||||
class="event__updated_on"
|
||||
class:ae_d_none={!idaa_event_obj.updated_on}
|
||||
>
|
||||
Updated on: {ae.util.iso_datetime_formatter(idaa_event_obj.updated_on, 'datetime_short')}
|
||||
</span>
|
||||
</div>
|
||||
</section>
|
||||
{/if}
|
||||
</div>
|
||||
{/each}
|
||||
|
||||
{:else}
|
||||
{#if $ae_app.events.qry_status === 'loading'}
|
||||
<div class="ae_highlight ae_padding_md ae_row ae_flex_justify_center"><Spinner class="me-3" /> Loading...</div>
|
||||
{:else}
|
||||
<div class="ae_highlight ae_padding_md ae_row ae_flex_justify_center"> No recovery meetings avalible to show. The search may need to be changed.</div>
|
||||
{/if}
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
|
||||
<style>
|
||||
.ae_label {
|
||||
font-size: smaller;
|
||||
}
|
||||
.ae_value {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.ae_header h3 {
|
||||
font-size: 1.2em;
|
||||
margin: 0;
|
||||
/* padding: 0; */
|
||||
}
|
||||
|
||||
.event_obj .ae_meta {
|
||||
flex-direction: column;
|
||||
/* justify-content: space-between; */
|
||||
}
|
||||
|
||||
.event_obj .ae_meta .ae_group {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.event_obj .ae_meta .ae_options {
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,392 @@
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher, onMount } from 'svelte';
|
||||
import { fade } from 'svelte/transition';
|
||||
|
||||
import { ae } from 'aether_npm_lib';
|
||||
import { slct, slct_trigger, ae_app } from './stores';
|
||||
|
||||
export let container_class_li = [];
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
if ($slct.event_id) {
|
||||
console.log(`Event ID selected: ${$slct.event_id}`);
|
||||
console.log(`Event Object selected: ${$slct.event_obj}`)
|
||||
|
||||
$slct_trigger = 'load__event_obj';
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** View - Event Obj');
|
||||
});
|
||||
|
||||
|
||||
dayjs.extend(window.dayjs_plugin_utc)
|
||||
dayjs.extend(window.dayjs_plugin_timezone);
|
||||
console.log(`UTC offset: ${dayjs().utcOffset()}`);
|
||||
console.log(`TZ offset: ${dayjs().utcOffset('US/Pacific')}`);
|
||||
// let test_time = dayjs.utc('2024-01-08 11:55').tz('Asia/Taipei');
|
||||
// let test_time = dayjs.utc('2024-01-08 14:15').tz('America/New_York');
|
||||
let test_time = dayjs.tz('2024-01-08 14:15', 'US/Pacific');
|
||||
console.log(test_time.format('YYYY-MM-DD HH:mm'));
|
||||
let adjusted_to_local_tz = test_time.tz('America/New_York');
|
||||
console.log(adjusted_to_local_tz.format('YYYY-MM-DD HH:mm'));
|
||||
|
||||
let adjusted_to_local_tz_v2 = dayjs.tz('2024-01-08 14:15', 'US/Pacific').tz('America/New_York');
|
||||
console.log(adjusted_to_local_tz_v2);
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<section class="svelte_component ae_section ae_view event_obj view__event_obj {container_class_li.join(' ')}">
|
||||
|
||||
<!-- <div class="event__header">
|
||||
<h2 class="event__name">{@html $slct.event_obj.name}</h2>
|
||||
</div> -->
|
||||
|
||||
<div class="event__content">
|
||||
<div
|
||||
class="meeting_description description"
|
||||
>
|
||||
<div class="ae_label event__description">Description:</div>
|
||||
<pre class="ae_value event__description">{@html $slct.event_obj.description}</pre>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class:ae_d_none={!$slct.event_obj.type}
|
||||
class="meeting_type"
|
||||
>
|
||||
<span class="ae_label">Type of Recovery Meeting:</span>
|
||||
<span class="ae_value">{$slct.event_obj.type}</span>
|
||||
</div>
|
||||
|
||||
<div class="meeting_physical_virtual how_to_attended">
|
||||
|
||||
<div class="col-6 meeting_physical"
|
||||
class:ae_d_none={(!$slct.event_obj.address_city && !$slct.event_obj.location_address_json) || ($slct.event_obj.location_address_json && !$slct.event_obj.location_address_json.city && !$slct.event_obj.location_address_json.country_subdivision_code && !$slct.event_obj.location_address_json.postal_code)}
|
||||
>
|
||||
<div class="meeting_address_location">
|
||||
Address:
|
||||
<address class="ae_value event__address">
|
||||
{#if $slct.event_obj.location_address_json}
|
||||
|
||||
{#if $slct.event_obj.physical}
|
||||
{#if $slct.event_obj.location_address_json.name}{$slct.event_obj.location_address_json.name}<br>{/if}
|
||||
{#if $slct.event_obj.location_address_json.line_1}{$slct.event_obj.location_address_json.line_1}<br>{/if}
|
||||
{#if $slct.event_obj.location_address_json.line_2}{$slct.event_obj.location_address_json.line_2}<br>{/if}
|
||||
{#if $slct.event_obj.location_address_json.line_3}{$slct.event_obj.location_address_json.line_3}<br>{/if}
|
||||
{/if}
|
||||
{#if $slct.event_obj.location_address_json.city}{$slct.event_obj.location_address_json.city}, {/if}
|
||||
{#if $slct.event_obj.location_address_json.state_province}{$slct.event_obj.location_address_json.state_province}{/if}
|
||||
{#if $slct.event_obj.physical}
|
||||
{#if $slct.event_obj.location_address_json.postal_code}{$slct.event_obj.location_address_json.postal_code}{/if}
|
||||
{/if}
|
||||
{#if $slct.event_obj.location_address_json.country}
|
||||
<br>
|
||||
{$slct.event_obj.location_address_json.country}
|
||||
{/if}
|
||||
|
||||
{:else}
|
||||
|
||||
{#if $slct.event_obj.physical}
|
||||
{#if $slct.event_obj.address_name}{$slct.event_obj.address_name}<br>{/if}
|
||||
{#if $slct.event_obj.address_line_1}{$slct.event_obj.address_line_1}<br>{/if}
|
||||
{#if $slct.event_obj.address_line_2}{$slct.event_obj.address_line_2}<br>{/if}
|
||||
{#if $slct.event_obj.address_line_3}{$slct.event_obj.address_line_3}<br>{/if}
|
||||
{/if}
|
||||
{#if $slct.event_obj.address_city}{$slct.event_obj.address_city}, {/if}
|
||||
{#if $slct.event_obj.address_country_subdivision_name}{$slct.event_obj.address_country_subdivision_name}{/if}
|
||||
{#if $slct.event_obj.physical}
|
||||
{#if $slct.event_obj.address_postal_code}{$slct.event_obj.address_postal_code}{/if}
|
||||
{/if}
|
||||
{#if $slct.event_obj.address_country_name}
|
||||
<br>
|
||||
{$slct.event_obj.address_country_name}
|
||||
{/if}
|
||||
|
||||
{/if}
|
||||
</address>
|
||||
{#if $slct.event_obj.physical}
|
||||
<div
|
||||
class:ae_d_none={!$slct.event_obj.location_text}
|
||||
>
|
||||
Additional information: {@html $slct.event_obj.location_text}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-6"
|
||||
class:meeting_virtual={$slct.event_obj.virtual}
|
||||
class:ae_d_none={!$slct.event_obj.virtual}
|
||||
>
|
||||
<div class="meeting_attend_url"
|
||||
class:ae_d_none={!$slct.event_obj.attend_url}
|
||||
>
|
||||
<span class="ae_label">
|
||||
<span class="fas fa-link"></span>
|
||||
URL:
|
||||
</span>
|
||||
<span class="ae_value">
|
||||
<a href="{$slct.event_obj.attend_url}">{$slct.event_obj.attend_url}</a>
|
||||
</span>
|
||||
<span class="ae_label">
|
||||
<span class="fas fa-lock"></span>
|
||||
Passcode:
|
||||
</span>
|
||||
<span class="ae_value">
|
||||
{$slct.event_obj.attend_url_passcode}
|
||||
</span>
|
||||
</div>
|
||||
<div class="meeting_attend_phone"
|
||||
class:ae_d_none={!$slct.event_obj.attend_phone}
|
||||
>
|
||||
<span class="ae_label">
|
||||
<span class="fas fa-phone"></span>
|
||||
Phone:
|
||||
</span>
|
||||
<span class="ae_value">
|
||||
<a href="tel:{$slct.event_obj.attend_phone}">{$slct.event_obj.attend_phone}</a>
|
||||
</span>
|
||||
<span class="ae_label">
|
||||
<span class="fas fa-lock"></span>
|
||||
Passcode:
|
||||
</span>
|
||||
<span class="ae_value">
|
||||
{$slct.event_obj.attend_phone_passcode}
|
||||
</span>
|
||||
</div>
|
||||
<div class="attend_text"
|
||||
class:ae_d_none={!$slct.event_obj.attend_text}
|
||||
>
|
||||
Additional information: {@html $slct.event_obj.attend_text}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="meeting_when">
|
||||
|
||||
<div class="meeting_recurring"
|
||||
class:ae_d_none={!$slct.event_obj.recurring}
|
||||
>
|
||||
<div class="meeting_recurring_text">
|
||||
<span class="ae_label">
|
||||
<span class="fas fa-calendar-alt"></span>
|
||||
Frequency:
|
||||
</span>
|
||||
{#if $slct.event_obj.recurring_pattern == 'weekly'}<span>Weekly</span>
|
||||
{:else if $slct.event_obj.recurring_pattern == 'monthly'}<span>Monthly</span>
|
||||
{:else if $slct.event_obj.recurring_pattern == 'every other week'}<span>Every Other Week</span>
|
||||
{:else if $slct.event_obj.recurring_pattern == 'other'}<span>Other</span>
|
||||
{/if}
|
||||
{#if $slct.event_obj.recurring_text && $slct.event_obj.recurring_text.length > 0}
|
||||
{#if $slct.event_obj.recurring_text.includes('*gen*') && $ae_app.administrator_access}
|
||||
<span class="ae_value ae_highlight">{@html $slct.event_obj.recurring_text}</span>
|
||||
{:else if (!$slct.event_obj.recurring_text.includes('*gen*'))}
|
||||
<span class="ae_value">{@html $slct.event_obj.recurring_text}</span>
|
||||
{/if}
|
||||
<!-- - <span class="ae_value">{@html $slct.event_obj.recurring_text}</span> -->
|
||||
{/if}
|
||||
</div>
|
||||
<div class="meeting_recurring_days_of_week">
|
||||
<span class="ae_label">
|
||||
<span class="fas fa-calendar-week"></span>
|
||||
Days of week:
|
||||
</span>
|
||||
{#if $slct.event_obj.weekday_sunday}<span class="ae_value">Sunday</span>{/if}
|
||||
{#if $slct.event_obj.weekday_monday}<span class="ae_value">Monday</span>{/if}
|
||||
{#if $slct.event_obj.weekday_tuesday}<span class="ae_value">Tuesday</span>{/if}
|
||||
{#if $slct.event_obj.weekday_wednesday}<span class="ae_value">Wednesday</span>{/if}
|
||||
{#if $slct.event_obj.weekday_thursday}<span class="ae_value">Thursday</span>{/if}
|
||||
{#if $slct.event_obj.weekday_friday}<span class="ae_value">Friday</span>{/if}
|
||||
{#if $slct.event_obj.weekday_saturday}<span class="ae_value">Saturday</span>{/if}
|
||||
</div>
|
||||
<div class="meeting_recurring_time">
|
||||
{#if $slct.event_obj.recurring_start_time}
|
||||
<span class="meeting_recurring_start_time">
|
||||
<span class="ae_label">
|
||||
<span class="fas fa-clock"></span> Start time:
|
||||
</span>
|
||||
<span class="ae_value">{ae.util.iso_datetime_formatter(`2024-01-01 ${$slct.event_obj.recurring_start_time}`, 'time_short')}</span>
|
||||
</span>
|
||||
<span
|
||||
class:ae_d_none={!$slct.event_obj.recurring_end_time}
|
||||
>
|
||||
- <span class="meeting_recurring_end_time">
|
||||
<span class="ae_label">End time:</span>
|
||||
<span class="ae_value">{ae.util.iso_datetime_formatter(`2024-01-01 ${$slct.event_obj.recurring_end_time}`, 'time_short')}
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
<span
|
||||
class:ae_d_none={!$slct.event_obj.timezone}
|
||||
>
|
||||
- <span class="meeting_timezone">
|
||||
<span class="ae_label">Timezone:</span>
|
||||
<span class="ae_value">{$slct.event_obj.timezone}</span>
|
||||
</span>
|
||||
</span>
|
||||
{#if $slct.event_obj.timezone}
|
||||
<span class="event__user_timezone">
|
||||
(
|
||||
<span class="ae_label">Your TZ:</span>
|
||||
<span class="ae_value">
|
||||
{dayjs.tz(`${$ae_app.current_date_str} ${$slct.event_obj.recurring_start_time}`, $slct.event_obj.timezone).tz($ae_app.current_timezone).format('hh:mm A')} {$ae_app.current_timezone}
|
||||
</span>
|
||||
)
|
||||
</span>
|
||||
{/if}
|
||||
{:else}
|
||||
<span class="meeting_recurring_no_time">No times set</span>
|
||||
{/if}
|
||||
|
||||
|
||||
|
||||
<!-- {dayjs.tz(`2024-01-08 20:00`, $slct.event_obj.timezone).format('hh:mm A')} -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="ae_list event__contacts">
|
||||
|
||||
{#if $slct.event_obj.contact_li_json && $slct.event_obj.contact_li_json.length && $slct.event_obj.contact_li_json[0].full_name}
|
||||
<div class="event__contact"
|
||||
class:ae_d_none={!$slct.event_obj.contact_li_json[0].full_name}
|
||||
>
|
||||
<span class="ae_label">
|
||||
<span class="fas fa-user"></span> Contact:
|
||||
</span>
|
||||
{$slct.event_obj.contact_li_json[0].full_name}
|
||||
{#if $slct.event_obj.contact_li_json[0].email}
|
||||
| <a href="mailto:{$slct.event_obj.contact_li_json[0].email}?Subject={$slct.event_obj.full_name}">{$slct.event_obj.contact_li_json[0].email}</a>
|
||||
{/if}
|
||||
{#if $slct.event_obj.contact_li_json[0].phone_mobile}
|
||||
<span class="ae_label">| Mobile:</span>
|
||||
<a href="tel:{$slct.event_obj.contact_li_json[0].phone_mobile}">{$slct.event_obj.contact_li_json[0].phone_mobile}</a>
|
||||
{/if}
|
||||
{#if $slct.event_obj.contact_li_json[0].phone_home}
|
||||
<span class="ae_label">| Home:</span>
|
||||
<a href="tel:{$slct.event_obj.contact_li_json[0].phone_home}">{$slct.event_obj.contact_li_json[0].phone_home}</a>
|
||||
{/if}
|
||||
{#if $slct.event_obj.contact_li_json[0].phone_office}
|
||||
<span class="ae_label">| Office:</span>
|
||||
<a href="tel:{$slct.event_obj.contact_li_json[0].phone_office}">{$slct.event_obj.contact_li_json[0].phone_office}</a>
|
||||
{/if}
|
||||
{#if $slct.event_obj.contact_li_json[0].other_text}| {$slct.event_obj.contact_li_json[0].other_text}{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if $slct.event_obj.contact_li_json && $slct.event_obj.contact_li_json.length && $slct.event_obj.contact_li_json[1].full_name}
|
||||
<div class="event__contact"
|
||||
class:ae_d_none={!$slct.event_obj.contact_li_json[1].full_name}
|
||||
>
|
||||
<span class="ae_label">
|
||||
<span class="fas fa-user"></span> Contact:
|
||||
</span>
|
||||
{$slct.event_obj.contact_li_json[1].full_name}
|
||||
{#if $slct.event_obj.contact_li_json[1].email}
|
||||
| <a href="mailto:{$slct.event_obj.contact_li_json[1].email}?Subject={$slct.event_obj.full_name}">{$slct.event_obj.contact_li_json[1].email}</a>
|
||||
{/if}
|
||||
{#if $slct.event_obj.contact_li_json[1].phone_mobile}
|
||||
<span class="ae_label">| Mobile:</span>
|
||||
<a href="tel:{$slct.event_obj.contact_li_json[1].phone_mobile}">{$slct.event_obj.contact_li_json[1].phone_mobile}</a>
|
||||
{/if}
|
||||
{#if $slct.event_obj.contact_li_json[1].phone_home}
|
||||
<span class="ae_label">| Home:</span>
|
||||
<a href="tel:{$slct.event_obj.contact_li_json[1].phone_home}">{$slct.event_obj.contact_li_json[1].phone_home}</a>
|
||||
{/if}
|
||||
{#if $slct.event_obj.contact_li_json[1].phone_office}
|
||||
<span class="ae_label">| Office:</span>
|
||||
<a href="tel:{$slct.event_obj.contact_li_json[1].phone_office}">{$slct.event_obj.contact_li_json[1].phone_office}</a>
|
||||
{/if}
|
||||
{#if $slct.event_obj.contact_li_json[1].other_text}| {$slct.event_obj.contact_li_json[1].other_text}{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
</div>
|
||||
|
||||
<section class="ae_section ae_meta event__meta">
|
||||
<div class="ae_group">
|
||||
<span
|
||||
class="event__id"
|
||||
class:ae_d_none={!$ae_app.administrator_access}>
|
||||
ID:
|
||||
{$slct.event_obj.event_id_random}
|
||||
</span>
|
||||
<span
|
||||
class="event__created_on"
|
||||
>
|
||||
Created on: {ae.util.iso_datetime_formatter($slct.event_obj.created_on, 'datetime_short')}
|
||||
</span>
|
||||
<span
|
||||
class="event__updated_on"
|
||||
class:ae_d_none={!$slct.event_obj.updated_on}
|
||||
>
|
||||
Updated on: {ae.util.iso_datetime_formatter($slct.event_obj.updated_on, 'datetime_short')}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{#if $ae_app.trusted_access || $slct.event_obj.external_person_id === $ae_app.novi_uuid || $slct.event_obj.contact_li_json[0].email === $ae_app.novi_email}
|
||||
<div class="ae_options">
|
||||
<button
|
||||
on:click={() => {
|
||||
// $slct.event_id = $slct.event_obj.event_id_random;
|
||||
// $slct.event_obj = $slct.event_obj;
|
||||
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.set('event_id', $slct.event_obj.event_id_random);
|
||||
// history.pushState({}, '', url);
|
||||
|
||||
// $ae_app.events.show_main__options = true;
|
||||
// $ae_app.events.show_list__event_obj_li = true;
|
||||
$ae_app.events.show_view__event_obj = false;
|
||||
$ae_app.events.show_edit__event_obj = true;
|
||||
}}
|
||||
class="btn btn-xs btn-secondary"
|
||||
title={`Edit meeting: ${$slct.event_obj.name}`}
|
||||
>
|
||||
<span class="fas fa-edit"></span> Edit
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<style>
|
||||
.ae_label {
|
||||
font-size: smaller;
|
||||
}
|
||||
.ae_value {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.event__user_timezone {
|
||||
font-size: smaller;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.event_obj .ae_meta {
|
||||
flex-direction: column;
|
||||
/* justify-content: space-between; */
|
||||
}
|
||||
|
||||
.event_obj .ae_meta .ae_group {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.event_obj .ae_meta .ae_options {
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
/* a {
|
||||
color: #82B6E1;
|
||||
} */
|
||||
</style>
|
||||
196
src/routes/idaa/(idaa)/stores.ts
Normal file
196
src/routes/idaa/(idaa)/stores.ts
Normal file
@@ -0,0 +1,196 @@
|
||||
import { readable, writable } from 'svelte/store';
|
||||
// console.log('*** stores.ts ***');
|
||||
|
||||
/* FAKE TESTING DATA */
|
||||
|
||||
let fake_app_base_url = 'https://dev-app.oneskyit.com';
|
||||
let fake_app_base_url_backup = 'https://bak-app.oneskyit.com';
|
||||
let fake_api_base_url = 'https://dev-api.oneskyit.com';
|
||||
let fake_api_base_url_backup = 'https://bak-api.oneskyit.com';
|
||||
let fake_api_secret_key = 'dFP6J9DVj9hUgIMn-fNIqg';
|
||||
let fake_ae_account_id = 'Q8lR8Ai8hx2FjbQ3C_EH1Q'; // IDAA Q8lR8Ai8hx2FjbQ3C_EH1Q (13)
|
||||
let fake_ae_api_jwt_key="EHmSXZFKfMEW65E8kxCKmQ" // 22 characters; super secret Aether JWT signing key
|
||||
|
||||
let fake_api_temporary_token = '';
|
||||
|
||||
let fake_access_type = 'anonymous';
|
||||
let fake_administrator_access: boolean = false;
|
||||
let fake_trusted_access: boolean = false;
|
||||
|
||||
/* FAKE TESTING DATA */
|
||||
|
||||
type key_val = {
|
||||
[key: string]: any; // variable key
|
||||
// name: string;
|
||||
};
|
||||
|
||||
export const account_id = fake_ae_account_id;
|
||||
|
||||
let ae_cfg_data: key_val = {};
|
||||
|
||||
// NOTE: This API CRUD super key thing being here should be short term! -2023-05-02
|
||||
|
||||
ae_cfg_data['api'] = {};
|
||||
ae_cfg_data['app'] = {};
|
||||
|
||||
// ae_cfg_data['api']['api_crud_super_key'] = 'zp5PtX4zUsI';
|
||||
|
||||
let ae_api_cfg_data: key_val = {};
|
||||
if (api_base_url) {
|
||||
ae_api_cfg_data['base_url'] = api_base_url;
|
||||
} else {
|
||||
console.log(`WARNING: api_base_url not set. Using fake_api_base_url: ${fake_api_base_url}`);
|
||||
ae_api_cfg_data['base_url'] = fake_api_base_url;
|
||||
}
|
||||
if (api_base_url_backup) {
|
||||
ae_api_cfg_data['base_url_backup'] = api_base_url_backup;
|
||||
} else {
|
||||
console.log(`WARNING: api_base_url_backup not set. Using fake_api_base_url_backup: ${fake_api_base_url_backup}`);
|
||||
ae_api_cfg_data['base_url_backup'] = fake_api_base_url_backup;
|
||||
}
|
||||
|
||||
ae_api_cfg_data['api_crud_super_key'] = 'zp5PtX4zUsI';
|
||||
|
||||
ae_api_cfg_data['headers'] = {};
|
||||
ae_api_cfg_data['headers']['Access-Control-Allow-Origin'] = '*';
|
||||
ae_api_cfg_data['headers']['content-type'] = 'application/json';
|
||||
ae_api_cfg_data['headers']['x-aether-api-key'] = fake_api_secret_key;
|
||||
ae_api_cfg_data['headers']['x-aether-api-token'] = 'fake-temp-token';
|
||||
ae_api_cfg_data['headers']['x-aether-api-expire-on'] = '';
|
||||
ae_api_cfg_data['headers']['x-account-id'] = fake_ae_account_id;
|
||||
|
||||
console.log(`Aether API Config Data:`, ae_api_cfg_data);
|
||||
|
||||
ae_cfg_data['api']['headers'] = ae_api_cfg_data['headers'];
|
||||
|
||||
let ae_app_cfg_data: key_val = {};
|
||||
if (app_base_url) {
|
||||
ae_app_cfg_data['base_url'] = app_base_url;
|
||||
} else {
|
||||
console.log(`WARNING: app_base_url not set. Using fake_app_base_url: ${fake_app_base_url}`);
|
||||
ae_app_cfg_data['base_url'] = fake_app_base_url;
|
||||
}
|
||||
ae_cfg_data['app'] = ae_app_cfg_data;
|
||||
|
||||
console.log(`All Aether App and API Config Data:`, ae_cfg_data);
|
||||
window.localStorage.setItem('ae_cfg', JSON.stringify(ae_cfg_data)); // Also set in main HTML template files
|
||||
export const ae_cfg = readable(ae_cfg_data);
|
||||
|
||||
|
||||
|
||||
/* *** BEGIN *** Initialize slct variable */
|
||||
// Updated 2023-11-01
|
||||
export let slct_trigger: any = writable(null);
|
||||
let slct_obj_template: key_val = { 'event_id': null, 'event_obj': {}, 'post_id': null, 'post_obj': {}, 'post_obj_li': [], 'post_comment_id': null, 'post_comment_obj': {}, 'post_comment_obj_li': [] };
|
||||
export let slct = writable(slct_obj_template);
|
||||
|
||||
let novi_api_cfg_data: key_val = {};
|
||||
|
||||
|
||||
/* *** BEGIN *** Initialize IDAA app structure variable (JS object) */
|
||||
// Updated 2023-11-01
|
||||
let ae_app_data_version = .5;
|
||||
|
||||
let ae_app_struct: key_val = {
|
||||
'ver': ae_app_data_version,
|
||||
'app': ae_cfg_data.app, // Includes AE app base_url {'base_url': ae_cfg_data.app.base_url},
|
||||
'ae_api': ae_api_cfg_data, // Includes the AE API headers
|
||||
'novi_api': novi_api_cfg_data, // Includes the Novi API headers
|
||||
|
||||
'access_type': fake_access_type,
|
||||
'administrator_access': fake_administrator_access,
|
||||
'trusted_access': fake_trusted_access,
|
||||
|
||||
'account_id': account_id,
|
||||
|
||||
// YYYY-MM-DD string of the current date
|
||||
'current_date_str': new Date().toISOString().slice(0, 10),
|
||||
|
||||
'novi_uuid': null,
|
||||
'novi_email': null,
|
||||
'novi_full_name': null,
|
||||
'novi_admin_li': [],
|
||||
|
||||
// Module - Archives (IDAA Archives)
|
||||
'archives':{
|
||||
// 'show_start_new_view_help': true, // getting ready to start new submission
|
||||
// 'show_active_submission_view_help': true, // started in progress submission
|
||||
// 'show_grant_list': false,
|
||||
|
||||
'show_archive_new_form': false,
|
||||
'show_archive_content_new_form': false,
|
||||
'show_archive_content_view': false,
|
||||
'show_archive_content_crud': false,
|
||||
'show_archive_content_crud_new': false,
|
||||
'show_list__archive_content_li_group': null,
|
||||
|
||||
// all, disabled, enabled
|
||||
'enabled': 'enabled', // all or nothing... easier for now
|
||||
|
||||
// all, hidden, not_hidden
|
||||
'hidden': 'not_hidden', // all or nothing... easier for now
|
||||
|
||||
'limit': 250, // all or nothing... easier for now
|
||||
'offset': 0, // all or nothing... easier for now
|
||||
'archive_group_sort': 'ASC', // ASC or DESC
|
||||
'content_group_sort': 'ASC', // ASC or DESC
|
||||
|
||||
'archive_id': null,
|
||||
'archive_content_id': null,
|
||||
|
||||
'ds':{},
|
||||
},
|
||||
|
||||
// Module - Events (IDAA Recovery Meetings)
|
||||
'events':{
|
||||
'show_event_id_view': false,
|
||||
'show_event_id_edit': false,
|
||||
|
||||
'filter_meeting_type': 'all', // all, idaa, al-anon
|
||||
'filter_meeting_group': 'all', // all, in-person, virtual
|
||||
'filter_location': 'all', // all, something something
|
||||
|
||||
// all, disabled, enabled
|
||||
'enabled': 'enabled', // all or nothing... easier for now
|
||||
|
||||
// all, hidden, not_hidden
|
||||
'hidden': 'not_hidden', // all or nothing... easier for now
|
||||
|
||||
'limit': 250, // all or nothing... easier for now
|
||||
'offset': 0, // all or nothing... easier for now
|
||||
|
||||
'event_id': null,
|
||||
|
||||
'ds':{},
|
||||
},
|
||||
|
||||
// Module - Posts (IDAA Support BB)
|
||||
'posts':{
|
||||
'show_post_new_form': false,
|
||||
'show_post_comment_new_form': false,
|
||||
'show_view__post_id': false,
|
||||
'show_post_comment_crud': false,
|
||||
|
||||
'show_post_comment_list': true,
|
||||
|
||||
// all, disabled, enabled
|
||||
'enabled': 'enabled', // all or nothing... easier for now
|
||||
|
||||
// all, hidden, not_hidden
|
||||
'hidden': 'not_hidden', // all or nothing... easier for now
|
||||
|
||||
'limit': 250, // all or nothing... easier for now
|
||||
'offset': 0, // all or nothing... easier for now
|
||||
|
||||
'post_id': null,
|
||||
'post_comment_id': null,
|
||||
|
||||
'ds':{},
|
||||
},
|
||||
|
||||
'ds':{},
|
||||
|
||||
'testing': null
|
||||
}
|
||||
export let ae_app = writable(ae_app_struct);
|
||||
console.log(ae_app);
|
||||
40
src/routes/idaa/(idaa)/stores_ae_api.js
Normal file
40
src/routes/idaa/(idaa)/stores_ae_api.js
Normal file
@@ -0,0 +1,40 @@
|
||||
console.log('*** stores_data_store_api.js Stores ***');
|
||||
import { get } from 'svelte/store';
|
||||
import { ae_app } from './stores';
|
||||
import { api } from 'aether_npm_lib';
|
||||
|
||||
|
||||
/* BEGIN: IDAA Recover Meetings Related */
|
||||
export let get_account_event_obj_list = async function get_account_event_obj_list({account_id, enabled='enabled', hidden='not_hidden', limit=100, params={}, timeout=50000, log_lvl=0}) {
|
||||
console.log('*** stores_meetings_api.js: get_account_event_obj_list() ***');
|
||||
|
||||
const endpoint = `/account/${account_id}/event/meeting_list_flat`;
|
||||
|
||||
let allowed_enabled_list = ['all', 'enabled', 'not_enabled']
|
||||
if (allowed_enabled_list.includes(enabled) ) {
|
||||
params['enabled'] = enabled;
|
||||
}
|
||||
|
||||
let allowed_hidden_list = ['all', 'hidden', 'not_hidden'];
|
||||
if (allowed_hidden_list.includes(hidden) ) {
|
||||
params['hidden'] = hidden;
|
||||
}
|
||||
|
||||
if (limit) {
|
||||
params['limit'] = limit;
|
||||
}
|
||||
|
||||
let event_obj_list_get_promise = await api.get_object({api_cfg: get(ae_app).ae_api, endpoint: endpoint, params: params, timeout: timeout, log_lvl: log_lvl});
|
||||
|
||||
// if (event_obj_list_get_promise === false) {
|
||||
// console.log('Event - RUN AGAIN WITH BACKUP');
|
||||
|
||||
// let temp_api = get(cfg).api;
|
||||
// temp_api['base_url'] = temp_api['base_url_backup']
|
||||
|
||||
// event_obj_list_get_promise = await api.get_object({api_cfg: temp_api, endpoint: endpoint, params: params, timeout: timeout, log_lvl: log_lvl});
|
||||
// }
|
||||
|
||||
let event_obj_list = event_obj_list_get_promise;
|
||||
return event_obj_list;
|
||||
}
|
||||
Reference in New Issue
Block a user