import {
SETTINGS_REQUEST,
SETTINGS_SUCCESS,
SETTINGS_FAILURE,
SETTINGS_DROPDOWN_SELECT,
SETTINGS_DEFAULT_VALUE_SELECT,
SETTINGS_SAVE_SUCCESS,
SETTINGS_CHANGE_VALUE_STORE
} from "../../constants/settings/settings.constants"
import {LOGOUT} from "../../constants/auth.constants"
import {history} from "../../history"
import {requestPost, requestGet, requestPostGet} from "../../api/request"
export const getPersonSettings = () => {
return dispatch => {
requestGet('Settings/GetPersonSettings')
.then(resp => {
resp.status === 200
? dispatch({ type: SETTINGS_SUCCESS, payload: resp.data, loading: false })
: dispatch({ type: SETTINGS_FAILURE, error: resp.status })
})
.catch(error => {
if ([401, 403, 500].indexOf(error.response.status) !== -1) {
dispatch({ type: LOGOUT })
history.push('/')
}
dispatch({ type: SETTINGS_FAILURE, error })
})
dispatch({type: SETTINGS_REQUEST })
}
}
export const savePersonalInformation = ({...params}) => {
const {settingsName, settingsSurname, settingsBirthday, settingsPassport, settingsCountry, settingsCity, settingsAddress_1, zip, prefix, phone} = params
let personalInformation = {
FirstName: settingsName || null,
LastName: settingsSurname || null,
BirthDateStr: settingsBirthday || null,
PersonalDocument: settingsPassport || null,
DictionaryCountryId: Number(settingsCountry) || null,
City: settingsCity || null,
Address: settingsAddress_1 || null,
Zip: zip || null,
PhonePrefix: String(prefix) || null,
Phone: phone || null
}
return dispatch => {
requestPost('Settings/ChangePersonalInformation', personalInformation)
.then(resp => {
dispatch({ type: SETTINGS_SAVE_SUCCESS, loading: true })
})
.catch(error => {
dispatch({ type: SETTINGS_FAILURE, error })
})
dispatch({type: SETTINGS_REQUEST })
}
}
import {SETTINGS_REQUEST, SETTINGS_SUCCESS, SETTINGS_FAILURE, SETTINGS_SAVE_SUCCESS} from '../../constants/settings/settings.constants'
const initialState = {
fields: {
personInformationForm: {
settingsName: {
id: 'settingsName',
name: 'settingsName',
type: 'text',
required: true,
label: 'Имя',
edit: false
},
settingsSurname: {
id: 'settingsSurname',
name: 'settingsSurname',
type: 'text',
required: true,
label: 'Фамилия',
description: 'Вы можете изменить имя и фамилию до тех пор, пока не прошли идентификацию личности Veriff',
edit: false
},
email: {
id: 'email',
name: 'email',
type: 'email',
required: true,
label: 'Электронная почта',
description: 'Чтобы изменить адрес электронной почты обратитесь в службу поддержки',
edit: false
},
prefix: {
id: 'prefix',
name: 'prefix',
options: [
{id: 43, value: '+43 AT' },
...
{id: 372, value: '+372 EE' }
],
value: '+43 AT',
labelHidden: true
},
phone: {
id: 'phone',
name: 'phone',
type: 'phone',
required: true,
label: 'Контактный телефон',
description: 'Чтобы изменить контактный телефон обратитесь в службу поддержки',
edit: false
},
settingsBirthday: {
id: 'settingsBirthday',
name: 'settingsBirthday',
type: 'text',
required: true,
label: 'Дата рождения',
edit: true
},
settingsPassport: {
id: 'settingsPassport',
name: 'settingsPassport',
type: 'text',
required: true,
label: 'Серия и номер документа',
edit: true
},
settingsCountry: {
id: 'settingsCountry',
name: 'settingsCountry',
options: [
{id: 208, value: 'Бельгия' },
...
{id: 267, value: 'Эстония' }
],
value: 208,
label: 'Страна'
},
settingsCity: {
id: 'settingsCity',
name: 'settingsCity',
type: 'text',
required: false,
label: 'Город',
edit: true
},
settingsAddress_1: {
id: 'settingsAddress_1',
name: 'settingsAddress_1',
type: 'text',
required: false,
label: 'Адрес 1',
edit: true
},
zip: {
id: 'zip',
name: 'zip',
type: 'text',
required: false,
label: 'ZIP',
edit: true
}
}
}
}
const settings = (state = initialState, action) => {
switch (action.type) {
case SETTINGS_REQUEST:
return {...state, loading: true }
case SETTINGS_SUCCESS:
const {
settingsName,
settingsSurname,
email,
prefix,
phone,
settingsBirthday,
settingsPassport,
settingsCountry,
settingsCity,
settingsAddress_1,
zip
} = action.payload.personInformation
return {
...state,
fields: {
...state.fields,
personInformationForm: {
...state.fields.personInformationForm,
settingsName: {
...state.fields.personInformationForm.settingsName,
value: settingsName
},
settingsSurname: {
...state.fields.personInformationForm.settingsSurname,
value: settingsSurname
},
email: {
...state.fields.personInformationForm.email,
value: email
},
prefix: {
...state.fields.personInformationForm.prefix,
value: Number(prefix) || 43
},
phone: {
...state.fields.personInformationForm.phone,
value: phone
},
settingsBirthday: {
...state.fields.personInformationForm.settingsBirthday,
value: settingsBirthday
},
settingsPassport: {
...state.fields.personInformationForm.settingsPassport,
value: settingsPassport
},
settingsCountry: {
...state.fields.personInformationForm.settingsCountry,
value: Number(settingsCountry)
},
settingsCity: {
...state.fields.personInformationForm.settingsCity,
value: settingsCity
},
settingsAddress_1: {
...state.fields.personInformationForm.settingsAddress_1,
value: settingsAddress_1
},
zip: {
...state.fields.personInformationForm.zip,
value: zip
}
}
},
loading: action.loading
}
case SETTINGS_FAILURE:
return {...state, error: action.error, loading: false }
case SETTINGS_SAVE_SUCCESS:
return {...state, loading: action.loading }
default:
return state
}
}
export default settings
import React, {Component, createRef} from 'react';
import Input from '../components/UI/Input';
import Tabs from '../components/UI/Tabs';
import Checkbox from '../components/UI/Checkbox';
import {connect} from 'react-redux';
import {getPersonSettings, toggleSelect, changeDefaultValue, changeValueStore, savePersonalInformation} from '../redux/actions/settings/settings.actions';
import Spinner from '../components/UI/Spinner';
import {Field, reduxForm, change, getFormValues} from 'redux-form'
import FormComponent from '../components/UI/Forms';
import RenderTabs from '../components/UI/Tabs-new';
import {compose} from 'redux';
import PersonInformationForm from '../components/UI/formControls/settings/personInformation.form';
class Settings extends Component {
componentDidMount() {
this.props.getPersonSettings()
}
sumbitPersonInformationForm(values) {
const {settingsCountry, prefix} = this.props.selects
const {settingsName, settingsSurname, settingsBirthday, settingsPassport, settingsCity, settingsAddress_1, zip, phone} = values
const phoneFull = String(prefix ? prefix.id : this.props.state.fields.personInformationForm.prefix.value) + phone
this.props.savePersonalInformation({
settingsName,
settingsSurname,
settingsBirthday,
settingsPassport,
settingsCountry: settingsCountry ? settingsCountry.id : this.props.state.fields.personInformationForm.settingsCountry.value,
settingsCity,
settingsAddress_1,
zip,
prefix: prefix ? prefix.id : this.props.state.fields.personInformationForm.prefix.value,
phone: this.props.state.fields.personInformationForm.phone.value ? phone : phoneFull
})
this.props.getPersonSettings()
}
render() {
return (
<main className="depositing">
<h1 className="container">Мой аккаунт</h1>
{
this.props.data.loading !== undefined
? this.props.data.loading
? <Spinner />
: <section className="tabs js-tabs">
<RenderTabs page={'settings'} id='settingsTabs'>
<PersonInformationForm onSubmit={this.sumbitPersonInformationForm.bind(this)} fields={this.props.state.fields} />
<div>Test</div>
</RenderTabs>
</section>
: null
}
</main>
)
}
}
const MSTP = state => {
return {
MSTPState: state,
data: state.settings,
state: state.settings,
selects: state.forms.selects
}
}
const MDTP = dispatch => {
return {
getPersonSettings: () => dispatch(getPersonSettings()),
//changeValueStore: values => dispatch(changeValueStore(values)),
savePersonalInformation: personInformation => dispatch(savePersonalInformation(personInformation))
}
}
export default connect(MSTP, MDTP)(Settings)
import React, {useEffect} from 'react'
import {Field, reduxForm, change, getFormValues} from 'redux-form'
import {compose} from 'redux'
import {connect} from 'react-redux'
import RenderInput from '../../formComponents/RenderInput'
import RenderSelect from '../../formComponents/RenderSelect'
import RenderPhone from '../../formComponents/RenderPhone'
const PersonInformationForm = props => {
const fieldID = props.fields[props.form]
useEffect(() => {
for (let key in fieldID)
props.change(fieldID[key].id, fieldID[key].value)
}, [])
return (
<>
<form id='personal_button' onSubmit={props.handleSubmit} className="settings__form columns_2">
<div className="box card">
<h3 className="box__heading">Личные данные</h3>
<RenderInput data={fieldID['settingsName']} />
<RenderInput data={fieldID['settingsSurname']} />
<RenderInput data={fieldID['email']} />
<RenderPhone dataSelect={fieldID['prefix']} dataInput={fieldID['phone']} />
<RenderInput data={fieldID['settingsBirthday']} />
<RenderInput data={fieldID['settingsPassport']} />
</div>
<div className="box card">
<h3 className="box__heading">Адрес проживания</h3>
<RenderSelect data={fieldID['settingsCountry']} />
<RenderInput data={fieldID['settingsCity']} />
<RenderInput data={fieldID['settingsAddress_1']} />
<RenderInput data={fieldID['zip']} />
</div>
</form>
<div className="fixed">
<div className="container">
<button id="btn_person_save" form="personal_button" className="button settings__button">Сохранить</button>
</div>
</div>
</>
)
}
export default reduxForm({form: 'personInformationForm' })(PersonInformationForm)
import axios from "axios";
export const requestPost = async (url, params = { }) => {
return await axios.post(url, params)
}
export const requestGet = async (url) => {
return await axios.get(url)
}
export const requestAll = async ([...url]) => {
return await axios.all([
axios.get(url[0]),
axios.post(url[1])
])
}
<credit-picker _ngcontent-ntx-c8="" _nghost-ntx-c9="" ng-reflect-credit_data="[object Object]">
<pickerview _ngcontent-ntx-c9="" ng-reflect-data="[object Object],[object Object" ng-reflect-cascade="false" ng-reflect-model="7000 руб,на,20 дней" class="ng-untouched ng-pristine ng-valid">
<div class="am-picker" style="flex-direction: row; align-items: center;">
<!--bindings={"ng-reflect-ng-for-of": "[object Object],[object Object"}-->
<div class="am-picker-col">
<div class="am-picker-col-indicator " ng-reflect-ng-style="[object Object]"></div>
<div class="am-picker-col-mask" style="background-size: 100% 102px;" id="0"></div>
<div class="am-picker-col-content" style="transition: transform 0.3s ease 0s; transform: translateY(-102px);">
<!--bindings={
"ng-reflect-ng-for-of": "[object Object],[object Object"}-->
<div class="am-picker-col-item" ng-reflect-ng-style="[object Object]" id="0"> 5500 руб </div
div class="am-picker-col-item" ng-reflect-ng-style="[object Object]" id="1"> 6000 руб </div>
<div class="am-picker-col-item" ng-reflect-ng-style="[object Object]" id="2"> 6500 руб </div>
<div class="am-picker-col-item" ng-reflect-ng-style="[object Object]" id="3"> 7000 руб </div>
<div class="am-picker-col-item" ng-reflect-ng-style="[object Object]" id="4"> 7500 руб </div>
<div class="am-picker-col-item" ng-reflect-ng-style="[object Object]" id="5"> 8000 руб </div>
</div>
</div>
<div class="am-picker-col">
<div class="am-picker-col-indicator " ng-reflect-ng-style="[object Object]"></div>
<div class="am-picker-col-mask" style="background-size: 100% 102px;" id="1"></div>
<div class="am-picker-col-content" style="transition: transform 0.3s ease 0s; transform: translateY(0px);">
<!--bindings={"ng-reflect-ng-for-of": "[object Object]"}-->
<div class="am-picker-col-item" ng-reflect-ng-style="[object Object]" id="0"> на </div>
</div>
</div>
<div class="am-picker-col">
<div class="am-picker-col-indicator " ng-reflect-ng-style="[object Object]"></div>
<div class="am-picker-col-mask" style="background-size: 100% 102px;" id="2"></div>
<div class="am-picker-col-content" style="transition: transform 0.3s ease 0s; transform: translateY(-340px);"><!--bindings={"ng-reflect-ng-for-of": "[object Object],[object Object"}-->
<div class="am-picker-col-item" ng-reflect-ng-style="[object Object]" id="0"> 10 дней </div>
<div class="am-picker-col-item" ng-reflect-ng-style="[object Object]" id="1"> 11 дней </div>
<div class="am-picker-col-item" ng-reflect-ng-style="[object Object]" id="2"> 12 дней </div>
<div class="am-picker-col-item" ng-reflect-ng-style="[object Object]" id="3"> 13 дней </div>
<div class="am-picker-col-item" ng-reflect-ng-style="[object Object]" id="4"> 14 дней </div>
<div class="am-picker-col-item" ng-reflect-ng-style="[object Object]" id="5"> 15 дней </div>
<div class="am-picker-col-item" ng-reflect-ng-style="[object Object]" id="6"> 16 дней </div>
<div class="am-picker-col-item" ng-reflect-ng-style="[object Object]" id="7"> 17 дней </div>
<div class="am-picker-col-item" ng-reflect-ng-style="[object Object]" id="8"> 18 дней </div>
<div class="am-picker-col-item" ng-reflect-ng-style="[object Object]" id="9"> 19 дней </div>
<div class="am-picker-col-item" ng-reflect-ng-style="[object Object]" id="10"> 20 дней </div>
<div class="am-picker-col-item" ng-reflect-ng-style="[object Object]" id="11"> 21 дней </div>
<div class="am-picker-col-item" ng-reflect-ng-style="[object Object]" id="12"> 22 дней </div>
<div class="am-picker-col-item" ng-reflect-ng-style="[object Object]" id="13"> 23 дней </div>
<div class="am-picker-col-item" ng-reflect-ng-style="[object Object]" id="14"> 24 дней </div>
<div class="am-picker-col-item" ng-reflect-ng-style="[object Object]" id="15"> 25 дней </div>
<div class="am-picker-col-item" ng-reflect-ng-style="[object Object]" id="16"> 26 дней </div>
<div class="am-picker-col-item" ng-reflect-ng-style="[object Object]" id="17"> 27 дней </div>
<div class="am-picker-col-item" ng-reflect-ng-style="[object Object]" id="18"> 28 дней </div>
<div class="am-picker-col-item" ng-reflect-ng-style="[object Object]" id="19"> 29 дней </div>
<div class="am-picker-col-item" ng-reflect-ng-style="[object Object]" id="20"> 30 дней </div>
</div>
</div>
</div>
</pickerview>
<ion-item _ngcontent-ntx-c9="" class="item-label item md in-list ion-focusable hydrated">
<ion-label _ngcontent-ntx-c9="" class="sc-ion-label-md-h sc-ion-label-md-s md hydrated">К возврату</ion-label>
<ion-note _ngcontent-ntx-c9="" color="danger" slot="end" ng-reflect-color="danger" class="ion-color ion-color-danger md hydrated">₽8,400.00</ion-note>
</ion-item>
<ion-item _ngcontent-ntx-c9="" class="item-label item md in-list ion-focusable hydrated">
<ion-label _ngcontent-ntx-c9="" class="sc-ion-label-md-h sc-ion-label-md-s md hydrated">Дата возврата</ion-label>
<ion-note _ngcontent-ntx-c9="" color="danger" slot="end" ng-reflect-color="danger" class="ion-color ion-color-danger md hydrated">09.02.2020</ion-note>
</ion-item>
</credit-picker>
<ion-header>
<ion-toolbar>
<ion-buttons slot="start">
<ion-back-button defaultHref="{{defRef}}" icon="./assets/img/login/arrow-back.svg"></ion-back-button>
</ion-buttons>
<ion-title class="header-title">{{header}}</ion-title>
</ion-toolbar>
</ion-header>
<ion-content fullscreen>
<ion-list class="flex-sb" lines="none">
<ion-list-header *ngIf="defRef == 'person-job'" >
<ion-label>Хочу занять</ion-label>
<ion-label style="display: block;" text-wrap>{{credit_data.sum_value}} руб. на {{credit_data. day_value}} дней</ion-label>
</ion-list-header>
<credit-picker [credit_data]="credit_data" ></credit-picker>
<ion-button *ngIf="defRef != 'person-job'" class="button-global" expand="block" (click)="takeCredit()">Получить деньги</ion-button>
<ion-button *ngIf="defRef == 'person-job'" expand="block" color="secondary" (click)="submitCredit()">Отправить заявку</ion-button>
</ion-list>
</ion-content>
$(window).scroll(function(){
scroll = $(window).scrollTop();
if (scroll > 500) {
$('.logo').addClass('logo_active');
$('#navbar-btn').hide();
} else {
$('.logo').removeClass('logo_active');
$('#navbar-btn').show();
}
});
Проблема возникает тогда, когда нужно изменить на одном сайте и это изменилось на втором. Так как могут быть большие изменения и вносить их туда и туда, времени уйдет в 2 раза больше.