<script src="<?php echo base_url();?>ckeditor/ckeditor.js"></script>
      <section class="content-header">
      <h1>

        Events

      </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');?>">Events</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>

          <!-- Horizontal Form -->

          <div class="box box-info">

            <div class="box-header with-border">

              <h3 class="box-title">Add </h3>

            </div>

            <!-- /.box-header -->

            <!-- form start -->

            <form id="add_frm" name="add_frm" class="form-horizontal" method="post" action="" enctype="multipart/form-data">

              <div class="box-body">
              <?php if(!empty($languages)){ 
                  foreach ($languages as $lang) { ?>
                   
                <div class="form-group">

                  <label class="col-sm-2 control-label">Ttile [<?php echo $lang['name']; ?>]</label>

                  <div class="col-sm-10">

                    <input type="text" class="form-control" id="title" name="name_<?php echo $lang['id']; ?>" value="" placeholder="Please enter title">

                  </div>

                </div>
              <?php } } ?>
              <?php if(!empty($languages)){ 
                  foreach ($languages as $lang) { ?>
                  <div class="form-group">

                      <label class="col-sm-2 control-label">Teaser text  [<?php echo $lang['name']; ?>]</label>

                      <div class="col-sm-10">
                      <input type="text" class="form-control" id="teasertext" name="teasertext_<?php echo $lang['id']; ?>" value="" placeholder="Please enter teaser text">

                      </div>

                  </div>
              <?php } } ?>  
              <?php if(!empty($languages)){ 
                  foreach ($languages as $lang) { ?>  
                <div class="form-group">

                  <label class="col-sm-2 control-label">Content [<?php echo $lang['name']; ?>]</label>

                  <div class="col-sm-10">
                    <textarea name="content_<?php echo $lang['id']; ?>" class="form-control"></textarea>
                  <script>
                           CKEDITOR.replace( 'content_<?php echo $lang['id']; ?>',{
                                    filebrowserBrowseUrl : '/castle/fileman/index.html',
                                    filebrowserImageBrowseUrl : '/castle/fileman/index.html?type=image',
                                    removeDialogTabs: 'link:upload;image:upload'
                            });
                        </script> 
                </div>
              </div>
              <?php } } ?> 
              <div class="form-group">

                  <label class="col-sm-2 control-label">Banner Image</label>

                  <div class="col-sm-10">

                    <input type="file" class="form-control" id="banner_image" name="banner_image" >

                  </div>

                </div>
                <div class="form-group">

                  <label class="col-sm-2 control-label">Party Image</label>

                  <div class="col-sm-10">

                    <input type="file" class="form-control" id="party_image" name="party_image[]" multiple>

                  </div>

                </div>
                <div class="form-group">

                  <label class="col-sm-2 control-label">Party Video</label>

                  <div class="col-sm-10">

                    <input type="text" class="form-control" id="video_url" name="video_url">

                  </div>

                </div>
                <div class="form-group">

                  <label class="col-sm-2 control-label">Locations</label>

                  <div class="col-sm-10">
                    <select class="form-control" name="location_id[]" multiple="">
                    <?php if(!empty($locations))
                          foreach ($locations as $loc) {
                           echo '<option value="'.$loc['id'].'">'.$loc['name'].'</option>';
                          }
                      ?>
                      </select>
                  </div>

                </div>
                <div class="form-group">

                  <label class="col-sm-2 control-label">Address</label>

                  <div class="col-sm-10">
                    <textarea class="form-control" name="address"></textarea>
                  </div>

                </div>
                <div class="form-group">

                  <label class="col-sm-2 control-label">Services</label>

                  <div class="col-sm-10">
                    <ul class="serviceList">
                    <?php if(!empty($services))
                          $i=0;
                          foreach ($services as $serv) { ?>
                            <li>
                              <input type="checkbox" id="<?php echo $i; ?>" name="services[]" value="<?php echo $serv; ?>">
                              <label for="<?php echo $i; ?>"><?php echo $serv; ?></label>
                            </li>
                    <?php $i++; }
                      ?>
                    </ul>  
                  </div>

                </div>

                <div class="form-group">
                  <div class="row">
                   <div class="col-sm-6">
                      <label class="col-sm-4 control-label">From Date</label>

                      <div class="col-sm-8">
                          <input type="text" name="fromDate" id="fromDate">

                      </div>
                   </div>
                   <div class="col-sm-6">
                      <label class="col-sm-4 control-label">To Date</label>

                      <div class="col-sm-8">
                          <input type="text" name="toDate" id="toDate">
                      </div>
                   </div>
                  </div>
                </div>

                <div class="form-group">
                  <div class="row">
                   <div class="col-sm-6">
                      <label class="col-sm-4 control-label">Basic Package Price</label>

                      <div class="col-sm-8">
                          <input type="text" name="basic_drinking" id="basic_drinking">
                      </div>
                   </div>
                   <div class="col-sm-6">
                      <label class="col-sm-4 control-label">Premium Package Price</label>

                      <div class="col-sm-8">
                          <input type="text" name="premium_drinking" id="premium_drinking">
                      </div>
                   </div>
                  </div>
                </div>


              </div>
              
              <div class="box-footer">

                <button type="button" onclick="return_back()"class="btn btn-warning  margin-left  " >Cancel</button>

                <input type="submit" class="btn btn-black " value="Add" id="add">

              </div>

              <input type="hidden" name="frmSecurity" value="<?php echo $this->utility->getSecurity();?>"/>

            </form>

          </div>
        </div>
      </div>
    </section>

    <style type="text/css">

    .loader{

      position: fixed;

      left: 0;

      top: 0;

      right: 0;

      bottom: 0;

      width: 100%;

      height: 100%;

      background-color: rgba(0, 0, 0, 0.60);

      z-index: 9999;

      text-align: center;

    }

    .loader img{

      z-index: 99999;

      margin-top: 10%;

    }

    </style>

   <script type='text/javascript'>
      $("#add_frm").validate({
        rules: {
          /*<?php if(!empty($languages)){ 
                  foreach ($languages as $lang) { ?>
          'name_<?php echo $lang['id']; ?>': {
            required: true,
          },
          <?php } } ?>
          <?php if(!empty($languages)){ 
                  foreach ($languages as $lang) { ?>
          'content_<?php echo $lang['id']; ?>': {
            required: true,
          },
          <?php } } ?>*/
          banner_image:{
            required: true
          },
          'location_id[]':{
            required:true
          },
          'services[]':{
            required:true
          },
          fromDate:{
            required:true
          },
          toDate:{
            required:true
          },
          basic_drinking:{
            required:true,
            number:true,
          },
          premium_drinking:{
            required:true,
            number:true,
          },
        }
      });
      $(function(){
        $("#fromDate").datetimepicker();
        $("#toDate").datetimepicker({
          minDate: $("#fromDate").val(),
        });
      });
    </script>

   <script type="text/javascript">
    function return_back()
    {
      var back_url='<?php echo base_url()?>admin/event';
      window.location=back_url;
    }
   </script>