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

<!DOCTYPE html>
<html lang="en">
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<title><?php 
            
            $leename=mysqli_query($config,"select Name,Name_status from lee_master");
            while($lee=mysqli_fetch_array($leename))
            {
                 $namestatus=$lee[1];
if($namestatus == 1)
{
    echo  $lee[0];
}else{
    echo "Need Name";

}

            }
            
            ?>  </title>
	<meta content='width=device-width, initial-scale=1.0, shrink-to-fit=no' name='viewport' />
	<link rel="icon" href="<?php 
            
            $inro_logo=mysqli_query($config,"select Logo_Path,logo_status from lee_master");
            while($logo=mysqli_fetch_array($inro_logo))
            {
                 $logstatus=$logo[1];
if($logstatus == 1)
{
	
	 $ms=substr($logo[0],3);
				  echo  $ms;
	
     
}else{
    echo "../../photos/logo/no_logo.png";

}

            }
            
            ?>" type="image/x-icon"/>
	
	<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
	<script src="../assets/js/plugin/webfont/webfont.min.js"></script>
	<script>
		WebFont.load({
			google: {"families":["Lato:300,400,700,900"]},
			custom: {"families":["Flaticon", "Font Awesome 5 Solid", "Font Awesome 5 Regular", "Font Awesome 5 Brands", "simple-line-icons"], urls: ['../assets/css/fonts.min.css']},
			active: function() {
				sessionStorage.fonts = true;
			}
		});
	</script>

	<!-- CSS Files -->
	<link rel="stylesheet" href="../assets/css/bootstrap.min.css">
	<link rel="stylesheet" href="../assets/css/atlantis.min.css">
	<!-- CSS Just for demo purpose, don't include it in your project -->
	<link rel="stylesheet" href="../assets/css/demo.css">
		<script src="../assets/angular/angular.min.js"></script> 
		
		
		
		
<style>

.tab {
  overflow: hidden;
  border: 1px solid #ccc;
  background-color: #f1f1f1;
}

/* Style the buttons inside the tab */
.tab button {
  background-color: inherit;
  float: left;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 14px 16px;
  transition: 0.3s;
  font-size: 17px;
}

/* Change background color of buttons on hover */
.tab button:hover {
  background-color: #ddd;
}

/* Create an active/current tablink class */
.tab button.active {
  background-color: #ccc;
}

/* Style the tab content */
.tabcontent {
  
  padding: 6px 12px;
  border: 1px solid #ccc;
  border-top: none;
}
</style>		
		
</head>
<body>
	<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" style="    padding-top:61px;background-color: white;    margin-right: 16px;">
			
 <div class="tab">
<!-- <button class="tablinks" onclick="openCity(event,'London')">Add Product</button>
  <button class="tablinks" onclick="openCity(event, 'Paris')">Add Product  Price</button>
  <button class="tablinks" onclick="openCity(event, 'Tokyo')">Add Product Gallery</button>-->
</div>
			
 <form action="Function/Add_master_product.php" method="post" enctype="multipart/form-data"  name="upload_form" id="upload_form">

      <div class="modal-body">
	   <div ng-app="myproduct" ng-controller="productcontroller" ng-init="loadid()">
   <div id="London" class="tabcontent ">
  <h3>Add New Product</h3>
       
 
   <div ng-app="myproduct" ng-controller="productcontroller" ng-init="loadid()">
        <form action="Function/Add_product.php " method="post" enctype="multipart/form-data">
         	
			<div class="form-group">
	<label for="email2">Product Name (Avoid Special Characters ' "" !  )</label>
<input type="text" maxlength="60" class="form-control" id="email2" name="Add_pro_name" placeholder="Enter Product Name"  >
<small style="color: red;">* 60 CHARACTERS Only</small>
			</div>
			
			<div class="form-group" >
                <label for="inputStatus">Main  Category </label>
                <select class="form-control" name="Add_product_maincate" onchange="main_categ(this.value);" >
				<option  value="">Select Main  Category</option>
			  <?php
			   $shop_master=mysqli_query($config,"select * from main_category where Main_Category_Status=1");
			   while($sm=mysqli_fetch_object($shop_master))
			   {
			   ?>
               <option  value="<?php echo $sm->Main_Category_id?>"><?php echo $sm->Main_Category_Name?></option>
			   <?php }?>
                </select>
              </div> 
			  
				<div id="sc"></div>
               
              
		
			  <div class="form-group" >
				
				<div class="row" >
				<div class="col-2" style="display:none">
					<div class="form-group">
                <label for="inputStatus">Texture </label>
                <select required class="form-control" name="texture[]"  >
             
			  <?php
			   $shop_master=mysqli_query($config,"select * from plateform_master");
			   while($sm=mysqli_fetch_object($shop_master))
			   {
			   ?>
               <option  value="<?php echo $sm->plateform_id?>"><?php echo $sm->plateform_name?></option>
			   <?php }?>
                </select>
              </div> 
					</div>
					<div class="col-2" style="display:none">
					<div class="form-group">
                <label for="inputStatus">Color </label>
                <select required class="form-control" name="color[]"  >
             
			  <?php
			   $shop_master=mysqli_query($config,"select * from main_category where Main_Category_Status=1");
			   while($sm=mysqli_fetch_object($shop_master))
			   {
			   ?>
               <option  value="<?php echo $sm->Main_Category_id?>"><?php echo $sm->Main_Category_Name?></option>
			   <?php }?>
                </select>
              </div> 
					</div>

					<div class="col-2" style="display:none">
					<div class="form-group">
                <label for="inputStatus">length </label>
                <select required class="form-control" name="length[]"  >
             
			  <?php
			   $shop_master=mysqli_query($config,"select * from game_support_flatform");
			   while($sm=mysqli_fetch_object($shop_master))
			   {
			   ?>
               <option  value="<?php echo $sm->shop_id?>"><?php echo $sm->Shop__setting?></option>
			   <?php }?>
                </select>
              </div> 
					</div>
			  <div class="col-3">
			  <div class="form-group" id="">
			<label for="email2">Weight</label>
			<select required class="form-control" name="weight[]"  >
             
			 <?php
			  $shop_master=mysqli_query($config,"select * from game_rate");
			  while($sm=mysqli_fetch_object($shop_master))
			  {
			  ?>
			  <option  value="<?php echo $sm->Game_rate_id?>"><?php echo $sm->Game_Rateing?></option>
			  <?php }?>
			   </select>

			</div>
			  </div> 

			  <div class="col-3">
			  <div class="form-group" id="">
			<label for="email2">Product price</label>
			<input  type="number" class="form-control" id="email2" name="Add_pro_price[]" placeholder="Product Price"  >

			  </div>
			  </div>
			  <div class="col-3">
			  <div class="form-group" id="">
			<label for="email2">Selling price</label>
			<input required type="number" class="form-control" id="email2" name="Add_pro_shelling_price[]" placeholder="Product Shelling Price"  >
			</div>
			  </div>
			  <div class="col-3">
			  <div class="form-group" id="">
			<label for="email2">Product Image</label>
			<input required type="file" class="form-control" id="email2" name="support_image[]"   >
			</div>
			  </div>

					</div>
					<div  id="old__"></div>
					<div class="form-group" id="">
						<a href="#" type="button" onclick="add_new()" style="float: right;" class="btn btn-warning"> <i class="fa fa-plus"></i> Add </a>
					</div>
			

			
			
			
<div class="form-group" id="psize" style="display: none;">
	<label for="email2">Painting Size</label></br>
	<div class="form-group">
	<?php
	$gamesupport=mysqli_query($config,"select Shop__setting,shop_id from game_support_flatform");
	
	while($gs=mysqli_fetch_object($gamesupport))
	{
	?>
	<label style="font-weight: normal;">
&nbsp;&nbsp;<input id="<?php echo $gs->shop_id;?>" onClick="reply_click(this.id)" class="" type="checkbox"  name="Add_pro_game_support[]" value="<?php echo $gs->Shop__setting;?>" > &nbsp;&nbsp;<?php echo $gs->Shop__setting;?>
   <input class="form-control" id="m<?php echo $gs->shop_id;?>" type="file" name="support_image[]" >
   <small style="color: red;">* Image size 247px * 300px  </small><br>
   <div class="row">
  <label class="p_t">Product price</label> <input id="p<?php echo $gs->shop_id;?>" class="form-control pr_add" type="text" name="prod_price[]"></div>
  <div class="row">
  <label class="p_t">Selling price</label> <input id="s<?php echo $gs->shop_id;?>" class="form-control pr_add" type="text" name="shell_price[]"></div>

	</label>
	<?php } ?>

	</div>
	</div>



			
			  
			  
				
			

			<div class="form-group" style="display: none;">
	<label for="email2">Game Age Rating</label></br>
	
	<?php
	$gamerate=mysqli_query($config,"select Game_Rateing from game_rate");
	
	while($gr=mysqli_fetch_object($gamerate))
	{
	?>
	<label style="font-weight: normal;">
&nbsp;&nbsp;<input type="checkbox"  name="Add_game_rate[]" value="<?php echo $gr->Game_Rateing;?>" > &nbsp;&nbsp;<?php echo $gr->Game_Rateing;?> 

	</label>
	<?php } ?>


	</div>

  <div class="form-group" style="display: none;">
			<label for="email2">Edition Type</label></br>
			
			<?php
			
			$pro_type_=mysqli_query($config,"select * from product_type where Product_type_status=1");
											while($ptype=mysqli_fetch_object($pro_type_))
											{
			
			
			?>
			<label style="font-weight: normal;">
		&nbsp;&nbsp;<input type="checkbox"  name="Add_pro_type[]" value="<?php echo $ptype->Product_type;?>" > &nbsp;&nbsp;<?php echo $ptype->Product_type;?>
	
			</label>
			
											<?php } ?>
		</div>  






			
		
			
			 <div class="form-group" style="display: none;">
			<label for="email2">Product tax</label>
			
			<select class="form-control" name="Add_pro_tax" >
			<?php
			
			$pro_name_=mysqli_query($config,"SELECT * FROM `tax_master` ORDER BY `tax_master`.`Tax` ASC");
											while($add_pro=mysqli_fetch_object($pro_name_))
											{
			
			
			?>
			
			<option value="<?php echo $add_pro->Tax;?>"><?php echo $add_pro->Tax;?>%</option>
			
			
			
			
											<?php } ?>
			
			</select>	
			
			
			
			
			</div>
			
			
				<div class="form-group" >
			<label for="email2">  Avalible Stocks</label>
			<input type="number" class="form-control" id="email2" name="Add_pro_stocks" placeholder="Product Avalible Stocks" value="1"  >
			</div> 
			
			
				<div class="form-group">
			<label for="email2">Product Master Image (size 247px X 300 px )</label>
			<input type="file" class="form-control" id="email2" name="Add_product_master_image"    >
			</div>

			<div class="form-group" >
	<label for="email2">Short description</label>
<input type="text" class="form-control" id="email2" name="Add_pro_Publisher"   >

			</div> 
	<div class="form-group" style="display: none;">
			<label for="email2">Multiple Product Image (size 800px X 800 px)</label>
			<input type="file" name="upload_images[]" id="image_file"  class="form-control"  multiple>
			  
			</div>
	 		<div class="form-group">
			<label for="email2">Product Description  (Avoid Special Characters ' "" !  )</label>
		
<textarea name="Editor1" style="width:100%;">      
</textarea>

<script type="text/javascript" src="richtext.js"></script> 
  <script type="text/javascript">
 
        bkLib.onDomLoaded(function() { nicEditors.allTextAreas() });
  </script>
		</div>
	
		
			<div class="form-group" style="display: none;">
	<label for="email2">Header Name	</label>
<input type="text" class="form-control" id="email2" name="Add_pro_Developer"   >

			</div>

			<div class="form-group" style="display: none;" >
	<label for="email2">Medium</label>
	

	<input type="text" class="form-control" id="email2" name="Add_pro_brand" placeholder=""  >
	</div>
		<div class="form-group" style="display: none;">
			<label for="email2">Weight (Gm)</label>
			<input type="text" class="form-control" id="email2" name="return" placeholder=""  >
			</div>

			<div class="form-group" style="display:none">
			<label for="email2">Delivery price</label>
			<input type="number" class="form-control" id="email2" name="delivry" placeholder="Delivery price"  >
			</div>
		<div class="form-group" >
			<label for="email2">Youtube Code</label>
			<input type="text" class="form-control" id="email2" name="Add_pro_video_link" placeholder=""  >
			</div>
			<div class="form-group" style="display: none;">
			<label for="email2">Authenticity</label>
 			<select class="form-control" id="exampleFormControlSelect1" name="Add_pro_offer" >
			<option value="0">No</option>
		<option value="1">Yes</option>
	
		
		</select>
		</div>  
		<div class="form-group" style="display: none;">
                <label for="inputStatus">Product Listing </label>
              

			 <div class="form-check" >
  <input checked class="form-check-input"  name="p_list" type="checkbox" value="1" id="defaultCheck1">
  <label class="form-check-label" for="defaultCheck1">
  Our Products
  </label>
</div>
<div class="form-check">
  <input class="form-check-input" name="p_list2" type="checkbox" value="2" id="defaultCheck1">
  <label class="form-check-label" for="defaultCheck1">
  Speial Products
  </label>
</div>

              </div>
			  
			  
			   <div class="form-group"  style="display: none;">
			<label for="email2"> Releasing On</label>
			<input type="date" class="form-control" id="email2" name="Add_pro_rel_date" value="<?php  echo  date('Y-m-d');?>"  >
			</div>
			   
			   
			   
	   
	  
			<div class="form-group " style="display: none;">
	<label for="email2">Playstation Type</label></br>
	<div class="form-group">
	<?php
	$gamesupport=mysqli_query($config,"select Shop__setting,shop_id from shop_setting");
	
	while($gs=mysqli_fetch_object($gamesupport))
	{
	?>
	<label style="font-weight: normal;">
&nbsp;&nbsp;<input id="<?php echo $gs->shop_id;?>"  class="" type="checkbox"  name="Add_pro_game_support1[]" value="<?php echo $gs->Shop__setting;?>" > &nbsp;&nbsp;<?php echo $gs->Shop__setting;?>

	</label>
	<?php } ?>

	</div>
	</div>



        <div class="form-group" style="display: none;">
		<label for="exampleFormControlSelect1">Product Displayed  Category</label>
		<select class="form-control" id="exampleFormControlSelect1" name="Add_pro_dispaly_cate" >
		<option value="Console">Console</option>
		<option value="Accessories">Accessories</option>
		<option value="Games">Games</option>
		<option value="Digital">Digital</option>
		
		</select>
											</div>	 
											
	   
		 <div class="form-group" style="display: none;">
		<label for="exampleFormControlSelect1">Product Display</label>
		<select class="form-control" id="exampleFormControlSelect1" name="Add_pro_dispaly" >
		<option value="New">New</option>
		<option value="Feature">Feature</option>
		<option value="Preorder">Pre-order</option>
		<option value="CommingSoon">Comming Soon</option>
		

		</select>
											</div>	 
											
											
											
											
											<div class="form-group" style="display: none;">
		<label for="exampleFormControlSelect1">Product Active Status</label>
		<select class="form-control" id="exampleFormControlSelect1" name="Add_pro_status" >
		<option value="1">Active</option>
		<option value="0">In-Active</option>
		
		</select>
											</div>	
											
											</div>
			
			
</div>


 
   


	 
	
      </div>
      </div>
	  

	  <div class="form-group">
									<button style="float: right;" class="btn btn-success" type="submit" name="Add_new_product">Add New</button>
 								</div>	 
			
								 <br>
			<br>
			</form>		
			
			
		</div>
	</div>
			
			
			
	<div style="display: none;">	
											<div id="clon__" class="template">	
				<div class="row" >
				<div class="col-2" style="display:none">
					<div class="form-group">
                <label for="inputStatus">Texture </label>
                <select required class="form-control" name="texture[]"  >
             
			  <?php
			   $shop_master=mysqli_query($config,"select * from plateform_master");
			   while($sm=mysqli_fetch_object($shop_master))
			   {
			   ?>
               <option  value="<?php echo $sm->plateform_id?>"><?php echo $sm->plateform_name?></option>
			   <?php }?>
                </select>
              </div> 
					</div>
					<div class="col-2" style="display:none">
					<div class="form-group">
                <label for="inputStatus">Color </label>
                <select required class="form-control" name="color[]"  >
             
			  <?php
			   $shop_master=mysqli_query($config,"select * from main_category where Main_Category_Status=1");
			   while($sm=mysqli_fetch_object($shop_master))
			   {
			   ?>
               <option  value="<?php echo $sm->Main_Category_id?>"><?php echo $sm->Main_Category_Name?></option>
			   <?php }?>
                </select>
              </div> 
					</div>

					<div class="col-2" style="display:none">
					<div class="form-group">
                <label for="inputStatus">length </label>
                <select required class="form-control" name="length[]"  >
             
			  <?php
			   $shop_master=mysqli_query($config,"select * from game_support_flatform");
			   while($sm=mysqli_fetch_object($shop_master))
			   {
			   ?>
               <option  value="<?php echo $sm->shop_id?>"><?php echo $sm->Shop__setting?></option>
			   <?php }?>
                </select>
              </div> 
					</div>
			  <div class="col-3">
			  <div class="form-group" id="">
			<label for="email2">Weight</label>
			<select required class="form-control" name="weight[]"  >
             
			 <?php
			  $shop_master=mysqli_query($config,"select * from game_rate");
			  while($sm=mysqli_fetch_object($shop_master))
			  {
			  ?>
			  <option  value="<?php echo $sm->Game_rate_id?>"><?php echo $sm->Game_Rateing?></option>
			  <?php }?>
			   </select>

			</div>
			  </div> 
			  <div class="col-3">
			  <div class="form-group" id="">
			<label for="email2">Product price</label>
			<input  type="number" class="form-control" id="email2" name="Add_pro_price[]" placeholder="Product Price"  >

			  </div>
			  </div>
			  <div class="col-3">
			  <div class="form-group" id="">
			<label for="email2">Selling price</label>
			<input required type="number" class="form-control" id="email2" name="Add_pro_shelling_price[]" placeholder="Product Shelling Price"  >
			</div>
			  </div>
			  <div class="col-3">
			  <div class="form-group" id="">
			<label for="email2">Product Image</label>
			<input required type="file" class="form-control" id="email2" name="support_image[]"   >
			<a style="float: right;" href="#" class="btn btn-danger btn-sm  remove_btn"><i class="fa fa-close"></i></a>	
		</div>
			  </div>

			 
			  
		    	</div>
			
			
			
			
			
		</div>
		<!-- <?php include('footer.php');?> -->
		 <script>
function openCity(evt, London) {
  var i, tabcontent, tablinks;
  tabcontent = document.getElementsByClassName("tabcontent");
  for (i = 1; i < tabcontent.length; i++) {
    tabcontent[i].style.display = "none";
  }
  tablinks = document.getElementsByClassName("tablinks");
  for (i = 1; i < tablinks.length; i++) {
    tablinks[i].className = tablinks[i].className.replace("active", "");
  }
  document.getElementById(London).style.display = "block";
  evt.currentTarget.className += " active";
}
</script>
		<!-- 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>
var app = angular.module("myproduct",[]);  


 app.controller("productcontroller", function($scope, $http){  
$scope.loadid = function()
{
  $http.get("Function/Product_catergory.php")  
           .success(function(data){  
                $scope.cateid = data;  
           }); 
 
 }  

 $scope.loadsub = function(id){ 
	
        //    $http.post("Function/Product_sub_category.php", {'cate_id':$scope.ctid})  
        //    .success(function(data){  
        //         $scope.subna = data;  
        //    });   
		   
     




	 }  
	   
    


 }); 

 function main_categ(id){
	
	$.ajax({
        type: "POST",
        url:'subcate.php',
        data: {id:id}, // serializes the form's elements.
        success: function(data)
        {
			
         $('#sc').html(data);
        }
    });
 }
 </script>
<script>

$('#mid').change(function() {
	var mid=$(this).val();
	
	$.ajax({
        url: "Function/Product_sub_category.php",
        type: "post",
        data: {mid:mid} ,
        success: function (response) {

           
		   $('#sc').html(response);
        }
    });
});

</script>	
	
</body>
</html>


<style>
	.pr_add{
		width: 40%;
    margin-bottom: 3%;
	margin-left: 15%;
	}
	.p_t{
		
		margin-left: 5%;

	}
	.form-check [type=checkbox]:checked, .form-check [type=checkbox]:not(:checked) {
    position: absolute;
    left: 13px;
}
.col-2{
	padding-right: 0px !important;
}
	</style>

<script>
        $(document).ready(function() {
            // On click of checkbox
            $('#cbox').click(function() {
                // Check if it's checked
                if ($(this).prop('checked')) {
                    // Add the required attribute to the text input
                    $('#tbox').attr('required', '');
                    // log our results and display a small indicator span status
                    console.log('input is now required');
                    $('.status').text('input is now required');
                } else {
                    // If it isn't checked, remove the required attribute
                    $('#tbox').removeAttr('required');
                    // log our results and display a small indicator span status
                    console.log('input is no longer required');
                    $('.status').text('input is no longer required');
                }
            });
        });

		function reply_click(clicked_id)
  {
      
	  var id=clicked_id;
	  
	  var pid='#p'+id;
	  var sid='#s'+id;
	  var cid='#'+id;
	  var mid='#s'+id;

	
	  if($(cid).prop('checked') == true){
		$(pid).attr('required', '');
	  $(sid).attr('required', '');
	  $(mid).attr('required', '');
	  
	  }else{
		$(pid).removeAttr('required');
	  $(sid).removeAttr('required');
	  $(mid).removeAttr('required');
	  }
	

	
	
  }
    </script>

	<script>
	function ptype_check(id){
		if(id == 1){
			$('#psize').css('display','none');
		}else{
			$('#psize').css('display','block');
			$('#pprice').css('display','none');
			$('#sprice').css('display','none');

		}
	}
	</script>
	<script>
		function add_new()
		{
			$("#old__").append($("#clon__").clone());
		}
		$(document).on("click", ".remove_btn", function(e) {
    var $e = $(e.currentTarget);
    $e.closest('.template').remove();
  });
	</script>