diff --git a/actions/contractActions.js b/actions/contractActions.js index 064119d..f936946 100644 --- a/actions/contractActions.js +++ b/actions/contractActions.js @@ -473,7 +473,7 @@ export const getContractGraphicChangeOptions = ({ dispatch, number, variants }) { console.log("ACTION", "getContractGraphicChangeOptions", "response.data", response.data); - dispatch({ type: actionTypes.CONTRACT_CHANGE, data: { options: response.data } }); + dispatch({ type: actionTypes.CONTRACT_CHANGE, data: { options: response.data.planpayments[0] } }); resolve(); }) .catch((error) => @@ -485,22 +485,21 @@ export const getContractGraphicChangeOptions = ({ dispatch, number, variants }) }); } -export const getContractGraphicChangeCalculate = ({ dispatch, number, calculation }) => +export const getContractGraphicChangeCalculate = (calculation) => { - console.log("ACTION", "getContractGraphicChangeCurrent", { number }); + console.log("ACTION", "getContractGraphicChangeCurrent", calculation); return new Promise((resolve, reject) => { - axios.post(`${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/change/calculations`, { number }, + + axios.post(`${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/change/graphic/calculate`, { calculation }, { withCredentials: true, }) .then(async (response) => { console.log("ACTION", "getContractGraphicChangeCurrent", "response.data", response.data); - - dispatch({ type: actionTypes.CONTRACT_CHANGE, data: { calculations: response.data.pre_calculations } }); - resolve(); + resolve(response.data); }) .catch((error) => { diff --git a/actions/eventsActions.js b/actions/eventsActions.js index aee0508..e4b8edf 100644 --- a/actions/eventsActions.js +++ b/actions/eventsActions.js @@ -33,12 +33,11 @@ export const getEvents = ({ dispatch, type, contract }) => }) .then((response) => { - console.log("getEvents", "response", response.data); + console.log("ACTION", "getEvents()", "response", response.data); const events = response.data; const filtered_events = []; - console.log("events"); - console.log(events); + console.log("ACTION", "getEvents()", "events", events); dispatch({ type: actionTypes.EVENTS, data: { list: events, loaded: true } }); resolve(); diff --git a/lib/CRMRequest/index.js b/lib/CRMRequestGet/index.js similarity index 82% rename from lib/CRMRequest/index.js rename to lib/CRMRequestGet/index.js index 8ec1288..8b5b29f 100644 --- a/lib/CRMRequest/index.js +++ b/lib/CRMRequestGet/index.js @@ -7,7 +7,7 @@ import jwt from 'jsonwebtoken'; import { cors } from '../cors'; import { inspect } from 'util'; -export default async function CRMRequest(req, res, path, params) +export default async function CRMRequestGet(req, res, path, params) { await cors(req, res); @@ -16,7 +16,7 @@ export default async function CRMRequest(req, res, path, params) const cookies = cookie.parse(req.headers?.cookie ? req.headers?.cookie : ""); console.log("-".repeat(50)); - console.log("CRMRequest", "req.body"); + console.log("CRMRequestGet", "req.body"); console.log(req.body); if(cookies.jwt !== undefined && cookies.jwt !== null) @@ -25,7 +25,7 @@ export default async function CRMRequest(req, res, path, params) console.log(cookies.jwt); var client_jwt_decoded = jwt.verify(cookies.jwt, process.env.JWT_SECRET_CLIENT); - var crm_jwt = jwt.sign(client_jwt_decoded, process.env.JWT_SECRET_CRM, { noTimestamp: true }); + var crm_jwt = jwt.sign({ acc_number: client_jwt_decoded.acc_number }, process.env.JWT_SECRET_CRM, { noTimestamp: true }); console.log("client_jwt_decoded", client_jwt_decoded); console.log("crm_jwt", crm_jwt); @@ -36,7 +36,7 @@ export default async function CRMRequest(req, res, path, params) try { await axios.get(path, { - params: { ...client_jwt_decoded, ...params }, + params: { ...{ acc_number: client_jwt_decoded.acc_number }, ...params }, headers: { "Authorization": `Bearer ${ crm_jwt }`, }, diff --git a/lib/CRMRequestPost/index.js b/lib/CRMRequestPost/index.js new file mode 100644 index 0000000..0c6ac99 --- /dev/null +++ b/lib/CRMRequestPost/index.js @@ -0,0 +1,68 @@ +// Next.js API route support: https://nextjs.org/docs/api-routes/introduction +import axios from 'axios'; +import { Cookies } from 'react-cookie'; +import cookie from 'cookie'; +import moment from 'moment'; +import jwt from 'jsonwebtoken'; +import { cors } from '../cors'; +import { inspect } from 'util'; + +export default async function CRMRequestPost(req, res, path, params) +{ + await cors(req, res); + + if(req.headers.cookie !== undefined) + { + const cookies = cookie.parse(req.headers?.cookie ? req.headers?.cookie : ""); + + console.log("-".repeat(50)); + console.log("CRMRequestPost", "req.body"); + console.log(req.body); + + if(cookies.jwt !== undefined && cookies.jwt !== null) + { + console.log("cookies.jwt"); + console.log(cookies.jwt); + + var client_jwt_decoded = jwt.verify(cookies.jwt, process.env.JWT_SECRET_CLIENT); + var crm_jwt = jwt.sign({ acc_number: client_jwt_decoded.acc_number }, process.env.JWT_SECRET_CRM, { noTimestamp: true }); + + const payload = { ...{ acc_number: client_jwt_decoded.acc_number }, ...params }; + console.log("path", path); + console.log("payload", payload); + + try + { + await axios.post(path, payload, + { + headers: { + //"Content-Type": "application/json", + "Authorization": `Bearer ${ crm_jwt }`, + }, + withCredentials: true, + }) + .then((crm_response) => + { + console.log("crm_response for", path); + console.log(inspect(crm_response.data, true, null, true)); + + res.status(200).json(crm_response.data); + }) + .catch((error) => + { + console.error(error); + res.status(500); + }); + } + catch(e) + { + console.error(e); + res.status(500); + } + } + else + { + res.status(403); + } + } +} \ No newline at end of file diff --git a/pages/api/contract/change/calculations.js b/pages/api/contract/change/calculations.js index 1ba280d..642ec3a 100644 --- a/pages/api/contract/change/calculations.js +++ b/pages/api/contract/change/calculations.js @@ -1,7 +1,7 @@ // Next.js API route support: https://nextjs.org/docs/api-routes/introduction -import CRMRequest from '../../../../lib/CRMRequest'; +import CRMRequestGet from '../../../../lib/CRMRequestGet'; export default async function handler(req, res) { - await CRMRequest(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/GetPreCalculations`, { contract_number: req.body.number }); + await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/GetPreCalculations`, { contract_number: req.body.number }); } \ No newline at end of file diff --git a/pages/api/contract/change/graphic/calculate.js b/pages/api/contract/change/graphic/calculate.js index 48719ee..e5ed656 100644 --- a/pages/api/contract/change/graphic/calculate.js +++ b/pages/api/contract/change/graphic/calculate.js @@ -1,7 +1,9 @@ // Next.js API route support: https://nextjs.org/docs/api-routes/introduction -import CRMRequest from '../../../../../lib/CRMRequest'; +import CRMRequestPost from '../../../../../lib/CRMRequestPost'; export default async function handler(req, res) { - await CRMRequest(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/CreateCalculation`, { contract_number: req.body.number }); + console.log("WTF BODY"); + console.log(req.body); + await CRMRequestPost(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/CreateCalculation`, req.body.calculation); } \ No newline at end of file diff --git a/pages/api/contract/change/graphic/calculation.js b/pages/api/contract/change/graphic/calculation.js index 9007bfb..5d17c96 100644 --- a/pages/api/contract/change/graphic/calculation.js +++ b/pages/api/contract/change/graphic/calculation.js @@ -1,7 +1,7 @@ // Next.js API route support: https://nextjs.org/docs/api-routes/introduction -import CRMRequest from '../../../../../lib/CRMRequest'; +import CRMRequestGet from '../../../../../lib/CRMRequestGet'; export default async function handler(req, res) { - await CRMRequest(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/GetPreCalculationGraph`, { addcontract_number: req.body.calculation }); + await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/GetPreCalculationGraph`, { addcontract_number: req.body.calculation }); } \ No newline at end of file diff --git a/pages/api/contract/change/graphic/current.js b/pages/api/contract/change/graphic/current.js index d338d87..84abf45 100644 --- a/pages/api/contract/change/graphic/current.js +++ b/pages/api/contract/change/graphic/current.js @@ -1,7 +1,7 @@ // Next.js API route support: https://nextjs.org/docs/api-routes/introduction -import CRMRequest from '../../../../../lib/CRMRequest'; +import CRMRequestGet from '../../../../../lib/CRMRequestGet'; export default async function handler(req, res) { - await CRMRequest(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/GetCurrentGraph`, { contract_number: req.body.number }); + await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/GetCurrentGraph`, { contract_number: req.body.number }); } \ No newline at end of file diff --git a/pages/api/contract/change/options.js b/pages/api/contract/change/options.js index 997edb0..d957d1f 100644 --- a/pages/api/contract/change/options.js +++ b/pages/api/contract/change/options.js @@ -1,5 +1,5 @@ // Next.js API route support: https://nextjs.org/docs/api-routes/introduction -import CRMRequest from '../../../../lib/CRMRequest'; +import CRMRequestGet from '../../../../lib/CRMRequestGet'; export default async function handler(req, res) { @@ -8,5 +8,5 @@ export default async function handler(req, res) console.log(req.body.variants); console.log("-".repeat(50)); - await CRMRequest(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/GetTypeOptions`, { ...{ contract_number: req.body.number }, ...req.body.variants }); + await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/GetTypeOptions`, { ...{ contract_number: req.body.number }, ...req.body.variants }); } \ No newline at end of file diff --git a/pages/api/contract/change/signatories.js b/pages/api/contract/change/signatories.js index 22f6727..a4c86cf 100644 --- a/pages/api/contract/change/signatories.js +++ b/pages/api/contract/change/signatories.js @@ -1,7 +1,7 @@ // Next.js API route support: https://nextjs.org/docs/api-routes/introduction -import CRMRequest from '../../../../lib/CRMRequest'; +import CRMRequestGet from '../../../../lib/CRMRequestGet'; export default async function handler(req, res) { - await CRMRequest(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/GetSignatories`, {}); + await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/GetSignatories`, {}); } \ No newline at end of file diff --git a/pages/api/contract/change/variants.js b/pages/api/contract/change/variants.js index 1a7d0c6..798fb8c 100644 --- a/pages/api/contract/change/variants.js +++ b/pages/api/contract/change/variants.js @@ -1,5 +1,5 @@ // Next.js API route support: https://nextjs.org/docs/api-routes/introduction -import CRMRequest from '../../../../lib/CRMRequest'; +import CRMRequestGet from '../../../../lib/CRMRequestGet'; export default async function handler(req, res) { @@ -7,5 +7,5 @@ export default async function handler(req, res) console.log(req.body.variants); console.log("-".repeat(50)); - await CRMRequest(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/GetAvaliableGraphChangeTypes`, { ...{ contract_number: req.body.number }, ...req.body.variants }); + await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/GetAvaliableGraphChangeTypes`, { ...{ contract_number: req.body.number }, ...req.body.variants }); } \ No newline at end of file diff --git a/pages/components/Company/index.js b/pages/components/Company/index.js index 18e1c3d..874276a 100644 --- a/pages/components/Company/index.js +++ b/pages/components/Company/index.js @@ -42,7 +42,7 @@ class Company extends React.Component return (
-

1 && "arrow" }>{/* className="arrow" */} +

1 ? "arrow" : "" }>{/* className="arrow" */} { company.title }
{company.inn != null && ИНН: { company.inn } } {company.kpp != null && КПП: { company.kpp }} diff --git a/pages/components/Header/NotificationsList/index.js b/pages/components/Header/NotificationsList/index.js index 5f4eca8..7930765 100644 --- a/pages/components/Header/NotificationsList/index.js +++ b/pages/components/Header/NotificationsList/index.js @@ -15,7 +15,7 @@ export default class NotificationsList extends React.Component render() { const { events } = this.props; - console.log("events", events); + console.log("NotificationsList", "events", events); return ( <> diff --git a/pages/components/Header/index.js b/pages/components/Header/index.js index fbc0990..38d6815 100644 --- a/pages/components/Header/index.js +++ b/pages/components/Header/index.js @@ -143,7 +143,7 @@ class Header extends React.Component render() { const { observer, menuOpened, notificationsOpened, messagesOpened, events, events_loaded, appeals } = this.state; - console.log("events", events); + console.log("Header", "events", events); return (

diff --git a/pages/contract/change/components/Options/index.js b/pages/contract/change/components/Options/index.js index 352051d..ab1b2dd 100644 --- a/pages/contract/change/components/Options/index.js +++ b/pages/contract/change/components/Options/index.js @@ -1,19 +1,480 @@ import React from "react"; -import { getContractGraphicChangeOptions } from "../../../../../actions"; +import { SpinnerCircular } from "spinners-react"; +import moment from "moment"; +import pluralize from 'pluralize-ru'; +import numeral from "numeral"; + import DateInput from "../../../../components/DatePicker"; +import { getContractGraphicChangeOptions, getContractGraphicChangeCalculate } from "../../../../../actions"; + +class PaymentDate extends React.Component +{ + constructor(props) + { + super(props); + this.state = { + value: null, + min: null, + max: null, + } + } + + componentDidMount() + { + const { option, onOption } = this.props; + + this.setState({ + value: moment(option.value).toDate(), + min: moment(option.from).toDate(), + max: moment(option.to).toDate(), + }, () => + { + onOption(this.state.value); + }); + } + + _handle_onChange = (value) => + { + const { onOption } = this.props; + + this.setState({ value }, () => + { + onOption(value); + }); + } + + render() + { + const { value, min, max } = this.state; + + return ( +
+ + +
+ ) + } +} + +class FixLastPayment extends React.Component +{ + constructor(props) + { + super(props); + this.state = { + value: false, + }; + } + + componentDidMount() + { + const { option, onOption } = this.props; + + this.setState({ + value: option.value, + }, () => + { + onOption(this.state.value); + }); + } + + _handle_onChange = () => + { + const { onOption } = this.props; + + this.setState({ value: this.state.value ? false : true }, () => + { + onOption(this.state.value); + }); + } + + render() + { + const { value } = this.state; + + return ( +
+ + +
+
+ + + + + +
+
+ {" "} + {/* opened */} +
+

Какой-то описательный текст

+

Закрыть

+
+
+
+
+ ) + } +} + +class DateOffestType extends React.Component +{ + constructor(props) + { + super(props); + this.state = { + value: null, + } + } + + componentDidMount() + { + const { option, onOption } = this.props; + + this.setState({ + value: parseInt(option.value, 10), + }, () => + { + onOption(this.state.value); + }); + } + + _handle_onChange = (value) => + { + const { onOption } = this.props; + + this.setState({ value: parseInt(value, 10) }, () => + { + onOption(this.state.value); + }); + } + + render() + { + const { value } = this.state; + + return ( +
+ +
+ this._handle_onChange(100000001) }/> + +
+
+ this._handle_onChange(100000000) }/> + +
+
+ ) + } +} + +class PeriodSelector extends React.Component +{ + constructor(props) + { + super(props); + this.state = { + value: null, + periods: [], + } + } + + componentDidMount() + { + const { option, onOption } = this.props; + const periods = []; + + if(option.min !== undefined && option.min !== null) + { + for(let i = parseInt(option.min, 10); i <= parseInt(option.max, 10); i++) + { + periods.push(i); + } + + this.setState({ + value: periods[0], periods + }, () => + { + onOption(this.state.value); + }); + } + } + + _handle_onChange = (event) => + { + const { onOption } = this.props; + + this.setState({ value: parseInt(event.target.value, 10) }, () => + { + onOption(this.state.value); + }); + } + + render() + { + const { value, periods } = this.state; + + if(value !== null) + { + return ( +
+ + +
+ ) + } + + return null; + } +} + +class SumSelector extends React.Component +{ + constructor(props) + { + super(props); + this.state = { + value: "", + min: null, + max: null, + } + } + + componentDidMount() + { + const { option, onOption } = this.props; + + this.setState({ + value: option.min, + min: option.min, + max: option.max, + }, () => + { + onOption(this.state.value, false); + }); + } + + _handle_onChange = (event) => + { + const { onOption } = this.props; + const { min, max } = this.state; + + const value = parseFloat(event.target.value.replace('/[^\d]/m', '')); + if(value >= min && value <= max && !isNaN(value)) + { + this.setState({ value: value }, () => + { + onOption(this.state.value, false); + }); + } + else + { + onOption(this.state.value, true); + } + } + + render() + { + const { value, min, max } = this.state; + + return ( +
+ + +
от { numeral(min).format(' ., ') } ₽
+
до { numeral(max).format(' ., ') } ₽
+
+
+ + + + + +
+
+ {" "} + {/* opened */} +
+

Какой-то описательный текст

+

Закрыть

+
+
+
+
+ ) + } +} + +class InsurancePriceSelector extends React.Component +{ + constructor(props) + { + super(props); + this.state = { + value: "", + min: null, + max: null, + } + } + + componentDidMount() + { + const { option, onOption } = this.props; + + this.setState({ + value: option.min, + min: option.min, + max: option.max, + }, () => + { + onOption(this.state.value, false); + }); + } + + _handle_onChange = (event) => + { + const { onOption } = this.props; + const { min, max } = this.state; + + const value = parseFloat(event.target.value.replace('/[^\d]/m', '')); + if(value >= min && value <= max && !isNaN(value)) + { + this.setState({ value: value }, () => + { + onOption(this.state.value, false); + }); + } + else + { + onOption(this.state.value, true); + } + } + + render() + { + const { value, min, max } = this.state; + + return ( +
+ + +
от { numeral(min).format(' ., ') } ₽
+
до { numeral(max).format(' ., ') } ₽
+
+
+ + + + + +
+
+ {" "} + {/* opened */} +
+

Какой-то описательный текст

+

Закрыть

+
+
+
+
+ ) + } +} + +class InsuranceDateFromSelector extends React.Component +{ + constructor(props) + { + super(props); + this.state = { + value: null, + min: null, + max: null, + } + } + + componentDidMount() + { + const { option, onOption } = this.props; + + this.setState({ + value: moment(option.value !== null ? option.value : option.from).toDate(), + min: moment(option.from).toDate(), + max: moment(option.to).toDate(), + }, () => + { + onOption(this.state.value); + }); + } + + _handle_onChange = (value) => + { + const { onOption } = this.props; + + this.setState({ value }, () => + { + onOption(value); + }); + } + + render() + { + const { value, min, max } = this.state; + + return ( +
+ + +
+ ) + } +} + export default class Options extends React.Component { constructor(props) { super(props); this.state = { + loading: true, + sending: false, date: null, car: null, contract_date: null, agreement: null, rules: null, - loading: true, + number_paydate: null, + period_new: null, + fix_last_payment_available: false, + date_offset_type: null, + sum: null, + insurance_price_result: null, + datefrom: null, + errors: {}, }; } @@ -30,12 +491,10 @@ export default class Options extends React.Component } } - console.log("varianst_for_options", varianst_for_options); - getContractGraphicChangeOptions({ dispatch, number, variants: varianst_for_options }) .then(() => { - + this.setState({ loading: false }); }) .catch(() => { @@ -51,95 +510,163 @@ export default class Options extends React.Component _handle_onCalculate = (event) => { + const { sending, number_paydate, period_new, fix_last_payment_available, date_offset_type, sum, insurance_price_result, datefrom, } = this.state; + const { number, options, variants, onCalculate } = this.props; + event.preventDefault(); - this.props.onCalculate(); + console.log(this.props); + + if(!sending) + { + const v = {}; + for(let i in variants.types) { v[ variants.types[i].name ] = variants.types[i].value; } + 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, + } + }; + console.log(payload); + + this.setState({ sending: true, }, () => + { + getContractGraphicChangeCalculate(payload) + .then((calculation) => + { + console.log("calculationcalculationcalculationcalculationcalculation"); + console.log(calculation); + + /* + onCalculate() + .then(() => + { + + }) + .catch(() => + { + this.setState({ sending: false, }); + }); + */ + }) + .catch(() => + { + }); + }); + } + } + + _handle_onPaymentDateChange = (date) => + { + this.setState({ number_paydate: date }); + } + + _handle_onFixLastPaymentChange = (value) => + { + this.setState({ fix_last_payment_available: value }); + } + + _handle_onDateOffsetTypeChange = (value) => + { + this.setState({ date_offset_type: value }); + } + + _handle_onPeriodChange = (value) => + { + this.setState({ period_new: value }); + } + + _handle_onSumChange = (value, error) => + { + const { errors } = this.state; + + if(error) { errors['sum'] = true; } else { delete errors['sum']; } + + this.setState({ sum: value, errors }); + } + + _handle_onInsurancePriceChange = (value, error) => + { + const { errors } = this.state; + + if(error) { errors['insurance_price_result'] = true; } else { delete errors['insurance_price_result']; } + + this.setState({ insurance_price_result: value, errors }); + } + + _handle_onInsuranceDateFromChange = (date) => + { + this.setState({ datefrom: date }); + } + + _checkAllowCalculate = () => + { + const { errors } = this.state; + + for(let i in errors) + { + if(errors[i]) + { + return false; + } + } + + return true; } render() { - const { loading, date, car, contract_date, agreement, rules } = this.state; - const { variants } = this.props; - - console.log("Change", "Options", "render()", "variants", variants); + const { loading, sending, } = this.state; + const { variants, options } = this.props; return (

Параметры опций изменений графика платежей

-
-
- - this.setState({ date_to: date }) } /> + { loading ? ( +
+
-
- - -
-
- - - - - -
-
- {" "} - {/* opened */} -
-

Какой-то описательный текст

-

Закрыть

-
-
+ ) : ( + + { options !== undefined && options !== null && options.number_paydate !== undefined && options.number_paydate !== null && options.number_paydate.visible && ( + + ) } + { options !== undefined && options !== null && options.fix_last_payment_available !== undefined && options.fix_last_payment_available !== null && options.fix_last_payment_available.visible && ( + + ) } + { options !== undefined && options !== null && options.date_offset_type !== undefined && options.date_offset_type !== null && options.date_offset_type.visible && ( + + ) } + { options !== undefined && options !== null && options.period_new !== undefined && options.period_new !== null && options.period_new.visible && ( + + ) } + { options !== undefined && options !== null && options.sum !== undefined && options.sum !== null && options.sum.visible && ( + + ) } + { options !== undefined && options !== null && options.insurance_price_result !== undefined && options.insurance_price_result !== null && options.insurance_price_result.visible && ( + + ) } + { options !== undefined && options !== null && options.datefrom !== undefined && options.datefrom !== null && options.datefrom.visible && ( + + ) } +
+ +
-
-
- -
- - -
-
- - -
-
-
- - -
-
- - -
-
- - - - - -
-
- {" "} - {/* opened */} -
-

Какой-то описательный текст

-

Закрыть

-
-
-
-
-
- - -
- + + ) }
); } diff --git a/pages/contract/change/components/VariantsList/index.js b/pages/contract/change/components/VariantsList/index.js index 3fc5686..544ba1f 100644 --- a/pages/contract/change/components/VariantsList/index.js +++ b/pages/contract/change/components/VariantsList/index.js @@ -66,7 +66,7 @@ export default class VariantsList extends React.Component
-1 ? true : false } onChange={ () => { this._handle_onVariant(variant.type) } }/> + style={ disabled ? { color: "#A8026B", textDecoration: "line-through", } : {} }>{ variant.title }
{ variant.type }
diff --git a/pages/contract/change/index.js b/pages/contract/change/index.js index f0b14d5..411daad 100644 --- a/pages/contract/change/index.js +++ b/pages/contract/change/index.js @@ -93,9 +93,6 @@ class ChangeGraphicPage extends React.Component componentDidMount() { - - - console.log("ChangePage", "MOUNT", "document.location.hash", document.location.hash); if(document.location.hash !== undefined && document.location.hash !== null && document.location.hash !== "") { if (!this.state.loading && this.props.number !== undefined) @@ -149,7 +146,6 @@ class ChangeGraphicPage extends React.Component componentDidUpdate(prevProps, prevState) { - //console.log("ChangePage", "CDM", "document.location.hash", document.location.hash); if(document.location.hash) { } @@ -175,8 +171,6 @@ class ChangeGraphicPage extends React.Component this.setState({ variants_selected: selected, variants_loading: true }, () => { - console.log(this.state.variants_selected); - const { variants_selected, variants_types } = this.state; const variants = {}; @@ -192,9 +186,6 @@ class ChangeGraphicPage extends React.Component } } - console.log("variantsvariantsvariantsvariantsvariants???????????"); - console.log(variants); - getContractGraphicChangeVariants({ dispatch: this.props.dispatch, number: this.props.number, variants }) .then(() => { @@ -240,8 +231,6 @@ class ChangeGraphicPage extends React.Component const { loading, mode_options, mode_comparison, mode_calculation, mode_final, date, car, contract_date, agreement, rules, signer, signatories, calculations, calculation_id, variants, variants_loading, variants_selected, variants_types, variants_unavailable, options, current, calculated, } = this.state; const { number } = this.props; - console.log("render", "signatories", signatories); - return ( @@ -303,6 +292,7 @@ class ChangeGraphicPage extends React.Component dispatch={ this.props.dispatch } number={ number } variants={ variants } + variants_selected={ variants_selected } options={ options } onVariants={ this._handle_onVariants } onCalculate={ this._handle_onCalculate }