import React from "react"; import * as ReactDOM from 'react-dom'; 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 { getSupportThemes, getContractsList, } from "../../actions"; class SupportRequestPage extends React.Component { constructor(props) { super(props); this.state = { loading: false, contracts: null, themes: null, name: "", phone: "", email: "", question: "", file: null, opened_theme: 0, opened_question: 0, }; } static getDerivedStateFromProps(nextProps, prevState) { return { contracts: nextProps.contracts, themes: nextProps.themes, }; } componentDidMount() { console.log("CDM", "SupportRequestPage", this.state); ReactDOM.findDOMNode(this).parentNode.style.height = "100%"; ReactDOM.findDOMNode(this).parentNode.style.display = "flex"; ReactDOM.findDOMNode(this).parentNode.style.flexDirection = "column"; ReactDOM.findDOMNode(this).parentNode.style.justifyContent = "spaceBetween"; ReactDOM.findDOMNode(this).parentNode.style.alignItems = "stretch"; document.documentElement.style.height = "100%"; document.documentElement.style.display = "flex"; document.documentElement.style.flexDirection = "column"; document.body.style.height = "100%"; document.body.style.display = "flex"; document.body.style.flexDirection = "column"; if (!this.state.loading) { this.setState({ loading: true }, () => { Promise.all([ getContractsList({ dispatch: this.props.dispatch, all: true }), getSupportThemes({ dispatch: this.props.dispatch }) ]) .then(() => { this.setState({ loading: false }); }) .catch(() => {}); }); } } componentWillUnmount() { ReactDOM.findDOMNode(this).parentNode.style.height = "unset"; ReactDOM.findDOMNode(this).parentNode.style.display = "unset"; ReactDOM.findDOMNode(this).parentNode.style.flexDirection = "unset"; ReactDOM.findDOMNode(this).parentNode.style.justifyContent = "unset"; ReactDOM.findDOMNode(this).parentNode.style.alignItems = "unset"; document.documentElement.style.height = "unset"; document.documentElement.style.display = "unset"; document.documentElement.style.flexDirection = "unset"; document.body.style.height = "unset"; document.body.style.display = "unset"; document.body.style.flexDirection = "unset"; } componentDidUpdate(prevProps, prevState) { } _handle_onBack = () => { this.props.router.push('/support/faq/'); } _handle_onChangeTheme = (index) => { this.setState({ opened_theme: index, opened_question: 0 }); } _handle_onSelectContracts = (event) => { } _renderForm = () => { const { loading, contracts, themes, name, phone, email, question, file, opened_theme, opened_question } = this.state; return (

Перенесите файлы на экран для быстрой загрузки или выберите файл с компьютера

) } render() { const { number } = this.props; const { loading, themes, opened_theme, opened_question } = this.state; const procedure = themes !== undefined && themes !== null ? themes[opened_theme].questions[opened_question] : undefined; return ( ЛК Эволюция автолизинга

Новое обращение

{ themes !== undefined && themes !== null && themes.map((theme, theme_index) => (
this._handle_onChangeTheme(theme_index) }>

{ theme.name }

{ theme_index === opened_theme && theme.questions.map((question, question_index) => (
this.setState({ opened_question: question_index }) }>

{ question.title }

) )}
)) }
{ themes !== undefined && themes !== null && (

Процедура

{ procedure.documents !== null && (

Документы

) } { procedure.templates !== null && (

Документы

{ procedure.templates.map((template, index) => (

{ template.filename }Скачать шаблон

)) }
) } { this._renderForm() }
) }