refactor: rename 'title' to 'name' in CategoryIndex component for consistency with data model
This commit is contained in:
parent
0c9d58b551
commit
fd1c215ede
@ -41,7 +41,7 @@ export default function CategoryIndex({ categories }: { categories: Category[] }
|
||||
const [selectedCategory, setSelectedCategory] = useState<Category | null>(null);
|
||||
|
||||
const { data, setData, post, patch, processing, errors, reset, clearErrors } = useForm({
|
||||
title: '',
|
||||
name: '',
|
||||
});
|
||||
|
||||
const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false);
|
||||
@ -54,7 +54,7 @@ export default function CategoryIndex({ categories }: { categories: Category[] }
|
||||
setIsEditing(true);
|
||||
setSelectedCategory(category);
|
||||
setData({
|
||||
title: category.title,
|
||||
name: category.name,
|
||||
});
|
||||
setIsOpen(true);
|
||||
};
|
||||
@ -128,13 +128,13 @@ export default function CategoryIndex({ categories }: { categories: Category[] }
|
||||
|
||||
const columns: ColumnDef<Category>[] = [
|
||||
{
|
||||
accessorKey: "title",
|
||||
accessorKey: "name",
|
||||
header: ({ column }) => {
|
||||
return (
|
||||
<DataTableColumnHeader column={column} title="Judul" />
|
||||
<DataTableColumnHeader column={column} title="Nama" />
|
||||
)
|
||||
},
|
||||
meta: { title: "Judul" },
|
||||
meta: { title: "Nama" },
|
||||
},
|
||||
{
|
||||
accessorKey: "is_active",
|
||||
@ -205,17 +205,17 @@ export default function CategoryIndex({ categories }: { categories: Category[] }
|
||||
<form onSubmit={onSubmit}>
|
||||
<FieldGroup>
|
||||
<Field>
|
||||
<Label htmlFor="title">Judul</Label>
|
||||
<Label htmlFor="name">Nama</Label>
|
||||
<Input
|
||||
id="title"
|
||||
name="title"
|
||||
value={data.title}
|
||||
onChange={e => setData('title', e.target.value)}
|
||||
id="name"
|
||||
name="name"
|
||||
value={data.name}
|
||||
onChange={e => setData('name', e.target.value)}
|
||||
autoComplete='off'
|
||||
placeholder='Contoh: Gamis'
|
||||
maxLength={50}
|
||||
/>
|
||||
{errors.title && <p className="text-xs text-red-500">{errors.title}</p>}
|
||||
{errors.name && <p className="text-xs text-red-500">{errors.name}</p>}
|
||||
</Field>
|
||||
</FieldGroup>
|
||||
<DialogFooter className="mt-6">
|
||||
@ -268,7 +268,7 @@ export default function CategoryIndex({ categories }: { categories: Category[] }
|
||||
</AlertDialogMedia>
|
||||
<AlertDialogTitle>Hapus kategori?</AlertDialogTitle>
|
||||
<AlertDialogDescription>
|
||||
Tindakan ini tidak dapat dibatalkan. Kategori <strong>{categoryToDelete?.title}</strong> akan dihapus secara permanen.
|
||||
Tindakan ini tidak dapat dibatalkan. Kategori <strong>{categoryToDelete?.name}</strong> akan dihapus secara permanen.
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user