2024-07-16 12:29:59 +00:00
|
|
|
<div class="container">
|
|
|
|
<div class="row">
|
2024-07-19 12:30:57 +00:00
|
|
|
<div class="col-md-12 mt-4">
|
2024-07-16 12:29:59 +00:00
|
|
|
<div class="card">
|
|
|
|
<div class="card-header">
|
2024-08-09 12:04:48 +00:00
|
|
|
<?php if ($this->session->flashdata('status')) : ?>
|
2024-07-16 12:29:59 +00:00
|
|
|
<div class="alert alert-success">
|
|
|
|
<?= $this->session->flashdata('status'); ?>
|
|
|
|
</div>
|
|
|
|
<?php endif; ?>
|
2024-07-29 09:17:16 +00:00
|
|
|
<h3>Published Forms</h3>
|
2024-07-16 12:29:59 +00:00
|
|
|
</div>
|
|
|
|
<div class="card-body">
|
|
|
|
<!-- here your table will occur -->
|
|
|
|
<table id="basetable1" class="table table-bordered">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
2024-08-09 12:04:48 +00:00
|
|
|
<th>Serial No.</th>
|
2024-07-16 12:29:59 +00:00
|
|
|
<th>Title</th>
|
2024-07-23 12:54:27 +00:00
|
|
|
<th>Response Link</th>
|
2024-07-24 13:12:00 +00:00
|
|
|
<th>Status</th>
|
2024-07-23 12:54:27 +00:00
|
|
|
<th>Preview</th>
|
2024-07-16 12:29:59 +00:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2024-07-26 12:41:46 +00:00
|
|
|
<?php $serialNumber = 1;
|
2024-08-09 12:04:48 +00:00
|
|
|
foreach ($forms as $row) : ?>
|
2024-07-16 12:29:59 +00:00
|
|
|
<tr>
|
2024-07-26 12:41:46 +00:00
|
|
|
<td><?php echo $serialNumber++; ?></td>
|
2024-07-29 09:17:16 +00:00
|
|
|
<td class="title-column"><?php echo $row->title; ?></td>
|
2024-07-16 12:29:59 +00:00
|
|
|
<td>
|
2024-07-29 09:17:16 +00:00
|
|
|
<a href="<?php echo $row->response_link; ?>" target="_blank"><?php echo $row->response_link; ?></a>
|
2024-07-16 12:29:59 +00:00
|
|
|
</td>
|
|
|
|
<td>
|
2024-07-26 12:41:46 +00:00
|
|
|
<label class="switch">
|
2024-07-29 09:17:16 +00:00
|
|
|
<input type="checkbox" class="toggle-switch" data-form-id="<?php echo $row->id; ?>" <?php echo $row->is_responsive ? 'checked' : ''; ?>>
|
2024-07-26 12:41:46 +00:00
|
|
|
<span class="slider round"></span>
|
2024-07-29 09:17:16 +00:00
|
|
|
<span class="tooltip"><?php echo $row->is_responsive ? 'Active' : 'Inactive'; ?></span>
|
2024-07-26 12:41:46 +00:00
|
|
|
</label>
|
2024-07-16 12:29:59 +00:00
|
|
|
</td>
|
|
|
|
<td>
|
2024-07-26 12:41:46 +00:00
|
|
|
<a href="<?php echo base_url('form_preview/' . $row->id); ?>">
|
|
|
|
<i class="fas fa-eye"></i> <!-- Eye icon -->
|
|
|
|
</a>
|
|
|
|
</td>
|
2024-07-16 12:29:59 +00:00
|
|
|
</tr>
|
|
|
|
<?php endforeach; ?>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
2024-07-29 09:17:16 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<script>
|
|
|
|
$(document).ready(function() {
|
|
|
|
$('#basetable1').DataTable({
|
|
|
|
"pagingType": "full_numbers", // Full pagination controls
|
|
|
|
"lengthMenu": [10, 25, 50], // Options for number of rows per page
|
|
|
|
"language": {
|
|
|
|
"search": "Filter records:", // Custom search label
|
|
|
|
"lengthMenu": "Show _MENU_ entries" // Custom length menu label
|
|
|
|
},
|
|
|
|
"columnDefs": [
|
|
|
|
{ "orderable": false, "targets": 4 } // Disable sorting for the "View" column (index 4)
|
|
|
|
],
|
|
|
|
"order": [[0, "asc"]] // Default sort by "Title" column (index 1) in descending order
|
|
|
|
});
|
|
|
|
});
|
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
|
|
document.querySelectorAll('.toggle-switch').forEach(function(switchElement) {
|
|
|
|
switchElement.addEventListener('change', function() {
|
|
|
|
var formId = this.getAttribute('data-form-id');
|
|
|
|
var isResponsive = this.checked ? 1 : 0;
|
|
|
|
|
|
|
|
fetch(`<?php echo base_url('Publish_controller/toggle_responsive/'); ?>${formId}`, {
|
|
|
|
method: 'POST',
|
|
|
|
headers: {
|
|
|
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
|
|
'X-Requested-With': 'XMLHttpRequest'
|
|
|
|
},
|
|
|
|
body: `is_responsive=${isResponsive}`
|
|
|
|
})
|
|
|
|
.then(response => response.json())
|
|
|
|
.then(data => {
|
|
|
|
if (data.success) {
|
|
|
|
// Optionally, handle success
|
|
|
|
} else {
|
|
|
|
// Optionally, handle failure
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
|
console.error('Error:', error);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|