Lots of little fixes. Can now save archives.
This commit is contained in:
@@ -49,7 +49,7 @@ $idaa_slct.archive_id = ae_acct.slct.archive_id;
|
||||
$: lq__archive_obj = liveQuery(async () => {
|
||||
console.log(`lq__archive_obj: archive_id = ${$idaa_slct?.archive_id}`);
|
||||
let results = await db_archives.archive
|
||||
.get($idaa_slct?.archive_id);
|
||||
.get($idaa_slct?.archive_id ?? ''); // null or undefined does not reset things like '' does
|
||||
|
||||
return results;
|
||||
});
|
||||
@@ -57,7 +57,7 @@ $: lq__archive_obj = liveQuery(async () => {
|
||||
$: lq__archive_content_obj_li = liveQuery(async () => {
|
||||
let results = await db_archives.content
|
||||
.where('archive_id')
|
||||
.equals($idaa_slct?.archive_id)
|
||||
.equals($idaa_slct?.archive_id ?? '') // null or undefined does not reset things like '' does
|
||||
.reverse()
|
||||
.sortBy('updated_on');
|
||||
// .sortBy('title');
|
||||
@@ -67,7 +67,7 @@ $: lq__archive_content_obj_li = liveQuery(async () => {
|
||||
|
||||
$: lq__archive_content_obj = liveQuery(async () => {
|
||||
let results = await db_archives.content
|
||||
.get($idaa_slct.archive_content_id);
|
||||
.get($idaa_slct.archive_content_id ?? ''); // null or undefined does not reset things like '' does
|
||||
|
||||
return results;
|
||||
});
|
||||
@@ -180,7 +180,7 @@ if (browser) {
|
||||
|
||||
<!-- Modal: Archive Content edit ID -->
|
||||
<Modal
|
||||
title="{$lq__archive_content_obj?.name} - {$lq__archive_content_obj?.id}"
|
||||
title="{$lq__archive_content_obj?.name ?? 'New Archive Content'} - {$lq__archive_content_obj?.id ?? 'Not Saved Yet'}"
|
||||
bind:open={$idaa_sess.archives.show__modal_edit__archive_content_id}
|
||||
autoclose={false}
|
||||
placement="top-center"
|
||||
@@ -191,30 +191,30 @@ if (browser) {
|
||||
<svelte:fragment slot="header">
|
||||
<div class="flex flex-row items-center justify-between w-full">
|
||||
<h3 class="text-lg font-semibold">
|
||||
{#if $ae_loc.trusted_access}
|
||||
<!-- <div class="ae_options"> -->
|
||||
<button
|
||||
on:click={() => {
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.set('event_id', $lq__archive_content_obj?.event_id_random);
|
||||
// history.pushState({}, '', url);
|
||||
{#if $ae_loc.trusted_access}
|
||||
<!-- <div class="ae_options"> -->
|
||||
<button
|
||||
on:click={() => {
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.set('event_id', $lq__archive_content_obj?.event_id_random);
|
||||
// history.pushState({}, '', url);
|
||||
|
||||
$idaa_sess.archives.show__modal_view__archive_content_id = $idaa_slct.archive_content_id;
|
||||
$idaa_sess.archives.show__modal_edit__archive_content_id = false;
|
||||
}}
|
||||
class="btn btn-sm variant-ghost-warning hover:variant-filled-warning transition"
|
||||
title={`View meeting: ${$lq__archive_content_obj?.name}`}
|
||||
>
|
||||
<span class="fas fa-eye m-1"></span> View
|
||||
</button>
|
||||
<!-- </div> -->
|
||||
{/if}
|
||||
$idaa_sess.archives.show__modal_view__archive_content_id = $idaa_slct.archive_content_id;
|
||||
$idaa_sess.archives.show__modal_edit__archive_content_id = false;
|
||||
}}
|
||||
class="btn btn-sm variant-ghost-warning hover:variant-filled-warning transition"
|
||||
title={`View meeting: ${$lq__archive_content_obj?.name}`}
|
||||
>
|
||||
<span class="fas fa-eye m-1"></span> View
|
||||
</button>
|
||||
<!-- </div> -->
|
||||
{/if}
|
||||
|
||||
<span class="text-sm text-gray-500">
|
||||
Edit Archive Content:
|
||||
</span>
|
||||
{$lq__archive_content_obj?.name}
|
||||
</h3>
|
||||
<span class="text-sm text-gray-500">
|
||||
Edit Archive Content:
|
||||
</span>
|
||||
{$lq__archive_content_obj?.name ?? 'New Archive Content'}
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
</svelte:fragment>
|
||||
@@ -248,6 +248,7 @@ if (browser) {
|
||||
title="{$lq__archive_content_obj?.name} - {$lq__archive_content_obj?.archive_content_id}"
|
||||
bind:open={$idaa_sess.archives.show__modal_view__archive_content_id}
|
||||
autoclose={false}
|
||||
outsideclose={true}
|
||||
placement="top-center"
|
||||
size="xl"
|
||||
class="top-center bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-200 rounded-lg border-gray-200 dark:border-gray-700 divide-gray-200 dark:divide-gray-700 shadow-md relative flex flex-col mx-auto w-full divide-y"
|
||||
|
||||
@@ -3,13 +3,11 @@ export let log_lvl = 1;
|
||||
// *** Import Svelte core
|
||||
import { onMount } from 'svelte';
|
||||
import { fade } from 'svelte/transition';
|
||||
import { Spinner } from 'flowbite-svelte';
|
||||
|
||||
// *** Import Aether core variables and functions
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
import { ae_util } from '$lib/ae_utils/ae_utils';
|
||||
import { core_func } from '$lib/ae_core/ae_core_functions';
|
||||
import { api } from '$lib/api';
|
||||
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
||||
import { idaa_loc, idaa_sess, idaa_slct } from '$lib/ae_idaa_stores';
|
||||
import { archives_func } from '$lib/ae_archives/ae_archives_functions';
|
||||
@@ -101,6 +99,7 @@ if (lu_time_zone_list && lu_time_zone_list.length > 0) {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** ID - Archive Content Obj - Edit');
|
||||
});
|
||||
@@ -400,7 +399,7 @@ async function handle_hosted_files_uploaded(hosted_file_id_li: string[], hosted_
|
||||
bind:hosted_file_id_li={$idaa_slct.archive_content_obj.hosted_file_id_li}
|
||||
bind:hosted_file_obj_li={$idaa_slct.archive_content_obj.hosted_file_obj_li}
|
||||
bind:upload_complete={$idaa_slct.archive_content_obj.upload_complete}
|
||||
log_lvl={2}
|
||||
log_lvl={log_lvl}
|
||||
>
|
||||
<span slot="label">
|
||||
<div>
|
||||
@@ -717,7 +716,7 @@ async function handle_hosted_files_uploaded(hosted_file_id_li: string[], hosted_
|
||||
<button
|
||||
type="submit"
|
||||
disabled={disable_submit_btn}
|
||||
class="btn btn-md variant-ghost-primary"
|
||||
class="btn btn-md variant-ghost-primary hover:variant-filled-primary transition"
|
||||
>
|
||||
<span class="fas fa-check m-1"></span>
|
||||
Save Archive Content
|
||||
|
||||
@@ -3,15 +3,14 @@ export let log_lvl = 1;
|
||||
// *** Import Svelte core
|
||||
import { onMount } from 'svelte';
|
||||
import { fade } from 'svelte/transition';
|
||||
import { Spinner } from 'flowbite-svelte';
|
||||
|
||||
// *** Import Aether core variables and functions
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
import { ae_util } from '$lib/ae_utils/ae_utils';
|
||||
import { core_func } from '$lib/ae_core/ae_core_functions';
|
||||
import { api } from '$lib/api';
|
||||
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
||||
import { idaa_loc, idaa_sess, idaa_slct } from '$lib/ae_idaa_stores';
|
||||
import { archives_func } from '$lib/ae_archives/ae_archives_functions';
|
||||
|
||||
import Tiptap_editor from '$lib/element_tiptap_editor.svelte';
|
||||
|
||||
@@ -21,6 +20,8 @@ let create_archive_obj_promise: any;
|
||||
let delete_archive_obj_promise: any;
|
||||
let update_archive_obj_promise: any;
|
||||
let upload__hosted_file_obj_promise: any;
|
||||
let prom_api__archive_obj: any;
|
||||
let prom_api__archive_obj__hosted_file: any;
|
||||
|
||||
let disable_submit_btn = true;
|
||||
|
||||
@@ -66,7 +67,6 @@ if (lu_time_zone_list && lu_time_zone_list.length > 0) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** ID - Archive Obj - Edit');
|
||||
});
|
||||
@@ -74,39 +74,40 @@ onMount(() => {
|
||||
|
||||
|
||||
async function handle_submit_form(event) {
|
||||
console.log('*** handle_submit_form() ***');
|
||||
if (log_lvl > 1) {
|
||||
console.log('*** handle_submit_form() ***');
|
||||
console.log(event.target);
|
||||
}
|
||||
|
||||
disable_submit_btn = true;
|
||||
|
||||
let form_data = new FormData(event.target);
|
||||
console.log(form_data);
|
||||
|
||||
let form_archive_data = ae_util.extract_prefixed_form_data({prefix: null, form_data: form_data, trim_values: true, bool_tf_str: true, log_lvl: 0});
|
||||
console.log(form_archive_data);
|
||||
let archive_di = ae_util.extract_prefixed_form_data({prefix: null, form_data: form_data, trim_values: true, bool_tf_str: true, log_lvl: 0});
|
||||
console.log(archive_di);
|
||||
|
||||
let archive_data: key_val = {};
|
||||
let archive_do: key_val = {};
|
||||
|
||||
if (!$idaa_slct.archive_id) {
|
||||
archive_data['account_id_random'] = $ae_loc.account_id;
|
||||
archive_data['enable'] = true;
|
||||
archive_do['account_id_random'] = $ae_loc.account_id;
|
||||
// archive_do['enable'] = true;
|
||||
}
|
||||
|
||||
archive_data['name'] = form_archive_data.name;
|
||||
if (tinyMCE.get('description')) {
|
||||
archive_data['description'] = tinyMCE.get('description').getContent();
|
||||
} else {
|
||||
archive_data['description'] = form_archive_data.description;
|
||||
}
|
||||
archive_do['name'] = archive_di.name;
|
||||
|
||||
if (tinyMCE.get('content_html')) {
|
||||
archive_data['content_html'] = tinyMCE.get('content_html').getContent();
|
||||
// Check if the description_new_html exists and is a string
|
||||
if (typeof $idaa_slct.archive_obj.description_new_html === 'string') {
|
||||
console.log('New description is a string');
|
||||
archive_do['description'] = $idaa_slct.archive_obj.description_new_html;
|
||||
} else {
|
||||
archive_data['content_html'] = form_archive_data.content_html;
|
||||
console.log('New description is not a string. Do nothing.');
|
||||
// archive_do['description'] = event_meeting_fd.description;
|
||||
}
|
||||
|
||||
let date_time_str = null;
|
||||
let date_part = form_archive_data.original_datetime_date.trim();
|
||||
let time_part = form_archive_data.original_datetime_time.trim();
|
||||
let date_part = archive_di.original_datetime_date.trim();
|
||||
let time_part = archive_di.original_datetime_time.trim();
|
||||
if (date_part && time_part) {
|
||||
date_time_str = `${date_part} ${time_part}`;
|
||||
} else if (date_part) {
|
||||
@@ -115,81 +116,77 @@ async function handle_submit_form(event) {
|
||||
// date_time_str = `${time_part}`;
|
||||
date_time_str = false;
|
||||
}
|
||||
archive_data['original_datetime'] = date_time_str;
|
||||
archive_do['original_datetime'] = date_time_str;
|
||||
|
||||
archive_data['original_timezone'] = form_archive_data.original_timezone;
|
||||
archive_do['original_timezone'] = archive_di.original_timezone;
|
||||
|
||||
archive_data['original_location'] = form_archive_data.original_location;
|
||||
archive_do['original_location'] = archive_di.original_location;
|
||||
|
||||
archive_data['original_url'] = form_archive_data.original_url;
|
||||
archive_data['original_url_text'] = form_archive_data.original_url_text;
|
||||
archive_do['original_url'] = archive_di.original_url;
|
||||
archive_do['original_url_text'] = archive_di.original_url_text;
|
||||
|
||||
archive_data['hide'] = !!form_archive_data.hide;
|
||||
archive_data['priority'] = !!form_archive_data.priority;
|
||||
if (form_archive_data.sort) {
|
||||
archive_data['sort'] = Number(form_archive_data.sort);
|
||||
archive_do['hide'] = archive_di.hide;
|
||||
archive_do['priority'] = archive_di.priority;
|
||||
if (archive_di.sort) {
|
||||
archive_do['sort'] = Number(archive_di.sort);
|
||||
} else {
|
||||
archive_data['sort'] = null;
|
||||
archive_do['sort'] = null;
|
||||
}
|
||||
if (form_archive_data.group) {
|
||||
archive_data['group'] = form_archive_data.group;
|
||||
if (archive_di.group) {
|
||||
archive_do['group'] = archive_di.group;
|
||||
} else {
|
||||
archive_data['group'] = null;
|
||||
archive_do['group'] = null;
|
||||
}
|
||||
|
||||
if (form_archive_data.enable) {
|
||||
archive_data['enable'] = !!form_archive_data.enable;
|
||||
}
|
||||
// console.log(`archive_di.enable = ${archive_di.enable}`);
|
||||
archive_do['enable'] = !!archive_di.enable;
|
||||
|
||||
if (tinyMCE.get('notes')) {
|
||||
archive_data['notes'] = tinyMCE.get('notes').getContent();
|
||||
// Check if the notes_new_html exists and is a string
|
||||
if (typeof $idaa_slct.archive_obj.notes_new_html === 'string') {
|
||||
console.log('New notes is a string');
|
||||
archive_do['notes'] = $idaa_slct.archive_obj.notes_new_html;
|
||||
} else {
|
||||
archive_data['notes'] = form_archive_data.notes;
|
||||
console.log('New notes is not a string. Do nothing.');
|
||||
// archive_do['notes'] = event_meeting_fd.notes;
|
||||
}
|
||||
|
||||
console.log(archive_data);
|
||||
console.log(archive_do);
|
||||
|
||||
if (!$idaa_slct.archive_id) {
|
||||
create_archive_obj_promise = api.create_ae_obj_crud({
|
||||
prom_api__archive_obj = archives_func.create_ae_obj__archive({
|
||||
api_cfg: $ae_api,
|
||||
obj_type: 'archive',
|
||||
fields: archive_data,
|
||||
key: $ae_api.api_crud_super_key,
|
||||
log_lvl: 1
|
||||
archive_id: $idaa_slct.archive_id,
|
||||
data_kv: archive_do,
|
||||
log_lvl: log_lvl
|
||||
})
|
||||
.then(function (archive_obj_create_result) {
|
||||
.then(async function (archive_obj_create_result) {
|
||||
if (!archive_obj_create_result) {
|
||||
console.log('The result was null or false.');
|
||||
return false;
|
||||
}
|
||||
|
||||
$idaa_slct.archive_id = archive_obj_create_result.obj_id_random;
|
||||
$idaa_slct.archive_obj = archive_obj_create_result;
|
||||
|
||||
dispatch(
|
||||
'created__archive_obj',
|
||||
{
|
||||
archive_id: $idaa_slct.archive_id,
|
||||
}
|
||||
);
|
||||
|
||||
return archive_obj_create_result;
|
||||
return update_archive_obj_promise
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('Something went wrong.');
|
||||
console.log(error);
|
||||
return false;
|
||||
})
|
||||
.finally(() => {
|
||||
disable_submit_btn = false;
|
||||
});
|
||||
|
||||
return create_archive_obj_promise;
|
||||
|
||||
} else {
|
||||
update_archive_obj_promise = api.update_ae_obj_id_crud({
|
||||
prom_api__archive_obj = archives_func.update_ae_obj__archive({
|
||||
api_cfg: $ae_api,
|
||||
obj_type: 'archive',
|
||||
obj_id: $idaa_slct.archive_id,
|
||||
fields: archive_data,
|
||||
key: $ae_api.api_crud_super_key,
|
||||
log_lvl: 1
|
||||
archive_id: $idaa_slct.archive_id,
|
||||
data_kv: archive_do,
|
||||
log_lvl: log_lvl
|
||||
})
|
||||
.then(function (archive_obj_update_result) {
|
||||
if (!archive_obj_update_result) {
|
||||
@@ -197,22 +194,23 @@ async function handle_submit_form(event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
dispatch(
|
||||
'updated__archive_obj',
|
||||
{
|
||||
archive_id: $idaa_slct.archive_id,
|
||||
}
|
||||
);
|
||||
|
||||
return archive_obj_update_result;
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('Something went wrong.');
|
||||
console.log(error);
|
||||
return false;
|
||||
})
|
||||
.finally(() => {
|
||||
// We need to do all of this since the DB object has changed and the SLCT object does automatically update (yet...??? Svelte 5?).
|
||||
// $idaa_slct.archive_obj = await $lq__archive_obj;
|
||||
|
||||
// $idaa_slct.archive_id = null;
|
||||
// $idaa_slct.archive_obj = {};
|
||||
$idaa_sess.archives.show__modal_edit__archive_id = false;
|
||||
});
|
||||
|
||||
return update_archive_obj_promise;
|
||||
return prom_api__archive_obj;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -383,60 +381,117 @@ async function handle_submit_form(event) {
|
||||
{$idaa_loc.archives.show__admin_options ? 'Hide' : 'Show'} Admin
|
||||
</button>
|
||||
|
||||
<!-- BEGIN: section post__admin_options -->
|
||||
<section
|
||||
class="ae_section archive__admin_options border border-gray-200 rounded p-2 space-y-2"
|
||||
class="ae_section archive__admin_options border border-gray-200 rounded p-2 space-y-2 bg-red-100"
|
||||
class:hidden={!$idaa_loc.archives.show__admin_options}
|
||||
> <!-- BEGIN: section archive__admin_options -->
|
||||
<!-- <div
|
||||
class="border border-gray-200 rounded p-2"
|
||||
class:hidden={!$idaa_loc.archives.show__admin_options}
|
||||
> -->
|
||||
>
|
||||
|
||||
<h3 class="h3">
|
||||
Admin Options
|
||||
</h3>
|
||||
|
||||
<label>Hide
|
||||
<input
|
||||
type="checkbox"
|
||||
name="hide"
|
||||
id="hide"
|
||||
bind:checked={$idaa_slct.archive_obj.hide}
|
||||
class="checkbox"
|
||||
<span
|
||||
class="flex flex-col md:flex-row flex-wrap gap-2 items-center justify-center md:justify-stretch w-full"
|
||||
>
|
||||
<span
|
||||
class="flex flex-row flex-wrap gap-2 items-center justify-evenly grow"
|
||||
>
|
||||
<!-- <input type="checkbox" name="hide" value={$idaa_slct.archive_obj.hide} /> -->
|
||||
</label>
|
||||
<fieldset class="flex flex-row gap-1 items-center justify-center">
|
||||
<legend class="legend text-sm font-semibold">Hide</legend>
|
||||
<div>
|
||||
<input
|
||||
type="radio"
|
||||
id="hide_yes"
|
||||
name="hide"
|
||||
value={true}
|
||||
bind:group={$idaa_slct.archive_obj.hide}
|
||||
class="radio"
|
||||
>
|
||||
<label for="hide_yes">Yes</label>
|
||||
</div>
|
||||
<div>
|
||||
<input
|
||||
type="radio"
|
||||
id="hide_no"
|
||||
name="hide"
|
||||
value={false}
|
||||
bind:group={$idaa_slct.archive_obj.hide}
|
||||
class="radio"
|
||||
>
|
||||
<label for="hide_no">No</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<label>Priority
|
||||
<input
|
||||
type="checkbox"
|
||||
name="priority"
|
||||
id="priority"
|
||||
bind:checked={$idaa_slct.archive_obj.priority}
|
||||
class="checkbox"
|
||||
>
|
||||
<!-- <input type="checkbox" name="priority" value={$idaa_slct.archive_obj.priority} /> -->
|
||||
</label>
|
||||
<fieldset class="flex flex-row gap-2">
|
||||
<legend class="legend text-sm font-semibold">Priority</legend>
|
||||
<div>
|
||||
<input
|
||||
type="radio"
|
||||
id="priority_yes"
|
||||
name="priority"
|
||||
value={true}
|
||||
bind:group={$idaa_slct.archive_obj.priority}
|
||||
class="radio"
|
||||
>
|
||||
<label for="priority_yes">Yes</label>
|
||||
</div>
|
||||
<div>
|
||||
<input
|
||||
type="radio"
|
||||
id="priority_no"
|
||||
name="priority"
|
||||
value={false}
|
||||
bind:group={$idaa_slct.archive_obj.priority}
|
||||
class="radio"
|
||||
>
|
||||
<label for="priority_no">No</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
</span>
|
||||
|
||||
<label>Sort <input type="number" name="sort" value={$idaa_slct.archive_obj.sort} class="input w-24" /></label>
|
||||
<span class="flex flex-row flex-wrap gap-1 items-center justify-evenly grow">
|
||||
<label class="legend text-sm font-semibold">Sort <input type="number" name="sort" value={$idaa_slct.archive_obj.sort} class="input w-24" /></label>
|
||||
|
||||
<label>Group <input type="text" name="group" value={$idaa_slct.archive_obj.group} max="100" class="input w-48" /></label>
|
||||
<label class="legend text-sm font-semibold">Group <input type="text" name="group" value={$idaa_slct.archive_obj.group ?? ''} max="100" class="input w-40" /></label>
|
||||
</span>
|
||||
|
||||
{#if $ae_loc.administrator_access}
|
||||
<label>Enable
|
||||
<input
|
||||
type="checkbox"
|
||||
name="enable"
|
||||
id="enable"
|
||||
bind:checked={$idaa_slct.archive_obj.enable}
|
||||
class="checkbox"
|
||||
>
|
||||
<!-- <input type="checkbox" name="enable" value={$idaa_slct.archive_obj.enable} checked={$idaa_slct.archive_obj.enable} /> -->
|
||||
</label>
|
||||
{/if}
|
||||
{#if $ae_loc.administrator_access}
|
||||
<span class="flex flex-row flex-wrap gap-1 items-center justify-evenly grow">
|
||||
<fieldset class="flex flex-row gap-2">
|
||||
<legend class="legend text-sm font-semibold">Enable</legend>
|
||||
<div>
|
||||
<input
|
||||
type="radio"
|
||||
id="enable_yes"
|
||||
name="enable"
|
||||
value={true}
|
||||
bind:group={$idaa_slct.archive_obj.enable}
|
||||
class="radio"
|
||||
>
|
||||
<label for="enable_yes">Yes</label>
|
||||
</div>
|
||||
<div>
|
||||
<input
|
||||
type="radio"
|
||||
id="enable_no"
|
||||
name="enable"
|
||||
value={false}
|
||||
bind:group={$idaa_slct.archive_obj.enable}
|
||||
class="radio"
|
||||
>
|
||||
<label for="enable_no">No</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
</span>
|
||||
{/if}
|
||||
</span>
|
||||
|
||||
<label for="notes">
|
||||
Internal Staff Notes
|
||||
{#if $ae_loc.trusted_access}
|
||||
<label
|
||||
for="notes"
|
||||
>
|
||||
<span class="legend text-sm font-semibold">Internal Staff Notes</span>
|
||||
<Tiptap_editor
|
||||
default_minimal={true}
|
||||
bind:html_text={$idaa_slct.archive_obj.notes}
|
||||
@@ -444,16 +499,30 @@ async function handle_submit_form(event) {
|
||||
bind:new_html={$idaa_slct.archive_obj.notes_new_html}
|
||||
/>
|
||||
</label>
|
||||
{/if}
|
||||
|
||||
<div class="text-sm text-gray-600 dark:text-gray-400">
|
||||
{$lq__archive_obj?.updated_on ? `DB Updated on: ${$lq__archive_obj?.updated_on}` : ''}
|
||||
{$idaa_slct.archive_obj?.updated_on ? `SLCT Updated on: ${$idaa_slct.archive_obj?.updated_on}` : ''}
|
||||
</div>
|
||||
|
||||
</section> <!-- END: section archive__admin_options -->
|
||||
{/if}
|
||||
|
||||
|
||||
<section class="ae_section ae_options flex flex-row gap-1 items-center justify-center">
|
||||
<button type="submit" class="btn btn-md variant-ghost-primary hover:variant-filled-primary transition"><span class="fas fa-check m-1"></span> Save Archive</button>
|
||||
<button
|
||||
type="submit"
|
||||
class="btn btn-md variant-ghost-primary hover:variant-filled-primary transition"
|
||||
>
|
||||
<span class="fas fa-check m-1"></span>
|
||||
Save Archive
|
||||
</button>
|
||||
|
||||
{#if $idaa_slct.archive_id}
|
||||
<button
|
||||
disabled={$ae_loc.administrator_access}
|
||||
type="button"
|
||||
on:click={() => {
|
||||
if (!confirm('Are you sure you want to delete this archive?')) {return false;}
|
||||
handle_delete_archive_obj({archive_id: $idaa_slct.archive_id});
|
||||
@@ -461,7 +530,8 @@ async function handle_submit_form(event) {
|
||||
$idaa_slct.archive_id = null;
|
||||
$idaa_slct.archive_obj = {};
|
||||
}}
|
||||
class="btn btn-sm variant-soft-warning" type="button">
|
||||
class="btn btn-sm variant-soft-warning"
|
||||
>
|
||||
<span class="fas fa-minus m-1"></span> Delete
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
@@ -76,6 +76,9 @@ onMount(() => {
|
||||
<button
|
||||
disabled={!$ae_loc.trusted_access}
|
||||
on:click={() => {
|
||||
if (!confirm('Create new archive content?')) {
|
||||
return false;
|
||||
}
|
||||
$idaa_slct.archive_content_id = null;
|
||||
$idaa_slct.archive_content_obj = {};
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import { posts_func } from '$lib/ae_posts/ae_posts_functions';
|
||||
|
||||
import Comp__post_obj_li from './ae_idaa_comp__post_obj_li.svelte';
|
||||
import Comp__post_obj_id_view from './ae_idaa_comp__post_obj_id_view.svelte';
|
||||
import Comp__post_options from './ae_idaa_comp__post_options.svelte';
|
||||
|
||||
|
||||
$: lq__post_obj_li = liveQuery(async () => {
|
||||
@@ -39,7 +40,7 @@ $: lq__post_obj_li = liveQuery(async () => {
|
||||
|
||||
$: lq__post_obj = liveQuery(async () => {
|
||||
let results = await db_posts.post
|
||||
.get($idaa_slct.post_id);
|
||||
.get($idaa_slct.post_id ?? ''); // null or undefined does not reset things like '' does
|
||||
|
||||
return results;
|
||||
});
|
||||
@@ -47,7 +48,7 @@ $: lq__post_obj = liveQuery(async () => {
|
||||
$: lq__post_comment_obj_li = liveQuery(async () => {
|
||||
let results = await db_posts.comment
|
||||
.where('post_id')
|
||||
.equals($idaa_slct.post_id)
|
||||
.equals($idaa_slct.post_id ?? '') // null or undefined does not reset things like '' does
|
||||
.reverse()
|
||||
.sortBy('updated_on');
|
||||
// .sortBy('title');
|
||||
@@ -57,7 +58,7 @@ $: lq__post_comment_obj_li = liveQuery(async () => {
|
||||
|
||||
$: lq__post_comment_obj = liveQuery(async () => {
|
||||
let results = await db_posts.comment
|
||||
.get($idaa_slct.post_comment_id);
|
||||
.get($idaa_slct.post_comment_id ?? ''); // null or undefined does not reset things like '' does
|
||||
|
||||
return results;
|
||||
});
|
||||
@@ -77,6 +78,10 @@ $: lq__post_comment_obj = liveQuery(async () => {
|
||||
"
|
||||
>
|
||||
|
||||
|
||||
<Comp__post_options
|
||||
/>
|
||||
|
||||
<!-- <h1>Bulletin Board {$lq__post_obj_li?.length}</h1> -->
|
||||
|
||||
{#if $lq__post_obj_li && $lq__post_obj_li?.length }
|
||||
@@ -93,8 +98,8 @@ $: lq__post_comment_obj = liveQuery(async () => {
|
||||
|
||||
<!-- Modal: Post (Bulletin Board) view ID -->
|
||||
<Modal
|
||||
title="{$lq__post_obj?.title} - {$lq__post_obj?.id}"
|
||||
bind:open={$idaa_sess.bb.show__modal_view}
|
||||
title="{$lq__post_obj?.title ?? 'New Post'} - {$lq__post_obj?.id ?? 'Not Saved Yet'}"
|
||||
bind:open={$idaa_sess.bb.show__modal_view__post_id}
|
||||
autoclose={false}
|
||||
outsideclose={true}
|
||||
placement="top-center"
|
||||
@@ -130,7 +135,7 @@ $: lq__post_comment_obj = liveQuery(async () => {
|
||||
{/if}
|
||||
</button>
|
||||
{/if}
|
||||
{$lq__post_obj?.title}
|
||||
{$lq__post_obj?.title ?? 'New Post'}
|
||||
</h3>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
|
||||
@@ -198,14 +198,12 @@ async function handle_delete_post_obj({post_id, method}: key_val) {
|
||||
|
||||
<!-- <h3 class="h3">Post</h3> -->
|
||||
|
||||
[{$idaa_slct.post_id}]
|
||||
|
||||
<input type="hidden" value={$idaa_slct.post_id} />
|
||||
|
||||
<section class="ae_section post__general_information border border-gray-200 rounded p-2 space-y-2"> <!-- BEGIN: section post__general_information -->
|
||||
|
||||
<label for="title">Title of BB Post:
|
||||
<input type="text" id="title" name="title" required max="200" value={$idaa_slct.post_obj?.title} placeholder="Title of Post" autocomplete="off" class="input w-96" />
|
||||
<input type="text" id="title" name="title" required max="200" value={$idaa_slct.post_obj?.title ?? ''} placeholder="Title of Post" autocomplete="off" class="input w-96" />
|
||||
</label>
|
||||
|
||||
<label for="content" class="ae_label post__content">Content (post body):
|
||||
@@ -227,7 +225,7 @@ async function handle_delete_post_obj({post_id, method}: key_val) {
|
||||
<select
|
||||
name="topic_id"
|
||||
class="select w-96"
|
||||
value={$idaa_slct.post_obj?.topic_id}
|
||||
value={$idaa_slct.post_obj?.topic_id ?? ''}
|
||||
>
|
||||
<option value="">-- None --</option>
|
||||
<option value={16}>Licensing/ monitoring/ credentialing issues</option>
|
||||
|
||||
@@ -90,9 +90,9 @@ onDestroy(() => {
|
||||
<div class="post__header">
|
||||
<h2 class="post__title flex flex-row gap-2 items-center">
|
||||
<span class="h3">
|
||||
{@html $lq__post_obj?.title}
|
||||
{@html $idaa_slct.post_obj?.title ?? 'New Post'} - {$idaa_slct.post_obj?.id ?? 'Not Yet Saved'}
|
||||
</span>
|
||||
{#if $lq__post_obj?.topic_id}<span class="badge badge-info variant-glass-secondary"><span class="fas fa-user-md m-1"></span> {$lq__post_obj?.topic_name}</span>{/if}
|
||||
{#if $idaa_slct.post_obj?.topic_id}<span class="badge badge-info variant-glass-secondary"><span class="fas fa-user-md m-1"></span> {$idaa_slct.post_obj?.topic_name}</span>{/if}
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -53,8 +53,8 @@ onMount(() => {
|
||||
// $idaa_sess.bb.show_main__options = true;
|
||||
// $idaa_sess.bb.show_list__post_obj_li = true;
|
||||
// $idaa_sess.bb.show_edit__post_id = false;
|
||||
$idaa_sess.bb.show__modal_view = true;
|
||||
$idaa_sess.bb.show__modal_edit = false;
|
||||
$idaa_sess.bb.show__modal_view__post_id = idaa_post_obj?.post_id;
|
||||
$idaa_sess.bb.show__modal_edit__post_id = false;
|
||||
}}
|
||||
class="btn btn-md variant-ghost-primary hover:variant-filled-primary transition"
|
||||
title={`View: ${idaa_post_obj?.title}`}
|
||||
@@ -78,7 +78,7 @@ onMount(() => {
|
||||
// $idaa_sess.bb.show_main__options = true;
|
||||
// $idaa_sess.bb.show_list__post_obj_li = true;
|
||||
// $idaa_sess.bb.show_edit__post_id = true;
|
||||
$idaa_sess.bb.show__modal_view = true;
|
||||
$idaa_sess.bb.show__modal_view__post_id = idaa_post_obj.post_id;
|
||||
$idaa_sess.bb.show__inline_edit__post_obj = true;
|
||||
}}
|
||||
class="btn btn-sm variant-ghost-warning hover:variant-filled-warning transition"
|
||||
|
||||
145
src/routes/idaa/(idaa)/bb/ae_idaa_comp__post_options.svelte
Normal file
145
src/routes/idaa/(idaa)/bb/ae_idaa_comp__post_options.svelte
Normal file
@@ -0,0 +1,145 @@
|
||||
<script lang="ts">
|
||||
|
||||
// *** Import Aether core variables and functions
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
||||
import { idaa_loc, idaa_sess, idaa_slct } from '$lib/ae_idaa_stores';
|
||||
|
||||
let ae_promises: key_val = {};
|
||||
let ae_tmp: key_val = {};
|
||||
let ae_trigger: any = null;
|
||||
let ae_triggers: key_val = {};
|
||||
|
||||
let search_submit_results: any = null;
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<section class="ae_section ae_options filters_and_search flex flex-col gap-1 variant-ghost-success my-2 p-2 border rounded-md items-center justify-center">
|
||||
|
||||
<div class="ae_group ae_row flex flex-row flex-wrap gap-1 w-full items-center justify-center">
|
||||
|
||||
<!-- Max events select options -->
|
||||
<span
|
||||
class="flex flex-row gap-1 items-center justify-around"
|
||||
>
|
||||
<label
|
||||
class="text-sm w-32 text-right"
|
||||
for="qry_limit__events">
|
||||
Max events:
|
||||
</label>
|
||||
<select
|
||||
id="qry_limit__events"
|
||||
bind:value={$idaa_loc.bb.qry__limit}
|
||||
on:change={() => {
|
||||
// search__event_presenter({
|
||||
// api_cfg: $ae_api,
|
||||
// post_id: $events_slct.post_id,
|
||||
// agree: true,
|
||||
// biography: null,
|
||||
// ft_search_str: '',
|
||||
// lk_search_str: '',
|
||||
// params: {
|
||||
// 'qry__enabled': 'enabled',
|
||||
// 'qry__hidden': 'not_hidden',
|
||||
// 'qry__limit': $idaa_loc.bb.qry__limit__events,},
|
||||
// try_cache: false,
|
||||
// log_lvl: log_lvl,
|
||||
// });
|
||||
}}
|
||||
class="select w-20 text-sm"
|
||||
>
|
||||
<option value={25}>25</option>
|
||||
<option value={50}>50</option>
|
||||
<option value={75}>75</option>
|
||||
<option value={100}>100</option>
|
||||
<option value={200}>200</option>
|
||||
<option value={500}>500</option>
|
||||
</select>
|
||||
</span>
|
||||
|
||||
{#if $ae_loc.trusted_access && !$idaa_loc.bb.qry__hidden || $idaa_loc.bb.qry__hidden == 'not_hidden'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$idaa_loc.bb.qry__hidden = 'all';
|
||||
$idaa_loc.bb.qry__limit = 200;
|
||||
ae_trigger = 'load__post_obj_li';
|
||||
}}
|
||||
class="btn_show_bb_post ae_btn btn btn-info btn-sm variant-ghost-secondary"
|
||||
>
|
||||
<span class="fas fa-eye m-1"></span> Show Hidden Posts
|
||||
</button>
|
||||
{:else if $ae_loc.trusted_access && $idaa_loc.bb.qry__hidden != 'not_hidden'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$idaa_loc.bb.qry__hidden = 'not_hidden';
|
||||
$idaa_loc.bb.qry__limit = 100;
|
||||
ae_trigger = 'load__post_obj_li';
|
||||
}}
|
||||
class="btn_hide_bb_post ae_btn btn btn-info btn-sm variant-ghost-secondary"
|
||||
>
|
||||
<span class="fas fa-eye-slash m-1"></span> Hide Hidden Posts
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
{#if $ae_loc.administrator_access && !$idaa_loc.bb.qry__enabled || $idaa_loc.bb.qry__enabled == 'enabled'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$idaa_loc.bb.qry__hidden = 'all';
|
||||
$idaa_loc.bb.qry__enabled = 'all';
|
||||
$idaa_loc.bb.qry__limit = 500;
|
||||
ae_trigger = 'load__post_obj_li';
|
||||
}}
|
||||
class="btn_show_bb_post ae_btn btn btn-warning btn-sm variant-ghost-secondary"
|
||||
>
|
||||
<span class="fas fa-eye m-1"></span> Show Disabled Posts
|
||||
</button>
|
||||
{:else if $ae_loc.administrator_access && $idaa_loc.bb.qry__enabled != 'enabled'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$idaa_loc.bb.qry__enabled = 'enabled';
|
||||
ae_trigger = 'load__post_obj_li';
|
||||
}}
|
||||
class="btn_hide_bb_post ae_btn btn btn-warning btn-sm variant-ghost-secondary"
|
||||
>
|
||||
<span class="fas fa-eye-slash m-1"></span> Hide Disabled Posts
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
{#if ($ae_loc.trusted_access && $ae_loc.edit_mode) || $idaa_loc.novi_uuid}
|
||||
<button
|
||||
disabled={!$ae_loc.trusted_access}
|
||||
on:click={() => {
|
||||
if (!confirm('Create new meeting?')) {
|
||||
return false;
|
||||
}
|
||||
// $idaa_slct.post_id = '';
|
||||
// $idaa_slct.post_id = undefined;
|
||||
$idaa_slct.post_id = null;
|
||||
$idaa_slct.post_obj = {};
|
||||
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.delete('post_id');
|
||||
// history.pushState({}, '', url);
|
||||
|
||||
// $idaa_loc.bb.show_main__options = false;
|
||||
// $idaa_loc.bb.show_list__post_obj_li = false;
|
||||
// $idaa_loc.bb.show_view__post_obj = false;
|
||||
// $idaa_loc.bb.show_edit__post_obj = true;
|
||||
|
||||
$idaa_sess.bb.show__modal_view__post_id = true;
|
||||
$idaa_sess.bb.show__inline_edit__post_obj = true;
|
||||
}}
|
||||
class="btn_new_recovery_meeting btn btn-sm variant-ghost-warning hover:variant-filled-warning transition text-xs"
|
||||
|
||||
>
|
||||
<span class="fas fa-plus m-1"></span> Create New Meeting
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</section> <!-- END: div filters_and_search -->
|
||||
@@ -1,7 +1,6 @@
|
||||
<script lang="ts">
|
||||
// *** Import Svelte core
|
||||
import { onMount } from 'svelte';
|
||||
// import { Spinner } from 'flowbite-svelte';
|
||||
|
||||
// *** Import Aether core variables and functions
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
|
||||
Reference in New Issue
Block a user