SessionExpired.js
4.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
import React, { Component } from 'react'
import ReactModal from 'react-modal';
import {NavLink} from 'react-router-dom';
import * as SelectActionCreators from '../actions/profilationSelect'
import { connect } from 'react-redux';
import endActivation from './img/end_activation.svg'
/*
<div className="Modal Modal-mask modal_repower Modal--save isOpen">
<div className="Modal-wrapper">
<div className="Modal-container" >
*/
class SessionExpired extends Component {
constructor(props) {
super(props);
this.state = {
email:'',
name:'',
privacy:true,
buttonDisabled: true
};
this.handleChange = this.handleChange.bind(this);
this.handleCheckbox = this.handleCheckbox.bind(this);
this.redirect=this.redirect.bind(this)
}
redirect(){
window.location.href='http://www.repower.com'
}
handleCheckbox(e){
const target = e.currentTarget;
this.form.validateFields(target);
const checkbox= !this.state.privacy
const disable= !checkbox
this.setState({
name:this.state.name,
email: this.state.email,
privacy: checkbox,
buttonDisabled: disable
});
console.log('isValid',this.state)
}
handleChange(e) {
const target = e.currentTarget;
this.form.validateFields(target);
const isValid=this.form.fieldsStore.fields.email.warnings.size===0 &&
this.form.fieldsStore.fields.email.errors.size===0 &&
this.state.email!=='' &&
this.form.fieldsStore.fields.name.warnings.size===0 &&
this.form.fieldsStore.fields.name.errors.size===0 &&
this.state.name!==''
const checkbox= this.state.privacy
console.log('isValid',this.form.fieldsStore.fields)
const disable= !isValid
this.setState({
privacy: checkbox,
[target.name]: target.value,
buttonDisabled: disable
});
console.log('isValid',this.state)
}
render(){
return(
<ReactModal
isOpen={true}
onRequestClose={() => this.props.hideModal()}
portalClassName='modal modal-mask modal_repower modal_repower__contact modal_repower__contact_confirm modal-confirm isOpen'
overlayClassName='modal-wrapper'
className='modal-container'
>
<div className="close_modal" onClick={()=>this.props.updateStoreValue('modalOpen',[])}><img src="https://d33wubrfki0l68.cloudfront.net/c0553300c767c895ee4900759828af6476c3e9e9/55953/img/closed_modal.svg" alt="" /></div>
<div class=" modal-header">
<img src={endActivation} alt="" />
<h3> Processo di attivazione scaduto</h3>
</div>
<div class="modal-body">
<p class="modal-description">Sono passati più di 30 giorni e la soluzione energetica che hai
iniziato ad attivare non è più valida. Puoi aggiornare la soluzione per la tua attività e riprendere l'attivazione.</p>
</div>
<div class="modal-footer">
<NavLink to={`/`} activeClassName="active">
<button className="btn btn__red"
onClick={() => this.props.hideModal()}>Aggiorna soluzione
</button>
</NavLink>
</div>
</ReactModal>
)
}
}
const mapStateToProps = state => {
return {
steps:state.ProfilationSelectReducer.steps,
solutions:state.ProfilationSelectReducer.solutions,
modalOpen:state.ProfilationSelectReducer.modalOpen,
modalContacts:state.ProfilationSelectReducer.modalContacts
}};
const mapDispatchToProps = dispatch => ({
updatePropValue: (prop,value,index,complete) =>
dispatch(SelectActionCreators.changeValue(prop,value,index,complete)),
updateStoreValue: (prop,value) =>
dispatch(SelectActionCreators.changeProp(prop,value)),
hideModal: () =>
dispatch(SelectActionCreators.hideModal()),
showModal: (modalName) =>
dispatch(SelectActionCreators.showModal(modalName)),
});
export default connect(mapStateToProps, mapDispatchToProps)(SessionExpired);