<!--
Author: W3layouts
Author URL: http://w3layouts.com
License: Creative Commons Attribution 3.0 Unported
License URL: http://creativecommons.org/licenses/by/3.0/
-->
<!DOCTYPE HTML>
<html>
<head>
<title>nehrdelivery.com</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
 <!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel='stylesheet' type='text/css' />
<!-- Custom CSS -->
<link href="css/style.css" rel='stylesheet' type='text/css' />
<link href="css/font-awesome.css" rel="stylesheet"> 
<!-- jQuery -->
<script src="js/jquery.min.js"></script>
<!----webfonts--->
<link href='http://fonts.googleapis.com/css?family=Roboto:400,100,300,500,700,900' rel='stylesheet' type='text/css'>
<!---//webfonts--->  
<script>
    $(document).ready(function(){
        $("#onbording").hide();    
      $("#new_client").click(function(){
        $("#onbording").show();
      });
      $("#new_client_close").click(function(){
        $("#onbording").hide();
      });
      $("#btn_reset").click(function(){
        setOnBoardResponse("","");
      });
      $("#btn_submit").click(function(){
        setOnBoardResponse("","");
      });
      
      
      $("#onboard_form").submit(function(event) {
          
            /* stop form from submitting normally */
              event.preventDefault();
            
              /* get the action attribute from the <form action=""> element */
              var formValues = $(this).serialize();
              var url = 'common/logic_customer_on_board.php';
             $.post("common/logic_customer_on_board.php", formValues, function(data){
                if(data == 'Success'){
                    $('#onboard_form').trigger("reset");
                    setOnBoardResponse("Onboarding success!","");
                    location.reload();
                }else{
                    console.log(data);
                    setOnBoardResponse("","Onboarding failed!");
                }  
            });
    });
    });
    
    /*function loadWithPinCode(){
        $.getJSON('http://www.postalpincode.in/api/pincode/676123', function(data) {
            console.log(data);
        });
    }*/
    
    function setOnBoardResponse(success, failure){
        $("#onboard_result_success").text(success);
        $("#onboard_result_fail").text(failure);
    }
</script>
<style>
.edit {
  background: #bbf0bbab; 
  border: none;
  color: #00000;
  padding: 5px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 10px;
  margin: 4px 2px;
  cursor: pointer;
  border-radius: 5px;
}
.delete {
  background-color: #f2dcdcab; 
  border: none;
  color: #00000;
  padding: 5px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 10px;
  margin: 4px 2px;
  cursor: pointer;
  border-radius: 5px;
}
</style>
</head>
<body>
    
    <?php
        /*session_start();
        echo $_SESSION["isAuthenticated"];
        if($_SESSION["isAuthenticated"] == "true"){
            header("Location: index.php");
        }*/
    ?>
    <div id="wrapper">
     <!-- Navigation -->
        <?php include 'common/nav.php';?>
        <?php include 'common/connection.php';?>
        <div id="page-wrapper">
        <div class="graphs">
	   <div class="md">
		 <h3>Shop Management</h3>
		<div class="form-group">
		  <div class="row">
			<div class="col-md-12">
				<div class="col_3">
					<div class="col-md-3 widget widget1">
						<div class="r3_counter_box" id="new_client">
							<i class="pull-left fa fa-user icon-rounded"></i>
							<div class="stats">
							  <h5><strong>New Shop</strong></h5>
							</div>
						</div>
					</div>
					<!--<div class="col-md-3 widget widget1">
						<div class="r3_counter_box" id="new_client_category">
							<i class="pull-left fa fa-file icon-rounded"></i>
							<div class="stats">
							  <h5><strong>New Category</strong></h5>
							</div>
						</div>
					</div>-->
					<div class="clearfix"> </div>
			  </div>
			</div>
			
			<div id="onbording">
			<div class="col-md-12">
			    <div class="well1 white">
			        <button id="new_client_close" style="float: right;">X</button>
			        <center><span id="onboard_result_success" style="color: green;"></span></center>
			        <center><span id="onboard_result_fail" style="color: red;"></span></center>
			        <h3><u>Shop on bording</u></h3>
			        <div class="row">
                <form id="onboard_form" class="form-floating" method="post">
                    <input type="hidden" name="key" value="shop_on_board"/>
                    <div class="col-md-6">
                  <fieldset>
                    <div class="form-group">
                      <label class="control-label">Owner Name</label>
                      <input type="text" name="owner_name" id="owner_name" class="form-control1" required="required">
                    </div>
                    <!--<div class="form-group">
                      <label class="control-label">Email</label>
                      <input type="email" class="form-control1 ng-invalid ng-valid-email ng-invalid-required ng-touched" ng-model="model.email" required="">
                    </div>-->
                    <div class="form-group">
                      <label class="control-label">Mobile</label>
                      <input type="text" name="mobile" id="mobile" class="form-control1" minlength="10" maxlength="10" required="required">
                    </div>
                    
                            <div class="form-group">
                              <label class="control-label">Shop Name</label>
                              <input type="text" id="shop_name" name="shop_name" class="form-control1" required="required">
                            </div>
                    <div class="form-group">
                      <label class="control-label">Place</label>
                      <input type="text" id="place" name="place" class="form-control1" required="required">
                    </div>
                    <div class="form-group">
                      <label class="control-label">pincode</label>
                      <input type="text" id="pincode" name="pincode" minlength="6" maxlength="6" class="form-control1" required="required">
                    </div>
                  </fieldset>
                  </div>
                  
                    <div class="col-md-6">
                        <fieldset>
                            <div class="form-group filled">
                              <label class="control-label">Category</label>
                              <select id="category" name="category" class="form-control1" required="required">
                                <option value="Groceries">Groceries</option>
                                <option value="Fruits & Vegitables">Fruits & Vegitables</option>
                                <option value="Meat & Fish">Meat & Fish</option>
                                <option value="Banking">Banking</option>
                                <option value="Electronics">Electronics</option>
                                <option value="Electrical">Electrical</option>
                                <option value="Toys">Toys</option>
                                <option value="Garments">Garments</option>
                                <option value="Home Appliances">Home Appliances</option>
                                <option value="Leather & Laguage">Leather & Laguage</option>
                                <option value="Jewellers">Jewellers</option>
                                <option value="Furniture">Furniture</option>
                                <option value="Bakery">Bakery</option>
                                <option value="Educations">Educations</option>
                                <option value="Insurance">Insurance</option>
                                <option value="Used Cars">Used Cars</option>
                                <option value="Used Products">Used Products</option>
                                <option value="Loans">Loans</option>
                                <option value=">On Demands">On Demands</option>
                                <option value="Tickets">Tickets</option>
                                <option value="Bills">Bills</option>
                                <option value="E Governs">E Governs</option>
                                <option value="Farm & Farmers">Farm & Farmers</option>
                                <option value="WholeSale">WholeSale</option>
                                <option value="Event Management">Event Management</option>
                                <option value="Real Estate">Real Estate</option>
                              </select>
                            </div>
                            <div class="form-group">
                              <label class="control-label">Address Line 1</label>
                              <input type="text" name="address_line1" class="form-control1" required="required">
                            </div>
                            <div class="form-group">
                              <label class="control-label">Landmark</label>
                              <input type="text" name="landmark" class="form-control1" required="required">
                            </div>
                            <div class="form-group">
                              <label class="control-label">District</label>
                              <input type="text" name="district" class="form-control1" required="required">
                            </div>
                            <div class="form-group">
                              <label class="control-label">State</label>
                              <input type="text" name="state" class="form-control1">
                            </div>
                    <div class="form-group" style="float: right;">
                      <button type="reset" id="btn_reset" class="btn btn-default">Reset</button>
                      <button type="submit" id="btn_submit" class="btn btn-primary">Submit</button>
                    </div>
                        </fieldset>
                    </div>
                </form>
                </div>
              </div>
			</div>
			</div>
			</div>
			</div>
			
			<div class="clearfix"> </div>
			<div class="row">
			<div class="col-md-12">
				<div class="panel " data-widget="{&quot;draggable&quot;: &quot;false&quot;}" data-widget-static="">
					<div class="panel-heading">
						<h2>Registered Shops</h2>
						<div class="panel-ctrls" data-actions-container="" data-action-collapse="{&quot;target&quot;: &quot;.panel-body&quot;}"><span class="button-icon has-bg"><i class="ti ti-angle-down"></i></span></div>
					</div>
					<?php
					    $servername = "localhost";
                        $username = "finstech_sales";
                        $password = "SalesApp@123";
                        $dbname = "finstech_salesapp";
                        
                        $arr = [];
                        try {
                            $pdo = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
                            $rows = $pdo->query("SELECT * FROM master_shop");
                            //$rows = $stmt->execute();
                            $rows->setFetchMode(PDO::FETCH_ASSOC);
                            /*while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
                              $arr[] = $row;
                            }*/
                        }catch(PDOException $e) {
                            echo $sql . "<br>" . $e->getMessage();
                        }
                        $stmt = null;
                        $pdo = null;
					?>
					<div class="panel-body no-padding" style="display: block;">
						<table class="table table-striped">
							<thead>
								<tr >
									<th>#</th>
									<th>Shop Name</th>
									<th>Category</th>
									<th>Owner</th>
									<th>Mobile</th>
									<th>Pincode</th>
									<th>Address</th>
								</tr>
							</thead>
							<tbody>
							    <?php
							        $count = 1;
                                    while ($row = $rows->fetch()):
                                        $address = $row['address_line1'].",\r\n".$row['address_line2'].",\r\n".$row['address_line3'].",\r\n".$row['state'].",\r\n".$row['pincode']
								?><tr>
								    <td><?php echo $count ?></td>
									<td><?php echo htmlspecialchars($row['shop_name']) ?></td>
									<td><?php echo htmlspecialchars($row['category']) ?></td>
									<td><?php echo htmlspecialchars($row['owner_name']) ?></td>
									<td><?php echo htmlspecialchars($row['mobile']) ?></td>
									<td><?php echo htmlspecialchars($row['pincode']) ?></td>
									<td><?php echo htmlspecialchars($address) ?></td>
									<td><form action="shop_edit.php" method="post"><input type="hidden" name="sid" value="<?php echo htmlspecialchars($row['shop_id']) ?>"><input class="edit" type="submit" value="edit"></form></td>
									<td><form action="shop_delete.php" method="post"><input type="hidden" name="sid" value="<?php echo htmlspecialchars($row['shop_id']) ?>"><input class="delete" type="submit" value="delete"></form></td>
								</tr>
								<?php 
								    $count = $count + 1; 
								    endwhile; 
								?>
							</tbody>
						</table>
					</div>
				</div>
			</div>
			</div>
			<div class="clearfix"> </div>
		   </div>
		</div>					
       </div>
      </div>
      <!-- /#page-wrapper -->
   </div>
    <!-- /#wrapper -->
    <!-- Nav CSS -->
<link href="css/custom.css" rel="stylesheet">
<!-- Metis Menu Plugin JavaScript -->
<script src="js/metisMenu.min.js"></script>
<script src="js/custom.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.min.js"></script>

</body>
</html>
