<?php include('../config/setup.php'); ?>
<?php include "head.php" ?>

	<div class="wrapper">
		<div class="main-header">
			<!-- Logo Header -->
			<?php include('logo.php'); ?>
			<!-- End Logo Header -->

			<!-- Navbar Header -->
			<?php include('topbar.php'); ?>
			<!-- End Navbar -->
		</div>
		<!-- Sidebar -->
		<?php include('sidebar.php'); ?>


		<div class="main-panel">
			<div class="content">
				<div class="page-inner">
					<div class="page-header">
						<h4 class="page-title">Main Category</h4>

					</div>
					<div class="row">
						<div class="col-md-12">
							<div class="card">

								<div class="card-body">
									<!--<center> <button type="button" class="btn btn-success" data-toggle="modal" data-target="#exampleModal">-->
									<!--		<i class="fas fa-plus"></i> Add New Category-->
									<!--	</button></center>-->
									<div class="table-responsive">
										<table id="basic-datatables" class="display table table-striped table-hover">
											<thead>
												<tr>
													<th>S.No</th>
													<th>Main Category</th>
													<th>Status</th>
													<th>Action</th>
												</tr>
											</thead>

											<tbody>
												<?php
												$mc = 1;
												$main_cate = mysqli_query($config, "select * from main_category");
												while ($macate = mysqli_fetch_object($main_cate)) {
												?>


													<tr>
														<td><?php echo $mc; ?></td>

														<td><?php echo $macate->Main_Category_Name; ?></td>

														<!--<td><img style="width:100px" src="../../photos/psbanner/<?php #echo $macate->Shop_setting; ?>">-->
														<!--</td>-->
														<td><?php

															$enablestatus = $macate->Main_Category_Status;

															if ($enablestatus == 1) { ?>
																<label class="btn btn-success text-white">Active</label>
															<?php
															} else {
															?>
																<label class="btn btn-danger text-white">In-Active</label>
															<?php
															}


															?>
														</td>
														<td>
															<a href="" class="btn btn-primary" data-toggle="modal" data-target="#<?php echo $mc; ?>"> <i class="fas fa-pencil-alt"></i> </a>
															<!--<a href="Function/Main_category_delete.php?delcateid=<?php # echo $macate->Main_Category_id; ?>&delcat=100" class="btn btn-danger" onclick="return confirm('Are you confirm to delete this category?');"> <i class="fas fa-trash"></i> </a>-->



														</td>

														<!-- Modal -->
														<div class="modal fade" id="<?php echo $mc; ?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
															<div class="modal-dialog" role="document">
																<div class="modal-content">
																	<div class="modal-header">
																		<h5 class="modal-title" id="exampleModalLabel">Main Category Edit</h5>
																		<button type="button" class="close" data-dismiss="modal" aria-label="Close">
																			<span aria-hidden="true">&times;</span>
																		</button>
																	</div>
																	<div class="modal-body">
																		<form action="Function/Main_category_edit.php" method="post" enctype="multipart/form-data">


																			<div class="form-group d-none">
																				<label for="exampleFormControlSelect1">Icon</label>
																				<img style="width:100px" src="../../photos/psbanner/<?php echo $macate->Shop_setting; ?>">
																				<input type="file" class="form-control" id="email2" name="Add_main_cate_shopsetting" value="">
																			</div>
																			<div class="form-group">
																				<label for="email2">Main Category</label>
																				<input type="hidden" class="form-control" id="email2" name="main_cate_id" value="<?php echo $macate->Main_Category_id; ?>">
																				<input type="text" class="form-control" id="email2" name="main_cate_name" placeholder="Main CategoryName" value="<?php echo $macate->Main_Category_Name; ?>">
																			</div>
																			<div class="form-group">
																				<label for="exampleFormControlSelect1"> Status</label>
																				<select class="form-control" id="exampleFormControlSelect1" name="main_category_status">
																					<?php

																					$enablestatus = $macate->Main_Category_Status;

																					if ($enablestatus == 1) { ?>

																						<option value="1" selected>Active</option>
																						<option value="0">In-Active</option>
																					<?php } else if ($enablestatus == 0) { ?>

																						<option value="1">Active</option>
																						<option value="0" selected>In-Active</option>
																					<?php } else { ?>
																						<option value="1">Active</option>
																						<option value="0">In-Active</option>


																					<?php } ?>

																				</select>
																			</div>

																			<div class="form-group">
																				<button class="btn btn-success" type="submit" name="category_content_edit">Submit</button>
																			</div>


																		</form>


																	</div>


																	<div class="modal-footer">
																		<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>

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


													</tr>

												<?php $mc++;
												} ?>

											</tbody>
										</table>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>

			<!-- Modal -->
			<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
				<div class="modal-dialog" role="document">
					<div class="modal-content">
						<div class="modal-header">
							<h5 class="modal-title" id="exampleModalLabel">Main Category</h5>
							<button type="button" class="close" data-dismiss="modal" aria-label="Close">
								<span aria-hidden="true">&times;</span>
							</button>
						</div>
						<div class="modal-body">
							<form action="Function/Add_Main_Category.php" method="post" enctype="multipart/form-data">


								<!--<div class="form-group">-->
								<!--	<label for="exampleFormControlSelect1">Icon</label>-->
								<!--	<input type="file" name="Add_main_cate_shopsetting">-->
								<!--</div>-->





								<div class="form-group">
									<label for="email2">Main Category</label>
									<input type="text" class="form-control" id="email2" name="Add_main_cate_name" placeholder="">
								</div>
                                <div class="form-group">
                                    <label for="email2">Need Sub Category ?</label>
                                    <div class="d-flex">
                                        <div class="form-check" style="margin-left:10px;">
                                          <input type="radio" class="form-check-input" id="radio1" name="sub_menu" value="1">
                                          <label class="form-check-label" for="radio1">Yes</label>
                                        </div>
                                        <div class="form-check">
                                          <input type="radio" class="form-check-input" id="radio2" name="sub_menu" value="0">
                                          <label class="form-check-label" for="radio2">No</label>
                                        </div>
                                    </div>
                                  <!--<input class="form-check-input" type="checkbox" id="sub_menu" name="sub_menu" >-->
                                  <!--<label class="form-check-label">Sub Category</label>-->
                                </div>
                                
								<div class="form-group">
									<label for="exampleFormControlSelect1"> Status</label>
									<select class="form-control" id="exampleFormControlSelect1" name="Add_main_category_status">
										<option value="1">Active</option>
										<option value="0">In-Active</option>

									</select>
								</div>

								<div class="form-group">
									<button class="btn btn-success" type="submit" name="category_add">Add New</button>
								</div>


							</form>

						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>

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













			<?php include('footer.php'); ?>
		</div>


		<!-- End Custom template -->
	</div>
	<!--   Core JS Files   -->
	<script src="../assets/js/core/jquery.3.2.1.min.js"></script>
	<script src="../assets/js/core/popper.min.js"></script>
	<script src="../assets/js/core/bootstrap.min.js"></script>
	<!-- jQuery UI -->
	<script src="../assets/js/plugin/jquery-ui-1.12.1.custom/jquery-ui.min.js"></script>
	<script src="../assets/js/plugin/jquery-ui-touch-punch/jquery.ui.touch-punch.min.js"></script>

	<!-- jQuery Scrollbar -->
	<script src="../assets/js/plugin/jquery-scrollbar/jquery.scrollbar.min.js"></script>
	<!-- Datatables -->
	<script src="../assets/js/plugin/datatables/datatables.min.js"></script>
	<!-- Atlantis JS -->
	<script src="../assets/js/atlantis.min.js"></script>
	<!-- Atlantis DEMO methods, don't include it in your project! -->
	<script src="../assets/js/setting-demo2.js"></script>
	<script>
		$(document).ready(function() {
			$('#basic-datatables').DataTable({});




		});
	</script>
</body>

</html>