feat: add file upload and management features; enhance pagination and permissions handling
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
import { useState } from 'react';
|
||||
|
||||
import { Button } from '@kit/ui/button';
|
||||
|
||||
import type { CmsFieldType } from '../schema/module.schema';
|
||||
import { FieldRenderer } from './field-renderer';
|
||||
|
||||
@@ -114,13 +116,13 @@ export function ModuleForm({
|
||||
))}
|
||||
|
||||
<div className="flex justify-end gap-2 border-t pt-4">
|
||||
<button
|
||||
<Button
|
||||
type="submit"
|
||||
disabled={isLoading}
|
||||
className="bg-primary text-primary-foreground hover:bg-primary/90 inline-flex items-center justify-center rounded-md px-4 py-2 text-sm font-medium disabled:opacity-50"
|
||||
data-test="module-record-submit-btn"
|
||||
>
|
||||
{isLoading ? 'Wird gespeichert...' : 'Speichern'}
|
||||
</button>
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
'use client';
|
||||
|
||||
import { useTranslations } from 'next-intl';
|
||||
|
||||
import { formatDate } from '@kit/shared/dates';
|
||||
|
||||
import type { CmsFieldType } from '../schema/module.schema';
|
||||
@@ -56,6 +58,7 @@ export function ModuleTable({
|
||||
onSelectionChange,
|
||||
currentSort,
|
||||
}: ModuleTableProps) {
|
||||
const t = useTranslations('cms.modules');
|
||||
const visibleFields = fields
|
||||
.filter((f) => f.show_in_table)
|
||||
.sort((a, b) => a.sort_order - b.sort_order);
|
||||
@@ -137,7 +140,7 @@ export function ModuleTable({
|
||||
colSpan={visibleFields.length + (onSelectionChange ? 1 : 0)}
|
||||
className="text-muted-foreground p-8 text-center"
|
||||
>
|
||||
Keine Datensätze gefunden
|
||||
{t('noRecords')}
|
||||
</td>
|
||||
</tr>
|
||||
) : (
|
||||
@@ -183,8 +186,11 @@ export function ModuleTable({
|
||||
{pagination.totalPages > 1 && (
|
||||
<div className="flex items-center justify-between px-2">
|
||||
<span className="text-muted-foreground text-sm">
|
||||
{pagination.total} Datensätze — Seite {pagination.page} von{' '}
|
||||
{pagination.totalPages}
|
||||
{t('paginationSummary', {
|
||||
total: pagination.total,
|
||||
page: pagination.page,
|
||||
totalPages: pagination.totalPages,
|
||||
})}
|
||||
</span>
|
||||
<div className="flex gap-1">
|
||||
<button
|
||||
@@ -192,14 +198,14 @@ export function ModuleTable({
|
||||
disabled={pagination.page <= 1}
|
||||
className="hover:bg-muted rounded border px-3 py-1 text-sm disabled:opacity-50"
|
||||
>
|
||||
← Zurück
|
||||
{t('paginationPrevious')}
|
||||
</button>
|
||||
<button
|
||||
onClick={() => onPageChange(pagination.page + 1)}
|
||||
disabled={pagination.page >= pagination.totalPages}
|
||||
className="hover:bg-muted rounded border px-3 py-1 text-sm disabled:opacity-50"
|
||||
>
|
||||
Weiter →
|
||||
{t('paginationNext')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user