Bug fixes for enable related fields.

This commit is contained in:
Scott Idem
2024-11-19 16:53:24 -05:00
parent fc8ee53724
commit fea392eff7
4 changed files with 132 additions and 52 deletions

View File

@@ -74,11 +74,12 @@ async function handle_submit_form(event: any) {
post_comment_do['group'] = null;
}
// Check if the enable exists and is a string
console.log(`post_comment_di.enable = ${post_comment_di.enable}`);
// if (typeof post_comment_di.enable !== 'undefined') {
post_comment_do['enable'] = !!post_comment_di.enable;
// }
// NOTE: We only want to set enable value if the input is defined.
if (typeof post_comment_di.enable !== 'undefined') {
post_comment_do.enable = post_comment_di.enable;
}
// NOTE: We want to always default to false if the input is not defined.
// post_comment_do.enable = post_comment_di.enable ?? false;
// // Check if the notes_new_html exists and is a string
// if (typeof $idaa_slct.post_comment_obj.notes_new_html === 'string') {
@@ -338,7 +339,7 @@ async function handle_delete_post_comment_obj(
{#if $ae_loc.trusted_access}
<button
type="button"
class="btn btn-sm variant-soft-secondary float-right"
class="btn btn-sm variant-soft-warning float-right"
on:click={() => {
$idaa_loc.bb.show__admin_options = !$idaa_loc.bb.show__admin_options;
}}

View File

@@ -78,8 +78,8 @@ async function handle_submit_form(event: any) {
post_do['email'] = post_di.email;
post_do['notify'] = post_di.notify;
post_do['hide'] = !!post_di.hide;
post_do['priority'] = !!post_di.priority;
post_do['hide'] = post_di.hide;
post_do['priority'] = post_di.priority;
if (post_di.sort) {
post_do['sort'] = Number(post_di.sort);
} else {
@@ -91,8 +91,14 @@ async function handle_submit_form(event: any) {
post_do['group'] = null;
}
// console.log(`post_di.enable = ${post_di.enable}`);
post_do['enable'] = !!post_di.enable;
// NOTE: We only want to set enable value if the input is defined.
if (typeof post_di.enable !== 'undefined') {
post_do.enable = post_di.enable;
}
// NOTE: We want to always default to false if the input is not defined.
// post_do['enable'] = !!post_di.enable;
console.log(`post_di.enable = ${post_di.enable}`);
console.log(`post_do.enable = ${post_do.enable}`);
// Check if the notes_new_html exists and is a string
if (typeof $idaa_slct.post_obj.notes_new_html === 'string') {
@@ -118,7 +124,8 @@ async function handle_submit_form(event: any) {
return false;
}
$idaa_slct.post_id = post_obj_create_result.obj_id_random;
$idaa_slct.post_id = post_obj_create_result.post_id_random;
// $idaa_slct.post_obj = post_obj_create_result;
return post_obj_create_result;
})
@@ -627,7 +634,7 @@ function send_staff_notification_email() {
<input
type="text"
name="email"
value={($idaa_slct.post_obj.email ? $idaa_slct.post_obj.email : $idaa_loc.novi_email)}
value={($idaa_slct.post_obj.email ? $idaa_slct.post_obj.email : $idaa_loc.novi_email ?? '')}
readonly={!$ae_loc.trusted_access}
class="input w-96"
>
@@ -672,7 +679,7 @@ function send_staff_notification_email() {
{#if $ae_loc.trusted_access}
<button
type="button"
class="btn btn-sm float-right"
class="btn btn-sm variant-soft-warning float-right"
class:variant-filled-secondary={$idaa_loc.bb.show__admin_options}
class:variant-soft-secondary={!$idaa_loc.bb.show__admin_options}
on:click={() => {