Set default dinero currencies. Created checklist display skeleton component. BOD-377

This commit is contained in:
Patrick Fic
2020-09-03 10:10:40 -07:00
parent 2adb72b25f
commit f4fed87f61
10 changed files with 87 additions and 3 deletions

View File

@@ -8,19 +8,23 @@ import { useHistory, useLocation, useParams } from "react-router-dom";
import { createStructuredSelector } from "reselect";
import { MARK_LATEST_APPOINTMENT_AS_ARRIVED } from "../../../../graphql/appointments.queries";
import { UPDATE_JOB } from "../../../../graphql/jobs.queries";
import { selectBodyshop } from "../../../../redux/user/user.selectors";
import {
selectBodyshop,
selectCurrentUser,
} from "../../../../redux/user/user.selectors";
import DateTimePicker from "../../../form-date-time-picker/form-date-time-picker.component";
import ConfigFormComponents from "../../../config-form-components/config-form-components.component";
import { logImEXEvent } from "../../../../firebase/firebase.utils";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
currentUser: selectCurrentUser,
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
});
export function JobChecklistForm({ formItems, bodyshop, type }) {
export function JobChecklistForm({ formItems, bodyshop, currentUser, type }) {
const { t } = useTranslation();
const [intakeJob] = useMutation(UPDATE_JOB);
const [loading, setLoading] = useState(false);
@@ -48,7 +52,11 @@ export function JobChecklistForm({ formItems, bodyshop, type }) {
}),
[(type === "intake" && "intakechecklist") ||
(type === "deliver" && "deliverchecklist")]: values,
(type === "deliver" && "deliverchecklist")]: {
...values,
completed_by: currentUser.email,
completed_at: new Date(),
},
...(type === "deliver" && {
scheduled_delivery: values.scheduledDelivery,

View File

@@ -0,0 +1,12 @@
import React from "react";
import ConfigFormComponents from "../config-form-components/config-form-components.component";
export default function JobChecklistDisplay({ checklist }) {
console.log("JobChecklistDisplay -> checklist", checklist);
if (!checklist) return <div></div>;
return (
<div>
<ConfigFormComponents readOnly componentList={checklist} />
</div>
);
}

View File

@@ -0,0 +1,20 @@
import React from "react";
import { Row, Col } from "antd";
import JobChecklistDisplay from "../job-checklist/job-checklist-display.component";
const colSpan = { sm: { span: 24 }, md: { span: 12 } };
export default function JobsDetailChecklists({ job }) {
return (
<div>
<Row gutter={[16, 16]}>
<Col {...colSpan}>
<JobChecklistDisplay checklist={job.intakechecklist} />
</Col>
<Col {...colSpan}>
{" "}
<JobChecklistDisplay checklist={job.deliverchecklist} />
</Col>
</Row>
</div>
);
}