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,
operation: AuditTrailMapping.jobmodifylbradj({
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,
ellipsis: true,
render: (text, record) => (
<>
<JobLineConvertToLabor jobline={record} job={job}>
<CurrencyFormatter>
{record.db_ref === "900510" || record.db_ref === "900511"
? record.prt_dsmk_m
@@ -189,7 +189,7 @@ export function JobLinesComponent({
) : (
<></>
)}
</>
</JobLineConvertToLabor>
),
},
{
@@ -337,7 +337,6 @@ export function JobLinesComponent({
</Button>
</>
)}
<JobLineConvertToLabor jobline={record} job={job} />
</Space>
),
},

View File

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

View File

@@ -72,7 +72,9 @@ export function LaborAllocationsAdjustmentEdit({
jobid: jobId,
operation: AuditTrailMapping.jobmodifylbradj({
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),
}),
});
}