/
var
/
www
/
html
/
stengineers
/
admin
/
Upload FileeE
HOME
<?php header('Access-Control-Allow-Origin: *'); require_once('dbconnection.php'); error_reporting(0); $lmenu_active = "active"; include 'header.php'; $start_date = $_GET['sdate']; $end_date = $_GET['edate']; $sdate = date('Y-m-01'); $edate = date('Y-m-t'); if($start_date!="" || $end_date!="") { $pref = " created_at between '$start_date' and '$end_date'"; $prefs = " A.created_at between '$start_date' and '$end_date'"; $sdispdate = $start_date; $edispdate = $end_date; } else { $pref = " created_at between '$sdate' and '$edate'"; $prefs = " A.created_at between '$sdate' and '$edate'"; $sdispdate = $sdate; $edispdate = $edate; } ?> <!-- Begin Page Content --> <div class="container-fluid"> <!-- Page Heading --> <h1 class="h3 mb-2 text-gray-800">Enquiry List</h1> <div class="card mb-4"> <div class="card-body" style="text-align: center;"> <h4>Leads Between</h4> <span style=" padding: 10px;"><?php echo date('d F Y', strtotime($sdispdate)); ?> - <?php echo date('d F Y', strtotime($edispdate)); ?></span> </div> <div class="card-body" style="text-align: center;"> Start date : <input type="date" id="sdate" name="sdate" value="<?php echo $sdispdate; ?>"> End date : <input type="date" id="edate" name="edate" value="<?php echo $edispdate; ?>"> <input type="submit" value="Submit" class="btn btn-danger" onclick='submitData()'> </div> <div class="card-body" style="text-align: right;"> <span class="btn btn-secondary" style="border:1px solid #D4D4D4; padding: 10px;"><a style="text-decoration: none; color: #fff;" href="download-leads.php?sdate=<?php echo $sdispdate; ?>&edate=<?php echo $edispdate; ?>" target="_blank">Download Report <i class="fa fa-download" style="font-size:12px; color:#fff; margin-left: 10px;" aria-hidden="true"></i></a></span> </div> </div> <!-- DataTales Example --> <div class="card shadow mb-4"> <div class="card-header py-3"></div> <div class="card-body"> <div class="table-responsive"> <table class="table table-bordered" id="dataTable" width="100%" cellspacing="0"> <thead> <tr> <th>Name</th> <th>Details</th> <th>Company</th> <th>Product Name</th> <th>Action</th> <th>Source</th> </tr> </thead> <tbody id="table_id"> <?php $s = "SELECT * FROM contact WHERE $pref ORDER BY created_at DESC"; $res = mysqli_query($con, $s); $num = mysqli_num_rows($res); if ($num == 0) { echo '<tr> <td colspan="6">No Data Found</td> </tr>'; } else { while($row = mysqli_fetch_array($res)) { $id = $row['id']; $name = $row['name']; $email = $row['email']; $mobile = $row['phone']; $company = $row['company']; $country = $row['country']; $pincode = $row['pincode']; $product = $row['product_name']; $message = $row['message']; $page = $row['source']; $created_at = date('d-m-Y', strtotime($row['created_at'])); echo "<tr> <td>$name</td> <td> Email - $email<br> Phone - $mobile<br> Country - $country<br> Pincode - $pincode<br> </td> <td>$company</td> <td>$product</td> <td style='white-space: nowrap;'>$created_at <a class='btn btn-danger btn-circle btn-sm' onclick='deleteData($id)'> <i class='fas fa-trash'></i> </a> </td> <td>$page</td> </tr>"; } } ?> </tbody> </table> </div> </div> </div> </div> <!-- /.container-fluid --> <script type="text/javascript"> function refreshData(){ $("#table_id").load(window.location + " #table_id"); } function deleteData(id){ var id = id; var getData; if(confirm('Are you sure you want to delete?')) { $.ajax({ url: 'api/leads.php', type: 'POST', data:{id:id,action:"delete", referer:"ezioaws"}, success: function (response) { var data = JSON.parse(response); console.log(data); if (data.status == 'success') { alert("Deleted Successfully") window.location.href="leads.php"; } else { alert("Failed, Please try again later") } } }); } } function submitData() { var sdate = $('#sdate').val(); var edate = $('#edate').val(); if(sdate === "") { alert("Select Start Date"); } else if(edate === "") { alert("Select End Date"); } else { window.location.href = "leads.php?sdate=" + sdate + "&edate=" + edate; } } </script> <?php include 'footer.php'?>