IO-2173 Client Fusion - Job Line Discount not allowed
Adjust client job-line-upsert-modal to allow for discounts as markups were only allowed before. Convert prt_dsmk_p over to prt_dsmk_m on save of modal for both markup/discount for handling and viewing
This commit is contained in:
@@ -289,7 +289,7 @@ export function JobLinesUpsertModalComponent({
|
|||||||
name="prt_dsmk_p"
|
name="prt_dsmk_p"
|
||||||
initialValue={0}
|
initialValue={0}
|
||||||
>
|
>
|
||||||
<InputNumber precision={0} min={0} max={100} />
|
<InputNumber precision={0} min={-100} max={100} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("joblines.fields.tax_part")}
|
label={t("joblines.fields.tax_part")}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import { selectJobLineEditModal } from "../../redux/modals/modals.selectors";
|
|||||||
import UndefinedToNull from "../../utils/undefinedtonull";
|
import UndefinedToNull from "../../utils/undefinedtonull";
|
||||||
import JobLinesUpdsertModal from "./job-lines-upsert-modal.component";
|
import JobLinesUpdsertModal from "./job-lines-upsert-modal.component";
|
||||||
import Axios from "axios";
|
import Axios from "axios";
|
||||||
|
import Dinero from "dinero.js";
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
jobLineEditModal: selectJobLineEditModal,
|
jobLineEditModal: selectJobLineEditModal,
|
||||||
});
|
});
|
||||||
@@ -40,7 +41,15 @@ function JobLinesUpsertModalContainer({
|
|||||||
manual_line: !(
|
manual_line: !(
|
||||||
jobLineEditModal.context && jobLineEditModal.context.id
|
jobLineEditModal.context && jobLineEditModal.context.id
|
||||||
),
|
),
|
||||||
...UndefinedToNull(values),
|
...UndefinedToNull({
|
||||||
|
...values,
|
||||||
|
prt_dsmk_m: Dinero({
|
||||||
|
amount: Math.round(values.act_price * 100),
|
||||||
|
})
|
||||||
|
.percentage(Math.abs(values.prt_dsmk_p || 0))
|
||||||
|
.multiply(values.prt_dsmk_p >= 0 ? 1 : -1)
|
||||||
|
.toFormat(0.0),
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -68,7 +77,15 @@ function JobLinesUpsertModalContainer({
|
|||||||
const r = await updateJobLine({
|
const r = await updateJobLine({
|
||||||
variables: {
|
variables: {
|
||||||
lineId: jobLineEditModal.context.id,
|
lineId: jobLineEditModal.context.id,
|
||||||
line: values,
|
line: {
|
||||||
|
...values,
|
||||||
|
prt_dsmk_m: Dinero({
|
||||||
|
amount: Math.round(values.act_price * 100),
|
||||||
|
})
|
||||||
|
.percentage(Math.abs(values.prt_dsmk_p || 0))
|
||||||
|
.multiply(values.prt_dsmk_p >= 0 ? 1 : -1)
|
||||||
|
.toFormat(0.0),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
refetchQueries: ["GET_LINE_TICKET_BY_PK"],
|
refetchQueries: ["GET_LINE_TICKET_BY_PK"],
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user