IO-747 CCC Scroll to Job in Table on create
This commit is contained in:
@@ -117,6 +117,13 @@ export default function ContractsCarsComponent({
|
|||||||
type: "radio",
|
type: "radio",
|
||||||
selectedRowKeys: [selectedCar],
|
selectedRowKeys: [selectedCar],
|
||||||
}}
|
}}
|
||||||
|
onRow={(record, rowIndex) => {
|
||||||
|
return {
|
||||||
|
onClick: (event) => {
|
||||||
|
handleSelect(record);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import { Table, Input } from "antd";
|
import { Input, Table } from "antd";
|
||||||
import React, { useState } from "react";
|
import React, { useState, useMemo } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { alphaSort } from "../../utils/sorters";
|
import { alphaSort } from "../../utils/sorters";
|
||||||
|
import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component";
|
||||||
|
|
||||||
export default function ContractsJobsComponent({
|
export default function ContractsJobsComponent({
|
||||||
loading,
|
loading,
|
||||||
@@ -158,6 +159,15 @@ export default function ContractsJobsComponent({
|
|||||||
.includes(state.search.toLowerCase())
|
.includes(state.search.toLowerCase())
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const defaultCurrent = useMemo(() => {
|
||||||
|
return (
|
||||||
|
Math.round(
|
||||||
|
((filteredData.findIndex((v) => v.id === selectedJob) || 0) + 1) / 10
|
||||||
|
) + 1
|
||||||
|
);
|
||||||
|
}, [filteredData, selectedJob]);
|
||||||
|
|
||||||
|
if (loading) return <LoadingSkeleton />;
|
||||||
return (
|
return (
|
||||||
<Table
|
<Table
|
||||||
loading={loading}
|
loading={loading}
|
||||||
@@ -169,8 +179,11 @@ export default function ContractsJobsComponent({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
size="small"
|
size="small"
|
||||||
pagination={{ position: "top" }}
|
pagination={{
|
||||||
columns={columns.map((item) => ({ ...item }))}
|
position: "top",
|
||||||
|
defaultCurrent: defaultCurrent,
|
||||||
|
}}
|
||||||
|
columns={columns}
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
dataSource={filteredData}
|
dataSource={filteredData}
|
||||||
onChange={handleTableChange}
|
onChange={handleTableChange}
|
||||||
@@ -179,6 +192,13 @@ export default function ContractsJobsComponent({
|
|||||||
type: "radio",
|
type: "radio",
|
||||||
selectedRowKeys: [selectedJob],
|
selectedRowKeys: [selectedJob],
|
||||||
}}
|
}}
|
||||||
|
onRow={(record, rowIndex) => {
|
||||||
|
return {
|
||||||
|
onClick: (event) => {
|
||||||
|
handleSelect(record);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -173,9 +173,9 @@ function CalculateRatesTotals(ratesList, shoprates) {
|
|||||||
let subtotal = Dinero({ amount: 0 });
|
let subtotal = Dinero({ amount: 0 });
|
||||||
let rates_subtotal = Dinero({ amount: 0 });
|
let rates_subtotal = Dinero({ amount: 0 });
|
||||||
for (const property in ret) {
|
for (const property in ret) {
|
||||||
ret[property].total = Dinero({ amount: ret[property].rate * 100 }).multiply(
|
ret[property].total = Dinero({
|
||||||
ret[property].hours
|
amount: Math.round((ret[property].rate || 0) * 100),
|
||||||
);
|
}).multiply(ret[property].hours);
|
||||||
subtotal = subtotal.add(ret[property].total);
|
subtotal = subtotal.add(ret[property].total);
|
||||||
if (property !== "mapa" && property !== "mash")
|
if (property !== "mapa" && property !== "mash")
|
||||||
rates_subtotal = rates_subtotal.add(ret[property].total);
|
rates_subtotal = rates_subtotal.add(ret[property].total);
|
||||||
@@ -336,7 +336,6 @@ function CalculateTaxesTotals(job, otherTotals) {
|
|||||||
0) * 100
|
0) * 100
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
console.log("A", additionalItemsTax.toJSON());
|
|
||||||
} else {
|
} else {
|
||||||
statePartsTax = statePartsTax.add(
|
statePartsTax = statePartsTax.add(
|
||||||
Dinero({ amount: Math.round((val.act_price || 0) * 100) })
|
Dinero({ amount: Math.round((val.act_price || 0) * 100) })
|
||||||
@@ -348,7 +347,6 @@ function CalculateTaxesTotals(job, otherTotals) {
|
|||||||
0) * 100
|
0) * 100
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
console.log("S", statePartsTax.toJSON());
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user