/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = AccesosConceptos::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'req_tarjeta' => $this->req_tarjeta, 'req_seguro' => $this->req_seguro]); $query->andFilterWhere(['like', 'concepto', $this->concepto]); return $dataProvider; }
$this->title = Yii::t('app', 'Conceptos de accesos'); $this->params['breadcrumbs'][] = $this->title; $this->registerCss(' .kv-grid-loading { opacity: 0.5; background: #ffffff url("../images/loading.gif") top center no-repeat !important; } '); ?> <div class="accesos-conceptos-index"> <h3><?php echo Html::encode($this->title); ?> </h3> <?php $columns = ['id', 'concepto', ['attribute' => 'req_tarjeta', 'value' => function ($model) { return AccesosConceptos::getSiNo($model->req_tarjeta); }, 'filter' => AccesosConceptos::getSiNo()], ['attribute' => 'req_seguro', 'value' => function ($model) { return AccesosConceptos::getSiNo($model->req_seguro); }, 'filter' => AccesosConceptos::getSiNo()], ['attribute' => 'estado', 'value' => function ($model) { return AccesosConceptos::getEstados($model->estado); }, 'filter' => AccesosConceptos::getEstados()], ['class' => 'kartik\\grid\\ActionColumn', 'header' => Html::a('<span class="glyphicon glyphicon-plus-sign"></span>', ['create'], ['class' => 'btn-sm btn-primary', 'title' => Yii::t('app', 'Nuevo concepto')]), 'template' => '{view}']]; echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'pjax' => true, 'pjaxSettings' => ['neverTimeout' => true], 'options' => ['id' => 'gridConceptos'], 'columns' => $columns, 'condensed' => true]); ?> </div>
/** * @return \yii\db\ActiveQuery */ public function getAccesosConcepto() { return $this->hasOne(AccesosConceptos::className(), ['id' => 'id_concepto']); }
public function actionRefreshConcepto($id_concepto = null) { if (empty($id_concepto) || $id_concepto == 'null') { return; } $ac = AccesosConceptos::findOne($id_concepto); \Yii::$app->session->set('req_seguro', $ac->req_seguro); // en la vista solo se usa el grupo personas pero se devuelve todo \Yii::$app->response->format = 'json'; $response = $this->refreshListas(); return $response; }
} if ($action === 'mensajeV') { $url = Yii::$app->urlManager->createUrl(['mensajes/create-ajax', 'modelName' => 'frontend\\models\\Vehiculos', 'modelID' => $model->ing_id_vehiculo]); return $url; } if ($action === 'view') { $url = Yii::$app->urlManager->createUrl(['accesos/view', 'id' => $model->id_acceso]); return $url; } }], ['attribute' => 'id_acceso', 'format' => 'raw', 'value' => function ($model, $index, $widget) { return Html::a($model->id_acceso, Yii::$app->urlManager->createUrl(['accesos/view', 'id' => $model->id_acceso]), ['title' => 'Ver detalle', 'target' => '_blank', 'data-pjax' => '0']); }], ['attribute' => 'ing_fecha', 'options' => ['style' => 'width:275px;'], 'contentOptions' => ['style' => 'width:275px;'], 'headerOptions' => ['style' => 'width:275px;'], 'format' => ['date'], 'filter' => MaskedInput::widget(['model' => $searchModel, 'attribute' => 'ing_fecha', 'mask' => '99/99/9999'])], ['attribute' => 'ing_hora', 'format' => ['time']], ['attribute' => 'id_persona', 'format' => 'raw', 'value' => function ($model, $index, $widget) { return Html::a($model->id_persona, Yii::$app->urlManager->createUrl(['personas/view', 'id' => $model->id_persona]), ['title' => 'Ver detalle de persona', 'target' => '_blank', 'data-pjax' => '0']); }], 'r_apellido', 'r_nombre', 'r_nombre2', 'r_nro_doc', ['attribute' => 'ing_id_vehiculo', 'format' => 'raw', 'value' => function ($model, $index, $widget) { return Html::a($model->ing_id_vehiculo, Yii::$app->urlManager->createUrl(['vehiculos/view', 'id' => $model->ing_id_vehiculo]), ['title' => 'Ver detalle del vehiculo', 'target' => '_blank', 'data-pjax' => '0']); }], 'r_ing_patente', 'r_ing_marca', 'r_ing_modelo', 'r_ing_color', 'ing_id_porton', 'r_ing_usuario', ['attribute' => 'id_concepto', 'value' => 'desc_concepto', 'filter' => AccesosConceptos::getListaConceptos(true)], 'ing_id_llave', 'motivo', ['attribute' => 'id_autorizante', 'format' => 'raw', 'value' => function ($model, $index, $widget) { return Html::a($model->id_autorizante, Yii::$app->urlManager->createUrl(['personas/view', 'id' => $model->id_autorizante]), ['title' => 'Ver detalle de autorizante', 'target' => '_blank', 'data-pjax' => '0']); }], 'r_aut_apellido', 'r_aut_nombre', 'r_aut_nombre2', 'id_uf', ['attribute' => 'egr_fecha', 'format' => ['date'], 'filter' => MaskedInput::widget(['model' => $searchModel, 'attribute' => 'egr_fecha', 'mask' => '99/99/9999'])], ['attribute' => 'egr_hora', 'format' => ['time']], ['attribute' => 'egr_id_vehiculo', 'format' => 'raw', 'value' => function ($model, $index, $widget) { return Html::a($model->egr_id_vehiculo, Yii::$app->urlManager->createUrl(['vehiculos/view', 'id' => $model->egr_id_vehiculo]), ['title' => 'Ver detalle del vehiculo', 'target' => '_blank', 'data-pjax' => '0']); }], 'r_egr_patente', 'r_egr_marca', 'r_egr_modelo', 'r_egr_color', 'egr_id_porton', 'r_egr_usuario', 'egr_id_llave', 'control', ['attribute' => 'estado', 'value' => function ($data) { return Accesos::getEstados($data->estado); }, 'filter' => Accesos::getEstados()], 'motivo_baja']; if (\Yii::$app->user->can('exportarConsAccesos')) { // contiene la selección inicial de columnas, es decir, todas // por ejemplo [0,1,2,3] $poSel = []; // contiene las descripciones de las columnas // por ejemplo [0=>'Portón', 1=>'Usuario',2=>'Fecha',3=>'Texto'] $poItems = []; $i = -1; foreach ($columns as $c) {
use yii\helpers\Html; use yii\widgets\DetailView; use frontend\models\AccesosConceptos; /* @var $this yii\web\View */ /* @var $model frontend\models\AccesosConceptos */ $this->title = 'Detalle de concepto de acceso ' . $model->id; $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Conceptos de accesos'), 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="accesos-conceptos-view"> <h3><?php echo Html::encode($this->title); ?> </h3> <p> <?php echo Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']); ?> <?php echo Html::a($model->estado == AccesosConceptos::ESTADO_ACTIVO ? 'Deshabilita' : 'Habilita', ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Confirma el cambio de estado?', 'method' => 'post']]); ?> </p> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'concepto', ['attribute' => 'req_tarjeta', 'value' => AccesosConceptos::getSiNo($model->req_tarjeta)], ['attribute' => 'req_seguro', 'value' => AccesosConceptos::getSiNo($model->req_seguro)], 'userCreatedBy.username', 'created_at:datetime', 'userUpdatedBy.username', 'updated_at:datetime', ['label' => 'Estado', 'value' => AccesosConceptos::getEstados($model->estado)]]]); ?> </div>
} if ($action === 'mensajeV') { $url = Yii::$app->urlManager->createUrl(['mensajes/create-ajax', 'modelName' => 'frontend\\models\\Vehiculos', 'modelID' => $model->ing_id_vehiculo]); return $url; } if ($action === 'view') { $url = Yii::$app->urlManager->createUrl(['accesos/view', 'id' => $model->id]); return $url; } }], ['class' => '\\kartik\\grid\\CheckboxColumn', 'visible' => !$consulta], ['attribute' => 'id', 'format' => 'raw', 'value' => function ($model, $index, $widget) { return Html::a($model->id, Yii::$app->urlManager->createUrl(['accesos/view', 'id' => $model->id]), ['title' => 'Ver detalle', 'target' => '_blank', 'data-pjax' => '0']); }], ['attribute' => 'ing_fecha', 'format' => ['date'], 'filter' => MaskedInput::widget(['model' => $searchModel, 'attribute' => 'ing_fecha', 'mask' => '99/99/9999'])], ['attribute' => 'ing_hora', 'format' => ['time']], ['attribute' => 'id_persona', 'format' => 'raw', 'value' => function ($model, $index, $widget) { return Html::a($model->id_persona, Yii::$app->urlManager->createUrl(['personas/view', 'id' => $model->id_persona]), ['title' => 'Ver detalle de persona', 'target' => '_blank', 'data-pjax' => '0']); }], 'r_apellido', 'r_nombre', 'r_nombre2', 'r_nro_doc', ['attribute' => 'ing_id_vehiculo', 'format' => 'raw', 'value' => function ($model, $index, $widget) { return Html::a($model->ing_id_vehiculo, Yii::$app->urlManager->createUrl(['vehiculos/view', 'id' => $model->ing_id_vehiculo]), ['title' => 'Ver detalle del vehiculo', 'target' => '_blank', 'data-pjax' => '0']); }], 'r_ing_patente', 'r_ing_marca', 'r_ing_modelo', 'r_ing_color', ['attribute' => 'id_concepto', 'value' => 'desc_concepto', 'filter' => AccesosConceptos::getListaConceptos(false)], 'motivo', 'control']; if ($consulta && \Yii::$app->user->can('exportarConsDentro')) { // contiene la selección inicial de columnas, es decir, todas // por ejemplo [0,1,2,3] $poSel = []; // contiene las descripciones de las columnas // por ejemplo [0=>'Portón', 1=>'Usuario',2=>'Fecha',3=>'Texto'] $poItems = []; $i = -1; foreach ($columns as $c) { $i++; // si es un array busca la clave "attribute" if (is_array($c)) { foreach ($c as $key => $value) { if ($key == 'attribute') { $poSel[] = $i;
} if ($action === 'mensajeV') { $url = Yii::$app->urlManager->createUrl(['mensajes/create-ajax', 'modelName' => 'frontend\\models\\Vehiculos', 'modelID' => $model->ing_id_vehiculo]); return $url; } if ($action === 'view') { $url = Yii::$app->urlManager->createUrl(['accesos/view', 'id' => $model->id]); return $url; } }], ['class' => '\\kartik\\grid\\CheckboxColumn', 'visible' => !$consulta], ['attribute' => 'id_acceso', 'format' => 'raw', 'value' => function ($model, $index, $widget) { return Html::a($model->id_acceso, Yii::$app->urlManager->createUrl(['accesos/view', 'id' => $model->id_acceso]), ['title' => 'Ver detalle', 'target' => '_blank', 'data-pjax' => '0']); }], ['attribute' => 'ing_fecha', 'format' => ['date'], 'filter' => MaskedInput::widget(['model' => $searchModel, 'attribute' => 'ing_fecha', 'mask' => '99/99/9999'])], ['attribute' => 'ing_hora', 'format' => ['time']], ['attribute' => 'id_persona', 'format' => 'raw', 'value' => function ($model, $index, $widget) { return Html::a($model->id_persona, Yii::$app->urlManager->createUrl(['personas/view', 'id' => $model->id_persona]), ['title' => 'Ver detalle de persona', 'target' => '_blank', 'data-pjax' => '0']); }], 'r_apellido', 'r_nombre', 'r_nombre2', 'r_nro_doc', ['attribute' => 'ing_id_vehiculo', 'format' => 'raw', 'value' => function ($model, $index, $widget) { return Html::a($model->ing_id_vehiculo, Yii::$app->urlManager->createUrl(['vehiculos/view', 'id' => $model->ing_id_vehiculo]), ['title' => 'Ver detalle del vehiculo', 'target' => '_blank', 'data-pjax' => '0']); }], 'r_ing_patente', 'r_ing_marca', 'r_ing_modelo', 'r_ing_color', ['attribute' => 'id_concepto', 'value' => 'desc_concepto', 'filter' => AccesosConceptos::getListaConceptos(false)], 'motivo', 'control', ['attribute' => 'id_autorizante', 'format' => 'raw', 'value' => function ($model, $index, $widget) { return Html::a($model->id_autorizante, Yii::$app->urlManager->createUrl(['personas/view', 'id' => $model->id_autorizante]), ['title' => 'Ver detalle de autorizante', 'target' => '_blank', 'data-pjax' => '0']); }], 'r_aut_apellido', 'r_aut_nombre', 'r_aut_nombre2', 'id_uf']; if ($consulta && \Yii::$app->user->can('exportarConsDentro')) { // contiene la selección inicial de columnas, es decir, todas // por ejemplo [0,1,2,3] $poSel = []; // contiene las descripciones de las columnas // por ejemplo [0=>'Portón', 1=>'Usuario',2=>'Fecha',3=>'Texto'] $poItems = []; $i = -1; foreach ($columns as $c) { $i++; // si es un array busca la clave "attribute" if (is_array($c)) { foreach ($c as $key => $value) {
<div class="accesos-conceptos-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'concepto')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'req_tarjeta')->dropDownList(AccesosConceptos::getSiNo()); ?> <?php echo $form->field($model, 'req_seguro')->dropDownList(AccesosConceptos::getSiNo()); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div>
type : "POST", cache : false, url : "drop-lista?grupo=autorizantes&id=" + seleccion, success : function(r) { $("#divlistaautorizantes").html(r["autorizantes"]); } }); } }']]); ?> <br/><br/> <div class="panel panel-default"> <div class="panel-body"> <?php echo $form->field($model, 'id_concepto')->dropDownList(AccesosConceptos::getListaConceptos(false), ['prompt' => 'Elija el concepto', 'onchange' => ' $.ajax({ type:"POST", cache:false, url:"refresh-concepto?id_concepto=" + $(this).val(), success: function(r) { $("#divlistapersonas").html(r["ingpersonas"]); } }); ']); echo $form->field($model, 'motivo')->textInput(['maxlength' => true, 'style' => 'text-transform: uppercase']); if ($diferido) { echo $form->field($model, 'ing_hora')->widget(DateControl::classname(), ['type' => DateControl::FORMAT_DATETIME, 'displayFormat' => 'php:d/m/Y H:i']); } //echo $form->field($model,'cant_acomp')->textInput(); ?>
/** * Finds the AccesosConceptos model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return AccesosConceptos the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = AccesosConceptos::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }