<?php 
if(!isset($_SESSION)) { 
  session_start(); 
  include('../includes/dbcon.php');
}
if(empty($_SESSION['rm_id'])):
header('Location:../index.php');
endif;


?>
<!DOCTYPE html>
<html lang="en">


<head>
  <!-- Required meta tags -->
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <title>SalesHub | Item Management </title>
  <!-- plugins:css -->
  <?php include('../includes/commonheader.php');?>


</head>
<body>
 <?php include('../includes/header.php');?>
 <?php include('../includes/leftsidebar.php');?>
           <!-- partial -->
 <div class="main-panel">        
 <div class="content-wrapper">
  <div class="container-fluid">
          <div class="page-header">
            <h3 class="page-title">
                New Item
            </h3>          
          </div>
         <div class="col-12 grid-margin">
         <div class="card">
         <div class="card-body">   
            
         
                 
    <form class="needs-validation" novalidate method="post" action="admin_item_add.php" enctype="multipart/form-data" onsubmit="return validateForm()"> 
                  
                    <div class="row">                     
                      <div class="col-md-6">
                        <div class="form-group row">
                          <label class="col-sm-3 col-form-label">Item Name <span style="color:red;font-size: 15px;font-weight:bold;">*</span></label>
                          <div class="col-sm-9">
                                <input type="text" class="form-control" id="itemname" name="itemname" placeholder="Item Name " >
                          </div>
                        </div>
                      </div>
                      <div class="col-md-6">
                        <div class="form-group row">
                          <label class="col-sm-3 col-form-label">Description</label>
                          <div class="col-sm-9">
                            <input type="text" class="form-control" name="des" id="des"   placeholder="Description "/>
                          </div>
                        </div>
                      </div>
                   
                    </div>
                    <div class="row">
                       <div class="col-md-6">
                        <div class="form-group row">
                          <label class="col-sm-3 col-form-label">SKU</label>
                          <div class="col-sm-9">
                            <input type="text" name="sku" id="sku" class="form-control" placeholder="SKU "/>
                          </div>
                        </div>
                      </div>
                      <div class="col-md-6">
                        <div class="form-group row">
                          <label class="col-sm-3 col-form-label">Manufact./Brand</label>
                          <div class="col-sm-9">
                            <input type="text" name="mb" id="mb" class="form-control" placeholder="Manufacture or Brand "/>
                          </div>
                        </div>
                      </div>
                     
                    </div>
                    <div class="row">
                      <div class="col-md-6">
                          <div class="form-group row">
                          <label class="col-sm-3 col-form-label">Item Type <span style="color:red;font-size: 15px;font-weight:bold;">*</span></label>
                          <div class="col-sm-9">
                          <select class="form-control select2" style="width: 100%;" name="itemtype" id="itemtype" required >
           <option value="0">~~~Select ~~~~</option>  
          <?php            
          $querydoc=mysqli_query($con,"select * from item_type  ")or die(mysqli_error());
          
          while($rowd=mysqli_fetch_array($querydoc)){
          ?>
          <option value="<?php echo $rowd['type_id'];?>"><?php echo $rowd['type_des'];?></option>        
          <?php }?>
          </select> 
          </div> 
          </div>   
          </div>  

          <div class="col-md-6">
                        <div class="form-group row">
                          <label class="col-sm-3 col-form-label">Category <span style="color:red;font-size: 15px;font-weight:bold;">*</span></label>
                          <div class="col-sm-9">
                             <select class="form-control select2" style="width: 100%;" name="catid" id="catid" required >
           <option value="0">~~~Select ~~~~</option>  
          <?php            
          $querydoc=mysqli_query($con,"select * from item_category  ")or die(mysqli_error());
          
          while($rowd=mysqli_fetch_array($querydoc)){
          ?>
          <option value="<?php echo $rowd['cat_id'];?>"><?php echo $rowd['cat_des'];?></option>        
          <?php }?>
          </select> 
                          </div>
                        </div>
                      </div>
                    </div> 
      

              <!-------------------------------->
                    <div class="row">
                       <div class="col-md-6">
                        <div class="form-group row">
                         <label class="col-sm-3 col-form-label">Sales Price <span style="color:red;font-size: 15px;font-weight:bold;">*</span></label>
                          <div class="col-sm-9">
                            <input type="number" name="sp" id="sp" class="form-control" placeholder="Sales Price "/>
                          </div>
                        </div>
                      </div>
                      <div class="col-md-6">
                        <div class="form-group row">
                          <label class="col-sm-3 col-form-label">Cost Price</label>
                          <div class="col-sm-9">
                            <input type="number" name="cp" id="cp" class="form-control" placeholder="Cost Price "/>
                          </div>
                        </div>
                      </div>
              <!--------------------->
 </div>

 <!-------------------------------->
                    <div class="row">
                       <div class="col-md-6">
                        <div class="form-group row">
                         <label class="col-sm-3 col-form-label">weight</label>
                          <div class="col-sm-9">
                            <input type="text" name="weight" id="weight" class="form-control" placeholder="Item Weight "/>
                          </div>
                        </div>
                      </div>
                      <div class="col-md-6">
                        <div class="form-group row">
                          <label class="col-sm-3 col-form-label">Dimention</label>
                          <div class="col-sm-9">
                            <input type="text" name="dimen" id="dimen" class="form-control" placeholder="Item Dimension "/>
                          </div>
                        </div>
                      </div>
              <!--------------------->
</div>
 <!-------------------------------->
                    <div class="row">
                       <div class="col-md-6">
                        <div class="form-group row">
                         <label class="col-sm-3 col-form-label">Tax Rate</label>
                          <div class="col-sm-9">
                            <input type="number" name="tr" id="tr" class="form-control" placeholder="Tax Rate "/>
                          </div>
                        </div>
                      </div>
                      <div class="col-md-6">
                        <div class="form-group row">
                          <label class="col-sm-3 col-form-label">Discount Rate</label>
                          <div class="col-sm-9">
                            <input type="number" name="dr" id="dr" class="form-control" placeholder="Discount Rate "/>
                          </div>
                        </div>
                      </div>
              <!--------------------->
</div>

<div class="row">
                      <div class="col-md-6">
                          <div class="form-group row">
                          <label class="col-sm-3 col-form-label">Supplier</label>
                          <div class="col-sm-9">
                          <select class="form-control select2" style="width: 100%;" name="sup" id="sup" required >
           <option value="0">~~~Select ~~~~</option>  
          <?php            
          $querydoc=mysqli_query($con,"select * from supplier_master  ")or die(mysqli_error());
          
          while($rowd=mysqli_fetch_array($querydoc)){
          ?>
          <option value="<?php echo $rowd['sup_id'];?>"><?php echo $rowd['sup_name'];?></option>        
          <?php }?>
          </select> 
          </div> 
          </div>   
          </div>  

 <!--------Sub Raw------------------------------------------------------------->

<!--------End of Sub Raw------------------------------------------------------->

          <div class="col-md-6">
                        <div class="form-group row">
                          <label class="col-sm-3 col-form-label">Unit <span style="color:red;font-size: 15px;font-weight:bold;">*</span></label>
                          <div class="col-sm-9">
                             <select class="form-control select2" style="width: 100%;" name="uni" id="uni" required >
           <option value="0">~~~Select ~~~~</option>  
          <?php            
          $querydoc=mysqli_query($con,"select * from unit_master  ")or die(mysqli_error());
          
          while($rowd=mysqli_fetch_array($querydoc)){
          ?>
          <option value="<?php echo $rowd['unit_id'];?>"><?php echo $rowd['unit_des'];?></option>        
          <?php }?>
          </select> 
                          </div>
                        </div>
                      </div>
             
 <!--------Sub Raw------------------------------------------------------------->
   
   </div>
   <!-------------------------------->
                    <div class="row">
                       <div class="col-md-6">
                        <div class="form-group row">
                          <div class="row">
                          <label class="col-sm-3 col-form-label" >  min_stock_level</label>
                          <div class="col-sm-3">
                            <input type="number" name="mins" id="mins" class="form-control" />
                          </div>

                            <label class="col-sm-3 col-form-label">  max_stock_level</label>
                          <div class="col-sm-3">
                            <input type="number" name="maxs" id="maxs" class="form-control" />
                          </div>

                        </div> <!---- <div class="row">------->
                        </div>
                      </div>
                      <div class="col-md-6">
                       
                         <div class="row">
                           <div class="form-group row">

                         <label class="col-sm-3 col-form-label" >&nbsp;  ROL</label>
                          <div class="col-sm-3">
                            <input type="number" name="rol" id="rol" class="form-control" />
                          </div>
                           <label class="col-sm-3 col-form-label"> &nbsp;&nbsp; QOH</label>
                          <div class="col-sm-3">
                            <input type="number" name="qoh" id="qoh" class="form-control" readonly />
                          </div>


                         </div> <!---- <div class="row">------->
                        </div>
                      </div>
              <!--------------------->
<!--------End of Sub Raw------------------------------------------------------->
</div>
<!-------------------------------->
                    <div class="row">
                       <div class="col-md-6">
                        <div class="form-group row">
                         <label class="col-sm-3 col-form-label">Cases</label>
                          <div class="col-sm-9">
                            <input type="number" name="cases" id="cases" class="form-control" />
                          </div>
                        </div>
                      </div>
                      <div class="col-md-6">
                        <div class="form-group row">
                          <label class="col-sm-3 col-form-label">Bar Code</label>
                          <div class="col-sm-9">
                            <input type="number" name="bcode" id="bcode" class="form-control" />
                          </div>
                        </div>
                      </div>
              <!--------------------->




                     
                    </div>


            

                 
                     <button type="submit" class="btn btn-primary">Save</button>
                    <button class="btn btn-light">Cancel</button>
                  </form>
                </div>
              </div>
            </div>


                    <button type="button" onclick="document.location='home.php'" class="btn btn-warning "><i class="fas fa-arrow-left"></i> Go Back
                    
                 

   </div>

        </div>  <!----- <div class="content-wrapper">------>
          
          <?php include('../includes/footer.php');?>
  </div>

 </div><!-----End of main panel--~~~~~~~~~~~~~~~~~~~~~~~--------------->
 </div><!-----Dont Delete this DIV--~~~~~~~~~~~~~~~~~~~~~~~--------------->
  <!-- container-scroller -->

<?php include('../includes/commonjs.php');?>
 
</body>


</html>

<script>
    $( document ).ready(function() {
         // alert("Please Select Order Type");

    });

function validateForm() { 

    //````````route````````````````````````````````````
    if($('#bname').val().trim().length == 0) {
           alert("Please enter the route you visited !!!");               
            return false;
    } ////``````````````````````````````````````````

    



 } ///validateForm() { 

</script>

 <!-- End custom js for this page-->
  <script>
  $(function () {
    //Initialize Select2 Elements
    $('.select2').select2()

    //Initialize Select2 Elements
    $('.select2bs4').select2({
      theme: 'bootstrap4'
    })
  })

</script>



