<?php

 Yii::app()->setLanguage(isset(Yii::app()->session['lang']) ? Yii::app()->session['lang'] : 'ar'); 
 $lang=Yii::app()->getLanguage();
 
 Yii::app()->getClientScript()->registerCssFile(Yii::app()->getBaseUrl(true) . '/css/openlayers.css');

?>

 
    <h2 class="head-text-1">
    <?php //echo Yii::t('governorate','BranchAndATMlocations');?>
    <?php 
    if($lang=='ar'){
    echo '
    أماكن الفروع و الصراف الآلي';
    }else{
      echo 'Branch and ATM locations';
    }
    ?>
    </h2>
    <div class="main-text">
    <?php //echo Yii::t('governorate','EnterTheNameOfTheCityAndEara');?>
      <?php 
    if($lang=='ar'){
    echo '
        أدخل اسم المحافظة و المنطقة
    ';
    }else{
      // echo 'Enter the name of the city and eara';
         echo 'Enter name of governorate and area';
    }
    ?>

    </div>
    <form>
        <div class="form-group"> 
            <select name="country" id="governorateSelect" class="form-control" > 
            <option value="0" selected disabled hidden>
            <?php //echo Yii::t('governorate','city');?>
            <?php echo ($lang=='en'?'city':'المحافظة')?></option>
            <?php
                $governorates=Governorate::model()->findAll();
                foreach($governorates as $governorate){
             ?>
            <option value=<?php echo $governorate->id ?>><?php echo ($lang=='en'?$governorate->name_en:$governorate->name_ar) ?></option>
            <?php }?>
        </select> 
            <select name="state" id="regionSelect" class="form-control">
            <option value="0">
            <?php echo ($lang=='en'?'Area':'المنطقة')?></option>
              
            <?php
            
            $areas=Area::model()->findAll();
                foreach($areas as $area){
             ?> 
            <option data-region=<?php echo $area->governorate; ?> value=<?php  echo $area->id; ?>><?php  echo ($lang=='en'?$area->name_en:$area->name_ar); ?></option>
                <?php   }?> 

        </select>
        <button class="btn btn-search" id="search" type="button">
        <?php //echo Yii::t('governorate','search');?>
        <?php echo ($lang=='en'?'Search':'ابحث')?>
        </button>
        </div>
    </form>


<!-- <script src="http://www.openlayers.org/api/OpenLayers.js"></script> -->
<script src="<?= Yii::app()->getBaseUrl(true) . '/js/openlayers.js' ?>"></script>
<script  type="application/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/site/scriptGovernorate"></script>
