<style>
    .grid-view {
	padding-top: 0px !important;
    }
</style>
<?php
/* @var $this ItemRequestHeaderController */
/* @var $model ItemRequestHeader */

$this->breadcrumbs = array(
    yii::t('default', 'Requests') => array('/dashboard/requests'),
    Yii::t('default', 'Items') => array('index'),
    $model->id,
);
$this->widget('bootstrap.widgets.TbAlert');

echo CHtml::link(CHtml::image(Yii::app()->request->baseUrl . '/css/flags/pdf.png'), array('ConvertToPDF', 'download' => 1, 'id' => $model->id), array('id' => 'PDF', 'style' => 'background-image:url(css/flags/pdf.png)'));
$this->widget('ext.bootstrap.widgets.TbDetailView', array(
    'type' => 'striped',
    'cssFile' => Yii::app()->request->baseUrl . '/css/general/CDetailView/' . Yii::app()->language . '/styles.css',
    'data' => $model,
    'attributes' => array(
	'id',
	array(
	    'type' => 'raw',
	    'name' => 'location_id',
	    'value' => Yii::app()->user->checkAccess('Food Manager') ? $model->location->code : CHtml::link($model->location->code, array('location/view', 'id' => $model->location_id))
	),
	array(
	    'type' => 'raw',
	    'name' => 'department_id',
	    'value' => Yii::app()->user->checkAccess('Food Manager') ? $model->department->name : CHtml::link($model->department->name, array('department/view', 'id' => $model->department_id)),
	),
	'date_time',
    ),
));

echo "<br/>";
Yii::app()->controller->renderPartial('/itemRequestDetail/index', array('model' => $model, 'from_view_page' => 'true', 'location_id' => $model->location_id));
?>


<?php
if ($new_request == 1) {
    ignore_user_abort(TRUE);
?>
    <script type="text/javascript">
        $(document).ready(function(){ <?php
    echo CHtml::ajax(array(
	'type' => 'POST',
	'data' => 'ajax:true}',
	'url' => CController::createUrl('itemRequestHeader/sendEmail', array('id' => $model->id)),
	    )
    );
?>
        });
    </script>
<?php } ?>
