This commit is contained in:
merelendor 2022-08-17 05:09:36 +03:00
commit 458c886f09
68 changed files with 3372 additions and 597 deletions

View File

@ -92,8 +92,7 @@ export const sendLoginFormPhone = ({ phone }) =>
})
.catch((error) =>
{
console.log("DATA !!! ");
console.log("error");
console.error("sendLoginFormPhone", "error");
console.error(error);
reject();
@ -137,8 +136,7 @@ export const sendSmsCode = ({ dispatch, phone, code }) =>
})
.catch((error) =>
{
console.log("DATA !!! ");
console.log("error");
console.error("sendSmsCode", "error");
console.error(error);
reject();
@ -186,7 +184,9 @@ export const sendOffstageToken = ({ token, dispatch }) =>
{
dispatch({ type: actionTypes.AUTH, data: { logged: true, observer: true } });
dispatch({ type: actionTypes.USER, data: response.data.user });
dispatch({ type: actionTypes.COMPANIES, data: { list: response.data.companies } });
resolve();
Router.push('/');
})
@ -203,7 +203,31 @@ export const sendOffstageToken = ({ token, dispatch }) =>
})
.catch((error) =>
{
console.log("error");
console.error("sendOffstageToken", "error");
console.error(error);
reject();
});
});
}
export const getUsers = ({ dispatch }) =>
{
console.log("ACTION", "getUsers()");
return new Promise((resolve, reject) =>
{
axios.post(`${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/auth/admin/`, {})
.then(async (response) =>
{
console.log("getContractRules", "response.data", response.data);
dispatch({ type: actionTypes.ADMIN, data: { users: response.data.users } });
resolve();
})
.catch((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();
})
@ -397,11 +405,13 @@ export const getContractGraphicChangeSignatories = ({ dispatch, number }) =>
export const getContractGraphicChangeVariants = ({ dispatch, number, variants = {} }) =>
{
console.log("ACTION", "getContractGraphicChangeVariants", { ...{ number }, ...variants });
console.log("ACTION", "getContractGraphicChangeVariants", { ...{ number }, ...{ variants: variants } });
return new Promise((resolve, reject) =>
{
axios.post(`${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/change/variants`, { ...{ number }, ...variants },
console.log("{ ...{ number }, ...variants }", { ...{ number }, ...{ variants: variants } });
axios.post(`${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/change/variants`, { ...{ number }, ...{ variants: variants } },
{
withCredentials: true,
})
@ -447,30 +457,49 @@ export const getContractGraphicChangeCalculationsList = ({ dispatch, number }) =
});
}
export const getContractGraphicChangeOptions = ({ dispatch, number }) =>
export const getContractGraphicChangeOptions = ({ dispatch, number, variants }) =>
{
console.log("ACTION", "getContractGraphicChangeOptions", { ...{ number }, ...variants });
return new Promise((resolve, reject) =>
{
resolve();
console.log("{ ...{ number }, ...variants }", { ...{ number }, ...variants });
axios.post(`${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/change/options`, { ...{ number }, ...{ variants: variants } },
{
withCredentials: true,
})
.then(async (response) =>
{
console.log("ACTION", "getContractGraphicChangeOptions", "response.data", response.data);
dispatch({ type: actionTypes.CONTRACT_CHANGE, data: { options: response.data.planpayments[0] } });
resolve();
})
.catch((error) =>
{
console.error("ACTION", "getContractGraphicChangeOptions", "error");
console.error(error);
reject();
});
});
}
export const getContractGraphicChangeCalculate = ({ dispatch, number, calculation }) =>
export const getContractGraphicChangeCalculate = (calculation) =>
{
console.log("ACTION", "getContractGraphicChangeCurrent", { number });
console.log("ACTION", "getContractGraphicChangeCurrent", calculation);
return new Promise((resolve, reject) =>
{
axios.post(`${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/change/calculations`, { number },
axios.post(`${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/change/graphic/calculate`, { calculation },
{
withCredentials: true,
})
.then(async (response) =>
{
console.log("ACTION", "getContractGraphicChangeCurrent", "response.data", response.data);
dispatch({ type: actionTypes.CONTRACT_CHANGE, data: { calculations: response.data.pre_calculations } });
resolve();
resolve(response.data);
})
.catch((error) =>
{

View File

@ -33,12 +33,11 @@ export const getEvents = ({ dispatch, type, contract }) =>
})
.then((response) =>
{
console.log("getEvents", "response", response.data);
console.log("ACTION", "getEvents()", "response", response.data);
const events = response.data;
const filtered_events = [];
console.log("events");
console.log(events);
console.log("ACTION", "getEvents()", "events", events);
dispatch({ type: actionTypes.EVENTS, data: { list: events, loaded: true } });
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) =>
@ -206,4 +207,54 @@ 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

@ -1,6 +1,8 @@
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: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;
}
}

View File

@ -1 +1 @@
{"version":3,"sources":["style.less"],"names":[],"mappings":"AAAA,OACI,kBAAA,CACA,cAAA,CACA,sBAEA,gBAAmC,uBAAwB,kBAA3D,OACI,WAGJ,gBAAkC,iBAAlC,OACI,eAAA,CACA,eAXR,MAcI,YACI,YAAA,CACA,6BAAA,CACA,sBAAA,CACA,uBAEA,gBAAmC,kBAAnC,MANJ,YAOQ,SAAA,CACA,gBAtBZ,MA0BI,SACI,WAAA,CACA,sBAEA,gBAAmC,kBAAnC,MAJJ,SAKQ,cAEA,MAPR,QAOS,YACG,UAAA,CACA,YAAA,CACA,eAHJ,MAPR,QAOS,WAKG,KALJ,MAPR,QAOS,WAKU,GACH,aAAA,CACA,eAAA,CACA,kBAAA,CACA,qBAAA,CACA,4BAKZ,gBAAkC,iBAAlC,MAtBJ,SAuBQ,UAAA,CACA,mBAEA,MA1BR,QA0BS,WACG,KADJ,MA1BR,QA0BS,WACU,GACH,UAAA,CACA,eAAA,CACA,iBAKZ,MAnCJ,QAmCK,IAAI,cACD,mBAII,MAxCZ,QAuCQ,GACK,IAAI,cACD,mBAEA,gBAAkC,iBAAlC,MA3ChB,QAuCQ,GACK,IAAI,cAIG,mBAtExB,MA0BI,QAuCQ,GASI,GACI,WA3EpB,MA0BI,QAsDQ,GACI,aAAA,CACA,iBAIA,MA5DZ,QA2DQ,EACK,cACG,oBAAA,CACA,cAAA,CACA,gBAAA,CACA,UAAA,CACA,iBAAA,CACA,eAAgB,6DAEhB,gBAAmC,kBAAnC,MApEhB,QA2DQ,EACK,cASO,cAAA,CACA,oBAAA,CACA,mBAIR,MA3EZ,QA2DQ,EAgBK,iBACG,oBAAA,CACA,cAAA,CACA,gBAAA,CACA,UAAA,CACA,i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A2DQ,EACK,cACG,oBAAA,CACA,cAAA,CACA,gBAAA,CACA,UAAA,CACA,iBAAA,CACA,eAAgB,6DAEhB,gBAAmC,kBAAnC,MApEhB,QA2DQ,EACK,cASO,cAAA,CACA,oBAAA,CACA,mBAIR,MA3EZ,QA2DQ,EAgBK,iBACG,oBAAA,CACA,cAAA,CACA,gBAAA,CACA,UAAA,CACA,iBAAA,CACA,eAAgB,4DAIhB,gBAAmC,kBAAnC,MArFhB,QA2DQ,EAgBK,iBAWO,cAAA,CACA,oBAAA,CACA,mBAMR,MA9FZ,QA6FQ,IACK,UAAU,IACX,MA/FZ,QA6FQ,IAEK,UAAU,IACX,MAhGZ,QA6FQ,IAGK,SACG,mBAEA,gBAAmC,uBAAwB,kBAA3D,MAnGhB,QA6FQ,IACK,UAAU,IAKP,MAnGhB,QA6FQ,IAEK,UAAU,IAIP,MAnGhB,QA6FQ,IAGK,SAIO,oBA9HxB,MA0BI,QA6FQ,IAWI,GACI,iBAEA,gBAAmC,kBAAnC,MA3GhB,QA6FQ,IAWI,GAIQ"}

View File

@ -4,7 +4,7 @@ footer {
box-sizing: border-box;
@media all and (max-width: 1600px) and (min-width: 1280px) {
padding: 0;
padding: 25px 0;
}
@media all and (max-width: 768px) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"version":3,"sources":["style.less"],"names":[],"mappings":"AAAA,OACE,eAAA,CACA,cAAA,CACA,UAAA,CACA,MAAA,CACA,OAAA,CAEA,YAAA,CACA,cAAA,CACA,gBAAA,CACA,mDAEA,gBAAmC,uBAAwB,kBAA3D,OACE,WAAA,CACA,cAAA,CACA,kBAfJ,MAkBE,YACE,cAAA,CACA,YAAA,CACA,kBAAA,CACA,6BAAA,CACA,SAAA,CACA,gBAEA,MARF,WAQG,OACC,aA3BN,MA+BE,GACE,oBAAA,CACA,WAEA,MAJF,EAIG,MACC,UAAW,gBApCjB,MAwCE,cACE,aAAA,CACA,cAAA,CACA,6BAAA,C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,CACA,eAlBJ,MAeE,aAME,KACE,WAAA,CACA,kBAvBN,MAeE,aAME,IAKE,aACE,aAAA,CACA,WAAA,CACA,SAAA,CACA,qBAAsB,uCAAtB,CACA,2BAAA,CACA,4BAAA,CACA,cAAA,CACA,MAAO,WAAP,CACA,eAAA,CAEA,cAAA,CACA,cAAA,CACA,eAAA,CACA,kBAAA,CACA,sBAAA,CACA,eAAA,CACA,gBA3CR,MAeE,aAME,IAyBE,IACE,aAAA,CACA,iBAAA,CACA,eAAA,CACA,iBAAA,CACA,QAAA,CACA,UAAA,CACA,YAEA,MAxCN,aAME,IAyBE,GASG,IAAI,QACH,aAIA,MA7CR,aAME,IAyBE,GAaE,GACG,IAAI,cACH,kBA7DZ,MAeE,aAME,IAyBE,GAaE,GAKE,GACE,eAjEZ,MAeE,aAwDE,EAAC,eACC,UAAA,CACA,WAAA,CACA,eAAgB,8DAAhB,CACA,mBAAA,CACA,eAAA,CACA,kBAKN,gBAAkC,iBAAlC,OACE,YADF,MAGE,YACE,oBAJJ,MAOE,cACE,aAAA,CACA,cAAA,CACA,aAAA,CACA,YAXJ,MAOE,aAME,KACE,iBAAA,CACA,MAAA,CACA,WAhBN,MAOE,aAYE,EAAC,eACC,UAAA,CACA,WAAA,CACA,wBAtBN,MA0BE,KACE,UAAA,CACA,WAAA,CACA,cAAA,CACA"}
{"version":3,"sources":["style.less"],"names":[],"mappings":"AAAA,OACE,eAAA,CACA,cAAA,CACA,UAAA,CACA,MAAA,CACA,OAAA,CAEA,YAAA,CACA,cAAA,CACA,gBAAA,CACA,mDAEA,gBAAmC,uBAAwB,kBAA3D,OACE,WAAA,CACA,cAAA,CACA,kBAfJ,MAkBE,YACE,cAAA,CACA,YAAA,CACA,kBAAA,CACA,6BAAA,CACA,SAAA,CACA,gBAEA,MARF,WAQG,OACC,aA3BN,MA+BE,GACE,oBAAA,CACA,WAEA,MAJF,EAIG,MACC,UAAW,gBApCjB,MAwCE,cACE,aAAA,CACA,cAAA,CACA,6BAA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BAGF,MAXN,aAIE,IAEE,GAAG,GAKA,YACC,mBAOV,gBAAmC,kBAAnC,OACE,cAAA,CACA,gBAAA,CACA,YAIE,MADF,EACG,KACC,KACE,WAAA,CACA,YAVR,MAeE,cACE,qBAAA,CACA,oBAAA,CACA,eAlBJ,MAeE,aAME,KACE,WAAA,CACA,kBAvBN,MAeE,aAME,IAKE,aACE,aAAA,CACA,WAAA,CACA,SAAA,CACA,qBAAsB,uCAAtB,CACA,2BAAA,CACA,4BAAA,CACA,cAAA,CACA,MAAO,WAAP,CACA,eAAA,CAEA,cAAA,CACA,cAAA,CACA,eAAA,CACA,kBAAA,CACA,sBAAA,CACA,eAAA,CACA,gBA3CR,MAeE,aAME,IAyBE,IACE,aAAA,CACA,iBAAA,CACA,eAAA,CACA,iBAAA,CACA,QAAA,CACA,UAAA,CACA,YAEA,MAxCN,aAME,IAyBE,GASG,IAAI,QACH,aAIA,MA7CR,aAME,IAyBE,GAaE,GACG,IAAI,cACH,kBA7DZ,MAeE,aAME,IAyBE,GAaE,GAKE,GACE,eAjEZ,MAeE,aAwDE,EAAC,eACC,UAAA,CACA,WAAA,CACA,eAAgB,8DAAhB,CACA,mBAAA,CACA,eAAA,CACA,kBAKN,gBAAkC,iBAAlC,OACE,YADF,MAGE,YACE,oBAJJ,MAOE,cACE,aAAA,CACA,cAAA,CACA,aAAA,CACA,YAXJ,MAOE,aAME,KACE,iBAAA,CACA,MAAA,CACA,WAhBN,MAOE,aAYE,EAAC,eACC,UAAA,CACA,WAAA,CACA,wBAtBN,MA0BE,KACE,UAAA,CACA,WAAA,CACA,cAAA,CACA"}

View File

@ -277,7 +277,7 @@ header {
@media all and (max-width: 768px) {
order: 1;
width: 100%;
margin-left: 20px;
margin-left: 0px;
margin-right: 0;
}
}
@ -291,6 +291,16 @@ header {
text-align: center;
}
}
&.type {
margin-bottom: 0;
padding-right: 20px;
@media all and (max-width: 768px) {
padding-right: 0;
padding-left: 20px;
}
}
}
a {

View File

@ -1,9 +1,11 @@
main {
padding-top: 112px;
min-height: calc(100vh - 587px);
}
@media all and (max-width: 1600px) and (min-width: 1280px) {
main {
padding-top: 82px;
min-height: calc(100vh - 456px);
}
}
@media all and (max-width: 1279px) {
@ -3547,7 +3549,8 @@ main .dropdown_blocks_list .dropdown_block .block_body .fines_detail ul li {
}
.helpBox .content .info a {
display: block;
width: calc(33.33% - 15px);
width: auto;
min-width: calc(33.33% - 15px);
padding-left: 38px;
line-height: 26px;
font-size: 15px;

File diff suppressed because one or more lines are too long

View File

@ -1,8 +1,10 @@
main {
padding-top: 112px;
min-height: calc(100vh - 587px);
@media all and (max-width: 1600px) and (min-width: 1280px) {
padding-top: 82px;
min-height: calc(100vh - 456px);
}
@media all and (max-width: 1279px) {
@ -3984,7 +3986,8 @@ main .dropdown_blocks_list .dropdown_block .block_body {
a {
display: block;
width: calc(33.33% - 15px);
width: auto;
min-width: calc(33.33% - 15px);
padding-left: 38px;
line-height: 26px;
font-size: 15px;

View File

@ -5,8 +5,9 @@ import cookie from 'cookie';
import moment from 'moment';
import jwt from 'jsonwebtoken';
import { cors } from '../cors';
import { inspect } from 'util';
export default async function CRMRequest(req, res, path, params)
export default async function CRMRequestGet(req, res, path, params)
{
await cors(req, res);
@ -15,7 +16,7 @@ export default async function CRMRequest(req, res, path, params)
const cookies = cookie.parse(req.headers?.cookie ? req.headers?.cookie : "");
console.log("-".repeat(50));
console.log("CRMRequest", "req.body");
console.log("CRMRequestGet", "req.body");
console.log(req.body);
if(cookies.jwt !== undefined && cookies.jwt !== null)
@ -24,7 +25,7 @@ export default async function CRMRequest(req, res, path, params)
console.log(cookies.jwt);
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 });
var crm_jwt = jwt.sign({ acc_number: client_jwt_decoded.acc_number }, process.env.JWT_SECRET_CRM, { noTimestamp: true });
console.log("client_jwt_decoded", client_jwt_decoded);
console.log("crm_jwt", crm_jwt);
@ -35,7 +36,7 @@ export default async function CRMRequest(req, res, path, params)
try
{
await axios.get(path, {
params: { ...client_jwt_decoded, ...params },
params: { ...{ acc_number: client_jwt_decoded.acc_number }, ...params },
headers: {
"Authorization": `Bearer ${ crm_jwt }`,
},
@ -44,7 +45,7 @@ export default async function CRMRequest(req, res, path, params)
.then((crm_response) =>
{
console.log("crm_response for", path);
console.log(crm_response.data);
console.log(inspect(crm_response.data, true, null, true));
res.status(200).json(crm_response.data);
})

View File

@ -0,0 +1,68 @@
// 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 '../cors';
import { inspect } from 'util';
export default async function CRMRequestPost(req, res, path, params)
{
await cors(req, res);
if(req.headers.cookie !== undefined)
{
const cookies = cookie.parse(req.headers?.cookie ? req.headers?.cookie : "");
console.log("-".repeat(50));
console.log("CRMRequestPost", "req.body");
console.log(req.body);
if(cookies.jwt !== undefined && cookies.jwt !== null)
{
console.log("cookies.jwt");
console.log(cookies.jwt);
var client_jwt_decoded = jwt.verify(cookies.jwt, process.env.JWT_SECRET_CLIENT);
var crm_jwt = jwt.sign({ acc_number: client_jwt_decoded.acc_number }, process.env.JWT_SECRET_CRM, { noTimestamp: true });
const payload = { ...{ acc_number: client_jwt_decoded.acc_number }, ...params };
console.log("path", path);
console.log("payload", payload);
try
{
await axios.post(path, payload,
{
headers: {
//"Content-Type": "application/json",
"Authorization": `Bearer ${ crm_jwt }`,
},
withCredentials: true,
})
.then((crm_response) =>
{
console.log("crm_response for", path);
console.log(inspect(crm_response.data, true, null, true));
res.status(200).json(crm_response.data);
})
.catch((error) =>
{
console.error(error);
res.status(500);
});
}
catch(e)
{
console.error(e);
res.status(500);
}
}
else
{
res.status(403);
}
}
}

View File

@ -5,53 +5,56 @@ import Header from "./components/Header";
import Footer from "./components/Footer";
import Company from "./components/Company";
class Offline extends React.Component {
constructor(props) {
super(props);
this.state = {};
}
class Offline extends React.Component
{
constructor(props)
{
super(props);
this.state = {};
}
static getDerivedStateFromProps(nextProps, prevState) {
return {};
}
static getDerivedStateFromProps(nextProps, prevState)
{
return {};
}
componentDidMount() {}
componentDidMount() {}
render() {
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">
<h1 className="section_title">Личный кабинет</h1>
</div>
<div className="right">
<Company />
</div>
</div>
<div className="offline">
<p>
В настоящий момент ведутся технические работы. Если Вам
необходимо получить информацию, пожалуйста, свяжитесь с нами
по телефону: 8 800 111 22 33
</p>
</div>
</div>
</section>
</main>
<Footer />
</React.Fragment>
);
}
render()
{
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">
<h1 className="section_title">Личный кабинет</h1>
</div>
<div className="right">
<Company { ...this.props }/>
</div>
</div>
<div className="offline">
<p>
В настоящий момент ведутся технические работы. Если Вам
необходимо получить информацию, пожалуйста, свяжитесь с нами
по телефону: 8 800 111 22 33
</p>
</div>
</div>
</section>
</main>
<Footer />
</React.Fragment>
);
}
}
export default Offline;

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

@ -25,8 +25,6 @@ export default async function handler(req, res)
console.log(api_response.data);
res.status(200).send(api_response.data);
//resolve(api_response.data);
})
.catch((error) =>
{
@ -34,7 +32,6 @@ export default async function handler(req, res)
console.error(error);
res.status(403).json();
//reject();
});
}
else

View File

@ -31,7 +31,7 @@ export default async function handler(req, res)
console.log(existed_data_json);
console.log("*".repeat(50));
token = jwt.sign({ "acc_number": existed_data_json.acc_number, }, process.env.JWT_SECRET_CLIENT, { noTimestamp: true });
token = jwt.sign({ "acc_number": existed_data_json.acc_number, login: existed_data_json.user.email, companies: existed_data_json.companies, }, process.env.JWT_SECRET_CLIENT, { noTimestamp: true });
res.status(200).json({ ...existed_data_json, ...{ status: "success", token: token, } });
}

74
pages/api/auth/switch.js Normal file
View File

@ -0,0 +1,74 @@
// 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);
let { acc_number } = req.body;
console.log("API", "auth/switch");
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);
console.log("API", "auth/switch", "client_jwt_decoded", client_jwt_decoded);
const { companies } = client_jwt_decoded;
if(companies !== undefined && companies !== null)
{
for(let i in companies)
{
if(companies[i].acc_number === acc_number)
{
company = companies[i];
allow = true;
break;
}
}
if(allow)
{
const new_client_jwt = jwt.sign({
acc_number: acc_number,
login: client_jwt_decoded.login,
companies: client_jwt_decoded.companies,
}, process.env.JWT_SECRET_CLIENT, { noTimestamp: true });
res.status(200).send({
status: "success",
token: new_client_jwt,
});
}
else
{
res.status(403).json();
}
}
else
{
res.status(403).json();
}
}
else
{
res.status(403).json();
}
}
else
{
res.status(403).json();
}
}

View File

@ -29,7 +29,7 @@ export default async function handler(req, res)
})
.then((crm_response) =>
{
res.status(200).json(crm_response.data);
res.status(200).json({ ...crm_response.data, ...{ active: client_jwt_decoded.acc_number } });
})
.catch((error) =>
{

View File

@ -1,7 +1,7 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import CRMRequest from '../../../../lib/CRMRequest';
import CRMRequestGet from '../../../../lib/CRMRequestGet';
export default async function handler(req, res)
{
await CRMRequest(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/GetPreCalculations`, { contract_number: req.body.number });
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/GetPreCalculations`, { contract_number: req.body.number });
}

View File

@ -1,7 +1,9 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import CRMRequest from '../../../../../lib/CRMRequest';
import CRMRequestPost from '../../../../../lib/CRMRequestPost';
export default async function handler(req, res)
{
await CRMRequest(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/CreateCalculation`, { contract_number: req.body.number });
console.log("WTF BODY");
console.log(req.body);
await CRMRequestPost(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/CreateCalculation`, req.body.calculation);
}

View File

@ -1,7 +1,7 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import CRMRequest from '../../../../../lib/CRMRequest';
import CRMRequestGet from '../../../../../lib/CRMRequestGet';
export default async function handler(req, res)
{
await CRMRequest(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/GetPreCalculationGraph`, { addcontract_number: req.body.calculation });
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/GetPreCalculationGraph`, { addcontract_number: req.body.calculation });
}

View File

@ -1,7 +1,7 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import CRMRequest from '../../../../../lib/CRMRequest';
import CRMRequestGet from '../../../../../lib/CRMRequestGet';
export default async function handler(req, res)
{
await CRMRequest(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/GetCurrentGraph`, { contract_number: req.body.number });
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/GetCurrentGraph`, { contract_number: req.body.number });
}

View File

@ -0,0 +1,12 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import CRMRequestGet from '../../../../lib/CRMRequestGet';
export default async function handler(req, res)
{
console.log("-".repeat(50));
console.log("API", "contract", "change", "options", "req.body.variants");
console.log(req.body.variants);
console.log("-".repeat(50));
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/GetTypeOptions`, { ...{ contract_number: req.body.number }, ...req.body.variants });
}

View File

@ -1,7 +1,7 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import CRMRequest from '../../../../lib/CRMRequest';
import CRMRequestGet from '../../../../lib/CRMRequestGet';
export default async function handler(req, res)
{
await CRMRequest(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/GetSignatories`, {});
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/GetSignatories`, {});
}

View File

@ -1,7 +1,11 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import CRMRequest from '../../../../lib/CRMRequest';
import CRMRequestGet from '../../../../lib/CRMRequestGet';
export default async function handler(req, res)
{
await CRMRequest(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/GetAvaliableGraphChangeTypes`, { ...{ contract_number: req.body.number }, ...req.body.variants });
console.log("req.body.variantsreq.body.variantsreq.body.variantsreq.body.variants");
console.log(req.body.variants);
console.log("-".repeat(50));
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/GetAvaliableGraphChangeTypes`, { ...{ contract_number: req.body.number }, ...req.body.variants });
}

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,5 +1,6 @@
import React from "react";
import { connect } from "react-redux";
//import { switchAccount } from "../../../actions";
class Company extends React.Component
{
@ -9,57 +10,52 @@ class Company extends React.Component
this.state = {
company: {},
opened: false,
companies: null,
}
}
static getDerivedStateFromProps(nextProps, prevState)
{
return {
company: nextProps.company,
company: nextProps.company,
companies: nextProps.companies,
};
}
_handleOnClick = () =>
{
const { opened } = this.state;
//this.setState({ opened: !opened ? true : false })
const { companies, opened } = this.state;
if(companies !== null && companies.length > 1)
{
this.setState({ opened: !opened ? true : false })
}
}
_handle_onSelectCompany = (acc_number) =>
{
this.props.router.push(`/switch/?account=${ acc_number }`);
}
render()
{
const { company, opened } = this.state;
console.log(this.props);
const { company, companies, opened } = this.state;
return (
<div className="right company-dropdown" onClick={ this._handleOnClick }>
<p align="right">{/* className="arrow" */}
<p align="right" className={ companies !== null && companies.length > 1 ? "arrow" : "" }>{/* className="arrow" */}
<b>{ company.title }</b><br/>
{company.inn != null && <span>ИНН: { company.inn } </span>}
{company.kpp != null && <span>КПП: { company.kpp }</span>}
</p>
<div className={`companies_list ${ opened && "opened" }`}> {/* opened */}
<div className="company_item">
<p align="right">
<b>ООО ЮКС</b><br/>
ИНН: <span>12345678765</span> КПП: <span>13432-02</span>
</p>
</div>
<div className="company_item">
<p align="right">
<b>ООО Еще одно название</b><br/>
ИНН: <span>12345678765</span> КПП: <span>13432-02</span>
</p>
</div>
<div className="company_item selected">
<p align="right">
<b>ООО Друзья и КО</b><br/>
ИНН: <span>12345678765</span> КПП: <span>13432-02</span>
</p>
</div>
{ companies !== null && companies.map((entry, index) => (
<div key={ index } className={ `company_item ${ company.active === entry.acc_number && "selected" }` } onClick={ () => this._handle_onSelectCompany(entry.acc_number) }>
<p align="right">
<b>{ entry.title }</b><br/>
ИНН: <span>{ entry.inn }</span> { entry.kpp !== '' && (<>КПП: <span>{ entry.kpp }</span></>) }
</p>
</div>
)) }
</div>
</div>
)
@ -70,6 +66,7 @@ function mapStateToProps(state, ownProps)
{
return {
company: state.company,
companies: state.companies.list,
}
}

View File

@ -15,7 +15,7 @@ export default class NotificationsList extends React.Component
render()
{
const { events } = this.props;
console.log("events", events);
console.log("NotificationsList", "events", events);
return (
<>

View File

@ -143,7 +143,7 @@ class Header extends React.Component
render()
{
const { observer, menuOpened, notificationsOpened, messagesOpened, events, events_loaded, appeals } = this.state;
console.log("events", events);
console.log("Header", "events", events);
return (
<header>

View File

@ -87,8 +87,8 @@ class ChangeGraphicPage extends React.Component
render()
{
const { loading, date, car, contract_date, agreement, rules } = this.state;
const { number } = this.props;
const { loading, date, car, contract_date, agreement, rules } = this.state;
console.log("rules", rules);
@ -123,7 +123,7 @@ class ChangeGraphicPage extends React.Component
: ""}
</h5>
</div>
<Company />
<Company { ...this.props }/>
</div>
<div className="aside_container about">
<InnerMenu number={number} {...this.props} />

View File

@ -84,8 +84,8 @@ class ContractPage extends React.Component
render()
{
const { loading, date, car, contract_date, agreement, rules } = this.state;
const { number } = this.props;
const { loading, date, car, contract_date, agreement, rules } = this.state;
console.log("rules", rules);
@ -127,7 +127,7 @@ class ContractPage extends React.Component
: "" }
</h5>
</div>
<Company />
<Company { ...this.props }/>
</div>
<div className="aside_container about">
<InnerMenu number={number} {...this.props} />

View File

@ -59,21 +59,23 @@ export default class CalculationsList extends React.Component
const { number, calculations } = this.props;
console.log("\x1B[31m calculations \x1B[34m", calculations);
return (
<div className="feed">
<div className="feed_list">
<Slider { ...settings }>
{ calculations.map((calculation, index) =>
{ calculations !== undefined && calculations !== null && calculations.map((calculation, index) =>
(
<div className="feed_item" key={ index }>
<p className="item_title">Расчет { calculation.label }</p>
<p className="item_desc">
{ calculation.date_offset_type_comment !== null && (<>{ calculation.date_offset_type_comment }<br/></>) }
{ calculation.number_paydate_comment !== null && (<>{ calculation.number_paydate_comment }<br/></>) }
{ calculation.insurance_price_result_comment !== null && (<>{ calculation.insurance_price_result_comment }<br/></>) }
{ calculation.fix_last_payment_available_comment !== null && (<>{ calculation.fix_last_payment_available_comment }<br/></>) }
{ calculation.period_new_comment !== null && (<>{ calculation.period_new_comment }<br/></>) }
{ calculation.sum_comment !== null && (<>{ calculation.sum_comment }<br/></>) }
{ calculation.date_offset_type_comment !== null && (<>{ `${ calculation.date_offset_type_comment.label }: ${ calculation.date_offset_type_comment.value }` }<br/></>) }
{ calculation.number_paydate_comment !== null && (<>{ `${ calculation.number_paydate_comment.label }: ${ calculation.number_paydate_comment.value }` }<br/></>) }
{ calculation.insurance_price_result_comment !== null && (<>{ `${ calculation.insurance_price_result_comment.label }: ${ calculation.insurance_price_result_comment.value } ` }<br/></>) }
{ calculation.fix_last_payment_available_comment !== null && (<>{ `${ calculation.fix_last_payment_available_comment.label }: ${ calculation.fix_last_payment_available_comment.value ? "да" : "нет" }` }<br/></>) }
{ calculation.period_new_comment !== null && (<>{ `${ calculation.period_new_comment.label }: ${ calculation.period_new_comment.value }` }<br/></>) }
{ calculation.sum_comment !== null && (<>{ `${ calculation.sum_comment.label }: ${ calculation.sum_comment.value }` }<br/></>) }
</p>
<a className="item_link interactive" onClick={ () => this._handle_onCalculation(calculation.addcontract_number) }>Подробнее</a>
</div>

View File

@ -110,42 +110,34 @@ export default class Comparison extends React.Component
<div className="compare_data">
{ calculation !== undefined && calculation !== null && calculation.fix_last_payment_available_comment !== null && (
<div className="form_field">
<input type="checkbox" hidden id="" name="" checked disabled />
<label htmlFor="">{ calculation.fix_last_payment_available_comment }</label>
<input type="checkbox" hidden id="" name="" checked={ calculation.fix_last_payment_available_comment.value ? true : false } disabled style={ calculation.fix_last_payment_available_comment.value ? {} : { background: "unset"} } />
<label htmlFor="">{ calculation.fix_last_payment_available_comment.label }</label>
</div>
) }
{ calculation !== undefined && calculation !== null && calculation.date_offset_type_comment !== null && (
<div className="form_field">
<input type="checkbox" hidden id="" name="" checked disabled />
<label htmlFor="">{ calculation.date_offset_type_comment }</label>
<input type="checkbox" hidden id="" name="" checked={ calculation.date_offset_type_comment.value ? true : false } disabled style={ calculation.date_offset_type_comment.value ? {} : { background: "unset"} } />
<label htmlFor="">{ calculation.date_offset_type_comment.label }</label>
</div>
) }
{ calculation !== undefined && calculation !== null && calculation.insurance_price_result_comment !== null && (
<div className="form_field">
<p>
{ calculation.insurance_price_result_comment }
</p>
<p><span>{ calculation.insurance_price_result_comment.label }:</span> { calculation.insurance_price_result_comment.value }</p>
</div>
) }
{ calculation !== undefined && calculation !== null && calculation.number_paydate_comment !== null && (
<div className="form_field">
<p>
{ calculation.number_paydate_comment }
</p>
<p><span>{ calculation.number_paydate_comment.label }:</span> { calculation.number_paydate_comment.value }</p>
</div>
) }
{ calculation !== undefined && calculation !== null && calculation.period_new_comment !== null && (
<div className="form_field">
<p>
{ calculation.period_new_comment }
</p>
<p><span>{ calculation.period_new_comment.label }:</span> { calculation.period_new_comment.value }</p>
</div>
) }
{ calculation !== undefined && calculation !== null && calculation.sum_comment !== null && (
<div className="form_field">
<p>
{ calculation.sum_comment }
</p>
<p><span>{ calculation.sum_comment.label }:</span> { calculation.sum_comment.value }</p>
</div>
) }
{/*}
@ -172,7 +164,7 @@ export default class Comparison extends React.Component
<div className="compare_tables">
<div className="compare_table">
<p className="table_title">Текущий график</p>
<div className="table_body" style={{ display: "flex", flexDirection: "column", }}>
<div className="table_body">
<div className="table_row table_header">
<div></div>
<div>Дата лизингового платежа</div>{/* className="sortable" */}
@ -180,7 +172,7 @@ export default class Comparison extends React.Component
<div>Сумма досрочного выкупа</div>{/* className="sortable" */}
</div>
{ !show_previous && (
<div className="table_row row-button" style={{ position: "relative", display: "flex" }}>
<div className="table_row row-button" >
<button className="button button-gray" onClick={ this._handle_onShowPrevious }>
Показать прошедшие платежи
</button>
@ -192,7 +184,7 @@ export default class Comparison extends React.Component
{
if(!show_previous && moment(payment.plandate) < today) { return null; }
return (
<div key={ `current_${ index }` } className="table_row" style={{ display: "flex" }}>
<div key={ `current_${ index }` } className="table_row" >
<div>{ payment.name }</div>
<div>{ moment(payment.plandate, "YYYY.MM.DD").format("DD.MM.YYYY") }</div>
<div>{ numeral(payment.sum).format(' ., ') }&nbsp;</div>
@ -209,7 +201,7 @@ export default class Comparison extends React.Component
Изменения с платежа { calculation.label }
</p>
) }
<div className="table_body" style={{ display: "flex", flexDirection: "column", }}>
<div className="table_body" >
<div className="table_row table_header">
<div></div>
<div>Дата лизингового платежа</div>{/* className="sortable" */}
@ -217,7 +209,7 @@ export default class Comparison extends React.Component
<div>Сумма досрочного выкупа</div>{/* className="sortable" */}
</div>
{ !show_previous && (
<div className="table_row row-button" style={{ position: "relative", display: "flex" }}>
<div className="table_row row-button">
<button className="button button-gray" onClick={ this._handle_onShowPrevious }>
Показать прошедшие платежи
</button>
@ -229,7 +221,7 @@ export default class Comparison extends React.Component
{
if(!show_previous && moment(payment.plandate) < today) { return null; }
return (
<div key={ `current_${ index }` } className="table_row" style={{ display: "flex" }}>
<div key={ `current_${ index }` } className="table_row">
<div>{ payment.name }</div>
<div>{ moment(payment.plandate, "YYYY.MM.DD").format("DD.MM.YYYY") }</div>
<div>{ numeral(payment.sum).format(' ., ') }&nbsp;</div>

View File

@ -1,23 +1,505 @@
import React from "react";
import { SpinnerCircular } from "spinners-react";
import moment from "moment";
import pluralize from 'pluralize-ru';
import numeral from "numeral";
import DateInput from "../../../../components/DatePicker";
import { getContractGraphicChangeOptions, getContractGraphicChangeCalculate } from "../../../../../actions";
class PaymentDate extends React.Component
{
constructor(props)
{
super(props);
this.state = {
value: null,
min: null,
max: null,
}
}
componentDidMount()
{
const { option, onOption } = this.props;
this.setState({
value: moment(option.value).toDate(),
min: moment(option.from).toDate(),
max: moment(option.to).toDate(),
}, () =>
{
onOption(this.state.value);
});
}
_handle_onChange = (value) =>
{
const { onOption } = this.props;
this.setState({ value }, () =>
{
onOption(value);
});
}
render()
{
const { value, min, max } = this.state;
return (
<div className="form_field">
<label>Дата платежа</label>
<DateInput
placeholder=""
value={ value }
min={ min }
max={ max }
id={"date_to"}
onChange={ this._handle_onChange }
/>
</div>
)
}
}
class FixLastPayment extends React.Component
{
constructor(props)
{
super(props);
this.state = {
value: false,
};
}
componentDidMount()
{
const { option, onOption } = this.props;
this.setState({
value: option.value,
}, () =>
{
onOption(this.state.value);
});
}
_handle_onChange = () =>
{
const { onOption } = this.props;
this.setState({ value: this.state.value ? false : true }, () =>
{
onOption(this.state.value);
});
}
render()
{
const { value } = this.state;
return (
<div className="form_field">
<input type="checkbox" hidden id="fix_pay" name="fix_pay" checked={ value } onChange={ this._handle_onChange }/>
<label htmlFor="fix_pay">
Фиксировать послединий платеж
</label>
<div className="help_tooltip">
<div className="help_icon">
<svg width={ 24 } height={ 24 } fill="none" xmlns="http://www.w3.org/2000/svg" >
<path d="M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Z" stroke="#8E94A7" strokeWidth={ 2 } strokeLinecap="round" strokeLinejoin="round" />
<path d="M11.25 11.25H12v5.25h.75" stroke="#8E94A7" strokeWidth={ 2 } strokeLinecap="round" strokeLinejoin="round" />
<path d="M12 9a1.125 1.125 0 1 0 0-2.25A1.125 1.125 0 0 0 12 9Z" fill="#8E94A7" />
</svg>
</div>
<div className="help_content ">
{" "}
{/* opened */}
<div>
<p>Какой-то описательный текст</p>
<p className="button">Закрыть</p>
</div>
</div>
</div>
</div>
)
}
}
class DateOffestType extends React.Component
{
constructor(props)
{
super(props);
this.state = {
value: null,
}
}
componentDidMount()
{
const { option, onOption } = this.props;
this.setState({
value: parseInt(option.value, 10),
}, () =>
{
onOption(this.state.value);
});
}
_handle_onChange = (value) =>
{
const { onOption } = this.props;
this.setState({ value: parseInt(value, 10) }, () =>
{
onOption(this.state.value);
});
}
render()
{
const { value } = this.state;
return (
<div className="form_field">
<label>Тип каникул</label>
<div className="form_field">
<input type="radio" hidden id="weeekend_type_1" name="weeekend_type" checked={ value === 100000001 ? true : false } onChange={ () => this._handle_onChange(100000001) }/>
<label htmlFor="weeekend_type_1">С увеличением срока</label>
</div>
<div className="form_field">
<input type="radio" hidden id="weeekend_type_2" name="weeekend_type" checked={ value === 100000000 ? true : false } onChange={ () => this._handle_onChange(100000000) }/>
<label htmlFor="weeekend_type_2">Без изменения срока</label>
</div>
</div>
)
}
}
class PeriodSelector extends React.Component
{
constructor(props)
{
super(props);
this.state = {
value: null,
periods: [],
}
}
componentDidMount()
{
const { option, onOption } = this.props;
const periods = [];
if(option.min !== undefined && option.min !== null)
{
for(let i = parseInt(option.min, 10); i <= parseInt(option.max, 10); i++)
{
periods.push(i);
}
this.setState({
value: periods[0], periods
}, () =>
{
onOption(this.state.value);
});
}
}
_handle_onChange = (event) =>
{
const { onOption } = this.props;
this.setState({ value: parseInt(event.target.value, 10) }, () =>
{
onOption(this.state.value);
});
}
render()
{
const { value, periods } = this.state;
if(value !== null)
{
return (
<div className="form_field">
<label>Увеличить график на</label>
<select value={ value } onChange={ this._handle_onChange }>
{ periods.map((period, index) => (
<option key={ index } value={ period }>{ index + 1 } { pluralize( index + 1, 'месяца', 'месяц', 'месяца', 'месяцев') } ({ period } { pluralize( period, 'платежа', 'платеж', 'платежа', 'платежей') })</option>
)) }
</select>
</div>
)
}
return null;
}
}
class SumSelector extends React.Component
{
constructor(props)
{
super(props);
this.state = {
value: "",
min: null,
max: null,
}
}
componentDidMount()
{
const { option, onOption } = this.props;
this.setState({
value: option.min,
min: option.min,
max: option.max,
}, () =>
{
onOption(this.state.value, false);
});
}
_handle_onChange = (event) =>
{
const { onOption } = this.props;
const { min, max } = this.state;
const value = parseFloat(event.target.value.replace('/[^\d]/m', ''));
if(value >= min && value <= max && !isNaN(value))
{
this.setState({ value: value }, () =>
{
onOption(this.state.value, false);
});
}
else
{
onOption(this.state.value, true);
}
}
render()
{
const { value, min, max } = this.state;
return (
<div className="form_field">
<label>Увеличить платеж на (ЧДП)</label>
<input type="number" placeholder="Укажите сумму" defaultValue={ value } onChange={ this._handle_onChange }/>
<div style={{ position: "absolute", left: 214, top: 46, fontSize: 12 }}>от { numeral(min).format(' ., ') }&nbsp;</div>
<div style={{ position: "absolute", left: 440, top: 46, fontSize: 12 }}>до { numeral(max).format(' ., ') }&nbsp;</div>
<div className="help_tooltip">
<div className="help_icon">
<svg width={ 24 } height={ 24 } fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Z" stroke="#8E94A7" strokeWidth={ 2 } strokeLinecap="round" strokeLinejoin="round" />
<path d="M11.25 11.25H12v5.25h.75" stroke="#8E94A7" strokeWidth={ 2 } strokeLinecap="round" strokeLinejoin="round" />
<path d="M12 9a1.125 1.125 0 1 0 0-2.25A1.125 1.125 0 0 0 12 9Z" fill="#8E94A7" />
</svg>
</div>
<div className="help_content ">
{" "}
{/* opened */}
<div>
<p>Какой-то описательный текст</p>
<p className="button">Закрыть</p>
</div>
</div>
</div>
</div>
)
}
}
class InsurancePriceSelector extends React.Component
{
constructor(props)
{
super(props);
this.state = {
value: "",
min: null,
max: null,
}
}
componentDidMount()
{
const { option, onOption } = this.props;
this.setState({
value: option.min,
min: option.min,
max: option.max,
}, () =>
{
onOption(this.state.value, false);
});
}
_handle_onChange = (event) =>
{
const { onOption } = this.props;
const { min, max } = this.state;
const value = parseFloat(event.target.value.replace('/[^\d]/m', ''));
if(value >= min && value <= max && !isNaN(value))
{
this.setState({ value: value }, () =>
{
onOption(this.state.value, false);
});
}
else
{
onOption(this.state.value, true);
}
}
render()
{
const { value, min, max } = this.state;
return (
<div className="form_field">
<label>Сумма пролонгации</label>
<input type="number" placeholder="Укажите сумму" defaultValue={ value } onChange={ this._handle_onChange }/>
<div style={{ position: "absolute", left: 214, top: 46, fontSize: 12 }}>от { numeral(min).format(' ., ') }&nbsp;</div>
<div style={{ position: "absolute", left: 440, top: 46, fontSize: 12 }}>до { numeral(max).format(' ., ') }&nbsp;</div>
<div className="help_tooltip">
<div className="help_icon">
<svg width={ 24 } height={ 24 } fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Z" stroke="#8E94A7" strokeWidth={ 2 } strokeLinecap="round" strokeLinejoin="round" />
<path d="M11.25 11.25H12v5.25h.75" stroke="#8E94A7" strokeWidth={ 2 } strokeLinecap="round" strokeLinejoin="round" />
<path d="M12 9a1.125 1.125 0 1 0 0-2.25A1.125 1.125 0 0 0 12 9Z" fill="#8E94A7" />
</svg>
</div>
<div className="help_content ">
{" "}
{/* opened */}
<div>
<p>Какой-то описательный текст</p>
<p className="button">Закрыть</p>
</div>
</div>
</div>
</div>
)
}
}
class InsuranceDateFromSelector extends React.Component
{
constructor(props)
{
super(props);
this.state = {
value: null,
min: null,
max: null,
}
}
componentDidMount()
{
const { option, onOption } = this.props;
this.setState({
value: moment(option.value !== null ? option.value : option.from).toDate(),
min: moment(option.from).toDate(),
max: moment(option.to).toDate(),
}, () =>
{
onOption(this.state.value);
});
}
_handle_onChange = (value) =>
{
const { onOption } = this.props;
this.setState({ value }, () =>
{
onOption(value);
});
}
render()
{
const { value, min, max } = this.state;
return (
<div className="form_field">
<label>Дата начала пролонгации</label>
<DateInput
placeholder=""
value={ value }
min={ min }
max={ max }
id={"date_to"}
onChange={ this._handle_onChange }
/>
</div>
)
}
}
export default class Options extends React.Component
{
constructor(props)
{
super(props);
this.state = {
loading: true,
sending: false,
date: null,
car: null,
contract_date: null,
agreement: null,
rules: null,
loading: false,
number_paydate: null,
period_new: null,
fix_last_payment_available: false,
date_offset_type: null,
sum: null,
insurance_price_result: null,
datefrom: null,
errors: {},
};
}
componentDidMount()
{
const { dispatch, number, variants } = this.props;
const varianst_for_options = {};
for(let i in variants.types)
{
if(variants.types[i].value)
{
varianst_for_options[variants.types[i].name] = true;
}
}
getContractGraphicChangeOptions({ dispatch, number, variants: varianst_for_options })
.then(() =>
{
this.setState({ loading: false });
})
.catch(() =>
{
});
}
_handle_onBack = (event) =>
@ -28,93 +510,163 @@ export default class Options extends React.Component
_handle_onCalculate = (event) =>
{
const { sending, number_paydate, period_new, fix_last_payment_available, date_offset_type, sum, insurance_price_result, datefrom, } = this.state;
const { number, options, variants, onCalculate } = this.props;
event.preventDefault();
this.props.onCalculate();
console.log(this.props);
if(!sending)
{
const v = {};
for(let i in variants.types) { v[ variants.types[i].name ] = variants.types[i].value; }
const payload = {
...{ contract_number: number },
...v,
...{
number_paydate: number_paydate !== null ? moment(number_paydate).format() : null,
period_new,
fix_last_payment_available,
date_offset_type,
sum: sum === null ? 0 : sum,
insurance_price_result: insurance_price_result === null ? 0 : insurance_price_result,
datefrom: datefrom !== null ? moment(datefrom).format() : null,
early_redemption_change: false,
number_planpayment: options.number_planpayment.value,
}
};
console.log(payload);
this.setState({ sending: true, }, () =>
{
getContractGraphicChangeCalculate(payload)
.then((calculation) =>
{
console.log("calculationcalculationcalculationcalculationcalculation");
console.log(calculation);
/*
onCalculate()
.then(() =>
{
})
.catch(() =>
{
this.setState({ sending: false, });
});
*/
})
.catch(() =>
{
});
});
}
}
_handle_onPaymentDateChange = (date) =>
{
this.setState({ number_paydate: date });
}
_handle_onFixLastPaymentChange = (value) =>
{
this.setState({ fix_last_payment_available: value });
}
_handle_onDateOffsetTypeChange = (value) =>
{
this.setState({ date_offset_type: value });
}
_handle_onPeriodChange = (value) =>
{
this.setState({ period_new: value });
}
_handle_onSumChange = (value, error) =>
{
const { errors } = this.state;
if(error) { errors['sum'] = true; } else { delete errors['sum']; }
this.setState({ sum: value, errors });
}
_handle_onInsurancePriceChange = (value, error) =>
{
const { errors } = this.state;
if(error) { errors['insurance_price_result'] = true; } else { delete errors['insurance_price_result']; }
this.setState({ insurance_price_result: value, errors });
}
_handle_onInsuranceDateFromChange = (date) =>
{
this.setState({ datefrom: date });
}
_checkAllowCalculate = () =>
{
const { errors } = this.state;
for(let i in errors)
{
if(errors[i])
{
return false;
}
}
return true;
}
render()
{
const { loading, date, car, contract_date, agreement, rules } = this.state;
const { number } = this.props;
const { loading, sending, } = this.state;
const { variants, options } = this.props;
return (
<div className="block">
<p className="title">Параметры опций изменений графика платежей</p>
<form className="calc">
<div className="form_field">
<label>Дата платежа</label>
<DateInput placeholder="" id={"date_to"} onChange={ (date) => this.setState({ date_to: date }) } />
{ loading ? (
<div style={{ position: "absolute", left: "50%", top: "50%" }}>
<SpinnerCircular size={ 90 } thickness={ 51 } speed={ 100 } color="rgba(28, 1, 169, 1)" secondaryColor="rgba(236, 239, 244, 1)" style={{ marginTop: "-45px", marginLeft: "-45px", }}/>
</div>
<div className="form_field">
<input type="checkbox" hidden id="fix_pay" name="fix_pay" />
<label htmlFor="fix_pay">
Фиксировать послединий платеж
</label>
<div className="help_tooltip">
<div className="help_icon">
<svg width={ 24 } height={ 24 } fill="none" xmlns="http://www.w3.org/2000/svg" >
<path d="M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Z" stroke="#8E94A7" strokeWidth={ 2 } strokeLinecap="round" strokeLinejoin="round" />
<path d="M11.25 11.25H12v5.25h.75" stroke="#8E94A7" strokeWidth={ 2 } strokeLinecap="round" strokeLinejoin="round" />
<path d="M12 9a1.125 1.125 0 1 0 0-2.25A1.125 1.125 0 0 0 12 9Z" fill="#8E94A7" />
</svg>
</div>
<div className="help_content ">
{" "}
{/* opened */}
<div>
<p>Какой-то описательный текст</p>
<p className="button">Закрыть</p>
</div>
</div>
) : (
<form className="calc">
{ options !== undefined && options !== null && options.number_paydate !== undefined && options.number_paydate !== null && options.number_paydate.visible && (
<PaymentDate option={ options.number_paydate } onOption={ this._handle_onPaymentDateChange } />
) }
{ options !== undefined && options !== null && options.fix_last_payment_available !== undefined && options.fix_last_payment_available !== null && options.fix_last_payment_available.visible && (
<FixLastPayment option={ options.fix_last_payment_available } onOption={ this._handle_onFixLastPaymentChange } />
) }
{ options !== undefined && options !== null && options.date_offset_type !== undefined && options.date_offset_type !== null && options.date_offset_type.visible && (
<DateOffestType option={ options.date_offset_type } onOption={ this._handle_onDateOffsetTypeChange } />
) }
{ options !== undefined && options !== null && options.period_new !== undefined && options.period_new !== null && options.period_new.visible && (
<PeriodSelector option={ options.period_new } onOption={ this._handle_onPeriodChange } />
) }
{ options !== undefined && options !== null && options.sum !== undefined && options.sum !== null && options.sum.visible && (
<SumSelector option={ options.sum } onOption={ this._handle_onSumChange } />
) }
{ options !== undefined && options !== null && options.insurance_price_result !== undefined && options.insurance_price_result !== null && options.insurance_price_result.visible && (
<InsurancePriceSelector option={ options.insurance_price_result } onOption={ this._handle_onInsurancePriceChange } />
) }
{ options !== undefined && options !== null && options.datefrom !== undefined && options.datefrom !== null && options.datefrom.visible && (
<InsuranceDateFromSelector option={ options.datefrom } onOption={ this._handle_onInsuranceDateFromChange } />
) }
<div className="btn_group">
<button className="button button-gray" onClick={ this._handle_onBack }>Назад</button>
<button className="button button-blue" onClick={ this._handle_onCalculate } disabled={ this._checkAllowCalculate() ? false : true } style={{ minWidth: 350 }}>
{ sending ? (
<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>
<div className="form_field">
<label>Тип каникул</label>
<div className="form_field">
<input type="radio" hidden id="weeekend_type_1" name="weeekend_type" />
<label htmlFor="weeekend_type_1">
Фиксировать послединий платеж
</label>
</div>
<div className="form_field">
<input type="radio" hidden id="weeekend_type_2" name="weeekend_type" />
<label htmlFor="weeekend_type_2">
Фиксировать послединий платеж
</label>
</div>
</div>
<div className="form_field">
<label>Увеличить график на</label>
<select>
<option>1 месяц (37 платеж)</option>
</select>
</div>
<div className="form_field">
<label>Увеличить график на</label>
<input type="number" placeholder="Укажите сумму" />
<div className="help_tooltip">
<div className="help_icon">
<svg width={ 24 } height={ 24 } fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Z" stroke="#8E94A7" strokeWidth={ 2 } strokeLinecap="round" strokeLinejoin="round" />
<path d="M11.25 11.25H12v5.25h.75" stroke="#8E94A7" strokeWidth={ 2 } strokeLinecap="round" strokeLinejoin="round" />
<path d="M12 9a1.125 1.125 0 1 0 0-2.25A1.125 1.125 0 0 0 12 9Z" fill="#8E94A7" />
</svg>
</div>
<div className="help_content ">
{" "}
{/* opened */}
<div>
<p>Какой-то описательный текст</p>
<p className="button">Закрыть</p>
</div>
</div>
</div>
</div>
<div className="btn_group">
<button className="button button-gray" onClick={ this._handle_onBack }>Назад</button>
<button className="button button-blue" onClick={ this._handle_onCalculate }>Рассчитать график</button>
</div>
</form>
</form>
) }
</div>
);
}

View File

@ -45,6 +45,11 @@ export default class VariantsList extends React.Component
return false;
}
_handle_onOptions = () =>
{
this.props.onOptions();
}
render()
{
const { number, variants_types, selected, blocked, loading } = this.props;
@ -53,7 +58,7 @@ export default class VariantsList extends React.Component
<div className="block" style={{ position: "relative" }}>
<p className="title">Варианты изменения графиков</p>
<div style={ loading ? { opacity: 0.5, } : {} }>
<form>
<form onSubmit={ (e) => e.preventDefault() }>
{ variants_types.map((variant, index) =>
{
const disabled = this._checkVariant(variant.type);
@ -61,7 +66,7 @@ export default class VariantsList extends React.Component
<div className="form_field" key={ index }>
<input type="checkbox" hidden id={ `variant_${ index }` } name="variants" disabled={ disabled } checked={ selected.indexOf(variant.type) > -1 ? true : false } onChange={ () => { this._handle_onVariant(variant.type) } }/>
<label htmlFor={ `variant_${ index }` } className="unselectable"
style={ disabled ? { color: "#A8026B", textDecoration: "line-through", } : {} }>{ variant.title }</label>
style={ disabled ? { color: "#A8026B", textDecoration: "line-through", } : {} }>{ variant.title }<br/><small>{ variant.type }</small></label>
<div className="help_tooltip">
<div className="help_icon">
<svg width={ 24 } height={ 24 } fill="none" xmlns="http://www.w3.org/2000/svg" >
@ -82,7 +87,7 @@ export default class VariantsList extends React.Component
</div>
)
}) }
<button className="button button-blue" disabled={ blocked || loading ? true : selected.length > 0 ? false : true }>Далее</button>
<button className="button button-blue" disabled={ blocked || loading ? true : selected.length > 0 ? false : true } onClick={ this._handle_onOptions }>Далее</button>
</form>
</div>
{ loading && (

View File

@ -93,22 +93,6 @@ class ChangeGraphicPage 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";
//
console.log("ChangePage", "MOUNT", "document.location.hash", document.location.hash);
if(document.location.hash !== undefined && document.location.hash !== null && document.location.hash !== "")
{
if (!this.state.loading && this.props.number !== undefined)
@ -158,25 +142,10 @@ class ChangeGraphicPage 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";
}
componentWillUnmount() {}
componentDidUpdate(prevProps, prevState)
{
//console.log("ChangePage", "CDM", "document.location.hash", document.location.hash);
if(document.location.hash)
{
}
@ -202,8 +171,6 @@ class ChangeGraphicPage extends React.Component
this.setState({ variants_selected: selected, variants_loading: true }, () =>
{
console.log(this.state.variants_selected);
const { variants_selected, variants_types } = this.state;
const variants = {};
@ -264,8 +231,6 @@ class ChangeGraphicPage extends React.Component
const { loading, mode_options, mode_comparison, mode_calculation, mode_final, date, car, contract_date, agreement, rules, signer, signatories, calculations, calculation_id, variants, variants_loading, variants_selected, variants_types, variants_unavailable, options, current, calculated, } = this.state;
const { number } = this.props;
console.log("render", "signatories", signatories);
return (
<React.Fragment>
<Head>
@ -285,7 +250,7 @@ class ChangeGraphicPage extends React.Component
{ car !== undefined && car !== null ? ` - ${car.brand.name} ${car.model.name} | ${ car.reg_number !== null ? car.reg_number : "без рег. номера" } | ${ car.vin_number !== null ? car.vin_number : "без VIN номера" }` : "" }
</h5>
</div>
<Company />
<Company { ...this.props }/>
</div>
{ loading ? (
<div className="aside_container about">
@ -323,7 +288,15 @@ class ChangeGraphicPage extends React.Component
<InnerMenu number={ number } { ...this.props } />
<article className="changes">
{ mode_options ? (
<Options onVariants={ this._handle_onVariants } onCalculate={ this._handle_onCalculate }/>
<Options
dispatch={ this.props.dispatch }
number={ number }
variants={ variants }
variants_selected={ variants_selected }
options={ options }
onVariants={ this._handle_onVariants }
onCalculate={ this._handle_onCalculate }
/>
) : (
<>
{ variants !== null && (

View File

@ -83,9 +83,10 @@ class ChangeGraphicComparePage extends React.Component
}
}
render() {
const { loading, date, car, contract_date, agreement, rules } = this.state;
render()
{
const { number } = this.props;
const { loading, date, car, contract_date, agreement, rules } = this.state;
console.log("rules", rules);
@ -108,7 +109,7 @@ class ChangeGraphicComparePage extends React.Component
{ car !== undefined && car !== null ? ` - ${car.brand.name} ${car.model.name} | ${ car.reg_number !== null ? car.reg_number : "без рег. номера" } | ${ car.vin_number !== null ? car.vin_number : "без VIN номера" }` : "" }
</h5>
</div>
<Company />
<Company { ...this.props }/>
</div>
<div className="aside_container about">
<article className="compare">

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,
@ -390,6 +390,7 @@ class ContractDocumentsPage extends React.Component
render()
{
const { number } = this.props;
const {
loading,
date,
@ -407,7 +408,6 @@ class ContractDocumentsPage extends React.Component
penalties_date,
penalties_result,
} = this.state;
const { number } = this.props;
console.log("documentsdocumentsdocumentsdocumentsdocuments");
console.log(documents);
@ -514,7 +514,7 @@ class ContractDocumentsPage extends React.Component
: "" }
</h5>
</div>
<Company />
<Company { ...this.props }/>
</div>
<div className="aside_container about">
<InnerMenu number={ number } { ...this.props }/>
@ -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

@ -63,8 +63,8 @@ class ContractPage extends React.Component
render()
{
const { loading, date, car, contract_date, events_loaded, filtered, } = this.state;
const { number } = this.props;
const { loading, date, car, contract_date, events_loaded, filtered, } = this.state;
//console.log("rules", rules);
@ -84,7 +84,7 @@ class ContractPage extends React.Component
<h1 className="section_title">Договор { number }</h1>
<h5 style={{ fontSize: "14px" }}>{ date !== undefined && date !== null && date !== null && (<> от { moment(date).format("DD.MM.YYYY") }</>)}{ car !== undefined && car !== null ? ` - ${ car.brand.name } ${ car.model.name } | ${ car.reg_number !== null ? car.reg_number : "без рег. номера" } | ${ car.vin_number !== null ? car.vin_number : "без VIN номера" }` : "" }</h5>
</div>
<Company />
<Company { ...this.props }/>
</div>
<div className="aside_container about">
<InnerMenu number={ number } { ...this.props } />

View File

@ -260,9 +260,9 @@ class ContractDocumentsPage extends React.Component
return (
<div className="row" key={index}>
<p
className="doc_name i-pdf i-medium"
data-format={doc.extension}
<p
className="doc_name i-pdf i-medium"
data-format={ doc.extension }
>
{doc.num} от {moment(doc.date).format("DD.MM.YYYY")}
</p>
@ -477,6 +477,7 @@ class ContractDocumentsPage extends React.Component
render()
{
const { number } = this.props;
const {
loading,
date,
@ -491,7 +492,6 @@ class ContractDocumentsPage extends React.Component
reconciliation_disabled,
opened,
} = this.state;
const { number } = this.props;
console.log("documentsdocumentsdocumentsdocumentsdocuments");
console.log(documents);
@ -505,7 +505,7 @@ class ContractDocumentsPage extends React.Component
<title>ЛК Эволюция автолизинга</title>
<meta name="description" content="ЛК Эволюция автолизинга" />
</Head>
<Header {...this.props} />
<Header { ...this.props } />
<main>
<section>
<div className="clear"></div>
@ -530,10 +530,10 @@ class ContractDocumentsPage extends React.Component
: "" }
</h5>
</div>
<Company />
<Company { ...this.props }/>
</div>
<div className="aside_container about">
<InnerMenu number={number} {...this.props} />
<InnerMenu number={ number } { ...this.props }/>
<article>
{ loading ? (
<div
@ -555,84 +555,12 @@ class ContractDocumentsPage extends React.Component
</div>
) : (
<>
<div className="reconciliation_form">
<p>Акт сверки</p>
<div className="form_group">
<div className="form_field">
<DateInput
placeholder="Дата начала периода"
value={period_date_start}
min={valid_date_start}
max={valid_date_end}
onChange={this._handle_onPeriodDate_start}
/>
</div>
<div className="form_field">
<DateInput
placeholder="Дата окончания периода"
value={period_date_end}
min={valid_date_start}
max={valid_date_end}
onChange={this._handle_onPeriodDate_end}
/>
</div>
</div>
<div className="form_group">
<button
className="button button-blue"
disabled={reconciliation_disabled}
onClick={() => {
this._handle_onReconciliationFileRequest();
}}
>
<>
{reconciliation_requested ? (
<SpinnerCircular size={ 24 } thickness={ 100 } speed={ 100 } color="rgba(255, 255, 255, 1)" secondaryColor="rgba(255, 255, 255, 0.5)"/>
) : (
"Скачать"
)}
</>
</button>
{/*<button className="button button-blue">Отправить в ЭДО</button>*/}
</div>
</div>
<div className="dropdown_blocks_list">
{documents !== undefined && documents !== null ? (
<>
{this._renderDocuments(documents.upd, "upd")}
{this._renderDocuments(
documents.upd_avans,
"upd_avans"
)}
{this._renderDocuments(
documents.billfines,
"billfines"
)}
{this._renderFines(documents.fines, "fines")}
</>
) : null}
<div className="block-column">
<div className="dropdown_block ">
<div className="block_header">
<p>Счета-уведомления на пени</p>
</div>
</div>
<div className="block_with_form">
<p>Введите планируемую дату оплаты просроченной задолженности для расчёта пеней</p>
<form className="paymentDateForm">
<div className="form_field">
<DateInput
placeholder="Планируемая дата"
value={period_date_start}
min={valid_date_start}
max={valid_date_end}
onChange={this._handle_onPeriodDate_start}
/>
</div>
<button className="button button-blue">Применить</button>
</form>
</div>
</div>
</div>
</>
) }

View File

@ -100,156 +100,158 @@ class ContractServicesPage extends React.Component {
this.setState({ opened: opened });
};
render() {
const {
opened,
loading,
date,
car,
contract_date,
helpcard,
insurance,
registration,
telematic,
} = this.state;
const { number } = this.props;
render()
{
const { number } = this.props;
const {
opened,
loading,
date,
car,
contract_date,
helpcard,
insurance,
registration,
telematic,
} = this.state;
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">Договор {number}</h1>
<h5 style={{ fontSize: "14px" }}>
{date !== undefined && date !== null && date !== null && (
<> от {moment(date).format("DD.MM.YYYY")}</>
)}
{car !== undefined && car !== null
? ` - ${car.brand.name} ${car.model.name} | ${
car.reg_number !== null
? car.reg_number
: "без рег. номера"
} | ${
car.vin_number !== null
? car.vin_number
: "без VIN номера"
}`
: ""}
</h5>
</div>
<Company />
</div>
<div className="aside_container about">
<InnerMenu number={number} {...this.props} />
<article>
{loading ? (
<div
className="table_row table_header"
style={{
minHeight: 300,
display: "flex",
justifyContent: "center",
alignItems: "center",
}}
>
<SpinnerCircular
size={90}
thickness={51}
speed={100}
color="rgba(28, 1, 169, 1)"
secondaryColor="rgba(236, 239, 244, 1)"
/>
</div>
) : (
<div className="dropdown_blocks_list zero-margin gibdd">
<div className={`dropdown_block open`}>
<div className="block_body full">
<div className="company">
<p className="title lower">Штрафы ГИБДД</p>
<ul>
<li>
Номер постановления: <b>3432434242334</b>
</li>
<li>
Страховая: <b>3 400 000,00 </b>
</li>
<li>
Статус: <b>Оплачен</b>
</li>
<li>
Дата: <b>01/01/2020 </b>
</li>
<li>
Штраф:{" "}
<b>п. 1.15 - Несоблюдение правил парковки </b>
</li>
<li>
<div className="dosc_list medium-icon">
<div className="row">
<p className="doc_name i-pdf extension">
01/20/2020 (.PDF)
<span style={{"width":"100%"}}>
Постановление
</span>
</p>
</div>
<div className="row">
<p className="doc_name i-pdf extension">
Договор
<span style={{"width":"100%"}}>
2021_3866 от 25.06.2021
</span>
</p>
</div>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
)}
</article>
</div>
</div>
</section>
</main>
<Footer />
</React.Fragment>
);
}
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">Договор {number}</h1>
<h5 style={{ fontSize: "14px" }}>
{date !== undefined && date !== null && date !== null && (
<> от {moment(date).format("DD.MM.YYYY")}</>
)}
{car !== undefined && car !== null
? ` - ${car.brand.name} ${car.model.name} | ${
car.reg_number !== null
? car.reg_number
: "без рег. номера"
} | ${
car.vin_number !== null
? car.vin_number
: "без VIN номера"
}`
: ""}
</h5>
</div>
<Company { ...this.props }/>
</div>
<div className="aside_container about">
<InnerMenu number={number} {...this.props} />
<article>
{loading ? (
<div
className="table_row table_header"
style={{
minHeight: 300,
display: "flex",
justifyContent: "center",
alignItems: "center",
}}
>
<SpinnerCircular
size={90}
thickness={51}
speed={100}
color="rgba(28, 1, 169, 1)"
secondaryColor="rgba(236, 239, 244, 1)"
/>
</div>
) : (
<div className="dropdown_blocks_list zero-margin gibdd">
<div className={`dropdown_block open`}>
<div className="block_body full">
<div className="company">
<p className="title lower">Штрафы ГИБДД</p>
<ul>
<li>
Номер постановления: <b>3432434242334</b>
</li>
<li>
Страховая: <b>3 400 000,00 </b>
</li>
<li>
Статус: <b>Оплачен</b>
</li>
<li>
Дата: <b>01/01/2020 </b>
</li>
<li>
Штраф:{" "}
<b>п. 1.15 - Несоблюдение правил парковки </b>
</li>
<li>
<div className="dosc_list medium-icon">
<div className="row">
<p className="doc_name i-pdf extension">
01/20/2020 (.PDF)
<span style={{"width":"100%"}}>
Постановление
</span>
</p>
</div>
<div className="row">
<p className="doc_name i-pdf extension">
Договор
<span style={{"width":"100%"}}>
2021_3866 от 25.06.2021
</span>
</p>
</div>
</div>
</li>
</ul>
</div>
</div>
</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,
helpcard: state.contract.helpcard,
insurance: state.contract.insurance,
registration: state.contract.registration,
telematic: state.contract.telematic,
};
function mapStateToProps(state, ownProps)
{
return {
contract_date: state.contract.date,
date: state.contract.date,
car: state.contract.car,
helpcard: state.contract.helpcard,
insurance: state.contract.insurance,
registration: state.contract.registration,
telematic: state.contract.telematic,
};
}
export const getServerSideProps = reduxWrapper.getServerSideProps(
(store) =>
async ({ req, res, query }) => {
return {
props: {
//number: query.number,
number: null,
},
};
}
(store) =>
async ({ req, res, query }) => {
return {
props: {
//number: query.number,
number: null,
},
};
}
);
export default withRouter(connect(mapStateToProps)(ContractServicesPage));

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));
@ -133,7 +189,7 @@ class ContractSchedulePage extends React.Component
<h1 className="section_title">Договор { number }</h1>
<p className="section_subtitle">{ date !== undefined && date !== null && date !== null && (<> от { moment(date).format("DD.MM.YYYY") }</>)}{ car !== undefined && car !== null ? ` - ${ car.brand.name } ${ car.model.name } | ${ car.reg_number !== null ? car.reg_number : 'без рег. номера' } | ${ car.vin_number !== null ? car.vin_number : 'без VIN номера' }` : '' }</p>
</div>
<Company/>
<Company { ...this.props }/>
</div>
<div className="aside_container about">
<InnerMenu number={ number } { ...this.props }/>
@ -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>
</div>
<div style={{ border: "solid 1px red" }}>
<p><span>Пени:</span> 000 </p>
<button className="button button-blue">Скачать счет</button>
<button className="button button-blue">Рассчитать пени</button>
</div>
{ 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>
) }
{ 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

@ -90,7 +90,7 @@ class ContractPage extends React.Component
<h1 className="section_title">Договор { number }</h1>
<h5 style={{ fontSize: '14px' }}>{ date !== undefined && date !== null && date !== null && (<> от { moment(date).format("DD.MM.YYYY") }</>)}{ car !== undefined && car !== null ? ` - ${ car.brand.name } ${ car.model.name } | ${ car.reg_number !== null ? car.reg_number : 'без рег. номера' } | ${ car.vin_number !== null ? car.vin_number : 'без VIN номера' }` : '' }</h5>
</div>
<Company/>
<Company { ...this.props }/>
</div>
<div className="aside_container about">
<InnerMenu number={ number } { ...this.props }/>

View File

@ -140,7 +140,7 @@ class ContractServicesPage extends React.Component
<h1 className="section_title">Договор { number }</h1>
<h5 style={{ fontSize: '14px' }}>{ date !== undefined && date !== null && date !== null && (<> от { moment(date).format("DD.MM.YYYY") }</>)}{ car !== undefined && car !== null ? ` - ${ car.brand.name } ${ car.model.name } | ${ car.reg_number !== null ? car.reg_number : 'без рег. номера' } | ${ car.vin_number !== null ? car.vin_number : 'без VIN номера' }` : '' }</h5>
</div>
<Company/>
<Company { ...this.props }/>
</div>
<div className="aside_container about">
<InnerMenu number={ number } { ...this.props }/>

View File

@ -244,7 +244,7 @@ class CalendarPage extends React.Component
{/*[{ perweek ? 1 : 0 }, { current_week }, { selected_week }, { weeks_in_month }]*/}
<h1 className="section_title">Календарь оплат</h1>
</div>
<Company/>
<Company { ...this.props }/>
</div>
<div className="aside_container about">
<InnerMenu { ...this.props }/>

View File

@ -94,7 +94,7 @@ class FinalsPage extends React.Component
<div className="left">
<h1 className="section_title">Закрывающие документы</h1>
</div>
<Company/>
<Company { ...this.props }/>
</div>
<div className="aside_container about">
<InnerMenu { ...this.props }/>

View File

@ -234,7 +234,7 @@ class ReconciliationsPage extends React.Component
<div className="left">
<h1 className="section_title">Акты сверок</h1>
</div>
<Company/>
<Company { ...this.props }/>
</div>
<div className="aside_container about">
<InnerMenu { ...this.props }/>

View File

@ -93,7 +93,7 @@ class EventsPage extends React.Component
<div className="left" style={{ flexDirection: "column" }}>
<h1 className="section_title">События</h1>
</div>
<Company />
<Company { ...this.props }/>
</div>
<div className="aside_container about">
<InnerMenu { ...this.props }/>

View File

@ -150,6 +150,7 @@ class IndexPage extends React.Component
render()
{
const { company, loading, page, pages, search, date_from, date_from_type, date_to, date_to_type, contracts, sort_number, sort_date, sort_status, all } = this.state;
const contract_status = {
"Действующий": "opened",
"Закрыт": "closed",
@ -177,7 +178,7 @@ class IndexPage extends React.Component
<h1 className="section_title">Личный кабинет</h1>
</div>
<div className="right">
<Company company={ company }/>
<Company company={ company } { ...this.props }/>
</div>
</div>
<AnnouncementsList />

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>
@ -91,7 +107,7 @@ class IndexPage extends React.Component
<div className="left">
<h1 className="section_title">Личный кабинет</h1>
</div>
<Company/>
<Company { ...this.props }/>
</div>
<div className="aside_container about">
<InnerMenu { ...this.props }/>
@ -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

@ -171,7 +171,7 @@ class IndexPage extends React.Component
<div className="left">
<h1 className="section_title">Смена пароля</h1>
</div>
<Company/>
<Company { ...this.props }/>
</div>
<div className="aside_container about">
<InnerMenu { ...this.props }/>

View File

@ -202,7 +202,7 @@ class IndexPage extends React.Component
<div className="left">
<h1 className="section_title">Вход по номеру телефона</h1>
</div>
<Company/>
<Company { ...this.props }/>
</div>
<div className="aside_container about">
<InnerMenu { ...this.props }/>

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,24 +65,13 @@ 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()
{
const { loading, appeals } = this.state;
const { number } = this.props;
const { loading, appeals } = this.state;
const status = {
active: { title: "Активное", color: "#04A8A4" },
closed: { title: "Закрыто", color: "#000", },
@ -111,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">
@ -119,7 +95,7 @@ class SupportAppealsPage extends React.Component
<div className="left" style={{ flexDirection: "column" }}>
<h1 className="section_title">Мои обращения</h1>
</div>
<Company />
<Company { ...this.props }/>
</div>
<div className="aside_container about">
<InnerMenu { ...this.props } />
@ -134,8 +110,10 @@ class SupportAppealsPage extends React.Component
<div className="appeal_item" key={ index }>
<div className="item_header">
<p>Номер обращения: <b>{ appeal.number } от { moment(appeal.created_date, "YYYY-MM-DD").format("DD.MM.YYYY") }</b></p>
<p>Отвественный ОРК: <b>{ appeal.owner }</b></p>
<p>Договор(ы): <b>{ appeal.contracts }</b></p>
<p>Отвественный сотрудник ОРК: <b>{ appeal.owner }</b></p>
{ appeal.contracts.length > 0 && (
<p>Договор{ appeal.contracts.length > 1 && "ы" }: <b>{ appeal.contracts.map((contract, contract_index) => (<span key={ contract_index }> { contract }{ contract_index < appeal.contracts.length - 1 && ", " }</span>)) }</b></p>
) }
<div className="status" style={{ backgroundColor: status[appeal.status].color }}>{ status[appeal.status].title }</div>
</div>
<div className="item_body">
@ -144,7 +122,7 @@ class SupportAppealsPage extends React.Component
<p>{ appeal.subject }</p>
</div>
<div className="item_text">
<p><b>Текст ответа ОРК</b></p>
<p><b>Ответ ОРК</b></p>
<p>{ appeal.answer === "" ? "Без ответа" : appeal.answer }</p>
{ appeal.documents.length > 0 && (
<div className="dosc_list medium-icon">

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">
@ -130,7 +105,7 @@ class ContractPage extends React.Component
<div className="left" style={{ flexDirection: "column" }}>
<h1 className="section_title">Обращения</h1>
</div>
<Company />
<Company { ...this.props }/>
</div>
<div className="aside_container about">
<InnerMenu { ...this.props } />

View File

@ -159,8 +159,8 @@ class SupportRequestPage extends React.Component
render()
{
const { loading, themes, opened_theme, opened_question } = this.state;
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;
@ -180,7 +180,7 @@ class SupportRequestPage extends React.Component
<button className="back" onClick={ this._handle_onBack }>Назад</button>
<h1 className="section_title">Новое обращение</h1>
</div>
<Company />
<Company { ...this.props }/>
</div>
<div className="aside_container about">
<article className="full">

102
pages/switch.js Normal file
View File

@ -0,0 +1,102 @@
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 { reduxWrapper } from '../store';
import pluralize from 'pluralize-ru';
import { SpinnerCircular } from 'spinners-react';
import Header from './components/Header';
import Footer from './components/Footer';
import MainHeader from "./components/MainHeader";
import FormRequest from "./components/FormRequest";
import { sendOffstageToken, switchAccount } from '../actions';
class SwitchPage extends React.Component
{
constructor(props)
{
super(props);
this.state = {
error: undefined,
};
}
static getDerivedStateFromProps(nextProps, prevState)
{
return {
};
}
componentDidMount()
{
switchAccount({ dispatch: this.props.dispatch, acc_number: this.props.account })
.then(() =>
{
this.setState({ error: false });
})
.catch(() =>
{
this.setState({ error: true });
});
}
render()
{
const { error } = this.state;
return (
<React.Fragment>
<Head>
<title>ЛК Эволюция автолизинга</title>
<meta
name="description"
content="ЛК Эволюция автолизинга"
/>
</Head>
<MainHeader logo_url={ process.env.NEXT_PUBLIC_MAIN_SITE } />
<main>
<section>
<div className="clear"></div>
<div className="container" style={{ width: "100vw", height: "80vh", display: "flex", alignItems: "center", justifyContent: "center", }}>
{ error === true ? (
<p>Предоставленный токен невалиден или аккаунт не найден</p>
) : (
<SpinnerCircular size={90} thickness={51} speed={100} color="rgba(28, 1, 169, 1)" secondaryColor="rgba(236, 239, 244, 1)" />
) }
</div>
</section>
</main>
</React.Fragment>
);
}
}
function mapStateToProps(state, ownProps)
{
return {
}
}
export const getServerSideProps = reduxWrapper.getServerSideProps(store =>
async ({ req, res, query }) =>
{
if(query.account === undefined)
{
res.statusCode = 302;
res.setHeader('Location', `/`);
}
else
{
return {
props: {
account: query.account,
}
}
}
}
);
export default withRouter(connect(mapStateToProps)(SwitchPage));

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

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

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

@ -9,11 +9,17 @@ export const defaultState = {
secondname: "",
phone: "",
},
companies: {
list: null,
},
admin: {
list: null,
},
company: {
title: "",
inn: "",
kpp: "",
ogrn: "",
kpp: "",
ogrn: "",
},
contracts:
{
@ -24,6 +30,8 @@ export const defaultState = {
contract: {
payments: null,
avans: null,
debt: null,
penalty: null,
date: null,
car: null,
insurance: null,

View File

@ -4,21 +4,25 @@ import { createWrapper } from 'next-redux-wrapper';
import authReducer from '../reducers/authReducer';
import userReducer from '../reducers/userReducer';
import companyReducer from '../reducers/companyReducer';
import companiesReducer from '../reducers/companiesReducer';
import contractsReducer from '../reducers/contractsReducer';
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,
user: userReducer,
company: companyReducer,
companies: companiesReducer,
contracts: contractsReducer,
contract: contractReducer,
calendar: calendarReducer,
events: eventsReducer,
support: supportReducer,
admin: adminReducer,
});
const makeStore = (context) =>
@ -36,7 +40,7 @@ const makeStore = (context) =>
const persistConfig = {
key: 'nextjs',
whitelist: [ 'auth', 'user', 'company', ],
whitelist: [ 'auth', 'user', 'company', 'companies' ],
storage
};