EVOLUTION-NINJA
Edit File: ticket-view.php
<?php echo view('includes/admin-header'); ?> <div class="col-sm-10 p-0"> <div class="ticket-view"> <div class="row ticket-head"> <div class="col-sm-9"> <h3>Ticket List</h3> </div> <div class="col-sm-3" id="go-back-new"> <a onclick="history.back()"><i class="fa fa-arrow-left" aria-hidden="true"></i>Back</a> </div> </div> <div class="row ticket-list-head pt-4"> <!-- <div class="col-sm-9"> <a href="<?php echo base_url('add-ticket'); ?>">Create New Ticket +</a> </div> --> <div class="col-sm-3" id="go-back-new"> <input type="text" class="form-control" id='searchInput' placeholder="search" name=""> </div> </div> <div class="row ticket_list_table"> <div class="col-sm-12"> <div class="table-responsive"> <table class="table" > <thead> <tr> <th>SL</th> <th>Ticket ID</th> <th>Type of request</th> <th>Name</th> <th>Email</th> <th>GamerId</th> <th>Mobile</th> <th>Created at</th> <th>Status</th> <!-- <th>Action</th> --> <th>Action</th> </tr> </thead> <tbody id="dataTable"> <?php $sl = 1; foreach($ticketdata as $val){ ?> <?php $date1 = new DateTime($val['created_at']); date_default_timezone_set('Asia/Kolkata'); ?> <tr> <td><?php echo $sl; ?></td> <td><?php echo $val['ticket_id']; ?></td> <td><?php echo $val['type_of_request']; ?></td> <td><?php echo $val['name']; ?></td> <td><?php echo $val['email']; ?></td> <td><?php echo $val['gamerid']; ?></td> <td><?php echo $val['mobile']; ?></td> <td><?php echo date('h:i a d-m-y', strtotime($val['created_at'])); ?></td> <?php if($val['status'] === 'Open'){ $status_class = 'open-btn'; }elseif($val['status'] === 'Closed'){ $status_class = 'close-btn'; }else{ $status_class = 'progress-btn'; } ?> <td><button type="button" class="<?php echo $status_class; ?>"><?php echo $val['status']; ?></button></td> <!-- <td><span></span><button type="button" class="open-btn"> <a href="<?php echo base_url('ticket-details').'?id='.$val['id']; ?>" >View</a></button></td> --> <td class=" d-flex"> <button type="button" class="btn btn-delete mr-2"><a href='<?php echo base_url('edit-ticket').'?id='.$val["id"]; ?>'>Reply</a></button> <button type="button" onclick='deleteTicket(<?php echo $val["id"]; ?>)' class="btn-delete">Delete</button> </td> </tr> <?php $sl++; }; ?> </tbody> </table> </div> </div> </div> </div> </div> <script> function deleteTicket(id){ swal({ title: "Are you sure?", text: "Ticket will be deleted", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes", cancelButtonText: "No", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if(isConfirm){ $.ajax({ type: "get", url: `<?php echo base_url("delete-ticket")?>?id=${id}`, contentType: false, processData: false, success: function (response) { var res = JSON.parse(response); console.log(res.result); if (res.result == 1) { toastr["success"](res.message); setTimeout(() => { window.location = '<?php echo base_url("ticket-view")?>'; }, 2000); } else { toastr["error"](response.message); } }, }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } </script> <script> document.addEventListener("DOMContentLoaded", function() { // Get the input element and table const searchInput = document.getElementById("searchInput"); const dataTable = document.getElementById("dataTable"); // Add an event listener to the search input searchInput.addEventListener("input", function() { const searchText = searchInput.value.toLowerCase(); const rows = dataTable.getElementsByTagName("tr"); // Loop through all the rows in the table and hide those that don't match the search text for (let i = 0; i < rows.length; i++) { const cells = rows[i].getElementsByTagName("td"); let rowMatchesSearch = false; for (let j = 0; j < cells.length; j++) { const cellText = cells[j].textContent.toLowerCase(); if (cellText.includes(searchText)) { rowMatchesSearch = true; break; } } // Show or hide the row based on whether it matches the search text rows[i].style.display = rowMatchesSearch ? "" : "none"; } }); }); </script> <?php echo view('includes/admin-footer'); ?>