CHANGE_ template CRUD:GWM

This commit is contained in:
bitbucket 2024-05-31 09:50:27 +05:30
parent b493a31463
commit 38687905e1
10 changed files with 122 additions and 115 deletions

View File

@ -40,7 +40,10 @@ class MasterController extends BaseController
public function service_list()
{
if(!$this->session->has('is_staff_logged_in')){ return redirect()->to(base_url().'staff'); }
$data['serviceList'] = $this->ServiceModel->findAll();
// $data['serviceList'] = $this->ServiceModel->findAll();
$data['serviceList'] = $this->ServiceModel->select('services.* , COUNT(template.template_id) as template_count')
->join('template', 'services.service_id = template.service_id', 'left')
->findAll();
$staffdata = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow();
echo view('layout/header', ['Data'=>$staffdata]);
@ -180,12 +183,15 @@ class MasterController extends BaseController
$data['serviceData'] = $this->ServiceModel->where('service_id',$data['templateData']->service_id)->get()->getRow();
$staffdata = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow();
echo view('layout/header', ['Data'=>$staffdata]);
$data['body_html'] = $data['templateData']->body_html;
// echo view('layout/header', ['Data'=>$staffdata]);
echo view('template_preview',$data);
echo view('layout/footer');
// echo view('layout/footer');
}
// str_replace("%name%","Gowtham",$data['templateData']->body_html);

View File

@ -43,7 +43,7 @@
<td><?php echo $value['service_name']; ?></td>
<td><?php echo $value['notes']; ?></td>
<td><?php echo 0; ?></td>
<td><?php echo $value['template_count']; ?></td>
</tr>

View File

@ -110,6 +110,26 @@
<div class="col-sm-4 font-weight-bold">Email</div>
<div class="col-sm-8">%email%</div>
</div>
<div class="row mb-3">
<div class="col-sm-4 font-weight-bold">Address</div>
<div class="col-sm-8">%address%</div>
</div>
<div class="row mb-3">
<div class="col-sm-4 font-weight-bold">Country</div>
<div class="col-sm-8">%country%</div>
</div>
<div class="row mb-3">
<div class="col-sm-4 font-weight-bold">State</div>
<div class="col-sm-8">%state%</div>
</div>
<div class="row mb-3">
<div class="col-sm-4 font-weight-bold">City</div>
<div class="col-sm-8">%city%</div>
</div>
<div class="row mb-3">
<div class="col-sm-4 font-weight-bold">PIN</div>
<div class="col-sm-8">%pin_code%</div>
</div>
</div>
</div>
</div>
@ -185,9 +205,9 @@ $(document).ready(function() {
['font', ['bold', 'italic', 'underline', 'clear']],
['fontname', ['fontname']],
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
['para', ['ul', 'ol', 'paragraph' , 'height']],
['table', ['table']],
['insert', ['link', 'picture', 'video']],
// ['insert', ['link', 'picture', 'video']],
['view', ['fullscreen', 'codeview', 'help']],
['mybutton', ['customButton']] // Custom button group
],

View File

@ -9,7 +9,7 @@
<div class="row">
<div class="col-12">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Templates</h4>
<h4 class="page-title">Service And Templates </h4>
<div class="page-title-right">
<a href="<?= base_url('template_create?service_id=').md5($serviceData->service_id); ?>" class="btn btn-primary waves-effect waves-light">
Create New
@ -35,7 +35,7 @@
</h4>
<p class="text-muted font-13 mb-4"> <?= $serviceData->notes; ?> </p>
<table id="datatable-buttons" class="table table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" >
<table class="table table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" >
<thead class="bg-light">
<tr>
<th>Template Name</th>
@ -58,7 +58,11 @@
<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" 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>
<a class="dropdown-item" href="<?= base_url()."template_preview?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_preview?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 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>
</div>
</div>
</td>
@ -79,51 +83,66 @@
</div>
</div> <!-- container -->
</div> <!-- content -->
<div id="con-close-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Update Service</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<form id="save-service" enctype="multipart/form-data">
<div class="modal-body p-4">
<input type="hidden" name="id" value=" <?= $serviceData->service_id; ?> ">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label for="field-1" class="control-label">Service Name</label>
<input type="text" class="form-control" name="service_name" value=" <?= $serviceData->service_name; ?> ">
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label for="field-1" class="control-label">Notes</label>
<textarea class="form-control" name="notes"><?= $serviceData->notes; ?></textarea>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary waves-effect" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-info waves-effect waves-light">Save changes</button>
</div>
</form>
<div id="con-close-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Update Service</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<form id="save-service" enctype="multipart/form-data">
<div class="modal-body p-4">
<input type="hidden" name="id" value=" <?= $serviceData->service_id; ?> ">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label for="field-1" class="control-label">Service Name</label>
<input type="text" class="form-control" name="service_name" value=" <?= $serviceData->service_name; ?> ">
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label for="field-1" class="control-label">Notes</label>
<textarea class="form-control" name="notes"><?= $serviceData->notes; ?></textarea>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary waves-effect" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-info waves-effect waves-light">Save changes</button>
</div>
</form>
</div>
</div>
</div><!-- /.modal -->
<!-- ============================================================== -->
<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 -->
<!-- ============================================================== -->
@ -133,6 +152,7 @@
<script>
$(document).ready(function() {
$('#save-service').submit(function(e) {
e.preventDefault(); // Prevent the form from submitting normally
@ -165,5 +185,25 @@ $(document).ready(function() {
});
$('.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>

View File

@ -1,72 +1,18 @@
<!-- ============================================================== -->
<!-- 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"> Template Preview</h4>
<div class="page-title-right">
<ol class="breadcrumb m-0">
<!-- <li class="breadcrumb-item"><a href="javascript: void(0);">Minton</a></li>
<li class="breadcrumb-item"><a href="javascript: void(0);">Pages</a></li>
<li class="breadcrumb-item active">Starter</li> -->
</ol>
</div>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-lg-2"></div>
<div class="col-lg-8">
<div class="card">
<div class="card-body">
<p style="text-align: right; ">Date: 12.02.2024</p>
<div class="template-header">
<p style="text-align: left;"><b>To</b>
</p><p style="text-align: left; margin-left: 25px;">&nbsp; &nbsp; &nbsp; The Board of Directors
</p><p style="text-align: left; margin-left: 25px;">&nbsp; &nbsp; &nbsp; PKR E Learning Solutions Private Limited
</p><p style="text-align: left; margin-left: 25px;">&nbsp; &nbsp; &nbsp; Chennai<br></p>
</div>
<div class="template-body">
<?php echo $templateData->body_html; ?>
</div>
</div>
</div> <!-- end card -->
<div class="card">
<div class="card-body">
<div class="template-header">
</div>
<div class="col-lg-2"></div>
<!-- end col -->
<div class="template-body">
<?php echo $body_html; ?>
</div>
</div>
</div>
</div> <!-- container -->
</div> <!-- content -->
<!-- ============================================================== -->
<!-- End Page content -->
<!-- ============================================================== -->

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long