<?php    $form = $this->beginWidget('CActiveForm', array( 
    'id' => 'building-details-form',
    'enableAjaxValidation' => false,  
    'enableClientValidation' => false, 
    )); 
?>     
<ul class="form-add clearfix">
    <input type="hidden" name="word" id="word" value="<?php echo $buying_value_inword;?>"> 
    <li class="form-add col-sm-3">  
        <div class="icon-box fa-building-o material m1">  
                          <?php echo $form->hiddenField($model, 'id'); ?> 
                   <?php echo $form->textField($model, 'building_name', array('placeholder'=>'Land Name <span class="red">*</span>')); ?> 
                   <?php echo $form->error($model, 'building_name'); ?> 
        </div>  
    </li>  
    <li class="form-add col-sm-3">   
        <div class="icon-box fa-building material m1">  
                      <?php echo $form->textField($model, 'building_id', array('placeholder'=>'Land Id')); ?> 
                       <?php echo $form->error($model, 'building_id'); ?>  
        </div> 
    </li>    
    <li class="form-add col-sm-3">   
        <div class="icon-box fa-home material m1">    
                <?php echo $form->textField($model, 'makani', array('placeholder'=>'Makani')); ?>   
                 <?php echo $form->error($model, 'makani'); ?>  
        </div>      
    </li>  
    <li class="form-add col-sm-3">   
        <div class="icon-box  fa-calendar-check-o  material m1"> 
                   <?php echo $form->textField($model, 'buying_date', array('class'=>'date-picker','placeholder'=>'Buying Date  <span class="red">*</span>','value'=>$date)); ?>
                    <?php echo $form->error($model, 'buying_date'); ?>    
        </div> 
    </li>  
    <li class="form-add col-sm-3">     
        <div class="icon-box fa-calendar material m1">   
                 <?php echo $form->textField($model, 'location', array('placeholder'=>'Location')); ?> 
                   <?php echo $form->error($model, 'location'); ?>     
        </div>               
    </li>                
    <li class="form-add col-sm-3">
        <div class="icon-box fa-location-arrow material m1">  
                  <?php echo $form->textField($model, 'state', array('placeholder'=>'State')); ?> 
                   <?php echo $form->error($model, 'state'); ?>   
        </div>      
    </li>        
    <?php 
      $selectedOptions=  array();
                if($model->id>0){
                    $selectedOptions[$model->country] = array('selected' => 'selected');
                }else{
                    $selectedOptions['228'] = array('selected' => 'selected');
                }
    ?>
    <li class="form-add col-sm-3">   
        <div class="icon-box fa-globe material m1">   
                  <?php  echo $form->dropDownList($model, 'country',MasterCountry::getCountry(),array('options' => $selectedOptions,'placeholder'=>'Country')); ?>   
                 <?php echo $form->error($model, 'country'); ?> 
        </div>           
    </li>     
    <li class="form-add col-sm-3">      
        <div class="icon-box fa-phone material m1">   
                 <?php echo $form->textField($model, 'telephone', array('placeholder'=>'Telephone')); ?>   
                 <?php echo $form->error($model, 'telephone'); ?>   
        </div>       
    </li>      
    <li class="form-add col-sm-3">     
        <div class="icon-box fa-mobile material m1">   
                 <?php echo $form->textField($model, 'mobile', array('placeholder'=>'Mobile')); ?>  
                  <?php echo $form->error($model, 'mobile'); ?> 
        </div>               
    </li>             
    <li class="form-add col-sm-3">    
        <div class="icon-box fa-envelope material m1">  
                  <?php echo $form->textField($model, 'email', array('placeholder'=>'Email')); ?>  
                  <?php echo $form->error($model, 'email'); ?>     
        </div>     
    </li>       
    <li class="form-add col-sm-3">     
        <div class="icon-box fa-usd material m1">   
                              <?php// $buying_value='';//    
                              //                            if($model->id > 0){//     
                              //                           $buying_value = Yii::app()->numberFormatter->formatCurrency($model->buying_value,"");
//                                } ?>      
              <?php echo $form->textField($model, 'buying_value', array('placeholder'=>'Buying Value','onkeyup'=>'findSquareRate()','onkeypress' => 'return isNumberKey(event)','value'=>$buying_value)); ?>  
                  <?php echo $form->error($model, 'buying_value'); ?>   
        </div>           
    </li> 
    <li class="form-add col-sm-3">  
        <div class="icon-box fa-th-list material m1">  
            <?php echo $form->textField($model, 'squarefeet', array('placeholder'=>'SquareFeet','onkeyup'=>'findSquareMetre(this.value);findSquareRate();','onkeypress' => 'return isNumberKey(event)')); ?>    
                <?php echo $form->error($model, 'squarefeet'); ?>   
        </div>        
    </li>   
    <li class="form-add col-sm-3">  
        <div class="icon-box fa-th-list material m1">  
                  <?php echo $form->textField($model, 'squaremetre', array('placeholder'=>'SquareMetre','onkeyup'=>'findSquareFeet(this.value);findSquareRate();','onkeypress' => 'return isNumberKey(event)')); ?>  
                  <?php echo $form->error($model, 'squaremetre'); ?>   
        </div> 
    </li>
    <li class="form-add col-sm-3">  
        <div class="icon-box fa-th-list material m1">  
                  <?php echo $form->textField($model, 'squarefeet_rate', array('placeholder'=>'Squarefeet Rate','onkeypress' => 'return isNumberKey(event)')); ?>                    
                      <?php echo $form->error($model, 'squaremetre'); ?>   
        </div> 
    </li>   
               <?php if($model->id > 0){ ?>   
    <li class="form-add col-sm-6">       
        <div class="icon-box fa-usd material m1">   
                             <?php $buying_value= $model_building->buying_value;  
                             if($model_building->buying_value != '0.00'){ 
                                 $buying_value_inword = $this->int_to_words($buying_value).' Only/-';   
                                 } else {    
                                     $buying_value_inword ='';    
                                     } ?>
            <input type="text" name="amountinwords"  value="<?php echo $buying_value_inword; ?> " readonly="" placeholder="Amount in words">
        </div>  
    </li>     
    <?php } ?>   
    <li class="form-add col-sm-3">     
        <div class="icon-box fa-home material m1">      
              <?php echo $form->textArea($model, 'address', array('placeholder'=>'Address')); ?>    
                <?php echo $form->error($model, 'address'); ?>  
        </div>        
    </li>
            
      
          
</ul>      
<div class="div-btn">    
    <button type="button" class="btn btn-default" data-dismiss="modal" onclick=" location.href=$('#liveSite').val()+'administrator.php?r=purchasedland/index';">Close</button>                 <?php echo CHtml::ajaxSubmitButton('Save', Yii::app()->createUrl('purchasedland/Save'), array( 
        'dataType' => 'json', 
        'type' => 'post',    
        'success' => 'function(data) { 
        if(data.status=="success"){   
        location.href=$("#liveSite").val()+"administrator.php?r=purchasedland/create&id="+data.id; 
        notification("Purchased Land saved!","success");   
        }                           
        else   
        {                                
        $.each(data, function(key, val) { 
            notification(val,"error");
        });           
        }	
        }',	
        'beforeSend' => 'function(){           
        $.pnotify_remove_all();     
        $("#building-details-form .maintenance-save-btn").prop("disabled", true);    
        }',              
        'complete' => 'function(){   
        $("#building-details-form .maintenance-save-btn").prop("disabled", false);  
        }'	
        ), array('id' => 'mybtn' . rand(), 'class' => 'maintenance-save-btn btn btn-primary')); ?>   
</div>
<?php $this->endWidget(); ?>