update fix create and update provider
This commit is contained in:
@ -68,6 +68,7 @@ const AddDialog = () => {
|
|||||||
if (
|
if (
|
||||||
formField.name === '' ||
|
formField.name === '' ||
|
||||||
formField.description === '' ||
|
formField.description === '' ||
|
||||||
|
formField.type === '' ||
|
||||||
formField.status === '' ||
|
formField.status === '' ||
|
||||||
formField.transactionTypeId === '' ||
|
formField.transactionTypeId === '' ||
|
||||||
formField.agentId === ''
|
formField.agentId === ''
|
||||||
@ -138,7 +139,9 @@ const AddDialog = () => {
|
|||||||
|
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
<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
|
<Input
|
||||||
className="input"
|
className="input"
|
||||||
type="text"
|
type="text"
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { useManageProviderContext } from '../hooks/useManageProviderContext';
|
|||||||
import { Alert, useDataGrid } from '@/components';
|
import { Alert, useDataGrid } from '@/components';
|
||||||
import { useCallApi } from '@/hooks';
|
import { useCallApi } from '@/hooks';
|
||||||
import { getAuth } from '@/auth';
|
import { getAuth } from '@/auth';
|
||||||
import React, { useCallback, useState } from 'react';
|
import React, { useCallback, useEffect, useState } from 'react';
|
||||||
import { toast } from 'sonner';
|
import { toast } from 'sonner';
|
||||||
import {
|
import {
|
||||||
Dialog,
|
Dialog,
|
||||||
@ -35,8 +35,8 @@ const EditDialog = () => {
|
|||||||
status: '',
|
status: '',
|
||||||
transactionTypeId: '',
|
transactionTypeId: '',
|
||||||
agentId: '',
|
agentId: '',
|
||||||
created_by: '',
|
updated_by: '',
|
||||||
created_at: ''
|
updated_at: ''
|
||||||
};
|
};
|
||||||
const [formField, setFormField] = useState(initialState);
|
const [formField, setFormField] = useState(initialState);
|
||||||
|
|
||||||
@ -79,16 +79,26 @@ const EditDialog = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// doUpdateProvider(e);
|
doUpdateProvider(e);
|
||||||
console.log(formField);
|
console.log(formField);
|
||||||
setAlert({ show: false, message: '' });
|
setAlert({ show: false, message: '' });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (showEditDialog) {
|
||||||
|
setFormField({
|
||||||
|
...formField,
|
||||||
|
updated_by: parsedUser.username,
|
||||||
|
updated_at: formattedTime
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [formattedTime]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open={showEditDialog} onOpenChange={(open) => handleEditDialog(open, null)}>
|
<Dialog open={showEditDialog} onOpenChange={(open) => handleEditDialog(open, null)}>
|
||||||
<DialogContent className="container-fixed max-w-[768px] flex flex-col p-5 overflow-hidden">
|
<DialogContent className="container-fixed max-w-[768px] flex flex-col p-5 overflow-hidden">
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>Provider - Create</DialogTitle>
|
<DialogTitle>Provider - Update</DialogTitle>
|
||||||
<DialogDescription></DialogDescription>
|
<DialogDescription></DialogDescription>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
<DialogBody>
|
<DialogBody>
|
||||||
|
|||||||
Reference in New Issue
Block a user