Compare commits
6 Commits
master
...
ae_mod_spo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ccbb783378 | ||
|
|
970e7567fc | ||
|
|
7f6f063f00 | ||
|
|
7775b88b35 | ||
|
|
06e0c98e68 | ||
|
|
143265ed9e |
@@ -1,5 +1,5 @@
|
||||
[Dolphin]
|
||||
Timestamp=2021,7,8,11,31,30.712
|
||||
Timestamp=2024,2,6,18,10,21.847
|
||||
Version=4
|
||||
ViewMode=1
|
||||
|
||||
|
||||
27
.gitignore
vendored
27
.gitignore
vendored
@@ -1,4 +1,27 @@
|
||||
/node_modules/
|
||||
/public/build/
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
*.bak
|
||||
*.tar.gz
|
||||
|
||||
107
README.md
107
README.md
@@ -1,105 +1,2 @@
|
||||
*Looking for a shareable component template? Go here --> [sveltejs/component-template](https://github.com/sveltejs/component-template)*
|
||||
|
||||
---
|
||||
|
||||
# svelte app
|
||||
|
||||
This is a project template for [Svelte](https://svelte.dev) apps. It lives at https://github.com/sveltejs/template.
|
||||
|
||||
To create a new project based on this template using [degit](https://github.com/Rich-Harris/degit):
|
||||
|
||||
```bash
|
||||
npx degit sveltejs/template svelte-app
|
||||
cd svelte-app
|
||||
```
|
||||
|
||||
*Note that you will need to have [Node.js](https://nodejs.org) installed.*
|
||||
|
||||
|
||||
## Get started
|
||||
|
||||
Install the dependencies...
|
||||
|
||||
```bash
|
||||
cd svelte-app
|
||||
npm install
|
||||
```
|
||||
|
||||
...then start [Rollup](https://rollupjs.org):
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
Navigate to [localhost:5000](http://localhost:5000). You should see your app running. Edit a component file in `src`, save it, and reload the page to see your changes.
|
||||
|
||||
By default, the server will only respond to requests from localhost. To allow connections from other computers, edit the `sirv` commands in package.json to include the option `--host 0.0.0.0`.
|
||||
|
||||
If you're using [Visual Studio Code](https://code.visualstudio.com/) we recommend installing the official extension [Svelte for VS Code](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode). If you are using other editors you may need to install a plugin in order to get syntax highlighting and intellisense.
|
||||
|
||||
## Building and running in production mode
|
||||
|
||||
To create an optimised version of the app:
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
You can run the newly built app with `npm run start`. This uses [sirv](https://github.com/lukeed/sirv), which is included in your package.json's `dependencies` so that the app will work when you deploy to platforms like [Heroku](https://heroku.com).
|
||||
|
||||
|
||||
## Single-page app mode
|
||||
|
||||
By default, sirv will only respond to requests that match files in `public`. This is to maximise compatibility with static fileservers, allowing you to deploy your app anywhere.
|
||||
|
||||
If you're building a single-page app (SPA) with multiple routes, sirv needs to be able to respond to requests for *any* path. You can make it so by editing the `"start"` command in package.json:
|
||||
|
||||
```js
|
||||
"start": "sirv public --single"
|
||||
```
|
||||
|
||||
## Using TypeScript
|
||||
|
||||
This template comes with a script to set up a TypeScript development environment, you can run it immediately after cloning the template with:
|
||||
|
||||
```bash
|
||||
node scripts/setupTypeScript.js
|
||||
```
|
||||
|
||||
Or remove the script via:
|
||||
|
||||
```bash
|
||||
rm scripts/setupTypeScript.js
|
||||
```
|
||||
|
||||
## Deploying to the web
|
||||
|
||||
### With [Vercel](https://vercel.com)
|
||||
|
||||
Install `vercel` if you haven't already:
|
||||
|
||||
```bash
|
||||
npm install -g vercel
|
||||
```
|
||||
|
||||
Then, from within your project folder:
|
||||
|
||||
```bash
|
||||
cd public
|
||||
vercel deploy --name my-project
|
||||
```
|
||||
|
||||
### With [surge](https://surge.sh/)
|
||||
|
||||
Install `surge` if you haven't already:
|
||||
|
||||
```bash
|
||||
npm install -g surge
|
||||
```
|
||||
|
||||
Then, from within your project folder:
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
surge public my-project.surge.sh
|
||||
```
|
||||
# OSIT AE - Sponsorships App (Svelte)
|
||||
This was created for One Sky IT's Aether system.
|
||||
|
||||
49
index.html
Normal file
49
index.html
Normal file
@@ -0,0 +1,49 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<!-- Load dayjs library: https://cdnjs.com/libraries/dayjs -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/dayjs/1.11.10/dayjs.min.js" integrity="sha512-FwNWaxyfy2XlEINoSnZh1JQ5TRRtGow0D6XcmAWmYCRgvqOUTnzCxPc9uF35u5ZEpirk1uhlPVA19tflhvnW1g==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/dayjs/1.11.10/plugin/utc.min.js" integrity="sha512-z84O912dDT9nKqvpBnl1tri5IN0j/OEgMzLN1GlkpKLMscs5ZHVu+G2CYtA6dkS0YnOGi3cODt3BOPnYc8Agjg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/dayjs/1.11.10/plugin/timezone.min.js" integrity="sha512-jmsGNYDezdyZ+W3bVeZy83kZp/2n5BgWe/0solkveG0vSSrP9XIVTD1tNiM1OqImc4H3OxHfs1uSfVclOU3mWw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<script src="https://static.oneskyit.com/js/tinymce/tinymce.min.js"></script>
|
||||
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" integrity="sha512-1ycn6IcaQQ40/MKBW2W4Rhis/DbILU74C1vSrLJxCq57o941Ym01SwNsOMqvEBFlcgUa6xLiPY/NS5R+E6ztJQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
|
||||
|
||||
<!-- <link rel="stylesheet" href="/src/main.css" /> -->
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Æ AE App (The Hub) - Sponsorships - Vite + Svelte + TS</title>
|
||||
<script>
|
||||
let api_base_url = 'https://dev-api.oneskyit.com';
|
||||
let api_base_url_backup = 'https://bak-api.oneskyit.com';
|
||||
let app_base_url = 'https://dev-demo.oneskyit.com';
|
||||
let app_base_url_backup = 'https://bak-demo.oneskyit.com';
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<section id="Site-Header">Site-Header</section>
|
||||
<section id="Site-Nav-Menu"></section>
|
||||
<!-- <section id="Notifications">Notifications</section> -->
|
||||
|
||||
<div class="svelte_target ae_svelte_app ae_sponsorships_main"></div>
|
||||
|
||||
<section id="Site-Set-Access-Type" class="svelte_target set_access_type"></section>
|
||||
|
||||
<section id="Site-Footer">Site-Footer</section>
|
||||
|
||||
<section id="Site-Modals"><!-- Site-Modals --></section>
|
||||
|
||||
<div class="svelte_target ae_svelte_app_hub"></div>
|
||||
|
||||
<!-- The ae_bridge_init.js and main.ts should be run back to back -->
|
||||
<script src="/ae_bridge_init.js"></script>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
3228
package-lock.json
generated
3228
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
39
package.json
39
package.json
@@ -1,31 +1,26 @@
|
||||
{
|
||||
"name": "svelte-app",
|
||||
"version": "1.0.0",
|
||||
"name": "ae_sponsorships_app_svelte",
|
||||
"private": true,
|
||||
"version": "0.0.1",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "rollup -c",
|
||||
"dev": "rollup -c -w",
|
||||
"start": "sirv public --single --port 5555",
|
||||
"validate": "svelte-check"
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"check": "svelte-check --tsconfig ./tsconfig.json"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-commonjs": "^17.0.0",
|
||||
"@rollup/plugin-node-resolve": "^11.0.0",
|
||||
"@rollup/plugin-typescript": "^8.0.0",
|
||||
"@tsconfig/svelte": "^1.0.0",
|
||||
"rollup": "^2.3.4",
|
||||
"rollup-plugin-css-only": "^3.1.0",
|
||||
"rollup-plugin-livereload": "^2.0.0",
|
||||
"rollup-plugin-svelte": "^7.0.0",
|
||||
"rollup-plugin-terser": "^7.0.0",
|
||||
"svelte": "^3.0.0",
|
||||
"svelte-check": "^1.0.0",
|
||||
"svelte-preprocess": "^4.0.0",
|
||||
"tslib": "^2.0.0",
|
||||
"typescript": "^4.0.0"
|
||||
"@sveltejs/adapter-static": "^3.0.1",
|
||||
"@sveltejs/vite-plugin-svelte": "^3.0.0",
|
||||
"@tsconfig/svelte": "^5.0.0",
|
||||
"svelte": "^4.2.8",
|
||||
"svelte-check": "^3.6.0",
|
||||
"tslib": "^2.6.0",
|
||||
"typescript": "^5.3.0",
|
||||
"vite": "^5.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.21.1",
|
||||
"sirv-cli": "^1.0.0"
|
||||
"aether_npm_lib": "bitbucket:oneskyit/one-sky-it-npm-library",
|
||||
"axios": "^1.6.0"
|
||||
}
|
||||
}
|
||||
|
||||
175
public/ae_bridge_init.js
Normal file
175
public/ae_bridge_init.js
Normal file
@@ -0,0 +1,175 @@
|
||||
|
||||
// These localStorage values were created when generating the HTML
|
||||
|
||||
// let ae_local = window.localStorage.getItem('ae'); // Includes: cfg, client, page, other
|
||||
// let ae_session = window.sessionStorage.getItem('ae'); // Includes: cfg, client, page, other
|
||||
// let ae_com_local = window.localStorage.getItem('ae_com');
|
||||
// let ae_com_session = window.sessionStorage.getItem('ae_com');
|
||||
|
||||
if (window.localStorage.getItem('ae') === null) {
|
||||
window.localStorage.setItem('ae', JSON.stringify({ 'cfg': {}, 'client': {}, 'page': {}, 'other': {}, 'test': {} }));
|
||||
}
|
||||
|
||||
if (window.sessionStorage.getItem('ae') === null) {
|
||||
window.sessionStorage.setItem('ae', JSON.stringify({ 'cfg': {}, 'client': {}, 'page': {}, 'other': {}, 'test': {} }));
|
||||
}
|
||||
// JSON.parse(window.sessionStorage.getItem('ae'))
|
||||
|
||||
// export let ae_bridge = {
|
||||
const ae_bridge = {
|
||||
// example_var: 'Example Default Value',
|
||||
// get example() {
|
||||
// return this.example_var;
|
||||
// },
|
||||
// set example(new_value) {
|
||||
// this.example_var = new_value;
|
||||
// this.example_var_listener(new_value);
|
||||
// this.example_var_core_listener(new_value);
|
||||
// this.example_var_mods_listener(new_value);
|
||||
// },
|
||||
|
||||
// example_var_listener: function (new_value) {},
|
||||
// registerNewListener: function (external_listener_function) {
|
||||
// this.example_var_listener = external_listener_function;
|
||||
// },
|
||||
|
||||
// example_var_core_listener: function (new_value) {},
|
||||
// registerNewCoreListener: function (external_core_listener_function) {
|
||||
// this.example_var_core_listener = external_core_listener_function;
|
||||
// },
|
||||
|
||||
// example_var_mods_listener: function (new_value) {},
|
||||
// registerNewModsListener: function (external_mods_listener_function) {
|
||||
// this.example_var_mods_listener = external_mods_listener_function;
|
||||
// },
|
||||
|
||||
|
||||
// Monitor change in **local** storage AE
|
||||
// Created and set when generating and then rendering the inital HTML and JS
|
||||
// ae_local_var: true,
|
||||
ae_local_var: JSON.parse(window.localStorage.getItem('ae')),
|
||||
get ae_local() {
|
||||
return this.ae_local_var;
|
||||
},
|
||||
set ae_local(new_value) {
|
||||
console.log('ae_local_var: new_value: ', new_value);
|
||||
this.ae_local_var = new_value;
|
||||
this.ae_local_listener(new_value);
|
||||
window.localStorage.setItem('ae', new_value);
|
||||
},
|
||||
|
||||
ae_local_listener: function (new_value) {},
|
||||
register_ae_local_listener: function (external_listener_function) {
|
||||
this.ae_local_listener = external_listener_function;
|
||||
},
|
||||
|
||||
|
||||
// Monitor change in **session* storage AE
|
||||
// Created and set when generating and then rendering the inital HTML and JS
|
||||
// ae_session_var: true,
|
||||
// ae_session_var: JSON.parse((window.sessionStorage.getItem('ae') ? window.sessionStorage.getItem('ae') : {'cfg': true, 'client': true, 'page': true, 'other': true})),
|
||||
// ae_session_var: {'example': 'This is just an example from init.js!'},
|
||||
ae_session_var: JSON.parse(window.sessionStorage.getItem('ae')),
|
||||
get ae_session() {
|
||||
return this.ae_session_var;
|
||||
},
|
||||
set ae_session(new_value) {
|
||||
console.log('ae_session_var: new_value: ', new_value);
|
||||
this.ae_session_var = new_value;
|
||||
this.ae_session_listener(new_value);
|
||||
window.sessionStorage.setItem('ae', new_value);
|
||||
},
|
||||
|
||||
ae_session_listener: function (new_value) {},
|
||||
register_ae_session_listener: function (external_listener_function) {
|
||||
this.ae_session_listener = external_listener_function;
|
||||
},
|
||||
|
||||
|
||||
// Monitor change in Access Type
|
||||
access_type_var: 'anonymous',
|
||||
get access_type() {
|
||||
return this.access_type_var;
|
||||
},
|
||||
set access_type(new_value) {
|
||||
this.access_type_var = new_value;
|
||||
this.access_type_var_core_listener(new_value);
|
||||
this.access_type_var_mods_listener(new_value);
|
||||
},
|
||||
|
||||
access_type_var_core_listener: function (new_value) {},
|
||||
register_core_access_type_listener: function (external_core_listener_function) {
|
||||
this.access_type_var_core_listener = external_core_listener_function;
|
||||
},
|
||||
|
||||
access_type_var_mods_listener: function (new_value) {},
|
||||
register_mods_access_type_listener: function (external_mods_listener_function) {
|
||||
this.access_type_var_mods_listener = external_mods_listener_function;
|
||||
},
|
||||
|
||||
|
||||
// Monitor change in AE Common
|
||||
// ae_com_var: true,
|
||||
ae_com_var: JSON.parse(window.localStorage.getItem('ae_com')),
|
||||
get ae_com() {
|
||||
return this.ae_com_var;
|
||||
},
|
||||
set ae_com(new_value) {
|
||||
this.ae_com_var = new_value;
|
||||
this.ae_com_var_core_listener(new_value);
|
||||
this.ae_com_var_mods_listener(new_value);
|
||||
},
|
||||
|
||||
ae_com_var_core_listener: function (new_value) {},
|
||||
register_core_ae_com_listener: function (external_core_listener_function) {
|
||||
this.ae_com_var_core_listener = external_core_listener_function;
|
||||
},
|
||||
|
||||
ae_com_var_mods_listener: function (new_value) {},
|
||||
register_mods_ae_com_listener: function (external_mods_listener_function) {
|
||||
this.ae_com_var_mods_listener = external_mods_listener_function;
|
||||
},
|
||||
|
||||
|
||||
// Monitor change in Client
|
||||
client_var: true,
|
||||
get client() {
|
||||
return this.client_var;
|
||||
},
|
||||
set client(new_value) {
|
||||
this.client_var = new_value;
|
||||
this.client_var_core_listener(new_value);
|
||||
this.client_var_mods_listener(new_value);
|
||||
},
|
||||
|
||||
client_var_core_listener: function (new_value) {},
|
||||
register_core_client_listener: function (external_core_listener_function) {
|
||||
this.client_var_core_listener = external_core_listener_function;
|
||||
},
|
||||
|
||||
client_var_mods_listener: function (new_value) {},
|
||||
register_mods_client_listener: function (external_mods_listener_function) {
|
||||
this.client_var_mods_listener = external_mods_listener_function;
|
||||
},
|
||||
|
||||
};
|
||||
console.log('ae_bridge_init.js loaded');
|
||||
|
||||
|
||||
// Updated: 2024-02-09
|
||||
/* BEGIN: Add this to the stores.ts */
|
||||
// This adds a listener to the ae_bridge object. This can then be exported and used in the Svelte components.
|
||||
// export let ae_example = writable(ae_bridge.ae_example);
|
||||
// ae_bridge.register_ae_example_listener((new_value) => {
|
||||
// console.log(`AE Bridge: AE Example: ${new_value}`);
|
||||
// console.log(new_value);
|
||||
|
||||
// ae_example.set(new_value);
|
||||
// console.log(ae_example);
|
||||
// });
|
||||
/* END: Add this to the stores.ts */
|
||||
|
||||
|
||||
/* BEGIN: Add this to the Svelte components */
|
||||
// import { ae_example } from './stores';
|
||||
/* END: Add this to the Svelte components */
|
||||
@@ -1,88 +0,0 @@
|
||||
html, body {
|
||||
position: relative;
|
||||
/* width: 100%; */
|
||||
height: 100%;
|
||||
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
/* color: #333;
|
||||
margin: 0;
|
||||
padding: 8px;
|
||||
box-sizing: border-box;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; */
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: hsla(0, 0%, 5%, 1);
|
||||
/*text-transform: uppercase;*/
|
||||
/* font-size: 4rem; */
|
||||
/* font-weight: 100; */
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: hsla(0, 0%, 10%, 1);
|
||||
/*text-transform: uppercase;*/
|
||||
/* font-size: 4rem; */
|
||||
/* font-weight: 100; */
|
||||
}
|
||||
|
||||
|
||||
a {
|
||||
/* color: rgb(0,100,200);
|
||||
text-decoration: none; */
|
||||
}
|
||||
|
||||
a:hover {
|
||||
/* text-decoration: underline; */
|
||||
}
|
||||
|
||||
a:visited {
|
||||
/* color: rgb(0,80,160); */
|
||||
}
|
||||
|
||||
label {
|
||||
/* display: block; */
|
||||
}
|
||||
|
||||
input, button, select, textarea {
|
||||
/* font-family: inherit;
|
||||
font-size: inherit;
|
||||
-webkit-padding: 0.4rem 0;
|
||||
padding: 0.4rem;
|
||||
margin: 0 0 0.5rem 0;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 2px; */
|
||||
}
|
||||
|
||||
input:disabled {
|
||||
color: hsla(0, 0%, 50%, 1);
|
||||
}
|
||||
|
||||
button {
|
||||
/* color: #333;
|
||||
background-color: #f4f4f4;
|
||||
outline: none; */
|
||||
}
|
||||
|
||||
button:disabled {
|
||||
color: hsla(0, 0%, 50%, 1);
|
||||
}
|
||||
|
||||
button:not(:disabled):active {
|
||||
background-color: hsla(0, 0%, 50%, 1);
|
||||
}
|
||||
|
||||
button:focus {
|
||||
/* border-color: #666; */
|
||||
}
|
||||
|
||||
button:hover {
|
||||
/* background-color: green; */
|
||||
}
|
||||
|
||||
#my_body {
|
||||
/* outline: solid thin red; */
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.1 KiB |
@@ -1,35 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<meta name='viewport' content='width=device-width,initial-scale=1'>
|
||||
|
||||
<title>Index - Svelte</title>
|
||||
|
||||
<link rel='icon' type='image/png' href='/favicon.png'>
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.2/css/all.css">
|
||||
<link rel='stylesheet' href='https://static.oneskyit.com/css/global.css'>
|
||||
<link rel='stylesheet' href='/app_global.css'>
|
||||
<link rel='stylesheet' href='/build/bundle.css'>
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/dayjs/1.9.4/dayjs.min.js" integrity="sha512-XZSHSEFj4QeE0G4pwy4tToyAhF2VXoEcF9CP0t1PSZMP2XHhEEB9PjM9knsdzcEKbi6GRMazdt8tJadz0JTKIQ==" crossorigin="anonymous"></script>
|
||||
<script defer src='https://static.oneskyit.com/js/utilities.js'></script>
|
||||
<script defer src='/build/bundle.js'></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header><h1>Index - Dev Svelte App</h1></header>
|
||||
|
||||
<main>
|
||||
<a href="log_client_viewing">log_client_viewing</a>
|
||||
<a href="membership_member_manage">membership_member_manage</a>
|
||||
<a href="user_person">user_person</a>
|
||||
<div id="test_container" class="svelte_container">
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
This is the footer
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,32 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<meta name='viewport' content='width=device-width,initial-scale=1'>
|
||||
|
||||
<title>Log Client Viewing - Dev Svelte App</title>
|
||||
|
||||
<link rel='icon' type='image/png' href='/favicon.png'>
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.2/css/all.css">
|
||||
<link rel='stylesheet' href='https://static.oneskyit.com/css/global.css'>
|
||||
<link rel='stylesheet' href='/app_global.css'>
|
||||
<link rel='stylesheet' href='/build/bundle.css'>
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/dayjs/1.9.4/dayjs.min.js" integrity="sha512-XZSHSEFj4QeE0G4pwy4tToyAhF2VXoEcF9CP0t1PSZMP2XHhEEB9PjM9knsdzcEKbi6GRMazdt8tJadz0JTKIQ==" crossorigin="anonymous"></script>
|
||||
<script defer src='https://static.oneskyit.com/js/utilities.js'></script>
|
||||
<script defer src='/build/bundle.js'></script>
|
||||
<script>
|
||||
let account_id = 'TblpWmPauKw';
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header><h1>Log Client Viewing - Dev Svelte App</h1></header>
|
||||
|
||||
<main>
|
||||
<div id="log_client_viewing_list_container" class="svelte_container">
|
||||
</div>
|
||||
</main>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,33 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<meta name='viewport' content='width=device-width,initial-scale=1'>
|
||||
|
||||
<title>Membership Member Manage - Dev Svelte App</title>
|
||||
|
||||
<link rel='icon' type='image/png' href='/favicon.png'>
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.2/css/all.css">
|
||||
<link rel='stylesheet' href='https://static.oneskyit.com/css/global.css'>
|
||||
<link rel='stylesheet' href='/app_global.css'>
|
||||
<link rel='stylesheet' href='/build/bundle.css'>
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/dayjs/1.9.4/dayjs.min.js" integrity="sha512-XZSHSEFj4QeE0G4pwy4tToyAhF2VXoEcF9CP0t1PSZMP2XHhEEB9PjM9knsdzcEKbi6GRMazdt8tJadz0JTKIQ==" crossorigin="anonymous"></script>
|
||||
<script defer src='https://static.oneskyit.com/js/utilities.js'></script>
|
||||
<script defer src='/build/bundle.js'></script>
|
||||
<script>
|
||||
let account_id = '_PRgRxSkzu-Xg-V4Ft1RGg';
|
||||
let membership_member_id = '6jMd9WwnMbs';
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header><h1>Membership Member Manage - Dev Svelte App</h1></header>
|
||||
|
||||
<main>
|
||||
<div id="membership_member_manage_container" class="svelte_container">
|
||||
</div>
|
||||
</main>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,36 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<meta name='viewport' content='width=device-width,initial-scale=1'>
|
||||
|
||||
<title>User Person - Dev Svelte App</title>
|
||||
|
||||
<link rel='icon' type='image/png' href='/favicon.png'>
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.2/css/all.css">
|
||||
<link rel='stylesheet' href='https://static.oneskyit.com/css/global.css'>
|
||||
<link rel='stylesheet' href='/app_global.css'>
|
||||
<link rel='stylesheet' href='/build/bundle.css'>
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/dayjs/1.9.4/dayjs.min.js" integrity="sha512-XZSHSEFj4QeE0G4pwy4tToyAhF2VXoEcF9CP0t1PSZMP2XHhEEB9PjM9knsdzcEKbi6GRMazdt8tJadz0JTKIQ==" crossorigin="anonymous"></script>
|
||||
<script defer src='https://static.oneskyit.com/js/utilities.js'></script>
|
||||
<script defer src='/build/bundle.js'></script>
|
||||
<script>
|
||||
let account_id = '_PRgRxSkzu-Xg-V4Ft1RGg';
|
||||
let person_id = 'OfcrSXX_evI';
|
||||
let user_id = 'VMvg8X3QnZM';
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header><h1>User Person - Dev Svelte App</h1></header>
|
||||
|
||||
<main>
|
||||
<div id="user_container" class="svelte_container">
|
||||
</div>
|
||||
<div id="person_container" class="svelte_container">
|
||||
</div>
|
||||
</main>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
1
public/vite.svg
Normal file
1
public/vite.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
@@ -1,83 +0,0 @@
|
||||
import svelte from 'rollup-plugin-svelte';
|
||||
import commonjs from '@rollup/plugin-commonjs';
|
||||
import resolve from '@rollup/plugin-node-resolve';
|
||||
import livereload from 'rollup-plugin-livereload';
|
||||
import { terser } from 'rollup-plugin-terser';
|
||||
import sveltePreprocess from 'svelte-preprocess';
|
||||
import typescript from '@rollup/plugin-typescript';
|
||||
import css from 'rollup-plugin-css-only';
|
||||
|
||||
const production = !process.env.ROLLUP_WATCH;
|
||||
|
||||
function serve() {
|
||||
let server;
|
||||
|
||||
function toExit() {
|
||||
if (server) server.kill(0);
|
||||
}
|
||||
|
||||
return {
|
||||
writeBundle() {
|
||||
if (server) return;
|
||||
server = require('child_process').spawn('npm', ['run', 'start', '--', '--dev'], {
|
||||
stdio: ['ignore', 'inherit', 'inherit'],
|
||||
shell: true
|
||||
});
|
||||
|
||||
process.on('SIGTERM', toExit);
|
||||
process.on('exit', toExit);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default {
|
||||
input: 'src/main.ts',
|
||||
output: {
|
||||
sourcemap: true,
|
||||
format: 'iife',
|
||||
name: 'app',
|
||||
file: 'public/build/bundle.js'
|
||||
},
|
||||
plugins: [
|
||||
svelte({
|
||||
preprocess: sveltePreprocess({ sourceMap: !production }),
|
||||
compilerOptions: {
|
||||
// enable run-time checks when not in production
|
||||
dev: !production
|
||||
}
|
||||
}),
|
||||
// we'll extract any component CSS out into
|
||||
// a separate file - better for performance
|
||||
css({ output: 'bundle.css' }),
|
||||
|
||||
// If you have external dependencies installed from
|
||||
// npm, you'll most likely need these plugins. In
|
||||
// some cases you'll need additional configuration -
|
||||
// consult the documentation for details:
|
||||
// https://github.com/rollup/plugins/tree/master/packages/commonjs
|
||||
resolve({
|
||||
browser: true,
|
||||
dedupe: ['svelte']
|
||||
}),
|
||||
commonjs(),
|
||||
typescript({
|
||||
sourceMap: !production,
|
||||
inlineSources: !production
|
||||
}),
|
||||
|
||||
// In dev mode, call `npm run start` once
|
||||
// the bundle has been generated
|
||||
!production && serve(),
|
||||
|
||||
// Watch the `public` directory and refresh the
|
||||
// browser on changes when not in production
|
||||
!production && livereload('public'),
|
||||
|
||||
// If we're building for production (npm run build
|
||||
// instead of npm run dev), minify
|
||||
production && terser()
|
||||
],
|
||||
watch: {
|
||||
clearScreen: false
|
||||
}
|
||||
};
|
||||
617
src/0_archives__main.svelte
Normal file
617
src/0_archives__main.svelte
Normal file
@@ -0,0 +1,617 @@
|
||||
<script lang="ts">
|
||||
type key_val = {
|
||||
[key: string]: any;
|
||||
};
|
||||
// *** Import Svelte core
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
// *** Import Aether core variables and functions
|
||||
import { ae, api, Element_modal_v3 } from 'aether_npm_lib';
|
||||
|
||||
import { slct, slct_trigger, ae_app } from './stores';
|
||||
|
||||
// *** Import Aether core components
|
||||
// import { get_data_store_obj_w_code } from '../data_store/stores_data_store_api.js';
|
||||
|
||||
// *** Import Aether module variables and functions
|
||||
// import { get_account_archive_obj_list } from './stores_ae_api.js';
|
||||
|
||||
// *** Import Aether module components
|
||||
import Edit_archive_obj from './10_edit__archive_obj.svelte';
|
||||
import List_archive_obj from './10_list__archive_obj.svelte';
|
||||
import View_archive_obj from './10_view__archive_obj.svelte';
|
||||
|
||||
// *** Export/Exposed variables and functions for component
|
||||
// export let account_id: string = $page['page_for']['account_id'];
|
||||
export let account_id: string = $ae_app.account_id;
|
||||
export let archive_id: string = $ae_app.archives.archive_id;
|
||||
|
||||
export let novi_uuid: string = $ae_app.novi_uuid;
|
||||
export let novi_email: string = $ae_app.novi_email;
|
||||
export let novi_full_name: string = $ae_app.novi_full_name;
|
||||
export let novi_admin_li: string = $ae_app.novi_admin_li;
|
||||
export let novi_trusted_li: string = $ae_app.novi_trusted_li;
|
||||
|
||||
// *** Set initial variables
|
||||
$ae_app.novi_uuid = novi_uuid;
|
||||
$ae_app.novi_email = decodeURIComponent(novi_email);
|
||||
$ae_app.novi_full_name = decodeURIComponent(novi_full_name);
|
||||
$ae_app.novi_admin_li = novi_admin_li;
|
||||
$ae_app.novi_trusted_li = novi_trusted_li;
|
||||
|
||||
$ae_app.current_timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||
if (!$ae_app.lu_timezone_list) {
|
||||
$ae_app.lu_timezone_list = [];
|
||||
}
|
||||
|
||||
$ae_app.archives.show_main__options = true; // Section for: buttons for creating new archives, show/hide archives, and search archives
|
||||
// $ae_app.archives.show_list__archive_obj_li = true;
|
||||
// $ae_app.archives.show_view__archive_obj = $ae_app.archives.show_view__archive_obj;
|
||||
$ae_app.archives.fulltext_search_qry_str = '';
|
||||
$ae_app.archives.qry_type = false
|
||||
|
||||
// NOTE: Check if the novi_uuid is in the novi_admin_li list
|
||||
if ($ae_app.novi_uuid && $ae_app.novi_admin_li) {
|
||||
if ($ae_app.novi_admin_li.includes($ae_app.novi_uuid)) {
|
||||
$ae_app.access_type = 'administrator';
|
||||
$ae_app.administrator_access = true;
|
||||
$ae_app.trusted_access = true;
|
||||
}
|
||||
}
|
||||
// NOTE: Check if the novi_uuid is in the novi_trusted_li list
|
||||
if ($ae_app.novi_uuid && $ae_app.novi_trusted_li) {
|
||||
if ($ae_app.novi_trusted_li.includes($ae_app.novi_uuid)) {
|
||||
$ae_app.access_type = 'trusted';
|
||||
$ae_app.trusted_access = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($ae_app.administrator_access) {
|
||||
$ae_app.archives.enabled = 'enabled';
|
||||
$ae_app.archives.hidden = 'not_hidden';
|
||||
$ae_app.archives.limit = 150;
|
||||
} else if ($ae_app.trusted_access) {
|
||||
$ae_app.archives.enabled = 'enabled';
|
||||
$ae_app.archives.hidden = 'not_hidden';
|
||||
$ae_app.archives.limit = 75;
|
||||
} else {
|
||||
$ae_app.archives.enabled = 'enabled';
|
||||
$ae_app.archives.hidden = 'not_hidden';
|
||||
$ae_app.archives.limit = 75;
|
||||
}
|
||||
|
||||
let idaa_archive_obj_li_get_promise;
|
||||
let idaa_archive_obj_get_promise;
|
||||
|
||||
if (account_id) {
|
||||
$slct.account_id = account_id;
|
||||
handle_load_archive_obj_li({account_id: $slct.account_id, try_cache: false});
|
||||
}
|
||||
|
||||
if (archive_id) {
|
||||
console.log(`Selected Archive ID: ${archive_id}`);
|
||||
$slct.archive_id = archive_id;
|
||||
$slct_trigger = 'load__archive_obj';
|
||||
|
||||
// $ae_app.archives.show_main__options = true;
|
||||
$ae_app.archives.show_list__archive_obj_li = false;
|
||||
$ae_app.archives.show_view__archive_obj = true;
|
||||
$ae_app.archives.show_edit__archive_obj = false;
|
||||
} else {
|
||||
// $ae_app.archives.show_main__options = true;
|
||||
$ae_app.archives.show_list__archive_obj_li = true;
|
||||
$ae_app.archives.show_view__archive_obj = false;
|
||||
$ae_app.archives.show_edit__archive_obj = false;
|
||||
}
|
||||
|
||||
if (!$ae_app.client_content) {
|
||||
$ae_app.client_content = {};
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** IDAA Archives - AE Archives: Main');
|
||||
});
|
||||
|
||||
|
||||
$: if ($ae_app.iframe_height && $ae_app.iframe_height_modal_body) {
|
||||
console.log('getting new dimensions for iframe:', $ae_app.iframe_height, $ae_app.iframe_height_modal_body);
|
||||
|
||||
let iframe_height = 0;
|
||||
|
||||
if ($ae_app.iframe_height > $ae_app.iframe_height_modal_body) {
|
||||
iframe_height = $ae_app.iframe_height;
|
||||
} else {
|
||||
iframe_height = $ae_app.iframe_height_modal_body;
|
||||
|
||||
// console.log($ae_app.modal_dimensions);
|
||||
|
||||
if ($ae_app.modal_dimensions && $ae_app.modal_dimensions.header_height) {
|
||||
iframe_height = iframe_height + $ae_app.modal_dimensions.header_height;
|
||||
}
|
||||
if ($ae_app.modal_dimensions && $ae_app.modal_dimensions.footer_height) {
|
||||
iframe_height = iframe_height + $ae_app.modal_dimensions.footer_height;
|
||||
}
|
||||
// iframe_height = iframe_height + 50; // Just in case
|
||||
}
|
||||
|
||||
console.log(`Suggested new iframe_height: ${iframe_height}`);
|
||||
window.parent.postMessage({'iframe_height': iframe_height}, "*"); // This should be in pixels
|
||||
} else if ($ae_app.iframe_height) {
|
||||
console.log('setting new iframe_height:', $ae_app.iframe_height);
|
||||
|
||||
// let iframe_height = $ae_app.iframe_height;
|
||||
|
||||
window.parent.postMessage({'iframe_height': $ae_app.iframe_height}, "*"); // This should be in pixels
|
||||
}
|
||||
|
||||
$: if ($slct_trigger == 'load__archive_obj' && $slct.archive_id) {
|
||||
console.log('*** $slct_trigger == load__archive_obj ***');
|
||||
$slct_trigger = null;
|
||||
|
||||
handle_load_archive_obj({archive_id: $slct.archive_id, try_cache: false});
|
||||
|
||||
// Auto show the selected Archive ID
|
||||
// Is this pushState needed here?
|
||||
// Set the URL param "archive_id" to the current Archive ID. This is a just in case.
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.set('archive_id', $slct.archive_id);
|
||||
// history.pushState({}, '', url);
|
||||
|
||||
// Is this postMessage needed here?
|
||||
let message = {'archive_id': $slct.archive_id};
|
||||
window.parent.postMessage(message, "*");
|
||||
|
||||
// $ae_app.archives.show_main__options = false;
|
||||
// $ae_app.archives.show_list__archive_obj_li = false;
|
||||
// $ae_app.archives.show_view__archive_obj = true;
|
||||
// $ae_app.archives.show_edit__archive_obj = false;
|
||||
}
|
||||
|
||||
$: if ($slct_trigger == 'load__archive_obj_li' && $slct.account_id) {
|
||||
console.log('*** $slct_trigger == load__archive_obj_li ***');
|
||||
$slct_trigger = null;
|
||||
|
||||
handle_load_archive_obj_li({account_id: $slct.account_id, try_cache: false});
|
||||
}
|
||||
|
||||
async function handle_load_archive_obj_li({account_id, try_cache=true}) {
|
||||
console.log('*** handle_load_archive_obj_li() ***');
|
||||
console.log($ae_app.archives);
|
||||
|
||||
let enabled = $ae_app.archives.enabled;
|
||||
let hidden = $ae_app.archives.hidden;
|
||||
let limit = $ae_app.archives.limit;
|
||||
let offset = $ae_app.archives.offset;
|
||||
|
||||
let params = {};
|
||||
|
||||
let params_json: key_val = {};
|
||||
if ($ae_app.archives.fulltext_search_qry_str && $ae_app.archives.fulltext_search_qry_str.length > 2) {
|
||||
params_json['ft_qry'] = {
|
||||
'default_qry_str': $ae_app.archives.fulltext_search_qry_str,
|
||||
};
|
||||
}
|
||||
|
||||
if ($ae_app.archives.qry_audio || $ae_app.archives.qry_video || $ae_app.archives.qry_other) {
|
||||
params_json['and_qry'] = {};
|
||||
if ($ae_app.archives.qry_audio) params_json['and_qry']['audio'] = true;
|
||||
if ($ae_app.archives.qry_video) params_json['and_qry']['video'] = true;
|
||||
if ($ae_app.archives.qry_other) params_json['and_qry']['other'] = $ae_app.archives.qry_other;
|
||||
}
|
||||
|
||||
console.log('params_json:', params_json);
|
||||
|
||||
idaa_archive_obj_li_get_promise = api.get_ae_obj_li_for_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'archive', // Archive in this case is an IDAA archive.
|
||||
for_obj_type: 'account',
|
||||
for_obj_id: account_id,
|
||||
use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config.
|
||||
use_alt_base: false, // NOTE: This will use the base_name_alt value instead of the base_name value in the API config.
|
||||
enabled: enabled,
|
||||
hidden: hidden,
|
||||
order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'created_on': 'DESC', 'updated_on': 'DESC'},
|
||||
limit: limit,
|
||||
offset: offset,
|
||||
params_json: params_json,
|
||||
params: params,
|
||||
log_lvl: 1
|
||||
})
|
||||
|
||||
.then(function (archive_obj_li_get_result) {
|
||||
if (archive_obj_li_get_result) {
|
||||
$slct.archive_obj_li = archive_obj_li_get_result;
|
||||
console.log(`Archive list:`, $slct.archive_obj_li);
|
||||
} else {
|
||||
$slct.archive_obj_li = [];
|
||||
}
|
||||
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
|
||||
return idaa_archive_obj_li_get_promise;
|
||||
}
|
||||
|
||||
async function handle_load_archive_obj({archive_id, try_cache=false}) {
|
||||
console.log('*** handle_load_archive_obj() ***');
|
||||
|
||||
// let enabled = $ae_app.archives.enabled;
|
||||
// let hidden = $ae_app.archives.hidden;
|
||||
// let limit = $ae_app.archives.limit;
|
||||
// let offset = $ae_app.archives.offset;
|
||||
|
||||
let params = {};
|
||||
|
||||
idaa_archive_obj_get_promise = api.get_ae_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'archive',
|
||||
obj_id: archive_id,
|
||||
use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config.
|
||||
use_alt_base: false, // NOTE: This will use the base_name_alt value instead of the base_name value in the API config.
|
||||
params: params,
|
||||
log_lvl: 0
|
||||
})
|
||||
.then(function (archive_obj_get_result) {
|
||||
if (archive_obj_get_result) {
|
||||
$slct.archive_obj = archive_obj_get_result;
|
||||
// console.log($slct.archive_obj.cfg_json.content_group_sort);
|
||||
$ae_app.archives.content_group_sort = $slct.archive_obj.cfg_json.content_group_sort;
|
||||
console.log(`Archive object:`, $slct.archive_obj);
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
|
||||
return idaa_archive_obj_get_promise;
|
||||
}
|
||||
|
||||
function handle_created_archive_obj(event) {
|
||||
console.log('*** handle_created_archive_obj() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
handle_load_archive_obj({archive_id: $slct.archive_id, try_cache: false});
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.set('archive_id', $slct.archive_id);
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {'archive_id': $slct.archive_id};
|
||||
window.parent.postMessage(message, "*");
|
||||
|
||||
// $slct_trigger = 'load__archive_obj';
|
||||
$slct_trigger = 'load__archive_obj_li';
|
||||
|
||||
// $ae_app.archives.show_main__options = false;
|
||||
$ae_app.archives.show_list__archive_obj_li = false;
|
||||
$ae_app.archives.show_view__archive_obj = true;
|
||||
$ae_app.archives.show_edit__archive_obj = false;
|
||||
}
|
||||
|
||||
function handle_updated_archive_obj(event) {
|
||||
console.log('*** handle_updated_archive_obj() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
$slct_trigger = 'load__archive_obj';
|
||||
// NOTE: If the next trigger is set too quickly it will cause the one above to be missed.
|
||||
// $slct_trigger = 'load__archive_obj_li';
|
||||
|
||||
// $ae_app.archives.show_main__options = false;
|
||||
$ae_app.archives.show_list__archive_obj_li = false;
|
||||
$ae_app.archives.show_view__archive_obj = true;
|
||||
$ae_app.archives.show_edit__archive_obj = false;
|
||||
}
|
||||
|
||||
function handle_deleted_archive_obj(event) {
|
||||
console.log('*** handle_deleted_archive_obj() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete('archive_id');
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {'archive_id': null};
|
||||
window.parent.postMessage(message, "*");
|
||||
|
||||
$slct_trigger = 'load__archive_obj_li';
|
||||
|
||||
$ae_app.archives.show_main__options = true;
|
||||
$ae_app.archives.show_list__archive_obj_li = true;
|
||||
$ae_app.archives.show_view__archive_obj = false;
|
||||
$ae_app.archives.show_edit__archive_obj = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<section id="osit_idaa_archives" class="osit_archives ae_main c_idaa c_idaa_archives" bind:clientHeight={$ae_app.iframe_height}>
|
||||
<!-- <header>
|
||||
<h1>IDAA Archives</h1>
|
||||
</header> -->
|
||||
|
||||
<section class="ae_section ae_meta">
|
||||
<p>
|
||||
Novi: {$ae_app.novi_full_name}
|
||||
<span class="details">
|
||||
(
|
||||
{$ae_app.novi_email}
|
||||
{#if $ae_app.administrator_access}
|
||||
<span class="access_type administrator_access">Administrator</span>
|
||||
{:else if $ae_app.trusted_access}
|
||||
<span class="access_type trusted_access">Trusted</span>
|
||||
{/if}
|
||||
<span class="novi_uuid">UUID: {$ae_app.novi_uuid}</span>
|
||||
)
|
||||
</span>
|
||||
</p>
|
||||
<!-- <p>Page height: {window.innerHeight}</p> -->
|
||||
</section>
|
||||
|
||||
{#if $ae_app.archives.show_main__options}
|
||||
<section class="ae_section ae_options ae_column archive_obj__options">
|
||||
|
||||
<!-- <div class="note">A comment about the IDAA archives in general can go here.</div> -->
|
||||
|
||||
<div class="filters_and_search ae_group ae_row">
|
||||
|
||||
<!-- Show/hide hidden content -->
|
||||
|
||||
{#if $ae_app.trusted_access}
|
||||
{#if $ae_app.archives.hidden == 'not_hidden'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.archives.hidden = 'all';
|
||||
$ae_app.archives.limit = 150;
|
||||
$slct_trigger = 'load__archive_obj_li';
|
||||
}}
|
||||
class="btn_new_bb_post ae_btn btn_xs ae_smallest btn btn-xs btn-info"
|
||||
>
|
||||
<span class="fas fa-eye"></span> Show Hidden Archives
|
||||
</button>
|
||||
{:else}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.archives.hidden = 'not_hidden';
|
||||
$slct_trigger = 'load__archive_obj_li';
|
||||
}}
|
||||
class="btn_new_bb_post ae_btn btn_xs btn btn-xs btn-info"
|
||||
>
|
||||
<span class="fas fa-eye-slash"></span> Hide Hidden Archives
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
<!-- We only want these options to show if a specific archive is showing. -->
|
||||
{#if $ae_app.archives.show_view__archive_obj}
|
||||
{#if $ae_app.archives.hidden == 'not_hidden'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.archives.hidden = 'all';
|
||||
$ae_app.archives.limit = 150;
|
||||
$slct_trigger = 'load__archive_content_obj_li';
|
||||
}}
|
||||
class="btn_new_bb_post ae_btn btn_xs ae_smallest btn btn-xs btn-info"
|
||||
>
|
||||
<span class="fas fa-eye"></span> Show Hidden Content
|
||||
</button>
|
||||
{:else}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.archives.hidden = 'not_hidden';
|
||||
$slct_trigger = 'load__archive_content_obj_li';
|
||||
}}
|
||||
class="btn_new_bb_post ae_btn btn_xs btn btn-xs btn-info"
|
||||
>
|
||||
<span class="fas fa-eye-slash"></span> Hide Hidden Content
|
||||
</button>
|
||||
{/if}
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
<!-- For administrator access: Show/hide disabled content -->
|
||||
|
||||
{#if $ae_app.administrator_access}
|
||||
{#if $ae_app.archives.enabled == 'enabled'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.archives.hidden = 'all';
|
||||
$ae_app.archives.enabled = 'all';
|
||||
$ae_app.archives.limit = 500;
|
||||
$slct_trigger = 'load__archive_obj_li';
|
||||
}}
|
||||
class="ae_btn btn_xs ae_smallest btn btn-xs btn-warning"
|
||||
>
|
||||
<span class="fas fa-eye"></span> Show Disabled Archives
|
||||
</button>
|
||||
{:else}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.archives.enabled = 'enabled';
|
||||
$slct_trigger = 'load__archive_obj_li';
|
||||
}}
|
||||
class="ae_btn btn_xs ae_smallest btn btn-xs btn-warning"
|
||||
>
|
||||
<span class="fas fa-eye-slash"></span> Hide Disabled Archives
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
{#if $ae_app.archives.enabled == 'enabled'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.archives.hidden = 'all';
|
||||
$ae_app.archives.enabled = 'all';
|
||||
$ae_app.archives.limit = 500;
|
||||
$slct_trigger = 'load__archive_content_obj_li';
|
||||
}}
|
||||
class="ae_btn btn_xs ae_smallest btn btn-xs btn-warning"
|
||||
>
|
||||
<span class="fas fa-eye"></span> Show Disabled Content
|
||||
</button>
|
||||
{:else}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.archives.enabled = 'enabled';
|
||||
$slct_trigger = 'load__archive_content_obj_li';
|
||||
}}
|
||||
class="ae_btn btn_xs btn btn-xs btn-warning"
|
||||
>
|
||||
<span class="fas fa-eye-slash"></span> Hide Disabled Content
|
||||
</button>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
<!-- END: div filters_and_search -->
|
||||
|
||||
<div class="view_archvies_create_archive ae_group ae_row">
|
||||
{#if $slct.archive_id}
|
||||
<button
|
||||
on:click={ () => {
|
||||
|
||||
$slct.archive_id = null;
|
||||
$slct.archive_obj = {};
|
||||
|
||||
$ae_app.archives.show_main__options = true;
|
||||
$ae_app.archives.show_list__archive_obj_li = true;
|
||||
$ae_app.archives.show_view__archive_obj = false;
|
||||
$ae_app.archives.show_edit__archive_obj = false;
|
||||
// $ae_app.iframe_height_modal_body = 0;
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete('archive_id');
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {'archive_id': null};
|
||||
window.parent.postMessage(message, "*");
|
||||
}}
|
||||
class="btn_new_archive ae_btn btn btn-secondary"
|
||||
>
|
||||
<span class="fas fa-times"></span> View Other Archives
|
||||
</button>
|
||||
{/if}
|
||||
{#if $ae_app.trusted_access}
|
||||
<button
|
||||
on:click={() => {
|
||||
$slct.archive_id = null;
|
||||
$slct.archive_obj = {};
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete('archive_id');
|
||||
history.pushState({}, '', url);
|
||||
|
||||
$ae_app.archives.show_main__options = true;
|
||||
$ae_app.archives.show_list__archive_obj_li = false;
|
||||
$ae_app.archives.show_view__archive_obj = false;
|
||||
$ae_app.archives.show_edit__archive_obj = true;
|
||||
}}
|
||||
class="ae_btn ae_smallest btn_new_archive ae_btn btn btn-warning"
|
||||
>
|
||||
<span class="fas fa-plus"></span> Create new Archive
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
</section>
|
||||
{/if}
|
||||
|
||||
|
||||
{#if $ae_app.archives.show_list__archive_obj_li}
|
||||
<List_archive_obj
|
||||
on:created__archive_obj={handle_created_archive_obj}
|
||||
on:updated__archive_obj={handle_updated_archive_obj}
|
||||
on:deleted__archive_obj={handle_deleted_archive_obj}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
|
||||
{#if $ae_app.archives.show_view__archive_obj && $slct.archive_obj}
|
||||
<View_archive_obj />
|
||||
{/if}
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
{#if $ae_app.archives.show_edit__archive_obj}
|
||||
<Element_modal_v3
|
||||
show = { true }
|
||||
modal_cover_body = { false }
|
||||
report_client_dimensions = { true }
|
||||
on:close={ () => {
|
||||
$ae_app.archives.show_main__options = true;
|
||||
$ae_app.archives.show_list__archive_obj_li = true;
|
||||
$ae_app.archives.show_edit__archive_obj = false;
|
||||
$ae_app.archives.show_view__archive_obj = false;
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete('archive_id');
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {'archive_id': null};
|
||||
window.parent.postMessage(message, "*");
|
||||
}}
|
||||
on:report__modal_dimensions={ (event) => {
|
||||
console.log('*** on:report__modal_dimensions ***');
|
||||
console.log(event.detail);
|
||||
|
||||
$ae_app.modal_dimensions = event.detail.modal_dimensions;
|
||||
}}
|
||||
>
|
||||
<span slot="header_title">{@html ($slct.archive_obj.name ? $slct.archive_obj.name : 'New Archive Group')}</span>
|
||||
|
||||
<span slot="body">
|
||||
|
||||
<Edit_archive_obj
|
||||
on:created__archive_obj={handle_created_archive_obj}
|
||||
on:updated__archive_obj={handle_updated_archive_obj}
|
||||
on:deleted__archive_obj={handle_deleted_archive_obj}
|
||||
/>
|
||||
|
||||
</span>
|
||||
</Element_modal_v3>
|
||||
{/if}
|
||||
|
||||
|
||||
<!-- {#if $ae_app.archives.show_view__archive_obj && $slct.archive_obj}
|
||||
<Element_modal_v3
|
||||
show = { true }
|
||||
modal_cover_body = { true }
|
||||
report_modal_dimensions = { true }
|
||||
on:close={ () => {
|
||||
|
||||
$slct.archive_id = null;
|
||||
$slct.archive_obj = {};
|
||||
|
||||
$ae_app.archives.show_main__options = true;
|
||||
$ae_app.archives.show_list__archive_obj_li = true;
|
||||
$ae_app.archives.show_view__archive_obj = false;
|
||||
$ae_app.archives.show_edit__archive_obj = false;
|
||||
$ae_app.iframe_height_modal_body = 0;
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete('archive_id');
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {'archive_id': null};
|
||||
window.parent.postMessage(message, "*");
|
||||
}}
|
||||
on:report__modal_dimensions={ (event) => {
|
||||
console.log('*** on:report__modal_dimensions ***');
|
||||
console.log(event.detail);
|
||||
|
||||
$ae_app.modal_dimensions = event.detail.modal_dimensions;
|
||||
}}
|
||||
>
|
||||
<span slot="header_title">{@html $slct.archive_obj.name}</span>
|
||||
|
||||
<span slot="body">
|
||||
|
||||
<View_archive_obj />
|
||||
|
||||
</span>
|
||||
</Element_modal_v3>
|
||||
{/if} -->
|
||||
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
239
src/0_hub__main.svelte
Normal file
239
src/0_hub__main.svelte
Normal file
@@ -0,0 +1,239 @@
|
||||
<script lang="ts">
|
||||
type key_val = {
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
|
||||
// *** Import Svelte core
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
// *** Import Aether core variables and functions
|
||||
import { ae, api, Element_modal_v3 } from 'aether_npm_lib';
|
||||
|
||||
import { slct, slct_trigger, ae_app, ae_session, ae_local } from './stores';
|
||||
|
||||
export let ae_obj_type: string = 'example';
|
||||
export let ae_obj_id: string = 'abc123';
|
||||
|
||||
|
||||
// let data_store_obj_get_promise: Promise<any>;
|
||||
let data_store_obj_get_promises: key_val = {};
|
||||
let get_ds_hub_site_header_promise = handle_get_data_store_obj_w_code({code: 'hub_site_header'});
|
||||
let get_ds_hub_site_footer_promise = handle_get_data_store_obj_w_code({code: 'hub_site_footer'});
|
||||
|
||||
handle_build_site_nav_menu();
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** OSIT - AE Hub: Main');
|
||||
$ae_session.test.hub = 'Hello World!';
|
||||
$ae_session.test.general = 'Hello world from The Hub!';
|
||||
console.log('ae_session:', $ae_session);
|
||||
});
|
||||
|
||||
|
||||
async function handle_get_data_store_obj_w_code({code, data_type='text'}) {
|
||||
console.log('*** handle_get_data_store_obj_w_code() ***');
|
||||
|
||||
let get_item_result = window.localStorage.getItem(code);
|
||||
if (get_item_result) {
|
||||
$ae_app.hub.ds[code] = get_item_result;
|
||||
} else {
|
||||
console.log('Get local storage item miss.');
|
||||
}
|
||||
|
||||
data_store_obj_get_promises[code] = api.get_data_store_obj_w_code({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
data_store_code: code,
|
||||
data_type: data_type,
|
||||
log_lvl: 0
|
||||
})
|
||||
.then(function (get_data_store_result) {
|
||||
if (get_data_store_result) {
|
||||
|
||||
if (data_type == 'text') {
|
||||
// console.log(get_data_store_result.text);
|
||||
$ae_app.hub.ds[code] = get_data_store_result.text;
|
||||
} else if (data_type == 'json') {
|
||||
// console.log(get_data_store_result.json);
|
||||
$ae_app.hub.ds[code] = get_data_store_result.json;
|
||||
}
|
||||
|
||||
// console.log(`Code: ${$ae_app.hub.ds[code]}`);
|
||||
// console.log(`Code:`, $ae_app.hub.ds[code]);
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
}
|
||||
|
||||
// In most cases we are just inserting HTML into the DOM. The Svelte module apps can update the ID's of the elements within if needed.
|
||||
$: if ($ae_app.hub.ds['hub_site_header']) {
|
||||
console.log('Hub Site Header:', $ae_app.hub.ds['hub_site_header']);
|
||||
const site_header_element = document.getElementById('Site-Header');
|
||||
if (site_header_element) {
|
||||
site_header_element.innerHTML = $ae_app.hub.ds['hub_site_header'];
|
||||
}
|
||||
}
|
||||
|
||||
$: if ($ae_app.hub.ds['hub_site_footer']) {
|
||||
console.log('Hub Site Footer:', $ae_app.hub.ds['hub_site_footer']);
|
||||
const site_footer_element = document.getElementById('Site-Footer');
|
||||
if (site_footer_element) {
|
||||
site_footer_element.innerHTML = $ae_app.hub.ds['hub_site_footer'];
|
||||
}
|
||||
}
|
||||
|
||||
// $: if ($ae_app.hub.ds['hub_site_nav_menu']) {
|
||||
// console.log('Hub Site Nav Menu:', $ae_app.hub.ds['hub_site_nav_menu']);
|
||||
// const site_menu_element = document.getElementById('Site-Nav-Menu');
|
||||
// if (site_menu_element) {
|
||||
// /* Add the HTML to the site_menu_element DOM element */
|
||||
// // site_menu_element.innerHTML = $ae_app.hub.ds['hub_site_nav_menu'];
|
||||
// }
|
||||
// }
|
||||
|
||||
$: if ($ae_app.hub.ds['hub_notifications']) {
|
||||
console.log('Hub Notifications:', $ae_app.hub.ds['hub_notifications']);
|
||||
const site_notifications_element = document.getElementById('Notifications');
|
||||
if (site_notifications_element) {
|
||||
site_notifications_element.innerHTML = $ae_app.hub.ds['hub_notifications'];
|
||||
}
|
||||
}
|
||||
|
||||
// if $ae_app.hub.ds['hub_site_header'] {
|
||||
// console.log('Hub Site Header:', $ae_app.hub.ds['hub_site_header']);
|
||||
// document.getElementById('Site-Header').innerHTML = $ae_app.hub.ds['hub_site_header'];
|
||||
// }
|
||||
|
||||
function handle_build_site_nav_menu() {
|
||||
$ae_session.site_nav_menu = {};
|
||||
|
||||
// let menu_item_tmp = {};
|
||||
|
||||
|
||||
// Navigation button group
|
||||
// $ae_session.site_nav_menu['options'] = []; // group
|
||||
|
||||
$ae_session.site_nav_menu['home'] = {
|
||||
'access_level': 'all',
|
||||
'state': 'active', // active, inactive, disabled
|
||||
'text': '<span class="fas fa-home"></span> Home',
|
||||
'href': '/',
|
||||
'action': 'navigate', // navigate, modal, action
|
||||
'class_li': ['ae_btn', 'btn_outline_primary']
|
||||
};
|
||||
|
||||
$ae_session.site_nav_menu['reports_exports'] = {
|
||||
'access_level': 'trusted',
|
||||
'state': 'active', // active, inactive, disabled
|
||||
'text': 'Reports & Exports',
|
||||
'href': '/',
|
||||
'action': 'navigate', // navigate, modal, action
|
||||
'class_li': ['ae_btn', 'btn_outline_secondary']
|
||||
};
|
||||
|
||||
$ae_session.site_nav_menu['manage'] = {
|
||||
'access_level': 'administrator',
|
||||
'state': 'active', // active, inactive, disabled
|
||||
'text': 'Manage',
|
||||
'href': '/manage',
|
||||
'action': 'navigate', // navigate, modal, action
|
||||
'class_li': ['ae_btn', 'btn_outline_secondary']
|
||||
};
|
||||
|
||||
$ae_session.site_nav_menu['help'] = {
|
||||
'access_level': 'all',
|
||||
'state': 'active', // active, inactive, disabled
|
||||
'text': 'Help',
|
||||
'href': '/',
|
||||
'class_li': ['ae_btn', 'btn_outline_secondary']
|
||||
};
|
||||
|
||||
|
||||
// // Trusted button group
|
||||
// $ae_session.site_nav_menu['trusted'] = []; // group
|
||||
|
||||
// menu_item_tmp = $event_defaults.event_manage_btn;
|
||||
// menu_item_tmp['href'] = `/event/${$slct.event_id}/manage`;
|
||||
// menu_item_tmp['class_li'].push('btn_sm', 'btn_outline_warning');
|
||||
// $ae_session.site_nav_menu['trusted'].push(menu_item_tmp);
|
||||
|
||||
// menu_item_tmp = $event_defaults.event_location_view_li_btn;
|
||||
// menu_item_tmp['href'] = `/event/${$slct.event_id}/locations`;
|
||||
// menu_item_tmp['class_li'].push('btn_sm', 'btn_outline_secondary');
|
||||
// $ae_session.site_nav_menu['trusted'].push(menu_item_tmp);
|
||||
|
||||
// // Admin button group
|
||||
// $ae_session.site_nav_menu['admin'] = []; // group
|
||||
|
||||
// menu_item_tmp = $event_defaults.event_edit_btn;
|
||||
// menu_item_tmp['href'] = `/event/${$slct.event_id}/edit`;
|
||||
// menu_item_tmp['class_li'].push('btn_sm', 'btn_outline_warning');
|
||||
// $ae_session.site_nav_menu['admin'].push(menu_item_tmp);
|
||||
}
|
||||
</script>
|
||||
|
||||
<section class="ae_hub ae_debug">
|
||||
|
||||
The Hub!
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_session.site_nav_menu['home'].text = '<span class="fas fa-house-damage"></span> Home';
|
||||
// console.log('ae_session:', $ae_session);
|
||||
|
||||
$ae_local.testing = 'Hello World!';
|
||||
$ae_local.test = 'Hello World!';
|
||||
// $ae_local.set('Hello World!');
|
||||
console.log('ae_local:', $ae_local);
|
||||
}}
|
||||
>
|
||||
<span class="fas fa-biohazard"></span> Test
|
||||
</button>
|
||||
|
||||
{#if $ae_app.administrator_access}
|
||||
<span class="access_type administrator_access">Administrator</span>
|
||||
{:else if $ae_app.trusted_access}
|
||||
<span class="access_type trusted_access">Trusted</span>
|
||||
{/if}
|
||||
|
||||
<div>
|
||||
<!-- {$ae_session.test.example} -->
|
||||
<!-- {$ae_session.test.general} -->
|
||||
<!-- {$ae_session.test.hub} -->
|
||||
<!-- {$ae_session.test.sponsorships} -->
|
||||
</div>
|
||||
|
||||
{#await data_store_obj_get_promises['hub_site_header']}
|
||||
<p>Loading site header...</p>
|
||||
{:then}
|
||||
<p>Site header loaded.</p>
|
||||
<!-- <div class="">{@html $ae_app.hub.ds['hub_site_header']}</div> -->
|
||||
<!-- <pre>
|
||||
{$ae_app.hub.ds['hub_site_header']}
|
||||
</pre> -->
|
||||
{:catch error}
|
||||
<p style="color: red">{error.message}</p>
|
||||
{/await}
|
||||
|
||||
{#await data_store_obj_get_promises['hub_site_footer']}
|
||||
<p>Loading site footer...</p>
|
||||
{:then}
|
||||
<p>Site footer loaded.</p>
|
||||
<!-- <div class="">{@html $ae_app.hub.ds['hub_site_footer']}</div> -->
|
||||
<!-- <pre>
|
||||
{$ae_app.hub.ds['hub_site_footer']}
|
||||
</pre> -->
|
||||
{:catch error}
|
||||
<p style="color: red">{error.message}</p>
|
||||
{/await}
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<style>
|
||||
|
||||
/* .ae_hub.ae_debug {
|
||||
|
||||
} */
|
||||
</style>
|
||||
711
src/0_posts__main.svelte
Normal file
711
src/0_posts__main.svelte
Normal file
@@ -0,0 +1,711 @@
|
||||
<script lang="ts">
|
||||
type key_val = {
|
||||
[key: string]: any;
|
||||
};
|
||||
// *** Import Svelte core
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
// *** Import Aether core variables and functions
|
||||
import { ae, api, Element_modal_v3 } from 'aether_npm_lib';
|
||||
|
||||
import { slct, slct_trigger, ae_app } from './stores';
|
||||
|
||||
// *** Import Aether core components
|
||||
|
||||
// *** Import Aether module variables and functions
|
||||
|
||||
// *** Import Aether module components
|
||||
import Edit_post_obj from './10_edit__post_obj.svelte';
|
||||
import View_post_obj from './10_view__post_obj.svelte';
|
||||
|
||||
// *** Export/Exposed variables and functions for component
|
||||
export let account_id: string = $ae_app.account_id;
|
||||
export let post_id: string = $ae_app.posts.post_id;
|
||||
|
||||
export let novi_uuid: string = $ae_app.novi_uuid;
|
||||
export let novi_email: string = $ae_app.novi_email;
|
||||
export let novi_full_name: string = $ae_app.novi_full_name;
|
||||
export let novi_admin_li: string = $ae_app.novi_admin_li;
|
||||
export let novi_trusted_li: string = $ae_app.novi_trusted_li;
|
||||
|
||||
// *** Set initial variables
|
||||
$ae_app.novi_uuid = novi_uuid;
|
||||
$ae_app.novi_email = decodeURIComponent(novi_email);
|
||||
$ae_app.novi_full_name = decodeURIComponent(novi_full_name);
|
||||
$ae_app.novi_admin_li = novi_admin_li;
|
||||
$ae_app.novi_trusted_li = novi_trusted_li;
|
||||
|
||||
$ae_app.posts.show_main__options = true;
|
||||
$ae_app.posts.show_list__post_obj_li = true;
|
||||
|
||||
// NOTE: Check if the novi_uuid is in the novi_admin_li list
|
||||
if ($ae_app.novi_uuid && $ae_app.novi_admin_li) {
|
||||
if ($ae_app.novi_admin_li.includes($ae_app.novi_uuid)) {
|
||||
$ae_app.access_type = 'administrator';
|
||||
$ae_app.administrator_access = true;
|
||||
$ae_app.trusted_access = true;
|
||||
}
|
||||
}
|
||||
// NOTE: Check if the novi_uuid is in the novi_trusted_li list
|
||||
if ($ae_app.novi_uuid && $ae_app.novi_trusted_li) {
|
||||
if ($ae_app.novi_trusted_li.includes($ae_app.novi_uuid)) {
|
||||
$ae_app.access_type = 'trusted';
|
||||
$ae_app.trusted_access = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($ae_app.administrator_access) {
|
||||
$ae_app.posts.enabled = 'enabled';
|
||||
$ae_app.posts.hidden = 'not_hidden';
|
||||
$ae_app.events.limit = 150;
|
||||
} else if ($ae_app.trusted_access) {
|
||||
$ae_app.posts.enabled = 'enabled';
|
||||
$ae_app.posts.hidden = 'not_hidden';
|
||||
$ae_app.events.limit = 75;
|
||||
} else {
|
||||
$ae_app.posts.enabled = 'enabled';
|
||||
$ae_app.posts.hidden = 'not_hidden';
|
||||
$ae_app.events.limit = 50;
|
||||
}
|
||||
|
||||
let idaa_post_obj_li_get_promise;
|
||||
let idaa_post_obj_get_promise;
|
||||
let idaa_post_comment_obj_li_get_promise;
|
||||
|
||||
if (account_id) {
|
||||
$slct.account_id = account_id;
|
||||
handle_load_idaa_post_obj_li({account_id: $slct.account_id, try_cache: false});
|
||||
}
|
||||
|
||||
// NOTE: This if post_id is not fully ready yet -2023-09-08
|
||||
if (post_id) {
|
||||
console.log(`Selected Post ID: ${post_id}`);
|
||||
$slct.post_id = post_id;
|
||||
$slct_trigger = 'load__post_obj';
|
||||
$slct_trigger = 'load__post_comment_obj_li';
|
||||
// handle_load_post_id_obj({post_id: $slct.post_id, try_cache: false});
|
||||
// handle_load_post_comment_obj_li({post_id: $slct.post_id, try_cache: false});
|
||||
|
||||
// Auto show the selected Post ID
|
||||
// Is this pushState needed here?
|
||||
// Set the URL param "post_id" to the current Post ID. This is a just in case.
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.set('post_id', $slct.post_id);
|
||||
// history.pushState({}, '', url);
|
||||
|
||||
$ae_app.events.show_main__options = true;
|
||||
$ae_app.posts.show_list__post_obj_li = true;
|
||||
$ae_app.posts.show_edit__post_id = false;
|
||||
$ae_app.posts.show_view__post_id = true;
|
||||
}
|
||||
|
||||
if (!$ae_app.client_content) {
|
||||
$ae_app.client_content = {};
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** IDAA Bulletin Board - AE Posts: Main');
|
||||
});
|
||||
|
||||
|
||||
$: if ($ae_app.iframe_height && $ae_app.iframe_height_modal_body) {
|
||||
console.log('getting new dimensions for iframe:', $ae_app.iframe_height, $ae_app.iframe_height_modal_body);
|
||||
|
||||
let iframe_height = 0;
|
||||
|
||||
if ($ae_app.iframe_height > $ae_app.iframe_height_modal_body) {
|
||||
iframe_height = $ae_app.iframe_height;
|
||||
} else {
|
||||
iframe_height = $ae_app.iframe_height_modal_body;
|
||||
|
||||
// console.log($ae_app.modal_dimensions);
|
||||
|
||||
if ($ae_app.modal_dimensions && $ae_app.modal_dimensions.header_height) {
|
||||
iframe_height = iframe_height + $ae_app.modal_dimensions.header_height;
|
||||
}
|
||||
if ($ae_app.modal_dimensions && $ae_app.modal_dimensions.footer_height) {
|
||||
iframe_height = iframe_height + $ae_app.modal_dimensions.footer_height;
|
||||
}
|
||||
// iframe_height = iframe_height + 50; // Just in case
|
||||
}
|
||||
|
||||
console.log(`Suggested new iframe_height: ${iframe_height}`);
|
||||
window.parent.postMessage({'iframe_height': iframe_height}, "*"); // This should be in pixels
|
||||
} else if ($ae_app.iframe_height) {
|
||||
console.log('setting new iframe_height:', $ae_app.iframe_height);
|
||||
|
||||
// let iframe_height = $ae_app.iframe_height;
|
||||
|
||||
window.parent.postMessage({'iframe_height': $ae_app.iframe_height}, "*"); // This should be in pixels
|
||||
}
|
||||
|
||||
|
||||
$: if ($slct_trigger == 'load__post_obj_li' && $slct.account_id) {
|
||||
$slct_trigger = null;
|
||||
|
||||
handle_load_idaa_post_obj_li({account_id: $slct.account_id, try_cache: false});
|
||||
}
|
||||
|
||||
async function handle_load_idaa_post_obj_li({account_id, try_cache=false}) {
|
||||
console.log('*** handle_load_idaa_post_obj_li() ***');
|
||||
|
||||
let enabled = $ae_app.posts.enabled;
|
||||
let hidden = $ae_app.posts.hidden;
|
||||
let limit = $ae_app.posts.limit;
|
||||
let offset = $ae_app.posts.offset;
|
||||
|
||||
let params = {};
|
||||
|
||||
// params['json_str'] = encodeURIComponent(JSON.stringify($ae_app.posts));
|
||||
// let json_test_obj = {
|
||||
// 'default_qry_str': 'Testing',
|
||||
// 'address_default_qry_str': 'New York',
|
||||
// 'contact_1_default_qry_str': 'Scott',
|
||||
// };
|
||||
|
||||
// let json_test_obj = {
|
||||
// 'name': {'comp': 'LIKE', 'val': '%test%'},
|
||||
// 'priority': {'comp': '>=', 'val': 0},
|
||||
// 'created_on': {'comp': '>=', 'val': '2021-01-01 00:00:00'},
|
||||
// };
|
||||
|
||||
idaa_post_obj_li_get_promise = api.get_ae_obj_li_for_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'post', // Post in this case is a person's bulletin board post.
|
||||
for_obj_type: 'account',
|
||||
for_obj_id: account_id,
|
||||
enabled: enabled,
|
||||
hidden: hidden,
|
||||
order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'created_on': 'DESC', 'updated_on': 'DESC'},
|
||||
limit: limit,
|
||||
offset: offset,
|
||||
params_json: null,
|
||||
params: params,
|
||||
log_lvl: 2
|
||||
})
|
||||
.then(function (post_obj_li_get_result) {
|
||||
if (post_obj_li_get_result) {
|
||||
$slct.post_obj_li = post_obj_li_get_result;
|
||||
console.log(`Post list:`, $slct.post_obj_li);
|
||||
} else {
|
||||
$slct.post_obj_li = [];
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
|
||||
return idaa_post_obj_li_get_promise;
|
||||
}
|
||||
|
||||
|
||||
$: if ($slct_trigger == 'load__post_obj' && $slct.post_id) {
|
||||
$slct_trigger = null;
|
||||
|
||||
handle_load_post_id_obj({post_id: $slct.post_id, try_cache: false});
|
||||
|
||||
// // Auto show the selected Event ID
|
||||
// // Set the URL param "post_id" to the current Event ID. This is a just in case.
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.set('post_id', $slct.post_id);
|
||||
// history.pushState({}, '', url);
|
||||
|
||||
// let message = {'post_id': $slct.post_id};
|
||||
// window.parent.postMessage(message, "*");
|
||||
|
||||
// $ae_app.posts.show_main__options = false;
|
||||
// $ae_app.posts.show_list__post_li = false;
|
||||
// $ae_app.posts.show_view__post_id = true;
|
||||
// $ae_app.posts.show_edit__post_id = false;
|
||||
}
|
||||
|
||||
async function handle_load_post_id_obj({post_id, try_cache=false}) {
|
||||
console.log('*** handle_load_post_id_obj() ***');
|
||||
|
||||
// let enabled = $ae_app.posts.enabled;
|
||||
// let hidden = $ae_app.posts.hidden;
|
||||
// let limit = $ae_app.posts.limit;
|
||||
// let offset = $ae_app.posts.offset;
|
||||
|
||||
let params = {};
|
||||
|
||||
idaa_post_obj_get_promise = api.get_ae_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'post',
|
||||
obj_id: post_id,
|
||||
params: params,
|
||||
log_lvl: 0
|
||||
})
|
||||
.then(function (post_obj_get_result) {
|
||||
if (post_obj_get_result) {
|
||||
$slct.post_obj = post_obj_get_result;
|
||||
console.log(`Post object:`, $slct.post_obj);
|
||||
}
|
||||
|
||||
// Auto show the selected Post ID
|
||||
// Set the URL param "post_id" to the current Post ID.
|
||||
const url = new URL(location);
|
||||
url.searchParams.set('post_id', $slct.post_id);
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {'post_id': $slct.post_id};
|
||||
window.parent.postMessage(message, "*");
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
|
||||
return idaa_post_obj_get_promise;
|
||||
}
|
||||
|
||||
|
||||
$: if ($slct_trigger == 'load__post_comment_obj_li' && $slct.post_id) {
|
||||
$slct_trigger = null;
|
||||
|
||||
handle_load_post_comment_obj_li({post_id: $slct.post_id, try_cache: false});
|
||||
}
|
||||
|
||||
async function handle_load_post_comment_obj_li({post_id, try_cache=false}) {
|
||||
console.log('*** handle_load_post_comment_obj_li() ***');
|
||||
|
||||
let enabled = $ae_app.posts.enabled;
|
||||
let hidden = $ae_app.posts.hidden;
|
||||
let limit = $ae_app.posts.limit;
|
||||
let offset = $ae_app.posts.offset;
|
||||
|
||||
let params = {};
|
||||
|
||||
idaa_post_comment_obj_li_get_promise = api.get_ae_obj_li_for_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'post_comment', // Post comment in this case is a person's bulletin board post comment.
|
||||
for_obj_type: 'post',
|
||||
for_obj_id: post_id,
|
||||
enabled: enabled,
|
||||
hidden: hidden,
|
||||
order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'created_on': 'DESC', 'updated_on': 'DESC'},
|
||||
limit: limit,
|
||||
offset: offset,
|
||||
params_json: null,
|
||||
params: params,
|
||||
log_lvl: 0
|
||||
})
|
||||
.then(function (post_comment_obj_li_get_result) {
|
||||
if (post_comment_obj_li_get_result) {
|
||||
$slct.post_comment_obj_li = post_comment_obj_li_get_result;
|
||||
console.log(`Post Comment list:`, $slct.post_comment_obj_li);
|
||||
} else {
|
||||
$slct.post_comment_obj_li = [];
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
|
||||
return idaa_post_comment_obj_li_get_promise;
|
||||
}
|
||||
|
||||
function handle_post_obj_created(event) {
|
||||
console.log('*** handle_post_obj_created() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
// $slct.post_id = event.detail.post_id_random;
|
||||
// $slct.post_obj = event.detail;
|
||||
|
||||
$slct_trigger = 'load__post_obj_li';
|
||||
|
||||
$ae_app.posts.show_list__post_obj_li = true;
|
||||
$ae_app.posts.show_edit__post_id = false;
|
||||
$ae_app.posts.show_view__post_id = false;
|
||||
}
|
||||
|
||||
function handle_post_obj_updated(event) {
|
||||
console.log('*** handle_post_obj_updated() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
// $slct.post_id = event.detail.post_id_random;
|
||||
// $slct.post_obj = event.detail;
|
||||
|
||||
$slct_trigger = 'load__post_obj_li';
|
||||
|
||||
$ae_app.posts.show_list__post_obj_li = true;
|
||||
$ae_app.posts.show_edit__post_id = false;
|
||||
$ae_app.posts.show_view__post_id = false;
|
||||
}
|
||||
|
||||
function handle_post_obj_deleted(event) {
|
||||
console.log('*** handle_post_obj_deleted() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
// $slct.post_id = null;
|
||||
// $slct.post_obj = {};
|
||||
|
||||
$slct_trigger = 'load__post_obj_li';
|
||||
|
||||
$ae_app.posts.show_list__post_obj_li = true;
|
||||
$ae_app.posts.show_edit__post_id = false;
|
||||
$ae_app.posts.show_view__post_id = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<section id="osit_idaa_bb" class="osit_posts ae_main c_idaa c_idaa_bb" bind:clientHeight={$ae_app.iframe_height}>
|
||||
<!-- <header>
|
||||
<h1>IDAA BB Posts</h1>
|
||||
</header> -->
|
||||
|
||||
<section class="ae_section ae_meta">
|
||||
<p>
|
||||
Novi: {$ae_app.novi_full_name}
|
||||
<span class="details">
|
||||
(
|
||||
{$ae_app.novi_email}
|
||||
{#if $ae_app.administrator_access}
|
||||
<span class="access_type administrator_access">Administrator</span>
|
||||
{:else if $ae_app.trusted_access}
|
||||
<span class="access_type trusted_access">Trusted</span>
|
||||
{/if}
|
||||
<span class="novi_uuid">UUID: {$ae_app.novi_uuid}</span>
|
||||
)
|
||||
</span>
|
||||
</p>
|
||||
<!-- <p>Page height: {window.innerHeight}</p> -->
|
||||
</section>
|
||||
|
||||
{#if $ae_app.posts.show_main__options}
|
||||
<section class="ae_section ae_options ae_row post_obj__options">
|
||||
|
||||
{#if $ae_app.trusted_access && $ae_app.posts.hidden == 'not_hidden'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.posts.hidden = 'all';
|
||||
$slct_trigger = 'load__post_obj_li';
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-info"
|
||||
>
|
||||
<span class="fas fa-eye"></span> Show Hidden Posts
|
||||
</button>
|
||||
{:else}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.posts.hidden = 'not_hidden';
|
||||
$slct_trigger = 'load__post_obj_li';
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-info"
|
||||
>
|
||||
<span class="fas fa-eye-slash"></span> Hide Hidden Posts
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
{#if $ae_app.administrator_access}
|
||||
{#if $ae_app.posts.enabled == 'enabled'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.posts.hidden = 'all';
|
||||
$ae_app.posts.enabled = 'all';
|
||||
$ae_app.posts.limit = 500;
|
||||
$slct_trigger = 'load__post_obj_li';
|
||||
}}
|
||||
class="ae_btn btn_xs ae_smallest btn btn-xs btn-warning"
|
||||
>
|
||||
<span class="fas fa-eye"></span> Show Disabled Posts
|
||||
</button>
|
||||
{:else}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.posts.enabled = 'enabled';
|
||||
$slct_trigger = 'load__post_obj_li';
|
||||
}}
|
||||
class="ae_btn btn_xs ae_smallest btn btn-xs btn-warning"
|
||||
>
|
||||
<span class="fas fa-eye-slash"></span> Hide Disabled Posts
|
||||
</button>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
<button
|
||||
on:click={() => {
|
||||
$slct.post_id = null;
|
||||
$slct.post_obj = {};
|
||||
$slct.post_comment_obj_li = [];
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete('post_id');
|
||||
history.pushState({}, '', url);
|
||||
|
||||
$ae_app.posts.show_main__options = true;
|
||||
$ae_app.posts.show_list__post_obj_li = true;
|
||||
$ae_app.posts.show_edit__post_id = true;
|
||||
$ae_app.posts.show_view__post_id = false;
|
||||
}}
|
||||
class="btn_new_bb_post btn btn-secondary"
|
||||
>
|
||||
<span class="fas fa-plus"></span> Create new BB post
|
||||
</button>
|
||||
|
||||
</section>
|
||||
{/if}
|
||||
|
||||
{#if $ae_app.posts.show_list__post_obj_li}
|
||||
<section class="bb_post_list">
|
||||
{#if $slct.post_obj_li}
|
||||
<!-- <ul> -->
|
||||
{#each $slct.post_obj_li as idaa_post_obj, index}
|
||||
<div
|
||||
id={`idaa_bb_post_id__${idaa_post_obj.post_id_random}`}
|
||||
class="container bb_post post_obj"
|
||||
class:post__hide={idaa_post_obj.hide}
|
||||
class:post__priority={idaa_post_obj.priority}
|
||||
class:post__group={idaa_post_obj.group}
|
||||
>
|
||||
<header class="ae_header post__header">
|
||||
<h3 class="post__title">
|
||||
{@html idaa_post_obj.title}
|
||||
{#if idaa_post_obj.topic_id}<span class="badge badge-info bg-info"><span class="fas fa-user-md"></span> {idaa_post_obj.topic_name}</span>{/if}
|
||||
</h3>
|
||||
</header>
|
||||
|
||||
{#if idaa_post_obj.content}<div class="post__content">{@html idaa_post_obj.content}</div>{/if}
|
||||
|
||||
<div class="ae_options post_obj__options">
|
||||
<button
|
||||
on:click={() => {
|
||||
$slct.post_id = idaa_post_obj.post_id_random;
|
||||
$slct.post_obj = idaa_post_obj;
|
||||
|
||||
handle_load_post_comment_obj_li({post_id: $slct.post_id, try_cache: false});
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.set('post_id', idaa_post_obj.post_id_random);
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {'post_id': idaa_post_obj.post_id_random};
|
||||
window.parent.postMessage(message, "*");
|
||||
|
||||
$ae_app.posts.show_main__options = true;
|
||||
$ae_app.posts.show_list__post_obj_li = true;
|
||||
// $ae_app.posts.show_edit__post_id = false;
|
||||
$ae_app.posts.show_view__post_id = true;
|
||||
}}
|
||||
class="btn btn-primary"
|
||||
title={`View: ${idaa_post_obj.title}`}
|
||||
>
|
||||
<span class="fas fa-envelope-open"></span> Open
|
||||
|
||||
{#if idaa_post_obj.post_comment_count}
|
||||
<span class="ae_badge ae_info post__post_comment_count">
|
||||
<span class="fas fa-comment"></span> {(idaa_post_obj.post_comment_count == 1 ? `${idaa_post_obj.post_comment_count} comment` : `${idaa_post_obj.post_comment_count} comments` )}
|
||||
</span>
|
||||
{/if}
|
||||
</button>
|
||||
|
||||
{#if $ae_app.trusted_access || idaa_post_obj.external_person_id === $ae_app.novi_uuid || idaa_post_obj.email === $ae_app.novi_email}
|
||||
<button
|
||||
on:click={() => {
|
||||
$slct.post_id = idaa_post_obj.post_id_random;
|
||||
$slct.post_obj = idaa_post_obj;
|
||||
$slct_trigger = 'load__post_obj';
|
||||
|
||||
$ae_app.posts.show_main__options = true;
|
||||
$ae_app.posts.show_list__post_obj_li = true;
|
||||
$ae_app.posts.show_edit__post_id = true;
|
||||
// $ae_app.posts.show_view__post_id = false;
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-secondary"
|
||||
title={`Edit post: ${idaa_post_obj.title}`}
|
||||
>
|
||||
<span class="fas fa-edit"></span> Edit Post
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
<!-- <button
|
||||
on:click={() => {
|
||||
$slct.post_id = idaa_post_obj.post_id_random;
|
||||
$slct.post_obj = idaa_post_obj;
|
||||
|
||||
$ae_app.posts.show_post_comment_crud = true;
|
||||
}}
|
||||
class="ae_btn btn_md btn_outline_warning"
|
||||
title={`New comment on: ${idaa_post_obj.title}`}
|
||||
>
|
||||
<span class="fas fa-plus"></span> New Comment
|
||||
</button> -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="ae_section ae_footer ae_meta post__meta">
|
||||
{#if (idaa_post_obj.anonymous)}
|
||||
<div class="post__posted_by">
|
||||
Posted by: <span class="fas fa-user-secret"></span> <span class="post__full_name">Anonymous</span>
|
||||
</div>
|
||||
{:else if (idaa_post_obj.full_name)}
|
||||
<div class="post__posted_by">
|
||||
Posted by: <span class="fas fa-user"></span> <span class="post__full_name">{idaa_post_obj.full_name}
|
||||
{#if $ae_app.trusted_access && idaa_post_obj.email}
|
||||
(<a href="mailto:{idaa_post_obj.email}?subject=IDAA BB Post">{idaa_post_obj.email}</a>)
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if idaa_post_obj.created_on}
|
||||
<div class="post__created_on_updated_on">
|
||||
{#if !idaa_post_obj.updated_on}
|
||||
<span
|
||||
class="post__created_on"
|
||||
>
|
||||
<span class="ae_label">Created on:</span>
|
||||
<span class="ae_value">{ae.util.iso_datetime_formatter(idaa_post_obj.created_on, 'datetime_iso_no_seconds')}</span>
|
||||
</span>
|
||||
{:else}
|
||||
<span
|
||||
class="post__updated_on"
|
||||
>
|
||||
<span class="ae_label">Updated on:</span>
|
||||
<span class="ae_value">{ae.util.iso_datetime_formatter(idaa_post_obj.updated_on, 'datetime_iso_no_seconds')}</span>
|
||||
</span>
|
||||
{/if}
|
||||
{#if idaa_post_obj.archive_on}
|
||||
<span class="post__archive_on">Archive on: {ae.util.iso_datetime_formatter(idaa_post_obj.archive_on, 'datetime_iso_no_seconds')}</span>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
<!-- <div style="font-size: smaller">json={encodeURIComponent(JSON.stringify({idaa_post_obj}))}</div> -->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{/each}
|
||||
<!-- </ul> -->
|
||||
{:else}
|
||||
No posts found at this time
|
||||
{/if}
|
||||
</section>
|
||||
{/if}
|
||||
|
||||
|
||||
{#if $ae_app.posts.show_edit__post_id}
|
||||
<Element_modal_v3
|
||||
show = { true }
|
||||
modal_cover_body = { false }
|
||||
report_client_dimensions = { true }
|
||||
on:close={ () => {
|
||||
$ae_app.posts.show_main__options = true;
|
||||
$ae_app.posts.show_list__post_obj_li = true;
|
||||
$ae_app.posts.show_edit__post_id = false;
|
||||
// $ae_app.posts.show_view__post_id = false;
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete('post_id');
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {'post_id': null};
|
||||
window.parent.postMessage(message, "*");
|
||||
}}
|
||||
on:report__modal_dimensions={ (event) => {
|
||||
console.log('*** on:report__modal_dimensions ***');
|
||||
console.log(event.detail);
|
||||
|
||||
$ae_app.modal_dimensions = event.detail.modal_dimensions;
|
||||
}}
|
||||
>
|
||||
<span slot="header_title">{@html ($slct.post_obj.title ? $slct.post_obj.title : 'New BB Post')}</span>
|
||||
|
||||
<span slot="body">
|
||||
<section class="post_obj_view">
|
||||
<Edit_post_obj on:created__post_obj={handle_post_obj_created} on:updated__post_obj={handle_post_obj_updated} on:deleted__post_obj={handle_post_obj_deleted} />
|
||||
</section>
|
||||
</span>
|
||||
</Element_modal_v3>
|
||||
{/if}
|
||||
|
||||
|
||||
{#if $ae_app.posts.show_view__post_id && $slct.post_obj}
|
||||
<Element_modal_v3
|
||||
show = { true }
|
||||
modal_cover_body = { false }
|
||||
report_client_dimensions = { true }
|
||||
on:close={ () => {
|
||||
$slct.post_comment_id = null; // NOTE: Reset in case the post comment was being edited.
|
||||
$slct.post_comment_obj = {}; // NOTE: Reset in case the post comment was being edited.
|
||||
$slct.post_comment_obj_li = [];
|
||||
|
||||
$ae_app.posts.show_main__options = true;
|
||||
$ae_app.posts.show_list__post_obj_li = true;
|
||||
// $ae_app.posts.show_edit__post_id = false;
|
||||
$ae_app.posts.show_view__post_id = false;
|
||||
$ae_app.posts.show_edit__post_comment = false;
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete('post_id');
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {'post_id': null};
|
||||
window.parent.postMessage(message, "*");
|
||||
}}
|
||||
on:report__modal_dimensions={ (event) => {
|
||||
console.log('*** on:report__modal_dimensions ***');
|
||||
console.log(event.detail);
|
||||
|
||||
$ae_app.modal_dimensions = event.detail.modal_dimensions;
|
||||
}}
|
||||
>
|
||||
<span slot="header_title">{$slct.post_obj.title}</span>
|
||||
|
||||
<span slot="body">
|
||||
|
||||
<View_post_obj />
|
||||
|
||||
</span>
|
||||
</Element_modal_v3>
|
||||
{/if}
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<style>
|
||||
.ae_header h3 {
|
||||
font-size: 1.2em;
|
||||
margin: 0;
|
||||
/* padding: 0; */
|
||||
}
|
||||
|
||||
.post_obj .ae_meta {
|
||||
font-size: smaller;
|
||||
color: hsla(0,0%,50%,1);
|
||||
}
|
||||
|
||||
.post_obj {
|
||||
border: solid thin hsla(0,0%,90%,1);
|
||||
margin: 1em .5em;
|
||||
padding: .5em .5em;
|
||||
}
|
||||
|
||||
.post__header {
|
||||
background-color: hsla(0,0%,90%,1);
|
||||
}
|
||||
|
||||
/* .ae_meta.post_obj {
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
} */
|
||||
|
||||
/* :global(.bb_post_crud .element_ae_modal) {
|
||||
border: dashed thin hsla(0,0%,70%,1);
|
||||
|
||||
margin: .5em .25em;
|
||||
padding: .5em .25em;
|
||||
|
||||
background-color: hsla(0,0%,90%,1);
|
||||
} */
|
||||
|
||||
/* :global(.bb_post_id_view .element_ae_modal) {
|
||||
border: dashed thin blue;
|
||||
} */
|
||||
|
||||
/* :global(.bb_post_comment_crud .element_ae_modal) {
|
||||
border: dashed thin hsla(0,0%,70%,1);
|
||||
|
||||
margin: .5em .25em;
|
||||
padding: .5em .25em;
|
||||
|
||||
background-color: hsla(0,0%,90%,1);
|
||||
} */
|
||||
</style>
|
||||
847
src/0_sponsorships__main.svelte
Normal file
847
src/0_sponsorships__main.svelte
Normal file
@@ -0,0 +1,847 @@
|
||||
<script lang="ts">
|
||||
type key_val = {
|
||||
[key: string]: any;
|
||||
};
|
||||
// *** Import Svelte core
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
// *** Import Aether core variables and functions
|
||||
import { ae, api, Element_modal_v3 } from 'aether_npm_lib';
|
||||
|
||||
import { slct, slct_trigger, ae_app, ae_local, ae_session } from './stores';
|
||||
|
||||
// *** Import Aether core components
|
||||
// import { get_data_store_obj_w_code } from '../data_store/stores_data_store_api.js';
|
||||
|
||||
// *** Import Aether module variables and functions
|
||||
|
||||
// *** Import Aether module components
|
||||
import Edit_sponsorship_obj from './10_edit__sponsorship_obj.svelte';
|
||||
import List_sponsorship_obj from './10_list__sponsorship_obj.svelte';
|
||||
import View_sponsorship_obj from './10_view__sponsorship_obj.svelte';
|
||||
|
||||
// *** Export/Exposed variables and functions for component
|
||||
// export let account_id: string = $page['page_for']['account_id'];
|
||||
export let account_id: string = $ae_app.account_id;
|
||||
export let sponsorship_id: string = $ae_app.sponsorships.sponsorship_id;
|
||||
|
||||
export let user: string = $ae_app.user;
|
||||
export let key: string = $ae_app.key;
|
||||
export let full_name: string = $ae_app.full_name;
|
||||
export let ae_admin_li: string = $ae_app.ae_admin_li;
|
||||
export let ae_trusted_li: string = $ae_app.ae_trusted_li;
|
||||
|
||||
// *** Set initial variables
|
||||
$ae_app.user = decodeURIComponent(user);
|
||||
$ae_app.key = decodeURIComponent(key);
|
||||
// $ae_app.ae_admin_li = ae_admin_li;
|
||||
// $ae_app.ae_trusted_li = ae_trusted_li;
|
||||
|
||||
$ae_app.current_timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||
if (!$ae_app.lu_country_subdivision_list) {
|
||||
$ae_app.lu_country_subdivision_list = [];
|
||||
}
|
||||
if (!$ae_app.lu_country_list ) {
|
||||
$ae_app.lu_country_list = [];
|
||||
}
|
||||
if (!$ae_app.lu_timezone_list) {
|
||||
$ae_app.lu_timezone_list = [];
|
||||
}
|
||||
|
||||
$ae_app.sponsorships.show_main__options = true; // Section for: search area, buttons for filtering sponsorships, create new sponsorship.
|
||||
$ae_app.sponsorships.show_list__sponsorship_obj_li = true;
|
||||
$ae_app.sponsorships.fulltext_search_qry_str = '';
|
||||
$ae_app.sponsorships.qry_virtual = false;
|
||||
$ae_app.sponsorships.qry_physical = false;
|
||||
$ae_app.sponsorships.qry_type = '';
|
||||
|
||||
// NOTE: Check if the ae_user is in the ae_admin_li list
|
||||
if ($ae_app.ae_user && $ae_app.ae_admin_li) {
|
||||
if ($ae_app.ae_admin_li.includes($ae_app.ae_user)) {
|
||||
$ae_app.access_type = 'administrator';
|
||||
$ae_app.administrator_access = true;
|
||||
$ae_app.trusted_access = true;
|
||||
}
|
||||
}
|
||||
// NOTE: Check if the ae_user is in the ae_trusted_li list
|
||||
if ($ae_app.ae_user && $ae_app.ae_trusted_li) {
|
||||
if ($ae_app.ae_trusted_li.includes($ae_app.ae_user)) {
|
||||
$ae_app.access_type = 'trusted';
|
||||
$ae_app.trusted_access = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($ae_app.administrator_access) {
|
||||
$ae_app.sponsorships.enabled = 'enabled';
|
||||
$ae_app.sponsorships.hidden = 'not_hidden';
|
||||
$ae_app.sponsorships.limit = 150;
|
||||
} else if ($ae_app.trusted_access) {
|
||||
$ae_app.sponsorships.enabled = 'enabled';
|
||||
$ae_app.sponsorships.hidden = 'not_hidden';
|
||||
$ae_app.sponsorships.limit = 75;
|
||||
} else {
|
||||
$ae_app.sponsorships.enabled = 'enabled';
|
||||
$ae_app.sponsorships.hidden = 'not_hidden';
|
||||
$ae_app.sponsorships.limit = 25;
|
||||
}
|
||||
|
||||
let ae_sponsorship_obj_li_get_promise;
|
||||
let ae_sponsorship_obj_get_promise;
|
||||
let data_store_obj_get_promise;
|
||||
let get_ds_sponsorships_info_promise = handle_get_data_store_obj_w_code({code: 'sponsorships_info'});
|
||||
let get_ds_sponsorships_options_promise = handle_get_data_store_obj_w_code({code: 'sponsorships_options'});
|
||||
|
||||
if (account_id) {
|
||||
$slct.account_id = account_id;
|
||||
handle_load_ae_sponsorship_obj_li({account_id: $slct.account_id, try_cache: false});
|
||||
}
|
||||
|
||||
// NOTE: This if sponsorship_id is not fully ready yet -2023-09-08
|
||||
if (sponsorship_id) {
|
||||
console.log(`Selected Sponsorship ID: ${sponsorship_id}`);
|
||||
$slct.sponsorship_id = sponsorship_id;
|
||||
$slct_trigger = 'load__sponsorship_obj';
|
||||
|
||||
// handle_load_sponsorship_id_obj({sponsorship_id: $slct.sponsorship_id, try_cache: false});
|
||||
|
||||
// // Auto show the selected Sponsorship ID
|
||||
// // Set the URL param "sponsorship_id" to the current Sponsorship ID. This is a just in case.
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.set('sponsorship_id', $slct.sponsorship_id);
|
||||
// history.pushState({}, '', url);
|
||||
|
||||
// let message = {'sponsorship_id': $slct.sponsorship_id};
|
||||
// window.parent.postMessage(message, "*");
|
||||
|
||||
$ae_app.sponsorships.show_main__options = true;
|
||||
$ae_app.sponsorships.show_list__sponsorship_obj_li = true;
|
||||
$ae_app.sponsorships.show_view__sponsorship_obj = true;
|
||||
$ae_app.sponsorships.show_edit__sponsorship_obj = false;
|
||||
}
|
||||
|
||||
if (!$ae_app.client_content) {
|
||||
$ae_app.client_content = {};
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** OSIT - AE Sponsorships: Main');
|
||||
|
||||
document.getElementById('meeting_fulltext_search_qry_str').focus();
|
||||
|
||||
$ae_session.test.sponsorships = 'Hello World!';
|
||||
$ae_session.test.general = 'Hello world from Sponsorships!';
|
||||
console.log('ae_session:', $ae_session);
|
||||
});
|
||||
|
||||
|
||||
$: if ($ae_app.iframe_height && $ae_app.iframe_height_modal_body) {
|
||||
console.log('getting new dimensions for iframe:', $ae_app.iframe_height, $ae_app.iframe_height_modal_body);
|
||||
|
||||
let iframe_height = 0;
|
||||
|
||||
if ($ae_app.iframe_height > $ae_app.iframe_height_modal_body) {
|
||||
iframe_height = $ae_app.iframe_height;
|
||||
} else {
|
||||
iframe_height = $ae_app.iframe_height_modal_body;
|
||||
|
||||
// console.log($ae_app.modal_dimensions);
|
||||
|
||||
if ($ae_app.modal_dimensions && $ae_app.modal_dimensions.header_height) {
|
||||
iframe_height = iframe_height + $ae_app.modal_dimensions.header_height;
|
||||
}
|
||||
if ($ae_app.modal_dimensions && $ae_app.modal_dimensions.footer_height) {
|
||||
iframe_height = iframe_height + $ae_app.modal_dimensions.footer_height;
|
||||
}
|
||||
// iframe_height = iframe_height + 50; // Just in case
|
||||
}
|
||||
|
||||
console.log(`Suggested new iframe_height: ${iframe_height}`);
|
||||
window.parent.postMessage({'iframe_height': iframe_height}, "*"); // This should be in pixels
|
||||
} else if ($ae_app.iframe_height) {
|
||||
console.log('setting new iframe_height:', $ae_app.iframe_height);
|
||||
|
||||
// let iframe_height = $ae_app.iframe_height;
|
||||
|
||||
window.parent.postMessage({'iframe_height': $ae_app.iframe_height}, "*"); // This should be in pixels
|
||||
}
|
||||
|
||||
|
||||
$: if ($slct_trigger == 'load__sponsorship_obj_li' && $slct.account_id) {
|
||||
if ($ae_app.sponsorships.qry_status == 'loading') {
|
||||
console.log('*** $ae_app.sponsorships.qry_status == loading ***');
|
||||
|
||||
setTimeout(() => {
|
||||
console.log("Delayed for X second.");
|
||||
$slct_trigger = null;
|
||||
handle_load_ae_sponsorship_obj_li({account_id: $slct.account_id, try_cache: false});
|
||||
}, 250);
|
||||
} else {
|
||||
console.log('*** $ae_app.sponsorships.qry_status != loading ***');
|
||||
$slct_trigger = null;
|
||||
handle_load_ae_sponsorship_obj_li({account_id: $slct.account_id, try_cache: false});
|
||||
}
|
||||
}
|
||||
|
||||
async function handle_load_ae_sponsorship_obj_li({account_id, try_cache=true}) {
|
||||
console.log('*** handle_load_ae_sponsorship_obj_li() ***');
|
||||
console.log($ae_app.sponsorships);
|
||||
|
||||
let fulltext_search_qry_str = $ae_app.sponsorships.fulltext_search_qry_str;
|
||||
let qry_virtual = $ae_app.sponsorships.qry_virtual;
|
||||
let qry_physical = $ae_app.sponsorships.qry_physical;
|
||||
let qry_type = $ae_app.sponsorships.qry_type;
|
||||
|
||||
let enabled = $ae_app.sponsorships.enabled;
|
||||
let hidden = $ae_app.sponsorships.hidden;
|
||||
let limit = $ae_app.sponsorships.limit;
|
||||
let offset = $ae_app.sponsorships.offset;
|
||||
|
||||
let params = {};
|
||||
// params['archived'] = 'all';
|
||||
// params['conference'] = false;
|
||||
// params['inc_address'] = true;
|
||||
// params['inc_contact'] = true;
|
||||
|
||||
let params_json: key_val = {};
|
||||
// if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) {
|
||||
// params_json['ft_qry'] = {
|
||||
// 'default_qry_str': fulltext_search_qry_str,
|
||||
// 'location_address_json': fulltext_search_qry_str,
|
||||
// 'contact_li_json': fulltext_search_qry_str,
|
||||
// 'address_default_qry_str': fulltext_search_qry_str, // NOTE: Remove after going live with OSIT ae?
|
||||
// 'contact_1_default_qry_str': fulltext_search_qry_str, // NOTE: Remove after going live with OSIT ae?
|
||||
// };
|
||||
// }
|
||||
|
||||
// if (qry_virtual || qry_physical || qry_type) {
|
||||
// params_json['and_qry'] = {};
|
||||
// if (qry_virtual) params_json['and_qry']['virtual'] = true;
|
||||
// if (qry_physical) params_json['and_qry']['physical'] = true;
|
||||
// if (qry_type) params_json['and_qry']['type'] = qry_type;
|
||||
// }
|
||||
|
||||
// console.log('params_json:', params_json);
|
||||
// console.log(params_json);
|
||||
|
||||
// NOTE: I am not sure if this is actually needed. It may save a little space in the URL.
|
||||
// if (JSON.stringify(params_json) == JSON.stringify({})) {
|
||||
// params_json = null;
|
||||
// }
|
||||
$ae_app.sponsorships.qry_status = 'loading';
|
||||
ae_sponsorship_obj_li_get_promise = api.get_ae_obj_li_for_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'sponsorship',
|
||||
for_obj_type: 'account',
|
||||
for_obj_id: account_id,
|
||||
use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config.
|
||||
use_alt_base: false, // NOTE: This will use the base_name_alt value instead of the base_name value in the API config.
|
||||
enabled: enabled,
|
||||
hidden: hidden,
|
||||
order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC'},
|
||||
// order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'created_on': 'DESC', 'updated_on': 'DESC'},
|
||||
limit: limit,
|
||||
offset: offset,
|
||||
params_json: params_json,
|
||||
params: params,
|
||||
log_lvl: 2
|
||||
})
|
||||
|
||||
.then(function (sponsorship_obj_li_get_result) {
|
||||
if (sponsorship_obj_li_get_result) {
|
||||
$slct.sponsorship_obj_li = sponsorship_obj_li_get_result;
|
||||
console.log(`Sponsorship list:`, $slct.sponsorship_obj_li);
|
||||
} else {
|
||||
$slct.sponsorship_obj_li = [];
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
})
|
||||
.finally(function () {
|
||||
$ae_app.sponsorships.qry_status = 'done';
|
||||
});
|
||||
|
||||
return ae_sponsorship_obj_li_get_promise;
|
||||
}
|
||||
|
||||
|
||||
$: if ($slct_trigger == 'load__sponsorship_obj' && $slct.sponsorship_id) {
|
||||
$slct_trigger = null;
|
||||
|
||||
handle_load_sponsorship_id_obj({sponsorship_id: $slct.sponsorship_id, try_cache: false});
|
||||
|
||||
// Auto show the selected Sponsorship ID
|
||||
// Is this pushState needed here?
|
||||
// Set the URL param "sponsorship_id" to the current Sponsorship ID. This is a just in case.
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.set('sponsorship_id', $slct.sponsorship_id);
|
||||
// history.pushState({}, '', url);
|
||||
|
||||
// Is this postMessage needed here?
|
||||
// let message = {'sponsorship_id': $slct.sponsorship_id};
|
||||
// window.parent.postMessage(message, "*");
|
||||
|
||||
// $ae_app.sponsorships.show_main__options = false;
|
||||
// $ae_app.sponsorships.show_list__sponsorship_obj_li = false;
|
||||
// $ae_app.sponsorships.show_view__sponsorship_obj = true;
|
||||
// $ae_app.sponsorships.show_edit__sponsorship_obj = false;
|
||||
}
|
||||
|
||||
async function handle_load_sponsorship_id_obj({sponsorship_id, try_cache=false}) {
|
||||
console.log('*** handle_load_sponsorship_id_obj() ***');
|
||||
|
||||
// let enabled = $ae_app.sponsorships.enabled;
|
||||
// let hidden = $ae_app.sponsorships.hidden;
|
||||
// let limit = $ae_app.sponsorships.limit;
|
||||
// let offset = $ae_app.sponsorships.offset;
|
||||
|
||||
let params = {};
|
||||
|
||||
ae_sponsorship_obj_get_promise = api.get_ae_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'event',
|
||||
obj_id: sponsorship_id,
|
||||
use_alt_table: true, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config.
|
||||
use_alt_base: true, // NOTE: This will use the base_name_alt value instead of the base_name value in the API config.
|
||||
params: params,
|
||||
log_lvl: 0
|
||||
})
|
||||
.then(function (sponsorship_obj_get_result) {
|
||||
if (sponsorship_obj_get_result) {
|
||||
$slct.sponsorship_obj = sponsorship_obj_get_result;
|
||||
console.log(`Sponsorship object:`, $slct.sponsorship_obj);
|
||||
}
|
||||
|
||||
// Auto show the selected Sponsorship ID
|
||||
// Is this pushState needed here?
|
||||
// Set the URL param "sponsorship_id" to the current Sponsorship ID.
|
||||
const url = new URL(location);
|
||||
url.searchParams.set('sponsorship_id', $slct.sponsorship_id);
|
||||
history.pushState({}, '', url);
|
||||
|
||||
// Is this postMessage needed here?
|
||||
let message = {'sponsorship_id': $slct.sponsorship_id};
|
||||
window.parent.postMessage(message, "*");
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
|
||||
return ae_sponsorship_obj_get_promise;
|
||||
}
|
||||
|
||||
function handle_created_sponsorship_obj(event) {
|
||||
console.log('*** handle_created_sponsorship_obj() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
handle_load_sponsorship_id_obj({sponsorship_id: $slct.sponsorship_id, try_cache: false});
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.set('sponsorship_id', $slct.sponsorship_id);
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {'sponsorship_id': $slct.sponsorship_id};
|
||||
window.parent.postMessage(message, "*");
|
||||
|
||||
// $slct_trigger = 'load__sponsorship_obj';
|
||||
$slct_trigger = 'load__sponsorship_obj_li';
|
||||
|
||||
$ae_app.sponsorships.show_main__options = false;
|
||||
$ae_app.sponsorships.show_list__sponsorship_obj_li = false;
|
||||
$ae_app.sponsorships.show_view__sponsorship_obj = true;
|
||||
$ae_app.sponsorships.show_edit__sponsorship_obj = false;
|
||||
}
|
||||
|
||||
function handle_updated_sponsorship_obj(event) {
|
||||
console.log('*** handle_updated_sponsorship_obj() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
// $slct_trigger = 'load__sponsorship_obj';
|
||||
$slct_trigger = 'load__sponsorship_obj_li';
|
||||
|
||||
$ae_app.sponsorships.show_main__options = false;
|
||||
$ae_app.sponsorships.show_list__sponsorship_obj_li = false;
|
||||
$ae_app.sponsorships.show_view__sponsorship_obj = true;
|
||||
$ae_app.sponsorships.show_edit__sponsorship_obj = false;
|
||||
}
|
||||
|
||||
function handle_deleted_sponsorship_obj(event) {
|
||||
console.log('*** handle_deleted_sponsorship_obj() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete('sponsorship_id');
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {'sponsorship_id': null};
|
||||
window.parent.postMessage(message, "*");
|
||||
|
||||
$slct_trigger = 'load__sponsorship_obj_li';
|
||||
|
||||
$ae_app.sponsorships.show_main__options = true;
|
||||
$ae_app.sponsorships.show_list__sponsorship_obj_li = true;
|
||||
$ae_app.sponsorships.show_view__sponsorship_obj = false;
|
||||
$ae_app.sponsorships.show_edit__sponsorship_obj = false;
|
||||
}
|
||||
|
||||
|
||||
function handle_submit_form(event) {
|
||||
console.log('*** handle_submit_form() ***');
|
||||
console.log(event);
|
||||
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
return false;
|
||||
}
|
||||
function handle_cancel_form(event) {
|
||||
console.log('*** handle_cancel_form() ***');
|
||||
console.log(event);
|
||||
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function handle_oninput_fulltext_search_qry_str(event) {
|
||||
console.log('*** handle_oninput_fulltext_search_qry_str() ***');
|
||||
console.log(event);
|
||||
|
||||
// Check if this variable is a promise. The last query may still be being processed.
|
||||
// if (!ae_sponsorship_obj_li_get_promise.promise) {
|
||||
// console.log('*** handle_oninput_fulltext_search_qry_str() ***');
|
||||
// console.log('*** Promise is still processing. ***');
|
||||
// console.log(ae_sponsorship_obj_li_get_promise);
|
||||
// ae_sponsorship_obj_li_get_promise.promise.finally(() => { ae_sponsorship_obj_li_get_promise.promise.done = true; });
|
||||
// } else {
|
||||
// $slct_trigger = 'load__sponsorship_obj_li';
|
||||
// }
|
||||
// if (ae_sponsorship_obj_li_get_promise && ae_sponsorship_obj_li_get_promise.then) {
|
||||
// console.log('*** handle_oninput_fulltext_search_qry_str() ***');
|
||||
// console.log('*** Promise is still processing. ***');
|
||||
// console.log(ae_sponsorship_obj_li_get_promise);
|
||||
// $slct_trigger = 'load__sponsorship_obj_li';
|
||||
// return;
|
||||
// }
|
||||
|
||||
// fulltext_search_qry_str = event.target.value;
|
||||
|
||||
// if ($ae_app.sponsorships.fulltext_search_qry_str.length > 2) {
|
||||
// } else {
|
||||
// $ae_app.sponsorships.fulltext_search_qry_str = '';
|
||||
// }
|
||||
$slct_trigger = 'load__sponsorship_obj_li';
|
||||
}
|
||||
|
||||
async function handle_get_data_store_obj_w_code({code, data_type='text'}) {
|
||||
console.log('*** handle_get_data_store_obj_w_code() ***');
|
||||
|
||||
let get_item_result = window.localStorage.getItem(code);
|
||||
if (get_item_result) {
|
||||
$ae_app.sponsorships.ds[code] = get_item_result;
|
||||
} else {
|
||||
console.log('Get local storage item miss.');
|
||||
}
|
||||
|
||||
data_store_obj_get_promise = api.get_data_store_obj_w_code({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
data_store_code: code,
|
||||
data_type: data_type,
|
||||
log_lvl: 1
|
||||
})
|
||||
.then(function (get_data_store_result) {
|
||||
if (get_data_store_result) {
|
||||
|
||||
if (data_type == 'text') {
|
||||
// console.log(get_data_store_result.text);
|
||||
$ae_app.sponsorships.ds[code] = get_data_store_result.text;
|
||||
} else if (data_type == 'json') {
|
||||
// console.log(get_data_store_result.json);
|
||||
$ae_app.sponsorships.ds[code] = get_data_store_result.json;
|
||||
}
|
||||
|
||||
// console.log(`Code: ${$ae_app.sponsorships.ds[code]}`);
|
||||
// console.log(`Code:`, $ae_app.sponsorships.ds[code]);
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- <svelte:window
|
||||
bind:outerHeight={ae_iframe_height}
|
||||
/> -->
|
||||
|
||||
|
||||
<section id="osit_ae_sponsorships" class="osit_sponsorships ae_main c_ae c_ae_sponsorships ae_main" bind:clientHeight={$ae_app.iframe_height}>
|
||||
<header>
|
||||
<h1>Sponsorships for One Sky IT Demo</h1>
|
||||
</header>
|
||||
|
||||
<section class="ae_section ae_meta">
|
||||
<p>
|
||||
ae: {($ae_app.ae_full_name ? $ae_app.ae_full_name : 'Name not set')}
|
||||
<span class="details">
|
||||
(
|
||||
{($ae_app.ae_email ? $ae_app.ae_email : 'Email not set')}
|
||||
{#if $ae_app.administrator_access}
|
||||
<span class="access_type administrator_access">Administrator</span>
|
||||
{:else if $ae_app.trusted_access}
|
||||
<span class="access_type trusted_access">Trusted</span>
|
||||
{/if}
|
||||
<span class="ae_user">{$ae_app.ae_user ? $ae_app.ae_user : 'User not set'}</span>
|
||||
)
|
||||
</span>
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<div class="ae_overview">
|
||||
<div class="ae_info ds__sponsorships_info ">
|
||||
{@html $ae_app.sponsorships.ds.sponsorships_info}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if $ae_app.sponsorships.show_main__options}
|
||||
<section class="ae_section ae_options ae_column sponsorship_obj__options">
|
||||
<div class="ae_note ds__sponsorships_options ">
|
||||
{@html $ae_app.sponsorships.ds.sponsorships_options}
|
||||
</div>
|
||||
|
||||
<div class="filters_and_search">
|
||||
|
||||
|
||||
|
||||
<form on:submit|preventDefault={handle_submit_form} on:keydown={e => e.key === 'Escape' && handle_cancel_form} class="search_form">
|
||||
<div class="ae_group">
|
||||
<input
|
||||
type="search"
|
||||
placeholder="Search (name, description, etc.)"
|
||||
id="meeting_fulltext_search_qry_str"
|
||||
name="fulltext_search_qry_str"
|
||||
bind:value={$ae_app.sponsorships.fulltext_search_qry_str}
|
||||
style="width: 50%;"
|
||||
class="bs-input"
|
||||
>
|
||||
<button
|
||||
on:click={handle_oninput_fulltext_search_qry_str}
|
||||
>
|
||||
<span class="fas fa-search"></span> Search
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<fieldset>
|
||||
<legend>Filter on?</legend>
|
||||
<div class="ae_row ae_flex_justify_around ae_width_md">
|
||||
<label>Paid
|
||||
<input
|
||||
name="qry_paid"
|
||||
type="checkbox"
|
||||
bind:checked={$ae_app.sponsorships.qry_paid}
|
||||
on:change={() => {$slct_trigger = 'load__sponsorship_obj_li';}}
|
||||
>
|
||||
</label>
|
||||
<label>Guests
|
||||
<input
|
||||
name="qry_guest_li"
|
||||
type="checkbox"
|
||||
bind:checked={$ae_app.sponsorships.qry_guest_li}
|
||||
on:change={() => {$slct_trigger = 'load__sponsorship_obj_li';}}
|
||||
>
|
||||
</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Select level?</legend>
|
||||
<div class="ae_row ae_flex_justify_around ae_width_100">
|
||||
<label>All
|
||||
<input
|
||||
name="qry_type"
|
||||
type="radio"
|
||||
value=""
|
||||
bind:group={$ae_app.sponsorships.qry_type}
|
||||
on:change={() => {$slct_trigger = 'load__sponsorship_obj_li';}}
|
||||
title="Show all meeting types"
|
||||
>
|
||||
</label>
|
||||
<label>Friend ($5,000)
|
||||
<input
|
||||
name="qry_type"
|
||||
type="radio"
|
||||
value="Friend"
|
||||
bind:group={$ae_app.sponsorships.qry_type}
|
||||
on:change={() => {$slct_trigger = 'load__sponsorship_obj_li';}}
|
||||
title="Friend ($5,000)"
|
||||
>
|
||||
</label>
|
||||
<label>Supporter ($7,500)
|
||||
<input
|
||||
name="qry_type"
|
||||
type="radio"
|
||||
value="Supporter"
|
||||
bind:group={$ae_app.sponsorships.qry_type}
|
||||
on:change={() => {$slct_trigger = 'load__sponsorship_obj_li';}}
|
||||
title="Supporter ($7,500)"
|
||||
>
|
||||
</label>
|
||||
<label>Champion ($12,500)
|
||||
<input
|
||||
name="qry_type"
|
||||
type="radio"
|
||||
value="Champion"
|
||||
bind:group={$ae_app.sponsorships.qry_type}
|
||||
on:change={() => {$slct_trigger = 'load__sponsorship_obj_li';}}
|
||||
title="Champion ($12,500)"
|
||||
>
|
||||
</label>
|
||||
<label>Advocate ($20,000)
|
||||
<input
|
||||
name="qry_type"
|
||||
type="radio"
|
||||
value="Advocate"
|
||||
bind:group={$ae_app.sponsorships.qry_type}
|
||||
on:change={() => {$slct_trigger = 'load__sponsorship_obj_li';}}
|
||||
title="Advocate ($20,000)"
|
||||
>
|
||||
</label>
|
||||
<label>Presenting Partner ($30,000)
|
||||
<input
|
||||
name="qry_type"
|
||||
type="radio"
|
||||
value="Presenting Partner"
|
||||
bind:group={$ae_app.sponsorships.qry_type}
|
||||
on:change={() => {$slct_trigger = 'load__sponsorship_obj_li';}}
|
||||
title="Presenting Partner ($30,000)"
|
||||
>
|
||||
</label>
|
||||
<label>Signature Partner ($50,000)
|
||||
<input
|
||||
name="qry_type"
|
||||
type="radio"
|
||||
value="Signature Partner"
|
||||
bind:group={$ae_app.sponsorships.qry_type}
|
||||
on:change={() => {$slct_trigger = 'load__sponsorship_obj_li';}}
|
||||
title="Signature Partner ($50,000)"
|
||||
>
|
||||
</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
</form>
|
||||
|
||||
{#await ae_sponsorship_obj_li_get_promise}
|
||||
<div><span class="fas fa-spinner"></span>
|
||||
Loading sponsorships...</div>
|
||||
{:then ae_sponsorship_obj_li_get_result}
|
||||
<!-- <p>Sponsorship list: {ae_sponsorship_obj_li_get_result}</p> -->
|
||||
{:catch error}
|
||||
<div>Error: {error.message}</div>
|
||||
{/await}
|
||||
|
||||
<div class="ae_group ae_row">
|
||||
|
||||
{#if $ae_app.trusted_access && $ae_app.sponsorships.hidden == 'not_hidden'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.sponsorships.hidden = 'all';
|
||||
$ae_app.sponsorships.limit = 150;
|
||||
$slct_trigger = 'load__sponsorship_obj_li';
|
||||
}}
|
||||
class="btn_show_bb_post ae_btn btn btn-info"
|
||||
>
|
||||
<span class="fas fa-eye"></span> Show Hidden Sponsorships
|
||||
</button>
|
||||
{:else if $ae_app.trusted_access && $ae_app.sponsorships.hidden == 'all'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.sponsorships.hidden = 'not_hidden';
|
||||
$slct_trigger = 'load__sponsorship_obj_li';
|
||||
}}
|
||||
class="btn_hide_bb_post ae_btn btn btn-info"
|
||||
>
|
||||
<span class="fas fa-eye-slash"></span> Hide Hidden Sponsorships
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
{#if $ae_app.administrator_access && $ae_app.sponsorships.enabled == 'enabled'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.sponsorships.hidden = 'all';
|
||||
$ae_app.sponsorships.enabled = 'all';
|
||||
$ae_app.sponsorships.limit = 500;
|
||||
$slct_trigger = 'load__sponsorship_obj_li';
|
||||
}}
|
||||
class="btn_show_bb_post ae_btn btn btn-warning"
|
||||
>
|
||||
<span class="fas fa-eye"></span> Show Disabled Sponsorships
|
||||
</button>
|
||||
{:else if $ae_app.administrator_access && $ae_app.sponsorships.enabled == 'all'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.sponsorships.enabled = 'enabled';
|
||||
$slct_trigger = 'load__sponsorship_obj_li';
|
||||
}}
|
||||
class="btn_hide_bb_post ae_btn btn btn-warning"
|
||||
>
|
||||
<span class="fas fa-eye-slash"></span> Hide Disabled Sponsorships
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
<button
|
||||
on:click={() => {
|
||||
$slct.sponsorship_id = null;
|
||||
$slct.sponsorship_obj = {};
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete('sponsorship_id');
|
||||
history.pushState({}, '', url);
|
||||
|
||||
$ae_app.sponsorships.show_main__options = false;
|
||||
$ae_app.sponsorships.show_list__sponsorship_obj_li = false;
|
||||
$ae_app.sponsorships.show_view__sponsorship_obj = false;
|
||||
$ae_app.sponsorships.show_edit__sponsorship_obj = true;
|
||||
|
||||
$ae_session.test.sponsorships = 'Hello World! Create new Sponsorship was clicked!';
|
||||
$ae_session.test_xyz.sponsorships = 'Hello World! Create new Sponsorship was clicked!';
|
||||
}}
|
||||
class="btn_new_recovery_meeting ae_btn btn btn-secondary"
|
||||
>
|
||||
<span class="fas fa-plus"></span> Create new Sponsorship
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div> <!-- END: div filters_and_search -->
|
||||
|
||||
</section>
|
||||
{/if}
|
||||
|
||||
|
||||
{#if $slct.sponsorship_obj_li && $ae_app.sponsorships.show_list__sponsorship_obj_li}
|
||||
<List_sponsorship_obj />
|
||||
{/if}
|
||||
|
||||
|
||||
{#if $ae_app.sponsorships.show_edit__sponsorship_obj}
|
||||
<!-- <section class="ae_edit sponsorship_obj sponsorship_id ae_sponsorship_id_edit"> -->
|
||||
<Element_modal_v3
|
||||
show = { true }
|
||||
modal_cover_body = { false }
|
||||
report_client_dimensions = { true }
|
||||
on:close={ () => {
|
||||
$ae_app.sponsorships.show_main__options = true;
|
||||
$ae_app.sponsorships.show_list__sponsorship_obj_li = true;
|
||||
$ae_app.sponsorships.show_edit__sponsorship_obj = false;
|
||||
$ae_app.sponsorships.show_view__sponsorship_obj = false;
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete('sponsorship_id');
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {'sponsorship_id': null};
|
||||
window.parent.postMessage(message, "*");
|
||||
}}
|
||||
on:report__modal_dimensions={ (event) => {
|
||||
console.log('*** on:report__modal_dimensions ***');
|
||||
console.log(event.detail);
|
||||
|
||||
$ae_app.modal_dimensions = event.detail.modal_dimensions;
|
||||
}}
|
||||
>
|
||||
<span slot="header_title">{@html ($slct.sponsorship_obj.name ? $slct.sponsorship_obj.name : 'New Sponsorship')}</span>
|
||||
|
||||
<span slot="body">
|
||||
|
||||
<Edit_sponsorship_obj
|
||||
on:created__meeting_obj={handle_created_sponsorship_obj}
|
||||
on:updated__meeting_obj={handle_updated_sponsorship_obj}
|
||||
on:deleted__meeting_obj={handle_deleted_sponsorship_obj}
|
||||
/>
|
||||
|
||||
</span>
|
||||
</Element_modal_v3>
|
||||
<!-- </section> -->
|
||||
{/if}
|
||||
|
||||
|
||||
{#if $ae_app.sponsorships.show_view__sponsorship_obj && $slct.sponsorship_obj}
|
||||
<!-- <section class="ae_view sponsorship_obj sponsorship_id ae_sponsorship_id_view"> -->
|
||||
<Element_modal_v3
|
||||
show = { true }
|
||||
modal_cover_body = { false }
|
||||
report_client_dimensions = { true }
|
||||
on:close={ () => {
|
||||
$slct.sponsorship_id = null;
|
||||
$slct.sponsorship_obj = {};
|
||||
|
||||
$ae_app.sponsorships.show_main__options = true;
|
||||
$ae_app.sponsorships.show_list__sponsorship_obj_li = true;
|
||||
$ae_app.sponsorships.show_view__sponsorship_obj = false;
|
||||
$ae_app.sponsorships.show_edit__sponsorship_obj = false;
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete('sponsorship_id');
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {'sponsorship_id': null};
|
||||
window.parent.postMessage(message, "*");
|
||||
}}
|
||||
on:report__modal_dimensions={ (event) => {
|
||||
console.log('*** on:report__modal_dimensions ***');
|
||||
console.log(event.detail);
|
||||
|
||||
$ae_app.modal_dimensions = event.detail.modal_dimensions;
|
||||
}}
|
||||
>
|
||||
<span slot="header_title">{@html $slct.sponsorship_obj.name}</span>
|
||||
|
||||
<span slot="body">
|
||||
|
||||
<View_sponsorship_obj />
|
||||
|
||||
</span>
|
||||
</Element_modal_v3>
|
||||
<!-- </section> -->
|
||||
{/if}
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<style>
|
||||
|
||||
|
||||
/* .ae_meta {
|
||||
font-size: smaller;
|
||||
color: hsla(0,0%,50%,1);
|
||||
} */
|
||||
|
||||
/* .ae_edit.sponsorship_obj {
|
||||
border: dashed thin hsla(0,0%,70%,1);
|
||||
|
||||
margin: .5em .25em;
|
||||
padding: .5em .25em;
|
||||
|
||||
background-color: hsla(0,0%,90%,1);
|
||||
} */
|
||||
|
||||
/* .ae_view.sponsorship_obj {
|
||||
border: dashed thin hsla(0,0%,70%,1);
|
||||
|
||||
margin: .5em .25em;
|
||||
padding: .5em .25em;
|
||||
|
||||
background-color: hsla(0,0%,90%,1);
|
||||
} */
|
||||
|
||||
/* :global(.ae_edit.sponsorship_id .element_ae_modal) {
|
||||
border: dashed thin hsla(0,0%,70%,1);
|
||||
|
||||
margin: .5em .25em;
|
||||
padding: .5em .25em;
|
||||
|
||||
background-color: hsla(0,0%,90%,1);
|
||||
} */
|
||||
|
||||
</style>
|
||||
706
src/10_edit__archive_content_obj.svelte
Normal file
706
src/10_edit__archive_content_obj.svelte
Normal file
@@ -0,0 +1,706 @@
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher, onDestroy, onMount } from 'svelte';
|
||||
import { fade } from 'svelte/transition';
|
||||
|
||||
import { ae, api, Element_input, Element_input_file_hashing } from 'aether_npm_lib';
|
||||
import { slct, ae_app } from './stores';
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
type key_val = {
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
$ae_app.archives.input_file_list = []
|
||||
|
||||
let create_archive_content_obj_promise: any;
|
||||
let delete_archive_content_obj_promise: any;
|
||||
let update_archive_content_obj_promise: any;
|
||||
let upload__hosted_file_obj_promise: any;
|
||||
|
||||
let disable_submit_btn = true;
|
||||
|
||||
if ($slct.archive_content_id) {
|
||||
console.log(`Archive Content ID selected: ${$slct.archive_content_id}`);
|
||||
console.log(`Archive Content Object selected: ${$slct.archive_content_obj}`)
|
||||
} else {
|
||||
$slct.archive_content_id = null;
|
||||
$slct.archive_content_obj = {
|
||||
archive_id_random: null,
|
||||
// archive_content_id_random: null,
|
||||
archive_content_type: null,
|
||||
name: null,
|
||||
description: null,
|
||||
content_html: null,
|
||||
// hosted_file_id_random: null,
|
||||
file_path: null,
|
||||
filename: null,
|
||||
file_extension: null,
|
||||
original_datetime: null,
|
||||
original_timezone: null,
|
||||
original_location: null,
|
||||
original_url: null,
|
||||
original_url_text: null,
|
||||
access_key: null, // or passcode?
|
||||
|
||||
enable: true,
|
||||
hide: false,
|
||||
priority: null,
|
||||
sort: null,
|
||||
notes: null,
|
||||
};
|
||||
console.log(`Archive Content Object started: ${$slct.archive_content_obj}`)
|
||||
}
|
||||
|
||||
|
||||
if ($slct.archive_content_obj) {
|
||||
|
||||
} else {
|
||||
console.log(`Archive Content Object started: ${$slct.archive_content_obj}`)
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** Edit - Archive Content Obj');
|
||||
|
||||
tinymce_remove(); // This seems to fix rendering issues
|
||||
tinymce_init();
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
console.log('** Component Destroyed: ** Edit - Event Obj');
|
||||
tinymce_remove(); // This seems like the right thing to do
|
||||
});
|
||||
|
||||
|
||||
// let ae_iframe_height = window.outerHeight;
|
||||
let ae_iframe_height = window.innerHeight;
|
||||
console.log(`ae_iframe_height: ${ae_iframe_height}`);
|
||||
$: if (ae_iframe_height) {
|
||||
console.log('ae_iframe_height changed:', ae_iframe_height);
|
||||
|
||||
let iframe_height = ae_iframe_height; // TESTING!!!
|
||||
|
||||
// window.parent.postMessage({'iframe_height': `${iframe_height}px`}, "*");
|
||||
window.parent.postMessage({'iframe_height': iframe_height}, "*");
|
||||
}
|
||||
|
||||
|
||||
$: if ($slct.archive_content_obj) {
|
||||
console.log('Selected archive_content object changed?');
|
||||
console.log($slct.archive_content_obj);
|
||||
|
||||
if ($slct.archive_content_obj == null) {
|
||||
$slct.archive_content_obj = {title: null, content: null, name: null, description: null, notes: null, created_on: null, updated_on: null};
|
||||
} else {
|
||||
disable_submit_btn = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function handle_submit_form(event) {
|
||||
console.log('*** handle_submit_form() ***');
|
||||
|
||||
disable_submit_btn = true;
|
||||
|
||||
let form_data = new FormData(event.target);
|
||||
console.log(form_data);
|
||||
|
||||
let form_archive_content_data = ae.util.extract_prefixed_form_data({prefix: null, form_data: form_data, trim_values: true, bool_tf_str: true, log_lvl: 0});
|
||||
console.log(form_archive_content_data);
|
||||
|
||||
let archive_content_data: key_val = {};
|
||||
|
||||
if (!$slct.archive_content_id) {
|
||||
archive_content_data['account_id_random'] = $ae_app.account_id;
|
||||
archive_content_data['archive_id_random'] = $slct.archive_id;
|
||||
// archive_content_data['enable'] = true;
|
||||
}
|
||||
|
||||
archive_content_data['name'] = form_archive_content_data.name;
|
||||
if (tinyMCE.get('description')) {
|
||||
archive_content_data['description'] = tinyMCE.get('description').getContent();
|
||||
} else {
|
||||
archive_content_data['description'] = form_archive_content_data.description;
|
||||
}
|
||||
|
||||
if (tinyMCE.get('content_html')) {
|
||||
archive_content_data['content_html'] = tinyMCE.get('content_html').getContent();
|
||||
} else {
|
||||
archive_content_data['content_html'] = form_archive_content_data.content_html;
|
||||
}
|
||||
|
||||
if (form_archive_content_data.archive_content_type) {
|
||||
archive_content_data['archive_content_type'] = form_archive_content_data.archive_content_type;
|
||||
} else {
|
||||
archive_content_data['archive_content_type'] = null;
|
||||
}
|
||||
|
||||
archive_content_data['enable_for_public'] = !!!form_archive_content_data.enable_for_public;
|
||||
|
||||
archive_content_data['file_path'] = form_archive_content_data.file_path;
|
||||
archive_content_data['filename'] = form_archive_content_data.filename.trim();
|
||||
archive_content_data['file_extension'] = form_archive_content_data.file_extension.trim();
|
||||
|
||||
let date_time_str = null;
|
||||
let date_part = form_archive_content_data.original_datetime_date.trim();
|
||||
let time_part = form_archive_content_data.original_datetime_time.trim();
|
||||
if (date_part && time_part) {
|
||||
date_time_str = `${date_part} ${time_part}`;
|
||||
} else if (date_part) {
|
||||
date_time_str = `${date_part}T00:00:00`;
|
||||
} else if (time_part) {
|
||||
// date_time_str = `${time_part}`;
|
||||
date_time_str = false;
|
||||
}
|
||||
archive_content_data['original_datetime'] = date_time_str;
|
||||
|
||||
archive_content_data['original_timezone'] = form_archive_content_data.original_timezone;
|
||||
|
||||
archive_content_data['original_location'] = form_archive_content_data.original_location;
|
||||
|
||||
archive_content_data['hide'] = !!form_archive_content_data.hide;
|
||||
archive_content_data['priority'] = !!form_archive_content_data.priority;
|
||||
if (form_archive_content_data.sort) {
|
||||
// Change this to a number type
|
||||
archive_content_data['sort'] = Number(form_archive_content_data.sort);
|
||||
} else {
|
||||
archive_content_data['sort'] = null;
|
||||
}
|
||||
if (form_archive_content_data.group) {
|
||||
archive_content_data['group'] = form_archive_content_data.group;
|
||||
} else {
|
||||
archive_content_data['group'] = null;
|
||||
}
|
||||
if (archive_content_data['enable']) {
|
||||
archive_content_data['enable'] = !!form_archive_content_data.enable;
|
||||
}
|
||||
|
||||
if (tinyMCE.get('notes')) {
|
||||
archive_content_data['notes'] = tinyMCE.get('notes').getContent();
|
||||
} else {
|
||||
archive_content_data['notes'] = form_archive_content_data.notes;
|
||||
}
|
||||
|
||||
console.log(archive_content_data);
|
||||
|
||||
if (!$slct.archive_content_id) {
|
||||
create_archive_content_obj_promise = api.create_ae_obj_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'archive_content',
|
||||
fields: archive_content_data,
|
||||
key: $ae_app.ae_api.api_crud_super_key,
|
||||
log_lvl: 1
|
||||
})
|
||||
.then(async function (archive_content_obj_create_result) {
|
||||
if (!archive_content_obj_create_result) {
|
||||
console.log('The result was null or false.');
|
||||
return false;
|
||||
}
|
||||
|
||||
$slct.archive_content_id = archive_content_obj_create_result.obj_id_random;
|
||||
|
||||
// Get ready to upload the file now that we have a new archive_content_id.
|
||||
const form_data = new FormData();
|
||||
|
||||
form_data.append('account_id', $ae_app.account_id);
|
||||
form_data.append('link_to_type', 'archive_content');
|
||||
form_data.append('link_to_id', $slct.archive_content_id);
|
||||
|
||||
for (let i = 0; i < event.target.file_list.files.length; i++) {
|
||||
form_data.append(`file_list`, event.target.archive_content_file_upload_list.files[i]);
|
||||
}
|
||||
|
||||
let params = null;
|
||||
|
||||
let endpoint = '/hosted_file/upload_files';
|
||||
|
||||
console.log(form_data);
|
||||
|
||||
params = null;
|
||||
|
||||
// Uncomment and the post_promise is not seen by the "await" below
|
||||
// post_promise = await api.post_object({api_cfg: $cfg.api, endpoint: endpoint, params: params, data:form_data});
|
||||
// Uncomment so that the post_promise is not seen by the "await" below
|
||||
upload__hosted_file_obj_promise = await api.post_object({api_cfg: $ae_app.ae_api, endpoint: endpoint, params: params, form_data: form_data});
|
||||
console.log(upload__hosted_file_obj_promise);
|
||||
let hosted_file_id = upload__hosted_file_obj_promise[0].hosted_file_id_random;
|
||||
|
||||
archive_content_data = {};
|
||||
archive_content_data['hosted_file_id_random'] = hosted_file_id;
|
||||
archive_content_data['file_path'] = `/hosted_file/download/${hosted_file_id}?filename=${form_archive_content_data.filename.trim()}`;
|
||||
archive_content_data['archive_content_type'] = 'hosted_file';
|
||||
|
||||
update_archive_content_obj_promise = await api.update_ae_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'archive_content',
|
||||
obj_id: $slct.archive_content_id,
|
||||
fields: archive_content_data,
|
||||
key: $ae_app.ae_api.api_crud_super_key,
|
||||
log_lvl: 1
|
||||
})
|
||||
.then(function (archive_content_obj_update_result) {
|
||||
if (!archive_content_obj_update_result) {
|
||||
console.log('The result was null or false.');
|
||||
return false;
|
||||
}
|
||||
return archive_content_obj_update_result;
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('Something went wrong.');
|
||||
console.log(error);
|
||||
return false;
|
||||
});
|
||||
|
||||
// update_archive_content_obj_promise = await update_archive_content_obj({archive_content_id: $slct.archive_content_id, data: archive_content_data})
|
||||
// console.log(update_archive_content_obj_promise);
|
||||
return update_archive_content_obj_promise
|
||||
})
|
||||
.then(function (archive_content_obj_create_result) {
|
||||
|
||||
dispatch(
|
||||
'created__archive_content_obj',
|
||||
{
|
||||
archive_content_id: $slct.archive_content_id,
|
||||
}
|
||||
);
|
||||
|
||||
return archive_content_obj_create_result;
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('Something went wrong.');
|
||||
console.log(error);
|
||||
return false;
|
||||
});
|
||||
|
||||
return create_archive_content_obj_promise;
|
||||
|
||||
} else {
|
||||
update_archive_content_obj_promise = api.update_ae_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'archive_content',
|
||||
obj_id: $slct.archive_content_id,
|
||||
fields: archive_content_data,
|
||||
key: $ae_app.ae_api.api_crud_super_key,
|
||||
log_lvl: 1
|
||||
})
|
||||
.then(function (archive_content_obj_update_result) {
|
||||
if (!archive_content_obj_update_result) {
|
||||
console.log('The result was null or false.');
|
||||
return false;
|
||||
}
|
||||
|
||||
dispatch(
|
||||
'updated__archive_content_obj',
|
||||
{
|
||||
archive_content_id: $slct.archive_content_id,
|
||||
}
|
||||
);
|
||||
|
||||
return archive_content_obj_update_result;
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('Something went wrong.');
|
||||
console.log(error);
|
||||
return false;
|
||||
});
|
||||
|
||||
return update_archive_content_obj_promise;
|
||||
}
|
||||
}
|
||||
|
||||
function handle_input_file_list_updated(event) {
|
||||
console.log(event.detail.element_id);
|
||||
console.log(event.detail.input_file_list);
|
||||
console.log(event.detail.input_file_list_processed);
|
||||
|
||||
// This now needs be reviewed and possibly updated with additional information. Check if any files have already been uploaded in the past and ignore.
|
||||
let new_upload_list = event.detail.input_file_list_processed;
|
||||
$ae_app.archives.input_file_list = new_upload_list;
|
||||
// Setting the first file as the default. For now other files are ignored?
|
||||
if (new_upload_list.length) {
|
||||
$ae_app.archives.input_filename = new_upload_list[0].filename;
|
||||
$ae_app.archives.input_file_extension = new_upload_list[0].guessed_extension;
|
||||
} else {
|
||||
$ae_app.archives.input_filename = '';
|
||||
$ae_app.archives.input_file_extension = '';
|
||||
}
|
||||
|
||||
// for (let file_upload_item of new_upload_list) {
|
||||
// console.log(file_upload_item);
|
||||
|
||||
// filename = file_upload_item.filename;
|
||||
// file_extension = file_upload_item.guessed_extension;
|
||||
// }
|
||||
}
|
||||
|
||||
$ae_app.archives.form_file_upload_list = [];
|
||||
|
||||
async function handle_delete_archive_content_obj({archive_content_id, hosted_file_id=null, method='delete'}) {
|
||||
console.log('*** handle_delete_archive_content_obj() ***');
|
||||
|
||||
if (hosted_file_id) {
|
||||
let delete_hosted_file_obj_promise = api.delete_hosted_file({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
hosted_file_id: hosted_file_id,
|
||||
link_to_type: 'archive_content',
|
||||
link_to_id: archive_content_id,
|
||||
rm_orphan: true,
|
||||
// params: params,
|
||||
key: $ae_app.ae_api.api_crud_super_key,
|
||||
log_lvl: 2
|
||||
})
|
||||
.then(function (hosted_file_obj_delete_result) {
|
||||
if (hosted_file_obj_delete_result) {
|
||||
// console.log(`Result:`, hosted_file_obj_delete_result);
|
||||
|
||||
dispatch(
|
||||
'deleted__hosted_file_obj',
|
||||
{
|
||||
hosted_file_id: hosted_file_id,
|
||||
}
|
||||
);
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('The result was null or false when trying to delete.', error);
|
||||
});
|
||||
}
|
||||
|
||||
delete_archive_content_obj_promise = api.delete_ae_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'archive_content',
|
||||
obj_id: archive_content_id,
|
||||
method: method,
|
||||
// params: params,
|
||||
key: $ae_app.ae_api.api_crud_super_key,
|
||||
log_lvl: 0
|
||||
})
|
||||
.then(function (archive_content_obj_delete_result) {
|
||||
if (archive_content_obj_delete_result) {
|
||||
// console.log(`Result:`, archive_content_obj_delete_result);
|
||||
|
||||
dispatch(
|
||||
'deleted__archive_content_obj',
|
||||
{
|
||||
archive_content_id: archive_content_id,
|
||||
}
|
||||
);
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('The result was null or false when trying to delete.', error);
|
||||
});
|
||||
|
||||
return delete_archive_content_obj_promise;
|
||||
}
|
||||
|
||||
function tinymce_init() {
|
||||
// REFERENCE: https://www.tiny.cloud/docs/tinymce/6/basic-setup/
|
||||
// plugins: [
|
||||
// 'advlist', 'autolink', 'link', 'image', 'lists', 'charmap', 'preview', 'anchor', 'pagebreak',
|
||||
// 'searchreplace', 'wordcount', 'visualblocks', 'visualchars', 'code', 'fullscreen', 'insertdatetime',
|
||||
// 'media', 'table', 'emoticons', 'template', 'help'
|
||||
// ],
|
||||
// 'undo redo | styles | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent'
|
||||
|
||||
// NOTE: Regular version of the TinyMCE editor
|
||||
tinymce.init({
|
||||
selector: '.tinymce_editor.editor_regular',
|
||||
// width: 600,
|
||||
height: 400,
|
||||
plugins: [ 'advlist', 'autolink', 'link', 'lists', 'anchor', 'code', 'help' ],
|
||||
menubar: false,
|
||||
toolbar: 'undo redo | styles | bold italic | alignleft aligncenter alignright | bullist numlist outdent indent | link | code | help',
|
||||
});
|
||||
|
||||
// NOTE: Basic version of the TinyMCE editor
|
||||
tinymce.init({
|
||||
selector: '.tinymce_editor.editor_basic',
|
||||
// width: 600,
|
||||
height: 400,
|
||||
plugins: [ 'lists', 'code', 'help' ],
|
||||
menubar: false,
|
||||
toolbar: 'undo redo | styles | bold italic | alignleft aligncenter | bullist numlist outdent indent | code | help',
|
||||
});
|
||||
|
||||
// NOTE: Minimal version of the TinyMCE editor
|
||||
tinymce.init({
|
||||
selector: '.tinymce_editor.editor_basic_200',
|
||||
// width: 600,
|
||||
height: 200,
|
||||
plugins: [ 'lists', 'code', 'help' ],
|
||||
menubar: false,
|
||||
toolbar: 'undo redo | styles | bold italic | alignleft aligncenter | bullist numlist outdent indent | code | help',
|
||||
});
|
||||
|
||||
// NOTE: Less is more version of the TinyMCE editor
|
||||
tinymce.init({
|
||||
selector: '.tinymce_editor.editor_less_100',
|
||||
// width: 600,
|
||||
height: 100,
|
||||
// plugins: [ 'lists', 'code', 'help' ],
|
||||
menubar: false,
|
||||
toolbar: false,
|
||||
statusbar: false,
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function tinymce_remove() {
|
||||
tinymce.remove('.tinymce_editor.editor_regular');
|
||||
tinymce.remove('.tinymce_editor.editor_basic');
|
||||
tinymce.remove('.tinymce_editor.editor_basic_200');
|
||||
tinymce.remove('.tinymce_editor.editor_less_100');
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<section
|
||||
class="svelte_component ae_edit archive_content_obj"
|
||||
class:ae_create={!$slct.archive_content_id}
|
||||
>
|
||||
<!-- bind:clientHeight={ae_iframe_height} -->
|
||||
|
||||
<form on:submit|preventDefault={handle_submit_form} class="">
|
||||
|
||||
{#await update_archive_content_obj_promise}
|
||||
<div class="awaiting alert_msg_pulse" out:fade={{ duration: 2000 }}>Saving...</div>
|
||||
{:then}
|
||||
{#if update_archive_content_obj_promise}
|
||||
<div class="awaiting" out:fade={{ duration: 2000 }}>Finished saving</div>
|
||||
{:else}
|
||||
<!-- <div class="awaiting" out:fade={{ duration: 2000 }}>Nothing here yet</div> -->
|
||||
{/if}
|
||||
{/await}
|
||||
|
||||
<h3>Archive Content</h3>
|
||||
|
||||
<label for="title">Name of Content
|
||||
<input type="text" id="name" name="name" required max="200" value={$slct.archive_content_obj.name ? $slct.archive_content_obj.name : '' } placeholder="Content name">
|
||||
</label>
|
||||
|
||||
<label for="description">Description
|
||||
<textarea id="description" name="description" rows="6" cols="80" value={$slct.archive_content_obj.description ? $slct.archive_content_obj.description : ''} class="ae_value archive_content__description tinymce_editor editor_basic_200"></textarea>
|
||||
</label>
|
||||
|
||||
<label for="content_html">Content (HTML)
|
||||
<textarea id="content_html" name="content_html" rows="6" cols="80" value={$slct.archive_content_obj.content_html ? $slct.archive_content_obj.content_html : ''} class="ae_value archive_content__content_html tinymce_editor editor_regular"></textarea>
|
||||
</label>
|
||||
|
||||
<label for="archive_content_type">Type
|
||||
<select id="archive_content_type" name="archive_content_type" value={$slct.archive_content_obj.archive_content_type}>
|
||||
<option value="">-- None --</option>
|
||||
<option value="hosted_file">Hosted File in Æ</option>
|
||||
<option value="html">Hosted HTML in Æ</option>
|
||||
<option value="json">Hosted JSON in Æ</option>
|
||||
<option value="url">External URL</option>
|
||||
<option value="other">Other</option>
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<fieldset class="">
|
||||
<legend class="">Public Access with Rotating Access Key/Passcode</legend>
|
||||
<label for="enable_for_public_no" class="">No, disable public access
|
||||
<input
|
||||
type="radio"
|
||||
class=""
|
||||
id="enable_for_public_no"
|
||||
name="enable_for_public"
|
||||
value={false}
|
||||
bind:group={$slct.archive_content_obj.enable_for_public}
|
||||
>
|
||||
<!-- <input type="radio" class="" id="enable_for_public_no" name="enable_for_public" value="0" checked={(!$slct.archive_content_obj.enable_for_public)} required> -->
|
||||
</label>
|
||||
<label for="enable_for_public_yes" class="">Yes, allow public access
|
||||
<input
|
||||
type="radio"
|
||||
class=""
|
||||
id="enable_for_public_yes"
|
||||
name="enable_for_public"
|
||||
value={true}
|
||||
bind:group={$slct.archive_content_obj.enable_for_public}
|
||||
>
|
||||
<!-- <input type="radio" class="" id="enable_for_public_yes" name="enable_for_public" value="1" checked={($slct.archive_content_obj.enable_for_public)} required > -->
|
||||
</label>
|
||||
</fieldset>
|
||||
|
||||
|
||||
<h3>File?</h3>
|
||||
{#if !$slct.archive_content_id}
|
||||
<Element_input_file_hashing
|
||||
multiple = {false}
|
||||
required = {true}
|
||||
accept = {''}
|
||||
element_id = {'archive_content_file_upload_list'}
|
||||
|
||||
on:input_file_list_updated = {handle_input_file_list_updated}
|
||||
use_selected_file_table={true}
|
||||
/>
|
||||
<!-- bind:input_file_list = {$ae_app.archives.form_file_upload_list} -->
|
||||
{/if}
|
||||
|
||||
<label for="file_path">File Path
|
||||
{#if !$ae_app.administrator_access}
|
||||
<span class="fas fa-lock" title="Field is locked"></span>
|
||||
{:else}
|
||||
<span class="fas fa-unlock" title="Field is unlocked"></span>
|
||||
{/if}
|
||||
<input
|
||||
type="text"
|
||||
id="file_path"
|
||||
name="file_path"
|
||||
value={($slct.archive_content_obj.file_path ? $slct.archive_content_obj.file_path : '')}
|
||||
readonly={!$ae_app.administrator_access}
|
||||
>
|
||||
</label>
|
||||
|
||||
<label for="filename">Filename
|
||||
<input type="text" id="filename" name="filename" value={($slct.archive_content_obj.filename ? $slct.archive_content_obj.filename : $ae_app.archives.input_filename)}>
|
||||
</label>
|
||||
|
||||
<label for="file_extension">File Extension
|
||||
{#if !$ae_app.administrator_access}
|
||||
<span class="fas fa-lock" title="Field is locked"></span>
|
||||
{:else}
|
||||
<span class="fas fa-unlock" title="Field is unlocked"></span>
|
||||
{/if}
|
||||
<input
|
||||
type="text"
|
||||
id="file_extension"
|
||||
name="file_extension"
|
||||
value={($slct.archive_content_obj.file_extension ? $slct.archive_content_obj.file_extension : $ae_app.archives.input_file_extension)}
|
||||
readonly={!$ae_app.administrator_access}
|
||||
>
|
||||
</label>
|
||||
|
||||
<h3>Original</h3>
|
||||
<label for="original_datetime">Original Date/Time
|
||||
<input type="date" id="original_datetime_date" name="original_datetime_date" value={($slct.archive_content_obj.original_datetime ? ae.util.iso_datetime_formatter($slct.archive_content_obj.original_datetime,'date_iso') : '')} placeholder="YYYY-MM-DD">
|
||||
<input type="time" id="original_datetime_time" name="original_datetime_time" value={($slct.archive_content_obj.original_datetime ? ae.util.iso_datetime_formatter($slct.archive_content_obj.original_datetime,'time_iso') : '')} placeholder="HH:MM AM/PM">
|
||||
</label>
|
||||
|
||||
<fieldset class="flex_row flex_gap_md flex_justify_around">
|
||||
<label for="original_timezone">Original Timezone
|
||||
{#if $ae_app.lu_time_zone_list}
|
||||
<select name="original_timezone" id="original_timezone" required>
|
||||
{#each $ae_app.lu_time_zone_list as lu_timezone}
|
||||
<option value="{lu_timezone.name}" selected={((($slct.archive_content_obj.original_timezone && lu_timezone.name == $slct.archive_content_obj.original_timezone) || lu_timezone.name == $ae_app.current_timezone) ? 'selected' : '')}>{lu_timezone.name}</option>
|
||||
{/each}
|
||||
</select>
|
||||
{:else}
|
||||
<input type="text" name="timezone" value={($slct.archive_content_obj.original_timezone ? $slct.archive_content_obj.original_timezone : $ae_app.current_timezone)} />
|
||||
{/if}
|
||||
</label>
|
||||
</fieldset>
|
||||
|
||||
<!-- <label for="original_timezone">Original Timezone
|
||||
<input type="text" id="original_timezone" name="original_timezone" value={$slct.archive_content_obj.original_timezone} list="timezones">
|
||||
<datalist id="timezones">
|
||||
<option value="UTC">UTC</option>
|
||||
<option value="America/New_York">America/New York</option>
|
||||
<option value="America/Chicago">America/Chicago</option>
|
||||
<option value="America/Denver">America/Denver</option>
|
||||
<option value="America/Phoenix">America/Phoenix</option>
|
||||
<option value="America/Los_Angeles">America/Los Angeles</option>
|
||||
<option value="America/Anchorage">America/Anchorage</option>
|
||||
<option value="America/Adak">America/Adak</option>
|
||||
<option value="Pacific/Honolulu">Pacific/Honolulu</option>
|
||||
<option value="Pacific/Midway">Pacific/Midway</option>
|
||||
<option value="US/Eastern">US/Eastern</option>
|
||||
<option value="US/Central">US/Central</option>
|
||||
<option value="US/Mountain">US/Mountain</option>
|
||||
<option value="US/Pacific">US/Pacific</option>
|
||||
<option value="US/Alaska">US/Alaska</option>
|
||||
<option value="US/Hawaii">US/Hawaii</option>
|
||||
<option value="US/Samoa">US/Samoa</option>
|
||||
<option value="US/Aleutian">US/Aleutian</option>
|
||||
<option value="US/Arizona">US/Arizona</option>
|
||||
<option value="US/Michigan">US/Michigan</option>
|
||||
</datalist>
|
||||
</label> -->
|
||||
|
||||
<label for="original_location">Original Location
|
||||
<input type="text" id="original_location" name="original_location" value={$slct.archive_content_obj.original_location}>
|
||||
</label>
|
||||
|
||||
|
||||
{#if $ae_app.trusted_access}
|
||||
<section class="ae_section archive_content__admin_options"> <!-- BEGIN: section archive_content__admin_options -->
|
||||
|
||||
<h3>
|
||||
Admin Options
|
||||
<button type="button" class="ae_btn ae_smallest ae_d_none_toggle ae_float_right btn btn-xs btn-info" on:click={() => {document.querySelector('.ae_d_none_content').classList.toggle('ae_d_none');}}><span class="fas fa-eye"></span> Show/Hide Admin</button>
|
||||
</h3>
|
||||
|
||||
<span class="ae_d_none_content ae_d_none">
|
||||
<label>Hide
|
||||
<input
|
||||
type="checkbox"
|
||||
name="hide"
|
||||
id="hide"
|
||||
bind:checked={$slct.archive_content_obj.hide}
|
||||
>
|
||||
<!-- <input type="checkbox" name="hide" value={$slct.archive_content_obj.hide} /> -->
|
||||
</label>
|
||||
|
||||
<label>Priority
|
||||
<input
|
||||
type="checkbox"
|
||||
name="priority"
|
||||
id="priority"
|
||||
bind:checked={$slct.archive_content_obj.priority}
|
||||
>
|
||||
<!-- <input type="checkbox" name="priority" value={$slct.archive_content_obj.priority} /> -->
|
||||
</label>
|
||||
|
||||
<label>Sort <input type="number" name="sort" value={$slct.archive_content_obj.sort} /></label>
|
||||
|
||||
<label>Group <input type="text" name="group" value={$slct.archive_content_obj.group} max="100" /></label>
|
||||
|
||||
{#if $ae_app.administrator_access}
|
||||
<label>Enable
|
||||
<input
|
||||
type="checkbox"
|
||||
name="enable"
|
||||
id="enable"
|
||||
bind:checked={$slct.archive_content_obj.enable}
|
||||
>
|
||||
<!-- <input type="checkbox" name="enable" value={$slct.archive_content_obj.enable} checked={$slct.archive_content_obj.enable} /> -->
|
||||
</label>
|
||||
{/if}
|
||||
|
||||
<label>Internal Staff Notes
|
||||
<textarea id="notes" name="notes" class="ae_value archive_content__notes tinymce_editor editor_basic_200" rows="2" cols="70" value={$slct.archive_content_obj.notes}></textarea>
|
||||
</label>
|
||||
|
||||
</span> <!-- END: span ae_show_hide_content -->
|
||||
|
||||
</section> <!-- END: section archive_content__admin_options -->
|
||||
{/if}
|
||||
|
||||
|
||||
<section class="ae_section ae_options ae_row">
|
||||
<button type="submit" class="ae_btn btn btn-primary"><span class="fas fa-check"></span> Save Archive Content</button>
|
||||
|
||||
{#if $slct.archive_content_id}
|
||||
<button
|
||||
on:click={() => {
|
||||
if (!confirm('Are you sure you want to delete this archive content?')) {return false;}
|
||||
handle_delete_archive_content_obj({archive_content_id: $slct.archive_content_id, hosted_file_id: $slct.archive_content_obj.hosted_file_id_random});
|
||||
|
||||
$slct.archive_content_id = null;
|
||||
$slct.archive_content_obj = {};
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-danger" type="button">
|
||||
<span class="fas fa-minus"></span> Delete
|
||||
</button>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
</form>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<style>
|
||||
</style>
|
||||
588
src/10_edit__archive_obj.svelte
Normal file
588
src/10_edit__archive_obj.svelte
Normal file
@@ -0,0 +1,588 @@
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher, onDestroy, onMount } from 'svelte';
|
||||
import { fade } from 'svelte/transition';
|
||||
|
||||
import { ae, api, Element_input } from 'aether_npm_lib';
|
||||
import { slct, ae_app } from './stores';
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
type key_val = {
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
let create_archive_obj_promise: any;
|
||||
let delete_archive_obj_promise: any;
|
||||
let update_archive_obj_promise: any;
|
||||
|
||||
let disable_submit_btn = true;
|
||||
|
||||
if ($slct.archive_id) {
|
||||
console.log(`Archive ID selected: ${$slct.archive_id}`);
|
||||
console.log(`Archive Object selected: ${$slct.archive_obj}`)
|
||||
} else {
|
||||
$slct.archive_id = null;
|
||||
$slct.archive_obj = {
|
||||
title: null,
|
||||
content: null,
|
||||
topic_id: null,
|
||||
anonymous: false,
|
||||
external_person_id: $ae_app.novi_uuid,
|
||||
full_name: $ae_app.novi_full_name,
|
||||
email: $ae_app.novi_email,
|
||||
|
||||
sort: null,
|
||||
notes: null,
|
||||
};
|
||||
console.log(`Archive Object started: ${$slct.archive_obj}`)
|
||||
}
|
||||
|
||||
|
||||
if ($slct.archive_obj) {
|
||||
|
||||
} else {
|
||||
// $slct.archive_obj = {name: 'null', description: 'null'};
|
||||
console.log(`Archive Object started: ${$slct.archive_obj}`)
|
||||
}
|
||||
|
||||
if ($ae_app.lu_time_zone_list && $ae_app.lu_time_zone_list.length > 0) {
|
||||
// console.log('Already have time zone list!', $ae_app.lu_time_zone_list);
|
||||
} else {
|
||||
console.log('No time zone list');
|
||||
|
||||
let lu_time_zone_li_get_promise = api.get_ae_obj_li_for_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'lu', // "lu" = a lookup table
|
||||
for_obj_type: 'time_zone',
|
||||
enabled: null,
|
||||
hidden: null,
|
||||
// order_by_li: {'name': 'ASC'},
|
||||
log_lvl: 1
|
||||
})
|
||||
|
||||
.then(function (lu_time_zone_li_get_result) {
|
||||
if (lu_time_zone_li_get_result) {
|
||||
$ae_app.lu_time_zone_list = lu_time_zone_li_get_result;
|
||||
console.log(`Time zone list:`, $ae_app.lu_time_zone_list);
|
||||
console.log($ae_app.lu_time_zone_list[0]);
|
||||
console.log($ae_app.lu_time_zone_list[10]);
|
||||
} else {
|
||||
console.log(`No time zones returned!`);
|
||||
$ae_app.lu_time_zone_list = [];
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** Edit - Event Obj');
|
||||
|
||||
tinymce_remove(); // This seems to fix rendering issues
|
||||
tinymce_init();
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
console.log('** Component Destroyed: ** Edit - Event Obj');
|
||||
tinymce_remove(); // This seems like the right thing to do
|
||||
});
|
||||
|
||||
|
||||
// let ae_iframe_height = window.outerHeight;
|
||||
let ae_iframe_height = window.innerHeight;
|
||||
console.log(`ae_iframe_height: ${ae_iframe_height}`);
|
||||
$: if (ae_iframe_height) {
|
||||
console.log('ae_iframe_height changed:', ae_iframe_height);
|
||||
|
||||
let iframe_height = ae_iframe_height; // TESTING!!!
|
||||
|
||||
// window.parent.postMessage({'iframe_height': `${iframe_height}px`}, "*");
|
||||
window.parent.postMessage({'iframe_height': iframe_height}, "*");
|
||||
}
|
||||
|
||||
|
||||
$: if ($slct.archive_obj) {
|
||||
console.log('Selected archive object changed?');
|
||||
console.log($slct.archive_obj);
|
||||
|
||||
if ($slct.archive_obj == null) {
|
||||
$slct.archive_obj = {title: null, content: null, name: null, description: null, notes: null, created_on: null, updated_on: null};
|
||||
} else {
|
||||
disable_submit_btn = false;
|
||||
}
|
||||
|
||||
// ae.input_template['event']['timezone'] = 'EDT';
|
||||
}
|
||||
|
||||
|
||||
async function handle_submit_form(event) {
|
||||
console.log('*** handle_submit_form() ***');
|
||||
|
||||
disable_submit_btn = true;
|
||||
|
||||
let form_data = new FormData(event.target);
|
||||
console.log(form_data);
|
||||
|
||||
let form_archive_data = ae.util.extract_prefixed_form_data({prefix: null, form_data: form_data, trim_values: true, bool_tf_str: true, log_lvl: 0});
|
||||
console.log(form_archive_data);
|
||||
|
||||
let archive_data: key_val = {};
|
||||
|
||||
if (!$slct.archive_id) {
|
||||
archive_data['account_id_random'] = $ae_app.account_id;
|
||||
archive_data['enable'] = true;
|
||||
}
|
||||
|
||||
archive_data['name'] = form_archive_data.name;
|
||||
if (tinyMCE.get('description')) {
|
||||
archive_data['description'] = tinyMCE.get('description').getContent();
|
||||
} else {
|
||||
archive_data['description'] = form_archive_data.description;
|
||||
}
|
||||
|
||||
if (tinyMCE.get('content_html')) {
|
||||
archive_data['content_html'] = tinyMCE.get('content_html').getContent();
|
||||
} else {
|
||||
archive_data['content_html'] = form_archive_data.content_html;
|
||||
}
|
||||
|
||||
let date_time_str = null;
|
||||
let date_part = form_archive_data.original_datetime_date.trim();
|
||||
let time_part = form_archive_data.original_datetime_time.trim();
|
||||
if (date_part && time_part) {
|
||||
date_time_str = `${date_part} ${time_part}`;
|
||||
} else if (date_part) {
|
||||
date_time_str = `${date_part}T00:00:00`;
|
||||
} else if (time_part) {
|
||||
// date_time_str = `${time_part}`;
|
||||
date_time_str = false;
|
||||
}
|
||||
archive_data['original_datetime'] = date_time_str;
|
||||
|
||||
archive_data['original_timezone'] = form_archive_data.original_timezone;
|
||||
|
||||
archive_data['original_location'] = form_archive_data.original_location;
|
||||
|
||||
archive_data['original_url'] = form_archive_data.original_url;
|
||||
archive_data['original_url_text'] = form_archive_data.original_url_text;
|
||||
|
||||
archive_data['hide'] = !!form_archive_data.hide;
|
||||
archive_data['priority'] = !!form_archive_data.priority;
|
||||
if (form_archive_data.sort) {
|
||||
archive_data['sort'] = Number(form_archive_data.sort);
|
||||
} else {
|
||||
archive_data['sort'] = null;
|
||||
}
|
||||
if (form_archive_data.group) {
|
||||
archive_data['group'] = form_archive_data.group;
|
||||
} else {
|
||||
archive_data['group'] = null;
|
||||
}
|
||||
|
||||
if (form_archive_data.enable) {
|
||||
archive_data['enable'] = !!form_archive_data.enable;
|
||||
}
|
||||
|
||||
if (tinyMCE.get('notes')) {
|
||||
archive_data['notes'] = tinyMCE.get('notes').getContent();
|
||||
} else {
|
||||
archive_data['notes'] = form_archive_data.notes;
|
||||
}
|
||||
|
||||
console.log(archive_data);
|
||||
|
||||
if (!$slct.archive_id) {
|
||||
create_archive_obj_promise = api.create_ae_obj_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'archive',
|
||||
fields: archive_data,
|
||||
key: $ae_app.ae_api.api_crud_super_key,
|
||||
log_lvl: 1
|
||||
})
|
||||
.then(function (archive_obj_create_result) {
|
||||
if (!archive_obj_create_result) {
|
||||
console.log('The result was null or false.');
|
||||
return false;
|
||||
}
|
||||
|
||||
$slct.archive_id = archive_obj_create_result.obj_id_random;
|
||||
|
||||
dispatch(
|
||||
'created__archive_obj',
|
||||
{
|
||||
archive_id: $slct.archive_id,
|
||||
}
|
||||
);
|
||||
|
||||
return archive_obj_create_result;
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('Something went wrong.');
|
||||
console.log(error);
|
||||
return false;
|
||||
});
|
||||
|
||||
return create_archive_obj_promise;
|
||||
|
||||
} else {
|
||||
update_archive_obj_promise = api.update_ae_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'archive',
|
||||
obj_id: $slct.archive_id,
|
||||
fields: archive_data,
|
||||
key: $ae_app.ae_api.api_crud_super_key,
|
||||
log_lvl: 1
|
||||
})
|
||||
.then(function (archive_obj_update_result) {
|
||||
if (!archive_obj_update_result) {
|
||||
console.log('The result was null or false.');
|
||||
return false;
|
||||
}
|
||||
|
||||
dispatch(
|
||||
'updated__archive_obj',
|
||||
{
|
||||
archive_id: $slct.archive_id,
|
||||
}
|
||||
);
|
||||
|
||||
return archive_obj_update_result;
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('Something went wrong.');
|
||||
console.log(error);
|
||||
return false;
|
||||
});
|
||||
|
||||
return update_archive_obj_promise;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function handle_delete_archive_obj({archive_id, method='delete'}) {
|
||||
console.log('*** handle_delete_archive_obj() ***');
|
||||
|
||||
delete_archive_obj_promise = api.delete_ae_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'archive',
|
||||
obj_id: archive_id,
|
||||
method: method,
|
||||
// params: params,
|
||||
key: $ae_app.ae_api.api_crud_super_key,
|
||||
log_lvl: 0
|
||||
})
|
||||
.then(function (archive_obj_delete_result) {
|
||||
if (archive_obj_delete_result) {
|
||||
// console.log(`Result:`, archive_obj_delete_result);
|
||||
|
||||
dispatch(
|
||||
'deleted__archive_obj',
|
||||
{
|
||||
archive_id: archive_id,
|
||||
}
|
||||
);
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('The result was null or false when trying to delete.', error);
|
||||
});
|
||||
|
||||
return delete_archive_obj_promise;
|
||||
}
|
||||
|
||||
function tinymce_init() {
|
||||
// REFERENCE: https://www.tiny.cloud/docs/tinymce/6/basic-setup/
|
||||
// plugins: [
|
||||
// 'advlist', 'autolink', 'link', 'image', 'lists', 'charmap', 'preview', 'anchor', 'pagebreak',
|
||||
// 'searchreplace', 'wordcount', 'visualblocks', 'visualchars', 'code', 'fullscreen', 'insertdatetime',
|
||||
// 'media', 'table', 'emoticons', 'template', 'help'
|
||||
// ],
|
||||
// 'undo redo | styles | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent'
|
||||
|
||||
// NOTE: Regular version of the TinyMCE editor
|
||||
tinymce.init({
|
||||
selector: '.tinymce_editor.editor_regular',
|
||||
// width: 600,
|
||||
height: 400,
|
||||
plugins: [ 'advlist', 'autolink', 'link', 'lists', 'anchor', 'code', 'help' ],
|
||||
menubar: false,
|
||||
toolbar: 'undo redo | styles | bold italic | alignleft aligncenter alignright | bullist numlist outdent indent | link | code | help',
|
||||
});
|
||||
|
||||
// NOTE: Basic version of the TinyMCE editor
|
||||
tinymce.init({
|
||||
selector: '.tinymce_editor.editor_basic',
|
||||
// width: 600,
|
||||
height: 400,
|
||||
plugins: [ 'lists', 'code', 'help' ],
|
||||
menubar: false,
|
||||
toolbar: 'undo redo | styles | bold italic | alignleft aligncenter | bullist numlist outdent indent | code | help',
|
||||
});
|
||||
|
||||
// NOTE: Minimal version of the TinyMCE editor
|
||||
tinymce.init({
|
||||
selector: '.tinymce_editor.editor_basic_200',
|
||||
// width: 600,
|
||||
height: 200,
|
||||
plugins: [ 'lists', 'code', 'help' ],
|
||||
menubar: false,
|
||||
toolbar: 'undo redo | styles | bold italic | alignleft aligncenter | bullist numlist outdent indent | code | help',
|
||||
});
|
||||
|
||||
// NOTE: Less is more version of the TinyMCE editor
|
||||
tinymce.init({
|
||||
selector: '.tinymce_editor.editor_less_100',
|
||||
// width: 600,
|
||||
height: 100,
|
||||
// plugins: [ 'lists', 'code', 'help' ],
|
||||
menubar: false,
|
||||
toolbar: false,
|
||||
statusbar: false,
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function tinymce_remove() {
|
||||
tinymce.remove('.tinymce_editor.editor_regular');
|
||||
tinymce.remove('.tinymce_editor.editor_basic');
|
||||
tinymce.remove('.tinymce_editor.editor_basic_200');
|
||||
tinymce.remove('.tinymce_editor.editor_less_100');
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<section
|
||||
class="svelte_component ae_edit archive_obj"
|
||||
class:ae_create={!$slct.archive_id}
|
||||
bind:clientHeight={$ae_app.iframe_height_modal_body}
|
||||
>
|
||||
|
||||
<form on:submit|preventDefault={handle_submit_form} class="">
|
||||
|
||||
{#await update_archive_obj_promise}
|
||||
<div class="awaiting alert_msg_pulse" out:fade={{ duration: 2000 }}>Saving...</div>
|
||||
{:then}
|
||||
{#if update_archive_obj_promise}
|
||||
<div class="awaiting" out:fade={{ duration: 2000 }}>Finished saving</div>
|
||||
{:else}
|
||||
<!-- <div class="awaiting" out:fade={{ duration: 2000 }}>Nothing here yet</div> -->
|
||||
{/if}
|
||||
{/await}
|
||||
|
||||
<h3>Archive</h3>
|
||||
|
||||
<label for="name">Name of Archive
|
||||
<input type="text" id="name" name="name" required max="20" value={$slct.archive_obj.name ? $slct.archive_obj.name : 'Testing!' } placeholder="Name of Archive">
|
||||
</label>
|
||||
|
||||
<label for="description">Description
|
||||
<textarea id="description" name="description" rows="6" cols="80" value={$slct.archive_obj.description ? $slct.archive_obj.description : ''} class="ae_value archive__description tinymce_editor editor_basic_200"></textarea>
|
||||
</label>
|
||||
|
||||
<label for="content_html">Content (HTML)
|
||||
<textarea id="content_html" name="content_html" rows="6" cols="80" value={$slct.archive_obj.content_html ? $slct.archive_obj.content_html : ''} class="ae_value archive__content_html tinymce_editor editor_regular"></textarea>
|
||||
</label>
|
||||
|
||||
<h3>Original</h3>
|
||||
<label for="original_datetime">Original Date/Time
|
||||
<input type="date" id="original_datetime_date" name="original_datetime_date" value={($slct.archive_obj.original_datetime ? ae.util.iso_datetime_formatter($slct.archive_obj.original_datetime,'date_iso') : '')} placeholder="YYYY-MM-DD">
|
||||
<input type="time" id="original_datetime_time" name="original_datetime_time" value={($slct.archive_obj.original_datetime ? ae.util.iso_datetime_formatter($slct.archive_obj.original_datetime,'time_iso') : '')} placeholder="HH:MM AM/PM">
|
||||
</label>
|
||||
|
||||
<fieldset class="flex_row flex_gap_md flex_justify_around">
|
||||
<label for="original_timezone">Original Timezone
|
||||
{#if $ae_app.lu_time_zone_list}
|
||||
<select name="original_timezone" id="original_timezone" required>
|
||||
{#each $ae_app.lu_time_zone_list as lu_timezone}
|
||||
<option value="{lu_timezone.name}" selected={((($slct.archive_obj.original_timezone && lu_timezone.name == $slct.archive_obj.original_timezone) || lu_timezone.name == $ae_app.current_timezone) ? 'selected' : '')}>{lu_timezone.name}</option>
|
||||
{/each}
|
||||
</select>
|
||||
{:else}
|
||||
<input type="text" name="timezone" value={($slct.archive_obj.original_timezone ? $slct.archive_obj.original_timezone : $ae_app.current_timezone)} />
|
||||
{/if}
|
||||
</label>
|
||||
</fieldset>
|
||||
|
||||
<!-- <label for="original_timezone">Original Timezone
|
||||
<input type="text" id="original_timezone" name="original_timezone" value={($slct.archive_obj.original_timezone ? $slct.archive_obj.original_timezone : $ae_app.current_timezone)} placeholder="Timezone" list="timezones">
|
||||
<datalist id="timezones">
|
||||
<option value="UTC">UTC</option>
|
||||
<option value="America/New_York">America/New York</option>
|
||||
<option value="America/Chicago">America/Chicago</option>
|
||||
<option value="America/Denver">America/Denver</option>
|
||||
<option value="America/Phoenix">America/Phoenix</option>
|
||||
<option value="America/Los_Angeles">America/Los Angeles</option>
|
||||
<option value="America/Anchorage">America/Anchorage</option>
|
||||
<option value="America/Adak">America/Adak</option>
|
||||
<option value="Pacific/Honolulu">Pacific/Honolulu</option>
|
||||
<option value="Pacific/Midway">Pacific/Midway</option>
|
||||
<option value="US/Eastern">US/Eastern</option>
|
||||
<option value="US/Central">US/Central</option>
|
||||
<option value="US/Mountain">US/Mountain</option>
|
||||
<option value="US/Pacific">US/Pacific</option>
|
||||
<option value="US/Alaska">US/Alaska</option>
|
||||
<option value="US/Hawaii">US/Hawaii</option>
|
||||
<option value="US/Samoa">US/Samoa</option>
|
||||
<option value="US/Aleutian">US/Aleutian</option>
|
||||
<option value="US/Arizona">US/Arizona</option>
|
||||
<option value="US/Michigan">US/Michigan</option>
|
||||
</datalist>
|
||||
</label> -->
|
||||
|
||||
<label for="original_location">Original Location
|
||||
<input type="text" id="original_location" name="original_location" value={($slct.archive_obj.original_location ? $slct.archive_obj.original_location : '')} placeholder="Location">
|
||||
</label>
|
||||
|
||||
<label for="original_url">Original URL
|
||||
<input type="text" id="original_url" name="original_url" max="255" value={$slct.archive_obj.original_url ? $slct.archive_obj.original_url : '' } placeholder="URL">
|
||||
</label>
|
||||
|
||||
<label for="original_url_text">Original URL Text/Title
|
||||
<input type="text" id="original_url_text" name="original_url_text" max="255" value={$slct.archive_obj.original_url_text ? $slct.archive_obj.original_url_text : '' } placeholder="URL text or title">
|
||||
</label>
|
||||
|
||||
|
||||
<!-- <label for="topic_id">BB post topic
|
||||
<select id="topic_id" name="topic_id">
|
||||
<option value="">-- None --</option>
|
||||
<option value="16">Licensing/ monitoring/ credentialing issues</option>
|
||||
<option value="17">Return to practice</option>
|
||||
<option value="18">Contacts/ sponsorship in my area</option>
|
||||
<option value="19">Professional positions</option>
|
||||
<option value="21">Announcement</option>
|
||||
</select>
|
||||
</label> -->
|
||||
|
||||
<!-- <h3>Archiveer's Information</h3>
|
||||
<fieldset class="">
|
||||
<legend class="">Archive as Anonymous</legend>
|
||||
<div class="">
|
||||
<input type="radio" class="" id="anonymous_no" name="anonymous" value="0" checked={(!$slct.archive_obj.anonymous)} required>
|
||||
<label for="anonymous_no" class="">No, include my name and email address</label>
|
||||
</div>
|
||||
<div class="">
|
||||
<input type="radio" class="" id="anonymous_yes" name="anonymous" value="1" checked={($slct.archive_obj.anonymous)} required >
|
||||
<label for="anonymous_yes" class="">Yes, the post will be listed as Anonymous</label>
|
||||
</div>
|
||||
</fieldset> -->
|
||||
|
||||
<!-- <label for="external_person_id">Your ID
|
||||
<input type="text" id="external_person_id" name="external_person_id" value={$slct.archive_obj.external_person_id} readonly>
|
||||
</label>
|
||||
|
||||
<label for="full_name">Your name
|
||||
<input type="text" id="full_name" name="full_name" value={$slct.archive_obj.full_name}>
|
||||
</label>
|
||||
|
||||
<label for="email">Your email
|
||||
<input type="text" name="email" value={$slct.archive_obj.email} readonly>
|
||||
</label> -->
|
||||
|
||||
<!-- <h3>Archiveer's Options</h3> -->
|
||||
|
||||
<!-- <fieldset class="">
|
||||
<legend class="">Official or Member Archive</legend>
|
||||
<div class="">
|
||||
<input type="radio" class="" id="group_official" name="group" value="official">
|
||||
<label for="group_official" class="">Archive as Official/Leadership</label>
|
||||
</div>
|
||||
<div class="">
|
||||
<input type="radio" class="" id="group_member" name="group" value="member" checked="">
|
||||
<label for="group_member" class="">Archive as Member</label>
|
||||
</div>
|
||||
</fieldset> -->
|
||||
|
||||
<!-- <fieldset class="">
|
||||
<legend class="">Enable Comments</legend>
|
||||
<div class="">
|
||||
<input type="radio" class="" id="enable_comments_no" name="enable_comments" value="0">
|
||||
<label for="enable_comments_no" class="">No, do not allow comments</label>
|
||||
</div>
|
||||
<div class="">
|
||||
<input type="radio" class="" id="enable_comments_yes" name="enable_comments" value="1" checked>
|
||||
<label for="enable_comments_yes" class="">Yes, allow comments</label>
|
||||
</div>
|
||||
</fieldset> -->
|
||||
|
||||
|
||||
{#if $ae_app.trusted_access}
|
||||
<section class="ae_section archive__admin_options"> <!-- BEGIN: section archive__admin_options -->
|
||||
|
||||
<h3>
|
||||
Admin Options
|
||||
<button type="button" class="ae_btn ae_d_none_toggle ae_float_right ae_smallest btn btn-xs btn-info" on:click={() => {document.querySelector('.ae_d_none_content').classList.toggle('ae_fade_out'); document.querySelector('.ae_d_none_content').classList.toggle('ae_fade_in');}}><span class="fas fa-eye"></span> Show/Hide Admin</button>
|
||||
</h3>
|
||||
|
||||
<span class="ae_d_none_content ae_fade_out">
|
||||
<label>Hide
|
||||
<input
|
||||
type="checkbox"
|
||||
name="hide"
|
||||
id="hide"
|
||||
bind:checked={$slct.archive_obj.hide}
|
||||
>
|
||||
<!-- <input type="checkbox" name="hide" value={$slct.archive_obj.hide} /> -->
|
||||
</label>
|
||||
|
||||
<label>Priority
|
||||
<input
|
||||
type="checkbox"
|
||||
name="priority"
|
||||
id="priority"
|
||||
bind:checked={$slct.archive_obj.priority}
|
||||
>
|
||||
<!-- <input type="checkbox" name="priority" value={$slct.archive_obj.priority} /> -->
|
||||
</label>
|
||||
|
||||
<label>Sort <input type="number" name="sort" value={$slct.archive_obj.sort} /></label>
|
||||
|
||||
<label>Group <input type="text" name="group" value={$slct.archive_obj.group} max="100" /></label>
|
||||
|
||||
{#if $ae_app.administrator_access}
|
||||
<label>Enable
|
||||
<input
|
||||
type="checkbox"
|
||||
name="enable"
|
||||
id="enable"
|
||||
bind:checked={$slct.archive_obj.enable}
|
||||
>
|
||||
<!-- <input type="checkbox" name="enable" value={$slct.archive_obj.enable} checked={$slct.archive_obj.enable} /> -->
|
||||
</label>
|
||||
{/if}
|
||||
|
||||
<label>Internal Staff Notes
|
||||
<textarea id="notes" name="notes" class="ae_value archive__notes tinymce_editor editor_basic_200" rows="2" cols="70" value={$slct.archive_obj.notes}></textarea>
|
||||
</label>
|
||||
|
||||
</span> <!-- END: span ae_show_hide_content -->
|
||||
|
||||
</section> <!-- END: section archive__admin_options -->
|
||||
{/if}
|
||||
|
||||
|
||||
<section class="ae_section ae_options ae_row">
|
||||
<button type="submit" class="ae_btn btn btn-primary"><span class="fas fa-check"></span> Save Archive</button>
|
||||
|
||||
{#if $slct.archive_id}
|
||||
<button
|
||||
on:click={() => {
|
||||
if (!confirm('Are you sure you want to delete this archive?')) {return false;}
|
||||
handle_delete_archive_obj({archive_id: $slct.archive_id});
|
||||
|
||||
$slct.archive_id = null;
|
||||
$slct.archive_obj = {};
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-danger" type="button">
|
||||
<span class="fas fa-minus"></span> Delete
|
||||
</button>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
</form>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<style>
|
||||
</style>
|
||||
384
src/10_edit__post_comment_obj.svelte
Normal file
384
src/10_edit__post_comment_obj.svelte
Normal file
@@ -0,0 +1,384 @@
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher, onMount } from 'svelte';
|
||||
import { fade } from 'svelte/transition';
|
||||
|
||||
import { ae, api, Element_input } from 'aether_npm_lib';
|
||||
import { slct, ae_app } from './stores';
|
||||
|
||||
export let container_class_li = [];
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
let create_post_comment_obj_promise: any;
|
||||
let delete_post_comment_obj_promise: any;
|
||||
let update_post_comment_obj_promise: any;
|
||||
|
||||
let disable_submit_btn = true;
|
||||
|
||||
if ($slct.post_comment_id) {
|
||||
console.log(`Post Comment ID selected: ${$slct.post_comment_id}`);
|
||||
console.log(`Post Comment Object selected: ${$slct.post_comment_obj}`);
|
||||
} else {
|
||||
$slct.post_comment_id = null;
|
||||
$slct.post_comment_obj = {
|
||||
title: null,
|
||||
content: null,
|
||||
anonymous: false,
|
||||
external_person_id: $ae_app.novi_uuid,
|
||||
full_name: $ae_app.novi_full_name,
|
||||
email: $ae_app.novi_email,
|
||||
|
||||
sort: null,
|
||||
// notes: null,
|
||||
};
|
||||
console.log(`Post Comment Object started: ${$slct.post_comment_obj}`);
|
||||
}
|
||||
|
||||
|
||||
if ($slct.post_comment_obj) {
|
||||
|
||||
} else {
|
||||
// $slct.post_comment_obj = {name: 'null', description: 'null'};
|
||||
console.log(`Post Comment Object started: ${$slct.post_comment_obj}`)
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** Edit - Posts Comment Obj');
|
||||
});
|
||||
|
||||
|
||||
$: if ($slct.post_comment_obj) {
|
||||
console.log('Selected post comment object changed?');
|
||||
console.log($slct.post_comment_obj);
|
||||
|
||||
if ($slct.post_comment_obj == null) {
|
||||
$slct.post_comment_obj = {title: null, content: null, name: null, description: null, notes: null, created_on: null, updated_on: null};
|
||||
} else {
|
||||
disable_submit_btn = false;
|
||||
}
|
||||
|
||||
// ae.input_template['event']['timezone'] = 'EDT';
|
||||
}
|
||||
|
||||
|
||||
async function handle_submit_form(event) {
|
||||
console.log('*** handle_submit_form() ***');
|
||||
|
||||
disable_submit_btn = true;
|
||||
|
||||
let form_data = new FormData(event.target);
|
||||
console.log(form_data);
|
||||
|
||||
let post_comment_data = ae.util.extract_prefixed_form_data({prefix: null, form_data: form_data, trim_values: true, bool_tf_str: true, log_lvl: 0});
|
||||
|
||||
if (!$slct.post_comment_id) {
|
||||
post_comment_data['post_id_random'] = $slct.post_id;
|
||||
post_comment_data['enable'] = true;
|
||||
}
|
||||
|
||||
console.log(post_comment_data);
|
||||
|
||||
if (!$slct.post_comment_id) {
|
||||
create_post_comment_obj_promise = api.create_ae_obj_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'post_comment',
|
||||
fields: post_comment_data,
|
||||
key: $ae_app.ae_api.api_crud_super_key,
|
||||
log_lvl: 1
|
||||
})
|
||||
.then(function (post_comment_obj_create_result) {
|
||||
if (!post_comment_obj_create_result) {
|
||||
console.log('The result was null or false.');
|
||||
return false;
|
||||
}
|
||||
|
||||
$slct.post_comment_id = post_comment_obj_create_result;
|
||||
|
||||
dispatch(
|
||||
'post_comment_obj_created',
|
||||
{
|
||||
post_comment_id: $slct.post_comment_id,
|
||||
}
|
||||
);
|
||||
|
||||
return post_comment_obj_create_result;
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('Something went wrong.');
|
||||
console.log(error);
|
||||
return false;
|
||||
});
|
||||
|
||||
return create_post_comment_obj_promise;
|
||||
|
||||
} else {
|
||||
update_post_comment_obj_promise = api.update_ae_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'post_comment',
|
||||
obj_id: $slct.post_comment_id,
|
||||
fields: post_comment_data,
|
||||
key: $ae_app.ae_api.api_crud_super_key,
|
||||
log_lvl: 1
|
||||
})
|
||||
.then(function (post_comment_obj_update_result) {
|
||||
if (!post_comment_obj_update_result) {
|
||||
console.log('The result was null or false.');
|
||||
return false;
|
||||
}
|
||||
|
||||
dispatch(
|
||||
'post_comment_obj_updated',
|
||||
{
|
||||
post_comment_id: $slct.post_comment_id,
|
||||
}
|
||||
);
|
||||
|
||||
return post_comment_obj_update_result;
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('Something went wrong.');
|
||||
console.log(error);
|
||||
return false;
|
||||
});
|
||||
|
||||
return update_post_comment_obj_promise;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function handle_delete_post_comment_obj({post_comment_id, method='disable'}) {
|
||||
console.log('*** handle_delete_post_comment_obj() ***');
|
||||
|
||||
delete_post_comment_obj_promise = api.delete_ae_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'post_comment',
|
||||
obj_id: post_comment_id,
|
||||
method: method,
|
||||
// params: params,
|
||||
key: $ae_app.ae_api.api_crud_super_key,
|
||||
log_lvl: 0
|
||||
})
|
||||
.then(function (post_comment_obj_delete_result) {
|
||||
if (post_comment_obj_delete_result) {
|
||||
// console.log(`Result:`, post_comment_obj_delete_result);
|
||||
|
||||
dispatch(
|
||||
'post_comment_obj_deleted',
|
||||
{
|
||||
post_comment_id: post_comment_id,
|
||||
}
|
||||
);
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('The result was null or false when trying to delete.', error);
|
||||
});
|
||||
|
||||
return delete_post_comment_obj_promise;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<section class="svelte_component ae_edit post_comment_obj {container_class_li.join(' ')}">
|
||||
|
||||
<form on:submit|preventDefault={handle_submit_form} class="">
|
||||
|
||||
{#await update_post_comment_obj_promise}
|
||||
<div class="awaiting alert_msg_pulse" out:fade={{ duration: 2000 }}>Saving...</div>
|
||||
{:then}
|
||||
{#if update_post_comment_obj_promise}
|
||||
<div class="awaiting" out:fade={{ duration: 2000 }}>Finished saving</div>
|
||||
{:else}
|
||||
<!-- <div class="awaiting" out:fade={{ duration: 2000 }}>Nothing here yet</div> -->
|
||||
{/if}
|
||||
{/await}
|
||||
|
||||
<h3>Post Comment</h3>
|
||||
|
||||
<!-- <label for="title">Title of BB post
|
||||
<input type="text" id="title" name="title" required max="20" value={$slct.post_comment_obj.title ? $slct.post_comment_obj.title : '' } placeholder="BB post title">
|
||||
</label> -->
|
||||
|
||||
<label for="content">Content (post comment body)
|
||||
<textarea id="content" name="content" required rows="6" cols="70" value={$slct.post_comment_obj.content ? $slct.post_comment_obj.content : ''} class="ae__post_comment__content"></textarea>
|
||||
</label>
|
||||
|
||||
<h3>Poster's Information</h3>
|
||||
<fieldset class="">
|
||||
<legend class="">Post as Anonymous</legend>
|
||||
<div class="">
|
||||
<input type="radio" class="" id="anonymous_no" name="anonymous" value="0" checked={(!$slct.post_comment_obj.anonymous)} required>
|
||||
<label for="anonymous_no" class="">No, include my name and email address</label>
|
||||
</div>
|
||||
<div class="">
|
||||
<input type="radio" class="" id="anonymous_yes" name="anonymous" value="1" checked={($slct.post_comment_obj.anonymous)} required >
|
||||
<label for="anonymous_yes" class="">Yes, the post will be listed as Anonymous</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
{#if $ae_app.trusted_access}
|
||||
<label for="external_person_id">Your ID
|
||||
{#if !$ae_app.trusted_access}
|
||||
<span class="fas fa-lock" title="Field is locked"></span>
|
||||
{:else}
|
||||
<span class="fas fa-unlock" title="Field is unlocked"></span>
|
||||
{/if}
|
||||
<input
|
||||
type="text"
|
||||
id="external_person_id"
|
||||
name="external_person_id"
|
||||
value={($slct.post_comment_obj.external_person_id ? $slct.post_comment_obj.external_person_id : $ae_app.novi_uuid)}
|
||||
readonly={!$ae_app.trusted_access}
|
||||
>
|
||||
<span class="ae_highlight">Primary link using the Novi API UUID</span>
|
||||
</label>
|
||||
{/if}
|
||||
|
||||
<label for="full_name">Your name
|
||||
{#if !$ae_app.trusted_access}
|
||||
<span class="fas fa-lock" title="Field is locked"></span>
|
||||
{:else}
|
||||
<span class="fas fa-unlock" title="Field is unlocked"></span>
|
||||
{/if}
|
||||
<input
|
||||
type="text"
|
||||
id="full_name"
|
||||
name="full_name"
|
||||
value={($slct.post_comment_obj.full_name ? $slct.post_comment_obj.full_name : $ae_app.novi_full_name)}
|
||||
>
|
||||
</label>
|
||||
|
||||
{#if $ae_app.trusted_access}
|
||||
<label for="email">Your email
|
||||
{#if !$ae_app.trusted_access}
|
||||
<span class="fas fa-lock" title="Field is locked"></span>
|
||||
{:else}
|
||||
<span class="fas fa-unlock" title="Field is unlocked"></span>
|
||||
{/if}
|
||||
<input
|
||||
type="text"
|
||||
name="email"
|
||||
value={($slct.post_comment_obj.email ? $slct.post_comment_obj.email : $ae_app.novi_email)}
|
||||
readonly={!$ae_app.trusted_access}
|
||||
>
|
||||
<span class="ae_highlight">Secondary link using the Novi email address</span>
|
||||
</label>
|
||||
{/if}
|
||||
|
||||
|
||||
{#if $ae_app.trusted_access}
|
||||
<section class="ae_section post_comment__admin_options"> <!-- BEGIN: section post_comment__admin_options -->
|
||||
|
||||
<h3>
|
||||
Admin Options
|
||||
<button type="button" class="ae_btn ae_d_none_toggle ae_float_right ae_smallest btn btn-xs btn-info" on:click={() => {document.querySelector('.ae_d_none_content').classList.toggle('ae_fade_out'); document.querySelector('.ae_d_none_content').classList.toggle('ae_fade_in');}}><span class="fas fa-eye"></span> Show/Hide Admin</button>
|
||||
</h3>
|
||||
|
||||
<span class="ae_d_none_content ae_fade_out">
|
||||
<label>Hide
|
||||
<input
|
||||
type="checkbox"
|
||||
name="hide"
|
||||
id="hide"
|
||||
bind:checked={$slct.post_comment_obj.hide}
|
||||
>
|
||||
</label>
|
||||
|
||||
<!-- <label>Priority
|
||||
<input
|
||||
type="checkbox"
|
||||
name="priority"
|
||||
id="priority"
|
||||
bind:checked={$slct.post_comment_obj.priority}
|
||||
>
|
||||
</label> -->
|
||||
|
||||
<!-- <label>Sort <input type="number" name="sort" value={$slct.post_comment_obj.sort} /></label> -->
|
||||
|
||||
<!-- <label>Group <input type="text" name="group" value={$slct.post_comment_obj.group} max="100" /></label> -->
|
||||
|
||||
{#if $ae_app.administrator_access}
|
||||
<label>Enable
|
||||
<input
|
||||
type="checkbox"
|
||||
name="enable"
|
||||
id="enable"
|
||||
bind:checked={$slct.post_comment_obj.enable}
|
||||
>
|
||||
</label>
|
||||
{/if}
|
||||
|
||||
<!-- {#if $ae_app.trusted_access}
|
||||
<label>Internal Staff Notes
|
||||
<textarea id="notes" name="notes" class="ae_value post__notes tinymce_editor editor_basic_200" rows="2" cols="70" value={$slct.post_comment_obj.notes}></textarea>
|
||||
</label>
|
||||
{/if} -->
|
||||
|
||||
</span> <!-- END: span ae_show_hide_content -->
|
||||
|
||||
</section> <!-- END: section post_comment__admin_options -->
|
||||
{/if}
|
||||
|
||||
|
||||
<section class="ae_section ae_options ae_row">
|
||||
<button type="submit" class="ae_btn btn btn-primary"><span class="fas fa-check"></span> Save Post Comment</button>
|
||||
|
||||
{#if $slct.post_comment_id}
|
||||
{#if $ae_app.administrator_access}
|
||||
<button
|
||||
on:click={() => {
|
||||
if (!confirm('Are you sure you want to delete this post comment?')) {return false;}
|
||||
handle_delete_post_comment_obj({post_comment_id: $slct.post_comment_id, method: 'delete'});
|
||||
|
||||
$slct.post_comment_id = null;
|
||||
$slct.post_comment_obj = {};
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-danger" type="button"
|
||||
title="Delete record permanently"
|
||||
>
|
||||
<span class="fas fa-minus"></span> Delete
|
||||
</button>
|
||||
{:else if $ae_app.trusted_access}
|
||||
<button
|
||||
on:click={() => {
|
||||
if (!confirm('Are you sure you want to disable this post comment?')) {return false;}
|
||||
handle_delete_post_comment_obj({post_comment_id: $slct.post_comment_id, method: 'disable'});
|
||||
|
||||
$slct.post_comment_id = null;
|
||||
$slct.post_comment_obj = {};
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-danger" type="button"
|
||||
title="Disable record to delete"
|
||||
>
|
||||
<span class="fas fa-minus"></span> Delete
|
||||
</button>
|
||||
{:else}
|
||||
<button
|
||||
on:click={() => {
|
||||
if (!confirm('Are you sure you want to hide this post comment?')) {return false;}
|
||||
handle_delete_post_comment_obj({post_comment_id: $slct.post_comment_id, method: 'hide'});
|
||||
|
||||
$slct.post_comment_id = null;
|
||||
$slct.post_comment_obj = {};
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-danger" type="button"
|
||||
title="Hide record to delete"
|
||||
>
|
||||
<span class="fas fa-comment-slash"></span> Delete
|
||||
</button>
|
||||
{/if}
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<style>
|
||||
.svelte_component.ae_edit {
|
||||
/* outline: dashed thin pink; */
|
||||
}
|
||||
</style>
|
||||
536
src/10_edit__post_obj.svelte
Normal file
536
src/10_edit__post_obj.svelte
Normal file
@@ -0,0 +1,536 @@
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher, onMount } from 'svelte';
|
||||
import { fade } from 'svelte/transition';
|
||||
|
||||
import { ae, api, Element_input } from 'aether_npm_lib';
|
||||
import { slct, ae_app } from './stores';
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
type key_val = {
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
let create_post_obj_promise: any;
|
||||
let delete_post_obj_promise: any;
|
||||
let update_post_obj_promise: any;
|
||||
|
||||
let disable_submit_btn = true;
|
||||
|
||||
if ($slct.post_id) {
|
||||
console.log(`Post ID selected: ${$slct.post_id}`);
|
||||
console.log(`Post Object selected: ${$slct.post_obj}`);
|
||||
|
||||
if ($slct.post_obj) {
|
||||
// if (!$slct.post_obj.external_person_id) {
|
||||
// $slct.post_obj['external_person_id'] = $ae_app.novi_uuid;
|
||||
// }
|
||||
// if (!$slct.post_obj.full_name) {
|
||||
// $slct.post_obj['full_name'] = $ae_app.novi_full_name;
|
||||
// }
|
||||
// if (!$slct.post_obj.email) {
|
||||
// $slct.post_obj['email'] = $ae_app.novi_email;
|
||||
// }
|
||||
}
|
||||
} else {
|
||||
$slct.post_id = null;
|
||||
$slct.post_obj = {
|
||||
title: null,
|
||||
content: null,
|
||||
topic_id: null,
|
||||
anonymous: false,
|
||||
external_person_id: $ae_app.novi_uuid,
|
||||
full_name: $ae_app.novi_full_name,
|
||||
email: $ae_app.novi_email,
|
||||
|
||||
sort: null,
|
||||
notes: null,
|
||||
};
|
||||
console.log(`Post Object started: ${$slct.post_obj}`);
|
||||
}
|
||||
|
||||
|
||||
if ($slct.post_obj) {
|
||||
|
||||
} else {
|
||||
// $slct.post_obj = {name: 'null', description: 'null'};
|
||||
console.log(`Post Object started: ${$slct.post_obj}`)
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** Edit - Post Obj');
|
||||
|
||||
// NOTE: Minimal version of the TinyMCE editor
|
||||
tinymce.init({
|
||||
selector: '.tinymce_editor.editor_basic_200',
|
||||
// width: 600,
|
||||
height: 200,
|
||||
plugins: [ 'lists', 'code', 'help' ],
|
||||
menubar: false,
|
||||
toolbar: 'undo redo | styles | bold italic | alignleft aligncenter | bullist numlist outdent indent | code | help',
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// let ae_iframe_height = window.outerHeight;
|
||||
let ae_iframe_height = window.innerHeight;
|
||||
console.log(`ae_iframe_height: ${ae_iframe_height}`);
|
||||
$: if (ae_iframe_height) {
|
||||
console.log('ae_iframe_height changed:', ae_iframe_height);
|
||||
|
||||
let iframe_height = ae_iframe_height; // TESTING!!!
|
||||
|
||||
// window.parent.postMessage({'iframe_height': `${iframe_height}px`}, "*");
|
||||
window.parent.postMessage({'iframe_height': iframe_height}, "*");
|
||||
}
|
||||
|
||||
|
||||
$: if ($slct.post_obj) {
|
||||
console.log('Selected post object changed?');
|
||||
console.log($slct.post_obj);
|
||||
|
||||
if ($slct.post_obj == null) {
|
||||
$slct.post_obj = {title: null, content: null, name: null, description: null, notes: null, created_on: null, updated_on: null};
|
||||
} else {
|
||||
disable_submit_btn = false;
|
||||
}
|
||||
|
||||
// ae.input_template['event']['timezone'] = 'EDT';
|
||||
}
|
||||
|
||||
|
||||
async function handle_submit_form(event) {
|
||||
console.log('*** handle_submit_form() ***');
|
||||
// console.log(event.target);
|
||||
|
||||
disable_submit_btn = true;
|
||||
|
||||
let form_data = new FormData(event.target);
|
||||
// console.log(form_data);
|
||||
|
||||
let form_post_data = ae.util.extract_prefixed_form_data({prefix: null, form_data: form_data, trim_values: true, bool_tf_str: true, log_lvl: 2});
|
||||
// console.log(form_post_data);
|
||||
|
||||
let post_data: key_val = {};
|
||||
|
||||
if (!$slct.post_id) {
|
||||
post_data['account_id_random'] = $ae_app.account_id;
|
||||
post_data['enable'] = true;
|
||||
}
|
||||
|
||||
post_data['title'] = form_post_data.title;
|
||||
if (tinyMCE.get('content')) {
|
||||
post_data['content'] = tinyMCE.get('content').getContent();
|
||||
} else {
|
||||
post_data['content'] = form_post_data.content;
|
||||
}
|
||||
|
||||
if (form_post_data.topic_id) {
|
||||
post_data['topic_id'] = Number(form_post_data.topic_id);
|
||||
// post_data['topic_id'] = form_post_data.topic_id;
|
||||
} else {
|
||||
post_data['topic_id'] = null;
|
||||
}
|
||||
|
||||
console.log(form_post_data.anonymous);
|
||||
console.log(typeof form_post_data.anonymous);
|
||||
|
||||
// console.log(Boolean(form_post_data.anonymous));
|
||||
// console.log(Number((form_post_data.anonymous)));
|
||||
// console.log(Boolean(Number((form_post_data.anonymous))));
|
||||
// let anonymous_test = Boolean(form_post_data.anonymous)
|
||||
|
||||
// console.log(!anonymous_test);
|
||||
// console.log(!!anonymous_test);
|
||||
// console.log(!!!anonymous_test);
|
||||
|
||||
post_data['anonymous'] = form_post_data.anonymous;
|
||||
|
||||
post_data['external_person_id'] = form_post_data.external_person_id;
|
||||
post_data['full_name'] = form_post_data.full_name;
|
||||
post_data['email'] = form_post_data.email;
|
||||
|
||||
post_data['hide'] = !!form_post_data.hide;
|
||||
post_data['priority'] = !!form_post_data.priority;
|
||||
if (form_post_data.sort) {
|
||||
post_data['sort'] = Number(form_post_data.sort);
|
||||
} else {
|
||||
post_data['sort'] = null;
|
||||
}
|
||||
if (form_post_data.group) {
|
||||
post_data['group'] = form_post_data.group;
|
||||
} else {
|
||||
post_data['group'] = null;
|
||||
}
|
||||
|
||||
if (form_post_data.enable) {
|
||||
post_data['enable'] = !!form_post_data.enable;
|
||||
}
|
||||
|
||||
if (tinyMCE.get('notes')) {
|
||||
post_data['notes'] = tinyMCE.get('notes').getContent();
|
||||
} else {
|
||||
post_data['notes'] = form_post_data.notes;
|
||||
}
|
||||
|
||||
console.log(post_data);
|
||||
|
||||
if (!$slct.post_id) {
|
||||
create_post_obj_promise = api.create_ae_obj_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'post',
|
||||
fields: post_data,
|
||||
key: $ae_app.ae_api.api_crud_super_key,
|
||||
log_lvl: 1
|
||||
})
|
||||
.then(function (post_obj_create_result) {
|
||||
if (!post_obj_create_result) {
|
||||
console.log('The result was null or false.');
|
||||
return false;
|
||||
}
|
||||
|
||||
$slct.post_id = post_obj_create_result.obj_id_random;
|
||||
|
||||
dispatch(
|
||||
'created__post_obj',
|
||||
{
|
||||
post_id: $slct.post_id,
|
||||
}
|
||||
);
|
||||
|
||||
return post_obj_create_result;
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('Something went wrong.');
|
||||
console.log(error);
|
||||
return false;
|
||||
});
|
||||
|
||||
return create_post_obj_promise;
|
||||
|
||||
} else {
|
||||
update_post_obj_promise = api.update_ae_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'post',
|
||||
obj_id: $slct.post_id,
|
||||
fields: post_data,
|
||||
key: $ae_app.ae_api.api_crud_super_key,
|
||||
log_lvl: 1
|
||||
})
|
||||
.then(function (post_obj_update_result) {
|
||||
if (!post_obj_update_result) {
|
||||
console.log('The result was null or false.');
|
||||
return false;
|
||||
}
|
||||
|
||||
dispatch(
|
||||
'updated__post_obj',
|
||||
{
|
||||
post_id: $slct.post_id,
|
||||
}
|
||||
);
|
||||
|
||||
return post_obj_update_result;
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('Something went wrong.');
|
||||
console.log(error);
|
||||
return false;
|
||||
});
|
||||
|
||||
return update_post_obj_promise;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function handle_delete_post_obj({post_id, method='disable'}) {
|
||||
console.log('*** handle_delete_post_obj() ***');
|
||||
|
||||
delete_post_obj_promise = api.delete_ae_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'post',
|
||||
obj_id: post_id,
|
||||
method: method,
|
||||
// params: params,
|
||||
key: $ae_app.ae_api.api_crud_super_key,
|
||||
log_lvl: 0
|
||||
})
|
||||
.then(function (post_obj_delete_result) {
|
||||
if (post_obj_delete_result) {
|
||||
// console.log(`Result:`, post_obj_delete_result);
|
||||
|
||||
dispatch(
|
||||
'deleted__post_obj',
|
||||
{
|
||||
post_id: post_id,
|
||||
}
|
||||
);
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('The result was null or false when trying to delete.', error);
|
||||
});
|
||||
|
||||
return delete_post_obj_promise;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<section
|
||||
class="svelte_component ae_edit post_obj"
|
||||
class:ae_create={!$slct.post_id}
|
||||
bind:clientHeight={$ae_app.iframe_height_modal_body}
|
||||
>
|
||||
|
||||
<form on:submit|preventDefault={handle_submit_form} class="">
|
||||
|
||||
{#await update_post_obj_promise}
|
||||
<div class="awaiting alert_msg_pulse" out:fade={{ duration: 2000 }}>Saving...</div>
|
||||
{:then}
|
||||
{#if update_post_obj_promise}
|
||||
<div class="awaiting" out:fade={{ duration: 2000 }}>Finished saving</div>
|
||||
{:else}
|
||||
<!-- <div class="awaiting" out:fade={{ duration: 2000 }}>Nothing here yet</div> -->
|
||||
{/if}
|
||||
{/await}
|
||||
|
||||
<h3>Post</h3>
|
||||
|
||||
<label for="title">Title of BB post
|
||||
<input type="text" id="title" name="title" required max="20" value={$slct.post_obj.title ? $slct.post_obj.title : '' } placeholder="BB post title">
|
||||
</label>
|
||||
|
||||
<label for="content">Content (post body)
|
||||
<textarea id="content" name="content" required rows="6" cols="80" value={$slct.post_obj.content ? $slct.post_obj.content : ''} class="ae_value post__content tinymce_editor editor_basic_200"></textarea>
|
||||
</label>
|
||||
|
||||
<label for="topic_id">BB post topic
|
||||
<select id="topic_id" name="topic_id" value={$slct.post_obj.topic_id}>
|
||||
<option value="">-- None --</option>
|
||||
<option value={16}>Licensing/ monitoring/ credentialing issues</option>
|
||||
<option value={17}>Return to practice</option>
|
||||
<option value={18}>Contacts/ sponsorship in my area</option>
|
||||
<option value={19}>Professional positions</option>
|
||||
<option value={21}
|
||||
disabled={!$ae_app.trusted_access}
|
||||
>
|
||||
Announcement
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<h3>Poster's Information</h3>
|
||||
<fieldset class="">
|
||||
<legend class="">Post as Anonymous</legend>
|
||||
<div class="">
|
||||
<input
|
||||
type="radio"
|
||||
id="anonymous_no"
|
||||
name="anonymous"
|
||||
value={false}
|
||||
bind:group={$slct.post_obj.anonymous}
|
||||
|
||||
>
|
||||
<label for="anonymous_no">No, include my name and email address</label>
|
||||
</div>
|
||||
<div class="">
|
||||
<input
|
||||
type="radio"
|
||||
id="anonymous_yes"
|
||||
name="anonymous"
|
||||
value={true}
|
||||
bind:group={$slct.post_obj.anonymous}
|
||||
|
||||
>
|
||||
<label for="anonymous_yes">Yes, the post will be listed as Anonymous</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
{#if $ae_app.trusted_access}
|
||||
<label for="external_person_id">Your ID
|
||||
{#if !$ae_app.trusted_access}
|
||||
<span class="fas fa-lock" title="Field is locked"></span>
|
||||
{:else}
|
||||
<span class="fas fa-unlock" title="Field is unlocked"></span>
|
||||
{/if}
|
||||
<input
|
||||
type="text"
|
||||
id="external_person_id"
|
||||
name="external_person_id"
|
||||
value={($slct.post_obj.external_person_id ? $slct.post_obj.external_person_id : $ae_app.novi_uuid)}
|
||||
readonly={!$ae_app.trusted_access}
|
||||
>
|
||||
<span class="ae_highlight">Primary link using the Novi API UUID</span>
|
||||
</label>
|
||||
{/if}
|
||||
|
||||
<label for="full_name">Your name
|
||||
{#if !$ae_app.trusted_access}
|
||||
<span class="fas fa-lock" title="Field is locked"></span>
|
||||
{:else}
|
||||
<span class="fas fa-unlock" title="Field is unlocked"></span>
|
||||
{/if}
|
||||
<input
|
||||
type="text"
|
||||
id="full_name"
|
||||
name="full_name"
|
||||
value={($slct.post_obj.full_name ? $slct.post_obj.full_name : $ae_app.novi_full_name)}
|
||||
readonly={!$ae_app.trusted_access}
|
||||
>
|
||||
</label>
|
||||
|
||||
{#if $ae_app.trusted_access}
|
||||
<label for="email">Your email
|
||||
{#if !$ae_app.trusted_access}
|
||||
<span class="fas fa-lock" title="Field is locked"></span>
|
||||
{:else}
|
||||
<span class="fas fa-unlock" title="Field is unlocked"></span>
|
||||
{/if}
|
||||
<input
|
||||
type="text"
|
||||
name="email"
|
||||
value={($slct.post_obj.email ? $slct.post_obj.email : $ae_app.novi_email)}
|
||||
readonly={!$ae_app.trusted_access}
|
||||
>
|
||||
<span class="ae_highlight">Secondary link using the Novi email address</span>
|
||||
</label>
|
||||
{/if}
|
||||
|
||||
<!-- <h3>Poster's Options</h3> -->
|
||||
|
||||
<!-- <fieldset class="">
|
||||
<legend class="">Official or Member Post</legend>
|
||||
<div class="">
|
||||
<input type="radio" class="" id="group_official" name="group" value="official">
|
||||
<label for="group_official" class="">Post as Official/Leadership</label>
|
||||
</div>
|
||||
<div class="">
|
||||
<input type="radio" class="" id="group_member" name="group" value="member" checked="">
|
||||
<label for="group_member" class="">Post as Member</label>
|
||||
</div>
|
||||
</fieldset> -->
|
||||
|
||||
<!-- <fieldset class="">
|
||||
<legend class="">Enable Comments</legend>
|
||||
<div class="">
|
||||
<input type="radio" class="" id="enable_comments_no" name="enable_comments" value="0">
|
||||
<label for="enable_comments_no" class="">No, do not allow comments</label>
|
||||
</div>
|
||||
<div class="">
|
||||
<input type="radio" class="" id="enable_comments_yes" name="enable_comments" value="1" checked>
|
||||
<label for="enable_comments_yes" class="">Yes, allow comments</label>
|
||||
</div>
|
||||
</fieldset> -->
|
||||
|
||||
|
||||
{#if $ae_app.trusted_access}
|
||||
<section class="ae_section post__admin_options"> <!-- BEGIN: section post__admin_options -->
|
||||
|
||||
<h3>
|
||||
Admin Options
|
||||
<button type="button" class="ae_btn ae_d_none_toggle ae_float_right ae_smallest btn btn-xs btn-info" on:click={() => {document.querySelector('.ae_d_none_content').classList.toggle('ae_fade_out'); document.querySelector('.ae_d_none_content').classList.toggle('ae_fade_in');}}><span class="fas fa-eye"></span> Show/Hide Admin</button>
|
||||
</h3>
|
||||
|
||||
<span class="ae_d_none_content ae_fade_out">
|
||||
<label>Hide
|
||||
<input
|
||||
type="checkbox"
|
||||
name="hide"
|
||||
id="hide"
|
||||
bind:checked={$slct.post_obj.hide}
|
||||
>
|
||||
</label>
|
||||
|
||||
<label>Priority
|
||||
<input
|
||||
type="checkbox"
|
||||
name="priority"
|
||||
id="priority"
|
||||
bind:checked={$slct.post_obj.priority}
|
||||
>
|
||||
</label>
|
||||
|
||||
<label>Sort <input type="number" name="sort" value={$slct.post_obj.sort} /></label>
|
||||
|
||||
<label>Group <input type="text" name="group" value={$slct.post_obj.group} max="100" /></label>
|
||||
|
||||
{#if $ae_app.administrator_access}
|
||||
<label>Enable
|
||||
<input
|
||||
type="checkbox"
|
||||
name="enable"
|
||||
id="enable"
|
||||
bind:checked={$slct.post_obj.enable}
|
||||
>
|
||||
</label>
|
||||
{/if}
|
||||
|
||||
{#if $ae_app.trusted_access}
|
||||
<label>Internal Staff Notes
|
||||
<textarea id="notes" name="notes" class="ae_value post__notes tinymce_editor editor_basic_200" rows="2" cols="70" value={$slct.post_obj.notes}></textarea>
|
||||
</label>
|
||||
{/if}
|
||||
|
||||
</span> <!-- END: span ae_show_hide_content -->
|
||||
|
||||
</section> <!-- END: section post__admin_options -->
|
||||
{/if}
|
||||
|
||||
|
||||
<section class="ae_section ae_options ae_row">
|
||||
<button type="submit" class="ae_btn btn btn-primary"><span class="fas fa-check"></span> Save Post</button>
|
||||
|
||||
{#if $slct.post_id}
|
||||
{#if $ae_app.administrator_access}
|
||||
<button
|
||||
on:click={() => {
|
||||
if (!confirm('Are you sure you want to delete this post?')) {return false;}
|
||||
handle_delete_post_obj({post_id: $slct.post_id, method: 'delete'});
|
||||
|
||||
$slct.post_id = null;
|
||||
$slct.post_obj = {};
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-danger" type="button"
|
||||
title="Delete record permanently"
|
||||
>
|
||||
<span class="fas fa-minus"></span> Delete
|
||||
</button>
|
||||
{:else if $ae_app.trusted_access}
|
||||
<button
|
||||
on:click={() => {
|
||||
if (!confirm('Are you sure you want to disable this post?')) {return false;}
|
||||
handle_delete_post_obj({post_id: $slct.post_id, method: 'disable'});
|
||||
|
||||
$slct.post_id = null;
|
||||
$slct.post_obj = {};
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-danger" type="button"
|
||||
title="Disable record to delete"
|
||||
>
|
||||
<span class="fas fa-minus"></span> Disable
|
||||
</button>
|
||||
{:else}
|
||||
<button
|
||||
on:click={() => {
|
||||
if (!confirm('Are you sure you want to hide this post?')) {return false;}
|
||||
handle_delete_post_obj({post_id: $slct.post_id, method: 'hide'});
|
||||
|
||||
$slct.post_id = null;
|
||||
$slct.post_obj = {};
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-danger" type="button"
|
||||
title="Hide record to delete"
|
||||
>
|
||||
<span class="fas fa-comment-slash"></span> Delete
|
||||
</button>
|
||||
{/if}
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
</form>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<style>
|
||||
</style>
|
||||
1159
src/10_edit__sponsorship_obj.svelte
Normal file
1159
src/10_edit__sponsorship_obj.svelte
Normal file
File diff suppressed because it is too large
Load Diff
63
src/10_hub__site_menu.svelte
Normal file
63
src/10_hub__site_menu.svelte
Normal file
@@ -0,0 +1,63 @@
|
||||
<script lang="ts">
|
||||
|
||||
// *** Import Svelte core
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
import { slct, slct_trigger, ae_app, ae_session } from './stores';
|
||||
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** OSIT - AE Hub: Site Menu');
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<nav>
|
||||
{#if $ae_session.site_nav_menu}
|
||||
<ul>
|
||||
{#each Object.entries($ae_session.site_nav_menu) as [name, menu_item]}
|
||||
<li>
|
||||
<a href={menu_item.href} class={menu_item.class_li}>{@html menu_item.text}</a>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
{/if}
|
||||
</nav>
|
||||
|
||||
|
||||
<style>
|
||||
nav {
|
||||
/* outline: dashed thick red; */
|
||||
/* background-color: hsla(0, 0%, 100%, 0.85); */
|
||||
/* padding: .5em 1em; */
|
||||
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
nav ul {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
|
||||
width: 100%;
|
||||
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
}
|
||||
nav ul li {
|
||||
/* display: inline; */
|
||||
/* margin-right: 1em; */
|
||||
}
|
||||
nav ul li a {
|
||||
text-decoration: none;
|
||||
}
|
||||
nav ul li a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
nav ul li a.active {
|
||||
font-weight: bold;
|
||||
}
|
||||
nav ul li a.active:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
||||
489
src/10_list__archive_content_obj.svelte
Normal file
489
src/10_list__archive_content_obj.svelte
Normal file
@@ -0,0 +1,489 @@
|
||||
<script lang="ts">
|
||||
// *** Import Svelte core
|
||||
import { onMount } from 'svelte';
|
||||
import { fade } from 'svelte/transition';
|
||||
|
||||
// *** Import Aether core variables and functions
|
||||
import { ae, api, Element_modal_v3 } from 'aether_npm_lib';
|
||||
import { slct, ae_app, slct_trigger } from './stores';
|
||||
|
||||
import Edit_archive_content_obj from './10_edit__archive_content_obj.svelte';
|
||||
import Player_archive_content_obj from './10_player__archive_content_obj.svelte';
|
||||
|
||||
let idaa_archive_content_obj_li_get_promise: Promise<any>;
|
||||
let idaa_archive_content_obj_get_promise: Promise<any>;
|
||||
|
||||
let file_icons:any = {}
|
||||
file_icons['ac3'] = 'file-audio';
|
||||
file_icons['aac'] = 'file-audio';
|
||||
file_icons['csv'] = 'file-csv';
|
||||
file_icons['doc'] = 'file-word';
|
||||
file_icons['docx'] = 'file-word';
|
||||
file_icons['gif'] = 'file-image';
|
||||
file_icons['htm'] = 'file-code';
|
||||
file_icons['html'] = 'file-code';
|
||||
file_icons['jpeg'] = 'file-image';
|
||||
file_icons['jpg'] = 'file-image';
|
||||
file_icons['key'] = 'file-powerpoint';
|
||||
file_icons['mkv'] = 'file-video';
|
||||
file_icons['mov'] = 'file-video';
|
||||
file_icons['mp3'] = 'file-audio';
|
||||
file_icons['mp4'] = 'file-video';
|
||||
file_icons['pdf'] = 'file-pdf';
|
||||
file_icons['png'] = 'file-image';
|
||||
file_icons['ppt'] = 'file-powerpoint';
|
||||
file_icons['pptx'] = 'file-powerpoint';
|
||||
file_icons['txt'] = 'file-alt';
|
||||
file_icons['wav'] = 'file-audio';
|
||||
file_icons['webp'] = 'file-image';
|
||||
file_icons['xls'] = 'file-excel';
|
||||
file_icons['xlsx'] = 'file-excel';
|
||||
file_icons['zip'] = 'file-archive';
|
||||
|
||||
let media_play_extension_li = ['m4a', 'mp4', 'mp3'];
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** List - Archive Content Obj Li');
|
||||
});
|
||||
|
||||
$: if ($slct_trigger == 'load__archive_content_obj_li' && $slct.archive_id) {
|
||||
$slct_trigger = null;
|
||||
|
||||
handle_load_archive_content_obj_li({archive_id: $slct.archive_id, try_cache: false});
|
||||
}
|
||||
|
||||
async function handle_load_archive_content_obj_li({archive_id, try_cache=false}) {
|
||||
console.log('*** handle_load_archive_content_obj_li() ***');
|
||||
|
||||
let enabled = $ae_app.archives.enabled;
|
||||
let hidden = $ae_app.archives.hidden;
|
||||
let limit = $ae_app.archives.limit;
|
||||
let offset = $ae_app.archives.offset;
|
||||
// $ae_app.archives.content_group_sort = 'DESC'; // 'ASC' or 'DESC'
|
||||
let group_sort = $ae_app.archives.content_group_sort; // 'ASC' or 'DESC'
|
||||
|
||||
let params = {};
|
||||
|
||||
idaa_archive_content_obj_li_get_promise = api.get_ae_obj_li_for_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'archive_content',
|
||||
for_obj_type: 'archive',
|
||||
for_obj_id: archive_id,
|
||||
enabled: enabled,
|
||||
hidden: hidden,
|
||||
order_by_li: {'group': group_sort, 'priority': 'DESC', 'sort': 'DESC', 'name': 'ASC', 'created_on': 'DESC', 'updated_on': 'DESC'},
|
||||
limit: limit,
|
||||
offset: offset,
|
||||
params_json: null,
|
||||
params: params,
|
||||
log_lvl: 0
|
||||
})
|
||||
.then(function (archive_content_obj_li_get_result) {
|
||||
if (archive_content_obj_li_get_result) {
|
||||
$slct.archive_content_obj_li = archive_content_obj_li_get_result;
|
||||
console.log(`Archive Content list:`, $slct.archive_content_obj_li);
|
||||
|
||||
// console.log(ae.dynamic_sort());
|
||||
// $slct.archive_content_obj_li.sort(ae.util.dynamic_sort_multiple('group ASC', 'created_on DESC', 'updated_on DESC'));
|
||||
} else {
|
||||
$slct.archive_content_obj_li = [];
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
|
||||
return idaa_archive_content_obj_li_get_promise;
|
||||
}
|
||||
|
||||
|
||||
$: if ($slct_trigger == 'load__archive_content_obj' && $slct.archive_content_id) {
|
||||
$slct_trigger = null;
|
||||
|
||||
handle_load_archive_content_obj({archive_content_id: $slct.archive_content_id, try_cache: false});
|
||||
}
|
||||
|
||||
|
||||
async function handle_load_archive_content_obj({archive_content_id, try_cache=false}) {
|
||||
console.log('*** handle_load_archive_content_obj() ***');
|
||||
|
||||
let params = {};
|
||||
|
||||
idaa_archive_content_obj_get_promise = api.get_ae_obj_id_crud({
|
||||
api_cfg: $ae_app.ae_api,
|
||||
obj_type: 'archive_content',
|
||||
obj_id: archive_content_id,
|
||||
use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config.
|
||||
use_alt_base: false, // NOTE: This will use the base_name_alt value instead of the base_name value in the API config.
|
||||
params: params,
|
||||
log_lvl: 0
|
||||
})
|
||||
.then(function (archive_content_obj_get_result) {
|
||||
if (archive_content_obj_get_result) {
|
||||
$slct.archive_content_obj = archive_content_obj_get_result;
|
||||
console.log(`Archive object:`, $slct.archive_content_obj);
|
||||
}
|
||||
|
||||
// handle_resize_document();
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
|
||||
return idaa_archive_content_obj_get_promise;
|
||||
}
|
||||
|
||||
function handle_created_archive_content_obj(event) {
|
||||
console.log('*** handle_created_archive_content_obj() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
$slct_trigger = 'load__archive_content_obj_li';
|
||||
|
||||
$ae_app.archives.show_list__event_obj_li = true;
|
||||
$ae_app.archives.show_edit__archive_content_id = false;
|
||||
$ae_app.archives.show_view__archive_content_id = false;
|
||||
}
|
||||
|
||||
function handle_updated_archive_content_obj(event) {
|
||||
console.log('*** handle_updated_archive_content_obj() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
$slct_trigger = 'load__archive_content_obj_li';
|
||||
|
||||
$ae_app.archives.show_list__event_obj_li = true;
|
||||
$ae_app.archives.show_edit__archive_content_id = false;
|
||||
$ae_app.archives.show_view__archive_content_id = false;
|
||||
}
|
||||
|
||||
function handle_deleted_archive_content_obj(event) {
|
||||
console.log('*** handle_deleted_archive_content_obj() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
$slct_trigger = 'load__archive_content_obj_li';
|
||||
|
||||
$ae_app.archives.show_list__event_obj_li = true;
|
||||
$ae_app.archives.show_edit__archive_content_id = false;
|
||||
$ae_app.archives.show_view__archive_content_id = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<section class="svelte_component ae_section ae_list archive_content_obj_li list__archive_content_obj">
|
||||
{#if $slct.archive_content_obj_li}
|
||||
|
||||
{#each $slct.archive_content_obj_li as idaa_archive_content_obj, index}
|
||||
<!-- {#each $slct.archive_content_obj_li.sort(ae.util.dynamic_sort_multiple('group ASC', 'priority DESC')) as idaa_archive_content_obj, index} -->
|
||||
{#if idaa_archive_content_obj.group && idaa_archive_content_obj.group != $slct.archive_content_obj_li[index - 1]?.group}
|
||||
<div class="ae_row archive_content__group">
|
||||
<button
|
||||
class="ae_btn btn btn-info ae_margin_sm"
|
||||
on:click={() => {
|
||||
if ($ae_app.archives.show_list__archive_content_li_group == idaa_archive_content_obj.group) {
|
||||
$ae_app.archives.show_list__archive_content_li_group = null;
|
||||
} else {
|
||||
$ae_app.archives.show_list__archive_content_li_group = idaa_archive_content_obj.group;
|
||||
}
|
||||
}}
|
||||
>
|
||||
{#if $ae_app.archives.show_list__archive_content_li_group == idaa_archive_content_obj.group}
|
||||
<span class="fas fa-caret-down" in:fade={{ duration: 250 }}
|
||||
out:fade={{ duration: 0 }}></span>
|
||||
<!-- <span class="fas fa-minus"></span> -->
|
||||
<span class="ae_label">Hide:</span>
|
||||
{:else}
|
||||
<span class="fas fa-caret-right" in:fade={{ duration: 250 }}
|
||||
out:fade={{ duration: 0 }}></span>
|
||||
<!-- <span class="fas fa-plus"></span> -->
|
||||
<span class="ae_label">Show:</span>
|
||||
{/if}
|
||||
<!-- <span class="fas fa-caret-down"></span> -->
|
||||
<!-- <span class="ae_label">Show:</span> -->
|
||||
<span class="ae_value">{idaa_archive_content_obj.group}</span>
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
{#if $ae_app.archives.show_list__archive_content_li_group == idaa_archive_content_obj.group}
|
||||
<!-- class:ae_d_none={$ae_app.archives.show_list__archive_content_li_group != idaa_archive_content_obj.group} -->
|
||||
<div
|
||||
id={`idaa_archive_content_id__${idaa_archive_content_obj.archive_content_id_random}`}
|
||||
class="container archive_content ae_object archive_content_obj"
|
||||
class:archive__content_type={idaa_archive_content_obj.type}
|
||||
|
||||
in:fade={{ duration: 125 }}
|
||||
out:fade={{ duration: 250 }}
|
||||
>
|
||||
|
||||
<header class="ae_header archive_content__header">
|
||||
<h3>
|
||||
<span class="archive_content__name">{idaa_archive_content_obj.name}</span>
|
||||
|
||||
{#if idaa_archive_content_obj.type}<span class="badge badge-info bg-info"><span class="fas fa-user-md"></span> {idaa_archive_content_obj.type}</span>{/if}
|
||||
|
||||
{#if $ae_app.trusted_access && idaa_archive_content_obj.hide}<span class="badge badge-warning"><span class="fas fa-exclamation-triangle"></span> Hidden</span>{/if}
|
||||
{#if $ae_app.administrator_access && !idaa_archive_content_obj.enable}<span class="badge badge-warning"><span class="fas fa-exclamation-triangle"></span> Not enabled</span>{/if}
|
||||
</h3>
|
||||
</header>
|
||||
|
||||
<section class="ae_options archive_content_obj__options">
|
||||
{#if idaa_archive_content_obj.archive_content_id_random != $ae_app.archives.show_view__archive_content_media}
|
||||
<button
|
||||
on:click={ () => {
|
||||
$slct.archive_content_id = idaa_archive_content_obj.archive_content_id_random;
|
||||
$slct.archive_content_obj = idaa_archive_content_obj;
|
||||
$ae_app.archives.show_view__archive_content_media = $slct.archive_content_id;
|
||||
// idaa_archive_content_obj.show_view__archive_content_media = true;
|
||||
}}
|
||||
class="ae_btn btn_md btn btn-md btn-primary"
|
||||
title="Open this file">
|
||||
{#if media_play_extension_li.includes( idaa_archive_content_obj.file_extension)}
|
||||
<span class="fas fa-play"></span>
|
||||
Play <!-- This really should check the file type: view, show, play, listen, watch -->
|
||||
{:else}
|
||||
<span class="fas fa-eye"></span>
|
||||
View
|
||||
{/if}
|
||||
<span class="badge">
|
||||
{#if file_icons[idaa_archive_content_obj.file_extension]}
|
||||
<span class="fas fa-{file_icons[idaa_archive_content_obj.file_extension]}"></span>
|
||||
{:else}
|
||||
<span class="fas fa-file"></span>
|
||||
{/if}
|
||||
.{idaa_archive_content_obj.file_extension}</span>
|
||||
</button>
|
||||
{:else}
|
||||
<button
|
||||
on:click={ () => {
|
||||
$slct.archive_content_id = idaa_archive_content_obj.archive_content_id_random;
|
||||
$slct.archive_content_obj = idaa_archive_content_obj;
|
||||
|
||||
$ae_app.archives.show_view__archive_content_media = false;
|
||||
// idaa_archive_content_obj.show_view__archive_content_media = false;
|
||||
}}
|
||||
class="ae_btn btn_md btn btn-md btn-secondary"
|
||||
title="Hide this file">
|
||||
<span class="fas fa-play"></span>
|
||||
Hide <!-- This really should check the file type: view, show, play, listen, watch -->
|
||||
<span class="badge">
|
||||
{#if file_icons[idaa_archive_content_obj.file_extension]}
|
||||
<span class="fas fa-{file_icons[idaa_archive_content_obj.file_extension]}"></span>
|
||||
{:else}
|
||||
<span class="fas fa-file"></span>
|
||||
{/if}
|
||||
.{idaa_archive_content_obj.file_extension}</span>
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
{#if $ae_app.trusted_access}
|
||||
<a href="{$ae_app.app.base_url}{idaa_archive_content_obj.hosted_file_path}" class="ae_btn btn_md btn btn-md btn-secondary" title="Download this file">
|
||||
<span class="fas fa-download"></span>
|
||||
Download <!-- This really should check the file type: view, show, play, listen, watch -->
|
||||
<span class="badge">
|
||||
{#if file_icons[idaa_archive_content_obj.file_extension]}
|
||||
<span class="fas fa-{file_icons[idaa_archive_content_obj.file_extension]}"></span>
|
||||
{:else}
|
||||
<span class="fas fa-file"></span>
|
||||
{/if}
|
||||
.{idaa_archive_content_obj.file_extension}</span>
|
||||
</a>
|
||||
{/if}
|
||||
|
||||
{#if $ae_app.trusted_access}
|
||||
<button
|
||||
on:click={() => {
|
||||
$slct.archive_content_id = idaa_archive_content_obj.archive_content_id_random;
|
||||
$slct.archive_content_obj = idaa_archive_content_obj;
|
||||
$slct_trigger = 'load__archive_content_obj';
|
||||
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.set('archive_content_id', idaa_archive_content_obj.archive_content_id_random);
|
||||
// history.pushState({}, '', url);
|
||||
|
||||
// $ae_app.archives.show_main__options = true;
|
||||
// $ae_app.archives.show_list__archive_content_li = true;
|
||||
// $ae_app.archives.show_view__archive_content_id = false;
|
||||
$ae_app.archives.show_view__archive_content_media = false;
|
||||
$ae_app.archives.show_edit__archive_content_id = true;
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-warning"
|
||||
title={`Edit content: ${idaa_archive_content_obj.name}`}
|
||||
>
|
||||
<span class="fas fa-edit"></span> Edit Content
|
||||
</button>
|
||||
<!-- <button
|
||||
on:click={() => {
|
||||
// Copy URL to clipboard
|
||||
// Is there a URL anymore?
|
||||
// const copy_text = document.getElementById(`archive_edit_url_${idaa_archive_content_obj.archive_content_id_random}`);
|
||||
}}
|
||||
class="ae_btn btn_sm btn_outline_info archive_edit_help"
|
||||
>
|
||||
<span class="fas fa-link"></span> URL
|
||||
</button> -->
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
|
||||
<!-- Doing some checks before the media player/viewer shows. The player should be the only one showing. So there is a sort of global check first. -->
|
||||
{#if idaa_archive_content_obj.archive_content_id_random == $ae_app.archives.show_view__archive_content_media}
|
||||
<Player_archive_content_obj archive_content_id={idaa_archive_content_obj.archive_content_id_random} />
|
||||
{/if}
|
||||
|
||||
|
||||
<section class="ae_section archive_content__content">
|
||||
{#if idaa_archive_content_obj.description}
|
||||
<div
|
||||
class="archive_content__description ae_description"
|
||||
>
|
||||
<div class="ae_label archive_content__description">Description:</div>
|
||||
<div class="ae_value archive_content__description">
|
||||
{idaa_archive_content_obj.description}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if idaa_archive_content_obj.content_html}
|
||||
<div
|
||||
class="archive_content__content_html ae_content_html"
|
||||
>
|
||||
<div class="ae_label archive_content__content_html">Content:</div>
|
||||
<div class="ae_value archive_content__content_html">
|
||||
{@html idaa_archive_content_obj.content_html}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div
|
||||
class="ae_group"
|
||||
class:ae_d_none={!idaa_archive_content_obj.original_datetime && !idaa_archive_content_obj.original_timezone}
|
||||
>
|
||||
<span class="ae_label">Original date/time:</span>
|
||||
{#if idaa_archive_content_obj.original_datetime}
|
||||
<span class="ae_value ae_prop prop_original_datetime fs_smaller">{ae.util.iso_datetime_formatter(idaa_archive_content_obj.original_datetime, 'datetime_long')}</span>
|
||||
{/if}
|
||||
{#if idaa_archive_content_obj.original_timezone}
|
||||
<span class="ae_label">Timezone:</span>
|
||||
<span class="ae_value">{idaa_archive_content_obj.original_timezone}</span>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<section
|
||||
class="ae_section ae_footer ae_meta archive_content__meta"
|
||||
class:ae_d_none={!$ae_app.administrator_access}
|
||||
>
|
||||
<span
|
||||
class="archive_content__archive_content_type"
|
||||
class:ae_d_none={!idaa_archive_content_obj.archive_content_type}
|
||||
>
|
||||
Type: {idaa_archive_content_obj.archive_content_type}
|
||||
</span>
|
||||
<span class="ae_group">
|
||||
<span
|
||||
class="archive_content__created_on"
|
||||
>
|
||||
Created on: {ae.util.iso_datetime_formatter(idaa_archive_content_obj.created_on, 'datetime_short')}
|
||||
</span>
|
||||
<span
|
||||
class="archive_content__updated_on"
|
||||
class:ae_d_none={!idaa_archive_content_obj.updated_on}
|
||||
>
|
||||
Updated on: {ae.util.iso_datetime_formatter(idaa_archive_content_obj.updated_on, 'datetime_short')}
|
||||
</span>
|
||||
</span>
|
||||
</section>
|
||||
</div>
|
||||
{/if}
|
||||
{/each}
|
||||
|
||||
{:else}
|
||||
<div>No archives avalible to show at this time</div>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
|
||||
{#if $ae_app.archives.show_edit__archive_content_id}
|
||||
<!-- <section class="ae_edit archive_content_obj archive_content_id idaa_archive_content_id_edit"> -->
|
||||
<Element_modal_v3
|
||||
show = { true }
|
||||
modal_cover_body = { false }
|
||||
on:close={ () => {
|
||||
$slct.archive_content_id = null;
|
||||
$slct.archive_content_obj = {};
|
||||
|
||||
// $ae_app.archives.show_main__options = true;
|
||||
// $ae_app.archives.show_list__archive_content_li = true;
|
||||
$ae_app.archives.show_view__archive_content_media = false;
|
||||
$ae_app.archives.show_edit__archive_content_id = false;
|
||||
// $ae_app.archives.show_view__archive_content_id = false;
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete('archive_content_id');
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {'archive_content_id': null};
|
||||
window.parent.postMessage(message, "*");
|
||||
}}
|
||||
>
|
||||
<span slot="header_title">{@html ($slct.archive_content_obj.name ? $slct.archive_content_obj.name : 'New Archive Content')}</span>
|
||||
|
||||
<span slot="body">
|
||||
|
||||
<Edit_archive_content_obj
|
||||
on:created__archive_content_obj={handle_created_archive_content_obj}
|
||||
on:updated__archive_content_obj={handle_updated_archive_content_obj}
|
||||
on:deleted__archive_content_obj={handle_deleted_archive_content_obj}
|
||||
/>
|
||||
|
||||
</span>
|
||||
</Element_modal_v3>
|
||||
<!-- </section> -->
|
||||
{/if}
|
||||
|
||||
|
||||
<style>
|
||||
.ae_label {
|
||||
font-size: smaller;
|
||||
}
|
||||
.ae_value {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.ae_header h3 {
|
||||
font-size: 1.2em;
|
||||
margin: 0;
|
||||
/* padding: 0; */
|
||||
}
|
||||
|
||||
.ae_row.archive_content__group {
|
||||
width: 100%;
|
||||
}
|
||||
.ae_row.archive_content__group button {
|
||||
width: 100%;
|
||||
}
|
||||
.ae_value.archive_content__group {
|
||||
font-size: 1.4em;
|
||||
font-weight: bold;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
text-align: center;
|
||||
|
||||
border-bottom: solid thin black;
|
||||
}
|
||||
|
||||
.archive_content_obj .ae_meta {
|
||||
flex-direction: column;
|
||||
/* justify-content: space-between; */
|
||||
}
|
||||
|
||||
.archive_content_obj .ae_meta .ae_group {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.archive_content_obj .ae_meta .ae_options {
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
}
|
||||
</style>
|
||||
151
src/10_list__archive_obj.svelte
Normal file
151
src/10_list__archive_obj.svelte
Normal file
@@ -0,0 +1,151 @@
|
||||
<script lang="ts">
|
||||
// *** Import Svelte core
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
// *** Import Aether core variables and functions
|
||||
import { ae } from 'aether_npm_lib';
|
||||
import { slct, ae_app, slct_trigger } from './stores';
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** List - Archive Obj Li');
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<section class="svelte_component ae_section ae_list archive_obj_li list__archive_obj archive_list">
|
||||
{#if $slct.archive_obj_li}
|
||||
|
||||
{#each $slct.archive_obj_li as idaa_archive_obj, index}
|
||||
<div
|
||||
id={`idaa_archive_id__${idaa_archive_obj.archive_id_random}`}
|
||||
class="archive ae_object archive_obj"
|
||||
>
|
||||
|
||||
<div class="ae_header archive__header">
|
||||
<span class="archive__name">{idaa_archive_obj.name}</span>
|
||||
{#if idaa_archive_obj.original_location}
|
||||
<span>(
|
||||
<!-- <span class="ae_label">Location:</span> -->
|
||||
<span class="ae_value">{idaa_archive_obj.original_location}</span>
|
||||
)
|
||||
</span>
|
||||
{/if}
|
||||
|
||||
{#if $ae_app.trusted_access && idaa_archive_obj.hide}<span class="badge badge-warning"><span class="fas fa-exclamation-triangle"></span> Hidden</span>{/if}
|
||||
{#if $ae_app.administrator_access && !idaa_archive_obj.enable}<span class="badge badge-warning"><span class="fas fa-exclamation-triangle"></span> Not enabled</span>{/if}
|
||||
</div>
|
||||
|
||||
<div class="ae_options archive_obj__options">
|
||||
<button
|
||||
on:click={() => {
|
||||
$slct.archive_id = idaa_archive_obj.archive_id_random;
|
||||
$slct.archive_obj = idaa_archive_obj;
|
||||
$ae_app.archives.content_group_sort = $slct.archive_obj.cfg_json.content_group_sort;
|
||||
$slct_trigger = 'load__archive_obj';
|
||||
|
||||
$ae_app.archives.show_main__options = true;
|
||||
$ae_app.archives.show_list__archive_obj_li = false;
|
||||
$ae_app.archives.show_view__archive_obj = true;
|
||||
$ae_app.archives.show_edit__archive_obj = false;
|
||||
}}
|
||||
class="btn btn-secondary"
|
||||
title={`View: ${idaa_archive_obj.name}`}
|
||||
>
|
||||
<span class="fas fa-envelope-open"></span> Open
|
||||
</button>
|
||||
|
||||
{#if $ae_app.trusted_access}
|
||||
<button
|
||||
on:click={() => {
|
||||
$slct.archive_id = idaa_archive_obj.archive_id_random;
|
||||
$slct.archive_obj = idaa_archive_obj;
|
||||
$slct_trigger = 'load__archive_obj';
|
||||
|
||||
// $ae_app.archives.show_main__options = true;
|
||||
// $ae_app.archives.show_list__archive_obj_li = true;
|
||||
$ae_app.archives.show_view__archive_obj = false;
|
||||
$ae_app.archives.show_edit__archive_obj = true;
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-warning"
|
||||
title={`Edit archive: ${idaa_archive_obj.name}`}
|
||||
>
|
||||
<span class="fas fa-edit"></span> Edit Archive
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
|
||||
<section class="ae_section archive__content">
|
||||
<div
|
||||
class="archive_description description"
|
||||
>
|
||||
<!-- <div class="ae_label archive__description">Description:</div> -->
|
||||
<div class="ae_value archive__description">
|
||||
{@html idaa_archive_obj.description}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
<section class="ae_section ae_footer ae_meta archive__meta">
|
||||
<div class="ae_group">
|
||||
{#if !idaa_archive_obj.updated_on}
|
||||
<span
|
||||
class="archive__created_on"
|
||||
>
|
||||
<span class="ae_label">Created on:</span>
|
||||
<span class="ae_value">{ae.util.iso_datetime_formatter(idaa_archive_obj.created_on, 'datetime_short')}</span>
|
||||
</span>
|
||||
{:else}
|
||||
<span
|
||||
class="archive__updated_on"
|
||||
>
|
||||
<span class="ae_label">Updated on:</span>
|
||||
<span class="ae_value">{ae.util.iso_datetime_formatter(idaa_archive_obj.updated_on, 'datetime_short')}</span>
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
{/each}
|
||||
|
||||
{:else}
|
||||
<div>No archives avalible to show at this time</div>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
|
||||
<style>
|
||||
.archive_obj {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 1em;
|
||||
}
|
||||
|
||||
.archive__name {
|
||||
font-size: 1.5em;
|
||||
font-weight: bold;
|
||||
}
|
||||
.archive__content {
|
||||
display: none;
|
||||
}
|
||||
.archive__meta {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.archive_obj .ae_meta {
|
||||
flex-direction: column;
|
||||
/* justify-content: space-between; */
|
||||
}
|
||||
|
||||
.archive_obj .ae_meta .ae_group {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.archive_obj .ae_meta .ae_options {
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
}
|
||||
</style>
|
||||
163
src/10_list__sponsorship_obj.svelte
Normal file
163
src/10_list__sponsorship_obj.svelte
Normal file
@@ -0,0 +1,163 @@
|
||||
<script lang="ts">
|
||||
// *** Import Svelte core
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
// *** Import Aether core variables and functions
|
||||
import { ae } from 'aether_npm_lib';
|
||||
import { slct, ae_app, slct_trigger } from './stores';
|
||||
|
||||
export let container_class_li = [];
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** List - Sponsorships Obj');
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<section class="svelte_component ae_section ae_list list__sponsorship_obj sponsorship_obj_li {container_class_li.join(' ')}">
|
||||
{#if $slct.sponsorship_obj_li}
|
||||
<table class="ae_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Options</th>
|
||||
<th>Name</th> <!-- This is the name of the organization or person -->
|
||||
<th>Level</th>
|
||||
<th>Paid</th>
|
||||
<th>Guests</th>
|
||||
<th>
|
||||
<!-- Show what POC (Point of Contact) stands for when hovering -->
|
||||
<abbr title="Point of Contact" class="ae_label">POC</abbr>
|
||||
</th>
|
||||
<th>Created</th>
|
||||
<th>Updated</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each $slct.sponsorship_obj_li as ae_sponsorship_obj, index}
|
||||
<tr
|
||||
id={`ae_sponsorship_id__${ae_sponsorship_obj.sponsorship_id_random}`}
|
||||
class="ae_object sponsorship_obj"
|
||||
>
|
||||
|
||||
<td class="ae_options sponsorship_obj__options">
|
||||
<button
|
||||
on:click={() => {
|
||||
$slct.sponsorship_id = ae_sponsorship_obj.sponsorship_id_random;
|
||||
$slct.sponsorship_obj = ae_sponsorship_obj;
|
||||
$slct_trigger = 'load__sponsorship_obj';
|
||||
|
||||
$ae_app.sponsorships.show_main__options = true;
|
||||
$ae_app.sponsorships.show_list__sponsorship_obj_li = true;
|
||||
$ae_app.sponsorships.show_view__sponsorship_obj = true;
|
||||
$ae_app.sponsorships.show_edit__sponsorship_obj = false;
|
||||
}}
|
||||
class="ae_btn btn_primary"
|
||||
title={`Open to see details: ${ae_sponsorship_obj.name}`}
|
||||
>
|
||||
<span class="fas fa-envelope-open"></span>
|
||||
<!-- <span class="fas fa-info-circle"></span> -->
|
||||
View
|
||||
</button>
|
||||
|
||||
{#if $ae_app.administrator_access}
|
||||
<button
|
||||
on:click={() => {
|
||||
$slct.sponsorship_id = ae_sponsorship_obj.sponsorship_id_random;
|
||||
$slct.sponsorship_obj = ae_sponsorship_obj;
|
||||
$slct_trigger = 'load__sponsorship_obj';
|
||||
|
||||
// $ae_app.sponsorships.show_main__options = true;
|
||||
// $ae_app.sponsorships.show_list__sponsorship_obj_li = true;
|
||||
$ae_app.sponsorships.show_view__sponsorship_obj = false;
|
||||
$ae_app.sponsorships.show_edit__sponsorship_obj = true;
|
||||
}}
|
||||
class="ae_btn btn_secondary"
|
||||
title={`Edit meeting: ${ae_sponsorship_obj.name}`}
|
||||
>
|
||||
<span class="fas fa-edit"></span> Edit
|
||||
</button>
|
||||
{/if}
|
||||
</td>
|
||||
|
||||
<td class="ae_value sponsorships__name">{ae_sponsorship_obj.name}</td>
|
||||
|
||||
<td class="">
|
||||
<span class="fas fa-gem"></span>
|
||||
{#if ae_sponsorship_obj.level_num}{ae_sponsorship_obj.level_num}{/if}
|
||||
{#if ae_sponsorship_obj.level_str}{ae_sponsorship_obj.level_str}{/if}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{#if ae_sponsorship_obj.paid}
|
||||
<!-- Show checkmark -->
|
||||
<span class="fas fa-check"
|
||||
title="Paid"></span>
|
||||
{:else}
|
||||
<!-- Show X or cross -->
|
||||
<span class="fas fa-times"
|
||||
title="Not Paid"></span>
|
||||
{/if}
|
||||
{#if ae_sponsorship_obj.amount}
|
||||
<span class="ae_value sponsorships__amount">${ae_sponsorship_obj.amount}</span>
|
||||
{/if}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{#if ae_sponsorship_obj.guest_li_json}
|
||||
<span class="fas fa-list-ol"></span> {ae_sponsorship_obj.guest_li_json.length}
|
||||
{:else}
|
||||
<!-- <span class="fas fa-list-ol"></span> -->
|
||||
-- None --
|
||||
{/if}
|
||||
</td>
|
||||
|
||||
<td><span class="ae_flex ae_flex_justify_around">
|
||||
{#if ae_sponsorship_obj.poc_json}
|
||||
<span>
|
||||
<span class="fas fa-user"></span> {ae_sponsorship_obj.poc_json.given_name} {ae_sponsorship_obj.poc_json.family_name}
|
||||
</span>
|
||||
<a href="mailto:{ae_sponsorship_obj.poc_json.email}"><span class="fas fa-envelope"></span> {ae_sponsorship_obj.poc_json.email}</a>
|
||||
{/if}
|
||||
</span></td>
|
||||
|
||||
<td>{ae.util.iso_datetime_formatter(ae_sponsorship_obj.created_on, 'datetime_short')}</td>
|
||||
<td>{ae.util.iso_datetime_formatter(ae_sponsorship_obj.updated_on, 'datetime_short')}</td>
|
||||
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
{:else}
|
||||
<div>No sponsorships avalible to show at this time</div>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
|
||||
<style>
|
||||
.ae_label {
|
||||
font-size: smaller;
|
||||
}
|
||||
.ae_value {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.ae_header h3 {
|
||||
font-size: 1.2em;
|
||||
margin: 0;
|
||||
/* padding: 0; */
|
||||
}
|
||||
|
||||
.sponsorship_obj .ae_meta {
|
||||
flex-direction: column;
|
||||
/* justify-content: space-between; */
|
||||
}
|
||||
|
||||
.sponsorship_obj .ae_meta .ae_group {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.sponsorship_obj .ae_meta .ae_options {
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
}
|
||||
</style>
|
||||
78
src/10_player__archive_content_obj.svelte
Normal file
78
src/10_player__archive_content_obj.svelte
Normal file
@@ -0,0 +1,78 @@
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher, onMount } from 'svelte';
|
||||
import { fade } from 'svelte/transition';
|
||||
|
||||
// import { ae, Element_modal_v3 } from 'aether_npm_lib';
|
||||
import { slct, slct_trigger, ae_app } from './stores';
|
||||
|
||||
// export let archive_content_id = null;
|
||||
|
||||
let file_icons:any = {}
|
||||
file_icons['ac3'] = 'file-audio';
|
||||
file_icons['aac'] = 'file-audio';
|
||||
file_icons['csv'] = 'file-csv';
|
||||
file_icons['doc'] = 'file-word';
|
||||
file_icons['docx'] = 'file-word';
|
||||
file_icons['gif'] = 'file-image';
|
||||
file_icons['htm'] = 'file-code';
|
||||
file_icons['html'] = 'file-code';
|
||||
file_icons['jpeg'] = 'file-image';
|
||||
file_icons['jpg'] = 'file-image';
|
||||
file_icons['key'] = 'file-powerpoint';
|
||||
file_icons['mkv'] = 'file-video';
|
||||
file_icons['mov'] = 'file-video';
|
||||
file_icons['mp3'] = 'file-audio';
|
||||
file_icons['mp4'] = 'file-video';
|
||||
file_icons['pdf'] = 'file-pdf';
|
||||
file_icons['png'] = 'file-image';
|
||||
file_icons['ppt'] = 'file-powerpoint';
|
||||
file_icons['pptx'] = 'file-powerpoint';
|
||||
file_icons['txt'] = 'file-alt';
|
||||
file_icons['wav'] = 'file-audio';
|
||||
file_icons['webp'] = 'file-image';
|
||||
file_icons['xls'] = 'file-excel';
|
||||
file_icons['xlsx'] = 'file-excel';
|
||||
file_icons['zip'] = 'file-archive';
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** Player - Archive Content Obj');
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- <h3 class="ae_title">Viewing: {$slct.archive_content_obj.name}</h3> -->
|
||||
|
||||
<section class="ae_content">
|
||||
{#if file_icons[$slct.archive_content_obj.file_extension] == 'file-audio'}
|
||||
<audio id="view_archive_content_audio" width="" height="" autoplay controls style="max-width: 100%; max-height: 65vh;">
|
||||
<source id="view_archive_content_audio_source" src="{$ae_app.app.base_url}{$slct.archive_content_obj.file_path}" type="audio/mpeg">
|
||||
<!--<source src="audio.ogg" type="audio/ogg">-->
|
||||
Your browser does not support the audio tag.
|
||||
</audio>
|
||||
|
||||
{:else if file_icons[$slct.archive_content_obj.file_extension] == 'file-video'}
|
||||
<video id="view_archive_content_video" width="" height="" autoplay controls style="max-width: 100%; max-height: 65vh;">
|
||||
<source id="view_archive_content_video_source" src="{$ae_app.app.base_url}{$slct.archive_content_obj.file_path}" type="video/mp4">
|
||||
<!--<source src="video.ogg" type="video/ogg">-->
|
||||
<track kind="captions" src="" srclang="en" label="English">
|
||||
Your browser does not support the video tag.
|
||||
</video>
|
||||
|
||||
{:else if file_icons[$slct.archive_content_obj.file_extension] == 'file-image'}
|
||||
<img id="view_archive_content_image" src="{$ae_app.app.base_url}{$slct.archive_content_obj.file_path}" alt="{$slct.archive_content_obj.name}" style="max-width: 100%; max-height: 65vh;" />
|
||||
{:else}
|
||||
<a href="{$ae_app.app.base_url}{$slct.archive_content_obj.file_path}">{$slct.archive_content_obj.filename}</a>
|
||||
{/if}
|
||||
|
||||
{#if $slct.archive_content_obj.description}
|
||||
<div id="archive_content__description" class="archive_content__description">
|
||||
{$slct.archive_content_obj.description}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if $slct.archive_content_obj.content_html}
|
||||
<div id="archive_content__content_html" class="archive_content__content_html">
|
||||
{@html $slct.archive_content_obj.content_html}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
</section>
|
||||
244
src/10_view__archive_obj.svelte
Normal file
244
src/10_view__archive_obj.svelte
Normal file
@@ -0,0 +1,244 @@
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher, onMount } from 'svelte';
|
||||
import { fade } from 'svelte/transition';
|
||||
|
||||
import { ae, Element_modal_v3 } from 'aether_npm_lib';
|
||||
import { slct, slct_trigger, ae_app } from './stores';
|
||||
|
||||
// import Edit_archive_content_obj from './10_edit__archive_content_obj.svelte';
|
||||
import List_archive_content_obj from './10_list__archive_content_obj.svelte';
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
if ($slct.archive_id) {
|
||||
console.log(`Archive ID selected: ${$slct.archive_id}`);
|
||||
console.log(`Archive Object selected: ${$slct.archive_obj}`)
|
||||
|
||||
$slct_trigger = 'load__archive_obj';
|
||||
$slct_trigger = 'load__archive_content_obj_li';
|
||||
|
||||
// Auto show the selected Archive ID
|
||||
// Set the URL param "archive_id" to the current Archive ID. This is a just in case.
|
||||
const url = new URL(location);
|
||||
url.searchParams.set('archive_id', $slct.archive_id);
|
||||
history.pushState({}, '', url);
|
||||
|
||||
// $ae_app.archives.show_main__options = true;
|
||||
$ae_app.archives.show_list__archive_obj_li = false;
|
||||
$ae_app.archives.show_edit__archive_obj = false;
|
||||
$ae_app.archives.show_view__archive_obj = true;
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** View - Archive Obj');
|
||||
});
|
||||
|
||||
function handle_archive_content_obj_created(event) {
|
||||
console.log('*** handle_archive_content_obj_created() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
$slct.archive_content_id = null;
|
||||
$slct.archive_content_obj = {};
|
||||
|
||||
$slct_trigger = 'load__archive_obj_li';
|
||||
$slct_trigger = 'load__archive_obj';
|
||||
$slct_trigger = 'load__archive_content_obj_li';
|
||||
|
||||
// $ae_app.archives.show_list__archive_obj_li = false;
|
||||
// $ae_app.archives.show_edit__archive_obj = false;
|
||||
// $ae_app.archives.show_view__archive_obj = true;
|
||||
$ae_app.archives.show_edit__archive_content_id = false;
|
||||
}
|
||||
function handle_archive_content_obj_updated(event) {
|
||||
console.log('*** handle_archive_content_obj_updated() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
$slct_trigger = 'load__archive_obj';
|
||||
$slct_trigger = 'load__archive_content_obj_li';
|
||||
|
||||
// $ae_app.archives.show_list__archive_obj_li = false;
|
||||
// $ae_app.archives.show_edit__archive_obj = false;
|
||||
// $ae_app.archives.show_view__archive_obj = true;
|
||||
$ae_app.archives.show_edit__archive_content_id = false;
|
||||
}
|
||||
function handle_archive_content_obj_deleted(event) {
|
||||
console.log('*** handle_archive_content_obj_deleted() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
$slct_trigger = 'load__archive_obj_li';
|
||||
$slct_trigger = 'load__archive_obj';
|
||||
$slct_trigger = 'load__archive_content_obj_li';
|
||||
|
||||
// $ae_app.archives.show_list__archive_obj_li = false;
|
||||
// $ae_app.archives.show_edit__archive_obj = false;
|
||||
// $ae_app.archives.show_view__archive_obj = true;
|
||||
$ae_app.archives.show_edit__archive_content_id = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<section class="svelte_component ae_section ae_view archive_obj view__archive_obj" bind:clientHeight={$ae_app.iframe_height_modal_body}>
|
||||
|
||||
<header class="ae_header archive__header">
|
||||
<h2 class="archive__name">{@html $slct.archive_obj.name}</h2>
|
||||
</header>
|
||||
|
||||
<section class="archive__content">
|
||||
{#if $slct.archive_obj.description}<div class="ae_value archive__description">{@html $slct.archive_obj.description}</div>{/if}
|
||||
{#if $slct.archive_obj.content_html}<div class="ae_value">{@html $slct.archive_obj.content_html}</div>{/if}
|
||||
{#if $slct.archive_obj.original_url}
|
||||
<div>
|
||||
<span class="ae_label">URL:</span>
|
||||
<span class="ae_value">{$slct.archive_obj.original_url}</span>
|
||||
</div>
|
||||
{/if}
|
||||
{#if $slct.archive_obj.original_datetime}
|
||||
<div class="archive__original_datetime">
|
||||
<span class="ae_label">Start Date:</span>
|
||||
<span class="ae_value">{ae.util.iso_datetime_formatter($slct.archive_obj.original_datetime, 'datetime_long')}</span>
|
||||
</div>
|
||||
{/if}
|
||||
{#if $slct.archive_obj.original_timezone}
|
||||
<span class="ae_label">Timezone:</span>
|
||||
<span class="ae_value">{$slct.archive_obj.original_timezone}</span>
|
||||
{/if}
|
||||
{#if $slct.archive_obj.original_location}
|
||||
<div>
|
||||
<span class="ae_label">Location:</span>
|
||||
<span class="ae_value">{$slct.archive_obj.original_location}</span>
|
||||
</div>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
<section
|
||||
class="ae_section ae_meta archive__meta"
|
||||
class:ae_d_none={!$ae_app.administrator_access}
|
||||
>
|
||||
<div class="ae_group">
|
||||
<div class="archive__created_on_updated_on">
|
||||
<span class="ae_label">Created on:</span>
|
||||
<span class="ae_value archive__created_on">{ae.util.iso_datetime_formatter($slct.archive_obj.created_on, 'datetime_iso_no_seconds')}</span>
|
||||
{#if $slct.archive_obj.updated_on}
|
||||
<span class="ae_label">Updated on:</span>
|
||||
<span class="ae_value">{ae.util.iso_datetime_formatter($slct.archive_obj.updated_on, 'datetime_iso_no_seconds')}</span>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if $ae_app.trusted_access}
|
||||
<div class="ae_options">
|
||||
{#if $ae_app.trusted_access || $slct.archive_obj.external_person_id === $ae_app.novi_uuid}
|
||||
<button
|
||||
on:click={() => {
|
||||
$slct.archive_content_id = null;
|
||||
$slct.archive_content_obj = {};
|
||||
$ae_app.archives.show_edit__archive_content_id = true;
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-warning"
|
||||
title={`Add content for: ${$slct.archive_obj.name}`}
|
||||
>
|
||||
<span class="fas fa-plus"></span> Add Content
|
||||
</button>
|
||||
|
||||
<button
|
||||
on:click={() => {
|
||||
// $slct.archive_id = $slct.archive_obj.archive_id_random;
|
||||
// $slct.archive_obj = $slct.archive_obj;
|
||||
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.set('archive_id', $slct.archive_obj.archive_id_random);
|
||||
// history.pushState({}, '', url);
|
||||
|
||||
// $ae_app.archives.show_main__options = false;
|
||||
// $ae_app.archives.show_list__archive_obj_li = false;
|
||||
$ae_app.archives.show_view__archive_obj = false;
|
||||
$ae_app.archives.show_edit__archive_obj = true;
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-xs btn-warning"
|
||||
title={`Edit archive: ${$slct.archive_obj.name}`}
|
||||
>
|
||||
<span class="fas fa-edit"></span> Edit Archive
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
{#if $slct.archive_obj}
|
||||
<!-- {#each $slct.archive_content_obj_li as idaa_archive_content_obj, index} -->
|
||||
<List_archive_content_obj />
|
||||
<!-- {/each} -->
|
||||
{/if}
|
||||
|
||||
|
||||
|
||||
<!-- {#if $slct.archive_content_obj_li && $slct.archive_content_obj_li.length} -->
|
||||
<!-- {#each $slct.archive_content_obj_li as idaa_archive_content_obj, index}
|
||||
<hr />
|
||||
<span class="archive_content__name">{idaa_archive_content_obj.name}</span>
|
||||
<pre class="archive_content__content">{@html idaa_archive_content_obj.content}</pre>
|
||||
|
||||
<section class="ae_section ae_meta archive_content__meta">
|
||||
<div class="ae_group">
|
||||
<div class="archive_content__created_on_updated_on">
|
||||
Created on:
|
||||
<span class="archive_content__created_on">{ae.util.iso_datetime_formatter(idaa_archive_content_obj.created_on, 'datetime_iso_no_seconds')}
|
||||
{#if idaa_archive_content_obj.updated_on}
|
||||
Updated on:
|
||||
{ae.util.iso_datetime_formatter(idaa_archive_content_obj.updated_on, 'datetime_iso_no_seconds')}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if $ae_app.trusted_access || idaa_archive_content_obj.external_person_id === $ae_app.novi_uuid}
|
||||
<div class="ae_options">
|
||||
<button on:click={() => {
|
||||
$slct.archive_content_id = idaa_archive_content_obj.archive_content_id_random;
|
||||
$slct.archive_content_obj = idaa_archive_content_obj;
|
||||
|
||||
// $ae_app.archives.show_archive_content_list = false;
|
||||
$ae_app.archives.show_edit__archive_content_id = true;
|
||||
// $ae_app.archives.show_view__archive_obj = false;
|
||||
}}
|
||||
class="btn btn-default"
|
||||
>
|
||||
<span class="fas fa-edit"></span> Edit Content
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
{/each} -->
|
||||
<!-- {/if} -->
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<style>
|
||||
.ae_label {
|
||||
font-size: smaller;
|
||||
}
|
||||
.ae_value {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.archive_obj .ae_meta {
|
||||
flex-direction: column;
|
||||
/* justify-content: space-between; */
|
||||
}
|
||||
|
||||
.archive_obj .ae_meta .ae_group {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.archive_obj .ae_meta .ae_options {
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.archive__created_on_updated_on, .archive_content__created_on_updated_on {
|
||||
/* font-size: smaller; */
|
||||
/* background-color: hsla(0,80%,50%,1); */
|
||||
/* color: hsla(0,0%,50%,1); */
|
||||
}
|
||||
</style>
|
||||
261
src/10_view__post_obj.svelte
Normal file
261
src/10_view__post_obj.svelte
Normal file
@@ -0,0 +1,261 @@
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher, onMount } from 'svelte';
|
||||
import { fade } from 'svelte/transition';
|
||||
|
||||
import { ae, Element_modal_v3 } from 'aether_npm_lib';
|
||||
import { slct, slct_trigger, ae_app } from './stores';
|
||||
|
||||
import Edit_post_comment_obj from './10_edit__post_comment_obj.svelte';
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
if ($slct.post_id) {
|
||||
console.log(`Post ID selected: ${$slct.post_id}`);
|
||||
console.log(`Post Object selected: ${$slct.post_obj}`)
|
||||
|
||||
$slct_trigger = 'load__post_obj';
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** View - Post Obj');
|
||||
});
|
||||
|
||||
function handle_post_comment_obj_created(event) {
|
||||
console.log('*** handle_post_comment_obj_created() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
$slct.post_comment_id = null;
|
||||
$slct.post_comment_obj = {};
|
||||
|
||||
$slct_trigger = 'load__post_obj_li';
|
||||
$slct_trigger = 'load__post_obj';
|
||||
$slct_trigger = 'load__post_comment_obj_li';
|
||||
|
||||
// $ae_app.posts.show_post_list = false;
|
||||
// $ae_app.posts.show_edit__post_id = false;
|
||||
// $ae_app.posts.show_view__post_id = true;
|
||||
$ae_app.posts.show_edit__post_comment = false;
|
||||
}
|
||||
function handle_post_comment_obj_updated(event) {
|
||||
console.log('*** handle_post_comment_obj_updated() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
$slct_trigger = 'load__post_obj';
|
||||
$slct_trigger = 'load__post_comment_obj_li';
|
||||
|
||||
// $ae_app.posts.show_post_list = false;
|
||||
// $ae_app.posts.show_edit__post_id = false;
|
||||
// $ae_app.posts.show_view__post_id = true;
|
||||
$ae_app.posts.show_edit__post_comment = false;
|
||||
}
|
||||
function handle_post_comment_obj_deleted(event) {
|
||||
console.log('*** handle_post_comment_obj_deleted() ***');
|
||||
console.log(event.detail);
|
||||
|
||||
$slct_trigger = 'load__post_obj_li';
|
||||
$slct_trigger = 'load__post_obj';
|
||||
$slct_trigger = 'load__post_comment_obj_li';
|
||||
|
||||
// $ae_app.posts.show_post_list = false;
|
||||
// $ae_app.posts.show_edit__post_id = false;
|
||||
// $ae_app.posts.show_view__post_id = true;
|
||||
$ae_app.posts.show_edit__post_comment = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<section
|
||||
bind:clientHeight={$ae_app.iframe_height_modal_body}
|
||||
class="svelte_component ae_section ae_view post_obj view__post_obj"
|
||||
>
|
||||
|
||||
<div class="post__header">
|
||||
<h2 class="post__title">
|
||||
{@html $slct.post_obj.title}
|
||||
{#if $slct.post_obj.topic_id}<span class="badge badge-info bg-info"><span class="fas fa-user-md"></span> {$slct.post_obj.topic_name}</span>{/if}
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<div class="post__content">{@html $slct.post_obj.content}</div>
|
||||
|
||||
<section class="ae_section ae_meta post__meta">
|
||||
<div class="ae_group">
|
||||
{#if ($slct.post_obj.anonymous)}
|
||||
<div class="post__posted_by">
|
||||
Posted by: <span class="fas fa-user-secret"></span> <span class="post__full_name">Anonymous</span>
|
||||
</div>
|
||||
{:else if ($slct.post_obj.full_name)}
|
||||
<div class="post__posted_by">
|
||||
Posted by: <span class="fas fa-user"></span> <span class="post__full_name">{$slct.post_obj.full_name}
|
||||
{#if $ae_app.trusted_access && $slct.post_obj.email}
|
||||
<a href="mailto:{$slct.post_obj.email}?subject=IDAA BB Post">{$slct.post_obj.email}</a>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="post__created_on_updated_on">
|
||||
{#if !$slct.post_obj.updated_on}
|
||||
<span class="ae_label">Created on:</span>
|
||||
<span class="ae_value post__created_on">{ae.util.iso_datetime_formatter($slct.post_obj.created_on, 'datetime_iso_no_seconds')}</span>
|
||||
{:else}
|
||||
<span class="ae_label">Updated on:</span>
|
||||
<span class="ae_value post__updated_on">
|
||||
{ae.util.iso_datetime_formatter($slct.post_obj.updated_on, 'datetime_iso_no_seconds')}</span>
|
||||
{/if}
|
||||
<span class="post__archive_on">
|
||||
<span class="ae_label">Archive on:</span>
|
||||
<span class="ae_value">{ae.util.iso_datetime_formatter($slct.post_obj.archive_on, 'datetime_iso_no_seconds')}</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ae_options">
|
||||
{#if $slct.post_obj.post_comment_count}
|
||||
<span class="ae_badge ae_info post__post_comment_count">
|
||||
<span class="fas fa-comment"></span> {($slct.post_obj.post_comment_count == 1 ? `${$slct.post_obj.post_comment_count} comment` : `${$slct.post_obj.post_comment_count} comments` )}
|
||||
</span>
|
||||
{/if}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.posts.show_edit__post_comment = true;
|
||||
}}
|
||||
class="btn btn-primary"
|
||||
title={`New comment on: ${$slct.post_obj.title}`}
|
||||
>
|
||||
<span class="fas fa-plus"></span> New Comment
|
||||
</button>
|
||||
|
||||
{#if $ae_app.trusted_access || $slct.post_obj.external_person_id === $ae_app.novi_uuid || $slct.post_obj.email === $ae_app.novi_email}
|
||||
<button
|
||||
on:click={() => {
|
||||
// $slct.post_id = $slct.post_obj.post_id_random;
|
||||
// $slct.post_obj = $slct.post_obj;
|
||||
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.set('post_id', $slct.post_obj.post_id_random);
|
||||
// history.pushState({}, '', url);
|
||||
|
||||
// $ae_app.posts.show_main__options = false;
|
||||
// $ae_app.posts.show_list__post_li = false;
|
||||
$ae_app.posts.show_view__post_id = false;
|
||||
$ae_app.posts.show_edit__post_id = true;
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-xs btn-secondary"
|
||||
title={`Edit post: ${$slct.post_obj.name}`}
|
||||
>
|
||||
<span class="fas fa-edit"></span> Edit
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
{#if $ae_app.posts.show_edit__post_comment}
|
||||
<section class="bb_post_comment_crud">
|
||||
|
||||
<Element_modal_v3
|
||||
show = { true }
|
||||
modal_cover_body = { true }
|
||||
on:close={ () => {
|
||||
$slct.post_comment_id = null;
|
||||
$slct.post_comment_obj = {};
|
||||
|
||||
// $ae_app.posts.show_post_list = true;
|
||||
// $ae_app.posts.show_edit__post_id = false;
|
||||
// $ae_app.posts.show_view__post_id = false;
|
||||
$ae_app.posts.show_edit__post_comment = false;
|
||||
}}
|
||||
>
|
||||
<span slot="header_title">Comment on: {($slct.post_obj.title ? $slct.post_obj.title : '')}</span>
|
||||
|
||||
<span slot="body">
|
||||
<section class="post_comment_obj_view">
|
||||
<Edit_post_comment_obj on:post_comment_obj_created={handle_post_comment_obj_created} on:post_comment_obj_updated={handle_post_comment_obj_updated} on:post_comment_obj_deleted={handle_post_comment_obj_deleted} />
|
||||
</section>
|
||||
</span>
|
||||
</Element_modal_v3>
|
||||
</section>
|
||||
{/if}
|
||||
|
||||
{#if $slct.post_comment_obj_li.length}
|
||||
{#each $slct.post_comment_obj_li as idaa_post_comment_obj, index}
|
||||
<hr />
|
||||
<div class="post_comment__content">{@html idaa_post_comment_obj.content}</div>
|
||||
|
||||
|
||||
<section class="ae_section ae_meta post_comment__meta">
|
||||
<div class="ae_group">
|
||||
<span class="post_comment__posted_by `comment_by_container">
|
||||
<span class="comment_by_lable">Comment by:</span>
|
||||
{#if idaa_post_comment_obj.anonymous}
|
||||
<span class="fas fa-user-secret"></span>
|
||||
<span class="comment_by_full_name anonymous">Anonymous</span>
|
||||
{:else}
|
||||
<span class="fas fa-user"></span>
|
||||
<span class="comment_by_full_name">{idaa_post_comment_obj.full_name}</span>
|
||||
<!-- {#if idaa_post_comment_obj.email}
|
||||
(<a href="mailto:{idaa_post_comment_obj.email}"><span class="comment_by_email">{idaa_post_comment_obj.email}</span></a>)
|
||||
{/if} -->
|
||||
{/if}
|
||||
<div class="post_comment__created_on_updated_on">
|
||||
Created on:
|
||||
<span class="post_comment__created_on">{ae.util.iso_datetime_formatter(idaa_post_comment_obj.created_on, 'datetime_iso_no_seconds')}
|
||||
{#if idaa_post_comment_obj.updated_on}
|
||||
Updated on:
|
||||
{ae.util.iso_datetime_formatter(idaa_post_comment_obj.updated_on, 'datetime_iso_no_seconds')}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if $ae_app.trusted_access || idaa_post_comment_obj.external_person_id === $ae_app.novi_uuid}
|
||||
<div class="ae_options">
|
||||
<button on:click={() => {
|
||||
$slct.post_comment_id = idaa_post_comment_obj.post_comment_id_random;
|
||||
$slct.post_comment_obj = idaa_post_comment_obj;
|
||||
|
||||
// $ae_app.posts.show_post_comment_list = false;
|
||||
$ae_app.posts.show_edit__post_comment = true;
|
||||
// $ae_app.posts.show_view__post_id = false;
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-secondary"
|
||||
>
|
||||
<span class="fas fa-edit"></span> Edit Comment
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
{/each}
|
||||
{/if}
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<style>
|
||||
.post_obj .ae_meta {
|
||||
flex-direction: column;
|
||||
/* justify-content: space-between; */
|
||||
}
|
||||
|
||||
.post_obj .ae_meta .ae_group {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.post_obj .ae_meta .ae_options {
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.post__posted_by, .post_comment__posted_by {
|
||||
/* font-size: smaller; */
|
||||
/* background-color: hsla(0,80%,50%,1); */
|
||||
/* color: hsla(0,0%,50%,1); */
|
||||
}
|
||||
|
||||
.post__created_on_updated_on, .post_comment__created_on_updated_on {
|
||||
/* font-size: smaller; */
|
||||
/* background-color: hsla(0,80%,50%,1); */
|
||||
/* color: hsla(0,0%,50%,1); */
|
||||
}
|
||||
</style>
|
||||
192
src/10_view__sponsorship_obj.svelte
Normal file
192
src/10_view__sponsorship_obj.svelte
Normal file
@@ -0,0 +1,192 @@
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher, onMount } from 'svelte';
|
||||
import { fade } from 'svelte/transition';
|
||||
|
||||
import { ae } from 'aether_npm_lib';
|
||||
import { slct, slct_trigger, ae_app } from './stores';
|
||||
|
||||
export let container_class_li = [];
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
if ($slct.sponsorship_id) {
|
||||
console.log(`Sponsorship ID selected: ${$slct.sponsorship_id}`);
|
||||
console.log(`Sponsorship Object selected: ${$slct.sponsorship_obj}`)
|
||||
|
||||
$slct_trigger = 'load__sponsorship_obj';
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** View - Sponsorship Obj');
|
||||
});
|
||||
|
||||
|
||||
dayjs.extend(window.dayjs_plugin_utc)
|
||||
dayjs.extend(window.dayjs_plugin_timezone);
|
||||
console.log(`UTC offset: ${dayjs().utcOffset()}`);
|
||||
console.log(`TZ offset: ${dayjs().utcOffset('US/Pacific')}`);
|
||||
// let test_time = dayjs.utc('2024-01-08 11:55').tz('Asia/Taipei');
|
||||
// let test_time = dayjs.utc('2024-01-08 14:15').tz('America/New_York');
|
||||
let test_time = dayjs.tz('2024-01-08 14:15', 'US/Pacific');
|
||||
console.log(test_time.format('YYYY-MM-DD HH:mm'));
|
||||
let adjusted_to_local_tz = test_time.tz('America/New_York');
|
||||
console.log(adjusted_to_local_tz.format('YYYY-MM-DD HH:mm'));
|
||||
|
||||
let adjusted_to_local_tz_v2 = dayjs.tz('2024-01-08 14:15', 'US/Pacific').tz('America/New_York');
|
||||
console.log(adjusted_to_local_tz_v2);
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<section class="svelte_component ae_section ae_view sponsorship_obj view__sponsorship_obj {container_class_li.join(' ')}">
|
||||
|
||||
<div class="sponsorship__header">
|
||||
<h2 class="sponsorship__name">{@html $slct.sponsorship_obj.name}</h2>
|
||||
</div>
|
||||
|
||||
<div class="sponsorship__content">
|
||||
<div
|
||||
class="sponsorship_description description"
|
||||
>
|
||||
<div class="ae_label sponsorship__description">Description:</div>
|
||||
<pre class="ae_value sponsorship__description">{@html $slct.sponsorship_obj.description ? $slct.sponsorship_obj.description : '-- No Description Given --'}</pre>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class:ae_d_none={!$slct.sponsorship_obj.level_num}
|
||||
class="sponsorship_level"
|
||||
>
|
||||
<span class="ae_label">Level of Sponsorship:</span>
|
||||
<span class="ae_value"><span class="fas fa-gem"></span> {$slct.sponsorship_obj.level_num} — {$slct.sponsorship_obj.level_str}</span>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span class="ae_label">Paid:</span>
|
||||
$
|
||||
<span class="ae_value">
|
||||
{$slct.sponsorship_obj.paid ? 'Yes, marked as paid' : 'Not yet marked as paid'}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="ae_list sponsorship__guests">
|
||||
<h2>Guest List</h2>
|
||||
|
||||
{#if $slct.sponsorship_obj.guest_li_json && $slct.sponsorship_obj.guest_li_json.length && $slct.sponsorship_obj.guest_li_json[0].full_name}
|
||||
<ul>
|
||||
{#each $slct.sponsorship_obj.guest_li_json as guest, index}
|
||||
<li class="sponsorship__guest"
|
||||
class:ae_d_none={!$slct.sponsorship_obj.guest_li_json[index].full_name}
|
||||
>
|
||||
<span class="ae_label">
|
||||
<span class="fas fa-user"></span> Contact:
|
||||
</span>
|
||||
{$slct.sponsorship_obj.guest_li_json[index].full_name}
|
||||
{#if $slct.sponsorship_obj.guest_li_json[index].email}
|
||||
| <a href="mailto:{$slct.sponsorship_obj.guest_li_json[index].email}?Subject={$slct.sponsorship_obj.full_name}">{$slct.sponsorship_obj.guest_li_json[index].email}</a>
|
||||
{/if}
|
||||
{#if $slct.sponsorship_obj.guest_li_json[index].phone_mobile}
|
||||
<span class="ae_label">| Mobile:</span>
|
||||
<a href="tel:{$slct.sponsorship_obj.guest_li_json[index].phone_mobile}">{$slct.sponsorship_obj.guest_li_json[index].phone_mobile}</a>
|
||||
{/if}
|
||||
{#if $slct.sponsorship_obj.guest_li_json[index].phone_home}
|
||||
<span class="ae_label">| Home:</span>
|
||||
<a href="tel:{$slct.sponsorship_obj.guest_li_json[index].phone_home}">{$slct.sponsorship_obj.guest_li_json[index].phone_home}</a>
|
||||
{/if}
|
||||
{#if $slct.sponsorship_obj.guest_li_json[index].phone_office}
|
||||
<span class="ae_label">| Office:</span>
|
||||
<a href="tel:{$slct.sponsorship_obj.guest_li_json[index].phone_office}">{$slct.sponsorship_obj.guest_li_json[index].phone_office}</a>
|
||||
{/if}
|
||||
{#if $slct.sponsorship_obj.guest_li_json[index].other_text}| {$slct.sponsorship_obj.guest_li_json[index].other_text}{/if}
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
{:else}
|
||||
<div class="ae_warning">No guest list found!</div>
|
||||
{/if}
|
||||
|
||||
</div>
|
||||
|
||||
<section class="ae_section ae_meta sponsorship__meta">
|
||||
<div class="ae_group">
|
||||
<span
|
||||
class="sponsorship__id"
|
||||
class:ae_d_none={!$ae_app.administrator_access}>
|
||||
ID:
|
||||
{$slct.sponsorship_obj.sponsorship_id_random}
|
||||
</span>
|
||||
<span
|
||||
class="sponsorship__created_on"
|
||||
>
|
||||
Created on: {ae.util.iso_datetime_formatter($slct.sponsorship_obj.created_on, 'datetime_short')}
|
||||
</span>
|
||||
<span
|
||||
class="sponsorship__updated_on"
|
||||
class:ae_d_none={!$slct.sponsorship_obj.updated_on}
|
||||
>
|
||||
Updated on: {ae.util.iso_datetime_formatter($slct.sponsorship_obj.updated_on, 'datetime_short')}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{#if $ae_app.trusted_access || $slct.sponsorship_obj.external_person_id === $ae_app.novi_uuid || $slct.sponsorship_obj.contact_1_email === $ae_app.novi_email}
|
||||
<div class="ae_options">
|
||||
<button
|
||||
on:click={() => {
|
||||
// $slct.sponsorship_id = $slct.sponsorship_obj.sponsorship_id_random;
|
||||
// $slct.sponsorship_obj = $slct.sponsorship_obj;
|
||||
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.set('sponsorship_id', $slct.sponsorship_obj.sponsorship_id_random);
|
||||
// history.pushState({}, '', url);
|
||||
|
||||
// $ae_app.sponsorships.show_main__options = true;
|
||||
// $ae_app.sponsorships.show_list__sponsorship_obj_li = true;
|
||||
$ae_app.sponsorships.show_view__sponsorship_obj = false;
|
||||
$ae_app.sponsorships.show_edit__sponsorship_obj = true;
|
||||
}}
|
||||
class="btn btn-xs btn-secondary"
|
||||
title={`Edit sponsorship: ${$slct.sponsorship_obj.name}`}
|
||||
>
|
||||
<span class="fas fa-edit"></span> Edit
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<style>
|
||||
.ae_label {
|
||||
font-size: smaller;
|
||||
}
|
||||
.ae_value {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.sponsorship__user_timezone {
|
||||
font-size: smaller;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.sponsorship_obj .ae_meta {
|
||||
flex-direction: column;
|
||||
/* justify-content: space-between; */
|
||||
}
|
||||
|
||||
.sponsorship_obj .ae_meta .ae_group {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.sponsorship_obj .ae_meta .ae_options {
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
/* a {
|
||||
color: #82B6E1;
|
||||
} */
|
||||
</style>
|
||||
@@ -1,21 +1,47 @@
|
||||
<script lang="ts">
|
||||
import Test from './test.svelte';
|
||||
export let name: string;
|
||||
import svelteLogo from './assets/svelte.svg'
|
||||
import viteLogo from '/vite.svg'
|
||||
import Counter from './lib/Counter.svelte'
|
||||
</script>
|
||||
|
||||
<section>
|
||||
<p>Name: {name}</p>
|
||||
<main>
|
||||
<div>
|
||||
<a href="https://vitejs.dev" target="_blank" rel="noreferrer">
|
||||
<img src={viteLogo} class="logo" alt="Vite Logo" />
|
||||
</a>
|
||||
<a href="https://svelte.dev" target="_blank" rel="noreferrer">
|
||||
<img src={svelteLogo} class="logo svelte" alt="Svelte Logo" />
|
||||
</a>
|
||||
</div>
|
||||
<h1>Vite + Svelte</h1>
|
||||
|
||||
<Test />
|
||||
<div class="card">
|
||||
<Counter />
|
||||
</div>
|
||||
|
||||
</section>
|
||||
<p>
|
||||
Check out <a href="https://github.com/sveltejs/kit#readme" target="_blank" rel="noreferrer">SvelteKit</a>, the official Svelte app framework powered by Vite!
|
||||
</p>
|
||||
|
||||
<p class="read-the-docs">
|
||||
Click on the Vite and Svelte logos to learn more
|
||||
</p>
|
||||
</main>
|
||||
|
||||
<style>
|
||||
section {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
p {
|
||||
color: green;
|
||||
}
|
||||
.logo {
|
||||
height: 6em;
|
||||
padding: 1.5em;
|
||||
will-change: filter;
|
||||
transition: filter 300ms;
|
||||
}
|
||||
.logo:hover {
|
||||
filter: drop-shadow(0 0 2em #646cffaa);
|
||||
}
|
||||
.logo.svelte:hover {
|
||||
filter: drop-shadow(0 0 2em #ff3e00aa);
|
||||
}
|
||||
.read-the-docs {
|
||||
color: #888;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
<script lang="ts">
|
||||
export let name: string;
|
||||
|
||||
let count = 0;
|
||||
|
||||
function handleClick() {
|
||||
count += 1;
|
||||
}
|
||||
|
||||
let m = { x: 0, y: 0 };
|
||||
|
||||
function handle_mousemove(event) {
|
||||
m.x = event.clientX;
|
||||
m.y = event.clientY;
|
||||
}
|
||||
|
||||
|
||||
let first_name = '';
|
||||
let last_name = '';
|
||||
let full_name = 'Not Here';
|
||||
$: full_name = first_name + ' ' + last_name;
|
||||
|
||||
let name_checked = false;
|
||||
</script>
|
||||
|
||||
<main>
|
||||
<input bind:value={first_name}>
|
||||
<input bind:value={last_name}>
|
||||
<label>Check me <input type=checkbox bind:checked={name_checked}></label>
|
||||
|
||||
<h1>Hello {full_name}!</h1>
|
||||
{#if name_checked}
|
||||
<p>Thank you. We will bombard your inbox and sell your personal details.</p>
|
||||
{:else}
|
||||
<p>You must opt in to continue. If you're not paying, you're the product.</p>
|
||||
{/if}
|
||||
|
||||
<button disabled={!name_checked}>
|
||||
Subscribe
|
||||
</button>
|
||||
|
||||
<p>This is a new app using Svelte.</p>
|
||||
<button on:click={handleClick}>
|
||||
Clicked {count} {count === 1 ? 'time' : 'times'}
|
||||
</button>
|
||||
|
||||
<div class="my_class">My fancy class!</div>
|
||||
|
||||
<div on:mousemove={handle_mousemove}>
|
||||
The mouse position is {m.x} x {m.y}
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<style>
|
||||
main {
|
||||
text-align: center;
|
||||
padding: 1rem;
|
||||
max-width: 240px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: hsla(0, 50%, 50%, 1);
|
||||
/*text-transform: uppercase;*/
|
||||
font-size: 4rem;
|
||||
font-weight: 100;
|
||||
}
|
||||
|
||||
@media (min-width: 640px) {
|
||||
main {
|
||||
max-width: none;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -1,38 +0,0 @@
|
||||
import axios from 'axios';
|
||||
|
||||
console.log('*** api_update.js ***');
|
||||
|
||||
var axios_fastapi = axios.create({
|
||||
//baseURL: 'https://dev-fastapi.oneskyit.com',
|
||||
//baseURL: 'http://fastapi.localhost:5005',
|
||||
baseURL: 'http://192.168.32.20:5005',
|
||||
/* other custom settings */
|
||||
});
|
||||
axios_fastapi.defaults.headers['Access-Control-Allow-Origin'] = '*';
|
||||
axios_fastapi.defaults.headers['content-type'] = 'application/json';
|
||||
axios_fastapi.defaults.headers['x-aether-api-key'] = 'aaabbbcccxxxyyyzzz';
|
||||
axios_fastapi.defaults.headers['x-aether-api-token'] = 'aaabbbcccxxxyyyzzz';
|
||||
axios_fastapi.defaults.headers['x-aether-api-expire-on'] = '';
|
||||
axios_fastapi.defaults.headers['x-account-id'] = 'xxxyyyzzz111222333';
|
||||
|
||||
|
||||
async function delete_object({axios=axios_fastapi, endpoint='', data=[]}) {
|
||||
console.log('*** delete_object() ***');
|
||||
|
||||
console.log(data)
|
||||
|
||||
// https://stackoverflow.com/questions/51069552/axios-delete-request-with-body-and-headers
|
||||
let response_data = await axios.delete(endpoint, { 'data': data }) // not just data?
|
||||
.then(function (response) {
|
||||
console.log(response.data);
|
||||
return response.data;
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
return error;
|
||||
});
|
||||
|
||||
return response_data;
|
||||
}
|
||||
|
||||
export default delete_object;
|
||||
@@ -1,52 +0,0 @@
|
||||
import axios from 'axios';
|
||||
|
||||
console.log('*** api_update.js ***');
|
||||
|
||||
var axios_fastapi = axios.create({
|
||||
baseURL: 'https://dev-fastapi.oneskyit.com',
|
||||
// baseURL: 'http://fastapi.localhost:5005',
|
||||
// baseURL: 'http://192.168.32.20:5005',
|
||||
/* other custom settings */
|
||||
});
|
||||
axios_fastapi.defaults.headers['Access-Control-Allow-Origin'] = '*';
|
||||
axios_fastapi.defaults.headers['content-type'] = 'application/json';
|
||||
axios_fastapi.defaults.headers['x-aether-api-key'] = 'aaabbbcccxxxyyyzzz';
|
||||
axios_fastapi.defaults.headers['x-aether-api-token'] = 'aaabbbcccxxxyyyzzz';
|
||||
axios_fastapi.defaults.headers['x-aether-api-expire-on'] = '';
|
||||
axios_fastapi.defaults.headers['x-account-id'] = 'xxxyyyzzz111222333';
|
||||
|
||||
|
||||
async function get_object({axios=axios_fastapi, endpoint='', params=[], data=[], return_meta=false, force_li=false}) {
|
||||
console.log('*** get_object() ***');
|
||||
|
||||
//console.log(endpoint);
|
||||
//console.log(params);
|
||||
//console.log(data);
|
||||
//console.log(return_meta);
|
||||
//console.log(force_li);
|
||||
|
||||
let response_data = await axios.get(endpoint, { params: params })
|
||||
.then(function (response) {
|
||||
console.log(response.data);
|
||||
if (!Array.isArray(response.data['data']) && force_li) {
|
||||
console.log('Forcing return as a list');
|
||||
let return_data = [];
|
||||
return_data.push(response.data['data']);
|
||||
return return_data;
|
||||
} else {
|
||||
return response.data['data'];
|
||||
}
|
||||
//return response.data;
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error.response);
|
||||
if (error.response.status === 404) {
|
||||
return null;
|
||||
}
|
||||
return error;
|
||||
});
|
||||
|
||||
return response_data;
|
||||
}
|
||||
|
||||
export default get_object;
|
||||
@@ -1,45 +0,0 @@
|
||||
import axios from 'axios';
|
||||
|
||||
console.log('*** api_update.js ***');
|
||||
|
||||
var axios_fastapi = axios.create({
|
||||
// baseURL: 'https://dev-fastapi.oneskyit.com',
|
||||
baseURL: 'http://fastapi.localhost:5005',
|
||||
// baseURL: 'http://192.168.32.20:5005',
|
||||
/* other custom settings */
|
||||
});
|
||||
axios_fastapi.defaults.headers['Access-Control-Allow-Origin'] = '*';
|
||||
axios_fastapi.defaults.headers['content-type'] = 'application/json';
|
||||
axios_fastapi.defaults.headers['x-aether-api-key'] = 'aaabbbcccxxxyyyzzz';
|
||||
axios_fastapi.defaults.headers['x-aether-api-token'] = 'aaabbbcccxxxyyyzzz';
|
||||
axios_fastapi.defaults.headers['x-aether-api-expire-on'] = '';
|
||||
axios_fastapi.defaults.headers['x-account-id'] = 'xxxyyyzzz111222333';
|
||||
|
||||
|
||||
async function patch_object({axios=axios_fastapi, endpoint='', params=[], record=[], return_meta=false}) {
|
||||
console.log('*** patch_object() ***');
|
||||
|
||||
//console.log(endpoint);
|
||||
//console.log(params);
|
||||
console.log(record);
|
||||
//console.log(return_meta);
|
||||
//console.log(force_li);
|
||||
|
||||
let response_data = await axios.patch(endpoint, record, { params: params })
|
||||
.then(function (response) {
|
||||
console.log(response.data);
|
||||
return response.data['data'];
|
||||
//return response.data;
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error.response);
|
||||
if (error.response.status === 404) {
|
||||
return null;
|
||||
}
|
||||
return error;
|
||||
});
|
||||
|
||||
return response_data;
|
||||
}
|
||||
|
||||
export default patch_object;
|
||||
@@ -1,45 +0,0 @@
|
||||
import axios from 'axios';
|
||||
|
||||
console.log('*** api_post.js ***');
|
||||
|
||||
var axios_fastapi = axios.create({
|
||||
// baseURL: 'https://dev-fastapi.oneskyit.com',
|
||||
baseURL: 'http://fastapi.localhost:5005',
|
||||
// baseURL: 'http://192.168.32.20:5005',
|
||||
/* other custom settings */
|
||||
});
|
||||
axios_fastapi.defaults.headers['Access-Control-Allow-Origin'] = '*';
|
||||
axios_fastapi.defaults.headers['content-type'] = 'application/json';
|
||||
axios_fastapi.defaults.headers['x-aether-api-key'] = 'aaabbbcccxxxyyyzzz';
|
||||
axios_fastapi.defaults.headers['x-aether-api-token'] = 'aaabbbcccxxxyyyzzz';
|
||||
axios_fastapi.defaults.headers['x-aether-api-expire-on'] = '';
|
||||
axios_fastapi.defaults.headers['x-account-id'] = 'xxxyyyzzz111222333';
|
||||
|
||||
|
||||
async function post_object({axios=axios_fastapi, endpoint='', record=[], return_meta=false}) {
|
||||
console.log('*** post_object() ***');
|
||||
|
||||
//console.log(endpoint);
|
||||
//console.log(params);
|
||||
console.log(record);
|
||||
//console.log(return_meta);
|
||||
//console.log(force_li);
|
||||
|
||||
let response_data = await axios.post(endpoint, record)
|
||||
.then(function (response) {
|
||||
console.log(response.data);
|
||||
return response.data['data'];
|
||||
//return response.data;
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error.response);
|
||||
if (error.response.status === 404) {
|
||||
return null;
|
||||
}
|
||||
return error;
|
||||
});
|
||||
|
||||
return response_data;
|
||||
}
|
||||
|
||||
export default post_object;
|
||||
711
src/app.css
Normal file
711
src/app.css
Normal file
@@ -0,0 +1,711 @@
|
||||
:root {
|
||||
font-family: system-ui, Helvetica, Arial, sans-serif;
|
||||
/* line-height: 1.5; */
|
||||
/* font-weight: 400; */
|
||||
|
||||
color-scheme: light dark;
|
||||
/* color: rgba(255, 255, 255, 0.87); */
|
||||
/* background-color: #242424; */
|
||||
|
||||
/* font-synthesis: none; */
|
||||
/* text-rendering: optimizeLegibility; */
|
||||
/* -webkit-font-smoothing: antialiased; */
|
||||
/* -moz-osx-font-smoothing: grayscale; */
|
||||
/* -webkit-text-size-adjust: 100%; */
|
||||
}
|
||||
|
||||
body {
|
||||
/* Use boarder-box to make things easier with borders and scrolling in general. */
|
||||
box-sizing: border-box;
|
||||
|
||||
/* outline: dashed thick blue; */
|
||||
/* border: solid thick blue; */
|
||||
|
||||
margin: 1em;
|
||||
padding: 0em;
|
||||
|
||||
/* Account for the margin */
|
||||
height: calc(100vh - 1em - 1em);
|
||||
|
||||
/* max-width: 1280px; */
|
||||
|
||||
/* background-color: hsla(240, 50%, 20%); */
|
||||
background-color: hsla(207, 43%, 18%);
|
||||
|
||||
/* Display as flex does not seem to work well here. */
|
||||
}
|
||||
|
||||
.svelte_target.ae_svelte_app_hub {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
|
||||
background-color: hsla(0, 0%, 100%, .50);
|
||||
color: black;
|
||||
font-size: x-small;
|
||||
|
||||
padding: .25em;
|
||||
|
||||
z-index: 1000;
|
||||
|
||||
opacity: .5;
|
||||
|
||||
transition: all .25s ease-in-out;
|
||||
}
|
||||
.svelte_target.ae_svelte_app_hub:hover {
|
||||
opacity: 1;
|
||||
background-color: hsla(0, 50%, 80%, .75);
|
||||
}
|
||||
|
||||
.svelte_target.ae_svelte_app {
|
||||
|
||||
box-sizing: border-box;
|
||||
/* box-sizing: content-box; */
|
||||
/* outline: solid thin hsla(0, 50%, 50%, .50); */
|
||||
border: solid medium hsla(0, 0%, 50%, .40);
|
||||
/* border-color: hsla(207, 43%, 18%); */
|
||||
|
||||
/* background-color: white; */
|
||||
/* background-color: hsla(240, 100%, 95%, .97); */
|
||||
background-color: hsla(0, 0%, 100%, .90);
|
||||
|
||||
|
||||
overflow: scroll;
|
||||
|
||||
height: 100%;
|
||||
/* max-height: calc(100% - 1em); */
|
||||
|
||||
/* width: 100%; */
|
||||
/* max-width: calc(100% - 1em); */
|
||||
max-width: 1280px;
|
||||
|
||||
/* margin: 1em; */
|
||||
/* Use auto margin to center this element within the body */
|
||||
margin: auto;
|
||||
padding: .5em;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* Use this to fix the scrolling. This is mostly useful for wide tables. */
|
||||
/* This must be applied to the parent of the table. */
|
||||
.svelte_target.ae_svelte_app .svelte_component {
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
#Site-Header {
|
||||
background-color: hsla(0, 0%, 100%, 0.85);
|
||||
padding: .5em 1em;
|
||||
margin-bottom: 1em;
|
||||
|
||||
/* display: flex; */
|
||||
/* justify-content: space-between; */
|
||||
}
|
||||
|
||||
#Site-Header h1 {
|
||||
/* text-shadow: 0em 0em .75em hsla(240,100%,25%,1); */
|
||||
/* text-shadow: 0em 0em .75em hsla(0,0%,5%,1); */
|
||||
|
||||
font-size: 2.5em;
|
||||
line-height: 1.1;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#Site-Header h2 {
|
||||
font-size: 1.5em;
|
||||
line-height: 1.1;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
/* Make font italic */
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
#Site-Nav-Menu {
|
||||
background-color: hsla(0, 0%, 100%, 0.85);
|
||||
/* padding: .5em 1em; */
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
#Site-Footer {
|
||||
background-color: hsla(0, 0%, 100%, 0.85);
|
||||
padding: .5em 1em;
|
||||
margin-top: 1em;
|
||||
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
|
||||
address {
|
||||
margin-bottom: .25em;
|
||||
padding-left: .5em;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
pre {
|
||||
white-space: pre-wrap;
|
||||
word-break: normal;
|
||||
word-wrap: normal;
|
||||
|
||||
border: none;
|
||||
}
|
||||
|
||||
table.ae_table {
|
||||
/* border-collapse: collapse; */
|
||||
border-spacing: 0px;
|
||||
border: solid thin hsla(0, 0%, 0%, .30);
|
||||
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
|
||||
/* margin: 1em; */
|
||||
/* padding: 1em; */
|
||||
/* overflow: scroll; */
|
||||
|
||||
}
|
||||
.ae_table tr {
|
||||
border: solid thin hsla(0, 0%, 0%, .20);
|
||||
}
|
||||
.ae_table th {
|
||||
border: solid thin hsla(0, 0%, 0%, .10);
|
||||
border-bottom: solid thin hsla(0, 0%, 0%, .20);
|
||||
|
||||
padding: .5em;
|
||||
|
||||
/* text-align: center; */
|
||||
}
|
||||
.ae_table td {
|
||||
border: solid thin hsla(0, 0%, 0%, .10);
|
||||
|
||||
padding: .5em;
|
||||
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
textarea {
|
||||
/* width: calc(fit-content - 1em); */
|
||||
width: 100%;
|
||||
max-width: calc(fit-content - .5em);
|
||||
}
|
||||
|
||||
button.ae_normal, .btn.ae_normal {
|
||||
/* font: normal 1em sans-serif; */
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
button.ae_smaller, .btn.ae_smaller {
|
||||
font-size: .8rem;
|
||||
}
|
||||
|
||||
button.ae_smallest, .btn.ae_smallest {
|
||||
font-size: .65rem;
|
||||
}
|
||||
|
||||
/* h1 {
|
||||
font-size: 3.2em;
|
||||
line-height: 1.1;
|
||||
} */
|
||||
|
||||
/* .card {
|
||||
padding: 2em;
|
||||
} */
|
||||
|
||||
/* #app {
|
||||
max-width: 1280px;
|
||||
margin: 0 auto;
|
||||
padding: 2rem;
|
||||
text-align: center;
|
||||
} */
|
||||
|
||||
/* button {
|
||||
border-radius: 8px;
|
||||
border: 1px solid transparent;
|
||||
padding: 0.6em 1.2em;
|
||||
font-size: 1em;
|
||||
font-weight: 500;
|
||||
font-family: inherit;
|
||||
background-color: #1a1a1a;
|
||||
cursor: pointer;
|
||||
transition: border-color 0.25s;
|
||||
}
|
||||
button:hover {
|
||||
border-color: #646cff;
|
||||
}
|
||||
button:focus,
|
||||
button:focus-visible {
|
||||
outline: 4px auto -webkit-focus-ring-color;
|
||||
} */
|
||||
|
||||
/* @media (prefers-color-scheme: light) {
|
||||
:root {
|
||||
color: #213547;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
a:hover {
|
||||
color: #747bff;
|
||||
}
|
||||
button {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
} */
|
||||
|
||||
|
||||
/* BEGIN: Novi and Bootstrap specific fixes */
|
||||
/* .ae_btn .btn_xs, .btn .btn-xs {
|
||||
font-size: .65rem;
|
||||
} */
|
||||
|
||||
.ae_btn.btn-danger, .ae_btn.btn-info, .ae_btn.btn-warning {
|
||||
border-radius: 60px;
|
||||
}
|
||||
|
||||
/* END: Novi and Bootstrap specific fixes */
|
||||
|
||||
|
||||
.ae_main {
|
||||
/* min-height: fit-content; */
|
||||
/* min-height: 100vh; */
|
||||
/* height: 100%; */
|
||||
|
||||
/* min-width: 100vw; */
|
||||
/* width: 100%; */
|
||||
|
||||
/* contain: layout; */
|
||||
/* contain: content; */
|
||||
/* contain: size; */
|
||||
}
|
||||
|
||||
.ae_dev_in_progress {
|
||||
background-color: hsla(300,80%,50%,1);
|
||||
}
|
||||
|
||||
.c_idaa_bb, .c_idaa_recovery_meetings {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
/* align-items: center; */
|
||||
/* justify-content: center; */
|
||||
/* min-height: 100vh; */
|
||||
|
||||
gap: 1em;
|
||||
}
|
||||
|
||||
.c_idaa_archives>.ae_meta, .c_idaa_bb>.ae_meta, .c_idaa_recovery_meetings>.ae_meta {
|
||||
background-color: lightgray;
|
||||
}
|
||||
|
||||
.ae_list.archive_obj_li {
|
||||
/* border: solid thin gray; */
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
/* align-items: stretch; */
|
||||
/* justify-content: stretch; */
|
||||
gap: .5em;
|
||||
}
|
||||
|
||||
.ae_list.archive_obj_li .ae_object.archive_obj, .ae_list.archive_content_obj_li .ae_object.archive_content_obj {
|
||||
border-top: solid medium hsla(0,0%,90%,1);
|
||||
/* border-bottom: solid thin hsla(0,0%,90%,1); */
|
||||
/* margin: 1em .5em; */
|
||||
padding: .5em .5em;
|
||||
|
||||
width: 100%;
|
||||
|
||||
/* flex-grow: 1; */
|
||||
}
|
||||
|
||||
.c_idaa_recovery_meetings section.ae_options fieldset {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.c_idaa_recovery_meetings section.ae_options fieldset legend {
|
||||
display: inline;
|
||||
/* border: none; */
|
||||
margin: 0;
|
||||
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.ae_list.event_obj_li {
|
||||
/* border: solid thin gray; */
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
/* align-items: stretch; */
|
||||
/* justify-content: stretch; */
|
||||
gap: .5em;
|
||||
}
|
||||
|
||||
.ae_list.event_obj_li .ae_object.event_obj {
|
||||
border-top: solid medium hsla(0,0%,90%,1);
|
||||
/* border-bottom: solid thin hsla(0,0%,90%,1); */
|
||||
/* margin: 1em .5em; */
|
||||
padding: .5em .5em;
|
||||
|
||||
width: 100%;
|
||||
|
||||
/* flex-grow: 1; */
|
||||
}
|
||||
|
||||
/* For now this only affects the IDAA Recovery Meetings when viewing a specific meeting. */
|
||||
.view__event_obj a, .view__event_obj a.ae_link {
|
||||
/* color: #007bff; */
|
||||
color: #82B6E1;
|
||||
/* text-decoration: underline; */
|
||||
/* background-color: transparent; */
|
||||
}
|
||||
.view__event_obj a:hover, .view__event_obj a:focus, .view__event_obj a.ae_link:hover, .view__event_obj a.ae_link:focus {
|
||||
color: #0056b3;
|
||||
text-decoration: underline;
|
||||
/* background-color: transparent; */
|
||||
|
||||
/* scale: 1.1; */
|
||||
}
|
||||
|
||||
.svelte_component {
|
||||
margin: 0em;
|
||||
padding: 0em;
|
||||
}
|
||||
|
||||
.ae_section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.ae_warning {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.ae_highlight {
|
||||
background-color: hsla(60,100%,50%,1);
|
||||
}
|
||||
|
||||
.ae_d_none, .d-none {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.ae_group {
|
||||
/* display: flex; */
|
||||
/* flex-direction: row; */
|
||||
/* align-items: center; */
|
||||
/* justify-content: space-between; */
|
||||
/* justify-content: space-evenly; */
|
||||
}
|
||||
|
||||
.ae_flex {
|
||||
display: flex;
|
||||
|
||||
/* flex-direction: row; */
|
||||
/* align-items: center; */
|
||||
/* justify-content: space-between; */
|
||||
}
|
||||
|
||||
.ae_column {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
/* align-items: center; */
|
||||
/* justify-content: space-between; */
|
||||
justify-content: space-evenly;
|
||||
}
|
||||
|
||||
.ae_row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
||||
align-items: center;
|
||||
/* justify-content: space-between; */
|
||||
justify-content: space-evenly;
|
||||
}
|
||||
|
||||
.ae_flex_justify_around {
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.ae_text_align_left {
|
||||
text-align: left;
|
||||
}
|
||||
.ae_text_align_center {
|
||||
text-align: center;
|
||||
}
|
||||
.ae_text_align_right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
|
||||
.ae_width_25 {
|
||||
width: 25%;
|
||||
/* max-width: 25%; */
|
||||
}
|
||||
.ae_width_30 {
|
||||
width: 30%;
|
||||
/* max-width: 30%; */
|
||||
}
|
||||
.ae_width_50 {
|
||||
width: 50%;
|
||||
/* max-width: 50%; */
|
||||
}
|
||||
.ae_width_100 {
|
||||
width: 100%;
|
||||
/* max-width: 100%; */
|
||||
}
|
||||
|
||||
.ae_width_md {
|
||||
min-width: 16em;
|
||||
width: 16em;
|
||||
max-width: 16em;
|
||||
}
|
||||
|
||||
.ae_margin_xs {
|
||||
margin: .25em;
|
||||
}
|
||||
.ae_margin_sm {
|
||||
margin: .5em;
|
||||
}
|
||||
.ae_margin_md {
|
||||
margin: .75em;
|
||||
}
|
||||
.ae_margin_lg {
|
||||
margin: 1.0em;
|
||||
}
|
||||
.ae_margin_lg {
|
||||
margin: 1.25em;
|
||||
}
|
||||
|
||||
.ae_float_right {
|
||||
float: right;
|
||||
align-self: flex-end;
|
||||
}
|
||||
|
||||
|
||||
.ae_options {
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
.ae_fade_in {
|
||||
/* animation: fadein 1s; */
|
||||
opacity: 1;
|
||||
/* height: initial; */
|
||||
/* max-height: 100%; */
|
||||
/* width: initial; */
|
||||
/* max-width: 100%; */
|
||||
transition: opacity, height, width, .25s ease-in;
|
||||
|
||||
/* transition: height 1s ease-in; */
|
||||
/* width: initial; */
|
||||
/* transition: opacity, height, width 1s ease-in 1s; */
|
||||
}
|
||||
.ae_fade_out {
|
||||
/* animation: fadeout 1s; */
|
||||
opacity: 0;
|
||||
height: 0;
|
||||
max-height: 0;
|
||||
width: 0;
|
||||
max-width: 0;
|
||||
transition: opacity, height, width, .25s ease-out;
|
||||
}
|
||||
|
||||
/* .ae_section.ae_options {
|
||||
border: solid thin hsla(0,0%,90%,.75); */
|
||||
|
||||
/* Display options using flex (row, wrap, space elements equally) */
|
||||
/* display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center; */
|
||||
/* justify-content: space-evenly; */
|
||||
/* align-content: center;
|
||||
align-items: center;
|
||||
} */
|
||||
|
||||
.ae_section.ae_meta {
|
||||
font-size: smaller;
|
||||
color: hsla(0,0%,50%,1);
|
||||
}
|
||||
|
||||
.svelte_component.ae_edit {
|
||||
/* outline: dashed thin pink; */
|
||||
border: solid medium hsla(220,100%,50%,.1);
|
||||
|
||||
}
|
||||
|
||||
.svelte_component.ae_create {
|
||||
border: solid medium hsla(0,100%,50%,.1);
|
||||
}
|
||||
|
||||
/* This covers the entire viewable area. Essentially a new "body" */
|
||||
/* element_ae_modal ae_modal_showing_container ae_modal modal_cover_body */
|
||||
.ae_modal {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 1000;
|
||||
|
||||
min-height: 100vh;
|
||||
height: 100%;
|
||||
/* max-height: 100vh; */
|
||||
|
||||
min-width: 100%;
|
||||
/* width: 100%; */
|
||||
width: 100vw;
|
||||
max-width: 100vw;
|
||||
/* max-width: 1280px; */
|
||||
|
||||
/* background-color: hsla(180,75%,90%,.75); */
|
||||
background-color: hsla(180,0%,90%,.75);
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
align-items: center;
|
||||
/* align-items: flex-start; */
|
||||
/* justify-content: center; */
|
||||
/* justify-content: flex-start; */
|
||||
|
||||
/* contain: layout; */
|
||||
contain: strict;
|
||||
/* contain: size; */
|
||||
|
||||
/* Margin should stay 0 and padding can be used to create space within the modal for the actual content. */
|
||||
margin: 0;
|
||||
padding: 0em;
|
||||
|
||||
/* pointer-events: auto; */
|
||||
}
|
||||
|
||||
.ae_modal .modal_content {
|
||||
z-index: 1001;
|
||||
position: relative;
|
||||
|
||||
box-sizing: content-box;
|
||||
|
||||
background-color: white;
|
||||
/* margin: 1em;
|
||||
padding: .25em .5em; */
|
||||
margin: 0em;
|
||||
padding: 0em;
|
||||
|
||||
border: solid thin lightgray;
|
||||
border-radius: .5em;
|
||||
|
||||
/* box-shadow: .5em .5em 1.5em .5em hsla(0, 0%, 0%, .9); */
|
||||
box-shadow: 0em 0em 1.5em .5em hsla(0, 0%, 0%, .9);
|
||||
|
||||
/* min-height: 50vh; */
|
||||
max-height: calc(100vh - 2em);
|
||||
/* max-height: fit-content; */
|
||||
|
||||
/* min-width: 50vw; */
|
||||
max-width: calc(100vw - 2em);
|
||||
/* max-width: 100vw; */
|
||||
|
||||
/* scroll-behavior: auto; */
|
||||
/* overflow: scroll; */
|
||||
/* overflow: auto; */
|
||||
/* contain: content; */
|
||||
/* contain: strict; */
|
||||
/* overflow: auto; */
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.ae_modal .modal_header {
|
||||
background-color: hsla(0,0%,90%,.5);
|
||||
border-bottom: solid thin lightgray;
|
||||
|
||||
margin: 0em;
|
||||
padding: .25em .25em;
|
||||
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.ae_modal .modal_body {
|
||||
/* outline: dashed medium pink; */
|
||||
|
||||
margin: 0em;
|
||||
padding: .25em .25em;
|
||||
|
||||
/* height: 100vh; */
|
||||
|
||||
/* contain: content; */
|
||||
/* pointer-events: auto; */
|
||||
overflow: scroll;
|
||||
/* overflow-x: auto; */
|
||||
/* overflow-y: scroll; */
|
||||
}
|
||||
|
||||
.ae_modal .modal_footer {
|
||||
background-color: hsla(0,0%,90%,.5);
|
||||
border-top: solid thin lightgray;
|
||||
|
||||
margin: 0em;
|
||||
padding: .25em .25em;
|
||||
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
/* body.modal_cover_body {
|
||||
pointer-events: none;
|
||||
overflow-y: hidden;
|
||||
height: fit-content;
|
||||
contain: size;
|
||||
} */
|
||||
|
||||
body.modal_cover_body .ae_modal {
|
||||
margin: 0em;
|
||||
padding: 0em;
|
||||
/* max-width: 100vw; */
|
||||
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
body.modal_cover_body .ae_modal .modal_content {
|
||||
/* outline: dashed thin pink; */
|
||||
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
|
||||
box-shadow: none;
|
||||
|
||||
max-height: calc(100vh - .5em);
|
||||
|
||||
max-width: calc(100vw);
|
||||
}
|
||||
|
||||
body.modal_cover_body .ae_modal .modal_body {
|
||||
/* outline: dashed medium pink; */
|
||||
}
|
||||
|
||||
|
||||
form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
/* justify-content: flex-start; */
|
||||
/* align-items: center; */
|
||||
|
||||
padding: .75em;
|
||||
}
|
||||
|
||||
form fieldset {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
/* justify-content: flex-start; */
|
||||
/* align-items: center; */
|
||||
}
|
||||
|
||||
/* Make readonly input fields grayed out and hide border*/
|
||||
form input:read-only {
|
||||
/* background-color: hsla(0,0%,90%,1); */
|
||||
border: none;
|
||||
}
|
||||
1
src/assets/svelte.svg
Normal file
1
src/assets/svelte.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="26.6" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 308"><path fill="#FF3E00" d="M239.682 40.707C211.113-.182 154.69-12.301 113.895 13.69L42.247 59.356a82.198 82.198 0 0 0-37.135 55.056a86.566 86.566 0 0 0 8.536 55.576a82.425 82.425 0 0 0-12.296 30.719a87.596 87.596 0 0 0 14.964 66.244c28.574 40.893 84.997 53.007 125.787 27.016l71.648-45.664a82.182 82.182 0 0 0 37.135-55.057a86.601 86.601 0 0 0-8.53-55.577a82.409 82.409 0 0 0 12.29-30.718a87.573 87.573 0 0 0-14.963-66.244"></path><path fill="#FFF" d="M106.889 270.841c-23.102 6.007-47.497-3.036-61.103-22.648a52.685 52.685 0 0 1-9.003-39.85a49.978 49.978 0 0 1 1.713-6.693l1.35-4.115l3.671 2.697a92.447 92.447 0 0 0 28.036 14.007l2.663.808l-.245 2.659a16.067 16.067 0 0 0 2.89 10.656a17.143 17.143 0 0 0 18.397 6.828a15.786 15.786 0 0 0 4.403-1.935l71.67-45.672a14.922 14.922 0 0 0 6.734-9.977a15.923 15.923 0 0 0-2.713-12.011a17.156 17.156 0 0 0-18.404-6.832a15.78 15.78 0 0 0-4.396 1.933l-27.35 17.434a52.298 52.298 0 0 1-14.553 6.391c-23.101 6.007-47.497-3.036-61.101-22.649a52.681 52.681 0 0 1-9.004-39.849a49.428 49.428 0 0 1 22.34-33.114l71.664-45.677a52.218 52.218 0 0 1 14.563-6.398c23.101-6.007 47.497 3.036 61.101 22.648a52.685 52.685 0 0 1 9.004 39.85a50.559 50.559 0 0 1-1.713 6.692l-1.35 4.116l-3.67-2.693a92.373 92.373 0 0 0-28.037-14.013l-2.664-.809l.246-2.658a16.099 16.099 0 0 0-2.89-10.656a17.143 17.143 0 0 0-18.398-6.828a15.786 15.786 0 0 0-4.402 1.935l-71.67 45.674a14.898 14.898 0 0 0-6.73 9.975a15.9 15.9 0 0 0 2.709 12.012a17.156 17.156 0 0 0 18.404 6.832a15.841 15.841 0 0 0 4.402-1.935l27.345-17.427a52.147 52.147 0 0 1 14.552-6.397c23.101-6.006 47.497 3.037 61.102 22.65a52.681 52.681 0 0 1 9.003 39.848a49.453 49.453 0 0 1-22.34 33.12l-71.664 45.673a52.218 52.218 0 0 1-14.563 6.398"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.9 KiB |
@@ -1,119 +0,0 @@
|
||||
var template = {};
|
||||
|
||||
// NOTE address template section
|
||||
template['address'] = {};
|
||||
|
||||
template['address']['id'] = { 'obj_type': 'address', 'obj_prop_name': 'id', 'type': 'hidden', 'placeholder': '', 'class_li': [], 'style': '', 'readonly': 'readonly', 'disabled': 'disabled', 'required': 'required', 'label': 'ID', 'label_class_li': [] };
|
||||
template['address']['id_random'] = { 'obj_type': 'address', 'obj_prop_name': 'id_random', 'type': 'hidden', 'placeholder': '', 'class_li': [], 'style': '', 'readonly': 'readonly', 'disabled': 'disabled', 'required': 'required', 'label': 'ID random', 'label_class_li': [] };
|
||||
|
||||
template['address']['for_type'] = { 'obj_type': 'address', 'obj_prop_name': 'for_type', 'type': 'text', 'placeholder': 'For type', 'class': 'address.for_type', 'style': '', 'label': 'For type', 'label_class_li': [] };
|
||||
template['address']['for_id'] = { 'obj_type': 'address', 'obj_prop_name': 'for_id', 'type': 'text', 'placeholder': 'For ID', 'class': 'address.for_id', 'style': '', 'label': 'For ID', 'label_class_li': [] };
|
||||
|
||||
template['address']['name'] = { 'obj_type': 'address', 'obj_prop_name': 'name', 'type': 'text', 'placeholder': 'Name', 'class': 'address.name', 'style': '', 'label': 'Name', 'label_class_li': [] };
|
||||
template['address']['attention_to'] = { 'obj_type': 'address', 'obj_prop_name': 'attention_to', 'type': 'text', 'placeholder': 'Attention to', 'class': 'address.attention_to', 'style': '', 'label': 'Attention to', 'label_class_li': [] };
|
||||
|
||||
template['address']['organization_name'] = { 'obj_type': 'address', 'obj_prop_name': 'organization_name', 'type': 'text', 'placeholder': 'Organization name', 'class': 'address.organization_name', 'style': '', 'label': 'Organization name', 'label_class_li': [] };
|
||||
template['address']['line_1'] = { 'obj_type': 'address', 'obj_prop_name': 'line_1', 'type': 'text', 'placeholder': 'Line 1', 'class': 'address.line_1', 'style': '', 'label': 'Line 1', 'label_class_li': [] };
|
||||
template['address']['line_2'] = { 'obj_type': 'address', 'obj_prop_name': 'line_2', 'type': 'text', 'placeholder': 'Line 2', 'class': 'address.line_2', 'style': '', 'label': 'Line 2', 'label_class_li': [] };
|
||||
template['address']['line_3'] = { 'obj_type': 'address', 'obj_prop_name': 'line_3', 'type': 'text', 'placeholder': 'Line 3', 'class': 'address.line_3', 'style': '', 'label': 'Line 3', 'label_class_li': [] };
|
||||
template['address']['city'] = { 'obj_type': 'address', 'obj_prop_name': 'city', 'type': 'text', 'placeholder': 'City', 'class': 'address.city', 'style': '', 'label': 'City', 'label_class_li': [] };
|
||||
template['address']['state_province'] = { 'obj_type': 'address', 'obj_prop_name': 'state_province', 'type': 'text', 'placeholder': 'State/Province', 'class': 'address.state_province', 'style': '', 'label': 'State/Province', 'label_class_li': [] };
|
||||
template['address']['postal_code'] = { 'obj_type': 'address', 'obj_prop_name': 'postal_code', 'type': 'text', 'placeholder': 'Postal Code', 'class': 'address.postal_code', 'style': '', 'label': 'Postal code', 'label_class_li': [] };
|
||||
|
||||
//template['address']['country_alpha_2_code'] = { 'obj_type': 'address', 'obj_prop_name': 'country_alpha_2_code', 'type': 'select', 'placeholder': 'Country alpha 2 code', 'class': 'address.country_alpha_2_code', 'style': '', 'label': 'Country alpha 2 code', 'label_class_li': [], 'select_option_li': { 'CA': 'Canada', 'MX': 'Mexico', 'US': 'United States', 'UK': 'United Kingdom' } };
|
||||
template['address']['country_alpha_2_code'] = { 'obj_type': 'address', 'obj_prop_name': 'country_alpha_2_code', 'type': 'select', 'placeholder': 'Country alpha 2 code', 'class': 'address.country_alpha_2_code', 'style': '', 'label': 'Country alpha 2 code', 'label_class_li': [], 'select_option_li': { 'CA': 'Canada', 'MX': 'Mexico', 'US': 'United States', 'UK': 'United Kingdom' } };
|
||||
template['address']['country'] = { 'obj_type': 'address', 'obj_prop_name': 'country', 'type': 'text', 'placeholder': 'Country', 'class': 'address.country', 'style': '', 'label': 'Country', 'label_class_li': [] };
|
||||
|
||||
template['address']['timezone'] = { 'obj_type': 'address', 'obj_prop_name': 'timezone', 'type': 'text', 'placeholder': 'Timezone', 'class': 'address.timezone', 'style': '', 'label': 'Timezone', 'label_class_li': [] };
|
||||
|
||||
template['address']['latitude'] = { 'obj_type': 'address', 'obj_prop_name': 'latitude', 'type': 'text', 'placeholder': 'Latitude', 'class': 'address.latitude', 'style': '', 'label': 'Latitude', 'label_class_li': [] };
|
||||
template['address']['longitude'] = { 'obj_type': 'address', 'obj_prop_name': 'longitude', 'type': 'text', 'placeholder': 'Longitude', 'class': 'address.longitude', 'style': '', 'label': 'Longitude', 'label_class_li': [] };
|
||||
template['address']['map_url'] = { 'obj_type': 'address', 'obj_prop_name': 'map_url', 'type': 'url', 'placeholder': 'Map URL', 'class': 'address.map_url', 'style': '', 'label': 'Map URL', 'label_class_li': [] };
|
||||
|
||||
template['address']['congressional_district'] = { 'obj_type': 'address', 'obj_prop_name': 'congressional_district', 'type': 'text', 'placeholder': 'Congressional district', 'class': 'address.congressional_district', 'style': '', 'label': 'Congressional district', 'label_class_li': [] };
|
||||
|
||||
template['address']['verified'] = { 'obj_type': 'address', 'obj_prop_name': 'verified', 'type': 'checkbox', 'placeholder': 'Verified', 'class': 'address.verified', 'style': '', 'label': 'Verified', 'label_class_li': [] };
|
||||
|
||||
template['address']['created_on'] = { 'obj_type': 'address', 'obj_prop_name': 'created_on', 'type': 'text', 'placeholder': '', 'class': 'address.created_on', 'style': '', 'readonly': 'readonly', 'disabled': 'disabled', 'required': 'required', 'label': 'Created on', 'label_class_li': [] };
|
||||
template['address']['updated_on'] = { 'obj_type': 'address', 'obj_prop_name': 'updated_on', 'type': 'text', 'placeholder': '', 'class': 'address.updated_on', 'style': '', 'readonly': 'readonly', 'disabled': 'disabled', 'required': 'required', 'label': 'Updated on', 'label_class_li': [] };
|
||||
|
||||
|
||||
// NOTE contact section
|
||||
template['contact'] = {};
|
||||
template['contact']['name'] = { 'obj_type': 'contact', 'obj_prop_name': 'name', 'type': 'text', 'placeholder': 'Name', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': 'required', 'label': 'Name', 'label_class_li': [] };
|
||||
template['contact']['title'] = { 'obj_type': 'contact', 'obj_prop_name': 'title', 'type': 'text', 'placeholder': 'Title', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': 'required', 'label': 'Title', 'label_class_li': [] };
|
||||
template['contact']['tagline'] = { 'obj_type': 'contact', 'obj_prop_name': 'tagline', 'type': 'checkbox', 'placeholder': 'Tagline', 'class': 'contact.tagline', 'style': '', 'label': 'Tagline', 'label_class_li': [] };
|
||||
|
||||
template['contact']['email'] = { 'obj_type': 'contact', 'obj_prop_name': 'email', 'type': 'email', 'placeholder': 'Email address', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Email address', 'label_class_li': [] };
|
||||
template['contact']['other_site_url'] = { 'obj_type': 'contact', 'obj_prop_name': 'website_url', 'type': 'url', 'placeholder': 'Website URL', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Website URL', 'label_class_li': [] };
|
||||
template['contact']['website_name'] = { 'obj_type': 'contact', 'obj_prop_name': 'website_name', 'type': 'text', 'placeholder': 'Website name', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Website name', 'label_class_li': [] };
|
||||
|
||||
template['contact']['phone_mobile'] = { 'obj_type': 'contact', 'obj_prop_name': 'phone_mobile', 'type': 'tel', 'placeholder': 'Phone mobile', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Phone mobile', 'label_class_li': [] };
|
||||
template['contact']['phone_home'] = { 'obj_type': 'contact', 'obj_prop_name': 'phone_home', 'type': 'tel', 'placeholder': 'Phone home', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Phone home', 'label_class_li': [] };
|
||||
template['contact']['phone_office'] = { 'obj_type': 'contact', 'obj_prop_name': 'phone_office', 'type': 'tel', 'placeholder': 'Phone office', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Phone office', 'label_class_li': [] };
|
||||
template['contact']['phone_land'] = { 'obj_type': 'contact', 'obj_prop_name': 'phone_land', 'type': 'tel', 'placeholder': 'Phone land', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Phone land', 'label_class_li': [] };
|
||||
template['contact']['phone_fax'] = { 'obj_type': 'contact', 'obj_prop_name': 'phone_fax', 'type': 'tel', 'placeholder': 'Phone fax', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Phone fax', 'label_class_li': [] };
|
||||
|
||||
template['contact']['facebook_url'] = { 'obj_type': 'contact', 'obj_prop_name': 'facebook_url', 'type': 'url', 'placeholder': 'Facebook URL', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Facebook URL', 'label_class_li': [] };
|
||||
template['contact']['instagram_url'] = { 'obj_type': 'contact', 'obj_prop_name': 'instagram_url', 'type': 'url', 'placeholder': 'Instagram URL', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Instagram URL', 'label_class_li': [] };
|
||||
template['contact']['twitter_url'] = { 'obj_type': 'contact', 'obj_prop_name': 'twitter_url', 'type': 'url', 'placeholder': 'Twitter URL', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Twitter URL', 'label_class_li': [] };
|
||||
template['contact']['linkedin_url'] = { 'obj_type': 'contact', 'obj_prop_name': 'linkedin_url', 'type': 'url', 'placeholder': 'LinkedIn URL', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'LinkedIn URL', 'label_class_li': [] };
|
||||
|
||||
template['contact']['other_site_url'] = { 'obj_type': 'contact', 'obj_prop_name': 'other_site_url', 'type': 'url', 'placeholder': 'Other site URL', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Other site URL', 'label_class_li': [] };
|
||||
template['contact']['others_site_name'] = { 'obj_type': 'contact', 'obj_prop_name': 'others_site_name', 'type': 'text', 'placeholder': 'Other site name', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Other site name', 'label_class_li': [] };
|
||||
|
||||
|
||||
template['contact']['enable'] = { 'obj_type': 'contact', 'obj_prop_name': 'enable', 'type': 'checkbox', 'placeholder': 'Enable', 'class': 'contact.enable', 'style': '', 'label': 'Enable', 'label_class_li': [] };
|
||||
|
||||
|
||||
|
||||
// NOTE site template section
|
||||
template['site'] = {};
|
||||
|
||||
template['site']['id'] = { 'obj_type': 'site', 'obj_prop_name': 'id', 'type': 'hidden', 'placeholder': '', 'class_li': [], 'style': '', 'readonly': 'readonly', 'disabled': 'disabled', 'required': 'required', 'label': 'ID', 'label_class_li': [] };
|
||||
template['site']['id_random'] = { 'obj_type': 'site', 'obj_prop_name': 'id_random', 'type': 'hidden', 'placeholder': '', 'class_li': [], 'style': '', 'readonly': 'readonly', 'disabled': 'disabled', 'required': 'required', 'label': 'ID random', 'label_class_li': [] };
|
||||
|
||||
//template['site']['fqdn_1'] = { 'obj_type': 'site', 'obj_prop_name': 'fqdn_1', 'type': 'text', 'placeholder': 'FQDN 1', 'class': 'site.fqdn_1', 'style': '', 'label': 'FQDN 1', 'label_class_li': [] };
|
||||
//template['site']['fqdn_2'] = { 'obj_type': 'site', 'obj_prop_name': 'fqdn_2', 'type': 'text', 'placeholder': 'FQDN 2', 'class': 'site.fqdn_2', 'style': '', 'label': 'FQDN 2', 'label_class_li': [] };
|
||||
//template['site']['fqdn_3'] = { 'obj_type': 'site', 'obj_prop_name': 'fqdn_3', 'type': 'text', 'placeholder': 'FQDN 2', 'class': 'site.fqdn_3', 'style': '', 'label': 'FQDN 3', 'label_class_li': [] };
|
||||
|
||||
template['site']['enable'] = { 'obj_type': 'site', 'obj_prop_name': 'enable', 'type': 'checkbox', 'placeholder': 'Enable', 'class': 'site.enable', 'style': '', 'label': 'Enable', 'label_class_li': [] };
|
||||
|
||||
template['site']['name'] = { 'obj_type': 'site', 'obj_prop_name': 'name', 'type': 'text', 'placeholder': 'Name', 'class': 'site.name', 'style': '', 'label': 'Name', 'label_class_li': [] };
|
||||
template['site']['description'] = { 'obj_type': 'site', 'obj_prop_name': 'description', 'obj_prop_value_pre': true, 'type': 'textarea', 'placeholder': 'Description', 'class': 'site.description', 'style': '', 'label': 'Description', 'label_class_li': [], 'rows': 3, 'cols': 80 };
|
||||
|
||||
template['site']['logo_path'] = { 'obj_type': 'site', 'obj_prop_name': 'logo_path', 'type': 'text', 'placeholder': 'Logo path', 'class': 'site.logo_path', 'style': '', 'label': 'Logo path' };
|
||||
template['site']['banner_image_path'] = { 'obj_type': 'site', 'obj_prop_name': 'banner_image_path', 'type': 'text', 'placeholder': 'Banner image path', 'class': 'site.banner_image_path', 'style': '', 'label': 'Banner image path' };
|
||||
//template['site']['html_menu_path'] = { 'obj_type': 'site', 'obj_prop_name': 'html_menu_path', 'type': 'text', 'placeholder': 'HTML menu path', 'class': 'site.html_menu_path', 'style': '', 'label': 'HTML menu path' };
|
||||
|
||||
template['site']['site_body'] = { 'obj_type': 'site', 'obj_prop_name': 'site_body', 'obj_prop_value_pre': true, 'type': 'textarea', 'placeholder': 'Site body', 'class': 'site.site_body', 'style': '', 'label': 'Site body', 'label_class_li': [], 'rows': 10, 'cols': 80 };
|
||||
template['site']['site_tagline'] = { 'obj_type': 'site', 'obj_prop_name': 'site_tagline', 'type': 'text', 'placeholder': 'Site tagline', 'class': 'site.site_tagline', 'style': '', 'label': 'Site tagline', 'label_class_li': [] };
|
||||
|
||||
template['site']['style_href'] = { 'obj_type': 'site', 'obj_prop_name': 'style_href', 'type': 'text', 'placeholder': 'Style HREF', 'class': 'site.style_href', 'style': '', 'label': 'Style HREF', 'label_class_li': [] };
|
||||
template['site']['script_src'] = { 'obj_type': 'site', 'obj_prop_name': 'script_src', 'type': 'text', 'placeholder': 'Script SRC', 'class': 'site.script_src', 'style': '', 'label': 'Script SRC', 'label_class_li': [] };
|
||||
|
||||
template['site']['google_tracking_id'] = { 'obj_type': 'site', 'obj_prop_name': 'google_tracking_id', 'type': 'text', 'placeholder': 'Google tracking ID', 'class': 'site.google_tracking_id', 'style': '', 'label': 'Google tracking ID', 'label_class_li': [] };
|
||||
|
||||
template['site']['created_on'] = { 'obj_type': 'site', 'obj_prop_name': 'created_on', 'type': 'text', 'placeholder': '', 'class': 'site.created_on', 'style': '', 'readonly': 'readonly', 'disabled': 'disabled', 'required': 'required', 'label': 'Created on', 'label_class_li': [] };
|
||||
template['site']['updated_on'] = { 'obj_type': 'site', 'obj_prop_name': 'updated_on', 'type': 'text', 'placeholder': '', 'class': 'site.updated_on', 'style': '', 'readonly': 'readonly', 'disabled': 'disabled', 'required': 'required', 'label': 'Updated on', 'label_class_li': [] };
|
||||
|
||||
// NOTE person section
|
||||
template['person'] = {};
|
||||
template['person']['given_name'] = { 'obj_type': 'person', 'obj_prop_name': 'given_name', 'type': 'text', 'placeholder': 'Given name', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': 'required', 'label': 'Given name', 'label_class_li': [] };
|
||||
template['person']['middle_name'] = { 'obj_type': 'person', 'obj_prop_name': 'middle_name', 'type': 'text', 'placeholder': 'Middle name', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': 'required', 'label': 'Middle name', 'label_class_li': [] };
|
||||
template['person']['family_name'] = { 'obj_type': 'person', 'obj_prop_name': 'family_name', 'type': 'text', 'placeholder': 'Family name', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Family name', 'label_class_li': [] };
|
||||
template['person']['title'] = { 'obj_type': 'person', 'obj_prop_name': 'title', 'type': 'text', 'placeholder': 'Title', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Title', 'label_class_li': [] };
|
||||
template['person']['tagline'] = { 'obj_type': 'person', 'obj_prop_name': 'tagline', 'type': 'text', 'placeholder': 'Tagline', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Tagline', 'label_class_li': [] };
|
||||
template['person']['organization_name'] = { 'obj_type': 'person', 'obj_prop_name': 'organization_name', 'type': 'text', 'placeholder': 'Organization name', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Organization name', 'label_class_li': [] };
|
||||
|
||||
template['person']['notes'] = { 'obj_type': 'person', 'obj_prop_name': 'notes', 'obj_prop_value_pre': true, 'type': 'textarea', 'placeholder': 'Notes', 'class': 'person.notes', 'style': '', 'label': 'Notes', 'label_class_li': [], 'rows': 3, 'cols': 80 };
|
||||
|
||||
// NOTE user section
|
||||
template['user'] = {};
|
||||
template['user']['email'] = { 'obj_type': 'user', 'obj_prop_name': 'email', 'type': 'email', 'placeholder': 'Email address', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': 'required', 'label': 'Email address', 'label_class_li': [] };
|
||||
template['user']['name'] = { 'obj_type': 'user', 'obj_prop_name': 'name', 'type': 'text', 'placeholder': 'Name', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': 'required', 'label': 'Name', 'label_class_li': [] };
|
||||
template['user']['username'] = { 'obj_type': 'user', 'obj_prop_name': 'username', 'type': 'text', 'placeholder': 'Username', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': 'required', 'label': 'Username', 'label_class_li': [] };
|
||||
template['user']['email_verified'] = { 'obj_type': 'user', 'obj_prop_name': 'email_verified', 'type': 'checkbox', 'placeholder': 'Email verified', 'class': 'user.email_verified', 'style': '', 'label': 'Email verified', 'label_class_li': [] };
|
||||
template['user']['enable'] = { 'obj_type': 'user', 'obj_prop_name': 'enable', 'type': 'checkbox', 'placeholder': 'Enable', 'class': 'user.enable', 'style': '', 'label': 'Enable', 'label_class_li': [] };
|
||||
|
||||
export default template;
|
||||
@@ -1,37 +0,0 @@
|
||||
<script lang="ts">
|
||||
export let id_random: string = '';
|
||||
export let obj_type: string = '';
|
||||
export let obj_prop_name: string = '';
|
||||
|
||||
export let name: string = obj_prop_name;
|
||||
export let id: string = `${name}--${id_random}`; // Same as the value for "for"
|
||||
|
||||
export let value: string = '';
|
||||
|
||||
export let readonly: string = '';
|
||||
export let disabled: string = '';
|
||||
export let required: string = '';
|
||||
|
||||
export let type: string = 'text';
|
||||
//export let class: string = ''; // Probably not going to use
|
||||
export let class_li: Array<> = [];
|
||||
|
||||
export let style: string = '';
|
||||
|
||||
export let label: string = '';
|
||||
export let placeholder: string = label;
|
||||
export let label_class: string = ''; // Probably not going to use
|
||||
export let label_class_li: Array<> = [];
|
||||
|
||||
</script>
|
||||
|
||||
{#if type === 'text' || type === 'email' || type === 'url' || type === 'checkbox' }
|
||||
<label for={id} class={label_class_li.join(' ')}>{label}</label>
|
||||
<input {id} {name} class={class_li.join(' ')} {type} {value} {placeholder} {readonly} {disabled} {required} data-id_random={id_random} data-obj_type={obj_type} data-obj_prop_name={obj_prop_name} />
|
||||
{:else if type === 'textarea'}
|
||||
<label for={id} class={label_class_li.join(' ')}>{label}</label>
|
||||
<textarea {id} {name} class={class_li.join(' ')} {value} {placeholder} {readonly} {disabled} {required} data-id_random={id_random} data-obj_type={obj_type} data-obj_prop_name={obj_prop_name}></textarea>
|
||||
|
||||
<!-- rows="" cols="" maxlength="" -->
|
||||
|
||||
{/if}
|
||||
10
src/lib/Counter.svelte
Normal file
10
src/lib/Counter.svelte
Normal file
@@ -0,0 +1,10 @@
|
||||
<script lang="ts">
|
||||
let count: number = 0
|
||||
const increment = () => {
|
||||
count += 1
|
||||
}
|
||||
</script>
|
||||
|
||||
<button on:click={increment}>
|
||||
count is {count}
|
||||
</button>
|
||||
@@ -1,176 +0,0 @@
|
||||
<script lang="ts">
|
||||
import get_object from './api_get.js';
|
||||
import delete_object from './api_delete.js';
|
||||
// import InputElement from './input_element.svelte';
|
||||
export let name: string;
|
||||
export let account_id: string;
|
||||
|
||||
let log_client_viewing_list = Array();
|
||||
//let log_client_viewing = Object();
|
||||
let log_client_viewing = null;
|
||||
|
||||
|
||||
//let request_promise = null;
|
||||
let request_promise_list = null;
|
||||
let request_promise_del = null;
|
||||
|
||||
function handle_get_log_client_viewing_obj_list() {
|
||||
console.log('*** handle_get_log_client_viewing_obj_list() ***');
|
||||
request_promise_list = get_log_client_viewing_obj_list();
|
||||
}
|
||||
|
||||
async function get_log_client_viewing_obj_list() {
|
||||
console.log('Request the log client viewing list...');
|
||||
|
||||
let endpoint = `/account/${account_id}/log/client_viewing/list`;
|
||||
// let params = { from_datetime: '', to_datetime: '' };
|
||||
let params = { };
|
||||
|
||||
let log_client_viewing_list_resp = await get_object({endpoint:endpoint, params:params, force_li:true});
|
||||
console.log(log_client_viewing_list_resp);
|
||||
|
||||
log_client_viewing_list = log_client_viewing_list_resp;
|
||||
}
|
||||
|
||||
async function get_log_client_viewing_obj(log_client_viewing_id) {
|
||||
console.log('Request the log client viewing object...');
|
||||
|
||||
let endpoint = `log/client_viewing/${log_client_viewing_id}`;
|
||||
|
||||
let log_client_viewing_resp = await get_object({endpoint:endpoint});
|
||||
console.log(log_client_viewing_resp);
|
||||
|
||||
log_client_viewing = log_client_viewing_resp;
|
||||
}
|
||||
|
||||
function handle_delete_log_client_viewing_obj(log_client_viewing_id_random) {
|
||||
console.log('*** handle_delete_log_client_viewing_obj() ***');
|
||||
request_promise_del = delete_log_client_viewing_obj(log_client_viewing_id_random);
|
||||
}
|
||||
|
||||
async function delete_log_client_viewing_obj(log_client_viewing_id_random) {
|
||||
console.log('Delete the log client viewing object...');
|
||||
|
||||
let endpoint = `log/client_viewing/${log_client_viewing_id_random}`;
|
||||
|
||||
let log_client_viewing_obj_resp = await delete_object({endpoint:endpoint});
|
||||
console.log(log_client_viewing_obj_resp);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div>
|
||||
<header>
|
||||
<h1>{name}</h1>
|
||||
</header>
|
||||
|
||||
<button on:click={handle_get_log_client_viewing_obj_list}>
|
||||
Load Client Viewing Log Entries
|
||||
</button>
|
||||
|
||||
<div class="log_client_viewing_obj_li">
|
||||
|
||||
{#await request_promise_list}
|
||||
<div>waiting...</div>
|
||||
{:then data}
|
||||
<div>{data}</div>
|
||||
{:catch error}
|
||||
<div class="error">{error.message}</div>
|
||||
{/await}
|
||||
|
||||
<ul>
|
||||
{#each log_client_viewing_list as log_client_viewing}
|
||||
<li key={log_client_viewing.log_client_viewing_id_random}>{log_client_viewing.name} {log_client_viewing.name} <button on:click={get_log_client_viewing_obj(log_client_viewing.log_client_viewing_id_random)}><span class="fas fa-trash"></span></button></li>
|
||||
{/each}
|
||||
</ul>
|
||||
|
||||
<table class="log_client_viewing_obj_tbl">
|
||||
{#each log_client_viewing_list as log_client_viewing}
|
||||
<tr key={log_client_viewing.log_client_viewing_id_random}>
|
||||
<td>{log_client_viewing.external_client_id}</td>
|
||||
<td>{log_client_viewing.name}</td>
|
||||
<td>{log_client_viewing.page_load_on}</td>
|
||||
<td>{log_client_viewing.authenticated_on}</td>
|
||||
<td>{log_client_viewing.play_start_on_first}</td>
|
||||
<td>{log_client_viewing.play_start_on_last}</td>
|
||||
<td>{log_client_viewing.play_start_count}</td>
|
||||
<td>{log_client_viewing.play_ended_on}</td>
|
||||
<td>{log_client_viewing.play_ended_count}</td>
|
||||
<td>{log_client_viewing.created_on}</td>
|
||||
<td>{log_client_viewing.update_on}</td>
|
||||
<button on:click={handle_delete_log_client_viewing_obj(log_client_viewing.log_client_viewing_id_random)}><span class="fas fa-trash"></span></button>
|
||||
</tr>
|
||||
{/each}
|
||||
</table>
|
||||
|
||||
{#if log_client_viewing}
|
||||
<div class="log_client_viewing_obj">
|
||||
<div>Viewing something</div>
|
||||
</div>
|
||||
{:else}
|
||||
<div>Nothing to see yet</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
|
||||
<div class="log_client_viewing_obj_li">
|
||||
{#await request_promise_list}
|
||||
<div>waiting...</div>
|
||||
{:then data}
|
||||
<div>Data: {data}</div>
|
||||
{:catch error}
|
||||
<div class="error">{error.message}</div>
|
||||
{/await}
|
||||
|
||||
<ul>
|
||||
{#each log_client_viewing_list as log_client_viewing}
|
||||
<li key={log_client_viewing.log_client_viewing_id_random}>{log_client_viewing.name}</li>
|
||||
{/each}
|
||||
</ul>
|
||||
|
||||
{#if log_client_viewing}
|
||||
<div class="log_client_viewing_obj">
|
||||
<h1>{log_client_viewing.name}</h1>
|
||||
<div>{log_client_viewing.summary}</div>
|
||||
<div>{log_client_viewing.content}</div>
|
||||
<div>{log_client_viewing.description}</div>
|
||||
<div>{log_client_viewing.created_on} {log_client_viewing.updated_on}</div>
|
||||
|
||||
</div>
|
||||
{:else}
|
||||
<div>Click an entry to view the details.</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
h1 {
|
||||
color: hsla(0, 50%, 50%, 1);
|
||||
/*text-transform: uppercase;*/
|
||||
font-size: 4rem;
|
||||
font-weight: 100;
|
||||
}
|
||||
|
||||
.log_client_viewing_obj_tbl {
|
||||
color: hsla(0, 0%, 0%, 1);
|
||||
}
|
||||
|
||||
table {
|
||||
border: solid thin hsla(0, 0%, 50%, 1);
|
||||
border-collapse: collapse;
|
||||
}
|
||||
th, td {
|
||||
border: solid thin hsla(0, 0%, 75%, 1);
|
||||
border-collapse: collapse;
|
||||
/* margin: 0; */
|
||||
padding: .5rem;
|
||||
}
|
||||
|
||||
tr:nth-child(even) {
|
||||
background-color: hsla(0, 0%, 95%, 1);
|
||||
}
|
||||
tr:nth-child(odd) {
|
||||
background-color: hsla(0, 0%, 85%, 1);
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -1,260 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { fade, fly } from 'svelte/transition';
|
||||
import get_object from './api_get.js';
|
||||
import delete_object from './api_delete.js';
|
||||
// import InputElement from './input_element.svelte';
|
||||
export let name: string;
|
||||
export let account_id: string;
|
||||
|
||||
let log_client_viewing_li = Array();
|
||||
$: log_client_viewing_li_length = log_client_viewing_li.length;
|
||||
$: log_client_viewing_li_reviewed = log_client_viewing_li.filter(log_client_viewing_li => log_client_viewing_li.reviewed).length
|
||||
//let log_client_viewing = Object();
|
||||
// let log_client_viewing = null;
|
||||
// let status_list_log_client_viewing = null;
|
||||
// let status_delete_log_client_viewing = null;
|
||||
|
||||
//let request_promise = null;
|
||||
let promise_request_li = null;
|
||||
let promise_request_delete = null;
|
||||
let promise_viewing_entry = null;
|
||||
|
||||
function handle_get_log_client_viewing_obj_list() {
|
||||
console.log('*** handle_get_log_client_viewing_obj_list() ***');
|
||||
promise_request_li = get_log_client_viewing_obj_list();
|
||||
}
|
||||
|
||||
async function get_log_client_viewing_obj_list() {
|
||||
console.log('Request the log client viewing list...');
|
||||
|
||||
let endpoint = `/account/${account_id}/log/client_viewing/list`;
|
||||
// let params = { from_datetime: '', to_datetime: '' };
|
||||
let params = { };
|
||||
|
||||
let log_client_viewing_li_resp = await get_object({endpoint:endpoint, params:params, force_li:true});
|
||||
console.log(log_client_viewing_li_resp);
|
||||
|
||||
log_client_viewing_li = log_client_viewing_li_resp;
|
||||
}
|
||||
|
||||
/*async function get_log_client_viewing_obj(log_client_viewing_id) {
|
||||
console.log('Request the log client viewing object...');
|
||||
|
||||
let endpoint = `log/client_viewing/${log_client_viewing_id}`;
|
||||
|
||||
let log_client_viewing_resp = await get_object({endpoint:endpoint});
|
||||
console.log(log_client_viewing_resp);
|
||||
|
||||
// status_list_log_client_viewing = log_client_viewing_resp;
|
||||
}*/
|
||||
|
||||
function handle_delete_log_client_viewing_obj(rm_log_client_viewing) {
|
||||
console.log('*** handle_delete_log_client_viewing_obj() ***');
|
||||
if (confirm(`Remove ID ${rm_log_client_viewing.log_client_viewing_id_random}?`)) {
|
||||
promise_request_delete = delete_log_client_viewing_obj(rm_log_client_viewing.log_client_viewing_id_random);
|
||||
log_client_viewing_li = log_client_viewing_li.filter(log_client_viewing => log_client_viewing !== rm_log_client_viewing);
|
||||
// console.log(log_client_viewing_li);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async function delete_log_client_viewing_obj(log_client_viewing_id_random) {
|
||||
console.log('Delete the log client viewing object...');
|
||||
|
||||
let endpoint = `log/client_viewing/${log_client_viewing_id_random}`;
|
||||
|
||||
let log_client_viewing_obj_resp = await delete_object({endpoint:endpoint});
|
||||
// console.log(log_client_viewing_obj_resp);
|
||||
|
||||
// status_delete_log_client_viewing = log_client_viewing_obj_resp;
|
||||
}
|
||||
|
||||
function handle_view_log_client_viewing_obj(log_client_viewing) {
|
||||
console.log('*** handle_view_log_client_viewing_obj() ***');
|
||||
// if (confirm(`Entry ID ${log_client_viewing.log_client_viewing_id_random}?`)) {
|
||||
promise_viewing_entry = log_client_viewing;
|
||||
// promise_request_view = view_log_client_viewing_obj(rm_log_client_viewing.log_client_viewing_id_random);
|
||||
// log_client_viewing_li = log_client_viewing_li.filter(log_client_viewing => log_client_viewing !== rm_log_client_viewing);
|
||||
// console.log(log_client_viewing_li);
|
||||
return true;
|
||||
// } else {
|
||||
// return false;
|
||||
// }
|
||||
}
|
||||
|
||||
function handle_promise_reset(reset_variable) {
|
||||
reset_variable = null;
|
||||
promise_viewing_entry = null;
|
||||
}
|
||||
|
||||
|
||||
// async function view_log_client_viewing_obj(log_client_viewing_id_random) {
|
||||
// console.log('view the log client viewing object...');
|
||||
|
||||
// let endpoint = `log/client_viewing/${log_client_viewing_id_random}`;
|
||||
|
||||
// let log_client_viewing_obj_resp = await view_object({endpoint:endpoint});
|
||||
// // console.log(log_client_viewing_obj_resp);
|
||||
|
||||
// // status_view_log_client_viewing = log_client_viewing_obj_resp;
|
||||
// }
|
||||
|
||||
</script>
|
||||
|
||||
<div>
|
||||
<header>
|
||||
<h2>{name}</h2>
|
||||
</header>
|
||||
|
||||
<button on:click={handle_get_log_client_viewing_obj_list}>
|
||||
Load Client Viewing Log Entries
|
||||
</button>
|
||||
|
||||
<div class="log_client_viewing_obj_li">
|
||||
|
||||
|
||||
{#if promise_request_li}
|
||||
{#await promise_request_li}
|
||||
<div>Loading...</div>
|
||||
{:then result}
|
||||
<!-- <div>Loaded</div> -->
|
||||
{:catch error}
|
||||
<div class="error">{error.message}</div>
|
||||
{/await}
|
||||
<table class="table_borders log_client_viewing_obj_tbl table_alt_rows">
|
||||
<tr>
|
||||
<th>Rand ID</th>
|
||||
<th>Email</th>
|
||||
<th>Name</th>
|
||||
<th>Page Load</th>
|
||||
<th>Authenticated</th>
|
||||
<th>Play Start First</th>
|
||||
<th>Play Start Last</th>
|
||||
<th>Play Start Count</th>
|
||||
|
||||
<th>Play Ended</th>
|
||||
<th>Play Ended Count</th>
|
||||
|
||||
<th>Log Created</th>
|
||||
<th>Log Updated</th>
|
||||
<th>Entry</th>
|
||||
</tr>
|
||||
{#each log_client_viewing_li as log_client_viewing, index}
|
||||
<tr key={log_client_viewing.log_client_viewing_id_random} class="record">
|
||||
<!-- <td>{index}</td> -->
|
||||
<td class="id_random">{log_client_viewing.log_client_viewing_id_random}</td>
|
||||
<td>{#if log_client_viewing.external_client_id}{log_client_viewing.external_client_id}{/if}</td>
|
||||
<td>{#if log_client_viewing.name}{log_client_viewing.name}{/if}</td>
|
||||
<td>{iso_datetime_formatter(log_client_viewing.page_load_on,'datetime_short_month')}</td>
|
||||
<td>{iso_datetime_formatter(log_client_viewing.authenticated_on,'datetime_short_month')}</td>
|
||||
<td>{iso_datetime_formatter(log_client_viewing.play_start_on_first,'datetime_short_month')}</td>
|
||||
<td>{iso_datetime_formatter(log_client_viewing.play_start_on_last,'datetime_short_month')}</td>
|
||||
<td>{log_client_viewing.play_start_count}</td>
|
||||
<td>{iso_datetime_formatter(log_client_viewing.play_ended_on,'datetime_short_month')}</td>
|
||||
<td>{log_client_viewing.play_ended_count}</td>
|
||||
<td>{iso_datetime_formatter(log_client_viewing.created_on,'datetime_short_month')}</td>
|
||||
<td>{iso_datetime_formatter(log_client_viewing.updated_on,'datetime_iso_12_short_month')}</td>
|
||||
<td>
|
||||
<button on:click={handle_delete_log_client_viewing_obj(log_client_viewing)}><span class="fas fa-trash"></span></button>
|
||||
<button on:click={handle_view_log_client_viewing_obj(log_client_viewing)}><span class="fas fa-eye"></span></button>
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</table>
|
||||
Count: {log_client_viewing_li_length}
|
||||
{:else}
|
||||
<div>Nothing to see yet</div>
|
||||
{/if}
|
||||
|
||||
{#await promise_request_delete}
|
||||
<div>Deleting...</div>
|
||||
{:then result}
|
||||
{:catch error}
|
||||
<div class="error">{error.message}</div>
|
||||
{/await}
|
||||
|
||||
{#if promise_viewing_entry}
|
||||
<div transition:fade="{{ duration: 200 }}" class="modal_container">
|
||||
<div class="modal_content">
|
||||
<header class="modal_header">
|
||||
<section class="modal_header_begin">
|
||||
<h3 class="modal_title">{promise_viewing_entry.name} ({promise_viewing_entry.external_client_id})</h3>
|
||||
<div>{promise_viewing_entry.log_client_viewing_id_random}</div>
|
||||
</section>
|
||||
<section class="modal_header_end">
|
||||
<button on:click={handle_promise_reset(promise_viewing_entry)} class="modal_close"><span class="fas fa-window-close"></span> Close</button>
|
||||
</section>
|
||||
</header>
|
||||
|
||||
<section class="modal_body">
|
||||
|
||||
<div>Page Loaded: {iso_datetime_formatter(promise_viewing_entry.page_load_on,'datetime_short')}</div>
|
||||
|
||||
<div>Authenticated: {iso_datetime_formatter(promise_viewing_entry.authenticated_on,'datetime_short_month')}</div>
|
||||
|
||||
<div>Start: first: {#if promise_viewing_entry.play_start_on_first}{iso_datetime_formatter(promise_viewing_entry.play_start_on_first,'datetime_short_month')}{/if} {#if promise_viewing_entry.play_start_on_last}last: {iso_datetime_formatter(promise_viewing_entry.play_start_on_last,'datetime_short_month')}{/if} x{#if promise_viewing_entry.play_start_count}{promise_viewing_entry.play_start_count}{/if}</div>
|
||||
|
||||
<div>Pause: first: {iso_datetime_formatter(promise_viewing_entry.play_pause_on_first,'datetime_short_month')} last: {iso_datetime_formatter(promise_viewing_entry.play_pause_on_last,'datetime_short_month')} x{promise_viewing_entry.play_pause_count}</div>
|
||||
|
||||
<div>Seeked: first: {iso_datetime_formatter(promise_viewing_entry.play_seeked_on_first,'datetime_short_month')} last: {iso_datetime_formatter(promise_viewing_entry.play_seeked_on_last,'datetime_short_month')} x{promise_viewing_entry.play_seeked_count}</div>
|
||||
|
||||
<div>Ended: {iso_datetime_formatter(promise_viewing_entry.play_ended_on,'datetime_short_month')} x{promise_viewing_entry.play_ended_count}</div>
|
||||
|
||||
<div>Volume: {iso_datetime_formatter(promise_viewing_entry.play_volume_change_on,'datetime_short_month')} x{promise_viewing_entry.play_volume_change_count} vol: {promise_viewing_entry.play_volume}</div>
|
||||
|
||||
<div>Muted: {promise_viewing_entry.play_muted} x{promise_viewing_entry.play_muted_toggle_count}</div>
|
||||
|
||||
<div>Last Ping: {iso_datetime_formatter(promise_viewing_entry.last_ping,'datetime_short')}</div>
|
||||
|
||||
<div>Log Created/Updated: {iso_datetime_formatter(promise_viewing_entry.created_on,'datetime_short')} / {iso_datetime_formatter(promise_viewing_entry.updated_on,'datetime_short')}</div>
|
||||
|
||||
<div>
|
||||
Client App:
|
||||
<pre>
|
||||
{format_json_string(promise_viewing_entry.client_app_json)}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
<footer class="modal_footer">
|
||||
<section class="modal_footer_begin">
|
||||
<div class="load_datetime"><span class="label">Loaded:</span> <span class="datetime">{new Date()}</span></div>
|
||||
</section>
|
||||
<section class="modal_footer_end">
|
||||
<button on:click={handle_promise_reset(promise_viewing_entry)} class="modal_close"><span class="fas fa-window-close"></span> Close</button>
|
||||
</section>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<div>Select an entry above</div>
|
||||
{/if}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.log_client_viewing_obj_tbl tr:hover {
|
||||
background-color: hsla(0, 25%, 90%, 1);
|
||||
}
|
||||
|
||||
.log_client_viewing_obj_tbl {
|
||||
font-size: .8rem;
|
||||
}
|
||||
|
||||
.record .id_random {
|
||||
font-size: .5rem;
|
||||
}
|
||||
|
||||
/* .record_details {
|
||||
display: fixed;
|
||||
top: 1rem;
|
||||
right: 1rem;
|
||||
bottom: 1rem;
|
||||
left: 1rem;
|
||||
border: solid thin hsla(0, 0%, 50%, 1);
|
||||
} */
|
||||
</style>
|
||||
101
src/main.ts
101
src/main.ts
@@ -1,56 +1,59 @@
|
||||
// import api from './api.js';
|
||||
import App from './App.svelte';
|
||||
import log_client_viewing_li from './log_client_viewing.svelte';
|
||||
import membership_member_manage from './membership_member_manage.svelte';
|
||||
import person from './person.svelte';
|
||||
// import user from './user.svelte';
|
||||
// Import ae_bridge from ae_bridge_init.js
|
||||
// import './ae_bridge_init';
|
||||
// import './ae_bridge_init.js';
|
||||
import './app.css';
|
||||
|
||||
// <App />
|
||||
import { ae } from 'aether_npm_lib';
|
||||
|
||||
if (document.getElementById('log_client_viewing_list_container')) {
|
||||
const log_client_viewing_app = new log_client_viewing_li({
|
||||
target: document.getElementById('log_client_viewing_list_container'),
|
||||
props: {
|
||||
'name': 'List Client Viewing Log',
|
||||
'account_id': account_id,
|
||||
}
|
||||
});
|
||||
import Hub_main from './0_hub__main.svelte';
|
||||
import Hub_site_menu from './10_hub__site_menu.svelte';
|
||||
import Sponsorships from './0_sponsorships__main.svelte';
|
||||
|
||||
let url_params = ae.util.get_url_params();
|
||||
// console.log(url_params);
|
||||
// IMPORTANT: The URL paramater 'uuid' is used to determine if the user is logged in or not. If the user is logged in, the uuid will be passed in as a url param. If the user is not logged in, the uuid will not be passed in as a url param.
|
||||
|
||||
|
||||
if (document.querySelector('.svelte_target.ae_svelte_app_hub')) { // ae_hub_main
|
||||
const hub_main_app = new Hub_main({
|
||||
target: document.querySelector('.svelte_target.ae_svelte_app_hub'), // ae_hub_main
|
||||
props: {
|
||||
// NOTE: decodeURIComponent() is needed because the value is passed in as a url param. Should this be taken care of by the ae.util.get_url_params() function?
|
||||
'ae_obj_type': url_params.ae_type,
|
||||
'ae_obj_id': url_params.ae_id,
|
||||
'user': decodeURIComponent(url_params.user),
|
||||
'email': decodeURIComponent(url_params.email),
|
||||
'key': (url_params.key ? url_params.key : false),
|
||||
// 'results_limit_administrator': 75,
|
||||
// 'results_limit_trusted': 50,
|
||||
// 'results_limit_authenticated': 25,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (document.getElementById('membership_member_manage_container')) {
|
||||
const membership_member_manage_app = new membership_member_manage({
|
||||
target: document.getElementById('membership_member_manage_container'),
|
||||
props: {
|
||||
'name': 'Membership Member Manage',
|
||||
'account_id': account_id,
|
||||
'membership_member_id': membership_member_id,
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (document.querySelector('#Site-Nav-Menu')) { // ae_hub_main
|
||||
const hub_main_app = new Hub_site_menu({
|
||||
target: document.querySelector('#Site-Nav-Menu'), // ae_hub_main
|
||||
props: {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (document.getElementById('person_container')) {
|
||||
const person_app = new person({
|
||||
target: document.getElementById('person_container'),
|
||||
props: {
|
||||
'name': 'Person',
|
||||
'account_id': account_id,
|
||||
'person_id': person_id,
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (document.querySelector('.svelte_target.ae_svelte_app')) { // ae_sponsorships_main
|
||||
const sponsorships_main_app = new Sponsorships({
|
||||
target: document.querySelector('.svelte_target.ae_svelte_app'), // ae_sponsorships_main
|
||||
props: {
|
||||
// NOTE: decodeURIComponent() is needed because the value is passed in as a url param. Should this be taken care of by the ae.util.get_url_params() function?
|
||||
'sponsorship_id': url_params.sponsorship_id,
|
||||
'user': decodeURIComponent(url_params.email),
|
||||
'key': (url_params.key ? url_params.key : false),
|
||||
// 'results_limit_administrator': 75,
|
||||
// 'results_limit_trusted': 50,
|
||||
// 'results_limit_authenticated': 25,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// if (document.getElementById('user_container')) {
|
||||
// const user_app = new user({
|
||||
// target: document.getElementById('user_container'),
|
||||
// props: {
|
||||
// 'name': 'User',
|
||||
// 'account_id': account_id,
|
||||
// 'user_id': user_id,
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
|
||||
|
||||
//export default app;
|
||||
//export app_2;
|
||||
|
||||
@@ -1,264 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { fade, fly } from 'svelte/transition';
|
||||
// import delete_object from './api_delete.js';
|
||||
import get_object from './api_get.js';
|
||||
import update_object from './api_patch.js';
|
||||
|
||||
export let name: string;
|
||||
export let account_id: string;
|
||||
export let membership_member_id: string;
|
||||
|
||||
let membership_member_obj_li = Array();
|
||||
// let membership_member_obj = null;
|
||||
let membership_member_obj_view = null;
|
||||
|
||||
let promise_request_obj_del = null;
|
||||
// let promise_request_obj_get = null;
|
||||
let promise_request_obj_li = null;
|
||||
let promise_request_obj_up = null;
|
||||
|
||||
function handle_get_membership_member_obj_li() {
|
||||
console.log('*** handle_get_membership_member_obj_li() ***');
|
||||
|
||||
promise_request_obj_li = get_membership_member_obj_li();
|
||||
}
|
||||
|
||||
async function get_membership_member_obj_li() {
|
||||
console.log('*** get_membership_member_obj_li() ***');
|
||||
|
||||
let endpoint = `/account/${account_id}/membership/member/list`;
|
||||
let params = { inc_person: true, inc_user: true };
|
||||
|
||||
let membership_member_obj_li_resp = await get_object({endpoint:endpoint, params:params, force_li:true});
|
||||
console.log(membership_member_obj_li_resp);
|
||||
|
||||
membership_member_obj_li = membership_member_obj_li_resp;
|
||||
}
|
||||
|
||||
function handle_view_membership_member_obj(membership_member_obj) {
|
||||
console.log('*** handle_view_membership_member_obj() ***');
|
||||
|
||||
membership_member_obj_view = membership_member_obj;
|
||||
}
|
||||
|
||||
function handle_reset_view_membership_member_obj() {
|
||||
console.log('*** handle_reset_view_membership_member_obj() ***');
|
||||
|
||||
membership_member_obj_view = null;
|
||||
}
|
||||
|
||||
function handle_status_membership_member_obj(membership_member_obj, status) {
|
||||
console.log('*** handle_status_membership_member_obj() ***');
|
||||
|
||||
// console.log(membership_member_obj);
|
||||
// console.log(membership_member_obj_li.indexOf(membership_member_obj));
|
||||
let index = membership_member_obj_li.indexOf(membership_member_obj);
|
||||
// membership_member_obj_up = membership_member_obj_li[index];
|
||||
|
||||
let membership_member_id = membership_member_obj.membership_member_id_random;
|
||||
let data = {}
|
||||
// let status_name = null;
|
||||
let current_datetime = new Date();
|
||||
switch (status) {
|
||||
case 'pending':
|
||||
data = { 'status_id': 1, 'approved_on': null, 'start_on': null };
|
||||
membership_member_obj_li[index].status_id = 1;
|
||||
membership_member_obj_li[index].status_name = 'Pending';
|
||||
membership_member_obj_li[index].approved_on = null;
|
||||
membership_member_obj_li[index].start_on = null;
|
||||
break;
|
||||
case 'approve':
|
||||
data = { 'status_id': 3, 'approved_on': current_datetime };
|
||||
membership_member_obj_li[index].status_id = 3;
|
||||
membership_member_obj_li[index].status_name = 'Approved';
|
||||
membership_member_obj_li[index].approved_on = current_datetime;
|
||||
break;
|
||||
case 'reject':
|
||||
data = { 'status_id': 4, 'approved_on': null, 'start_on': null };
|
||||
membership_member_obj_li[index].status_id = 4;
|
||||
membership_member_obj_li[index].status_name = 'Rejected';
|
||||
membership_member_obj_li[index].approved_on = null;
|
||||
membership_member_obj_li[index].start_on = null;
|
||||
break;
|
||||
case 'active':
|
||||
data = { 'status_id': 5, 'start_on': current_datetime };
|
||||
membership_member_obj_li[index].status_id = 5;
|
||||
membership_member_obj_li[index].status_name = 'Active';
|
||||
membership_member_obj_li[index].start_on = current_datetime;
|
||||
if (!membership_member_obj_li[index].first_start_on) {
|
||||
data['first_start_on'] = current_datetime;
|
||||
membership_member_obj_li[index].first_start_on = current_datetime;
|
||||
}
|
||||
break;
|
||||
}
|
||||
promise_request_obj_up = update_membership_member_obj(membership_member_id, data);
|
||||
// membership_member_obj.status_id = data['status_id'];
|
||||
// membership_member_obj.status_name = status_name;
|
||||
// membership_member_obj.approved_on = data['approved_on'];
|
||||
|
||||
// let array_index = membership_member_obj_li.indexOf(membership_member_obj);
|
||||
// membership_member_obj_up.status_id = data['status_id'];
|
||||
// membership_member_obj_up.status_name = status_name;
|
||||
// membership_member_obj_up.approved_on = data['approved_on'];
|
||||
|
||||
// membership_member_obj_li = membership_member_obj_li.filter(log_client_viewing => log_client_viewing !== rm_log_client_viewing);
|
||||
}
|
||||
|
||||
async function update_membership_member_obj(membership_member_id, data) {
|
||||
console.log('*** update_membership_member_obj() ***');
|
||||
|
||||
let endpoint = `/membership/member/${membership_member_id}`;
|
||||
|
||||
let membership_member_obj_up_resp = await update_object({endpoint:endpoint, record:data});
|
||||
console.log(membership_member_obj_up_resp);
|
||||
|
||||
// membership_member_obj_li = membership_member_obj_up_resp;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div>
|
||||
<header>
|
||||
<h2>{name}</h2>
|
||||
</header>
|
||||
|
||||
<button on:click={handle_get_membership_member_obj_li}>
|
||||
Load Membership Member List
|
||||
</button>
|
||||
|
||||
<div class="membership_member_obj_li">
|
||||
|
||||
|
||||
{#if membership_member_obj_li}
|
||||
{#await membership_member_obj_li}
|
||||
<div>Loading...</div>
|
||||
{:then result}
|
||||
<!-- <div>Loaded</div> -->
|
||||
{:catch error}
|
||||
<div class="error">{error.message}</div>
|
||||
{/await}
|
||||
<table class="table_borders membership_member_obj_tbl table_alt_rows">
|
||||
<tr>
|
||||
<th>Actions</th>
|
||||
<!-- <th>Index</th> -->
|
||||
<th>ID</th>
|
||||
<th>Type</th>
|
||||
<th>Status</th>
|
||||
<th>Name</th>
|
||||
<th>Username</th>
|
||||
<th>Email</th>
|
||||
<th>Approved</th>
|
||||
<th>First Start On</th>
|
||||
<th>Current Start On</th>
|
||||
</tr>
|
||||
{#each membership_member_obj_li as membership_member_obj, index}
|
||||
<tr key={membership_member_obj.membership_member_id_random} class="record">
|
||||
<td>
|
||||
<button on:click={handle_view_membership_member_obj(membership_member_obj)}><span class="fas fa-eye"></span></button>
|
||||
</td>
|
||||
<!-- <td>{index}</td> -->
|
||||
<td class="id_random">{membership_member_obj.membership_member_id_random}</td>
|
||||
<td class="type_name">{membership_member_obj.type_name}</td>
|
||||
<td class="status_name">
|
||||
{membership_member_obj.status_name}
|
||||
{#if membership_member_obj.status_name === 'Pending'}
|
||||
<button on:click={handle_status_membership_member_obj(membership_member_obj, 'approve')} title="Set to approved"><span class="fas fa-user-check"></span></button>
|
||||
<button on:click={handle_status_membership_member_obj(membership_member_obj, 'reject')} title="Set to rejected"><span class="fas fa-user-times"></span></button>
|
||||
{:else if membership_member_obj.status_name === 'Rejected'}
|
||||
<button on:click={handle_status_membership_member_obj(membership_member_obj, 'pending')} title="Set to pending"><span class="fas fa-user-lock"></span></button>
|
||||
<button on:click={handle_status_membership_member_obj(membership_member_obj, 'reject')} title="Set to rejected"><span class="fas fa-user-times"></span></button>
|
||||
{:else if membership_member_obj.status_name === 'Approved'}
|
||||
<button on:click={handle_status_membership_member_obj(membership_member_obj, 'reject')} title="Set to rejected"><span class="fas fa-user-times"></span></button>
|
||||
<button on:click={handle_status_membership_member_obj(membership_member_obj, 'active')} title="Set to active"><span class="fas fa-user-check"></span></button>
|
||||
{/if}
|
||||
</td>
|
||||
<td class="full_name">{membership_member_obj.person.full_name}</td>
|
||||
<td class="username">{membership_member_obj.user.username}</td>
|
||||
<td class="email">{membership_member_obj.user.email}</td>
|
||||
|
||||
<td class="approved_on">{iso_datetime_formatter(membership_member_obj.approved_on,'datetime_short')}</td>
|
||||
<td class="first_start_on">{iso_datetime_formatter(membership_member_obj.first_start_on,'datetime_short')}</td>
|
||||
<td class="start_on">{iso_datetime_formatter(membership_member_obj.start_on,'datetime_short')}</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</table>
|
||||
{:else}
|
||||
<div>Nothing loaded yet</div>
|
||||
{/if}
|
||||
|
||||
{#await promise_request_obj_del}
|
||||
<div>Deleting...</div>
|
||||
{:then result}
|
||||
{:catch error}
|
||||
<div class="error">{error.message}</div>
|
||||
{/await}
|
||||
|
||||
{#await promise_request_obj_up}
|
||||
<div>Updating...</div>
|
||||
{:then result}
|
||||
{:catch error}
|
||||
<div class="error">{error.message}</div>
|
||||
{/await}
|
||||
|
||||
|
||||
|
||||
{#if membership_member_obj_view}
|
||||
<div transition:fade="{{ duration: 200 }}" class="modal_container">
|
||||
<div class="modal_content">
|
||||
<header class="modal_header">
|
||||
<section class="modal_header_begin">
|
||||
<h3 class="modal_title">{membership_member_obj_view.person.full_name} ({membership_member_obj_view.user.username})</h3>
|
||||
<div>{membership_member_obj_view.membership_member_id_random}</div>
|
||||
</section>
|
||||
<section class="modal_header_end">
|
||||
<button on:click={handle_reset_view_membership_member_obj(membership_member_obj_view)} class="modal_close"><span class="fas fa-window-close"></span> Close</button>
|
||||
</section>
|
||||
</header>
|
||||
|
||||
<section class="modal_body">
|
||||
|
||||
<div>Approved on: {iso_datetime_formatter(membership_member_obj_view.approved_on,'datetime_short')}</div>
|
||||
|
||||
<div>Created/Updated: {iso_datetime_formatter(membership_member_obj_view.created_on,'datetime_short')} / {iso_datetime_formatter(membership_member_obj_view.updated_on,'datetime_short')}</div>
|
||||
|
||||
</section>
|
||||
|
||||
<footer class="modal_footer">
|
||||
<section class="modal_footer_begin">
|
||||
<div class="load_datetime"><span class="label">Loaded:</span> <span class="datetime">{new Date()}</span></div>
|
||||
</section>
|
||||
<section class="modal_footer_end">
|
||||
<button on:click={handle_reset_view_membership_member_obj(membership_member_obj_view)} class="modal_close"><span class="fas fa-window-close"></span> Close</button>
|
||||
</section>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<div>Select an entry above</div>
|
||||
{/if}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.membership_member_obj_tbl tr:hover {
|
||||
background-color: hsla(0, 25%, 90%, 1);
|
||||
}
|
||||
|
||||
.membership_member_obj_tbl {
|
||||
font-size: .8rem;
|
||||
}
|
||||
|
||||
.record .id_random {
|
||||
font-size: .5rem;
|
||||
}
|
||||
|
||||
/* .record_details {
|
||||
display: fixed;
|
||||
top: 1rem;
|
||||
right: 1rem;
|
||||
bottom: 1rem;
|
||||
left: 1rem;
|
||||
border: solid thin hsla(0, 0%, 50%, 1);
|
||||
} */
|
||||
</style>
|
||||
@@ -1,342 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { fade, fly } from 'svelte/transition';
|
||||
// import delete_object from './api_delete.js';
|
||||
import get_object from './api_get.js';
|
||||
// import post_object from './api_post.js';
|
||||
import patch_object from './api_patch.js';
|
||||
|
||||
import html_template from './html_input_render_templates.js';
|
||||
|
||||
import Input_element from './input_element.svelte';
|
||||
|
||||
export let name: string;
|
||||
export let account_id: string;
|
||||
export let person_id: string;
|
||||
|
||||
let person_obj = null;
|
||||
let person_obj_get_promise = null;
|
||||
let person_obj_up_promise = null;
|
||||
|
||||
let person_obj_edit = false;
|
||||
let given_name = null;
|
||||
|
||||
let person_given_name_template = { name: 'given_name', label: 'Given name', type: 'text' };
|
||||
let person_middle_name_template = { name: 'middle_name', label: 'Middle name', type: 'text' };
|
||||
let person_family_name_template = { name: 'family_name', label: 'Family name', type: 'text' };
|
||||
|
||||
let contact_obj_edit = false;
|
||||
let email = null;
|
||||
|
||||
let address_obj_edit = false;
|
||||
let line_1 = false;
|
||||
|
||||
|
||||
let person_data = null;
|
||||
// let promise_request_obj_del = null;
|
||||
// let promise_request_obj_get = null;
|
||||
// let promise_request_obj_li = null;
|
||||
let promise_request_obj_up = null;
|
||||
|
||||
onMount(() => {
|
||||
console.log('The component has mounted');
|
||||
person_obj_get_promise = get_person_obj(person_id);
|
||||
|
||||
/* const interval = setInterval(() => {
|
||||
console.log('beep');
|
||||
}, 1000); */
|
||||
});
|
||||
|
||||
function handle_get_person_obj(person_id) {
|
||||
console.log('*** handle_get_person_obj() ***');
|
||||
|
||||
person_obj_get_promise = get_person_obj(person_id);
|
||||
}
|
||||
|
||||
async function get_person_obj(person_id) {
|
||||
console.log('*** get_person_obj() ***');
|
||||
|
||||
let endpoint = `/person/${person_id}`;
|
||||
let params = { inc_address: true, inc_contact: true, inc_membership_member: true };
|
||||
let person_obj_get_resp = await get_object({endpoint:endpoint, params:params});
|
||||
|
||||
person_obj = person_obj_get_resp;
|
||||
given_name = person_obj.given_name;
|
||||
email = person_obj.contact.email;
|
||||
line_1 = person_obj.contact.address.line_1;
|
||||
return true;
|
||||
}
|
||||
|
||||
function handle_update_person_obj() {
|
||||
console.log('*** handle_update_person_obj() ***');
|
||||
|
||||
person_obj_up_promise = update_person_obj(person_id, person_data);
|
||||
}
|
||||
|
||||
async function update_person_obj(person_id, person_data) {
|
||||
console.log('*** update_person_obj() ***');
|
||||
|
||||
let endpoint = `/person/${person_id}`;
|
||||
let params = { return_obj: true };
|
||||
let person_obj_up_resp = await patch_object({endpoint:endpoint, params:params, record:person_data});
|
||||
console.log(person_obj_up_resp);
|
||||
|
||||
person_obj = { ...person_obj, ...person_obj_up_resp };
|
||||
return true;
|
||||
}
|
||||
|
||||
function handle_edit_person(value) {
|
||||
console.log('*** handle_edit_person() ***');
|
||||
person_obj_edit = true;
|
||||
}
|
||||
|
||||
function handle_cancel_person() {
|
||||
console.log('*** handle_cancel_person() ***');
|
||||
person_obj_edit = false;
|
||||
}
|
||||
|
||||
function handle_save_person(event) {
|
||||
console.log('*** handle_save_person() ***');
|
||||
console.log(event);
|
||||
console.log(event.target);
|
||||
console.log(event.target.given_name.value);
|
||||
console.log(event.target.family_name.value);
|
||||
|
||||
// person_id = event.target.person_id.value;
|
||||
|
||||
let person_data = {};
|
||||
person_data['given_name'] = event.target.given_name.value;
|
||||
person_data['middle_name'] = event.target.middle_name.value;
|
||||
person_data['family_name'] = event.target.family_name.value;
|
||||
let name_li = process_person_name(person_data);
|
||||
|
||||
person_data['title'] = event.target.title.value;
|
||||
person_data['tagline'] = event.target.tagline.value;
|
||||
person_data['organization_name'] = event.target.organization_name.value;
|
||||
|
||||
person_data['notes'] = event.target.notes.value;
|
||||
|
||||
person_data = Object.assign(person_data, name_li);
|
||||
console.log(person_data);
|
||||
|
||||
person_obj_up_promise = update_person_obj(person_id, person_data);
|
||||
|
||||
// person_obj_edit = true;
|
||||
}
|
||||
|
||||
function handle_delete_person(value) {
|
||||
console.log('*** handle_delete_person() ***');
|
||||
// person_obj_edit = true;
|
||||
}
|
||||
|
||||
function handle_edit_contact(value) {
|
||||
console.log('*** handle_edit_contact() ***');
|
||||
contact_obj_edit = true;
|
||||
}
|
||||
|
||||
function handle_cancel_contact(value) {
|
||||
console.log('*** handle_cancel_contact() ***');
|
||||
contact_obj_edit = false;
|
||||
}
|
||||
|
||||
function handle_save_contact(value) {
|
||||
console.log('*** handle_save_contact() ***');
|
||||
}
|
||||
|
||||
function handle_delete_contact(value) {
|
||||
console.log('*** handle_delete_contact() ***');
|
||||
}
|
||||
|
||||
function handle_edit_address(value) {
|
||||
console.log('*** handle_edit_address() ***');
|
||||
address_obj_edit = true;
|
||||
}
|
||||
|
||||
function handle_cancel_address(value) {
|
||||
console.log('*** handle_cancel_address() ***');
|
||||
address_obj_edit = false;
|
||||
}
|
||||
|
||||
function handle_save_address(value) {
|
||||
console.log('*** handle_save_address() ***');
|
||||
}
|
||||
|
||||
function handle_delete_address(value) {
|
||||
console.log('*** handle_delete_address() ***');
|
||||
}
|
||||
|
||||
function test_fun() {
|
||||
console.log('*** test_fun() ***');
|
||||
return false;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div>
|
||||
<header>
|
||||
<h2>{name}</h2>
|
||||
</header>
|
||||
|
||||
<div class="person_obj">
|
||||
|
||||
<button on:click={handle_get_person_obj(person_id)}>
|
||||
Load Person
|
||||
</button>
|
||||
|
||||
{#await person_obj_get_promise}
|
||||
<!-- promise is pending -->
|
||||
<div>Loading...</div>
|
||||
{:then result}
|
||||
<!-- promise was fulfilled -->
|
||||
{#if person_obj}
|
||||
<section class="person_obj obj">
|
||||
{#if person_obj_edit == true}
|
||||
<form on:submit|preventDefault={handle_save_person} class="" on:keydown={e => e.key === 'Escape' && handle_cancel_person}>
|
||||
<input value={person_obj.person_id_random} type="hidden" id="person__id_random--{person_obj.person_id_random}" name="id_random" />
|
||||
|
||||
<fieldset class="">
|
||||
<legend>Name</legend>
|
||||
<Input_element {...html_template['person']['given_name']} id_random={person_obj.person_id_random} value={person_obj.given_name} />
|
||||
|
||||
<Input_element {...html_template['person']['middle_name']} id_random={person_obj.person_id_random} value={person_obj.middle_name} />
|
||||
|
||||
<Input_element {...html_template['person']['family_name']} id_random={person_obj.person_id_random} value={person_obj.family_name} />
|
||||
</fieldset>
|
||||
|
||||
<Input_element {...html_template['person']['title']} id_random={person_obj.person_id_random} value={person_obj.title} />
|
||||
|
||||
<Input_element {...html_template['person']['tagline']} id_random={person_obj.person_id_random} value={person_obj.tagline} />
|
||||
|
||||
<Input_element {...html_template['person']['organization_name']} id_random={person_obj.person_id_random} value={person_obj.organization_name} />
|
||||
|
||||
<Input_element {...html_template['person']['notes']} id_random={person_obj.person_id_random} value={person_obj.notes} />
|
||||
|
||||
<div class="edit_options">
|
||||
<button class="btn person-cancel" on:click={handle_cancel_person} type="button">
|
||||
Cancel<span class="visually_hidden">name change</span>
|
||||
</button>
|
||||
<button class="btn btn__primary person-edit" type="submit" disabled={!given_name}>
|
||||
Save<span class="visually_hidden">name change</span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
Full name: {person_obj.full_name}
|
||||
{:else}
|
||||
Name: {person_obj.full_name} {person_obj.given_name} {person_obj.middle_name} {person_obj.family_name}
|
||||
Organization name {person_obj.organization_name}
|
||||
|
||||
<div class="edit_options">
|
||||
<button type="button" class="btn" on:click={handle_edit_person}>
|
||||
Edit<span class="visually_hidden"> person</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn__danger" on:click={handle_delete_person}>
|
||||
Delete<span class="visually_hidden"> person</span>
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<section class="contact_obj obj">
|
||||
{#if contact_obj_edit == true}
|
||||
<form on:submit|preventDefault={handle_save_contact} class="" on:keydown={e => e.key === 'Escape' && handle_cancel_contact}>
|
||||
<input value={person_obj.contact.contact_id_random} type="hidden" id="contact__id_random--{person_obj.contact.contact_id_random}" name="id_random" />
|
||||
|
||||
<label for="contact__email--{person_obj.contact.contact_id_random}" class="">Email</label>
|
||||
<input bind:value={email} type="text" id="contact__email--{person_obj.contact.contact_id_random}" autoComplete="off" class="" />
|
||||
|
||||
<div class="edit_options">
|
||||
<button class="btn contact-cancel" on:click={handle_cancel_contact} type="button">
|
||||
Cancel<span class="visually_hidden">contact change</span>
|
||||
</button>
|
||||
<button class="btn btn__primary contact-edit" type="submit" disabled={!email}>
|
||||
Save<span class="visually_hidden">contact change</span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
{:else}
|
||||
Email: {person_obj.contact.email}
|
||||
|
||||
<div class="edit_options">
|
||||
<button type="button" class="btn" on:click={handle_edit_contact}>
|
||||
Edit<span class="visually_hidden"> contact</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn__danger" on:click={handle_delete_contact}>
|
||||
Delete<span class="visually_hidden"> contact</span>
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
<section class="address_obj obj">
|
||||
{#if address_obj_edit == true}
|
||||
<form on:submit|preventDefault={handle_save_address} class="" on:keydown={e => e.key === 'Escape' && handle_cancel_address}>
|
||||
<input value={person_obj.contact.address.address_id_random} type="hidden" id="address__id_random--{person_obj.contact.address.address_id_random}" name="id_random" />
|
||||
|
||||
<label for="address__line_1--{person_obj.contact.address.address_id_random}" class="">Line 1</label>
|
||||
<input bind:value={line_1} type="text" id="address__line_1--{person_obj.contact.address.address_id_random}" autoComplete="off" class="" />
|
||||
|
||||
<div class="edit_options">
|
||||
<button class="btn address-cancel" on:click={handle_cancel_address} type="button">
|
||||
Cancel<span class="visually_hidden">address change</span>
|
||||
</button>
|
||||
<button class="btn btn__primary address-edit" type="submit" disabled={!line_1}>
|
||||
Save<span class="visually_hidden">address change</span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
{:else}
|
||||
Line 1: {person_obj.contact.address.line_1}
|
||||
City: {person_obj.contact.address.city}
|
||||
State/Province: {person_obj.contact.address.country_subdivision_name}
|
||||
|
||||
<div class="edit_options">
|
||||
<button type="button" class="btn" on:click={handle_edit_address}>
|
||||
Edit<span class="visually_hidden"> address</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn__danger" on:click={handle_delete_address}>
|
||||
Delete<span class="visually_hidden"> address</span>
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
</section> <!-- END section contact_obj -->
|
||||
|
||||
{:else}
|
||||
<div>Nothing loaded yet</div>
|
||||
{/if}
|
||||
|
||||
{:catch error}
|
||||
<!-- promise was rejected -->
|
||||
<div class="error">{error.message}</div>
|
||||
{/await}
|
||||
|
||||
|
||||
|
||||
{#await promise_request_obj_up}
|
||||
<div>Updating...</div>
|
||||
{:then result}
|
||||
{:catch error}
|
||||
<div class="error">{error.message}</div>
|
||||
{/await}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
section.obj {
|
||||
margin: 1rem 0rem;
|
||||
padding: .5rem .5rem;
|
||||
}
|
||||
.person_obj {
|
||||
border: solid thin hsla(0, 25%, 90%, 1);
|
||||
}
|
||||
|
||||
.contact_obj {
|
||||
border: solid thin hsla(0, 25%, 90%, 1);
|
||||
}
|
||||
|
||||
.address_obj{
|
||||
border: solid thin hsla(0, 25%, 90%, 1);
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -1,322 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { fade, fly } from 'svelte/transition';
|
||||
// import delete_object from './api_delete.js';
|
||||
import get_object from './api_get.js';
|
||||
// import post_object from './api_post.js';
|
||||
import patch_object from './api_patch.js';
|
||||
|
||||
export let name: string;
|
||||
export let account_id: string;
|
||||
export let person_id: string;
|
||||
|
||||
let person_obj = null;
|
||||
let person_obj_get_promise = null;
|
||||
let person_obj_up_promise = null;
|
||||
|
||||
let person_obj_edit = false;
|
||||
let given_name = null;
|
||||
|
||||
let contact_obj_edit = false;
|
||||
let email = null;
|
||||
|
||||
let address_obj_edit = false;
|
||||
let line_1 = false;
|
||||
|
||||
|
||||
let person_data = null;
|
||||
// let promise_request_obj_del = null;
|
||||
// let promise_request_obj_get = null;
|
||||
// let promise_request_obj_li = null;
|
||||
let promise_request_obj_up = null;
|
||||
|
||||
onMount(() => {
|
||||
console.log('The component has mounted');
|
||||
person_obj_get_promise = get_person_obj(person_id);
|
||||
|
||||
/* const interval = setInterval(() => {
|
||||
console.log('beep');
|
||||
}, 1000); */
|
||||
});
|
||||
|
||||
function handle_get_person_obj(person_id) {
|
||||
console.log('*** handle_get_person_obj() ***');
|
||||
|
||||
person_obj_get_promise = get_person_obj(person_id);
|
||||
}
|
||||
|
||||
async function get_person_obj(person_id) {
|
||||
console.log('*** get_person_obj() ***');
|
||||
|
||||
let endpoint = `/person/${person_id}`;
|
||||
let params = { inc_address: true, inc_contact: true, inc_membership_member: true };
|
||||
let person_obj_get_resp = await get_object({endpoint:endpoint, params:params});
|
||||
|
||||
person_obj = person_obj_get_resp;
|
||||
given_name = person_obj.given_name;
|
||||
email = person_obj.contact.email;
|
||||
line_1 = person_obj.contact.address.line_1;
|
||||
return true;
|
||||
}
|
||||
|
||||
function handle_update_person_obj() {
|
||||
console.log('*** handle_update_person_obj() ***');
|
||||
|
||||
person_obj_up_promise = update_person_obj(person_id, person_data);
|
||||
}
|
||||
|
||||
async function update_person_obj(person_id, person_data) {
|
||||
console.log('*** update_person_obj() ***');
|
||||
|
||||
let endpoint = `/person/${person_id}`;
|
||||
let params = { return_obj: true };
|
||||
let person_obj_up_resp = await patch_object({endpoint:endpoint, params:params, record:person_data});
|
||||
console.log(person_obj_up_resp);
|
||||
|
||||
person_obj = { ...person_obj, ...person_obj_up_resp };
|
||||
return true;
|
||||
}
|
||||
|
||||
function handle_edit_person(value) {
|
||||
console.log('*** handle_edit_person() ***');
|
||||
person_obj_edit = true;
|
||||
}
|
||||
|
||||
function handle_cancel_person() {
|
||||
console.log('*** handle_cancel_person() ***');
|
||||
person_obj_edit = false;
|
||||
}
|
||||
|
||||
function handle_save_person(event) {
|
||||
console.log('*** handle_save_person() ***');
|
||||
console.log(event);
|
||||
console.log(event.target);
|
||||
console.log(event.target.given_name.value);
|
||||
console.log(event.target.family_name.value);
|
||||
|
||||
// person_id = event.target.person_id.value;
|
||||
|
||||
let person_data = {};
|
||||
person_data['given_name'] = event.target.given_name.value;
|
||||
person_data['middle_name'] = event.target.middle_name.value;
|
||||
person_data['family_name'] = event.target.family_name.value;
|
||||
|
||||
console.log(person_data);
|
||||
|
||||
// person_data['full_name'] = `${event.target.given_name.value} ${event.target.family_name.value}`;
|
||||
|
||||
let name_li = process_person_name(person_data);
|
||||
|
||||
// person_data = { ...person_data, name_li };
|
||||
person_data = Object.assign(person_data, name_li);
|
||||
console.log(person_data);
|
||||
|
||||
person_obj_up_promise = update_person_obj(person_id, person_data);
|
||||
|
||||
// person_obj_edit = true;
|
||||
}
|
||||
|
||||
function handle_delete_person(value) {
|
||||
console.log('*** handle_delete_person() ***');
|
||||
// person_obj_edit = true;
|
||||
}
|
||||
|
||||
function handle_edit_contact(value) {
|
||||
console.log('*** handle_edit_contact() ***');
|
||||
contact_obj_edit = true;
|
||||
}
|
||||
|
||||
function handle_cancel_contact(value) {
|
||||
console.log('*** handle_cancel_contact() ***');
|
||||
contact_obj_edit = false;
|
||||
}
|
||||
|
||||
function handle_save_contact(value) {
|
||||
console.log('*** handle_save_contact() ***');
|
||||
}
|
||||
|
||||
function handle_delete_contact(value) {
|
||||
console.log('*** handle_delete_contact() ***');
|
||||
}
|
||||
|
||||
function handle_edit_address(value) {
|
||||
console.log('*** handle_edit_address() ***');
|
||||
address_obj_edit = true;
|
||||
}
|
||||
|
||||
function handle_cancel_address(value) {
|
||||
console.log('*** handle_cancel_address() ***');
|
||||
address_obj_edit = false;
|
||||
}
|
||||
|
||||
function handle_save_address(value) {
|
||||
console.log('*** handle_save_address() ***');
|
||||
}
|
||||
|
||||
function handle_delete_address(value) {
|
||||
console.log('*** handle_delete_address() ***');
|
||||
}
|
||||
|
||||
function test_fun() {
|
||||
console.log('*** test_fun() ***');
|
||||
return false;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div>
|
||||
<header>
|
||||
<h2>{name}</h2>
|
||||
</header>
|
||||
|
||||
<div class="person_obj">
|
||||
|
||||
<button on:click={handle_get_person_obj(person_id)}>
|
||||
Load Person
|
||||
</button>
|
||||
|
||||
{#await person_obj_get_promise}
|
||||
<!-- promise is pending -->
|
||||
<div>Loading...</div>
|
||||
{:then result}
|
||||
<!-- promise was fulfilled -->
|
||||
{#if person_obj}
|
||||
<section class="person_obj">
|
||||
{#if person_obj_edit == true}
|
||||
<form on:submit|preventDefault={handle_save_person} class="" on:keydown={e => e.key === 'Escape' && handle_cancel_person}>
|
||||
<input value={person_obj.person_id_random} type="hidden" id="person__id_random--{person_obj.person_id_random}" name="id_random" />
|
||||
|
||||
<label for="person__given_name--{person_obj.person_id_random}" class="">Given Name</label>
|
||||
<input bind:value={given_name} type="text" id="person__given_name--{person_obj.person_id_random}" name="given_name" autoComplete="off" class="" />
|
||||
|
||||
<label for="person__middle_name--{person_obj.person_id_random}" class="">Middle Name</label>
|
||||
<input value={person_obj.middle_name} type="text" id="person__middle_name--{person_obj.person_id_random}" name="middle_name" autoComplete="off" class="" />
|
||||
|
||||
<label for="person__family_name--{person_obj.person_id_random}" class="">Family Name</label>
|
||||
<input value={person_obj.family_name} type="text" id="person__family_name--{person_obj.person_id_random}" name="family_name" autoComplete="off" class="" />
|
||||
|
||||
<div class="edit_options">
|
||||
<button class="btn person-cancel" on:click={handle_cancel_person} type="button">
|
||||
Cancel<span class="visually_hidden">name change</span>
|
||||
</button>
|
||||
<button class="btn btn__primary person-edit" type="submit" disabled={!given_name}>
|
||||
Save<span class="visually_hidden">name change</span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
Full name: {person_obj.full_name}
|
||||
{:else}
|
||||
Name: {person_obj.full_name} {person_obj.given_name} {person_obj.middle_name} {person_obj.family_name}
|
||||
Organization name {person_obj.organization_name}
|
||||
|
||||
<div class="edit_options">
|
||||
<button type="button" class="btn" on:click={handle_edit_person}>
|
||||
Edit<span class="visually_hidden"> person</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn__danger" on:click={handle_delete_person}>
|
||||
Delete<span class="visually_hidden"> person</span>
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<section class="contact_obj">
|
||||
{#if contact_obj_edit == true}
|
||||
<form on:submit|preventDefault={handle_save_contact} class="" on:keydown={e => e.key === 'Escape' && handle_cancel_contact}>
|
||||
<input value={person_obj.contact.contact_id_random} type="hidden" id="contact__id_random--{person_obj.contact.contact_id_random}" name="id_random" />
|
||||
|
||||
<label for="contact__email--{person_obj.contact.contact_id_random}" class="">Email</label>
|
||||
<input bind:value={email} type="text" id="contact__email--{person_obj.contact.contact_id_random}" autoComplete="off" class="" />
|
||||
|
||||
<div class="edit_options">
|
||||
<button class="btn contact-cancel" on:click={handle_cancel_contact} type="button">
|
||||
Cancel<span class="visually_hidden">contact change</span>
|
||||
</button>
|
||||
<button class="btn btn__primary contact-edit" type="submit" disabled={!email}>
|
||||
Save<span class="visually_hidden">contact change</span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
{:else}
|
||||
Email: {person_obj.contact.email}
|
||||
|
||||
<div class="edit_options">
|
||||
<button type="button" class="btn" on:click={handle_edit_contact}>
|
||||
Edit<span class="visually_hidden"> contact</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn__danger" on:click={handle_delete_contact}>
|
||||
Delete<span class="visually_hidden"> contact</span>
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
<section class="address_obj">
|
||||
{#if address_obj_edit == true}
|
||||
<form on:submit|preventDefault={handle_save_address} class="" on:keydown={e => e.key === 'Escape' && handle_cancel_address}>
|
||||
<input value={person_obj.contact.address.address_id_random} type="hidden" id="address__id_random--{person_obj.contact.address.address_id_random}" name="id_random" />
|
||||
|
||||
<label for="address__line_1--{person_obj.contact.address.address_id_random}" class="">Line 1</label>
|
||||
<input bind:value={line_1} type="text" id="address__line_1--{person_obj.contact.address.address_id_random}" autoComplete="off" class="" />
|
||||
|
||||
<div class="edit_options">
|
||||
<button class="btn address-cancel" on:click={handle_cancel_address} type="button">
|
||||
Cancel<span class="visually_hidden">address change</span>
|
||||
</button>
|
||||
<button class="btn btn__primary address-edit" type="submit" disabled={!line_1}>
|
||||
Save<span class="visually_hidden">address change</span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
{:else}
|
||||
Line 1: {person_obj.contact.address.line_1}
|
||||
City: {person_obj.contact.address.city}
|
||||
State/Province: {person_obj.contact.address.country_subdivision_name}
|
||||
|
||||
<div class="edit_options">
|
||||
<button type="button" class="btn" on:click={handle_edit_address}>
|
||||
Edit<span class="visually_hidden"> address</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn__danger" on:click={handle_delete_address}>
|
||||
Delete<span class="visually_hidden"> address</span>
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
</section> <!-- END section contact_obj -->
|
||||
|
||||
{:else}
|
||||
<div>Nothing loaded yet</div>
|
||||
{/if}
|
||||
|
||||
{:catch error}
|
||||
<!-- promise was rejected -->
|
||||
<div class="error">{error.message}</div>
|
||||
{/await}
|
||||
|
||||
|
||||
|
||||
{#await promise_request_obj_up}
|
||||
<div>Updating...</div>
|
||||
{:then result}
|
||||
{:catch error}
|
||||
<div class="error">{error.message}</div>
|
||||
{/await}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.person_obj {
|
||||
border: solid thin hsla(0, 25%, 90%, 1);
|
||||
}
|
||||
|
||||
.contact_obj {
|
||||
border: solid thin hsla(0, 25%, 90%, 1);
|
||||
}
|
||||
|
||||
.address_obj{
|
||||
border: solid thin hsla(0, 25%, 90%, 1);
|
||||
}
|
||||
|
||||
</style>
|
||||
246
src/stores.ts
Normal file
246
src/stores.ts
Normal file
@@ -0,0 +1,246 @@
|
||||
import { readable, writable } from 'svelte/store';
|
||||
// console.log('*** stores.ts ***');
|
||||
|
||||
/* FAKE TESTING DATA */
|
||||
|
||||
let fake_app_base_url = 'https://dev-app.oneskyit.com';
|
||||
let fake_app_base_url_backup = 'https://bak-app.oneskyit.com';
|
||||
let fake_api_base_url = 'https://dev-api.oneskyit.com';
|
||||
let fake_api_base_url_backup = 'https://bak-api.oneskyit.com';
|
||||
let fake_api_secret_key = 'dFP6J9DVj9hUgIMn-fNIqg';
|
||||
let fake_ae_account_id = '_XY7DXtc9MY'; // OSIT Demo _XY7DXtc9MY (1)
|
||||
let fake_ae_api_jwt_key="EHmSXZFKfMEW65E8kxCKmQ" // 22 characters; super secret Aether JWT signing key
|
||||
|
||||
let fake_api_temporary_token = '';
|
||||
|
||||
let fake_access_type = 'anonymous';
|
||||
let fake_administrator_access: boolean = false;
|
||||
let fake_trusted_access: boolean = false;
|
||||
|
||||
/* FAKE TESTING DATA */
|
||||
|
||||
type key_val = {
|
||||
[key: string]: any; // variable key
|
||||
// name: string;
|
||||
};
|
||||
|
||||
export const account_id = fake_ae_account_id;
|
||||
|
||||
let ae_cfg_data: key_val = {};
|
||||
|
||||
// NOTE: This API CRUD super key thing being here should be short term! -2023-05-02
|
||||
|
||||
ae_cfg_data['api'] = {};
|
||||
ae_cfg_data['app'] = {};
|
||||
|
||||
// ae_cfg_data['api']['api_crud_super_key'] = 'zp5PtX4zUsI';
|
||||
|
||||
let ae_api_cfg_data: key_val = {};
|
||||
if (api_base_url) {
|
||||
ae_api_cfg_data['base_url'] = api_base_url;
|
||||
} else {
|
||||
console.log(`WARNING: api_base_url not set. Using fake_api_base_url: ${fake_api_base_url}`);
|
||||
ae_api_cfg_data['base_url'] = fake_api_base_url;
|
||||
}
|
||||
if (api_base_url_backup) {
|
||||
ae_api_cfg_data['base_url_backup'] = api_base_url_backup;
|
||||
} else {
|
||||
console.log(`WARNING: api_base_url_backup not set. Using fake_api_base_url_backup: ${fake_api_base_url_backup}`);
|
||||
ae_api_cfg_data['base_url_backup'] = fake_api_base_url_backup;
|
||||
}
|
||||
|
||||
ae_api_cfg_data['api_crud_super_key'] = 'zp5PtX4zUsI';
|
||||
|
||||
ae_api_cfg_data['headers'] = {};
|
||||
ae_api_cfg_data['headers']['Access-Control-Allow-Origin'] = '*';
|
||||
ae_api_cfg_data['headers']['content-type'] = 'application/json';
|
||||
ae_api_cfg_data['headers']['x-aether-api-key'] = fake_api_secret_key;
|
||||
ae_api_cfg_data['headers']['x-aether-api-token'] = 'fake-temp-token';
|
||||
ae_api_cfg_data['headers']['x-aether-api-expire-on'] = '';
|
||||
ae_api_cfg_data['headers']['x-account-id'] = fake_ae_account_id;
|
||||
|
||||
console.log(`Aether API Config Data:`, ae_api_cfg_data);
|
||||
|
||||
ae_cfg_data['api']['headers'] = ae_api_cfg_data['headers'];
|
||||
|
||||
let ae_app_cfg_data: key_val = {};
|
||||
if (app_base_url) {
|
||||
ae_app_cfg_data['base_url'] = app_base_url;
|
||||
} else {
|
||||
console.log(`WARNING: app_base_url not set. Using fake_app_base_url: ${fake_app_base_url}`);
|
||||
ae_app_cfg_data['base_url'] = fake_app_base_url;
|
||||
}
|
||||
ae_cfg_data['app'] = ae_app_cfg_data;
|
||||
|
||||
console.log(`All Aether App and API Config Data:`, ae_cfg_data);
|
||||
window.localStorage.setItem('ae_cfg', JSON.stringify(ae_cfg_data)); // Also set in main HTML template files
|
||||
export const ae_cfg = readable(ae_cfg_data);
|
||||
|
||||
|
||||
|
||||
/* *** BEGIN *** Initialize slct variable */
|
||||
// Updated 2023-11-01
|
||||
export let slct_trigger: any = writable(null);
|
||||
let slct_obj_template: key_val = { 'sponsorship_id': null, 'sponsorship_obj': {}, 'post_id': null, 'post_obj': {}, 'post_obj_li': [], 'post_comment_id': null, 'post_comment_obj': {}, 'post_comment_obj_li': [] };
|
||||
export let slct = writable(slct_obj_template);
|
||||
|
||||
let novi_api_cfg_data: key_val = {};
|
||||
|
||||
|
||||
/* *** BEGIN *** Initialize IDAA app structure variable (JS object) */
|
||||
// Updated 2023-11-01
|
||||
let ae_app_data_version = .5;
|
||||
|
||||
let ae_app_struct: key_val = {
|
||||
'ver': ae_app_data_version,
|
||||
'app': ae_cfg_data.app, // Includes AE app base_url {'base_url': ae_cfg_data.app.base_url},
|
||||
'ae_api': ae_api_cfg_data, // Includes the AE API headers
|
||||
'novi_api': novi_api_cfg_data, // Includes the Novi API headers
|
||||
|
||||
'access_type': fake_access_type,
|
||||
'administrator_access': fake_administrator_access,
|
||||
'trusted_access': fake_trusted_access,
|
||||
|
||||
'account_id': account_id,
|
||||
|
||||
// YYYY-MM-DD string of the current date
|
||||
'current_date_str': new Date().toISOString().slice(0, 10),
|
||||
|
||||
'ae_user': null,
|
||||
'ae_key': null,
|
||||
'ae_full_name': null,
|
||||
'ae_admin_li': [],
|
||||
|
||||
// Module - OSIT Aether - The Hub
|
||||
'hub':{
|
||||
'show__site_header': true,
|
||||
'show__site_menu': true,
|
||||
'show__site_notificatons': true,
|
||||
'show__site_footer': true,
|
||||
'show__site_quick_access': false,
|
||||
|
||||
'ds':{},
|
||||
},
|
||||
|
||||
// Module - OSIT Aether - Sponsorships
|
||||
'sponsorships':{
|
||||
'show_sponsorship_id_view': false,
|
||||
'show_sponsorship_id_edit': false,
|
||||
|
||||
'filter_meeting_type': 'all', // all, idaa, al-anon
|
||||
'filter_meeting_group': 'all', // all, in-person, virtual
|
||||
'filter_location': 'all', // all, something something
|
||||
|
||||
// all, disabled, enabled
|
||||
'enabled': 'enabled', // all or nothing... easier for now
|
||||
|
||||
// all, hidden, not_hidden
|
||||
'hidden': 'not_hidden', // all or nothing... easier for now
|
||||
|
||||
'limit': 250, // all or nothing... easier for now
|
||||
'offset': 0, // all or nothing... easier for now
|
||||
|
||||
'group_sort': 'ASC', // ASC or DESC
|
||||
|
||||
'sponsorship_id': null,
|
||||
'sponsorship_cfg_id': null,
|
||||
|
||||
'qry_status': null,
|
||||
|
||||
'ds':{},
|
||||
},
|
||||
|
||||
'ds':{},
|
||||
|
||||
'testing': null
|
||||
}
|
||||
export let ae_app = writable(ae_app_struct);
|
||||
console.log(ae_app);
|
||||
|
||||
|
||||
|
||||
|
||||
// NOTE: read/write
|
||||
// Updated 2024-02-01
|
||||
export let ae_local = writable(ae_bridge.ae_local);
|
||||
ae_bridge.register_ae_local_listener((new_value) => {
|
||||
console.log(`Bridge to all: AE localStorage: ${new_value}`);
|
||||
console.log(new_value);
|
||||
|
||||
ae_local.set(new_value);
|
||||
console.log(ae_local);
|
||||
});
|
||||
|
||||
export let ae_session = writable(ae_bridge.ae_session);
|
||||
ae_bridge.register_ae_session_listener((new_value) => {
|
||||
console.log(`Bridge to all: AE sessionStorage: ${new_value}`);
|
||||
console.log(new_value);
|
||||
|
||||
ae_session.set(new_value);
|
||||
console.log(ae_session);
|
||||
});
|
||||
|
||||
|
||||
// if (ae_bridge.ae_local && !ae_bridge.ae_local.app && ae_bridge.ae_local.app !== {}) {
|
||||
// ae_bridge.ae_local.app = ae_app_struct; // .set({});
|
||||
// }
|
||||
|
||||
// if (ae_bridge.ae_session && !ae_bridge.ae_session.app && ae_bridge.ae_session.app !== {}) {
|
||||
// ae_bridge.ae_session.app = ae_app_struct; // .set({});
|
||||
// }
|
||||
|
||||
// if (!ae_bridge.ae_session.app.sponsorships) {
|
||||
// ae_bridge.ae_session.app.sponsorships = {
|
||||
// 'ver': ae_app_data_version,
|
||||
// 'app': ae_cfg_data.app, // Includes AE app base_url {'base_url': ae_cfg_data.app.base_url},
|
||||
// 'ae_api': ae_api_cfg_data, // Includes the AE API headers
|
||||
// 'novi_api': novi_api_cfg_data, // Includes the Novi API headers
|
||||
|
||||
// 'access_type': fake_access_type,
|
||||
// 'administrator_access': fake_administrator_access,
|
||||
// 'trusted_access': fake_trusted_access,
|
||||
|
||||
// 'account_id': account_id,
|
||||
|
||||
// // YYYY-MM-DD string of the current date
|
||||
// 'current_date_str': new Date().toISOString().slice(0, 10),
|
||||
|
||||
// 'ae_user': null,
|
||||
// 'ae_key': null,
|
||||
// 'ae_full_name': null,
|
||||
// 'ae_admin_li': [],
|
||||
|
||||
// // Module - OSIT Aether - Sponsorships
|
||||
// 'sponsorships':{
|
||||
// 'show_sponsorship_id_view': false,
|
||||
// 'show_sponsorship_id_edit': false,
|
||||
|
||||
// 'filter_meeting_type': 'all', // all, idaa, al-anon
|
||||
// 'filter_meeting_group': 'all', // all, in-person, virtual
|
||||
// 'filter_location': 'all', // all, something something
|
||||
|
||||
// // all, disabled, enabled
|
||||
// 'enabled': 'enabled', // all or nothing... easier for now
|
||||
|
||||
// // all, hidden, not_hidden
|
||||
// 'hidden': 'not_hidden', // all or nothing... easier for now
|
||||
|
||||
// 'limit': 250, // all or nothing... easier for now
|
||||
// 'offset': 0, // all or nothing... easier for now
|
||||
|
||||
// 'group_sort': 'ASC', // ASC or DESC
|
||||
|
||||
// 'sponsorship_id': null,
|
||||
// 'sponsorship_cfg_id': null,
|
||||
|
||||
// 'qry_status': null,
|
||||
|
||||
// 'ds':{},
|
||||
// },
|
||||
|
||||
// 'ds':{},
|
||||
|
||||
// };
|
||||
// }
|
||||
|
||||
console.log(ae_bridge.ae_session);
|
||||
40
src/stores_ae_api.js
Normal file
40
src/stores_ae_api.js
Normal file
@@ -0,0 +1,40 @@
|
||||
console.log('*** stores_data_store_api.js Stores ***');
|
||||
import { get } from 'svelte/store';
|
||||
import { ae_app } from './stores';
|
||||
import { api } from 'aether_npm_lib';
|
||||
|
||||
|
||||
/* BEGIN: IDAA Recover Meetings Related */
|
||||
export let get_account_event_obj_list = async function get_account_event_obj_list({account_id, enabled='enabled', hidden='not_hidden', limit=100, params={}, timeout=50000, log_lvl=0}) {
|
||||
console.log('*** stores_meetings_api.js: get_account_event_obj_list() ***');
|
||||
|
||||
const endpoint = `/account/${account_id}/event/meeting_list_flat`;
|
||||
|
||||
let allowed_enabled_list = ['all', 'enabled', 'not_enabled']
|
||||
if (allowed_enabled_list.includes(enabled) ) {
|
||||
params['enabled'] = enabled;
|
||||
}
|
||||
|
||||
let allowed_hidden_list = ['all', 'hidden', 'not_hidden'];
|
||||
if (allowed_hidden_list.includes(hidden) ) {
|
||||
params['hidden'] = hidden;
|
||||
}
|
||||
|
||||
if (limit) {
|
||||
params['limit'] = limit;
|
||||
}
|
||||
|
||||
let event_obj_list_get_promise = await api.get_object({api_cfg: get(ae_app).ae_api, endpoint: endpoint, params: params, timeout: timeout, log_lvl: log_lvl});
|
||||
|
||||
// if (event_obj_list_get_promise === false) {
|
||||
// console.log('Event - RUN AGAIN WITH BACKUP');
|
||||
|
||||
// let temp_api = get(cfg).api;
|
||||
// temp_api['base_url'] = temp_api['base_url_backup']
|
||||
|
||||
// event_obj_list_get_promise = await api.get_object({api_cfg: temp_api, endpoint: endpoint, params: params, timeout: timeout, log_lvl: log_lvl});
|
||||
// }
|
||||
|
||||
let event_obj_list = event_obj_list_get_promise;
|
||||
return event_obj_list;
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
<script lang="ts">
|
||||
export let name: string;
|
||||
</script>
|
||||
|
||||
<section>
|
||||
<p>This is a test. Name: {name}</p>
|
||||
</section>
|
||||
|
||||
<style>
|
||||
p {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
264
src/user.svelte
264
src/user.svelte
@@ -1,264 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { fade, fly } from 'svelte/transition';
|
||||
// import delete_object from './api_delete.js';
|
||||
import get_object from './api_get.js';
|
||||
// import post_object from './api_post.js';
|
||||
import update_object from './api_update.js';
|
||||
|
||||
export let name: string;
|
||||
export let account_id: string;
|
||||
export let user_id: string;
|
||||
|
||||
let user_obj = null;
|
||||
// let membership_member_obj_view = null;
|
||||
|
||||
// let promise_request_obj_del = null;
|
||||
let promise_request_obj_get = null;
|
||||
// let promise_request_obj_li = null;
|
||||
let promise_request_obj_up = null;
|
||||
|
||||
function handle_get_membership_member_obj_li() {
|
||||
console.log('*** handle_get_membership_member_obj_li() ***');
|
||||
|
||||
promise_request_obj_li = get_membership_member_obj_li();
|
||||
}
|
||||
|
||||
async function get_membership_member_obj_li() {
|
||||
console.log('*** get_membership_member_obj_li() ***');
|
||||
|
||||
let endpoint = `/account/${account_id}/membership/member/list`;
|
||||
let params = { inc_person: true, inc_user: true };
|
||||
|
||||
let membership_member_obj_li_resp = await get_object({endpoint:endpoint, params:params, force_li:true});
|
||||
console.log(membership_member_obj_li_resp);
|
||||
|
||||
membership_member_obj_li = membership_member_obj_li_resp;
|
||||
}
|
||||
|
||||
function handle_view_membership_member_obj(membership_member_obj) {
|
||||
console.log('*** handle_view_membership_member_obj() ***');
|
||||
|
||||
membership_member_obj_view = membership_member_obj;
|
||||
}
|
||||
|
||||
function handle_reset_view_membership_member_obj() {
|
||||
console.log('*** handle_reset_view_membership_member_obj() ***');
|
||||
|
||||
membership_member_obj_view = null;
|
||||
}
|
||||
|
||||
function handle_status_membership_member_obj(membership_member_obj, status) {
|
||||
console.log('*** handle_status_membership_member_obj() ***');
|
||||
|
||||
// console.log(membership_member_obj);
|
||||
// console.log(membership_member_obj_li.indexOf(membership_member_obj));
|
||||
let index = membership_member_obj_li.indexOf(membership_member_obj);
|
||||
// membership_member_obj_up = membership_member_obj_li[index];
|
||||
|
||||
let membership_member_id = membership_member_obj.membership_member_id_random;
|
||||
let data = {}
|
||||
// let status_name = null;
|
||||
let current_datetime = new Date();
|
||||
switch (status) {
|
||||
case 'pending':
|
||||
data = { 'status_id': 1, 'approved_on': null, 'start_on': null };
|
||||
membership_member_obj_li[index].status_id = 1;
|
||||
membership_member_obj_li[index].status_name = 'Pending';
|
||||
membership_member_obj_li[index].approved_on = null;
|
||||
membership_member_obj_li[index].start_on = null;
|
||||
break;
|
||||
case 'approve':
|
||||
data = { 'status_id': 3, 'approved_on': current_datetime };
|
||||
membership_member_obj_li[index].status_id = 3;
|
||||
membership_member_obj_li[index].status_name = 'Approved';
|
||||
membership_member_obj_li[index].approved_on = current_datetime;
|
||||
break;
|
||||
case 'reject':
|
||||
data = { 'status_id': 4, 'approved_on': null, 'start_on': null };
|
||||
membership_member_obj_li[index].status_id = 4;
|
||||
membership_member_obj_li[index].status_name = 'Rejected';
|
||||
membership_member_obj_li[index].approved_on = null;
|
||||
membership_member_obj_li[index].start_on = null;
|
||||
break;
|
||||
case 'active':
|
||||
data = { 'status_id': 5, 'start_on': current_datetime };
|
||||
membership_member_obj_li[index].status_id = 5;
|
||||
membership_member_obj_li[index].status_name = 'Active';
|
||||
membership_member_obj_li[index].start_on = current_datetime;
|
||||
if (!membership_member_obj_li[index].first_start_on) {
|
||||
data['first_start_on'] = current_datetime;
|
||||
membership_member_obj_li[index].first_start_on = current_datetime;
|
||||
}
|
||||
break;
|
||||
}
|
||||
promise_request_obj_up = update_membership_member_obj(membership_member_id, data);
|
||||
// membership_member_obj.status_id = data['status_id'];
|
||||
// membership_member_obj.status_name = status_name;
|
||||
// membership_member_obj.approved_on = data['approved_on'];
|
||||
|
||||
// let array_index = membership_member_obj_li.indexOf(membership_member_obj);
|
||||
// membership_member_obj_up.status_id = data['status_id'];
|
||||
// membership_member_obj_up.status_name = status_name;
|
||||
// membership_member_obj_up.approved_on = data['approved_on'];
|
||||
|
||||
// membership_member_obj_li = membership_member_obj_li.filter(log_client_viewing => log_client_viewing !== rm_log_client_viewing);
|
||||
}
|
||||
|
||||
async function update_membership_member_obj(membership_member_id, data) {
|
||||
console.log('*** update_membership_member_obj() ***');
|
||||
|
||||
let endpoint = `/membership/member/${membership_member_id}`;
|
||||
|
||||
let membership_member_obj_up_resp = await update_object({endpoint:endpoint, record:data});
|
||||
console.log(membership_member_obj_up_resp);
|
||||
|
||||
// membership_member_obj_li = membership_member_obj_up_resp;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div>
|
||||
<header>
|
||||
<h2>{name}</h2>
|
||||
</header>
|
||||
|
||||
<button on:click={handle_get_membership_member_obj_li}>
|
||||
Load Membership Member List
|
||||
</button>
|
||||
|
||||
<div class="membership_member_obj_li">
|
||||
|
||||
|
||||
{#if membership_member_obj_li}
|
||||
{#await membership_member_obj_li}
|
||||
<div>Loading...</div>
|
||||
{:then result}
|
||||
<!-- <div>Loaded</div> -->
|
||||
{:catch error}
|
||||
<div class="error">{error.message}</div>
|
||||
{/await}
|
||||
<table class="table_borders membership_member_obj_tbl table_alt_rows">
|
||||
<tr>
|
||||
<th>Actions</th>
|
||||
<!-- <th>Index</th> -->
|
||||
<th>ID</th>
|
||||
<th>Type</th>
|
||||
<th>Status</th>
|
||||
<th>Name</th>
|
||||
<th>Username</th>
|
||||
<th>Email</th>
|
||||
<th>Approved</th>
|
||||
<th>First Start On</th>
|
||||
<th>Current Start On</th>
|
||||
</tr>
|
||||
{#each membership_member_obj_li as membership_member_obj, index}
|
||||
<tr key={membership_member_obj.membership_member_id_random} class="record">
|
||||
<td>
|
||||
<button on:click={handle_view_membership_member_obj(membership_member_obj)}><span class="fas fa-eye"></span></button>
|
||||
</td>
|
||||
<!-- <td>{index}</td> -->
|
||||
<td class="id_random">{membership_member_obj.membership_member_id_random}</td>
|
||||
<td class="type_name">{membership_member_obj.type_name}</td>
|
||||
<td class="status_name">
|
||||
{membership_member_obj.status_name}
|
||||
{#if membership_member_obj.status_name === 'Pending'}
|
||||
<button on:click={handle_status_membership_member_obj(membership_member_obj, 'approve')} title="Set to approved"><span class="fas fa-user-check"></span></button>
|
||||
<button on:click={handle_status_membership_member_obj(membership_member_obj, 'reject')} title="Set to rejected"><span class="fas fa-user-times"></span></button>
|
||||
{:else if membership_member_obj.status_name === 'Rejected'}
|
||||
<button on:click={handle_status_membership_member_obj(membership_member_obj, 'pending')} title="Set to pending"><span class="fas fa-user-lock"></span></button>
|
||||
<button on:click={handle_status_membership_member_obj(membership_member_obj, 'reject')} title="Set to rejected"><span class="fas fa-user-times"></span></button>
|
||||
{:else if membership_member_obj.status_name === 'Approved'}
|
||||
<button on:click={handle_status_membership_member_obj(membership_member_obj, 'reject')} title="Set to rejected"><span class="fas fa-user-times"></span></button>
|
||||
<button on:click={handle_status_membership_member_obj(membership_member_obj, 'active')} title="Set to active"><span class="fas fa-user-check"></span></button>
|
||||
{/if}
|
||||
</td>
|
||||
<td class="full_name">{membership_member_obj.person.full_name}</td>
|
||||
<td class="username">{membership_member_obj.user.username}</td>
|
||||
<td class="email">{membership_member_obj.user.email}</td>
|
||||
|
||||
<td class="approved_on">{iso_datetime_formatter(membership_member_obj.approved_on,'datetime_short')}</td>
|
||||
<td class="first_start_on">{iso_datetime_formatter(membership_member_obj.first_start_on,'datetime_short')}</td>
|
||||
<td class="start_on">{iso_datetime_formatter(membership_member_obj.start_on,'datetime_short')}</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</table>
|
||||
{:else}
|
||||
<div>Nothing loaded yet</div>
|
||||
{/if}
|
||||
|
||||
{#await promise_request_obj_del}
|
||||
<div>Deleting...</div>
|
||||
{:then result}
|
||||
{:catch error}
|
||||
<div class="error">{error.message}</div>
|
||||
{/await}
|
||||
|
||||
{#await promise_request_obj_up}
|
||||
<div>Updating...</div>
|
||||
{:then result}
|
||||
{:catch error}
|
||||
<div class="error">{error.message}</div>
|
||||
{/await}
|
||||
|
||||
|
||||
|
||||
{#if membership_member_obj_view}
|
||||
<div transition:fade="{{ duration: 200 }}" class="modal_container">
|
||||
<div class="modal_content">
|
||||
<header class="modal_header">
|
||||
<section class="modal_header_begin">
|
||||
<h3 class="modal_title">{membership_member_obj_view.person.full_name} ({membership_member_obj_view.user.username})</h3>
|
||||
<div>{membership_member_obj_view.membership_member_id_random}</div>
|
||||
</section>
|
||||
<section class="modal_header_end">
|
||||
<button on:click={handle_reset_view_membership_member_obj(membership_member_obj_view)} class="modal_close"><span class="fas fa-window-close"></span> Close</button>
|
||||
</section>
|
||||
</header>
|
||||
|
||||
<section class="modal_body">
|
||||
|
||||
<div>Approved on: {iso_datetime_formatter(membership_member_obj_view.approved_on,'datetime_short')}</div>
|
||||
|
||||
<div>Created/Updated: {iso_datetime_formatter(membership_member_obj_view.created_on,'datetime_short')} / {iso_datetime_formatter(membership_member_obj_view.updated_on,'datetime_short')}</div>
|
||||
|
||||
</section>
|
||||
|
||||
<footer class="modal_footer">
|
||||
<section class="modal_footer_begin">
|
||||
<div class="load_datetime"><span class="label">Loaded:</span> <span class="datetime">{new Date()}</span></div>
|
||||
</section>
|
||||
<section class="modal_footer_end">
|
||||
<button on:click={handle_reset_view_membership_member_obj(membership_member_obj_view)} class="modal_close"><span class="fas fa-window-close"></span> Close</button>
|
||||
</section>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<div>Select an entry above</div>
|
||||
{/if}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.membership_member_obj_tbl tr:hover {
|
||||
background-color: hsla(0, 25%, 90%, 1);
|
||||
}
|
||||
|
||||
.membership_member_obj_tbl {
|
||||
font-size: .8rem;
|
||||
}
|
||||
|
||||
.record .id_random {
|
||||
font-size: .5rem;
|
||||
}
|
||||
|
||||
/* .record_details {
|
||||
display: fixed;
|
||||
top: 1rem;
|
||||
right: 1rem;
|
||||
bottom: 1rem;
|
||||
left: 1rem;
|
||||
border: solid thin hsla(0, 0%, 50%, 1);
|
||||
} */
|
||||
</style>
|
||||
2
src/vite-env.d.ts
vendored
Normal file
2
src/vite-env.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/// <reference types="svelte" />
|
||||
/// <reference types="vite/client" />
|
||||
67
svelte.config.js
Normal file
67
svelte.config.js
Normal file
@@ -0,0 +1,67 @@
|
||||
|
||||
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'
|
||||
// import adapter from '@sveltejs/adapter-static';
|
||||
// import adapter from '@sveltejs/adapter-node';
|
||||
|
||||
|
||||
const config = {
|
||||
// Consult https://svelte.dev/docs#compile-time-svelte-preprocess
|
||||
// for more information about preprocessors
|
||||
preprocess: vitePreprocess(),
|
||||
|
||||
// Disable accessibility warnings
|
||||
onwarn: (warning, handler) => {
|
||||
// console.log('HERE');
|
||||
if (warning.code.includes("a11y")) return;
|
||||
// if (warning.code === 'a11y-distracting-elements') return;
|
||||
handler(warning);
|
||||
},
|
||||
|
||||
// kit: {
|
||||
// adapter: adapter({
|
||||
// // default options are shown. On some platforms
|
||||
// // these options are set automatically — see below
|
||||
// // pages: 'build',
|
||||
// // assets: 'build',
|
||||
// // fallback: undefined,
|
||||
// // precompress: false,
|
||||
// // strict: true,
|
||||
|
||||
// // output directory:
|
||||
// // target: 'dist_x',
|
||||
|
||||
// // default options are shown
|
||||
// out: 'build_x',
|
||||
// precompress: false,
|
||||
// envPrefix: ''
|
||||
|
||||
|
||||
// })
|
||||
// }
|
||||
}
|
||||
export default config;
|
||||
|
||||
|
||||
|
||||
// import adapter from '@sveltejs/adapter-auto';
|
||||
|
||||
// /** @type {import('@sveltejs/kit').Config} */
|
||||
// const config = {
|
||||
// // Consult https://svelte.dev/docs#compile-time-svelte-preprocess
|
||||
// // for more information about preprocessors
|
||||
// preprocess: vitePreprocess(),
|
||||
|
||||
// // Disable accessibility warnings
|
||||
// onwarn: (warning, handler) => {
|
||||
// console.log('HERE');
|
||||
// if (warning.code.includes("a11y")) return;
|
||||
// handler(warning);
|
||||
// },
|
||||
|
||||
// kit: {
|
||||
// adapter: adapter()
|
||||
// }
|
||||
// };
|
||||
|
||||
// export default config;
|
||||
|
||||
@@ -1,6 +1,20 @@
|
||||
{
|
||||
"extends": "@tsconfig/svelte/tsconfig.json",
|
||||
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules/*", "__sapper__/*", "public/*"]
|
||||
}
|
||||
"compilerOptions": {
|
||||
"target": "ESNext",
|
||||
"useDefineForClassFields": true,
|
||||
"module": "ESNext",
|
||||
"resolveJsonModule": true,
|
||||
/**
|
||||
* Typecheck JS in `.svelte` and `.js` files by default.
|
||||
* Disable checkJs if you'd like to use dynamic types in JS.
|
||||
* Note that setting allowJs false does not prevent the use
|
||||
* of JS in `.svelte` files.
|
||||
*/
|
||||
"allowJs": true,
|
||||
"checkJs": true,
|
||||
"isolatedModules": true
|
||||
},
|
||||
"include": ["src/**/*.d.ts", "src/**/*.ts", "src/**/*.js", "src/**/*.svelte"],
|
||||
"references": [{ "path": "./tsconfig.node.json" }]
|
||||
}
|
||||
|
||||
9
tsconfig.node.json
Normal file
9
tsconfig.node.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"skipLibCheck": true,
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler"
|
||||
},
|
||||
"include": ["vite.config.ts"]
|
||||
}
|
||||
7
vite.config.ts
Normal file
7
vite.config.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import { svelte } from '@sveltejs/vite-plugin-svelte'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [svelte()],
|
||||
})
|
||||
Reference in New Issue
Block a user