process page added
This commit was merged in pull request #38.
This commit is contained in:
@@ -1,46 +1,29 @@
|
||||
import { FC, useEffect } from "react";
|
||||
import { useMutation, useQueryClient } from "react-query";
|
||||
import { useQueryClient } from "react-query";
|
||||
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 { employersVerify } from "../../../core/_requests";
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
import { User } from "../../../core/_models";
|
||||
|
||||
type Props = {
|
||||
id: ID;
|
||||
data: Array<User> | any
|
||||
};
|
||||
|
||||
const UserActionsCell: FC<Props> = ({ id }) => {
|
||||
const { setItemIdForUpdate } = useListView();
|
||||
const { query } = useQueryResponse();
|
||||
const queryClient = useQueryClient();
|
||||
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]
|
||||
let selectedUser = data?.filter((item:User) => item.uid == id)[0]
|
||||
|
||||
useEffect(() => {
|
||||
MenuComponent.reinitialization();
|
||||
}, []);
|
||||
|
||||
const openEditModal = () => {
|
||||
setItemIdForUpdate(id);
|
||||
};
|
||||
|
||||
const empsVerify = useMutation(() => employersVerify(id), {
|
||||
// 💡 response of the mutation is passed to onSuccess
|
||||
onSuccess: () => {
|
||||
// ✅ update detail view directly
|
||||
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
|
||||
@@ -59,21 +42,9 @@ const UserActionsCell: FC<Props> = ({ id }) => {
|
||||
>
|
||||
{/* begin::Menu item */}
|
||||
<div className="menu-item px-3">
|
||||
<a className="menu-link px-3" onClick={openEditModal}>
|
||||
Edit
|
||||
</a>
|
||||
</div>
|
||||
{/* end::Menu item */}
|
||||
|
||||
{/* begin::Menu item */}
|
||||
<div className="menu-item px-3">
|
||||
<a
|
||||
className="menu-link px-3"
|
||||
data-kt-users-table-filter="delete_row"
|
||||
onClick={async () => resendVerification()}
|
||||
>
|
||||
Resend Verification
|
||||
</a>
|
||||
<Link state={{selectedUser}} to='/loan/verified/process' className="menu-link px-3">
|
||||
Process
|
||||
</Link>
|
||||
</div>
|
||||
{/* end::Menu item */}
|
||||
</div>
|
||||
|
||||
@@ -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