Compare commits
1 Commits
feature/IO
...
feature/IO
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf31290f05 |
@@ -1,7 +1,7 @@
|
||||
import { forwardRef } from "react";
|
||||
import React, { forwardRef } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
const LaborTypeFormItem = ({ value }) => {
|
||||
const LaborTypeFormItem = ({ value, onChange }, ref) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
if (!value) return null;
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
import { forwardRef } from "react";
|
||||
import React, { forwardRef } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
const PartTypeFormItem = ({ value }) => {
|
||||
const PartTypeFormItem = ({ value, onChange }, ref) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
if (!value) return null;
|
||||
|
||||
return (
|
||||
<div style={{ wordWrap: "break-word", overflowWrap: "break-word" }}>{t(`joblines.fields.part_types.${value}`)}</div>
|
||||
);
|
||||
return <div>{t(`joblines.fields.part_types.${value}`)}</div>;
|
||||
};
|
||||
export default forwardRef(PartTypeFormItem);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import Dinero from "dinero.js";
|
||||
import { forwardRef } from "react";
|
||||
import React, { forwardRef } from "react";
|
||||
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
@@ -7,24 +8,23 @@ import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop
|
||||
});
|
||||
const mapDispatchToProps = () => ({
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
|
||||
const ReadOnlyFormItem = ({ bodyshop, value, type = "text" }) => {
|
||||
const ReadOnlyFormItem = ({ bodyshop, value, type = "text", onChange }, ref) => {
|
||||
if (!value) return null;
|
||||
switch (type) {
|
||||
case "employee": {
|
||||
case "employee":
|
||||
const emp = bodyshop.employees.find((e) => e.id === value);
|
||||
return `${emp?.first_name} ${emp?.last_name}`;
|
||||
}
|
||||
|
||||
case "text":
|
||||
return <div style={{ wordWrap: "break-word", overflowWrap: "break-word" }}>{value}</div>;
|
||||
return <div>{value}</div>;
|
||||
case "currency":
|
||||
return <div>{Dinero({ amount: Math.round(value * 100) }).toFormat()}</div>;
|
||||
default:
|
||||
return <div style={{ wordWrap: "break-word", overflowWrap: "break-word" }}>{value}</div>;
|
||||
return <div>{value}</div>;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import { DownCircleFilled } from "@ant-design/icons";
|
||||
import { useMutation } from "@apollo/client";
|
||||
import { Button, Dropdown } from "antd";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { useNotification } from "../../contexts/Notifications/notificationContext.jsx";
|
||||
import { UPDATE_JOB_STATUS } from "../../graphql/jobs.queries";
|
||||
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||
import { useNotification } from "../../contexts/Notifications/notificationContext.jsx";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -24,7 +24,6 @@ export function JobsChangeStatus({ job, bodyshop, jobRO, insertAuditTrail }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const [availableStatuses, setAvailableStatuses] = useState([]);
|
||||
const [otherStages, setOtherStages] = useState([]);
|
||||
const [mutationUpdateJobstatus] = useMutation(UPDATE_JOB_STATUS);
|
||||
const notification = useNotification();
|
||||
|
||||
@@ -32,7 +31,7 @@ export function JobsChangeStatus({ job, bodyshop, jobRO, insertAuditTrail }) {
|
||||
mutationUpdateJobstatus({
|
||||
variables: { jobId: job.id, status: status }
|
||||
})
|
||||
.then((r) => {
|
||||
.then(() => {
|
||||
notification["success"]({ message: t("jobs.successes.save") });
|
||||
insertAuditTrail({
|
||||
jobid: job.id,
|
||||
@@ -41,7 +40,7 @@ export function JobsChangeStatus({ job, bodyshop, jobRO, insertAuditTrail }) {
|
||||
});
|
||||
// refetch();
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch(() => {
|
||||
notification["error"]({ message: t("jobs.errors.saving") });
|
||||
});
|
||||
};
|
||||
@@ -51,19 +50,14 @@ export function JobsChangeStatus({ job, bodyshop, jobRO, insertAuditTrail }) {
|
||||
if (job && bodyshop) {
|
||||
if (bodyshop.md_ro_statuses.pre_production_statuses.includes(job.status)) {
|
||||
setAvailableStatuses(bodyshop.md_ro_statuses.pre_production_statuses);
|
||||
if (bodyshop.md_ro_statuses.production_statuses[0])
|
||||
setOtherStages([bodyshop.md_ro_statuses.production_statuses[0]]);
|
||||
} else if (bodyshop.md_ro_statuses.production_statuses.includes(job.status)) {
|
||||
setAvailableStatuses(bodyshop.md_ro_statuses.production_statuses);
|
||||
setOtherStages([bodyshop.md_ro_statuses.default_imported, bodyshop.md_ro_statuses.default_delivered]);
|
||||
} else if (bodyshop.md_ro_statuses.post_production_statuses.includes(job.status)) {
|
||||
setAvailableStatuses(
|
||||
bodyshop.md_ro_statuses.post_production_statuses.filter(
|
||||
(s) => s !== bodyshop.md_ro_statuses.default_invoiced && s !== bodyshop.md_ro_statuses.default_exported
|
||||
)
|
||||
);
|
||||
if (bodyshop.md_ro_statuses.production_statuses[0])
|
||||
setOtherStages([bodyshop.md_ro_statuses.production_statuses[0]]);
|
||||
} else {
|
||||
console.log("Status didn't match any restrictions. Allowing all status changes.");
|
||||
setAvailableStatuses(bodyshop.md_ro_statuses.statuses);
|
||||
@@ -76,16 +70,7 @@ export function JobsChangeStatus({ job, bodyshop, jobRO, insertAuditTrail }) {
|
||||
...availableStatuses.map((item) => ({
|
||||
key: item,
|
||||
label: item
|
||||
})),
|
||||
...(job.converted
|
||||
? [
|
||||
{ type: "divider" },
|
||||
...otherStages.map((item) => ({
|
||||
key: item,
|
||||
label: item
|
||||
}))
|
||||
]
|
||||
: [])
|
||||
}))
|
||||
],
|
||||
onClick: (e) => updateJobStatus(e.key)
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { WarningOutlined } from "@ant-design/icons";
|
||||
import { Form, Select, Space, Tooltip } from "antd";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
@@ -8,13 +8,14 @@ import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import LaborTypeFormItem from "../form-items-formatted/labor-type-form-item.component";
|
||||
import PartTypeFormItem from "../form-items-formatted/part-type-form-item.component";
|
||||
import ReadOnlyFormItem from "../form-items-formatted/read-only-form-item.component";
|
||||
import { WarningOutlined } from "@ant-design/icons";
|
||||
import "./jobs-close-lines.styles.scss";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
jobRO: selectJobReadOnly
|
||||
});
|
||||
const mapDispatchToProps = () => ({
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
|
||||
@@ -23,7 +24,7 @@ export function JobsCloseLines({ bodyshop, job, jobRO }) {
|
||||
return (
|
||||
<div>
|
||||
<Form.List name={["joblines"]}>
|
||||
{(fields) => {
|
||||
{(fields, { add, remove, move }) => {
|
||||
return (
|
||||
<table className="jobs-close-table">
|
||||
<thead>
|
||||
|
||||
@@ -271,7 +271,7 @@ export function JobsCloseComponent({ job, bodyshop, jobRO, insertAuditTrail, set
|
||||
{
|
||||
required: true
|
||||
},
|
||||
() => ({
|
||||
({ getFieldValue }) => ({
|
||||
validator(_, value) {
|
||||
if (!bodyshop.cdk_dealerid) return Promise.resolve();
|
||||
if (!value || dayjs(value).isSameOrAfter(dayjs(), "day")) {
|
||||
@@ -280,7 +280,7 @@ export function JobsCloseComponent({ job, bodyshop, jobRO, insertAuditTrail, set
|
||||
return Promise.reject(new Error(t("jobs.labels.dms.invoicedatefuture")));
|
||||
}
|
||||
}),
|
||||
() => ({
|
||||
({ getFieldValue }) => ({
|
||||
validator(_, value) {
|
||||
if (ClosingPeriod.treatment === "on" && bodyshop.accountingconfig.ClosingPeriod) {
|
||||
if (
|
||||
@@ -369,8 +369,8 @@ export function JobsCloseComponent({ job, bodyshop, jobRO, insertAuditTrail, set
|
||||
<Form.List
|
||||
name={["qb_multiple_payers"]}
|
||||
rules={[
|
||||
() => ({
|
||||
validator() {
|
||||
({ getFieldValue }) => ({
|
||||
validator(_, value) {
|
||||
let totalAllocated = Dinero();
|
||||
|
||||
const payers = form.getFieldValue("qb_multiple_payers");
|
||||
@@ -492,7 +492,7 @@ export function JobsCloseComponent({ job, bodyshop, jobRO, insertAuditTrail, set
|
||||
<Statistic
|
||||
title={t("jobs.labels.pimraryamountpayable")}
|
||||
valueStyle={{
|
||||
color: discrep.getAmount() >= 0 ? "green" : "red"
|
||||
color: discrep.getAmount() > 0 ? "green" : "red"
|
||||
}}
|
||||
value={discrep.toFormat()}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user