update fix create and update provider

This commit is contained in:
Wikzyy
2025-03-10 13:27:51 +07:00
parent 8c930ae17a
commit cf7183aa99
2 changed files with 19 additions and 6 deletions

View File

@ -68,6 +68,7 @@ const AddDialog = () => {
if (
formField.name === '' ||
formField.description === '' ||
formField.type === '' ||
formField.status === '' ||
formField.transactionTypeId === '' ||
formField.agentId === ''
@ -138,7 +139,9 @@ const AddDialog = () => {
<div className="w-full">
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label className="form-label flex items-center gap-1 max-w-56">Type</label>
<label className="form-label flex items-center gap-1 max-w-56">
Type<span className="text-red-500">*</span>
</label>
<Input
className="input"
type="text"

View File

@ -3,7 +3,7 @@ import { useManageProviderContext } from '../hooks/useManageProviderContext';
import { Alert, useDataGrid } from '@/components';
import { useCallApi } from '@/hooks';
import { getAuth } from '@/auth';
import React, { useCallback, useState } from 'react';
import React, { useCallback, useEffect, useState } from 'react';
import { toast } from 'sonner';
import {
Dialog,
@ -35,8 +35,8 @@ const EditDialog = () => {
status: '',
transactionTypeId: '',
agentId: '',
created_by: '',
created_at: ''
updated_by: '',
updated_at: ''
};
const [formField, setFormField] = useState(initialState);
@ -79,16 +79,26 @@ const EditDialog = () => {
return;
}
// doUpdateProvider(e);
doUpdateProvider(e);
console.log(formField);
setAlert({ show: false, message: '' });
};
useEffect(() => {
if (showEditDialog) {
setFormField({
...formField,
updated_by: parsedUser.username,
updated_at: formattedTime
});
}
}, [formattedTime]);
return (
<Dialog open={showEditDialog} onOpenChange={(open) => handleEditDialog(open, null)}>
<DialogContent className="container-fixed max-w-[768px] flex flex-col p-5 overflow-hidden">
<DialogHeader>
<DialogTitle>Provider - Create</DialogTitle>
<DialogTitle>Provider - Update</DialogTitle>
<DialogDescription></DialogDescription>
</DialogHeader>
<DialogBody>