Skip to content

Commit

Permalink
Merge pull request #2 from coronasafe/develop
Browse files Browse the repository at this point in the history
merge #2
  • Loading branch information
SandeepThomas authored Mar 24, 2020
2 parents 5d4f379 + 52f0255 commit b1ff038
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 14 deletions.
1 change: 0 additions & 1 deletion src/Components/Ambulance/AmbulanceOnboarding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ export default function AmbulanceOnboarding() {
setVehicleObj(val);
setValue(1);
};
console.log('vehicleObj: ', vehicleObj);

return (

Expand Down
19 changes: 13 additions & 6 deletions src/Components/Ambulance/DriverDetailsForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { TextInputField } from '../Common/HelperInputFields';
import { useDispatch } from "react-redux";
import { postAmbulance } from "../../Redux/actions";
import { isEmpty, get } from "lodash";
import { navigate } from 'hookrouter';


export const DriverDetailsForm = (props:any) => {
Expand Down Expand Up @@ -43,7 +44,7 @@ export const DriverDetailsForm = (props:any) => {
};

const validateData = () => {
const err = Object.assign({});
const err:any = {};
Object.keys(form).forEach((key) => {
const value = form[key];
switch (key) {
Expand Down Expand Up @@ -76,6 +77,7 @@ export const DriverDetailsForm = (props:any) => {
});
if (!isEmpty(err)) {
setErrors(err);
return false;
}
return form;
};
Expand Down Expand Up @@ -122,8 +124,9 @@ export const DriverDetailsForm = (props:any) => {
const statusCode = get(resp, 'status', '');
if (res && statusCode === 401) {
alert('Something went wrong..!');
} else if (res && statusCode === 200) {
} else if (res && statusCode === 201) {
alert('Ambulance Added Successfully');
navigate("/")
}
})
}
Expand All @@ -140,7 +143,8 @@ export const DriverDetailsForm = (props:any) => {
<h4>Driver 1</h4>
<TextInputField
name="driverName1"
placeholder="Driver Name"
label="Driver Name"
placeholder=""
variant="outlined"
margin="dense"
value={form.driverName1}
Expand All @@ -150,7 +154,8 @@ export const DriverDetailsForm = (props:any) => {
<TextInputField
type="number"
name="cellNumber1"
placeholder="Cellphone Number"
label="Cellphone Number"
placeholder=""
variant="outlined"
margin="dense"
value={form.cellNumber1}
Expand All @@ -168,7 +173,8 @@ export const DriverDetailsForm = (props:any) => {
<h4>Driver 2</h4>
<TextInputField
name="driverName2"
placeholder="Driver Name"
label="Driver Name"
placeholder=""
variant="outlined"
margin="dense"
value={form.driverName2}
Expand All @@ -178,7 +184,8 @@ export const DriverDetailsForm = (props:any) => {
<TextInputField
type="number"
name="cellNumber2"
placeholder="Cellphone Number"
label="Cellphone Number"
placeholder=""
variant="outlined"
margin="dense"
value={form.cellNumber2}
Expand Down
11 changes: 7 additions & 4 deletions src/Components/Ambulance/VehicleDetailsForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const VehicleDetailsForm = (props: any) => {
};

const validateData = () => {
const err = Object.assign({}, errors);
const err:any = {};
Object.keys(form).forEach(key => {
const value = form[key];
switch (key) {
Expand Down Expand Up @@ -126,8 +126,9 @@ export const VehicleDetailsForm = (props: any) => {
<CardContent className={classes.cardContent}>
<Box display="flex" flexDirection="column">
<TextInputField
label="Vehicle registration number"
name="registrationNumber"
placeholder="Vehicle registration number"
placeholder=""
variant="outlined"
margin="dense"
InputLabelProps={{shrink: !!form.registrationNumber}}
Expand Down Expand Up @@ -158,8 +159,9 @@ export const VehicleDetailsForm = (props: any) => {
/>
</div>
<TextInputField
label="Name of owner"
name="nameOfOwner"
placeholder="Name of owner"
placeholder=""
variant="outlined"
margin="dense"
value={form.nameOfOwner}
Expand All @@ -168,8 +170,9 @@ export const VehicleDetailsForm = (props: any) => {
errors={errors.nameOfOwner}
/>
<TextInputField
label="Owner phone number"
name="ownerPhoneNumber"
placeholder="Owner phone number"
placeholder=""
variant="outlined"
margin="dense"
value={form.ownerPhoneNumber}
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Common/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const Header = () => {
<MenuIcon/>
</IconButton>
<Typography variant="h6">
<img src={img} alt="care logo"style={{ height: '25px' }}/>
<A href='/'> <img src={img} alt="care logo"style={{ height: '25px' }}/></A>
</Typography>
<div className={classes.flexGrow}>

Expand Down
3 changes: 2 additions & 1 deletion src/Components/Common/HelperInputFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import DateFnsUtils from '@date-io/date-fns';
import DeleteIcon from '@material-ui/icons/Delete';

export const TextInputField = (props: any) => {
const { placeholder, onChange, value, name, variant, type, margin, errors } = props;
const { placeholder, onChange, value, name, variant, type, margin, errors, label } = props;
return (
<div>
<TextField
label={label}
type={type}
fullWidth
variant={variant}
Expand Down
3 changes: 2 additions & 1 deletion src/Components/Common/TopBar.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import React from 'react';
import { AppBar, Toolbar, Typography, } from '@material-ui/core';
import {A} from "hookrouter";

const img = 'https://care-staging-coronasafe.s3.amazonaws.com/static/images/logos/black-logo.svg';
const TopBar = () => {
return (
<AppBar position="fixed" className="appBar">
<Toolbar>
<Typography variant="h5">
<img src= {img} style={{height:"25px"}} alt="care logo"/>
<A href={'/'} ><img src= {img} style={{height:"25px"}} alt="care logo"/> </A>
</Typography>
</Toolbar>
</AppBar>
Expand Down

0 comments on commit b1ff038

Please sign in to comment.