Artikel DB struktur geändert von CODEX
This commit is contained in:
1 parent
0c0a678eaa
commit
9c18234efe
95 files changed
+3872
-2316
No files matched your search
@@ -1,37 +1,40 @@
|
||||
import Link from "next/link";
|
||||
import { sites } from "../../../../_config/sites";
|
||||
import { articleFindById } from "../../../../actions/article.actions";
|
||||
import { ArticleMainForm } from "../../../../components/article/articleMain.form";
|
||||
import { categoryFindAll } from "../../../../actions/category.actions";
|
||||
import { manufacturerFindAll } from "../../../../actions/manufacturer.actions";
|
||||
|
||||
interface PageProps {
|
||||
params: Promise<{ id: string }>
|
||||
|
||||
}
|
||||
export default async function CatergoryUpdate({ params }: PageProps) {
|
||||
|
||||
|
||||
const { id } = await params
|
||||
const article = await articleFindById(id);
|
||||
const cats = await categoryFindAll();
|
||||
const manufacturer = await manufacturerFindAll();
|
||||
|
||||
if(!article._id) {
|
||||
return (<div>
|
||||
<div>Artikel nicht gefunden</div>
|
||||
<div>
|
||||
<Link className="cursor-pointer p-2 border-1 border-sky-500 bg-sky-500 text-white rounded-full m-1 hover:bg-sky-700 " href={sites.article.url}>zurück1</Link>
|
||||
</div>
|
||||
</div>)
|
||||
}
|
||||
const {name,category,variants} = article;
|
||||
console.log('Varianten:',article.variants)
|
||||
import Link from 'next/link';
|
||||
import { sites } from '../../../../_config/sites';
|
||||
import {
|
||||
articleFindById,
|
||||
articleGroupsFindAll,
|
||||
} from '../../../../actions/article.actions';
|
||||
import { ArticleMainForm } from '../../../../components/article/articleMain.form';
|
||||
import { categoryFindAll } from '../../../../actions/category.actions';
|
||||
import { manufacturerFindAll } from '../../../../actions/manufacturer.actions';
|
||||
|
||||
export default async function ArticleUpdatePage({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ id: string }>;
|
||||
}) {
|
||||
const { id } = await params;
|
||||
const [article, categories, manufacturer, groups] = await Promise.all([
|
||||
articleFindById(id),
|
||||
categoryFindAll(),
|
||||
manufacturerFindAll(),
|
||||
articleGroupsFindAll(),
|
||||
]);
|
||||
return (
|
||||
<div className="h-screen">
|
||||
<ArticleMainForm initData={article} categories={cats} manufacturer={manufacturer}></ArticleMainForm>
|
||||
<Link className="cursor-pointer p-2 border-1 border-sky-500 bg-sky-500 text-white rounded-full m-1 hover:bg-sky-700 " href={sites.article.url}>zurück</Link>
|
||||
<div>
|
||||
{article ? (
|
||||
<ArticleMainForm
|
||||
initData={article}
|
||||
categories={categories}
|
||||
manufacturer={manufacturer}
|
||||
groups={groups}
|
||||
/>
|
||||
) : (
|
||||
<p>Artikel nicht gefunden.</p>
|
||||
)}
|
||||
<Link className="text-sky-700 p-6" href={sites.article.url}>
|
||||
Zurück zu den Artikeln
|
||||
</Link>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user