Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
970e2adaa2
@ -244,34 +244,6 @@ class PolicyTransactionController extends BaseController
|
||||
// print_r($data); die;
|
||||
// var_dump($data); die;
|
||||
|
||||
// Format dates
|
||||
// $data['policy_issue_date'] = change_date_format($this->request->getPost('policy_issue_date'), 'd/m/Y', 'Y-m-d') ?? null;
|
||||
// $data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd/m/Y', 'Y-m-d') ?? null;
|
||||
// $data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd/m/Y', 'Y-m-d') ?? null;
|
||||
// $data['renewal_date'] = change_date_format($this->request->getPost('renewal_date'), 'd/m/Y', 'Y-m-d') ?? null;
|
||||
// $data['rollover_date'] = change_date_format($this->request->getPost('rollover_date'), 'd/m/Y', 'Y-m-d') ?? null;
|
||||
|
||||
// $data['policy_issue_date'] = (isset($data['policy_issue_date']) && $data['policy_issue_date'] !== null && $data['policy_issue_date'] !== '')
|
||||
// ? date('d/m/Y', strtotime($data['policy_issue_date']))
|
||||
// : null;
|
||||
|
||||
// $data['policy_start_date'] = (isset($data['policy_start_date']) && $data['policy_start_date'] !== null && $data['policy_start_date'] !== '')
|
||||
// ? date('d/m/Y', strtotime($data['policy_start_date']))
|
||||
// : null;
|
||||
|
||||
// $data['policy_end_date'] = (isset($data['policy_end_date']) && $data['policy_end_date'] !== null && $data['policy_end_date'] !== '')
|
||||
// ? date('d/m/Y', strtotime($data['policy_end_date']))
|
||||
// : null;
|
||||
|
||||
// $data['renewal_date'] = (isset($data['renewal_date']) && $data['renewal_date'] !== null && $data['renewal_date'] !== '')
|
||||
// ? date('d/m/Y', strtotime($data['renewal_date']))
|
||||
// : null;
|
||||
|
||||
// $data['rollover_date'] = (isset($data['rollover_date']) && $data['rollover_date'] !== null && $data['rollover_date'] !== '')
|
||||
// ? date('d/m/Y', strtotime($data['rollover_date']))
|
||||
// : null;
|
||||
|
||||
|
||||
if(empty($data['policy_issue_date'])){
|
||||
$data['policy_issue_date'] = null;
|
||||
}
|
||||
@ -302,7 +274,7 @@ class PolicyTransactionController extends BaseController
|
||||
// Separate Insurer and TPA Branch IDs and IDs
|
||||
if(isset($data['insurer_id']) && !empty($data['insurer_id'])){
|
||||
list($data['insurer_branch_id'], $data['insurer_id']) = explode('-', $data['insurer_id']);
|
||||
if ($data['tpa']) {
|
||||
if (isset($data['tpa'])) {
|
||||
list($data['tpa_branch_id'], $data['tpa_id']) = explode('-', $data['tpa']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -250,9 +250,10 @@ class TicketController extends BaseController
|
||||
$ticket_data = $this->formatDateForClaim($ticket_data, 'd/m/Y');
|
||||
// dd($ticket_data);
|
||||
$template_data = $this->ticketMasterModel->getTemplateDataByTicketID($ticket_id);
|
||||
$template_data['mail_content'] = $this->replacePlaceholders($template_data['mail_content'], $ticket_data);
|
||||
$template_data['subject'] = $this->replacePlaceholders($template_data['subject'], $ticket_data);
|
||||
|
||||
if(!empty($template_data)){
|
||||
$template_data['mail_content'] = $this->replacePlaceholders($template_data['mail_content'], $ticket_data);
|
||||
$template_data['subject'] = $this->replacePlaceholders($template_data['subject'], $ticket_data);
|
||||
}
|
||||
$data = $this->ticket_form_data($ticket_data['ticket_type_id']);
|
||||
$data['ticket_data'] = $ticket_data;
|
||||
$data['reply_data'] = $template_data;
|
||||
|
||||
@ -50,7 +50,7 @@ table.dataTable tbody td {
|
||||
background-color: #f8f9fa !important;
|
||||
color: #16181b !important;
|
||||
cursor: pointer !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="col-12">
|
||||
@ -82,11 +82,16 @@ table.dataTable tbody td {
|
||||
<td><?php echo $trigger_type[$row['trigger_type']]; ?></td>
|
||||
<td><?=$row['is_auto_mail'] == 1?'Auto':"Manual" ?></td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<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="btn-group dropdown">
|
||||
<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="#" onclick="getMailTemplateData(<?=$row['id']?>)"><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a class="dropdown-item" onclick="deleteTemplate(<?=$row['id']?>)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
<a class="dropdown-item" href="#"
|
||||
onclick="getMailTemplateData(<?=$row['id']?>)"><i
|
||||
class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a class="dropdown-item" onclick="deleteTemplate(<?=$row['id']?>)"><i
|
||||
class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@ -116,19 +121,14 @@ table.dataTable tbody td {
|
||||
<form role="form" class="parsley-examples" method="post" id="ticket_mail_editor_modal"
|
||||
enctype="multipart/form-data" novalidate>
|
||||
<div class="form-group">
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="emp_code">Template Name</label>
|
||||
<input type="text" id="template_name" name="template_name" class="form-control" placeholder="Template Name" required>
|
||||
<input type="text" id="template_name" name="template_name" class="form-control"
|
||||
placeholder="Template Name" required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="template_subject">Subject</label>
|
||||
<input type="text" id="template_subject" name="subject" class="form-control" placeholder="Subject" required>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="emp_code">Policy Type</label>
|
||||
@ -141,10 +141,10 @@ table.dataTable tbody td {
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-2">
|
||||
<label for="trigger_type">Trigger Type</label>
|
||||
<select class="form-control" id="trigger_type" name="trigger_type" required>
|
||||
<option value="">Select status</option>
|
||||
@ -155,46 +155,58 @@ table.dataTable tbody td {
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select> <input id="primaryKey" type="hidden">
|
||||
</select> <input id="primaryKey" type="hidden">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<div>
|
||||
<div id="statusSwitchWrapper" class="dt-switch-wrapper" style="padding-top: 40px;padding-left: 10px;">
|
||||
<div id="statusSwitchWrapper" class="dt-switch-wrapper"
|
||||
style="padding-top: 40px;padding-left: 10px;">
|
||||
<div class="custom-control custom-switch" style="text-align: left;">
|
||||
<input type="checkbox" class="custom-control-input" id="statusSwitch">
|
||||
<label class="custom-control-label" for="statusSwitch">Auto Mail</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="template_subject">Subject</label>
|
||||
<input type="text" id="template_subject" name="subject" class="form-control"
|
||||
placeholder="Subject" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<!-- <textarea class="form-control" rows="5" placeholder="Enter Mail Content"></textarea> -->
|
||||
<div class="form-row" id="rac_rate_dropdown">
|
||||
<div class="form-group col-md-12">
|
||||
<select id="ticket_mail_customButton" class="form-control" style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;">
|
||||
<option value="">PlaceHolders</option>
|
||||
<?php foreach ($placeHolders as $value): ?>
|
||||
<?php // if($value == 'member_name' || $value == 'member_mobile' || $value == 'nhance_logo' || $value == 'client_logo' || $value == 'app_link' || $value == 'client_name'){ ?>member_mobile
|
||||
<?php $valueChange = str_replace('_', ' ', $value); $valueChange = ucwords($valueChange); ?>
|
||||
<option value="[[<?php echo $value; ?>]]"><?php echo $valueChange; ?></option>
|
||||
<?php //} ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<select id="ticket_mail_customButton" class="form-control"
|
||||
style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;">
|
||||
<option value="">PlaceHolders</option>
|
||||
<?php foreach ($placeHolders as $value): ?>
|
||||
<?php // if($value == 'member_name' || $value == 'member_mobile' || $value == 'nhance_logo' || $value == 'client_logo' || $value == 'app_link' || $value == 'client_name'){ ?>member_mobile
|
||||
<?php $valueChange = str_replace('_', ' ', $value); $valueChange = ucwords($valueChange); ?>
|
||||
<option value="[[<?php echo $value; ?>]]"><?php echo $valueChange; ?>
|
||||
</option>
|
||||
<?php //} ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div id="ticket_mail_editor" name="content" style="height: 300px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnGridSubmit_2">Submit</button>
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||
id="btnGridSubmit_2">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@ -237,32 +249,30 @@ $(document).ready(function() {
|
||||
console.error("Table atet found.");
|
||||
}
|
||||
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);
|
||||
const editor = Jodit.make("#ticket_mail_editor", editorConfig);
|
||||
|
||||
let lastActiveField = null;
|
||||
let lastActiveField = null;
|
||||
|
||||
// Track last active input field
|
||||
$("#template_subject").on("focus", function() {
|
||||
// Track last active input field
|
||||
$("#template_subject").on("focus", function() {
|
||||
lastActiveField = this;
|
||||
});
|
||||
|
||||
@ -270,8 +280,8 @@ $("#template_subject").on("focus", function() {
|
||||
editor.events.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();
|
||||
@ -297,7 +307,8 @@ document.addEventListener('change', function(event) {
|
||||
} 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.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;
|
||||
@ -305,22 +316,22 @@ document.addEventListener('change', function(event) {
|
||||
}
|
||||
|
||||
|
||||
$('.close').click(function () {
|
||||
$('#template_subject').val('');
|
||||
$('#template_name').val('');
|
||||
$('#primaryKey').val('');
|
||||
$('#policy_type').val('').change();
|
||||
$('#trigger_type').val('').change();
|
||||
editor.setEditorValue('');
|
||||
$('#primaryKey').val(null);
|
||||
$('#statusSwitch').prop('checked', false);
|
||||
$('.close').click(function() {
|
||||
$('#template_subject').val('');
|
||||
$('#template_name').val('');
|
||||
$('#primaryKey').val('');
|
||||
$('#policy_type').val('').change();
|
||||
$('#trigger_type').val('').change();
|
||||
editor.setEditorValue('');
|
||||
$('#primaryKey').val(null);
|
||||
$('#statusSwitch').prop('checked', false);
|
||||
|
||||
})
|
||||
$('#ticket_mail_editor_modal').submit(function (event) {
|
||||
})
|
||||
$('#ticket_mail_editor_modal').submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
let isValid = true;
|
||||
$('#ticket_mail_editor_modal [required]').each(function () {
|
||||
event.preventDefault();
|
||||
let isValid = true;
|
||||
$('#ticket_mail_editor_modal [required]').each(function() {
|
||||
if (!this.value.trim()) {
|
||||
isValid = false;
|
||||
$(this).addClass('is-invalid'); // Add a red border for visibility
|
||||
@ -333,58 +344,61 @@ $('#ticket_mail_editor_modal').submit(function (event) {
|
||||
toastr.error('Please fill all required fields.', 'Validation Error');
|
||||
return; // Prevent submission
|
||||
}
|
||||
var joditEditor = editor;
|
||||
if (joditEditor)
|
||||
{
|
||||
var mailContent = $(joditEditor.currentPlace.container).find('.jodit-wysiwyg').html();
|
||||
var formData = $(this).serializeArray();
|
||||
formData.push({ name: 'mail_content', value: mailContent });
|
||||
// formData.push({ name: 'client_id', value: $('#general_PrimaryKey').val() });
|
||||
var isAutoMailEnabled = $('#statusSwitch').is(':checked') ? 1 : 0;
|
||||
formData.push({ name: 'is_auto_mail', value: isAutoMailEnabled });
|
||||
var primary_key = $('#primaryKey').val();
|
||||
if (primary_key != null && primary_key != ''){
|
||||
formData.push({ name: 'id', value: primary_key});
|
||||
}
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
var form_action = '<?= base_url("ticket/crud_mail_template/1") ?>';
|
||||
$.ajax({
|
||||
url: form_action,
|
||||
type: "POST",
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(res)
|
||||
{
|
||||
if(res.status == true){
|
||||
$('#new_mail_template').find('.close').click();
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.success('Template saved successfully!', 'Success');
|
||||
location.reload();
|
||||
}else if (res.status == false){
|
||||
toastr.error('Failed to Save Data', 'error');
|
||||
}
|
||||
|
||||
},
|
||||
error: function (xhr, status, error)
|
||||
{
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function()
|
||||
{
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.error('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
var joditEditor = editor;
|
||||
if (joditEditor) {
|
||||
var mailContent = $(joditEditor.currentPlace.container).find('.jodit-wysiwyg').html();
|
||||
var formData = $(this).serializeArray();
|
||||
formData.push({
|
||||
name: 'mail_content',
|
||||
value: mailContent
|
||||
});
|
||||
// formData.push({ name: 'client_id', value: $('#general_PrimaryKey').val() });
|
||||
var isAutoMailEnabled = $('#statusSwitch').is(':checked') ? 1 : 0;
|
||||
formData.push({
|
||||
name: 'is_auto_mail',
|
||||
value: isAutoMailEnabled
|
||||
});
|
||||
var primary_key = $('#primaryKey').val();
|
||||
if (primary_key != null && primary_key != '') {
|
||||
formData.push({
|
||||
name: 'id',
|
||||
value: primary_key
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
console.error("Jodit editor instance is not defined.");
|
||||
}
|
||||
})
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
var form_action = '<?= base_url("ticket/crud_mail_template/1") ?>';
|
||||
$.ajax({
|
||||
url: form_action,
|
||||
type: "POST",
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
if (res.status == true) {
|
||||
$('#new_mail_template').find('.close').click();
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.success('Template saved successfully!', 'Success');
|
||||
location.reload();
|
||||
} else if (res.status == false) {
|
||||
toastr.error('Failed to Save Data', 'error');
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.error('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.error("Jodit editor instance is not defined.");
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
@ -393,9 +407,11 @@ function openModal() {
|
||||
myModal.show();
|
||||
}
|
||||
|
||||
function deleteTemplate(id){
|
||||
const url = '<?= base_url("ticket/crud_mail_template/3") ?>';
|
||||
const data = { id: id }; // Ensure data is passed as an object
|
||||
function deleteTemplate(id) {
|
||||
const url = '<?= base_url("ticket/crud_mail_template/3") ?>';
|
||||
const data = {
|
||||
id: id
|
||||
}; // Ensure data is passed as an object
|
||||
|
||||
Swal.fire({
|
||||
title: "Are you sure?",
|
||||
@ -437,13 +453,16 @@ function deleteTemplate(id){
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getMailTemplateData(id) {
|
||||
const template_name = 'new_mail_template';
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var form_action = '<?= base_url("ticket/crud_mail_template/2") ?>';
|
||||
var data = { id: id };
|
||||
var form_action = '<?= base_url("ticket/crud_mail_template/2") ?>';
|
||||
var data = {
|
||||
id: id
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: form_action,
|
||||
@ -454,15 +473,15 @@ function getMailTemplateData(id) {
|
||||
if (res) {
|
||||
if (res.status == true) {
|
||||
// Open the modal
|
||||
openModal();
|
||||
openModal();
|
||||
|
||||
// Populate the form fields
|
||||
$('#template_subject').val(res.data.subject);
|
||||
$('#template_name').val(res.data.template_name);
|
||||
$('#template_name').val(res.data.template_name);
|
||||
$('#primaryKey').val(res.data.id);
|
||||
$('#policy_type').val(res.data.ticket_type).change();
|
||||
$('#trigger_type').val(res.data.ticket_type).change();
|
||||
$('.jodit-wysiwyg').html(res.data.mail_content);
|
||||
$('.jodit-wysiwyg').html(res.data.mail_content);
|
||||
|
||||
// Set the auto mail switch
|
||||
if (res.data.is_auto_mail == 1) {
|
||||
@ -486,7 +505,7 @@ function getMailTemplateData(id) {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
@ -497,27 +516,24 @@ function getMailTemplateData(id) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
<script>
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const table = document.getElementById("scroll-horizontal-datatable");
|
||||
|
||||
|
||||
// Create custom dropdown
|
||||
function createCustomDropdown(row) {
|
||||
// Get the original dropdown items
|
||||
const originalDropdown = row.querySelector('.dropdown-menu');
|
||||
if (!originalDropdown) return null;
|
||||
|
||||
|
||||
// Create new dropdown with proper background and spacing
|
||||
const customDropdown = document.createElement('div');
|
||||
customDropdown.className = 'custom-dropdown-menu';
|
||||
|
||||
|
||||
// Copy inner content while maintaining icon alignment
|
||||
customDropdown.innerHTML = originalDropdown.innerHTML;
|
||||
|
||||
|
||||
return customDropdown;
|
||||
}
|
||||
|
||||
@ -527,7 +543,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
table.querySelectorAll("tbody tr").forEach(row => {
|
||||
const customDropdown = createCustomDropdown(row);
|
||||
if (!customDropdown) return;
|
||||
|
||||
|
||||
document.body.appendChild(customDropdown);
|
||||
|
||||
row.addEventListener("click", function(event) {
|
||||
@ -543,16 +559,16 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
|
||||
// Get click position
|
||||
const rect = event.target.getBoundingClientRect();
|
||||
|
||||
|
||||
// Position the dropdown with some offset
|
||||
customDropdown.style.display = 'block';
|
||||
customDropdown.style.position = 'fixed';
|
||||
customDropdown.style.left = `${rect.left}px`;
|
||||
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
|
||||
|
||||
|
||||
// Set as active dropdown
|
||||
activeDropdown = customDropdown;
|
||||
|
||||
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
@ -563,7 +579,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
if (onclickAttr) {
|
||||
eval(onclickAttr);
|
||||
}
|
||||
|
||||
|
||||
const href = this.getAttribute('href');
|
||||
if (href && href !== '#') {
|
||||
window.location.href = href;
|
||||
@ -574,7 +590,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
}
|
||||
|
||||
|
||||
e.stopPropagation();
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user