admin panel updates, contract debt & penalty files download

This commit is contained in:
merelendor 2022-08-16 08:42:29 +03:00
parent 62fd2cef9a
commit 084699b05b
23 changed files with 6722 additions and 105 deletions

View File

@ -211,42 +211,23 @@ export const sendOffstageToken = ({ token, dispatch }) =>
});
}
export const sendSwitchAccount = ({ dispatch, acc_number }) =>
export const getUsers = ({ dispatch }) =>
{
console.log("ACTION", "sendSwitchAccount()", `${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/auth/switch/`);
console.log("ACTION", "getUsers()");
return new Promise((resolve, reject) =>
{
axios.post(`${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/auth/switch/`, { acc_number })
.then((response) =>
axios.post(`${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/auth/admin/`, {})
.then(async (response) =>
{
console.log("sendSwitchAccount RESPONSE");
console.log(response.data);
console.log("getContractRules", "response.data", response.data);
dispatch({ type: actionTypes.ADMIN, data: { users: response.data.users } });
if(response.data.status === "success")
{
const cookies = new Cookies();
cookies.set('jwt', response.data.token, new Date(moment().add(7, 'day').toDate()));
getCompanyInfo({ dispatch })
.then(() =>
{
resolve();
Router.push('/');
})
.catch(() =>
{
reject();
});
}
else
{
reject();
}
})
.catch((error) =>
{
console.error("sendSwitchAccount", "error");
console.error("ACTION", "getUsers()", "error");
console.error(error);
reject();

View File

@ -39,7 +39,15 @@ export const getContract = ({ dispatch, number, }) =>
console.log("response.data");
console.log(response.data);
dispatch({ type: actionTypes.CONTRACT_PAYMENTS, data: { payments: response.data.payments, avans: response.data.avans } });
dispatch({
type: actionTypes.CONTRACT_PAYMENTS,
data: {
payments: response.data.payments,
avans: response.data.avans,
debt: response.data.paymentDebt,
penalty: response.data.penyDebt
}
});
resolve();
})

View File

@ -154,7 +154,8 @@ export const getReconciliationFile = ({ contract, date_from, date_to, filename }
})
.then((response) =>
{
fileDownload(response.data, filename);
console.log(response.data);
//fileDownload(response.data, filename);
resolve();
})
.catch((error) =>
@ -207,3 +208,53 @@ export const getBitrixFile = ({ url, filename }) =>
*/
});
}
export const getContractDebtInvoiceFile = ({ contract }) =>
{
console.log("ACTION", "getContractDebtInvoiceFile", { contract });
return new Promise((resolve, reject) =>
{
axios.get(`${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/file/contract/debt`, {
params: { contract },
responseType: 'blob',
})
.then((response) =>
{
fileDownload(response.data, `evoleasing_${ contract }_invoice_debt_${ moment().format("YYYY_MM_DD") }.pdf`);
resolve();
})
.catch((error) =>
{
console.error("getContractDebtInvoiceFile", "error");
console.error(error);
reject();
});
});
}
export const getContractPenaltyInvoiceFile = ({ contract }) =>
{
console.log("ACTION", "getContractPenaltyInvoiceFile", { contract });
return new Promise((resolve, reject) =>
{
axios.get(`${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/file/contract/penalty`, {
params: { contract },
responseType: 'blob',
})
.then((response) =>
{
fileDownload(response.data, `evoleasing_${ contract }_invoice_penalty_${ moment().format("YYYY_MM_DD") }.pdf`);
resolve();
})
.catch((error) =>
{
console.error("getContractPenaltyInvoiceFile", "error");
console.error(error);
reject();
});
});
}

View File

@ -2,6 +2,7 @@ export const AUTH = 'AUTH';
export const USER = 'USER';
export const COMPANY = 'COMPANY';
export const COMPANIES = 'COMPANIES';
export const ADMIN = 'ADMIN';
export const CONTRACTS = 'CONTRACTS';
export const CONTRACT = 'CONTRACT';
export const CONTRACT_PAYMENTS = 'CONTRACT_PAYMENTS';

View File

@ -1 +1,130 @@
footer{background:#EDEFF5;padding:45px 0;box-sizing:border-box}@media all and (max-width:1600px) and (min-width:1280px){footer{padding:25px 0}}@media all and (max-width:768px){footer{margin-top:40px;pading:25px 0}}footer .container{display:flex;justify-content:space-between;align-items:flex-start;background:transparent}@media all and (max-width:1279px){footer .container{padding:0;flex-wrap:wrap}}footer .column{width:270px;box-sizing:border-box}@media all and (max-width:1279px){footer .column{width:33.333%}footer .column:last-child{width:100%;display:flex;flex-wrap:wrap}footer .column:last-child>div,footer .column:last-child>p{width:33.333%;margin-top:35px;padding-right:30px;box-sizing:border-box;margin-bottom:0 !important}}@media all and (max-width:768px){footer .column{width:100%;margin-bottom:16px}footer .column:last-child>div,footer .column:last-child>p{width:100%;margin-top:15px;padding-right:0}}footer .column:not(:last-child){padding-right:15px}footer .column li:not(:last-child){margin-bottom:13px}@media all and (max-width:768px){footer .column li:not(:last-child){margin-bottom:8px}}footer .column li a{color:#000}footer .column p{color:#8E94A7;line-height:32px}footer .column a[href^="tel"]{display:inline-block;font-size:16px;line-height:32px;color:#000;padding-left:40px;background:url("/assets/images/icons/icon-phone.svg") no-repeat left center}@media all and (max-width:1600px){footer .column a[href^="tel"]{font-size:13px;background-size:24px;padding-left:37px}}footer .column a[href^="mailto"]{display:inline-block;font-size:16px;line-height:24px;color:#000;padding-left:40px;background:url("/assets/images/icons/icon-mail.svg") no-repeat left center}@media all and (max-width:1600px){footer .column a[href^="mailto"]{font-size:13px;background-size:24px;padding-left:37px}}footer .column div:nth-child(1),footer .column div:nth-child(2),footer .column div.socials{margin-bottom:40px}@media all and (max-width:1600px) and (min-width:1280px){footer .column div:nth-child(1),footer .column div:nth-child(2),footer .column div.socials{margin-bottom:20px}}footer .column div a{line-height:32px}@media all and (max-width:1279px){footer .column div a{line-height:1.45}}/*# sourceMappingURL=./style.css.map */
footer {
background: #EDEFF5;
padding: 45px 0;
box-sizing: border-box;
}
@media all and (max-width: 1600px) and (min-width: 1280px) {
footer {
padding: 25px 0;
}
}
@media all and (max-width: 768px) {
footer {
margin-top: 40px;
pading: 25px 0;
}
}
footer .container {
display: flex;
justify-content: space-between;
align-items: flex-start;
background: transparent;
}
@media all and (max-width: 1279px) {
footer .container {
padding: 0;
flex-wrap: wrap;
}
}
footer .column {
width: 270px;
box-sizing: border-box;
}
@media all and (max-width: 1279px) {
footer .column {
width: 33.333%;
}
footer .column:last-child {
width: 100%;
display: flex;
flex-wrap: wrap;
}
footer .column:last-child > div,
footer .column:last-child > p {
width: 33.333%;
margin-top: 35px;
padding-right: 30px;
box-sizing: border-box;
margin-bottom: 0 !important;
}
}
@media all and (max-width: 768px) {
footer .column {
width: 100%;
margin-bottom: 16px;
}
footer .column:last-child > div,
footer .column:last-child > p {
width: 100%;
margin-top: 15px;
padding-right: 0;
}
}
footer .column:not(:last-child) {
padding-right: 15px;
}
footer .column li:not(:last-child) {
margin-bottom: 13px;
}
@media all and (max-width: 768px) {
footer .column li:not(:last-child) {
margin-bottom: 8px;
}
}
footer .column li a {
color: #000;
}
footer .column p {
color: #8E94A7;
line-height: 32px;
}
footer .column a[href^="tel"] {
display: inline-block;
font-size: 16px;
line-height: 32px;
color: #000;
padding-left: 40px;
background: url("/assets/images/icons/icon-phone.svg") no-repeat left center;
}
@media all and (max-width: 1600px) {
footer .column a[href^="tel"] {
font-size: 13px;
background-size: 24px;
padding-left: 37px;
}
}
footer .column a[href^="mailto"] {
display: inline-block;
font-size: 16px;
line-height: 24px;
color: #000;
padding-left: 40px;
background: url("/assets/images/icons/icon-mail.svg") no-repeat left center;
}
@media all and (max-width: 1600px) {
footer .column a[href^="mailto"] {
font-size: 13px;
background-size: 24px;
padding-left: 37px;
}
}
footer .column div:nth-child(1),
footer .column div:nth-child(2),
footer .column div.socials {
margin-bottom: 40px;
}
@media all and (max-width: 1600px) and (min-width: 1280px) {
footer .column div:nth-child(1),
footer .column div:nth-child(2),
footer .column div.socials {
margin-bottom: 20px;
}
}
footer .column div a {
line-height: 32px;
}
@media all and (max-width: 1279px) {
footer .column div a {
line-height: 1.45;
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

55
pages/api/auth/admin.js Normal file
View File

@ -0,0 +1,55 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import axios from 'axios';
import { Cookies } from 'react-cookie';
import cookie from 'cookie';
import moment from 'moment';
import jwt from 'jsonwebtoken';
import { inspect } from 'util';
import { cors } from '../../../lib/cors';
export default async function handler(req, res)
{
await cors(req, res);
let { acc_number } = req.body;
console.log("API", "auth/admin");
if(req.headers.cookie !== undefined)
{
const cookies = cookie.parse(req.headers?.cookie ? req.headers?.cookie : "");
if(cookies.jwt !== undefined && cookies.jwt !== null)
{
let allow = false;
let company = {};
let client_jwt_decoded = jwt.verify(cookies.jwt, process.env.JWT_SECRET_CLIENT);
await axios.post(`${ process.env.NEXT_PUBLIC_API_HOST }/api/admin/users/`, {
token: jwt.sign({ "acc_number": client_jwt_decoded.acc_number, }, process.env.JWT_SECRET_CRM, { noTimestamp: true }),
})
.then((api_response) =>
{
console.log("API", "auth/admin", "RESPONSE");
//console.log(inspect(api_response.data, true, null, true));
res.status(200).send(api_response.data);
})
.catch((error) =>
{
console.error("API", "auth/admin", "error");
console.error(error);
res.status(403).json();
});
}
else
{
res.status(403).json();
}
}
else
{
res.status(403).json();
}
}

View File

@ -0,0 +1,54 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import axios from 'axios';
import { Cookies } from 'react-cookie';
import cookie from 'cookie';
import moment from 'moment';
import jwt from 'jsonwebtoken';
import { cors } from '../../../../lib/cors';
export default async function handler(req, res)
{
await cors(req, res);
if(req.headers.cookie !== undefined)
{
const cookies = cookie.parse(req.headers?.cookie ? req.headers?.cookie : "");
if(cookies.jwt !== undefined && cookies.jwt !== null)
{
var client_jwt_decoded = jwt.verify(cookies.jwt, process.env.JWT_SECRET_CLIENT);
var crm_jwt = jwt.sign(client_jwt_decoded, process.env.JWT_SECRET_CRM, { noTimestamp: true });
try
{
axios.get(`${ process.env.CRM_API_HOST }/lk/Contract/GetDebtBill/`, {
params: { ...client_jwt_decoded, contract_number: req.query.contract, },
responseType: 'blob',
headers: {
"Authorization": `Bearer ${ crm_jwt }`,
}
})
.then((crm_response) =>
{
console.log("API", "/file/contract/debt", "crm_response.data");
console.log(crm_response.data);
res.status(200).send(Buffer.from(crm_response.data, 'base64'));
})
.catch((error) =>
{
console.error(error);
res.status(500);
});
}
catch(e)
{
console.error(e);
res.status(500);
}
}
else
{
res.status(403);
}
}
}

View File

@ -0,0 +1,54 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import axios from 'axios';
import { Cookies } from 'react-cookie';
import cookie from 'cookie';
import moment from 'moment';
import jwt from 'jsonwebtoken';
import { cors } from '../../../../lib/cors';
export default async function handler(req, res)
{
await cors(req, res);
if(req.headers.cookie !== undefined)
{
const cookies = cookie.parse(req.headers?.cookie ? req.headers?.cookie : "");
if(cookies.jwt !== undefined && cookies.jwt !== null)
{
var client_jwt_decoded = jwt.verify(cookies.jwt, process.env.JWT_SECRET_CLIENT);
var crm_jwt = jwt.sign(client_jwt_decoded, process.env.JWT_SECRET_CRM, { noTimestamp: true });
try
{
axios.get(`${ process.env.CRM_API_HOST }/lk/Contract/GetFineBill/`, {
params: { ...client_jwt_decoded, contract_number: req.query.contract, },
responseType: 'blob',
headers: {
"Authorization": `Bearer ${ crm_jwt }`,
}
})
.then((crm_response) =>
{
console.log("API", "/file/contract/penalty", "crm_response.data");
console.log(crm_response.data);
res.status(200).send(Buffer.from(crm_response.data, 'base64'));
})
.catch((error) =>
{
console.error(error);
res.status(500);
});
}
catch(e)
{
console.error(e);
res.status(500);
}
}
else
{
res.status(403);
}
}
}

View File

@ -1,6 +1,6 @@
import React from "react";
import { connect } from "react-redux";
import { sendSwitchAccount } from "../../../actions";
//import { switchAccount } from "../../../actions";
class Company extends React.Component
{

View File

@ -3,7 +3,7 @@ import moment from "moment";
import DateInput from "../../../components/DatePicker";
export default class FinesCalculatorForm extends React.Component
export default class PenaltiesCalculatorForm extends React.Component
{
constructor(props)
{

View File

@ -22,7 +22,7 @@ import DateInput from "../components/DatePicker";
import DownloadPrintFormPdfButton from "../components/DownloadPrintFormPdfButton";
import DownloadFinesPdfButton from "../components/DownloadFinesPdfButton";
import FinesCalculatorForm from "./components/FinesCalculatorForm";
import PenaltiesCalculatorForm from "./components/PenaltiesCalculatorForm";
import {
getContractInfo,
@ -595,7 +595,7 @@ class ContractDocumentsPage extends React.Component
</>
) : null}
{ documents !== undefined && documents !== null && documents.billfines !== undefined && documents.billfines !== null && documents.billfines.length > 0 && (
<FinesCalculatorForm onPenalties={ this._handle_onPenaltiesShow }/>
<PenaltiesCalculatorForm onPenalties={ this._handle_onPenaltiesShow }/>
) }
</div>
</>

View File

@ -14,7 +14,7 @@ import Footer from '../components/Footer';
import Company from "../components/Company";
import InnerMenu from "./components/InnerMenu";
import { getContract, getContractInfo } from './../../actions';
import { getContract, getContractDebtInvoiceFile, getContractInfo, getContractPenaltyInvoiceFile } from './../../actions';
class ContractSchedulePage extends React.Component
{
@ -25,10 +25,14 @@ class ContractSchedulePage extends React.Component
loading: false,
payments: null,
avans: null,
debt: null,
penalty: null,
date: null,
car: null,
full: false,
opened: [],
debt_invoice_file_loading: false,
penalty_invoice_file_loading: false,
}
}
@ -39,6 +43,8 @@ class ContractSchedulePage extends React.Component
car: nextProps.car,
payments: nextProps.payments,
avans: nextProps.avans,
debt: nextProps.debt,
penalty: nextProps.penalty,
};
}
@ -90,9 +96,59 @@ class ContractSchedulePage extends React.Component
this.setState({ opened: opened });
}
_handle_onDownloadDebtFile = () =>
{
const { number } = this.props;
if(!this.state.debt_invoice_file_loading)
{
this.setState({ debt_invoice_file_loading: true }, () =>
{
getContractDebtInvoiceFile({ contract: number })
.then(() =>
{
this.setState({ debt_invoice_file_loading: false });
})
.catch(() =>
{
this.setState({ debt_invoice_file_loading: false });
});
});
}
}
_handle_onDownloadPenaltyFile = () =>
{
const { number } = this.props;
if(!this.state.penalty_invoice_file_loading)
{
this.setState({ penalty_invoice_file_loading: true }, () =>
{
/*
getContractPenaltyInvoiceFile({ contract: number })
.then(() =>
{
this.setState({ penalty_invoice_file_loading: false });
})
.catch(() =>
{
this.setState({ penalty_invoice_file_loading: false });
});
*/
});
}
}
_handle_onCalculatePenalty = () =>
{
const { number } = this.props;
this.props.router.push(`/contract/${ number }/documents`);
}
render()
{
const { payments, avans, date, car, full, opened, loading } = this.state;
const { payments, avans, debt, penalty, date, car, full, opened, loading, debt_invoice_file_loading, penalty_invoice_file_loading } = this.state;
const { number } = this.props;
console.log(".".repeat(50));
@ -147,15 +203,31 @@ class ContractSchedulePage extends React.Component
) }
{/* Вариант 1 */}
<div className="payments_actions">
<div style={{ border: "solid 1px red" }}>
<p>Счёт на основной долг 1: 000 </p>
<button className="button button-blue">Скачать счет</button>
{ parseInt(debt, 10) > 0 && (
<div>
<p>Счёт на основной долг: { numeral(debt).format(' ., ') }&nbsp;</p>
<button className="button button-blue" onClick={ this._handle_onDownloadDebtFile } style={{ minWidth: 113 }}>
{ debt_invoice_file_loading ? (
<SpinnerCircular size={24} thickness={100} speed={100} color="rgba(255, 255, 255, 1)" secondaryColor="rgba(255, 255, 255, 0.5)" style={{ marginTop: "0px" }}/>
) :
("Скачать счет")
}
</button>
</div>
<div style={{ border: "solid 1px red" }}>
<p><span>Пени:</span> 000 </p>
<button className="button button-blue">Скачать счет</button>
<button className="button button-blue">Рассчитать пени</button>
) }
{ parseInt(penalty, 10) > 0 && (
<div>
<p><span>Пени:</span> { numeral(penalty).format(' ., ') }&nbsp;</p>
<button className="button button-blue" onClick={ this._handle_onDownloadPenaltyFile } style={{ minWidth: 113 }}>
{ penalty_invoice_file_loading ? (
<SpinnerCircular size={24} thickness={100} speed={100} color="rgba(255, 255, 255, 1)" secondaryColor="rgba(255, 255, 255, 0.5)" style={{ marginTop: "0px" }}/>
) :
("Скачать счет")
}
</button>
<button className="button button-blue" onClick={ this._handle_onCalculatePenalty }>Рассчитать пени</button>
</div>
) }
</div>
<div className="contract_table schedule">
<div className="table_row table_header">
@ -271,6 +343,8 @@ function mapStateToProps(state, ownProps)
company: state.company,
payments: state.contract.payments,
avans: state.contract.avans,
debt: state.contract.debt,
penalty: state.contract.penalty,
date: state.contract.date,
car: state.contract.car,
//schedule: state.payments,

View File

@ -18,7 +18,7 @@ import Footer from '../components/Footer';
import Pagination from '../components/Pagination';
import Company from "../components/Company";
import { sendPhoneChangeNumber, sendPhoneChangeNumberSmsCode, setUserPhone } from '../../actions';
import { getUsers, sendPhoneChangeNumber, sendPhoneChangeNumberSmsCode, setUserPhone } from '../../actions';
class IndexPage extends React.Component
{
@ -27,6 +27,8 @@ class IndexPage extends React.Component
super(props);
this.state = {
user: {},
loading: false,
users: null,
};
}
@ -34,6 +36,7 @@ class IndexPage extends React.Component
{
return {
user: nextProps.user,
users: nextProps.users,
};
}
@ -51,6 +54,19 @@ class IndexPage extends React.Component
document.body.style.height = "100%";
document.body.style.display = "flex";
document.body.style.flexDirection = "column";
this.setState({ loading: true }, () =>
{
getUsers({ dispatch: this.props.dispatch })
.then(() =>
{
this.setState({ loading: false, })
})
.catch(() =>
{
});
});
}
componentWillUnmount()
@ -71,7 +87,7 @@ class IndexPage extends React.Component
render()
{
const { user } = this.state;
const { user, users } = this.state;
return (
<React.Fragment>
@ -112,6 +128,45 @@ class IndexPage extends React.Component
<div className="table_cell">Статус</div>
<div className="table_cell"></div>
</div>
{ users !== undefined && users !== null && users.map((entry, index) =>
{
if(entry.email === user.email)
{
return (
<div className="table_row" key={ index }>
<div className="table_cell" data-title="ФИО пользователя">{ entry.name }</div>
<div className="table_cell" data-title="Почта">{ user.email }</div>
<div className="table_cell" data-title="Роль">Администратор</div>
<div className="table_cell" data-title="Доступные организации">Все организации</div>
<div className="table_cell" data-title="Статус">Активен</div>
<div className="table_cell delete" style={{ position: 'relative' }}>
</div>
</div>
)
}
return null;
}) }
{ users !== undefined && users !== null && users.map((entry, index) =>
{
if(entry.email !== user.email)
{
return (
<div className="table_row" key={ index }>
<div className="table_cell" data-title="ФИО пользователя">{ entry.name }</div>
<div className="table_cell" data-title="Почта">{ user.email }</div>
<div className="table_cell" data-title="Роль">Администратор</div>
<div className="table_cell" data-title="Доступные организации">{ entry.companies.map((company, cindex) => (
<p>{ company.title }</p>
)) }</div>
<div className="table_cell" data-title="Статус">Активен</div>
<div className="table_cell delete" style={{ position: 'relative' }}>
</div>
</div>
)
}
return null;
}) }
{/*}
{ user !== undefined && user !== null && user.email !== undefined && user.email !== null && (
<div className="table_row">
<div className="table_cell" data-title="ФИО пользователя">{ `${ user.lastname } ${ user.name } ${ user.secondname }` }</div>
@ -123,6 +178,7 @@ class IndexPage extends React.Component
</div>
</div>
) }
{*/}
{/*}
<div className="table_row">
<div className="table_cell" data-title="ФИО пользователя">Иванов Иван Иванович</div>
@ -189,6 +245,7 @@ function mapStateToProps(state, ownProps)
{
return {
user: state.user,
users: state.admin.users,
}
}

View File

@ -42,19 +42,6 @@ class SupportAppealsPage extends React.Component
componentDidMount()
{
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";
setTimeout(() =>
{
const appeals = [];
@ -78,18 +65,6 @@ class SupportAppealsPage extends React.Component
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";
}
render()
@ -112,7 +87,7 @@ class SupportAppealsPage extends React.Component
<meta name="description" content="ЛК Эволюция автолизинга" />
</Head>
<Header { ...this.props } />
<main style={{ flex: 1, display: "flex", flexDirection: "column" }}>
<main>
<section>
<div className="clear"></div>
<div className="container">

View File

@ -46,19 +46,6 @@ class ContractPage extends React.Component
componentDidMount()
{
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 }, () =>
@ -75,18 +62,6 @@ class ContractPage extends React.Component
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";
}
_handle_onQuestion = (question) =>
@ -122,7 +97,7 @@ class ContractPage extends React.Component
<meta name="description" content="ЛК Эволюция автолизинга" />
</Head>
<Header { ...this.props } />
<main style={{ flex: 1, display: "flex", flexDirection: "column" }}>
<main>
<section>
<div className="clear"></div>
<div className="container">

View File

@ -12,7 +12,7 @@ import Footer from './components/Footer';
import MainHeader from "./components/MainHeader";
import FormRequest from "./components/FormRequest";
import { sendOffstageToken, sendSwitchAccount } from '../actions';
import { sendOffstageToken, switchAccount } from '../actions';
class SwitchPage extends React.Component
{
@ -32,7 +32,7 @@ class SwitchPage extends React.Component
componentDidMount()
{
sendSwitchAccount({ dispatch: this.props.dispatch, acc_number: this.props.account })
switchAccount({ dispatch: this.props.dispatch, acc_number: this.props.account })
.then(() =>
{
this.setState({ error: false });

24
reducers/adminReducer.js Normal file
View File

@ -0,0 +1,24 @@
import { HYDRATE } from 'next-redux-wrapper';
import * as actionTypes from '../constants/actionTypes';
import initialState from "./initialState";
const adminReducer = (state = initialState.admin, action) =>
{
switch (action.type)
{
case actionTypes.ADMIN:
{
return {
...state,
...action.data,
};
}
default: {
return state;
}
}
};
export default adminReducer;

View File

@ -29,6 +29,8 @@ const contractReducer = (state = initialState.contract, action) =>
...state,
payments: action.data.payments,
avans: action.data.avans,
debt: action.data.debt,
penalty: action.data.penalty,
};
}

View File

@ -12,6 +12,9 @@ export const defaultState = {
companies: {
list: null,
},
admin: {
list: null,
},
company: {
title: "",
inn: "",
@ -27,6 +30,8 @@ export const defaultState = {
contract: {
payments: null,
avans: null,
debt: null,
penalty: null,
date: null,
car: null,
insurance: null,

View File

@ -10,6 +10,7 @@ import contractReducer from '../reducers/contractReducer';
import calendarReducer from '../reducers/calendarReducer';
import eventsReducer from '../reducers/eventsReducer';
import supportReducer from '../reducers/supportReducer';
import adminReducer from '../reducers/adminReducer';
const combinedReducer = combineReducers({
auth: authReducer,
@ -21,6 +22,7 @@ const combinedReducer = combineReducers({
calendar: calendarReducer,
events: eventsReducer,
support: supportReducer,
admin: adminReducer,
});
const makeStore = (context) =>