[364f27d] | 1 | import React from "react";
|
---|
| 2 | import '../UtilComponents/App.css'
|
---|
| 3 |
|
---|
| 4 | const DriverReport = (props) => {
|
---|
| 5 |
|
---|
| 6 | return(
|
---|
| 7 | <div style={{width: "85%", margin: 'auto'}} className={"container mm-4 mt-5"}>
|
---|
| 8 | <h2 style={{textAlign: "center", color: "darkcyan"}}>Report on your passengers</h2>
|
---|
| 9 | <hr></hr>
|
---|
| 10 | <div className={"row table-responsive"}>
|
---|
| 11 | <div className={"row"} style={{margin: 'auto'}}>
|
---|
| 12 | <table className={"table table-striped"}>
|
---|
| 13 | <thead>
|
---|
| 14 | <tr>
|
---|
| 15 | <th scope={"col"}>Passenger Email</th>
|
---|
| 16 | <th scope={"col"}>Passenger Name Surname</th>
|
---|
| 17 | <th scope={"col"}>Kilometers Travelled With Passenger</th>
|
---|
| 18 | <th scope={"col"}>Total Earnings from passenger</th>
|
---|
| 19 | <th scope={"col"}>Earnings Per Kilometer</th>
|
---|
| 20 | <th scope={"col"}>Average Grade Received Per Drive</th>
|
---|
| 21 | <th scope={"col"}>Number Of Drives</th>
|
---|
| 22 | </tr>
|
---|
| 23 | </thead>
|
---|
| 24 | <tbody>
|
---|
| 25 | {props.report.map((term) => {
|
---|
| 26 | return(
|
---|
| 27 | <tr>
|
---|
| 28 | <td>{term.passengerEmail}</td>
|
---|
| 29 | <td>{term.passengerName} {term.passengerSurname}</td>
|
---|
| 30 | <td>{(Math.round(term.kmTravelledWithPassenger * 100) / 100).toFixed(2)} km</td>
|
---|
| 31 | <td>{(Math.round(term.totalEarnings * 100) / 100).toFixed(2)} MKD</td>
|
---|
| 32 | <td>{(Math.round(term.earningsPerKm * 100) / 100).toFixed(2)} MKD per km</td>
|
---|
| 33 | <td>{(Math.round(term.averageGradeReceivedPerDrive * 100) / 100).toFixed(2)}</td>
|
---|
| 34 | <td>{term.numberOfDrives} drives</td>
|
---|
| 35 | </tr>
|
---|
| 36 | )
|
---|
| 37 | })}
|
---|
| 38 | </tbody>
|
---|
| 39 | </table>
|
---|
| 40 | </div>
|
---|
| 41 | </div>
|
---|
| 42 | <div style={{textAlign: "center"}}>
|
---|
| 43 | <a className="myButton btn btn-primary" onClick={() => props.onDownloadReport(localStorage.getItem("driverId"))} style={{borderColor: 'black', backgroundColor: 'cyan', color: "black"}}>Download Report</a>
|
---|
| 44 | </div>
|
---|
| 45 | </div>
|
---|
| 46 | )
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | export default DriverReport; |
---|