GWM : placeholder auto append
This commit is contained in:
parent
646eba706c
commit
5ed8e9ab0e
@ -379,7 +379,7 @@ class MasterController extends BaseController
|
|||||||
$doc_id = $this->request->getVar('doc_id');
|
$doc_id = $this->request->getVar('doc_id');
|
||||||
$data['docData'] = $this->ClientDocsModel->docPreview($doc_id);
|
$data['docData'] = $this->ClientDocsModel->docPreview($doc_id);
|
||||||
|
|
||||||
$data['clientData'] = $this->ClientBranchModel->select('client.* , client_branch.*')
|
$data['clientData'] = $this->ClientBranchModel->select('client.name , client.pan_no ,client_branch.gst_no , client_branch.mobile_no , client_branch.email , client_branch.address , client_branch.country , client_branch.state , client_branch.city , client_branch.pin_code ')
|
||||||
->join('client', 'client_branch.client_id = client.client_id', 'left')
|
->join('client', 'client_branch.client_id = client.client_id', 'left')
|
||||||
->where('client_branch.id',$data['docData']->client_branch_id)
|
->where('client_branch.id',$data['docData']->client_branch_id)
|
||||||
->get()->getRow();
|
->get()->getRow();
|
||||||
@ -390,18 +390,27 @@ class MasterController extends BaseController
|
|||||||
$data['header_html'] = $data['docData']->header_html;
|
$data['header_html'] = $data['docData']->header_html;
|
||||||
$data['footer_html'] = $data['docData']->footer_html;
|
$data['footer_html'] = $data['docData']->footer_html;
|
||||||
$data['body_html'] = $data['docData']->body_html;
|
$data['body_html'] = $data['docData']->body_html;
|
||||||
|
//replace client details in template content
|
||||||
foreach ($data['clientData'] as $key => $value) {
|
foreach ($data['clientData'] as $key => $value) {
|
||||||
$placeHolder = '%'.$key.'%';
|
$placeHolder = '%'.$key.'%';
|
||||||
$data['body_html'] = str_replace($placeHolder,$value,$data['body_html']);
|
$data['body_html'] = str_replace($placeHolder,$value,$data['body_html']);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//replace Date and Year values in template content
|
||||||
foreach ($DateAndYears as $key => $value) {
|
foreach ($DateAndYears as $key => $value) {
|
||||||
$placeHolder = '%'.$key.'%';
|
$placeHolder = '%'.$key.'%';
|
||||||
$data['body_html'] = str_replace($placeHolder,$value,$data['body_html']);
|
$data['body_html'] = str_replace($placeHolder,$value,$data['body_html']);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sharedDate = $this->DocsStatusModel->where('client_docs_id',$doc_id)->where('status','Shared')->get()->getRow()->created_at;
|
||||||
|
if($sharedDate){
|
||||||
|
$date = \DateTime::createFromFormat('Y-m-d H:i:s', $sharedDate);
|
||||||
|
$formattedDate = $date->format('d-m-Y');
|
||||||
|
$data['body_html'] = str_replace('%CD%',$formattedDate,$data['body_html']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo view('layout/header', ['Data'=>$userData]);
|
echo view('layout/header', ['Data'=>$userData]);
|
||||||
echo view('client_docs_preview',$data);
|
echo view('client_docs_preview',$data);
|
||||||
echo view('layout/footer');
|
echo view('layout/footer');
|
||||||
@ -410,8 +419,6 @@ class MasterController extends BaseController
|
|||||||
|
|
||||||
public function dateAndYearPlaceholder()
|
public function dateAndYearPlaceholder()
|
||||||
{
|
{
|
||||||
$currentDate = date('d-m-Y');
|
|
||||||
|
|
||||||
|
|
||||||
$currentYear = date('Y');
|
$currentYear = date('Y');
|
||||||
$currentMonth = date('m');
|
$currentMonth = date('m');
|
||||||
@ -439,7 +446,6 @@ class MasterController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$DateAndYears = [
|
$DateAndYears = [
|
||||||
"CD" => $currentDate,
|
|
||||||
"CY" => $currentYear,
|
"CY" => $currentYear,
|
||||||
"FY" => $financialYear,
|
"FY" => $financialYear,
|
||||||
"AY" => $assessmentYear,
|
"AY" => $assessmentYear,
|
||||||
@ -447,7 +453,6 @@ class MasterController extends BaseController
|
|||||||
"Q2" => $q2,
|
"Q2" => $q2,
|
||||||
"Q3" => $q3,
|
"Q3" => $q3,
|
||||||
"Q4" => $q4,
|
"Q4" => $q4,
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
return $DateAndYears;
|
return $DateAndYears;
|
||||||
|
|||||||
@ -12,7 +12,10 @@
|
|||||||
padding-top: 3px;
|
padding-top: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
|
||||||
|
|
||||||
@ -326,8 +329,7 @@
|
|||||||
<script>
|
<script>
|
||||||
document.addEventListener("DOMContentLoaded", function() {
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
document.querySelector(".download-btnn").addEventListener("click", async function() {
|
document.querySelector(".download-btnn").addEventListener("click", async function() {
|
||||||
$('.loader').fadeIn();
|
|
||||||
$('.loader-mask').fadeIn();
|
|
||||||
var element = document.querySelector(".card-body");
|
var element = document.querySelector(".card-body");
|
||||||
|
|
||||||
// Get the HTML content of the element as a string
|
// Get the HTML content of the element as a string
|
||||||
@ -363,13 +365,12 @@
|
|||||||
link.click();
|
link.click();
|
||||||
// Remove the link from the document
|
// Remove the link from the document
|
||||||
document.body.removeChild(link);
|
document.body.removeChild(link);
|
||||||
|
|
||||||
}
|
}
|
||||||
$('.loader').fadeOut();
|
|
||||||
$('.loader-mask').fadeOut('slow');
|
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
$('.loader').fadeOut();
|
|
||||||
$('.loader-mask').fadeOut('slow');
|
|
||||||
console.error('Error : ' + error);
|
console.error('Error : ' + error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -4,21 +4,20 @@
|
|||||||
<!-- ============================================================== -->
|
<!-- ============================================================== -->
|
||||||
<style>
|
<style>
|
||||||
.append-text-button {
|
.append-text-button {
|
||||||
display: inline-block;
|
|
||||||
padding: 10px 10px;
|
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
color: black; /* Primary color */
|
color: black;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
border: 2px solid #85a7c9; /* Border color */
|
border-radius: 4px;
|
||||||
border-radius: 4px; /* Rounded corners */
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
cursor: pointer; /* Pointer cursor to indicate it's clickable */
|
cursor: pointer;
|
||||||
transition: background-color 0.3s ease, color 0.3s ease; /* Smooth transition */
|
transition: background-color 0.3s ease, color 0.3s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.append-text-button:hover {
|
.append-text-button:hover {
|
||||||
background-color: #85a7c9; /* Background color on hover */
|
font-weight: bold;
|
||||||
color: #fff; /* Text color on hover */
|
color: black;
|
||||||
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
@ -214,16 +213,7 @@
|
|||||||
<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/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 src="https://cdnjs.cloudflare.com/ajax/libs/blueimp-md5/2.19.0/js/md5.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
|
||||||
|
|
||||||
$('.append-text-button').on('click', function() {
|
|
||||||
var textToInsert = $(this).text(); // Get the text content of the clicked element
|
|
||||||
$('#summernote-basic').summernote('focus'); // Focus on the Summernote editor
|
|
||||||
$('#summernote-basic').summernote('editor.insertText', textToInsert); // Insert the text at the cursor position
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$("#savedata").on("click", function()
|
$("#savedata").on("click", function()
|
||||||
@ -271,6 +261,8 @@ $("#savedata").on("click", function()
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var lastCursorRange;
|
||||||
$('#summernote-basic').summernote({
|
$('#summernote-basic').summernote({
|
||||||
height: 750,
|
height: 750,
|
||||||
toolbar: [
|
toolbar: [
|
||||||
@ -295,6 +287,7 @@ $(document).ready(function() {
|
|||||||
contents: 'Client Details',
|
contents: 'Client Details',
|
||||||
tooltip: 'Client Details Place Holders',
|
tooltip: 'Client Details Place Holders',
|
||||||
click: function() {
|
click: function() {
|
||||||
|
saveCursorPosition();
|
||||||
$('#customModal').modal('show');
|
$('#customModal').modal('show');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -307,6 +300,7 @@ $(document).ready(function() {
|
|||||||
contents: 'Date & Year',
|
contents: 'Date & Year',
|
||||||
tooltip: 'Date & Year Place Holders',
|
tooltip: 'Date & Year Place Holders',
|
||||||
click: function() {
|
click: function() {
|
||||||
|
saveCursorPosition();
|
||||||
$('#YearsCustomModal').modal('show');
|
$('#YearsCustomModal').modal('show');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -321,6 +315,35 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
|
|
||||||
|
// Save the cursor position
|
||||||
|
function saveCursorPosition() {
|
||||||
|
var selection = window.getSelection();
|
||||||
|
if (selection.rangeCount > 0) {
|
||||||
|
lastCursorRange = selection.getRangeAt(0);
|
||||||
|
console.log('Cursor Range Saved:', lastCursorRange);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle text insertion from modals
|
||||||
|
$(document).on('click', '.append-text-button', function() {
|
||||||
|
var textToInsert = $(this).text();
|
||||||
|
$('#customModal').modal('hide');
|
||||||
|
$('#YearsCustomModal').modal('hide');
|
||||||
|
$('#summernote-basic').summernote('focus');
|
||||||
|
if (lastCursorRange) {
|
||||||
|
var selection = window.getSelection();
|
||||||
|
selection.removeAllRanges();
|
||||||
|
selection.addRange(lastCursorRange);
|
||||||
|
document.execCommand('insertText', false, textToInsert);
|
||||||
|
console.log('Inserted text:', textToInsert);
|
||||||
|
} else {
|
||||||
|
$('#summernote-basic').summernote('editor.insertText', textToInsert);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -4,21 +4,19 @@
|
|||||||
<!-- ============================================================== -->
|
<!-- ============================================================== -->
|
||||||
<style>
|
<style>
|
||||||
.append-text-button {
|
.append-text-button {
|
||||||
display: inline-block;
|
|
||||||
padding: 10px 10px;
|
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
color: black; /* Primary color */
|
color: black;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
border: 2px solid #85a7c9; /* Border color */
|
border-radius: 4px;
|
||||||
border-radius: 4px; /* Rounded corners */
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
cursor: pointer; /* Pointer cursor to indicate it's clickable */
|
cursor: pointer;
|
||||||
transition: background-color 0.3s ease, color 0.3s ease; /* Smooth transition */
|
transition: background-color 0.3s ease, color 0.3s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.append-text-button:hover {
|
.append-text-button:hover {
|
||||||
background-color: #85a7c9; /* Background color on hover */
|
font-weight: bold;
|
||||||
color: #fff; /* Text color on hover */
|
color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
@ -248,16 +246,10 @@
|
|||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
$('.append-text-button').on('click', function() {
|
|
||||||
var textToInsert = $(this).text(); // Get the text content of the clicked element
|
|
||||||
$('#summernote-basic').summernote('focus'); // Focus on the Summernote editor
|
|
||||||
$('#summernote-basic').summernote('editor.insertText', textToInsert); // Insert the text at the cursor position
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.select2-dropdown').select2();
|
$('.select2-dropdown').select2();
|
||||||
|
|
||||||
$("#service_group_id").on("change", function()
|
$("#service_group_id").on("change", function()
|
||||||
{
|
{
|
||||||
var value = $(this).val();
|
var value = $(this).val();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '<?= base_url("get_service_data") ?>?service_group_id=' + value,
|
url: '<?= base_url("get_service_data") ?>?service_group_id=' + value,
|
||||||
@ -287,7 +279,7 @@ $("#service_group_id").on("change", function()
|
|||||||
toastr.error('Failed to fetch data.', 'Error');
|
toastr.error('Failed to fetch data.', 'Error');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#savedata").on("click", function()
|
$("#savedata").on("click", function()
|
||||||
@ -363,6 +355,8 @@ $("#savedata").on("click", function()
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var lastCursorRange;
|
||||||
$('#summernote-basic').summernote({
|
$('#summernote-basic').summernote({
|
||||||
height: 750,
|
height: 750,
|
||||||
toolbar: [
|
toolbar: [
|
||||||
@ -387,6 +381,7 @@ $(document).ready(function() {
|
|||||||
contents: 'Client Details',
|
contents: 'Client Details',
|
||||||
tooltip: 'Client Details Place Holders',
|
tooltip: 'Client Details Place Holders',
|
||||||
click: function() {
|
click: function() {
|
||||||
|
saveCursorPosition();
|
||||||
$('#customModal').modal('show');
|
$('#customModal').modal('show');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -399,6 +394,7 @@ $(document).ready(function() {
|
|||||||
contents: 'Date & Year',
|
contents: 'Date & Year',
|
||||||
tooltip: 'Date & Year Place Holders',
|
tooltip: 'Date & Year Place Holders',
|
||||||
click: function() {
|
click: function() {
|
||||||
|
saveCursorPosition();
|
||||||
$('#YearsCustomModal').modal('show');
|
$('#YearsCustomModal').modal('show');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -413,6 +409,35 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
|
|
||||||
|
// Save the cursor position
|
||||||
|
function saveCursorPosition() {
|
||||||
|
var selection = window.getSelection();
|
||||||
|
if (selection.rangeCount > 0) {
|
||||||
|
lastCursorRange = selection.getRangeAt(0);
|
||||||
|
console.log('Cursor Range Saved:', lastCursorRange);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle text insertion from modals
|
||||||
|
$(document).on('click', '.append-text-button', function() {
|
||||||
|
var textToInsert = $(this).text();
|
||||||
|
$('#customModal').modal('hide');
|
||||||
|
$('#YearsCustomModal').modal('hide');
|
||||||
|
$('#summernote-basic').summernote('focus');
|
||||||
|
if (lastCursorRange) {
|
||||||
|
var selection = window.getSelection();
|
||||||
|
selection.removeAllRanges();
|
||||||
|
selection.addRange(lastCursorRange);
|
||||||
|
document.execCommand('insertText', false, textToInsert);
|
||||||
|
console.log('Inserted text:', textToInsert);
|
||||||
|
} else {
|
||||||
|
$('#summernote-basic').summernote('editor.insertText', textToInsert);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user