diff --git a/src/lib/ae_api/api_get_object.ts b/src/lib/ae_api/api_get_object.ts index 96a0e1ac..7398b4f0 100644 --- a/src/lib/ae_api/api_get_object.ts +++ b/src/lib/ae_api/api_get_object.ts @@ -48,14 +48,11 @@ export let get_object = async function get_object( console.log('Params:', params); if (log_lvl > 1) { console.log('Data:', data); - console.log(`Base URL: ${api_cfg['base_url']}`); + console.log(`Base URL: ${api_cfg['base_url']}; Timeout: ${timeout}`); console.log('API Config:', api_cfg); } if (log_lvl > 2) { - console.log(`Return Meta: ${return_meta}`); - console.log(`Return Blob: ${return_blob}`); - console.log(`Filename: ${filename}`); - console.log(`Auto Download: ${auto_download}`); + console.log(`Return Meta: ${return_meta}; Return Blob: ${return_blob}; Filename: ${filename}; Auto Download: ${auto_download}`); } } diff --git a/src/lib/ae_core_functions.ts b/src/lib/ae_core_functions.ts index 1a9f46e9..cc825b04 100644 --- a/src/lib/ae_core_functions.ts +++ b/src/lib/ae_core_functions.ts @@ -338,13 +338,13 @@ async function handle_download_export__obj_type( for_obj_type, // Usually for an account, event, event_exhibit, or sponsorship_cfg for_obj_id, // The ID of the object exp_alt = null, // Export name (idaa, other, not 'default') - file_type='CSV', // 'CSV' or 'Excel' - return_file=true, - filename='no_filename.csv', - auto_download=false, - limit=5000, - params={}, // key value object is expected - log_lvl=0 + file_type = 'CSV', // 'CSV' or 'Excel' + return_file = true, + filename = 'no_filename.csv', + auto_download = false, + limit = 5000, + params = {}, // key value object is expected + log_lvl = 0 }: { api_cfg: any, get_obj_type: string, @@ -392,6 +392,7 @@ async function handle_download_export__obj_type( api_cfg: api_cfg, endpoint: endpoint, params: params, + timeout: 90000, // Seems to timeout sometimes with the default of 60 seconds return_blob: return_file, filename: clean_filename, auto_download: auto_download, diff --git a/src/lib/ae_idaa_stores.ts b/src/lib/ae_idaa_stores.ts index 93a07709..640bf458 100644 --- a/src/lib/ae_idaa_stores.ts +++ b/src/lib/ae_idaa_stores.ts @@ -93,6 +93,9 @@ let idaa_session_data_struct: key_val = { recovery_meetings: { qry__status: null, // qry__fulltext_str: null, + + show__modal_edit: false, + show__modal_view: false, }, }; diff --git a/src/routes/idaa/(idaa)/recovery_meetings/+page.svelte b/src/routes/idaa/(idaa)/recovery_meetings/+page.svelte index 083c8847..79cef963 100644 --- a/src/routes/idaa/(idaa)/recovery_meetings/+page.svelte +++ b/src/routes/idaa/(idaa)/recovery_meetings/+page.svelte @@ -23,6 +23,7 @@ import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$ import Comp__event_obj_qry from './ae_idaa_comp__event_obj_qry.svelte'; import Comp__event_obj_li from './ae_idaa_comp__event_obj_li.svelte'; +import Comp__event_obj_id_edit from './ae_idaa_comp__event_obj_id_edit.svelte'; import Comp__event_obj_id_view from './ae_idaa_comp__event_obj_id_view.svelte'; let event_id_random_li: Array; @@ -127,10 +128,26 @@ $: lq_new__event_obj_li = liveQuery(async () => { + + + + + + + + -import { createEventDispatcher, afterUpdate, onDestroy, onMount } from 'svelte'; +import { createEventDispatcher, onDestroy, onMount } from 'svelte'; import { fade } from 'svelte/transition'; -import { ae, api } from 'aether_npm_lib'; -import { slct, slct_trigger, ae_app } from './stores'; -import App from './App.svelte'; +import { ae_util } from '$lib/ae_utils/ae_utils'; +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 { update_event_obj } from './stores_meetings_api.js'; - -export let container_class_li: string[] = []; +export let lq__event_obj: any; +// export let container_class_li = []; const dispatch = createEventDispatcher(); @@ -24,16 +24,16 @@ let disable_submit_btn = true; let event_location_select_option_li = {}; // This is a list (dict) of key value pairs -if ($slct.event_id) { +if ($idaa_slct.event_id) { // console.log(`Event ID selected: ${$slct.event_id}`); - // console.log(`Event Object selected: ${$slct.event_obj}`) + // console.log(`Event Object selected: ${$lq__event_obj}`) $slct_trigger = 'load__event_obj'; disable_submit_btn = false; } else { - $slct.event_id = null; - $slct.event_obj = { - account_id_random: $ae_app.account_id, + $idaa_slct.event_id = null; + $idaa_slct.event_obj = { + account_id_random: $ae_loc.account_id, name: null, description: null, @@ -67,8 +67,8 @@ if ($slct.event_id) { contact_li_json: [ { - full_name: $ae_app.novi_full_name, - email: $ae_app.novi_email, + full_name: $idaa_loc.novi_full_name, + email: $idaa_loc.novi_email, phone_mobile: null, phone_home: null, phone_office: null, @@ -85,20 +85,20 @@ if ($slct.event_id) { sort: null, notes: null, - external_person_id: $ae_app.novi_uuid, - external_person_full_name: $ae_app.novi_full_name, - external_person_email: $ae_app.novi_email, + external_person_id: $idaa_loc.novi_uuid, + external_person_full_name: $idaa_loc.novi_full_name, + external_person_email: $idaa_loc.novi_email, }; - console.log(`Event Object started: ${$slct.event_obj}`); + console.log(`Event Object started: ${$idaa_slct.event_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); +if ($ae_loc.lu_time_zone_list && $ae_loc.lu_time_zone_list.length > 0) { + // console.log('Already have time zone list!', $ae_loc.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, + api_cfg: $ae_api, obj_type: 'lu', // "lu" = a lookup table for_obj_type: 'time_zone', enabled: null, @@ -109,13 +109,13 @@ if ($ae_app.lu_time_zone_list && $ae_app.lu_time_zone_list.length > 0) { .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]); + $ae_loc.lu_time_zone_list = lu_time_zone_li_get_result; + console.log(`Time zone list:`, $ae_loc.lu_time_zone_list); + console.log($ae_loc.lu_time_zone_list[0]); + console.log($ae_loc.lu_time_zone_list[10]); } else { console.log(`No time zones returned!`); - $ae_app.lu_time_zone_list = []; + $ae_loc.lu_time_zone_list = []; } }) .catch(function (error) { @@ -123,13 +123,13 @@ if ($ae_app.lu_time_zone_list && $ae_app.lu_time_zone_list.length > 0) { }); } -if ($ae_app.lu_country_list && $ae_app.lu_country_list.length > 0) { - // console.log('Already have country list!', $ae_app.lu_country_list); +if ($ae_loc.lu_country_list && $ae_loc.lu_country_list.length > 0) { + // console.log('Already have country list!', $ae_loc.lu_country_list); } else { console.log('No country list'); let lu_country_li_get_promise = api.get_ae_obj_li_for_obj_id_crud({ - api_cfg: $ae_app.ae_api, + api_cfg: $ae_api, obj_type: 'lu', // "lu" = a lookup table for_obj_type: 'country', enabled: null, @@ -140,13 +140,13 @@ if ($ae_app.lu_country_list && $ae_app.lu_country_list.length > 0) { .then(function (lu_country_li_get_result) { if (lu_country_li_get_result) { - $ae_app.lu_country_list = lu_country_li_get_result; - console.log(`Country list:`, $ae_app.lu_country_list); - console.log($ae_app.lu_country_list[0]); - console.log($ae_app.lu_country_list[10]); + $ae_loc.lu_country_list = lu_country_li_get_result; + console.log(`Country list:`, $ae_loc.lu_country_list); + console.log($ae_loc.lu_country_list[0]); + console.log($ae_loc.lu_country_list[10]); } else { console.log(`No countries returned!`); - $ae_app.lu_country_list = []; + $ae_loc.lu_country_list = []; } }) .catch(function (error) { @@ -154,13 +154,13 @@ if ($ae_app.lu_country_list && $ae_app.lu_country_list.length > 0) { }); } -if ($ae_app.lu_country_subdivision_list && $ae_app.lu_country_subdivision_list.length > 0) { - // console.log('Already have country subdivision list!', $ae_app.lu_country_subdivision_list); +if ($ae_loc.lu_country_subdivision_list && $ae_loc.lu_country_subdivision_list.length > 0) { + // console.log('Already have country subdivision list!', $ae_loc.lu_country_subdivision_list); } else { console.log('No country subdivision list'); let lu_country_subdivision_li_get_promise = api.get_ae_obj_li_for_obj_id_crud({ - api_cfg: $ae_app.ae_api, + api_cfg: $ae_api, obj_type: 'lu', // "lu" = a lookup table for_obj_type: 'country_subdivision', enabled: null, @@ -171,13 +171,13 @@ if ($ae_app.lu_country_subdivision_list && $ae_app.lu_country_subdivision_list.l .then(function (lu_country_subdivision_li_get_result) { if (lu_country_subdivision_li_get_result) { - $ae_app.lu_country_subdivision_list = lu_country_subdivision_li_get_result; - console.log(`Country subdivision list:`, $ae_app.lu_country_subdivision_list); - console.log($ae_app.lu_country_subdivision_list[0]); - console.log($ae_app.lu_country_subdivision_list[10]); + $ae_loc.lu_country_subdivision_list = lu_country_subdivision_li_get_result; + console.log(`Country subdivision list:`, $ae_loc.lu_country_subdivision_list); + console.log($ae_loc.lu_country_subdivision_list[0]); + console.log($ae_loc.lu_country_subdivision_list[10]); } else { console.log(`No country subdivisions returned!`); - $ae_app.lu_country_subdivision_list = []; + $ae_loc.lu_country_subdivision_list = []; } }) .catch(function (error) { @@ -211,52 +211,52 @@ function tinymce_init() { // ], // 'undo redo | styles | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent' - // 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: 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: 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, - }); + // // 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_basic'); - tinymce.remove('.tinymce_editor.editor_basic_200'); - tinymce.remove('.tinymce_editor.editor_less_100'); + // tinymce.remove('.tinymce_editor.editor_basic'); + // tinymce.remove('.tinymce_editor.editor_basic_200'); + // tinymce.remove('.tinymce_editor.editor_less_100'); } -$: if ($slct.event_obj) { - // console.log('Selected Event object changed?'); - // console.log($slct.event_obj); +$: if ($idaa_slct.event_obj) { + console.log('Selected Event object changed?'); + console.log($idaa_slct.event_obj); - if ($slct.event_obj == null) { - // $slct.event_obj = {code: null, name: null, description: null, start_datetime: null, end_datetime: null, notes: null}; + if ($idaa_slct.event_obj == null) { + // $idaa_slct.event_obj = {code: null, name: null, description: null, start_datetime: null, end_datetime: null, notes: null}; } else { disable_submit_btn = false; } @@ -271,12 +271,12 @@ async function handle_submit_form(event){ let form_data = new FormData(event.target); console.log(form_data); - let event_meeting_data = ae.util.extract_prefixed_form_data({prefix: null, form_data: form_data, trim_values: true, bool_tf_str: true, log_lvl: 0}); + let event_meeting_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(event_meeting_data); let event_data: key_val = {}; - event_data['account_id_random'] = $ae_app.account_id; + event_data['account_id_random'] = $ae_loc.account_id; event_data['name'] = event_meeting_data.name; @@ -299,7 +299,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_app.lu_country_subdivision_list, 'property': 'code', 'value': 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}); address['state_province'] = country_subdivision_data[0].name; // Assume there is only one match // address['country_subdivision_name'] = country_subdivision_data[0].name; } @@ -307,7 +307,7 @@ 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_app.lu_country_list, 'property': 'alpha_2_code', 'value': 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}); 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; @@ -392,11 +392,11 @@ async function handle_submit_form(event){ let current_date_iso = dayjs().format('YYYY-MM-DD'); - // event_data['recurring_text'] = `This meeting occurs every ${days_of_week.join(', ')} at ${ae.util.iso_datetime_formatter(`${current_date_iso} ${event_data['recurring_start_time']}`, 'time_short_no_leading')} to ${ae.util.iso_datetime_formatter(`${current_date_iso} ${event_data['recurring_end_time']}`, 'time_short_no_leading')}.`; + // event_data['recurring_text'] = `This meeting occurs every ${days_of_week.join(', ')} at ${ae_util.iso_datetime_formatter(`${current_date_iso} ${event_data['recurring_start_time']}`, 'time_short_no_leading')} to ${ae_util.iso_datetime_formatter(`${current_date_iso} ${event_data['recurring_end_time']}`, 'time_short_no_leading')}.`; - // event_data['recurring_text'] = `This meeting occurs every ${days_of_week.join(', ')} at ${ae.util.iso_datetime_formatter(`${current_date_iso} ${event_data['recurring_start_time']}`, 'time_short_no_leading')}.`; + // event_data['recurring_text'] = `This meeting occurs every ${days_of_week.join(', ')} at ${ae_util.iso_datetime_formatter(`${current_date_iso} ${event_data['recurring_start_time']}`, 'time_short_no_leading')}.`; - event_data['recurring_text'] = `*gen* ${days_of_week.join(', ')} at ${ae.util.iso_datetime_formatter(`${current_date_iso} ${event_data['recurring_start_time']}`, 'time_short_no_leading')}`; + event_data['recurring_text'] = `*gen* ${days_of_week.join(', ')} at ${ae_util.iso_datetime_formatter(`${current_date_iso} ${event_data['recurring_start_time']}`, 'time_short_no_leading')}`; } event_data['external_person_id'] = event_meeting_data.external_person_id; // NOTE: Defaults to the Novi user that created/owns this event @@ -455,10 +455,10 @@ async function handle_submit_form(event){ if (!$slct.event_id) { create_event_obj_promise = api.create_ae_obj_crud({ - api_cfg: $ae_app.ae_api, + api_cfg: $ae_api, obj_type: 'event', fields: event_data, - key: $ae_app.ae_api.api_crud_super_key, + key: $ae_api.api_crud_super_key, log_lvl: 2 }) .then(function (event_obj_create_result) { @@ -489,11 +489,11 @@ async function handle_submit_form(event){ } else { update_event_obj_promise = api.update_ae_obj_id_crud({ - api_cfg: $ae_app.ae_api, + api_cfg: $ae_api, obj_type: 'event', obj_id: $slct.event_id, fields: event_data, - key: $ae_app.ae_api.api_crud_super_key, + key: $ae_api.api_crud_super_key, log_lvl: 1 }) .then(function (event_obj_update_result) { @@ -562,12 +562,12 @@ async function handle_delete_event_obj({event_id, method='disable'}) { console.log('*** handle_delete_event_obj() ***'); delete_event_obj_promise = api.delete_ae_obj_id_crud({ - api_cfg: $ae_app.ae_api, + api_cfg: $ae_api, obj_type: 'event', obj_id: event_id, method: method, // params: params, - key: $ae_app.ae_api.api_crud_super_key, + key: $ae_api.api_crud_super_key, log_lvl: 0 }) .then(function (event_obj_delete_result) { @@ -592,9 +592,9 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
@@ -616,19 +616,19 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
@@ -783,22 +785,22 @@ async function handle_delete_event_obj({event_id, method='disable'}) { @@ -808,91 +810,91 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
Recurring
-
- - + +
- {#if ( $ae_app.administrator_access || $slct.event_obj && ($slct.event_obj.show_recurring_text || ($slct.event_obj.recurring_text && !$slct.event_obj.recurring_text.includes('*gen*'))) )} + {#if ( $ae_loc.administrator_access || $lq__event_obj && ($lq__event_obj?.show_recurring_text || ($lq__event_obj?.recurring_text && !$lq__event_obj?.recurring_text.includes('*gen*'))) )}

Please only use the text box for additional information if the options above do not cover your needs. This may affect how this meeting shows up in search results.

{/if} - {#if ( $ae_app.administrator_access || $slct.event_obj && ($slct.event_obj.show_recurring_text || ($slct.event_obj.recurring_text && !$slct.event_obj.recurring_text.includes('*gen*'))) )} + {#if ( $ae_loc.administrator_access || $lq__event_obj && ($lq__event_obj?.show_recurring_text || ($lq__event_obj?.recurring_text && !$lq__event_obj?.recurring_text.includes('*gen*'))) )} {:else} {/if} -
@@ -902,17 +904,17 @@ async function handle_delete_event_obj({event_id, method='disable'}) {

Contacts

- + @@ -935,13 +937,13 @@ async function handle_delete_event_obj({event_id, method='disable'}) { - {#if !($ae_app.trusted_access || $slct.event_obj.contact_li_json[0].unlock)} + {#if !($ae_loc.trusted_access || $lq__event_obj?.contact_li_json[0].unlock)} + @@ -1047,7 +1058,8 @@ async function handle_delete_event_obj({event_id, method='disable'}) { type="checkbox" name="hide" id="hide" - bind:checked={$slct.event_obj.hide} + bind:checked={$idaa_slct.event_obj.hide} + class="checkbox" > @@ -1056,28 +1068,30 @@ async function handle_delete_event_obj({event_id, method='disable'}) { type="checkbox" name="priority" id="priority" - bind:checked={$slct.event_obj.priority} + bind:checked={$idaa_slct.event_obj.priority} + class="checkbox" > - + - + - {#if $ae_app.administrator_access} + {#if $ae_loc.administrator_access} {/if} - {#if $ae_app.trusted_access} + {#if $ae_loc.trusted_access} {/if} @@ -1088,34 +1102,50 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
{#if $slct.event_id} - + {:else} - + {/if} {#if $slct.event_id} - {#if $ae_app.administrator_access} + {#if $ae_loc.administrator_access} - {:else if $ae_app.trusted_access} + {:else if $ae_loc.trusted_access}