Code clean up
This commit is contained in:
@@ -167,95 +167,6 @@ if (browser) {
|
|||||||
"
|
"
|
||||||
> -->
|
> -->
|
||||||
|
|
||||||
|
|
||||||
<div class="hidden flex flex-row items-center justify-between w-full">
|
|
||||||
<a href="/journals"
|
|
||||||
class="btn btn-sm
|
|
||||||
variant-ghost-tertiary
|
|
||||||
hover:variant-filled-tertiary
|
|
||||||
transition
|
|
||||||
">
|
|
||||||
<!-- <span class="fas fa-arrow-left m-1"></span> Back to Journals -->
|
|
||||||
<!-- <span class="fas fa-arrow-left m-1"></span> -->
|
|
||||||
<BookHeart class="mx-1" />
|
|
||||||
View Other Journals
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<!-- Add default journal entry -->
|
|
||||||
<span class="flex flex-row items-center gap-1">
|
|
||||||
<span class="text-sm text-gray-500 hidden md:inline">
|
|
||||||
New entry:
|
|
||||||
</span>
|
|
||||||
<button
|
|
||||||
class="
|
|
||||||
btn btn-sm
|
|
||||||
variant-ghost-success
|
|
||||||
hover:variant-filled-success
|
|
||||||
transition
|
|
||||||
"
|
|
||||||
onclick={() => {
|
|
||||||
// $journals_sess.show__modal_new__journal_entry_obj = true;
|
|
||||||
|
|
||||||
let data_kv = {
|
|
||||||
category_code: null,
|
|
||||||
};
|
|
||||||
if ($journals_loc.qry__category_code) {
|
|
||||||
data_kv.category_code = $journals_loc.qry__category_code;
|
|
||||||
}
|
|
||||||
if (log_lvl) {
|
|
||||||
console.log('Creating new journal entry with data_kv:', data_kv);
|
|
||||||
}
|
|
||||||
journals_func.create_ae_obj__journal_entry({
|
|
||||||
api_cfg: $ae_api,
|
|
||||||
journal_id: $lq__journal_obj?.journal_id ?? '',
|
|
||||||
data_kv: data_kv,
|
|
||||||
log_lvl: log_lvl
|
|
||||||
}).then((results) => {
|
|
||||||
console.log('New journal entry created:', results);
|
|
||||||
$journals_slct.journal_entry_id = results?.journal_entry_id_random;
|
|
||||||
// alert(`Journal entry created successfully! ${$journals_slct.journal_entry_id}`);
|
|
||||||
}).catch((error) => {
|
|
||||||
console.error('Error creating journal entry:', error);
|
|
||||||
alert('Failed to create journal entry.');
|
|
||||||
}).finally(() => {
|
|
||||||
goto(`/journals/${$lq__journal_obj?.journal_id}/entry/${$journals_slct.journal_entry_id}`);
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<FilePlus class="mx-1" />
|
|
||||||
<!-- <span class="fas fa-plus m-1"></span> -->
|
|
||||||
New Journal Entry
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<!-- Give list of categories to base the new entry on -->
|
|
||||||
<span class="flex flex-row items-center gap-2">
|
|
||||||
<span class="text-sm text-gray-500 hidden sm:inline">
|
|
||||||
Category:
|
|
||||||
</span>
|
|
||||||
<select
|
|
||||||
class="novi_btn btn btn-secondary btn-sm
|
|
||||||
variant-soft-primary
|
|
||||||
hover:variant-filled-primary
|
|
||||||
transition
|
|
||||||
text-xs
|
|
||||||
"
|
|
||||||
bind:value={$journals_loc.qry__category_code}
|
|
||||||
onchange={(event) => {
|
|
||||||
$journals_loc.qry__category_code = event.target.value;
|
|
||||||
console.log('Selected category:', $journals_loc.qry__category_code);
|
|
||||||
}}
|
|
||||||
title="Select a category for the new journal entry"
|
|
||||||
>
|
|
||||||
<option value="">Select Category</option>
|
|
||||||
{#each $lq__journal_obj?.cfg_json.category_li as category}
|
|
||||||
<option value={category.code}>{category.name}</option>
|
|
||||||
{/each}
|
|
||||||
</select>
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<Journal_view
|
<Journal_view
|
||||||
lq__journal_obj={lq__journal_obj}
|
lq__journal_obj={lq__journal_obj}
|
||||||
lq__journal_entry_obj_li={lq__journal_entry_obj_li}
|
lq__journal_entry_obj_li={lq__journal_entry_obj_li}
|
||||||
@@ -317,72 +228,4 @@ if (browser) {
|
|||||||
|
|
||||||
{/snippet}
|
{/snippet}
|
||||||
|
|
||||||
<!-- <Journal_obj_id_edit
|
|
||||||
lq__journal_obj={lq__journal_obj}
|
|
||||||
/> -->
|
|
||||||
|
|
||||||
|
|
||||||
<!-- <svelte:fragment slot="footer">
|
|
||||||
<div class="text-center w-full">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
on:click={() => {
|
|
||||||
console.log('Close modal');
|
|
||||||
$journals_sess.recovery_meetings.show__modal_edit__journal_id = false;
|
|
||||||
}}
|
|
||||||
class="btn btn-sm variant-soft-warning hover:variant-ghost-warning"
|
|
||||||
>
|
|
||||||
<span class="fas fa-times mx-1"></span>
|
|
||||||
Close
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</svelte:fragment> -->
|
|
||||||
|
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
|
|
||||||
<!-- Modal: Journal Entry new -->
|
|
||||||
<!-- <Modal
|
|
||||||
bind:open={$journals_sess.show__modal_new__journal_entry_obj}
|
|
||||||
title="New Journal Entry - {$lq__journal_obj?.name}"
|
|
||||||
autoclose={false}
|
|
||||||
placement="top-center"
|
|
||||||
size="xl"
|
|
||||||
class="top-center bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-200 rounded-lg border-gray-200 dark:border-gray-700 divide-gray-200 dark:divide-gray-700 shadow-md relative flex flex-col mx-auto w-full divide-y"
|
|
||||||
>
|
|
||||||
|
|
||||||
{#snippet header()}
|
|
||||||
|
|
||||||
<div class="flex flex-row items-center justify-between w-full">
|
|
||||||
<h3 class="text-lg font-semibold">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
onclick={() => {
|
|
||||||
// Cancel the new journal entry
|
|
||||||
$journals_sess.show__modal_new__journal_entry_obj = false;
|
|
||||||
$journals_slct.journal_entry_id = null;
|
|
||||||
$journals_slct.journal_entry_obj = null;
|
|
||||||
}}
|
|
||||||
class="novi_btn btn btn-sm variant-ghost-warning hover:variant-filled-warning transition"
|
|
||||||
title={`Cancel new journal entry`}
|
|
||||||
>
|
|
||||||
<span class="fas fa-times m-1"></span> Cancel
|
|
||||||
</button>
|
|
||||||
New Journal Entry
|
|
||||||
<span class="text-sm text-gray-500">
|
|
||||||
{$lq__journal_obj?.name}
|
|
||||||
</span>
|
|
||||||
</h3>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/snippet}
|
|
||||||
|
|
||||||
</Modal> -->
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Modal: Journal Content ID media player -->
|
|
||||||
<!-- {#if $journals_slct.journal_entry_id && $journals_sess.show__modal_view__journal_entry_id}
|
|
||||||
<Modal_media_player
|
|
||||||
lq__journal_entry_obj={lq__journal_entry_obj}
|
|
||||||
/>
|
|
||||||
{/if} -->
|
|
||||||
|
|||||||
Reference in New Issue
Block a user