Skip to content

Commit

Permalink
add vo_niem
Browse files Browse the repository at this point in the history
  • Loading branch information
titieo committed Dec 3, 2023
1 parent ce000ef commit 60753b5
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
Binary file modified src/DatabaseDefinitions.d.ts
Binary file not shown.
3 changes: 3 additions & 0 deletions src/routes/table/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
hang_phuc: ele.hang_phuc === null ? '' : ele.hang_phuc,
lhs: ele.lhs === null ? '' : ele.lhs,
seven_lines: ele.seven_lines === null ? '' : ele.seven_lines,
vo_niem: ele.vo_niem === null ? '' : ele.vo_niem,
}));
let sum = {
Expand All @@ -22,6 +23,7 @@
hang_phuc: 'N/A',
lhs: 0,
seven_lines: 0,
vo_niem: 'N/A',
};
dates.forEach((ele) => {
Expand All @@ -36,6 +38,7 @@
tara: 'Green Tara',
taras_homage: '21 Tara Homages',
lay_dai: 'Lạy Dài',
vo_niem: 'An trú Vô Niệm',
hang_phuc: 'Kiết Già Hàng Phục',
lhs: 'Guru Rinpoche',
seven_lines: 'Seven Lines Guru Rinpoche',
Expand Down
2 changes: 1 addition & 1 deletion src/routes/tara/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const load: PageServerLoad = async ({ url, locals: { getSession } }) => {
// console.log(session);
const { data } = await supabase
.from('main')
.select('id, created_at, tara, taras_homage, lay_dai, hang_phuc');
.select('id, created_at, tara, taras_homage, lay_dai, hang_phuc, vo_niem');
return {
dates: data ?? [],
session:
Expand Down
19 changes: 18 additions & 1 deletion src/routes/tara/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@
taras_homage: values.taras_homage + lastDate.taras_homage,
hang_phuc: values.hang_phuc + lastDate.hang_phuc,
lay_dai: values.lay_dai + lastDate.lay_dai,
vo_niem: values.vo_niem + lastDate.vo_niem,
})
.eq('created_at', created_date);
lastDate.tara += values.tara;
lastDate.taras_homage += values.taras_homage;
lastDate.hang_phuc += values.hang_phuc;
lastDate.lay_dai += values.lay_dai;
lastDate.vo_niem += values.vo_niem;
} else {
await supabase.from('main').insert([
{
Expand All @@ -67,6 +69,7 @@
hang_phuc: values.hang_phuc,
created_at: created_date,
lay_dai: values.lay_dai,
vo_niem: values.vo_niem,
},
]);
Expand All @@ -77,6 +80,7 @@
taras_homage: values.taras_homage,
hang_phuc: values.hang_phuc,
created_at: created_date,
vo_niem: values.vo_niem,
},
];
}
Expand All @@ -98,6 +102,7 @@
y1: e.taras_homage,
y2: e.lay_dai / 3,
y3: e.hang_phuc,
y4: e.vo_niem,
});
});
// const x = (DataRecord) => DataRecord.x;
Expand All @@ -106,13 +111,15 @@
(DataRecord: { y1: number }) => DataRecord.y1,
(DataRecord: { y2: number }) => DataRecord.y2,
(DataRecord: { y3: number }) => DataRecord.y3,
(DataRecord: { y4: number }) => DataRecord.y4,
];
const bulletLegendItems = [
'Green Tara',
'21 Tara Homages',
'Lạy dài (x3)',
'Hàng Phục',
'An trú Vô Niệm (s)',
].map((label) => ({ name: label }));
// console.log(DataRecord);
</script>
Expand All @@ -131,7 +138,7 @@
md:(px-4 py-4) md:(mt-4 mr-10)"
>
<!-- p="x-4 y-4" -->
{#each dates as { tara, taras_homage, created_at, hang_phuc, lay_dai, tam }, i}
{#each dates as { tara, taras_homage, created_at, hang_phuc, lay_dai, vo_niem }, i}
<!-- {#each dates as { tara, taras_homage, created_at, lay_dai, lhs, hang_phuc, tam, qt_chu_tara }, i} -->
<!-- {page} for infinite scrolling -->
<DateCard {created_at}>
Expand All @@ -146,6 +153,11 @@
({hang_phuc} Phút Kiết Già Hàng Phục)
</span>
{/if}
{#if vo_niem != null}
<span>
({vo_niem}s Vô Niệm)
</span>
{/if}
<br />
Tán thán 21 Tara: {taras_homage} Lần
{#if lay_dai != null}
Expand Down Expand Up @@ -177,6 +189,7 @@

<!-- Start of the form -->
{#if visible && session}
<!-- {#if true} -->
<SubmitForm bind:visible {form}>
<div class="col-start-1 row-start-1">
<h4>Green Tara (Chuỗi)</h4>
Expand Down Expand Up @@ -214,6 +227,10 @@
/>
<!-- required={true} for form -->
</div>
<div class="col-start-2 row-start-5">
<h4>Thời gian An Trú Vô Niệm (giây)</h4>
<input type="number" name="vo_niem" class="py-2 px-4 mt-2 rounded-md" />
</div>
</SubmitForm>
{/if}
</main>
Expand Down

0 comments on commit 60753b5

Please sign in to comment.