<?php require_once('includes/check-login.php'); ?>
<?php require_once('includes/header.php'); ?>
    <?php require_once('includes/menu.php'); ?>

        <!-- Datatable CSS -->
        <link href='data_tables/datatables.min.css' rel='stylesheet' type='text/css' />        

        <!-- Content Wrapper. Contains page content -->
        <div class="content-wrapper">
            <!-- Content Header (Page header) -->
            <section class="content-header">                
                    <small><a href="javascript:void(0);" class="newCat"><i class="fa fa-plus"></i> Category</a></small>                   
                    <ol class="breadcrumb">
                        <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>                    
                        <li class="active"><a href="primary-category.php">Primary Category</a></li>           
                    </ol>                
            </section>

            <!-- Main content -->
            <section class="content">                
                <!-- Default box -->
                <div class="box box-form">
                    <div class="box-header with-border">
                        <h3 class="box-title">Primary Category</h3>
                        <div class="box-tools pull-right">
                            <button type="button" class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse">
                                <i class="fa fa-minus"></i></button>
                            <button type="button" class="btn btn-box-tool" data-widget="remove" data-toggle="tooltip" title="Remove">
                                <i class="fa fa-times"></i></button>
                        </div>
                    </div>
                    <div class="box-body">    
                        <!-- Table -->
                        <table id='PrimaryCategory' class='display dataTable table table-bordered table-hover'>
                            <thead>
                            <tr>
                                <th>Category</th>
                                <th>Sort Order</th>
                                <th>Active</th>
                                <th>Avatar</th>
                                <th>Created On</th>
                                <th>Edit</th>
                                <th>Delete</th>
                            </tr>
                            </thead>                
                        </table>

                    </div>
                    
                    <!-- /.box-footer-->                    
                </div>
                <!-- /.box -->

            </section>
            <!-- /.content -->                                        
        </div>
        <!-- /.content-wrapper -->        

        <div class="modal fade" id="categoryModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="categoryTitle"></h4>
                    </div>
                    <div class="modal-body">
                        <div class="row">
                            <div class="col-lg-12 message"></div>
                            <form role="form" id="categoryForm">                                
                                <div class="col-md-12">
                                    <div class="form-group">
                                        <label>Category Name</label>
                                        <br>
                                        <input type="text" class="form-control" id="category_name" name="category_name" placeholder="Category Name" value="" />
                                    </div>                                    

                                    <div class="form-group">
                                        <label>Sort Order</label>
                                        <br>
                                        <input type="text" class="form-control" id="sort_order" name="sort_order" placeholder="Sort Order" value="" />
                                    </div>

                                    <div class="form-group">
                                        <label>Category Image</label>
                                        <br>
                                        <input type="file" class="fa fa-file form-control" id="primary_cat_img" name="primary_cat_img" />
                                        <input type="hidden" id="old_cat_img" name="old_cat_img" />
                                    </div>

                                    <div class="form-group">
                                        <label>Active</label>
                                        <br>
                                        <select id="active" name="active" class="form-control">
                                            <option value="-1">-- Active --</option>
                                            <option value="1" selected="selected">Active</option>
                                            <option value="0">Inactive</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="col-xs-12">
                                    <button type="button" class="btn btn-primary" id="CategoryBtn">Save</button>
                                    <button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
  <div class="modal fade" id="pcEditModal" role="dialog">
    <div class="modal-dialog">
    
      <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">Edit Primary Category</h4>
        </div>
        <div class="modal-body">
          <!-- edit content start -->
            <form id="editPrimaryCategory" enctype="multipart/form-data">
                <center><div class="message"></div></center>
                <input type="hidden" id="id" name="id" class="form-control">

                <div class="col-md-12">
                    <div class="form-group">
                        <label>Category Name</label>
                        <input type="text" id="cat_name" name="cat_name" class="form-control">
                    </div>
                </div>
                <div class="col-md-12">
                    <div class="form-group">   
                        <label>Sort Order</label>
                        <input type="text" id="order" name="order" class="form-control" readonly>
                    </div>
                </div>
                <div class="col-md-12">
                    <div class="form-group">
                        <label>Category Image</label>
                        <input type="file" id="img_cat" name="img_cat" class="form-control">
                        <input  id="old_img" type="hidden" name="old_img" /><br/>

                    </div>
                </div>
                <div class="col-md-12">
                    <div class="form-group">
                        <label>Status</label>
                            <select class="form-control" name="status" id="status">
                                <option value="-1">---Select---</option>
                                <option value="1">Active</option>
                                <option value="0">In-active</option>
                            </select> 
                    </div>
                </div>
                <div class="col-md-12">
                    <div class="form-group">
                        <button type="button" name="edit_description" id="edit_description" value="Update" class="btn btn-primary float-left updatePrimaryCategory" >Save</button>
                        <button type="button" class="btn btn-primary float-left" data-dismiss="modal" >Close</button>
                    </div>
                </div>    
            </form> 
          <!-- edit content end -->
        </div>
        <br />
        <div class="modal-footer">
        </div>
      </div>
      
    </div>
  </div>       


<script src="js/common.js"></script>     
<script src="js/pc/script.js"></script>     
<?php require_once('includes/footer.php'); ?>