feature/IO-3255-simplified-parts-management - Bug Fixes
This commit is contained in:
@@ -322,19 +322,17 @@ export function JobLinesComponent({
|
|||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<Space>
|
<Space>
|
||||||
{(record.manual_line || jobIsPrivate) && !technician && (
|
{(record.manual_line || jobIsPrivate) && !technician && (
|
||||||
<>
|
<Button
|
||||||
<Button
|
disabled={jobRO}
|
||||||
disabled={jobRO}
|
onClick={() => {
|
||||||
onClick={() => {
|
setJobLineEditContext({
|
||||||
setJobLineEditContext({
|
actions: { refetch: refetch, submit: form && form.submit },
|
||||||
actions: { refetch: refetch, submit: form && form.submit },
|
context: { ...record, jobid: job.id }
|
||||||
context: { ...record, jobid: job.id }
|
});
|
||||||
});
|
}}
|
||||||
}}
|
>
|
||||||
>
|
<EditFilled />
|
||||||
<EditFilled />
|
</Button>
|
||||||
</Button>
|
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
<Button
|
<Button
|
||||||
title={t("tasks.buttons.create")}
|
title={t("tasks.buttons.create")}
|
||||||
@@ -350,31 +348,29 @@ export function JobLinesComponent({
|
|||||||
<FaTasks />
|
<FaTasks />
|
||||||
</Button>
|
</Button>
|
||||||
{(record.manual_line || jobIsPrivate) && !technician && (
|
{(record.manual_line || jobIsPrivate) && !technician && (
|
||||||
<>
|
<Button
|
||||||
<Button
|
disabled={jobRO}
|
||||||
disabled={jobRO}
|
onClick={async () => {
|
||||||
onClick={async () => {
|
await deleteJobLine({
|
||||||
await deleteJobLine({
|
variables: { joblineId: record.id },
|
||||||
variables: { joblineId: record.id },
|
update(cache) {
|
||||||
update(cache) {
|
cache.modify({
|
||||||
cache.modify({
|
fields: {
|
||||||
fields: {
|
joblines(existingJobLines, { readField }) {
|
||||||
joblines(existingJobLines, { readField }) {
|
return existingJobLines.filter((jlRef) => record.id !== readField("id", jlRef));
|
||||||
return existingJobLines.filter((jlRef) => record.id !== readField("id", jlRef));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
await axios.post("/job/totalsssu", {
|
});
|
||||||
id: job.id
|
await axios.post("/job/totalsssu", {
|
||||||
});
|
id: job.id
|
||||||
refetch && refetch();
|
});
|
||||||
}}
|
if (refetch) refetch();
|
||||||
>
|
}}
|
||||||
<DeleteFilled />
|
>
|
||||||
</Button>
|
<DeleteFilled />
|
||||||
</>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</Space>
|
</Space>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -14,16 +14,26 @@ import { insertAuditTrail } from "../../redux/application/application.actions";
|
|||||||
import { selectTechnician } from "../../redux/tech/tech.selectors";
|
import { selectTechnician } from "../../redux/tech/tech.selectors";
|
||||||
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||||
import { useNotification } from "../../contexts/Notifications/notificationContext.jsx";
|
import { useNotification } from "../../contexts/Notifications/notificationContext.jsx";
|
||||||
|
import { selectIsPartsEntry } from "../../redux/application/application.selectors.js";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
technician: selectTechnician
|
technician: selectTechnician,
|
||||||
|
isPartsEntry: selectIsPartsEntry
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
insertAuditTrail: ({ jobid, operation, type }) => dispatch(insertAuditTrail({ jobid, operation, type }))
|
insertAuditTrail: ({ jobid, operation, type }) => dispatch(insertAuditTrail({ jobid, operation, type }))
|
||||||
});
|
});
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(JobLineConvertToLabor);
|
export default connect(mapStateToProps, mapDispatchToProps)(JobLineConvertToLabor);
|
||||||
|
|
||||||
export function JobLineConvertToLabor({ children, jobline, job, insertAuditTrail, technician, ...otherBtnProps }) {
|
export function JobLineConvertToLabor({
|
||||||
|
children,
|
||||||
|
jobline,
|
||||||
|
job,
|
||||||
|
insertAuditTrail,
|
||||||
|
technician,
|
||||||
|
isPartsEntry,
|
||||||
|
...otherBtnProps
|
||||||
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
@@ -168,7 +178,7 @@ export function JobLineConvertToLabor({ children, jobline, job, insertAuditTrail
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{children}
|
{children}
|
||||||
{jobline.act_price !== 0 && !technician && (
|
{!isPartsEntry && jobline.act_price !== 0 && !technician && (
|
||||||
<Popover disabled={jobline.convertedtolbr} content={overlay} open={visibility} placement="bottom">
|
<Popover disabled={jobline.convertedtolbr} content={overlay} open={visibility} placement="bottom">
|
||||||
<Tooltip title={t("joblines.actions.converttolabor")}>
|
<Tooltip title={t("joblines.actions.converttolabor")}>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
Reference in New Issue
Block a user