diff --git a/src/lib/ae_events_stores.ts b/src/lib/ae_events_stores.ts index 14ad53fd..4816ffa0 100644 --- a/src/lib/ae_events_stores.ts +++ b/src/lib/ae_events_stores.ts @@ -138,6 +138,7 @@ let events_session_data_struct: key_val = { entered_passcode: null, tmp_license: { + 'index': null, // 'agree' : false, // The user must agree to the license agreement. 'email': '', 'full_name': '', diff --git a/src/routes/events_leads/exhibit/[slug]/+page.svelte b/src/routes/events_leads/exhibit/[slug]/+page.svelte index a307aa67..3aa6d3dc 100644 --- a/src/routes/events_leads/exhibit/[slug]/+page.svelte +++ b/src/routes/events_leads/exhibit/[slug]/+page.svelte @@ -182,10 +182,19 @@ $: if ($events_trigger == 'load__event_exhibit_obj' && $events_slct.exhibit_id) async function handle_submit_form_license_update(event) { console.log('*** handle_submit_form_license_update() ***'); + console.log(`$events_sess.leads=`, $events_sess.leads.tmp_license); + // Data in let tmp_obj = $event_exhibit_obj; + console.log('tmp_obj:', tmp_obj); - if ($events_sess.leads.tmp_license.index >= 0 && $events_sess.leads.tmp_license.email && $events_sess.leads.tmp_license.full_name) { + if ($events_sess.leads.tmp_license.index === null && $events_sess.leads.tmp_license.email && $events_sess.leads.tmp_license.full_name) { + if (!Array.isArray(tmp_obj.license_li_json)) { + tmp_obj.license_li_json = []; + } + tmp_obj.license_li_json.push($events_sess.leads.tmp_license); + console.log('Add license:', tmp_obj); + } else if ($events_sess.leads.tmp_license.index >= 0 && $events_sess.leads.tmp_license.email && $events_sess.leads.tmp_license.full_name) { tmp_obj.license_li_json[$events_sess.leads.tmp_license.index] = $events_sess.leads.tmp_license; console.log('Update license:', tmp_obj); } else if ($events_sess.leads.tmp_license.index >= 0 && !$events_sess.leads.tmp_license.email && !$events_sess.leads.tmp_license.full_name) { @@ -196,12 +205,6 @@ async function handle_submit_form_license_update(event) { tmp_obj.license_li_json.splice($events_sess.leads.tmp_license.index, 1); console.log('Removed license:', tmp_obj); - } else if ($events_sess.leads.tmp_license.email && $events_sess.leads.tmp_license.full_name) { - if (!Array.isArray(tmp_obj.license_li_json)) { - tmp_obj.license_li_json = []; - } - tmp_obj.license_li_json.push($events_sess.leads.tmp_license); - console.log('Add license:', tmp_obj); } else if ($events_sess.leads.tmp_license.index === -1) { // console.log('No license email and full_name to add or update and index is -1. This was already deleted based on the old index number! Just submit what is already there?', tmp_obj); } else { @@ -605,6 +608,7 @@ function send_init_confirm_email({to_email}) { on:click={() => { // let tmp_obj = $event_exhibit_obj; $events_sess.leads.tmp_license = { + 'index': null, // 'index': $event_exhibit_obj?.license_li_json.length, // This is the index of the new license in the list. 'email': '', // test+z@oneskyit.com 'full_name': '', // Scott X @@ -798,7 +802,7 @@ function send_init_confirm_email({to_email}) { type="button" on:click={() => { console.log('Remove License'); - if (confirm('Are you sure you want to remove this license?')) { + if (confirm('Are you sure you want to remove this license? This only clears their name and email address so that it can be used by someone else. (The same as editing it.')) { // This still needs to be saved to the database. // Signal that this license should be removed from the list. // $events_sess.leads.tmp_license.index = -1; @@ -807,21 +811,10 @@ function send_init_confirm_email({to_email}) { $events_sess.leads.tmp_license.full_name = null; handle_submit_form_license_update(event); } - - // let tmp_obj = $event_exhibit_obj; - // tmp_obj?.license_li_json.splice(index, 1); - // console.log('Remove License:', tmp_obj); - // db_events.exhibits.put(tmp_obj); - - // This still needs to be saved to the database. - // $events_sess.leads.tmp_license.index = -1; - // Signal that this license should be removed from the list. - // $events_sess.leads.tmp_license.index = index; - // $events_sess.leads.tmp_license.email = null; - // $events_sess.leads.tmp_license.full_name = null; - // handle_submit_form_license_update(event); }} - class="btn btn-sm variant-soft-error"> + class:hidden={!$ae_loc.trusted_access} + class="btn btn-sm variant-soft-error" + > Remove @@ -967,15 +960,9 @@ function send_init_confirm_email({to_email}) { {/if} --> - - +
+ Do not use the same email address for more than one license. The email address is used as the key to log in and is linked to leads added. The full name is used to help identify the staff person. +
+ + {#if $ae_loc.trusted_access}