diff --git a/actions/contractActions.js b/actions/contractActions.js index ec04a05..1ca38b8 100644 --- a/actions/contractActions.js +++ b/actions/contractActions.js @@ -609,7 +609,7 @@ export const getContractGraphicChangeGetCurrent = ({ dispatch, number }) => { console.log("ACTION", "getContractGraphicChangeGetCurrent", "response.data", response.data); - dispatch({ type: actionTypes.CONTRACT_CHANGE, data: { current: response.data.planpayments } }); + dispatch({ type: actionTypes.CONTRACT_CHANGE, data: { current: { payments: response.data.planpayments, total: response.data.sum_total } } }); resolve(); }) .catch((error) => @@ -636,7 +636,7 @@ export const getContractGraphicChangeGetCalculated = ({ dispatch, calculation }) { console.log("ACTION", "getContractGraphicChangeGetCalculated", "response.data", response.data); - dispatch({ type: actionTypes.CONTRACT_CHANGE, data: { calculated: response.data.planpayments } }); + dispatch({ type: actionTypes.CONTRACT_CHANGE, data: { calculated: { payments: response.data.planpayments, total: response.data.sum_total } } }); resolve(); }) .catch((error) => diff --git a/actions/supportActions.js b/actions/supportActions.js index a29366c..d3bd3da 100644 --- a/actions/supportActions.js +++ b/actions/supportActions.js @@ -20,6 +20,21 @@ if(process.browser) }; } +function _getMarks(query, content) +{ + let new_content = content; + const search_array = query.split(" "); + for(let s in search_array) + { + const chunk = search_array[s]; + const s_regex = new RegExp(chunk, 'gim'); + + new_content = new_content.replace(s_regex, `${ chunk }`) + } + + return new_content; +} + export const setAppealsRead = ({ dispatch, appeals }) => { return new Promise((resolve, reject) => @@ -90,7 +105,32 @@ export const getSupportThemes = ({ dispatch, query, }) => console.log("getContractRules", "response.data", response.data); if(query !== undefined) { - dispatch({ type: actionTypes.SUPPORT_THEMES_FILTERED, data: { filtered: response.data.themes } }); + const { themes } = response.data; + const themes_filtered = []; + + for(let t in themes) + { + if(themes[t].questions.length > 0) + { + const _theme = { + _name: _getMarks(query, themes[t].name), + questions: [], + }; + + for(let q in themes[t].questions) + { + const _question = themes[t].questions[q]; + _question._title = _getMarks(query, themes[t].questions[q].title); + _question._answer = _getMarks(query, themes[t].questions[q].answer); + + _theme.questions.push(_question); + } + + themes_filtered.push(_theme); + } + } + + dispatch({ type: actionTypes.SUPPORT_THEMES_FILTERED, data: { filtered: themes_filtered } }); } else { diff --git a/pages/components/Header/NotificationsList/index.js b/pages/components/Header/NotificationsList/index.js index 7676e90..5c77599 100644 --- a/pages/components/Header/NotificationsList/index.js +++ b/pages/components/Header/NotificationsList/index.js @@ -15,11 +15,12 @@ export default class NotificationsList extends React.Component render() { const { events } = this.props; + const limit = window.innerWidth > 768 ? 5 : 3; return ( <> Все события diff --git a/pages/contract/change/components/CalculationsList/index.js b/pages/contract/change/components/CalculationsList/index.js index a304b42..abaf257 100644 --- a/pages/contract/change/components/CalculationsList/index.js +++ b/pages/contract/change/components/CalculationsList/index.js @@ -73,10 +73,10 @@ export default class CalculationsList extends React.Component

{ calculation.date_offset_type_comment !== null && (<>{ `${ calculation.date_offset_type_comment.label }: ${ calculation.date_offset_type_comment.value }` }
) } { calculation.number_paydate_comment !== null && (<>{ `${ calculation.number_paydate_comment.label }: ${ calculation.number_paydate_comment.value }` }
) } - { calculation.insurance_price_result_comment !== null && (<>{ calculation.insurance_price_result_comment.label }: { numeral(calculation.insurance_price_result_comment.value).format(' ., ') }  ₽
) } + { calculation.insurance_price_result_comment !== null && (<>{ calculation.insurance_price_result_comment.label }: { calculation.insurance_price_result_comment.value }
) } { calculation.fix_last_payment_available_comment !== null && (<>{ `${ calculation.fix_last_payment_available_comment.label }: ${ calculation.fix_last_payment_available_comment.value ? "да" : "нет" }` }
) } { calculation.period_new_comment !== null && (<>{ `${ calculation.period_new_comment.label }: ${ calculation.period_new_comment.value }` }
) } - { calculation.sum_comment !== null && (<>{ calculation.sum_comment.label }: { numeral(calculation.sum_comment.value).format(' ., ') } ₽
) } + { calculation.sum_comment !== null && (<>{ calculation.sum_comment.label }: { calculation.sum_comment.value }
) }

this._handle_onCalculation(calculation.addcontract_number) }>Подробнее diff --git a/pages/contract/change/components/Comparison/index.js b/pages/contract/change/components/Comparison/index.js index 7101093..4962a9c 100644 --- a/pages/contract/change/components/Comparison/index.js +++ b/pages/contract/change/components/Comparison/index.js @@ -48,11 +48,11 @@ export default class Comparison extends React.Component } const opened = []; - for(let i in current) + for(let i in current.payments) { - if(moment(current[i].plandate) >= today) + if(moment(current.payments[i].plandate) >= today) { - opened.push(current[i].name); + opened.push(current.payments[i].name); break; } } @@ -134,13 +134,11 @@ export default class Comparison extends React.Component if(current !== undefined && current !== null && calculated !== undefined && calculated !== null) { - console.log("_renderMixedPayments", "current.length", current.length, "calculated.length", calculated.length); - - if(current.length > calculated.length) + if(current.payments.length > calculated.payments.length) { return ( <> - { current.map((payment, index) => + { current.payments.map((payment, index) => { if(!show_previous && moment(payment.plandate) < today) { return null; } else @@ -155,15 +153,26 @@ export default class Comparison extends React.Component
Сумма досрочного выкупа { numeral(payment.early_repayment_sum).format(' ., ') } ₽
-
Новый график { calculated[index] !== undefined ? moment(calculated[index].plandate, "YYYY.MM.DD").format("DD.MM.YYYY") : (`-`) }
-
На сумму { calculated[index] !== undefined ? (<>{ numeral(calculated[index].sum).format(' ., ') } ₽) : (`-`) }
-
Сумма досрочного выкупа { calculated[index] !== undefined ? (<>{ numeral(calculated[index].early_repayment_sum).format(' ., ') } ₽) : (`-`) }
+
Новый график { calculated.payments[index] !== undefined ? moment(calculated.payments[index].plandate, "YYYY.MM.DD").format("DD.MM.YYYY") : (`-`) }
+
На сумму { calculated.payments[index] !== undefined ? (<>{ numeral(calculated.payments[index].sum).format(' ., ') } ₽) : (`-`) }
+
Сумма досрочного выкупа { calculated.payments[index] !== undefined ? (<>{ numeral(calculated.payments[index].early_repayment_sum).format(' ., ') } ₽) : (`-`) }
) } }) } +
-1 && "opened" }` } onClick={ () => this._handle_onMixedPayment("mixed_total") }> +

Итого

+
+
+
Текущий график { numeral(current.total).format(' ., ') } ₽
+
+
+
Новый график { numeral(calculated.total).format(' ., ') } ₽
+
+
+
) } @@ -171,7 +180,7 @@ export default class Comparison extends React.Component { return ( <> - { calculated.map((payment, index) => + { calculated.payments.map((payment, index) => { if(!show_previous && moment(payment.plandate) < today) { return null; } else @@ -181,9 +190,9 @@ export default class Comparison extends React.Component

Платеж №{ payment.name }

-
Текущий график { current[index] !== undefined ? moment(current[index].plandate, "YYYY.MM.DD").format("DD.MM.YYYY") : (`-`) }
-
На сумму { current[index] !== undefined ? (<>{ numeral(current[index].sum).format(' ., ') } ₽) : (`-`) }
-
Сумма досрочного выкупа { current[index] !== undefined ? (<>{ numeral(current[index].early_repayment_sum).format(' ., ') } ₽) : (`-`) }
+
Текущий график { current.payments[index] !== undefined ? moment(current.payments[index].plandate, "YYYY.MM.DD").format("DD.MM.YYYY") : (`-`) }
+
На сумму { current.payments[index] !== undefined ? (<>{ numeral(current.payments[index].sum).format(' ., ') } ₽) : (`-`) }
+
Сумма досрочного выкупа { current.payments[index] !== undefined ? (<>{ numeral(current.payments[index].early_repayment_sum).format(' ., ') } ₽) : (`-`) }
Новый график { moment(payment.plandate, "YYYY.MM.DD").format("DD.MM.YYYY") }
@@ -195,6 +204,17 @@ export default class Comparison extends React.Component ) } }) } +
-1 && "opened" }` } onClick={ () => this._handle_onMixedPayment("mixed_total") }> +

Итого

+
+
+
Текущий график { numeral(current.total).format(' ., ') } ₽
+
+
+
Новый график { numeral(calculated.total).format(' ., ') } ₽
+
+
+
) } @@ -213,18 +233,19 @@ export default class Comparison extends React.Component

Выбранный(ые) варианты изменения графика

Вернуться к параметрам изменения графика + {/*} + {*/}
{ calculation !== undefined && calculation !== null && calculation.fix_last_payment_available_comment !== null && (
- - +

{ calculation.fix_last_payment_available_comment.label }: { calculation.fix_last_payment_available_comment.value ? "Да" : "Нет" }

) } { calculation !== undefined && calculation !== null && calculation.date_offset_type_comment !== null && (
- +
) } @@ -286,7 +307,7 @@ export default class Comparison extends React.Component
) } - { current !== undefined && current !== null && current.map((payment, index) => + { current !== undefined && current !== null && current.payments.map((payment, index) => { if(!show_previous && moment(payment.plandate) < today) { return null; } @@ -299,6 +320,14 @@ export default class Comparison extends React.Component
) }) } + { current !== undefined && current !== null && ( +
+
+
Итого
+
{ numeral(current.total).format(' ., ') } ₽
+
+
+ ) }
@@ -321,7 +350,7 @@ export default class Comparison extends React.Component
) } - { calculated !== undefined && calculated !== null && calculated.map((payment, index) => + { calculated !== undefined && calculated !== null && calculated.payments.map((payment, index) => { if(!show_previous && moment(payment.plandate) < today) { return null; } @@ -334,6 +363,14 @@ export default class Comparison extends React.Component ) }) } + { calculated !== undefined && calculated !== null && ( +
+
+
Итого
+
{ numeral(calculated.total).format(' ., ') } ₽
+
+
+ ) }
diff --git a/pages/contract/change/components/Options/index.js b/pages/contract/change/components/Options/index.js index c0b22b7..4ebd952 100644 --- a/pages/contract/change/components/Options/index.js +++ b/pages/contract/change/components/Options/index.js @@ -17,6 +17,7 @@ class PaymentDate extends React.Component value: null, min: null, max: null, + help: false, } } @@ -44,6 +45,14 @@ class PaymentDate extends React.Component }); } + _handle_onMobileHelp = () => + { + if(window.innerWidth < 768) + { + this.setState({ help: this.state.help ? false : true }); + } + } + render() { const { option } = this.props; @@ -74,6 +83,7 @@ class FixLastPayment extends React.Component super(props); this.state = { value: false, + help: false, }; } @@ -99,10 +109,18 @@ class FixLastPayment extends React.Component }); } + _handle_onMobileHelp = () => + { + if(window.innerWidth < 768) + { + this.setState({ help: this.state.help ? false : true }); + } + } + render() { const { option } = this.props; - const { value } = this.state; + const { value, help } = this.state; return (
@@ -112,19 +130,17 @@ class FixLastPayment extends React.Component { option.information !== undefined && option.information !== null && (
-
+
this._handle_onMobileHelp() }>
-
- {" "} - {/* opened */} +

-

Закрыть

+

this._handle_onMobileHelp() }>Закрыть

@@ -269,6 +285,7 @@ class SumSelector extends React.Component value: "", min: null, max: null, + help: false, } } @@ -305,10 +322,18 @@ class SumSelector extends React.Component } } + _handle_onMobileHelp = () => + { + if(window.innerWidth < 768) + { + this.setState({ help: this.state.help ? false : true }); + } + } + render() { const { option } = this.props; - const { value, min, max } = this.state; + const { value, min, max, help } = this.state; return (
@@ -320,19 +345,17 @@ class SumSelector extends React.Component
{ option.information !== undefined && option.information !== null && (
-
+
this._handle_onMobileHelp() }>
-
- {" "} - {/* opened */} +

-

Закрыть

+

this._handle_onMobileHelp() }>Закрыть

@@ -351,6 +374,7 @@ class InsurancePriceSelector extends React.Component value: "", min: null, max: null, + help: false, } } @@ -395,10 +419,18 @@ class InsurancePriceSelector extends React.Component //} } + _handle_onMobileHelp = () => + { + if(window.innerWidth < 768) + { + this.setState({ help: this.state.help ? false : true }); + } + } + render() { const { option } = this.props; - const { value, min, max } = this.state; + const { value, min, max, help } = this.state; return (
@@ -416,19 +448,17 @@ class InsurancePriceSelector extends React.Component
{ option.information !== undefined && option.information !== null && (
-
+
this._handle_onMobileHelp() }>
-
- {" "} - {/* opened */} +

-

Закрыть

+

this._handle_onMobileHelp() }>Закрыть

@@ -593,7 +623,7 @@ export default class Options extends React.Component { this.setState({ sending: false, }, () => { - alert("К сожаление при расчете возникла ошибка."); + alert("К сожалению при расчете возникла ошибка."); }); }); }); diff --git a/pages/contract/change/components/VariantsList/index.js b/pages/contract/change/components/VariantsList/index.js index 9d2b544..07ef201 100644 --- a/pages/contract/change/components/VariantsList/index.js +++ b/pages/contract/change/components/VariantsList/index.js @@ -68,19 +68,21 @@ export default class VariantsList extends React.Component _handle_onMobileHelp = (index) => { - console.log("_handle_onMobileHelp", index); - const opened = [ ...this.state.opened ]; + if(window.innerWidth < 768) + { + const opened = [ ...this.state.opened ]; - if (opened.indexOf(index) === -1) - { - opened.push(index); - } - else - { - opened.splice(opened.indexOf(index), 1); + if (opened.indexOf(index) === -1) + { + opened.push(index); + } + else + { + opened.splice(opened.indexOf(index), 1); + } + + this.setState({ opened: opened }); } - - this.setState({ opened: opened }); } render() diff --git a/pages/contract/change/index.js b/pages/contract/change/index.js index a653fc2..a3dd62c 100644 --- a/pages/contract/change/index.js +++ b/pages/contract/change/index.js @@ -227,7 +227,7 @@ class ChangeGraphicPage extends React.Component { this.setState({ loading: false, }, () => { - alert("К сожаление при формировании документа возникла ошибка."); + alert("К сожалению при формировании документа возникла ошибка."); }); }); }); diff --git a/pages/settings/components/InnerMenu/index.js b/pages/settings/components/InnerMenu/index.js index 1df05f6..e928613 100644 --- a/pages/settings/components/InnerMenu/index.js +++ b/pages/settings/components/InnerMenu/index.js @@ -64,7 +64,7 @@ export default class InnerMenu extends React.Component render() { const { user, observer } = this.props; - const { menu, menuOpened, } = this.state; + const { menuOpened, } = this.state; return (

Ответ службы клиентского сервиса

-

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

+

") }}>

{ appeal.documents.length > 0 && (
{ appeal.documents.map((file, index) => { if(file.doc_direction !== "outgoing") { return null; } - return () + return () }) }
) } diff --git a/pages/support/components/RequestFile/index.js b/pages/support/components/RequestFile/index.js index c856bfc..f7f1b02 100644 --- a/pages/support/components/RequestFile/index.js +++ b/pages/support/components/RequestFile/index.js @@ -15,14 +15,14 @@ export default class RequestFile extends React.Component _handle_onDownloadFile = () => { - const { id, filename } = this.props; + const { file } = this.props; const { downloading } = this.state; if(!downloading) { this.setState({ downloading: true }, () => { - getFile({ id, filename }) + getFile({ id: file.doc_url, filename: `${ file.doc_name }.${ file.doc_extension }` }) .then(() => { this.setState({ downloading: false }); }) .catch(() => { this.setState({ downloading: false }); }); }); @@ -31,15 +31,15 @@ export default class RequestFile extends React.Component render() { - const { filename, extension, title } = this.props; + const { file } = this.props; const { downloading } = this.state; return (
-

- { filename } +

+ { file.doc_name } - { title ? title : "Скачать шаблон" } { downloading ? () : null } + Скачать документ { downloading ? () : null }

diff --git a/pages/support/index.js b/pages/support/index.js index 487772e..73b876b 100644 --- a/pages/support/index.js +++ b/pages/support/index.js @@ -20,7 +20,7 @@ import { resetFilteredThemes, } from "../../actions"; -class ContractPage extends React.Component +class SupportPage extends React.Component { constructor(props) { @@ -248,8 +248,8 @@ class ContractPage extends React.Component (
-

-

+

+

{/*}

К каждой теме свободное html поле для миниинструкции (со ссылками на формы документов и документы). Привязка к теме обращения в CRM

{*/} @@ -343,4 +343,4 @@ export const getServerSideProps = reduxWrapper.getServerSideProps( } ); -export default withRouter(connect(mapStateToProps)(ContractPage)); +export default withRouter(connect(mapStateToProps)(SupportPage)); diff --git a/store/index.js b/store/index.js index 8817d1e..a1ed84d 100644 --- a/store/index.js +++ b/store/index.js @@ -43,7 +43,7 @@ const makeStore = (context) => const storage = require('redux-persist/lib/storage').default; const persistConfig = { - key: 'nextjs', + key: 'lkevoleasing', whitelist: [ 'auth', 'user', 'company', 'companies', 'contracts_info', 'contract_events' ], storage };