CHANGE_AUTO_QUERY_RTE : RV
This commit is contained in:
parent
a2479cb28d
commit
e39779f04f
@ -9,31 +9,84 @@
|
|||||||
<!-- <label for="ticket_auto_query_note">Add Notes</label> -->
|
<!-- <label for="ticket_auto_query_note">Add Notes</label> -->
|
||||||
<div class="form-row" id="rac_rate_dropdown">
|
<div class="form-row" id="rac_rate_dropdown">
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<select id="ticket_mail_auto_query_customButton" class="form-control"
|
<select id="ticket_mail_auto_query_customButton" class="form-control">
|
||||||
style="border:none;right: 13px;width: auto;position: absolute;z-index: 1;top: -19px;height: 32px;float: right;">
|
|
||||||
<option value="">Documents</option>
|
<option value="">Documents</option>
|
||||||
<?php foreach ($ticket_check_list as $value): ?>
|
<?php foreach ($ticket_check_list as $value): ?>
|
||||||
<option value="<?= $value['document']; ?>"><?= $value['document']; ?></option>
|
<option value="<?= $value['document']; ?>"><?= $value['document']; ?></option>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<textarea class="form-control" id="ticket_auto_query_note" name="note" rows="3"
|
<textarea class="form-control" id="ticket_auto_query_note" name="note" rows="3"
|
||||||
placeholder="Enter Text"><?= isset($ticket_note['note']) ? $ticket_note['note'] : '' ?></textarea>
|
placeholder="Enter Text"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div><input type="hidden" id="query_note_id"><input type="hidden" <div
|
</div><input type="hidden" id="query_note_id">
|
||||||
class="form-group text-right m-b-0">
|
|
||||||
<button type="submit" class="btn btn-primary" id="ticket_auto_query_submit">Submit</button>
|
<div class="form-group text-right">
|
||||||
|
<button type="submit" class="btn btn-primary" id="ticket_auto_query_submit">Submit</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</div> <!-- end col-->
|
||||||
</div>
|
|
||||||
</div> <!-- end col-->
|
|
||||||
</div>
|
</div>
|
||||||
<!-- end -->
|
<!-- end -->
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
const auto_query_editor = Jodit.make("#ticket_auto_query_note", editorConfig);
|
||||||
|
// var mail_content = `<?= isset($ticket_note['note'])?$ticket_note['note']:'' ?> `;
|
||||||
|
// console.log('query_content', mail_content);
|
||||||
|
// $('.jodit-wysiwyg').html(mail_content);
|
||||||
|
|
||||||
|
let lastActiveField = null;
|
||||||
|
auto_query_editor.events.on("focus", function() {
|
||||||
|
lastActiveField = auto_query_editor;
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#ticket_auto_query_note").on("focus", function() {
|
||||||
|
lastActiveField = this;
|
||||||
|
});
|
||||||
|
|
||||||
|
document.addEventListener('change', function(event) {
|
||||||
|
|
||||||
|
var target = event.target;
|
||||||
|
|
||||||
|
if (target.matches('#ticket_mail_auto_query_customButton')) {
|
||||||
|
|
||||||
|
let placeholderValue = $(target).val();
|
||||||
|
if (!placeholderValue) return;
|
||||||
|
|
||||||
|
if (lastActiveField) {
|
||||||
|
if (lastActiveField.id === "ticket_auto_query_note") {
|
||||||
|
insertAtCursor(lastActiveField, placeholderValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$(target).val('');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function insertAtCursor(input, textToInsert) {
|
||||||
|
if (document.selection) {
|
||||||
|
input.focus();
|
||||||
|
var sel = document.selection.createRange();
|
||||||
|
sel.text = textToInsert;
|
||||||
|
} else if (input.selectionStart || input.selectionStart === 0) {
|
||||||
|
let startPos = input.selectionStart;
|
||||||
|
let endPos = input.selectionEnd;
|
||||||
|
input.value = input.value.substring(0, startPos) + textToInsert + input.value.substring(endPos, input.value.length);
|
||||||
|
input.selectionStart = input.selectionEnd = startPos + textToInsert.length;
|
||||||
|
} else {
|
||||||
|
input.value += textToInsert;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
url = '<?= base_url('ticket/note/1') ?>';
|
url = '<?= base_url('ticket/note/1') ?>';
|
||||||
data = {
|
data = {
|
||||||
id: $('#ticket_master_id').val(),
|
id: $('#ticket_master_id').val(),
|
||||||
@ -44,8 +97,9 @@ $(document).ready(function() {
|
|||||||
data: data,
|
data: data,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
|
console.log('auto query res', res)
|
||||||
if (res.status == true) {
|
if (res.status == true) {
|
||||||
$('#ticket_auto_query_note').val(res.data.note);
|
$('.jodit-wysiwyg').html(res.data.note);
|
||||||
$('#query_note_id').val(res.data.id);
|
$('#query_note_id').val(res.data.id);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -116,48 +170,4 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
let lastActiveField = null;
|
|
||||||
|
|
||||||
$("#ticket_auto_query_note").on("focus", function() {
|
|
||||||
lastActiveField = this;
|
|
||||||
});
|
|
||||||
|
|
||||||
document.addEventListener('change', function(event) {
|
|
||||||
|
|
||||||
var target = event.target;
|
|
||||||
|
|
||||||
if (target.matches('#ticket_mail_auto_query_customButton')) {
|
|
||||||
|
|
||||||
let placeholderValue = $(target).val();
|
|
||||||
if (!placeholderValue) return;
|
|
||||||
|
|
||||||
if (lastActiveField) {
|
|
||||||
if (lastActiveField.id === "ticket_auto_query_note") {
|
|
||||||
insertAtCursor(lastActiveField, placeholderValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$(target).val('');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function insertAtCursor(input, textToInsert) {
|
|
||||||
|
|
||||||
textToInsert += '\n';
|
|
||||||
|
|
||||||
if (document.selection) {
|
|
||||||
input.focus();
|
|
||||||
var sel = document.selection.createRange();
|
|
||||||
sel.text = textToInsert;
|
|
||||||
} else if (input.selectionStart || input.selectionStart === 0) {
|
|
||||||
let startPos = input.selectionStart;
|
|
||||||
let endPos = input.selectionEnd;
|
|
||||||
input.value = input.value.substring(0, startPos) + textToInsert + input.value.substring(endPos, input.value
|
|
||||||
.length);
|
|
||||||
input.selectionStart = input.selectionEnd = startPos + textToInsert.length;
|
|
||||||
} else {
|
|
||||||
input.value += textToInsert;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
@ -47,36 +47,61 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
var toolbar = "bold,italic,strikethrough,|,superscript,subscript,|,align,";
|
||||||
|
|
||||||
|
const editorConfig = {
|
||||||
|
buttons: toolbar.concat(['fontsize']),
|
||||||
|
fontsize: [8, 10, 12, 14, 16, 18, 20, 22, 24], // Customize font sizes
|
||||||
|
showPlaceholder: false,
|
||||||
|
toolbarButtonSize: 'small',
|
||||||
|
toolbarAdaptive: false,
|
||||||
|
saveHeightInStorage: true,
|
||||||
|
minHeight: 400,
|
||||||
|
extraButtons: [
|
||||||
|
{
|
||||||
|
name: 'info',
|
||||||
|
iconURL: '<?= base_url()."public"; ?>/assets/images/image-solid.svg', // Replace with the actual icon URL
|
||||||
|
exec: function (editor) {
|
||||||
|
const fileInput = document.getElementById("Question_title_fileInput");
|
||||||
|
fileInput.click();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
var toolbar = "bold,italic,strikethrough,|,superscript,subscript,|,align,";
|
var toolbar = "bold,italic,strikethrough,|,superscript,subscript,|,align,";
|
||||||
const editorConfig = {
|
|
||||||
buttons: toolbar.concat(['fontsize']),
|
const editorConfig = {
|
||||||
fontsize: [8, 10, 12, 14, 16, 18, 20, 22, 24], // Customize font sizes
|
buttons: toolbar.concat(['fontsize']),
|
||||||
showPlaceholder: false,
|
fontsize: [8, 10, 12, 14, 16, 18, 20, 22, 24], // Customize font sizes
|
||||||
toolbarButtonSize: 'small',
|
showPlaceholder: false,
|
||||||
toolbarAdaptive: false,
|
toolbarButtonSize: 'small',
|
||||||
saveHeightInStorage: true,
|
toolbarAdaptive: false,
|
||||||
minHeight: 400,
|
saveHeightInStorage: true,
|
||||||
extraButtons: [
|
minHeight: 400,
|
||||||
{
|
extraButtons: [
|
||||||
name: 'info',
|
{
|
||||||
iconURL: '<?= base_url()."public"; ?>/assets/images/image-solid.svg', // Replace with the actual icon URL
|
name: 'info',
|
||||||
exec: function (editor) {
|
iconURL: '<?= base_url()."public"; ?>/assets/images/image-solid.svg', // Replace with the actual icon URL
|
||||||
const fileInput = document.getElementById("Question_title_fileInput");
|
exec: function (editor) {
|
||||||
fileInput.click();
|
const fileInput = document.getElementById("Question_title_fileInput");
|
||||||
},
|
fileInput.click();
|
||||||
},
|
},
|
||||||
],
|
},
|
||||||
};
|
],
|
||||||
|
};
|
||||||
|
|
||||||
const editor = Jodit.make("#ticket_mail_editor", editorConfig);
|
const editor = Jodit.make("#ticket_mail_editor", editorConfig);
|
||||||
var mail_content = `<?=isset($reply_data['mail_content'])?$reply_data['mail_content']:'' ?>`;
|
var mail_content = `<?=isset($reply_data['mail_content'])?$reply_data['mail_content']:'' ?>`;
|
||||||
$('.jodit-wysiwyg').html(mail_content);
|
$('.jodit-wysiwyg').html(mail_content);
|
||||||
|
|
||||||
let lastActiveField = null;
|
let lastActiveField = null;
|
||||||
|
|
||||||
// Track last active input field
|
// Track last active input field
|
||||||
$("#mail_subject").on("focus", function() {
|
$("#mail_subject").on("focus", function() {
|
||||||
lastActiveField = this;
|
lastActiveField = this;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -85,7 +110,7 @@ $("#mail_subject").on("focus", function() {
|
|||||||
lastActiveField = editor;
|
lastActiveField = editor;
|
||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener('change', function(event) {
|
document.addEventListener('change', function(event) {
|
||||||
var target = event.target;
|
var target = event.target;
|
||||||
if (target.matches('#ticket_mail_customButton')) {
|
if (target.matches('#ticket_mail_customButton')) {
|
||||||
let placeholderValue = $(target).val();
|
let placeholderValue = $(target).val();
|
||||||
@ -176,6 +201,7 @@ document.addEventListener('change', function(event) {
|
|||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
function reloadTicket_conversation() {
|
function reloadTicket_conversation() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user