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 [selectedCategory, setSelectedCategory] = useState<Category | null>(null);
|
||||||
|
|
||||||
const { data, setData, post, patch, processing, errors, reset, clearErrors } = useForm({
|
const { data, setData, post, patch, processing, errors, reset, clearErrors } = useForm({
|
||||||
title: '',
|
name: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false);
|
const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false);
|
||||||
@ -54,7 +54,7 @@ export default function CategoryIndex({ categories }: { categories: Category[] }
|
|||||||
setIsEditing(true);
|
setIsEditing(true);
|
||||||
setSelectedCategory(category);
|
setSelectedCategory(category);
|
||||||
setData({
|
setData({
|
||||||
title: category.title,
|
name: category.name,
|
||||||
});
|
});
|
||||||
setIsOpen(true);
|
setIsOpen(true);
|
||||||
};
|
};
|
||||||
@ -128,13 +128,13 @@ export default function CategoryIndex({ categories }: { categories: Category[] }
|
|||||||
|
|
||||||
const columns: ColumnDef<Category>[] = [
|
const columns: ColumnDef<Category>[] = [
|
||||||
{
|
{
|
||||||
accessorKey: "title",
|
accessorKey: "name",
|
||||||
header: ({ column }) => {
|
header: ({ column }) => {
|
||||||
return (
|
return (
|
||||||
<DataTableColumnHeader column={column} title="Judul" />
|
<DataTableColumnHeader column={column} title="Nama" />
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
meta: { title: "Judul" },
|
meta: { title: "Nama" },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "is_active",
|
accessorKey: "is_active",
|
||||||
@ -205,17 +205,17 @@ export default function CategoryIndex({ categories }: { categories: Category[] }
|
|||||||
<form onSubmit={onSubmit}>
|
<form onSubmit={onSubmit}>
|
||||||
<FieldGroup>
|
<FieldGroup>
|
||||||
<Field>
|
<Field>
|
||||||
<Label htmlFor="title">Judul</Label>
|
<Label htmlFor="name">Nama</Label>
|
||||||
<Input
|
<Input
|
||||||
id="title"
|
id="name"
|
||||||
name="title"
|
name="name"
|
||||||
value={data.title}
|
value={data.name}
|
||||||
onChange={e => setData('title', e.target.value)}
|
onChange={e => setData('name', e.target.value)}
|
||||||
autoComplete='off'
|
autoComplete='off'
|
||||||
placeholder='Contoh: Gamis'
|
placeholder='Contoh: Gamis'
|
||||||
maxLength={50}
|
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>
|
</Field>
|
||||||
</FieldGroup>
|
</FieldGroup>
|
||||||
<DialogFooter className="mt-6">
|
<DialogFooter className="mt-6">
|
||||||
@ -268,7 +268,7 @@ export default function CategoryIndex({ categories }: { categories: Category[] }
|
|||||||
</AlertDialogMedia>
|
</AlertDialogMedia>
|
||||||
<AlertDialogTitle>Hapus kategori?</AlertDialogTitle>
|
<AlertDialogTitle>Hapus kategori?</AlertDialogTitle>
|
||||||
<AlertDialogDescription>
|
<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>
|
</AlertDialogDescription>
|
||||||
</AlertDialogHeader>
|
</AlertDialogHeader>
|
||||||
<AlertDialogFooter>
|
<AlertDialogFooter>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user