public function getRiskAddDep() { return $this->hasOne(RiskAddDep::className(), ['dep_id' => 'riskadddep_id']); }
/** * Finds the RiskAddDep model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return RiskAddDep the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = RiskAddDep::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
<?php echo $form->field($model, 'risk_date')->widget(DatePicker::classname(), ['language' => 'th', 'dateFormat' => 'yyyy-MM-dd', 'clientOptions' => ['changeMonth' => true, 'changeYear' => true], 'options' => ['class' => 'form-control']]); ?> </div> <div class="col-xs-4 col-sm-2 col-md-2"> <?php echo $form->field($model, 'risk_time')->textInput(['maxlength' => true]); ?> </div> <div class="col-xs-6 col-sm-4 col-md-4"> <?php echo $form->field($model, 'risk_department')->widget(Select2::classname(), ['data' => ArrayHelper::map(RiskAddDep::find()->all(), 'dep_id', 'dep_name'), 'options' => ['placeholder' => 'เลือกแแผนก ...'], 'pluginOptions' => ['allowClear' => true]]); ?> </div> <div class="col-xs-6 col-sm-6"> <?php echo $form->field($model, 'risk_miss')->inline()->radioList(\frontend\models\RiskHead::itemAlias('risk_miss')); ?> </div> <div class="col-xs-6 col-sm-6"> <?php echo $form->field($model, 'clinictype')->widget(Select2::classname(), ['data' => ArrayHelper::map(RiskClinictype::find()->all(), 'id', 'name'), 'options' => ['placeholder' => 'เลือกประเภทความเสี่ยง ...'], 'pluginOptions' => ['allowClear' => true]]); ?>