<!-- Main Content -->

<div class="page-wrapper">

<div class="container-fluid pt-25">

   <div class="row">

      <div class="alert alert-success alert-dismissible" role="alert" <?php if($this->session->flashdata('message')==''){ ?> style="display:none" <?php } ?> >

         <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>

         <?php echo $this->session->flashdata('message'); ?>

      </div>

      <div class="alert alert-warning alert-dismissible" role="alert" <?php if($this->session->flashdata('emessage')==''){ ?> style="display:none" <?php } ?> >

         <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>

         <?php echo $this->session->flashdata('emessage'); ?>

      </div>

   </div>

   <!-- Row -->

   <div class="row">

      <div class="col-sm-8 col-md-offset-2">

         <div class="panel panel-default card-view">

            <div class="panel-heading">

               <div class="pull-left">

                  <h6 class="panel-title txt-dark">Edit Service Images</h6>

               </div>

               <div class="clearfix"></div>

            </div>

            <div class="panel-wrapper collapse in">

               <div class="panel-body">

                  <div class="form-wrap">

                     <form id="addTestimonialFrom" class="form-horizontal" action="<?php echo base_url(A."/editServiceGallery"); ?>" enctype="multipart/form-data" method='post'>
                        <input type="hidden" name="id" value="<?php echo $post['id']; ?>" />
                        <div class="row">
                           <div class="col-md-12">
                              <?php if($post['image']!=''){ ?>
                              <div class="form-group col-sm-12">
                                 <img src="<?php echo base_url($post['image']); ?>" alt="image" style="width:100px;">
                              </div>
                              <?php } ?> 
                              <div class="form-group col-sm-12">
                                 <label class="">Gallery Image (Image Size - 500x450 px)</label>
                                 <input type="file" name="image" class="form-control" multiple>
                              </div>

                              <div class="form-group col-sm-12">

                                 <label class="">Service</label>

                                 <select class="form-control" name="category" id="category" required>
                                    <option value="">Select</option>
                                    <?php if(isset($category) && !empty($category)){ foreach($category as $key=>$value) : ?>
                                       <option <?php echo($post['category']==$value['id'])?'selected':''; ?> value="<?php echo $value['id']; ?>"><?php echo $value['category']; ?></option>
                                    <?php endforeach; } ?>
                                 </select>

                              </div>
                              <?php /* $subcategory = $this->common->getData('int_category',array('parent'=>$post['category']),array(),array('field'=>'item_order','by'=>'asc')); ?>
                              <div class="form-group col-sm-12">

                                 <label class="">SubCategory</label>

                                 <select class="form-control" name="subcategory" id="subcategory" required>
                                    <option value="">Select</option>
                                    <?php if(isset($subcategory) && !empty($subcategory)){ foreach($subcategory as $key=>$value) : ?>
                                       <option <?php echo($post['subcategory']==$value['id'])?'selected':''; ?> value="<?php echo $value['id']; ?>"><?php echo $value['category']; ?></option>
                                    <?php endforeach; } ?>
                                 </select>

                              </div>
                              <?php */ ?>

                              <div class="form-group mb-0">

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

                                    <button type="submit" name="addcategory" class="btn btn-success btn-anim pull-right"><i class="icon-rocket"></i><span class="btn-text">Submit</span></button>

                                 </div>

                              </div>

                           </div>

                        </div>

                     </form>

                  </div>

               </div>

            </div>

         </div>

      </div>

   </div>

   <!-- /Row -->

</div>
<script>
   var path = "<?php echo base_url(A); ?>";
   $("#category").on("change",function(){

        var cid = $(this).val();

        $.ajax({

            url: path+"/getSubCatByCategory",

            type:"POST",

            data:"cid="+cid,

            success: function(result){

                $('#subcategory').html(result.html);

            }

        });

    });
</script>