<?php include("parent/callMe.php"); ?>
<?php  include("sessioncheck.php");

$pageName = basename($_SERVER['PHP_SELF']);

 $m->where("page_name", $pageName);
 $pageNameAccess=$m->get("eduportal_modules_pages_detail");


$m->where("user_id", $_SESSION['user_id']);
$m->where ("branch_id", $_SESSION['branch']);
$m->where("page_id", $pageNameAccess[0]['page_id']);
$access = $m->get("users_privilege_detail");




 ?>
<!DOCTYPE html>
<html lang="en">
  <head>
    
    <title>Add Book | EduPortal</title>
    <?php include('RootMe/css_links.php');?>
  
<script type="text/javascript">

function getSubCat(id){
  //alert(id);

    if (window.XMLHttpRequest) {
      // code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
    } else { // code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange=function() {
      if (xmlhttp.readyState==4 && xmlhttp.status==200) {

        document.getElementById("subcatgory").innerHTML=xmlhttp.responseText;
       //alert(xmlhttp.responseText);

      }

    }
    xmlhttp.open("GET","get_exp_subcategory.php?id="+id,true);
    xmlhttp.send();
  }
</script> 
  </head>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<!-- <script>
$(document).ready(function(){
  
    $("#div1").fadeOut();
    $("#div2").fadeOut("slow");
    $("#div3").fadeOut(3000);
 
});
</script> -->
  <style>
#snackbar {
  visibility: hidden;
  min-width: 250px;
  margin-left: -125px;
  background-color: #1E90FF;
  color: #fff;
  text-align: right;
  border-radius: 2px;
  padding: 16px;
  position: fixed;
  z-index: 1;
  left: 80%;
  bottom: 30px;
  font-size: 17px;
}

#snackbar.show {
  visibility: visible;
  -webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s;
  animation: fadein 0.5s, fadeout 0.5s 2.5s;
}

@-webkit-keyframes fadein {
  from {bottom: 0; opacity: 0;} 
  to {bottom: 30px; opacity: 1;}
}

@keyframes fadein {
  from {bottom: 0; opacity: 0;}
  to {bottom: 30px; opacity: 1;}
}

@-webkit-keyframes fadeout {
  from {bottom: 30px; opacity: 1;} 
  to {bottom: 0; opacity: 0;}
}

@keyframes fadeout {
  from {bottom: 30px; opacity: 1;}
  to {bottom: 0; opacity: 0;}
}
</style>
  <body class="nav-md">
    <div class="container body">
      <div class="main_container">
        <div class="col-md-3 left_col">
     
            <?php include('RootMe/sidebar.php');?>

              <?php include('RootMe/header.php');?>
     
        <!-- page content -->
          <div class="right_col" role="main">

            <a href="<?php echo $_SESSION['dashboard'];?>" style="margin-left: 33px;">Dashboard </a> &nbsp; <i style="" class="fa fa-angle-double-right"></i>  &nbsp;

          <a href="list_books.php">Book List </a> &nbsp; <i style="" class="fa fa-angle-double-right"></i>  &nbsp;  

          Add New Book
          
          <div class="row" style="background-color: white;">
           
  <section class="add_sub_agent" id="table_sub_agent">
  <div class="container">

 <div class="" style="margin-top:10px;">
   
      

                                    <!-- page content -->
        
  <div class="">
    
      <h3 style="margin-left: 15px;">Add New Book</h3>
            <div class="row">
          
              <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
            
                  <div class="x_content">
          
     
                    <form action="<?php echo DOMAIN.AgentDirectory;?>parent/InsertMe.php" method="post" enctype="multipart/form-data" class="form-horizontal form-label-left" >
  <?php

  $date;
  
   if(!isset($_GET['book'])){ $date=date("Y-m-d"); ?>
        <input type="hidden" name="action" value="add_book" />


  <?php } else {


          $query="select * from eduportal_library_details where library_id =".$_GET['book'];
          $librarydata = $m->query($query);

          $date=$librarydata[0]['post_date'];
         
?>
              <input type="hidden" name="action" value="update_book" />
              <input type="hidden" name="library_id"  value="<?php echo $_GET['book'];?>">

  <?php } ?>        
          
        <div class="item form-group">
                        
                        <label class="control-label col-md-2 col-sm-2 col-xs-12" for="email">

                         Book Title <span class="required">*</span>
                        </label>
                        
                        <div class="col-md-4 col-sm-4 col-xs-12">
                          <input class="form-control col-md-7 col-xs-12" name="book_title" placeholder="eg Principle Of Management " value="<?php echo $librarydata[0]['book_title']; ?>">
                        </div>

                          
                         <label class="control-label col-md-2 col-sm-2 col-xs-12" for="email">

                        	Book Number 
                        </label>
                        
                        <div class="col-md-4 col-sm-4 col-xs-12">
                          <input class="form-control col-md-7 col-xs-12"  name="book_number" placeholder="eg 101 " value="<?php echo $librarydata[0]['book_number']; ?>">
                        </div>

                      </div>              
                   

           <div class="item form-group">
                        
                        <label class="control-label col-md-2 col-sm-2 col-xs-12" for="email">

                        	ISBN Number
                        </label>
                        <div class="col-md-4 col-sm-4 col-xs-12">
                         
                           <input class="form-control col-md-7 col-xs-12"  name="ISBN_number" placeholder="eg 1-200145 " value="<?php echo $librarydata[0]['ISBN_number']; ?>">
                        </div>
                  
	          
                        <label class="control-label col-md-2 col-sm-2 col-xs-12" for="email"> Publisher <span class="required">*</span>
                        </label>
                        <div class="col-md-4 col-sm-4 col-xs-12">
                          <input type="text" placeholder="e.g Ilmi Kitab" id="owner_email" name="publisher" class="form-control col-md-7 col-xs-12" value="<?php echo $librarydata[0]['publisher']; ?>">
                      
                    </div>
            
                      </div>



                      <div class="item form-group">
                        <label class="control-label col-md-2 col-sm-2 col-xs-12" for="email">Author <span class="required">*</span> 
                        </label>
                        
                        <div class="col-md-4 col-sm-4 col-xs-12">
                          <input class="form-control col-md-7 col-xs-12" name="author" placeholder="eg Umar Ali " value="<?php echo $librarydata[0]['author']; ?>">
                        </div>



                        <label class="control-label col-md-2 col-sm-2 col-xs-12" for="email">Subject  <span class="required">*</span>
                        </label>
                        <div class="col-md-4 col-sm-4 col-xs-12">
                          <input class="form-control col-md-7 col-xs-12" name="subject" placeholder="eg Business" autocomplete="off" type="text" value="<?php echo $librarydata[0]['subject']; ?>">
                        </div>
                      </div>


                       <div class="item form-group">
                        <label class="control-label col-md-2 col-sm-2 col-xs-12" for="email">Rack Number <span class="required">*</span> 
                        </label>
                        
                        <div class="col-md-4 col-sm-4 col-xs-12">
                          <input class="form-control col-md-7 col-xs-12" name="rack_number" placeholder="eg 6 " value="<?php echo $librarydata[0]['rack_number']; ?>">
                        </div>



                        <label class="control-label col-md-2 col-sm-2 col-xs-12" for="email">Qty  <span class="required">*</span>
                        </label>
                        <div class="col-md-4 col-sm-4 col-xs-12">
                          <input class="form-control col-md-7 col-xs-12" name="qty" placeholder="eg 12" autocomplete="off" type="text" value="<?php echo $librarydata[0]['qty']; ?>">
                        </div>
                      </div>

                       <div class="item form-group">
                        <label class="control-label col-md-2 col-sm-2 col-xs-12" for="email">Book Price <span class="required">*</span> 
                        </label>
                        
                        <div class="col-md-4 col-sm-4 col-xs-12">
                          <input class="form-control col-md-7 col-xs-12" name="book_price" placeholder="eg 650 " value="<?php echo $librarydata[0]['book_price']; ?>">
                        </div>



                        <label class="control-label col-md-2 col-sm-2 col-xs-12" for="email">Post Date  
                        </label>
                        <div class="col-md-4 col-sm-4 col-xs-12">
                          <input class="form-control col-md-7 col-xs-12" name="post_date"  autocomplete="off" type="date" value="<?php echo $date; ?>">
                        </div>
                      </div>

                      <label class="control-label col-md-2 col-sm-2 col-xs-12" for="email">Description  
                        </label>
                        <div class="col-md-10 col-sm-10 col-xs-12">
                          <textarea class="form-control col-md-12 col-xs-12" placeholder="Write Here" name="description"></textarea>
                          
                        </div>


                        <br><br><br><br><br>


                     

                      <div class="form-group">
                        <div class="col-md-6 col-md-offset-3">
                          
                          <button id="send" type="submit" class="btn btn-primary" >Save Record</button>
                          <button type="submit" class="btn btn-primary" >Cancel</button>

                        </div>
                      </div>

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

        <!-- /page content -->



  </div>
  <div class="clearfix"></div>
</section>           


  

    
  <?php include('RootMe/js_linksscript.php');?>
  </body>
</html>
<script>
function toastFunction() {
  var x = document.getElementById("snackbar");
  x.className = "show";
  setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000);
}
</script>