/
_form_view.php
executable file
·256 lines (248 loc) · 7.56 KB
/
_form_view.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
<?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'=>[
//'staticValue'=>'<large><bold>'.$nl.'</bold></large>',
//'staticValue'=>$nl,
'value'=>$nl,
//'staticOnly'=>true,
],
'columnOptions'=>['colspan'=>3],
//'label'=>$nl,
//'value'=>$nl,
],
'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'),
//'options'=>['placeholder'=>'Select Coorporate...'],
'columnOptions'=>['colspan'=>1],
],
'DEP_ID'=>[
'type'=>Form::INPUT_DROPDOWN_LIST ,
'items'=>ArrayHelper::map(Dept::find()->orderBy('SORT')->asArray()->all(), 'DEP_ID','DEP_NM'),
//'options'=>['placeholder'=>'Select Coorporate...'],
'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'),
//'options'=>['placeholder'=>'Select Coorporate...'],
'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'),
//'options'=>['placeholder'=>'Select Coorporate...'],
'hint'=>'Select Employee Status',
'columnOptions'=>['colspan'=>1],
],
'EMP_JOIN_DATE'=>[
'type'=>Form::INPUT_WIDGET,
'widgetClass'=>'\kartik\widgets\DatePicker',
'options' => [
//'placeholder' => 'Input Join Date ...',
'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' => [
//'placeholder' => 'Input Resign Date ...',
'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, // override columns setting
'attributes'=>[ // colspan example with nested 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' => [
//'placeholder' => 'Input Join Date ...',
'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],
//'hint'=>'Enter Picture',
],
],
],
],
],
/*
[
'attributes'=>[
'birthday'=>['type'=>Form::INPUT_WIDGET, 'widgetClass'=>'\kartik\widgets\DatePicker', 'hint'=>'Enter birthday (mm/dd/yyyy)'],
//'state_1'=>['type'=>Form::INPUT_DROPDOWN_LIST, 'items'=>$model->typeahead_data, 'hint'=>'Type and select state'],
'color'=>['type'=>Form::INPUT_WIDGET, 'widgetClass'=>'\kartik\widgets\ColorInput', 'hint'=>'Choose your color'],
],
],
[
'attributes'=>[ // 3 column layout
'rememberMe'=>[ // radio list
'type'=>Form::INPUT_RADIO_LIST,
'items'=>[true=>'Yes', false=>'No'],
'options'=>['inline'=>true]
],
'brightness'=>[ // uses widget class with widget options
'type'=>Form::INPUT_WIDGET,
'label'=>Html::label('Brightness (%)'),
'widgetClass'=>'\kartik\widgets\RangeInput',
'options'=>['width'=>'80%']
],
'actions'=>[ // embed raw HTML content
'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>'
],
],
],
*/
[ //-Action Author: -ptr.nov-
'attributes'=>[
'actions'=>[ // embed raw HTML content
'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();