render() {
    return (
      <Container>
        <div>
          <h1 style={{ textAlign: "center" }}>Route History</h1>
        </div>
        <Col>
          <Row>
            <Col>
              <Button className="m-2" onClick={(e) => this.handleAllShow(e, this.state.routeLists)}>Delete All Route History</Button>
              <DialogBox 
                show={this.state.allShow} 
                modalTitle='Confirm Deletion'
                mainMessageText='Are you sure you want to delete all route history?'
                handleClose={this.handleClose}
                handleSave={this.handleSave}
                closeText='Cancel'
                saveText='Delete All Route History'
                buttonType='danger'
              />
            </Col>
          </Row>
        </Col>
        {this.state.routes.reverse().map((r) => (
          <Card>
            <Card.Title className="card-header border-dark bg-grey">
              <Col>
                <Row className="d-flex flex-row">
                  <Col sm={8} className="title">
                    <h6 style={{ paddingLeft: 0 }}>
                      {this.getRouteDate(r.created_on)} at {this.getRouteTime(r.created_on)}
                    </h6>
                    {this.getDriverName(r)}
                  </Col>
                  <Col sm={0} className="justify-content-around d-flex flex-row">
                            <Button href={this.getItineraryMapURL(r)} style={{ margin: 10}}
                                target="_blank">View Route Map</Button>
                            <Button href={"/routeResults/driverRoute/" 
                                + r.id + "/" + r.assigned_to} style={{margin: 10}}
                                target="_blank">Print Itinerary</Button>
                        </Col>   
                </Row>
              </Col>
            </Card.Title>
            <Card.Header className="pt-1 pl-1 pr-1 pb-1 border-dark bg-grey">
              <Table className="hover table  mb-0">
                <thead>
                  <tr>
                    <th>Capacity</th>
                    <th>Total Quantity</th>
                    <th>Expected Distance Traveled (in Miles)</th>
                    <th>Expected Duration (in Minutes)</th>
                    <th>Employee Status</th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td>{this.getCapacity(r)}</td>
                    <td>{r.total_quantity}</td>
                    <td>{Math.round(r.total_distance)}</td>
                    <td>{Math.round(r.total_duration)}</td>
                    <td>{this.getEmployeeStatus(r)}</td>
                  </tr>
                </tbody>
              </Table>
            </Card.Header>
            <Table>
              <thead>
                <tr>
                  <th>Name</th>
                  <th>Address</th>
                  <th>Apt #</th>
                  <th>City</th>
                  <th>State</th>
                  <th>Zip Code</th>
                  <th>{this.isEmployee(r) ? "Phone Number" : ""}</th>
                  <th>Quantity</th>
                  <th>Comments</th>
                </tr>
              </thead>
              {r.itinerary.map((s) => (
                <tbody>
                  <tr>
                    <td>{this.getRecipientName(s)}</td>
                    <td>{s.address.address}</td>
                    <td>
                      {this.getRecipientRoomNumber(s)
                        ? this.getRecipientRoomNumber(s)
                        : ""}
                    </td>
                    <td>{s.address.city}</td>
                    <td>{s.address.state}</td>
                    <td>{s.address.zipcode}</td>
                    <td>{this.isEmployee(r) ? this.getPhone(s) : ""}</td>
                    <td>{s.demand}</td>
                    <td>{this.getRecipientComment(s)}</td>
                  </tr>
                </tbody>
              ))}
            </Table>
          </Card>
        ))}
      </Container>
    );
  }
/**
   * The render method used to display the component.
   * @returns The HTML to be rendered.
   */
The render method used to display the component.
@returns The HTML to be rendered.
The render method used to display the component . @returns The HTML to be rendered .
render() {
    return (
      <Container>
        <div>
          <h1 style={{ textAlign: "center" }}>Route History</h1>
        </div>
        <Col>
          <Row>
            <Col>
              <Button className="m-2" onClick={(e) => this.handleAllShow(e, this.state.routeLists)}>Delete All Route History</Button>
              <DialogBox 
                show={this.state.allShow} 
                modalTitle='Confirm Deletion'
                mainMessageText='Are you sure you want to delete all route history?'
                handleClose={this.handleClose}
                handleSave={this.handleSave}
                closeText='Cancel'
                saveText='Delete All Route History'
                buttonType='danger'
              />
            </Col>
          </Row>
        </Col>
        {this.state.routes.reverse().map((r) => (
          <Card>
            <Card.Title className="card-header border-dark bg-grey">
              <Col>
                <Row className="d-flex flex-row">
                  <Col sm={8} className="title">
                    <h6 style={{ paddingLeft: 0 }}>
                      {this.getRouteDate(r.created_on)} at {this.getRouteTime(r.created_on)}
                    </h6>
                    {this.getDriverName(r)}
                  </Col>
                  <Col sm={0} className="justify-content-around d-flex flex-row">
                            <Button href={this.getItineraryMapURL(r)} style={{ margin: 10}}
                                target="_blank">View Route Map</Button>
                            <Button href={"/routeResults/driverRoute/" 
                                + r.id + "/" + r.assigned_to} style={{margin: 10}}
                                target="_blank">Print Itinerary</Button>
                        </Col>   
                </Row>
              </Col>
            </Card.Title>
            <Card.Header className="pt-1 pl-1 pr-1 pb-1 border-dark bg-grey">
              <Table className="hover table  mb-0">
                <thead>
                  <tr>
                    <th>Capacity</th>
                    <th>Total Quantity</th>
                    <th>Expected Distance Traveled (in Miles)</th>
                    <th>Expected Duration (in Minutes)</th>
                    <th>Employee Status</th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td>{this.getCapacity(r)}</td>
                    <td>{r.total_quantity}</td>
                    <td>{Math.round(r.total_distance)}</td>
                    <td>{Math.round(r.total_duration)}</td>
                    <td>{this.getEmployeeStatus(r)}</td>
                  </tr>
                </tbody>
              </Table>
            </Card.Header>
            <Table>
              <thead>
                <tr>
                  <th>Name</th>
                  <th>Address</th>
                  <th>Apt #</th>
                  <th>City</th>
                  <th>State</th>
                  <th>Zip Code</th>
                  <th>{this.isEmployee(r) ? "Phone Number" : ""}</th>
                  <th>Quantity</th>
                  <th>Comments</th>
                </tr>
              </thead>
              {r.itinerary.map((s) => (
                <tbody>
                  <tr>
                    <td>{this.getRecipientName(s)}</td>
                    <td>{s.address.address}</td>
                    <td>
                      {this.getRecipientRoomNumber(s)
                        ? this.getRecipientRoomNumber(s)
                        : ""}
                    </td>
                    <td>{s.address.city}</td>
                    <td>{s.address.state}</td>
                    <td>{s.address.zipcode}</td>
                    <td>{this.isEmployee(r) ? this.getPhone(s) : ""}</td>
                    <td>{s.demand}</td>
                    <td>{this.getRecipientComment(s)}</td>
                  </tr>
                </tbody>
              ))}
            </Table>
          </Card>
        ))}
      </Container>
    );
  }
render ( ) { return ( < Container > < div > < h1 style = { { textAlign : "center" } } > Route History < / h1 > < / div > < Col > < Row > < Col > < Button className = "m-2" onClick = { ( e ) => this . handleAllShow ( e , this . state . routeLists ) } > Delete All Route History < / Button > < DialogBox show = { this . state . allShow } modalTitle = 'Confirm Deletion' mainMessageText = 'Are you sure you want to delete all route history?' handleClose = { this . handleClose } handleSave = { this . handleSave } closeText = 'Cancel' saveText = 'Delete All Route History' buttonType = 'danger' / > < / Col > < / Row > < / Col > { this . state . routes . reverse ( ) . map ( ( r ) => ( < Card > < Card . Title className = "card-header border-dark bg-grey" > < Col > < Row className = "d-flex flex-row" > < Col sm = { 8 } className = "title" > < h6 style = { { paddingLeft : 0 } } > { this . getRouteDate ( r . created_on ) }  at  { this . getRouteTime ( r . created_on ) } < / h6 > { this . getDriverName ( r ) } < / Col > < Col sm = { 0 } className = "justify-content-around d-flex flex-row" > < Button href = { this . getItineraryMapURL ( r ) } style = { { margin : 10 } } target = "_blank" > View Route Map < / Button > < Button href = { "/routeResults/driverRoute/" + r . id + "/" + r . assigned_to } style = { { margin : 10 } } target = "_blank" > Print Itinerary < / Button > < / Col > < / Row > < / Col > < / Card . Title > < Card . Header className = "pt-1 pl-1 pr-1 pb-1 border-dark bg-grey" > < Table className = "hover table  mb-0" > < thead > < tr > < th > Capacity < / th > < th > Total Quantity < / th > < th > Expected Distance Traveled (in Miles) < / th > < th > Expected Duration (in Minutes) < / th > < th > Employee Status < / th > < / tr > < / thead > < tbody > < tr > < td > { this . getCapacity ( r ) } < / td > < td > { r . total_quantity } < / td > < td > { Math . round ( r . total_distance ) } < / td > < td > { Math . round ( r . total_duration ) } < / td > < td > { this . getEmployeeStatus ( r ) } < / td > < / tr > < / tbody > < / Table > < / Card . Header > < Table > < thead > < tr > < th > Name < / th > < th > Address < / th > < th > Apt # < / th > < th > City < / th > < th > State < / th > < th > Zip Code < / th > < th > { this . isEmployee ( r ) ? "Phone Number" : "" } < / th > < th > Quantity < / th > < th > Comments < / th > < / tr > < / thead > { r . itinerary . map ( ( s ) => ( < tbody > < tr > < td > { this . getRecipientName ( s ) } < / td > < td > { s . address . address } < / td > < td > { this . getRecipientRoomNumber ( s ) ? this . getRecipientRoomNumber ( s ) : "" } < / td > < td > { s . address . city } < / td > < td > { s . address . state } < / td > < td > { s . address . zipcode } < / td > < td > { this . isEmployee ( r ) ? this . getPhone ( s ) : "" } < / td > < td > { s . demand } < / td > < td > { this . getRecipientComment ( s ) } < / td > < / tr > < / tbody > ) ) } < / Table > < / Card > ) ) } < / Container > ) ; }
The render method used to display the component.
The render method used to display the component .