Пример #1
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getType()
 {
     return $this->hasOne(Types::className(), ['ID' => 'Type']);
 }
Пример #2
0
<div class="documents-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'Document')->textInput();
?>

    <?php 
echo $form->field($model, 'Company')->dropDownList(ArrayHelper::map(Companies::find()->asArray()->all(), 'ID', 'Company'), ['prompt' => Yii::t('app', 'Select...')]);
?>

    <?php 
echo $form->field($model, 'Type')->dropDownList(ArrayHelper::map(Types::find()->asArray()->all(), 'ID', 'Type'), ['prompt' => Yii::t('app', 'Select...')]);
?>

    <?php 
echo $form->field($model, 'Date')->widget(DatePicker::classname(), ['options' => ['placeholder' => Yii::t('app', 'Select...')], 'pluginOptions' => ['todayHighlight' => true, 'format' => 'yyyy-mm-dd', 'autoclose' => true]]);
?>


    <?php 
echo $form->field($model, 'From')->dropDownList(ArrayHelper::map(Warehouses::find()->asArray()->all(), 'ID', 'Warehouse'), ['prompt' => Yii::t('app', 'Select...')]);
?>

    <?php 
echo $form->field($model, 'To')->dropDownList(ArrayHelper::map(Warehouses::find()->asArray()->all(), 'ID', 'Warehouse'), ['prompt' => Yii::t('app', 'Select...')]);
?>
Пример #3
0
/* @var $this yii\web\View */
/* @var $searchModel app\models\DocumentsSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('app', 'Documents');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="documents-index">

  <h1><?php 
echo Html::encode($this->title);
?>
</h1>
  <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

  <p>
    <?php 
echo Html::a(Yii::t('app', 'Create'), ['create'], ['class' => 'btn btn-success']);
?>
  </p>

  <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['label' => 'Тип документа', 'attribute' => 'Type', 'value' => 'type.Type', 'filter' => Html::activeDropDownList($searchModel, 'Type', ArrayHelper::map(Types::find()->asArray()->all(), 'ID', 'Type'), ['class' => 'form-control', 'prompt' => Yii::t('app', 'All')])], 'Document', ['attribute' => 'Date', 'format' => ['Date', 'php:d.m.Y'], 'options' => ['width' => '100']], ['label' => 'Со склада', 'attribute' => 'From', 'value' => 'from.Warehouse'], ['label' => 'На склад', 'attribute' => 'To', 'value' => 'to.Warehouse'], 'Comment:ntext', ['label' => 'Компания', 'attribute' => 'Company', 'value' => 'company.Company', 'filter' => Html::activeDropDownList($searchModel, 'Company', ArrayHelper::map(Companies::find()->asArray()->all(), 'ID', 'Company'), ['class' => 'form-control', 'prompt' => Yii::t('app', 'All')])], ['class' => 'yii\\grid\\ActionColumn', 'buttons' => ['list' => function ($url, $model) {
    // $customurl=Yii::$app->getUrlManager()->createUrl(['log/view','id'=>$model['id']]); //$model->id для AR
    return \yii\helpers\Html::a('<span class="glyphicon glyphicon-search"></span>', ['contents/index', 'id' => $model->ID], ['title' => Yii::t('yii', 'List'), 'data-pjax' => '0']);
}], 'template' => '{view} {list} {update} {delete}']]]);
?>

  </div>