feat: update payment views

This commit is contained in:
2025-12-06 20:42:10 +01:00
parent ce4d5ba013
commit 37164b560f
49 changed files with 1826 additions and 624 deletions

View File

@@ -0,0 +1,43 @@
import { CurrencySchema } from "@module/payment/client";
import type { LucideIcon } from "lucide-react";
import { api } from "@/services/api.ts";
import { Controller } from "../../lib/controller.tsx";
export class CreateLedgerController extends Controller<
{
isSubmitting: boolean;
},
{ title: string; icon: LucideIcon }
> {
#label?: string;
#currencies: string[] = [];
async onInit() {
return {
isSubmitting: false,
};
}
setLabel(label: string) {
this.#label = label;
}
setCurrencies(currencies: string[]) {
this.#currencies = currencies;
}
async submit() {
this.setState("isSubmitting", true);
const result = await api.payment.ledger.create({
body: {
beneficiaryId: crypto.randomUUID(),
label: this.#label,
currencies: this.#currencies.map((currency) => CurrencySchema.parse(currency)),
},
});
console.log(result);
this.setState("isSubmitting", false);
}
}