Export now works for Sponsors, Speakers, and Leads
This commit is contained in:
@@ -283,10 +283,53 @@ async function handle_update_ae_obj_id_crud(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async function handle_download_export__obj_type(
|
||||||
|
{
|
||||||
|
api_cfg,
|
||||||
|
get_obj_type, // The type of object to return: event_badge, event_presenter, sponsorship, etc.
|
||||||
|
for_obj_type, // Usually for an account, event, event_exhibit, or sponsorship_cfg
|
||||||
|
for_obj_id, // The ID of the object
|
||||||
|
file_type='CSV', // 'CSV' or 'Excel'
|
||||||
|
return_file=true,
|
||||||
|
filename='no_filename.csv',
|
||||||
|
auto_download=false,
|
||||||
|
params={}, // key value object is expected
|
||||||
|
log_lvl=0
|
||||||
|
} : {
|
||||||
|
api_cfg: any,
|
||||||
|
get_obj_type: string,
|
||||||
|
for_obj_type: string,
|
||||||
|
for_obj_id: string,
|
||||||
|
file_type?: string,
|
||||||
|
return_file?: boolean,
|
||||||
|
filename?: string,
|
||||||
|
auto_download?: boolean,
|
||||||
|
params?: key_val,
|
||||||
|
log_lvl?: number
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
console.log('*** stores_event_api.js: get_sponsorship_export() ***');
|
||||||
|
|
||||||
|
const endpoint = `/v2/crud/${get_obj_type}/list`;
|
||||||
|
params['for_obj_type'] = for_obj_type;
|
||||||
|
params['for_obj_id'] = for_obj_id;
|
||||||
|
|
||||||
|
if (file_type == 'CSV' || file_type == 'Excel') {
|
||||||
|
params['file_type'] = file_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});
|
||||||
|
|
||||||
|
console.log('ae_promises.download__sponsorship_export_file:', ae_promises.download__sponsorship_export_file);
|
||||||
|
return ae_promises.download__sponsorship_export_file;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
let export_obj = {
|
let export_obj = {
|
||||||
handle_load_ae_obj_id__site_domain: handle_load_ae_obj_id__site_domain,
|
handle_load_ae_obj_id__site_domain: handle_load_ae_obj_id__site_domain,
|
||||||
handle_load_ae_obj_code__data_store: handle_load_ae_obj_code__data_store,
|
handle_load_ae_obj_code__data_store: handle_load_ae_obj_code__data_store,
|
||||||
handle_update_ae_obj_id_crud: handle_update_ae_obj_id_crud,
|
handle_update_ae_obj_id_crud: handle_update_ae_obj_id_crud,
|
||||||
|
handle_download_export__obj_type: handle_download_export__obj_type,
|
||||||
};
|
};
|
||||||
export let core_func = export_obj;
|
export let core_func = export_obj;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ const modalStore = getModalStore();
|
|||||||
|
|
||||||
import { api } from '$lib/api';
|
import { api } from '$lib/api';
|
||||||
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
|
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
|
||||||
|
import { core_func } from '$lib/ae_core_functions';
|
||||||
import { ae_util } from '$lib/ae_utils';
|
import { ae_util } from '$lib/ae_utils';
|
||||||
import type { key_val } from '$lib/ae_stores';
|
import type { key_val } from '$lib/ae_stores';
|
||||||
|
|
||||||
@@ -387,12 +388,14 @@ async function handle_load_ae_obj_id__event_presenter({event_presenter_id, try_c
|
|||||||
if (!confirm('Download exported data Excel file?')) {
|
if (!confirm('Download exported data Excel file?')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ae_promises.download__sponsorships_export = spons_func.handle_download_export__sponsorship({
|
ae_promises.download__events_speakers_export = core_func.handle_download_export__obj_type({
|
||||||
api_cfg: $ae_api,
|
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',
|
file_type: 'Excel',
|
||||||
return_file: true,
|
return_file: true,
|
||||||
filename: `lead_retrieval_export_${$ae_loc.account_code.replaceAll(' ', '_')}.xlsx`,
|
filename: `speakers_export_${$ae_loc.account_code.replaceAll(' ', '_')}.xlsx`,
|
||||||
auto_download: true,
|
auto_download: true,
|
||||||
log_lvl: 2
|
log_lvl: 2
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ const modalStore = getModalStore();
|
|||||||
|
|
||||||
import { api } from '$lib/api';
|
import { api } from '$lib/api';
|
||||||
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
|
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
|
||||||
|
import { core_func } from '$lib/ae_core_functions';
|
||||||
import { ae_util } from '$lib/ae_utils';
|
import { ae_util } from '$lib/ae_utils';
|
||||||
import type { key_val } from '$lib/ae_stores';
|
import type { key_val } from '$lib/ae_stores';
|
||||||
import { spons_func } from '$lib/ae_sponsorships_functions';
|
import { spons_func } from '$lib/ae_sponsorships_functions';
|
||||||
@@ -404,7 +405,7 @@ async function handle_load_ae_obj_id__sponsorship({sponsorship_id, try_cache=fal
|
|||||||
account_id: $slct.account_id,
|
account_id: $slct.account_id,
|
||||||
file_type: 'Excel',
|
file_type: 'Excel',
|
||||||
return_file: true,
|
return_file: true,
|
||||||
filename: `lead_retrieval_export_${$ae_loc.account_code.replaceAll(' ', '_')}.xlsx`,
|
filename: `sponsors_export_${$ae_loc.account_code.replaceAll(' ', '_')}.xlsx`,
|
||||||
auto_download: true,
|
auto_download: true,
|
||||||
log_lvl: 2
|
log_lvl: 2
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user