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> -->
|
||||
<div class="form-row" id="rac_rate_dropdown">
|
||||
<div class="form-group col-md-12">
|
||||
<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;">
|
||||
<select id="ticket_mail_auto_query_customButton" class="form-control">
|
||||
<option value="">Documents</option>
|
||||
<?php foreach ($ticket_check_list as $value): ?>
|
||||
<option value="<?= $value['document']; ?>"><?= $value['document']; ?></option>
|
||||
<option value="<?= $value['document']; ?>"><?= $value['document']; ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<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><input type="hidden" id="query_note_id"><input type="hidden" <div
|
||||
class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary" id="ticket_auto_query_submit">Submit</button>
|
||||
</div><input type="hidden" id="query_note_id">
|
||||
|
||||
<div class="form-group text-right">
|
||||
<button type="submit" class="btn btn-primary" id="ticket_auto_query_submit">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div> <!-- end col-->
|
||||
</div> <!-- end col-->
|
||||
</div>
|
||||
<!-- end -->
|
||||
|
||||
<script>
|
||||
$(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') ?>';
|
||||
data = {
|
||||
id: $('#ticket_master_id').val(),
|
||||
@ -44,8 +97,9 @@ $(document).ready(function() {
|
||||
data: data,
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
console.log('auto query res', res)
|
||||
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);
|
||||
}
|
||||
},
|
||||
@ -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>
|
||||
@ -47,36 +47,61 @@
|
||||
</div>
|
||||
|
||||
<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() {
|
||||
|
||||
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();
|
||||
},
|
||||
|
||||
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();
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const editor = Jodit.make("#ticket_mail_editor", editorConfig);
|
||||
var mail_content = `<?=isset($reply_data['mail_content'])?$reply_data['mail_content']:'' ?>`;
|
||||
$('.jodit-wysiwyg').html(mail_content);
|
||||
const editor = Jodit.make("#ticket_mail_editor", editorConfig);
|
||||
var mail_content = `<?=isset($reply_data['mail_content'])?$reply_data['mail_content']:'' ?>`;
|
||||
$('.jodit-wysiwyg').html(mail_content);
|
||||
|
||||
let lastActiveField = null;
|
||||
let lastActiveField = null;
|
||||
|
||||
// Track last active input field
|
||||
$("#mail_subject").on("focus", function() {
|
||||
// Track last active input field
|
||||
$("#mail_subject").on("focus", function() {
|
||||
lastActiveField = this;
|
||||
});
|
||||
|
||||
@ -85,7 +110,7 @@ $("#mail_subject").on("focus", function() {
|
||||
lastActiveField = editor;
|
||||
});
|
||||
|
||||
document.addEventListener('change', function(event) {
|
||||
document.addEventListener('change', function(event) {
|
||||
var target = event.target;
|
||||
if (target.matches('#ticket_mail_customButton')) {
|
||||
let placeholderValue = $(target).val();
|
||||
@ -176,6 +201,7 @@ document.addEventListener('change', function(event) {
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
<script>
|
||||
function reloadTicket_conversation() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user