Example #1
0
use common\models\SubSector;
use common\models\PlanOperativo;
use common\models\ObjetivosHistoricos;
use common\models\ObjetivosNacionales;
use common\models\ObjetivosEstrategicos;
use common\models\ObjetivosGenerales;
use common\models\Ambito;
//Iconos
$icons = ['crear' => '<span class="glyphicon glyphicon-file" aria-hidden="true"></span>', 'editar' => '<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>', 'eliminar' => '<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>', 'recargar' => '<span class="glyphicon glyphicon-repeat"></span>'];
CrudAsset::register($this);
?>

<div class="proyecto-view ">
    <!-- Widget con los datos -->
    <?php 
echo DetailView::widget(['model' => $model, 'mode' => 'view', 'fadeDelay' => 0, 'bordered' => true, 'striped' => true, 'condensed' => true, 'responsive' => true, 'deleteOptions' => ['params' => ['id' => $model->id, 'kvdelete' => true]], 'attributes' => ['id', 'codigo_proyecto', 'codigo_sne', ['attribute' => 'nombre', 'type' => DetailView::INPUT_TEXTAREA, 'options' => ['rows' => '6', 'style' => 'width:50%']], ['label' => $model->getAttributeLabel('fecha_inicio'), 'attribute' => 'fecha_inicio', 'type' => DetailView::INPUT_DATE, 'options' => ['style' => 'width:47%'], 'widgetOptions' => ['pluginOptions' => ['autoclose' => true, 'format' => 'dd/mm/yyyy']]], ['label' => $model->getAttributeLabel('fecha_fin'), 'attribute' => 'fecha_fin', 'type' => DetailView::INPUT_DATE, 'options' => ['style' => 'width:47%'], 'widgetOptions' => ['pluginOptions' => ['autoclose' => true, 'format' => 'dd/mm/yyyy']]], ['label' => $model->getAttributeLabel('estatus_proyecto'), 'attribute' => 'estatus_proyecto', 'value' => $model->nombreEstatusProyecto, 'type' => DetailView::INPUT_SELECT2, 'widgetOptions' => ['data' => ArrayHelper::map(EstatusProyecto::find()->all(), 'id', 'estatus'), 'options' => ['placeholder' => 'Seleccione'], 'pluginOptions' => ['allowClear' => true, 'width' => '50%']]], ['label' => $model->getAttributeLabel('situacion_presupuestaria'), 'attribute' => 'situacion_presupuestaria', 'value' => SituacionPresupuestaria::find()->where(['id' => $model->situacion_presupuestaria])->one()->situacion, 'type' => DetailView::INPUT_SELECT2, 'widgetOptions' => ['data' => ArrayHelper::map(SituacionPresupuestaria::find()->all(), 'id', 'situacion'), 'options' => ['placeholder' => 'Seleccione'], 'pluginOptions' => ['allowClear' => true, 'width' => '50%']]], ['label' => $model->getAttributeLabel('monto_proyecto'), 'attribute' => 'monto_proyecto', 'value' => $model->bolivarMonto, 'type' => DetailView::INPUT_MONEY, 'widgetOptions' => []], ['attribute' => 'descripcion', 'type' => DetailView::INPUT_TEXTAREA, 'options' => ['rows' => '6', 'style' => 'width:50%']], ['label' => $model->getAttributeLabel('sector'), 'attribute' => 'sector', 'value' => $model->nombreSector, 'type' => DetailView::INPUT_SELECT2, 'widgetOptions' => ['data' => ArrayHelper::map(Sector::find()->all(), 'id', 'sector'), 'options' => ['placeholder' => 'Seleccione'], 'pluginOptions' => ['allowClear' => true, 'width' => '50%']]], ['label' => $model->getAttributeLabel('sub_sector'), 'attribute' => 'sub_sector', 'value' => $model->nombreSubSector, 'type' => DetailView::INPUT_SELECT2, 'widgetOptions' => ['data' => ArrayHelper::map(SubSector::find()->all(), 'id', 'sub_sector'), 'options' => ['placeholder' => 'Seleccione'], 'pluginOptions' => ['allowClear' => true, 'width' => '50%']]], ['label' => $model->getAttributeLabel('plan_operativo'), 'attribute' => 'plan_operativo', 'value' => PlanOperativo::find()->where(['id' => $model->plan_operativo])->one()->plan_operativo, 'type' => DetailView::INPUT_SELECT2, 'widgetOptions' => ['data' => ArrayHelper::map(PlanOperativo::find()->all(), 'id', 'plan_operativo'), 'options' => ['placeholder' => 'Seleccione'], 'pluginOptions' => ['allowClear' => true, 'width' => '50%']]], ['label' => 'Objetivo Historico', 'value' => $historico->objetivo_historico, 'options' => ['style' => 'width:50%']], ['label' => 'Objetivo Nacional', 'value' => $nacional->objetivo_nacional, 'options' => ['style' => 'width:50%']], ['label' => 'Objetivo Estratégico', 'value' => $estrategico->objetivo_estrategico, 'options' => ['style' => 'width:50%']], ['label' => $model->getAttributeLabel('objetivo_general'), 'attribute' => 'objetivo_general', 'value' => ObjetivosGenerales::find()->where(['id' => $model->objetivo_general])->one()->objetivo_general, 'type' => DetailView::INPUT_SELECT2, 'widgetOptions' => ['data' => ArrayHelper::map(ObjetivosGenerales::find()->all(), 'id', 'objetivo_general'), 'options' => ['placeholder' => 'Seleccione'], 'pluginOptions' => ['allowClear' => true, 'width' => '50%']]], ['attribute' => 'objetivo_estrategico_institucional', 'type' => DetailView::INPUT_TEXTAREA, 'options' => ['rows' => '6', 'style' => 'width:50%']], ['label' => $model->getAttributeLabel('ambito'), 'attribute' => 'ambito', 'value' => $model->idAmbito->ambito, 'type' => DetailView::INPUT_SELECT2, 'widgetOptions' => ['data' => ArrayHelper::map(Ambito::find()->all(), 'id', 'ambito'), 'options' => ['placeholder' => 'Seleccione'], 'pluginOptions' => ['allowClear' => true, 'width' => '50%']]]], 'panel' => ['type' => 'primary', 'heading' => '<i class="fa fa-list"></i> Datos Básicos']]);
?>
</div>

<!-- LOCALIZACION -->
<div class="panel panel-info" id="localizacion">
    <div class="panel-heading">
        <h3 class="panel-title"><i class="glyphicon glyphicon-map-marker"></i> Localización</h3>
    </div>
    <div class="panel-body">
        <?php 
echo GridView::widget(['id' => 'crud-datatable', 'dataProvider' => $localizacion, 'pjax' => true, 'columns' => require __DIR__ . '/_localizacion.php', 'toolbar' => [['content' => Html::a($icons['crear'] . ' Nuevo', ['proyecto-localizacion/create', 'proyecto' => $model->id, 'ambito' => $model->ambito], ['role' => 'modal-remote', 'title' => 'Nuevo', 'class' => 'btn btn-default']) . Html::a($icons['recargar'] . ' Refrescar', ['proyecto/view', 'id' => $model->id], ['data-pjax' => 1, 'class' => 'btn btn-default', 'title' => 'Reset Grid']) . '{toggleData}' . '{export}']], 'striped' => true, 'condensed' => true, 'responsive' => true, 'panel' => ['type' => 'default', 'before' => '<em>* Resize table columns just like a spreadsheet by dragging the column edges.</em>', 'after' => BulkButtonWidget::widget(['buttons' => Html::a('<i class="glyphicon glyphicon-trash"></i>&nbsp; Delete All', ["bulk-delete"], ["class" => "btn btn-danger btn-xs", 'role' => 'modal-remote-bulk', 'data-confirm' => false, 'data-method' => false, 'data-request-method' => 'post', 'data-confirm-title' => 'Are you sure?', 'data-confirm-message' => 'Are you sure want to delete this item'])]) . '<div class="clearfix"></div>']]);
?>
          
    </div>
</div>  
Example #2
0
 /**
  * Updates an existing Proyecto model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     //Formato de las fechas
     $model->fecha_inicio = \Yii::$app->formatter->asDate($model->fecha_inicio);
     $model->fecha_fin = \Yii::$app->formatter->asDate($model->fecha_fin);
     //Listas desplegables y autocompletar
     $estatus_proyecto = EstatusProyecto::find()->all();
     $situacion_presupuestaria = SituacionPresupuestaria::find()->all();
     $sector = Sector::find()->all();
     $sub_sector = SubSector::find()->all();
     $plan_operativo = PlanOperativo::find()->all();
     $objetivo_general = ObjetivosGenerales::find()->select(['objetivo_general as value', 'id as id'])->asArray()->all();
     $ambito = Ambito::find()->all();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('update', ['model' => $model, 'estatus_proyecto' => $estatus_proyecto, 'situacion_presupuestaria' => $situacion_presupuestaria, 'sector' => $sector, 'sub_sector' => $sub_sector, 'plan_operativo' => $plan_operativo, 'objetivo_general' => $objetivo_general, 'ambito' => $ambito]);
     }
 }