<script src="https://cdn.ckeditor.com/4.7.1/standard/ckeditor.js"></script>
<section class="content-header">
  <h1>Party Locations</h1>
  <ol class="breadcrumb">
    <li><a href="<?php echo base_url().'admin';?>"><i class="fa fa-dashboard"></i> Home</a></li>
    <li><a href="<?php echo base_url('admin/event/locationlist');?>">Locations</a></li>
    <li class="active">Add</li>
  </ol>
</section>
<section class="content">
  <div class="row">
    <?php echo $this->utility->showMsg();?>
    <div class="col-md-12">
      <div class="loader" style="display:none;"><img src='<?php echo base_url();?>assets/images/loading.gif' alt='loading' /></div>
      <div class="box box-info">
        <div class="box-header with-border">
          <h3 class="box-title">Add </h3>
        </div>
        <form id="add_frm" name="add_frm" class="form-horizontal" method="post" action="" enctype="multipart/form-data" onsubmit="return formValidate();">
        <?php if(!empty($language)){ 
            foreach ($language as $lang) { ?>   
                <div class="box-body">
                  <div class="form-group">
                    <label class="col-sm-2 control-label">Name [<?php echo $lang['name']; ?>]</label>
                    <div class="col-sm-6">
                    <input type="text" class="form-control required" required id="name_<?php echo $lang['id']; ?>" name="name_<?php echo $lang['id']; ?>" value="" placeholder="Please enter name">
                    </div>
                  </div>
                </div>
        <?php } } ?>        
        <?php if(!empty($language)){ 
            foreach ($language as $lang) { ?>        
                <div class="box-body">
                  <div class="form-group">
                    <label class="col-sm-2 control-label">City [<?php echo $lang['name']; ?>]</label>
                    <div class="col-sm-6">
                    <input type="text" class="form-control required" required id="city_<?php echo $lang['id']; ?>" name="city_<?php echo $lang['id']; ?>" value="" placeholder="Please enter city">
                    </div>
                  </div>
                </div>
        <?php } } ?>        
        <?php if(!empty($language)){ 
            foreach ($language as $lang) { ?>        
                <div class="box-body">
                  <div class="form-group">
                    <label class="col-sm-2 control-label">Country [<?php echo $lang['name']; ?>]</label>
                    <div class="col-sm-6">
                    <input type="text" name="country_<?php echo $lang['id']; ?>" id="country_<?php echo $lang['id']; ?>" class="form-control required" required placeholder="Please enter country">
                    </div>
                  </div>
                </div>
        <?php } } ?>
          <div class="box-footer">
            <button type="button" onclick="return_back()"class="btn btn-default  margin-left  " >Cancel</button>
            <input type="submit" class="btn btn-info " value="Add" id="add">
          </div>
        </form>
      </div>
    </div>
  </div>
</section>
 <script type='text/javascript'>
  $("#add_frm").validate({
        rules: {
          <?php if(!empty($language)){ 
                  foreach ($language as $lang) { ?>
          'name_<?php echo $lang['id']; ?>': {
            required: true,
          },
          <?php } } ?>
          <?php if(!empty($language)){ 
                  foreach ($language as $lang) { ?>
          'city_<?php echo $lang['id']; ?>': {
            required: true,
          },
          <?php } } ?>
          <?php if(!empty($language)){ 
                  foreach ($language as $lang) { ?>
          'country_<?php echo $lang['id']; ?>': {
            required: true,
          },
          <?php } } ?>
        }
      });
      
</script>
 <script type="text/javascript">
  function return_back(){
    var back_url='<?php echo base_url()?>admin/event/locationlist';
    window.location=back_url;
  }
 </script>