/** * Update Informasi Departement * * @param $id * * @return mixed */ public function update($id) { $db = $this->departement->find($id); $canUpdate = $db->canUpdate(); if ($canUpdate) { /** @noinspection PhpUndefinedFieldInspection */ $db->name = Input::get('name'); /** @noinspection PhpUndefinedFieldInspection */ $db->info = Input::get('info'); /** @noinspection PhpUndefinedFieldInspection */ $db->uuid = uniqid('Update_'); $updated = $db->save(); return $this->response($db->toArray(), $updated); } return $this->response(array(), $canUpdate); }
<?php use yii\helpers\Html; use kartik\widgets\ActiveForm; use kartik\builder\Form; use kartik\builder\FormGrid; use kartik\widgets\FileInput; use yii\helpers\ArrayHelper; $this->sideMenu = 'hrd'; $form = ActiveForm::begin(['type' => ActiveForm::TYPE_VERTICAL]); $nlDigit = Dept::find()->count() + 1; $nl = 'LG' . $nlDigit; ?> <?php echo FormGrid::widget(['model' => $model, 'form' => $form, 'autoGenerateColumns' => true, 'rows' => [['contentBefore' => '<legend class="text-info"><small>DEPARTMENT IDENTITY</small></legend>', 'columns' => 1, 'autoGenerateColumns' => false, 'attributes' => ['employe_identity' => ['label' => 'Dept.ID', 'columns' => 5, 'attributes' => ['DEP_ID' => ['type' => Form::INPUT_TEXT, 'Form::SIZE_LARGE', 'options' => [], 'columnOptions' => ['colspan' => 3]], 'DEP_NM' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Department Name...'], 'columnOptions' => ['colspan' => 4]], 'DEP_DCRP' => ['type' => Form::INPUT_TEXTAREA, 'options' => ['placeholder' => 'Department 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\Modulset; 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; $Dept_MDL = Dept::find()->where(['DEP_ID' => $model->DEP_ID])->orderBy('SORT')->one(); $Val_Jabatan = $Dept_MDL->DEP_NM; $attribute = [['attribute' => 'DEP_ID'], ['attribute' => 'DEP_NM'], ['attribute' => 'DEP_DCRP', 'format' => 'raw', 'type' => DetailView::INPUT_TEXTAREA, 'widgetOptions' => ['data' => 'DEP_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->DEP_ID . '| ' . $model->DEP_NM, 'type' => DetailView::TYPE_INFO], 'attributes' => $attribute]); ?>