public function actionIndex($id) { $searchModel = new Warga_dataSearch(); if ($id == 11) { //RW $modelRslt = Warga_data::find()->where('STATUS<>3 AND RW=' . $id)->one(); $model = $modelRslt != '' ? $modelRslt : '0'; $dpDataProvider = $searchModel->searchDataWargaRW(Yii::$app->request->queryParams, $id); } else { //RT $modelRslt = Warga_data::find()->where('STATUS<>3 AND RT=' . $id)->one(); $model = $modelRslt != '' ? $modelRslt : '0'; $dpDataProvider = $searchModel->searchDataWargaRT(Yii::$app->request->queryParams, $id); } if ($id == 1 or $id == 2 or $id == 3 or $id == 4 or $id == 11) { return $this->render('index', ['id' => $id, 'model' => $model, 'searchModel' => $searchModel, 'dpDataProvider' => $dpDataProvider]); } else { /*NO DATA*/ return $this->render('indexNoData'); } }
$icon = '<span class="glyphicon glyphicon-search"></span>'; $label = $icon . ' ' . $title; $url = Url::toRoute(['/dashboard/warga-data/cari','rt'=>$rt]); $content = Html::a($label,$url, $options); return $content; } */ /* * COLUMN DATA RT * @author ptrnov [piter@lukison.com] * @since 1.2 */ $clmRt = [['class' => 'kartik\\grid\\ExpandRowColumn', 'width' => '20px', 'value' => function ($model, $key, $index, $column) { return GridView::ROW_COLLAPSED; //return GridView::ROW_NONE; }, 'detail' => function ($model, $key, $index, $column) { $searchModelWarga = new Warga_dataSearch(); $dataProviderWarga = $searchModelWarga->searchGroup(Yii::$app->request->queryParams, $model->id_rt); return Yii::$app->controller->renderPartial('data-warga', ['searchModelWarga' => $searchModelWarga, 'dataProviderWarga' => $dataProviderWarga]); }, 'detailOptions' => ['id' => 'gvxs'], 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '200px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'center', 'width' => '200px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt']], 'hiddenFromExport' => false], ['class' => 'kartik\\grid\\ActionColumn', 'dropdown' => true, 'template' => '{data_rw}{laporan_rw}', 'dropdownOptions' => ['class' => 'pull-left dropdown'], 'buttons' => ['data_rw' => function ($url, $model, $key) { return '<li>' . Html::a('<span class="fa fa-eye fa-dm"></span>' . Yii::t('app', 'Warga RW' . $model->id_rw), ['/dashboard/warga-data-rw'], ['data-title' => $model->id_rt]) . '</li>' . PHP_EOL; }, 'laporan_rw' => function ($url, $model, $key) { return '<li>' . Html::a('<span class="fa fa-edit fa-dm"></span>' . Yii::t('app', 'Review Warga RW' . $model->id_rw), ['/dashboard/warga-data-rw/analiz'], ['data-title' => $model->id_rt]) . '</li>' . PHP_EOL; }], 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '50px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'center', 'width' => '50px', 'height' => '10px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt']]], ['attribute' => 'id_rt', 'value' => function ($model) { return 'RT.0' . $model->id_rt; }, 'label' => 'RUKUN WARGA', 'hAlign' => 'left', 'vAlign' => 'middle', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '150px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'center', 'width' => '150px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt']]], ['attribute' => 'ket_rt', 'label' => 'Keterangan', 'value' => function ($model) { return 'RUKUN TETANGGA ' . $model->ket_rt; }, 'hAlign' => 'left', 'vAlign' => 'middle', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '350px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'left', 'width' => '350px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt']]]]; $dataRt = GridView::widget(['id' => 'gv-rt-warga', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'filterRowOptions' => ['style' => 'background-color:rgba(0, 95, 218, 0.3); align:center'], 'showPageSummary' => true, 'columns' => $clmRt, 'pjax' => true, 'pjaxSettings' => ['options' => ['enablePushState' => false, 'id' => 'gv-rt-warga']], 'hover' => true, 'responsive' => true, 'responsiveWrap' => true, 'bordered' => true, 'striped' => '4px', 'autoXlFormat' => true, 'export' => false]); ?> <div class="body-content"> <div class="row" style="padding-left: 5px; padding-right: 5px">
/** * Lists all Warga_data models. * @return mixed */ public function actionIndex() { /* $paramCari=Yii::$app->getRequest()->getQueryParam('id'); if ($paramCari!=''){ $cari=['KK_NM'=>$paramCari]; }else{ $cari=''; }; */ if (!Yii::$app->user->isGuest) { if (Yii::$app->request->post('hasEditable')) { $idx = Yii::$app->request->post('editableKey'); Yii::$app->response->format = Response::FORMAT_JSON; $model = Warga_data::findOne($idx); $out = Json::encode(['output' => '', 'message' => '']); $post = []; $posted = current($_POST['Warga_data']); $post['Warga_data'] = $posted; if ($model->load($post)) { $output = ''; $model->save(); /* RUMAH_STT */ if (isset($posted['RUMAH_STT'])) { $output = $model->RUMAH_STT; } /* JUMLAH_ANGOTA */ if (isset($posted['JUMLAH_ANGOTA'])) { $output = Yii::$app->formatter->asInteger($model->JUMLAH_ANGOTA); } /* HTLP_RUMAH */ if (isset($posted['TLP_RUMAH'])) { $output = $model->TLP_RUMAH; } /* TLP_KANTOR */ if (isset($posted['TLP_KANTOR'])) { $output = $model->TLP_KANTOR; } /* TLP_HP */ if (isset($posted['TLP_HP'])) { $output = $model->TLP_HP; } $out = Json::encode(['output' => $output, 'message' => '']); } // return ajax json encoded response and exit echo $out; return; } $searchModel = new Warga_dataSearch(['RT' => Yii::$app->user->identity->warga]); //$searchModel = new Warga_dataSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); } }