- reapply proper prettier formatting.
Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
@@ -6,7 +6,7 @@ import {connect} from "react-redux";
|
||||
import {createStructuredSelector} from "reselect";
|
||||
import {selectJobReadOnly} from "../../redux/application/application.selectors";
|
||||
import {setModalContext} from "../../redux/modals/modals.actions";
|
||||
import {selectBodyshop, selectCurrentUser} from "../../redux/user/user.selectors";
|
||||
import {selectBodyshop} from "../../redux/user/user.selectors";
|
||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||
import {DateFormatter} from "../../utils/DateFormatter";
|
||||
import {alphaSort, dateSort} from "../../utils/sorters";
|
||||
@@ -22,7 +22,10 @@ const mapStateToProps = createStructuredSelector({
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setBillEnterContext: (context) => dispatch(setModalContext({ context: context, modal: "billEnter" })),
|
||||
setBillEnterContext: (context) => dispatch(setModalContext({
|
||||
context: context,
|
||||
modal: "billEnter"
|
||||
})),
|
||||
setReconciliationContext: (context) => dispatch(setModalContext({
|
||||
context: context,
|
||||
modal: "reconciliation"
|
||||
@@ -40,7 +43,7 @@ export function BillsListTableComponent({
|
||||
setReconciliationContext,
|
||||
setTaskUpsertContext,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const {t} = useTranslation();
|
||||
|
||||
const [state, setState] = useState({
|
||||
sortedInfo: {}
|
||||
@@ -51,14 +54,14 @@ export function BillsListTableComponent({
|
||||
|
||||
const Templates = TemplateList("bill");
|
||||
const bills = billsQuery.data ? billsQuery.data.bills : [];
|
||||
const { refetch } = billsQuery;
|
||||
const {refetch} = billsQuery;
|
||||
|
||||
|
||||
const recordActions = (record, showView = false) => (
|
||||
<Space wrap>
|
||||
{showView && (
|
||||
<Button onClick={() => handleOnRowClick(record)}>
|
||||
<EditFilled />
|
||||
<EditFilled/>
|
||||
</Button>
|
||||
)}
|
||||
<Button title={t('tasks.buttons.create')} onClick={() => {
|
||||
@@ -71,9 +74,9 @@ export function BillsListTableComponent({
|
||||
}}>
|
||||
<FaTasks/>
|
||||
</Button>
|
||||
<BillDeleteButton bill={record} jobid={job.id} />
|
||||
<BillDeleteButton bill={record} jobid={job.id}/>
|
||||
<BillDetailEditReturnComponent
|
||||
data={{ bills_by_pk: { ...record, jobid: job.id } }}
|
||||
data={{bills_by_pk: {...record, jobid: job.id}}}
|
||||
disabled={record.is_credit_memo || record.vendorid === bodyshop.inhousevendorid || jobRO}
|
||||
/>
|
||||
|
||||
@@ -81,9 +84,9 @@ export function BillsListTableComponent({
|
||||
<PrintWrapperComponent
|
||||
templateObject={{
|
||||
name: Templates.inhouse_invoice.key,
|
||||
variables: { id: record.id }
|
||||
variables: {id: record.id}
|
||||
}}
|
||||
messageObject={{ subject: Templates.inhouse_invoice.subject }}
|
||||
messageObject={{subject: Templates.inhouse_invoice.subject}}
|
||||
/>
|
||||
)}
|
||||
</Space>
|
||||
@@ -126,7 +129,7 @@ export function BillsListTableComponent({
|
||||
key: "is_credit_memo",
|
||||
sorter: (a, b) => a.is_credit_memo - b.is_credit_memo,
|
||||
sortOrder: state.sortedInfo.columnKey === "is_credit_memo" && state.sortedInfo.order,
|
||||
render: (text, record) => <Checkbox checked={record.is_credit_memo} />
|
||||
render: (text, record) => <Checkbox checked={record.is_credit_memo}/>
|
||||
},
|
||||
{
|
||||
title: t("bills.fields.exported"),
|
||||
@@ -134,7 +137,7 @@ export function BillsListTableComponent({
|
||||
key: "exported",
|
||||
sorter: (a, b) => a.exported - b.exported,
|
||||
sortOrder: state.sortedInfo.columnKey === "exported" && state.sortedInfo.order,
|
||||
render: (text, record) => <Checkbox checked={record.exported} />
|
||||
render: (text, record) => <Checkbox checked={record.exported}/>
|
||||
},
|
||||
{
|
||||
title: t("general.labels.actions"),
|
||||
@@ -145,18 +148,18 @@ export function BillsListTableComponent({
|
||||
];
|
||||
|
||||
const handleTableChange = (pagination, filters, sorter) => {
|
||||
setState({ ...state, filteredInfo: filters, sortedInfo: sorter });
|
||||
setState({...state, filteredInfo: filters, sortedInfo: sorter});
|
||||
};
|
||||
|
||||
const filteredBills = bills
|
||||
? searchText === ""
|
||||
? bills
|
||||
: bills.filter(
|
||||
(b) =>
|
||||
(b.invoice_number || "").toLowerCase().includes(searchText.toLowerCase()) ||
|
||||
(b.vendor.name || "").toLowerCase().includes(searchText.toLowerCase()) ||
|
||||
(b.total || "").toString().toLowerCase().includes(searchText.toLowerCase())
|
||||
)
|
||||
(b) =>
|
||||
(b.invoice_number || "").toLowerCase().includes(searchText.toLowerCase()) ||
|
||||
(b.vendor.name || "").toLowerCase().includes(searchText.toLowerCase()) ||
|
||||
(b.total || "").toString().toLowerCase().includes(searchText.toLowerCase())
|
||||
)
|
||||
: [];
|
||||
|
||||
return (
|
||||
@@ -165,14 +168,14 @@ export function BillsListTableComponent({
|
||||
extra={
|
||||
<Space wrap>
|
||||
<Button onClick={() => refetch()}>
|
||||
<SyncOutlined />
|
||||
<SyncOutlined/>
|
||||
</Button>
|
||||
{job && job.converted ? (
|
||||
<>
|
||||
<Button
|
||||
onClick={() => {
|
||||
setBillEnterContext({
|
||||
actions: { refetch: billsQuery.refetch },
|
||||
actions: {refetch: billsQuery.refetch},
|
||||
context: {
|
||||
job
|
||||
}
|
||||
@@ -184,7 +187,7 @@ export function BillsListTableComponent({
|
||||
<Button
|
||||
onClick={() => {
|
||||
setReconciliationContext({
|
||||
actions: { refetch: billsQuery.refetch },
|
||||
actions: {refetch: billsQuery.refetch},
|
||||
context: {
|
||||
job,
|
||||
bills: (billsQuery.data && billsQuery.data.bills) || []
|
||||
|
||||
Reference in New Issue
Block a user