<?php
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
if ($model == null)
    $model = new TidStatus();
$this->widget('bootstrap.widgets.TbDetailView', array(
    'type' => 'striped',
    'cssFile' => Yii::app()->request->baseUrl . '/css/general/CDetailView/' . Yii::app()->language . '/styles.css',
    'data' => $model,
    'attributes' => array(
	array(
	    'type' => 'raw',
	    'name' => 'ti_type_id',
	    'value' => ($model->tiType == null) ? '' : $model->tiType->name
	),
	array(
	    'type' => 'raw',
	    'name' => 'contract_ref',
	    'value' => ($model->contract == null) ? '' : $model->contract->reference
	),
	array(
	    'type' => 'raw',
	    'name' => 'contract expiry date',
	    'value' => ($model->contract == null) ? '' : $model->contract->expiry_date
	),
	array(
	    'name' => 'ti_issue_date',
	    'value' => ($model->ti_issue_date == '') ? '' : $model->ti_issue_date
	),
	array(
	    'name' => 'ti_expiry_date',
	    'value' => ($model->ti_expiry_date == '0000-00-00') ? '' : $model->ti_expiry_date,
	    'visible' => ($model->ti_expiry_date != '0000-00-00')
	),
	array(
	    'type' => 'raw',
	    'name' => 'cca_id',
	    'value' => ($model->cca == null) ? '' : $model->cca->full_name
	),
	array(
	    'name' => 'ti_status',
	    'value' => ($model->ti_status == '') ? '' : $model->ti_status
	),
	array(
	    'type' => 'raw',
	    'name' => 'comments',
	    'value' => ($model->comments == '') ? '' : $model->comments
	),
	array(
	    'type' => 'raw',
	    'name' => 'last_edited_by',
	    'value' => ($model->last_edited_by == '') ? '' : ($model->last_edited_by == 0) ? "System" :  User::getUsernameById($model->last_edited_by)
	),
	array(
	    'type' => 'raw',
	    'name' => 'under_processing',
	    'value' => ($model->under_processing == null) ? '' : $model->under_processing
	),
	array(
	    'type' => 'raw',
	    'name' => 'renewal_stage_id',
	    'value' => ($model->renewal_stage_id != null) ? $model->renewalStage->name : '',
	    'visible' => ($model->under_processing != null)
	),
	array(
	    'type' => 'raw',
	    'name' => 'transferred_to_contract_id',
	    'value' => ($model->transferredContract == null) ? '' : $model->transferredContract->reference,
	    'visible' => ($model->under_processing != null) && $model->renewal_stage_id == Setting::getUnderTransferOfPrivilege()
	),
    ),
));
?>
<script type="text/javascript">
    $(document).ready(function() {
        var status = '<?php echo $model->ti_status ?>';
        
        if (status != '') {
            if (status == 'Expired') {
                $("#tid_status_td .bootstrap-widget-header").css('background', 'rgb(248, 200, 200)');
            }
            if (status == 'Grace') {

                $("#tid_status_td .bootstrap-widget-header").css('background', 'rgb(250, 228, 158)');
            }

            if (status == 'Exported') {
                $("#tid_status_td .bootstrap-widget-header").css('background', 'rgb(193, 206, 221)');
            }
            if (status == 'Partially Exported') {
                $("#tid_status_td .bootstrap-widget-header").css('background', 'rgb(222, 232, 224)');
            }
            if (status == 'Valid') {
                $("#tid_status_td .bootstrap-widget-header").css('background', 'rgb(208, 236, 176)');
            }
	    if (status == 'Permanent') {
                $("#tid_status_td .bootstrap-widget-header").css('background', 'rgb(217, 217, 217)');
            }
        }
    });
</script>
