<?php
ob_start();
error_reporting(0);
include("connect.php");
session_start();
$ver = $_SESSION['distributor_user_id'];
$user_role= $_SESSION['user_role']; 
if(!isset($_SESSION["distributor_user_id"])){
   header('location:https://tarkashcorp.appexperts.net/index.php');
}

if(isset($_POST['sub']))
{   
	$brand_id=$_POST['brand_id'];
    $brand_name=$_POST['brand_name'];
	$category_name=$_POST['category_name'];
/*	$CGST=$_POST['CGST'];
	$SGST=$_POST['SGST'];	*/
}
?>

<?php
$id1=$_GET['id'];
?>

<!DOCTYPE html>
<html lang="en">
    <head>
      <?php include("link_head.php");?>  
    <!-- END HEAD -->
			<script>
			function myFunction() {
				var txt;
				var r = confirm("Are you sure to cancel!");
				if (r == true) {
					window.location.href="category-detail.php";
				} 
			}
			</script>
	<style>
	::-webkit-scrollbar {
		display: none;
		overflow: hidden;
	}
	</style>
	<script>
	window.onscroll = function () {
	window.scrollTo(0,0);
	}
	</script>			
	</head>
	
    <body class="">
        <!-- BEGIN HEADER -->
		<?php include("header.php");?>
        <!-- END HEADER -->
		
        <!-- BEGIN CONTAINER -->
        <div class="container-fluid">
            <div class="page-content page-content-popup">
                
                <div class="page-sidebar-wrapper">
                    <!-- BEGIN SIDEBAR -->
                    <?php include("menu.php");?> 
				    <!-- END SIDEBAR -->
                </div>
                <div class="page-fixed-main-content">
                        <div class="row">
                            <div class="col-md-12">
                                <!-- BEGIN SAMPLE TABLE PORTLET-->
                                <div class="portlet">
                                    <div class="portlet-title">
                                        <div class="caption">
                                            <i class="fa fa-bell-o"></i> Edit Category Detail Confirmation
										</div>
                                    </div>
									
                                    <div class="portlet-body form" >
                                        <form method="post" name="form1"  enctype="multipart/form-data">
                                            <div class="form-body">
											<div class="form-group">
											
											
											<?php
											$cname=mysqli_query($con,"select * from tbl_master_brand where brand_id='$brand_id'");
											if($cname){
												while($fetch_product=mysqli_fetch_assoc($cname))
											 {	extract($fetch_product);
											?>
											<div class="col-md-4">
											 <label>Brand Name</label>
									<!--	 <input type="text" value="<?php // $category_name; ?>" name="category_name" placeholder="CATEGORY NAME" class="form-control" readonly> -->
											 <input type="text" value="<?=$brand_name; ?>" name="brand_name" placeholder="CATEGORY NAME" class="form-control" readonly> 
											 <input type="hidden" value="<?=$brand_id; ?>" name="brand_id">
											</div>
											<?php } }?>
											
											
											<div class="col-md-4">
											 <label>Category Name</label>
											 <input type="text" value="<?=$category_name; ?>" name="category_name" placeholder="CATEGORY NAME" class="form-control" readonly> 
											</div>
											<!--
											<div class="col-md-4">
											<label>CGST</label>
                                              <input type="text" value="<?=$CGST; ?>" class="form-control" placeholder="CGST" name="CGST" required readonly> 
											</div>
																				
											<div class="col-md-4">
											<label>SGST</label>
                                             <input type="text" value="<?=$SGST; ?>" class="form-control" required placeholder="SGST" name="SGST" style="text-transform:uppercase;" readonly> 
											</div>
											-->
											</div>
											<br clear="all"><br>
                                            </div>
										
                                            <div class="form-actions">
											<?php if($user_role=="Admin") { ?>
                                                <p>Are you sure to edit category detail!</p> 
											   <button type="submit" name="sub1" class="btn blue">Ok</button>
											   <button type="submit" name="sub11" class="btn blue">Back</button>
												<button type="submit" name="subcancel" class="btn blue" onClick="return confirm('Are you sure to cancel!')">Cancel</button>
											<?php } ?>
                                            </div>      
                                        </form>
										
										<?php
										if(isset($_POST['sub11']))
										{ 
										$id1=$_GET['id'];
										header("location:edit-category-detail.php?id=".$id1); 
										}
										if(isset($_POST['subcancel']))
										{ 
										header("location:category-detail.php");
										}
										if(isset($_POST['sub1']))
										{
											$brand_id=$_POST['brand_id'];
											$brand_name=$_POST['brand_name'];
											$category_name=$_POST['category_name'];
										/*	$CGST=$_POST['CGST'];
											$SGST=$_POST['SGST'];	*/
											
											date_default_timezone_set('Asia/Calcutta');
											$cdate  = date("Y-m-d")." ".date('H:i:sa');
											$scro=date("Y-m-d");
											$scri=date('H:i:s');		
											  
											$insert_category_detail=mysqli_query($con,"UPDATE tbl_master_category set brand_id='$brand_id', category_name='$category_name', status='Active', update_dateTime='$cdate' where category_id='$id1'");
											  
											if($insert_category_detail)
											{
											   header("location:category-detail.php");
											}
										
										}
										?>
								    </div>
									
									
                                </div>
                                <!-- END SAMPLE TABLE PORTLET-->
                            </div>
						</div>
                    </div>
                    <div class="clearfix"></div>
                    <!-- END DASHBOARD STATS 1-->
                    <!-- END PAGE BASE CONTENT -->
                </div>
			<div class="copyright-v2" style="padding:3px; margin-top:-18px;">
		    <?=date("Y")?> &copy; Tarkashcorp Developed By <a target="_blank" href="http://www.belltechnology.in">Bell Technology</a>
			</div>
		    <!-- END CONTAINER -->
            <!-- BEGIN FOOTER -->
			<a href="#index" class="go2top">
                    <i class="icon-arrow-up"></i>
                </a>
                <!-- END FOOTER -->
            </div>
        </div>
        <!-- END CONTAINER -->
        <!-- BEGIN QUICK SIDEBAR -->
        <a href="javascript:;" class="page-quick-sidebar-toggler">
            <i class="icon-login"></i>
        </a>
        
        <!-- END QUICK SIDEBAR -->
        <!-- BEGIN QUICK NAV -->
        
        <div class="quick-nav-overlay"></div>
        <!-- END QUICK NAV -->
        
        <!-- BEGIN CORE PLUGINS -->
        <?php include("link_script.php");?>  
        <!-- END THEME LAYOUT SCRIPTS -->
        <script>
            $(document).ready(function()
            {
                $('#clickmewow').click(function()
                {
                    $('#radio1003').attr('checked', 'checked');
                });
            });
        </script>
    </body>
</html>