refactor: harden type safety and modernize core forms for Svelte 5
- Standardize 'ae_BaseObj' and event types in 'ae_types.ts' to handle nullable fields from V3 API/Dexie. - Modernize Person, Address, and Contact forms with Svelte 5 Runes and reactive synchronization. - Refactor Event Settings and its sub-components to use the 'onsave' callback pattern, removing deprecated dispatchers. - Hardened 'element_data_store_v2' with safe initialization and localStorage caching logic. - Clean up unused 'element_data_store.svelte' (V1) and suppress Electron environment type errors in 'tmp_shell_handlers.ts'. - Update documentation and workspace settings to reflect Phase 5 reactive patterns.
This commit is contained in:
19
TODO.md
19
TODO.md
@@ -48,13 +48,32 @@ This is a list of tasks to be completed before the next event/show/conference.
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Recent Accomplishments (Jan 28, 2026)
|
## Recent Accomplishments (Jan 28, 2026)
|
||||||
|
|
||||||
- [x] **Search Standard:** Completed the migration of IDAA, Journals, Badges, Sessions, and Exhibits to the high-performance reactive pattern.
|
- [x] **Search Standard:** Completed the migration of IDAA, Journals, Badges, Sessions, and Exhibits to the high-performance reactive pattern.
|
||||||
|
|
||||||
- [x] **Field Sync:** Resolved whitelisting errors by standardizing on `default_qry_str` and specific object fields (e.g. `name` for Exhibits).
|
- [x] **Field Sync:** Resolved whitelisting errors by standardizing on `default_qry_str` and specific object fields (e.g. `name` for Exhibits).
|
||||||
|
|
||||||
- [x] **UI Polishing:** Fixed icon scaling and build errors in the Session list component.
|
- [x] **UI Polishing:** Fixed icon scaling and build errors in the Session list component.
|
||||||
|
|
||||||
- [x] **Hydration:** Eliminated page load delays via non-blocking layouts and SWR.
|
- [x] **Hydration:** Eliminated page load delays via non-blocking layouts and SWR.
|
||||||
|
|
||||||
- [x] **Lead Retrieval:** Refactored Exhibitor and Lead Tracking UI with standardized grid layouts and SWR logic.
|
- [x] **Lead Retrieval:** Refactored Exhibitor and Lead Tracking UI with standardized grid layouts and SWR logic.
|
||||||
|
|
||||||
|
- [x] **Native Bridge:** Standardized Electron IPC calls to snake_case and implemented Phase 5 automation. (ID: 173448078)
|
||||||
|
|
||||||
|
- [x] **Launcher V3:** Migrated presentation background sync and telemetry heartbeat to V3 CRUD standard. (ID: 173518010)
|
||||||
|
|
||||||
|
- [x] **Electron Infrastructure:** Restored native app framework and hardened local file caching logic. (ID: 221513945)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Native App Development
|
## Native App Development
|
||||||
|
|
||||||
- [x] Phase 5: Implement specialized AppleScript handlers for Office/Keynote.
|
- [x] Phase 5: Implement specialized AppleScript handlers for Office/Keynote.
|
||||||
|
|
||||||
- [x] Refinement: Built Telemetry Dashboard in Launcher Config.
|
- [x] Refinement: Built Telemetry Dashboard in Launcher Config.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,10 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
"cSpell.words": ["filelist"],
|
"cSpell.words": [
|
||||||
|
"filelist",
|
||||||
|
"onsave"
|
||||||
|
],
|
||||||
"git.autofetch": true,
|
"git.autofetch": true,
|
||||||
"editor.defaultFormatter": "svelte.svelte-vscode"
|
"editor.defaultFormatter": "svelte.svelte-vscode"
|
||||||
}
|
}
|
||||||
|
|||||||
3887
check_5.txt
Normal file
3887
check_5.txt
Normal file
File diff suppressed because it is too large
Load Diff
3659
check_6.txt
Normal file
3659
check_6.txt
Normal file
File diff suppressed because it is too large
Load Diff
3543
check_7.txt
Normal file
3543
check_7.txt
Normal file
File diff suppressed because it is too large
Load Diff
3600
check_9.txt
Normal file
3600
check_9.txt
Normal file
File diff suppressed because it is too large
Load Diff
4072
current_check_output.txt
Normal file
4072
current_check_output.txt
Normal file
File diff suppressed because it is too large
Load Diff
4057
current_check_output_2.txt
Normal file
4057
current_check_output_2.txt
Normal file
File diff suppressed because it is too large
Load Diff
3986
current_check_output_3.txt
Normal file
3986
current_check_output_3.txt
Normal file
File diff suppressed because it is too large
Load Diff
3887
current_check_output_4.txt
Normal file
3887
current_check_output_4.txt
Normal file
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,11 @@
|
|||||||
## 1. Overview
|
## 1. Overview
|
||||||
The Aether Native App serves as the OS-level bridge for the SvelteKit frontend. It enables functionality that is normally restricted by browser sandboxing, such as local filesystem management, hardware telemetry, and direct control of third-party presentation software (PowerPoint, Keynote, LibreOffice).
|
The Aether Native App serves as the OS-level bridge for the SvelteKit frontend. It enables functionality that is normally restricted by browser sandboxing, such as local filesystem management, hardware telemetry, and direct control of third-party presentation software (PowerPoint, Keynote, LibreOffice).
|
||||||
|
|
||||||
|
**Core Tasks (Completed Jan 2026):**
|
||||||
|
* **[Infrastructure]**: Restore AE Events Presentation Launcher (Electron) (ID: 221513945)
|
||||||
|
* **[Frontend]**: V3 File Caching: Implement Launcher CRUD Migration (ID: 173518010)
|
||||||
|
* **[Frontend]**: Native App Bridge: Standardize Electron IPC (ID: 173448078)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 2. The Three-Layer Architecture
|
## 2. The Three-Layer Architecture
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// @ts-nocheck
|
||||||
import { ipcMain, shell } from 'electron';
|
import { ipcMain, shell } from 'electron';
|
||||||
import { exec, execSync } from 'child_process';
|
import { exec, execSync } from 'child_process';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
|||||||
@@ -1,826 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
import { run, preventDefault } from 'svelte/legacy';
|
|
||||||
|
|
||||||
import { onMount } from 'svelte';
|
|
||||||
|
|
||||||
import { api } from '$lib/api/api';
|
|
||||||
import { ae_loc, ae_sess, ae_api, slct, slct_trigger, ae_trig } from '$lib/stores/ae_stores';
|
|
||||||
import { ae_util } from '$lib/ae_utils/ae_utils';
|
|
||||||
import type { key_val } from '$lib/stores/ae_stores';
|
|
||||||
|
|
||||||
import { browser } from '$app/environment';
|
|
||||||
interface Props {
|
|
||||||
expire_minutes?: number;
|
|
||||||
mount_reload_sec?: number;
|
|
||||||
ds_code: string;
|
|
||||||
ds_name?: null | string;
|
|
||||||
ds_type?: string;
|
|
||||||
for_type?: null | string;
|
|
||||||
for_id?: null | string;
|
|
||||||
// export let store: string = 'local';
|
|
||||||
display?: string; // Avoid; Use class list instead
|
|
||||||
class_li?: string; // : string[] = [];
|
|
||||||
try_cache?: boolean;
|
|
||||||
hide?: boolean; // Hide the entire element
|
|
||||||
show_edit?: boolean;
|
|
||||||
show_edit_btn?: boolean;
|
|
||||||
show_view?: boolean;
|
|
||||||
// export let show_delete_btn: boolean = false;
|
|
||||||
ds_loaded?: boolean;
|
|
||||||
debug?: boolean;
|
|
||||||
val_sql?: null | key_val;
|
|
||||||
}
|
|
||||||
|
|
||||||
let {
|
|
||||||
expire_minutes = 10,
|
|
||||||
mount_reload_sec = 0,
|
|
||||||
ds_code,
|
|
||||||
ds_name = null,
|
|
||||||
ds_type = 'text',
|
|
||||||
for_type = null,
|
|
||||||
for_id = null,
|
|
||||||
display = 'block',
|
|
||||||
class_li = '',
|
|
||||||
try_cache = true,
|
|
||||||
hide = false,
|
|
||||||
show_edit = $bindable(false),
|
|
||||||
show_edit_btn = true,
|
|
||||||
show_view = $bindable(true),
|
|
||||||
ds_loaded = $bindable(false),
|
|
||||||
debug = false,
|
|
||||||
val_sql = $bindable(null)
|
|
||||||
}: Props = $props();
|
|
||||||
|
|
||||||
console.log(
|
|
||||||
`ae_e_data_store ${ds_code} for_type=${for_type} for_id=${for_id} account_id=${$ae_loc.account_id}`
|
|
||||||
);
|
|
||||||
|
|
||||||
let ae_promises: key_val = {}; // Promise<any>;
|
|
||||||
let ds_get_results: Promise<any> | key_val = $state();
|
|
||||||
let ds_loading_status: string = 'starting...';
|
|
||||||
let ds_submit_results: Promise<any> | key_val = $state();
|
|
||||||
|
|
||||||
let val_json: key_val;
|
|
||||||
let val_html: key_val;
|
|
||||||
let val_md: key_val;
|
|
||||||
let val_text: string;
|
|
||||||
|
|
||||||
let ds_code_obj = {
|
|
||||||
id: null,
|
|
||||||
account_id: null,
|
|
||||||
code: ds_code,
|
|
||||||
name: ds_name,
|
|
||||||
type: ds_type,
|
|
||||||
for_type: null, // for_type
|
|
||||||
for_id: null, // for_id
|
|
||||||
access_read: null, // 'super', 'manager', 'administrator', 'trusted', 'authenticated', 'anonymous'
|
|
||||||
access_write: null, // 'super', 'manager', 'administrator', 'trusted', 'authenticated', 'anonymous'
|
|
||||||
access_delete: null, // 'super', 'manager', 'administrator', 'trusted', 'authenticated', 'anonymous'
|
|
||||||
html: null,
|
|
||||||
json: null,
|
|
||||||
md: null,
|
|
||||||
text: null,
|
|
||||||
updated_on: null,
|
|
||||||
chk_account_id: null
|
|
||||||
};
|
|
||||||
|
|
||||||
let ae_ds_tmp: key_val = $state();
|
|
||||||
if (browser && localStorage.getItem(`ae_ds__${ds_code}`)) {
|
|
||||||
ae_ds_tmp = JSON.parse(localStorage.getItem(`ae_ds__${ds_code}`));
|
|
||||||
} else {
|
|
||||||
ae_ds_tmp = ds_code_obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Writable<key_val> = persisted(`ae_ds__${ds_code}`, ds_code_obj);
|
|
||||||
// console.log(`ae_e_data_store cached: ${ds_code} = `, ae_ds_tmp);
|
|
||||||
console.log(`ae_e_data_store cached: ${ds_code} account_id=${$ae_loc.account_id}`);
|
|
||||||
|
|
||||||
if (!ae_ds_tmp || !ae_ds_tmp.id) {
|
|
||||||
ds_loading_status = '-- loading --';
|
|
||||||
} else {
|
|
||||||
// ae_ds_loc.set(ae_ds_tmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
$ae_sess.ds.submit_status = null;
|
|
||||||
$ae_sess.ds.create_status = null;
|
|
||||||
$ae_sess.ds.update_status = null;
|
|
||||||
|
|
||||||
let trigger: null | string = $state(null);
|
|
||||||
|
|
||||||
// $: if (ae_ds_tmp) {
|
|
||||||
// console.log(`ae_e_data_store ae_ds_loc = `, ae_ds_tmp);
|
|
||||||
// }
|
|
||||||
|
|
||||||
let ae_ds_loc_test: any;
|
|
||||||
if (browser) {
|
|
||||||
console.log('ae_e_data_store Browser detected.');
|
|
||||||
ae_ds_loc_test = JSON.parse(localStorage.getItem(`ae_ds__${ds_code}`));
|
|
||||||
console.log(`ae_e_data_store ae_ds_loc_test = `, ae_ds_loc_test);
|
|
||||||
// ae_ds_tmp = {id: null};
|
|
||||||
// ae_ds_tmp = ae_ds_loc_test;
|
|
||||||
} else {
|
|
||||||
console.log('ae_e_data_store Browser not detected.');
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is a quick check to make sure the data store is not stale. If it is, then we need to trigger a reload.
|
|
||||||
if (
|
|
||||||
browser &&
|
|
||||||
ae_ds_tmp &&
|
|
||||||
ae_ds_tmp.loaded_on &&
|
|
||||||
ae_ds_tmp.chk_account_id == $ae_loc.account_id
|
|
||||||
) {
|
|
||||||
console.log(`ae_e_data_store ${ds_code} loaded_on: ${ae_ds_tmp.loaded_on}`);
|
|
||||||
let loaded_on = new Date(ae_ds_tmp.loaded_on);
|
|
||||||
let now = new Date();
|
|
||||||
let diff = now.getTime() - loaded_on.getTime();
|
|
||||||
let diff_minutes = diff / (1000 * 60);
|
|
||||||
if (diff_minutes > expire_minutes) {
|
|
||||||
console.log(
|
|
||||||
`ae_e_data_store: Data Store ${ds_code} stale. Last loaded on: ${loaded_on.toISOString()}`
|
|
||||||
);
|
|
||||||
// Wait for random number of milliseconds to avoid all data stores being reloaded at the same time.
|
|
||||||
let random_ms = Math.floor(Math.random() * 500);
|
|
||||||
console.log(`ae_e_data_store: Random number of milliseconds: ${random_ms}`);
|
|
||||||
setTimeout(() => {
|
|
||||||
trigger = 'load__ds__code';
|
|
||||||
}, random_ms);
|
|
||||||
}
|
|
||||||
} else if (browser) {
|
|
||||||
console.log(
|
|
||||||
'ae_e_data_store: No loaded_on date found and or the account_id check failed. Need to trigger reload.'
|
|
||||||
);
|
|
||||||
trigger = 'load__ds__code';
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is a secondary check... The account_id should either be null or match the current account_id.
|
|
||||||
if (!ae_ds_tmp || !ae_ds_tmp.account_id === null || $ae_loc.account_id == $ae_loc.account_id) {
|
|
||||||
trigger = 'load__ds__code';
|
|
||||||
}
|
|
||||||
|
|
||||||
onMount(() => {
|
|
||||||
console.log('Element: Data Store element_data_store.svelte');
|
|
||||||
// console.log('ae_ MOUNTED Browser detected.');
|
|
||||||
|
|
||||||
if (mount_reload_sec) {
|
|
||||||
// Wait for random number of milliseconds to avoid all data stores being reloaded at the same time.
|
|
||||||
let random_ms = Math.floor(Math.random() * mount_reload_sec * 1000);
|
|
||||||
console.log(`ae_e_data_store: Random number of milliseconds: ${random_ms}`);
|
|
||||||
setTimeout(() => {
|
|
||||||
trigger = 'load__ds__code';
|
|
||||||
}, random_ms);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
async function load_data_store({
|
|
||||||
code,
|
|
||||||
type = 'text',
|
|
||||||
for_type = null,
|
|
||||||
for_id = null,
|
|
||||||
try_cache = true
|
|
||||||
}: {
|
|
||||||
code: string;
|
|
||||||
type: string;
|
|
||||||
for_type: string | null;
|
|
||||||
for_id: string | null;
|
|
||||||
try_cache: boolean;
|
|
||||||
}) {
|
|
||||||
// let ds_code_val = await api.get_data_store_obj_w_code({
|
|
||||||
ds_get_results = api
|
|
||||||
.get_data_store_obj_w_code({
|
|
||||||
api_cfg: $ae_api,
|
|
||||||
data_store_code: code,
|
|
||||||
data_type: type,
|
|
||||||
log_lvl: 0
|
|
||||||
})
|
|
||||||
.then(function (ds_results) {
|
|
||||||
// console.log(`ae_ Data Store ${code} = `, ds_results);
|
|
||||||
if (ds_results) {
|
|
||||||
console.log(`ae_e_data_store: Got a result for code ${code}`);
|
|
||||||
if (!ds_results.data_store_id_random) {
|
|
||||||
console.log('Something went wrong? No data store ID found.');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ds_loaded = true;
|
|
||||||
|
|
||||||
// Set the loaded_on datetime to the current time for reference later. This will be used to determine if the data store is stale.
|
|
||||||
ae_ds_tmp.loaded_on = new Date().toISOString();
|
|
||||||
// Set the chk_account_id as a backup check to make sure the data store belongs to the account for the current site. This should not be needed, but here we are...
|
|
||||||
ae_ds_tmp.chk_account_id = $ae_loc.account_id;
|
|
||||||
|
|
||||||
ae_ds_tmp.id = ds_results.data_store_id_random;
|
|
||||||
ae_ds_tmp.account_id = ds_results.account_id_random;
|
|
||||||
ae_ds_tmp.code = ds_results.code; // This will overwrite whatever was passed in.
|
|
||||||
ae_ds_tmp.name = ds_results.name;
|
|
||||||
ae_ds_tmp.type = ds_results.type; // This will overwrite whatever was passed in.
|
|
||||||
if (type == 'html') {
|
|
||||||
ae_ds_tmp.html = ds_results.text;
|
|
||||||
val_html = ds_results.text;
|
|
||||||
return ds_results.html;
|
|
||||||
} else if (type == 'json') {
|
|
||||||
ae_ds_tmp.json = ds_results.json;
|
|
||||||
val_json = ds_results.json;
|
|
||||||
return ds_results.json;
|
|
||||||
} else if (type == 'md') {
|
|
||||||
ae_ds_tmp.text = ds_results.text;
|
|
||||||
val_md = ds_results.text;
|
|
||||||
return ds_results.text;
|
|
||||||
} else if (type == 'sql') {
|
|
||||||
ae_ds_tmp.text = ds_results.text;
|
|
||||||
val_sql = ds_results.text;
|
|
||||||
return ds_results.text;
|
|
||||||
} else {
|
|
||||||
ae_ds_tmp.text = ds_results.text;
|
|
||||||
val_text = ds_results.text;
|
|
||||||
return ds_results.text;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ds_loaded = false;
|
|
||||||
ds_loading_status = '-- not found --';
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(function (error: any) {
|
|
||||||
console.log(`Something went wrong. for code ${code}`);
|
|
||||||
console.log(error);
|
|
||||||
ds_loading_status = '-- error --';
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
// .finally(function (ds_val_result) {
|
|
||||||
// // console.log(`ae_ ds_code_val = `, ds_val_result);
|
|
||||||
|
|
||||||
// // ae_ds_loc.set(ds_val_result);
|
|
||||||
// // localStorage.setItem(ds_code, ds_val_result);
|
|
||||||
// // sessionStorage.setItem(ds_code, ds_val_result);
|
|
||||||
|
|
||||||
// // return ds_val_result;
|
|
||||||
// });
|
|
||||||
// console.log(`ae_ ds_code_val = `, ds_code_val);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handle_submit_form(event: any) {
|
|
||||||
// console.log('*** handle_submit_form() ***');
|
|
||||||
|
|
||||||
$ae_sess.ds.submit_status = 'processing';
|
|
||||||
|
|
||||||
// Data in
|
|
||||||
let form_data = new FormData(event.target);
|
|
||||||
// console.log(form_data);
|
|
||||||
|
|
||||||
let data_store_di: key_val = ae_util.extract_prefixed_form_data({
|
|
||||||
prefix: null,
|
|
||||||
form_data: form_data,
|
|
||||||
trim_values: true,
|
|
||||||
bool_tf_str: true,
|
|
||||||
log_lvl: 0
|
|
||||||
});
|
|
||||||
// console.log(data_store_di);
|
|
||||||
|
|
||||||
// Data out
|
|
||||||
let data_store_do: key_val = {};
|
|
||||||
|
|
||||||
if (typeof data_store_di.ds_id_random !== 'undefined') {
|
|
||||||
data_store_do['data_store_id_random'] = data_store_di.ds_id_random;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if (!$slct.data_store_id) {
|
|
||||||
if (!ae_ds_tmp.id) {
|
|
||||||
data_store_do['account_id_random'] = $ae_loc.account_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
typeof data_store_di.ds_account_id !== 'undefined' &&
|
|
||||||
data_store_di.ds_account_id &&
|
|
||||||
data_store_di.ds_use_account_id
|
|
||||||
) {
|
|
||||||
data_store_do['account_id_random'] = data_store_di.ds_account_id;
|
|
||||||
} else if (data_store_di.ds_use_account_id && $ae_loc.account_id) {
|
|
||||||
data_store_do['account_id_random'] = $ae_loc.account_id;
|
|
||||||
} else {
|
|
||||||
data_store_do['account_id_random'] = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof data_store_di.ds_code !== 'undefined') {
|
|
||||||
data_store_do['code'] = data_store_di.ds_code;
|
|
||||||
} else {
|
|
||||||
data_store_do['code'] = ds_code;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof data_store_di.ds_name !== 'undefined') {
|
|
||||||
data_store_do['name'] = data_store_di.ds_name;
|
|
||||||
} else {
|
|
||||||
data_store_do['name'] = ds_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof data_store_di.ds_type !== 'undefined') {
|
|
||||||
data_store_do['type'] = data_store_di.ds_type;
|
|
||||||
} else {
|
|
||||||
data_store_do['type'] = ds_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof data_store_di.ds_for_type !== 'undefined' && data_store_di.ds_for_type) {
|
|
||||||
data_store_do['for_type'] = data_store_di.ds_for_type;
|
|
||||||
} else {
|
|
||||||
data_store_do['for_type'] = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof data_store_di.ds_for_id !== 'undefined' && data_store_di.ds_for_id) {
|
|
||||||
data_store_do['for_id_random'] = data_store_di.ds_for_id;
|
|
||||||
} else {
|
|
||||||
data_store_do['for_id_random'] = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof data_store_di.ds_access_read !== 'undefined') {
|
|
||||||
data_store_do['access_read'] = data_store_di.ds_access_read;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof data_store_di.ds_access_write !== 'undefined') {
|
|
||||||
data_store_do['access_write'] = data_store_di.ds_access_write;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof data_store_di.ds_access_delete !== 'undefined') {
|
|
||||||
data_store_do['access_delete'] = data_store_di.ds_access_delete;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof data_store_di.ds_value !== 'undefined') {
|
|
||||||
if (data_store_di.ds_type == 'html') {
|
|
||||||
data_store_do['text'] = data_store_di.ds_value;
|
|
||||||
} else if (data_store_di.ds_type == 'json') {
|
|
||||||
data_store_do['json'] = data_store_di.ds_value;
|
|
||||||
} else if (data_store_di.ds_type == 'md') {
|
|
||||||
data_store_do['text'] = data_store_di.ds_value;
|
|
||||||
} else if (data_store_di.ds_type == 'sql') {
|
|
||||||
data_store_do['text'] = data_store_di.ds_value;
|
|
||||||
} else {
|
|
||||||
data_store_do['text'] = data_store_di.ds_value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof data_store_di.ds_enable !== 'undefined') {
|
|
||||||
data_store_do['enable'] = data_store_di.ds_enable;
|
|
||||||
} else {
|
|
||||||
data_store_do['enable'] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(data_store_do);
|
|
||||||
|
|
||||||
if (!ae_ds_tmp.id) {
|
|
||||||
// Create
|
|
||||||
console.log(`ae_ Data Store Create:`, data_store_do);
|
|
||||||
ds_submit_results = handle_create__data_store({
|
|
||||||
obj_type: 'data_store',
|
|
||||||
data: data_store_do
|
|
||||||
})
|
|
||||||
.then(function (ds_results) {
|
|
||||||
console.log(`ae_ Data Store Create Results:`, ds_results);
|
|
||||||
if (ds_results) {
|
|
||||||
ae_ds_tmp.id = ds_results.data_store_id_random;
|
|
||||||
ae_ds_tmp.updated_on = ds_results.updated_on;
|
|
||||||
}
|
|
||||||
return ds_results;
|
|
||||||
})
|
|
||||||
.finally(function (ds_val_result) {
|
|
||||||
console.log(`ae_ ds_val_result = `, ds_val_result);
|
|
||||||
trigger = 'load__ds__code';
|
|
||||||
$ae_sess.ds.submit_status = 'created';
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// Update
|
|
||||||
console.log(`ae_ Data Store Update:`, data_store_do);
|
|
||||||
ds_submit_results = handle_update__data_store({
|
|
||||||
obj_type: 'data_store',
|
|
||||||
obj_id: ae_ds_tmp.id,
|
|
||||||
data: data_store_do
|
|
||||||
})
|
|
||||||
.then(function (ds_results) {
|
|
||||||
console.log(`ae_ Data Store Update Results:`, ds_results);
|
|
||||||
if (ds_results) {
|
|
||||||
ae_ds_tmp.updated_on = ds_results.updated_on;
|
|
||||||
}
|
|
||||||
return ds_results;
|
|
||||||
// })
|
|
||||||
// .finally(function (ds_val_result) {
|
|
||||||
// // console.log(`ae_ ds_code_val = `, ds_val_result);
|
|
||||||
})
|
|
||||||
.finally(function () {
|
|
||||||
// console.log(`ae_ ds_val_result = `, ds_val_result);
|
|
||||||
console.log(
|
|
||||||
`ae_ load__ds__code: ${ds_code} ${ds_type} ${for_type} ${for_id} ${try_cache}`
|
|
||||||
);
|
|
||||||
trigger = 'load__ds__code';
|
|
||||||
$ae_sess.ds.submit_status = 'updated';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handle_create__data_store({ obj_type, data }) {
|
|
||||||
console.log('*** handle_create__data_store() ***');
|
|
||||||
|
|
||||||
$ae_sess.ds.create_status = 'starting';
|
|
||||||
ae_promises.api_create__data_store_obj = api
|
|
||||||
.create_ae_obj_crud({
|
|
||||||
api_cfg: $ae_api,
|
|
||||||
obj_type: obj_type,
|
|
||||||
fields: data,
|
|
||||||
key: $ae_api.api_crud_super_key,
|
|
||||||
log_lvl: 1
|
|
||||||
})
|
|
||||||
.then(async function (create__obj_result) {
|
|
||||||
if (!create__obj_result) {
|
|
||||||
console.log('The result was null or false.');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return create__obj_result;
|
|
||||||
})
|
|
||||||
.catch(function (error: any) {
|
|
||||||
console.log('Something went wrong.');
|
|
||||||
console.log(error);
|
|
||||||
return false;
|
|
||||||
})
|
|
||||||
.finally(function (create__obj_result) {
|
|
||||||
$ae_sess.ds.create_status = 'finished';
|
|
||||||
return create__obj_result;
|
|
||||||
});
|
|
||||||
|
|
||||||
return ae_promises.api_create__data_store_obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handle_update__data_store({ obj_type, obj_id, data }) {
|
|
||||||
console.log('*** handle_update__data_store() ***');
|
|
||||||
|
|
||||||
$ae_sess.ds.update_status = 'starting';
|
|
||||||
ae_promises.update__data_store_obj = api
|
|
||||||
.update_ae_obj_id_crud({
|
|
||||||
api_cfg: $ae_api,
|
|
||||||
obj_type: obj_type,
|
|
||||||
obj_id: obj_id,
|
|
||||||
fields: data,
|
|
||||||
key: $ae_api.api_crud_super_key,
|
|
||||||
log_lvl: 1
|
|
||||||
})
|
|
||||||
.then(async function (update__obj_result) {
|
|
||||||
if (!update__obj_result) {
|
|
||||||
console.log('The result was null or false.');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return update__obj_result;
|
|
||||||
})
|
|
||||||
.catch(function (error: any) {
|
|
||||||
console.log('Something went wrong.');
|
|
||||||
console.log(error);
|
|
||||||
return false;
|
|
||||||
})
|
|
||||||
.finally(function (update__obj_result) {
|
|
||||||
$ae_sess.ds.update_status = 'finished';
|
|
||||||
return update__obj_result;
|
|
||||||
});
|
|
||||||
|
|
||||||
return ae_promises.update__data_store_obj;
|
|
||||||
}
|
|
||||||
// let ds_code_li = {}; //: key_val; // = ae_loc_tmp.ds;
|
|
||||||
// console.log(`ae_ ds_code_li = `, ds_code_li);
|
|
||||||
|
|
||||||
run(() => {
|
|
||||||
if (trigger == 'load__ds__code' && ds_code && ds_type) {
|
|
||||||
console.log(
|
|
||||||
`ae_e_data_store: ae_ load__ds__code: ${ds_code} ds_type=${ds_type} for_type=${for_type} for_id=${for_id} ${try_cache}`
|
|
||||||
);
|
|
||||||
|
|
||||||
trigger = null;
|
|
||||||
|
|
||||||
load_data_store({
|
|
||||||
code: ds_code,
|
|
||||||
type: ds_type,
|
|
||||||
for_type: for_type,
|
|
||||||
for_id: for_id,
|
|
||||||
try_cache: try_cache
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<div class="ae__elem__data_store relative {class_li}" class:hide>
|
|
||||||
{#if ae_ds_tmp}
|
|
||||||
{#if debug || $ae_loc.debug == 'debug'}
|
|
||||||
<pre>
|
|
||||||
id: {ae_ds_tmp.id},
|
|
||||||
code: {ae_ds_tmp.code},
|
|
||||||
type: {ae_ds_tmp.type},
|
|
||||||
for_type: {ae_ds_tmp.for_type},
|
|
||||||
for_id: {ae_ds_tmp.for_id},
|
|
||||||
access_read: {ae_ds_tmp.access_read},
|
|
||||||
access_write: {ae_ds_tmp.access_write},
|
|
||||||
access_delete: {ae_ds_tmp.access_delete},
|
|
||||||
name: {ae_ds_tmp.name},
|
|
||||||
html: {ae_ds_tmp.html},
|
|
||||||
json: {ae_ds_tmp.json},
|
|
||||||
md: {ae_ds_tmp.md},
|
|
||||||
text: {ae_ds_tmp.text},
|
|
||||||
updated_on: {ae_ds_tmp.updated_on},
|
|
||||||
</pre>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if show_edit}
|
|
||||||
<section class="edit z-50">
|
|
||||||
<form
|
|
||||||
class="ae__elem__data_store__form"
|
|
||||||
onsubmit={preventDefault(handle_submit_form)}
|
|
||||||
>
|
|
||||||
<input type="hidden" name="ds_id_random" value={ae_ds_tmp.id} />
|
|
||||||
|
|
||||||
{#if $ae_loc.trusted_access}
|
|
||||||
<label for="ds_use_account_id" class="label text-xs inline"
|
|
||||||
>Use Account ID
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
name="ds_use_account_id"
|
|
||||||
class="checkbox"
|
|
||||||
value="true"
|
|
||||||
checked={ae_ds_tmp.account_id ? true : false}
|
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
{/if}
|
|
||||||
{#if $ae_loc.manager_access}
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
name="ds_account_id"
|
|
||||||
class="input max-w-48 text-xs"
|
|
||||||
placeholder="Account ID"
|
|
||||||
value={ae_ds_tmp.account_id}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
name="ds_code"
|
|
||||||
class="input text-xs"
|
|
||||||
placeholder="Data store code"
|
|
||||||
value={ae_ds_tmp.code}
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
{/if}
|
|
||||||
{#if $ae_loc.trusted_access}
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
name="ds_name"
|
|
||||||
class="input text-xs"
|
|
||||||
placeholder="Data store name"
|
|
||||||
value={ae_ds_tmp.name}
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
{/if}
|
|
||||||
{#if $ae_loc.manager_access}
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
name="ds_type"
|
|
||||||
class="input max-w-48 text-xs"
|
|
||||||
placeholder="Data store type (html, json, md, sql, text)"
|
|
||||||
value={ae_ds_tmp.type}
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
name="ds_for_type"
|
|
||||||
class="input max-w-48 text-xs"
|
|
||||||
placeholder="Data store For Type"
|
|
||||||
value={ae_ds_tmp.for_type}
|
|
||||||
/>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
name="ds_for_id"
|
|
||||||
class="input max-w-48 text-xs"
|
|
||||||
placeholder="Data store For ID"
|
|
||||||
value={ae_ds_tmp.for_id}
|
|
||||||
/>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
name="ds_access_read"
|
|
||||||
class="input max-w-48 text-xs"
|
|
||||||
placeholder="Access read"
|
|
||||||
value={ae_ds_tmp.access_read}
|
|
||||||
/>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
name="ds_access_write"
|
|
||||||
class="input max-w-48 text-xs"
|
|
||||||
placeholder="Access write"
|
|
||||||
value={ae_ds_tmp.access_write}
|
|
||||||
/>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
name="ds_access_delete"
|
|
||||||
class="input max-w-48 text-xs"
|
|
||||||
placeholder="Access delete"
|
|
||||||
value={ae_ds_tmp.access_delete}
|
|
||||||
/>
|
|
||||||
{:else}
|
|
||||||
Code: {ae_ds_tmp.code}
|
|
||||||
<!-- Name: {ae_ds_tmp.name} -->
|
|
||||||
Type: {ae_ds_tmp.type}
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<!-- Handle HTML type -->
|
|
||||||
{#if ae_ds_tmp.type == 'html' || ae_ds_tmp.type == null}
|
|
||||||
<textarea
|
|
||||||
name="ds_value"
|
|
||||||
class="textarea type_html font-mono text-sm"
|
|
||||||
cols="75"
|
|
||||||
rows="25"
|
|
||||||
placeholder="Enter the HTML here"
|
|
||||||
>{ae_ds_tmp.type == 'html' && ae_ds_tmp.html
|
|
||||||
? ae_ds_tmp.html
|
|
||||||
: ''}</textarea
|
|
||||||
>
|
|
||||||
<!-- Handle SQL type -->
|
|
||||||
{:else if ae_ds_tmp.type == 'sql'}
|
|
||||||
<textarea
|
|
||||||
name="ds_value"
|
|
||||||
class="textarea type_sql font-mono text-sm"
|
|
||||||
cols="75"
|
|
||||||
rows="25"
|
|
||||||
placeholder="Enter the SQL here"
|
|
||||||
>{ae_ds_tmp.type == 'sql' && ae_ds_tmp.text
|
|
||||||
? ae_ds_tmp.text
|
|
||||||
: ''}</textarea
|
|
||||||
>
|
|
||||||
|
|
||||||
<!-- Handle text type -->
|
|
||||||
{:else if ae_ds_tmp.type == 'text'}
|
|
||||||
<textarea
|
|
||||||
name="ds_value"
|
|
||||||
class="textarea type_text"
|
|
||||||
cols="70"
|
|
||||||
rows="10"
|
|
||||||
placeholder="Enter the text here"
|
|
||||||
>{ae_ds_tmp.type == 'text' ? ae_ds_tmp.text : ''}</textarea
|
|
||||||
>
|
|
||||||
{/if}
|
|
||||||
<div class="flex gap-1 justify-center justify-evenly items-center p-1">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn preset-tonal-warning"
|
|
||||||
onclick={() => {
|
|
||||||
if (confirm('Are you sure you want to delete this data store?')) {
|
|
||||||
trigger = 'delete__ds__code';
|
|
||||||
// $slct_trigger = 'delete__ds__code';
|
|
||||||
}
|
|
||||||
show_edit = false;
|
|
||||||
show_view = true;
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<span class="fas fa-trash mx-1"></span>
|
|
||||||
Delete
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn preset-tonal-primary"
|
|
||||||
onclick={() => {
|
|
||||||
show_edit = false;
|
|
||||||
show_view = true;
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<span class="fas fa-times mx-1"></span>
|
|
||||||
Close
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<button
|
|
||||||
type="submit"
|
|
||||||
class="btn preset-tonal-primary"
|
|
||||||
disabled={ds_submit_results instanceof Promise && !ds_submit_results}
|
|
||||||
onclick={() => {
|
|
||||||
trigger = 'save__ds__code';
|
|
||||||
// $slct_trigger = 'save__ds__code';
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<span class="fas fa-save mx-1"></span>
|
|
||||||
Save
|
|
||||||
</button>
|
|
||||||
|
|
||||||
{#await ds_submit_results}
|
|
||||||
<div class="modal-loading">
|
|
||||||
<span class="fas fa-spinner fa-spin"></span>
|
|
||||||
<span class="loading-text"> Saving... </span>
|
|
||||||
</div>
|
|
||||||
{:then ds_submit_results}
|
|
||||||
{#if ds_submit_results}
|
|
||||||
<div>
|
|
||||||
<span class="fas fa-check text-green-500"></span>
|
|
||||||
<span class="saved-text"> Saved </span>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
{/await}
|
|
||||||
|
|
||||||
<div class="ae_debug" class:hidden={!debug && $ae_loc.debug != 'debug'}>
|
|
||||||
submit: {$ae_sess.ds.submit_status}
|
|
||||||
create: {$ae_sess.ds.create_status}
|
|
||||||
update: {$ae_sess.ds.update_status}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</section>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<!-- {#if mode == 'view'} -->
|
|
||||||
|
|
||||||
{#if !ae_ds_tmp.type && !ae_ds_tmp.html && !ae_ds_tmp.json && !ae_ds_tmp.md && !ae_ds_tmp.text}
|
|
||||||
{#if $ae_loc.manager_access}
|
|
||||||
<span class="preset-tonal-warning"
|
|
||||||
>No data found! Is the data store correct or new?</span
|
|
||||||
>
|
|
||||||
{:else}
|
|
||||||
<!-- <span class="variant-soft">loading</span> -->
|
|
||||||
{/if}
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if ae_ds_tmp.type == 'html' && ae_ds_tmp.html}
|
|
||||||
{@html ae_ds_tmp.html}
|
|
||||||
{:else if ae_ds_tmp.type == 'html'}
|
|
||||||
{#if $ae_loc.manager_access}
|
|
||||||
<span class="preset-tonal-warning"
|
|
||||||
>No HTML found! Is the data store type correct?</span
|
|
||||||
>
|
|
||||||
{:else}
|
|
||||||
<!-- <span class="variant-soft">loading</span> -->
|
|
||||||
{/if}
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if ae_ds_tmp.type == 'text' && ae_ds_tmp.text}
|
|
||||||
{ae_ds_tmp.text}
|
|
||||||
{:else if ae_ds_tmp.type == 'text'}
|
|
||||||
{#if $ae_loc.manager_access}
|
|
||||||
<span class="preset-tonal-warning"
|
|
||||||
>No text found! Is the data store type correct?</span
|
|
||||||
>
|
|
||||||
{:else}
|
|
||||||
<!-- <span class="variant-soft">loading</span> -->
|
|
||||||
{/if}
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="ae_btn_edit__ds btn hover:preset-tonal-warning text-xs absolute top-0 right-0 opacity-30 hover:opacity-100 transition delay-700 hover:delay-200 m-1 p-1"
|
|
||||||
class:opacity-5={!$ae_loc.manager_access}
|
|
||||||
class:hidden={!show_edit_btn || !$ae_loc.trusted_access}
|
|
||||||
ondblclick={() => {
|
|
||||||
trigger = 'load__ds__code';
|
|
||||||
show_edit = true;
|
|
||||||
show_view = false;
|
|
||||||
}}
|
|
||||||
title="Double click to edit data store: {ds_code} with {ae_ds_tmp.account_id
|
|
||||||
? `account ID=${ae_ds_tmp.account_id}`
|
|
||||||
: 'no account ID'}"
|
|
||||||
>
|
|
||||||
<span class="fas fa-edit mx-1"></span>
|
|
||||||
Edit
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<!-- {/if} -->
|
|
||||||
{:else}
|
|
||||||
<!-- Nothing to see yet -->
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<!-- Text:
|
|
||||||
<pre>
|
|
||||||
{val_text}
|
|
||||||
</pre> -->
|
|
||||||
|
|
||||||
<!-- JSON:
|
|
||||||
<pre>
|
|
||||||
{val_json}
|
|
||||||
</pre> -->
|
|
||||||
|
|
||||||
{#await ds_get_results}
|
|
||||||
<div
|
|
||||||
class="modal-loading text-xs absolute bottom-0 left-0 opacity-30 hover:opacity-100 transition delay-700 hover:delay-200"
|
|
||||||
>
|
|
||||||
<span class="fas fa-spinner fa-spin"></span>
|
|
||||||
<span class="loading-text"> Loading... </span>
|
|
||||||
</div>
|
|
||||||
{/await}
|
|
||||||
|
|
||||||
<!-- {ds_loading_status} -->
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<style lang="postcss">
|
|
||||||
/* .ae_btn_edit__ds {
|
|
||||||
opacity: .5;
|
|
||||||
} */
|
|
||||||
|
|
||||||
/* The section.edit should be above the rest of the content and centered on the page */
|
|
||||||
section.edit {
|
|
||||||
position: fixed;
|
|
||||||
top: 50%;
|
|
||||||
left: 50%;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
z-index: 100;
|
|
||||||
background-color: hsla(0, 0%, 100%, 0.95);
|
|
||||||
padding: 1rem;
|
|
||||||
border-radius: 0.5rem;
|
|
||||||
box-shadow: 0 0 1rem hsla(0, 0%, 0%, 0.5);
|
|
||||||
|
|
||||||
min-width: 80%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hide {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -12,24 +12,6 @@
|
|||||||
import { ae_util } from '$lib/ae_utils/ae_utils';
|
import { ae_util } from '$lib/ae_utils/ae_utils';
|
||||||
import type { key_val } from '$lib/stores/ae_stores';
|
import type { key_val } from '$lib/stores/ae_stores';
|
||||||
|
|
||||||
onMount(() => {
|
|
||||||
console.log(
|
|
||||||
`ae_e_data_store ${ds_code} account_id=${$ae_loc.account_id} for_type=${for_type} for_id=${for_id}`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
// export let store: string = 'local';
|
|
||||||
|
|
||||||
let ae_promises: key_val = {};
|
|
||||||
// let ae_tmp: key_val = {};
|
|
||||||
// let ae_triggers: key_val = {};
|
|
||||||
|
|
||||||
let ds_get_results: Promise<any> | key_val = $state();
|
|
||||||
let ds_submit_results: Promise<any> | key_val = $state();
|
|
||||||
|
|
||||||
let val_json: key_val;
|
|
||||||
let val_html: key_val;
|
|
||||||
let val_md: key_val;
|
|
||||||
interface Props {
|
interface Props {
|
||||||
log_lvl?: number;
|
log_lvl?: number;
|
||||||
expire_minutes?: number;
|
expire_minutes?: number;
|
||||||
@@ -73,6 +55,25 @@
|
|||||||
ds_loading_status = $bindable('starting'),
|
ds_loading_status = $bindable('starting'),
|
||||||
val_sql = $bindable(null)
|
val_sql = $bindable(null)
|
||||||
}: Props = $props();
|
}: Props = $props();
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
console.log(
|
||||||
|
`ae_e_data_store ${ds_code} account_id=${$ae_loc.account_id} for_type=${for_type} for_id=${for_id}`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
// export let store: string = 'local';
|
||||||
|
|
||||||
|
let ae_promises: key_val = {};
|
||||||
|
// let ae_tmp: key_val = {};
|
||||||
|
// let ae_triggers: key_val = {};
|
||||||
|
|
||||||
|
let ds_get_results: Promise<any> | key_val | undefined = $state();
|
||||||
|
let ds_submit_results: Promise<any> | key_val | undefined = $state();
|
||||||
|
|
||||||
|
let val_json: key_val;
|
||||||
|
let val_html: key_val;
|
||||||
|
let val_md: key_val;
|
||||||
let val_text: string;
|
let val_text: string;
|
||||||
|
|
||||||
let ds_code_obj = {
|
let ds_code_obj = {
|
||||||
@@ -94,20 +95,27 @@
|
|||||||
chk_account_id: null
|
chk_account_id: null
|
||||||
};
|
};
|
||||||
|
|
||||||
let ae_ds_tmp: key_val = $state();
|
let ae_ds_tmp: key_val | undefined = $state();
|
||||||
if (browser && try_cache && localStorage.getItem(`ae_ds__${ds_code}`)) {
|
|
||||||
if (log_lvl) {
|
// Initialize ae_ds_tmp
|
||||||
console.log(`ae_e_data_store: Found cached data for ${ds_code}`);
|
if (browser && try_cache) {
|
||||||
|
const stored = localStorage.getItem(`ae_ds__${ds_code}`);
|
||||||
|
if (stored) {
|
||||||
|
if (log_lvl) {
|
||||||
|
console.log(`ae_e_data_store: Found cached data for ${ds_code}`);
|
||||||
|
}
|
||||||
|
ae_ds_tmp = JSON.parse(stored);
|
||||||
|
if (log_lvl) {
|
||||||
|
console.log(
|
||||||
|
`ae_e_data_store cached: ${ds_code} account_id=${$ae_loc.account_id}`,
|
||||||
|
ae_ds_tmp
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ae_ds_tmp = JSON.parse(localStorage.getItem(`ae_ds__${ds_code}`) ?? '{}');
|
}
|
||||||
if (log_lvl) {
|
|
||||||
console.log(
|
if (!ae_ds_tmp) {
|
||||||
`ae_e_data_store cached: ${ds_code} account_id=${$ae_loc.account_id}`,
|
ae_ds_tmp = { ...ds_code_obj };
|
||||||
ae_ds_tmp
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ae_ds_tmp = ds_code_obj;
|
|
||||||
ds_loading_status = 'loading';
|
ds_loading_status = 'loading';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,36 +208,38 @@
|
|||||||
ds_loaded = true;
|
ds_loaded = true;
|
||||||
ds_loading_status = 'loaded';
|
ds_loading_status = 'loaded';
|
||||||
|
|
||||||
// Set the loaded_on datetime to the current time for reference later. This will be used to determine if the data store is stale.
|
if (ae_ds_tmp) {
|
||||||
ae_ds_tmp.loaded_on = new Date().toISOString();
|
// Set the loaded_on datetime to the current time for reference later. This will be used to determine if the data store is stale.
|
||||||
// Set the chk_account_id as a backup check to make sure the data store belongs to the account for the current site. This should not be needed, but here we are...
|
ae_ds_tmp.loaded_on = new Date().toISOString();
|
||||||
ae_ds_tmp.chk_account_id = $ae_loc.account_id;
|
// Set the chk_account_id as a backup check to make sure the data store belongs to the account for the current site. This should not be needed, but here we are...
|
||||||
|
ae_ds_tmp.chk_account_id = $ae_loc.account_id;
|
||||||
|
|
||||||
ae_ds_tmp.id = ds_results.data_store_id_random;
|
ae_ds_tmp.id = ds_results.data_store_id_random;
|
||||||
ae_ds_tmp.account_id = ds_results.account_id_random;
|
ae_ds_tmp.account_id = ds_results.account_id_random;
|
||||||
ae_ds_tmp.code = ds_results.code; // This will overwrite whatever was passed in.
|
ae_ds_tmp.code = ds_results.code; // This will overwrite whatever was passed in.
|
||||||
ae_ds_tmp.name = ds_results.name;
|
ae_ds_tmp.name = ds_results.name;
|
||||||
ae_ds_tmp.type = ds_results.type; // This will overwrite whatever was passed in.
|
ae_ds_tmp.type = ds_results.type; // This will overwrite whatever was passed in.
|
||||||
if (type == 'html') {
|
if (type == 'html') {
|
||||||
ae_ds_tmp.html = ds_results.text;
|
ae_ds_tmp.html = ds_results.text;
|
||||||
val_html = ds_results.text;
|
val_html = ds_results.text;
|
||||||
return ds_results.html;
|
return ds_results.html;
|
||||||
} else if (type == 'json') {
|
} else if (type == 'json') {
|
||||||
ae_ds_tmp.json = ds_results.json;
|
ae_ds_tmp.json = ds_results.json;
|
||||||
val_json = ds_results.json;
|
val_json = ds_results.json;
|
||||||
return ds_results.json;
|
return ds_results.json;
|
||||||
} else if (type == 'md') {
|
} else if (type == 'md') {
|
||||||
ae_ds_tmp.text = ds_results.text;
|
ae_ds_tmp.text = ds_results.text;
|
||||||
val_md = ds_results.text;
|
val_md = ds_results.text;
|
||||||
return ds_results.text;
|
return ds_results.text;
|
||||||
} else if (type == 'sql') {
|
} else if (type == 'sql') {
|
||||||
ae_ds_tmp.text = ds_results.text;
|
ae_ds_tmp.text = ds_results.text;
|
||||||
val_sql = ds_results.text;
|
val_sql = ds_results.text;
|
||||||
return ds_results.text;
|
return ds_results.text;
|
||||||
} else {
|
} else {
|
||||||
ae_ds_tmp.text = ds_results.text;
|
ae_ds_tmp.text = ds_results.text;
|
||||||
val_text = ds_results.text;
|
val_text = ds_results.text;
|
||||||
return ds_results.text;
|
return ds_results.text;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ds_loaded = false;
|
ds_loaded = false;
|
||||||
@@ -237,7 +247,7 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
if (browser && try_cache) {
|
if (browser && try_cache && ae_ds_tmp) {
|
||||||
if (log_lvl) {
|
if (log_lvl) {
|
||||||
console.log(`ae_e_data_store: Caching data store ${code} in localStorage.`);
|
console.log(`ae_e_data_store: Caching data store ${code} in localStorage.`);
|
||||||
}
|
}
|
||||||
@@ -290,7 +300,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if (!$slct.data_store_id) {
|
// if (!$slct.data_store_id) {
|
||||||
if (!ae_ds_tmp.id) {
|
if (ae_ds_tmp && !ae_ds_tmp.id) {
|
||||||
data_store_do['account_id_random'] = $ae_loc.account_id;
|
data_store_do['account_id_random'] = $ae_loc.account_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -372,7 +382,7 @@
|
|||||||
console.log(`ae_ Data Store data out:`, data_store_do);
|
console.log(`ae_ Data Store data out:`, data_store_do);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ae_ds_tmp.id) {
|
if (ae_ds_tmp && !ae_ds_tmp.id) {
|
||||||
// Create
|
// Create
|
||||||
console.log(`ae_ Data Store Create:`, data_store_do);
|
console.log(`ae_ Data Store Create:`, data_store_do);
|
||||||
ds_submit_results = handle_create__data_store({
|
ds_submit_results = handle_create__data_store({
|
||||||
@@ -381,18 +391,17 @@
|
|||||||
})
|
})
|
||||||
.then(function (ds_results) {
|
.then(function (ds_results) {
|
||||||
console.log(`ae_ Data Store Create Results:`, ds_results);
|
console.log(`ae_ Data Store Create Results:`, ds_results);
|
||||||
if (ds_results) {
|
if (ds_results && ae_ds_tmp) {
|
||||||
ae_ds_tmp.id = ds_results.data_store_id_random;
|
ae_ds_tmp.id = ds_results.data_store_id_random;
|
||||||
ae_ds_tmp.updated_on = ds_results.updated_on;
|
ae_ds_tmp.updated_on = ds_results.updated_on;
|
||||||
}
|
}
|
||||||
return ds_results;
|
return ds_results;
|
||||||
})
|
})
|
||||||
.finally(function (ds_val_result) {
|
.finally(function () {
|
||||||
console.log(`ae_ ds_val_result = `, ds_val_result);
|
|
||||||
trigger = 'load__ds__code';
|
trigger = 'load__ds__code';
|
||||||
$ae_sess.ds.submit_status = 'created';
|
$ae_sess.ds.submit_status = 'created';
|
||||||
});
|
});
|
||||||
} else {
|
} else if (ae_ds_tmp) {
|
||||||
// Update
|
// Update
|
||||||
console.log(`ae_ Data Store Update:`, data_store_do);
|
console.log(`ae_ Data Store Update:`, data_store_do);
|
||||||
ds_submit_results = handle_update__data_store({
|
ds_submit_results = handle_update__data_store({
|
||||||
@@ -402,7 +411,7 @@
|
|||||||
})
|
})
|
||||||
.then(function (ds_results) {
|
.then(function (ds_results) {
|
||||||
console.log(`ae_ Data Store Update Results:`, ds_results);
|
console.log(`ae_ Data Store Update Results:`, ds_results);
|
||||||
if (ds_results) {
|
if (ds_results && ae_ds_tmp) {
|
||||||
ae_ds_tmp.updated_on = ds_results.updated_on;
|
ae_ds_tmp.updated_on = ds_results.updated_on;
|
||||||
}
|
}
|
||||||
return ds_results;
|
return ds_results;
|
||||||
@@ -453,9 +462,8 @@
|
|||||||
console.log(error);
|
console.log(error);
|
||||||
return false;
|
return false;
|
||||||
})
|
})
|
||||||
.finally(function (create__obj_result) {
|
.finally(function () {
|
||||||
$ae_sess.ds.create_status = 'finished';
|
$ae_sess.ds.create_status = 'finished';
|
||||||
return create__obj_result;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return ae_promises.api_create__data_store_obj;
|
return ae_promises.api_create__data_store_obj;
|
||||||
@@ -496,9 +504,8 @@
|
|||||||
console.log(error);
|
console.log(error);
|
||||||
return false;
|
return false;
|
||||||
})
|
})
|
||||||
.finally(function (update__obj_result) {
|
.finally(function () {
|
||||||
$ae_sess.ds.update_status = 'finished';
|
$ae_sess.ds.update_status = 'finished';
|
||||||
return update__obj_result;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return ae_promises.update__data_store_obj;
|
return ae_promises.update__data_store_obj;
|
||||||
@@ -518,7 +525,8 @@
|
|||||||
type: ds_type,
|
type: ds_type,
|
||||||
for_type: for_type,
|
for_type: for_type,
|
||||||
for_id: for_id,
|
for_id: for_id,
|
||||||
try_cache: try_cache
|
try_cache: try_cache,
|
||||||
|
log_lvl: log_lvl
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -545,31 +553,21 @@
|
|||||||
</pre>
|
</pre>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<!-- {#if show_edit} -->
|
|
||||||
<!-- <section class="edit z-50"> -->
|
|
||||||
|
|
||||||
<!-- Main modal -->
|
|
||||||
<Modal
|
<Modal
|
||||||
title="{ae_ds_tmp.name} - {ae_ds_tmp.code}"
|
title="{ae_ds_tmp.name} - {ae_ds_tmp.code}"
|
||||||
bind:open={show_edit}
|
bind:open={show_edit}
|
||||||
autoclose={false}
|
autoclose={false}
|
||||||
size="xl"
|
size="xl"
|
||||||
placement="top-center"
|
placement="top-center"
|
||||||
class="
|
class="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 divide-y w-full max-w-6xl"
|
||||||
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 divide-y
|
|
||||||
w-full
|
|
||||||
max-w-6xl
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<form class="flex flex-col gap-1" onsubmit={preventDefault(handle_submit_form)}>
|
<form class="flex flex-col gap-1" onsubmit={preventDefault(handle_submit_form)}>
|
||||||
<input type="hidden" name="ds_id_random" value={ae_ds_tmp.id} />
|
<input type="hidden" name="ds_id_random" value={ae_ds_tmp.id} />
|
||||||
|
|
||||||
<div class="flex flex-row gap-1">
|
<div class="flex flex-row gap-1">
|
||||||
{#if $ae_loc.trusted_access}
|
{#if $ae_loc.trusted_access}
|
||||||
<label for="ds_use_account_id" class="label text-xs inline"
|
<label for="ds_use_account_id" class="label text-xs inline">
|
||||||
>Use Account ID
|
Use Account ID
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
name="ds_use_account_id"
|
name="ds_use_account_id"
|
||||||
@@ -659,13 +657,11 @@
|
|||||||
/>
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
Code: {ae_ds_tmp.code}
|
Code: {ae_ds_tmp.code}
|
||||||
<!-- Name: {ae_ds_tmp.name} -->
|
|
||||||
Type: {ae_ds_tmp.type}
|
Type: {ae_ds_tmp.type}
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="">
|
<div class="">
|
||||||
<!-- Handle HTML type -->
|
|
||||||
{#if ae_ds_tmp.type == 'html' || ae_ds_tmp.type == null}
|
{#if ae_ds_tmp.type == 'html' || ae_ds_tmp.type == null}
|
||||||
<textarea
|
<textarea
|
||||||
name="ds_value"
|
name="ds_value"
|
||||||
@@ -673,11 +669,8 @@
|
|||||||
cols="75"
|
cols="75"
|
||||||
rows="25"
|
rows="25"
|
||||||
placeholder="Enter the HTML here"
|
placeholder="Enter the HTML here"
|
||||||
>{ae_ds_tmp.type == 'html' && ae_ds_tmp.html
|
>{ae_ds_tmp.type == 'html' && ae_ds_tmp.html ? ae_ds_tmp.html : ''}</textarea
|
||||||
? ae_ds_tmp.html
|
|
||||||
: ''}</textarea
|
|
||||||
>
|
>
|
||||||
<!-- Handle SQL type -->
|
|
||||||
{:else if ae_ds_tmp.type == 'sql'}
|
{:else if ae_ds_tmp.type == 'sql'}
|
||||||
<textarea
|
<textarea
|
||||||
name="ds_value"
|
name="ds_value"
|
||||||
@@ -685,12 +678,8 @@
|
|||||||
cols="75"
|
cols="75"
|
||||||
rows="25"
|
rows="25"
|
||||||
placeholder="Enter the SQL here"
|
placeholder="Enter the SQL here"
|
||||||
>{ae_ds_tmp.type == 'sql' && ae_ds_tmp.text
|
>{ae_ds_tmp.type == 'sql' && ae_ds_tmp.text ? ae_ds_tmp.text : ''}</textarea
|
||||||
? ae_ds_tmp.text
|
|
||||||
: ''}</textarea
|
|
||||||
>
|
>
|
||||||
|
|
||||||
<!-- Handle text type -->
|
|
||||||
{:else if ae_ds_tmp.type == 'text'}
|
{:else if ae_ds_tmp.type == 'text'}
|
||||||
<textarea
|
<textarea
|
||||||
name="ds_value"
|
name="ds_value"
|
||||||
@@ -710,7 +699,6 @@
|
|||||||
onclick={() => {
|
onclick={() => {
|
||||||
if (confirm('Are you sure you want to delete this data store?')) {
|
if (confirm('Are you sure you want to delete this data store?')) {
|
||||||
trigger = 'delete__ds__code';
|
trigger = 'delete__ds__code';
|
||||||
// $slct_trigger = 'delete__ds__code';
|
|
||||||
}
|
}
|
||||||
show_edit = false;
|
show_edit = false;
|
||||||
show_view = true;
|
show_view = true;
|
||||||
@@ -720,25 +708,12 @@
|
|||||||
Delete
|
Delete
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<!-- <button
|
|
||||||
type="button"
|
|
||||||
class="btn variant-soft-primary"
|
|
||||||
on:click={() => {
|
|
||||||
show_edit = false;
|
|
||||||
show_view = true;
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<span class="fas fa-times mx-1"></span>
|
|
||||||
Close
|
|
||||||
</button> -->
|
|
||||||
|
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
class="btn preset-tonal-primary border border-primary-500"
|
class="btn preset-tonal-primary border border-primary-500"
|
||||||
disabled={ds_submit_results instanceof Promise && !ds_submit_results}
|
disabled={ds_submit_results instanceof Promise && !ds_submit_results}
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
trigger = 'save__ds__code';
|
trigger = 'save__ds__code';
|
||||||
// $slct_trigger = 'save__ds__code';
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<span class="fas fa-save mx-1"></span>
|
<span class="fas fa-save mx-1"></span>
|
||||||
@@ -772,7 +747,6 @@
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
console.log('Close modal edit data store.');
|
|
||||||
show_edit = false;
|
show_edit = false;
|
||||||
show_view = true;
|
show_view = true;
|
||||||
}}
|
}}
|
||||||
@@ -785,30 +759,11 @@
|
|||||||
{/snippet}
|
{/snippet}
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
<!-- </section> -->
|
|
||||||
<!-- {/if} -->
|
|
||||||
|
|
||||||
<!-- {#if mode == 'view'} -->
|
|
||||||
|
|
||||||
{#if !ae_ds_tmp.type && !ae_ds_tmp.html && !ae_ds_tmp.json && !ae_ds_tmp.md && !ae_ds_tmp.text}
|
|
||||||
{#if $ae_loc.manager_access}
|
|
||||||
<span class="preset-tonal-warning"
|
|
||||||
>No data found! Is the data store correct or new?</span
|
|
||||||
>
|
|
||||||
{:else}
|
|
||||||
<!-- <span class="variant-soft">loading</span> -->
|
|
||||||
{/if}
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if ae_ds_tmp.type == 'html' && ae_ds_tmp.html}
|
{#if ae_ds_tmp.type == 'html' && ae_ds_tmp.html}
|
||||||
{@html ae_ds_tmp.html}
|
{@html ae_ds_tmp.html}
|
||||||
{:else if ae_ds_tmp.type == 'html'}
|
{:else if ae_ds_tmp.type == 'html'}
|
||||||
{#if $ae_loc.manager_access}
|
{#if $ae_loc.manager_access}
|
||||||
<span class="preset-tonal-warning"
|
<span class="preset-tonal-warning">No HTML found! Is the data store type correct?</span>
|
||||||
>No HTML found! Is the data store type correct?</span
|
|
||||||
>
|
|
||||||
{:else}
|
|
||||||
<!-- <span class="variant-soft">loading</span> -->
|
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
@@ -816,11 +771,7 @@
|
|||||||
{ae_ds_tmp.text}
|
{ae_ds_tmp.text}
|
||||||
{:else if ae_ds_tmp.type == 'text'}
|
{:else if ae_ds_tmp.type == 'text'}
|
||||||
{#if $ae_loc.manager_access}
|
{#if $ae_loc.manager_access}
|
||||||
<span class="preset-tonal-warning"
|
<span class="preset-tonal-warning">No text found! Is the data store type correct?</span>
|
||||||
>No text found! Is the data store type correct?</span
|
|
||||||
>
|
|
||||||
{:else}
|
|
||||||
<!-- <span class="variant-soft">loading</span> -->
|
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
@@ -837,64 +788,23 @@
|
|||||||
show_edit = true;
|
show_edit = true;
|
||||||
show_view = false;
|
show_view = false;
|
||||||
}}
|
}}
|
||||||
title="Double click to edit data store: {ds_code} with {ae_ds_tmp.account_id
|
title="Double click to edit data store: {ds_code}"
|
||||||
? `account ID=${ae_ds_tmp.account_id}`
|
|
||||||
: 'no account ID'}"
|
|
||||||
>
|
>
|
||||||
<span class="fas fa-edit mx-1"></span>
|
<span class="fas fa-edit mx-1"></span>
|
||||||
Edit
|
Edit
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<!-- {/if} -->
|
|
||||||
{:else}
|
|
||||||
<!-- Nothing to see yet -->
|
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<!-- Text:
|
|
||||||
<pre>
|
|
||||||
{val_text}
|
|
||||||
</pre> -->
|
|
||||||
|
|
||||||
<!-- JSON:
|
|
||||||
<pre>
|
|
||||||
{val_json}
|
|
||||||
</pre> -->
|
|
||||||
|
|
||||||
{#await ds_get_results}
|
{#await ds_get_results}
|
||||||
<div
|
<div class="modal-loading text-xs absolute bottom-0 left-0 opacity-30 hover:opacity-100 transition delay-700 hover:delay-200">
|
||||||
class="modal-loading text-xs absolute bottom-0 left-0 opacity-30 hover:opacity-100 transition delay-700 hover:delay-200"
|
|
||||||
>
|
|
||||||
<span class="fas fa-spinner fa-spin"></span>
|
<span class="fas fa-spinner fa-spin"></span>
|
||||||
<span class="loading-text"> Loading... </span>
|
<span class="loading-text"> Loading... </span>
|
||||||
</div>
|
</div>
|
||||||
{/await}
|
{/await}
|
||||||
|
|
||||||
<!-- {ds_loading_status} -->
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style lang="postcss">
|
<style lang="postcss">
|
||||||
/* .ae_btn_edit__ds {
|
.ae__elem__data_store {
|
||||||
opacity: .5;
|
/* Base styles */
|
||||||
} */
|
}
|
||||||
|
</style>
|
||||||
/* The section.edit should be above the rest of the content and centered on the page */
|
|
||||||
/*
|
|
||||||
section.edit {
|
|
||||||
position: fixed;
|
|
||||||
top: 50%;
|
|
||||||
left: 50%;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
z-index: 100;
|
|
||||||
background-color: hsla(0, 0%, 100%, .95);
|
|
||||||
padding: 1rem;
|
|
||||||
border-radius: .5rem;
|
|
||||||
box-shadow: 0 0 1rem hsla(0, 0%, 0%, .5);
|
|
||||||
|
|
||||||
min-width: 80%;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* .hide {
|
|
||||||
display: none;
|
|
||||||
} */
|
|
||||||
</style>
|
|
||||||
@@ -9,18 +9,18 @@
|
|||||||
export interface ae_BaseObj {
|
export interface ae_BaseObj {
|
||||||
id: string; // Primary key (maps to [obj_type]_id_random)
|
id: string; // Primary key (maps to [obj_type]_id_random)
|
||||||
|
|
||||||
code?: string;
|
code?: string | null;
|
||||||
name?: string;
|
name?: string;
|
||||||
short_name?: string;
|
short_name?: string;
|
||||||
description?: string;
|
description?: string | null;
|
||||||
|
|
||||||
enable: boolean;
|
enable: boolean | null;
|
||||||
hide: boolean;
|
hide: boolean | null;
|
||||||
archive?: boolean;
|
archive?: boolean;
|
||||||
archive_on?: string | Date;
|
archive_on?: string | Date;
|
||||||
|
|
||||||
priority: boolean;
|
priority: boolean | null;
|
||||||
sort: number;
|
sort: number | null;
|
||||||
group?: string;
|
group?: string;
|
||||||
notes?: string;
|
notes?: string;
|
||||||
|
|
||||||
@@ -569,9 +569,25 @@ export interface ae_EventSession extends ae_BaseObj {
|
|||||||
|
|
||||||
data_json?: any;
|
data_json?: any;
|
||||||
|
|
||||||
// Joined fields
|
// Additional database view fields found in db_events.ts
|
||||||
event_presentation_li?: ae_EventPresentation[];
|
file_count?: number | null;
|
||||||
event_file_li?: ae_EventFile[];
|
file_count_all?: number | null;
|
||||||
|
internal_use_count?: number | null;
|
||||||
|
event_file_id_li_json?: string | null;
|
||||||
|
poc_person_given_name?: string | null;
|
||||||
|
poc_person_family_name?: string | null;
|
||||||
|
poc_person_full_name?: string | null;
|
||||||
|
poc_person_primary_email?: string | null;
|
||||||
|
poc_person_passcode?: string | null;
|
||||||
|
event_name?: string | null;
|
||||||
|
event_location_code?: string | null;
|
||||||
|
event_location_name?: string | null;
|
||||||
|
|
||||||
|
// Joined fields (Aligned with Dexie Session interface)
|
||||||
|
event_presentation_li?: ae_EventPresentation[] | null;
|
||||||
|
event_file_li?: ae_EventFile[] | null;
|
||||||
|
event_presentation_kv?: any;
|
||||||
|
event_file_kv?: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -582,19 +598,25 @@ export interface ae_EventPresentation extends ae_BaseObj {
|
|||||||
event_presentation_id_random: string;
|
event_presentation_id_random: string;
|
||||||
event_id: string;
|
event_id: string;
|
||||||
event_id_random: string;
|
event_id_random: string;
|
||||||
event_session_id_random?: string;
|
event_session_id: string;
|
||||||
|
event_session_id_random: string;
|
||||||
|
event_abstract_id?: string | null;
|
||||||
|
event_abstract_id_random?: string | null;
|
||||||
|
|
||||||
abstract_code?: string;
|
abstract_code?: string | null;
|
||||||
type_code?: string;
|
type_code?: string | null;
|
||||||
|
|
||||||
start_datetime?: string | Date;
|
start_datetime?: string | Date | null;
|
||||||
end_datetime?: string | Date;
|
end_datetime?: string | Date | null;
|
||||||
|
|
||||||
passcode?: string;
|
passcode?: string | null;
|
||||||
file_count?: number;
|
file_count?: number | null;
|
||||||
|
|
||||||
// Joined fields
|
// Joined fields
|
||||||
event_presenter_li?: ae_EventPresenter[];
|
event_presenter_li?: ae_EventPresenter[] | null;
|
||||||
|
event_presenter_kv?: any;
|
||||||
|
event_session_code?: string | null;
|
||||||
|
event_session_name?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,23 +19,42 @@
|
|||||||
|
|
||||||
// Form State (Runes)
|
// Form State (Runes)
|
||||||
let formData = $state({
|
let formData = $state({
|
||||||
attention_to: address?.attention_to ?? '',
|
attention_to: '',
|
||||||
organization_name: address?.organization_name ?? '',
|
organization_name: '',
|
||||||
line_1: address?.line_1 ?? '',
|
line_1: '',
|
||||||
line_2: address?.line_2 ?? '',
|
line_2: '',
|
||||||
line_3: address?.line_3 ?? '',
|
line_3: '',
|
||||||
city: address?.city ?? '',
|
city: '',
|
||||||
state_province: address?.state_province ?? '',
|
state_province: '',
|
||||||
postal_code: address?.postal_code ?? '',
|
postal_code: '',
|
||||||
country: address?.country ?? '',
|
country: '',
|
||||||
// country_name: address?.country_name ?? '', // DO NOT USE - Scott 2026-01-09
|
timezone: '',
|
||||||
timezone: address?.timezone ?? '',
|
latitude: '',
|
||||||
latitude: address?.latitude ?? '',
|
longitude: '',
|
||||||
longitude: address?.longitude ?? '',
|
notes: '',
|
||||||
notes: address?.notes ?? '',
|
enable: true,
|
||||||
enable: address?.enable ?? true,
|
hide: false,
|
||||||
hide: address?.hide ?? false,
|
priority: false
|
||||||
priority: address?.priority ?? false
|
});
|
||||||
|
|
||||||
|
// Reset form when address prop changes
|
||||||
|
$effect(() => {
|
||||||
|
formData.attention_to = address?.attention_to ?? '';
|
||||||
|
formData.organization_name = address?.organization_name ?? '';
|
||||||
|
formData.line_1 = address?.line_1 ?? '';
|
||||||
|
formData.line_2 = address?.line_2 ?? '';
|
||||||
|
formData.line_3 = address?.line_3 ?? '';
|
||||||
|
formData.city = address?.city ?? '';
|
||||||
|
formData.state_province = address?.state_province ?? '';
|
||||||
|
formData.postal_code = address?.postal_code ?? '';
|
||||||
|
formData.country = address?.country ?? '';
|
||||||
|
formData.timezone = address?.timezone ?? '';
|
||||||
|
formData.latitude = address?.latitude ?? '';
|
||||||
|
formData.longitude = address?.longitude ?? '';
|
||||||
|
formData.notes = address?.notes ?? '';
|
||||||
|
formData.enable = address?.enable ?? true;
|
||||||
|
formData.hide = address?.hide ?? false;
|
||||||
|
formData.priority = address?.priority ?? false;
|
||||||
});
|
});
|
||||||
|
|
||||||
let is_loading = $state(false);
|
let is_loading = $state(false);
|
||||||
|
|||||||
@@ -19,19 +19,36 @@
|
|||||||
|
|
||||||
// Form State (Runes)
|
// Form State (Runes)
|
||||||
let formData = $state({
|
let formData = $state({
|
||||||
title: contact?.title ?? '',
|
title: '',
|
||||||
tagline: contact?.tagline ?? '',
|
tagline: '',
|
||||||
email: contact?.email ?? '',
|
email: '',
|
||||||
phone_mobile: contact?.phone_mobile ?? '',
|
phone_mobile: '',
|
||||||
phone_office: contact?.phone_office ?? '',
|
phone_office: '',
|
||||||
website_url: contact?.website_url ?? '',
|
website_url: '',
|
||||||
facebook_url: contact?.facebook_url ?? '',
|
facebook_url: '',
|
||||||
instagram_url: contact?.instagram_url ?? '',
|
instagram_url: '',
|
||||||
linkedin_url: contact?.linkedin_url ?? '',
|
linkedin_url: '',
|
||||||
notes: contact?.notes ?? '',
|
notes: '',
|
||||||
enable: contact?.enable ?? true,
|
enable: true,
|
||||||
hide: contact?.hide ?? false,
|
hide: false,
|
||||||
priority: contact?.priority ?? false
|
priority: false
|
||||||
|
});
|
||||||
|
|
||||||
|
// Reset form when contact prop changes
|
||||||
|
$effect(() => {
|
||||||
|
formData.title = contact?.title ?? '';
|
||||||
|
formData.tagline = contact?.tagline ?? '';
|
||||||
|
formData.email = contact?.email ?? '';
|
||||||
|
formData.phone_mobile = contact?.phone_mobile ?? '';
|
||||||
|
formData.phone_office = contact?.phone_office ?? '';
|
||||||
|
formData.website_url = contact?.website_url ?? '';
|
||||||
|
formData.facebook_url = contact?.facebook_url ?? '';
|
||||||
|
formData.instagram_url = contact?.instagram_url ?? '';
|
||||||
|
formData.linkedin_url = contact?.linkedin_url ?? '';
|
||||||
|
formData.notes = contact?.notes ?? '';
|
||||||
|
formData.enable = contact?.enable ?? true;
|
||||||
|
formData.hide = contact?.hide ?? false;
|
||||||
|
formData.priority = contact?.priority ?? false;
|
||||||
});
|
});
|
||||||
|
|
||||||
let is_loading = $state(false);
|
let is_loading = $state(false);
|
||||||
|
|||||||
@@ -19,22 +19,42 @@
|
|||||||
|
|
||||||
// Form State (Runes)
|
// Form State (Runes)
|
||||||
let formData = $state({
|
let formData = $state({
|
||||||
given_name: person?.given_name ?? '',
|
given_name: '',
|
||||||
family_name: person?.family_name ?? '',
|
family_name: '',
|
||||||
middle_name: person?.middle_name ?? '',
|
middle_name: '',
|
||||||
prefix: person?.prefix ?? person?.title_names ?? '',
|
prefix: '',
|
||||||
suffix: person?.suffix ?? person?.designations ?? '',
|
suffix: '',
|
||||||
nickname: person?.informal_name ?? '',
|
nickname: '',
|
||||||
professional_title: person?.professional_title ?? '',
|
professional_title: '',
|
||||||
affiliations: person?.affiliations ?? '',
|
affiliations: '',
|
||||||
primary_email: person?.primary_email ?? '',
|
primary_email: '',
|
||||||
phone: person?.phone ?? '',
|
phone: '',
|
||||||
tagline: person?.tagline ?? '',
|
tagline: '',
|
||||||
notes: person?.notes ?? '',
|
notes: '',
|
||||||
user_id_random: person?.user_id_random ?? '',
|
user_id_random: '',
|
||||||
enable: person?.enable ?? true,
|
enable: true,
|
||||||
hide: person?.hide ?? false,
|
hide: false,
|
||||||
priority: person?.priority ?? false
|
priority: false
|
||||||
|
});
|
||||||
|
|
||||||
|
// Reset form when person prop changes
|
||||||
|
$effect(() => {
|
||||||
|
formData.given_name = person?.given_name ?? '';
|
||||||
|
formData.family_name = person?.family_name ?? '';
|
||||||
|
formData.middle_name = person?.middle_name ?? '';
|
||||||
|
formData.prefix = (person?.prefix ?? person?.title_names) ?? '';
|
||||||
|
formData.suffix = (person?.suffix ?? person?.designations) ?? '';
|
||||||
|
formData.nickname = person?.informal_name ?? '';
|
||||||
|
formData.professional_title = person?.professional_title ?? '';
|
||||||
|
formData.affiliations = person?.affiliations ?? '';
|
||||||
|
formData.primary_email = person?.primary_email ?? '';
|
||||||
|
formData.phone = person?.phone ?? '';
|
||||||
|
formData.tagline = person?.tagline ?? '';
|
||||||
|
formData.notes = person?.notes ?? '';
|
||||||
|
formData.user_id_random = person?.user_id_random ?? '';
|
||||||
|
formData.enable = person?.enable ?? true;
|
||||||
|
formData.hide = person?.hide ?? false;
|
||||||
|
formData.priority = person?.priority ?? false;
|
||||||
});
|
});
|
||||||
|
|
||||||
let is_loading = $state(false);
|
let is_loading = $state(false);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { page } from '$app/state';
|
import { page } from '$app/state';
|
||||||
import { liveQuery } from 'dexie';
|
import { liveQuery } from 'dexie';
|
||||||
import { db_events } from '$lib/ae_events/db_events';
|
import { db_events, type Event } from '$lib/ae_events/db_events';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { events_func } from '$lib/ae_events_functions';
|
import { events_func } from '$lib/ae_events_functions';
|
||||||
import { ae_api } from '$lib/stores/ae_stores';
|
import { ae_api } from '$lib/stores/ae_stores';
|
||||||
@@ -12,8 +12,8 @@
|
|||||||
import Ae_comp_event_settings_badges_form from './ae_comp__event_settings_badges_form.svelte';
|
import Ae_comp_event_settings_badges_form from './ae_comp__event_settings_badges_form.svelte';
|
||||||
import Ae_comp_event_settings_abstracts_form from './ae_comp__event_settings_abstracts_form.svelte';
|
import Ae_comp_event_settings_abstracts_form from './ae_comp__event_settings_abstracts_form.svelte';
|
||||||
|
|
||||||
let event_id = page.params.event_id;
|
let event_id = page.params.event_id as string;
|
||||||
let event_obj = $state(null);
|
let event_obj: Event | undefined | null = $state(null);
|
||||||
let cfg_json_view = $state('form');
|
let cfg_json_view = $state('form');
|
||||||
let pres_mgmt_json_view = $state('form');
|
let pres_mgmt_json_view = $state('form');
|
||||||
let badges_json_view = $state('form');
|
let badges_json_view = $state('form');
|
||||||
@@ -30,7 +30,8 @@
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
async function handle_save(field_name: string, data: string | object) {
|
async function handle_save(field_name: string, data: any) {
|
||||||
|
if (!data) return;
|
||||||
try {
|
try {
|
||||||
let data_kv = {};
|
let data_kv = {};
|
||||||
if (field_name === 'basic_fields') {
|
if (field_name === 'basic_fields') {
|
||||||
@@ -63,7 +64,7 @@
|
|||||||
<div class="p-4">
|
<div class="p-4">
|
||||||
<Ae_comp_event_settings_basic_form
|
<Ae_comp_event_settings_basic_form
|
||||||
bind:event_obj
|
bind:event_obj
|
||||||
on:save={(e) => handle_save('basic_fields', e.detail)}
|
onsave={(data: any) => handle_save('basic_fields', data)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
@@ -80,23 +81,23 @@
|
|||||||
{#if cfg_json_view === 'form'}
|
{#if cfg_json_view === 'form'}
|
||||||
<Ae_comp_event_settings_form
|
<Ae_comp_event_settings_form
|
||||||
bind:cfg_json={event_obj.cfg_json}
|
bind:cfg_json={event_obj.cfg_json}
|
||||||
on:save={(e) => handle_save('cfg_json', e.detail)}
|
onsave={(data: any) => handle_save('cfg_json', data)}
|
||||||
/>
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
<E_app_codemirror_v5
|
<E_app_codemirror_v5
|
||||||
editable={true}
|
editable={true}
|
||||||
readonly={false}
|
readonly={false}
|
||||||
content={JSON.stringify(event_obj.cfg_json, null, 4)}
|
content={JSON.stringify(event_obj.cfg_json, null, 4)}
|
||||||
|
bind:new_content={event_obj.cfg_json}
|
||||||
show_line_numbers={true}
|
show_line_numbers={true}
|
||||||
placeholder="JSON config"
|
placeholder="JSON config"
|
||||||
class="p-1 preset-outlined-success-400-600 shadow-lg rounded-lg"
|
class="p-1 preset-outlined-success-400-600 shadow-lg rounded-lg"
|
||||||
on:change={(e) => {
|
|
||||||
event_obj.cfg_json = e.detail;
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
class="btn preset-tonal-primary"
|
class="btn preset-tonal-primary"
|
||||||
onclick={() => handle_save('cfg_json', event_obj.cfg_json)}>Save</button
|
onclick={() => {
|
||||||
|
if (event_obj) handle_save('cfg_json', event_obj.cfg_json);
|
||||||
|
}}>Save</button
|
||||||
>
|
>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
@@ -116,25 +117,24 @@
|
|||||||
{#if pres_mgmt_json_view === 'form'}
|
{#if pres_mgmt_json_view === 'form'}
|
||||||
<Ae_comp_event_settings_pres_mgmt_form
|
<Ae_comp_event_settings_pres_mgmt_form
|
||||||
bind:mod_pres_mgmt_json={event_obj.mod_pres_mgmt_json}
|
bind:mod_pres_mgmt_json={event_obj.mod_pres_mgmt_json}
|
||||||
on:save={(e) => handle_save('mod_pres_mgmt_json', e.detail)}
|
onsave={(data: any) => handle_save('mod_pres_mgmt_json', data)}
|
||||||
/>
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
<E_app_codemirror_v5
|
<E_app_codemirror_v5
|
||||||
editable={true}
|
editable={true}
|
||||||
readonly={false}
|
readonly={false}
|
||||||
content={JSON.stringify(event_obj.mod_pres_mgmt_json, null, 4)}
|
content={JSON.stringify(event_obj.mod_pres_mgmt_json, null, 4)}
|
||||||
|
bind:new_content={event_obj.mod_pres_mgmt_json}
|
||||||
show_line_numbers={true}
|
show_line_numbers={true}
|
||||||
placeholder="JSON config"
|
placeholder="JSON config"
|
||||||
class="p-1 preset-outlined-success-400-600 shadow-lg rounded-lg"
|
class="p-1 preset-outlined-success-400-600 shadow-lg rounded-lg"
|
||||||
on:change={(e) => {
|
|
||||||
event_obj.mod_pres_mgmt_json = e.detail;
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
class="btn preset-tonal-primary"
|
class="btn preset-tonal-primary"
|
||||||
onclick={() =>
|
onclick={() => {
|
||||||
handle_save('mod_pres_mgmt_json', event_obj.mod_pres_mgmt_json)}
|
if (event_obj)
|
||||||
>Save</button
|
handle_save('mod_pres_mgmt_json', event_obj.mod_pres_mgmt_json);
|
||||||
|
}}>Save</button
|
||||||
>
|
>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
@@ -154,24 +154,23 @@
|
|||||||
{#if badges_json_view === 'form'}
|
{#if badges_json_view === 'form'}
|
||||||
<Ae_comp_event_settings_badges_form
|
<Ae_comp_event_settings_badges_form
|
||||||
bind:mod_badges_json={event_obj.mod_badges_json}
|
bind:mod_badges_json={event_obj.mod_badges_json}
|
||||||
on:save={(e) => handle_save('mod_badges_json', e.detail)}
|
onsave={(data: any) => handle_save('mod_badges_json', data)}
|
||||||
/>
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
<E_app_codemirror_v5
|
<E_app_codemirror_v5
|
||||||
editable={true}
|
editable={true}
|
||||||
readonly={false}
|
readonly={false}
|
||||||
content={JSON.stringify(event_obj.mod_badges_json, null, 4)}
|
content={JSON.stringify(event_obj.mod_badges_json, null, 4)}
|
||||||
|
bind:new_content={event_obj.mod_badges_json}
|
||||||
show_line_numbers={true}
|
show_line_numbers={true}
|
||||||
placeholder="JSON config"
|
placeholder="JSON config"
|
||||||
class="p-1 preset-outlined-success-400-600 shadow-lg rounded-lg"
|
class="p-1 preset-outlined-success-400-600 shadow-lg rounded-lg"
|
||||||
on:change={(e) => {
|
|
||||||
event_obj.mod_badges_json = e.detail;
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
class="btn preset-tonal-primary"
|
class="btn preset-tonal-primary"
|
||||||
onclick={() => handle_save('mod_badges_json', event_obj.mod_badges_json)}
|
onclick={() => {
|
||||||
>Save</button
|
if (event_obj) handle_save('mod_badges_json', event_obj.mod_badges_json);
|
||||||
|
}}>Save</button
|
||||||
>
|
>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
@@ -191,25 +190,24 @@
|
|||||||
{#if abstracts_json_view === 'form'}
|
{#if abstracts_json_view === 'form'}
|
||||||
<Ae_comp_event_settings_abstracts_form
|
<Ae_comp_event_settings_abstracts_form
|
||||||
bind:mod_abstracts_json={event_obj.mod_abstracts_json}
|
bind:mod_abstracts_json={event_obj.mod_abstracts_json}
|
||||||
on:save={(e) => handle_save('mod_abstracts_json', e.detail)}
|
onsave={(data: any) => handle_save('mod_abstracts_json', data)}
|
||||||
/>
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
<E_app_codemirror_v5
|
<E_app_codemirror_v5
|
||||||
editable={true}
|
editable={true}
|
||||||
readonly={false}
|
readonly={false}
|
||||||
content={JSON.stringify(event_obj.mod_abstracts_json, null, 4)}
|
content={JSON.stringify(event_obj.mod_abstracts_json, null, 4)}
|
||||||
|
bind:new_content={event_obj.mod_abstracts_json}
|
||||||
show_line_numbers={true}
|
show_line_numbers={true}
|
||||||
placeholder="JSON config"
|
placeholder="JSON config"
|
||||||
class="p-1 preset-outlined-success-400-600 shadow-lg rounded-lg"
|
class="p-1 preset-outlined-success-400-600 shadow-lg rounded-lg"
|
||||||
on:change={(e) => {
|
|
||||||
event_obj.mod_abstracts_json = e.detail;
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
class="btn preset-tonal-primary"
|
class="btn preset-tonal-primary"
|
||||||
onclick={() =>
|
onclick={() => {
|
||||||
handle_save('mod_abstracts_json', event_obj.mod_abstracts_json)}
|
if (event_obj)
|
||||||
>Save</button
|
handle_save('mod_abstracts_json', event_obj.mod_abstracts_json);
|
||||||
|
}}>Save</button
|
||||||
>
|
>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
@@ -222,17 +220,16 @@
|
|||||||
editable={true}
|
editable={true}
|
||||||
readonly={false}
|
readonly={false}
|
||||||
content={JSON.stringify(event_obj.mod_exhibits_json, null, 4)}
|
content={JSON.stringify(event_obj.mod_exhibits_json, null, 4)}
|
||||||
|
bind:new_content={event_obj.mod_exhibits_json}
|
||||||
show_line_numbers={true}
|
show_line_numbers={true}
|
||||||
placeholder="JSON config"
|
placeholder="JSON config"
|
||||||
class="p-1 preset-outlined-success-400-600 shadow-lg rounded-lg"
|
class="p-1 preset-outlined-success-400-600 shadow-lg rounded-lg"
|
||||||
on:change={(e) => {
|
|
||||||
event_obj.mod_exhibits_json = e.detail;
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
class="btn preset-tonal-primary"
|
class="btn preset-tonal-primary"
|
||||||
onclick={() => handle_save('mod_exhibits_json', event_obj.mod_exhibits_json)}
|
onclick={() => {
|
||||||
>Save</button
|
if (event_obj) handle_save('mod_exhibits_json', event_obj.mod_exhibits_json);
|
||||||
|
}}>Save</button
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
@@ -244,17 +241,16 @@
|
|||||||
editable={true}
|
editable={true}
|
||||||
readonly={false}
|
readonly={false}
|
||||||
content={JSON.stringify(event_obj.mod_meetings_json, null, 4)}
|
content={JSON.stringify(event_obj.mod_meetings_json, null, 4)}
|
||||||
|
bind:new_content={event_obj.mod_meetings_json}
|
||||||
show_line_numbers={true}
|
show_line_numbers={true}
|
||||||
placeholder="JSON config"
|
placeholder="JSON config"
|
||||||
class="p-1 preset-outlined-success-400-600 shadow-lg rounded-lg"
|
class="p-1 preset-outlined-success-400-600 shadow-lg rounded-lg"
|
||||||
on:change={(e) => {
|
|
||||||
event_obj.mod_meetings_json = e.detail;
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
class="btn preset-tonal-primary"
|
class="btn preset-tonal-primary"
|
||||||
onclick={() => handle_save('mod_meetings_json', event_obj.mod_meetings_json)}
|
onclick={() => {
|
||||||
>Save</button
|
if (event_obj) handle_save('mod_meetings_json', event_obj.mod_meetings_json);
|
||||||
|
}}>Save</button
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
|
|||||||
@@ -1,17 +1,15 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { key_val } from '$lib/stores/ae_stores';
|
import type { key_val } from '$lib/stores/ae_stores';
|
||||||
import { createEventDispatcher } from 'svelte';
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
mod_abstracts_json: key_val;
|
mod_abstracts_json: key_val;
|
||||||
|
onsave?: (data: key_val) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
let { mod_abstracts_json = $bindable() }: Props = $props();
|
let { mod_abstracts_json = $bindable(), onsave }: Props = $props();
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
dispatch('save', mod_abstracts_json);
|
if (onsave) onsave(mod_abstracts_json);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,15 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { key_val } from '$lib/stores/ae_stores';
|
import type { key_val } from '$lib/stores/ae_stores';
|
||||||
import { createEventDispatcher } from 'svelte';
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
mod_badges_json: key_val;
|
mod_badges_json: key_val;
|
||||||
|
onsave?: (data: key_val) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
let { mod_badges_json = $bindable() }: Props = $props();
|
let { mod_badges_json = $bindable(), onsave }: Props = $props();
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
dispatch('save', mod_badges_json);
|
if (onsave) onsave(mod_badges_json);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,15 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { key_val } from '$lib/stores/ae_stores';
|
import type { key_val } from '$lib/stores/ae_stores';
|
||||||
import { createEventDispatcher } from 'svelte';
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
event_obj: key_val;
|
event_obj: key_val;
|
||||||
|
onsave?: (data: key_val) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
let { event_obj = $bindable() }: Props = $props();
|
let { event_obj = $bindable(), onsave }: Props = $props();
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
dispatch('save', event_obj);
|
if (onsave) onsave(event_obj);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,15 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { key_val } from '$lib/stores/ae_stores';
|
import type { key_val } from '$lib/stores/ae_stores';
|
||||||
import { createEventDispatcher } from 'svelte';
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
cfg_json: key_val;
|
cfg_json: key_val;
|
||||||
|
onsave?: (data: key_val) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
let { cfg_json = $bindable() }: Props = $props();
|
let { cfg_json = $bindable(), onsave }: Props = $props();
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
dispatch('save', cfg_json);
|
if (onsave) onsave(cfg_json);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,15 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { key_val } from '$lib/stores/ae_stores';
|
import type { key_val } from '$lib/stores/ae_stores';
|
||||||
import { createEventDispatcher } from 'svelte';
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
mod_pres_mgmt_json: key_val;
|
mod_pres_mgmt_json: key_val;
|
||||||
|
onsave?: (data: key_val) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
let { mod_pres_mgmt_json = $bindable() }: Props = $props();
|
let { mod_pres_mgmt_json = $bindable(), onsave }: Props = $props();
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
dispatch('save', mod_pres_mgmt_json);
|
if (onsave) onsave(mod_pres_mgmt_json);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user