Init
This commit is contained in:
111
src/lib/types.ts
Normal file
111
src/lib/types.ts
Normal file
@@ -0,0 +1,111 @@
|
||||
export interface Cabin {
|
||||
id: number;
|
||||
name: string;
|
||||
capacity: number | null;
|
||||
sort_order: number;
|
||||
}
|
||||
|
||||
export type ReservationStatus = "confirmed" | "option";
|
||||
|
||||
export interface Reservation {
|
||||
id: number;
|
||||
cabin_id: number;
|
||||
guest_name: string;
|
||||
address: string | null;
|
||||
phone: string | null;
|
||||
num_guests: number | null;
|
||||
deposit_amount: number | null;
|
||||
deposit_paid: boolean;
|
||||
status: ReservationStatus;
|
||||
/** Data przyjazdu w formacie YYYY-MM-DD */
|
||||
arrival: string;
|
||||
/** Data wyjazdu w formacie YYYY-MM-DD */
|
||||
departure: string;
|
||||
notes: string | null;
|
||||
/** Cena za dobę w zł */
|
||||
price_per_night: number | null;
|
||||
/** Stan licznika energii na początku pobytu (kWh) */
|
||||
meter_start: number | null;
|
||||
/** Stan licznika energii na końcu pobytu (kWh) */
|
||||
meter_end: number | null;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export type ReservationInput = Omit<Reservation, "id" | "created_at">;
|
||||
|
||||
/** Parametry otwarcia dialogu rezerwacji: edycja istniejącej albo nowa w danym domku i terminie. */
|
||||
export type ReservationDialogParams =
|
||||
| { reservation: Reservation }
|
||||
| { cabin_id: number; arrival: string };
|
||||
|
||||
// --- Faktury ---
|
||||
|
||||
export interface Settings {
|
||||
id: number;
|
||||
company_name: string;
|
||||
first_name: string;
|
||||
last_name: string;
|
||||
address: string;
|
||||
nip: string | null;
|
||||
bank_account: string;
|
||||
bank_name: string;
|
||||
issue_place: string;
|
||||
default_pkwiu: string;
|
||||
default_vat_rate: number;
|
||||
/** Cena energii zł/kWh do rozliczania liczników */
|
||||
energy_price: number | null;
|
||||
}
|
||||
|
||||
export type PaymentMethod = "CASH" | "CARD" | "CARD_CASH" | "SEND";
|
||||
|
||||
export interface Invoice {
|
||||
id: number;
|
||||
invoice_number: string;
|
||||
reservation_id: number | null;
|
||||
issue_date: string;
|
||||
sale_date: string;
|
||||
payment_method: PaymentMethod;
|
||||
payment_card: number | null;
|
||||
payment_cash: number | null;
|
||||
payment_due: string;
|
||||
buyer_name: string;
|
||||
buyer_address: string | null;
|
||||
buyer_nip: string | null;
|
||||
seller_company: string;
|
||||
seller_person: string;
|
||||
seller_address: string;
|
||||
seller_nip: string | null;
|
||||
seller_bank_account: string;
|
||||
seller_bank_name: string;
|
||||
issue_place: string;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface InvoiceItem {
|
||||
id: number;
|
||||
invoice_id: number;
|
||||
name: string;
|
||||
pkwiu: string | null;
|
||||
quantity: number;
|
||||
/** Cena jednostkowa brutto (VAT liczony od brutto, jak w starym systemie) */
|
||||
unit_price: number;
|
||||
vat_rate: number;
|
||||
position: number;
|
||||
}
|
||||
|
||||
export type InvoiceItemInput = Omit<InvoiceItem, "id" | "invoice_id" | "position">;
|
||||
export type InvoiceInput = Omit<Invoice, "id" | "created_at">;
|
||||
|
||||
/** Parametry dialogu faktury: edycja istniejącej, nowa z pobytu albo pusta. */
|
||||
export type InvoiceDialogParams =
|
||||
| { invoice: Invoice; items: InvoiceItem[] }
|
||||
| { reservation: Reservation }
|
||||
| { blank: true };
|
||||
|
||||
/** Statystyki przychodu w zakresie dat (noclegi liczone tylko w zakresie). */
|
||||
export interface RevenueStats {
|
||||
nights_total: number;
|
||||
revenue_total: number;
|
||||
nights_confirmed: number;
|
||||
revenue_confirmed: number;
|
||||
}
|
||||
Reference in New Issue
Block a user