/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Rt::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_rt' => $this->id_rt, 'id_rw' => $this->id_rw, 'id_ketua_rt' => $this->id_ketua_rt]); $query->andFilterWhere(['like', 'no_rt', $this->no_rt])->andFilterWhere(['like', 'ket_rt', $this->ket_rt]); return $dataProvider; }
/** * Finds the Rt model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Rt the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Rt::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
use app\models\hrd\Dept; use kartik\grid\GridView; use kartik\widgets\ActiveForm; use kartik\tabs\TabsX; use kartik\date\DatePicker; use kartik\builder\Form; use yii\bootstrap\Modal; use yii\helpers\Url; use kartik\editable\Editable; use ubud\dashboard\models\Pembukuan_type; use ubud\dashboard\models\Pembukuan_child; use ubud\dashboard\models\Pembukuan_golongan; use ubud\dashboard\models\Rt; $filterTypeNm = ArrayHelper::map(Pembukuan_type::find()->all(), 'TYPE_ID', 'TYPE_NM'); $filterChildNm = ArrayHelper::map(Pembukuan_child::find()->where(['SRC' => 'rw11'])->all(), 'CHILD_ID', 'CHILD_NM'); $dataRt = ArrayHelper::map(Rt::find()->all(), 'id_rt', 'ket_rt'); $arySource = [['user_warga' => 'rw11', 'DESCRIP' => 'RW11'], ['user_warga' => 1, 'DESCRIP' => 'RT01'], ['user_warga' => 2, 'DESCRIP' => 'RT02'], ['user_warga' => 3, 'DESCRIP' => 'RT03'], ['user_warga' => 4, 'DESCRIP' => 'RT04']]; $valSource = ArrayHelper::map($arySource, 'DESCRIP', 'DESCRIP'); $aryStatus = [['STATUS' => 0, 'DESCRIP' => 'proses'], ['STATUS' => 1, 'DESCRIP' => 'closing']]; $valStatus = ArrayHelper::map($aryStatus, 'STATUS', 'DESCRIP'); function sttPembukuan($model) { if ($model->STATUS == 0) { /*open*/ return Html::a('<i class="glyphicon glyphicon-ok"></i> proses', '#', ['class' => 'btn btn-success btn-xs', 'style' => ['width' => '100px'], 'title' => 'process']); } elseif ($model->STATUS == 1) { /*closing*/ return Html::a('<i class="fa fa-remove fa-md"></i> Closing', '#', ['class' => 'btn btn-danger btn-xs', 'style' => ['width' => '25px'], 'title' => 'Closing']); } } //$this->title = 'Pembukuans';
use yii\bootstrap\Modal; use yii\helpers\Url; use kartik\editable\Editable; use ubud\dashboard\models\Warga_status; use ubud\dashboard\models\Rt; use ubud\dashboard\models\Warga_block; $sttNm = ArrayHelper::map(Warga_status::find()->all(), 'ID', 'RUMAH_STATUS'); $dataRt = ArrayHelper::map(Rt::find()->all(), 'id_rt', 'ket_rt'); $dataBlock = ArrayHelper::map(Warga_block::find()->all(), 'RUMAH_BLOCK', 'RUMAH_BLOCK'); /* * COLUMN DATA Warga * @author ptrnov [piter@lukison.com] * @since 1.2 */ $clmWarga = [['class' => 'kartik\\grid\\SerialColumn', 'width' => '10px', 'header' => 'No.', 'hAlign' => 'center', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'font-family' => 'tahoma', 'font-size' => '8pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'font-family' => 'tahoma', 'font-size' => '8pt']], 'pageSummaryOptions' => ['style' => ['border-right' => '0px']]], ['attribute' => 'RT', 'label' => 'Rukun Tetangga', 'filter' => $dataRt, 'value' => function ($model) { $nmRt = Rt::find()->where(['id_rt' => $model->RT])->one(); return $nmRt->ket_rt; }, 'hAlign' => 'left', 'vAlign' => 'middle', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '80px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'center', 'width' => '80px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt']]], ['attribute' => 'KK_NM', 'label' => 'Nama.KK', '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' => 'left', 'width' => '150px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt']]], ['attribute' => 'RUMAH_BLOCK', 'label' => 'Block', 'filter' => $dataBlock, 'hAlign' => 'left', 'vAlign' => 'middle', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '80px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'left', 'width' => '80px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt']]], ['attribute' => 'RUMAH_NO', 'label' => 'No.Rumah', 'hAlign' => 'left', 'vAlign' => 'middle', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '20px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'center', 'width' => '20px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt']]], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'RUMAH_STT', 'label' => 'Status.Rumah', 'value' => function ($model) { $sttNm = Warga_status::find()->where(['ID' => $model->RUMAH_STT])->one(); return $sttNm->RUMAH_STATUS; }, 'filter' => $sttNm, 'hAlign' => 'left', 'vAlign' => 'middle', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '80px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'left', 'width' => '80px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt']], 'editableOptions' => ['header' => 'Status Kepemilikan', 'inputType' => \kartik\editable\Editable::INPUT_SELECT2, 'size' => 'md', 'options' => ['data' => $sttNm, 'pluginOptions' => ['allowClear' => true, 'class' => 'pull-top dropup']], 'displayValueConfig' => ArrayHelper::map(Warga_status::find()->all(), 'ID', 'RUMAH_STATUS')]], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'JUMLAH_ANGOTA', 'label' => 'Anggota Keluarga', 'hAlign' => 'left', 'vAlign' => 'middle', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '30px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'center', 'width' => '30px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt']], 'editableOptions' => ['header' => 'Anggota Keluarga', 'widgetClass' => Editable::INPUT_WIDGET, 'inputType' => Editable::INPUT_SPIN, 'options' => ['pluginOptions' => ['buttonup_class' => 'btn btn-primary', 'buttondown_class' => 'btn btn-info', 'buttonup_txt' => '<i class="glyphicon glyphicon-plus-sign"></i>', 'buttondown_txt' => '<i class="glyphicon glyphicon-minus-sign"></i>']]]], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'TLP_RUMAH', 'label' => 'Tlp.Rumah', 'hAlign' => 'left', 'vAlign' => 'middle', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '60px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'left', 'width' => '60px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt']]], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'TLP_KANTOR', 'label' => 'Tlp.Kantor', 'hAlign' => 'left', 'vAlign' => 'middle', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '60px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'left', 'width' => '60px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt']]], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'TLP_HP', 'label' => 'Handphone', 'hAlign' => 'left', 'vAlign' => 'middle', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '60px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'left', 'width' => '60px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt']]], ['class' => 'kartik\\grid\\ActionColumn', 'dropdown' => true, 'template' => '{view}{edit}{delete}', 'dropdownOptions' => ['class' => 'pull-right dropup'], 'buttons' => ['view' => function ($url, $model, $key) { return '<li>' . Html::a('<span class="fa fa-eye fa-dm"></span>' . Yii::t('app', 'View'), ['/dashboard/warga-data-rw/view', 'id' => $model->ID], ['data-toggle' => "modal", 'data-target' => "#modal-view", 'data-title' => 'RT0' . $model->RT]) . '</li>' . PHP_EOL; }, 'edit' => function ($url, $model, $key) { return '<li>' . Html::a('<span class="fa fa-edit fa-dm"></span>' . Yii::t('app', 'Edit'), ['/dashboard/warga-data-rw/edit', 'id' => $model->ID], ['data-toggle' => "modal", 'data-target' => "#modal-edit", 'data-title' => 'RT0' . $model->RT]) . '</li>' . PHP_EOL; }, 'delete' => function ($url, $model, $key) { return '<li>' . Html::a('<span class="fa fa-remove fa-dm"></span>' . Yii::t('app', 'delete'), ['/dashboard/warga-data-rw/delete', 'id' => $model->ID], ['data-method' => 'post', 'data-confirm' => 'Anda yakin ingin menghapus data warga ' . $model->KK_NM . ' ?']) . '</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']]]]; $dataWarga = GridView::widget(['id' => 'gv-data-warga', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'filterRowOptions' => ['style' => 'background-color:rgba(0, 95, 218, 0.3); align:center'], 'showPageSummary' => true, 'columns' => $clmWarga, 'pjax' => true, 'pjaxSettings' => ['options' => ['enablePushState' => false, 'id' => 'gv-data-warga']], 'panel' => ['heading' => '<h3 class="panel-title">DATA WARGA</h3>', 'before' => Html::a('<i class="glyphicon glyphicon-plus"></i> ' . Yii::t('app', 'Tambah Warga ', ['modelClass' => 'Kategori']), '/dashboard/warga-data-rw/create', ['data-toggle' => "modal", 'data-target' => "#modal-create", 'class' => 'btn btn-success']), 'showFooter' => false], 'toolbar' => [], '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">