Merged in feature/IO-3020-IO-3036-imex-lite-rome-lite (pull request #2017)

IO-3020 IO-3036 Resolve lock wrapper on payroll allocations.
This commit is contained in:
Patrick Fic
2024-12-12 20:42:41 +00:00

View File

@@ -10,6 +10,9 @@ import { selectTechnician } from "../../redux/tech/tech.selectors";
import { selectBodyshop } from "../../redux/user/user.selectors";
import CurrencyFormatter from "../../utils/CurrencyFormatter";
import "./labor-allocations-table.styles.scss";
import { HasFeatureAccess } from "../feature-wrapper/feature-wrapper.component";
import UpsellComponent, { upsellEnum } from "../upsell/upsell.component";
import LockWrapperComponent from "../lock-wrapper/lock-wrapper.component";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
@@ -196,7 +199,7 @@ export function PayrollLaborAllocationsTable({
if (summary.difference !== 0 && typeof warningCallback === "function") {
warningCallback({ key: "labor", warning: t("jobs.labels.outstandinghours") });
}
const hasTimeTicketAccess = HasFeatureAccess({ bodyshop, featureName: "timetickets" });
return (
<Row gutter={[16, 16]}>
<Col span={24}>
@@ -205,6 +208,7 @@ export function PayrollLaborAllocationsTable({
extra={
<Space>
<Button
disabled={!hasTimeTicketAccess}
onClick={async () => {
const response = await axios.post("/payroll/payall", {
jobid: jobId
@@ -236,7 +240,7 @@ export function PayrollLaborAllocationsTable({
}
}}
>
{t("timetickets.actions.payall")}
<LockWrapperComponent featureName="timetickets">{t("timetickets.actions.payall")}</LockWrapperComponent>
</Button>
<Button
onClick={async () => {
@@ -257,10 +261,19 @@ export function PayrollLaborAllocationsTable({
rowKey={(record) => `${record.employeeid} ${record.mod_lbr_ty}`}
pagination={false}
onChange={handleTableChange}
dataSource={totals}
dataSource={hasTimeTicketAccess ? totals : []}
scroll={{
x: true
}}
locale={{
...(!hasTimeTicketAccess && {
emptyText: (
<Card>
<UpsellComponent upsell={upsellEnum().timetickets.allocations} />
</Card>
)
})
}}
summary={() => (
<Table.Summary.Row>
<Table.Summary.Cell>