Adding back in the sponsorship export stuff I was working on... Annoyed.

This commit is contained in:
Scott Idem
2024-04-23 15:53:43 -04:00
parent a87b4d53a0
commit 38e73cb40c
4 changed files with 74 additions and 22 deletions

View File

@@ -147,6 +147,9 @@ export async function load({ fetch, params, parent, route, url }) { // params, r
ae_api_init['headers']['x-no-account-id'] = null;
ae_loc_init['account_id'] = site_domain_results.account_id_random;
ae_loc_init['account_code'] = site_domain_results.account_code; // Useful for export file naming
ae_loc_init['account_name'] = site_domain_results.account_name; // Generally useful for display
ae_loc_init['site_id'] = site_domain_results.site_id_random;
ae_loc_init['site_domain_id'] = site_domain_results.site_domain_id_random;
ae_loc_init['site_enable'] = site_domain_results.enable;

View File

@@ -21,11 +21,13 @@ import { api } from '$lib/api';
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
import { ae_util } from '$lib/ae_utils';
import type { key_val } from '$lib/ae_stores';
import { spons_func } from '$lib/ae_sponsorships_functions';
import Edit_modal_sponsorship_obj from './10_edit_modal__sponsorship_obj.svelte';
import List_sponsorship_obj from './10_list__sponsorship_obj.svelte';
import View_modal_sponsorship_obj from './10_view_modal__sponsorship_obj.svelte';
let ae_promises: key_val = {};
// Editing
const modalComponentEditSponsorshipObj: ModalComponent = { ref: Edit_modal_sponsorship_obj, props: {container_class_li: 'w-full p-4 space-y-4 card ae_modal_scrollfix'} };
@@ -392,32 +394,38 @@ async function handle_load_ae_obj_id__sponsorship({sponsorship_id, try_cache=fal
Start Sponsor Submission Form
</button>
<!-- <button
{#if $ae_loc.trusted_access}
<button
type="button"
on:click={() => {
console.log('Open drawer');
drawerStore.open(drawer_settings_x);
}}
>
Open Drawer X
</button> -->
if (!confirm('Download exported data Excel file?')) {
return false;
}
ae_promises.download__sponsorships_export = spons_func.handle_download_export__sponsorship({
api_cfg: $ae_api,
account_id: $slct.account_id,
file_type: 'Excel',
return_file: true,
filename: `lead_retrieval_export_${$ae_loc.account_code.replaceAll(' ', '_')}.xlsx`,
auto_download: true,
log_lvl: 2
});
<!-- <button
on:click={() => {
console.log('Open drawer');
drawerStore.open(drawer_settings_y);
}}
class="btn btn-sm variant-ghost-primary w-48 mb-1 export_data_btn"
title={`Download sponsorship data for ${$ae_loc.account_name}`}
>
Open Drawer Y
</button> -->
<!-- <button
on:click={() => {
console.log('Open drawer');
drawerStore.open(drawer_settings_edit);
}}
>
Open Drawer Edit
</button> -->
{#await ae_promises.download__sponsorship_export}
<span class="fas fa-spinner fa-spin"></span>
<!-- <span class="loading-text">
Downloading...
</span> -->
{:then}
<!-- Done? -->
{/await}
<span class="fas fa-download mx-1"></span> Export Data
</button>
{/if}
</section>
<section class="sponsorships_list ae_h_scrollfix">