-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAddInfermiaModal.js
94 lines (79 loc) · 3.2 KB
/
AddInfermiaModal.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import React,{Component} from 'react';
import {Modal,Button, Row, Col, Form} from 'react-bootstrap';
export class AddInfiermeriaModal extends Component{
constructor(props){
super(props);
this.handleSubmit=this.handleSubmit.bind(this);
}
handleSubmit(event){
event.preventDefault();
fetch('https://localhost:7222/api/infiermeria',{
method:'POST',
headers:{
'Accept':'application/json',
'Content-Type':'application/json'
},
body:JSON. stringify({
InfiermeriaID:event.target.InfiermeriaID.value,
SektoriID:event.target.SektoriID.value,
Kapaciteti:event.target.Kapaciteti.value
})
})
.then(res=>res.json())
.then((result)=>{
alert(result);
},
(error)=>{
alert('Failed');
})
}
render(){
return(
<div className='container'>
<Modal className='shtoModal'
{...this.props}
size="lg"
aria-labelledy="contained-modal-title-vcenter"
centered
>
<Modal.Header clooseButton >
<Modal.Title id="contained-modal-title-vcenter">
Shto Infiermerin
</Modal.Title>
</Modal.Header>
<Modal.Body>
<Row>
<Col sm={8}>
<Form onSubmit={this.handleSubmit}>
<Form.Group controlId="InfiermeriaID">
<Form.Label>InfiermeriaID</Form.Label>
<Form.Control type="text" name="InfiermeriaID"
required placeholder="InfiermeriaID"/>
</Form.Group>
<Form.Group controlId="SektoriID">
<Form.Label> SektoriID</Form.Label>
<Form.Control type="text" name="SektoriID"
required placeholder="SektoriID"/>
</Form.Group>
<Form.Group controlId="Kapaciteti">
<Form.Label>pKapaciteti</Form.Label>
<Form.Control type="text" name="Kapaciteti"
required placeholder="kapaciteti"/>
</Form.Group>
<Form.Group>
<Button variant="primary" type="submit">
Shto Infiermerin
</Button>
</Form.Group>
</Form>
</Col>
</Row>
</Modal.Body>
<Modal.Footer>
<Button variant="danger" onClick={this.props.onHide}>Close</Button>
</Modal.Footer>
</Modal>
</div>
)
}
}