/* @var $this LineaServicioController */
/* @var $model LineaServicio */
$this->menu = array(array('label' => 'Listar Lineas de Servicio', 'url' => array('index')), array('label' => 'Crear Linea de Servicio', 'visible' => Yii::app()->user->perfil != 1, 'url' => array('create')));
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$('#linea-servicio-grid').yiiGridView('update', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1>Buscar Linea de Servicio - <a href="#exportar" class="btn btn-warning" role="button" data-toggle="modal"><i class="icon-share-alt icon-white"></i> Exportar</a></h1>

<div class="search-form" style="display:none">
<?php 
$this->renderPartial('_search', array('model' => $model));
?>
</div><!-- search-form -->

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'linea-servicio-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('header' => 'ID.', 'name' => 'id', 'value' => '$data->id', 'htmlOptions' => array('width' => '20')), 'nombre', array('name' => 'tipo_id', 'filter' => CHtml::listData(TipoLineaServicio::model()->findAll(), 'id', 'nombre'), 'value' => '$data[\'tipo\'][\'nombre\']', 'htmlOptions' => array('width' => '220')), 'precio', 'precio_pago', 'insumo', 'porcentaje', array('class' => 'CButtonColumn', 'template' => '{view}'))));
?>

<div id="exportar" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="myModalLabel">Exportar a un archivo de Excel </h3>
  </div>
  <div class="modal-body">
  	<p>Seleccione las opciones de Exportar</p>
 	<form id="frmExportar" name="frmExportar" action="index.php?r=lineaServicio/exportar&tipo=<?php 
$elTipo;
?>
" method = "post">
  		<div class="span5">
			<label>Filtro:</label>
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return TipoLineaServicio the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = TipoLineaServicio::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
<?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'linea-servicio-form', 'enableAjaxValidation' => false));
?>
	<p class="text-info">Si va a vincular un equipo a esta línea de servicio asegúrese que este ya este creado.</p>
	<p class="note">Campos con <span class="required">*</span> son requeridos.</p>

	<?php 
echo $form->errorSummary($model);
?>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'tipo_id');
?>
		<?php 
echo $form->dropDownList($model, 'tipo_id', CHtml::listData(TipoLineaServicio::model()->findAll(), 'id', 'nombre'), array('class' => 'input-xlarge'));
?>
		<a href="index.php?r=TipoLineaServicio/create" class="btn btn-small btn-primary"><i class="icon-plus-sign icon-white"></i> Agregar</a>
		<?php 
echo $form->error($model, 'tipo_id');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'nombre');
?>
		<?php 
echo $form->textField($model, 'nombre', array('size' => 60, 'maxlength' => 254, 'class' => 'input-xlarge'));
?>
		<?php