Wrapping up for the day. Finally working on IDAA related events some more.
This commit is contained in:
@@ -490,6 +490,10 @@ export function db_save_ae_obj_li__event(
|
||||
end_datetime: obj.end_datetime,
|
||||
timezone: obj.timezone,
|
||||
location_address_json: obj.location_address_json,
|
||||
location_text: obj.location_text,
|
||||
|
||||
attend_json: obj.attend_json,
|
||||
attend_text: obj.attend_text,
|
||||
|
||||
mod_abstracts_json: obj.mod_abstracts_json,
|
||||
mod_badges_json: obj.mod_badges_json,
|
||||
|
||||
@@ -3,6 +3,9 @@ import { process_permission_checks } from './ae_utils__perm_checks';
|
||||
import { iso_datetime_formatter } from './ae_utils__datetime_format';
|
||||
import { is_datetime_recent } from './ae_utils__is_datetime_recent';
|
||||
import { clean_filename, format_bytes, guess_file_name, guess_file_extension, get_file_hash } from './ae_utils__files';
|
||||
import { get_obj_li_w_match_prop} from './ae_utils__get_obj_li_w_match_prop';
|
||||
import { extract_prefixed_form_data } from './ae_utils__extract_prefixed_form_data';
|
||||
|
||||
|
||||
type key_str = {
|
||||
[key: string]: string;
|
||||
@@ -19,113 +22,6 @@ function number_w_commas(x) {
|
||||
}
|
||||
|
||||
|
||||
/* This utility function looks for any form data with the prefixed name passed and returns a new object.
|
||||
* This function is used heavily! Be very careful making changes!!!
|
||||
* If rm_empty_id then it will remove/ignore fields matching. This helps with the API and new records/objects
|
||||
* If rm_empty then it will remove/ignore fields matching. Sometimes this is needed.
|
||||
* If trim_values then it will trim string values.
|
||||
* If bool_tf_str then it will convert string values of true/false (case insensitive) to boolean values.
|
||||
* Updated 2023-12-22
|
||||
*/
|
||||
export let extract_prefixed_form_data = function extract_prefixed_form_data({prefix=null, form_data={}, rm_empty_id=true, rm_empty=false, trim_values=false, bool_tf_str=false, log_lvl=0}) {
|
||||
if (log_lvl) {
|
||||
console.log('*** extract_prefixed_form_data() ***');
|
||||
if (prefix) {
|
||||
console.log(`Looking for prefixed fields: ${prefix}; Removing emptry ID fields: ${rm_empty_id}; Removing empty fields: ${rm_empty}; Trim string values: ${trim_values}; Convert true/false string values to boolean: ${bool_tf_str}`);
|
||||
} else {
|
||||
console.log(`No prefix set. Looking at all fields. Removing emptry ID fields: ${rm_empty_id}; Removing empty fields: ${rm_empty}; Trim string values: ${trim_values}; Convert true/false string values to boolean: ${bool_tf_str}`);
|
||||
}
|
||||
}
|
||||
if (log_lvl > 1) {
|
||||
console.log('Form Data:');
|
||||
console.log(form_data);
|
||||
}
|
||||
|
||||
// const data_obj: any = {}; // future TS
|
||||
let data_obj = {};
|
||||
for (let field of form_data) {
|
||||
let [obj_prop_name, obj_prop_value] = field;
|
||||
if (log_lvl > 1) {
|
||||
console.log(`${obj_prop_name}: ${obj_prop_value} type=${typeof obj_prop_value}`);
|
||||
}
|
||||
|
||||
// Trim string values if needed
|
||||
if (trim_values && typeof obj_prop_value === 'string') {
|
||||
if (log_lvl && obj_prop_value.trim() != obj_prop_value) {
|
||||
console.log('Trimming string value!');
|
||||
obj_prop_value = obj_prop_value.trim();
|
||||
}
|
||||
}
|
||||
|
||||
// Convert string to boolean if needed
|
||||
if (bool_tf_str && typeof obj_prop_value === 'string') {
|
||||
// console.log('Flag set for converting true/false string values to boolean!');
|
||||
|
||||
if (obj_prop_value.toLowerCase() === 'true') {
|
||||
if (log_lvl) {
|
||||
console.log('Converting string to boolean value: true');
|
||||
}
|
||||
obj_prop_value = true;
|
||||
} else if (obj_prop_value.toLowerCase() === 'false') {
|
||||
if (log_lvl) {
|
||||
console.log('Converting string to boolean value: false');
|
||||
}
|
||||
obj_prop_value = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (prefix && obj_prop_name.startsWith(prefix)) { // Prefix set
|
||||
// if (obj_prop_name.startsWith(prefix)) {
|
||||
obj_prop_name = obj_prop_name.replace(prefix, '');
|
||||
if (log_lvl) {
|
||||
console.log(`Checking: (${prefix})${obj_prop_name} value=${obj_prop_value}`);
|
||||
}
|
||||
if (rm_empty_id && obj_prop_name.endsWith('id_random') && !obj_prop_value) {
|
||||
if (log_lvl) {
|
||||
console.log(`Match but empty *_id_random. Ignoring/removing: ${obj_prop_name}`);
|
||||
}
|
||||
} else if (rm_empty && !obj_prop_value) {
|
||||
if (log_lvl) {
|
||||
console.log(`Match but empty. Ignoring/removing: ${obj_prop_name}`);
|
||||
}
|
||||
} else {
|
||||
if (log_lvl) {
|
||||
console.log(`Match: ${prefix})${obj_prop_name} value=${obj_prop_value}`);
|
||||
}
|
||||
data_obj[obj_prop_name] = obj_prop_value;
|
||||
}
|
||||
} else if (prefix && !obj_prop_name.startsWith(prefix)) { // Prefix set
|
||||
if (log_lvl > 1) {
|
||||
console.log('Did not start with prefix. Ignoring');
|
||||
}
|
||||
} else { // No prefix set
|
||||
if (log_lvl) {
|
||||
console.log(`Checking: ${obj_prop_name} value=${obj_prop_value}`);
|
||||
}
|
||||
if (rm_empty_id && obj_prop_name.endsWith('id_random') && !obj_prop_value) {
|
||||
if (log_lvl > 1) {
|
||||
console.log(`Match but empty *_id_random. Ignoring/removing: ${obj_prop_name}`);
|
||||
}
|
||||
} else if (rm_empty && !obj_prop_value) {
|
||||
if (log_lvl > 1) {
|
||||
console.log(`Match but empty. Ignoring/removing: ${obj_prop_name}`);
|
||||
}
|
||||
} else {
|
||||
if (log_lvl > 1) {
|
||||
console.log(`Match: ${obj_prop_name} value=${obj_prop_value}`);
|
||||
}
|
||||
data_obj[obj_prop_name] = obj_prop_value;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (log_lvl > 1) {
|
||||
console.log(data_obj);
|
||||
}
|
||||
return data_obj;
|
||||
}
|
||||
|
||||
|
||||
/* This utility function processes specific data string.
|
||||
* MECARD
|
||||
* OBJ = OBJ:ot:example,oi:asdf1234
|
||||
@@ -716,6 +612,7 @@ export let ae_util = {
|
||||
guess_file_name: guess_file_name,
|
||||
guess_file_extension: guess_file_extension,
|
||||
get_file_hash: get_file_hash,
|
||||
get_obj_li_w_match_prop: get_obj_li_w_match_prop,
|
||||
extract_prefixed_form_data: extract_prefixed_form_data,
|
||||
process_data_string: process_data_string,
|
||||
handle_url_and_message: handle_url_and_message,
|
||||
|
||||
127
src/lib/ae_utils/ae_utils__extract_prefixed_form_data.ts
Normal file
127
src/lib/ae_utils/ae_utils__extract_prefixed_form_data.ts
Normal file
@@ -0,0 +1,127 @@
|
||||
type key_val = {
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
/* This utility function looks for any form data with the prefixed name passed and returns a new object.
|
||||
* This function is used heavily! Be very careful making changes!!!
|
||||
* If rm_empty_id then it will remove/ignore fields matching. This helps with the API and new records/objects
|
||||
* If rm_empty then it will remove/ignore fields matching. Sometimes this is needed.
|
||||
* If trim_values then it will trim string values.
|
||||
* If bool_tf_str then it will convert string values of true/false (case insensitive) to boolean values.
|
||||
* Updated 2023-12-22
|
||||
*/
|
||||
export let extract_prefixed_form_data = function extract_prefixed_form_data(
|
||||
{
|
||||
prefix = null,
|
||||
form_data = {},
|
||||
rm_empty_id = true,
|
||||
rm_empty = false,
|
||||
trim_values = false,
|
||||
bool_tf_str = false,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
prefix: string|null,
|
||||
form_data: any,
|
||||
rm_empty_id?: boolean,
|
||||
rm_empty?: boolean,
|
||||
trim_values?: boolean,
|
||||
bool_tf_str?: boolean,
|
||||
log_lvl?: number
|
||||
}
|
||||
) {
|
||||
if (log_lvl) {
|
||||
console.log('*** extract_prefixed_form_data() ***');
|
||||
if (prefix) {
|
||||
console.log(`Looking for prefixed fields: ${prefix}; Removing emptry ID fields: ${rm_empty_id}; Removing empty fields: ${rm_empty}; Trim string values: ${trim_values}; Convert true/false string values to boolean: ${bool_tf_str}`);
|
||||
} else {
|
||||
console.log(`No prefix set. Looking at all fields. Removing emptry ID fields: ${rm_empty_id}; Removing empty fields: ${rm_empty}; Trim string values: ${trim_values}; Convert true/false string values to boolean: ${bool_tf_str}`);
|
||||
}
|
||||
}
|
||||
if (log_lvl > 1) {
|
||||
console.log('Form Data:');
|
||||
console.log(form_data);
|
||||
}
|
||||
|
||||
// const data_obj: any = {}; // future TS
|
||||
let data_obj: key_val = {};
|
||||
for (let field of form_data) {
|
||||
let [obj_prop_name, obj_prop_value] = field;
|
||||
if (log_lvl > 1) {
|
||||
console.log(`${obj_prop_name}: ${obj_prop_value} type=${typeof obj_prop_value}`);
|
||||
}
|
||||
|
||||
// Trim string values if needed
|
||||
if (trim_values && typeof obj_prop_value === 'string') {
|
||||
if (log_lvl && obj_prop_value.trim() != obj_prop_value) {
|
||||
console.log('Trimming string value!');
|
||||
obj_prop_value = obj_prop_value.trim();
|
||||
}
|
||||
}
|
||||
|
||||
// Convert string to boolean if needed
|
||||
if (bool_tf_str && typeof obj_prop_value === 'string') {
|
||||
// console.log('Flag set for converting true/false string values to boolean!');
|
||||
|
||||
if (obj_prop_value.toLowerCase() === 'true') {
|
||||
if (log_lvl) {
|
||||
console.log('Converting string to boolean value: true');
|
||||
}
|
||||
obj_prop_value = true;
|
||||
} else if (obj_prop_value.toLowerCase() === 'false') {
|
||||
if (log_lvl) {
|
||||
console.log('Converting string to boolean value: false');
|
||||
}
|
||||
obj_prop_value = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (prefix && obj_prop_name.startsWith(prefix)) { // Prefix set
|
||||
// if (obj_prop_name.startsWith(prefix)) {
|
||||
obj_prop_name = obj_prop_name.replace(prefix, '');
|
||||
if (log_lvl) {
|
||||
console.log(`Checking: (${prefix})${obj_prop_name} value=${obj_prop_value}`);
|
||||
}
|
||||
if (rm_empty_id && obj_prop_name.endsWith('id_random') && !obj_prop_value) {
|
||||
if (log_lvl) {
|
||||
console.log(`Match but empty *_id_random. Ignoring/removing: ${obj_prop_name}`);
|
||||
}
|
||||
} else if (rm_empty && !obj_prop_value) {
|
||||
if (log_lvl) {
|
||||
console.log(`Match but empty. Ignoring/removing: ${obj_prop_name}`);
|
||||
}
|
||||
} else {
|
||||
if (log_lvl) {
|
||||
console.log(`Match: ${prefix})${obj_prop_name} value=${obj_prop_value}`);
|
||||
}
|
||||
data_obj[obj_prop_name] = obj_prop_value;
|
||||
}
|
||||
} else if (prefix && !obj_prop_name.startsWith(prefix)) { // Prefix set
|
||||
if (log_lvl > 1) {
|
||||
console.log('Did not start with prefix. Ignoring');
|
||||
}
|
||||
} else { // No prefix set
|
||||
if (log_lvl) {
|
||||
console.log(`Checking: ${obj_prop_name} value=${obj_prop_value}`);
|
||||
}
|
||||
if (rm_empty_id && obj_prop_name.endsWith('id_random') && !obj_prop_value) {
|
||||
if (log_lvl > 1) {
|
||||
console.log(`Match but empty *_id_random. Ignoring/removing: ${obj_prop_name}`);
|
||||
}
|
||||
} else if (rm_empty && !obj_prop_value) {
|
||||
if (log_lvl > 1) {
|
||||
console.log(`Match but empty. Ignoring/removing: ${obj_prop_name}`);
|
||||
}
|
||||
} else {
|
||||
if (log_lvl > 1) {
|
||||
console.log(`Match: ${obj_prop_name} value=${obj_prop_value}`);
|
||||
}
|
||||
data_obj[obj_prop_name] = obj_prop_value;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (log_lvl > 1) {
|
||||
console.log(data_obj);
|
||||
}
|
||||
return data_obj;
|
||||
}
|
||||
46
src/lib/ae_utils/ae_utils__get_obj_li_w_match_prop.ts
Normal file
46
src/lib/ae_utils/ae_utils__get_obj_li_w_match_prop.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
|
||||
/* Returns a list of objects that have a matching property value. */
|
||||
// Updated 2023-06-28
|
||||
export let get_obj_li_w_match_prop = function get_obj_li_w_match_prop(
|
||||
{
|
||||
obj_li,
|
||||
property,
|
||||
value,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
obj_li: any[],
|
||||
property: string,
|
||||
value: any,
|
||||
log_lvl?: number
|
||||
}
|
||||
) {
|
||||
if (log_lvl) {
|
||||
console.log('Search Object List:', obj_li);
|
||||
console.log(`Property: ${property}`);
|
||||
console.log(`Value: ${value}`);
|
||||
}
|
||||
if (log_lvl > 1) {
|
||||
console.log(`Type Of: ${typeof value}`);
|
||||
}
|
||||
|
||||
// Create an empty array to store the matching objects.
|
||||
const matching_obj_li = [];
|
||||
|
||||
// Iterate through the list of objects.
|
||||
for (const object of obj_li) {
|
||||
// Check if the object has the specified property and the value of the property matches the specified value.
|
||||
if (object.hasOwnProperty(property)) {
|
||||
// console.log('Has property at least....', object[property], typeof object[property]);
|
||||
}
|
||||
if (object.hasOwnProperty(property) && object[property] === value) {
|
||||
// Add the object to the array of matching objects.
|
||||
matching_obj_li.push(object);
|
||||
}
|
||||
}
|
||||
|
||||
// Return the array of matching objects.
|
||||
if (log_lvl > 1) {
|
||||
console.log('Matching Object List:', matching_obj_li);
|
||||
}
|
||||
return matching_obj_li;
|
||||
}
|
||||
@@ -319,7 +319,7 @@ export let update_ae_obj_id_crud = async function update_ae_obj_id_crud(
|
||||
return_obj = false,
|
||||
obj_v_name = '',
|
||||
return_meta = false,
|
||||
log_lvl = 3
|
||||
log_lvl = 1
|
||||
}: {
|
||||
api_cfg: any,
|
||||
obj_type: string,
|
||||
|
||||
@@ -27,6 +27,10 @@ export interface Event {
|
||||
end_datetime?: Date;
|
||||
timezone?: null|string;
|
||||
location_address_json?: null|string;
|
||||
location_text?: null|string;
|
||||
|
||||
attend_json?: null|string;
|
||||
attend_text?: null|string;
|
||||
|
||||
mod_abstracts_json?: null|key_val;
|
||||
mod_badges_json?: null|key_val;
|
||||
|
||||
@@ -5,6 +5,7 @@ import ListItem from '@tiptap/extension-list-item'
|
||||
import TextStyle from '@tiptap/extension-text-style'
|
||||
import StarterKit from "@tiptap/starter-kit";
|
||||
import { Editor } from "@tiptap/core";
|
||||
// import Highlight from '@tiptap/extension-highlight';
|
||||
|
||||
// import Highlight from '@tiptap/extension-highlight' ????
|
||||
// import Typography from '@tiptap/extension-typography' ????
|
||||
@@ -16,6 +17,12 @@ import "./element_tiptap_editor.scss";
|
||||
// <code class="language-css">
|
||||
|
||||
export let html_text: string = '';
|
||||
export let default_minimal: boolean = false;
|
||||
export let show_menu: boolean = true;
|
||||
|
||||
if (default_minimal) {
|
||||
show_menu = false;
|
||||
}
|
||||
|
||||
// export let html_text: string = `
|
||||
// <h2>
|
||||
@@ -74,19 +81,23 @@ if (show_button_kv) {
|
||||
show_button_kv = show_button_kv_defaults;
|
||||
}
|
||||
|
||||
export let new_json = editor?.getJSON();
|
||||
export let new_html: string = '';
|
||||
|
||||
onMount(() => {
|
||||
editor = new Editor({
|
||||
element: element,
|
||||
extensions: [
|
||||
Color.configure({ types: [TextStyle.name, ListItem.name] }),
|
||||
TextStyle.configure({ types: [ListItem.name] }),
|
||||
StarterKit,
|
||||
],
|
||||
content: html_text,
|
||||
onTransaction: () => {
|
||||
// force re-render so `editor.isActive` works as expected
|
||||
editor = editor;
|
||||
},
|
||||
element: element,
|
||||
extensions: [
|
||||
Color.configure({ types: [TextStyle.name, ListItem.name] }),
|
||||
TextStyle.configure({ types: [ListItem.name] }),
|
||||
StarterKit,
|
||||
],
|
||||
content: html_text,
|
||||
onTransaction: () => {
|
||||
// force re-render so `editor.isActive` works as expected
|
||||
editor = editor;
|
||||
new_html = editor.getHTML();
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -98,17 +109,28 @@ onDestroy(() => {
|
||||
</script>
|
||||
|
||||
<div
|
||||
on:click={() => {
|
||||
if (default_minimal) {
|
||||
editor.chain().focus().setParagraph().run();
|
||||
show_menu = true;
|
||||
}
|
||||
}}
|
||||
on:mouseleave={() => {
|
||||
if (default_minimal) {
|
||||
show_menu = false;
|
||||
}
|
||||
}}
|
||||
class="editor border border-gray-300 rounded p-1 pb-2 bg-gray-200"
|
||||
>
|
||||
|
||||
{#if editor}
|
||||
{#if editor && show_menu}
|
||||
<div class="control-group bg-gray-200 border-b border-gray-400 p-1">
|
||||
<div class="button-group flex flex-row flex-wrap gap-4 items-center justify-between">
|
||||
|
||||
<span>
|
||||
<button
|
||||
type="button"
|
||||
on:click={() => console.log && editor.chain().toggleBold().run()}
|
||||
on:click={() => console.log(editor?.getHTML()) && editor.chain().toggleBold().run()}
|
||||
disabled={!editor.can().chain().focus().toggleBold().run()}
|
||||
class="btn btn-sm variant-glass-secondary hover:variant-filled-secondary rounded-md font-bold"
|
||||
class:variant-ghost-secondary={editor.isActive("bold") ?? false}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
export let log_lvl = 1;
|
||||
import { createEventDispatcher, onDestroy, onMount } from 'svelte';
|
||||
import { fade } from 'svelte/transition';
|
||||
// import Editor from '@tinymce/tinymce-svelte';
|
||||
@@ -8,6 +9,7 @@ import { core_func } from '$lib/ae_core_functions';
|
||||
import { api } from '$lib/api';
|
||||
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
||||
import { idaa_loc, idaa_sess, idaa_slct } from '$lib/ae_idaa_stores';
|
||||
import { events_func } from '$lib/ae_events_functions';
|
||||
import Tiptap_editor from '$lib/element_tiptap_editor.svelte';
|
||||
|
||||
export let lq__event_obj: any;
|
||||
@@ -301,7 +303,7 @@ $: if ($idaa_slct.event_obj) {
|
||||
}
|
||||
|
||||
|
||||
async function handle_submit_form(event){
|
||||
async function handle_submit_form(event: any) {
|
||||
console.log('*** handle_submit_form() ***');
|
||||
|
||||
disable_submit_btn = true;
|
||||
@@ -318,6 +320,12 @@ async function handle_submit_form(event){
|
||||
|
||||
event_data['name'] = event_meeting_data.name;
|
||||
|
||||
if (event_meeting_data.description) {
|
||||
event_data['description'] = event_meeting_data.description;
|
||||
} else {
|
||||
event_data['description'] = null;
|
||||
}
|
||||
|
||||
// if (tinyMCE.get('description')) {
|
||||
// event_data['description'] = tinyMCE.get('description').getContent();
|
||||
// } else {
|
||||
@@ -337,7 +345,7 @@ async function handle_submit_form(event){
|
||||
if (event_meeting_data.address_country_subdivision_code) {
|
||||
address['country_subdivision_code'] = event_meeting_data.address_country_subdivision_code;
|
||||
|
||||
let country_subdivision_data = ae_util.get_obj_li_with_matching_prop({'obj_li': $ae_loc.lu_country_subdivision_list, 'property': 'code', 'value': event_meeting_data.address_country_subdivision_code});
|
||||
let country_subdivision_data = ae_util.get_obj_li_w_match_prop({'obj_li': $ae_loc.lu_country_subdivision_list, 'property': 'code', 'value': event_meeting_data.address_country_subdivision_code});
|
||||
address['state_province'] = country_subdivision_data[0].name; // Assume there is only one match
|
||||
// address['country_subdivision_name'] = country_subdivision_data[0].name;
|
||||
}
|
||||
@@ -345,12 +353,12 @@ async function handle_submit_form(event){
|
||||
if (event_meeting_data.address_country_alpha_2_code) {
|
||||
address['country_alpha_2_code'] = event_meeting_data.address_country_alpha_2_code;
|
||||
|
||||
let country_data = ae_util.get_obj_li_with_matching_prop({'obj_li': $ae_loc.lu_country_list, 'property': 'alpha_2_code', 'value': event_meeting_data.address_country_alpha_2_code});
|
||||
let country_data = ae_util.get_obj_li_w_match_prop({'obj_li': $ae_loc.lu_country_list, 'property': 'alpha_2_code', 'value': event_meeting_data.address_country_alpha_2_code});
|
||||
console.log(country_data);
|
||||
address['country'] = country_data[0].english_short_name; // Assume there is only one match
|
||||
// address['country_name'] = country_data[0].english_short_name;
|
||||
}
|
||||
event_data['location_address_json'] = address;
|
||||
// event_data['location_address_json'] = address;
|
||||
|
||||
// if (tinyMCE.get('location_text')) {
|
||||
// event_data['location_text'] = tinyMCE.get('location_text').getContent();
|
||||
@@ -453,7 +461,7 @@ async function handle_submit_form(event){
|
||||
if (event_meeting_data.contact_1_phone_office) {
|
||||
contact_1['phone_office'] = event_meeting_data.contact_1_phone_office;
|
||||
}
|
||||
event_data['contact_li_json'].push(contact_1);
|
||||
// event_data['contact_li_json'].push(contact_1);
|
||||
|
||||
let contact_2: key_val = {};
|
||||
contact_2['full_name'] = event_meeting_data.contact_2_full_name;
|
||||
@@ -467,7 +475,7 @@ async function handle_submit_form(event){
|
||||
if (event_meeting_data.contact_2_phone_office) {
|
||||
contact_2['phone_office'] = event_meeting_data.contact_2_phone_office;
|
||||
}
|
||||
event_data['contact_li_json'].push(contact_2);
|
||||
// event_data['contact_li_json'].push(contact_2);
|
||||
|
||||
event_data['hide'] = !!event_meeting_data.hide;
|
||||
event_data['priority'] = !!event_meeting_data.priority;
|
||||
@@ -475,7 +483,7 @@ async function handle_submit_form(event){
|
||||
event_data['sort'] = Number(event_meeting_data.sort);
|
||||
}
|
||||
if (event_data['group']) {
|
||||
event_data['group'] = form_event_data.group;
|
||||
event_data['group'] = event_meeting_data.group;
|
||||
} else {
|
||||
event_data['group'] = null;
|
||||
}
|
||||
@@ -526,14 +534,24 @@ async function handle_submit_form(event){
|
||||
return create_event_obj_promise;
|
||||
|
||||
} else {
|
||||
update_event_obj_promise = api.update_ae_obj_id_crud({
|
||||
events_func.update_ae_obj__event({
|
||||
api_cfg: $ae_api,
|
||||
obj_type: 'event',
|
||||
obj_id: $idaa_slct.event_id,
|
||||
fields: event_data,
|
||||
key: $ae_api.api_crud_super_key,
|
||||
log_lvl: 1
|
||||
})
|
||||
event_id: $idaa_slct.event_id,
|
||||
data_kv: event_data,
|
||||
log_lvl: log_lvl
|
||||
})
|
||||
|
||||
|
||||
|
||||
// update_event_obj_promise = api.update_ae_obj_id_crud({
|
||||
// api_cfg: $ae_api,
|
||||
// obj_type: 'event',
|
||||
// obj_id: $idaa_slct.event_id,
|
||||
// fields: event_data,
|
||||
// key: $ae_api.api_crud_super_key,
|
||||
// return_obj: true,
|
||||
// log_lvl: 2
|
||||
// })
|
||||
.then(function (event_obj_update_result) {
|
||||
if (!event_obj_update_result) {
|
||||
console.log('The result was null or false.');
|
||||
@@ -661,8 +679,30 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
||||
<!-- <textarea name="description" id="description" class="ae_value event__description tinymce_editor editor_basic textarea" rows="5" cols="70" bind:value={$idaa_slct.event_obj.description} placeholder="A short description or overview of this recovery meeting"></textarea> -->
|
||||
|
||||
<Tiptap_editor
|
||||
html_text={$idaa_slct.event_obj.description}
|
||||
default_minimal={true}
|
||||
bind:html_text={$idaa_slct.event_obj.description}
|
||||
show_button_kv={{'heading__h1': false, 'heading__h2': false, 'heading__h3': false}}
|
||||
bind:new_html={$idaa_slct.event_obj.description_new_html}
|
||||
/>
|
||||
|
||||
<!-- {@html $idaa_slct.event_obj?.description_new_html ?? 'not sure?'} -->
|
||||
|
||||
<!-- If changed then show Save button -->
|
||||
{#if
|
||||
$idaa_slct.event_obj.description_new_html &&
|
||||
$idaa_slct.event_obj?.description_new_html != '<p></p>' &&
|
||||
$idaa_slct.event_obj.description != $idaa_slct.event_obj.description_new_html}
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-md btn-primary variant-ghost-secondary"
|
||||
on:click={() => $idaa_slct.event_obj.description = $idaa_slct.event_obj.description_new_html}
|
||||
>
|
||||
<!-- <span class="icon">💾</span> -->
|
||||
<span class="fas fa-save m-1"></span>
|
||||
Save?
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
</label>
|
||||
|
||||
|
||||
@@ -700,7 +740,7 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
||||
<fieldset class="event__physical_virtual">
|
||||
<legend class="legend">Face-to-Face or Virtual</legend>
|
||||
<p>Is this a face-to-face/in person meeting, a virtual/online meeting, or both?</p>
|
||||
<div class="ae_group">
|
||||
<div class="ae_group border border-gray-200 rounded-md p-2 space-y-1">
|
||||
<label for="physical" class="">Face-to-Face/In person
|
||||
<input
|
||||
type="checkbox"
|
||||
@@ -796,9 +836,26 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
||||
<label for="location_text" class="">Additional information the meeting location
|
||||
<!-- <textarea class="ae_value event__location_text tinymce_editor editor_less_100 textarea" id="location_text" name="location_text" placeholder="Additional information about the meeting location" rows="2" cols="70" bind:value={$idaa_slct.event_obj.location_text}></textarea> -->
|
||||
<Tiptap_editor
|
||||
html_text={$idaa_slct.event_obj.location_text}
|
||||
default_minimal={true}
|
||||
bind:html_text={$idaa_slct.event_obj.location_text}
|
||||
show_button_kv={{'heading__h1': false, 'heading__h2': false, 'heading__h3': false}}
|
||||
bind:new_html={$idaa_slct.event_obj.location_text_new_html}
|
||||
/>
|
||||
|
||||
<!-- If changed then show Save button -->
|
||||
{#if
|
||||
$idaa_slct.event_obj?.location_text_new_html &&
|
||||
$idaa_slct.event_obj?.location_text_new_html != '<p></p>' &&
|
||||
$idaa_slct.event_obj.location_text != $idaa_slct.event_obj.location_text_new_html}
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-md btn-primary variant-ghost-secondary"
|
||||
on:click={() => $idaa_slct.event_obj.location_text = $idaa_slct.event_obj.location_text_new_html}
|
||||
>
|
||||
<span class="fas fa-save m-1"></span>
|
||||
Save?
|
||||
</button>
|
||||
{/if}
|
||||
</label>
|
||||
|
||||
<fieldset
|
||||
@@ -826,9 +883,26 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
||||
<label for="attend_text" class="">Additional information on how to attend
|
||||
<!-- <textarea class="ae_value event__attend_text tinymce_editor editor_less_100 textarea" id="attend_text" name="attend_text" placeholder="Additional information on how to attend or join the meeting" rows="2" cols="70" value={$lq__event_obj?.attend_text ?? ''}></textarea> -->
|
||||
<Tiptap_editor
|
||||
html_text={$idaa_slct.event_obj.attend_text}
|
||||
default_minimal={true}
|
||||
bind:html_text={$idaa_slct.event_obj.attend_text}
|
||||
show_button_kv={{'heading__h1': false, 'heading__h2': false, 'heading__h3': false}}
|
||||
bind:new_html={$idaa_slct.event_obj.attend_text_new_html}
|
||||
/>
|
||||
|
||||
<!-- If changed then show Save button -->
|
||||
{#if
|
||||
$idaa_slct.event_obj?.attend_text_new_html &&
|
||||
$idaa_slct.event_obj?.attend_text_new_html != '<p></p>' &&
|
||||
$idaa_slct.event_obj.attend_text != $idaa_slct.event_obj.attend_text_new_html}
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-md btn-primary variant-ghost-secondary"
|
||||
on:click={() => $idaa_slct.event_obj.attend_text = $idaa_slct.event_obj.attend_text_new_html}
|
||||
>
|
||||
<span class="fas fa-save m-1"></span>
|
||||
Save?
|
||||
</button>
|
||||
{/if}
|
||||
</label>
|
||||
|
||||
</section> <!-- END: section event__how_to_attend -->
|
||||
@@ -1174,9 +1248,27 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
||||
Internal Staff Notes
|
||||
<!-- <textarea id="notes" name="notes" class="ae_value event__notes tinymce_editor editor_basic_200 textarea" rows="2" cols="70" value={$lq__event_obj?.notes}></textarea> -->
|
||||
<Tiptap_editor
|
||||
html_text={$idaa_slct.event_obj.notes}
|
||||
default_minimal={true}
|
||||
bind:html_text={$idaa_slct.event_obj.notes}
|
||||
show_button_kv={{'heading__h1': false, 'heading__h2': false, 'heading__h3': false}}
|
||||
bind:new_html={$idaa_slct.event_obj.notes_new_html}
|
||||
/>
|
||||
|
||||
<!-- If changed then show Save button -->
|
||||
{#if
|
||||
$idaa_slct.event_obj?.notes_new_html &&
|
||||
$idaa_slct.event_obj?.notes_new_html != '<p></p>' &&
|
||||
$idaa_slct.event_obj.notes != $idaa_slct.event_obj.notes_new_html}
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-md btn-primary variant-ghost-secondary"
|
||||
on:click={() => $idaa_slct.event_obj.notes = $idaa_slct.event_obj.notes_new_html}
|
||||
>
|
||||
<span class="fas fa-save m-1"></span>
|
||||
Save?
|
||||
</button>
|
||||
{/if}
|
||||
<!-- {$idaa_slct.event_obj?.notes_new_html} -->
|
||||
</label>
|
||||
{/if}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user