import React from "react"; import Head from 'next/head'; import Link from "next/link"; import Image from 'next/image'; import { connect } from "react-redux"; import { withRouter } from 'next/router'; import { SpinnerCircular } from 'spinners-react'; import moment from "moment"; import { reduxWrapper } from '../../store'; import Header from '../components/Header'; import Footer from '../components/Footer'; import InnerMenu from "./components/InnerMenu"; import Company from "../components/Company"; import { getContractsList } from '../../actions'; class FinalsPage extends React.Component { constructor(props) { super(props); this.state = { loading: false, contracts: null, search: "", } } static getDerivedStateFromProps(nextProps, prevState) { return { contracts: nextProps.contracts, }; } componentDidMount() { this.setState({ loading: true }, () => { getContractsList({ dispatch: this.props.dispatch, all: true }).then(() => { this.setState({ loading: false }); }).catch(() => {}); }); } _handle_onChange_search = (value) => { if(this.state.value !== "" && value === "") { this.setState({ search: value }, () => { this._handle_onSearch(); }); } else { this.setState({ search: value }); } } _handle_onSearch = () => { const { search, } = this.state; this.setState({ loading: true, }, () => { getContractsList({ dispatch: this.props.dispatch, search, all: true}).then(() => { this.setState({ loading: false }); }).catch(() => {}); }); } render() { const { loading, search, contracts, } = this.state; return ( ЛК Эволюция автолизинга

Закрывающие документы

{ event.preventDefault(); } }>
{ this._handle_onChange_search(event.target.value); } }/>
{ loading ? (
) : (
0 ? {} : { display: "flex", justifyContent: "center" }}> { contracts !== undefined && contracts !== null && ( <> { contracts.length > 0 ? contracts.map((contract, index) => (

Договор { contract.number } от { moment(contract.date).format("DD.MM.YYYY") } { contract.car.brand.name } { contract.car.model.name } | { contract.car.reg_number !== undefined && contract.car.reg_number !== null ? contract.car.reg_number : "без рег. номера" } | { contract.car.vin_number }

)) : (

Нет договоров для отображения

) } ) }
) }