diff --git a/src/components/Add_Location.js b/src/components/Add_Location.js
new file mode 100644
index 0000000..e491f09
--- /dev/null
+++ b/src/components/Add_Location.js
@@ -0,0 +1,56 @@
+import React from 'react';
+import PropTypes from 'prop-types';
+import {InputGroup, Label, Input} from 'reactstrap';
+
+const AddLocation = ({ idx, cabRoute, handleRouteChange }) => {
+ const locationId = `location-${idx}`;
+ const creditId = `credit-${idx}`;
+
+ return(
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+AddLocation.propTypes = {
+ idx: PropTypes.number,
+ CabRoute: PropTypes.array,
+ handleRouteChange: PropTypes.func,
+};
+
+export default AddLocation;
diff --git a/src/components/Add_Ride.js b/src/components/Add_Ride.js
new file mode 100644
index 0000000..acc0da9
--- /dev/null
+++ b/src/components/Add_Ride.js
@@ -0,0 +1,141 @@
+import React, { useState, useEffect } from 'react';
+import {Button, InputGroup, Label, Input} from 'reactstrap';
+import AddLocation from './Add_Location';
+import Select from 'react-select';
+import 'bootstrap/dist/css/bootstrap.min.css';
+import './component.css';
+
+function AddRide() {
+ const emptyCabRoute = { location: '', credit: '', sequence_id: '' };
+ const [cabNumberList, setCabNumberList] = useState([]);
+ const [cabNumber, setCabNumber] = useState({label: "Select Vehicle", value: -1, disabled: 'yes'});
+ const [timeSlot, setTimeSlot] = useState('');
+ const [cabRoute, setCabRoute] = useState([{...emptyCabRoute}]);
+ const options = cabNumberList.map((cab_no) => { return {value: [cab_no.id, cab_no.capacity] , label: cab_no.vehicle_number+" [ Capacity : "+cab_no.capacity+" ]" }});
+
+ const addLocation = () => {
+ setCabRoute([...cabRoute,{...emptyCabRoute}]);
+ }
+ // debugger
+ //Hook For Fetching Data Into CabNumberList
+ useEffect(() => {
+ fetch('http://172.60.1.137:3000/cabs',{
+ method: 'GET',
+ headers: {
+ 'Accept': 'application/cab-tab.com; version=1'
+ }
+ })
+ .then((jsonResponse) => {
+ return jsonResponse.json();
+ })
+ .then((parsedResponse) => {
+ setCabNumberList([...parsedResponse.data]);
+ })
+ .catch((error)=>{
+ console.error("Error");
+ })
+ }, []);
+
+ //Handler for Managing Chnages Select DropDown
+ const handleCabChange = (selectedOption) => {
+ setCabNumber(selectedOption)
+ }
+
+ //Handler for Managing Changes in Location and Credit Field
+ const handleRouteChange = (e) => {
+ const updatedRoutes = [...cabRoute];
+ updatedRoutes[e.target.dataset.idx][e.target.dataset.field] = e.target.value;
+ if (e.target.dataset.field === "location")
+ {
+ updatedRoutes[e.target.dataset.idx]['sequence_id'] = parseInt(e.target.dataset.idx) + 1 ;
+ }
+ setCabRoute(updatedRoutes);
+ };
+
+ // Submit Event for Save Ride Button
+ const submit = () => {
+ const rides = {
+ cab_id: cabNumber.value[0],
+ time: timeSlot,
+ routes: cabRoute,
+ available_seats: cabNumber.value[1],
+ };
+ 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(rides),
+ }).then((response) => { console.log(); });
+ };
+
+ // CustomStyle for Select Box Width
+ const customStyles = {
+ container: provided => ({
+ ...provided,
+ width: 300
+ })
+ };
+
+ return (
+
+
+
+
+
Add Ride for Passengers
+
+
+
+
+
+
+
+
+
+
+
+
+
+ setTimeSlot(e.target.value)}
+ />
+
+
+
+
+
+
+
+
+ {
+ cabRoute.map((val, idx) => (
+
)
+ )
+ }
+
+
+
+
+
+
+
+
+ );
+}
+
+export default AddRide;