diff --git a/src/components/Add_Cab.js b/src/components/Add_Cab.js new file mode 100644 index 0000000..137963d --- /dev/null +++ b/src/components/Add_Cab.js @@ -0,0 +1,89 @@ +import React, { useState } from 'react'; +import {Button, InputGroup,Label, Input} from 'reactstrap'; +import 'bootstrap/dist/css/bootstrap.min.css'; +import './component.css'; + +function Add_Cab() { + const [cabNumber, setCabNumber] = useState(''); + const [cabMinPassengerRequired, setCabMinPassengerRequired] = useState(''); + const [cabCapacity, setCabCapacity] = useState(''); + + // Submit Event for Add Cab Button + const submit = () => { + const cab = { + vehicle_number: cabNumber, + capacity: cabCapacity, + min_passengers: cabMinPassengerRequired, + }; + debugger + fetch('http://172.60.1.137:3000/cabs', { + method: 'POST', + headers: { + Accept: 'application/cab-tab.com; version=1', + 'Content-Type': 'application/json', + }, + body: JSON.stringify(cab), + }).then((response) => { console.log(response); }); + }; + + return ( +
+
+
+
+

Add Cab to Organization

+
+
+
+ + + setCabNumber(e.target.value)} + /> + +
+
+ +
+ + + setCabCapacity(e.target.value)} + /> + +
+
+
+ + + setCabMinPassengerRequired(e.target.value)} + /> + +
+
+
+ +
+
+
+
+ ); +} + +export default Add_Cab;