JezK
Edit File: reportsManagement.php
<?php include("header.php"); $fromdate = isset($_REQUEST['fromdate'])?$_REQUEST['fromdate']:''; $todate = isset($_REQUEST['todate'])?$_REQUEST['todate']:''; $reports = $videocon->getReports($fromdate,$todate); // print_r($reports);exit; if((isset($_REQUEST['did']) && $_REQUEST['did']!='') || (isset($_POST['action']) && $_POST['action']='deleteReport')) { if(!isset($_POST['action'])) { $rid=$videocon->encrypt_decrypt('decrypt',$_REQUEST['did']); } else { $rid=implode(',',$_POST['delReports']); } $deleteReport=$videocon->deleteReports($rid); if($deleteReport>0) { echo "<script>alert('Deleted Successfully');window.location='reportsManagement.php';</script>"; }else{ echo "<script>alert('Deletion Failed');window.location='reportsManagement.php';</script>"; } } ?> <style> div.dataTables_wrapper div.dataTables_filter { position: absolute; top: 132px; } .more>span{ white-space: nowrap; width: 92px; overflow: hidden; text-overflow: ellipsis; } </style> <section class="section-padding"> <div class="container m-3 bg-white"> <div class=""> <form action ='' method='GET' id="reports"> <div class="calender-Right pt-4 mb-2"> <label class="fieldName mt-2 mr-2">Select Date Range</label> <div id="reportrange3" class="col-xl-5 col-md-6 col-lg-8 formField-control" style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc;"> <i class="fa fa-calendar float-right pt-1"></i> <span></span> <input type="hidden" class="hidden fromdate" name="fromdate" value=""> <input type="hidden" class="hidden todate" name="todate" value=""> </div> </div> </form> <!--ENd calender --> <div class="row"> <div class="col-xl-6 mt-1"> <a class="selectAll buttonStyle">Select All</a> <a class="unSelectAll buttonStyle">Unselect All</a> <a class="deleteAll buttonStyle" onclick="return deleteall('reportDelete');">Delete All</a> </div> <div class="col-xl-6 d-flex justify-content-end"> <!-- <a href="#" class="btn btn-primary">Export Excel</a> --> </div> </div> <div class="table-responsive"> <form name="reportDelete" id="reportDelete" action="" method="post"> <table id="dataTable" class="table table-striped table-borderless " style="width:100%"> <thead class="tableBackground"> <tr> <th></th> <th>S.No</th> <th>DATE</th> <th>REPORTED BY</th> <th>SUBJECT</th> <th>MESSAGE</th> <th>ACTION</th> </tr> </thead> <tbody> <?php $i=0; foreach($reports as $k=>$v){ $getava=$videocon->getBusiness('id',$v['user_id']); // print_r($getava);exit; $bname = (isset($getava['0']['professional_name']) && $getava['0']['professional_name']!='')?$getava['0']['professional_name']:$getava['0']['owner']; $i++; ?> <tr> <td> <label class="container1"> <input type="checkbox" name="delReports[]" class="checkmark" value="<?php echo $v['id']; ?>"> <span class="checkmark1"></span> </label> </td> <td><?php echo $i?>.</td> <td><?php echo $v['date'];?></td> <td><?php echo $bname;?></td> <td><?php echo $v['subject'];?></td> <td class="more"><span><?php echo $v['message'];?></span></td> <td> <span><a href="reportsView.php?rid=<?php echo $videocon->encrypt_decrypt('encrypt',$v['id']);?>" class="viewStyles">View</a></span> <span><a href="reportsReply.php?rid=<?php echo $videocon->encrypt_decrypt('encrypt',$v['id']);?>" class="viewStyles">Reply</a></span> <span><a onclick="return confirm('Are you sure you want to delete');" href="reportsManagement.php?did=<?php echo $videocon->encrypt_decrypt('encrypt',$v['id']);?>" class="viewStyles">Delete</a></span> </td> </tr> <?php }?> </tbody> </table> <input type="hidden" name="action" value="deleteReport"> </form> </div> </div> </div> </section> <div class="container"> <!-- The Modal --> <div class="modal" id="myModal"> <div class="modal-dialog"> <div class="modal-content"> <!-- Modal Header --> <div class="modal-header border-0"> <button type="button" class="close px-2 pt-2 pb-0" data-dismiss="modal">×</button> </div> <!-- Modal body --> <div class="modal-body mx-4"> <h5 class="modal-title style-login mb-3">Block Business</h5> <!-- <p class="modal-font"> --> <form action="" method="POST"> <div class="mt-3 mb-2 d-flex"> <h6 class="text-yellow mr-auto mb-0"><small class="font-600">Enable the Business</small></h6> <div class="radio-buttons-container d-flex"> <div class="custom-control custom-radio d-flex pr-3"> <input type="radio" class="custom-control-input" id="influencer" value="1" name="userType"> <label for="influencer" class="custom-control-label cutomRadio d-flex"> <span class="align-self-center pl-2">Automatic</span> </label> </div> <div class="custom-control custom-radio d-flex"> <input type="radio" class="custom-control-input" id="fan" value="2" name="userType"> <label for="fan" class="custom-control-label cutomRadio d-flex"> <span class="align-self-center pl-2">Manually</span> </label> </div> </div> </div> <div class="pt-2 mb-2"> <label class="fieldName mt-2 mr-2">Select Date Range</label> <div id="singleDate" class="formField-control" style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc;"> <i class="fa fa-calendar float-right pt-1"></i> <span></span> </div> </div> <div class="d-flex justify-content-end"> <button class="btn cancelBtn">Cancel</button> <button class="btn btn-primary">Block</button> </div> </form> <!--end password Form --> </div> </div> </div> </div> <?php include("footer.php");?> <script> $(function() { var start = moment().subtract(1, 'days'); var end = moment(); function cb(start, end) { $('.fromdate').val(start.format('YYYY-MM-DD')); $('.todate').val(end.format('YYYY-MM-DD')); $('#reportrange3 span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY')); } $('#reportrange3').daterangepicker({ startDate: start, endDate: end, ranges: { 'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')] } }, cb); cb(start, end); }); ///// date submission //////// $('#reportrange3').on('apply.daterangepicker', function(ev, picker) { // alert(picker.startDate.format('DD-MM-YYYY')+' To '+picker.endDate.format('DD-MM-YYYY')); var fromdate = picker.startDate.format('YYYY-MM-DD'); var todate =picker.endDate.format('YYYY-MM-DD'); $('#reports').submit(); }); ////// reload //////// $(document).ready(function() { var url = window.location.href; function getParameterByName( name,href ) { name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&]"+name+"=([^&#]*)"; var regex = new RegExp( regexS ); var results = regex.exec( href ); /* if( results == null ) return ""; else */ return decodeURIComponent(results[1].replace(/\+/g, " ")); } var from = getParameterByName("fromdate",url); var to = getParameterByName("todate",url); var x1 = moment(from).format('DD MMMM, YYYY '); var y1 = moment(to).format('DD MMMM, YYYY'); // alert(x1); $('#reportrange3 span').html(x1 + ' - ' + y1); }); function deleteall(typeofdel) { if(confirm('Are you sure want to delete')) { var testval = []; $('.checkmark:checked').each(function() { testval.push($(this).val()); }); if(testval.length<=0) { alert('Please select atleast one record to delete'); return false; }else{ document.getElementById(typeofdel).submit(); } }else{ return false; } } </script>