bb_sign/app/Views/template_list.php

161 lines
6.5 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!-- ============================================================== -->
<!-- Start Page Content here -->
<!-- ============================================================== -->
<div class="content-page">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Templates List</h4>
<div class="page-title-right">
<a href="<?= base_url('template_create'); ?>" class="btn btn-primary waves-effect waves-light">
Create New
</a>
</div>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<h4 class="header-title">
</h4>
<table id="template_list_table" class="table table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" >
<thead class="bg-light">
<tr>
<th>Group Name</th>
<th>Servicee Name</th>
<th>Template Name</th>
<th>Action</th>
</tr>
</thead>
<tbody class="font-14">
<?php foreach ($templateData as $key => $value) { ?>
<tr>
<td> <?php echo $value['group_name']; ?></td>
<td> <?php echo $value['service_name']; ?></td>
<td> <?php echo $value['template_name']; ?></td>
<!-- <td><a href="<?= base_url()."template_edit?template_id=".md5($value['template_id']); ?>" > <i class='mdi mdi-pencil-outline mr-1'></i>Edit</a></td> -->
<td>
<div class="btn-group dropdown">
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item preview-button" href="#" data-template-id="<?= md5($value['template_id']); ?>">
<i class="mdi mdi-eye-outline mr-2 text-muted font-18 vertical-middle"></i> Preview
</a>
<a class="dropdown-item" href="<?= base_url()."template_edit?template_id=".md5($value['template_id']); ?>">
<i class="mdi mdi-pencil-outline mr-2 text-muted font-18 vertical-middle"></i> Edit
</a>
</div>
</div>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div><!-- end col -->
</div>
</div> <!-- container -->
</div> <!-- content -->
<button type="button" style="display:none;" class="btn btn-info" id="template_preview_button" data-toggle="modal" data-target="#bs-example-modal-lg">Large Modal</button>
<!-- Modal content for the Large example -->
<div class="modal fade" id="bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myLargeModalLabel">Preview</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body" id="template_preview">
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- ============================================================== -->
<!-- End Page content -->
<!-- ============================================================== -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.1.0/js/select2.min.js"></script>
<script>
$(document).ready(function() {
datatable_bikeModel = $('#template_list_table').DataTable({
"order": [[1, 'asc']], // Set initial sorting to descending on the first column
"dom": 'Bfrtip', // Show export buttons
"buttons": [{extend: 'pdfHtml5',title: 'Template_List', text: 'PDF',},
{extend: 'print',title: 'Template_List',text: 'Print',},
{extend: 'copy',text: 'Copy', titleAttr: 'Copy',},
{extend: 'csv',text: 'CSV', title: 'Template_List', }],
"language": {
"search": "Search: " // Customize search label
},
});
$('.preview-button').on('click', function(e) {
e.preventDefault();
var templateId = $(this).data('template-id');
$.ajax({
url: '<?= base_url(); ?>template_preview?template_id='+templateId,
type: 'GET',
success: function(response) {
// Assuming you want to display the response in a modal
$('#template_preview').html(response);
$('#template_preview_button').click();
},
error: function(xhr, status, error) {
console.error('Error fetching template preview:', error);
}
});
});
});
</script>