@@ -516,6 +516,18 @@ export default class Options extends React.Component
event.preventDefault();
console.log(this.props);
+ const selected = {
+ number_planpayment: options.number_planpayment.value,
+ };
+ if(number_paydate !== null) { selected.number_paydate = moment(number_paydate).format(); }
+ if(period_new !== null) { selected.period_new = period_new; }
+ if(fix_last_payment_available !== null) { selected.fix_last_payment_available = fix_last_payment_available; }
+ if(date_offset_type !== null) { selected.date_offset_type = date_offset_type; }
+ if(sum !== null) { selected.sum = sum; }
+ if(insurance_price_result !== null) { selected.insurance_price_result = insurance_price_result; }
+ //if(early_redemption_change !== null) { selected.early_redemption_change = early_redemption_change; }
+ if(datefrom !== null) { selected.datefrom = moment(datefrom).format(); }
+
if(!sending)
{
const v = {};
@@ -523,17 +535,7 @@ export default class Options extends React.Component
const payload = {
...{ contract_number: number },
...v,
- ...{
- number_paydate: number_paydate !== null ? moment(number_paydate).format() : null,
- period_new,
- fix_last_payment_available,
- date_offset_type,
- sum: sum === null ? 0 : sum,
- insurance_price_result: insurance_price_result === null ? 0 : insurance_price_result,
- datefrom: datefrom !== null ? moment(datefrom).format() : null,
- early_redemption_change: false,
- number_planpayment: options.number_planpayment.value,
- }
+ ...selected
};
console.log(payload);
@@ -545,20 +547,11 @@ export default class Options extends React.Component
console.log("calculationcalculationcalculationcalculationcalculation");
console.log(calculation);
- /*
- onCalculate()
- .then(() =>
- {
-
- })
- .catch(() =>
- {
- this.setState({ sending: false, });
- });
- */
+ onCalculate(calculation.addcontract_number);
})
.catch(() =>
{
+ this.setState({ sending: false, });
});
});
}
diff --git a/pages/contract/change/index.js b/pages/contract/change/index.js
index 411daad..811b59c 100644
--- a/pages/contract/change/index.js
+++ b/pages/contract/change/index.js
@@ -23,12 +23,13 @@ import VariantsList from "./components/VariantsList";
import Final from "./components/Final";
import {
- getContractInfo,
- getContractGraphicChange,
- getContractGraphicChangeVariants,
- getContractGraphicChangeGetCurrent,
- getContractGraphicChangeGetCalculated,
- getContractGraphicChangeSignatories,
+ getContractInfo,
+ getContractGraphicChange,
+ getContractGraphicChangeVariants,
+ getContractGraphicChangeGetCurrent,
+ getContractGraphicChangeGetCalculated,
+ getContractGraphicChangeSignatories,
+ getContractGraphicChangeCalculationsList,
} from "../../../actions";
import Options from "./components/Options";
import Comparison from "./components/Comparison";
@@ -204,9 +205,21 @@ class ChangeGraphicPage extends React.Component
this.setState({ signer: signer_id });
}
- _handle_onCalculate = () =>
+ _handle_onCalculate = (calculation_id) =>
{
- this.setState({ mode_options: false, mode_comparison: true });
+ const { dispatch, number } = this.props;
+
+ getContractGraphicChangeCalculationsList({ dispatch, number })
+ .then(() =>
+ {
+ setTimeout(() =>
+ {
+ this._handle_onCalculation(calculation_id);
+ }, 100);
+ })
+ .catch(() =>
+ {
+ });
}
_handle_onCalculation = (calculation_id) =>