<?php use yii\helpers\Html; use yii\widgets\DetailView; use yii\widgets\ActiveForm; use frontend\models\Uf; $this->registerJs('$("#uf-motivo_baja").focus();', yii\web\View::POS_READY); ?> <div class="uf-view"> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['loteo', 'manzana', 'superficie:decimal', ['label' => 'Estado', 'value' => Uf::getEstados($model->estado)], 'motivo_baja']]); ?> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'motivo_baja')->textInput(['maxlength' => true]); ?> <div class="form-group"> <?php echo Html::submitButton('Eliminar', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?>
$this->title = 'U.F.' . $model->id; $this->params['breadcrumbs'][] = ['label' => 'Lista de U.F.', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="uf-view"> <h3><?php echo Html::encode($this->title); ?> </h3> <?php echo '<p>'; if ($model->estado != Uf::ESTADO_BAJA) { if (\Yii::$app->user->can('altaModificarUf')) { echo Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']); } if (\Yii::$app->user->can('borrarUf')) { echo ' ' . Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger']); } } echo '</p>'; ?> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['loteo', 'manzana', 'superficie:decimal', 'userCreatedBy.username', 'created_at:datetime', 'userUpdatedBy.username', 'updated_at:datetime', ['label' => 'Estado', 'value' => Uf::getEstados($model->estado)], 'motivo_baja']]); ?> </div>
?> <?php $lbl2 = ''; $pdfHeader = ['L' => ['content' => \Yii::$app->params['lblName']], 'C' => ['content' => $this->title . $lbl2, 'font-style' => 'B'], 'R' => ['content' => '']]; $pdfFooter = ['L' => ['content' => \Yii::$app->params['lblName2']], 'C' => ['content' => 'página {PAGENO} de {nb}'], 'R' => ['content' => 'Fecha:{DATE d/m/Y}']]; $columns = ['id', 'loteo', 'manzana', ['attribute' => 'superficie', 'format' => ['decimal', 2], 'hAlign' => 'right'], ['class' => '\\kartik\\grid\\FormulaColumn', 'value' => function ($model, $key, $index, $widget) { if ($model->estado == 0) { return null; } $p = compact('model', 'key', 'index'); // Write your formula below global $totSup; return $totSup == 0 ? 0 : $widget->col(3, $p) / $totSup * 100; }, 'format' => ['decimal', 3], 'label' => 'Coeficiente', 'hAlign' => 'right'], ['attribute' => 'estado', 'value' => function ($data) { return Uf::getEstados($data->estado); }, 'filter' => $searchModel->estados], ['class' => 'kartik\\grid\\ActionColumn', 'header' => Html::a('<span class="glyphicon glyphicon-plus-sign"></span>', ['create'], ['class' => 'btn-sm btn-primary', 'title' => Yii::t('app', 'Nueva U.F.')]), 'template' => '{view} {comentario} {titularidad}', 'buttons' => ['comentario' => function ($url, $model) { $c = Comentarios::getComentariosByModelId($model->className(), $model->id); $text = '<span class="glyphicon glyphicon-copyright-mark"'; if (!empty($c)) { $text .= ' style="color:#FF8000"></span>'; $titl = 'Ingresar nuevo/Ver comentarios'; } else { $text .= '></span>'; $titl = 'Ingresar nuevo comentario'; } return Html::a($text, $url, ['title' => $titl, 'onclick' => '$.ajax({ type :"POST", cache : false, url : $(this).attr("href"), success : function(response) {