import React from 'react';
import TripClosureInfo from './TripClosureInfo.js';
import TripClosureHeader from './TripClosureHeader.js';
import '../TicketNotification/Ticket.scss';
import '../TicketNotification/TicketData.scss';
import '../TicketNotification/TicketHeader.scss';


export default class TripClosureNotification extends React.Component{

    constructor(props) {
        super(props);
    }

    handleOnClick = () => {
        if(this.props.onNotificationClick){
            let obj = {};
            obj.type = 'CHANGEOVER';
            obj.vehicleNodeTrackingId = this.props.notificationData.data.vehicleNodeTrackingId;
            this.props.onNotificationClick(obj);
            this.props.onModalClose();
        }

    }

    render(){
        const props = this.props;
        let notificationData = props.notificationData;
        debugger;
        return(	<div>
                    <div className="ticket-body tripclosure-notification" onClick={this.handleOnClick}>
                        <TripClosureHeader
                            title = {notificationData.title}
                            notificationRead= {notificationData.read}
                        />
                        <TripClosureInfo
                            tripClosureFields={props.tripClosureFields}
                            data={notificationData.data}
                            notificationRead= {notificationData.read} />
                    </div>
            </div>


        )
    }

}