FIrst round of changes for Instance Manger & Pro Manager
This commit is contained in:
@@ -3,10 +3,13 @@ root = true
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
trim_trailing_whitespace = false
|
||||
quote_type = single
|
||||
max_line_length = 100
|
||||
bracketSpacing = false
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
@@ -15,4 +18,4 @@ trim_trailing_whitespace = false
|
||||
indent_size = 2
|
||||
|
||||
[*.json]
|
||||
indent_size = 2
|
||||
indent_size = 2
|
||||
|
||||
12
_reference/BodyshopFeatures.json
Normal file
12
_reference/BodyshopFeatures.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"mobile": "date",
|
||||
"allAccess": "bool",
|
||||
"timetickets": "date",
|
||||
"payments": "date",
|
||||
"partsorders": "date",
|
||||
"bills": "Date",
|
||||
"export": "date",
|
||||
"csi": "Date",
|
||||
"courtesycars": "date",
|
||||
"media": "date"
|
||||
}
|
||||
@@ -11,4 +11,4 @@ REACT_APP_STRIPE_PUBLIC_KEY=pk_test_51GqB4TJl3nQjrZ0wCQWAxAhlNF8jKe0tipIa6ExBaxw
|
||||
REACT_APP_AXIOS_BASE_API_URL=http://localhost:4000
|
||||
REACT_APP_REPORTS_SERVER_URL=https://reports3.test.imex.online
|
||||
REACT_APP_SPLIT_API=ts615lqgnmk84thn72uk18uu5pgce6e0l4rc
|
||||
INSTANCE=IMEX
|
||||
REACT_APP_INSTANCE=IMEX
|
||||
|
||||
@@ -11,4 +11,4 @@ REACT_APP_STRIPE_PUBLIC_KEY=pk_test_51GqB4TJl3nQjrZ0wCQWAxAhlNF8jKe0tipIa6ExBaxw
|
||||
REACT_APP_AXIOS_BASE_API_URL=http://localhost:4000
|
||||
REACT_APP_REPORTS_SERVER_URL=https://reports3.test.imex.online
|
||||
REACT_APP_SPLIT_API=ts615lqgnmk84thn72uk18uu5pgce6e0l4rc
|
||||
INSTANCE=PROMANAGER
|
||||
REACT_APP_INSTANCE=PROMANAGER
|
||||
|
||||
@@ -12,4 +12,4 @@ REACT_APP_AXIOS_BASE_API_URL=http://localhost:4000
|
||||
REACT_APP_REPORTS_SERVER_URL=https://reports3.test.imex.online
|
||||
REACT_APP_SPLIT_API=ts615lqgnmk84thn72uk18uu5pgce6e0l4rc
|
||||
REACT_APP_COUNTRY=USA
|
||||
INSTANCE=ROME
|
||||
REACT_APP_INSTANCE=ROME
|
||||
|
||||
@@ -12,4 +12,4 @@ REACT_APP_STRIPE_PUBLIC_KEY=pk_test_51GqB4TJl3nQjrZ0wCQWAxAhlNF8jKe0tipIa6ExBaxw
|
||||
REACT_APP_AXIOS_BASE_API_URL=https://api.imex.online/
|
||||
REACT_APP_REPORTS_SERVER_URL=https://reports.imex.online
|
||||
REACT_APP_SPLIT_API=et9pjkik6bn67he5evpmpr1agoo7gactphgk
|
||||
INSTANCE=IMEX
|
||||
REACT_APP_INSTANCE=IMEX
|
||||
|
||||
@@ -12,4 +12,4 @@ REACT_APP_STRIPE_PUBLIC_KEY=pk_test_51GqB4TJl3nQjrZ0wCQWAxAhlNF8jKe0tipIa6ExBaxw
|
||||
REACT_APP_AXIOS_BASE_API_URL=https://api.imex.online/
|
||||
REACT_APP_REPORTS_SERVER_URL=https://reports.imex.online
|
||||
REACT_APP_SPLIT_API=et9pjkik6bn67he5evpmpr1agoo7gactphgk
|
||||
INSTANCE=PROMANAGER
|
||||
REACT_APP_INSTANCE=PROMANAGER
|
||||
|
||||
@@ -12,4 +12,4 @@ REACT_APP_STRIPE_PUBLIC_KEY=pk_test_51GqB4TJl3nQjrZ0wCQWAxAhlNF8jKe0tipIa6ExBaxw
|
||||
REACT_APP_AXIOS_BASE_API_URL=https://api.romeonline.io/
|
||||
REACT_APP_REPORTS_SERVER_URL=https://reports.romeonline.io
|
||||
REACT_APP_SPLIT_API=et9pjkik6bn67he5evpmpr1agoo7gactphgk
|
||||
INSTANCE=ROME
|
||||
REACT_APP_INSTANCE=ROME
|
||||
|
||||
@@ -12,4 +12,4 @@ REACT_APP_AXIOS_BASE_API_URL=https://api.test.imex.online/
|
||||
REACT_APP_REPORTS_SERVER_URL=https://reports3.test.imex.online
|
||||
REACT_APP_IS_TEST=true
|
||||
REACT_APP_SPLIT_API=ts615lqgnmk84thn72uk18uu5pgce6e0l4rc
|
||||
INSTANCE=IMEX
|
||||
REACT_APP_INSTANCE=IMEX
|
||||
|
||||
@@ -12,4 +12,4 @@ REACT_APP_AXIOS_BASE_API_URL=https://api.test.imex.online/
|
||||
REACT_APP_REPORTS_SERVER_URL=https://reports3.test.imex.online
|
||||
REACT_APP_IS_TEST=true
|
||||
REACT_APP_SPLIT_API=ts615lqgnmk84thn72uk18uu5pgce6e0l4rc
|
||||
INSTANCE=PROMANAGER
|
||||
REACT_APP_INSTANCE=PROMANAGER
|
||||
|
||||
@@ -12,4 +12,4 @@ REACT_APP_AXIOS_BASE_API_URL=https://api.test.romeonline.io/
|
||||
REACT_APP_REPORTS_SERVER_URL=https://reports.test.romeonline.io
|
||||
REACT_APP_IS_TEST=true
|
||||
REACT_APP_SPLIT_API=ts615lqgnmk84thn72uk18uu5pgce6e0l4rc
|
||||
INSTANCE=ROME
|
||||
REACT_APP_INSTANCE=ROME
|
||||
|
||||
@@ -1,41 +1,41 @@
|
||||
import dayjs from "../../utils/day";
|
||||
import React from "react";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import {connect} from "react-redux";
|
||||
import {createStructuredSelector} from "reselect";
|
||||
import {selectBodyshop} from "../../redux/user/user.selectors";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import AlertComponent from "../alert/alert.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
|
||||
function FeatureWrapper({
|
||||
bodyshop,
|
||||
featureName,
|
||||
noauth,
|
||||
children,
|
||||
...restProps
|
||||
}) {
|
||||
const {t} = useTranslation();
|
||||
bodyshop,
|
||||
featureName,
|
||||
noauth,
|
||||
children,
|
||||
...restProps
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
if (HasFeatureAccess({featureName, bodyshop})) return children;
|
||||
if (HasFeatureAccess({ featureName, bodyshop })) return children;
|
||||
|
||||
return (
|
||||
noauth || (
|
||||
<AlertComponent
|
||||
message={t("general.messages.nofeatureaccess")}
|
||||
type="warning"
|
||||
/>
|
||||
)
|
||||
);
|
||||
return (
|
||||
noauth || (
|
||||
<AlertComponent
|
||||
message={t("general.messages.nofeatureaccess")}
|
||||
type="warning"
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export function HasFeatureAccess({featureName, bodyshop}) {
|
||||
return (
|
||||
bodyshop.features.allAccess ||
|
||||
dayjs(bodyshop.features[featureName]).isAfter(dayjs())
|
||||
);
|
||||
export function HasFeatureAccess({ featureName, bodyshop }) {
|
||||
return (
|
||||
bodyshop?.features.allAccess ||
|
||||
dayjs(bodyshop?.features[featureName]).isAfter(dayjs())
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, null)(FeatureWrapper);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -41,6 +41,7 @@ import JoblineTeamAssignment from "../job-line-team-assignment/job-line-team-ass
|
||||
import JobLineDispatchButton from "../job-line-dispatch-button/job-line-dispatch-button.component";
|
||||
import JobLineBulkAssignComponent from "../job-line-bulk-assign/job-line-bulk-assign.component";
|
||||
import {useSplitTreatments} from "@splitsoftware/splitio-react";
|
||||
import { HasFeatureAccess } from "../feature-wrapper/feature-wrapper.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -318,13 +319,13 @@ export function JobLinesComponent({
|
||||
<JobLineLocationPopup jobline={record} disabled={jobRO}/>
|
||||
),
|
||||
},
|
||||
{
|
||||
...HasFeatureAccess({featureName: "bills"}) ? [ {
|
||||
title: t("joblines.labels.billref"),
|
||||
dataIndex: "billref",
|
||||
key: "billref",
|
||||
render: (text, record) => <JobLinesBillRefernece jobline={record}/>,
|
||||
responsive: ["md"],
|
||||
},
|
||||
},] : [],
|
||||
{
|
||||
title: t("joblines.fields.status"),
|
||||
dataIndex: "status",
|
||||
|
||||
@@ -7,6 +7,7 @@ import JobBillsTotal from "../job-bills-total/job-bills-total.component";
|
||||
import PartsOrderListTableComponent from "../parts-order-list-table/parts-order-list-table.component";
|
||||
import PartsOrderModal from "../parts-order-modal/parts-order-modal.container";
|
||||
import PartsDispatchTable from "../parts-dispatch-table/parts-dispatch-table.component";
|
||||
import FeatureWrapperComponent from "../feature-wrapper/feature-wrapper.component";
|
||||
|
||||
export default function JobsDetailPliComponent({
|
||||
job,
|
||||
@@ -23,6 +24,7 @@ export default function JobsDetailPliComponent({
|
||||
) : null}
|
||||
<BillDetailEditcontainer/>
|
||||
<Row gutter={[16, 16]}>
|
||||
<FeatureWrapperComponent featureName='bills' noauth={() => null}>
|
||||
<Col span={24}>
|
||||
<JobBillsTotal
|
||||
bills={billsQuery.data ? billsQuery.data.bills : []}
|
||||
@@ -31,6 +33,7 @@ export default function JobsDetailPliComponent({
|
||||
jobTotals={job.job_totals}
|
||||
/>
|
||||
</Col>
|
||||
</FeatureWrapperComponent>
|
||||
<Col span={24}>
|
||||
<PartsOrderListTableComponent
|
||||
job={job}
|
||||
@@ -38,6 +41,7 @@ export default function JobsDetailPliComponent({
|
||||
billsQuery={billsQuery}
|
||||
/>
|
||||
</Col>
|
||||
<FeatureWrapperComponent featureName='bills' noauth={() => null}>
|
||||
<Col span={24}>
|
||||
<BillsListTable
|
||||
job={job}
|
||||
@@ -45,6 +49,7 @@ export default function JobsDetailPliComponent({
|
||||
billsQuery={billsQuery}
|
||||
/>
|
||||
</Col>
|
||||
</FeatureWrapperComponent>
|
||||
<Col span={24}>
|
||||
<PartsDispatchTable
|
||||
job={job}
|
||||
|
||||
@@ -26,6 +26,7 @@ import PartsOrderLineBackorderButton
|
||||
from "../parts-order-line-backorder-button/parts-order-line-backorder-button.component";
|
||||
import PartsReceiveModalContainer from "../parts-receive-modal/parts-receive-modal.container";
|
||||
import PrintWrapper from "../print-wrapper/print-wrapper.component";
|
||||
import FeatureWrapperComponent from "../feature-wrapper/feature-wrapper.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
jobRO: selectJobReadOnly,
|
||||
@@ -86,6 +87,7 @@ export function PartsOrderListTableComponent({
|
||||
<EyeFilled/>
|
||||
</Button>
|
||||
)}
|
||||
|
||||
<Button
|
||||
disabled={
|
||||
jobRO ||
|
||||
@@ -115,6 +117,7 @@ export function PartsOrderListTableComponent({
|
||||
>
|
||||
{t("parts_orders.actions.receive")}
|
||||
</Button>
|
||||
|
||||
<Popconfirm
|
||||
title={t("parts_orders.labels.confirmdelete")}
|
||||
disabled={jobRO}
|
||||
@@ -141,6 +144,7 @@ export function PartsOrderListTableComponent({
|
||||
<DeleteFilled/>
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
<FeatureWrapperComponent featureName='bills' noauth={() => null}>
|
||||
<Button
|
||||
disabled={
|
||||
(jobRO ? !record.return : jobRO) ||
|
||||
@@ -184,6 +188,7 @@ export function PartsOrderListTableComponent({
|
||||
>
|
||||
{t("parts_orders.actions.receivebill")}
|
||||
</Button>
|
||||
</FeatureWrapperComponent>
|
||||
<PrintWrapper
|
||||
templateObject={{
|
||||
name: record.return
|
||||
|
||||
@@ -16,6 +16,7 @@ import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component";
|
||||
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
||||
import ScheduleBlockDay from "../schedule-block-day/schedule-block-day.component";
|
||||
import ScheduleCalendarHeaderGraph from "./schedule-calendar-header-graph.component";
|
||||
import InstanceRenderMgr from '../../utils/instanceRenderMgr'
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -200,18 +201,22 @@ export function ScheduleCalendarHeaderComponent({
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="imex-calendar-load">
|
||||
<ScheduleBlockDay
|
||||
alreadyBlocked={isDayBlocked.length > 0}
|
||||
date={date}
|
||||
refetch={refetch}
|
||||
>
|
||||
<div style={{color: isShopOpen(date) ? "" : "tomato"}}>
|
||||
{label}
|
||||
{calculating ? <LoadingSkeleton/> : LoadComponent}
|
||||
</div>
|
||||
</ScheduleBlockDay>
|
||||
</div>
|
||||
<div className="imex-calendar-load">
|
||||
<ScheduleBlockDay
|
||||
alreadyBlocked={isDayBlocked.length > 0}
|
||||
date={date}
|
||||
refetch={refetch}
|
||||
>
|
||||
<div style={{ color: isShopOpen(date) ? "" : "tomato" }}>
|
||||
{label}
|
||||
{InstanceRenderMgr({
|
||||
imex: calculating ? <LoadingSkeleton /> : LoadComponent,
|
||||
rome: "USE_IMEX",
|
||||
promanager: <></>,
|
||||
})}
|
||||
</div>
|
||||
</ScheduleBlockDay>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,161 +1,171 @@
|
||||
import dayjs from "../../utils/day";
|
||||
import queryString from "query-string";
|
||||
import React from "react";
|
||||
import {Calendar, dayjsLocalizer} from "react-big-calendar";
|
||||
import {connect} from "react-redux";
|
||||
import {Link, useLocation, useNavigate} from "react-router-dom";
|
||||
import {createStructuredSelector} from "reselect";
|
||||
import {selectBodyshop} from "../../redux/user/user.selectors";
|
||||
import { Calendar, dayjsLocalizer } from "react-big-calendar";
|
||||
import { connect } from "react-redux";
|
||||
import { Link, useLocation, useNavigate } from "react-router-dom";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import Event from "../job-at-change/schedule-event.container";
|
||||
import HeaderComponent from "./schedule-calendar-header.component";
|
||||
import "./schedule-calendar.styles.scss";
|
||||
import JobDetailCards from "../job-detail-cards/job-detail-cards.component";
|
||||
import {selectProblemJobs} from "../../redux/application/application.selectors";
|
||||
import {Alert, Collapse, Space} from "antd";
|
||||
import {Trans, useTranslation} from "react-i18next";
|
||||
import { selectProblemJobs } from "../../redux/application/application.selectors";
|
||||
import { Alert, Collapse, Space } from "antd";
|
||||
import { Trans, useTranslation } from "react-i18next";
|
||||
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
problemJobs: selectProblemJobs,
|
||||
bodyshop: selectBodyshop,
|
||||
problemJobs: selectProblemJobs,
|
||||
});
|
||||
const localizer = dayjsLocalizer(dayjs);
|
||||
|
||||
export function ScheduleCalendarWrapperComponent({
|
||||
bodyshop,
|
||||
problemJobs,
|
||||
data,
|
||||
refetch,
|
||||
defaultView,
|
||||
setDateRangeCallback,
|
||||
date,
|
||||
...otherProps
|
||||
}) {
|
||||
const search = queryString.parse(useLocation().search);
|
||||
const history = useNavigate();
|
||||
const {t} = useTranslation();
|
||||
const handleEventPropStyles = (event, start, end, isSelected) => {
|
||||
return {
|
||||
...(event.color && !((search.view || defaultView) === "agenda")
|
||||
? {
|
||||
style: {
|
||||
backgroundColor:
|
||||
event.color && event.color.hex ? event.color.hex : event.color,
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
className: `${event.arrived ? "imex-event-arrived" : ""} ${
|
||||
event.block ? "imex-event-block" : ""
|
||||
}`,
|
||||
};
|
||||
bodyshop,
|
||||
problemJobs,
|
||||
data,
|
||||
refetch,
|
||||
defaultView,
|
||||
setDateRangeCallback,
|
||||
date,
|
||||
...otherProps
|
||||
}) {
|
||||
const search = queryString.parse(useLocation().search);
|
||||
const history = useNavigate();
|
||||
const { t } = useTranslation();
|
||||
const handleEventPropStyles = (event, start, end, isSelected) => {
|
||||
return {
|
||||
...(event.color && !((search.view || defaultView) === "agenda")
|
||||
? {
|
||||
style: {
|
||||
backgroundColor:
|
||||
event.color && event.color.hex ? event.color.hex : event.color,
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
className: `${event.arrived ? "imex-event-arrived" : ""} ${
|
||||
event.block ? "imex-event-block" : ""
|
||||
}`,
|
||||
};
|
||||
};
|
||||
|
||||
const selectedDate = new Date(date || dayjs(search.date) || Date.now());
|
||||
const selectedDate = new Date(date || dayjs(search.date) || Date.now());
|
||||
|
||||
return (
|
||||
<>
|
||||
<JobDetailCards/>
|
||||
{problemJobs && problemJobs.length > 2 ? (
|
||||
<Collapse style={{marginBottom: '5px'}}>
|
||||
<Collapse.Panel
|
||||
key="1"
|
||||
header={
|
||||
<span style={{color: "tomato"}}>
|
||||
{t("appointments.labels.severalerrorsfound")}
|
||||
</span>
|
||||
}
|
||||
>
|
||||
<Space direction="vertical" style={{width: '100%'}}>
|
||||
{problemJobs.map((problem) => (
|
||||
<Alert
|
||||
key={problem.id}
|
||||
type="error"
|
||||
message={
|
||||
<Trans
|
||||
i18nKey="appointments.labels.dataconsistency"
|
||||
components={[
|
||||
<Link
|
||||
to={`/manage/jobs/${problem.id}`}
|
||||
target="_blank"
|
||||
/>,
|
||||
]}
|
||||
values={{
|
||||
ro_number: problem.ro_number,
|
||||
code: problem.code,
|
||||
}}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</Space>
|
||||
|
||||
</Collapse.Panel>
|
||||
</Collapse>
|
||||
) : (
|
||||
<Space direction="vertical" style={{width: '100%', marginBottom: '5px'}}>
|
||||
{
|
||||
problemJobs.map((problem) => (
|
||||
<Alert
|
||||
key={problem.id}
|
||||
type="error"
|
||||
message={
|
||||
<Trans
|
||||
i18nKey="appointments.labels.dataconsistency"
|
||||
components={[
|
||||
<Link to={`/manage/jobs/${problem.id}`} target="_blank"/>,
|
||||
]}
|
||||
values={{
|
||||
ro_number: problem.ro_number,
|
||||
code: problem.code,
|
||||
}}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
))
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<JobDetailCards />
|
||||
{InstanceRenderManager({
|
||||
imex:
|
||||
problemJobs && problemJobs.length > 2 ? (
|
||||
<Collapse style={{ marginBottom: "5px" }}>
|
||||
<Collapse.Panel
|
||||
key="1"
|
||||
header={
|
||||
<span style={{ color: "tomato" }}>
|
||||
{t("appointments.labels.severalerrorsfound")}
|
||||
</span>
|
||||
}
|
||||
>
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
{problemJobs.map((problem) => (
|
||||
<Alert
|
||||
key={problem.id}
|
||||
type="error"
|
||||
message={
|
||||
<Trans
|
||||
i18nKey="appointments.labels.dataconsistency"
|
||||
components={[
|
||||
<Link
|
||||
to={`/manage/jobs/${problem.id}`}
|
||||
target="_blank"
|
||||
/>,
|
||||
]}
|
||||
values={{
|
||||
ro_number: problem.ro_number,
|
||||
code: problem.code,
|
||||
}}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</Space>
|
||||
)}
|
||||
</Collapse.Panel>
|
||||
</Collapse>
|
||||
) : (
|
||||
<Space
|
||||
direction="vertical"
|
||||
style={{ width: "100%", marginBottom: "5px" }}
|
||||
>
|
||||
{problemJobs.map((problem) => (
|
||||
<Alert
|
||||
key={problem.id}
|
||||
type="error"
|
||||
message={
|
||||
<Trans
|
||||
i18nKey="appointments.labels.dataconsistency"
|
||||
components={[
|
||||
<Link
|
||||
to={`/manage/jobs/${problem.id}`}
|
||||
target="_blank"
|
||||
/>,
|
||||
]}
|
||||
values={{
|
||||
ro_number: problem.ro_number,
|
||||
code: problem.code,
|
||||
}}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</Space>
|
||||
),
|
||||
|
||||
<Calendar
|
||||
events={data}
|
||||
defaultView={search.view || defaultView || "week"}
|
||||
date={selectedDate}
|
||||
onNavigate={(date, view, action) => {
|
||||
search.date = date.toISOString().substr(0, 10);
|
||||
history({search: queryString.stringify(search)});
|
||||
}}
|
||||
onRangeChange={(start, end) => {
|
||||
if (setDateRangeCallback) setDateRangeCallback({start, end});
|
||||
}}
|
||||
onView={(view) => {
|
||||
search.view = view;
|
||||
history({search: queryString.stringify(search)});
|
||||
}}
|
||||
step={15}
|
||||
// timeslots={1}
|
||||
showMultiDayTimes
|
||||
localizer={localizer}
|
||||
min={
|
||||
bodyshop.schedule_start_time
|
||||
? new Date(bodyshop.schedule_start_time)
|
||||
: new Date("2020-01-01T06:00:00")
|
||||
}
|
||||
max={
|
||||
bodyshop.schedule_end_time
|
||||
? new Date(bodyshop.schedule_end_time)
|
||||
: new Date("2020-01-01T20:00:00")
|
||||
}
|
||||
eventPropGetter={handleEventPropStyles}
|
||||
components={{
|
||||
event: (e) =>
|
||||
Event({bodyshop: bodyshop, event: e.event, refetch: refetch}),
|
||||
header: (p) => (
|
||||
<HeaderComponent {...p} events={data} refetch={refetch}/>
|
||||
),
|
||||
}}
|
||||
{...otherProps}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
rome: "USE_IMEX",
|
||||
promanager: <span />,
|
||||
})}
|
||||
|
||||
<Calendar
|
||||
events={data}
|
||||
defaultView={search.view || defaultView || "week"}
|
||||
date={selectedDate}
|
||||
onNavigate={(date, view, action) => {
|
||||
search.date = date.toISOString().substr(0, 10);
|
||||
history({ search: queryString.stringify(search) });
|
||||
}}
|
||||
onRangeChange={(start, end) => {
|
||||
if (setDateRangeCallback) setDateRangeCallback({ start, end });
|
||||
}}
|
||||
onView={(view) => {
|
||||
search.view = view;
|
||||
history({ search: queryString.stringify(search) });
|
||||
}}
|
||||
step={15}
|
||||
// timeslots={1}
|
||||
showMultiDayTimes
|
||||
localizer={localizer}
|
||||
min={
|
||||
bodyshop.schedule_start_time
|
||||
? new Date(bodyshop.schedule_start_time)
|
||||
: new Date("2020-01-01T06:00:00")
|
||||
}
|
||||
max={
|
||||
bodyshop.schedule_end_time
|
||||
? new Date(bodyshop.schedule_end_time)
|
||||
: new Date("2020-01-01T20:00:00")
|
||||
}
|
||||
eventPropGetter={handleEventPropStyles}
|
||||
components={{
|
||||
event: (e) =>
|
||||
Event({ bodyshop: bodyshop, event: e.event, refetch: refetch }),
|
||||
header: (p) => (
|
||||
<HeaderComponent {...p} events={data} refetch={refetch} />
|
||||
),
|
||||
}}
|
||||
{...otherProps}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, null)(ScheduleCalendarWrapperComponent);
|
||||
|
||||
@@ -15,6 +15,7 @@ import ScheduleDayViewContainer from "../schedule-day-view/schedule-day-view.con
|
||||
import ScheduleExistingAppointmentsList
|
||||
from "../schedule-existing-appointments-list/schedule-existing-appointments-list.component";
|
||||
import "./schedule-job-modal.scss";
|
||||
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -69,141 +70,144 @@ export function ScheduleJobModalComponent({
|
||||
};
|
||||
|
||||
return (
|
||||
<Row gutter={[16, 16]}>
|
||||
<Col span={12}>
|
||||
<Space>
|
||||
<Typography.Title level={3}>
|
||||
{lbrHrsData?.jobs_by_pk?.ro_number}
|
||||
</Typography.Title>
|
||||
<Typography.Title level={4}>{`B/R Hrs:${
|
||||
lbrHrsData?.jobs_by_pk.labhrs?.aggregate?.sum?.mod_lb_hrs || 0
|
||||
}/${
|
||||
lbrHrsData?.jobs_by_pk.larhrs?.aggregate?.sum?.mod_lb_hrs || 0
|
||||
}`}</Typography.Title>
|
||||
</Space>
|
||||
<LayoutFormRow grow>
|
||||
<Form.Item
|
||||
name="start"
|
||||
label={t("appointments.fields.time")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<DateTimePicker onBlur={handleDateBlur} onlyFuture/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="scheduled_completion"
|
||||
label={t("jobs.fields.scheduled_completion")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<DateTimePicker onlyFuture/>
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
|
||||
<Typography.Title level={4}>
|
||||
{t("appointments.labels.smartscheduling")}
|
||||
</Typography.Title>
|
||||
|
||||
<Row gutter={[16, 16]}>
|
||||
<Col span={12}>
|
||||
<Space>
|
||||
<Typography.Title level={3}>
|
||||
{lbrHrsData?.jobs_by_pk?.ro_number}
|
||||
</Typography.Title>
|
||||
<Typography.Title level={4}>{`B/R Hrs:${
|
||||
lbrHrsData?.jobs_by_pk.labhrs?.aggregate?.sum?.mod_lb_hrs || 0
|
||||
}/${
|
||||
lbrHrsData?.jobs_by_pk.larhrs?.aggregate?.sum?.mod_lb_hrs || 0
|
||||
}`}</Typography.Title>
|
||||
</Space>
|
||||
<LayoutFormRow grow>
|
||||
<Form.Item
|
||||
name="start"
|
||||
label={t("appointments.fields.time")}
|
||||
rules={[
|
||||
{
|
||||
// smartOptions.length > 0 && (
|
||||
// <div>{t("appointments.labels.suggesteddates")}</div>
|
||||
// )
|
||||
}
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<DateTimePicker onBlur={handleDateBlur} onlyFuture />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="scheduled_completion"
|
||||
label={t("jobs.fields.scheduled_completion")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<DateTimePicker onlyFuture />
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
{InstanceRenderManager({
|
||||
imex: (
|
||||
<>
|
||||
<Typography.Title level={4}>
|
||||
{t("appointments.labels.smartscheduling")}
|
||||
</Typography.Title>
|
||||
<Space wrap>
|
||||
<Button onClick={handleSmartScheduling} loading={loading}>
|
||||
{t("appointments.actions.calculate")}
|
||||
</Button>
|
||||
{smartOptions.map((d, idx) => (
|
||||
<Button
|
||||
className="imex-flex-row__margin"
|
||||
key={idx}
|
||||
onClick={() => {
|
||||
const ssDate = dayjs(d);
|
||||
if (ssDate.isBefore(dayjs())) {
|
||||
form.setFieldsValue({start: dayjs()});
|
||||
} else {
|
||||
form.setFieldsValue({start: dayjs(d).add(8, "hour")});
|
||||
}
|
||||
handleDateBlur();
|
||||
}}
|
||||
>
|
||||
<DateFormatter includeDay>{d}</DateFormatter>
|
||||
</Button>
|
||||
))}
|
||||
</Space>
|
||||
|
||||
<LayoutFormRow grow>
|
||||
<Form.Item
|
||||
name="notifyCustomer"
|
||||
valuePropName="checked"
|
||||
label={t("jobs.labels.appointmentconfirmation")}
|
||||
>
|
||||
<Switch/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item name="email" label={t("jobs.fields.ownr_ea")}>
|
||||
<EmailInput disabled={!form.getFieldValue("notifyCustomer")}/>
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
<LayoutFormRow grow>
|
||||
<Form.Item name="color" label={t("appointments.fields.color")}>
|
||||
<Select allowClear>
|
||||
{bodyshop.appt_colors &&
|
||||
bodyshop.appt_colors.map((color) => (
|
||||
<Select.Option
|
||||
style={{color: color.color.hex}}
|
||||
key={color.color.hex}
|
||||
value={color.color.hex}
|
||||
>
|
||||
{color.label}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name={"alt_transport"}
|
||||
label={t("jobs.fields.alt_transport")}
|
||||
>
|
||||
<Select allowClear>
|
||||
{bodyshop.appt_alt_transport &&
|
||||
bodyshop.appt_alt_transport.map((alt) => (
|
||||
<Select.Option key={alt}>{alt}</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item name={"note"} label={t("appointments.fields.note")}>
|
||||
<Input/>
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
{t("appointments.labels.history")}
|
||||
<ScheduleExistingAppointmentsList
|
||||
existingAppointments={existingAppointments}
|
||||
/>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Form.Item shouldUpdate={(prev, cur) => prev.start !== cur.start}>
|
||||
{() => {
|
||||
const values = form.getFieldsValue();
|
||||
if (values.start) {
|
||||
calculateScheduleLoad(dayjs(values.start).add(3, "day"));
|
||||
<Button onClick={handleSmartScheduling} loading={loading}>
|
||||
{t("appointments.actions.calculate")}
|
||||
</Button>
|
||||
{smartOptions.map((d, idx) => (
|
||||
<Button
|
||||
className="imex-flex-row__margin"
|
||||
key={idx}
|
||||
onClick={() => {
|
||||
const ssDate = dayjs(d);
|
||||
if (ssDate.isBefore(dayjs())) {
|
||||
form.setFieldsValue({ start: dayjs() });
|
||||
} else {
|
||||
form.setFieldsValue({
|
||||
start: dayjs(d).add(8, "hour"),
|
||||
});
|
||||
}
|
||||
return (
|
||||
<div className="schedule-job-modal">
|
||||
<ScheduleDayViewContainer day={values.start}/>
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
</Form.Item>
|
||||
</Col>
|
||||
</Row>
|
||||
handleDateBlur();
|
||||
}}
|
||||
>
|
||||
<DateFormatter includeDay>{d}</DateFormatter>
|
||||
</Button>
|
||||
))}
|
||||
</Space>
|
||||
</>
|
||||
),
|
||||
rome: "USE_IMEX",
|
||||
promanager: <></>,
|
||||
})}
|
||||
|
||||
<LayoutFormRow grow>
|
||||
<Form.Item
|
||||
name="notifyCustomer"
|
||||
valuePropName="checked"
|
||||
label={t("jobs.labels.appointmentconfirmation")}
|
||||
>
|
||||
<Switch />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item name="email" label={t("jobs.fields.ownr_ea")}>
|
||||
<EmailInput disabled={!form.getFieldValue("notifyCustomer")} />
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
<LayoutFormRow grow>
|
||||
<Form.Item name="color" label={t("appointments.fields.color")}>
|
||||
<Select allowClear>
|
||||
{bodyshop.appt_colors &&
|
||||
bodyshop.appt_colors.map((color) => (
|
||||
<Select.Option
|
||||
style={{ color: color.color.hex }}
|
||||
key={color.color.hex}
|
||||
value={color.color.hex}
|
||||
>
|
||||
{color.label}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name={"alt_transport"}
|
||||
label={t("jobs.fields.alt_transport")}
|
||||
>
|
||||
<Select allowClear>
|
||||
{bodyshop.appt_alt_transport &&
|
||||
bodyshop.appt_alt_transport.map((alt) => (
|
||||
<Select.Option key={alt}>{alt}</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item name={"note"} label={t("appointments.fields.note")}>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
{t("appointments.labels.history")}
|
||||
<ScheduleExistingAppointmentsList
|
||||
existingAppointments={existingAppointments}
|
||||
/>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Form.Item shouldUpdate={(prev, cur) => prev.start !== cur.start}>
|
||||
{() => {
|
||||
const values = form.getFieldsValue();
|
||||
if (values.start) {
|
||||
calculateScheduleLoad(dayjs(values.start).add(3, "day"));
|
||||
}
|
||||
return (
|
||||
<div className="schedule-job-modal">
|
||||
<ScheduleDayViewContainer day={values.start} />
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
</Form.Item>
|
||||
</Col>
|
||||
</Row>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,6 +66,12 @@ const router = createBrowserRouter(
|
||||
createRoutesFromElements(<Route path="*" element={<AppContainer />} />)
|
||||
);
|
||||
|
||||
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
let styles = 'font-weight: bold; font-size: 50px;color: red; 6px 6px 0 rgb(226,91,14) , 9px 9px 0 rgb(245,221,8) , 12px 12px 0 rgb(5,148,68) '
|
||||
console.log('%c %s', styles, `VER: ${process.env.REACT_APP_INSTANCE}`)
|
||||
}
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<PersistGate
|
||||
|
||||
@@ -11,6 +11,7 @@ import {QUERY_BILLS_FOR_EXPORT} from "../../graphql/accounting.queries";
|
||||
import {setBreadcrumbs, setSelectedHeader,} from "../../redux/application/application.actions";
|
||||
import {selectPartnerVersion} from "../../redux/application/application.selectors";
|
||||
import {selectBodyshop} from "../../redux/user/user.selectors";
|
||||
import FeatureWrapperComponent from "../../components/feature-wrapper/feature-wrapper.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -60,6 +61,7 @@ export function AccountingPayablesContainer({
|
||||
|
||||
return (
|
||||
<div>
|
||||
<FeatureWrapperComponent featureName='export'>
|
||||
<RbacWrapper action="accounting:payables">
|
||||
{noPath && (
|
||||
<AlertComponent
|
||||
@@ -73,6 +75,7 @@ export function AccountingPayablesContainer({
|
||||
refetch={refetch}
|
||||
/>
|
||||
</RbacWrapper>
|
||||
</FeatureWrapperComponent>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import {selectBodyshop} from "../../redux/user/user.selectors";
|
||||
import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component";
|
||||
import {checkPartnerStatus} from "../../components/partner-ping/partner-ping.component";
|
||||
import {selectPartnerVersion} from "../../redux/application/application.selectors";
|
||||
import FeatureWrapperComponent from "../../components/feature-wrapper/feature-wrapper.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -61,6 +62,7 @@ export function AccountingPaymentsContainer({
|
||||
);
|
||||
return (
|
||||
<div>
|
||||
<FeatureWrapperComponent featureName='export'>
|
||||
<RbacWrapper action="accounting:payments">
|
||||
{noPath && (
|
||||
<AlertComponent
|
||||
@@ -74,6 +76,7 @@ export function AccountingPaymentsContainer({
|
||||
refetch={refetch}
|
||||
/>
|
||||
</RbacWrapper>
|
||||
</FeatureWrapperComponent>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import {selectBodyshop} from "../../redux/user/user.selectors";
|
||||
import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component";
|
||||
import {checkPartnerStatus} from "../../components/partner-ping/partner-ping.component";
|
||||
import {selectPartnerVersion} from "../../redux/application/application.selectors";
|
||||
import FeatureWrapperComponent from "../../components/feature-wrapper/feature-wrapper.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -64,6 +65,7 @@ export function AccountingReceivablesContainer({
|
||||
|
||||
return (
|
||||
<div>
|
||||
<FeatureWrapperComponent featureName="export">
|
||||
<RbacWrapper action="accounting:receivables">
|
||||
{noPath && (
|
||||
<AlertComponent
|
||||
@@ -77,6 +79,7 @@ export function AccountingReceivablesContainer({
|
||||
refetch={refetch}
|
||||
/>
|
||||
</RbacWrapper>
|
||||
</FeatureWrapperComponent>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import {QUERY_ALL_BILLS_PAGINATED} from "../../graphql/bills.queries";
|
||||
import {setBreadcrumbs, setSelectedHeader,} from "../../redux/application/application.actions";
|
||||
import BillsPageComponent from "./bills.page.component";
|
||||
import {pageLimit} from "../../utils/config";
|
||||
import FeatureWrapperComponent from "../../components/feature-wrapper/feature-wrapper.component";
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
|
||||
@@ -55,6 +56,7 @@ export function BillsPageContainer({setBreadcrumbs, setSelectedHeader}) {
|
||||
|
||||
if (error) return <AlertComponent message={error.message} type="error"/>;
|
||||
return (
|
||||
<FeatureWrapperComponent featureName='bills'>
|
||||
<RbacWrapper action="bills:list">
|
||||
<div>
|
||||
<BillsPageComponent
|
||||
@@ -67,6 +69,7 @@ export function BillsPageContainer({setBreadcrumbs, setSelectedHeader}) {
|
||||
<BillDetailEditContainer/>
|
||||
</div>
|
||||
</RbacWrapper>
|
||||
</FeatureWrapperComponent>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import {addRecentItem, setBreadcrumbs, setSelectedHeader,} from "../../redux/app
|
||||
import {CreateRecentItem} from "../../utils/create-recent-item";
|
||||
import ContractDetailPageComponent from "./contract-detail.page.component";
|
||||
import NotFound from "../../components/not-found/not-found.component";
|
||||
import FeatureWrapperComponent from "../../components/feature-wrapper/feature-wrapper.component";
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
|
||||
@@ -122,6 +123,7 @@ export function ContractDetailPageContainer({
|
||||
if (!!!data.cccontracts_by_pk) return <NotFound/>;
|
||||
|
||||
return (
|
||||
<FeatureWrapperComponent featureName='courtesycars'>
|
||||
<RbacWrapper action="contracts:detail">
|
||||
<div>
|
||||
<CourtesyCarReturnModalContainer/>
|
||||
@@ -160,6 +162,7 @@ export function ContractDetailPageContainer({
|
||||
</Form>
|
||||
</div>
|
||||
</RbacWrapper>
|
||||
</FeatureWrapperComponent>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import {QUERY_ACTIVE_CONTRACTS_PAGINATED} from "../../graphql/cccontracts.querie
|
||||
import {setBreadcrumbs, setSelectedHeader,} from "../../redux/application/application.actions";
|
||||
import ContractsPageComponent from "./contracts.page.component";
|
||||
import {pageLimit} from "../../utils/config";
|
||||
import FeatureWrapperComponent from "../../components/feature-wrapper/feature-wrapper.component";
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
|
||||
@@ -56,14 +57,16 @@ export function ContractsPageContainer({setBreadcrumbs, setSelectedHeader}) {
|
||||
|
||||
if (error) return <AlertComponent message={error.message} type="error"/>;
|
||||
return (
|
||||
<FeatureWrapperComponent featureName="courtesycars">
|
||||
<RbacWrapper action="contracts:list">
|
||||
<ContractsPageComponent
|
||||
loading={loading}
|
||||
refetch={refetch}
|
||||
data={data ? data.search_cccontracts : []}
|
||||
total={data ? data.search_cccontracts_aggregate.aggregate.count : 0}
|
||||
/>
|
||||
<ContractsPageComponent
|
||||
loading={loading}
|
||||
refetch={refetch}
|
||||
data={data ? data.search_cccontracts : []}
|
||||
total={data ? data.search_cccontracts_aggregate.aggregate.count : 0}
|
||||
/>
|
||||
</RbacWrapper>
|
||||
</FeatureWrapperComponent>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component";
|
||||
import {INSERT_NEW_COURTESY_CAR} from "../../graphql/courtesy-car.queries";
|
||||
import {setBreadcrumbs, setSelectedHeader,} from "../../redux/application/application.actions";
|
||||
import {selectBodyshop} from "../../redux/user/user.selectors";
|
||||
import FeatureWrapperComponent from "../../components/feature-wrapper/feature-wrapper.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -67,16 +68,13 @@ export function CourtesyCarCreateContainer({
|
||||
}, [t, setBreadcrumbs, setSelectedHeader]);
|
||||
|
||||
return (
|
||||
<RbacWrapper action="courtesycar:create">
|
||||
<Form
|
||||
form={form}
|
||||
autoComplete="new-password"
|
||||
onFinish={handleFinish}
|
||||
layout="vertical"
|
||||
>
|
||||
<CourtesyCarFormComponent form={form} saveLoading={loading}/>
|
||||
</Form>
|
||||
</RbacWrapper>
|
||||
<RbacWrapper action="courtesycar:create">
|
||||
<FeatureWrapperComponent featureName="courtesycars">
|
||||
<Form form={form} autoComplete="new-password" onFinish={handleFinish} layout="vertical">
|
||||
<CourtesyCarFormComponent form={form} saveLoading={loading} />
|
||||
</Form>
|
||||
</FeatureWrapperComponent>
|
||||
</RbacWrapper>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component";
|
||||
import {QUERY_ALL_CC} from "../../graphql/courtesy-car.queries";
|
||||
import {setBreadcrumbs, setSelectedHeader,} from "../../redux/application/application.actions";
|
||||
import CourtesyCarsPageComponent from "./courtesy-cars.page.component";
|
||||
import FeatureWrapperComponent from "../../components/feature-wrapper/feature-wrapper.component";
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
|
||||
@@ -32,13 +33,15 @@ export function CourtesyCarsPageContainer({
|
||||
|
||||
if (error) return <AlertComponent message={error.message} type="error"/>;
|
||||
return (
|
||||
<RbacWrapper action="courtesycar:list">
|
||||
<CourtesyCarsPageComponent
|
||||
loading={loading}
|
||||
data={(data && data.courtesycars) || []}
|
||||
refetch={refetch}
|
||||
/>
|
||||
</RbacWrapper>
|
||||
<RbacWrapper action="courtesycar:list">
|
||||
<FeatureWrapperComponent featureName="courtesycars">
|
||||
<CourtesyCarsPageComponent
|
||||
loading={loading}
|
||||
data={(data && data.courtesycars) || []}
|
||||
refetch={refetch}
|
||||
/>
|
||||
</FeatureWrapperComponent>
|
||||
</RbacWrapper>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import {connect} from "react-redux";
|
||||
import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component";
|
||||
import {setBreadcrumbs, setSelectedHeader,} from "../../redux/application/application.actions";
|
||||
import ExportLogsPage from "./export-logs.page.component";
|
||||
import FeatureWrapperComponent from "../../components/feature-wrapper/feature-wrapper.component";
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
|
||||
@@ -25,9 +26,11 @@ export function ExportsLogPageContainer({setBreadcrumbs, setSelectedHeader}) {
|
||||
}, [setBreadcrumbs, t, setSelectedHeader]);
|
||||
|
||||
return (
|
||||
<FeatureWrapperComponent featureName='export'>
|
||||
<RbacWrapper action="accounting:exportlogs">
|
||||
<ExportLogsPage/>
|
||||
</RbacWrapper>
|
||||
</FeatureWrapperComponent>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,8 @@ import _ from "lodash";
|
||||
import JobProfileDataWarning from "../../components/job-profile-data-warning/job-profile-data-warning.component";
|
||||
import {DateTimeFormat} from "../../utils/DateFormatter";
|
||||
import JobLifecycleComponent from "../../components/job-lifecycle/job-lifecycle.component";
|
||||
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
||||
import { HasFeatureAccess } from "../../components/feature-wrapper/feature-wrapper.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -333,12 +335,12 @@ export function JobsDetailPage({
|
||||
label: t("menus.jobsdetail.partssublet"),
|
||||
children: <JobsDetailPliContainer job={job}/>,
|
||||
},
|
||||
{
|
||||
...InstanceRenderManager({ imex: true, rome: true, promanager: HasFeatureAccess({ featureName: 'timetickets', bodyshop }) }) ? [ {
|
||||
key: "labor",
|
||||
icon: <Icon component={FaHardHat}/>,
|
||||
label: t("menus.jobsdetail.labor"),
|
||||
children: <JobsDetailLaborContainer job={job} jobId={job.id}/>,
|
||||
},
|
||||
},]: [],
|
||||
{
|
||||
key: 'lifecycle',
|
||||
icon: <BarsOutlined/>,
|
||||
@@ -352,7 +354,7 @@ export function JobsDetailPage({
|
||||
forceRender: true,
|
||||
children: <JobsDetailDatesComponent job={job}/>,
|
||||
},
|
||||
{
|
||||
...InstanceRenderManager({ imex: true, rome: true, promanager: HasFeatureAccess({ featureName: 'media', bodyshop }) }) ? [ {
|
||||
key: "documents",
|
||||
icon: <FileImageFilled/>,
|
||||
label: t("jobs.labels.documents"),
|
||||
@@ -361,7 +363,7 @@ export function JobsDetailPage({
|
||||
) : (
|
||||
<JobsDocumentsGalleryContainer jobId={job.id}/>
|
||||
),
|
||||
},
|
||||
},]:[],
|
||||
{
|
||||
key: "notes",
|
||||
icon: <Icon component={FaRegStickyNote}/>,
|
||||
@@ -402,4 +404,4 @@ const transformJobToForm = (job) => {
|
||||
transformedJob.date_estimated = transformedJob.date_estimated ? dayjs(transformedJob.date_estimated) : null;
|
||||
|
||||
return transformedJob;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -12,6 +12,7 @@ import {QUERY_ALL_PAYMENTS_PAGINATED} from "../../graphql/payments.queries";
|
||||
import {setBreadcrumbs, setSelectedHeader,} from "../../redux/application/application.actions";
|
||||
import {selectBodyshop} from "../../redux/user/user.selectors";
|
||||
import {pageLimit} from "../../utils/config";
|
||||
import FeatureWrapperComponent from "../../components/feature-wrapper/feature-wrapper.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -60,6 +61,7 @@ export function AllJobs({bodyshop, setBreadcrumbs, setSelectedHeader}) {
|
||||
|
||||
if (error) return <AlertComponent message={error.message} type="error"/>;
|
||||
return (
|
||||
<FeatureWrapperComponent featureName='payments'>
|
||||
<RbacWrapper action="payments:list">
|
||||
<PaymentsListPaginated
|
||||
refetch={refetch}
|
||||
@@ -69,6 +71,7 @@ export function AllJobs({bodyshop, setBreadcrumbs, setSelectedHeader}) {
|
||||
payments={data ? data.payments : []}
|
||||
/>
|
||||
</RbacWrapper>
|
||||
</FeatureWrapperComponent>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
import React from "react";
|
||||
import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component";
|
||||
import TimeTicketShift from "../../components/time-ticket-shift/time-ticket-shift.container";
|
||||
import React from 'react';
|
||||
import RbacWrapper from '../../components/rbac-wrapper/rbac-wrapper.component';
|
||||
import TimeTicketShift from '../../components/time-ticket-shift/time-ticket-shift.container';
|
||||
import FeatureWrapperComponent from '../../components/feature-wrapper/feature-wrapper.component';
|
||||
|
||||
export default function ShiftClock() {
|
||||
return (
|
||||
<RbacWrapper action="shiftclock:view">
|
||||
<TimeTicketShift/>
|
||||
</RbacWrapper>
|
||||
);
|
||||
return (
|
||||
<FeatureWrapperComponent featureName="timetickets">
|
||||
<RbacWrapper action="shiftclock:view">
|
||||
<TimeTicketShift />
|
||||
</RbacWrapper>
|
||||
</FeatureWrapperComponent>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component";
|
||||
import {setBreadcrumbs, setSelectedHeader,} from "../../redux/application/application.actions";
|
||||
import {selectBodyshop} from "../../redux/user/user.selectors";
|
||||
import TemporaryDocsComponent from "./temporary-docs.component";
|
||||
import FeatureWrapperComponent from "../../components/feature-wrapper/feature-wrapper.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -31,9 +32,11 @@ export function TempDocumentsContainer({setBreadcrumbs, setSelectedHeader}) {
|
||||
}, [t, setBreadcrumbs, setSelectedHeader]);
|
||||
|
||||
return (
|
||||
<RbacWrapper action="temporarydocs:view">
|
||||
<TemporaryDocsComponent/>
|
||||
</RbacWrapper>
|
||||
<RbacWrapper action="temporarydocs:view">
|
||||
<FeatureWrapperComponent featureName="media">
|
||||
<TemporaryDocsComponent />
|
||||
</FeatureWrapperComponent>
|
||||
</RbacWrapper>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import TimeTicketsAttendanceTable
|
||||
from "../../components/time-tickets-attendance-table/time-tickets-attendance-table.component";
|
||||
import {setBreadcrumbs, setSelectedHeader,} from "../../redux/application/application.actions";
|
||||
import TimeTicketsCommit from "../../components/time-tickets-commit/time-tickets-commit.component";
|
||||
import FeatureWrapperComponent from "../../components/feature-wrapper/feature-wrapper.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({});
|
||||
|
||||
@@ -64,6 +65,7 @@ export function TimeTicketsContainer({
|
||||
if (error) return <AlertComponent message={error.message} type="error"/>;
|
||||
|
||||
return (
|
||||
<FeatureWrapperComponent featureName='timetickets'>
|
||||
<RbacWrapper action="timetickets:list">
|
||||
<Row gutter={[16, 16]}>
|
||||
<Col span={24}>
|
||||
@@ -90,10 +92,11 @@ export function TimeTicketsContainer({
|
||||
</Col>
|
||||
</Row>
|
||||
</RbacWrapper>
|
||||
</FeatureWrapperComponent>
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(TimeTicketsContainer);
|
||||
)(TimeTicketsContainer);
|
||||
|
||||
@@ -6,6 +6,7 @@ import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component";
|
||||
import TtApprovalsList from "../../components/tt-approvals-list/tt-approvals-list.container";
|
||||
import {setBreadcrumbs, setSelectedHeader,} from "../../redux/application/application.actions";
|
||||
import {selectBodyshop} from "../../redux/user/user.selectors";
|
||||
import FeatureWrapperComponent from "../../components/feature-wrapper/feature-wrapper.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -31,9 +32,11 @@ export function TtApprovalsPage({setBreadcrumbs, setSelectedHeader}) {
|
||||
}, [t, setBreadcrumbs, setSelectedHeader]);
|
||||
|
||||
return (
|
||||
<FeatureWrapperComponent featureName='timetickets'>
|
||||
<RbacWrapper action="ttapprovals:view">
|
||||
<TtApprovalsList/>
|
||||
</RbacWrapper>
|
||||
</FeatureWrapperComponent>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,30 +9,39 @@
|
||||
* @property { string | object | function } imex Return this prop if Rome.
|
||||
*/
|
||||
|
||||
export default function InstanceRenderManager({
|
||||
executeFunction,
|
||||
rome,
|
||||
promanager,
|
||||
imex,
|
||||
}) {
|
||||
let propToReturn = null;
|
||||
export default function InstanceRenderManager({ executeFunction, rome, promanager, imex, debug }) {
|
||||
let propToReturn = null;
|
||||
|
||||
switch (process.env.INSTANCE) {
|
||||
case "IMEX":
|
||||
propToReturn = imex;
|
||||
break;
|
||||
case "ROME":
|
||||
propToReturn = rome;
|
||||
break;
|
||||
case "PROMANAGER":
|
||||
propToReturn =
|
||||
promanager === "USE_ROME" ? rome : promanager || rome; //default promanager back to rome.
|
||||
break;
|
||||
default:
|
||||
propToReturn = imex;
|
||||
break;
|
||||
}
|
||||
switch (process.env.REACT_APP_INSTANCE) {
|
||||
case 'IMEX':
|
||||
propToReturn = imex;
|
||||
break;
|
||||
case 'ROME':
|
||||
propToReturn = rome;
|
||||
break;
|
||||
case 'PROMANAGER':
|
||||
//Return the rome prop if USE_ROME.
|
||||
//If not USE_ROME, we want to default back to the rome prop if it's undefined.
|
||||
//If null, we might want to show nothing, so make sure we return null.
|
||||
propToReturn =
|
||||
promanager === 'USE_ROME' ? rome : promanager !== undefined ? promanager : rome;
|
||||
break;
|
||||
default:
|
||||
propToReturn = imex;
|
||||
break;
|
||||
}
|
||||
|
||||
if (executeFunction && typeof propToReturn === "function") propToReturn();
|
||||
return propToReturn === undefined ? null : propToReturn;
|
||||
if (executeFunction && typeof propToReturn === 'function') propToReturn();
|
||||
|
||||
//Checking to see if we need to default to another one.
|
||||
if (propToReturn === 'imex') {
|
||||
propToReturn = imex;
|
||||
}
|
||||
if (debug) {
|
||||
console.log('InstanceRenderManager Debugger');
|
||||
console.log('=========================');
|
||||
console.log({ executeFunction, rome, promanager, imex, debug, propToReturn });
|
||||
console.log('=========================');
|
||||
}
|
||||
return propToReturn === undefined ? null : propToReturn;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user