<?php

/** @var \SquirrelsInventory\Controller $this */
$id = is_numeric($this->data) ? abs(round($this->data)) : 0;
$auto = new \SquirrelsInventory\Auto($id);
?>

<?php 
if ($auto->getId() == 0 || $auto->getId() === NULL) {
    ?>

	<p>
		The inventory you are looking for is no longer available.
		Please check back later.
	</p>

<?php 
} else {
    ?>

	<div class="squirrels squirrels-auto">

		<div class="row">
			<div class="col-md-12">

				<h3 class="squirrels-title">
					<?php 
    echo $auto->getYear() > 0 ? $auto->getYear() : '';
    ?>
					<?php 
    echo $auto->getMake()->getTitle();
    ?>

		<h1>
			<?php 
    echo __('Edit Inventory', 'squirrels_inventory');
    ?>
			<a href="?page=<?php 
    echo $_REQUEST['page'];
    ?>
" class="page-title-action">
				<?php 
    echo __('Cancel', 'squirrels_inventory');
    ?>
			</a>
			<?php 
    if ($auto->getId() !== NULL) {
        ?>
				<button class="page-title-action" id="squirrels-inventory-edit"><?php 
        echo __('Update', 'squirrels_inventory');
        ?>
</button>
				<button class="page-title-action" id="squirrels-inventory-delete"><?php 
        echo __('Delete', 'squirrels_inventory');
        ?>
</button>
			<?php 
    }
    ?>
		</h1>

		<?php