Lots of clean up to get Sponsorships working. Need to add the edit next.

This commit is contained in:
Scott Idem
2024-02-07 18:23:15 -05:00
parent 143265ed9e
commit 06e0c98e68
13 changed files with 1336 additions and 1767 deletions

View File

@@ -1,2 +1,2 @@
# OSIT IDAA Novi App (Svelte)
This was created for IDAA to use within the Novi CMS static pages. It can run as a standalone HTML page or within an iframe.
# OSIT AE - Sponsorships App (Svelte)
This was created for One Sky IT's Aether system.

View File

@@ -10,7 +10,7 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" integrity="sha512-1ycn6IcaQQ40/MKBW2W4Rhis/DbILU74C1vSrLJxCq57o941Ym01SwNsOMqvEBFlcgUa6xLiPY/NS5R+E6ztJQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="/src/main.css" />
<!-- <link rel="stylesheet" href="/src/main.css" /> -->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>&AElig; AE App - Sponsorships - Vite + Svelte + TS</title>

2
package-lock.json generated
View File

@@ -725,7 +725,7 @@
},
"node_modules/aether_npm_lib": {
"version": "1.5.0",
"resolved": "git+ssh://git@bitbucket.org/oneskyit/one-sky-it-npm-library.git#6f614a5c39385ce73fcbc6fcfb534bf3b00c398b",
"resolved": "git+ssh://git@bitbucket.org/oneskyit/one-sky-it-npm-library.git#c4fa1d707ad713d1f408554c26687b6c3183efe0",
"dependencies": {
"axios": "^1.1.3",
"html5-qrcode": "^2.1.6",

1
public/vite.svg Normal file
View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -1,841 +0,0 @@
<script lang="ts">
type key_val = {
[key: string]: any;
};
// *** Import Svelte core
import { onMount } from 'svelte';
// *** Import Aether core variables and functions
import { ae, 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);
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 = {};
// params['archived'] = 'all';
// params['conference'] = false;
// params['inc_address'] = true;
// params['inc_contact'] = true;
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': fulltext_search_qry_str,
'contact_li_json': fulltext_search_qry_str,
'address_default_qry_str': fulltext_search_qry_str, // NOTE: Remove after going live with IDAA Novi?
'contact_1_default_qry_str': fulltext_search_qry_str, // NOTE: Remove after going live with IDAA Novi?
};
}
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><span class="fas fa-spinner"></span>
Loading events...</div>
{:then idaa_event_obj_li_get_result}
<!-- <p>Event list: {idaa_event_obj_li_get_result}</p> -->
{: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>

View File

@@ -0,0 +1,840 @@
<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 Aether module components
// import Edit_sponsorship_obj from './10_edit__sponsorship_obj.svelte';
import List_sponsorship_obj from './10_list__sponsorship_obj.svelte';
import View_sponsorship_obj from './10_view__sponsorship_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 sponsorship_id: string = $ae_app.sponsorships.sponsorship_id;
export let user: string = $ae_app.user;
export let key: string = $ae_app.key;
export let full_name: string = $ae_app.full_name;
export let ae_admin_li: string = $ae_app.ae_admin_li;
export let ae_trusted_li: string = $ae_app.ae_trusted_li;
// *** Set initial variables
$ae_app.user = decodeURIComponent(user);
$ae_app.key = decodeURIComponent(key);
// $ae_app.ae_admin_li = ae_admin_li;
// $ae_app.ae_trusted_li = ae_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.sponsorships.show_main__options = true; // Section for: search area, buttons for filtering sponsorships, create new sponsorship.
$ae_app.sponsorships.show_list__sponsorship_obj_li = true;
$ae_app.sponsorships.fulltext_search_qry_str = '';
$ae_app.sponsorships.qry_virtual = false;
$ae_app.sponsorships.qry_physical = false;
$ae_app.sponsorships.qry_type = '';
// NOTE: Check if the ae_user is in the ae_admin_li list
if ($ae_app.ae_user && $ae_app.ae_admin_li) {
if ($ae_app.ae_admin_li.includes($ae_app.ae_user)) {
$ae_app.access_type = 'administrator';
$ae_app.administrator_access = true;
$ae_app.trusted_access = true;
}
}
// NOTE: Check if the ae_user is in the ae_trusted_li list
if ($ae_app.ae_user && $ae_app.ae_trusted_li) {
if ($ae_app.ae_trusted_li.includes($ae_app.ae_user)) {
$ae_app.access_type = 'trusted';
$ae_app.trusted_access = true;
}
}
if ($ae_app.administrator_access) {
$ae_app.sponsorships.enabled = 'enabled';
$ae_app.sponsorships.hidden = 'not_hidden';
$ae_app.sponsorships.limit = 150;
} else if ($ae_app.trusted_access) {
$ae_app.sponsorships.enabled = 'enabled';
$ae_app.sponsorships.hidden = 'not_hidden';
$ae_app.sponsorships.limit = 75;
} else {
$ae_app.sponsorships.enabled = 'enabled';
$ae_app.sponsorships.hidden = 'not_hidden';
$ae_app.sponsorships.limit = 25;
}
let ae_sponsorship_obj_li_get_promise;
let ae_sponsorship_obj_get_promise;
let data_store_obj_get_promise;
let get_ds_sponsorships_info_promise = handle_get_data_store_obj_w_code({code: 'sponsorships_info'});
let get_ds_sponsorships_options_promise = handle_get_data_store_obj_w_code({code: 'sponsorships_options'});
if (account_id) {
$slct.account_id = account_id;
handle_load_ae_sponsorship_obj_li({account_id: $slct.account_id, try_cache: false});
}
// NOTE: This if sponsorship_id is not fully ready yet -2023-09-08
if (sponsorship_id) {
console.log(`Selected Sponsorship ID: ${sponsorship_id}`);
$slct.sponsorship_id = sponsorship_id;
$slct_trigger = 'load__sponsorship_obj';
// handle_load_sponsorship_id_obj({sponsorship_id: $slct.sponsorship_id, try_cache: false});
// // Auto show the selected Sponsorship ID
// // Set the URL param "sponsorship_id" to the current Sponsorship ID. This is a just in case.
// const url = new URL(location);
// url.searchParams.set('sponsorship_id', $slct.sponsorship_id);
// history.pushState({}, '', url);
// let message = {'sponsorship_id': $slct.sponsorship_id};
// window.parent.postMessage(message, "*");
$ae_app.sponsorships.show_main__options = true;
$ae_app.sponsorships.show_list__sponsorship_obj_li = true;
$ae_app.sponsorships.show_view__sponsorship_obj = true;
$ae_app.sponsorships.show_edit__sponsorship_obj = false;
}
if (!$ae_app.client_content) {
$ae_app.client_content = {};
}
onMount(() => {
console.log('** Component Mounted: ** OSIT - AE Sponsorships: 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__sponsorship_obj_li' && $slct.account_id) {
if ($ae_app.sponsorships.qry_status == 'loading') {
console.log('*** $ae_app.sponsorships.qry_status == loading ***');
setTimeout(() => {
console.log("Delayed for X second.");
$slct_trigger = null;
handle_load_ae_sponsorship_obj_li({account_id: $slct.account_id, try_cache: false});
}, 250);
} else {
console.log('*** $ae_app.sponsorships.qry_status != loading ***');
$slct_trigger = null;
handle_load_ae_sponsorship_obj_li({account_id: $slct.account_id, try_cache: false});
}
}
async function handle_load_ae_sponsorship_obj_li({account_id, try_cache=true}) {
console.log('*** handle_load_ae_sponsorship_obj_li() ***');
console.log($ae_app.sponsorships);
let fulltext_search_qry_str = $ae_app.sponsorships.fulltext_search_qry_str;
let qry_virtual = $ae_app.sponsorships.qry_virtual;
let qry_physical = $ae_app.sponsorships.qry_physical;
let qry_type = $ae_app.sponsorships.qry_type;
let enabled = $ae_app.sponsorships.enabled;
let hidden = $ae_app.sponsorships.hidden;
let limit = $ae_app.sponsorships.limit;
let offset = $ae_app.sponsorships.offset;
let params = {};
// params['archived'] = 'all';
// params['conference'] = false;
// params['inc_address'] = true;
// params['inc_contact'] = true;
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': fulltext_search_qry_str,
// 'contact_li_json': fulltext_search_qry_str,
// 'address_default_qry_str': fulltext_search_qry_str, // NOTE: Remove after going live with OSIT ae?
// 'contact_1_default_qry_str': fulltext_search_qry_str, // NOTE: Remove after going live with OSIT ae?
// };
// }
// 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.sponsorships.qry_status = 'loading';
ae_sponsorship_obj_li_get_promise = api.get_ae_obj_li_for_obj_id_crud({
api_cfg: $ae_app.ae_api,
obj_type: 'sponsorship',
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', '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: 2
})
.then(function (sponsorship_obj_li_get_result) {
if (sponsorship_obj_li_get_result) {
$slct.sponsorship_obj_li = sponsorship_obj_li_get_result;
console.log(`Sponsorship list:`, $slct.sponsorship_obj_li);
} else {
$slct.sponsorship_obj_li = [];
}
})
.catch(function (error) {
console.log('No results returned or failed.', error);
})
.finally(function () {
$ae_app.sponsorships.qry_status = 'done';
});
return ae_sponsorship_obj_li_get_promise;
}
$: if ($slct_trigger == 'load__sponsorship_obj' && $slct.sponsorship_id) {
$slct_trigger = null;
handle_load_sponsorship_id_obj({sponsorship_id: $slct.sponsorship_id, try_cache: false});
// Auto show the selected Sponsorship ID
// Is this pushState needed here?
// Set the URL param "sponsorship_id" to the current Sponsorship ID. This is a just in case.
// const url = new URL(location);
// url.searchParams.set('sponsorship_id', $slct.sponsorship_id);
// history.pushState({}, '', url);
// Is this postMessage needed here?
// let message = {'sponsorship_id': $slct.sponsorship_id};
// window.parent.postMessage(message, "*");
// $ae_app.sponsorships.show_main__options = false;
// $ae_app.sponsorships.show_list__sponsorship_obj_li = false;
// $ae_app.sponsorships.show_view__sponsorship_obj = true;
// $ae_app.sponsorships.show_edit__sponsorship_obj = false;
}
async function handle_load_sponsorship_id_obj({sponsorship_id, try_cache=false}) {
console.log('*** handle_load_sponsorship_id_obj() ***');
// let enabled = $ae_app.sponsorships.enabled;
// let hidden = $ae_app.sponsorships.hidden;
// let limit = $ae_app.sponsorships.limit;
// let offset = $ae_app.sponsorships.offset;
let params = {};
ae_sponsorship_obj_get_promise = api.get_ae_obj_id_crud({
api_cfg: $ae_app.ae_api,
obj_type: 'event',
obj_id: sponsorship_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 (sponsorship_obj_get_result) {
if (sponsorship_obj_get_result) {
$slct.sponsorship_obj = sponsorship_obj_get_result;
console.log(`Sponsorship object:`, $slct.sponsorship_obj);
}
// Auto show the selected Sponsorship ID
// Is this pushState needed here?
// Set the URL param "sponsorship_id" to the current Sponsorship ID.
const url = new URL(location);
url.searchParams.set('sponsorship_id', $slct.sponsorship_id);
history.pushState({}, '', url);
// Is this postMessage needed here?
let message = {'sponsorship_id': $slct.sponsorship_id};
window.parent.postMessage(message, "*");
})
.catch(function (error) {
console.log('No results returned or failed.', error);
});
return ae_sponsorship_obj_get_promise;
}
function handle_created_sponsorship_obj(event) {
console.log('*** handle_created_sponsorship_obj() ***');
console.log(event.detail);
handle_load_sponsorship_id_obj({sponsorship_id: $slct.sponsorship_id, try_cache: false});
const url = new URL(location);
url.searchParams.set('sponsorship_id', $slct.sponsorship_id);
history.pushState({}, '', url);
let message = {'sponsorship_id': $slct.sponsorship_id};
window.parent.postMessage(message, "*");
// $slct_trigger = 'load__sponsorship_obj';
$slct_trigger = 'load__sponsorship_obj_li';
$ae_app.sponsorships.show_main__options = false;
$ae_app.sponsorships.show_list__sponsorship_obj_li = false;
$ae_app.sponsorships.show_view__sponsorship_obj = true;
$ae_app.sponsorships.show_edit__sponsorship_obj = false;
}
function handle_updated_sponsorship_obj(event) {
console.log('*** handle_updated_sponsorship_obj() ***');
console.log(event.detail);
// $slct_trigger = 'load__sponsorship_obj';
$slct_trigger = 'load__sponsorship_obj_li';
$ae_app.sponsorships.show_main__options = false;
$ae_app.sponsorships.show_list__sponsorship_obj_li = false;
$ae_app.sponsorships.show_view__sponsorship_obj = true;
$ae_app.sponsorships.show_edit__sponsorship_obj = false;
}
function handle_deleted_sponsorship_obj(event) {
console.log('*** handle_deleted_sponsorship_obj() ***');
console.log(event.detail);
const url = new URL(location);
url.searchParams.delete('sponsorship_id');
history.pushState({}, '', url);
let message = {'sponsorship_id': null};
window.parent.postMessage(message, "*");
$slct_trigger = 'load__sponsorship_obj_li';
$ae_app.sponsorships.show_main__options = true;
$ae_app.sponsorships.show_list__sponsorship_obj_li = true;
$ae_app.sponsorships.show_view__sponsorship_obj = false;
$ae_app.sponsorships.show_edit__sponsorship_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 (!ae_sponsorship_obj_li_get_promise.promise) {
// console.log('*** handle_oninput_fulltext_search_qry_str() ***');
// console.log('*** Promise is still processing. ***');
// console.log(ae_sponsorship_obj_li_get_promise);
// ae_sponsorship_obj_li_get_promise.promise.finally(() => { ae_sponsorship_obj_li_get_promise.promise.done = true; });
// } else {
// $slct_trigger = 'load__sponsorship_obj_li';
// }
// if (ae_sponsorship_obj_li_get_promise && ae_sponsorship_obj_li_get_promise.then) {
// console.log('*** handle_oninput_fulltext_search_qry_str() ***');
// console.log('*** Promise is still processing. ***');
// console.log(ae_sponsorship_obj_li_get_promise);
// $slct_trigger = 'load__sponsorship_obj_li';
// return;
// }
// fulltext_search_qry_str = event.target.value;
// if ($ae_app.sponsorships.fulltext_search_qry_str.length > 2) {
// } else {
// $ae_app.sponsorships.fulltext_search_qry_str = '';
// }
$slct_trigger = 'load__sponsorship_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.sponsorships.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.sponsorships.ds[code] = get_data_store_result.text;
} else if (data_type == 'json') {
// console.log(get_data_store_result.json);
$ae_app.sponsorships.ds[code] = get_data_store_result.json;
}
// console.log(`Code: ${$ae_app.sponsorships.ds[code]}`);
// console.log(`Code:`, $ae_app.sponsorships.ds[code]);
}
})
.catch(function (error) {
console.log('No results returned or failed.', error);
});
}
</script>
<!-- <svelte:window
bind:outerHeight={ae_iframe_height}
/> -->
<section id="osit_ae_sponsorships" class="osit_sponsorships ae_main c_ae c_ae_sponsorships ae_main" bind:clientHeight={$ae_app.iframe_height}>
<header>
<h1>Sponsorships for One Sky IT Demo</h1>
</header>
<section class="ae_section ae_meta">
<p>
ae: {$ae_app.ae_full_name}
<span class="details">
(
{$ae_app.ae_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="ae_user">user: {$ae_app.ae_user}</span>
)
</span>
</p>
</section>
<div class="ae_overview">
<div class="ae_info ds__sponsorships_info ">
{@html $ae_app.sponsorships.ds.sponsorships_info}
</div>
</div>
{#if $ae_app.sponsorships.show_main__options}
<section class="ae_section ae_options ae_column sponsorship_obj__options">
<div class="ae_note ds__sponsorships_options ">
{@html $ae_app.sponsorships.ds.sponsorships_options}
</div>
<div class="filters_and_search">
<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 (name, description, etc.)"
id="meeting_fulltext_search_qry_str"
name="fulltext_search_qry_str"
bind:value={$ae_app.sponsorships.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>Filter on?</legend>
<div class="ae_row ae_flex_justify_around ae_width_md">
<label>Paid
<input
name="qry_paid"
type="checkbox"
bind:checked={$ae_app.sponsorships.qry_paid}
on:change={() => {$slct_trigger = 'load__sponsorship_obj_li';}}
>
</label>
<label>Guests
<input
name="qry_guest_li"
type="checkbox"
bind:checked={$ae_app.sponsorships.qry_guest_li}
on:change={() => {$slct_trigger = 'load__sponsorship_obj_li';}}
>
</label>
</div>
</fieldset>
<fieldset>
<legend>Select level?</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.sponsorships.qry_type}
on:change={() => {$slct_trigger = 'load__sponsorship_obj_li';}}
title="Show all meeting types"
>
</label>
<label>Friend ($5,000)
<input
name="qry_type"
type="radio"
value="Friend"
bind:group={$ae_app.sponsorships.qry_type}
on:change={() => {$slct_trigger = 'load__sponsorship_obj_li';}}
title="Friend ($5,000)"
>
</label>
<label>Supporter ($7,500)
<input
name="qry_type"
type="radio"
value="Supporter"
bind:group={$ae_app.sponsorships.qry_type}
on:change={() => {$slct_trigger = 'load__sponsorship_obj_li';}}
title="Supporter ($7,500)"
>
</label>
<label>Champion ($12,500)
<input
name="qry_type"
type="radio"
value="Champion"
bind:group={$ae_app.sponsorships.qry_type}
on:change={() => {$slct_trigger = 'load__sponsorship_obj_li';}}
title="Champion ($12,500)"
>
</label>
<label>Advocate ($20,000)
<input
name="qry_type"
type="radio"
value="Advocate"
bind:group={$ae_app.sponsorships.qry_type}
on:change={() => {$slct_trigger = 'load__sponsorship_obj_li';}}
title="Advocate ($20,000)"
>
</label>
<label>Presenting Partner ($30,000)
<input
name="qry_type"
type="radio"
value="Presenting Partner"
bind:group={$ae_app.sponsorships.qry_type}
on:change={() => {$slct_trigger = 'load__sponsorship_obj_li';}}
title="Presenting Partner ($30,000)"
>
</label>
<label>Signature Partner ($50,000)
<input
name="qry_type"
type="radio"
value="Signature Partner"
bind:group={$ae_app.sponsorships.qry_type}
on:change={() => {$slct_trigger = 'load__sponsorship_obj_li';}}
title="Signature Partner ($50,000)"
>
</label>
</div>
</fieldset>
</form>
{#await ae_sponsorship_obj_li_get_promise}
<div><span class="fas fa-spinner"></span>
Loading sponsorships...</div>
{:then ae_sponsorship_obj_li_get_result}
<!-- <p>Sponsorship list: {ae_sponsorship_obj_li_get_result}</p> -->
{:catch error}
<div>Error: {error.message}</div>
{/await}
<div class="ae_group ae_row">
{#if $ae_app.trusted_access && $ae_app.sponsorships.hidden == 'not_hidden'}
<button
on:click={() => {
$ae_app.sponsorships.hidden = 'all';
$ae_app.sponsorships.limit = 150;
$slct_trigger = 'load__sponsorship_obj_li';
}}
class="btn_show_bb_post ae_btn btn btn-info"
>
<span class="fas fa-eye"></span> Show Hidden Sponsorships
</button>
{:else if $ae_app.trusted_access && $ae_app.sponsorships.hidden == 'all'}
<button
on:click={() => {
$ae_app.sponsorships.hidden = 'not_hidden';
$slct_trigger = 'load__sponsorship_obj_li';
}}
class="btn_hide_bb_post ae_btn btn btn-info"
>
<span class="fas fa-eye-slash"></span> Hide Hidden Sponsorships
</button>
{/if}
{#if $ae_app.administrator_access && $ae_app.sponsorships.enabled == 'enabled'}
<button
on:click={() => {
$ae_app.sponsorships.hidden = 'all';
$ae_app.sponsorships.enabled = 'all';
$ae_app.sponsorships.limit = 500;
$slct_trigger = 'load__sponsorship_obj_li';
}}
class="btn_show_bb_post ae_btn btn btn-warning"
>
<span class="fas fa-eye"></span> Show Disabled Sponsorships
</button>
{:else if $ae_app.administrator_access && $ae_app.sponsorships.enabled == 'all'}
<button
on:click={() => {
$ae_app.sponsorships.enabled = 'enabled';
$slct_trigger = 'load__sponsorship_obj_li';
}}
class="btn_hide_bb_post ae_btn btn btn-warning"
>
<span class="fas fa-eye-slash"></span> Hide Disabled Sponsorships
</button>
{/if}
<button
on:click={() => {
$slct.sponsorship_id = null;
$slct.sponsorship_obj = {};
const url = new URL(location);
url.searchParams.delete('sponsorship_id');
history.pushState({}, '', url);
$ae_app.sponsorships.show_main__options = false;
$ae_app.sponsorships.show_list__sponsorship_obj_li = false;
$ae_app.sponsorships.show_view__sponsorship_obj = false;
$ae_app.sponsorships.show_edit__sponsorship_obj = true;
}}
class="btn_new_recovery_meeting ae_btn btn btn-secondary"
>
<span class="fas fa-plus"></span> Create new Sponsorship
</button>
</div>
</div> <!-- END: div filters_and_search -->
</section>
{/if}
{#if $slct.sponsorship_obj_li && $ae_app.sponsorships.show_list__sponsorship_obj_li}
<List_sponsorship_obj />
{/if}
{#if $ae_app.sponsorships.show_edit__sponsorship_obj}
<!-- <section class="ae_edit sponsorship_obj sponsorship_id ae_sponsorship_id_edit"> -->
<Element_modal_v3
show = { true }
modal_cover_body = { false }
report_client_dimensions = { true }
on:close={ () => {
$ae_app.sponsorships.show_main__options = true;
$ae_app.sponsorships.show_list__sponsorship_obj_li = true;
$ae_app.sponsorships.show_edit__sponsorship_obj = false;
$ae_app.sponsorships.show_view__sponsorship_obj = false;
const url = new URL(location);
url.searchParams.delete('sponsorship_id');
history.pushState({}, '', url);
let message = {'sponsorship_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.sponsorship_obj.name ? $slct.sponsorship_obj.name : 'New Sponsorship')}</span>
<span slot="body">
<!-- <Edit_sponsorship_obj
on:created__meeting_obj={handle_created_sponsorship_obj}
on:updated__meeting_obj={handle_updated_sponsorship_obj}
on:deleted__meeting_obj={handle_deleted_sponsorship_obj}
/> -->
</span>
</Element_modal_v3>
<!-- </section> -->
{/if}
{#if $ae_app.sponsorships.show_view__sponsorship_obj && $slct.sponsorship_obj}
<!-- <section class="ae_view sponsorship_obj sponsorship_id ae_sponsorship_id_view"> -->
<Element_modal_v3
show = { true }
modal_cover_body = { false }
report_client_dimensions = { true }
on:close={ () => {
$slct.sponsorship_id = null;
$slct.sponsorship_obj = {};
$ae_app.sponsorships.show_main__options = true;
$ae_app.sponsorships.show_list__sponsorship_obj_li = true;
$ae_app.sponsorships.show_view__sponsorship_obj = false;
$ae_app.sponsorships.show_edit__sponsorship_obj = false;
const url = new URL(location);
url.searchParams.delete('sponsorship_id');
history.pushState({}, '', url);
let message = {'sponsorship_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.sponsorship_obj.name}</span>
<span slot="body">
<View_sponsorship_obj />
</span>
</Element_modal_v3>
<!-- </section> -->
{/if}
</section>
<style>
/* .ae_meta {
font-size: smaller;
color: hsla(0,0%,50%,1);
} */
/* .ae_edit.sponsorship_obj {
border: dashed thin hsla(0,0%,70%,1);
margin: .5em .25em;
padding: .5em .25em;
background-color: hsla(0,0%,90%,1);
} */
/* .ae_view.sponsorship_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.sponsorship_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>

View File

@@ -1,353 +0,0 @@
<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';
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}
{#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
<!-- {#if idaa_event_obj.contact_1_name}
<span class="ae_badge ae_info event__event_contact_1">
<span class="fas fa-user"></span> {idaa_event_obj.contact_1_name}
</span>
{/if}
{#if idaa_event_obj.contact_2_name}
<span class="ae_badge ae_info event__event_contact_2">
<span class="fas fa-user"></span> {idaa_event_obj.contact_2_name}
</span>
{/if} -->
</button>
<!-- This has some odd checks. I intentionally used contact_1_email and not the new contact_li_json[0]. I made the assumption that on the first save it should populate the UUID correctly. -->
{#if $ae_app.trusted_access || idaa_event_obj.external_person_id === $ae_app.novi_uuid || idaa_event_obj.contact_1_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 idaa_event_obj.contact_1_id_random}
<div class="event__contact"
class:ae_d_none={!idaa_event_obj.contact_1_full_name}
>
<span class="ae_label">
<span class="fas fa-user"></span> Contact:
</span>
{idaa_event_obj.contact_1_full_name}
{#if idaa_event_obj.contact_1_email}
| <a href="mailto:{idaa_event_obj.contact_1_email}?Subject={idaa_event_obj.name}">{idaa_event_obj.contact_1_email}</a>
{/if}
{#if idaa_event_obj.contact_1_phone_mobile}
<span class="ae_label">| Mobile:</span>
<a href="tel:{idaa_event_obj.contact_1_phone_mobile}">{idaa_event_obj.contact_1_phone_mobile}</a>
{/if}
{#if idaa_event_obj.contact_1_phone_home}
<span class="ae_label">| Home:</span>
<a href="tel:{idaa_event_obj.contact_1_phone_home}">{idaa_event_obj.contact_1_phone_home}</a>
{/if}
{#if idaa_event_obj.contact_1_phone_office}
<span class="ae_label">| Office:</span>
<a href="tel:{idaa_event_obj.contact_1_phone_office}">{idaa_event_obj.contact_1_phone_office}</a>
{/if}
{#if idaa_event_obj.contact_1_other_text}| {idaa_event_obj.contact_1_other_text}{/if}
</div>
{/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_2_other_text}| {idaa_event_obj.contact_2_other_text}{/if}
</div>
{:else if idaa_event_obj.contact_2_id_random}
<div class="event__contact"
class:ae_d_none={!idaa_event_obj.contact_2_name}
>
<span class="ae_label">
<span class="fas fa-user"></span> Contact:
</span>
{idaa_event_obj.contact_2_name}
{#if idaa_event_obj.contact_2_email}
| <a href="mailto:{idaa_event_obj.contact_2_email}?Subject={idaa_event_obj.name}">{idaa_event_obj.contact_2_email}</a>
{/if}
{#if idaa_event_obj.contact_2_phone_mobile}
<span class="ae_label">| Mobile:</span>
<a href="tel:{idaa_event_obj.contact_2_phone_mobile}">{idaa_event_obj.contact_2_phone_mobile}</a>
{/if}
{#if idaa_event_obj.contact_2_phone_home}
<span class="ae_label">| Home:</span>
<a href="tel:{idaa_event_obj.contact_2_phone_home}">{idaa_event_obj.contact_2_phone_home}</a>
{/if}
{#if idaa_event_obj.contact_2_phone_office}
<span class="ae_label">| Office:</span>
<a href="tel:{idaa_event_obj.contact_2_phone_office}">{idaa_event_obj.contact_2_phone_office}</a>
{/if}
{#if idaa_event_obj.contact_2_other_text}| {idaa_event_obj.contact_2_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) && !idaa_event_obj.contact_1_id_random && !idaa_event_obj.contact_2_id_random}
<div class="event__contact ae_warning">Required: No contact information was given!</div>
{/if}
{#if !idaa_event_obj.external_person_id}
<div class="event__contact ae_warning">New: This has not been 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}
<div>No recovery meetings avalible to show at this time</div>
{/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>

View File

@@ -0,0 +1,163 @@
<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';
export let container_class_li = [];
onMount(() => {
console.log('** Component Mounted: ** List - Sponsorships Obj');
});
</script>
<section class="svelte_component ae_section ae_list list__sponsorship_obj sponsorship_obj_li {container_class_li.join(' ')}">
{#if $slct.sponsorship_obj_li}
<table class="ae_table">
<thead>
<tr>
<th>Options</th>
<th>Name</th> <!-- This is the name of the organization or person -->
<th>Level</th>
<th>Paid</th>
<th>Guests</th>
<th>
<!-- Show what POC (Point of Contact) stands for when hovering -->
<abbr title="Point of Contact" class="ae_label">POC</abbr>
</th>
<th>Created</th>
<th>Updated</th>
</tr>
</thead>
<tbody>
{#each $slct.sponsorship_obj_li as ae_sponsorship_obj, index}
<tr
id={`ae_sponsorship_id__${ae_sponsorship_obj.sponsorship_id_random}`}
class="ae_object sponsorship_obj"
>
<td class="ae_options sponsorship_obj__options">
<button
on:click={() => {
$slct.sponsorship_id = ae_sponsorship_obj.sponsorship_id_random;
$slct.sponsorship_obj = ae_sponsorship_obj;
$slct_trigger = 'load__sponsorship_obj';
$ae_app.sponsorships.show_main__options = true;
$ae_app.sponsorships.show_list__sponsorship_obj_li = true;
$ae_app.sponsorships.show_view__sponsorship_obj = true;
$ae_app.sponsorships.show_edit__sponsorship_obj = false;
}}
class="ae_btn btn_primary"
title={`Open to see details: ${ae_sponsorship_obj.name}`}
>
<span class="fas fa-envelope-open"></span>
<!-- <span class="fas fa-info-circle"></span> -->
View
</button>
{#if $ae_app.administrator_access}
<button
on:click={() => {
$slct.sponsorship_id = ae_sponsorship_obj.sponsorship_id_random;
$slct.sponsorship_obj = ae_sponsorship_obj;
$slct_trigger = 'load__sponsorship_obj';
// $ae_app.sponsorships.show_main__options = true;
// $ae_app.sponsorships.show_list__sponsorship_obj_li = true;
$ae_app.sponsorships.show_view__sponsorship_obj = false;
$ae_app.sponsorships.show_edit__sponsorship_obj = true;
}}
class="ae_btn btn_secondary"
title={`Edit meeting: ${ae_sponsorship_obj.name}`}
>
<span class="fas fa-edit"></span> Edit
</button>
{/if}
</td>
<td class="ae_value sponsorships__name">{ae_sponsorship_obj.name}</td>
<td class="">
<span class="fas fa-gem"></span>
{#if ae_sponsorship_obj.level_num}{ae_sponsorship_obj.level_num}{/if}
{#if ae_sponsorship_obj.level_str}{ae_sponsorship_obj.level_str}{/if}
</td>
<td>
{#if ae_sponsorship_obj.paid}
<!-- Show checkmark -->
<span class="fas fa-check"
title="Paid"></span>
{:else}
<!-- Show X or cross -->
<span class="fas fa-times"
title="Not Paid"></span>
{/if}
{#if ae_sponsorship_obj.amount}
<span class="ae_value sponsorships__amount">${ae_sponsorship_obj.amount}</span>
{/if}
</td>
<td>
{#if ae_sponsorship_obj.guest_li_json}
<span class="fas fa-list-ol"></span> {ae_sponsorship_obj.guest_li_json.length}
{:else}
<!-- <span class="fas fa-list-ol"></span> -->
-- None --
{/if}
</td>
<td><span class="ae_flex ae_flex_justify_around">
{#if ae_sponsorship_obj.poc_json}
<span>
<span class="fas fa-user"></span> {ae_sponsorship_obj.poc_json.given_name} {ae_sponsorship_obj.poc_json.family_name}
</span>
<a href="mailto:{ae_sponsorship_obj.poc_json.email}"><span class="fas fa-envelope"></span> {ae_sponsorship_obj.poc_json.email}</a>
{/if}
</span></td>
<td>{ae.util.iso_datetime_formatter(ae_sponsorship_obj.created_on, 'datetime_short')}</td>
<td>{ae.util.iso_datetime_formatter(ae_sponsorship_obj.updated_on, 'datetime_short')}</td>
</tr>
{/each}
</tbody>
</table>
{:else}
<div>No sponsorships avalible to show at this time</div>
{/if}
</section>
<style>
.ae_label {
font-size: smaller;
}
.ae_value {
font-weight: bold;
}
.ae_header h3 {
font-size: 1.2em;
margin: 0;
/* padding: 0; */
}
.sponsorship_obj .ae_meta {
flex-direction: column;
/* justify-content: space-between; */
}
.sponsorship_obj .ae_meta .ae_group {
flex-direction: row;
}
.sponsorship_obj .ae_meta .ae_options {
flex-direction: row;
justify-content: space-between;
}
</style>

View File

@@ -1,446 +0,0 @@
<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>
{:else if $slct.event_obj.contact_1_id_random}
<div class="event__contact"
class:ae_d_none={!$slct.event_obj.contact_1_name}
>
<span class="ae_label">
<span class="fas fa-user"></span> Contact:
</span>
{$slct.event_obj.contact_1_name}
{#if $slct.event_obj.contact_1_email}
| <a href="mailto:{$slct.event_obj.contact_1_email}?Subject={$slct.event_obj.name}">{$slct.event_obj.contact_1_email}</a>
{/if}
{#if $slct.event_obj.contact_1_phone_mobile}
<span class="ae_label">| Mobile:</span>
<a href="tel:{$slct.event_obj.contact_1_phone_mobile}">{$slct.event_obj.contact_1_phone_mobile}</a>
{/if}
{#if $slct.event_obj.contact_1_phone_home}
<span class="ae_label">| Home:</span>
<a href="tel:{$slct.event_obj.contact_1_phone_home}">{$slct.event_obj.contact_1_phone_home}</a>
{/if}
{#if $slct.event_obj.contact_1_phone_office}
<span class="ae_label">| Office:</span>
<a href="tel:{$slct.event_obj.contact_1_phone_office}">{$slct.event_obj.contact_1_phone_office}</a>
{/if}
{#if $slct.event_obj.contact_1_other_text}| {$slct.event_obj.contact_1_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>
{:else if $slct.event_obj.contact_2_id_random}
<div class="event__contact"
class:ae_d_none={!$slct.event_obj.contact_2_name}
>
<span class="ae_label">
<span class="fas fa-user"></span> Contact:
</span>
{$slct.event_obj.contact_2_name}
{#if $slct.event_obj.contact_2_email}
| <a href="mailto:{$slct.event_obj.contact_2_email}?Subject={$slct.event_obj.name}">{$slct.event_obj.contact_2_email}</a>
{/if}
{#if $slct.event_obj.contact_2_phone_mobile}
<span class="ae_label">| Mobile:</span>
<a href="tel:{$slct.event_obj.contact_2_phone_mobile}">{$slct.event_obj.contact_2_phone_mobile}</a>
{/if}
{#if $slct.event_obj.contact_2_phone_home}
<span class="ae_label">| Home:</span>
<a href="tel:{$slct.event_obj.contact_2_phone_home}">{$slct.event_obj.contact_2_phone_home}</a>
{/if}
{#if $slct.event_obj.contact_2_phone_office}
<span class="ae_label">| Office:</span>
<a href="tel:{$slct.event_obj.contact_2_phone_office}">{$slct.event_obj.contact_2_phone_office}</a>
{/if}
{#if $slct.event_obj.contact_2_other_text}| {$slct.event_obj.contact_2_other_text}{/if}
</div>
{/if}
{#if !$slct.event_obj.contact_1_id_random && !$slct.event_obj.contact_2_id_random}
<div class="event__contact ae_warning">No contact information was given!</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_1_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>

View File

@@ -0,0 +1,192 @@
<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.sponsorship_id) {
console.log(`Sponsorship ID selected: ${$slct.sponsorship_id}`);
console.log(`Sponsorship Object selected: ${$slct.sponsorship_obj}`)
$slct_trigger = 'load__sponsorship_obj';
}
onMount(() => {
console.log('** Component Mounted: ** View - Sponsorship 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 sponsorship_obj view__sponsorship_obj {container_class_li.join(' ')}">
<div class="sponsorship__header">
<h2 class="sponsorship__name">{@html $slct.sponsorship_obj.name}</h2>
</div>
<div class="sponsorship__content">
<div
class="sponsorship_description description"
>
<div class="ae_label sponsorship__description">Description:</div>
<pre class="ae_value sponsorship__description">{@html $slct.sponsorship_obj.description ? $slct.sponsorship_obj.description : '-- No Description Given --'}</pre>
</div>
<div
class:ae_d_none={!$slct.sponsorship_obj.level_num}
class="sponsorship_level"
>
<span class="ae_label">Level of Sponsorship:</span>
<span class="ae_value"><span class="fas fa-gem"></span> {$slct.sponsorship_obj.level_num} &mdash; {$slct.sponsorship_obj.level_str}</span>
</div>
<div>
<span class="ae_label">Paid:</span>
$
<span class="ae_value">
{$slct.sponsorship_obj.paid ? 'Yes, marked as paid' : 'Not yet marked as paid'}
</span>
</div>
<div class="ae_list sponsorship__guests">
<h2>Guest List</h2>
{#if $slct.sponsorship_obj.guest_li_json && $slct.sponsorship_obj.guest_li_json.length && $slct.sponsorship_obj.guest_li_json[0].full_name}
<ul>
{#each $slct.sponsorship_obj.guest_li_json as guest, index}
<li class="sponsorship__guest"
class:ae_d_none={!$slct.sponsorship_obj.guest_li_json[index].full_name}
>
<span class="ae_label">
<span class="fas fa-user"></span> Contact:
</span>
{$slct.sponsorship_obj.guest_li_json[index].full_name}
{#if $slct.sponsorship_obj.guest_li_json[index].email}
| <a href="mailto:{$slct.sponsorship_obj.guest_li_json[index].email}?Subject={$slct.sponsorship_obj.full_name}">{$slct.sponsorship_obj.guest_li_json[index].email}</a>
{/if}
{#if $slct.sponsorship_obj.guest_li_json[index].phone_mobile}
<span class="ae_label">| Mobile:</span>
<a href="tel:{$slct.sponsorship_obj.guest_li_json[index].phone_mobile}">{$slct.sponsorship_obj.guest_li_json[index].phone_mobile}</a>
{/if}
{#if $slct.sponsorship_obj.guest_li_json[index].phone_home}
<span class="ae_label">| Home:</span>
<a href="tel:{$slct.sponsorship_obj.guest_li_json[index].phone_home}">{$slct.sponsorship_obj.guest_li_json[index].phone_home}</a>
{/if}
{#if $slct.sponsorship_obj.guest_li_json[index].phone_office}
<span class="ae_label">| Office:</span>
<a href="tel:{$slct.sponsorship_obj.guest_li_json[index].phone_office}">{$slct.sponsorship_obj.guest_li_json[index].phone_office}</a>
{/if}
{#if $slct.sponsorship_obj.guest_li_json[index].other_text}| {$slct.sponsorship_obj.guest_li_json[index].other_text}{/if}
</li>
{/each}
</ul>
{:else}
<div class="ae_warning">No guest list found!</div>
{/if}
</div>
<section class="ae_section ae_meta sponsorship__meta">
<div class="ae_group">
<span
class="sponsorship__id"
class:ae_d_none={!$ae_app.administrator_access}>
ID:
{$slct.sponsorship_obj.sponsorship_id_random}
</span>
<span
class="sponsorship__created_on"
>
Created on: {ae.util.iso_datetime_formatter($slct.sponsorship_obj.created_on, 'datetime_short')}
</span>
<span
class="sponsorship__updated_on"
class:ae_d_none={!$slct.sponsorship_obj.updated_on}
>
Updated on: {ae.util.iso_datetime_formatter($slct.sponsorship_obj.updated_on, 'datetime_short')}
</span>
</div>
{#if $ae_app.trusted_access || $slct.sponsorship_obj.external_person_id === $ae_app.novi_uuid || $slct.sponsorship_obj.contact_1_email === $ae_app.novi_email}
<div class="ae_options">
<button
on:click={() => {
// $slct.sponsorship_id = $slct.sponsorship_obj.sponsorship_id_random;
// $slct.sponsorship_obj = $slct.sponsorship_obj;
// const url = new URL(location);
// url.searchParams.set('sponsorship_id', $slct.sponsorship_obj.sponsorship_id_random);
// history.pushState({}, '', url);
// $ae_app.sponsorships.show_main__options = true;
// $ae_app.sponsorships.show_list__sponsorship_obj_li = true;
$ae_app.sponsorships.show_view__sponsorship_obj = false;
$ae_app.sponsorships.show_edit__sponsorship_obj = true;
}}
class="btn btn-xs btn-secondary"
title={`Edit sponsorship: ${$slct.sponsorship_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;
}
.sponsorship__user_timezone {
font-size: smaller;
font-style: italic;
}
.sponsorship_obj .ae_meta {
flex-direction: column;
/* justify-content: space-between; */
}
.sponsorship_obj .ae_meta .ae_group {
flex-direction: row;
}
.sponsorship_obj .ae_meta .ae_options {
flex-direction: row;
justify-content: space-between;
}
/* a {
color: #82B6E1;
} */
</style>

View File

@@ -15,22 +15,63 @@
}
body {
/* margin: 0; */
/* display: flex;
place-items: center; */
/* min-width: 320px; */
/* Use boarder-box to make things easier with borders and scrolling in general. */
box-sizing: border-box;
min-height: 100vh;
/* min-height: fit-content; */
/* height: 100%; */
/* outline: dashed thick blue; */
/* border: solid thick blue; */
min-width: 100vw;
/* width: 100%; */
margin: 1em;
padding: 0em;
/* contain: layout; */
/* contain: size; */
/* Account for the margin */
height: calc(100vh - 1em - 1em);
/* max-width: 1280px; */
/* background-color: hsla(240, 50%, 20%); */
background-color: hsla(207, 43%, 18%);
/* Display as flex does not seem to work well here. */
}
body>.svelte_target {
box-sizing: border-box;
/* box-sizing: content-box; */
/* outline: solid thin hsla(0, 50%, 50%, .50); */
border: solid medium hsla(0, 0%, 50%, .40);
/* border-color: hsla(207, 43%, 18%); */
/* background-color: white; */
/* background-color: hsla(240, 100%, 95%, .97); */
background-color: hsla(0, 0%, 100%, .90);
overflow: scroll;
height: 100%;
/* max-height: calc(100% - 1em); */
/* width: 100%; */
/* max-width: calc(100% - 1em); */
max-width: 1280px;
/* margin: 1em; */
/* Use auto margin to center this element within the body */
margin: auto;
padding: .5em;
}
/* Use this to fix the scrolling. This is mostly useful for wide tables. */
/* This must be applied to the parent of the table. */
body>.svelte_target .svelte_component {
overflow: scroll;
}
address {
margin-bottom: .25em;
padding-left: .5em;
@@ -45,6 +86,39 @@ pre {
border: none;
}
table.ae_table {
/* border-collapse: collapse; */
border-spacing: 0px;
border: solid thin hsla(0, 0%, 0%, .30);
width: 100%;
max-width: 100%;
/* margin: 1em; */
/* padding: 1em; */
/* overflow: scroll; */
}
.ae_table tr {
border: solid thin hsla(0, 0%, 0%, .20);
}
.ae_table th {
border: solid thin hsla(0, 0%, 0%, .10);
border-bottom: solid thin hsla(0, 0%, 0%, .20);
padding: .5em;
/* text-align: center; */
}
.ae_table td {
border: solid thin hsla(0, 0%, 0%, .10);
padding: .5em;
text-align: center;
}
textarea {
/* width: calc(fit-content - 1em); */
width: 100%;
@@ -256,6 +330,14 @@ button:focus-visible {
/* justify-content: space-evenly; */
}
.ae_flex {
display: flex;
/* flex-direction: row; */
/* align-items: center; */
/* justify-content: space-between; */
}
.ae_column {
display: flex;
flex-direction: column;
@@ -277,6 +359,17 @@ button:focus-visible {
justify-content: space-around;
}
.ae_text_align_left {
text-align: left;
}
.ae_text_align_center {
text-align: center;
}
.ae_text_align_right {
text-align: right;
}
.ae_width_25 {
width: 25%;
/* max-width: 25%; */
@@ -377,6 +470,7 @@ button:focus-visible {
border: solid medium hsla(0,100%,50%,.1);
}
/* This covers the entire viewable area. Essentially a new "body" */
/* element_ae_modal ae_modal_showing_container ae_modal modal_cover_body */
.ae_modal {
position: fixed;
@@ -388,9 +482,11 @@ button:focus-visible {
height: 100%;
/* max-height: 100vh; */
min-width: 100vw;
width: 100%;
min-width: 100%;
/* width: 100%; */
width: 100vw;
max-width: 100vw;
/* max-width: 1280px; */
/* background-color: hsla(180,75%,90%,.75); */
background-color: hsla(180,0%,90%,.75);
@@ -409,7 +505,7 @@ button:focus-visible {
/* Margin should stay 0 and padding can be used to create space within the modal for the actual content. */
margin: 0;
padding: 1em;
padding: 0em;
/* pointer-events: auto; */
}

View File

@@ -1,9 +1,7 @@
import { ae } from 'aether_npm_lib';
import './app.css';
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';
// import App from './App.svelte';
import Sponsorships from './0_sponsorships__main.svelte';
let url_params = ae.util.get_url_params();
// console.log(url_params);
@@ -15,50 +13,18 @@ if (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': 75,
'results_limit_trusted': 50,
'results_limit_authenticated': 25,
}
});
}
if (document.querySelector('.svelte_target.idaa_events_main')) {
const events_main_app = new Events({
target: document.querySelector('.svelte_target.idaa_events_main'),
if (document.querySelector('.svelte_target.ae_sponsorships_main')) {
const sponsorships_main_app = new Sponsorships({
target: document.querySelector('.svelte_target.ae_sponsorships_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': 75,
'results_limit_trusted': 50,
'results_limit_authenticated': 25,
}
});
}
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'],
// NOTE: decodeURIComponent() is needed because the value is passed in as a url param. Should this be taken care of by the ae.util.get_url_params() function?
'sponsorship_id': url_params.sponsorship_id,
'user': decodeURIComponent(url_params.email),
'key': (url_params.key ? url_params.key : false),
// 'results_limit_administrator': 75,
// 'results_limit_trusted': 50,
// 'results_limit_authenticated': 25,
}
});
}

View File

@@ -8,7 +8,7 @@ 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_account_id = '_XY7DXtc9MY'; // OSIT Demo _XY7DXtc9MY (1)
let fake_ae_api_jwt_key="EHmSXZFKfMEW65E8kxCKmQ" // 22 characters; super secret Aether JWT signing key
let fake_api_temporary_token = '';
@@ -81,7 +81,7 @@ 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': [] };
let slct_obj_template: key_val = { 'sponsorship_id': null, 'sponsorship_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 = {};
@@ -106,45 +106,15 @@ let ae_app_struct: key_val = {
// 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': [],
'ae_user': null,
'ae_key': null,
'ae_full_name': null,
'ae_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,
// Module - OSIT Aether - Sponsorships ()
'sponsorships':{
'show_sponsorship_id_view': false,
'show_sponsorship_id_edit': false,
'filter_meeting_type': 'all', // all, idaa, al-anon
'filter_meeting_group': 'all', // all, in-person, virtual
@@ -159,31 +129,12 @@ let ae_app_struct: key_val = {
'limit': 250, // all or nothing... easier for now
'offset': 0, // all or nothing... easier for now
'event_id': null,
'group_sort': 'ASC', // ASC or DESC
'ds':{},
},
'sponsorship_id': null,
'sponsorship_cfg_id': null,
// 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,
'qry_status': null,
'ds':{},
},