diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 1fc7309..61a4d5d 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -128,6 +128,26 @@ fn migrations() -> Vec { ); ", kind: MigrationKind::Up, + }, + Migration { + version: 4, + description: "add_cleaned_flag", + sql: " + ALTER TABLE reservations ADD COLUMN cleaned INTEGER NOT NULL DEFAULT 0; + -- wyjazdy sprzed migracji uznajemy za posprzątane, żeby nie zalać widoku zaległościami + UPDATE reservations SET cleaned = 1 WHERE departure < date('now'); + CREATE INDEX idx_reservations_departure ON reservations (departure); + ", + kind: MigrationKind::Up, + }, + Migration { + version: 5, + description: "add_prepared_flag", + sql: " + ALTER TABLE reservations ADD COLUMN prepared INTEGER NOT NULL DEFAULT 0; + UPDATE reservations SET prepared = 1 WHERE arrival < date('now'); + ", + kind: MigrationKind::Up, }] } @@ -166,9 +186,16 @@ fn auto_backup(app: &tauri::AppHandle) -> std::io::Result<()> { Ok(()) } +/// Zapis tekstu do pliku wskazanego przez okno "Zapisz jako" (eksport CSV). +#[tauri::command] +fn save_text_file(path: String, contents: String) -> Result<(), String> { + std::fs::write(&path, contents).map_err(|e| e.to_string()) +} + #[cfg_attr(mobile, tauri::mobile_entry_point)] pub fn run() { tauri::Builder::default() + .invoke_handler(tauri::generate_handler![save_text_file]) .setup(|app| { if let Err(e) = auto_backup(app.handle()) { eprintln!("Nie udało się wykonać kopii zapasowej: {e}"); diff --git a/src/lib/components/CabinsDialog.svelte b/src/lib/components/CabinsDialog.svelte index aff7e02..9ea1f23 100644 --- a/src/lib/components/CabinsDialog.svelte +++ b/src/lib/components/CabinsDialog.svelte @@ -101,9 +101,9 @@ placeholder="—" /> - - - + + + {/each} @@ -112,7 +112,7 @@
- +
{#if error} @@ -120,21 +120,14 @@ {/if}
- +
diff --git a/src/lib/components/InvoicePreview.svelte b/src/lib/components/InvoicePreview.svelte index 0d64140..88d64c6 100644 --- a/src/lib/components/InvoicePreview.svelte +++ b/src/lib/components/InvoicePreview.svelte @@ -33,8 +33,8 @@