Merge work.
This commit is contained in:
@@ -202,8 +202,6 @@ export function JobsTotalsTableComponent({ bodyshop, job }) {
|
|||||||
</td>
|
</td>
|
||||||
<td>{`(${Dinero(
|
<td>{`(${Dinero(
|
||||||
job.job_totals.parts.parts.subtotal
|
job.job_totals.parts.parts.subtotal
|
||||||
).toFormat()} ± ${Dinero(
|
|
||||||
job.job_totals.parts.parts.adjustments
|
|
||||||
).toFormat()})`}</td>
|
).toFormat()})`}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -213,8 +211,6 @@ export function JobsTotalsTableComponent({ bodyshop, job }) {
|
|||||||
</td>
|
</td>
|
||||||
<td>{`(${Dinero(
|
<td>{`(${Dinero(
|
||||||
job.job_totals.parts.sublets.subtotal
|
job.job_totals.parts.sublets.subtotal
|
||||||
).toFormat()} ± ${Dinero(
|
|
||||||
job.job_totals.parts.sublets.adjustments
|
|
||||||
).toFormat()})`}</td>
|
).toFormat()})`}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -339,7 +335,10 @@ export function JobsTotalsTableComponent({ bodyshop, job }) {
|
|||||||
</div>
|
</div>
|
||||||
<JobCalculateTotals job={job} />
|
<JobCalculateTotals job={job} />
|
||||||
<Editor
|
<Editor
|
||||||
value={{ CIECA: job.cieca_ttl.data, ImEXCalc: job.job_totals }}
|
value={{
|
||||||
|
CIECA: job.cieca_ttl && job.cieca_ttl.data,
|
||||||
|
ImEXCalc: job.job_totals,
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Col>
|
</Col>
|
||||||
|
|||||||
@@ -19,8 +19,6 @@ export default function JobsCloseTotals({ jobTotals }) {
|
|||||||
value={Dinero(jobTotals.parts.parts.total).toFormat()}
|
value={Dinero(jobTotals.parts.parts.total).toFormat()}
|
||||||
suffix={`(${Dinero(
|
suffix={`(${Dinero(
|
||||||
jobTotals.parts.parts.subtotal
|
jobTotals.parts.parts.subtotal
|
||||||
).toFormat()} ± ${Dinero(
|
|
||||||
jobTotals.parts.parts.adjustments
|
|
||||||
).toFormat()})`}
|
).toFormat()})`}
|
||||||
/>
|
/>
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
@@ -29,8 +27,6 @@ export default function JobsCloseTotals({ jobTotals }) {
|
|||||||
value={Dinero(jobTotals.parts.sublets.total).toFormat()}
|
value={Dinero(jobTotals.parts.sublets.total).toFormat()}
|
||||||
suffix={`(${Dinero(
|
suffix={`(${Dinero(
|
||||||
jobTotals.parts.sublets.subtotal
|
jobTotals.parts.sublets.subtotal
|
||||||
).toFormat()} ± ${Dinero(
|
|
||||||
jobTotals.parts.sublets.adjustments
|
|
||||||
).toFormat()})`}
|
).toFormat()})`}
|
||||||
/>
|
/>
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { Form, Select, Switch } from "antd";
|
import { Form, InputNumber, Select } from "antd";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import CurrencyInput from "../form-items-formatted/currency-form-item.component";
|
import CurrencyInput from "../form-items-formatted/currency-form-item.component";
|
||||||
import FormRow from "../layout-form-row/layout-form-row.component";
|
|
||||||
import JobsDetailRatesChangeButton from "../jobs-detail-rates-change-button/jobs-detail-rates-change-button.component";
|
import JobsDetailRatesChangeButton from "../jobs-detail-rates-change-button/jobs-detail-rates-change-button.component";
|
||||||
|
import FormRow from "../layout-form-row/layout-form-row.component";
|
||||||
|
|
||||||
export default function JobsDetailRates({ job, form }) {
|
export default function JobsDetailRates({ job, form }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -120,6 +120,24 @@ export default function JobsDetailRates({ job, form }) {
|
|||||||
<Form.Item label={t("jobs.fields.rate_matd")} name="rate_matd">
|
<Form.Item label={t("jobs.fields.rate_matd")} name="rate_matd">
|
||||||
<CurrencyInput />
|
<CurrencyInput />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("jobs.fields.federal_tax_rate")}
|
||||||
|
name="federal_tax_rate"
|
||||||
|
>
|
||||||
|
<InputNumber min={0} max={1} precision={2} />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("jobs.fields.state_tax_rate")}
|
||||||
|
name="state_tax_rate"
|
||||||
|
>
|
||||||
|
<InputNumber min={0} max={1} precision={2} />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("jobs.fields.local_tax_rate")}
|
||||||
|
name="local_tax_rate"
|
||||||
|
>
|
||||||
|
<InputNumber min={0} max={1} precision={2} />
|
||||||
|
</Form.Item>
|
||||||
</FormRow>
|
</FormRow>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -436,6 +436,9 @@ export const GET_JOB_BY_PK = gql`
|
|||||||
rate_mash
|
rate_mash
|
||||||
rate_matd
|
rate_matd
|
||||||
actual_in
|
actual_in
|
||||||
|
federal_tax_rate
|
||||||
|
local_tax_rate
|
||||||
|
state_tax_rate
|
||||||
scheduled_completion
|
scheduled_completion
|
||||||
scheduled_in
|
scheduled_in
|
||||||
actual_completion
|
actual_completion
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { GET_JOB_BY_PK, UPDATE_JOB } from "../../graphql/jobs.queries";
|
|||||||
import {
|
import {
|
||||||
addRecentItem,
|
addRecentItem,
|
||||||
setBreadcrumbs,
|
setBreadcrumbs,
|
||||||
|
setJobReadOnly,
|
||||||
setSelectedHeader,
|
setSelectedHeader,
|
||||||
} from "../../redux/application/application.actions";
|
} from "../../redux/application/application.actions";
|
||||||
import { CreateRecentItem } from "../../utils/create-recent-item";
|
import { CreateRecentItem } from "../../utils/create-recent-item";
|
||||||
@@ -19,6 +20,7 @@ const mapDispatchToProps = (dispatch) => ({
|
|||||||
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
|
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
|
||||||
addRecentItem: (item) => dispatch(addRecentItem(item)),
|
addRecentItem: (item) => dispatch(addRecentItem(item)),
|
||||||
setSelectedHeader: (key) => dispatch(setSelectedHeader(key)),
|
setSelectedHeader: (key) => dispatch(setSelectedHeader(key)),
|
||||||
|
setJobReadOnly: (bool) => dispatch(setJobReadOnly(bool)),
|
||||||
});
|
});
|
||||||
|
|
||||||
function JobsDetailPageContainer({
|
function JobsDetailPageContainer({
|
||||||
@@ -26,6 +28,7 @@ function JobsDetailPageContainer({
|
|||||||
setBreadcrumbs,
|
setBreadcrumbs,
|
||||||
addRecentItem,
|
addRecentItem,
|
||||||
setSelectedHeader,
|
setSelectedHeader,
|
||||||
|
setJobReadOnly,
|
||||||
}) {
|
}) {
|
||||||
const { jobId } = match.params;
|
const { jobId } = match.params;
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -64,7 +67,9 @@ function JobsDetailPageContainer({
|
|||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (data && data.jobs_by_pk)
|
if (data && data.jobs_by_pk) {
|
||||||
|
setJobReadOnly(!!data.jobs_by_pk.date_exported);
|
||||||
|
|
||||||
addRecentItem(
|
addRecentItem(
|
||||||
CreateRecentItem(
|
CreateRecentItem(
|
||||||
jobId,
|
jobId,
|
||||||
@@ -79,6 +84,7 @@ function JobsDetailPageContainer({
|
|||||||
`/manage/jobs/${jobId}`
|
`/manage/jobs/${jobId}`
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}, [
|
}, [
|
||||||
loading,
|
loading,
|
||||||
data,
|
data,
|
||||||
@@ -88,6 +94,7 @@ function JobsDetailPageContainer({
|
|||||||
jobId,
|
jobId,
|
||||||
addRecentItem,
|
addRecentItem,
|
||||||
setSelectedHeader,
|
setSelectedHeader,
|
||||||
|
setJobReadOnly,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (loading) return <SpinComponent />;
|
if (loading) return <SpinComponent />;
|
||||||
|
|||||||
@@ -38,3 +38,13 @@ export const setSelectedHeader = (key) => ({
|
|||||||
type: ApplicationActionTypes.SET_SELECTED_HEADER,
|
type: ApplicationActionTypes.SET_SELECTED_HEADER,
|
||||||
payload: key,
|
payload: key,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const setJobReadOnly = (bool) => ({
|
||||||
|
type: ApplicationActionTypes.SET_JOB_READONLY,
|
||||||
|
payload: bool,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const setBillReadOnly = (bool) => ({
|
||||||
|
type: ApplicationActionTypes.SET_BILL_READONLY,
|
||||||
|
payload: bool,
|
||||||
|
});
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ const INITIAL_STATE = {
|
|||||||
calculating: false,
|
calculating: false,
|
||||||
error: null,
|
error: null,
|
||||||
},
|
},
|
||||||
|
jobReadOnly: false,
|
||||||
|
billReadOnly: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
const applicationReducer = (state = INITIAL_STATE, action) => {
|
const applicationReducer = (state = INITIAL_STATE, action) => {
|
||||||
@@ -63,6 +65,11 @@ const applicationReducer = (state = INITIAL_STATE, action) => {
|
|||||||
loading: false,
|
loading: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
case ApplicationActionTypes.SET_BILL_READONLY:
|
||||||
|
return { ...state, billReadOnly: action.payload };
|
||||||
|
case ApplicationActionTypes.SET_JOB_READONLY:
|
||||||
|
return { ...state, jobReadOnly: action.payload };
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,3 +31,13 @@ export const selectSelectedHeader = createSelector(
|
|||||||
[selectApplication],
|
[selectApplication],
|
||||||
(application) => application.selectedHeader
|
(application) => application.selectedHeader
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const selectJobReadOnly = createSelector(
|
||||||
|
[selectApplication],
|
||||||
|
(application) => application.jobReadOnly
|
||||||
|
);
|
||||||
|
|
||||||
|
export const selectBillReadOnly = createSelector(
|
||||||
|
[selectApplication],
|
||||||
|
(application) => application.billReadOnly
|
||||||
|
);
|
||||||
|
|||||||
@@ -7,5 +7,7 @@ const ApplicationActionTypes = {
|
|||||||
CALCULATE_SCHEDULE_LOAD_FAILURE: "CALCULATE_SCHEDULE_LOAD_FAILURE",
|
CALCULATE_SCHEDULE_LOAD_FAILURE: "CALCULATE_SCHEDULE_LOAD_FAILURE",
|
||||||
ADD_RECENT_ITEM: "ADD_RECENT_ITEM",
|
ADD_RECENT_ITEM: "ADD_RECENT_ITEM",
|
||||||
SET_SELECTED_HEADER: "SET_SELECTED_HEADER",
|
SET_SELECTED_HEADER: "SET_SELECTED_HEADER",
|
||||||
|
SET_JOB_READONLY: "SET_JOB_READONLY",
|
||||||
|
SET_BILL_READONLY: "SET_BILL_READONLY",
|
||||||
};
|
};
|
||||||
export default ApplicationActionTypes;
|
export default ApplicationActionTypes;
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ function CalculateTaxesTotals(job, otherTotals) {
|
|||||||
const statePartsTax = job.joblines
|
const statePartsTax = job.joblines
|
||||||
.filter((jl) => !jl.removed)
|
.filter((jl) => !jl.removed)
|
||||||
.reduce((acc, val) => {
|
.reduce((acc, val) => {
|
||||||
if (!!!val.tax_part) return acc;
|
if (!!!val.tax_part || !!!val.part_type) return acc;
|
||||||
// if (!!job.parts_tax_rates[val.part_type]) {
|
// if (!!job.parts_tax_rates[val.part_type]) {
|
||||||
// console.log("val.line_desc", val.line_desc);
|
// console.log("val.line_desc", val.line_desc);
|
||||||
|
|
||||||
@@ -273,7 +273,6 @@ function CalculatePartsTotals(jobLines) {
|
|||||||
subtotal: acc.sublets.subtotal.add(
|
subtotal: acc.sublets.subtotal.add(
|
||||||
Dinero({ amount: Math.round(value.act_price * 100) })
|
Dinero({ amount: Math.round(value.act_price * 100) })
|
||||||
),
|
),
|
||||||
//TODO Add Adjustments in
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -306,7 +305,6 @@ function CalculatePartsTotals(jobLines) {
|
|||||||
amount: Math.round(value.act_price * 100),
|
amount: Math.round(value.act_price * 100),
|
||||||
}).multiply(value.part_qty)
|
}).multiply(value.part_qty)
|
||||||
),
|
),
|
||||||
//TODO Add Adjustments in
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
// default:
|
// default:
|
||||||
@@ -317,12 +315,10 @@ function CalculatePartsTotals(jobLines) {
|
|||||||
parts: {
|
parts: {
|
||||||
list: {},
|
list: {},
|
||||||
subtotal: Dinero({ amount: 0 }),
|
subtotal: Dinero({ amount: 0 }),
|
||||||
adjustments: Dinero({ amount: 0 }),
|
|
||||||
total: Dinero({ amount: 0 }),
|
total: Dinero({ amount: 0 }),
|
||||||
},
|
},
|
||||||
sublets: {
|
sublets: {
|
||||||
subtotal: Dinero({ amount: 0 }),
|
subtotal: Dinero({ amount: 0 }),
|
||||||
adjustments: Dinero({ amount: 0 }),
|
|
||||||
total: Dinero({ amount: 0 }),
|
total: Dinero({ amount: 0 }),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -331,11 +327,11 @@ function CalculatePartsTotals(jobLines) {
|
|||||||
return {
|
return {
|
||||||
parts: {
|
parts: {
|
||||||
...ret.parts,
|
...ret.parts,
|
||||||
total: ret.parts.subtotal, //+ ret.parts.adjustments
|
total: ret.parts.subtotal,
|
||||||
},
|
},
|
||||||
sublets: {
|
sublets: {
|
||||||
...ret.sublets,
|
...ret.sublets,
|
||||||
total: ret.sublets.subtotal, // + ret.sublets.adjustments,
|
total: ret.sublets.subtotal,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user