<style>
    .accordion-group {
	width: 1150px !important;
    }

    .table-striped{
	width: 500px !important;
    }

    .table.detail-view th {
	text-align: right;
	width: 215px;
    }

    /*    .table-striped tbody > tr:nth-child(2n+1) > td, .table-striped tbody > tr:nth-child(2n+1) > th{
	background-color: #ffffff !important;
	}*/

    .accordion-inner {
	padding: 24px 15px 9px 15px !important;
    }
</style>

<?php
/* @var $this TidController */
/* @var $model Tid */

$this->breadcrumbs = array(
    yii::t('default', 'TIDs Management') => array('dashboardLayout/tids'),
    yii::t('default', 'TIDs') => array('index'),
    $model->tid_no,
);
?>
<div id="flash-msg">
    <br>
    <?php $this->widget('bootstrap.widgets.TbAlert'); ?>
</div>
<div class="accordion-group">
    <div class="accordion-heading">
	<a class="accordion-toggle" data-toggle="collapse"
	   data-parent="#accordion2" href="#collapse0">
	       <?php echo Yii::t('default', 'TID Main Information'); ?>
	</a>
    </div>
    <div id="collapse0" class="accordion-body collapse in">
	<div class="accordion-inner">
	    <table style="width: 100%">
		<tr>
		    <td>
			<?php
			$this->beginWidget('yiiwheels.widgets.box.WhBox', array(
			    'title' => Yii::t('default', 'TID'),
			    'headerIcon' => 'icon-th-list',
			    'htmlOptions' => array(
				'style' => 'width: 550px !important;margin-bottom: 6px !important;',
			    ),
			    'htmlContentOptions' => array(
				'style' => 'height: 360px  !important;',
			    ),
			));
			$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(
				'number',
				'tid_no',
				'initial_issue_date',
				'customs_letter_no',
				array(
				    'type' => 'raw',
				    'name' => 'customs_letter_date',
				    'value' => ($model->customs_letter_date == '0000-00-00') ? '' : $model->customs_letter_date
				),
				'shipment_ref',
				array(
				    'type' => 'raw',
				    'name' => 'point_of_entry_id',
				    'value' => $model->pointOfEntry->name
				),
				array(
				    'type' => 'raw',
				    'name' => 'value',
				    'value' => ($model->value != '') ? $model->value . ' USD' : ''
				),
				array(
				    'type' => 'raw',
				    'name' => 'original_documnets_delivery_date',
				    'value' => ($model->original_documnets_delivery_date == '0000-00-00') ? '' : $model->original_documnets_delivery_date
				),
			    ),
			));
			$this->endWidget();
			?>

		    </td>
		    <td id="tid_status_td">
			<?php
			$this->beginWidget('yiiwheels.widgets.box.WhBox', array(
			    'title' => Yii::t('default', 'TID Status'),
			    'headerIcon' => 'icon-th-list',
			    'htmlOptions' => array(
				'style' => 'width: 550px !important;margin-bottom: 6px !important;',
			    ),
			    'htmlContentOptions' => array(
				'style' => 'height: 360px !important;',
			    ),
			));
			Yii::app()->controller->renderPartial('/tidStatus/_view', array('model' => $model->getLastStatus()));


			$this->endWidget();
			?>

		    </td>
		</tr>
	    </table>

	</div>
    </div>
</div>
<div class="accordion-group">
    <div class="accordion-heading">
	<a class="accordion-toggle" data-toggle="collapse"
	   data-parent="#accordion2" href="#collapse1">
	       <?php echo Yii::t('default', 'TID Documents'); ?>
	 	</a>
	     </div>
	     <div id="collapse1" class="accordion-body collapse">
	 	<div class="accordion-inner">
	    <?php
			Yii::app()->controller->renderPartial('/document/index', array('model' => $model, 'form' => '', 'from_view' => 'view'));
	    ?>

	    	</div>
	        </div>
	    </div>
	    <div class="accordion-group">
	        <div class="accordion-heading">
	    	<a class="accordion-toggle" data-toggle="collapse"
	    	   data-parent="#accordion2" href="#collapse2">
	       <?php echo Yii::t('default', 'TID Invoices'); ?>
	 	</a>
	     </div>
	     <div id="collapse2" class="accordion-body collapse">
	 	<div class="accordion-inner">

	    <?php Yii::app()->controller->renderPartial('/invoice/viewInvoiceInTid', array('model' => new Invoice('search'), 'tid_id' => $model->id, 'page_name' => 'view_tid')); ?>

	    	</div>
	        </div>
	    </div>
	    <div class="accordion-group">
	        <div class="accordion-heading">
	    	<a class="accordion-toggle" data-toggle="collapse"
	    	   data-parent="#accordion2" href="#collapse3">
	       <?php echo Yii::t('default', 'TID Statuses'); ?>
	 	</a>
	     </div>
	     <div id="collapse3" class="accordion-body collapse">
	 	<div class="accordion-inner">

	    <?php Yii::app()->controller->renderPartial('/tidStatus/_index', array('model' => new TidStatus(), 'tid_id' => $model->id)); ?>

	    	</div>
	        </div>
	    </div>


	    <br />

<?php if (!Yii::app()->user->isGuest

			    )echo CHtml::link(Yii::t('default', 'Add Invoice'), array('/invoice/create', 'tid_id' => $model->id), array('class' => 'btn primary')); ?>
			&nbsp;

<?php if (!Yii::app()->user->isGuest

			    )echo CHtml::link(Yii::t('default', 'Manage Invoices'), array('/invoice/index', 'tid_id' => $model->id), array('class' => 'btn primary')); ?>
			&nbsp;
<?php
			if (!Yii::app()->user->isGuest) {
			    echo CHtml::link(Yii::t('default', 'Edit'), array('update', 'id' => $model->id), array('class' => 'btn primary'));
			    echo "&nbsp";
			}
?>

<?php
			if (!Yii::app()->user->isGuest) {
			    echo CHtml::link(Yii::t('default', 'Delete'), array('/tid/delete', 'id' => $model->id), array(
				'class' => 'btn primary', 'id' => 'delete_btn',
				'onclick' => 'return confirm("' . yii::t("zii", 'Are you sure you want to delete this item?') . '");'));
			    echo "&nbsp";
			}
?>

<?php if (!Yii::app()->user->isGuest

			    )echo CHtml::link(Yii::t('default', 'Renew'), array('renew', 'id' => $model->id), array('class' => 'btn primary')); ?>
			&nbsp;
<?php echo CHtml::link(Yii::t('default', 'Back'), array('index'), array('class' => 'btn primary')); ?>