Time Ticket Task Improvmenets.

This commit is contained in:
Patrick Fic
2023-05-25 11:44:01 -07:00
parent 0849bbbba6
commit a56de72a6b
12 changed files with 449 additions and 222 deletions

View File

@@ -9,13 +9,16 @@ import { createStructuredSelector } from "reselect";
import { INSERT_TIME_TICKET_AND_APPROVE } from "../../graphql/timetickets.queries";
import { QUERY_TT_APPROVALS_BY_IDS } from "../../graphql/tt-approvals.queries";
import {
selectAuthLevel,
selectBodyshop,
selectCurrentUser,
} from "../../redux/user/user.selectors";
import { HasRbacAccess } from "../rbac-wrapper/rbac-wrapper.component";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
currentUser: selectCurrentUser,
authLevel: selectAuthLevel,
});
export function TtApproveButton({
@@ -23,6 +26,7 @@ export function TtApproveButton({
currentUser,
selectedTickets,
disabled,
authLevel,
loadingCallback,
completedCallback,
refetch,
@@ -83,7 +87,14 @@ export function TtApproveButton({
};
return (
<Button onClick={handleQbxml} loading={loading} disabled={disabled}>
<Button
onClick={handleQbxml}
loading={loading}
disabled={
disabled ||
!HasRbacAccess({ bodyshop, authLevel, action: "ttapprovals:approve" })
}
>
{t("tt_approvals.actions.approveselected")}
</Button>
);