Compare commits

..

1 Commits

Author SHA1 Message Date
Allan Carr
f6a59bdf55 IO-2511 Bill Label Reprint 2023-12-26 11:18:39 -08:00
10 changed files with 50 additions and 78 deletions

View File

@@ -10,7 +10,7 @@ import { createStructuredSelector } from "reselect";
import {
DELETE_BILL_LINE,
INSERT_NEW_BILL_LINES,
UPDATE_BILL_LINE
UPDATE_BILL_LINE,
} from "../../graphql/bill-lines.queries";
import { QUERY_BILL_BY_PK, UPDATE_BILL } from "../../graphql/bills.queries";
import { insertAuditTrail } from "../../redux/application/application.actions";
@@ -20,6 +20,7 @@ import AuditTrailMapping from "../../utils/AuditTrailMappings";
import AlertComponent from "../alert/alert.component";
import BillFormContainer from "../bill-form/bill-form.container";
import BillMarkExportedButton from "../bill-mark-exported-button/bill-mark-exported-button.component";
import BillPrintButton from "../bill-print-button/bill-print-button.component";
import BillReeportButtonComponent from "../bill-reexport-button/bill-reexport-button.component";
import JobDocumentsGallery from "../jobs-documents-gallery/jobs-documents-gallery.container";
import JobsDocumentsLocalGallery from "../jobs-documents-local-gallery/jobs-documents-local-gallery.container";
@@ -176,7 +177,7 @@ export function BillDetailEditcontainer({
extra={
<Space>
<BillDetailEditReturn data={data} />
<BillPrintButton billid={search.billid} />
<Popconfirm
visible={visible}
onConfirm={() => form.submit()}

View File

@@ -0,0 +1,38 @@
import { Button, Space } from "antd";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { GenerateDocument } from "../../utils/RenderTemplate";
import { TemplateList } from "../../utils/TemplateConstants";
export default function BillPrintButton({ billid }) {
const { t } = useTranslation();
const [loading, setLoading] = useState(false);
const Templates = TemplateList("job_special");
const submitHandler = async () => {
setLoading(true);
try {
await GenerateDocument(
{
name: Templates.parts_invoice_label_single.key,
variables: {
id: billid,
},
},
{},
"p"
);
} catch (e) {
console.warn("Warning: Error generating a document.");
}
setLoading(false);
};
return (
<Space wrap>
<Button loading={loading} onClick={submitHandler}>
{t("bills.labels.printlabels")}
</Button>
</Space>
);
}

View File

@@ -1,7 +1,7 @@
import { Button, Dropdown, Menu } from "antd";
import React from "react";
import { useTranslation } from "react-i18next";
import { Button, Dropdown, Menu } from "antd";
import dataSource from "./production-list-columns.data";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
@@ -24,7 +24,6 @@ export function ProductionColumnsComponent({
columnState,
technician,
bodyshop,
data,
tableState,
}) {
const [columns, setColumns] = columnState;
@@ -37,7 +36,6 @@ export function ProductionColumnsComponent({
bodyshop,
technician,
state: tableState,
data: data,
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
}).filter((i) => i.key === e.key),
]);
@@ -48,7 +46,6 @@ export function ProductionColumnsComponent({
technician,
state: tableState,
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
data: data,
});
const menu = (
<Menu

View File

@@ -1,4 +1,4 @@
import { BranchesOutlined, PauseCircleOutlined } from "@ant-design/icons";
import { PauseCircleOutlined, BranchesOutlined } from "@ant-design/icons";
import { Space, Tooltip } from "antd";
import i18n from "i18next";
import moment from "moment";
@@ -6,7 +6,6 @@ import { Link } from "react-router-dom";
import CurrencyFormatter from "../../utils/CurrencyFormatter";
import { TimeFormatter } from "../../utils/DateFormatter";
import PhoneFormatter from "../../utils/PhoneFormatter";
import { onlyUnique } from "../../utils/arrayHelper";
import { alphaSort, dateSort, statusSort } from "../../utils/sorters";
import JobAltTransportChange from "../job-at-change/job-at-change.component";
import JobPartsQueueCount from "../job-parts-queue-count/job-parts-queue-count.component";
@@ -26,7 +25,7 @@ import ProductionListColumnCategory from "./production-list-columns.status.categ
import ProductionListColumnStatus from "./production-list-columns.status.component";
import ProductionlistColumnTouchTime from "./prodution-list-columns.touchtime.component";
const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
const r = ({ technician, state, activeStatuses, bodyshop }) => {
return [
{
title: i18n.t("jobs.actions.viewdetail"),
@@ -537,36 +536,6 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
<JobPartsQueueCount parts={record.joblines_status} record={record} />
),
},
{
title: i18n.t("jobs.labels.estimator"),
dataIndex: "estimator",
key: "estimator",
sorter: (a, b) =>
alphaSort(
`${a.est_ct_fn || ""} ${a.est_ct_ln || ""}`.trim(),
`${b.est_ct_fn || ""} ${b.est_ct_ln || ""}`.trim()
),
sortOrder:
state.sortedInfo.columnKey === "estimator" && state.sortedInfo.order,
filters:
(data &&
data
.map((j) => `${j.est_ct_fn || ""} ${j.est_ct_ln || ""}`.trim())
.filter(onlyUnique)
.map((s) => {
return {
text: s || "N/A",
value: [s],
};
})) ||
[],
onFilter: (value, record) =>
value.includes(
`${record.est_ct_fn || ""} ${record.est_ct_ln || ""}`.trim()
),
render: (text, record) =>
`${record.est_ct_fn || ""} ${record.est_ct_ln || ""}`.trim(),
},
//Added as a place holder for St Claude. Not implemented as it requires another join for a field used by only 1 client.
// {

View File

@@ -24,7 +24,6 @@ export function ProductionListTable({
technician,
currentUser,
state,
data,
setColumns,
setState,
}) {
@@ -42,7 +41,6 @@ export function ProductionListTable({
bodyshop,
technician,
state,
data: data,
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
}).find((e) => e.key === k.key),
width: k.width,
@@ -97,7 +95,6 @@ export function ProductionListTable({
...ProductionListColumns({
technician,
state,
data: data,
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
}).find((e) => e.key === k.key),
width: k.width,

View File

@@ -10,7 +10,7 @@ import {
Statistic,
Table,
} from "antd";
import React, { useEffect, useMemo, useState } from "react";
import React, { useMemo, useState } from "react";
import ReactDragListView from "react-drag-listview";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
@@ -79,7 +79,6 @@ export function ProductionListTable({
bodyshop,
technician,
state,
data: data,
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
}).find((e) => e.key === k.key),
width: k.width ?? 100,
@@ -88,33 +87,6 @@ export function ProductionListTable({
[]
);
useEffect(() => {
const newColumns =
(state &&
matchingColumnConfig &&
matchingColumnConfig.columns.columnKeys.map((k) => {
return {
...ProductionListColumns({
bodyshop,
technician,
state,
data: data,
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
}).find((e) => e.key === k.key),
width: k.width ?? 100,
};
})) ||
[];
setColumns(newColumns);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [
//state,
matchingColumnConfig,
bodyshop,
technician,
data,
]); //State removed from dependency array as it causes race condition when removing columns from table view and is not needed.
const handleTableChange = (pagination, filters, sorter) => {
setState({
...state,
@@ -132,8 +104,7 @@ export function ProductionListTable({
const removeColumn = (e) => {
const { key } = e;
const newColumns = columns.filter((i) => i.key !== key);
setColumns(newColumns);
setColumns(columns.filter((i) => i.key !== key));
};
const handleResize =
@@ -256,7 +227,6 @@ export function ProductionListTable({
<ProductionListColumnsAdd
columnState={[columns, setColumns]}
tableState={state}
data={data}
/>
<ProductionListSaveConfigButton
columns={columns}
@@ -267,7 +237,6 @@ export function ProductionListTable({
state={state}
setState={setState}
setColumns={setColumns}
data={data}
/>
<Input

View File

@@ -364,8 +364,6 @@ export const QUERY_JOBS_IN_PRODUCTION = gql`
employee_refinish
employee_prep
employee_csr
est_ct_fn
est_ct_ln
suspended
date_repairstarted
joblines_status {

View File

@@ -214,6 +214,7 @@
"new": "New Bill",
"noneselected": "No bill selected.",
"onlycmforinvoiced": "Only credit memos can be entered for any Job that has been invoiced, exported, or voided.",
"printlabels": "Print Labels",
"retailtotal": "Bills Retail Total",
"savewithdiscrepancy": "You are about to save this bill with a discrepancy. The system will continue to use the calculated amount using the bill lines. Press cancel to return to the bill.",
"state_tax": "Provincial/State Tax",

View File

@@ -214,6 +214,7 @@
"new": "",
"noneselected": "",
"onlycmforinvoiced": "",
"printlabels": "",
"retailtotal": "",
"savewithdiscrepancy": "",
"state_tax": "",

View File

@@ -214,6 +214,7 @@
"new": "",
"noneselected": "",
"onlycmforinvoiced": "",
"printlabels": "",
"retailtotal": "",
"savewithdiscrepancy": "",
"state_tax": "",