IO-1967 Adjust display of convert to labor button.

This commit is contained in:
Patrick Fic
2022-06-30 14:16:10 -07:00
parent ece0946738
commit e0804099ee
4 changed files with 29 additions and 21 deletions

View File

@@ -149,7 +149,7 @@ function BillEnterModalContainer({
jobid: values.jobid, jobid: values.jobid,
operation: AuditTrailMapping.jobmodifylbradj({ operation: AuditTrailMapping.jobmodifylbradj({
mod_lbr_ty: key, mod_lbr_ty: key,
hours: adjustmentsToInsert[key], hours: adjustmentsToInsert[key].toFixed(1),
}), }),
}); });
}); });

View File

@@ -176,7 +176,7 @@ export function JobLinesComponent({
state.sortedInfo.columnKey === "act_price" && state.sortedInfo.order, state.sortedInfo.columnKey === "act_price" && state.sortedInfo.order,
ellipsis: true, ellipsis: true,
render: (text, record) => ( render: (text, record) => (
<> <JobLineConvertToLabor jobline={record} job={job}>
<CurrencyFormatter> <CurrencyFormatter>
{record.db_ref === "900510" || record.db_ref === "900511" {record.db_ref === "900510" || record.db_ref === "900511"
? record.prt_dsmk_m ? record.prt_dsmk_m
@@ -189,7 +189,7 @@ export function JobLinesComponent({
) : ( ) : (
<></> <></>
)} )}
</> </JobLineConvertToLabor>
), ),
}, },
{ {
@@ -337,7 +337,6 @@ export function JobLinesComponent({
</Button> </Button>
</> </>
)} )}
<JobLineConvertToLabor jobline={record} job={job} />
</Space> </Space>
), ),
}, },

View File

@@ -37,6 +37,7 @@ export default connect(
)(JobLineConvertToLabor); )(JobLineConvertToLabor);
export function JobLineConvertToLabor({ export function JobLineConvertToLabor({
children,
jobline, jobline,
job, job,
insertAuditTrail, insertAuditTrail,
@@ -105,7 +106,7 @@ export function JobLineConvertToLabor({
insertAuditTrail({ insertAuditTrail({
jobid: job.id, jobid: job.id,
operation: AuditTrailMapping.jobmodifylbradj({ operation: AuditTrailMapping.jobmodifylbradj({
hours: calculateAdjustment({ mod_lbr_ty, job, jobline }), hours: calculateAdjustment({ mod_lbr_ty, job, jobline }).toFixed(1),
mod_lbr_ty, mod_lbr_ty,
}), }),
}); });
@@ -214,23 +215,29 @@ export function JobLineConvertToLabor({
}; };
return ( return (
<Popover <>
disabled={jobline.convertedtolbr} {children}
content={overlay} {jobline.act_price !== 0 && (
visible={visibility} <Popover
placement="bottom"
>
<Tooltip title={t("joblines.actions.converttolabor")}>
<Button
disabled={jobline.convertedtolbr} disabled={jobline.convertedtolbr}
loading={loading} content={overlay}
onClick={handleClick} visible={visibility}
{...otherBtnProps} placement="bottom"
> >
<ClockCircleOutlined /> <Tooltip title={t("joblines.actions.converttolabor")}>
</Button> <Button
</Tooltip> type="link"
</Popover> disabled={jobline.convertedtolbr}
loading={loading}
onClick={handleClick}
{...otherBtnProps}
>
<ClockCircleOutlined />
</Button>
</Tooltip>
</Popover>
)}
</>
); );
} }

View File

@@ -72,7 +72,9 @@ export function LaborAllocationsAdjustmentEdit({
jobid: jobId, jobid: jobId,
operation: AuditTrailMapping.jobmodifylbradj({ operation: AuditTrailMapping.jobmodifylbradj({
mod_lbr_ty: values.mod_lbr_ty, mod_lbr_ty: values.mod_lbr_ty,
hours: values.hours - ((adjustments && adjustments[mod_lbr_ty]) || 0), hours:
values.hours -
((adjustments && adjustments[mod_lbr_ty]) || 0).toFixed(1),
}), }),
}); });
} }