/** @var EmpleoDepartamentoController $this */ /** @var EmpleoDepartamento $model */ /** @var AweActiveForm $form */ $form = $this->beginWidget('ext.AweCrud.components.AweActiveForm', array('id' => 'empleo-departamento-form', 'type' => 'horizontal', 'enableAjaxValidation' => true, 'clientOptions' => array('validateOnSubmit' => true, 'validateOnChange' => false), 'enableClientValidation' => false)); ?> <div class="row-fluid"> <div class="span12"> <!-- widget button --> <div class="widget border-cyan" id="widget-button"> <!-- widget header --> <div class="widget-header bg-cyan"> <!-- widget title --> <h4 class="widget-title"><i class="aweso-briefcase"></i> <?php echo Yii::t('AweCrud.app', $model->isNewRecord ? 'Create' : 'Update') . ' ' . EmpleoDepartamento::label(); ?> </h4> <!-- widget action, you can also use btn, btn-group, nav-tabs or nav-pills (also support dropdown). enjoy! --> <div class="widget-action"> <button data-toggle="collapse" data-collapse="#widget-button" class="btn"> <i class="aweso-chevron-up color-cyan" data-toggle-icon="aweso-chevron-down aweso-chevron-up"></i> </button> </div> </div><!-- /widget header --> <div class="widget-content form bg-white"> <p class="note"> <?php echo Yii::t('AweCrud.app', 'Fields with');
<?php /** @var EmpleoDepartamentoController $this */ /** @var EmpleoDepartamento $model */ $this->breadcrumbs = array('Empleo Departamentos'); $this->menu = array(array('label' => Yii::t('AweCrud.app', 'Create') . ' ' . EmpleoDepartamento::label(), 'icon' => 'plus', 'url' => array('create')), array('label' => Yii::t('AweCrud.app', 'Manage'), 'icon' => 'list-alt', 'url' => array('admin'))); ?> <fieldset> <legend> <?php echo Yii::t('AweCrud.app', 'List'); ?> <?php echo EmpleoDepartamento::label(2); ?> </legend> <?php $this->widget('bootstrap.widgets.TbListView', array('dataProvider' => $dataProvider, 'itemView' => '_view')); ?> </fieldset>
echo $form->textFieldRow($model, 'nombre', array('maxlength' => 45)); ?> <?php echo $form->textFieldRow($model, 'sueldo', array('maxlength' => 10)); ?> <?php // echo $form->textFieldRow($model, 'peso') ?> <?php echo $form->dropDownListRow($model, 'estado', array('VACANTE' => 'VACANTE', 'OCUPADO' => 'OCUPADO'), array('plaseholder' => null)); ?> <?php // echo $form->dropDownListRow($model, 'empleo_departamento_id', array('' => ' -- Seleccione -- ') + CHtml::listData(EmpleoDepartamento::model()->findAll(), 'id', EmpleoDepartamento::representingColumn()), array('prompt' => null)) ?> <?php echo $form->select2Row($model, 'empleo_departamento_id', array('asDropDownList' => true, 'data' => CHtml::listData(EmpleoDepartamento::model()->findAll(), 'id', EmpleoDepartamento::representingColumn()), 'options' => array('placeholder' => '-- Seleccione --'))); ?> <?php echo $form->textAreaRow($model, 'descripcion', array('rows' => 3, 'cols' => 50)); ?> <div class="form-actions bg-silver"> <div class="form-actions-float"> <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'success', 'label' => $model->isNewRecord ? Yii::t('AweCrud.app', 'Create') : Yii::t('AweCrud.app', 'Save'))); ?> <?php $this->widget('bootstrap.widgets.TbButton', array('label' => Yii::t('AweCrud.app', 'Cancel'), 'htmlOptions' => array('onclick' => 'javascript:history.go(-1)'))); ?> </div> </div> </div>
public function sortable($idSort, $pesoS, $idRep, $pesoR) { $modelEtap = EmpleoDepartamento::model()->getDepartamentos(); $ban = FALSE; if ($pesoS > $pesoR) { foreach ($modelEtap as $etap) { if ($etap['id'] == $idRep || $ban) { $etap['peso'] = $etap['peso'] + 1; EmpleoDepartamento::model()->updateByPk($etap['id'], array('peso' => $etap['peso'])); if ($etap['id'] == $idSort) { EmpleoDepartamento::model()->updateByPk($etap['id'], array('peso' => $pesoR)); $ban = false; } else { $ban = TRUE; } } } } else { if ($pesoS < $pesoR) { $ba2 = false; foreach ($modelEtap as $etap) { if ($etap['id'] == $idSort) { EmpleoDepartamento::model()->updateByPk($etap['id'], array('peso' => $pesoR)); $ba2 = TRUE; } else { if ($ba2) { if ($etap['id'] == $idRep) { $etap['peso'] = $etap['peso'] - 1; EmpleoDepartamento::model()->updateByPk($etap['id'], array('peso' => $etap['peso'])); $ba2 = FALSE; } else { $etap['peso'] = $etap['peso'] - 1; EmpleoDepartamento::model()->updateByPk($etap['id'], array('peso' => $etap['peso'])); } } } } } } }
<!-- widget header --> <div class="widget-header bg-cyan"> <!-- widget title --> <h4 class="widget-title"><i class="aweso-briefcase"></i> <?php echo Yii::t('AweCrud.app', 'Manage'); ?> <?php echo EmpleoCargo::label(2); ?> </h4> <!-- widget action, you can also use btn, btn-group, nav-tabs or nav-pills (also support dropdown). enjoy! --> <div class="widget-action"> <button data-toggle="collapse" data-collapse="#widget-button" class="btn"> <i class="aweso-chevron-up color-cyan" data-toggle-icon="aweso-chevron-down aweso-chevron-up"></i> </button> </div> </div><!-- /widget header --> <!-- widget content --> <div class="widget-content bg-white"> <div style='overflow:auto'> <?php //$this->widget('bootstrap.widgets.TbGridView',array( $this->widget('ext.yiiSortableModel.widgets.SortableCGridView', array('id' => 'empleo-cargo-grid', 'type' => 'striped bordered hover advance ', 'template' => '{summary}{items}{pager}', 'dataProvider' => $model->search(), 'orderField' => 'peso', 'pagerCssClass' => 'pagination text-center', 'orderUrl' => 'reordenar', 'columns' => array(array('name' => 'nombre', 'type' => 'html', 'value' => '"<i class=\'icon-move\'></i> ".$data->nombre'), 'sueldo', array('name' => 'estado', 'filter' => array('VACANTE' => 'VACANTE', 'OCUPADO' => 'OCUPADO')), array('name' => 'empleo_departamento_id', 'value' => 'isset($data->empleoDepartamento) ? $data->empleoDepartamento : null', 'filter' => CHtml::listData(EmpleoDepartamento::model()->findAll(), 'id', EmpleoDepartamento::representingColumn())), array('class' => 'CButtonColumn', 'template' => '{update} {delete}', 'deleteConfirmation' => CrugeTranslator::t('admin', 'Are you sure you want to delete this user'), 'buttons' => array('update' => array('label' => '<button class="btn btn-info"><i class="aweso-pencil"></i></button>', 'options' => array('title' => Yii::t('AweCrud.app', 'Update')), 'imageUrl' => false), 'delete' => array('label' => '<button class="btn btn-danger"><i class="aweso-trash"></i></button>', 'options' => array('title' => 'Eliminar', 'onClick' => 'js:location.reload();'), 'imageUrl' => false)), 'htmlOptions' => array('width' => '80px'))))); ?> </div> </div> </div> </div> </div> <!--</fieldset>-->