Merged in development (pull request #43) IO-808 IO-809 IO-273 IO-792
This commit is contained in:
3975
client/package-lock.json
generated
3975
client/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -32,7 +32,11 @@ export default function BillDetailEditcontainer() {
|
||||
|
||||
const handleSave = () => {
|
||||
//It's got a previously deducted bill line!
|
||||
if (data.bills_by_pk.billlines.filter((b) => b.deductedfromlbr).length > 0)
|
||||
if (
|
||||
data.bills_by_pk.billlines.filter((b) => b.deductedfromlbr).length > 0 ||
|
||||
form.getFieldValue("billlines").filter((b) => b.deductedfromlbr).length >
|
||||
0
|
||||
)
|
||||
setVisible(true);
|
||||
else {
|
||||
form.submit();
|
||||
@@ -55,18 +59,6 @@ export default function BillDetailEditcontainer() {
|
||||
const { deductedfromlbr, ...il } = billline;
|
||||
delete il.__typename;
|
||||
|
||||
//Need to compare this line to the previous version of the line to see if there is a change in the adjustments.
|
||||
const theOldBillLine = data.bills_by_pk.billlines.find(
|
||||
(bl) => bl.id === billline.id
|
||||
);
|
||||
|
||||
if (theOldBillLine) {
|
||||
//It was there! Need to change the diff.
|
||||
if (theOldBillLine.deductedfromlbr !== deductedfromlbr) {
|
||||
//There's a different
|
||||
}
|
||||
}
|
||||
|
||||
if (il.id) {
|
||||
updates.push(
|
||||
updateBillLine({
|
||||
@@ -101,7 +93,7 @@ export default function BillDetailEditcontainer() {
|
||||
await Promise.all(updates);
|
||||
|
||||
await refetch();
|
||||
form.resetFields();
|
||||
form.setFieldsValue(transformData(data));
|
||||
form.resetFields();
|
||||
setVisible(false);
|
||||
setUpdateLoading(false);
|
||||
|
||||
@@ -73,6 +73,7 @@ function BillEnterModalContainer({
|
||||
return {
|
||||
...restI,
|
||||
deductedfromlbr: deductedfromlbr,
|
||||
lbr_adjustment,
|
||||
joblineid: i.joblineid === "noline" ? null : i.joblineid,
|
||||
};
|
||||
}),
|
||||
|
||||
@@ -255,14 +255,7 @@ export function BillEnterModalLinesComponent({
|
||||
>
|
||||
<Switch disabled={disabled} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
shouldUpdate={(prev, cur) =>
|
||||
prev.billlines[index] &&
|
||||
prev.billlines[index].deductedfromlbr !==
|
||||
cur.billlines[index] &&
|
||||
cur.billlines[index].deductedfromlbr
|
||||
}
|
||||
>
|
||||
<Form.Item shouldUpdate>
|
||||
{() => {
|
||||
if (
|
||||
getFieldValue([
|
||||
|
||||
@@ -3,6 +3,16 @@ import React from "react";
|
||||
import { withTranslation } from "react-i18next";
|
||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectCurrentUser } from "../../redux/user/user.selectors";
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
currentUser: selectCurrentUser,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
|
||||
class ErrorBoundary extends React.Component {
|
||||
constructor() {
|
||||
super();
|
||||
@@ -23,6 +33,24 @@ class ErrorBoundary extends React.Component {
|
||||
this.setState({ ...this.state, error, info });
|
||||
}
|
||||
|
||||
handleErrorSubmit = () => {
|
||||
const errorDescription = `**Please add relevant details about what you were doing before you encountered this issue**
|
||||
|
||||
----
|
||||
System Generated Log:
|
||||
${this.state.error.message}
|
||||
${this.state.error.stack}
|
||||
`;
|
||||
|
||||
const URL = `https://bodyshop.atlassian.net/servicedesk/customer/portal/3/group/8/create/26?summary=123&description=${encodeURI(
|
||||
errorDescription
|
||||
)}&customfield_10049=${window.location}&email=${
|
||||
this.props.currentUser.email
|
||||
}`;
|
||||
console.log(`URL`, URL);
|
||||
window.open(URL, "_blank");
|
||||
};
|
||||
|
||||
render() {
|
||||
const { t } = this.props;
|
||||
const { error, info } = this.state;
|
||||
@@ -32,22 +60,20 @@ class ErrorBoundary extends React.Component {
|
||||
return (
|
||||
<div>
|
||||
<Result
|
||||
status='500'
|
||||
status="500"
|
||||
title={t("general.labels.exceptiontitle")}
|
||||
subTitle={t("general.messages.exception")}
|
||||
extra={
|
||||
<Space>
|
||||
<Button
|
||||
type='primary'
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
window.location.reload();
|
||||
}}>
|
||||
}}
|
||||
>
|
||||
{t("general.actions.refresh")}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => {
|
||||
alert("Not implemented yet.");
|
||||
}}>
|
||||
<Button onClick={this.handleErrorSubmit}>
|
||||
{t("general.actions.submitticket")}
|
||||
</Button>
|
||||
</Space>
|
||||
@@ -72,4 +98,8 @@ class ErrorBoundary extends React.Component {
|
||||
}
|
||||
}
|
||||
}
|
||||
export default withTranslation()(ErrorBoundary);
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withTranslation()(ErrorBoundary));
|
||||
|
||||
@@ -113,6 +113,9 @@ export default function JobReconcilitionPartsTable({
|
||||
onChange={handleTableChange}
|
||||
rowSelection={{
|
||||
onChange: handleOnRowClick,
|
||||
getCheckboxProps: (record) => ({
|
||||
disabled: record.removed,
|
||||
}),
|
||||
selectedRowKeys: selectedLines,
|
||||
}}
|
||||
rowClassName={(record) => record.removed && "text-strikethrough"}
|
||||
|
||||
@@ -11,7 +11,7 @@ export const reconcileByAssocLine = (
|
||||
const [selectedJobLines, setSelectedJobLines] = jobLineState;
|
||||
|
||||
const allJoblinesFromBills = billLines
|
||||
.filter((bl) => !!bl.joblineid)
|
||||
.filter((bl) => bl.joblineid && !(bl.jobline && bl.jobline.removed))
|
||||
.map((bl) => bl.joblineid);
|
||||
|
||||
const duplicatedJobLinesbyInvoiceId = _.filter(
|
||||
@@ -73,7 +73,7 @@ export const reconcileByPrice = (
|
||||
|
||||
jobLines.forEach((jl) => {
|
||||
const matchingBillLineIds = billLines
|
||||
.filter((bl) => bl.actual_price === jl.act_price)
|
||||
.filter((bl) => bl.actual_price === jl.act_price && !jl.removed)
|
||||
.map((bl) => bl.id);
|
||||
|
||||
if (matchingBillLineIds.length > 1) {
|
||||
|
||||
@@ -23,9 +23,11 @@ export default function PaymentFormTotalPayments({ jobid }) {
|
||||
return acc.add(Dinero({ amount: (val.amount || 0) * 100 }));
|
||||
}, Dinero());
|
||||
|
||||
const balance = Dinero(
|
||||
data.jobs_by_pk.job_totals.totals.total_repairs
|
||||
).subtract(totalPayments);
|
||||
const balance =
|
||||
data.jobs_by_pk.job_totals &&
|
||||
Dinero(data.jobs_by_pk.job_totals.totals.total_repairs).subtract(
|
||||
totalPayments
|
||||
);
|
||||
|
||||
return (
|
||||
<div style={{ display: "flex", justifyContent: "space-evenly" }}>
|
||||
@@ -33,11 +35,14 @@ export default function PaymentFormTotalPayments({ jobid }) {
|
||||
title={t("payments.labels.totalpayments")}
|
||||
value={totalPayments.toFormat()}
|
||||
/>
|
||||
<Statistic
|
||||
title={t("payments.labels.balance")}
|
||||
valueStyle={{ color: balance.getAmount() !== 0 ? "red" : "green" }}
|
||||
value={balance.toFormat()}
|
||||
/>
|
||||
{balance && (
|
||||
<Statistic
|
||||
title={t("payments.labels.balance")}
|
||||
valueStyle={{ color: balance.getAmount() !== 0 ? "red" : "green" }}
|
||||
value={balance.toFormat()}
|
||||
/>
|
||||
)}
|
||||
{!balance && <div>{t("jobs.errors.nofinancial")}</div>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -50,14 +50,6 @@ export const QUERY_ALL_BILLS_PAGINATED = gql`
|
||||
id
|
||||
ro_number
|
||||
}
|
||||
billlines {
|
||||
actual_price
|
||||
quantity
|
||||
actual_cost
|
||||
cost_center
|
||||
id
|
||||
line_desc
|
||||
}
|
||||
}
|
||||
search_bills_aggregate(args: { search: $search }) {
|
||||
aggregate {
|
||||
@@ -129,6 +121,7 @@ export const QUERY_BILLS_BY_JOBID = gql`
|
||||
line_desc
|
||||
applicable_taxes
|
||||
deductedfromlbr
|
||||
lbr_adjustment
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -167,6 +160,7 @@ export const QUERY_BILL_BY_PK = gql`
|
||||
joblineid
|
||||
applicable_taxes
|
||||
deductedfromlbr
|
||||
lbr_adjustment
|
||||
}
|
||||
documents {
|
||||
id
|
||||
|
||||
@@ -608,6 +608,10 @@ export const GET_JOB_RECONCILIATION_BY_PK = gql`
|
||||
line_desc
|
||||
applicable_taxes
|
||||
deductedfromlbr
|
||||
jobline {
|
||||
id
|
||||
removed
|
||||
}
|
||||
}
|
||||
}
|
||||
jobs_by_pk(id: $id) {
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
- args:
|
||||
cascade: false
|
||||
read_only: false
|
||||
sql: ALTER TABLE "public"."billlines" DROP COLUMN "lbr_adjustment";
|
||||
type: run_sql
|
||||
@@ -0,0 +1,5 @@
|
||||
- args:
|
||||
cascade: false
|
||||
read_only: false
|
||||
sql: ALTER TABLE "public"."billlines" ADD COLUMN "lbr_adjustment" jsonb NULL;
|
||||
type: run_sql
|
||||
@@ -0,0 +1,38 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: billlines
|
||||
schema: public
|
||||
type: drop_insert_permission
|
||||
- args:
|
||||
permission:
|
||||
check:
|
||||
bill:
|
||||
job:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
columns:
|
||||
- actual_cost
|
||||
- actual_price
|
||||
- applicable_taxes
|
||||
- billid
|
||||
- cost_center
|
||||
- created_at
|
||||
- deductedfromlbr
|
||||
- id
|
||||
- joblineid
|
||||
- line_desc
|
||||
- quantity
|
||||
- updated_at
|
||||
set: {}
|
||||
role: user
|
||||
table:
|
||||
name: billlines
|
||||
schema: public
|
||||
type: create_insert_permission
|
||||
@@ -0,0 +1,39 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: billlines
|
||||
schema: public
|
||||
type: drop_insert_permission
|
||||
- args:
|
||||
permission:
|
||||
check:
|
||||
bill:
|
||||
job:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
columns:
|
||||
- actual_cost
|
||||
- actual_price
|
||||
- applicable_taxes
|
||||
- billid
|
||||
- cost_center
|
||||
- created_at
|
||||
- deductedfromlbr
|
||||
- id
|
||||
- joblineid
|
||||
- lbr_adjustment
|
||||
- line_desc
|
||||
- quantity
|
||||
- updated_at
|
||||
set: {}
|
||||
role: user
|
||||
table:
|
||||
name: billlines
|
||||
schema: public
|
||||
type: create_insert_permission
|
||||
@@ -0,0 +1,39 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: billlines
|
||||
schema: public
|
||||
type: drop_select_permission
|
||||
- args:
|
||||
permission:
|
||||
allow_aggregations: true
|
||||
columns:
|
||||
- actual_cost
|
||||
- actual_price
|
||||
- applicable_taxes
|
||||
- billid
|
||||
- cost_center
|
||||
- created_at
|
||||
- deductedfromlbr
|
||||
- id
|
||||
- joblineid
|
||||
- line_desc
|
||||
- quantity
|
||||
- updated_at
|
||||
computed_fields: []
|
||||
filter:
|
||||
bill:
|
||||
job:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
role: user
|
||||
table:
|
||||
name: billlines
|
||||
schema: public
|
||||
type: create_select_permission
|
||||
@@ -0,0 +1,40 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: billlines
|
||||
schema: public
|
||||
type: drop_select_permission
|
||||
- args:
|
||||
permission:
|
||||
allow_aggregations: true
|
||||
columns:
|
||||
- actual_cost
|
||||
- actual_price
|
||||
- applicable_taxes
|
||||
- billid
|
||||
- cost_center
|
||||
- created_at
|
||||
- deductedfromlbr
|
||||
- id
|
||||
- joblineid
|
||||
- lbr_adjustment
|
||||
- line_desc
|
||||
- quantity
|
||||
- updated_at
|
||||
computed_fields: []
|
||||
filter:
|
||||
bill:
|
||||
job:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
role: user
|
||||
table:
|
||||
name: billlines
|
||||
schema: public
|
||||
type: create_select_permission
|
||||
@@ -0,0 +1,38 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: billlines
|
||||
schema: public
|
||||
type: drop_update_permission
|
||||
- args:
|
||||
permission:
|
||||
columns:
|
||||
- actual_cost
|
||||
- actual_price
|
||||
- applicable_taxes
|
||||
- billid
|
||||
- cost_center
|
||||
- created_at
|
||||
- deductedfromlbr
|
||||
- id
|
||||
- joblineid
|
||||
- line_desc
|
||||
- quantity
|
||||
- updated_at
|
||||
filter:
|
||||
bill:
|
||||
job:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
set: {}
|
||||
role: user
|
||||
table:
|
||||
name: billlines
|
||||
schema: public
|
||||
type: create_update_permission
|
||||
@@ -0,0 +1,39 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: billlines
|
||||
schema: public
|
||||
type: drop_update_permission
|
||||
- args:
|
||||
permission:
|
||||
columns:
|
||||
- actual_cost
|
||||
- actual_price
|
||||
- applicable_taxes
|
||||
- billid
|
||||
- cost_center
|
||||
- created_at
|
||||
- deductedfromlbr
|
||||
- id
|
||||
- joblineid
|
||||
- lbr_adjustment
|
||||
- line_desc
|
||||
- quantity
|
||||
- updated_at
|
||||
filter:
|
||||
bill:
|
||||
job:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
set: {}
|
||||
role: user
|
||||
table:
|
||||
name: billlines
|
||||
schema: public
|
||||
type: create_update_permission
|
||||
@@ -394,6 +394,7 @@ tables:
|
||||
- deductedfromlbr
|
||||
- id
|
||||
- joblineid
|
||||
- lbr_adjustment
|
||||
- line_desc
|
||||
- quantity
|
||||
- updated_at
|
||||
@@ -410,6 +411,7 @@ tables:
|
||||
- deductedfromlbr
|
||||
- id
|
||||
- joblineid
|
||||
- lbr_adjustment
|
||||
- line_desc
|
||||
- quantity
|
||||
- updated_at
|
||||
@@ -438,6 +440,7 @@ tables:
|
||||
- deductedfromlbr
|
||||
- id
|
||||
- joblineid
|
||||
- lbr_adjustment
|
||||
- line_desc
|
||||
- quantity
|
||||
- updated_at
|
||||
|
||||
630
package-lock.json
generated
630
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user