fix define row to match with response

This commit is contained in:
Wikzyy
2025-03-21 15:22:44 +07:00
parent b1e93f0909
commit be7b3fa458

View File

@ -56,7 +56,7 @@ const EditDialog = () => {
type: '',
status: '',
transactionTypeId: '',
agentId: '',
agent: '',
updated_by: '',
updated_at: ''
};
@ -128,7 +128,7 @@ const EditDialog = () => {
const doFetchData = useCallback(async (id: string) => {
const response = await GetData(`${API_URL_MASTERDATA}/provider/getdata/${id}`, { id });
console.log(response);
if (response?.status) {
setFormField((prev) => ({
...prev,
@ -137,7 +137,7 @@ const EditDialog = () => {
type: response?.data.type,
status: response?.data.status,
transactionTypeId: response?.data.transactionTypeId,
agentId: response?.data.agentId
agent: response?.data.agent
}));
}
}, []);
@ -151,7 +151,7 @@ const EditDialog = () => {
formField.type.trim() === '' ||
formField.status.trim() === '' ||
formField.transactionTypeId.trim() === '' ||
formField.agentId.trim() === ''
formField.agent.trim() === ''
) {
setAlert({ show: true, message: 'Please fill in all required fields.' });
return;
@ -309,7 +309,7 @@ const EditDialog = () => {
<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild>
<button type="button" className="input col-span-5 text-left">
{customers.find((customer) => customer.msisdn === formField.agentId)
{customers.find((customer) => customer.msisdn === formField.agent)
?.fullname || 'Select Agent'}
</button>
</PopoverTrigger>
@ -326,7 +326,7 @@ const EditDialog = () => {
onSelect={() => {
setFormField({
...formField,
agentId: customer.msisdn
agent: customer.msisdn
});
setOpen(false);
}}