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