import React from "react"; import Head from 'next/head'; import Image from 'next/image'; import { connect } from "react-redux"; import { withRouter } from 'next/router'; import numeral from "numeral"; import moment from "moment"; import { SpinnerCircular } from 'spinners-react'; import { reduxWrapper } from '../../store'; import Header from '../components/Header'; import Footer from '../components/Footer'; import Company from "../components/Company"; import InnerMenu from "./components/InnerMenu"; import { getContractInfo, getContractHelpCard, getContractInsurance, getContractRegistration, getContractTelematic } from './../../actions'; class ContractServicesPage extends React.Component { constructor(props) { super(props); this.state = { opened: [], date: null, car: null, contract_date: null, loading: false, helpcard: null, insurance: null, registration: null, telematic: null, insurance_location_checked: false, }; } static getDerivedStateFromProps(nextProps, prevState) { return { date: nextProps.date, car: nextProps.car, contract_date: nextProps.contract_date, helpcard: nextProps.helpcard, insurance: nextProps.insurance, registration: nextProps.registration, telematic: nextProps.telematic, }; } componentDidMount() { console.log("document.location.hash", document.location.hash); if(!this.state.loading && this.props.number !== undefined) { this.setState({ loading: true }, () => { getContractInfo({ dispatch: this.props.dispatch, number: this.props.number }); Promise.all([ new Promise((resolve) => { getContractHelpCard({ dispatch: this.props.dispatch, number: this.props.number }).then(resolve())}), new Promise((resolve) => { getContractInsurance({ dispatch: this.props.dispatch, number: this.props.number }).then(resolve())}), new Promise((resolve) => { getContractRegistration({ dispatch: this.props.dispatch, number: this.props.number }).then(resolve())}), new Promise((resolve) => { getContractTelematic({ dispatch: this.props.dispatch, number: this.props.number }).then(resolve())}), ]) .then(() => { this.setState({ loading: false }); }); }); } } componentDidUpdate(prevProps, prevState) { if(prevState.insurance === null && this.state.insurance !== null) { if(!this.state.insurance_location_checked) { this.setState({ insurance_location_checked: true }, () => { if(document.location.hash.indexOf("insurance") > -1) { const o = [ ...this.state.opened ]; o.push("insurance"); this.setState({ opened: o }); } }); } } } _handle_onCard = (card) => { const opened = [ ...this.state.opened ]; if(opened.indexOf(card) === -1) { opened.push(card); } else { opened.splice(opened.indexOf(card), 1); } this.setState({ opened: opened }); } render() { const { opened, loading, date, car, contract_date, helpcard, insurance, registration, telematic, } = this.state; const { number } = this.props; console.log("helpcard"); console.log(helpcard); console.log("insurance"); console.log(insurance); console.log("registration"); console.log(registration); console.log("telematic"); console.log(telematic); return ( ЛК Эволюция автолизинга

Договор №{ number }

{ date !== undefined && date !== null && date !== null && (<> от { moment(date).format("DD.MM.YYYY") })}{ car !== undefined && car !== null ? ` - ${ car.brand.name } ${ car.model.name } | ${ car.reg_number !== null ? car.reg_number : 'без рег. номера' } | ${ car.vin_number !== null ? car.vin_number : 'без VIN номера' }` : '' }
{ loading ? (
) : (
-1 ? 'open' : '' }`}>
this._handle_onCard('ratcard') }>

Карта РАТ Карта РАТ

{ helpcard !== undefined && helpcard !== null && helpcard.length > 0 ? ( helpcard.map((entry, index) => ( { entry.card_number !== null ? (

РАТ

  • Номер карты: { entry.card_number }
  • Тип карты: { entry.card_type }
  • Действует до: { moment(entry.date).format("DD.MM.YYYY") }
<> { entry && entry.description && (

") }}/> ) }

) : (

Нет данных

) }
)) ) : (

Нет данных

) }
-1 ? 'open' : '' }`}>
this._handle_onCard('insurance') }>

Страхование Страхование

КАСКО

  • Страховая компания: Согласие
  • Сайт: www.sogl.ru
  • Телефон: 34234324324324
  • Номер полиса: 34234324324324
  • Период действия: 01/01/2020 - 01/01/2025
  • Страховая сумма: 3 400 000,00 ₽ ₽
  • Обращаем Ваше внимание, что пролонгация полиса ОСАГО на второй и последующие периоды осуществляется Лизингополучателем самостоятельно
{ insurance !== undefined && insurance !== null ? ( <> { insurance.kasko !== undefined && insurance.kasko !== null && insurance.kasko !== "" && insurance.kasko.map !== undefined && insurance.kasko.map((entry, index) => (

КАСКО

    { entry.company && (
  • Страховая компания: { entry.company }
  • ) } { entry.site && (
  • Сайт: { entry.site }
  • ) } { entry.phone && (
  • Телефон: { entry.phone }
  • ) } { entry.number && (
  • Номер полиса: { entry.number }
  • ) } { entry.period && (
  • Период действия: { entry.period }
  • ) } { entry.amount && (
  • Страховая сумма: { numeral(entry.amount).format(' ., ') } ₽
  • ) } { entry.period_type === "prolong" && (
  • Обращаем Ваше внимание, что пролонгация полиса КАСКО на второй и последующие периоды осуществляется Лизингополучателем самостоятельно
  • ) }
{ entry.description && (

{ entry.description }

) }
)) } { insurance.osago !== undefined && insurance.osago !== null && insurance.osago !== "" && insurance.osago.map !== undefined && insurance.osago.map((entry, index) => (

ОСАГО

    { entry.company && (
  • Страховая компания: { entry.company }
  • ) } { entry.site && (
  • Сайт: { entry.site }
  • ) } { entry.phone && (
  • Телефон: { entry.phone }
  • ) } { entry.number && (
  • Номер полиса: { entry.number }
  • ) } { entry.period && (
  • Период действия: { entry.period }
  • ) } { entry.amount && (
  • Страховая сумма: { numeral(entry.amount).format(' ., ') } ₽
  • ) }
{ entry.description && (

{ entry.description }

) }
)) } { insurance.nsib !== undefined && insurance.nsib !== null && insurance.nsib !== "" && insurance.nsib.map !== undefined && insurance.nsib.map((entry, index) => (

НСИБ

    { entry.company && (
  • Страховая компания: { entry.company }
  • ) } { entry.site && (
  • Сайт: { entry.site }
  • ) } { entry.phone && (
  • Телефон: { entry.phone }
  • ) } { entry.number && (
  • Номер полиса: { entry.number }
  • ) } { entry.period && (
  • Период действия: { entry.period }
  • ) } { entry.amount && (
  • Страховая сумма: { numeral(entry.amount).format(' ., ') } ₽
  • ) }
{ entry.description && (

{ entry.description }

) }
)) } ) : (

Нет данных

) }
-1 ? 'open' : '' }`}>
this._handle_onCard('registration') }>

Регистрация Регистрация

{ registration !== undefined && registration !== null && registration.length > 0 ? registration.map((entry, index) => (

ГИБДД

    { entry.package && (
  • Пакет услуг: { entry.package }
  • ) } { entry.amount && (
  • Стоимость: { numeral(entry.amount).format(' ., ') } ₽
  • ) }
)) : (

Нет данных

) }
-1 ? 'open' : '' }`}>
this._handle_onCard('telematic') }>

Телематика Телематика

{ telematic !== undefined && telematic !== null && telematic.length > 0 ? telematic.map((entry, index) => (
    { entry.provider && (
  • Поставщик: { entry.provider }
  • ) } { entry.equipment && (
  • Оборудование: { entry.equipment }
  • ) } { entry.amount && (
  • Стоимость: { numeral(entry.amount).format(' ., ') } ₽
  • ) }
)) : (

Нет данных

)} {/*}
  • Сайт: www.telematic.ru
  • Логин: test
  • Пароль: test

Текстовый контент Текстовый контент Текстовый контент Текстовый контент Текстовый контент Текстовый контент Текстовый контент Текстовый контент Текстовый контент Текстовый контент Текстовый контент Текстовый контент Текстовый контент Текстовый контент Текстовый контент Текстовый контент Текстовый контент Текстовый контент Текстовый контент

{*/}
) }