241 lines
8.1 KiB
PHP
241 lines
8.1 KiB
PHP
|
|
<!-- ============================================================== -->
|
|
<!-- 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">Create Template</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-1"></div>
|
|
<div class="col-lg-10">
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
|
|
<form id="template-form">
|
|
<div class="form-row">
|
|
<div class="form-group col-md-4">
|
|
<label for="messageto-input">Service </label>
|
|
<input type="text" class="form-control" value="<?= $serviceData->service_name; ?>" readonly>
|
|
<input type="hidden" class="form-control" value="<?= $serviceData->service_id; ?>" id="service_id">
|
|
</div>
|
|
|
|
<div class="form-group col-md-4">
|
|
<label for="messageto-input">Template </label>
|
|
<input type="text" class="form-control" id="template_name" value="<?= isset($templateData) ? $templateData->template_name : '' ?>" >
|
|
<input type="hidden" id="template_id" value='<?= isset($templateData) ? $templateData->template_id : 'null' ?>'>
|
|
</div>
|
|
|
|
<div class="form-group col-md-4">
|
|
<label for="subject-input">Header type</label>
|
|
<input type="text" class="form-control" id="header_type" value="<?= isset($templateData) ? $templateData->header_type : '' ?>" >
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="subject-input">Body Content</label>
|
|
<!-- basic summernote-->
|
|
<div id="summernote-basic"></div>
|
|
</div>
|
|
|
|
</form>
|
|
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-light" onClick="history.back()" data-dismiss="modal">Close</button>
|
|
<button type="button" id="savedata" class="btn btn-primary">Save <i class="fab fa-telegram-plane ml-1"></i></button>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
</div> <!-- end card -->
|
|
</div>
|
|
<div class="col-lg-1"></div>
|
|
<!-- end col -->
|
|
|
|
</div>
|
|
|
|
|
|
</div> <!-- container -->
|
|
|
|
</div> <!-- content -->
|
|
|
|
|
|
<!-- Modal Structure -->
|
|
<div class="modal fade" id="customModal" tabindex="-1" role="dialog" aria-labelledby="customModalLabel" aria-hidden="true">
|
|
<div class="modal-dialog" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="customModalLabel">Place Holder Variables</h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="container">
|
|
<div class="row mb-3">
|
|
<div class="col-sm-4 font-weight-bold">Client Name</div>
|
|
<div class="col-sm-8">%name%</div>
|
|
</div>
|
|
<div class="row mb-3">
|
|
<div class="col-sm-4 font-weight-bold">PAN No</div>
|
|
<div class="col-sm-8">%pan_no%</div>
|
|
</div>
|
|
<div class="row mb-3">
|
|
<div class="col-sm-4 font-weight-bold">Mobile No</div>
|
|
<div class="col-sm-8">%mobile_no%</div>
|
|
</div>
|
|
<div class="row mb-3">
|
|
<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>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<input type="hidden" id="body_html" value='<?= isset($templateData) ? $templateData->body_html : '' ?>'>
|
|
<!-- ============================================================== -->
|
|
<!-- 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 src="https://cdnjs.cloudflare.com/ajax/libs/blueimp-md5/2.19.0/js/md5.min.js"></script>
|
|
<script>
|
|
|
|
|
|
$("#savedata").on("click", function()
|
|
{
|
|
$('.btn-codeview').click();
|
|
formData ={
|
|
service_id : $('#service_id').val(),
|
|
template_id : $('#template_id').val(),
|
|
template_name : $('#template_name').val(),
|
|
header_type : $('#header_type').val(),
|
|
body_text : $('.note-editable > p:first').text(),
|
|
body_html : $('.note-codable').val(),
|
|
};
|
|
|
|
|
|
|
|
console.log(formData);
|
|
|
|
$.ajax({
|
|
url: '<?= base_url()."template_create"; ?>',
|
|
type: 'POST',
|
|
data: formData,
|
|
json: true,
|
|
success: function(response) {
|
|
console.log(response.success);
|
|
if(response.success){
|
|
|
|
toastr.success('Data saved successfully ', 'Success');
|
|
// window.location.reload();
|
|
window.location.href = '<?= base_url()."service_view?service_id="; ?>'+md5(response.service_id);
|
|
}else{
|
|
toastr.warning('Something went wrong', 'Warning');
|
|
}
|
|
|
|
},
|
|
error: function(xhr, status, error) {
|
|
// Handle errors here
|
|
console.error(xhr.responseText);
|
|
}
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
$(document).ready(function() {
|
|
|
|
|
|
|
|
|
|
$('#summernote-basic').summernote({
|
|
toolbar: [
|
|
// [groupName, [list of button]]
|
|
['style', ['style']],
|
|
['font', ['bold', 'italic', 'underline', 'clear']],
|
|
['fontname', ['fontname']],
|
|
['color', ['color']],
|
|
['para', ['ul', 'ol', 'paragraph' , 'height']],
|
|
['table', ['table']],
|
|
// ['insert', ['link', 'picture', 'video']],
|
|
['view', ['fullscreen', 'codeview', 'help']],
|
|
['mybutton', ['customButton']] // Custom button group
|
|
],
|
|
buttons: {
|
|
customButton: function() {
|
|
var ui = $.summernote.ui;
|
|
// create button
|
|
var button = ui.button({
|
|
contents: '<i class="fa fa-child"/> Place Holders',
|
|
tooltip: 'Client Details Place Holders',
|
|
click: function() {
|
|
$('#customModal').modal('show');
|
|
}
|
|
});
|
|
return button.render();
|
|
}
|
|
}
|
|
});
|
|
|
|
setTimeout(() =>
|
|
{
|
|
$('.btn-codeview').click();
|
|
$('.note-codable').val($('#body_html').val());
|
|
$('.btn-codeview').click();
|
|
}, 500);
|
|
|
|
});
|
|
|
|
|
|
</script>
|