 <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <div class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1 class="m-0 text-dark"><?php echo $title ?></h1>
          </div><!-- /.col -->
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="<?php echo base_url() ?>admin/admin/dashboard">Dashboard</a></li>
              <li class="breadcrumb-item"><a href="#"><?php echo ucwords(str_replace("_", " ", $this->uri->segment(2))); ?></a></li>
              <li class="breadcrumb-item active"><?php echo ucwords(str_replace("_", " ", $title)); ?></li>

            </ol>
          </div><!-- /.col -->
        </div><!-- /.row -->
      </div><!-- /.container-fluid -->
    </div>
    <!-- /.content-header -->
  <?php
    $errors = $this->session->userdata('errors');
    if (isset($errors)) {
        ?>
        <script>
            swal ( "Oops" ,  "<?php echo $errors ?>" ,  "error" )
        </script>
        <?php echo $errors ?>
        <?php
        $this->session->unset_userdata('errors');
    }
    $error = $this->session->userdata('error');
    if (isset($error)) {
        ?>
         <script>
            swal ( "Oops" ,  "<?php echo $error ?>" ,  "error" )
        </script>
        <?php
        $this->session->unset_userdata('error');
    }
    $success = $this->session->userdata('success');
    if (isset($success)) {
        ?>
         <script>
            swal({
          title: "Done!",
          text: "<?php echo $success ?>",
          icon: "success",
        });
        </script>
        <?php
        $this->session->unset_userdata('success');
    }
    ?>
    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <a href="add_new_category" class="btn btn-success"><i class="fa fa-plus" aria-hidden="true"></i> Add Category</a>
        <a href="view_all_category" class="btn btn-primary"><i class="fa fa-eye" aria-hidden="true"></i> View Category</a>
        <!--<a href="view_all_sub_category" class="btn btn-info"><i class="fa fa-eye" aria-hidden="true"></i> View All Sub Category</a>
        <!-- Info boxes -->
        <div class="row">
          <div class="col-sm-12">
            <div class="card card-default">
              <div class="card-header">
                <h3 class="card-title">Add <?php echo $title ?></h3>

                <div class="card-tools">
                  <button type="button" class="btn btn-tool" data-card-widget="collapse"><i class="fas fa-minus"></i></button>
                </div>
              </div>
              <!-- /.card-header -->
              <?php echo form_open_multipart('admin/category/new_category_add'); ?>
              <div class="card-body">
                <div class="row">

                <div class="col-md-12">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Category Name <span class="required">*</span></label>
                       <div class="col-sm-12">
                          <input class="form-control"  name="name" placeholder="Enter Category Name" required="required">
                       </div>
                    </div>
                  </div>
              
                  <div class="col-md-12">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Select Parent Category</label>
                       <div class="col-sm-12">
                          <select id="showing" class="form-control"  name="parent_category">
                            <option value="">Select Cateory</option>
                              <?php foreach ($get_all_category_name as $key => $category):?>
                                <option value="<?php echo $category->id ?>"><?php echo $category->name ?></option>
                              <?php endforeach; ?>
                          </select>
                       </div>
                    </div>
                  </div>

                  <div class="col-md-12" style="display: none;">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Menu Position <span class="required">*</span></label>
                       <div class="col-sm-12">
                          <input type="number" class="form-control"  name="menu_position" placeholder="Enter Menu Position (Ex. - 1,2,3,4 etc.)" value="1">
                       </div>
                    </div>
                  </div>
                
                  <div class="col-md-12 showing">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Category Image (150px X 150px)<span class="required">*</span></label>
                       <div class="col-sm-12">
                          <input type="file" id="mobile_image" onchange="check_image()" class="form-control"  name="mobile_image" required="">
                       </div>
                    </div>
                  </div>

                   <div class="col-md-12">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Category Banner (Banner Height 300px & width any px)</label>
                       <div class="col-sm-12">
                          <input type="file" class="form-control"  name="category_banner" >
                       </div>
                    </div>
                  </div>

                  <div class="col-md-12 showing">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Select Category Varient</label>
                       <div class="col-sm-12">
                        <?php foreach ($get_all_varient as $key => $varient):?>
                          <input type="checkbox" class=""  name="varients[]" value="<?php echo $varient->id ?>">&nbsp;<?php echo $varient->name ?><br/>
                        <?php endforeach; ?>
                       </div>
                    </div>
                  </div>


                  <div class="col-md-12">
                    <div class="form-group">
                       <button name="submit" style="float: right" type="submit" class="btn btn-success">Add</button>
                    </div>
                  </div>

                   <?php echo form_close() ?>
                   

                  <!-- /.col -->
                </div>
                <!-- /.row -->
              </div>
              <!-- /.card-body -->
            </div>
          </div>
        </div>
            <!-- /.row -->
      </div><!--/. container-fluid -->
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
  <script type="text/javascript">
    $(document).ready(function(){
    $('#showing').on('change', function() {
      if ( this.value > 0)
      //.....................^.......
      {
        $(".showing").hide();
        document.getElementById("mobile_image").required = false;
        document.getElementById("comission").required = false;
      }
      else
      {
        $(".showing").show();
        document.getElementById("mobile_image").required = true;
        document.getElementById("comission").required = true;
      }
    });
});


  </script>