/** * @return \yii\db\ActiveQuery */ public function gettypeOfContract() { return $this->hasOne(AppContractType::className(), ['ID' => 'ID_TypeOfContract']); }
use app\models\AppContractPayPeriod; use app\models\AppContractCurrency; use app\models\AppPartner; use app\models\AppSystemIssuer; use app\models\AppCard; use app\models\AppCardsSearch; use app\models\PetrolVecfil012Search; /* @var $this yii\web\View */ /* @var $model app\models\Contract */ $this->title = $model->Name; $this->params['breadcrumbs'][] = ['label' => 'Договоры', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; /************************************************************************* * Подготовка данных для представления в ************************************************************************/ $attributes = [['group' => true, 'label' => 'Номер и дата подписания', 'rowOptions' => ['class' => 'info']], ['columns' => [['attribute' => 'ContractNumber'], ['attribute' => 'Period', 'format' => 'date', 'type' => DetailView::INPUT_DATE, 'widgetOptions' => ['pluginOptions' => ['format' => 'yyyy-mm-dd']]], ['attribute' => 'DateOfSigning', 'format' => 'date', 'type' => DetailView::INPUT_DATE, 'widgetOptions' => ['pluginOptions' => ['format' => 'yyyy-mm-dd']]]]], ['columns' => [['attribute' => 'Name'], ['attribute' => 'status', 'label' => 'В работе?', 'format' => 'raw', 'value' => $model->status ? '<span class="label label-success">Yes</span>' : '<span class="label label-danger">No</span>', 'type' => DetailView::INPUT_SWITCH, 'widgetOptions' => ['pluginOptions' => ['onText' => 'Yes', 'offText' => 'No']]]]], ['group' => true, 'label' => 'Электронная копия', 'rowOptions' => ['class' => 'info']], ['attribute' => 'AlfrescoLink', 'format' => 'raw'], ['group' => true, 'label' => 'Связанные поля', 'rowOptions' => ['class' => 'info']], ['attribute' => 'ID_partner', 'value' => $model->ID_partner != null ? $model->partner->FullName : '', 'type' => DetailView::INPUT_SELECT2, 'widgetOptions' => ['data' => ArrayHelper::map(AppPartner::find()->all(), 'ID', 'FullName')]], ['group' => true, 'label' => 'Параметры договора', 'rowOptions' => ['class' => 'info']], ['columns' => [['attribute' => 'ID_TypeOfContract', 'value' => $model->ID_TypeOfContract != null ? $model->typeOfContract->Description : '', 'type' => DetailView::INPUT_SELECT2, 'widgetOptions' => ['data' => ArrayHelper::map(AppContractType::find()->all(), 'ID', 'Description')]], ['attribute' => 'ID_TypeOfCalculation', 'value' => $model->ID_TypeOfCalculation != null ? $model->typeOfCalculation->Description : '', 'type' => DetailView::INPUT_SELECT2, 'widgetOptions' => ['data' => ArrayHelper::map(AppContractCalcType::find()->all(), 'ID', 'Description')]]]], ['columns' => [['attribute' => 'ID_PaymentPeriod', 'value' => $model->ID_PaymentPeriod != null ? $model->paymentperiod->Description : '', 'type' => DetailView::INPUT_SELECT2, 'widgetOptions' => ['data' => ArrayHelper::map(AppContractPayPeriod::find()->all(), 'ID', 'Description')]], ['attribute' => 'ID_CurrencyOfThePayments', 'value' => $model->ID_CurrencyOfThePayments != null ? $model->currencyOfThePayments->Name : '', 'type' => DetailView::INPUT_SELECT2, 'widgetOptions' => ['data' => ArrayHelper::map(AppContractCurrency::find()->all(), 'ID', 'Name')]]]], ['group' => true, 'label' => 'Привязка к внешней системе', 'rowOptions' => ['class' => 'info']], ['columns' => [['attribute' => 'ID_issuer', 'value' => $model->ID_issuer != null ? $model->issuer->Description : '', 'type' => DetailView::INPUT_SELECT2, 'widgetOptions' => ['data' => ArrayHelper::map(AppSystemIssuer::find()->all(), 'ID', 'Description')]], ['attribute' => 'ID_in_ExtSystem']]]]; ?> <div class="contract-view"> <?php echo DetailView::widget(['model' => $model, 'condensed' => true, 'hover' => true, 'mode' => DetailView::MODE_VIEW, 'fadeDelay' => 0, 'panel' => ['heading' => 'Договор : ' . $model->Name, 'type' => DetailView::TYPE_PRIMARY], 'attributes' => $attributes, 'deleteOptions' => ['url' => ['delete', 'id' => $model->ID], 'data' => ['confirm' => Yii::t('app', 'Вы действительно хотите удалить запись'), 'method' => 'post']]]); ?> <div class="card-view"> <?php /***************** Вывод грида по картам *********************/ echo Yii::$app->controller->renderPartial('@app/views/app-cards/indexforcontract', ['model' => $model, 'dataProvider' => new \yii\data\ActiveDataProvider(['query' => $model->getcards()]), 'searchModel' => new AppCardsSearch()]); /***************** Вывод грида по картам петрола *********************/ /* echo Yii::$app->controller->renderPartial( '@app/views/petrol-vecfil012/index',
<?php echo $form->field($model, 'Name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'status')->radioList(array('1' => 'В работе', 0 => 'Закрыт')); ?> <?php echo $form->field($model, 'AlfrescoLink')->input('url', ['placeholder' => 'Введите ссылку на электронную версию документа...']); ?> <?php echo $form->field($model, 'ID_TypeOfContract')->dropDownList(ArrayHelper::map(AppContractType::find()->all(), 'ID', 'Description'), ['prompt' => 'Выберете тип договора...']); ?> <?php echo $form->field($model, 'ID_TypeOfCalculation')->dropDownList(ArrayHelper::map(AppContractCalcType::find()->all(), 'ID', 'Description'), ['prompt' => 'Выберете тип взаиморасчетов...']); ?> <?php echo $form->field($model, 'ID_PaymentPeriod')->dropDownList(ArrayHelper::map(AppContractPayPeriod::find()->all(), 'ID', 'Description'), ['prompt' => 'Выберете период оплаты...']); ?> <?php echo $form->field($model, 'ID_CurrencyOfThePayments')->dropDownList(ArrayHelper::map(AppContractCurrency::find()->all(), 'ID', 'Name'), ['prompt' => 'Выберете валюту...']); ?> <?php