Merged in release/2022-07-15 (pull request #537)

release/2022-07-15

Approved-by: Patrick Fic
This commit is contained in:
Patrick Fic
2022-07-14 16:10:05 +00:00
16 changed files with 231 additions and 90 deletions

View File

@@ -26551,6 +26551,27 @@
</translation> </translation>
</translations> </translations>
</concept_node> </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> <concept_node>
<name>cost</name> <name>cost</name>
<definition_loaded>false</definition_loaded> <definition_loaded>false</definition_loaded>

View File

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

View File

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

View File

@@ -23,7 +23,7 @@ export default connect(
export function EmailDocumentsComponent({ export function EmailDocumentsComponent({
emailConfig, emailConfig,
form,
selectedMediaState, selectedMediaState,
}) { }) {
const { t } = useTranslation(); const { t } = useTranslation();
@@ -48,7 +48,8 @@ export function EmailDocumentsComponent({
{selectedMedia && {selectedMedia &&
selectedMedia selectedMedia
.filter((s) => s.isSelected) .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> <div style={{ color: "red" }}>{t("general.errors.sizelimit")}</div>
) : null} ) : null}
{data && ( {data && (

View File

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

View File

@@ -168,7 +168,6 @@ export function EmailOverlayContainer({
useEffect(() => { useEffect(() => {
if (modalVisible) render(); if (modalVisible) render();
}, [modalVisible]); // eslint-disable-line react-hooks/exhaustive-deps }, [modalVisible]); // eslint-disable-line react-hooks/exhaustive-deps
return ( return (
<Modal <Modal
destroyOnClose={true} destroyOnClose={true}
@@ -178,7 +177,15 @@ export function EmailOverlayContainer({
onCancel={() => { onCancel={() => {
toggleEmailOverlayVisible(); 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}> <Form layout="vertical" form={form} onFinish={handleFinish}>
{loading && ( {loading && (

View File

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

View File

@@ -1,6 +1,6 @@
import { EditFilled } from "@ant-design/icons"; import { EditFilled } from "@ant-design/icons";
import { Card, Space, Table } from "antd"; import { Card, Space, Table, Row, Col } from "antd";
import React, { useEffect, useState } from "react"; import React, { useEffect, useMemo, useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { createStructuredSelector } from "reselect"; import { createStructuredSelector } from "reselect";
@@ -11,6 +11,8 @@ import LaborAllocationsAdjustmentEdit from "../labor-allocations-adjustment-edit
import "./labor-allocations-table.styles.scss"; import "./labor-allocations-table.styles.scss";
import { CalculateAllocationsTotals } from "./labor-allocations-table.utility"; import { CalculateAllocationsTotals } from "./labor-allocations-table.utility";
import _ from "lodash"; import _ from "lodash";
import CurrencyFormatter from "../../utils/CurrencyFormatter";
const mapStateToProps = createStructuredSelector({ const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop, bodyshop: selectBodyshop,
technician: selectTechnician, technician: selectTechnician,
@@ -43,6 +45,11 @@ export function LaborAllocationsTable({
if (!jobId) setTotals([]); if (!jobId) setTotals([]);
}, [joblines, timetickets, bodyshop, adjustments, jobId]); }, [joblines, timetickets, bodyshop, adjustments, jobId]);
const convertedLines = useMemo(
() => joblines && joblines.filter((j) => j.convertedtolbr),
[joblines]
);
const columns = [ const columns = [
{ {
title: t("timetickets.fields.cost_center"), title: t("timetickets.fields.cost_center"),
@@ -114,24 +121,104 @@ 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",
},
{
title: t("joblines.fields.mod_lbr_ty"),
dataIndex: "mod_lbr_ty",
key: "mod_lbr_ty",
render: (text, record) =>
record.mod_lbr_ty
? t(`joblines.fields.lbr_types.${record.mod_lbr_ty}`)
: null,
},
{
title: t("joblines.fields.mod_lb_hrs"),
dataIndex: "mod_lb_hrs",
key: "mod_lb_hrs",
},
];
const handleTableChange = (pagination, filters, sorter) => { const handleTableChange = (pagination, filters, sorter) => {
setState({ ...state, filteredInfo: filters, sortedInfo: sorter }); setState({ ...state, filteredInfo: filters, sortedInfo: sorter });
}; };
return ( return (
<Card title={t("jobs.labels.laborallocations")}> <Row gutter={[16, 16]}>
<Table <Col span={24}>
columns={columns} <Card title={t("jobs.labels.laborallocations")}>
rowKey="cost_center" <Table
pagination={false} columns={columns}
onChange={handleTableChange} rowKey="cost_center"
dataSource={totals} pagination={false}
scroll={{ onChange={handleTableChange}
x: true, dataSource={totals}
}} scroll={{
/> x: true,
</Card> }}
/>
</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); export default connect(mapStateToProps, null)(LaborAllocationsTable);

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,10 +1,10 @@
import axios from "axios"; import axios from "axios";
import phone from "phone"; import parsePhoneNumber from "libphonenumber-js";
import { all, call, put, select, takeLatest } from "redux-saga/effects"; import { all, call, put, select, takeLatest } from "redux-saga/effects";
import { logImEXEvent } from "../../firebase/firebase.utils"; import { logImEXEvent } from "../../firebase/firebase.utils";
import { import {
CONVERSATION_ID_BY_PHONE, CONVERSATION_ID_BY_PHONE,
CREATE_CONVERSATION, CREATE_CONVERSATION
} from "../../graphql/conversations.queries"; } from "../../graphql/conversations.queries";
import { INSERT_CONVERSATION_TAG } from "../../graphql/job-conversations.queries"; import { INSERT_CONVERSATION_TAG } from "../../graphql/job-conversations.queries";
import client from "../../utils/GraphQLClient"; import client from "../../utils/GraphQLClient";
@@ -12,7 +12,7 @@ import { selectBodyshop } from "../user/user.selectors";
import { import {
sendMessageFailure, sendMessageFailure,
sendMessageSuccess, sendMessageSuccess,
setSelectedConversation, setSelectedConversation
} from "./messaging.actions"; } from "./messaging.actions";
import MessagingActionTypes from "./messaging.types"; import MessagingActionTypes from "./messaging.types";
@@ -33,13 +33,14 @@ export function* openChatByPhone({ payload }) {
logImEXEvent("messaging_open_by_phone"); logImEXEvent("messaging_open_by_phone");
const { phone_num, jobid } = payload; const { phone_num, jobid } = payload;
const p = parsePhoneNumber(phone_num, "CA");
const bodyshop = yield select(selectBodyshop); const bodyshop = yield select(selectBodyshop);
try { try {
const { const {
data: { conversations }, data: { conversations },
} = yield client.query({ } = yield client.query({
query: CONVERSATION_ID_BY_PHONE, query: CONVERSATION_ID_BY_PHONE,
variables: { phone: phone(phone_num).phoneNumber }, variables: { phone: p.number },
}); });
if (conversations.length === 0) { if (conversations.length === 0) {
@@ -52,7 +53,7 @@ export function* openChatByPhone({ payload }) {
variables: { variables: {
conversation: [ conversation: [
{ {
phone_num: phone(phone_num).phoneNumber, phone_num: p.number,
bodyshopid: bodyshop.id, bodyshopid: bodyshop.id,
job_conversations: jobid ? { data: { jobid: jobid } } : null, 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.", "closeconfirm": "Are you sure you want to close this job? This cannot be easily undone.",
"closejob": "Close Job {{ro_number}}", "closejob": "Close Job {{ro_number}}",
"contracts": "CC Contracts", "contracts": "CC Contracts",
"convertedtolabor": "Lines Converted to Labor",
"cost": "Cost", "cost": "Cost",
"cost_Additional": "Cost - Additional", "cost_Additional": "Cost - Additional",
"cost_labor": "Cost - Labor", "cost_labor": "Cost - Labor",

View File

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

View File

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