Cleaned up Journal Entry update functions
This commit is contained in:
@@ -268,7 +268,8 @@ export async function create_ae_obj__journal(
|
|||||||
db_save_ae_obj_li__journal(
|
db_save_ae_obj_li__journal(
|
||||||
{
|
{
|
||||||
obj_type: 'journal',
|
obj_type: 'journal',
|
||||||
obj_li: [journal_obj_create_result]
|
obj_li: [journal_obj_create_result],
|
||||||
|
log_lvl: log_lvl
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return journal_obj_create_result;
|
return journal_obj_create_result;
|
||||||
@@ -375,7 +376,8 @@ export async function update_ae_obj__journal(
|
|||||||
if (journal_obj_update_result) {
|
if (journal_obj_update_result) {
|
||||||
if (try_cache) {
|
if (try_cache) {
|
||||||
db_save_ae_obj_li__journal({
|
db_save_ae_obj_li__journal({
|
||||||
obj_type: 'journal', obj_li: [journal_obj_update_result]
|
obj_type: 'journal', obj_li: [journal_obj_update_result],
|
||||||
|
log_lvl: log_lvl
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return journal_obj_update_result;
|
return journal_obj_update_result;
|
||||||
|
|||||||
@@ -189,7 +189,8 @@ export async function create_ae_obj__journal_entry(
|
|||||||
await db_save_ae_obj_li__journal_entry(
|
await db_save_ae_obj_li__journal_entry(
|
||||||
{
|
{
|
||||||
obj_type: 'journal_entry',
|
obj_type: 'journal_entry',
|
||||||
obj_li: [journal_entry_obj_create_result]
|
obj_li: [journal_entry_obj_create_result],
|
||||||
|
log_lvl: log_lvl
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return journal_entry_obj_create_result;
|
return journal_entry_obj_create_result;
|
||||||
@@ -294,7 +295,8 @@ export async function update_ae_obj__journal_entry(
|
|||||||
if (journal_entry_obj_update_result) {
|
if (journal_entry_obj_update_result) {
|
||||||
if (try_cache) {
|
if (try_cache) {
|
||||||
await db_save_ae_obj_li__journal_entry({
|
await db_save_ae_obj_li__journal_entry({
|
||||||
obj_type: 'journal_entry', obj_li: [journal_entry_obj_update_result]
|
obj_type: 'journal_entry', obj_li: [journal_entry_obj_update_result],
|
||||||
|
log_lvl: log_lvl
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return journal_entry_obj_update_result;
|
return journal_entry_obj_update_result;
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import { ae_util } from '$lib/ae_utils/ae_utils';
|
|||||||
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
||||||
import { journals_loc, journals_sess, journals_slct, journals_trig, journals_prom } from '$lib/ae_journals/ae_journals_stores';
|
import { journals_loc, journals_sess, journals_slct, journals_trig, journals_prom } from '$lib/ae_journals/ae_journals_stores';
|
||||||
import { journals_func } from '$lib/ae_journals/ae_journals_functions';
|
import { journals_func } from '$lib/ae_journals/ae_journals_functions';
|
||||||
|
import { updated } from '$app/state';
|
||||||
|
|
||||||
console.log(`ae_comp__journal_entry_obj_id_view.svelte`);
|
console.log(`ae_comp__journal_entry_obj_id_view.svelte`);
|
||||||
|
|
||||||
@@ -101,6 +102,8 @@ $effect(() => {
|
|||||||
console.log('TEST: IDB has changed and not flagged as updated_obj!!!');
|
console.log('TEST: IDB has changed and not flagged as updated_obj!!!');
|
||||||
updated_idb = true;
|
updated_idb = true;
|
||||||
// orig_entry_obj = { ...$lq__journal_entry_obj };
|
// orig_entry_obj = { ...$lq__journal_entry_obj };
|
||||||
|
}
|
||||||
|
|
||||||
// } else if (
|
// } else if (
|
||||||
// // !updated_obj
|
// // !updated_obj
|
||||||
// // &&
|
// // &&
|
||||||
@@ -110,9 +113,10 @@ $effect(() => {
|
|||||||
// ) {
|
// ) {
|
||||||
// console.log('TEST: IDB has changed!!!');
|
// console.log('TEST: IDB has changed!!!');
|
||||||
// orig_entry_obj = { ...$lq__journal_entry_obj };
|
// orig_entry_obj = { ...$lq__journal_entry_obj };
|
||||||
} else {
|
|
||||||
console.log('TEST: Catch all: LQ Journal Entry object available', orig_entry_obj, tmp_entry_obj, $lq__journal_entry_obj);
|
// } else {
|
||||||
}
|
// console.log('TEST: Catch all: LQ Journal Entry object available', orig_entry_obj, tmp_entry_obj, $lq__journal_entry_obj);
|
||||||
|
// }
|
||||||
});
|
});
|
||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
@@ -129,7 +133,49 @@ $effect(() => {
|
|||||||
|
|
||||||
// const test_html = marked.parse('# Marked in Node.js\n\nRendered by **marked**.');
|
// const test_html = marked.parse('# Marked in Node.js\n\nRendered by **marked**.');
|
||||||
|
|
||||||
// Reminder: Styling is being done with Tailwind CSS, not Bootstrap.
|
async function update_journal_entry() {
|
||||||
|
if (!$ae_loc.trusted_access) {
|
||||||
|
alert('You do not have permission to update this journal entry.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let data_kv = {
|
||||||
|
alert: tmp_entry_obj?.alert,
|
||||||
|
personal: tmp_entry_obj?.personal,
|
||||||
|
private: tmp_entry_obj?.private,
|
||||||
|
professional: tmp_entry_obj?.professional,
|
||||||
|
public: tmp_entry_obj?.public,
|
||||||
|
template: tmp_entry_obj?.template,
|
||||||
|
|
||||||
|
hide: tmp_entry_obj?.hide,
|
||||||
|
priority: tmp_entry_obj?.priority,
|
||||||
|
enable: tmp_entry_obj?.enable,
|
||||||
|
|
||||||
|
// alert_msg: $lq__journal_entry_obj?.alert_msg ? false : true
|
||||||
|
alert_msg: tmp_entry_obj?.alert_msg,
|
||||||
|
category_code: tmp_entry_obj?.category_code,
|
||||||
|
content: tmp_entry_obj?.content,
|
||||||
|
group: tmp_entry_obj?.group,
|
||||||
|
name: tmp_entry_obj?.name,
|
||||||
|
tags: tmp_entry_obj?.tags,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Call API to save the content
|
||||||
|
try {
|
||||||
|
await journals_func.update_ae_obj__journal_entry({
|
||||||
|
api_cfg: $ae_api,
|
||||||
|
journal_entry_id: $lq__journal_entry_obj?.journal_entry_id,
|
||||||
|
data_kv: data_kv,
|
||||||
|
log_lvl: 0,
|
||||||
|
});
|
||||||
|
updated_obj = true;
|
||||||
|
updated_idb = false;
|
||||||
|
console.log('Journal entry updated successfully!');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error updating journal entry:', error);
|
||||||
|
alert('Failed to update journal entry.');
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
@@ -146,32 +192,10 @@ $effect(() => {
|
|||||||
// Ask if they would like to save changes before toggling edit mode off.
|
// Ask if they would like to save changes before toggling edit mode off.
|
||||||
if ($journals_loc.entry.edit_kv[$lq__journal_entry_obj?.journal_entry_id]) {
|
if ($journals_loc.entry.edit_kv[$lq__journal_entry_obj?.journal_entry_id]) {
|
||||||
if (tmp_entry_obj_changed && confirm('Would you like to save changes to this journal entry before exiting edit mode?')) {
|
if (tmp_entry_obj_changed && confirm('Would you like to save changes to this journal entry before exiting edit mode?')) {
|
||||||
// Call API to save the content
|
update_journal_entry();
|
||||||
let data_kv = {
|
|
||||||
alert_msg: tmp_entry_obj?.alert_msg,
|
|
||||||
category_code: tmp_entry_obj?.category_code,
|
|
||||||
content: tmp_entry_obj?.content,
|
|
||||||
group: tmp_entry_obj?.group,
|
|
||||||
name: tmp_entry_obj?.name,
|
|
||||||
tags: tmp_entry_obj?.tags,
|
|
||||||
};
|
|
||||||
journals_func.update_ae_obj__journal_entry({
|
|
||||||
api_cfg: $ae_api,
|
|
||||||
journal_entry_id: $lq__journal_entry_obj?.journal_entry_id,
|
|
||||||
data_kv: data_kv,
|
|
||||||
log_lvl: log_lvl
|
|
||||||
}).then(() => {
|
|
||||||
// Optionally, you can provide feedback to the user
|
|
||||||
// alert('Journal entry updated successfully!');
|
|
||||||
orig_entry_obj = null;
|
|
||||||
}).catch((error) => {
|
|
||||||
console.error('Error updating journal entry:', error);
|
|
||||||
alert('Failed to update journal entry.');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Toggle edit mode
|
// Toggle edit mode
|
||||||
if ($journals_loc.entry.edit_kv[$lq__journal_entry_obj?.journal_entry_id]) {
|
if ($journals_loc.entry.edit_kv[$lq__journal_entry_obj?.journal_entry_id]) {
|
||||||
$journals_loc.entry.edit_kv[$lq__journal_entry_obj?.journal_entry_id] = false;
|
$journals_loc.entry.edit_kv[$lq__journal_entry_obj?.journal_entry_id] = false;
|
||||||
@@ -404,28 +428,7 @@ $effect(() => {
|
|||||||
tmp_entry_obj.category_code = event.target.value;
|
tmp_entry_obj.category_code = event.target.value;
|
||||||
console.log('Selected category:', tmp_entry_obj.category_code);
|
console.log('Selected category:', tmp_entry_obj.category_code);
|
||||||
|
|
||||||
// Call API to save the content
|
update_journal_entry();
|
||||||
let data_kv = {
|
|
||||||
alert_msg: tmp_entry_obj?.alert_msg,
|
|
||||||
category_code: tmp_entry_obj?.category_code,
|
|
||||||
content: tmp_entry_obj?.content,
|
|
||||||
group: tmp_entry_obj?.group,
|
|
||||||
name: tmp_entry_obj?.name,
|
|
||||||
tags: tmp_entry_obj?.tags,
|
|
||||||
};
|
|
||||||
journals_func.update_ae_obj__journal_entry({
|
|
||||||
api_cfg: $ae_api,
|
|
||||||
journal_entry_id: $lq__journal_entry_obj?.journal_entry_id,
|
|
||||||
data_kv: data_kv,
|
|
||||||
log_lvl: log_lvl
|
|
||||||
}).then(() => {
|
|
||||||
// Optionally, you can provide feedback to the user
|
|
||||||
// alert('Journal entry updated successfully!');
|
|
||||||
orig_entry_obj = null;
|
|
||||||
}).catch((error) => {
|
|
||||||
console.error('Error updating journal entry:', error);
|
|
||||||
alert('Failed to update journal entry.');
|
|
||||||
});
|
|
||||||
}}
|
}}
|
||||||
title="Select a category for the new journal entry"
|
title="Select a category for the new journal entry"
|
||||||
>
|
>
|
||||||
@@ -475,31 +478,8 @@ $effect(() => {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
if ($ae_loc.trusted_access) {
|
tmp_entry_obj.alert = !$lq__journal_entry_obj?.alert;
|
||||||
let data_kv = {
|
update_journal_entry();
|
||||||
alert_msg: tmp_entry_obj?.alert_msg,
|
|
||||||
category_code: tmp_entry_obj?.category_code,
|
|
||||||
content: tmp_entry_obj?.content,
|
|
||||||
group: tmp_entry_obj?.group,
|
|
||||||
name: tmp_entry_obj?.name,
|
|
||||||
tags: tmp_entry_obj?.tags,
|
|
||||||
|
|
||||||
alert: $lq__journal_entry_obj?.alert ? false : true
|
|
||||||
};
|
|
||||||
journals_func.update_ae_obj__journal_entry({
|
|
||||||
api_cfg: $ae_api,
|
|
||||||
journal_entry_id: $lq__journal_entry_obj?.journal_entry_id,
|
|
||||||
data_kv: data_kv,
|
|
||||||
log_lvl: log_lvl
|
|
||||||
}).then(() => {
|
|
||||||
// Optionally, you can provide feedback to the user
|
|
||||||
// alert('Journal entry updated successfully!');
|
|
||||||
orig_entry_obj = null;
|
|
||||||
}).catch((error) => {
|
|
||||||
console.error('Error updating journal entry:', error);
|
|
||||||
alert('Failed to update journal entry.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
class="btn-icon-sm"
|
class="btn-icon-sm"
|
||||||
title="Toggle alert status of this journal entry"
|
title="Toggle alert status of this journal entry"
|
||||||
@@ -515,30 +495,8 @@ $effect(() => {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
if ($ae_loc.trusted_access) {
|
// tmp_entry_obj.alert_msg = !$lq__journal_entry_obj?.alert_msg;
|
||||||
let data_kv = {
|
update_journal_entry();
|
||||||
category_code: tmp_entry_obj?.category_code,
|
|
||||||
content: tmp_entry_obj?.content,
|
|
||||||
group: tmp_entry_obj?.group,
|
|
||||||
name: tmp_entry_obj?.name,
|
|
||||||
tags: tmp_entry_obj?.tags,
|
|
||||||
|
|
||||||
alert_msg: $lq__journal_entry_obj?.alert_msg ? false : true
|
|
||||||
};
|
|
||||||
journals_func.update_ae_obj__journal_entry({
|
|
||||||
api_cfg: $ae_api,
|
|
||||||
journal_entry_id: $lq__journal_entry_obj?.journal_entry_id,
|
|
||||||
data_kv: data_kv,
|
|
||||||
log_lvl: log_lvl
|
|
||||||
}).then(() => {
|
|
||||||
// Optionally, you can provide feedback to the user
|
|
||||||
// alert('Journal entry updated successfully!');
|
|
||||||
orig_entry_obj = null;
|
|
||||||
}).catch((error) => {
|
|
||||||
console.error('Error updating journal entry:', error);
|
|
||||||
alert('Failed to update journal entry.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
class:hidden={!$lq__journal_entry_obj?.alert}
|
class:hidden={!$lq__journal_entry_obj?.alert}
|
||||||
class="btn-icon-sm"
|
class="btn-icon-sm"
|
||||||
@@ -555,31 +513,8 @@ $effect(() => {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
if ($ae_loc.trusted_access) {
|
tmp_entry_obj.private = !$lq__journal_entry_obj?.private;
|
||||||
let data_kv = {
|
update_journal_entry();
|
||||||
alert_msg: tmp_entry_obj?.alert_msg,
|
|
||||||
category_code: tmp_entry_obj?.category_code,
|
|
||||||
content: tmp_entry_obj?.content,
|
|
||||||
group: tmp_entry_obj?.group,
|
|
||||||
name: tmp_entry_obj?.name,
|
|
||||||
tags: tmp_entry_obj?.tags,
|
|
||||||
|
|
||||||
private: $lq__journal_entry_obj?.private ? false : true
|
|
||||||
};
|
|
||||||
journals_func.update_ae_obj__journal_entry({
|
|
||||||
api_cfg: $ae_api,
|
|
||||||
journal_entry_id: $lq__journal_entry_obj?.journal_entry_id,
|
|
||||||
data_kv: data_kv,
|
|
||||||
log_lvl: log_lvl
|
|
||||||
}).then(() => {
|
|
||||||
// Optionally, you can provide feedback to the user
|
|
||||||
// alert('Journal entry updated successfully!');
|
|
||||||
orig_entry_obj = null;
|
|
||||||
}).catch((error) => {
|
|
||||||
console.error('Error updating journal entry:', error);
|
|
||||||
alert('Failed to update journal entry.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
class="btn-icon-sm"
|
class="btn-icon-sm"
|
||||||
title="Toggle private visibility of this journal entry"
|
title="Toggle private visibility of this journal entry"
|
||||||
@@ -594,31 +529,8 @@ $effect(() => {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
if ($ae_loc.trusted_access) {
|
tmp_entry_obj.public = !$lq__journal_entry_obj?.public;
|
||||||
let data_kv = {
|
update_journal_entry();
|
||||||
alert_msg: tmp_entry_obj?.alert_msg,
|
|
||||||
category_code: tmp_entry_obj?.category_code,
|
|
||||||
content: tmp_entry_obj?.content,
|
|
||||||
group: tmp_entry_obj?.group,
|
|
||||||
name: tmp_entry_obj?.name,
|
|
||||||
tags: tmp_entry_obj?.tags,
|
|
||||||
|
|
||||||
public: $lq__journal_entry_obj?.public ? false : true
|
|
||||||
};
|
|
||||||
journals_func.update_ae_obj__journal_entry({
|
|
||||||
api_cfg: $ae_api,
|
|
||||||
journal_entry_id: $lq__journal_entry_obj?.journal_entry_id,
|
|
||||||
data_kv: data_kv,
|
|
||||||
log_lvl: log_lvl
|
|
||||||
}).then(() => {
|
|
||||||
// Optionally, you can provide feedback to the user
|
|
||||||
// alert('Journal entry updated successfully!');
|
|
||||||
orig_entry_obj = null;
|
|
||||||
}).catch((error) => {
|
|
||||||
console.error('Error updating journal entry:', error);
|
|
||||||
alert('Failed to update journal entry.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
class="btn-icon-sm"
|
class="btn-icon-sm"
|
||||||
title="Toggle public visibility of this journal entry"
|
title="Toggle public visibility of this journal entry"
|
||||||
@@ -633,31 +545,8 @@ $effect(() => {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
if ($ae_loc.trusted_access) {
|
tmp_entry_obj.personal = !$lq__journal_entry_obj?.personal;
|
||||||
let data_kv = {
|
update_journal_entry();
|
||||||
alert_msg: tmp_entry_obj?.alert_msg,
|
|
||||||
category_code: tmp_entry_obj?.category_code,
|
|
||||||
content: tmp_entry_obj?.content,
|
|
||||||
group: tmp_entry_obj?.group,
|
|
||||||
name: tmp_entry_obj?.name,
|
|
||||||
tags: tmp_entry_obj?.tags,
|
|
||||||
|
|
||||||
personal: $lq__journal_entry_obj?.personal ? false : true
|
|
||||||
};
|
|
||||||
journals_func.update_ae_obj__journal_entry({
|
|
||||||
api_cfg: $ae_api,
|
|
||||||
journal_entry_id: $lq__journal_entry_obj?.journal_entry_id,
|
|
||||||
data_kv: data_kv,
|
|
||||||
log_lvl: log_lvl
|
|
||||||
}).then(() => {
|
|
||||||
// Optionally, you can provide feedback to the user
|
|
||||||
// alert('Journal entry updated successfully!');
|
|
||||||
orig_entry_obj = null;
|
|
||||||
}).catch((error) => {
|
|
||||||
console.error('Error updating journal entry:', error);
|
|
||||||
alert('Failed to update journal entry.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
class="btn-icon-sm"
|
class="btn-icon-sm"
|
||||||
title="Toggle personal visibility of this journal entry"
|
title="Toggle personal visibility of this journal entry"
|
||||||
@@ -672,31 +561,8 @@ $effect(() => {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
if ($ae_loc.trusted_access) {
|
tmp_entry_obj.professional = !$lq__journal_entry_obj?.professional;
|
||||||
let data_kv = {
|
update_journal_entry();
|
||||||
alert_msg: tmp_entry_obj?.alert_msg,
|
|
||||||
category_code: tmp_entry_obj?.category_code,
|
|
||||||
content: tmp_entry_obj?.content,
|
|
||||||
group: tmp_entry_obj?.group,
|
|
||||||
name: tmp_entry_obj?.name,
|
|
||||||
tags: tmp_entry_obj?.tags,
|
|
||||||
|
|
||||||
professional: $lq__journal_entry_obj?.professional ? false : true
|
|
||||||
};
|
|
||||||
journals_func.update_ae_obj__journal_entry({
|
|
||||||
api_cfg: $ae_api,
|
|
||||||
journal_entry_id: $lq__journal_entry_obj?.journal_entry_id,
|
|
||||||
data_kv: data_kv,
|
|
||||||
log_lvl: log_lvl
|
|
||||||
}).then(() => {
|
|
||||||
// Optionally, you can provide feedback to the user
|
|
||||||
// alert('Journal entry updated successfully!');
|
|
||||||
orig_entry_obj = null;
|
|
||||||
}).catch((error) => {
|
|
||||||
console.error('Error updating journal entry:', error);
|
|
||||||
alert('Failed to update journal entry.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
class="btn-icon-sm"
|
class="btn-icon-sm"
|
||||||
title="Toggle professional visibility of this journal entry"
|
title="Toggle professional visibility of this journal entry"
|
||||||
@@ -704,7 +570,7 @@ $effect(() => {
|
|||||||
{#if $lq__journal_entry_obj?.professional}
|
{#if $lq__journal_entry_obj?.professional}
|
||||||
<BriefcaseBusiness strokeWidth="2.5" color="green" />
|
<BriefcaseBusiness strokeWidth="2.5" color="green" />
|
||||||
{:else}
|
{:else}
|
||||||
<BriefcaseBusiness strokeWidth="1" />
|
<BriefcaseBusiness strokeWidth="1" color="gray" />
|
||||||
{/if}
|
{/if}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
@@ -712,31 +578,8 @@ $effect(() => {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
if ($ae_loc.trusted_access) {
|
tmp_entry_obj.template = !$lq__journal_entry_obj?.template;
|
||||||
let data_kv = {
|
update_journal_entry();
|
||||||
alert_msg: tmp_entry_obj?.alert_msg,
|
|
||||||
category_code: tmp_entry_obj?.category_code,
|
|
||||||
content: tmp_entry_obj?.content,
|
|
||||||
group: tmp_entry_obj?.group,
|
|
||||||
name: tmp_entry_obj?.name,
|
|
||||||
tags: tmp_entry_obj?.tags,
|
|
||||||
|
|
||||||
template: $lq__journal_entry_obj?.template ? false : true
|
|
||||||
};
|
|
||||||
journals_func.update_ae_obj__journal_entry({
|
|
||||||
api_cfg: $ae_api,
|
|
||||||
journal_entry_id: $lq__journal_entry_obj?.journal_entry_id,
|
|
||||||
data_kv: data_kv,
|
|
||||||
log_lvl: log_lvl
|
|
||||||
}).then(() => {
|
|
||||||
// Optionally, you can provide feedback to the user
|
|
||||||
// alert('Journal entry updated successfully!');
|
|
||||||
orig_entry_obj = null;
|
|
||||||
}).catch((error) => {
|
|
||||||
console.error('Error updating journal entry:', error);
|
|
||||||
alert('Failed to update journal entry.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
class="btn-icon-sm"
|
class="btn-icon-sm"
|
||||||
title="Toggle template visibility of this journal entry"
|
title="Toggle template visibility of this journal entry"
|
||||||
@@ -866,34 +709,7 @@ $effect(() => {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
// Save the updated journal entry content
|
update_journal_entry();
|
||||||
if ($ae_loc.trusted_access) {
|
|
||||||
// Call API to save the content
|
|
||||||
let data_kv = {
|
|
||||||
alert_msg: tmp_entry_obj?.alert_msg,
|
|
||||||
category_code: tmp_entry_obj?.category_code,
|
|
||||||
content: tmp_entry_obj?.content,
|
|
||||||
group: tmp_entry_obj?.group,
|
|
||||||
name: tmp_entry_obj?.name,
|
|
||||||
tags: tmp_entry_obj?.tags,
|
|
||||||
};
|
|
||||||
journals_func.update_ae_obj__journal_entry({
|
|
||||||
api_cfg: $ae_api,
|
|
||||||
journal_entry_id: $lq__journal_entry_obj?.journal_entry_id,
|
|
||||||
data_kv: data_kv,
|
|
||||||
log_lvl: 1
|
|
||||||
}).then(() => {
|
|
||||||
// Optionally, you can provide feedback to the user
|
|
||||||
// alert('Journal entry updated successfully!');
|
|
||||||
// orig_entry_obj = {};
|
|
||||||
// tmp_entry_obj = {};
|
|
||||||
updated_obj = true;
|
|
||||||
updated_idb = false;
|
|
||||||
}).catch((error) => {
|
|
||||||
console.error('Error updating journal entry:', error);
|
|
||||||
alert('Failed to update journal entry.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
disabled={!tmp_entry_obj_changed}
|
disabled={!tmp_entry_obj_changed}
|
||||||
class:variant-filled-error={tmp_entry_obj_changed}
|
class:variant-filled-error={tmp_entry_obj_changed}
|
||||||
@@ -936,30 +752,8 @@ $effect(() => {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
if ($ae_loc.trusted_access) {
|
tmp_entry_obj.priority = !$lq__journal_entry_obj?.priority;
|
||||||
let data_kv = {
|
update_journal_entry();
|
||||||
alert: $lq__journal_entry_obj?.alert,
|
|
||||||
alert_msg: $lq__journal_entry_obj?.alert_msg,
|
|
||||||
category_code: tmp_entry_obj?.category_code,
|
|
||||||
content: tmp_entry_obj?.content,
|
|
||||||
name: tmp_entry_obj?.name,
|
|
||||||
priority: $lq__journal_entry_obj?.priority ? false : true,
|
|
||||||
tags: tmp_entry_obj?.tags,
|
|
||||||
};
|
|
||||||
journals_func.update_ae_obj__journal_entry({
|
|
||||||
api_cfg: $ae_api,
|
|
||||||
journal_entry_id: $lq__journal_entry_obj?.journal_entry_id,
|
|
||||||
data_kv: data_kv,
|
|
||||||
log_lvl: log_lvl
|
|
||||||
}).then(() => {
|
|
||||||
// Optionally, you can provide feedback to the user
|
|
||||||
// alert('Journal entry updated successfully!');
|
|
||||||
orig_entry_obj = null;
|
|
||||||
}).catch((error) => {
|
|
||||||
console.error('Error updating journal entry:', error);
|
|
||||||
alert('Failed to update journal entry.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
class="btn-icon-sm variant-soft-tertiary transition"
|
class="btn-icon-sm variant-soft-tertiary transition"
|
||||||
title="Toggle priority of this journal entry"
|
title="Toggle priority of this journal entry"
|
||||||
@@ -979,29 +773,8 @@ $effect(() => {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
let data_kv = {
|
tmp_entry_obj.sort = $lq__journal_entry_obj?.sort ? $lq__journal_entry_obj?.sort + 1 : 1;
|
||||||
alert_msg: tmp_entry_obj?.alert_msg,
|
update_journal_entry();
|
||||||
category_code: tmp_entry_obj?.category_code,
|
|
||||||
content: tmp_entry_obj?.content,
|
|
||||||
group: tmp_entry_obj?.group,
|
|
||||||
name: tmp_entry_obj?.name,
|
|
||||||
tags: tmp_entry_obj?.tags,
|
|
||||||
|
|
||||||
sort: $lq__journal_entry_obj?.sort ? $lq__journal_entry_obj?.sort + 1 : 1
|
|
||||||
};
|
|
||||||
journals_func.update_ae_obj__journal_entry({
|
|
||||||
api_cfg: $ae_api,
|
|
||||||
journal_entry_id: $lq__journal_entry_obj?.journal_entry_id,
|
|
||||||
data_kv: data_kv,
|
|
||||||
log_lvl: log_lvl
|
|
||||||
}).then(() => {
|
|
||||||
// Optionally, you can provide feedback to the user
|
|
||||||
// alert('Journal entry updated successfully!');
|
|
||||||
orig_entry_obj = null;
|
|
||||||
}).catch((error) => {
|
|
||||||
console.error('Error updating journal entry:', error);
|
|
||||||
alert('Failed to update journal entry.');
|
|
||||||
});
|
|
||||||
}}
|
}}
|
||||||
class="btn-icon-sm variant-soft-tertiary transition"
|
class="btn-icon-sm variant-soft-tertiary transition"
|
||||||
title="Increment sort order of this journal entry"
|
title="Increment sort order of this journal entry"
|
||||||
@@ -1019,29 +792,8 @@ $effect(() => {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
let data_kv = {
|
tmp_entry_obj.sort = $lq__journal_entry_obj?.sort ? $lq__journal_entry_obj?.sort - 1 : 0;
|
||||||
alert_msg: tmp_entry_obj?.alert_msg,
|
update_journal_entry();
|
||||||
category_code: tmp_entry_obj?.category_code,
|
|
||||||
content: tmp_entry_obj?.content,
|
|
||||||
group: tmp_entry_obj?.group,
|
|
||||||
name: tmp_entry_obj?.name,
|
|
||||||
tags: tmp_entry_obj?.tags,
|
|
||||||
|
|
||||||
sort: $lq__journal_entry_obj?.sort ? $lq__journal_entry_obj?.sort - 1 : 0,
|
|
||||||
};
|
|
||||||
journals_func.update_ae_obj__journal_entry({
|
|
||||||
api_cfg: $ae_api,
|
|
||||||
journal_entry_id: $lq__journal_entry_obj?.journal_entry_id,
|
|
||||||
data_kv: data_kv,
|
|
||||||
log_lvl: log_lvl
|
|
||||||
}).then(() => {
|
|
||||||
// Optionally, you can provide feedback to the user
|
|
||||||
// alert('Journal entry updated successfully!');
|
|
||||||
orig_entry_obj = null;
|
|
||||||
}).catch((error) => {
|
|
||||||
console.error('Error updating journal entry:', error);
|
|
||||||
alert('Failed to update journal entry.');
|
|
||||||
});
|
|
||||||
}}
|
}}
|
||||||
class="btn-icon-sm variant-soft-tertiary transition"
|
class="btn-icon-sm variant-soft-tertiary transition"
|
||||||
title="Decrement sort order of this journal entry"
|
title="Decrement sort order of this journal entry"
|
||||||
@@ -1057,27 +809,7 @@ $effect(() => {
|
|||||||
bind:value={tmp_entry_obj.group}
|
bind:value={tmp_entry_obj.group}
|
||||||
placeholder="Group"
|
placeholder="Group"
|
||||||
onchange={() => {
|
onchange={() => {
|
||||||
let data_kv = {
|
update_journal_entry();
|
||||||
alert_msg: tmp_entry_obj?.alert_msg,
|
|
||||||
category_code: tmp_entry_obj?.category_code,
|
|
||||||
content: tmp_entry_obj?.content,
|
|
||||||
group: tmp_entry_obj?.group,
|
|
||||||
name: tmp_entry_obj?.name,
|
|
||||||
tags: tmp_entry_obj?.tags,
|
|
||||||
};
|
|
||||||
journals_func.update_ae_obj__journal_entry({
|
|
||||||
api_cfg: $ae_api,
|
|
||||||
journal_entry_id: $lq__journal_entry_obj?.journal_entry_id,
|
|
||||||
data_kv: data_kv,
|
|
||||||
log_lvl: log_lvl
|
|
||||||
}).then(() => {
|
|
||||||
// Optionally, you can provide feedback to the user
|
|
||||||
// alert('Journal entry updated successfully!');
|
|
||||||
orig_entry_obj = null;
|
|
||||||
}).catch((error) => {
|
|
||||||
console.error('Error updating journal entry:', error);
|
|
||||||
alert('Failed to update journal entry.');
|
|
||||||
});
|
|
||||||
}}
|
}}
|
||||||
class="input input-sm input-bordered w-24"
|
class="input input-sm input-bordered w-24"
|
||||||
title="Set group (for sorting) of this journal entry"
|
title="Set group (for sorting) of this journal entry"
|
||||||
@@ -1088,29 +820,8 @@ $effect(() => {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
let data_kv = {
|
tmp_entry_obj.hide = !$lq__journal_entry_obj?.hide;
|
||||||
alert_msg: tmp_entry_obj?.alert_msg,
|
update_journal_entry();
|
||||||
category_code: tmp_entry_obj?.category_code,
|
|
||||||
content: tmp_entry_obj?.content,
|
|
||||||
group: tmp_entry_obj?.group,
|
|
||||||
name: tmp_entry_obj?.name,
|
|
||||||
tags: tmp_entry_obj?.tags,
|
|
||||||
|
|
||||||
hide: $lq__journal_entry_obj?.hide ? false : true
|
|
||||||
};
|
|
||||||
journals_func.update_ae_obj__journal_entry({
|
|
||||||
api_cfg: $ae_api,
|
|
||||||
journal_entry_id: $lq__journal_entry_obj?.journal_entry_id,
|
|
||||||
data_kv: data_kv,
|
|
||||||
log_lvl: log_lvl
|
|
||||||
}).then(() => {
|
|
||||||
// Optionally, you can provide feedback to the user
|
|
||||||
// alert('Journal entry updated successfully!');
|
|
||||||
orig_entry_obj = null;
|
|
||||||
}).catch((error) => {
|
|
||||||
console.error('Error updating journal entry:', error);
|
|
||||||
alert('Failed to update journal entry.');
|
|
||||||
});
|
|
||||||
}}
|
}}
|
||||||
class="btn btn-sm md:btn-md variant-soft-warning hover:variant-filled-warning transition"
|
class="btn btn-sm md:btn-md variant-soft-warning hover:variant-filled-warning transition"
|
||||||
title="Toggle visibility of this journal entry"
|
title="Toggle visibility of this journal entry"
|
||||||
@@ -1128,29 +839,8 @@ $effect(() => {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
let data_kv = {
|
tmp_entry_obj.enable = !$lq__journal_entry_obj?.enable;
|
||||||
alert_msg: tmp_entry_obj?.alert_msg,
|
update_journal_entry();
|
||||||
category_code: tmp_entry_obj?.category_code,
|
|
||||||
content: tmp_entry_obj?.content,
|
|
||||||
group: tmp_entry_obj?.group,
|
|
||||||
name: tmp_entry_obj?.name,
|
|
||||||
tags: tmp_entry_obj?.tags,
|
|
||||||
|
|
||||||
enable: $lq__journal_entry_obj?.enable ? false : true
|
|
||||||
};
|
|
||||||
journals_func.update_ae_obj__journal_entry({
|
|
||||||
api_cfg: $ae_api,
|
|
||||||
journal_entry_id: $lq__journal_entry_obj?.journal_entry_id,
|
|
||||||
data_kv: data_kv,
|
|
||||||
log_lvl: log_lvl
|
|
||||||
}).then(() => {
|
|
||||||
// Optionally, you can provide feedback to the user
|
|
||||||
// alert('Journal entry updated successfully!');
|
|
||||||
orig_entry_obj = null;
|
|
||||||
}).catch((error) => {
|
|
||||||
console.error('Error updating journal entry:', error);
|
|
||||||
alert('Failed to update journal entry.');
|
|
||||||
});
|
|
||||||
}}
|
}}
|
||||||
class:hidden={!$ae_loc.administrator_access || !$ae_loc.edit_mode}
|
class:hidden={!$ae_loc.administrator_access || !$ae_loc.edit_mode}
|
||||||
class="btn btn-sm md:btn-md variant-soft-error hover:variant-filled-error transition"
|
class="btn btn-sm md:btn-md variant-soft-error hover:variant-filled-error transition"
|
||||||
|
|||||||
Reference in New Issue
Block a user