<?php

use app\base\Common;
use yii\helpers\Url;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use app\models\Dbchange;
use kartik\select2\Select2;
use kartik\widgets\DepDrop;


/* @var $this yii\web\View */
/* @var $model app\models\Dbchange */
/* @var $form yii\widgets\ActiveForm */

$DBs =Dbchange::RetriveDBName();

?>

<div class="Dbchange-form">
	<div class="panel panel-default">
		<div class="panel-heading">
			
		</div>
		<div class="panel-body">
			<div class="row">
				<div class="col-lg-12">
					<?php
						$form = ActiveForm::begin(['options' => ['class' => 'form-horizontal']]);
						$template = [
							'labelOptions' => ['class' => 'form-label'],
							'template' => '<div class="col-sm-5">{label}{hint}</div><div class="col-sm-4">{input}{error}</div>',
						];
						$htemplate = [
							'options' => ['tag' => false],
							'template' => '{input}'
						];
					?>
										
                    <?php // $form->field($model, 'dbname', $template)->dropDownList($DBs, ['prompt'=>'Select']); ?>	

                   <?= $form->field($model, 'dbname', $template)->widget(DepDrop::classname(), ['data'=>$DBs, 'options'=>['prompt'=>'Select Database'], 'type'=>DepDrop::TYPE_SELECT2, 'pluginOptions'=>['depends'=>$DBs, 'placeholder'=>'Database', 'url'=>Url::to(['/dashboard/getids']), 'params'=>['common-method', 'common-method-type']]]);	?>					
					
					<div class="form-group">
						<div class="col-sm-offset-5 col-sm-7">
						<?php if(!$model->isNewRecord) : ?>				   	
						 	 <?= Html::submitButton(Yii::t('app', 'Update'), ['class' =>'btn btn-primary']) ?> 		 
					     <?php endif; ?>						 
						     <?= Html::a('Cancel', ['/'.Yii::$app->controller->id], ['class' => 'btn btn-default']) ?>							
						</div>
					</div>
					
					<?php ActiveForm::end(); ?>
				</div>
				<!-- /.col-lg-6 (nested) -->
			</div>
			<!-- /.row (nested) -->
		</div>
		<!-- /.panel-body -->
	</div>
	<!-- /.panel -->
</div>