public function getKey_Jabatan() { $sql = 'SELECT max(JAB_ID) as JAB_ID FROM jabatan'; $cntjabatan = Jabatan::findBySql($sql)->one(); $id_cnt_jab = $cntjabatan->JAB_ID + 1; return $id_cnt_jab; }
public function search($params) { /*[5.1] JOIN TABLE */ $query = Jabatan::find(); $dataProvider_Jab = new ActiveDataProvider(['query' => $query]); /*[5.3] LOAD VALIDATION PARAMS */ /*LOAD FARM VER 1*/ $this->load($params); if (!$this->validate()) { return $dataProvider_Jab; } /*[5.4] FILTER WHERE LIKE (string/integer)*/ /* FILTER COLUMN Author -ptr.nov-*/ $query->andFilterWhere(['like', 'JAB_ID', $this->JAB_ID])->andFilterWhere(['like', 'JAB_NM', $this->JAB_NM]); return $dataProvider_Jab; }
<?php use yii\helpers\Html; use lukisongroup\models\hrd\Jabatan; use kartik\widgets\ActiveForm; use kartik\builder\Form; use kartik\builder\FormGrid; use kartik\widgets\FileInput; use yii\helpers\ArrayHelper; $this->sideMenu = 'hrd_employee'; //$form = ActiveForm::begin(['type'=>ActiveForm::TYPE_HORIZONTAL,'options'=>['enctype'=>'multipart/form-data']]); //$form = ActiveForm::begin(['type'=>ActiveForm::TYPE_HORIZONTAL]); $form = ActiveForm::begin(['type' => ActiveForm::TYPE_VERTICAL]); $nlDigit = Jabatan::find()->count() + 1; $nl = 'LG' . $nlDigit; echo FormGrid::widget(['model' => $model, 'form' => $form, 'autoGenerateColumns' => true, 'rows' => [['contentBefore' => '<legend class="text-info"><small>JABATAN IDENTITY</small></legend>', 'columns' => 1, 'autoGenerateColumns' => false, 'attributes' => ['employe_identity' => ['label' => 'Jabatan.ID', 'columns' => 5, 'attributes' => ['JAB_ID' => ['type' => Form::INPUT_TEXT, 'Form::SIZE_LARGE', 'options' => [], 'columnOptions' => ['colspan' => 3]], 'JAB_NM' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Position Name...'], 'columnOptions' => ['colspan' => 4]], 'JAB_DCRP' => ['type' => Form::INPUT_TEXTAREA, 'options' => ['placeholder' => 'Position Description ...'], 'columnOptions' => ['colspan' => 4]], 'SORT' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'SORT...'], 'columnOptions' => ['colspan' => 4]]]]]], ['attributes' => ['actions' => ['type' => Form::INPUT_RAW, 'value' => '<div style="text-align: right; margin-top: 20px">' . Html::resetButton('Reset', ['class' => 'btn btn-default']) . ' ' . Html::submitButton('Submit', ['class' => 'btn btn-primary']) . '</div>']]]]]); ActiveForm::end();
<?php use yii\helpers\Html; use yii\helpers\ArrayHelper; use lukisongroup\models\hrd\Jabatan; use kartik\detail\DetailView; use yii\bootstrap\Modal; use kartik\widgets\ActiveField; use kartik\widgets\ActiveForm; use kartik\builder\Form; use kartik\icons\Icon; use kartik\widgets\Growl; $this->sideMenu = 'hrd_employee'; //$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Maxiprodaks'), 'url' => ['prodak']]; //$this->params['breadcrumbs'][] = $this->title; ?> <?php $Jabatan_MDL = Jabatan::find()->where(['JAB_ID' => $model->JAB_ID])->orderBy('SORT')->one(); $Val_Jabatan = $Jabatan_MDL->JAB_NM; $attribute = [['attribute' => 'JAB_ID'], ['attribute' => 'JAB_NM'], ['attribute' => 'JAB_DCRP', 'format' => 'raw', 'type' => DetailView::INPUT_TEXTAREA, 'widgetOptions' => ['data' => 'JAB_DCRP', 'options' => ['placeholder' => 'Position Description ...'], 'pluginOptions' => ['allowClear' => true]]], ['attribute' => 'SORT']]; echo DetailView::widget(['model' => $model, 'condensed' => true, 'hover' => true, 'mode' => DetailView::MODE_VIEW, 'panel' => ['heading' => $model->JAB_ID . '| ' . $model->JAB_NM, 'type' => DetailView::TYPE_INFO], 'attributes' => $attribute]); ?>
/** * CLASS TABLE FIND PrimaryKey * Example: Employe::find() */ protected function findModel($id) { if (($model = Jabatan::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }