graphic changes update

This commit is contained in:
merelendor 2022-08-17 20:06:55 +03:00
parent 7d5ce48246
commit 09be275e08
5 changed files with 43 additions and 37 deletions

View File

@ -491,8 +491,8 @@ export const getContractGraphicChangeCalculate = (calculation) =>
return new Promise((resolve, reject) =>
{
axios.post(`${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/change/graphic/calculate`, { calculation },
axios.post(`${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/change/graphic/calculate`, calculation,
{
withCredentials: true,
})

View File

@ -5,5 +5,5 @@ export default async function handler(req, res)
{
console.log("WTF BODY");
console.log(req.body);
await CRMRequestPost(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/CreateCalculation`, req.body.calculation);
await CRMRequestPost(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/CreateCalculation?contract_number=${ req.body.contract_number }`, req.body);
}

View File

@ -223,7 +223,7 @@ class ChangeGraphicPage extends React.Component
<div className="form_field">
<input type="checkbox" hidden id="fix_pay" name="fix_pay" />
<label htmlFor="fix_pay">
Фиксировать послединий платеж
Фиксировать последний платеж
</label>
<div className="help_tooltip">
<div className="help_icon">
@ -248,13 +248,13 @@ class ChangeGraphicPage extends React.Component
<div className="form_field">
<input type="radio" hidden id="weeekend_type_1" name="weeekend_type" />
<label htmlFor="weeekend_type_1">
Фиксировать послединий платеж
Фиксировать последний платеж
</label>
</div>
<div className="form_field">
<input type="radio" hidden id="weeekend_type_2" name="weeekend_type" />
<label htmlFor="weeekend_type_2">
Фиксировать послединий платеж
Фиксировать последний платеж
</label>
</div>
</div>

View File

@ -104,7 +104,7 @@ class FixLastPayment extends React.Component
<div className="form_field">
<input type="checkbox" hidden id="fix_pay" name="fix_pay" checked={ value } onChange={ this._handle_onChange }/>
<label htmlFor="fix_pay">
Фиксировать послединий платеж
Фиксировать последний платеж
</label>
<div className="help_tooltip">
<div className="help_icon">
@ -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, });
});
});
}

View File

@ -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) =>