Blame view

common/modules/relation/views/manage/_form.php 1.88 KB
a8370482   Alexander Karnovsky   init project
1
2
3
4
5
  <?php
  
  use yii\helpers\Html;
  use yii\widgets\ActiveForm;
  use yii\helpers\ArrayHelper;
14eadb86   Karnovsky A   Eager loading for...
6
  use yii\jui\AutoComplete;
a8370482   Alexander Karnovsky   init project
7
8
9
10
11
12
13
14
15
16
  
  /* @var $this yii\web\View */
  /* @var $model common\modules\rubrication\models\TaxGroup */
  /* @var $form yii\widgets\ActiveForm */
  ?>
  
  <div class="relation-form">
  
      <?php $form = ActiveForm::begin(); ?>
  
14eadb86   Karnovsky A   Eager loading for...
17
18
19
20
21
22
23
24
25
26
27
28
29
      <?= $form->field($model, $relation['entity1']['linked_key'])->widget(
          AutoComplete::className(), [
  //        'model' => \common\modules\relation\models\Relation::className(),
          'clientOptions' => [
              'source' => \yii\helpers\Url::to(['manage/autocomplete/', 'relation_key' => $relation_key, 'entity' => 'entity1']),
              'dataType' => 'json',
              'autoFill' => true,
              'minLength' => '2',
          ],
          'options' => [
              'value' => empty($value1) ? '' : $value1,
              'class'=>'form-control',
              'placeholder' => $relation['entity1']['label']
a8370482   Alexander Karnovsky   init project
30
          ]
14eadb86   Karnovsky A   Eager loading for...
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
      ]);
      ?>
  
      <?= $form->field($model, $relation['entity2']['linked_key'])->widget(
          AutoComplete::className(), [
  //        'model' => \common\modules\relation\models\Relation::className(),
          'clientOptions' => [
              'source' => \yii\helpers\Url::to(['manage/autocomplete/', 'relation_key' => $relation_key, 'entity' => 'entity2']),
              'dataType' => 'json',
              'autoFill' => true,
              'minLength' => '2',
              'allowClear' => true,
          ],
          'options' => [
              'value' => empty($value2) ? '' : $value2,
              'class'=>'form-control',
              'placeholder' => $relation['entity2']['label']
a8370482   Alexander Karnovsky   init project
48
          ]
14eadb86   Karnovsky A   Eager loading for...
49
50
      ]);
      ?>
a8370482   Alexander Karnovsky   init project
51
52
53
54
55
56
57
58
  
      <div class="form-group">
          <?= Html::submitButton($model->isNewRecord ? Yii::t('relation', 'Create') : Yii::t('relation', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
      </div>
  
      <?php ActiveForm::end(); ?>
  
  </div>