fix create and update

- change posto_adm_id to postoId
This commit is contained in:
Wikzyy
2025-03-25 10:05:07 +07:00
parent 3a0c01ca65
commit 50bd7980b2
3 changed files with 14 additions and 14 deletions

View File

@ -45,7 +45,7 @@ const AddDialog = () => {
});
const initialState = {
name: '',
posto_adm_id: 0,
postoId: 0,
created_by: '',
created_at: ''
};
@ -80,7 +80,7 @@ const AddDialog = () => {
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
if (formField.name.trim() === '' || formField.posto_adm_id === 0) {
if (formField.name.trim() === '' || formField.postoId === 0) {
setAlert({ show: true, message: 'Please fill in all required fields.' });
return;
}
@ -117,7 +117,7 @@ const AddDialog = () => {
order_field: sorting[0].id,
order_direction: sorting[0].desc == false ? 'ASC' : 'DESC'
});
console.log('ini data posto :', response?.data);
// console.log('ini data posto :', response?.data);
setPostoadms(response?.data.list || []);
} catch (error) {
console.log('Error fetching posto', error);
@ -166,7 +166,7 @@ const AddDialog = () => {
<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild>
<button type="button" className="input col-span-5 text-left">
{posto_adms.find((posto) => posto.PostoAdms_id === formField.posto_adm_id)
{posto_adms.find((posto) => posto.PostoAdms_id === formField.postoId)
?.PostoAdms_name || 'Select Posto Administrativo'}
</button>
</PopoverTrigger>
@ -183,7 +183,7 @@ const AddDialog = () => {
onSelect={() => {
setFormField({
...formField,
posto_adm_id: posto.PostoAdms_id
postoId: posto.PostoAdms_id
});
setOpen(false);
}}