source: RebuMKReact/src/Components/Drivers/drivers.js@ 364f27d

Last change on this file since 364f27d was 364f27d, checked in by MetodiMladenovski <meto.18@…>, 14 months ago

added projects and db scripts

  • Property mode set to 100644
File size: 2.1 KB
RevLine 
[364f27d]1import React from "react";
2import { useNavigate } from 'react-router-dom'
3import '../UtilComponents/App.css'
4
5
6const Drivers = (props) => {
7 const navigate = useNavigate();
8
9 const makeRequestForDriver = async (driverId, driverName) => {
10 navigate('/make-request', {state: {driverId: driverId, driverName: driverName}})
11 };
12
13 return(
14 <div className="container">
15 <h2 style={{color: 'darkcyan', textAlign: 'center', marginTop: '5px'}}>Drivers</h2>
16 <div className="row row-cols-1 row-cols-md-3 g-4" style={{width: '95%', margin: 'auto', marginBottom: '40px'}}>
17 {props.drivers.map((term) => {
18 const IMAGE_SRC = `http://localhost:8080/driver/${term.id}/profile/picture`;
19 return(
20 <div key={term.id} className="col">
21 <div className="card" >
22 <img src={IMAGE_SRC} className="card-img-top" alt="Driver doesn't have an image" style={{height: '285px', padding: '25px'}}/>
23 <div className="card-body">
24 <h5 className="card-title">{term.name} {term.surname}</h5>
25 <p style={term.status !== 'AVAILABLE' ? { color: 'red' } : {color: 'green'}}>
26 Status: {term.status}</p>
27 <p className="card-text">
28 Price per kilometer: {term.pricePerKm} MKD
29 <br></br>
30 Level: {term.level}
31 <br></br>
32 Number of grades: {term.numGrades}
33 <br></br>
34 Grade: {term.grade}
35 </p>
36 <a title={"Request Driver"} id="submit" className={"myButton btn btn-primary"}
37 style={{backgroundColor: "cyan", borderColor: "black", color: 'black'}}
38 onClick={() => makeRequestForDriver(term.id, term.name)}>Request Driver</a>
39 </div>
40 </div>
41 </div>
42 )})}
43 </div>
44 </div>
45 )
46}
47
48export default Drivers;
Note: See TracBrowser for help on using the repository browser.