BugFix: restored location forms

This commit is contained in:
2024-02-17 09:46:36 +01:00
parent fcd94408fe
commit cc8c6968f6
8 changed files with 93 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
import { LocationEditForm } from '@/app/ui/LocationEditForm';
import { YearMonth } from '@/app/lib/db-types';
export default async function LocationAddPage({ yearMonth }: { yearMonth:YearMonth }) {
return (<LocationEditForm yearMonth={yearMonth} />);
}

View File

@@ -0,0 +1,11 @@
import { parseYearMonth } from '@/app/lib/format';
import LocationAddPage from './LocationAddPage';
import { Main } from '@/app/ui/Main';
export default async function Page({ params:{ id } }: { params: { id:string } }) {
return (
<Main>
<LocationAddPage yearMonth={ parseYearMonth(id) } />
</Main>
);
}

View File

@@ -0,0 +1,14 @@
import { notFound } from 'next/navigation';
import { fetchLocationById } from '@/app/lib/actions/locationActions';
import { LocationDeleteForm } from '@/app/ui/LocationDeleteForm';
export const LocationDeletePage = async ({ locationId }: { locationId:string }) => {
const location = await fetchLocationById(locationId);
if (!location) {
return(notFound());
}
return (<LocationDeleteForm location={location} />);
}

View File

@@ -0,0 +1,6 @@
import { NotFoundPage } from '@/app/ui/NotFoundPage';
const BillingLocationNotFound = () =>
<NotFoundPage title="404 Billing Location Not Found" description="Could not find the requested Billing Location." />;
export default BillingLocationNotFound;

View File

@@ -0,0 +1,19 @@
import { notFound } from 'next/navigation';
import { fetchLocationById } from '@/app/lib/actions/locationActions';
import { LocationDeleteForm } from '@/app/ui/LocationDeleteForm';
import { Main } from '@/app/ui/Main';
export default async function Page({ params:{ id } }: { params: { id:string } }) {
const location = await fetchLocationById(id);
if (!location) {
return(notFound());
}
return (
<Main>
<LocationDeleteForm location={location} />
</Main>
);
}

View File

@@ -0,0 +1,16 @@
import { notFound } from 'next/navigation';
import { LocationEditForm } from '@/app/ui/LocationEditForm';
import { fetchLocationById } from '@/app/lib/actions/locationActions';
export default async function LocationEditPage({ locationId }: { locationId:string }) {
const location = await fetchLocationById(locationId);
if (!location) {
return(notFound());
}
const result = <LocationEditForm location={location} />;
return (result);
}

View File

@@ -0,0 +1,6 @@
import { NotFoundPage } from '@/app/ui/NotFoundPage';
const BillingLocationNotFound = () =>
<NotFoundPage title="404 Location Not Found" description="Could not find the requested Location." />;
export default BillingLocationNotFound;

View File

@@ -0,0 +1,15 @@
import { Suspense } from 'react';
import LocationEditPage from './LocationEditPage';
import { Main } from '@/app/ui/Main';
import { LocationEditFormSkeleton } from '@/app/ui/LocationEditForm';
export default async function Page({ params:{ id } }: { params: { id:string } }) {
return (
<Main>
<Suspense fallback={<LocationEditFormSkeleton />}>
<LocationEditPage locationId={id} />
</Suspense>
</Main>
);
}