import React from "react";
import moment from "moment";

export default class ContractHeader extends React.Component 
{
	constructor(props) 
	{
		super(props);
		this.state = {
		};
	}

	componentDidMount()
	{
	}

	render()
	{
		const { number, date, car } = this.props;

		return (
			<>
				<h1 className="section_title">Договор №{ number }</h1>
				<h5 style={{ fontSize: "14px" }}>
					{ date !== undefined && date !== null && date !== null && ( <> от { moment(date).format("DD.MM.YYYY") }</> ) }
					{ car !== undefined && car !== null ? ` - ${ car.brand.name } ${ car.model.name } | ${ car.reg_number !== null ? car.reg_number : "без рег. номера" } | ${ car.vin_number !== null ? car.vin_number : "без VIN номера" }`
					: "" }
				</h5>
			</>
		)
	}
}