JezK
Edit File: businessManagement.php
<?php include("header.php"); // $businessdet=$videocon->getBusiness(); $fromdate = isset($_REQUEST['fromdate']) ? $_REQUEST['fromdate'] : ''; $todate = isset($_REQUEST['todate']) ? $_REQUEST['todate'] : ''; $businessdet = $videocon->getOnlyBusiness($fromdate, $todate); // echo "<pre>"; // print_r($businessdet); // echo count($count);exit; if ((isset($_REQUEST['did']) && $_REQUEST['did'] != '') || (isset($_POST['action']) && $_POST['action'] = 'deleteBusinessUser')) { if (!isset($_POST['action'])) { $bid = $videocon->encrypt_decrypt('decrypt', $_REQUEST['did']); } else { $bid = implode(',', $_POST['delbusiness']); // echo $bid;exit; } $deleteBusness = $videocon->deleteBusiness($bid); if ($deleteBusness) { echo "<script>alert('Deleted Successfully');window.location='businessManagement.php';</script>"; } else { echo "<script>alert('Deletion Failed');window.location='businessManagement.php';</script>"; } } ?> <style> div.dataTables_wrapper div.dataTables_filter { position: absolute; top: 132px; } </style> <section class="section-padding"> <div class="container m-3 bg-white"> <div class=""> <form action='' method='GET' id="business"> <div class="calender-Right pt-4 mb-2"> <label class="fieldName mt-2 mr-2">Select Date Range</label> <div id="reportrange02" 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=" float-right "><img src="img/calenderdark.png"></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"> <a class="selectAll buttonStyle">Select All</a> <a class="unSelectAll buttonStyle">Unselect All</a> <a class="deleteAll buttonStyle" onclick="return deleteall('businessUserDelete');">Delete All</a> </div> <div class="col-xl-6 d-flex justify-content-end"> <a href="addBusiness.php" class="btn btn-primary py-0">Add Business</a> </div> </div> <div class="table-responsive"> <form name="businessUserDelete" id="businessUserDelete" 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>BUSINESS NAME</th> <th>USERNAME</th> <th>MOBILE</th> <th>Specialization</th> <th>OWNER NAME</th> <th>IS PROFESSIONAL</th> <th>NO OF PROFESSIONALS</th> <th>EMAIL</th> <th>CATEGORY</th> <th>LOCATION</th> <th>DATE</th> <th>ACTION</th> </tr> </thead> <tbody> <?php $i = 0; foreach ($businessdet as $k => $v) { $category = $videocon->categories($v['cat_id']); $categoryName = $category[0]['name']; $i++; ?> <tr> <td> <label class="container1"> <input type="checkbox" name="delbusiness[]" class="checkmark" value="<?php echo $v['id']; ?>"> <span class="checkmark1"></span> </label> </td> <td><?php echo $i; ?></td> <td><?php echo $v['business_name']; ?></td> <td><?php echo $v['username']; ?></td> <td><?php echo $v['mobile']; ?></td> <td><?php echo $v['specialization']; ?></td> <td><?php echo $v['owner']; ?></td> <td><?php echo $v['is_professional']==1?"Yes":"No"; ?></td> <?php if (isset($v['pcount']) && $v['pcount'] == 0) { ?> <td>No professionals</td> <?php } else { ?> <td><a href="professionManagement.php?bid=<?php echo $videocon->encrypt_decrypt('encrypt', $v['id']); ?>" class="viewStyles"><?php echo $v['pcount']; ?></a></td> <?php } ?> <td><?php echo $v['email']; ?></td> <td><?php echo $categoryName; ?></td> <td><?php echo $v['location']; ?></td> <td><?php echo date('m-d-Y', strtotime($v['date'])); ?></td> <td> <span><a href="business.php?id=<?php echo $videocon->encrypt_decrypt('encrypt', $v['id']); ?>" class="viewStyles">View</a></span> <span><a href="editBusiness.php?id=<?php echo $videocon->encrypt_decrypt('encrypt', $v['id']); ?>" class="viewStyles">Edit</a></span> <span><a href="javascript:void(0);" onclick="return blockorunblock('<?php echo $v['status']; ?>','<?php echo $videocon->encrypt_decrypt('encrypt', $v['id']); ?>','<?php echo $i; ?>')" class="viewStyles" id="blockid<?php echo $i; ?>"><?php echo $v['status'] == 1 ? "Block" : 'Unblock'; ?></a></span> <span><a onclick="return confirm('Are you sure you want to delete?');" href="businessManagement.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="deleteBusinessUser"> </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')); $('#reportrange02 span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY')); } $('#reportrange02').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 //////// $('#reportrange02').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'); $('#business').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); $('#reportrange02 span').html(x1 + ' - ' + y1); }); /* $(function() { var start = moment().subtract(29, 'days'); var end = moment(); function cb(start, end) { $('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY')); } $('#singleDate').daterangepicker({ locale: { format: 'MMMM D, YYYY' }, dateFormat: 'MMMM D, YYYY', singleDatePicker: true, showDropdowns: true, minYear: 1901, maxYear: parseInt(moment().format('YYYY'),10) }, function(start, end, label) { var years = moment().diff(start, 'years'); $('#singleDate span').html(start.format('MMMM D, YYYY'), end.format('MMMM D, YYYY')); alert(start.format('MMMM D, YYYY')); alert(end.format('MMMM D, YYYY')); }); }); */ </script>