<!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header mb_10">
      <h1>Item Categories</h1>
    </section>

    <!-- Main content -->
    <section class="content">
		<div class="row">			
			<div class="col-lg-12 mb_20">
			<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#AddItem" id="ItemCreateItemBtn" data-backdrop="static" data-keyboard="false"> 
					Add Category
			</button>
			</div>
		</div>
        <div class="modal fade" id="AddItem">
            <div class="modal-dialog modal-lg">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close mfwPopUpClose" data-dismiss="modal" aria-label="Close">
                        <i class="fa fa-remove"></i></button>
                        <h4 class="modal-title">Item Category Details</h4>
                    </div>
                    <div class="modal-body"> 
                        <div class="row">
                            <form role="form" id="mfwItemFormId" data-target="dashboard/create_catigory" method="post">
                                <div class="box-body">
                                    <div class="row">
                                        <div class="col-md-6"> 				
                                            <div class="form-group">
                                                <label for="ItemName">Category Name</label>
                                                <input type ="hidden" id="farm_action" value="dashboard/create_catigory">
                                                <input type="text" class="form-control" id="ItemName" name="ItemName" placeholder="Item Name" required autocomplete="off">
                                            </div>
                                        </div>
                                        
                                        <div class="col-md-6">
                                              <label for="ItemImage">Category Image</label>
                                              <div class="priview_thumb">
                                                 <input class="form-control" type='file' id="ItemImage" name="ItemImage" />
                                                 <span>The preferred size is 400px*400px and the same will appear in Android App.</span>
                                                 <span class="priview_thumb_img">
                                                    <a href="" data-toggle="modal" data-target="#ItemImagepr" ><img id="ItemImagepr" src="#" alt="" class="prev_thumb"/></a>
                                                 </span>
                                              </div>
                                          </div>
                                        <!-- /.box-body -->
                                    </div>
                                    <div class="box-footer">
                                        <input type="hidden" id="ItemUpdateId" name="ItemUpdateId">
                                        <button type="submit" class="btn btn-primary pull-right" id="CreateItem">Submit</button>
                                    </div>
                                </div> 
                            </form>  
                        </div>
                    </div> 
                </div>
                <!-- /.modal-content -->
            </div>
            <!-- /.modal-dialog -->
        </div>
        <!-- /.modal -->
	
	<div class="row">
	<div class="col-lg-12">
		<div class="box wholeSaleWrapper">
            <div class="box-body">
			<div class="table-responsive">
              <table id="mfw_ItemsTable" class="table table-bordered table-striped">
                <thead>
                <tr>
                  <th>Sr No.</th>
                  <th>Image</th>
                  <th>Category Name</th>
                  <th>Action</th>
                  
                </tr>
                </thead>
                <tbody>
				<?php if(!empty($categories)){
					$countItem = count($categories);
					 $i = $countItem;
					 $a=1;
					foreach($categories as $item){ 
				?>
                <tr>
                  <td><?php echo $a; ?></td>
					<td><?php 
						if(isset($item['catImage']) && !empty($item['catImage'])){
							$ItemImage = base_url().'assets/uploads/'.$item['catImage'];
							echo '<img src="'.$ItemImage.'" class="img_thumb" alt="Image">';
						} 
					?></td>
					<td><?php echo $item['catName']; ?></td>
					<td><button class="btn-primary icon_btn category_edit_btn" data-id="<?php echo $item['catId']; ?>" title="Edit"><i class="fa fa-pencil-square-o"></i></button>
					<button class="btn-danger icon_btn category_delete_btn" data-id="<?php echo $item['catId']; ?>" title="Delete"><i class="fa fa-trash-o"></i></button>
					</td>

					
                </tr>
				<?php 
				$a++;
				$i--;
				}
				} ?> 
                </tbody>
                <tfoot> 
                <tr>
                  <th>Sr No.</th>
                  <th>Image</th>
                  <th>Category Name</th>
                  <th>Action</th>
                </tr>
                </tfoot> 
              </table>
            </div>
            </div>
            <!-- /.box-body -->
          </div>
          <!-- /.box -->
		</div>
		</div>

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