Merge branch 'dev' of http://git.wdipl.com/Siddhesh.More/tanami-admin-panel into dev
This commit is contained in:
@@ -31,6 +31,7 @@ import ToastBox from "../../../Components/ToastBox";
|
||||
import { debounce } from "./AddSponser";
|
||||
import { TABLE_PAGINATION } from "../../../Constants/Paginations";
|
||||
import {
|
||||
useDeleteSponserMutation,
|
||||
useGetSponserMasterQuery,
|
||||
useToggleStatusMutation,
|
||||
} from "../../../Services/sponser.service";
|
||||
@@ -63,6 +64,8 @@ const Sponser = () => {
|
||||
const [mouseEntered, setMouseEntered] = useState(false);
|
||||
const [mouseEnteredId, setMouseEnteredId] = useState("");
|
||||
const [toggleStatus] = useToggleStatusMutation();
|
||||
const [deleteSponser] = useDeleteSponserMutation();
|
||||
|
||||
// useEffect(() => {
|
||||
// setSponser(sponsors)
|
||||
// }, [])
|
||||
@@ -256,44 +259,20 @@ const Sponser = () => {
|
||||
</Tooltip>
|
||||
</Box>
|
||||
),
|
||||
|
||||
// "Created At":
|
||||
// mouseEntered && mouseEnteredId === item?.id ? (
|
||||
// // false ? (
|
||||
// <Box w={38} as="span" display={"flex"} justifyContent={"start"} gap={3}>
|
||||
// <Box as="span" p={1} className="link" rounded={'sm'} >
|
||||
// <EditIcon fontSize={'md'} />
|
||||
// </Box>
|
||||
// <Box as="span" p={1} className="link" rounded={'sm'} >
|
||||
// <ViewIcon fontSize={'md'} />
|
||||
// </Box>
|
||||
// <Box as="span" p={1} className="link" rounded={'sm'} >
|
||||
// <DeleteIcon fontSize={'md'} />
|
||||
// </Box>
|
||||
// </Box>
|
||||
// ) : (
|
||||
// <Box
|
||||
// as="span" display={"flex"} justifyContent={"start"}
|
||||
// p={1}
|
||||
// >
|
||||
// <Text as={"span"} color={"gray.600"} fontWeight={"500"}>
|
||||
// {formatDate(item.createdAt)}
|
||||
// </Text>
|
||||
// </Box>
|
||||
// ),
|
||||
}));
|
||||
|
||||
const handleDelete = () => {
|
||||
const updatedSponsors = sponser.filter(
|
||||
(sponsor) => sponsor.id !== actionId
|
||||
);
|
||||
|
||||
setTimeout(() => {
|
||||
setSponser(updatedSponsors);
|
||||
setDeleteAlert(false);
|
||||
setIsLoading(false);
|
||||
}, 100);
|
||||
const handleDelete = async() => {
|
||||
console.log(actionId);
|
||||
setIsLoading(true);
|
||||
try {
|
||||
const response = await deleteSponser(actionId)
|
||||
console.log(response);
|
||||
setIsLoading(false);
|
||||
setDeleteAlert(false)
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -5,6 +5,7 @@ import { useContext, useEffect, useState } from "react";
|
||||
import FormInputView from "../../../Components/FormInputView";
|
||||
import { useForm } from "react-hook-form"; // assuming react-hook-form is used
|
||||
import { OPACITY_ON_LOAD } from "../../../Layout/animations";
|
||||
import { useGetSponserByIdQuery } from "../../../Services/sponser.service";
|
||||
|
||||
const ViewSponser = () => {
|
||||
const params = useParams();
|
||||
@@ -12,6 +13,8 @@ const ViewSponser = () => {
|
||||
const { reset } = useForm(); // assuming react-hook-form
|
||||
const { data, error, isLoading } = useGetSponserByIdQuery(params?.id);
|
||||
|
||||
console.log(data?.data);
|
||||
|
||||
|
||||
if (!data) {
|
||||
return <Box>Loading...</Box>;
|
||||
@@ -20,15 +23,18 @@ const ViewSponser = () => {
|
||||
const formFields = [
|
||||
{
|
||||
label: "Sponser name",
|
||||
value:data?.sponsorName
|
||||
value:data?.data?.sponsorName,
|
||||
section: "",
|
||||
},
|
||||
{
|
||||
label: "Sponser name (Arabic)",
|
||||
value:data?.sponsorNameArabic
|
||||
value:data?.data?.sponsorNameArabic,
|
||||
section: "",
|
||||
},
|
||||
{
|
||||
label: "Mobile Number",
|
||||
value:data?.mobileNo
|
||||
value:data?.data?.mobileNo,
|
||||
section: "",
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
@@ -52,6 +52,15 @@ export const sponserMaster = createApi({
|
||||
}),
|
||||
invalidatesTags: ["getSponser"],
|
||||
}),
|
||||
|
||||
deleteSponser: builder.mutation({
|
||||
query: (id) => ({
|
||||
url: `/sponsor/admin/delete/${id}`,
|
||||
method: "DELETE",
|
||||
}),
|
||||
invalidatesTags: ["getSponser"],
|
||||
}),
|
||||
|
||||
}),
|
||||
});
|
||||
|
||||
@@ -63,4 +72,5 @@ export const {
|
||||
useCreateSponserMutation,
|
||||
useUpdateSponserMutation,
|
||||
useGetSponserByIdQuery,
|
||||
useDeleteSponserMutation
|
||||
} = sponserMaster;
|
||||
|
||||
Reference in New Issue
Block a user