229 lines
6.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 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,
getContractAgreement,
getContractRules,
getFile,
} from "../../actions";
class ContractPage extends React.Component
{
constructor(props)
{
super(props);
this.state = {
date: null,
car: null,
contract_date: null,
agreement: null,
rules: null,
loading: false,
search: "",
};
}
static getDerivedStateFromProps(nextProps, prevState)
{
return {
date: nextProps.date,
car: nextProps.car,
contract_date: nextProps.contract_date,
agreement: nextProps.agreement,
rules: nextProps.rules,
};
}
componentDidMount()
{
if (!this.state.loading && this.props.number !== undefined)
{
this.setState({ loading: true }, () => {
getContractInfo({
dispatch: this.props.dispatch,
number: this.props.number,
})
.then((info) =>
{
console.log("info", info);
getContractRules({
dispatch: this.props.dispatch,
date: moment(info.date, "YYYY-MM-DD").format("DD.MM.YYYY"),
})
.then(() => {})
.catch(() => {});
})
.catch(() => {});
getContractAgreement({
dispatch: this.props.dispatch,
number: this.props.number,
})
.then(() => {
this.setState({ loading: false });
})
.catch(() => {});
});
}
}
render()
{
const { loading, date, car, contract_date, agreement, rules, search } = this.state;
const { number } = this.props;
return (
<React.Fragment>
<Head>
<title>ЛК Эволюция автолизинга</title>
<meta name="description" content="ЛК Эволюция автолизинга" />
</Head>
<Header { ...this.props } />
<main>
<section>
<div className="clear"></div>
<div className="container">
<div className="title_wrapper">
<div className="left" style={{ flexDirection: "column" }}>
<h1 className="section_title">Обращения</h1>
</div>
<Company />
</div>
<div className="aside_container about">
<InnerMenu { ...this.props } />
<article>
<div className="contract_search">
<form
onSubmit={(event) => {
event.preventDefault();
}}
>
<div className="form_field full">
<input type="search" value={ search } placeholder="Поиск" onChange={(event) => { this._handle_onChange_search(event.target.value);} }
/>
</div>
<button className="button" disabled={ search !== "" ? false : true } onClick={ this._handle_onSearch }>
Поиск
</button>
</form>
</div>
<div className="list faq-list">
<div className="faq_item">
<p className="item_title">Изменение графика платежей</p>
<div className="dropdown_blocks_list">
<div className="dropdown_block">
<div className="block_header">
<p>
Как изменить график платежей по договору лизинга?
</p>
<button></button>
</div>
<div className="block_body">
<p>Lorem</p>
</div>
</div>
</div>
</div>
<div className="faq_item">
<p className="item_title">Переуступка прав</p>
<div className="dropdown_blocks_list">
<div className="dropdown_block">
<div className="block_header">
<p>Как получить консультацию по Цессии?</p>
<button></button>
</div>
<div className="block_body">
<p>Lorem</p>
</div>
</div>
<div className="dropdown_block">
<div className="block_header">
<p>
Оформление переуступки прав и обязательств по
договору лизинга
</p>
<button></button>
</div>
<div className="block_body">
<p>Lorem</p>
</div>
</div>
</div>
</div>
<div className="faq_item">
<p className="item_title">
Досрочное прекращение срока действия договора лизинга
</p>
<div className="dropdown_blocks_list">
<div className="dropdown_block">
<div className="block_header">
<p>
Процедура досрочного прекращения срока действия
договора лизинга
</p>
<button></button>
</div>
<div className="block_body">
<p>Lorem</p>
</div>
</div>
</div>
</div>
</div>
{/* Результат поиска */}
<div className="search_list">
<div className="search_item">
<p className="item_title">Изменение графика платежей / Как изменить график платежей по договору лизинга?</p>
<p>К каждой теме свободное <mark>html поле для миниинструкции</mark> (со ссылками на формы документов и документы). Привязка к теме обращения в CRM</p>
</div>
</div>
</article>
</div>
</div>
</section>
</main>
<Footer />
</React.Fragment>
);
}
}
function mapStateToProps(state, ownProps)
{
return {
contract_date: state.contract.date,
date: state.contract.date,
car: state.contract.car,
agreement: state.contract.agreement,
rules: state.contract.rules,
};
}
export const getServerSideProps = reduxWrapper.getServerSideProps(
(store) =>
async ({ req, res, query }) => {
return {
props: {
//number: query.number,
number: null,
},
};
}
);
export default withRouter(connect(mapStateToProps)(ContractPage));