-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
73 lines (71 loc) · 1.69 KB
/
App.js
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
import React, { Component } from 'react';
import './App.css';
import Login from './Form/Login.js';
import Table from './Form/Table.js';
import Details from './Form/Details.js';
import './css/bootstrap.min.css';
import swal from 'sweetalert';
class App extends Component {
constructor()
{
super();
this.state={
array:[],
admin:'[email protected]',
password:'admin',
u1:'',
p1:'',
login:false,
details:false,
FirstName:'',
LastName:'',
Salary:'',
Email:'',
JobStartDate:'JobstartDate...',
fn:''
};
this.Verify=this.Verify.bind(this);
this.Detail=this.Detail.bind(this);
this.Info=this.Info.bind(this);
}
Verify(user,pass){
if(user=='[email protected]' && pass=='admin')
{
this.setState({
login:true
});
swal('Access','Sorry','success')
}
else
{
swal('NotAccess','Sorry','error')
}
}
Detail(get){
this.setState({
details:get
});
}
Info(f,l,s,e,j){
const {array}=this.state;
array.push({
FirstName:f,LastName:l,Salary:s,Email:e,JobStartDate:j
});
this.setState({
array
});
}
render() {
const {login,details,array}=this.state;
return (
<div className="App">
<header className="App-header">
{!login && <Login Login={this.Verify}/>}
{login && !details && <Table taking={array} Information={this.Detail}/>}
{login && details && <Details Information={this.Detail} Info={this.Info}/>}
</header>
</div>
);
}
}
export default App;