WIP Styling Changes

This commit is contained in:
Patrick Fic
2021-03-26 12:32:17 -07:00
parent 6688121b21
commit 89d4eb28b6
30 changed files with 486 additions and 498 deletions

View File

@@ -1,21 +1,15 @@
import { PrinterFilled } from "@ant-design/icons";
import { Button, Divider, PageHeader, Tag } from "antd";
import { Card, Col, Row, Tag } from "antd";
import React, { useMemo } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { Link } from "react-router-dom";
import { createStructuredSelector } from "reselect";
import { selectJobReadOnly } from "../../redux/application/application.selectors";
import { setModalContext } from "../../redux/modals/modals.actions";
import { selectBodyshop } from "../../redux/user/user.selectors";
import CurrencyFormatter from "../../utils/CurrencyFormatter";
import JobEmployeeAssignments from "../job-employee-assignments/job-employee-assignments.container";
import JobSyncButton from "../job-sync-button/job-sync-button.component";
import JobsChangeStatus from "../jobs-change-status/jobs-change-status.component";
import JobsConvertButton from "../jobs-convert-button/jobs-convert-button.component";
import JobsDetailHeaderActions from "../jobs-detail-header-actions/jobs-detail-header-actions.component";
import OwnerTagPopoverComponent from "../owner-tag-popover/owner-tag-popover.component";
import ProductionListColumnProductionNote from "../production-list-columns/production-list-columns.productionnote.component";
import VehicleTagPopoverComponent from "../vehicle-tag-popover/vehicle-tag-popover.component";
import ChatOpenButton from "../chat-open-button/chat-open-button.component";
import DataLabel from "../data-label/data-label.component";
import "./jobs-detail-header.styles.scss";
const mapStateToProps = createStructuredSelector({
@@ -45,80 +39,127 @@ export function JobsDetailHeader({
);
}, [job.status, bodyshop.md_ro_statuses.post_production_statuses]);
const menuExtra = (
<div className="imex-flex-row">
<JobsChangeStatus job={job} />
<JobSyncButton job={job} />
<Button
className="imex-flex-row__margin"
onClick={() => {
setPrintCenterContext({
actions: { refetch: refetch },
context: {
id: job.id,
job: job,
type: "job",
},
});
}}
key="printing"
>
<PrinterFilled />
{t("jobs.actions.printCenter")}
</Button>
<JobsConvertButton job={job} refetch={refetch} />
<JobsDetailHeaderActions key="actions" job={job} refetch={refetch} />
<Button
type="primary"
loading={loading}
disabled={jobRO}
className="imex-flex-row__margin"
onClick={() => form.submit()}
>
{t("general.actions.save")}
</Button>
</div>
);
const gridStyle = {
flex: 1,
//textAlign: "center",
};
return (
<PageHeader
title={job.ro_number || t("general.labels.na")}
subTitle={job.status}
tags={[
<OwnerTagPopoverComponent key="owner" job={job} />,
<VehicleTagPopoverComponent key="vehicle" job={job} />,
<Tag
color="#f50"
key="production"
style={{ display: job.inproduction ? "" : "none" }}
>
{t("jobs.labels.inproduction")}
</Tag>,
<Tag title={t("jobs.fields.repairtotal")} key="total" color="green">
<CurrencyFormatter>{job.clm_total}</CurrencyFormatter>
<span style={{ margin: "0rem .5rem" }}>/</span>
<CurrencyFormatter>{job.owner_owing}</CurrencyFormatter>
</Tag>,
]}
extra={menuExtra}
>
<div style={{ display: "flex", justifyContent: "flex-end" }}>
{(job.inproduction || jobInPostProduction) && (
<>
<div style={{ display: "flex", flex: 1 }}>
<div style={{ marginRight: "2rem" }}>
{t("jobs.fields.production_vars.note")}
</div>
<ProductionListColumnProductionNote record={job} />
<Row gutter={16} style={{ alignItems: "stretch" }}>
<Col span={8}>
<Card title="Job Status" style={{ height: "100%" }}>
<div>
<DataLabel label={t("jobs.fields.status")}>
{job.status}
{job.inproduction && (
<span style={{ marginLeft: ".5rem" }}>
<Tag color="#f50" key="production">
{t("jobs.labels.inproduction")}
</Tag>
</span>
)}
</DataLabel>
<DataLabel label={t("jobs.fields.ins_co_nm_short")}>
{job.ins_co_nm}
</DataLabel>
<DataLabel label={t("jobs.fields.clm_no")}>{job.clm_no}</DataLabel>
<DataLabel label={t("jobs.fields.repairtotal")}>
<CurrencyFormatter>{job.clm_total}</CurrencyFormatter>
<span style={{ margin: "0rem .5rem" }}>/</span>
<CurrencyFormatter>{job.owner_owing}</CurrencyFormatter>
</DataLabel>
</div>
</Card>
</Col>
<Col span={8}>
<Link to={`/manage/owners/${job.owner.id}`}>
<Card
className="ant-card-grid-hoverable"
style={{ height: "100%" }}
title={`${job.ownr_fn || ""} ${job.ownr_ln || ""} ${
job.ownr_co_nm || ""
}`}
>
<div>
<DataLabel key="2" label={t("jobs.fields.ownr_ph1")}>
<ChatOpenButton>{job.ownr_ph1 || ""}</ChatOpenButton>
</DataLabel>
<DataLabel key="3" label={t("owners.fields.address")}>
{`${job.ownr_addr1 || ""} ${job.ownr_addr2 || ""} ${
job.ownr_city || ""
} ${job.ownr_st || ""} ${job.ownr_zip || ""}`}
</DataLabel>
<DataLabel key="4" label={t("owners.fields.ownr_ea")}>
{job.ownr_ea || ""}
</DataLabel>
</div>
<Divider type="vertical" />
</>
)}
<JobEmployeeAssignments job={job} />
</div>
</PageHeader>
</Card>
</Link>
</Col>
<Col span={8}>
<Link to={`/manage/vehicles/${job.vehicle.id}`}>
<Card
className="ant-card-grid-hoverable"
style={{ height: "100%" }}
title={`${job.v_model_yr || ""} ${job.v_color || ""}
${job.v_make_desc || ""}
${job.v_model_desc || ""}`}
>
<div>
<DataLabel key="2" label={t("vehicles.fields.plate_no")}>
{`${job.plate_no || t("general.labels.na")} (${`${
job.plate_st || t("general.labels.na")
}`})`}
</DataLabel>
<DataLabel key="4" label={t("vehicles.fields.v_vin")}>
{`${job.v_vin || t("general.labels.na")}`}
</DataLabel>
</div>
</Card>
</Link>
</Col>
</Row>
);
// return (
// <PageHeader
// title={job.ro_number || t("general.labels.na")}
// subTitle={job.status}
// tags={[
// <OwnerTagPopoverComponent key="owner" job={job} />,
// <VehicleTagPopoverComponent key="vehicle" job={job} />,
// <Tag
// color="#f50"
// key="production"
// style={{ display: job.inproduction ? "" : "none" }}
// >
// {t("jobs.labels.inproduction")}
// </Tag>,
// <Tag title={t("jobs.fields.repairtotal")} key="total" color="green">
// <CurrencyFormatter>{job.clm_total}</CurrencyFormatter>
// <span style={{ margin: "0rem .5rem" }}>/</span>
// <CurrencyFormatter>{job.owner_owing}</CurrencyFormatter>
// </Tag>,
// ]}
// extra={menuExtra}
// >
// <div style={{ display: "flex", justifyContent: "flex-end" }}>
// {(job.inproduction || jobInPostProduction) && (
// <>
// <div style={{ display: "flex", flex: 1 }}>
// <div style={{ marginRight: "2rem" }}>
// {t("jobs.fields.production_vars.note")}
// </div>
// <ProductionListColumnProductionNote record={job} />
// </div>
// <Divider type="vertical" />
// </>
// )}
// <JobEmployeeAssignments job={job} />
// </div>
// </PageHeader>
// );
}
export default connect(mapStateToProps, mapDispatchToProps)(JobsDetailHeader);