generated from dave/wails-template
Compare commits
6 Commits
2ac082f230
...
master
Author | SHA1 | Date | |
---|---|---|---|
123b2961a2 | |||
f1c8c394c9 | |||
e83fb7abb8 | |||
3ca12139cd | |||
236b113c10 | |||
4ee622e65e |
@@ -4,7 +4,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
|
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
|
||||||
<title>wails-template</title>
|
<title>bill-manager</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
@@ -18,9 +18,16 @@
|
|||||||
scrollingTimeFrameStore.next();
|
scrollingTimeFrameStore.next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function scroll(event: WheelEvent) {
|
||||||
|
if (event.deltaY < 0) {
|
||||||
|
scrollingTimeFrameStore.prev();
|
||||||
|
} else {
|
||||||
|
scrollingTimeFrameStore.next();
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:window on:keydown={keyDown} />
|
<svelte:window on:keydown={keyDown} on:wheel={scroll} />
|
||||||
<Toaster theme="dark" expand visibleToasts={9} />
|
<Toaster theme="dark" expand visibleToasts={9} />
|
||||||
<template>
|
<template>
|
||||||
<!-- <Header /> -->
|
<!-- <Header /> -->
|
||||||
|
@@ -1,26 +1,45 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { type PaymentBill } from "$lib/types";
|
import { type PaymentBill } from "$lib/types";
|
||||||
import { time } from "$wails/models";
|
import { SetPaid } from "$wails/main/App";
|
||||||
|
import { toast } from "svelte-sonner";
|
||||||
|
|
||||||
export let paymentBill: PaymentBill = {
|
export let paymentBill: PaymentBill = {
|
||||||
id: -1,
|
id: -1,
|
||||||
name: "none",
|
name: "none",
|
||||||
payment: null,
|
payment: null,
|
||||||
};
|
};
|
||||||
|
export let monthFor: Date = new Date();
|
||||||
|
|
||||||
let paymentDate: string = "";
|
let paymentDate: string = "";
|
||||||
if (!!paymentBill.payment?.paymentDate) {
|
$: {
|
||||||
// @ts-ignore Yes split exists... The type is time.Time but it's actually a string
|
if (!!paymentBill.payment?.paymentDate) {
|
||||||
// Because typescript is a worthless waste of bytes
|
// @ts-ignore Yes split exists... The type is time.Time but it's actually a string
|
||||||
// And I don't know how to properly convert time.Time to Date or String
|
// Because typescript is a worthless waste of bytes
|
||||||
// So I'm doing this bullshit
|
// And I don't know how to properly convert time.Time to Date or String
|
||||||
paymentDate = paymentBill.payment!.paymentDate.split("T")[0];
|
// So I'm doing this bullshit
|
||||||
|
paymentDate = paymentBill.payment!.paymentDate.split("T")[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function doPaid(event: MouseEvent) {
|
||||||
|
const res = await SetPaid(paymentBill.id, monthFor);
|
||||||
|
if (!res.success) {
|
||||||
|
toast.error(`failed setting paid for ${paymentBill.id} and month ${monthFor} with error ${res.error}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
paymentBill.payment = res.data;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="grid grid-cols-2 w-full text-start px-3 text-xl">
|
<div class="grid grid-cols-2 w-full text-start px-3 text-xl">
|
||||||
<p class={paymentBill.payment == null ? "text-red-700" : ""}>{paymentBill.name}</p>
|
<p class={paymentBill.payment == null ? "text-red-700" : ""}>{paymentBill.name}</p>
|
||||||
<p class="h-[1.6em] cursor-pointer border-2 border-transparent hover:border-solid hover:border-sky-500">{paymentDate}</p>
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||||
|
<p
|
||||||
|
class="h-[1.6em] cursor-pointer border-2 border-transparent hover:border-solid hover:border-sky-500"
|
||||||
|
on:click={doPaid}
|
||||||
|
>
|
||||||
|
{paymentDate}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@@ -42,7 +42,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="">
|
<div class="">
|
||||||
{#each Object.values(paymentsModel) as payment}
|
{#each Object.values(paymentsModel) as payment}
|
||||||
<PaymentBillComp paymentBill={payment} />
|
<PaymentBillComp paymentBill={payment} monthFor={date} />
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -4,7 +4,10 @@ import { type Writable, writable } from "svelte/store";
|
|||||||
async function createStore(): Promise<Writable<ScrollingTimeframe> & { next: Function; prev: Function }> {
|
async function createStore(): Promise<Writable<ScrollingTimeframe> & { next: Function; prev: Function }> {
|
||||||
const thism = new Date();
|
const thism = new Date();
|
||||||
const lastm = new Date();
|
const lastm = new Date();
|
||||||
lastm.setMonth(thism.getMonth() - 1);
|
thism.setDate(1);
|
||||||
|
lastm.setDate(1);
|
||||||
|
thism.setMonth(thism.getMonth() - 1);
|
||||||
|
lastm.setMonth(lastm.getMonth() - 2);
|
||||||
|
|
||||||
const { subscribe, update, set } = writable({ from: lastm, to: thism });
|
const { subscribe, update, set } = writable({ from: lastm, to: thism });
|
||||||
return {
|
return {
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://wails.io/schemas/config.v2.json",
|
"$schema": "https://wails.io/schemas/config.v2.json",
|
||||||
"name": "wails-template",
|
"name": "bill-manager",
|
||||||
"outputfilename": "wails-template",
|
"outputfilename": "bill-manager",
|
||||||
"frontend:install": "pnpm install",
|
"frontend:install": "pnpm install",
|
||||||
"frontend:build": "pnpm build",
|
"frontend:build": "pnpm build",
|
||||||
"frontend:dev:watcher": "pnpm dev",
|
"frontend:dev:watcher": "pnpm dev",
|
||||||
|
Reference in New Issue
Block a user