Updates to clean up the lookups for time zones, countries, and subdivisions.

This commit is contained in:
Scott Idem
2025-01-13 15:28:24 -05:00
parent 8d4c770f19
commit 321c48513f
7 changed files with 64 additions and 46 deletions

View File

@@ -128,15 +128,15 @@ export async function get_ae_obj_li_for_obj_id_crud_v2(
endpoint = `/crud/sponsorship/list`;
// } else if (obj_type == 'user') {
// endpoint = `/crud/user/list`;
// } else if (obj_type == 'lu' && for_obj_type == 'country_subdivision') {
// endpoint = `/crud/lu/country_subdivision/list`;
// for_obj_type = null;
// } else if (obj_type == 'lu' && for_obj_type == 'country') {
// endpoint = `/crud/lu/country/list`;
// for_obj_type = null;
// } else if (obj_type == 'lu' && for_obj_type == 'time_zone') {
// endpoint = `/crud/lu/time_zone/list`;
// for_obj_type = null;
} else if (obj_type == 'lu' && for_obj_type == 'country_subdivision') {
endpoint = `/crud/lu/country_subdivision/list`;
// for_obj_type = null;
} else if (obj_type == 'lu' && for_obj_type == 'country') {
endpoint = `/crud/lu/country/list`;
// for_obj_type = null;
} else if (obj_type == 'lu' && for_obj_type == 'time_zone') {
endpoint = `/crud/lu/time_zone/list`;
// for_obj_type = null;
} else {
console.log(`Unknown object type: ${obj_type}`);
return false;

View File

@@ -11,37 +11,42 @@ export async function load_ae_obj_li__country(
{
api_cfg,
// account_id,
enabled = 'enabled',
hidden = 'not_hidden',
limit = 299,
offset = 0,
order_by_li = {'sort': 'DESC', 'english_short_name': 'ASC', 'alpha_2_code': 'ASC'},
params = {},
try_cache = true,
log_lvl = 0
}: {
api_cfg: any,
// account_id: string,
enabled?: string,
hidden?: string,
limit?: number,
offset?: number,
order_by_li?: key_val
params?: key_val,
try_cache?: boolean,
log_lvl?: number
}
) {
console.log(`*** load_ae_obj_li__country() ***`);
let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled
let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden
let limit: number = (params.qry__limit ?? 300); // Actual is 249 in 2024
let offset: number = (params.qry__offset ?? 0); // 0
let order_by_li = {'sort': 'DESC', 'english_short_name': 'ASC', 'alpha_2_code': 'ASC'};
if (log_lvl) {
console.log(`*** load_ae_obj_li__country() ***`);
}
let params_json: key_val = {};
// console.log('params_json:', params_json);
ae_promises.load__country_li = await api.get_ae_obj_li_for_obj_id_crud({
ae_promises.load__country_li = await api.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg,
obj_type: 'lu',
for_obj_type: 'country',
// for_obj_id: account_id,
use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config.
use_alt_base: false, // NOTE: This will use the base_name_alt value instead of the base_name value
use_alt_tbl: false,
use_alt_mdl: false,
enabled: enabled,
hidden: hidden,
order_by_li: order_by_li,

View File

@@ -11,12 +11,22 @@ export async function load_ae_obj_li__country_subdivision(
{
api_cfg,
// account_id,
enabled = 'enabled',
hidden = 'not_hidden',
limit = 399,
offset = 0,
order_by_li = {'sort': 'DESC', 'name': 'ASC', 'code': 'ASC'},
params = {},
try_cache = true,
log_lvl = 0
}: {
api_cfg: any,
// account_id: string,
enabled?: string,
hidden?: string,
limit?: number,
offset?: number,
order_by_li?: key_val
params?: key_val,
try_cache?: boolean,
log_lvl?: number
@@ -26,24 +36,17 @@ export async function load_ae_obj_li__country_subdivision(
console.log(`*** load_ae_obj_li__country_subdivision() ***`);
}
let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled
let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden
let limit: number = (params.qry__limit ?? 300); // Actual is 249 in 2024
let offset: number = (params.qry__offset ?? 0); // 0
let order_by_li = {'sort': 'DESC', 'name': 'ASC', 'code': 'ASC'};
let params_json: key_val = {};
// console.log('params_json:', params_json);
ae_promises.load__country_subdivision_li = await api.get_ae_obj_li_for_obj_id_crud({
ae_promises.load__country_subdivision_li = await api.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg,
obj_type: 'lu',
for_obj_type: 'country_subdivision',
// for_obj_id: account_id,
use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config.
use_alt_base: false, // NOTE: This will use the base_name_alt value instead of the base_name value
use_alt_tbl: false,
use_alt_mdl: false,
enabled: enabled,
hidden: hidden,
order_by_li: order_by_li,

View File

@@ -11,39 +11,46 @@ export async function load_ae_obj_li__time_zone(
{
api_cfg,
// account_id,
enabled = 'enabled',
hidden = 'not_hidden',
limit = 99,
offset = 0,
// order_by_li = {'priority': 'DESC', 'group': 'ASC', 'sort': 'DESC', 'name': 'ASC'},
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'name': 'ASC'},
params = {},
try_cache = true,
log_lvl = 0
}: {
api_cfg: any,
// account_id: string,
enabled?: string,
hidden?: string,
limit?: number,
offset?: number,
order_by_li?: key_val,
params?: key_val,
try_cache?: boolean,
log_lvl?: number
}
) {
console.log(`*** load_ae_obj_li__time_zone() ***`);
let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled
let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden
let limit: number = (params.qry__limit ?? 625); // Actual is 594 in 2024
let offset: number = (params.qry__offset ?? 0); // 0
if (log_lvl) {
console.log(`*** load_ae_obj_li__time_zone() ***`);
}
let params_json: key_val = {};
// console.log('params_json:', params_json);
ae_promises.load__time_zone_li = await api.get_ae_obj_li_for_obj_id_crud({
ae_promises.load__time_zone_li = await api.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg,
obj_type: 'lu',
for_obj_type: 'time_zone',
// for_obj_id: account_id,
use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config.
use_alt_base: false, // NOTE: This will use the base_name_alt value instead of the base_name value
use_alt_tbl: true, // NOTE: Using this with the time zones to use the view named "v_lu_time_zone_cust"
use_alt_mdl: false,
enabled: enabled,
hidden: hidden,
order_by_li: {'name': 'ASC'},
order_by_li: order_by_li,
limit: limit,
offset: offset,
params_json: params_json,

View File

@@ -116,7 +116,10 @@ ae_tmp.show__direct_download = $ae_loc.core?.show__direct_download ?? false;
<ol>
{#each $lq__hosted_file_obj_li as hosted_file_obj}
<li>
{hosted_file_obj.filename}
<a href="" class="underline text-blue-500">
{hosted_file_obj.filename}
</a>
{ae_util.format_bytes(hosted_file_obj.size)}
</li>
{/each}
</ol>

View File

@@ -410,6 +410,7 @@ function handle_submit_form(event) {
<h2 class="h2">Step X: Manage Files</h2>
<!-- Show files for this account -->
<Element_manage_hosted_file_li_wrap
link_to_type={'account'}
@@ -420,7 +421,6 @@ function handle_submit_form(event) {
/>
The end
</section>

View File

@@ -95,13 +95,13 @@ if ($idaa_slct.event_id) {
// $ae_loc.lu_time_zone_list = [];
if ($ae_loc.lu_time_zone_list && $ae_loc.lu_time_zone_list.length > 0) {
// console.log('Already have time zone list!', $ae_loc.lu_time_zone_list);
console.log('Already have time zone list!', $ae_loc.lu_time_zone_list);
} else {
console.log('No time zone list');
let lu_time_zone_li_get_promise = core_func.load_ae_obj_li__time_zone({
api_cfg: $ae_api,
log_lvl: 1
log_lvl: log_lvl
})
.then(function (lu_time_zone_li_get_result) {
if (lu_time_zone_li_get_result) {
@@ -154,7 +154,7 @@ if (lu_country_list && lu_country_list.length > 50 && Math.random() > 0.8) {
let lu_country_li_get_promise = core_func.load_ae_obj_li__country({
api_cfg: $ae_api,
log_lvl: 2
log_lvl: 1
})
.then(function (lu_country_li_get_result) {
if (lu_country_li_get_result) {