diff --git a/ui/package-lock.json b/ui/package-lock.json index 3c786eb3..d13bb735 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -34,10 +34,10 @@ "prettier-plugin-svelte": "^3.1.2", "svelte": "^5.0.0-next.1", "svelte-check": "^3.6.0", - "tailwindcss": "^3.4.3", + "tailwindcss": "^3.4.4", "tslib": "^2.4.1", "typescript": "^5.0.0", - "vite": "^5.0.3", + "vite": "^5.2.13", "vitest": "^1.2.0" } }, @@ -4639,9 +4639,9 @@ } }, "node_modules/tailwindcss": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.3.tgz", - "integrity": "sha512-U7sxQk/n397Bmx4JHbJx/iSOOv5G+II3f1kpLpY2QeUv5DcPdcTsYLlusZfq1NthHS1c1cZoyFmmkex1rzke0A==", + "version": "3.4.4", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.4.tgz", + "integrity": "sha512-ZoyXOdJjISB7/BcLTR6SEsLgKtDStYyYZVLsUtWChO4Ps20CBad7lfJKVDiejocV4ME1hLmyY0WJE3hSDcmQ2A==", "dependencies": { "@alloc/quick-lru": "^5.2.0", "arg": "^5.0.2", @@ -4934,9 +4934,9 @@ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" }, "node_modules/vite": { - "version": "5.2.11", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.2.11.tgz", - "integrity": "sha512-HndV31LWW05i1BLPMUCE1B9E9GFbOu1MbenhS58FuK6owSO5qHm7GiCotrNY1YE5rMeQSFBGmT5ZaLEjFizgiQ==", + "version": "5.2.13", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.2.13.tgz", + "integrity": "sha512-SSq1noJfY9pR3I1TUENL3rQYDQCFqgD+lM6fTRAM8Nv6Lsg5hDLaXkjETVeBt+7vZBCMoibD+6IWnT2mJ+Zb/A==", "dev": true, "dependencies": { "esbuild": "^0.20.1", diff --git a/ui/package.json b/ui/package.json index e41f7e99..37f55ba1 100644 --- a/ui/package.json +++ b/ui/package.json @@ -32,10 +32,10 @@ "prettier-plugin-svelte": "^3.1.2", "svelte": "^5.0.0-next.1", "svelte-check": "^3.6.0", - "tailwindcss": "^3.4.3", + "tailwindcss": "^3.4.4", "tslib": "^2.4.1", "typescript": "^5.0.0", - "vite": "^5.0.3", + "vite": "^5.2.13", "vitest": "^1.2.0" }, "type": "module", diff --git a/ui/src/routes/taxi/+page.server.ts b/ui/src/routes/taxi/+page.server.ts index a3e7c5e2..8fdb1d9d 100644 --- a/ui/src/routes/taxi/+page.server.ts +++ b/ui/src/routes/taxi/+page.server.ts @@ -1,9 +1,7 @@ import { db } from '$lib/database'; export async function load({ url }) { - const day = url.searchParams.get('date') ?? new Date().toISOString().slice(0, 10); - console.log(new Date(day)); - + const day = new Date(url.searchParams.get('date') ?? new Date().toISOString().slice(0, 10)); const company_id = 1; const vehicles = await db .selectFrom('vehicle') @@ -18,6 +16,7 @@ export async function load({ url }) { .execute(); return { vehicles, - tours + tours, + day }; } diff --git a/ui/src/routes/taxi/+page.svelte b/ui/src/routes/taxi/+page.svelte index 12d59af3..ab4bb28d 100644 --- a/ui/src/routes/taxi/+page.svelte +++ b/ui/src/routes/taxi/+page.svelte @@ -4,7 +4,12 @@ import { getCompany } from '$lib/api'; import type { Company } from '$lib/types'; - import { DateFormatter, today, getLocalTimeZone } from '@internationalized/date'; + import { + DateFormatter, + fromDate, + toCalendarDate, + getLocalTimeZone + } from '@internationalized/date'; import CalendarIcon from 'lucide-svelte/icons/calendar'; import { Calendar } from '$lib/components/ui/calendar/index.js'; @@ -37,9 +42,8 @@ vehicle_id!: number; } - let vehicles = $state>(new Map()); - onMount(async () => { - vehicles = new Map( + let vehicles = $state>( + new Map( data.vehicles.map((v) => [ v.id, { @@ -56,20 +60,18 @@ ] } ]) - ); - }); - - let tours = $state>([]); - onMount(async () => { - tours = data.tours.map((t) => ({ + ) + ); + let tours = $state>( + data.tours.map((t) => ({ id: t.id, from: t.departure, to: t.arrival, vehicle_id: t.vehicle - })); - }); + })) + ); - let value = $state(today('CET')); + let value = $state(toCalendarDate(fromDate(data.day, 'CET'))); let day = $derived(new ReactiveDate(value)); $effect(() => {