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