edit loan modal added, employer verify api added
This commit was merged in pull request #32.
This commit is contained in:
@@ -4,17 +4,21 @@ import { MenuComponent } from "../../../../../../_digifi/assets/ts/components";
|
||||
import { ID, KTIcon, QUERIES } from "../../../../../../_digifi/helpers";
|
||||
import { useListView } from "../../core/ListViewProvider";
|
||||
import { useQueryResponse } from "../../core/QueryResponseProvider";
|
||||
import { deleteUser } from "../../../core/_requests";
|
||||
import { employersVerify } from "../../../core/_requests";
|
||||
import { User } from "../../../core/_models";
|
||||
|
||||
type Props = {
|
||||
id: ID;
|
||||
data?: Array<User> | any
|
||||
};
|
||||
|
||||
const UserActionsCell: FC<Props> = ({ id }) => {
|
||||
const UserActionsCell: FC<Props> = ({ id, data }) => {
|
||||
const { setItemIdForUpdate } = useListView();
|
||||
const { query } = useQueryResponse();
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
let selectedUser = data?.filter((item:User) => item.uid == id)[0]
|
||||
|
||||
useEffect(() => {
|
||||
MenuComponent.reinitialization();
|
||||
}, []);
|
||||
@@ -23,14 +27,21 @@ const UserActionsCell: FC<Props> = ({ id }) => {
|
||||
setItemIdForUpdate(id);
|
||||
};
|
||||
|
||||
const deleteItem = useMutation(() => deleteUser(id), {
|
||||
const empsVerify = useMutation(() => employersVerify(selectedUser?.employer_uid), {
|
||||
// 💡 response of the mutation is passed to onSuccess
|
||||
onSuccess: () => {
|
||||
// ✅ update detail view directly
|
||||
queryClient.invalidateQueries([`${QUERIES.USERS_LIST}-${query}`]);
|
||||
queryClient.invalidateQueries([`${QUERIES.READY_LIST}-${query}`]);
|
||||
},
|
||||
});
|
||||
|
||||
const resendVerification = async () => { // FUNCTION TO RESEND VERIFICATION
|
||||
let cont = confirm('Are you sure, you want to send resend verification?')
|
||||
if(cont){
|
||||
await empsVerify.mutateAsync()
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<a
|
||||
@@ -60,7 +71,7 @@ const UserActionsCell: FC<Props> = ({ id }) => {
|
||||
<a
|
||||
className="menu-link px-3"
|
||||
data-kt-users-table-filter="delete_row"
|
||||
onClick={async () => await deleteItem.mutateAsync()}
|
||||
onClick={async () => resendVerification()}
|
||||
>
|
||||
Resend Verification
|
||||
</a>
|
||||
|
||||
@@ -58,7 +58,7 @@ const usersColumns: ReadonlyArray<Column<User>> = [
|
||||
<UserCustomHeader tableProps={props} title='Actions' className='text-end min-w-100px' />
|
||||
),
|
||||
id: 'actions',
|
||||
Cell: ({...props}) => <UserActionsCell id={props.data[props.row.index].uid} />,
|
||||
Cell: ({...props}) => <UserActionsCell id={props.data[props.row.index].uid} data={props?.data} />,
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user