예제 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = CortesEnergia::find();
     $pageSize = isset($_GET['per-page']) ? $_GET['per-page'] : \Yii::$app->params['cortesEnergia.defaultPageSize'];
     // add conditions that should always apply here
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => $pageSize], 'sort' => ['defaultOrder' => ['hora_desde' => SORT_DESC], 'enableMultiSort' => true]]);
     $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;
     }
     // grid filtering conditions
     $query->andFilterWhere(['id' => $this->id, 'hora_desde' => $this->hora_desde, 'hora_hasta' => $this->hora_hasta, 'created_by' => $this->created_by, 'created_at' => $this->created_at, 'updated_by' => $this->updated_by, 'updated_at' => $this->updated_at, 'estado' => $this->estado]);
     $query->andFilterWhere(['like', 'motivo_baja', $this->motivo_baja]);
     return $dataProvider;
 }
 /**
  * Deletes an existing CortesEnergiaGen model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $id
  * @return mixed
  */
 public function actionDelete($id)
 {
     $model = $this->findModel($id);
     $parent = CortesEnergia::findOne($model->id_cortes_energia);
     if ($model->load(Yii::$app->request->post())) {
         $model->estado = CortesEnergiaGen::ESTADO_BAJA;
         if ($model->save()) {
             return $this->redirect(['view', 'id' => $model->id]);
         }
     } else {
         return $this->render('delete', ['model' => $model, 'parent' => $parent]);
     }
 }
예제 #3
0
파일: view.php 프로젝트: ibergonzi/country
/* @var $model frontend\models\CortesEnergia */
$this->title = 'Corte de energía';
$this->params['breadcrumbs'][] = ['label' => 'Cortes de energía', 'url' => ['cortes-energia/index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="cortes-energia-view">

    <h3><?php 
echo Html::encode($this->title);
?>
</h3>

	<?php 
if ($model->estado == CortesEnergia::ESTADO_ACTIVO) {
    echo '<p>';
    if (\Yii::$app->user->can('modificarCorte')) {
        echo Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
    }
    if (\Yii::$app->user->can('borrarCorte')) {
        echo ' ' . Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger']);
    }
    echo '</p>';
}
?>

    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['hora_desde:datetime', 'hora_hasta:datetime', 'userCreatedBy.username', 'created_at:datetime', 'userUpdatedBy.username', 'updated_at:datetime', ['label' => 'Estado', 'value' => CortesEnergia::getEstados($model->estado)], 'motivo_baja']]);
?>

</div>
예제 #4
0
 /**
  * Finds the CortesEnergia model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return CortesEnergia the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = CortesEnergia::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
예제 #5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdCortesEnergia()
 {
     return $this->hasOne(CortesEnergia::className(), ['id' => 'id_cortes_energia']);
 }
예제 #6
0
파일: index.php 프로젝트: ibergonzi/country
    background: #ffffff url("../images/loading.gif") top center no-repeat !important;
}
');
?>
<div class="cortes-energia-index">

    <h3><?php 
echo Html::encode($this->title);
?>
</h3>
    <?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 = [['attribute' => 'hora_desde', 'format' => ['datetime'], 'filter' => MaskedInput::widget(['model' => $searchModel, 'attribute' => 'hora_desde', 'mask' => '99/99/9999'])], ['attribute' => 'hora_hasta', 'format' => ['datetime'], 'filter' => MaskedInput::widget(['model' => $searchModel, 'attribute' => 'hora_hasta', 'mask' => '99/99/9999'])], ['attribute' => 'estado', 'value' => function ($data) {
    return CortesEnergia::getEstados($data->estado);
}, 'filter' => $searchModel->estados], 'motivo_baja', ['class' => 'kartik\\grid\\ActionColumn', 'template' => '{view} {comentario} {generadores}', '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) {
예제 #7
0
파일: main.php 프로젝트: ibergonzi/country
$this->beginBody();
?>

<div class="wrap">
    <?php 
NavBar::begin(['brandLabel' => 'Barrio Miraflores', 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]);
$menuItems = [];
if (Yii::$app->user->isGuest) {
    //$menuItems[] = ['label' => 'Inicio', 'url' => ['/site/index']];
    //$menuItems[] = ['label' => 'Acerca de', 'url' => ['/site/about']];
    $menuItems[] = ['label' => 'Contacto', 'url' => ['/site/contact']];
    $menuItems[] = ['label' => 'Registrarse', 'url' => ['/site/signup']];
    $menuItems[] = ['label' => 'Ingresar', 'url' => ['/site/login']];
} else {
    // Generador
    $corteActivo = CortesEnergia::corteActivo();
    if ($corteActivo) {
        $menuItems[] = ['label' => Html::tag('i', '', ['class' => 'fa fa-lg fa-cog fa-spin']), 'url' => ['/cortes-energia/start-stop'], 'options' => ['title' => 'El corte comenzó el ' . Yii::$app->formatter->asDatetime($corteActivo->hora_desde)]];
        $itemCorte = ['label' => '<span class="fa fa-lg fa-cog fa-spin"></span>&nbsp; Terminar Corte', 'url' => ['/cortes-energia/start-stop'], 'visible' => \Yii::$app->user->can('accederCortesStartStop')];
    } else {
        $itemCorte = ['label' => '<span class="fa fa-cog"></span>&nbsp;Empezar Corte', 'url' => ['/cortes-energia/start-stop'], 'visible' => \Yii::$app->user->can('accederCortesStartStop')];
    }
    $menuItems[] = ['label' => 'Accesos', 'items' => [['label' => '<span class="glyphicon glyphicon-arrow-right"></span>&nbsp;Ingresos', 'url' => ['/accesos/ingreso'], 'visible' => \Yii::$app->user->can('accederIngreso')], ['label' => '<span class="glyphicon glyphicon-arrow-left"></span>&nbsp;Egresos', 'url' => ['/accesos/egreso'], 'visible' => \Yii::$app->user->can('accederEgreso')], ['label' => '<span class="fa fa-users"></span>&nbsp;Egreso Grupal', 'url' => ['/accesos/egreso-grupal'], 'visible' => \Yii::$app->user->can('accederEgresoGrupal')], ['label' => '<span class="glyphicon glyphicon-book"></span>&nbsp;Libro', 'url' => ['/libro/index'], 'visible' => \Yii::$app->user->can('accederLibro')], '<li class="divider"></li>', '<li class="dropdown-header">Consultas</li>', ['label' => 'Accesos', 'url' => ['/accesos/index'], 'visible' => \Yii::$app->user->can('accederConsAccesos')], ['label' => 'Personas adentro', 'url' => ['/accesos/cons-dentro'], 'visible' => \Yii::$app->user->can('accederConsDentro')], ['label' => 'Estadisticas', 'url' => ['/accesos/stats'], 'visible' => \Yii::$app->user->can('accederStatsAccesos')], ['label' => 'Lista de Personas', 'url' => ['/personas/index'], 'visible' => \Yii::$app->user->can('accederListaPersonas')], ['label' => 'Lista de Vehiculos', 'url' => ['/vehiculos/index'], 'visible' => \Yii::$app->user->can('accederListaVehiculos')], ['label' => 'Agenda', 'url' => ['/agenda/index'], 'visible' => \Yii::$app->user->can('accederAgenda')], '<li class="divider"></li>', '<li class="dropdown-header">Diferido</li>', ['label' => '<span class="glyphicon glyphicon-arrow-right"></span>&nbsp;Ingresos', 'url' => ['/accesos/ingreso', 'diferido' => 1], 'visible' => \Yii::$app->user->can('accederIngreso')], ['label' => '<span class="glyphicon glyphicon-arrow-left"></span>&nbsp;Egresos', 'url' => ['/accesos/egreso', 'diferido' => 1], 'visible' => \Yii::$app->user->can('accederEgreso')]]];
    // fin menuItems[]
    $menuItems[] = ['label' => 'Infracciones', 'items' => [['label' => 'Infracciones/multas', 'url' => ['/infracciones/index'], 'visible' => \Yii::$app->user->can('accederListaInfrac')], ['label' => 'Informe de multas', 'url' => ['/infracciones/rendic-fechas'], 'visible' => \Yii::$app->user->can('accederRendicMultas')]]];
    // fin menuItems[]
    $menuItems[] = ['label' => 'Energia', 'items' => [$itemCorte, '<li class="divider"></li>', '<li class="dropdown-header">Consultas</li>', ['label' => 'Cortes de energía', 'url' => ['/cortes-energia/index'], 'visible' => \Yii::$app->user->can('accederConsCortes')]]];
    // fin menuItems[]
    $menuItems[] = ['label' => 'Unidades', 'items' => [['label' => 'Lista de U.F.', 'url' => ['/uf/index'], 'visible' => \Yii::$app->user->can('accederListaUf')], '<li class="divider"></li>', '<li class="dropdown-header">Consultas</li>', ['label' => 'Expensas', 'url' => ['/titularidad-vista/index'], 'visible' => \Yii::$app->user->can('accederListaUf')]]];
    // fin menuItems[]
    $menuItems[] = ['label' => 'Parámetros', 'items' => [['label' => 'Autorizantes', 'url' => ['/autorizantes/index'], 'visible' => \Yii::$app->user->can('accederListaAutorizantes')], ['label' => 'Usuarios', 'url' => ['/user/index'], 'visible' => \Yii::$app->user->can('accederUser')], ['label' => 'Carnets', 'url' => ['/carnets/index'], 'visible' => \Yii::$app->user->can('accederCarnets')], ['label' => 'Cambio Personas', 'url' => ['/personas/change'], 'visible' => \Yii::$app->user->can('cambiarPersona')], ['label' => 'Tipos de documento', 'url' => ['/tiposdoc/index'], 'visible' => \Yii::$app->user->can('accederParametros')], ['label' => 'Movimientos de U.F.', 'url' => ['/movim-uf/index'], 'visible' => \Yii::$app->user->can('accederParametros')], ['label' => 'Generadores', 'url' => ['/generadores/index'], 'visible' => \Yii::$app->user->can('accederParametros')], '<li class="divider"></li>', ['label' => 'Infracciones: Conceptos', 'url' => ['/infrac-conceptos/index'], 'visible' => \Yii::$app->user->can('accederParametros')], ['label' => 'Infracciones: Unidades', 'url' => ['/infrac-unidades/index'], 'visible' => \Yii::$app->user->can('accederParametros')], '<li class="divider"></li>', ['label' => 'Autoriz.accesos manuales', 'url' => ['/accesos-autmanual/index'], 'visible' => \Yii::$app->user->can('accederAutManualAccesos')], ['label' => 'Conceptos de accesos', 'url' => ['/accesosconceptos/index'], 'visible' => \Yii::$app->user->can('accederParametros')]]];