fix: remove mandatory
All checks were successful
Build and deploy / build-deploy (push) Successful in 1m51s

This commit is contained in:
Ola Malmgren
2026-05-22 22:07:22 +02:00
parent 7e78ace956
commit 12cfa790ad
4 changed files with 18 additions and 15 deletions

View File

@@ -80,7 +80,7 @@ model Booking {
// Organization
orgName String
orgNumber String
orgNumber String?
// Invoice address
address String

View File

@@ -26,47 +26,47 @@ export default async function AdminLayout({
return (
<div className="min-h-screen bg-ink-50">
<header className="border-b border-ink-200 bg-white">
<header className="border-b border-brand-700 bg-brand-600 text-white">
<div className="mx-auto flex max-w-6xl items-center justify-between gap-3 px-4 py-3">
<div className="flex items-center gap-3">
<Link href="/admin" className="text-base font-semibold text-ink-900">
<Link href="/admin" className="text-base font-semibold">
{t('title')}
</Link>
{session?.user && (
<nav className="hidden gap-1 sm:flex">
<Link
href="/admin"
className="rounded-md px-3 py-1.5 text-sm text-ink-600 hover:bg-ink-100"
className="rounded-md px-3 py-1.5 text-sm text-white/80 hover:bg-white/10 hover:text-white"
>
{t('nav.bookings')}
</Link>
<Link
href="/admin/products"
className="rounded-md px-3 py-1.5 text-sm text-ink-600 hover:bg-ink-100"
className="rounded-md px-3 py-1.5 text-sm text-white/80 hover:bg-white/10 hover:text-white"
>
{t('nav.products')}
</Link>
<Link
href="/admin/pickup-slots"
className="rounded-md px-3 py-1.5 text-sm text-ink-600 hover:bg-ink-100"
className="rounded-md px-3 py-1.5 text-sm text-white/80 hover:bg-white/10 hover:text-white"
>
{t('nav.pickupSlots')}
</Link>
<Link
href="/admin/replacements"
className="rounded-md px-3 py-1.5 text-sm text-ink-600 hover:bg-ink-100"
className="rounded-md px-3 py-1.5 text-sm text-white/80 hover:bg-white/10 hover:text-white"
>
{tr('navTitle')}
</Link>
<Link
href="/admin/settings"
className="rounded-md px-3 py-1.5 text-sm text-ink-600 hover:bg-ink-100"
className="rounded-md px-3 py-1.5 text-sm text-white/80 hover:bg-white/10 hover:text-white"
>
{t('nav.settings')}
</Link>
<Link
href="/admin/users"
className="rounded-md px-3 py-1.5 text-sm text-ink-600 hover:bg-ink-100"
className="rounded-md px-3 py-1.5 text-sm text-white/80 hover:bg-white/10 hover:text-white"
>
{t('nav.users')}
</Link>
@@ -82,7 +82,10 @@ export default async function AdminLayout({
await signOut({ redirectTo: '/admin/login' });
}}
>
<button type="submit" className="btn-ghost text-xs">
<button
type="submit"
className="rounded-md px-3 py-1.5 text-xs text-white/80 hover:bg-white/10 hover:text-white"
>
{t('nav.signOut')}
</button>
</form>

View File

@@ -126,7 +126,7 @@ export function BookingForm({
/^\S+@\S+\.\S+$/.test(email) &&
phone.trim().length >= 5 &&
orgName.trim().length >= 2 &&
isValidSeOrgNumber(orgNumber) &&
(orgNumber.trim() === '' || isValidSeOrgNumber(orgNumber)) &&
address.trim().length >= 2 &&
postalCode.trim().length >= 3 &&
city.trim().length >= 1
@@ -347,7 +347,6 @@ export function BookingForm({
/>
<Field
label={t('details.orgNumber')}
required
value={orgNumber}
onChange={(v) => patch({ orgNumber: v })}
placeholder={t('details.orgNumberPlaceholder')}

View File

@@ -14,12 +14,13 @@ export const bookingSubmitSchema = z.object({
orgNumber: z
.string()
.trim()
.min(10)
.max(13)
.refine((v) => isValidSeOrgNumber(v), {
.refine((v) => v === '' || isValidSeOrgNumber(v), {
message: 'invalidOrgNumber',
})
.transform((v) => normalizeOrgNumber(v)),
.transform((v) => (v === '' ? null : normalizeOrgNumber(v)))
.nullable()
.optional(),
address: z.string().trim().min(2).max(200),
postalCode: z.string().trim().min(3).max(20),
city: z.string().trim().min(1).max(100),