<?php
use yii\helpers\Html;
use kartik\widgets\ActiveForm;
use yii\helpers\Url;
use common\controllers\CommonDBInterface as DBInterface;
use yii\helpers\ArrayHelper;

/* @var $this yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model \common\models\InstitutionForm */


?>
<main id="main">
        <section class="gradient-bar-thin" style="height: 1px;"></section>
        <div class="container pb-5">
            <div class="row">
                <div class="col">
                <h1>New Institution</h1>
  <p><strong>Please fill out the following fields to submit the new institution:</strong></p>
  <h2>Institution</h2>

            <?php 
            $cssClassSearchFields = 'complete_field searchfields col-lg-6 col-md-5 col-sm-3 col-2';
            
            $form = ActiveForm::begin(['type'=>ActiveForm::TYPE_VERTICAL, 'options' => ['class' => 'form-row'], 'fieldConfig' =>['options' => ['class' => 'complete_field searchfields col-lg-6 col-md-5 col-sm-3 col-2']]]); ?>
                <?= $form->field($modal, 'institutionShort')?>
                <?= $form->field($modal, 'institutionFullName')?>
                <?= $form->field($modal, 'city')?>
                <?php 
				$selectedValue = $modal->country;
				$countries = DBInterface::getCountries();
				$countrylist = ArrayHelper::map($countries, 'iso', 'country');
				echo $form->field($modal, 'country')
				            ->dropDownList(
                        $countrylist,
				        ['prompt' => '--Please select a country--'],
                        ['options' =>
                            [
                                $selectedValue => ['selected' => 'selected']
                            ]
                        ]
				        
                    )->label('Country');
				?>
                <?= $form->field($modal, 'Latitude')->textInput(  ['placeholder'=>"Minus for South America, Africa and Australia please :)"])?>
				<?= $form->field($modal, 'Longitude')->textInput(  ['placeholder'=>"Minus for North and South America please :)"])?>
                <?= $form->field($modal, 'logoURL')?>
                <?= $form->field($modal, 'memberStatus')->radioList(["Core"=>"Core","Associate"=>"Associate","Observer"=>"Observer"])?>
                <?= $form->field($modal, 'dateOfJoining')?>
                <?= $form->field($modal, 'onlineSince')?>
				<?= $form->field($modal, 'CITES_code')->textInput(  ['placeholder'=>"Check https://cites.org/eng/cms/index.php/component/cp/country/US/"])?>
                 	<?= $form->field($modal, 'IPEN_member')->radioList(['1'=>'yes', '0'=>'no'])?><br/>
                <div class="form-row complete_field searchfields col-lg-6 col-md-5 col-sm-3 col-2">
                    <?= Html::submitButton('Create', ['class' => 'btn btn-lg btn-success', 'name' => 'create-button'])?>
                </div>
                 <?php  ActiveForm::end ();?>    
			</div>
 			</div>
 		</div>
 	</main>