/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Warga_status::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]); $query->andFilterWhere(['like', 'RUMAH_STATUS', $this->RUMAH_STATUS]); return $dataProvider; }
<?php use yii\helpers\Html; use yii\widgets\ActiveForm; use kartik\widgets\Select2; use yii\helpers\ArrayHelper; use yii\helpers\Url; use kartik\widgets\DepDrop; use kartik\widgets\TouchSpin; /* @var $this yii\web\View */ /* @var $model ubud\dashboard\models\Warga_data */ /* @var $form yii\widgets\ActiveForm */ 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'); /* $aryBlok= [ ['RUMAH_BLOCK' => 1, 'DESCRIP' => 'G1'], ['RUMAH_BLOCK' => 2, 'DESCRIP' => 'G2'], ['RUMAH_BLOCK' => 3, 'DESCRIP' => 'G3'], ['RUMAH_BLOCK' => 4, 'DESCRIP' => 'G4'], ['RUMAH_BLOCK' => 5, 'DESCRIP' => 'G5'], ['RUMAH_BLOCK' => 6, 'DESCRIP' => 'G6'], ['RUMAH_BLOCK' => 7, 'DESCRIP' => 'G7'], ['RUMAH_BLOCK' => 8, 'DESCRIP' => 'G8'], ['RUMAH_BLOCK' => 9, 'DESCRIP' => 'G27'], ['RUMAH_BLOCK' => 10, 'DESCRIP' => 'G28'], ['RUMAH_BLOCK' => 11, 'DESCRIP' => 'G29'], ['RUMAH_BLOCK' => 12, 'DESCRIP' => 'G30'],
public function getSttrumah() { return $this->hasOne(Warga_status::className(), ['ID' => 'RUMAH_STT']); }
/** * Finds the Warga_status model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return Warga_status the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Warga_status::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
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"> <div class="col-sm-12 col-md-2 col-lg-12" style="padding-left:15px; padding-right:15px"> <?php echo $dataWarga; ?> </div>