<?php
  include('common/header.php');
?>
<?php 
 
  if ($this->uri->segment(3)) {
   foreach ($currency as  $value){
    $currenc_id=$value['currency_id'];
   }
  }
 

 ?>
  <div class="">
    <div class="col-xm-12">
      <div class="widget-box light-border">
        <div class="widget-header header-color-grey">
          <h4 class="smaller">
          Currency
          </h4>
        </div>
        <div class="widget-body">
          <div class="widget-main">
            <div class="row">
              <div class="col-sm-12">
                 <form class="form-horizontal" name="myForm" method="post" action="<?php echo base_url()?>index.php/<?php echo CURRENCY;?>add_currency/<?php $currenc_id?>" onsubmit="return validateForm()" name="manage_currency" id="manage_currency">
                  <section class="panel panel-default">
                  <header class="panel-heading bg-info lt font-bold">Currency Details</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">Currency Name:<font style="color:red">*</font></label>
                              <div class="col-sm-7">
                                <?php if ($this->uri->segment(3)) {?>
                                  <input type="text" name="currency_name" value="<?php echo $value['currency_name']; ?>" id="currency_name" placeholder="Currency Name" class="form-control"  /> <?php }else{ ?>

                                  <input type="text" name="currency_name" value="" id="currency_name" placeholder="Currency Name" class="form-control"  /> 
                              <?php } ?>
                                <span style="color: red;" id="empty">Please Enter Currency Name</span> 
                                   
                              </div>
                            </div>
                          </div>
                        
                          <div class="col-sm-6">
                            <div class="form-group" id="client_code">
                              <label for="client_code" class="col-sm-5 control-label required">Currency Code:<font style="color:red">*</font></label>
                              <div class="col-sm-7">
                                <?php if ($this->uri->segment(3)) {?>
                                <input type="text" name="currency_code" value="<?php echo $value['currency_code']; ?>" id="currency_code" placeholder="Currency Code" class="form-control" maxlength="3" /><?php }else{ ?> 
                                  <input type="text" name="currency_code" value="" id="currency_code" placeholder="Currency Code" class="form-control" maxlength="3" />
                                   <?php } ?>
                                <!-- <span style="color: red;" ><?php echo form_error('currency_code');?></span> -->
                                <span style="color: red;" id="empty1">Please Enter Currency Code</span> 
                              </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 --> 
<script>
function hide()
{
  document.getElementById("admin_type_code").style.display="none";
}
function show()
{
  document.getElementById("admin_type_code").style.display="";
}
</script>
<script>
  $(document).ready(function(){
    $('#empty').hide();
    $('#empty1').hide();
});
</script>
<script>
  function validateForm() {
  var x = document.forms["myForm"]["currency_name"].value;
  var y = document.forms["myForm"]["currency_code"].value;
  if (x == "" && y == "") {
     $('#empty').show();
     $('#empty1').show();

    return false;
  }
  if (x == "") {
     $('#empty').show();
     $('#empty1').hide();
    return false;
  }else if(y == ""){
    $('#empty').hide();
    $('#empty1').show();
    return false;
  }else{
    $('#empty').hide();
    $('#empty1').hide();
  }

}

</script>


<?php
  include('common/footer.php');
?>