Merge remote-tracking branch 'origin/master' into release/2022-07-22

This commit is contained in:
Patrick Fic
2022-07-18 11:39:32 -07:00
22 changed files with 260 additions and 97 deletions

View File

@@ -26551,6 +26551,27 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>convertedtolabor</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-MX</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-CA</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>cost</name>
<definition_loaded>false</definition_loaded>

View File

@@ -314,15 +314,17 @@ export function BillFormComponent({
>
<CurrencyInput min={0} disabled={disabled} />
</Form.Item>
<Form.Item label={t("bills.fields.allpartslocation")} name="location">
<Select style={{ width: "10rem" }} disabled={disabled} allowClear>
{bodyshop.md_parts_locations.map((loc, idx) => (
<Select.Option key={idx} value={loc}>
{loc}
</Select.Option>
))}
</Select>
</Form.Item>
{!billEdit && (
<Form.Item label={t("bills.fields.allpartslocation")} name="location">
<Select style={{ width: "10rem" }} disabled={disabled} allowClear>
{bodyshop.md_parts_locations.map((loc, idx) => (
<Select.Option key={idx} value={loc}>
{loc}
</Select.Option>
))}
</Select>
</Form.Item>
)}
</LayoutFormRow>
<LayoutFormRow>
<Form.Item

View File

@@ -323,28 +323,31 @@ export function BillEnterModalLinesComponent({
</Select>
),
},
{
title: t("billlines.fields.location"),
dataIndex: "location",
editable: true,
label: t("billlines.fields.location"),
formItemProps: (field) => {
return {
key: `${field.index}location`,
name: [field.name, "location"],
};
},
formInput: (record, index) => (
<Select disabled={disabled}>
{bodyshop.md_parts_locations.map((loc, idx) => (
<Select.Option key={idx} value={loc}>
{loc}
</Select.Option>
))}
</Select>
),
},
...(billEdit
? []
: [
{
title: t("billlines.fields.location"),
dataIndex: "location",
editable: true,
label: t("billlines.fields.location"),
formItemProps: (field) => {
return {
key: `${field.index}location`,
name: [field.name, "location"],
};
},
formInput: (record, index) => (
<Select disabled={disabled}>
{bodyshop.md_parts_locations.map((loc, idx) => (
<Select.Option key={idx} value={loc}>
{loc}
</Select.Option>
))}
</Select>
),
},
]),
{
title: t("billlines.labels.deductedfromlbr"),
dataIndex: "deductedfromlbr",

View File

@@ -23,7 +23,7 @@ export default connect(
export function EmailDocumentsComponent({
emailConfig,
form,
selectedMediaState,
}) {
const { t } = useTranslation();
@@ -48,7 +48,8 @@ export function EmailDocumentsComponent({
{selectedMedia &&
selectedMedia
.filter((s) => s.isSelected)
.reduce((acc, val) => (acc = acc + val.size), 0) >= 9961472 ? (
.reduce((acc, val) => (acc = acc + val.size), 0) >=
10485760 - new Blob([form.getFieldValue("html")]).size ? (
<div style={{ color: "red" }}>{t("general.errors.sizelimit")}</div>
) : null}
{data && (

View File

@@ -162,7 +162,10 @@ export function EmailOverlayComponent({
<Tabs>
{!bodyshop.uselocalmediaserver && (
<Tabs.TabPane tab={t("emails.labels.documents")} key="documents">
<EmailDocumentsComponent selectedMediaState={selectedMediaState} />
<EmailDocumentsComponent
selectedMediaState={selectedMediaState}
form={form}
/>
</Tabs.TabPane>
)}
<Tabs.TabPane tab={t("emails.labels.attachments")} key="attachments">
@@ -188,7 +191,8 @@ export function EmailOverlayComponent({
0
);
const limit = 9961472;
const limit =
10485760 - new Blob([form.getFieldValue("html")]).size;
if (totalSize > limit) {
return Promise.reject(t("general.errors.sizelimit"));

View File

@@ -168,7 +168,6 @@ export function EmailOverlayContainer({
useEffect(() => {
if (modalVisible) render();
}, [modalVisible]); // eslint-disable-line react-hooks/exhaustive-deps
return (
<Modal
destroyOnClose={true}
@@ -178,7 +177,15 @@ export function EmailOverlayContainer({
onCancel={() => {
toggleEmailOverlayVisible();
}}
okButtonProps={{ loading: sending }}
okButtonProps={{
loading: sending,
disabled:
selectedMedia &&
( (selectedMedia
.filter((s) => s.isSelected)
.reduce((acc, val) => (acc = acc + val.size), 0) >=
10485760 - new Blob([form.getFieldValue("html")]).size) || selectedMedia.filter((s) => s.isSelected).length > 10),
}}
>
<Form layout="vertical" form={form} onFinish={handleFinish}>
{loading && (

View File

@@ -11,6 +11,7 @@ import AlertComponent from "../alert/alert.component";
import OwnerNameDisplay, {
OwnerNameDisplayFunction,
} from "../owner-name-display/owner-name-display.component";
import VehicleVinDisplay from "../vehicle-vin-display/vehicle-vin-display.component";
export default function GlobalSearch() {
const { t } = useTranslation();
const history = useHistory();
@@ -97,7 +98,11 @@ export default function GlobalSearch() {
} ${vehicle.v_model_desc || ""}`}
</span>
<span>{vehicle.plate_no || ""}</span>
<span> {vehicle.v_vin || ""}</span>
<span>
<VehicleVinDisplay>
{vehicle.v_vin || ""}
</VehicleVinDisplay>
</span>
</Space>
</Link>
),

View File

@@ -247,40 +247,40 @@ export function ScheduleEventComponent({
);
const RegularEvent = event.isintake ? (
<div
<Space
wrap
size='small'
style={{
display: "flex",
flexWrap: "wrap",
height: "100%",
backgroundColor:
event.color && event.color.hex ? event.color.hex : event.color,
}}
>
<Space>
{event.note && <AlertFilled className="production-alert" />}
<strong>{`${event.job.ro_number || t("general.labels.na")}`}</strong>
<span>
<OwnerNameDisplay ownerObject={event.job} />
</span>
</Space>
<Space>
<span>
{`${(event.job && event.job.v_model_yr) || ""} ${
(event.job && event.job.v_make_desc) || ""
} ${(event.job && event.job.v_model_desc) || ""}`}
</span>
<span>
{`(${
(event.job && event.job.labhrs.aggregate.sum.mod_lb_hrs) || "0"
} / ${
(event.job && event.job.larhrs.aggregate.sum.mod_lb_hrs) || "0"
})`}
</span>
</Space>
{event.note && <AlertFilled className="production-alert" />}
<strong>{`${event.job.ro_number || t("general.labels.na")}`}</strong>
<OwnerNameDisplay ownerObject={event.job} />
{`${(event.job && event.job.v_model_yr) || ""} ${
(event.job && event.job.v_make_desc) || ""
} ${(event.job && event.job.v_model_desc) || ""}`}
{`(${(event.job && event.job.labhrs.aggregate.sum.mod_lb_hrs) || "0"} / ${
(event.job && event.job.larhrs.aggregate.sum.mod_lb_hrs) || "0"
})`}
{event.job && event.job.alt_transport && (
<div style={{ margin: ".1rem" }}>{event.job.alt_transport}</div>
)}
</div>
</Space>
) : (
<div style={{ height: "100%", width: "100%" }}>
<div
style={{
height: "100%",
width: "100%",
backgroundColor:
event.color && event.color.hex ? event.color.hex : event.color,
}}
>
<strong>{`${event.title || ""}`}</strong>
</div>
);
@@ -291,7 +291,13 @@ export function ScheduleEventComponent({
onVisibleChange={(vis) => !event.vacation && setVisible(vis)}
trigger="click"
content={event.block ? blockContent : popoverContent}
style={{ height: "100%", width: "100%" }}
style={{
height: "100%",
width: "100%",
backgroundColor:
event.color && event.color.hex ? event.color.hex : event.color,
}}
>
{RegularEvent}
</Popover>

View File

@@ -4,6 +4,7 @@ import { Table, Input, Card, Space } from "antd";
import { Link } from "react-router-dom";
import { alphaSort } from "../../utils/sorters";
import JobCreateContext from "../../pages/jobs-create/jobs-create.context";
import VehicleVinDisplay from "../vehicle-vin-display/vehicle-vin-display.component";
export default function JobsCreateVehicleInfoSearchComponent({
loading,
@@ -27,7 +28,9 @@ export default function JobsCreateVehicleInfoSearchComponent({
tableState.sortedInfo.columnKey === "v_vin" &&
tableState.sortedInfo.order,
render: (text, record) => (
<Link to={"/manage/vehicles/" + record.id}>{record.v_vin}</Link>
<Link to={"/manage/vehicles/" + record.id}>
<VehicleVinDisplay>{record.v_vin}</VehicleVinDisplay>
</Link>
),
},
{

View File

@@ -23,6 +23,7 @@ import JobsRelatedRos from "../jobs-related-ros/jobs-related-ros.component";
import { DateTimeFormatter } from "../../utils/DateFormatter";
import ProductionListColumnComment from "../production-list-columns/production-list-columns.comment.component";
import { OwnerNameDisplayFunction } from "../owner-name-display/owner-name-display.component";
import VehicleVinDisplay from "../vehicle-vin-display/vehicle-vin-display.component";
const mapStateToProps = createStructuredSelector({
jobRO: selectJobReadOnly,
@@ -211,7 +212,9 @@ export function JobsDetailHeader({ job, bodyshop, disabled }) {
}`})`}
</DataLabel>
<DataLabel key="4" label={t("vehicles.fields.v_vin")}>
{`${job.v_vin || t("general.labels.na")}`}
<VehicleVinDisplay>
{`${job.v_vin || t("general.labels.na")}`}
</VehicleVinDisplay>
</DataLabel>
<DataLabel label={t("jobs.labels.relatedros")}>
<JobsRelatedRos jobid={job.id} job={job} />

View File

@@ -1,16 +1,17 @@
import { EditFilled } from "@ant-design/icons";
import { Card, Space, Table } from "antd";
import { Card, Col, Row, Space, Table } from "antd";
import _ from "lodash";
import React, { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors";
import { selectTechnician } from "../../redux/tech/tech.selectors";
import { selectBodyshop } from "../../redux/user/user.selectors";
import { alphaSort } from "../../utils/sorters";
import LaborAllocationsAdjustmentEdit from "../labor-allocations-adjustment-edit/labor-allocations-adjustment-edit.component";
import "./labor-allocations-table.styles.scss";
import { CalculateAllocationsTotals } from "./labor-allocations-table.utility";
import _ from "lodash";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
technician: selectTechnician,
@@ -43,6 +44,11 @@ export function LaborAllocationsTable({
if (!jobId) setTotals([]);
}, [joblines, timetickets, bodyshop, adjustments, jobId]);
// const convertedLines = useMemo(
// () => joblines && joblines.filter((j) => j.convertedtolbr),
// [joblines]
// );
const columns = [
{
title: t("timetickets.fields.cost_center"),
@@ -114,24 +120,91 @@ export function LaborAllocationsTable({
),
},
];
// const convertedTableCols = [
// {
// title: t("joblines.fields.line_desc"),
// dataIndex: "line_desc",
// key: "line_desc",
// ellipsis: true,
// },
// {
// title: t("joblines.fields.op_code_desc"),
// dataIndex: "op_code_desc",
// key: "op_code_desc",
// ellipsis: true,
// render: (text, record) =>
// `${record.op_code_desc || ""}${
// record.alt_partm ? ` ${record.alt_partm}` : ""
// }`,
// },
// {
// title: t("joblines.fields.act_price"),
// dataIndex: "act_price",
// key: "act_price",
// ellipsis: true,
// render: (text, record) => (
// <>
// <CurrencyFormatter>
// {record.db_ref === "900510" || record.db_ref === "900511"
// ? record.prt_dsmk_m
// : record.act_price}
// </CurrencyFormatter>
// {record.prt_dsmk_p && record.prt_dsmk_p !== 0 ? (
// <span
// style={{ marginLeft: ".2rem" }}
// >{`(${record.prt_dsmk_p}%)`}</span>
// ) : (
// <></>
// )}
// </>
// ),
// },
// {
// title: t("joblines.fields.part_qty"),
// dataIndex: "part_qty",
// key: "part_qty",
// },
// ];
const handleTableChange = (pagination, filters, sorter) => {
setState({ ...state, filteredInfo: filters, sortedInfo: sorter });
};
return (
<Card title={t("jobs.labels.laborallocations")}>
<Table
columns={columns}
rowKey="cost_center"
pagination={false}
onChange={handleTableChange}
dataSource={totals}
scroll={{
x: true,
}}
/>
</Card>
<Row gutter={[16, 16]}>
<Col span={24}>
<Card title={t("jobs.labels.laborallocations")}>
<Table
columns={columns}
rowKey="cost_center"
pagination={false}
onChange={handleTableChange}
dataSource={totals}
scroll={{
x: true,
}}
/>
</Card>
</Col>
{
// convertedLines && convertedLines.length > 0 && (
// <Col span={24}>
// <Card title={t("jobs.labels.convertedtolabor")}>
// <Table
// columns={convertedTableCols}
// rowKey="id"
// pagination={false}
// dataSource={convertedLines}
// scroll={{
// x: true,
// }}
// />
// </Card>
// </Col>
// )
}
</Row>
);
}
export default connect(mapStateToProps, null)(LaborAllocationsTable);

View File

@@ -101,7 +101,7 @@ export function PartsOrderModalContainer({
logImEXEvent("parts_order_insert");
setSaving(true);
let insertResult;
if (!is_quote) {
insertResult = await insertPartOrder({
variables: {
po: [
@@ -112,16 +112,18 @@ export function PartsOrderModalContainer({
jobid: jobId,
user_email: currentUser.email,
return: isReturn,
status: bodyshop.md_order_statuses.default_ordered || "Ordered*",
status: is_quote
? bodyshop.md_order_statuses.default_quote || "Quote"
: bodyshop.md_order_statuses.default_ordered || "Ordered*",
},
],
},
refetchQueries: ["QUERY_PARTS_BILLS_BY_JOBID"],
});
if (!!insertResult.error) {
if (!!insertResult.errors) {
notification["error"]({
message: t("parts_orders.errors.creating"),
description: JSON.stringify(insertResult.error),
description: JSON.stringify(insertResult.errors),
});
return;
}
@@ -140,7 +142,7 @@ export function PartsOrderModalContainer({
insertResult.data.insert_parts_orders.returning[0].order_number
),
});
}
const jobLinesResult = await updateJobLines({
variables: {

View File

@@ -4,6 +4,10 @@
.rbc-time-view .rbc-allday-cell {
height: unset;
}
.rbc-month-row{
overflow: unset !important;
}
// .rbc-row-content {
// display: none;
// }

View File

@@ -34,7 +34,7 @@ export function ScheduleCalendarWrapperComponent({
const { t } = useTranslation();
const handleEventPropStyles = (event, start, end, isSelected) => {
return {
...(event.color
...(event.color && !((search.view || defaultView) === "agenda")
? {
style: {
backgroundColor:

View File

@@ -2,6 +2,7 @@ import { Button, Col, Descriptions, Popover, Row, Tag } from "antd";
import React from "react";
import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom";
import VehicleVinDisplay from "../vehicle-vin-display/vehicle-vin-display.component";
export default function VehicleTagPopoverComponent({ job }) {
const { t } = useTranslation();
@@ -27,7 +28,9 @@ export default function VehicleTagPopoverComponent({ job }) {
{`${job.plate_st || t("general.labels.na")}`}
</Descriptions.Item>
<Descriptions.Item key="4" label={t("vehicles.fields.v_vin")}>
{`${job.v_vin || t("general.labels.na")}`}
<VehicleVinDisplay>
{`${job.v_vin || t("general.labels.na")}`}
</VehicleVinDisplay>
</Descriptions.Item>
</Descriptions>
</Col>
@@ -46,7 +49,9 @@ export default function VehicleTagPopoverComponent({ job }) {
{`${job.vehicle.plate_st || t("general.labels.na")}`}
</Descriptions.Item>
<Descriptions.Item key="4" label={t("vehicles.fields.v_vin")}>
{`${job.vehicle.v_vin || t("general.labels.na")}`}
<VehicleVinDisplay>{`${
job.vehicle.v_vin || t("general.labels.na")
}`}</VehicleVinDisplay>
</Descriptions.Item>
</Descriptions>
</Col>

View File

@@ -0,0 +1,18 @@
import React from "react";
export default function VehicleVinDisplay({ children }) {
if (!children) return null;
console.log(children);
if (typeof children !== "string" || children.length !== 17) return children;
const vin = children.trim();
const first = vin.substring(0, 9);
const second = vin.substring(9, 17);
return (
<>
<span>{first}</span>
<span style={{ textDecoration: "underline" }}>{second}</span>
</>
);
}

View File

@@ -4,6 +4,7 @@ import queryString from "query-string";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { Link, useHistory, useLocation } from "react-router-dom";
import VehicleVinDisplay from "../vehicle-vin-display/vehicle-vin-display.component";
export default function VehiclesListComponent({
loading,
vehicles,
@@ -31,7 +32,7 @@ export default function VehiclesListComponent({
key: "v_vin",
render: (text, record) => (
<Link to={"/manage/vehicles/" + record.id}>
{record.v_vin || "N/A"}
<VehicleVinDisplay>{record.v_vin || "N/A"}</VehicleVinDisplay>
</Link>
),
},

View File

@@ -48,6 +48,7 @@ export const GET_LINE_TICKET_BY_PK = gql`
lbr_op
lbr_amt
op_code_desc
convertedtolbr
}
timetickets(where: { jobid: { _eq: $id } }) {
actualhrs

View File

@@ -1,10 +1,10 @@
import axios from "axios";
import phone from "phone";
import parsePhoneNumber from "libphonenumber-js";
import { all, call, put, select, takeLatest } from "redux-saga/effects";
import { logImEXEvent } from "../../firebase/firebase.utils";
import {
CONVERSATION_ID_BY_PHONE,
CREATE_CONVERSATION,
CREATE_CONVERSATION
} from "../../graphql/conversations.queries";
import { INSERT_CONVERSATION_TAG } from "../../graphql/job-conversations.queries";
import client from "../../utils/GraphQLClient";
@@ -12,7 +12,7 @@ import { selectBodyshop } from "../user/user.selectors";
import {
sendMessageFailure,
sendMessageSuccess,
setSelectedConversation,
setSelectedConversation
} from "./messaging.actions";
import MessagingActionTypes from "./messaging.types";
@@ -33,13 +33,14 @@ export function* openChatByPhone({ payload }) {
logImEXEvent("messaging_open_by_phone");
const { phone_num, jobid } = payload;
const p = parsePhoneNumber(phone_num, "CA");
const bodyshop = yield select(selectBodyshop);
try {
const {
data: { conversations },
} = yield client.query({
query: CONVERSATION_ID_BY_PHONE,
variables: { phone: phone(phone_num).phoneNumber },
variables: { phone: p.number },
});
if (conversations.length === 0) {
@@ -52,7 +53,7 @@ export function* openChatByPhone({ payload }) {
variables: {
conversation: [
{
phone_num: phone(phone_num).phoneNumber,
phone_num: p.number,
bodyshopid: bodyshop.id,
job_conversations: jobid ? { data: { jobid: jobid } } : null,
},

View File

@@ -1570,6 +1570,7 @@
"closeconfirm": "Are you sure you want to close this job? This cannot be easily undone.",
"closejob": "Close Job {{ro_number}}",
"contracts": "CC Contracts",
"convertedtolabor": "Lines Converted to Labor",
"cost": "Cost",
"cost_Additional": "Cost - Additional",
"cost_labor": "Cost - Labor",

View File

@@ -1570,6 +1570,7 @@
"closeconfirm": "",
"closejob": "",
"contracts": "",
"convertedtolabor": "",
"cost": "",
"cost_Additional": "",
"cost_labor": "",

View File

@@ -1570,6 +1570,7 @@
"closeconfirm": "",
"closejob": "",
"contracts": "",
"convertedtolabor": "",
"cost": "",
"cost_Additional": "",
"cost_labor": "",