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 app\models\hrd\Corp; use app\models\hrd\Dept; use app\models\hrd\Jabatan; use app\models\hrd\Status; use app\models\hrd\Employe; use kartik\widgets\ActiveForm; use kartik\builder\Form; use kartik\builder\FormGrid; use kartik\widgets\FileInput; use yii\helpers\ArrayHelper; $form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL]); //$form = ActiveForm::begin(['type'=>ActiveForm::TYPE_VERTICAL]); $nlDigit = Employe::find()->count() + 1; $nl = 'LG' . $nlDigit; echo FormGrid::widget(['model' => $model, 'form' => $form, 'autoGenerateColumns' => true, 'rows' => [['contentBefore' => '<legend class="text-info"><small>EMPLOYE IDENTITY</small></legend>', 'columns' => 1, 'autoGenerateColumns' => false, 'attributes' => ['employe_identity' => ['label' => 'Employee.ID', 'columns' => 5, 'attributes' => ['EMP_ID' => ['type' => Form::INPUT_TEXT, 'Form::SIZE_LARGE', 'options' => ['value' => $nl], 'columnOptions' => ['colspan' => 3]], 'EMP_NM' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter First Name...'], 'columnOptions' => ['colspan' => 4]], 'EMP_NM_BLK' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter Last Name...'], 'columnOptions' => ['colspan' => 4]]]]]], ['contentBefore' => '<legend class="text-info"><small>CORPORATE IDENTITY</small></legend>', 'columns' => 2, 'autoGenerateColumns' => false, 'attributes' => ['employe_identity' => ['label' => 'Company', 'columns' => 2, 'attributes' => ['EMP_CORP_ID' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => ArrayHelper::map(Corp::find()->orderBy('SORT')->asArray()->all(), 'CORP_ID', 'CORP_NM'), 'columnOptions' => ['colspan' => 1]], 'DEP_ID' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => ArrayHelper::map(Dept::find()->orderBy('SORT')->asArray()->all(), 'DEP_ID', 'DEP_NM'), 'hint' => 'Select Department', 'columnOptions' => ['colspan' => 1]], 'JAB_ID' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => ArrayHelper::map(Jabatan::find()->orderBy('SORT')->asArray()->all(), 'JAB_ID', 'JAB_NM'), 'hint' => 'Select Position ', 'columnOptions' => ['colspan' => 1]], 'EMP_STS' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => ArrayHelper::map(Status::find()->orderBy('SORT')->asArray()->all(), 'STS_ID', 'STS_NM'), 'hint' => 'Select Employee Status', 'columnOptions' => ['colspan' => 1]], 'EMP_JOIN_DATE' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\kartik\\widgets\\DatePicker', 'options' => ['pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd', 'todayHighlight' => true]], 'hint' => 'Enter Join Date (yyyy-mm-dd)', 'columnOptions' => ['colspan' => 1]], 'EMP_RESIGN_DATE' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\kartik\\widgets\\DatePicker', 'options' => ['pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd', 'todayHighlight' => true]], 'hint' => 'Enter Resign Date (yyyy-mm-dd)', 'columnOptions' => ['colspan' => 1]]]]]], ['contentBefore' => '<legend class="text-info"><small>EMPLOYEE PROFILE</small></legend>', 'columns' => 3, 'autoGenerateColumns' => false, 'attributes' => ['address_detail' => ['label' => 'Address', 'columns' => 6, 'attributes' => ['EMP_KTP' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter NO KTP...'], 'columnOptions' => ['colspan' => 2]], 'EMP_ALAMAT' => ['type' => Form::INPUT_TEXTAREA, 'options' => ['placeholder' => 'Enter address...'], 'columnOptions' => ['colspan' => 6]], 'EMP_ZIP' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Zip...'], 'columnOptions' => ['colspan' => 1]], 'EMP_HP' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Phone...'], 'columnOptions' => ['colspan' => 2]], 'EMP_GENDER' => ['type' => Form::INPUT_RADIO_LIST, 'items' => ['Male' => 'Male', 'Female' => 'Female'], 'options' => ['inline' => 'Male'], 'columnOptions' => ['colspan' => 4]], 'EMP_TGL_LAHIR' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\kartik\\widgets\\DatePicker', 'options' => ['pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd', 'todayHighlight' => true]], 'hint' => 'Enter birthday (yyyy-mm-dd)', 'columnOptions' => ['colspan' => 3]], 'EMP_EMAIL' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'acount@domain.com...', 'addon' => ['prepend' => ['content' => '@']]], 'columnOptions' => ['colspan' => 3]]]]]], ['columns' => 3, 'attributes' => ['address_detail' => ['label' => 'Picture', 'columns' => 6, 'attributes' => ['EMP_IMG' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\kartik\\widgets\\FileInput', 'columnOptions' => ['colspan' => 2]]]]]], ['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 app\models\hrd\Jabatan; use kartik\widgets\ActiveForm; use kartik\builder\Form; use kartik\builder\FormGrid; use kartik\widgets\FileInput; use yii\helpers\ArrayHelper; $this->mddPage = 'hrd'; //$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 app\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->mddPage = 'hrd'; //$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.'); } }
public function getJabOne() { return $this->hasOne(Jabatan::className(), ['JAB_ID' => 'JAB_ID']); }