added signalR for project Branch
This commit is contained in:
parent
18e739f3ab
commit
48f314eac4
@ -66,19 +66,10 @@ const Jobs = () => {
|
||||
<div className="col-12 col-md-6 text-start">
|
||||
<button
|
||||
type="button"
|
||||
className={`btn btn-sm ${showArchive ? "btn-primary" : "btn-outline-secondary"}`}
|
||||
className={`btn btn-sm ${showArchive ? "btn-secondary" : "btn-outline-secondary"}`}
|
||||
onClick={() => setShowArchive(!showArchive)}
|
||||
style={{ fontSize: "13px" }}
|
||||
>
|
||||
{showArchive ? (
|
||||
<>
|
||||
<i className="bx bx-list-ul me-1 mt-1"></i> Show Active
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<i className="bx bx-archive me-1 mt-1"></i> Show Archived
|
||||
</>
|
||||
)}
|
||||
<i className="bx bx-archive bx-sm me-1 mt-1"></i> Archived
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
||||
@ -59,8 +59,8 @@ export const useCreateServiceProject = (onSuccessCallback) => {
|
||||
onError: (error) => {
|
||||
showToast(
|
||||
error?.response?.data?.message ||
|
||||
error.message ||
|
||||
"Failed to delete task",
|
||||
error.message ||
|
||||
"Failed to delete task",
|
||||
"error"
|
||||
);
|
||||
},
|
||||
@ -84,8 +84,8 @@ export const useUpdateServiceProject = (onSuccessCallback) => {
|
||||
onError: (error) => {
|
||||
showToast(
|
||||
error?.response?.data?.message ||
|
||||
error.message ||
|
||||
"Failed to update project",
|
||||
error.message ||
|
||||
"Failed to update project",
|
||||
"error"
|
||||
);
|
||||
},
|
||||
@ -110,8 +110,8 @@ export const useActiveInActiveServiceProject = (onSuccessCallback) => {
|
||||
onError: (error) => {
|
||||
showToast(
|
||||
error?.response?.data?.message ||
|
||||
error.message ||
|
||||
"Failed to update project",
|
||||
error.message ||
|
||||
"Failed to update project",
|
||||
"error"
|
||||
);
|
||||
},
|
||||
@ -138,8 +138,8 @@ export const useAllocationServiceProjectTeam = (onSuccessCallback) => {
|
||||
onError: (error) => {
|
||||
showToast(
|
||||
error?.response?.data?.message ||
|
||||
error.message ||
|
||||
"Failed to update project",
|
||||
error.message ||
|
||||
"Failed to update project",
|
||||
"error"
|
||||
);
|
||||
},
|
||||
@ -148,11 +148,6 @@ export const useAllocationServiceProjectTeam = (onSuccessCallback) => {
|
||||
|
||||
//#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//#region Service Jobs
|
||||
|
||||
export const useServiceProjectJobs = (
|
||||
@ -163,7 +158,14 @@ export const useServiceProjectJobs = (
|
||||
isArchive
|
||||
) => {
|
||||
return useQuery({
|
||||
queryKey: ["serviceProjectJobs", pageSize, pageNumber, isActive, project, isArchive],
|
||||
queryKey: [
|
||||
"serviceProjectJobs",
|
||||
pageSize,
|
||||
pageNumber,
|
||||
isActive,
|
||||
project,
|
||||
isArchive,
|
||||
],
|
||||
queryFn: async () => {
|
||||
const resp = await ServiceProjectRepository.GetJobList(
|
||||
pageSize,
|
||||
@ -230,8 +232,8 @@ export const useAddCommentJob = (onSuccessCallback) => {
|
||||
onError: (error) => {
|
||||
showToast(
|
||||
error?.response?.data?.message ||
|
||||
error.message ||
|
||||
"Failed to update project",
|
||||
error.message ||
|
||||
"Failed to update project",
|
||||
"error"
|
||||
);
|
||||
},
|
||||
@ -254,8 +256,8 @@ export const useCreateServiceProjectJob = (onSuccessCallback) => {
|
||||
onError: (error) => {
|
||||
showToast(
|
||||
error?.response?.data?.message ||
|
||||
error.message ||
|
||||
"Failed to update project",
|
||||
error.message ||
|
||||
"Failed to update project",
|
||||
"error"
|
||||
);
|
||||
},
|
||||
@ -284,27 +286,19 @@ export const useUpdateServiceProjectJob = (onSuccessCallback) => {
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
onError: (error) => {
|
||||
showToast(
|
||||
error?.response?.data?.message ||
|
||||
error.message ||
|
||||
"Failed to update project",
|
||||
error.message ||
|
||||
"Failed to update project",
|
||||
"error"
|
||||
);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
//#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//#region Branch
|
||||
export const useBranches = (
|
||||
projectId,
|
||||
@ -343,8 +337,8 @@ export const useBranchTypes = () => {
|
||||
const resp = await ServiceProjectRepository.GetBranchTypeList();
|
||||
return resp.data;
|
||||
},
|
||||
})
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export const useBranchDetails = (id) => {
|
||||
return useQuery({
|
||||
@ -353,9 +347,9 @@ export const useBranchDetails = (id) => {
|
||||
const resp = await ServiceProjectRepository.GetBranchDetail(id);
|
||||
return resp.data;
|
||||
},
|
||||
enabled: !!id
|
||||
})
|
||||
}
|
||||
enabled: !!id,
|
||||
});
|
||||
};
|
||||
|
||||
export const useCreateBranch = (onSuccessCallBack) => {
|
||||
const queryClient = useQueryClient();
|
||||
@ -401,7 +395,6 @@ export const useUpdateBranch = (onSuccessCallBack) => {
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
export const useDeleteBranch = () => {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
@ -411,14 +404,17 @@ export const useDeleteBranch = () => {
|
||||
|
||||
onSuccess: (_, variable) => {
|
||||
queryClient.invalidateQueries({ queryKey: ["branches"] });
|
||||
showToast(`Branch ${variable.isActive ? "restored" : "deleted"} successfully`, "success");
|
||||
showToast(
|
||||
`Branch ${variable.isActive ? "restored" : "deleted"} successfully`,
|
||||
"success"
|
||||
);
|
||||
},
|
||||
|
||||
onError: (error) => {
|
||||
showToast(
|
||||
error?.response?.data?.message ||
|
||||
error.message ||
|
||||
"Failed to delete branch",
|
||||
error.message ||
|
||||
"Failed to delete branch",
|
||||
"error"
|
||||
);
|
||||
},
|
||||
|
||||
@ -150,6 +150,9 @@ export function startSignalR(loggedUser) {
|
||||
queryClient.invalidateQueries(["serviceProjects"]);
|
||||
queryClient.invalidateQueries(["serviceProject"]);
|
||||
}
|
||||
if (keyword === "Project_Branch") {
|
||||
queryClient.invalidateQueries(["branches"]);
|
||||
}
|
||||
|
||||
if (keyword === "Service_Project_Allocation") {
|
||||
queryClient.invalidateQueries(["serviceProjectTeam"]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user