Added basic RBAC component BOD-232
This commit is contained in:
@@ -7,17 +7,18 @@ import { connect } from "react-redux";
|
||||
import { useParams } from "react-router-dom";
|
||||
import AlertComponent from "../../components/alert/alert.component";
|
||||
import CourtesyCarReturnModalContainer from "../../components/courtesy-car-return-modal/courtesy-car-return-modal.container";
|
||||
import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component";
|
||||
import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component";
|
||||
import {
|
||||
QUERY_CONTRACT_BY_PK,
|
||||
UPDATE_CONTRACT,
|
||||
} from "../../graphql/cccontracts.queries";
|
||||
import {
|
||||
setBreadcrumbs,
|
||||
addRecentItem,
|
||||
setBreadcrumbs,
|
||||
} from "../../redux/application/application.actions";
|
||||
import ContractDetailPageComponent from "./contract-detail.page.component";
|
||||
import { CreateRecentItem } from "../../utils/create-recent-item";
|
||||
import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component";
|
||||
import ContractDetailPageComponent from "./contract-detail.page.component";
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
|
||||
@@ -94,41 +95,43 @@ export function ContractDetailPageContainer({ setBreadcrumbs, addRecentItem }) {
|
||||
if (loading) return <LoadingSpinner />;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<CourtesyCarReturnModalContainer />
|
||||
<Form
|
||||
form={form}
|
||||
autoComplete="no"
|
||||
layout="vertical"
|
||||
onFinish={handleFinish}
|
||||
initialValues={{
|
||||
...data.cccontracts_by_pk,
|
||||
start: data.cccontracts_by_pk.start
|
||||
? moment(data.cccontracts_by_pk.start)
|
||||
: null,
|
||||
scheduledreturn: data.cccontracts_by_pk.scheduledreturn
|
||||
? moment(data.cccontracts_by_pk.scheduledreturn)
|
||||
: null,
|
||||
actualreturn: data.cccontracts_by_pk.actualreturn
|
||||
? moment(data.cccontracts_by_pk.actualreturn)
|
||||
: null,
|
||||
driver_dlexpiry: data.cccontracts_by_pk.driver_dlexpiry
|
||||
? moment(data.cccontracts_by_pk.driver_dlexpiry)
|
||||
: null,
|
||||
driver_dob: data.cccontracts_by_pk.driver_dob
|
||||
? moment(data.cccontracts_by_pk.driver_dob)
|
||||
: null,
|
||||
}}
|
||||
>
|
||||
<ContractDetailPageComponent
|
||||
contract={data ? data.cccontracts_by_pk : null}
|
||||
job={data ? data.cccontracts_by_pk.job : null}
|
||||
courtesyCar={data ? data.cccontracts_by_pk.courtesycar : null}
|
||||
refetch={refetch}
|
||||
<RbacWrapper action="contracts:detail">
|
||||
<div>
|
||||
<CourtesyCarReturnModalContainer />
|
||||
<Form
|
||||
form={form}
|
||||
/>
|
||||
</Form>
|
||||
</div>
|
||||
autoComplete="no"
|
||||
layout="vertical"
|
||||
onFinish={handleFinish}
|
||||
initialValues={{
|
||||
...data.cccontracts_by_pk,
|
||||
start: data.cccontracts_by_pk.start
|
||||
? moment(data.cccontracts_by_pk.start)
|
||||
: null,
|
||||
scheduledreturn: data.cccontracts_by_pk.scheduledreturn
|
||||
? moment(data.cccontracts_by_pk.scheduledreturn)
|
||||
: null,
|
||||
actualreturn: data.cccontracts_by_pk.actualreturn
|
||||
? moment(data.cccontracts_by_pk.actualreturn)
|
||||
: null,
|
||||
driver_dlexpiry: data.cccontracts_by_pk.driver_dlexpiry
|
||||
? moment(data.cccontracts_by_pk.driver_dlexpiry)
|
||||
: null,
|
||||
driver_dob: data.cccontracts_by_pk.driver_dob
|
||||
? moment(data.cccontracts_by_pk.driver_dob)
|
||||
: null,
|
||||
}}
|
||||
>
|
||||
<ContractDetailPageComponent
|
||||
contract={data ? data.cccontracts_by_pk : null}
|
||||
job={data ? data.cccontracts_by_pk.job : null}
|
||||
courtesyCar={data ? data.cccontracts_by_pk.courtesycar : null}
|
||||
refetch={refetch}
|
||||
form={form}
|
||||
/>
|
||||
</Form>
|
||||
</div>
|
||||
</RbacWrapper>
|
||||
);
|
||||
}
|
||||
export default connect(null, mapDispatchToProps)(ContractDetailPageContainer);
|
||||
|
||||
Reference in New Issue
Block a user