Improved downloading export files.
This commit is contained in:
@@ -319,7 +319,12 @@ async function handle_download_export__obj_type(
|
||||
}
|
||||
params['return_file'] = true;
|
||||
|
||||
ae_promises.download__sponsorship_export_file = await api.get_object({api_cfg: api_cfg, endpoint: endpoint, params: params, return_blob: return_file, filename: filename, auto_download: auto_download, log_lvl: log_lvl});
|
||||
// let clean_filename = filename.replace(/[^a-z0-9]/gi, '_');
|
||||
// let clean_filename = filename.replace(/[^a-z0-9\[\]-]/gi, '_');
|
||||
let clean_filename = filename.replace(/[^a-zA-Z0-9\[\]-_.]/gi, '_');
|
||||
// let clean_filename = filename.replace(/[^a-zA-Z0-9\[\]-\._ ]/gi, '_');
|
||||
|
||||
ae_promises.download__sponsorship_export_file = await api.get_object({api_cfg: api_cfg, endpoint: endpoint, params: params, return_blob: return_file, filename: clean_filename, auto_download: auto_download, log_lvl: log_lvl});
|
||||
|
||||
console.log('ae_promises.download__sponsorship_export_file:', ae_promises.download__sponsorship_export_file);
|
||||
return ae_promises.download__sponsorship_export_file;
|
||||
|
||||
@@ -4,7 +4,10 @@ type key_val = {
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
export let iso_datetime_formatter = function iso_datetime_formatter(raw_datetime: string|Date, named_format: string) {
|
||||
export let iso_datetime_formatter = function iso_datetime_formatter(
|
||||
raw_datetime: null|string|Date = null,
|
||||
named_format: string = 'datetime_iso_no_seconds', // date_iso, datetime_iso_no_seconds
|
||||
) {
|
||||
// console.log('*** iso_datetime_formatter() ***');
|
||||
|
||||
// https://en.wikipedia.org/wiki/ISO_8601
|
||||
|
||||
@@ -160,7 +160,7 @@ let refresh_leads_list = setInterval(function () {
|
||||
<button
|
||||
type="button"
|
||||
on:click={() => {
|
||||
if (!confirm('Download exported data Excel file?')) {
|
||||
if (!confirm('Download data exported to an Excel file?')) {
|
||||
return false;
|
||||
}
|
||||
ae_promises.download__exhibit_tracking_export = events_func.handle_download_export__event_exhibit_tracking({
|
||||
|
||||
@@ -404,7 +404,7 @@ $: if ($events_slct.exhibit_id) {
|
||||
<button
|
||||
type="button"
|
||||
on:click={() => {
|
||||
if (!confirm('Download exported data Excel file?')) {
|
||||
if (!confirm('Download data exported to an Excel file?')) {
|
||||
return false;
|
||||
}
|
||||
ae_promises.download__exhibit_tracking_export = events_func.handle_download_export__event_exhibit_tracking({
|
||||
|
||||
@@ -395,7 +395,7 @@ async function handle_load_ae_obj_id__event_presenter({event_presenter_id, try_c
|
||||
for_obj_id: $slct.account_id,
|
||||
file_type: 'Excel',
|
||||
return_file: true,
|
||||
filename: `speakers_export_${$ae_loc.account_code.replaceAll(' ', '_')}.xlsx`,
|
||||
filename: `${$ae_loc.account_code}_Speakers_Hub_export_${ae_util.iso_datetime_formatter()}.xlsx`,
|
||||
auto_download: true,
|
||||
log_lvl: 2
|
||||
});
|
||||
|
||||
@@ -397,15 +397,17 @@ async function handle_load_ae_obj_id__sponsorship({sponsorship_id, try_cache=fal
|
||||
<button
|
||||
type="button"
|
||||
on:click={() => {
|
||||
if (!confirm('Download exported data Excel file?')) {
|
||||
if (!confirm('Download data exported to an Excel file?')) {
|
||||
return false;
|
||||
}
|
||||
ae_promises.download__sponsorships_export = spons_func.handle_download_export__sponsorship({
|
||||
ae_promises.download__sponsorships_export = core_func.handle_download_export__obj_type({
|
||||
api_cfg: $ae_api,
|
||||
account_id: $slct.account_id,
|
||||
get_obj_type: 'event_presenter',
|
||||
for_obj_type: 'account',
|
||||
for_obj_id: $slct.account_id,
|
||||
file_type: 'Excel',
|
||||
return_file: true,
|
||||
filename: `sponsors_export_${$ae_loc.account_code.replaceAll(' ', '_')}.xlsx`,
|
||||
filename: `${$ae_loc.account_code}_Sponsor_Hub_export_${ae_util.iso_datetime_formatter()}.xlsx`,
|
||||
auto_download: true,
|
||||
log_lvl: 2
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user