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, setAppealsRead, } from "../../actions"; class SupportAppealsPage extends React.Component { constructor(props) { super(props); this.state = { appeals: null, loading: false, }; } static getDerivedStateFromProps(nextProps, prevState) { return { appeals: nextProps.appeals, }; } componentDidMount() { setTimeout(() => { const appeals = []; if(this.state.appeals !== undefined && this.state.appeals !== null && this.state.appeals.list !== undefined && this.state.appeals.list !== null) { for(let i in this.state.appeals.list) { if(this.state.appeals.list[i].read !== true) { appeals.push({ number: this.state.appeals.list[i].number, status: this.state.appeals.list[i].status }); } } } console.log("appeals"); console.log(appeals); setAppealsRead({ dispatch: this.props.dispatch, appeals }); }, 1000); } componentWillUnmount() { } render() { const { number } = this.props; const { loading, appeals } = this.state; const status = { active: { title: "Активное", color: "#04A8A4" }, closed: { title: "Закрыто", color: "#000", }, cancelled: { title: "Отменено", color: "#A8026B", } }; console.log(appeals); return ( ЛК Эволюция автолизинга

Мои обращения

{ appeals !== undefined && appeals !== null && appeals.list !== undefined && appeals.list !== null && ( <> { appeals.list.length > 0 ? ( <> { appeals.list.map((appeal, index) => (

Номер обращения: { appeal.number } от { moment(appeal.created_date, "YYYY-MM-DD").format("DD.MM.YYYY") }

Отвественный сотрудник ОРК: { appeal.owner }

{ appeal.contracts.length > 0 && (

Договор{ appeal.contracts.length > 1 && "ы" }: { appeal.contracts.map((contract, contract_index) => (№ { contract }{ contract_index < appeal.contracts.length - 1 && ", " })) }

) }
{ status[appeal.status].title }

Тема запроса

{ appeal.subject }

Ответ ОРК

{ appeal.answer === "" ? "Без ответа" : appeal.answer }

{ appeal.documents.length > 0 && (
{ appeal.documents.map((document, document_index) => (

{ document.doc_name } Скачать документ

)) }
) }
)) } ) : (

У Вас пока нет обращений.

) } )} {/*}

Номер обращения: 123 от 13.04.2022

Отвественный ОРК: Иванов И.И.

Договор: №2021_1655, №2021_1655

Активное

Тема запроса

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

Текст ответа ОРК

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

Номер обращения: 123 от 13.04.2022

Отвественный ОРК: Иванов И.И.

Договор: №2021_1655, №2021_1655

Тема запроса

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

Текст ответа ОРК

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

№2021_1655 от 20.04.2021 2021_1655 от 20.04.2021

№2021_1655 от 20.04.2021 2021_1655 от 20.04.2021

{*/}