[364f27d] | 1 | import React from "react";
|
---|
| 2 | import { useNavigate } from 'react-router-dom'
|
---|
| 3 | import '../UtilComponents/App.css'
|
---|
| 4 |
|
---|
| 5 |
|
---|
| 6 | const 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 |
|
---|
| 48 | export default Drivers; |
---|