Merged in development (pull request #21)

Final push for Sprint 37.
This commit is contained in:
Patrick Fic
2021-02-27 00:21:44 +00:00
19 changed files with 178 additions and 42 deletions

View File

@@ -4099,6 +4099,27 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>checklist-view</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>close</name>
<definition_loaded>false</definition_loaded>
@@ -27559,6 +27580,48 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>noemployeeforuser</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>noemployeeforuser_sub</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>
</children>
</folder_node>
<folder_node>

View File

@@ -18,7 +18,9 @@ import { setModalContext } from "../../redux/modals/modals.actions";
import CurrencyFormatter from "../../utils/CurrencyFormatter";
import { DateFormatter } from "../../utils/DateFormatter";
import { alphaSort } from "../../utils/sorters";
import { TemplateList } from "../../utils/TemplateConstants";
import BillDeleteButton from "../bill-delete-button/bill-delete-button.component";
import PrintWrapperComponent from "../print-wrapper/print-wrapper.component";
const mapStateToProps = createStructuredSelector({
//jobRO: selectJobReadOnly,
@@ -49,7 +51,7 @@ export function BillsListTableComponent({
});
const search = queryString.parse(useLocation().search);
const selectedBill = search.billid;
const Templates = TemplateList("bill");
const bills = billsQuery.data ? billsQuery.data.bills : [];
const { refetch } = billsQuery;
const columns = [
@@ -115,7 +117,7 @@ export function BillsListTableComponent({
dataIndex: "actions",
key: "actions",
render: (text, record) => (
<Space>
<Space wrap>
{record.exported ? (
<Button disabled>{t("bills.actions.edit")}</Button>
) : (
@@ -126,6 +128,15 @@ export function BillsListTableComponent({
</Link>
)}
<BillDeleteButton bill={record} />
{record.isinhouse && (
<PrintWrapperComponent
templateObject={{
name: Templates.inhouse_invoice.key,
variables: { id: record.id },
}}
messageObject={{ subject: Templates.inhouse_invoice.subject }}
/>
)}
</Space>
),
},
@@ -275,7 +286,7 @@ export function BillsListTableComponent({
.map((i) => {
return {
line_desc: i.line_desc,
// db_price: i.actual_price,
// db_price: i.actual_price,
act_price: i.actual_price,
quantity: i.quantity,
joblineid: i.joblineid,

View File

@@ -246,6 +246,8 @@ export function JobLinesComponent({
sorter: (a, b) => alphaSort(a.status, b.status),
sortOrder:
state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
filteredValue: state.filteredInfo.status || null,
filters:
(jobLines &&
jobLines

View File

@@ -40,7 +40,7 @@ export function PartsOrderListTableComponent({
setPartsReceiveContext,
}) {
const responsibilityCenters = bodyshop.md_responsibility_centers;
const Templates = TemplateList("partsorder");
const { t } = useTranslation();
const [state, setState] = useState({
sortedInfo: {},
@@ -105,7 +105,7 @@ export function PartsOrderListTableComponent({
dataIndex: "actions",
key: "actions",
render: (text, record) => (
<Space>
<Space wrap>
<Button
disabled={jobRO || record.return}
onClick={() => {
@@ -165,10 +165,15 @@ export function PartsOrderListTableComponent({
<PrintWrapper
templateObject={{
name: record.isReturn
? TemplateList("partsorder").parts_return_slip.key
: TemplateList("partsorder").parts_order.key,
? Templates.parts_return_slip.key
: Templates.parts_order.key,
variables: { id: record.id },
}}
messageObject={{
subject: record.isReturn
? Templates.parts_return_slip.subject
: Templates.parts_order.subject,
}}
/>
</Space>
),

View File

@@ -1,6 +1,6 @@
import { MailFilled, PrinterFilled } from "@ant-design/icons";
import { Space } from "antd";
import React from "react";
import { Space, Spin } from "antd";
import React, { useState } from "react";
import { GenerateDocument } from "../../utils/RenderTemplate";
export default function PrintWrapperComponent({
@@ -8,15 +8,19 @@ export default function PrintWrapperComponent({
messageObject = {},
children,
}) {
const [loading, setLoading] = useState(false);
const handlePrint = async (type) => {
setLoading(true);
await GenerateDocument(templateObject, messageObject, type);
setLoading(false);
};
return (
<Space>
{children || null}
<PrinterFilled
onClick={() => GenerateDocument(templateObject, {}, "p")}
/>
<MailFilled
onClick={() => GenerateDocument(templateObject, messageObject, "e")}
/>
<PrinterFilled onClick={() => handlePrint("p")} />
<MailFilled onClick={() => handlePrint("e")} />
{loading && <Spin size="small" />}
</Space>
);
}

View File

@@ -1,11 +1,11 @@
import { useMutation } from "@apollo/client";
import { Dropdown, Menu } from "antd";
import React from "react";
import { Dropdown, Menu, Spin } from "antd";
import React, { useState } from "react";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { logImEXEvent } from "../../firebase/firebase.utils";
import { UPDATE_JOB } from "../../graphql/jobs.queries";
import { selectBodyshop } from "../../redux/user/user.selectors";
import { logImEXEvent } from "../../firebase/firebase.utils";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
@@ -13,21 +13,22 @@ const mapStateToProps = createStructuredSelector({
export function ProductionListColumnStatus({ record, bodyshop }) {
const [updateJob] = useMutation(UPDATE_JOB);
const [loading, setLoading] = useState(false);
const handleSetStatus = (e) => {
const handleSetStatus = async (e) => {
logImEXEvent("production_change_status");
e.stopPropagation();
// e.stopPropagation();
setLoading(true);
const { key } = e;
updateJob({
await updateJob({
variables: {
jobId: record.id,
job: {
status: key,
},
},
}).then(() => {
if (record.refetch) record.refetch();
});
setLoading(false);
};
return (
@@ -42,9 +43,12 @@ export function ProductionListColumnStatus({ record, bodyshop }) {
))}
</Menu>
}
trigger={["contextMenu"]}
trigger={["click"]}
>
<div style={{ width: "100%", height: "19px" }}>{record.status}</div>
<div style={{ width: "100%", height: "19px", cursor: "pointer" }}>
{record.status}
{loading && <Spin size="small" />}
</div>
</Dropdown>
);
}

View File

@@ -80,12 +80,13 @@ export function ScheduleEventComponent({
) : null}
<Button
onClick={() => {
const Template = TemplateList("job").appointment_reminder;
GenerateDocument(
{
name: TemplateList("job").appointment_reminder.key,
name: Template.key,
variables: { id: event.job.id },
},
{ to: event.job && event.job.ownr_ea },
{ to: event.job && event.job.ownr_ea, subject: Template.subject },
"e"
);
}}

View File

@@ -30,6 +30,7 @@ function ShopEmployeesContainer({ bodyshop }) {
const [updateEmployee] = useMutation(UPDATE_EMPLOYEE);
const [insertEmployees] = useMutation(INSERT_EMPLOYEES);
const [deleteEmployee] = useMutation(DELETE_EMPLOYEE);
const handleDelete = (id) => {
logImEXEvent("shop_employee_delete");
@@ -57,7 +58,13 @@ function ShopEmployeesContainer({ bodyshop }) {
logImEXEvent("shop_employee_update");
updateEmployee({
variables: { id: employeeState[0].id, employee: values },
variables: {
id: employeeState[0].id,
employee: {
...values,
user_email: values.user_email === "" ? null : values.user_email,
},
},
})
.then((r) => {
notification["success"]({

View File

@@ -105,6 +105,8 @@ export default function TimeTicketList({
sorter: (a, b) => a.memo - b.memo,
sortOrder:
state.sortedInfo.columnKey === "memo" && state.sortedInfo.order,
render: (text, record) =>
record.clockon || record.clockoff ? t(record.memo) : record.memo,
},
{
title: t("timetickets.fields.clockon"),

View File

@@ -40,10 +40,6 @@ export function TimeTicektShiftContainer({
return assoc && assoc.user && assoc.user.employee && assoc.user.employee.id;
}, [bodyshop, currentUser.email]);
console.log(
"🚀 ~ file: time-ticket-shift-form.container.jsx ~ line 42 ~ employeeId",
employeeId
);
const handleFinish = async (values) => {
setLoading(true);

View File

@@ -1,5 +1,7 @@
import { useQuery } from "@apollo/client";
import { Result } from "antd";
import React, { useMemo } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { QUERY_ACTIVE_SHIFT_TIME_TICKETS } from "../../graphql/timetickets.queries";
@@ -28,6 +30,7 @@ export function TimeTicketShiftContainer({
currentUser,
isTechConsole,
}) {
const { t } = useTranslation();
const employeeId = useMemo(() => {
const assoc = bodyshop.associations.filter(
(a) => a.useremail === currentUser.email
@@ -48,6 +51,17 @@ export function TimeTicketShiftContainer({
if (loading) return <LoadingSpinner />;
if (error) return <AlertComponent message={error.message} type="error" />;
if (!employeeId)
return (
<div>
<Result
status="500"
title={t("timetickets.errors.noemployeeforuser")}
subTitle={t("timetickets.errors.noemployeeforuser_sub")}
/>
</div>
);
return (
<div>
{data.timetickets.length > 0 ? (

View File

@@ -44,6 +44,7 @@ export const QUERY_ALL_BILLS_PAGINATED = gql`
total
invoice_number
date
isinhouse
exported
job {
id
@@ -80,6 +81,7 @@ export const QUERY_BILLS_BY_JOBID = gql`
order_date
deliver_by
return
parts_order_lines {
id
act_price
@@ -114,6 +116,7 @@ export const QUERY_BILLS_BY_JOBID = gql`
state_tax_rate
local_tax_rate
is_credit_memo
isinhouse
exported
billlines {
actual_price
@@ -147,6 +150,7 @@ export const QUERY_BILL_BY_PK = gql`
local_tax_rate
state_tax_rate
federal_tax_rate
isinhouse
vendor {
id
name

View File

@@ -7,10 +7,12 @@ import { connect } from "react-redux";
import { Link, useHistory, useLocation } from "react-router-dom";
import BillDeleteButton from "../../components/bill-delete-button/bill-delete-button.component";
import PartsOrderModalContainer from "../../components/parts-order-modal/parts-order-modal.container";
import PrintWrapperComponent from "../../components/print-wrapper/print-wrapper.component";
import { setModalContext } from "../../redux/modals/modals.actions";
import CurrencyFormatter from "../../utils/CurrencyFormatter";
import { DateFormatter } from "../../utils/DateFormatter";
import { alphaSort } from "../../utils/sorters";
import { TemplateList } from "../../utils/TemplateConstants";
const mapDispatchToProps = (dispatch) => ({
setPartsOrderContext: (context) =>
@@ -34,6 +36,7 @@ export function BillsListPage({
const history = useHistory();
const search = queryString.parse(useLocation().search);
const { page } = search;
const Templates = TemplateList("bill");
const columns = [
{
@@ -136,7 +139,7 @@ export function BillsListPage({
dataIndex: "actions",
key: "actions",
render: (text, record) => (
<Space>
<Space wrap>
<Link to={`/manage/bills?billid=${record.id}`}>
<Button>{t("bills.actions.edit")}</Button>
</Link>
@@ -153,7 +156,7 @@ export function BillsListPage({
linesToOrder: record.billlines.map((i) => {
return {
line_desc: i.line_desc,
// db_price: i.actual_price,
// db_price: i.actual_price,
act_price: i.actual_price,
quantity: i.quantity,
joblineid: i.joblineid,
@@ -167,6 +170,15 @@ export function BillsListPage({
{t("bills.actions.return")}
</Button>
<BillDeleteButton bill={record} />
{record.isinhouse && (
<PrintWrapperComponent
templateObject={{
name: Templates.inhouse_invoice.key,
variables: { id: record.id },
}}
messageObject={{ subject: Templates.inhouse_invoice.subject }}
/>
)}
</Space>
),
},

View File

@@ -5,9 +5,7 @@ import TimeTicketShift from "../../components/time-ticket-shift/time-ticket-shif
export default function ShiftClock() {
return (
<RbacWrapper action="shiftclock:view">
<div>
<TimeTicketShift />
</div>
<TimeTicketShift />
</RbacWrapper>
);
}

View File

@@ -9,7 +9,11 @@ import {
import rootReducer from "./root.reducer";
import rootSaga from "./root.saga";
import * as Sentry from "@sentry/react";
const sentryReduxEnhancer = Sentry.createReduxEnhancer({
// Optionally pass options
});
const sagaMiddleWare = createSagaMiddleware();
const reduxSyncConfig = {
@@ -32,7 +36,8 @@ const composeEnhancers =
: compose;
const enhancer = composeEnhancers(
applyMiddleware(...middlewares)
applyMiddleware(...middlewares),
sentryReduxEnhancer
// other store enhancers if any
);

View File

@@ -270,6 +270,7 @@
"jobs": {
"admin": "Jobs -> Admin",
"available-list": "Jobs -> Available List",
"checklist-view": "Jobs -> Checklist View",
"close": "Jobs -> Close",
"create": "Jobs -> Create",
"deliver": "Jobs -> Deliver",
@@ -1691,7 +1692,9 @@
"clockingin": "Error while clocking in. {{message}}",
"clockingout": "Error while clocking out. {{message}}",
"creating": "Error creating time ticket. {{message}}",
"deleting": "Error deleting time ticket. {{message}}"
"deleting": "Error deleting time ticket. {{message}}",
"noemployeeforuser": "Unable to use Shift Clock",
"noemployeeforuser_sub": "An employee record has not been created for this user. Please create one before using the shift clock. "
},
"fields": {
"actualhrs": "Actual Hours",

View File

@@ -270,6 +270,7 @@
"jobs": {
"admin": "",
"available-list": "",
"checklist-view": "",
"close": "",
"create": "",
"deliver": "",
@@ -1691,7 +1692,9 @@
"clockingin": "",
"clockingout": "",
"creating": "",
"deleting": ""
"deleting": "",
"noemployeeforuser": "",
"noemployeeforuser_sub": ""
},
"fields": {
"actualhrs": "",

View File

@@ -270,6 +270,7 @@
"jobs": {
"admin": "",
"available-list": "",
"checklist-view": "",
"close": "",
"create": "",
"deliver": "",
@@ -1691,7 +1692,9 @@
"clockingin": "",
"clockingout": "",
"creating": "",
"deleting": ""
"deleting": "",
"noemployeeforuser": "",
"noemployeeforuser_sub": ""
},
"fields": {
"actualhrs": "",

View File

@@ -252,7 +252,6 @@ exports.QUERY_EMPLOYEE_PIN = `query QUERY_EMPLOYEE_PIN($shopId: uuid!, $employee
first_name
employee_number
id
cost_center
pin
}
}`;