<?php
  include('common/header.php');
  error_reporting(E_ALL);

?>
  <div class="">
    <div class="col-xm-12">
      <div class="widget-box light-border">
        <!-- <div class="widget-header header-color-grey">
          <h4 class="smaller">
           
          </h4>
        </div> -->
        <div class="widget-body">
          <div class="widget-main">
            <div class="row">
              <div class="col-sm-12">
                 <form class="form-horizontal" method="post" action="http://project.nityam.in/nityamhygiene/index.php/admin/client/view_edit_client" name="manage_client" id="manage_client" onsubmit="return validateForm()">
                  <section class="panel panel-default">
                  <header class="panel-heading bg-info lt font-bold">Branch Saleable Geography</header>
                  <!-- panel body start -->
                  <div class="panel-body bs-example form-horizontal">
                    <div class="">
                     <div class="hr hr12 dotted"></div>
                       <div class="">
                        <!-- main col-sm-12 -->
                      <div class="col-sm-12"> 
                           <div class="col-sm-6">
                            <div class="form-group" id="client_code">
                              <label for="client_code" class="col-sm-5 control-label required">Saleable Geography Name:<font style="color:red">*</font></label>
                              <div class="col-sm-7">
                                <input type="text" name="saleable_name" value="" id="saleable_name" placeholder="Saleable Name" class="form-control"  />

                                  <span id="saleable_name1" class="text-danger font-weight-bold"></span>             
                              </div>
                            </div>
                          </div>

                     

                       <div class="col-sm-6">
                            <div class="form-group">
                             <label for="client_code" class="col-sm-5 control-label required">Country:<font style="color:red">*</font></label>
                              <div class="col-sm-7">
                                <select name="country_name" id="country_name" onChange="" class="form-control" required>
                                   <option value="">Select Country Name</option>
                                 <?php 
                                    foreach ($country as  $coun) {?>             
                                  <option value="<?php echo $coun['country_id']; ?>"><?php echo $coun['country_name']; ?></option>
                                <?php } ?>
                                </select>              
                              </div>
                            </div>
                          </div> 
                           </div> 

                        
                          
                        <div class="col-sm-12"> 
                          <div class="col-sm-6">
                           <div class="form-group">
                       <label class="col-sm-3 control-label no-padding-top" for="duallist"> Branch Saleable Geography </label>
                       <div class="col-sm-8">
                      <select multiple="multiple" size="10" name="duallistbox_demo1[]" id="duallist">
                      <option id="state"></option>
                    <!--     <option value="state" style="background-color: lightgrey; color: white;"><b>State</b></option> -->
                        
                      <br>
                      <option value="city" id="city" style="background-color: lightgrey; color: white;"><b>City</b></option>
                      <?php foreach ($city as  $cit) { ?>
                        <option value="<?php echo $cit['city_id'];?>"><?php echo $cit['city_name'];?></option>
                      <?php } ?>
                      </select>
                    </div>
                   
                  </div>        
                  </div> 
                        </div>

                  </div>
                                                 
                      </div>

                       <!-- </div> -->
                         <!-- main col-sm-12  close-->
                       </div> <!-- blank close -->
        </div><!-- blank close -->
      </div>   <!-- panel body close -->
    </section> <!-- section close -->

              </div>
            </div>
          </div>  
        </div>
      </div>
    </div>
    
    <!-- /.col -->
  </div>
  <div class="clearfix form-actions">
    <div class="col-md-offset-5 col-md-5">
      
      <button class="btn btn-info" type="submit">
         Submit
      </button>
    </div>
  </div>
  </form>
  <div class="space-4"></div>
    <!-- /.page-row -->
        <!-- /.page-content --> 
    </div>
    <!-- /.main-content --> 
  </div>
    <!-- /#ace-settings-container --> 
  </div>
  <!-- /.main-container-inner --> 
<?php
  include('common/footer.php');
?>
<script>
function hide()
{
  document.getElementById("admin_type_code").style.display="none";
}
function show()
{
  document.getElementById("admin_type_code").style.display="";
}
</script>
<script>
  jQuery(function($){
  var demo1 = $('select[name="duallistbox_demo1[]"]').bootstrapDualListbox({infoTextFiltered: '<span class="label label-purple label-lg">Filtered</span>'});
        var container1 = demo1.bootstrapDualListbox('getContainer');
        container1.find('.btn').addClass('btn-white btn-info btn-bold');
          });
</script>

<script>
$(document).ready(function(){
 $('#country_name').change(function(){
  var country_id = $('#country_name').val();
  if(country_id != '')
  {
   $.ajax({
    url:"<?php echo base_url();?>index.php/gc/geography/fetch_state",
    method:"POST",
    data:{
      country_id:country_id
    },
    success:function(data)
    {
     $('#state').html(data);
    // $('#city').html('<option value="">Select City</option>');
    }
   });
  }
  else
  {
   $('#state').html('<option value="">Select State</option>');
   //$('#city').html('<option value="">Select City</option>');
  }
 });

 // $('#state').change(function(){
 //  var state_id = $('#state').val();
 //  if(state_id != '')
 //  {
 //   $.ajax({
 //    url:"<?php echo base_url(); ?>dynamic_dependent/fetch_city",
 //    method:"POST",
 //    data:{state_id:state_id},
 //    success:function(data)
 //    {
 //     $('#city').html(data);
 //    }
 //   });
 //  }
 //  else
 //  {
 //   $('#city').html('<option value="">Select City</option>');
 //  }
 // });
 
});
</script>
<script type="text/javascript">
    

    function validateForm(){

      var saleable_name = document.getElementById('saleable_name').value;
      
      if(saleable_name == ""){
        document.getElementById('saleable_name1').innerHTML =" ** Please fill the First Name field";
        return false;
      }
       if(!isNaN(saleable_name)){
        document.getElementById('saleable_name1').innerHTML =" ** only characters are allowed";
        return false;
      }

    }
</script>