Пример #1
0
use kartik\builder\Form;
use kartik\icons\Icon;
use kartik\widgets\Growl;
use kartik\widgets\FileInput;
$this->mddPage = 'hrd';
//$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Maxiprodaks'), 'url' => ['prodak']];
//$this->params['breadcrumbs'][] = $this->title;
?>


<?php 
$Combo_Corp = ArrayHelper::map(Corp::find()->orderBy('SORT')->asArray()->all(), 'CORP_ID', 'CORP_NM');
$Combo_Dept = ArrayHelper::map(Dept::find()->orderBy('SORT')->asArray()->all(), 'DEP_ID', 'DEP_NM');
$Combo_Jab = ArrayHelper::map(Jabatan::find()->orderBy('SORT')->asArray()->all(), 'JAB_ID', 'JAB_NM');
$Combo_Status = ArrayHelper::map(Status::find()->orderBy('SORT')->asArray()->all(), 'STS_ID', 'STS_NM');
$Corp_MDL = Corp::find()->where(['CORP_ID' => $model->EMP_CORP_ID])->orderBy('SORT')->one();
$Dept_MDL = Dept::find()->where(['DEP_ID' => $model->DEP_ID])->orderBy('SORT')->one();
$Jabatan_MDL = Jabatan::find()->where(['JAB_ID' => $model->JAB_ID])->orderBy('SORT')->one();
$Status_MDL = Status::find()->where(['STS_ID' => $model->EMP_STS])->orderBy('SORT')->one();
$Val_Corp = $Corp_MDL->CORP_NM;
$Val_Dept = $Dept_MDL->DEP_NM;
$Val_Jabatan = $Jabatan_MDL->JAB_NM;
$Val_Status = $Status_MDL->STS_NM;
$attribute = [['group' => true, 'label' => 'SECTION 1: Identification Information', 'rowOptions' => ['class' => 'info']], ['attribute' => 'upload_file', 'label' => '', 'value' => Yii::getAlias('@HRD_EMP_UploadUrl') . '/' . $model->EMP_IMG, 'format' => ['image', ['width' => '100', 'height' => '120']], 'type' => DetailView::INPUT_FILEINPUT, 'widgetOptions' => ['pluginOptions' => ['showPreview' => true, 'showCaption' => false, 'showRemove' => false, 'showUpload' => false]]], ['attribute' => 'EMP_ID'], ['attribute' => 'EMP_NM'], ['attribute' => 'EMP_NM_BLK'], ['group' => true, 'label' => 'SECTION 1: Identification Information', 'rowOptions' => ['class' => 'info']], ['attribute' => 'EMP_CORP_ID', 'format' => 'raw', 'value' => Html::a($Val_Corp, '#', ['class' => 'kv-author-link']), 'type' => DetailView::INPUT_SELECT2, 'widgetOptions' => ['data' => $Combo_Corp, 'options' => ['placeholder' => 'Select ...'], 'pluginOptions' => ['allowClear' => true]]], ['attribute' => 'DEP_ID', 'format' => 'raw', 'value' => Html::a($Val_Dept, '#', ['class' => 'kv-author-link']), 'type' => DetailView::INPUT_SELECT2, 'widgetOptions' => ['data' => $Combo_Dept, 'options' => ['placeholder' => 'Select ...'], 'pluginOptions' => ['allowClear' => true]]], ['attribute' => 'JAB_ID', 'format' => 'raw', 'value' => Html::a($Val_Jabatan, '#', ['class' => 'kv-author-link']), 'type' => DetailView::INPUT_SELECT2, 'widgetOptions' => ['data' => $Combo_Jab, 'options' => ['placeholder' => 'Select ...'], 'pluginOptions' => ['allowClear' => true]]], ['attribute' => 'EMP_STS', 'format' => 'raw', 'value' => Html::a($Val_Status, '#', ['class' => 'kv-author-link']), 'type' => DetailView::INPUT_SELECT2, 'widgetOptions' => ['data' => $Combo_Status, 'options' => ['placeholder' => 'Select ...'], 'pluginOptions' => ['allowClear' => true]]], ['attribute' => 'EMP_JOIN_DATE', 'format' => 'date', 'type' => DetailView::INPUT_DATE, 'widgetOptions' => ['pluginOptions' => ['format' => 'yyyy-mm-dd']]], ['attribute' => 'EMP_RESIGN_DATE', 'format' => 'date', 'type' => DetailView::INPUT_DATE, 'widgetOptions' => ['pluginOptions' => ['format' => 'yyyy-mm-dd']]], ['group' => true, 'label' => 'SECTION 1: Identification Information', 'rowOptions' => ['class' => 'info']], ['attribute' => 'EMP_KTP'], ['attribute' => 'EMP_ALAMAT'], ['attribute' => 'EMP_ZIP'], ['attribute' => 'EMP_TLP'], ['attribute' => 'EMP_HP'], ['attribute' => 'EMP_GENDER'], ['attribute' => 'EMP_TGL_LAHIR', 'format' => 'date', 'type' => DetailView::INPUT_DATE, 'widgetOptions' => ['pluginOptions' => ['format' => 'yyyy-mm-dd']], 'inputWidth' => '40%'], ['attribute' => 'EMP_EMAIL']];
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]);
echo DetailView::widget(['model' => $model, 'condensed' => true, 'hover' => true, 'mode' => DetailView::MODE_VIEW, 'panel' => ['heading' => $model->EMP_NM . ' ' . $model->EMP_NM_BLK, 'type' => DetailView::TYPE_INFO], 'attributes' => $attribute, 'deleteOptions' => ['url' => ['delete', 'id' => $model->EMP_ID], 'data' => ['confirm' => Yii::t('app', 'Are you sure you want to delete this record?'), 'method' => 'post']]]);
ActiveForm::end();
?>
	

Пример #2
0
<?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();
Пример #3
0
 public function getSttOne()
 {
     return $this->hasOne(Status::className(), ['STS_ID' => 'EMP_STS']);
 }