Added working days to scheduling IO-153

This commit is contained in:
Patrick Fic
2021-01-29 17:26:48 -08:00
parent e71a7bd17b
commit 10e70230ba
20 changed files with 638 additions and 20 deletions

View File

@@ -184,6 +184,9 @@ export function JobsDetailHeaderActions({
{ defaultOpenStatus: bodyshop.md_ro_statuses.default_imported },
(newJobId) => {
history.push(`/manage/jobs/${newJobId}`);
notification["success"]({
message: t("jobs.successes.duplicated"),
});
}
)
}

View File

@@ -8,13 +8,14 @@ import { Link } from "react-router-dom";
import { createStructuredSelector } from "reselect";
import {
selectScheduleLoad,
selectScheduleLoadCalculating
selectScheduleLoadCalculating,
} from "../../redux/application/application.selectors";
import { selectBodyshop } from "../../redux/user/user.selectors";
import { DateTimeFormatter } from "../../utils/DateFormatter";
import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component";
import ScheduleBlockDay from "../schedule-block-day/schedule-block-day.component";
import ScheduleCalendarHeaderGraph from "./schedule-calendar-header-graph.component";
import moment from "moment";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
@@ -124,10 +125,42 @@ export function ScheduleCalendarHeaderComponent({
</div>
) : null;
const isShopOpen = (date) => {
let day;
switch (moment(date).day()) {
case 0:
day = "sunday";
break;
case 1:
day = "monday";
break;
case 2:
day = "tuesday";
break;
case 3:
day = "wednesday";
break;
case 4:
day = "thursday";
break;
case 5:
day = "friday";
break;
case 6:
day = "saturday";
break;
default:
day = "sunday";
break;
}
return bodyshop.workingdays[day];
};
return (
<div className="imex-calendar-load">
<ScheduleBlockDay date={date} refetch={refetch}>
<div>
<div style={{ color: isShopOpen(date) ? "" : "tomato" }}>
{label}
{calculating ? <LoadingSkeleton /> : LoadComponent}
</div>

View File

@@ -31,7 +31,7 @@ export function ScheduleJobModalComponent({
const [loading, setLoading] = useState(false);
const [smartOptions, setSmartOptions] = useState([]);
const handleAuto = async () => {
const handleSmartScheduling = async () => {
setLoading(true);
try {
const response = await axios.post("/scheduling/job", {
@@ -92,7 +92,7 @@ export function ScheduleJobModalComponent({
</Form.Item>
</LayoutFormRow>
<Card title={t("appointments.labels.smartscheduling")}>
<Button onClick={handleAuto} loading={loading}>
<Button onClick={handleSmartScheduling} loading={loading}>
{t("appointments.actions.calculate")}
</Button>
{smartOptions.length > 0 && (

View File

@@ -193,6 +193,57 @@ export default function ShopInfoComponent({ form, saveLoading }) {
<InputNumber min={15} precision={0} />
</Form.Item>
</LayoutFormRow>
<LayoutFormRow header={t("bodyshop.labels.workingdays")}>
<Form.Item
label={t("general.labels.sunday")}
name={["workingdays", "sunday"]}
valuePropName="checked"
>
<Switch />
</Form.Item>
<Form.Item
label={t("general.labels.monday")}
name={["workingdays", "monday"]}
valuePropName="checked"
>
<Switch />
</Form.Item>
<Form.Item
label={t("general.labels.tuesday")}
name={["workingdays", "tuesday"]}
valuePropName="checked"
>
<Switch />
</Form.Item>
<Form.Item
label={t("general.labels.wednesday")}
name={["workingdays", "wednesday"]}
valuePropName="checked"
>
<Switch />
</Form.Item>
<Form.Item
label={t("general.labels.thursday")}
name={["workingdays", "thursday"]}
valuePropName="checked"
>
<Switch />
</Form.Item>
<Form.Item
label={t("general.labels.friday")}
name={["workingdays", "friday"]}
valuePropName="checked"
>
<Switch />
</Form.Item>
<Form.Item
label={t("general.labels.saturday")}
name={["workingdays", "saturday"]}
valuePropName="checked"
>
<Switch />
</Form.Item>
</LayoutFormRow>
<LayoutFormRow>
<Form.Item
label={t("bodyshop.fields.dailypainttarget")}