|
|
|
|
@@ -21,9 +21,7 @@ type key_val = {
|
|
|
|
|
[key: string]: any;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
let create_event_obj_promise: any;
|
|
|
|
|
let delete_event_obj_promise: any;
|
|
|
|
|
let update_event_obj_promise: any;
|
|
|
|
|
let prom_api__event_obj: any;
|
|
|
|
|
|
|
|
|
|
let disable_submit_btn = true;
|
|
|
|
|
|
|
|
|
|
@@ -148,9 +146,11 @@ if ($ae_loc.lu_time_zone_list && $ae_loc.lu_time_zone_list.length > 0) {
|
|
|
|
|
// });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// $ae_loc.lu_country_list = [];
|
|
|
|
|
if ($ae_loc.lu_country_list && $ae_loc.lu_country_list.length > 150) {
|
|
|
|
|
// console.log('Already have country list!', $ae_loc.lu_country_list);
|
|
|
|
|
let lu_country_list = localStorage.getItem('lu_country_list') ? JSON.parse(localStorage.getItem('lu_country_list')) : [];
|
|
|
|
|
$ae_loc.lu_country_list = [];
|
|
|
|
|
// Refresh the list at least 20% of the time.
|
|
|
|
|
if (lu_country_list && lu_country_list.length > 50 && Math.random() > 0.8) {
|
|
|
|
|
console.log(`Already have country list! ${lu_country_list.length}`, lu_country_list);
|
|
|
|
|
} else {
|
|
|
|
|
console.log('No country list');
|
|
|
|
|
|
|
|
|
|
@@ -160,64 +160,44 @@ if ($ae_loc.lu_country_list && $ae_loc.lu_country_list.length > 150) {
|
|
|
|
|
})
|
|
|
|
|
.then(function (lu_country_li_get_result) {
|
|
|
|
|
if (lu_country_li_get_result) {
|
|
|
|
|
$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]);
|
|
|
|
|
lu_country_list = lu_country_li_get_result;
|
|
|
|
|
localStorage.setItem('lu_country_list', JSON.stringify(lu_country_li_get_result));
|
|
|
|
|
if (log_lvl) {
|
|
|
|
|
console.log(`Country list:`, lu_country_list);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
console.log(`No countries returned!`);
|
|
|
|
|
$ae_loc.lu_country_list = [];
|
|
|
|
|
// $ae_loc.lu_country_list = [];
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch(function (error) {
|
|
|
|
|
console.log('No results returned or failed.', error);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// let lu_country_li_get_promise = api.get_ae_obj_li_for_obj_id_crud({
|
|
|
|
|
// api_cfg: $ae_api,
|
|
|
|
|
// obj_type: 'lu', // "lu" = a lookup table
|
|
|
|
|
// for_obj_type: 'country',
|
|
|
|
|
// enabled: null,
|
|
|
|
|
// hidden: null,
|
|
|
|
|
// // order_by_li: {'sort': 'DESC', 'english_short_name': 'ASC'},
|
|
|
|
|
// log_lvl: 1
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
|
|
// .then(function (lu_country_li_get_result) {
|
|
|
|
|
// if (lu_country_li_get_result) {
|
|
|
|
|
// $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_loc.lu_country_list = [];
|
|
|
|
|
// }
|
|
|
|
|
// })
|
|
|
|
|
// .catch(function (error) {
|
|
|
|
|
// console.log('No results returned or failed.', error);
|
|
|
|
|
// });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let lu_country_subdivision_list = localStorage.getItem('lu_country_subdivision_list') ? JSON.parse(localStorage.getItem('lu_country_subdivision_list')) : [];
|
|
|
|
|
$ae_loc.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);
|
|
|
|
|
// Refresh the list at least 20% of the time.
|
|
|
|
|
if (lu_country_subdivision_list && lu_country_subdivision_list.length > 50 && Math.random() > 0.8) {
|
|
|
|
|
console.log(`Already have country subdivision list! ${lu_country_subdivision_list.length}`, lu_country_subdivision_list);
|
|
|
|
|
} else {
|
|
|
|
|
console.log('No country subdivision list');
|
|
|
|
|
console.log('No country subdivision list. Requesting new list.');
|
|
|
|
|
|
|
|
|
|
let lu_country_subdivision_li_get_promise = core_func.load_ae_obj_li__country_subdivision({
|
|
|
|
|
api_cfg: $ae_api,
|
|
|
|
|
log_lvl: 2
|
|
|
|
|
log_lvl: 1
|
|
|
|
|
})
|
|
|
|
|
.then(function (lu_country_subdivision_li_get_result) {
|
|
|
|
|
/* We need to save the country subdivision list to localStore */
|
|
|
|
|
if (lu_country_subdivision_li_get_result) {
|
|
|
|
|
$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]);
|
|
|
|
|
lu_country_subdivision_list = lu_country_subdivision_li_get_result;
|
|
|
|
|
localStorage.setItem('lu_country_subdivision_list', JSON.stringify(lu_country_subdivision_li_get_result));
|
|
|
|
|
if (log_lvl) {
|
|
|
|
|
console.log(`Country subdivision list:`, lu_country_subdivision_list);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
console.log(`No country subdivisions returned!`);
|
|
|
|
|
$ae_loc.lu_country_subdivision_list = [];
|
|
|
|
|
// $ae_loc.lu_country_subdivision_list = [];
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch(function (error) {
|
|
|
|
|
@@ -242,8 +222,9 @@ if ($ae_loc.lu_country_subdivision_list && $ae_loc.lu_country_subdivision_list.l
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$: if ($idaa_slct.event_obj) {
|
|
|
|
|
console.log('Selected Event object changed?');
|
|
|
|
|
console.log($idaa_slct.event_obj);
|
|
|
|
|
if (log_lvl) {
|
|
|
|
|
console.log('Selected Event object changed?', $idaa_slct.event_obj);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($idaa_slct.event_obj == null) {
|
|
|
|
|
// $idaa_slct.event_obj = {code: null, name: null, description: null, start_datetime: null, end_datetime: null, notes: null};
|
|
|
|
|
@@ -261,201 +242,194 @@ async function handle_submit_form(event: any) {
|
|
|
|
|
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});
|
|
|
|
|
console.log(event_meeting_data);
|
|
|
|
|
let event_meeting_fd = 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_fd);
|
|
|
|
|
|
|
|
|
|
let event_data: key_val = {};
|
|
|
|
|
let event_do: key_val = {}; // Data out for API object
|
|
|
|
|
|
|
|
|
|
event_data['account_id_random'] = $ae_loc.account_id;
|
|
|
|
|
event_do['account_id_random'] = $ae_loc.account_id;
|
|
|
|
|
|
|
|
|
|
event_data['name'] = event_meeting_data.name;
|
|
|
|
|
event_do['name'] = event_meeting_fd.name;
|
|
|
|
|
|
|
|
|
|
// Check if the description_new_html exists and is a string
|
|
|
|
|
if (typeof $idaa_slct.event_obj.description_new_html === 'string') {
|
|
|
|
|
console.log('New description is a string');
|
|
|
|
|
event_data['description'] = $idaa_slct.event_obj.description_new_html;
|
|
|
|
|
event_do['description'] = $idaa_slct.event_obj.description_new_html;
|
|
|
|
|
} else {
|
|
|
|
|
console.log('New description is not a string. Do nothing.');
|
|
|
|
|
// event_data['description'] = event_meeting_data.description;
|
|
|
|
|
// event_do['description'] = event_meeting_fd.description;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
event_data['type'] = event_meeting_data.type;
|
|
|
|
|
event_data['physical'] = !!event_meeting_data.physical;
|
|
|
|
|
event_data['virtual'] = !!event_meeting_data.virtual;
|
|
|
|
|
event_do['type'] = event_meeting_fd.type;
|
|
|
|
|
event_do['physical'] = !!event_meeting_fd.physical;
|
|
|
|
|
event_do['virtual'] = !!event_meeting_fd.virtual;
|
|
|
|
|
|
|
|
|
|
let address: key_val = {};
|
|
|
|
|
address['name'] = event_meeting_data.address_name;
|
|
|
|
|
address['line_1'] = event_meeting_data.address_line_1;
|
|
|
|
|
address['line_2'] = event_meeting_data.address_line_2;
|
|
|
|
|
address['line_3'] = event_meeting_data.address_line_3;
|
|
|
|
|
address['city'] = event_meeting_data.address_city;
|
|
|
|
|
address['country_subdivision_code'] = event_meeting_data.address_country_subdivision_code;
|
|
|
|
|
if (event_meeting_data.address_country_subdivision_code) {
|
|
|
|
|
address['country_subdivision_code'] = event_meeting_data.address_country_subdivision_code;
|
|
|
|
|
address['name'] = event_meeting_fd.address_name;
|
|
|
|
|
address['line_1'] = event_meeting_fd.address_line_1;
|
|
|
|
|
address['line_2'] = event_meeting_fd.address_line_2;
|
|
|
|
|
address['line_3'] = event_meeting_fd.address_line_3;
|
|
|
|
|
address['city'] = event_meeting_fd.address_city;
|
|
|
|
|
address['country_subdivision_code'] = event_meeting_fd.address_country_subdivision_code;
|
|
|
|
|
if (event_meeting_fd.address_country_subdivision_code) {
|
|
|
|
|
address['country_subdivision_code'] = event_meeting_fd.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});
|
|
|
|
|
let country_subdivision_data = ae_util.get_obj_li_w_match_prop({'obj_li': lu_country_subdivision_list, 'property': 'code', 'value': event_meeting_fd.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;
|
|
|
|
|
}
|
|
|
|
|
address['postal_code'] = event_meeting_data.address_postal_code;
|
|
|
|
|
if (event_meeting_data.address_country_alpha_2_code) {
|
|
|
|
|
address['country_alpha_2_code'] = event_meeting_data.address_country_alpha_2_code;
|
|
|
|
|
address['postal_code'] = event_meeting_fd.address_postal_code;
|
|
|
|
|
if (event_meeting_fd.address_country_alpha_2_code) {
|
|
|
|
|
address['country_alpha_2_code'] = event_meeting_fd.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});
|
|
|
|
|
let country_data = ae_util.get_obj_li_w_match_prop({'obj_li': lu_country_list, 'property': 'alpha_2_code', 'value': event_meeting_fd.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_do['location_address_json'] = address;
|
|
|
|
|
|
|
|
|
|
// Check if the location_text_new_html exists and is a string
|
|
|
|
|
if (typeof $idaa_slct.event_obj.location_text_new_html === 'string') {
|
|
|
|
|
event_data['location_text'] = $idaa_slct.event_obj.location_text_new_html;
|
|
|
|
|
event_do['location_text'] = $idaa_slct.event_obj.location_text_new_html;
|
|
|
|
|
} else {
|
|
|
|
|
console.log('New location text is not a string. Do nothing.');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
event_data['attend_url'] = event_meeting_data.attend_url;
|
|
|
|
|
event_data['attend_url_passcode'] = event_meeting_data.attend_url_passcode;
|
|
|
|
|
event_data['attend_phone'] = event_meeting_data.attend_phone;
|
|
|
|
|
event_data['attend_phone_passcode'] = event_meeting_data.attend_phone_passcode;
|
|
|
|
|
event_do['attend_url'] = event_meeting_fd.attend_url;
|
|
|
|
|
event_do['attend_url_passcode'] = event_meeting_fd.attend_url_passcode;
|
|
|
|
|
event_do['attend_phone'] = event_meeting_fd.attend_phone;
|
|
|
|
|
event_do['attend_phone_passcode'] = event_meeting_fd.attend_phone_passcode;
|
|
|
|
|
|
|
|
|
|
// Check if the attend_text_new_html exists and is a string
|
|
|
|
|
if (typeof $idaa_slct.event_obj.attend_text_new_html === 'string') {
|
|
|
|
|
event_data['attend_text'] = $idaa_slct.event_obj.attend_text_new_html;
|
|
|
|
|
event_do['attend_text'] = $idaa_slct.event_obj.attend_text_new_html;
|
|
|
|
|
} else {
|
|
|
|
|
console.log('New attend text is not a string. Do nothing.');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
event_data['timezone'] = event_meeting_data.timezone;
|
|
|
|
|
event_do['timezone'] = event_meeting_fd.timezone;
|
|
|
|
|
|
|
|
|
|
event_data['recurring'] = !!event_meeting_data.recurring;
|
|
|
|
|
event_data['recurring_pattern'] = event_meeting_data.recurring_pattern;
|
|
|
|
|
event_do['recurring'] = !!event_meeting_fd.recurring;
|
|
|
|
|
event_do['recurring_pattern'] = event_meeting_fd.recurring_pattern;
|
|
|
|
|
|
|
|
|
|
// NOTE: !! converts to boolean based on truthiness
|
|
|
|
|
event_data['weekday_sunday'] = !!event_meeting_data.weekday_sunday;
|
|
|
|
|
event_data['weekday_monday'] = !!event_meeting_data.weekday_monday;
|
|
|
|
|
event_data['weekday_tuesday'] = !!event_meeting_data.weekday_tuesday;
|
|
|
|
|
event_data['weekday_wednesday'] = !!event_meeting_data.weekday_wednesday;
|
|
|
|
|
event_data['weekday_thursday'] = !!event_meeting_data.weekday_thursday;
|
|
|
|
|
event_data['weekday_friday'] = !!event_meeting_data.weekday_friday;
|
|
|
|
|
event_data['weekday_saturday'] = !!event_meeting_data.weekday_saturday;
|
|
|
|
|
// event_data['weekday_sunday'] = event_meeting_data.weekday_sunday;
|
|
|
|
|
// event_data['weekday_monday'] = event_meeting_data.weekday_monday;
|
|
|
|
|
// event_data['weekday_tuesday'] = event_meeting_data.weekday_tuesday;
|
|
|
|
|
// event_data['weekday_wednesday'] = event_meeting_data.weekday_wednesday;
|
|
|
|
|
// event_data['weekday_thursday'] = event_meeting_data.weekday_thursday;
|
|
|
|
|
// event_data['weekday_friday'] = event_meeting_data.weekday_friday;
|
|
|
|
|
// event_data['weekday_saturday'] = event_meeting_data.weekday_saturday;
|
|
|
|
|
event_do['weekday_sunday'] = !!event_meeting_fd.weekday_sunday;
|
|
|
|
|
event_do['weekday_monday'] = !!event_meeting_fd.weekday_monday;
|
|
|
|
|
event_do['weekday_tuesday'] = !!event_meeting_fd.weekday_tuesday;
|
|
|
|
|
event_do['weekday_wednesday'] = !!event_meeting_fd.weekday_wednesday;
|
|
|
|
|
event_do['weekday_thursday'] = !!event_meeting_fd.weekday_thursday;
|
|
|
|
|
event_do['weekday_friday'] = !!event_meeting_fd.weekday_friday;
|
|
|
|
|
event_do['weekday_saturday'] = !!event_meeting_fd.weekday_saturday;
|
|
|
|
|
|
|
|
|
|
if (event_meeting_data['recurring_start_time'] ) {
|
|
|
|
|
event_data['recurring_start_time'] = event_meeting_data.recurring_start_time;
|
|
|
|
|
if (event_meeting_fd['recurring_start_time'] ) {
|
|
|
|
|
event_do['recurring_start_time'] = event_meeting_fd.recurring_start_time;
|
|
|
|
|
}
|
|
|
|
|
if (event_meeting_data['recurring_end_time']) {
|
|
|
|
|
event_data['recurring_end_time'] = event_meeting_data.recurring_end_time;
|
|
|
|
|
if (event_meeting_fd['recurring_end_time']) {
|
|
|
|
|
event_do['recurring_end_time'] = event_meeting_fd.recurring_end_time;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check if the recurring_text_new_html exists and is a string
|
|
|
|
|
if (typeof $idaa_slct.event_obj.recurring_text_new_html === 'string') {
|
|
|
|
|
event_data['recurring_text'] = $idaa_slct.event_obj.recurring_text_new_html;
|
|
|
|
|
event_do['recurring_text'] = $idaa_slct.event_obj.recurring_text_new_html;
|
|
|
|
|
} else {
|
|
|
|
|
console.log('New recurring text is not a string. Do nothing.');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log(event_data['recurring_text']);
|
|
|
|
|
if (!event_data['recurring_text'] || event_data['recurring_text'].includes('*gen*')) {
|
|
|
|
|
console.log(event_do['recurring_text']);
|
|
|
|
|
if (!event_do['recurring_text'] || event_do['recurring_text'].includes('*gen*')) {
|
|
|
|
|
let days_of_week = [];
|
|
|
|
|
if (event_data['weekday_sunday']) {
|
|
|
|
|
if (event_do['weekday_sunday']) {
|
|
|
|
|
days_of_week.push('Sunday');
|
|
|
|
|
}
|
|
|
|
|
if (event_data['weekday_monday']) {
|
|
|
|
|
if (event_do['weekday_monday']) {
|
|
|
|
|
days_of_week.push('Monday');
|
|
|
|
|
}
|
|
|
|
|
if (event_data['weekday_tuesday']) {
|
|
|
|
|
if (event_do['weekday_tuesday']) {
|
|
|
|
|
days_of_week.push('Tuesday');
|
|
|
|
|
}
|
|
|
|
|
if (event_data['weekday_wednesday']) {
|
|
|
|
|
if (event_do['weekday_wednesday']) {
|
|
|
|
|
days_of_week.push('Wednesday');
|
|
|
|
|
}
|
|
|
|
|
if (event_data['weekday_thursday']) {
|
|
|
|
|
if (event_do['weekday_thursday']) {
|
|
|
|
|
days_of_week.push('Thursday');
|
|
|
|
|
}
|
|
|
|
|
if (event_data['weekday_friday']) {
|
|
|
|
|
if (event_do['weekday_friday']) {
|
|
|
|
|
days_of_week.push('Friday');
|
|
|
|
|
}
|
|
|
|
|
if (event_data['weekday_saturday']) {
|
|
|
|
|
if (event_do['weekday_saturday']) {
|
|
|
|
|
days_of_week.push('Saturday');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let current_date_iso = ae_util.iso_datetime_formatter(new Date(), '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_do['recurring_text'] = `This meeting occurs every ${days_of_week.join(', ')} at ${ae_util.iso_datetime_formatter(`${current_date_iso} ${event_do['recurring_start_time']}`, 'time_short_no_leading')} to ${ae_util.iso_datetime_formatter(`${current_date_iso} ${event_do['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_do['recurring_text'] = `This meeting occurs every ${days_of_week.join(', ')} at ${ae_util.iso_datetime_formatter(`${current_date_iso} ${event_do['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_do['recurring_text'] = `*gen* ${days_of_week.join(', ')} at ${ae_util.iso_datetime_formatter(`${current_date_iso} ${event_do['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
|
|
|
|
|
event_do['external_person_id'] = event_meeting_fd.external_person_id; // NOTE: Defaults to the Novi user that created/owns this event
|
|
|
|
|
|
|
|
|
|
event_data['contact_li_json'] = [];
|
|
|
|
|
event_do['contact_li_json'] = [];
|
|
|
|
|
let contact_1: key_val = {};
|
|
|
|
|
// contact_1['external_person_id'] = event_meeting_data.external_person_id; // NOTE: From the Novi user that created/owns this event
|
|
|
|
|
contact_1['full_name'] = event_meeting_data.contact_1_full_name; // NOTE: From the Novi user that created/owns this event
|
|
|
|
|
contact_1['email'] = event_meeting_data.contact_1_email; // NOTE: From the Novi user that created/owns this event
|
|
|
|
|
if (event_meeting_data.contact_1_phone_mobile) {
|
|
|
|
|
contact_1['phone_mobile'] = event_meeting_data.contact_1_phone_mobile; // NOTE: From the Novi user that created/owns this event, but allow them to change or hide it
|
|
|
|
|
// contact_1['external_person_id'] = event_meeting_fd.external_person_id; // NOTE: From the Novi user that created/owns this event
|
|
|
|
|
contact_1['full_name'] = event_meeting_fd.contact_1_full_name; // NOTE: From the Novi user that created/owns this event
|
|
|
|
|
contact_1['email'] = event_meeting_fd.contact_1_email; // NOTE: From the Novi user that created/owns this event
|
|
|
|
|
if (event_meeting_fd.contact_1_phone_mobile) {
|
|
|
|
|
contact_1['phone_mobile'] = event_meeting_fd.contact_1_phone_mobile; // NOTE: From the Novi user that created/owns this event, but allow them to change or hide it
|
|
|
|
|
}
|
|
|
|
|
if (event_meeting_data.contact_1_phone_home) {
|
|
|
|
|
contact_1['phone_home'] = event_meeting_data.contact_1_phone_home;
|
|
|
|
|
if (event_meeting_fd.contact_1_phone_home) {
|
|
|
|
|
contact_1['phone_home'] = event_meeting_fd.contact_1_phone_home;
|
|
|
|
|
}
|
|
|
|
|
if (event_meeting_data.contact_1_phone_office) {
|
|
|
|
|
contact_1['phone_office'] = event_meeting_data.contact_1_phone_office;
|
|
|
|
|
if (event_meeting_fd.contact_1_phone_office) {
|
|
|
|
|
contact_1['phone_office'] = event_meeting_fd.contact_1_phone_office;
|
|
|
|
|
}
|
|
|
|
|
// event_data['contact_li_json'].push(contact_1);
|
|
|
|
|
event_do['contact_li_json'].push(contact_1);
|
|
|
|
|
|
|
|
|
|
let contact_2: key_val = {};
|
|
|
|
|
contact_2['full_name'] = event_meeting_data.contact_2_full_name;
|
|
|
|
|
contact_2['email'] = event_meeting_data.contact_2_email;
|
|
|
|
|
if (event_meeting_data.contact_2_phone_mobile) {
|
|
|
|
|
contact_2['phone_mobile'] = event_meeting_data.contact_2_phone_mobile;
|
|
|
|
|
contact_2['full_name'] = event_meeting_fd.contact_2_full_name;
|
|
|
|
|
contact_2['email'] = event_meeting_fd.contact_2_email;
|
|
|
|
|
if (event_meeting_fd.contact_2_phone_mobile) {
|
|
|
|
|
contact_2['phone_mobile'] = event_meeting_fd.contact_2_phone_mobile;
|
|
|
|
|
}
|
|
|
|
|
if (event_meeting_data.contact_2_phone_home) {
|
|
|
|
|
contact_2['phone_home'] = event_meeting_data.contact_2_phone_home;
|
|
|
|
|
if (event_meeting_fd.contact_2_phone_home) {
|
|
|
|
|
contact_2['phone_home'] = event_meeting_fd.contact_2_phone_home;
|
|
|
|
|
}
|
|
|
|
|
if (event_meeting_data.contact_2_phone_office) {
|
|
|
|
|
contact_2['phone_office'] = event_meeting_data.contact_2_phone_office;
|
|
|
|
|
if (event_meeting_fd.contact_2_phone_office) {
|
|
|
|
|
contact_2['phone_office'] = event_meeting_fd.contact_2_phone_office;
|
|
|
|
|
}
|
|
|
|
|
// event_data['contact_li_json'].push(contact_2);
|
|
|
|
|
event_do['contact_li_json'].push(contact_2);
|
|
|
|
|
|
|
|
|
|
event_data['hide'] = !!event_meeting_data.hide;
|
|
|
|
|
event_data['priority'] = !!event_meeting_data.priority;
|
|
|
|
|
if (event_meeting_data['sort']) {
|
|
|
|
|
event_data['sort'] = Number(event_meeting_data.sort);
|
|
|
|
|
event_do['hide'] = !!event_meeting_fd.hide;
|
|
|
|
|
event_do['priority'] = !!event_meeting_fd.priority;
|
|
|
|
|
if (event_meeting_fd['sort']) {
|
|
|
|
|
event_do['sort'] = Number(event_meeting_fd.sort);
|
|
|
|
|
}
|
|
|
|
|
if (event_data['group']) {
|
|
|
|
|
event_data['group'] = event_meeting_data.group;
|
|
|
|
|
if (event_meeting_fd['group']) {
|
|
|
|
|
event_do['group'] = event_meeting_fd.group;
|
|
|
|
|
} else {
|
|
|
|
|
event_data['group'] = null;
|
|
|
|
|
event_do['group'] = null;
|
|
|
|
|
}
|
|
|
|
|
if (event_meeting_data['enable']) {
|
|
|
|
|
event_data['enable'] = !!event_meeting_data.enable;
|
|
|
|
|
if (event_meeting_fd['enable']) {
|
|
|
|
|
event_do['enable'] = !!event_meeting_fd.enable;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check if the notes_new_html exists and is a string
|
|
|
|
|
if (typeof $idaa_slct.event_obj.notes_new_html === 'string') {
|
|
|
|
|
event_data['notes'] = $idaa_slct.event_obj.notes_new_html;
|
|
|
|
|
event_do['notes'] = $idaa_slct.event_obj.notes_new_html;
|
|
|
|
|
} else {
|
|
|
|
|
console.log('New notes is not a string. Do nothing.');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log(event_data);
|
|
|
|
|
console.log(event_do);
|
|
|
|
|
|
|
|
|
|
if (!$idaa_slct.event_id) {
|
|
|
|
|
create_event_obj_promise = api.create_ae_obj_crud({
|
|
|
|
|
prom_api__event_obj = api.create_ae_obj_crud({
|
|
|
|
|
api_cfg: $ae_api,
|
|
|
|
|
obj_type: 'event',
|
|
|
|
|
fields: event_data,
|
|
|
|
|
fields: event_do,
|
|
|
|
|
key: $ae_api.api_crud_super_key,
|
|
|
|
|
log_lvl: 2
|
|
|
|
|
})
|
|
|
|
|
@@ -483,30 +457,19 @@ async function handle_submit_form(event: any) {
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return create_event_obj_promise;
|
|
|
|
|
return prom_api__event_obj;
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
events_func.update_ae_obj__event({
|
|
|
|
|
prom_api__event_obj = events_func.update_ae_obj__event({
|
|
|
|
|
api_cfg: $ae_api,
|
|
|
|
|
event_id: $idaa_slct.event_id,
|
|
|
|
|
data_kv: event_data,
|
|
|
|
|
data_kv: event_do,
|
|
|
|
|
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.');
|
|
|
|
|
disable_submit_btn = false; // Enable the submit button even if something didn't go right
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -527,40 +490,9 @@ async function handle_submit_form(event: any) {
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return update_event_obj_promise;
|
|
|
|
|
return prom_api__event_obj;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if (!$idaa_slct.event_id) {
|
|
|
|
|
// event_meeting_data['event_id_random'] = $idaa_slct.event_id;
|
|
|
|
|
// event_meeting_data['enable'] = true;
|
|
|
|
|
|
|
|
|
|
// create_event_obj_promise = await create_event_obj({event_id: $idaa_slct.event_id, data: event_meeting_data})
|
|
|
|
|
// console.log(create_event_obj_promise);
|
|
|
|
|
// $idaa_slct.event_id = create_event_obj_promise;
|
|
|
|
|
|
|
|
|
|
// dispatch(
|
|
|
|
|
// 'created__event_obj',
|
|
|
|
|
// {
|
|
|
|
|
// event_id: $idaa_slct.event_id,
|
|
|
|
|
// }
|
|
|
|
|
// );
|
|
|
|
|
// } else {
|
|
|
|
|
// update_event_obj_promise = await update_event_obj({event_id: $idaa_slct.event_id, data: event_meeting_data, log_lvl: 0})
|
|
|
|
|
// console.log(update_event_obj_promise);
|
|
|
|
|
|
|
|
|
|
// dispatch(
|
|
|
|
|
// 'updated__event_obj',
|
|
|
|
|
// {
|
|
|
|
|
// event_id: $idaa_slct.event_id,
|
|
|
|
|
// }
|
|
|
|
|
// );
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// post_promise = null;
|
|
|
|
|
// update_event_obj_promise = null;
|
|
|
|
|
|
|
|
|
|
disable_submit_btn = false;
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
@@ -569,7 +501,7 @@ async function handle_submit_form(event: any) {
|
|
|
|
|
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({
|
|
|
|
|
prom_api__event_obj = api.delete_ae_obj_id_crud({
|
|
|
|
|
api_cfg: $ae_api,
|
|
|
|
|
obj_type: 'event',
|
|
|
|
|
obj_id: event_id,
|
|
|
|
|
@@ -594,7 +526,7 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
|
|
|
|
console.log('The result was null or false when trying to delete.', error);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return delete_event_obj_promise;
|
|
|
|
|
return prom_api__event_obj;
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
@@ -607,11 +539,11 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
|
|
|
|
|
|
|
|
|
<form on:submit|preventDefault={handle_submit_form} class="space-y-1">
|
|
|
|
|
|
|
|
|
|
{#await update_event_obj_promise}
|
|
|
|
|
{#await prom_api__event_obj}
|
|
|
|
|
<div class="awaiting alert_msg_pulse" out:fade={{ duration: 2000 }}>Saving...</div>
|
|
|
|
|
{:then}
|
|
|
|
|
{#if update_event_obj_promise}
|
|
|
|
|
<div class="awaiting" out:fade={{ duration: 2000 }}>Finished saving</div>
|
|
|
|
|
{#if prom_api__event_obj}
|
|
|
|
|
<!-- <div class="awaiting" out:fade={{ duration: 2000 }}>Finished saving</div> -->
|
|
|
|
|
{:else}
|
|
|
|
|
<!-- <div class="awaiting" out:fade={{ duration: 2000 }}>Nothing here yet</div> -->
|
|
|
|
|
{/if}
|
|
|
|
|
@@ -622,9 +554,13 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
|
|
|
|
<button
|
|
|
|
|
type="submit"
|
|
|
|
|
disabled={(disable_submit_btn)}
|
|
|
|
|
class="ae_btn btn_primary btn btn-primary variant-ghost-primary hover:variant-filled-primary transition"
|
|
|
|
|
class="ae_btn btn_primary btn btn-primary variant-ghost-primary hover:variant-filled-primary transition absolute top-0.5 right-0.5"
|
|
|
|
|
>
|
|
|
|
|
<span class="fas fa-check m-1"></span> Save?
|
|
|
|
|
{#await prom_api__event_obj}
|
|
|
|
|
<span class="fas fa-spinner fa-spin m-1"></span> Saving
|
|
|
|
|
{:then}
|
|
|
|
|
<span class="fas fa-save m-1"></span> Save
|
|
|
|
|
{/await}
|
|
|
|
|
</button>
|
|
|
|
|
{/if}
|
|
|
|
|
</section> <!-- END: section event__options -->
|
|
|
|
|
@@ -640,13 +576,14 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
|
|
|
|
</label>
|
|
|
|
|
|
|
|
|
|
<label for="description" class="ae_label event__description">Short description
|
|
|
|
|
<!-- <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> -->
|
|
|
|
|
<!-- <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} ></textarea> -->
|
|
|
|
|
|
|
|
|
|
<Tiptap_editor
|
|
|
|
|
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}
|
|
|
|
|
placeholder="A short description or overview of this recovery meeting"
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<!-- {@html $idaa_slct.event_obj?.description_new_html ?? 'not sure?'} -->
|
|
|
|
|
@@ -760,12 +697,17 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
|
|
|
|
<input type="text" class="input w-40" id="address_city" name="address_city" placeholder="Name of the city" value="{($lq__event_obj?.location_address_json && $lq__event_obj?.location_address_json.city ? $lq__event_obj?.location_address_json.city : $lq__event_obj?.address_city ?? '')}" autocomplete="address-level2">
|
|
|
|
|
</label>
|
|
|
|
|
|
|
|
|
|
{#if $ae_loc.lu_country_subdivision_list}
|
|
|
|
|
{#if lu_country_subdivision_list}
|
|
|
|
|
<label for="address_country_subdivision_code" class="">State or province
|
|
|
|
|
<select class="select w-56" id="address_country_subdivision_code" name="address_country_subdivision_code" title="Select the state or province for the meeting">
|
|
|
|
|
<select
|
|
|
|
|
id="address_country_subdivision_code"
|
|
|
|
|
name="address_country_subdivision_code"
|
|
|
|
|
value="{($lq__event_obj?.location_address_json && $lq__event_obj?.location_address_json.country_subdivision_code ? $lq__event_obj?.location_address_json.country_subdivision_code : $lq__event_obj?.address_country_subdivision_code ?? '')}"
|
|
|
|
|
class="select w-56"
|
|
|
|
|
title="Select the state or province for the meeting">
|
|
|
|
|
<option value="">-- None --</option>
|
|
|
|
|
{#each $ae_loc.lu_country_subdivision_list as lu_country_subdivision}
|
|
|
|
|
<option value="{lu_country_subdivision.code}" selected={(($lq__event_obj?.location_address_json && lu_country_subdivision.code == $lq__event_obj?.location_address_json.country_subdivision_code) || ( lu_country_subdivision.code == $lq__event_obj?.address_country_subdivision_code) ? 'selected' : '')}>{lu_country_subdivision.country_alpha_2_code} - {lu_country_subdivision.name}</option>
|
|
|
|
|
{#each lu_country_subdivision_list as lu_country_subdivision}
|
|
|
|
|
<option value="{lu_country_subdivision.code}">{lu_country_subdivision.country_alpha_2_code} - {lu_country_subdivision.name}</option>
|
|
|
|
|
{/each}
|
|
|
|
|
</select>
|
|
|
|
|
</label>
|
|
|
|
|
@@ -779,12 +721,17 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
|
|
|
|
<input type="text" class="input w-32" id="address_postal_code" name="address_postal_code" placeholder="Postal code or zip code" value="{($lq__event_obj?.location_address_json && $lq__event_obj?.location_address_json.postal_code ? $lq__event_obj?.location_address_json.postal_code : $lq__event_obj?.address_postal_code ?? '')}" autocomplete="postal-code">
|
|
|
|
|
</label>
|
|
|
|
|
|
|
|
|
|
{#if $ae_loc.lu_country_list}
|
|
|
|
|
{#if lu_country_list}
|
|
|
|
|
<label for="address_country_alpha_2_code" class="">Country
|
|
|
|
|
<select class="select w-56" id="address_country_alpha_2_code" name="address_country_alpha_2_code" title="Select the country for the meeting">
|
|
|
|
|
<select
|
|
|
|
|
id="address_country_alpha_2_code"
|
|
|
|
|
name="address_country_alpha_2_code"
|
|
|
|
|
value="{($lq__event_obj?.location_address_json && $lq__event_obj?.location_address_json.country_alpha_2_code ? $lq__event_obj?.location_address_json.country_alpha_2_code : $lq__event_obj?.address_country_alpha_2_code ?? '')}"
|
|
|
|
|
class="select w-64"
|
|
|
|
|
title="Select the country for the meeting">
|
|
|
|
|
<option value="">-- None --</option>
|
|
|
|
|
{#each $ae_loc.lu_country_list as lu_country}
|
|
|
|
|
<option value="{lu_country.alpha_2_code}" selected={(($lq__event_obj?.location_address_json && lu_country.alpha_2_code == $lq__event_obj?.location_address_json.country_alpha_2_code) || (lu_country.alpha_2_code == $lq__event_obj?.address_country_alpha_2_code) ? 'selected' : '')}>{lu_country.english_short_name}</option>
|
|
|
|
|
{#each lu_country_list as lu_country}
|
|
|
|
|
<option value="{lu_country.alpha_2_code}">{lu_country.english_short_name}</option>
|
|
|
|
|
{/each}
|
|
|
|
|
</select>
|
|
|
|
|
</label>
|
|
|
|
|
@@ -824,7 +771,9 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
|
|
|
|
<fieldset
|
|
|
|
|
id="virtual"
|
|
|
|
|
class="virtual space-y-1"
|
|
|
|
|
class:ae_d_none={!$idaa_slct.event_obj.virtual}>
|
|
|
|
|
class:ae_d_none={!$idaa_slct.event_obj.virtual}
|
|
|
|
|
class:hidden={!$idaa_slct.event_obj.virtual}
|
|
|
|
|
>
|
|
|
|
|
<legend>Virtual/Online</legend>
|
|
|
|
|
|
|
|
|
|
<label for="attend_url">URL to access the virtual meeting
|
|
|
|
|
@@ -921,14 +870,34 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
|
|
|
|
</fieldset>
|
|
|
|
|
|
|
|
|
|
<fieldset class="event__days_of_week">
|
|
|
|
|
<label><input type="checkbox" name="weekday_sunday" value={$lq__event_obj?.weekday_sunday} bind:checked={($idaa_slct.event_obj.weekday_sunday)} class="checkbox">
|
|
|
|
|
Sunday</label>
|
|
|
|
|
<label><input type="checkbox" name="weekday_monday" value={$lq__event_obj?.weekday_monday} bind:checked={($idaa_slct.event_obj.weekday_monday)} class="checkbox"> Monday</label>
|
|
|
|
|
<label><input type="checkbox" name="weekday_tuesday" value={$lq__event_obj?.weekday_tuesday} bind:checked={($idaa_slct.event_obj.weekday_tuesday)} class="checkbox"> Tuesday</label>
|
|
|
|
|
<label><input type="checkbox" name="weekday_wednesday" value={$lq__event_obj?.weekday_wednesday} bind:checked={($idaa_slct.event_obj.weekday_wednesday)} class="checkbox"> Wednesday</label>
|
|
|
|
|
<label><input type="checkbox" name="weekday_thursday" value={$lq__event_obj?.weekday_thursday} bind:checked={($idaa_slct.event_obj.weekday_thursday)} class="checkbox"> Thursday</label>
|
|
|
|
|
<label><input type="checkbox" name="weekday_friday" value={$lq__event_obj?.weekday_friday} bind:checked={($idaa_slct.event_obj.weekday_friday)} class="checkbox"> Friday</label>
|
|
|
|
|
<label><input type="checkbox" name="weekday_saturday" value={$lq__event_obj?.weekday_saturday} bind:checked={($idaa_slct.event_obj.weekday_saturday)} class="checkbox"> Saturday</label>
|
|
|
|
|
<label>
|
|
|
|
|
<input type="checkbox" name="weekday_sunday" value="Sunday" bind:checked={($idaa_slct.event_obj.weekday_sunday)} class="checkbox">
|
|
|
|
|
Sunday
|
|
|
|
|
</label>
|
|
|
|
|
<label>
|
|
|
|
|
<input type="checkbox" name="weekday_monday" value="Monday" bind:checked={($idaa_slct.event_obj.weekday_monday)} class="checkbox">
|
|
|
|
|
Monday
|
|
|
|
|
</label>
|
|
|
|
|
<label>
|
|
|
|
|
<input type="checkbox" name="weekday_tuesday" value="Tuesday" bind:checked={($idaa_slct.event_obj.weekday_tuesday)} class="checkbox">
|
|
|
|
|
Tuesday
|
|
|
|
|
</label>
|
|
|
|
|
<label>
|
|
|
|
|
<input type="checkbox" name="weekday_wednesday" value="Wednesday" bind:checked={($idaa_slct.event_obj.weekday_wednesday)} class="checkbox">
|
|
|
|
|
Wednesday
|
|
|
|
|
</label>
|
|
|
|
|
<label>
|
|
|
|
|
<input type="checkbox" name="weekday_thursday" value="Thursday" bind:checked={($idaa_slct.event_obj.weekday_thursday)} class="checkbox">
|
|
|
|
|
Thursday
|
|
|
|
|
</label>
|
|
|
|
|
<label>
|
|
|
|
|
<input type="checkbox" name="weekday_friday" value="Friday" bind:checked={($idaa_slct.event_obj.weekday_friday)} class="checkbox">
|
|
|
|
|
Friday
|
|
|
|
|
</label>
|
|
|
|
|
<label>
|
|
|
|
|
<input type="checkbox" name="weekday_saturday" value="Saturday" bind:checked={($idaa_slct.event_obj.weekday_saturday)} class="checkbox">
|
|
|
|
|
Saturday
|
|
|
|
|
</label>
|
|
|
|
|
</fieldset>
|
|
|
|
|
|
|
|
|
|
<fieldset class="flex_row flex_gap_md flex_justify_around">
|
|
|
|
|
@@ -1058,13 +1027,16 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
|
|
|
|
|
|
|
|
|
<span class="ae_group">
|
|
|
|
|
|
|
|
|
|
{#if !($ae_loc.trusted_access || $lq__event_obj?.contact_li_json[0].unlock)}
|
|
|
|
|
{#if !($ae_loc.administrator_access || $idaa_slct.event_obj?.contact_li_json[0]?.unlock)}
|
|
|
|
|
<button type="button" class="ae_btn ae_smaller ae_btn_info"
|
|
|
|
|
on:click|preventDefault={() => {
|
|
|
|
|
if (confirm('Are you sure you want to lock these fields? The primary contact name and email address are required.')) {
|
|
|
|
|
$lq__event_obj.contact_li_json[0].unlock = true;
|
|
|
|
|
if (!$idaa_slct.event_obj.contact_li_json[0]) {
|
|
|
|
|
$idaa_slct.event_obj.contact_li_json[0] = {};
|
|
|
|
|
}
|
|
|
|
|
$idaa_slct.event_obj.contact_li_json[0].unlock = true;
|
|
|
|
|
} else {
|
|
|
|
|
$lq__event_obj.contact_li_json[0].unlock = false;
|
|
|
|
|
$idaa_slct.event_obj.contact_li_json[0].unlock = false;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}}
|
|
|
|
|
@@ -1074,7 +1046,7 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
|
|
|
|
{:else}
|
|
|
|
|
<button type="button" class="ae_btn ae_smaller ae_btn_info"
|
|
|
|
|
on:click|preventDefault={() => {
|
|
|
|
|
$lq__event_obj.contact_li_json[0].unlock = false;
|
|
|
|
|
$idaa_slct.event_obj.contact_li_json[0].unlock = false;
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<span class="fas fa-unlock" title="Field is unlocked"></span>
|
|
|
|
|
@@ -1083,7 +1055,7 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
<label for="contact_1_full_name">Full name
|
|
|
|
|
{#if !($ae_loc.trusted_access || $lq__event_obj?.contact_li_json[0].unlock)}
|
|
|
|
|
{#if !($ae_loc.administrator_access || $idaa_slct.event_obj?.contact_li_json[0]?.unlock)}
|
|
|
|
|
<span class="fas fa-lock" title="Field is locked"></span>
|
|
|
|
|
{:else}
|
|
|
|
|
<span class="fas fa-unlock" title="Field is unlocked"></span>
|
|
|
|
|
@@ -1095,12 +1067,12 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
|
|
|
|
placeholder="Full name"
|
|
|
|
|
value={($lq__event_obj?.contact_li_json && $lq__event_obj?.contact_li_json[0] && $lq__event_obj?.contact_li_json[0].full_name ? $lq__event_obj?.contact_li_json[0].full_name : '')}
|
|
|
|
|
autocomplete="name"
|
|
|
|
|
readonly={!($ae_loc.trusted_access || $lq__event_obj?.contact_li_json[0].unlock)}
|
|
|
|
|
readonly={!($ae_loc.trusted_access || $idaa_slct.event_obj?.contact_li_json[0]?.unlock)}
|
|
|
|
|
required={!$ae_loc.trusted_access}
|
|
|
|
|
>
|
|
|
|
|
</label>
|
|
|
|
|
<label for="contact_1_email">Email
|
|
|
|
|
{#if !($ae_loc.trusted_access || $lq__event_obj?.contact_li_json[0].unlock)}
|
|
|
|
|
{#if !($ae_loc.administrator_access || $idaa_slct.event_obj?.contact_li_json[0]?.unlock)}
|
|
|
|
|
<span class="fas fa-lock" title="Field is locked"></span>
|
|
|
|
|
{:else}
|
|
|
|
|
<span class="fas fa-unlock" title="Field is unlocked"></span>
|
|
|
|
|
@@ -1113,7 +1085,7 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
|
|
|
|
placeholder="Email"
|
|
|
|
|
value={($lq__event_obj?.contact_li_json && $lq__event_obj?.contact_li_json[0] && $lq__event_obj?.contact_li_json[0].email ? $lq__event_obj?.contact_li_json[0].email : '')}
|
|
|
|
|
autocomplete="email"
|
|
|
|
|
readonly={!($ae_loc.trusted_access || $lq__event_obj?.contact_li_json[0].unlock)}
|
|
|
|
|
readonly={!($ae_loc.trusted_access || $idaa_slct.event_obj?.contact_li_json[0].unlock)}
|
|
|
|
|
required={!$ae_loc.trusted_access}
|
|
|
|
|
>
|
|
|
|
|
</label>
|
|
|
|
|
@@ -1173,12 +1145,12 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<span class="fas fa-eye m-1"></span>
|
|
|
|
|
Show/Hide Admin
|
|
|
|
|
{$idaa_loc.show__admin_options ? 'Hide' : 'Show'} Admin?
|
|
|
|
|
</button>
|
|
|
|
|
</h3>
|
|
|
|
|
|
|
|
|
|
<span
|
|
|
|
|
class:hidden={!$ae_loc.trusted_access && !$idaa_loc.show__admin_options}
|
|
|
|
|
class:hidden={!$ae_loc.trusted_access || !$idaa_loc.show__admin_options}
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
<span
|
|
|
|
|
@@ -1264,7 +1236,11 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
|
|
|
|
disabled={(disable_submit_btn)}
|
|
|
|
|
class="ae_btn btn_primary btn btn-primary variant-ghost-primary hover:variant-filled-primary transition"
|
|
|
|
|
>
|
|
|
|
|
<span class="fas fa-check m-1"></span> Save
|
|
|
|
|
{#await prom_api__event_obj}
|
|
|
|
|
<span class="fas fa-spinner fa-spin m-1"></span> Saving
|
|
|
|
|
{:then}
|
|
|
|
|
<span class="fas fa-save m-1"></span> Save
|
|
|
|
|
{/await}
|
|
|
|
|
</button>
|
|
|
|
|
{:else}
|
|
|
|
|
<button
|
|
|
|
|
@@ -1276,7 +1252,11 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
|
|
|
|
}}
|
|
|
|
|
class="ae_btn btn_primary btn btn-primary variant-ghost-primary hover:variant-filled-primary transition"
|
|
|
|
|
>
|
|
|
|
|
<span class="fas fa-plus m-1"></span> Save New Event
|
|
|
|
|
{#await prom_api__event_obj}
|
|
|
|
|
<span class="fas fa-spinner fa-spin m-1"></span> Saving
|
|
|
|
|
{:then}
|
|
|
|
|
<span class="fas fa-plus m-1"></span> Save New Event
|
|
|
|
|
{/await}
|
|
|
|
|
</button>
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
|