Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
3dac83280d
@ -215,8 +215,7 @@ table.dataTable tbody td {
|
|||||||
</a>
|
</a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<a href="javascript:void(0);"
|
<a class="dropdown-item btnHistory app-text-black"
|
||||||
class="dropdown-item btnHistory app-text-black"
|
|
||||||
data-id="<?= $row['id']; ?>"
|
data-id="<?= $row['id']; ?>"
|
||||||
title="Click to view Mail History">
|
title="Click to view Mail History">
|
||||||
<i class="mdi mdi-history mr-2 text-muted font-18 vertical-middle"></i>Email History
|
<i class="mdi mdi-history mr-2 text-muted font-18 vertical-middle"></i>Email History
|
||||||
@ -344,6 +343,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
// Handle clicks on dropdown items
|
// Handle clicks on dropdown items
|
||||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||||
item.addEventListener('click', function(e) {
|
item.addEventListener('click', function(e) {
|
||||||
|
console.log("##############");
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
@ -358,7 +358,13 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
if (id) {
|
if (id) {
|
||||||
getLeadsDataForEdit(id, lead_form_type);
|
getLeadsDataForEdit(id, lead_form_type);
|
||||||
}
|
}
|
||||||
}else{
|
}else if (this.classList.contains('btnHistory')) {
|
||||||
|
let lead_id = this.getAttribute('data-id');
|
||||||
|
if(lead_id){ console.log("******** Clicked from td lead_id-", lead_id); getLeadsDataForMailHistory(lead_id); }
|
||||||
|
else{ console.log("******** Clicked from td but i don`t have lead_id"); }
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
const onclickAttr = this.getAttribute('onclick');
|
const onclickAttr = this.getAttribute('onclick');
|
||||||
if (onclickAttr) {
|
if (onclickAttr) {
|
||||||
eval(onclickAttr);
|
eval(onclickAttr);
|
||||||
@ -387,6 +393,16 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
activeDropdown = null;
|
activeDropdown = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
document.addEventListener("click", function(e) {
|
||||||
|
if (e.target.closest(".btnHistory")) {
|
||||||
|
let lead_id = e.target.closest(".btnHistory").dataset.id;
|
||||||
|
console.log("******** in triple dot id available - " + lead_id);
|
||||||
|
getLeadsDataForMailHistory(lead_id);
|
||||||
|
}
|
||||||
|
else{ console.log("******** in triple dot but id not available"); }
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -462,25 +478,21 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
window.location.href = url;
|
window.location.href = url;
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
|
||||||
|
|
||||||
<script>
|
function getLeadsDataForMailHistory(lead_id){
|
||||||
document.addEventListener("click", function(e) {
|
|
||||||
if (e.target.closest(".btnHistory")) {
|
console.log("******** Inside Fnz :", lead_id);
|
||||||
let lead_id = e.target.closest(".btnHistory").dataset.id;
|
|
||||||
console.log("*********" + lead_id);
|
|
||||||
let url = '<?= base_url('/util/getLeadEmailHistory/') ?>' + lead_id;
|
let url = '<?= base_url('/util/getLeadEmailHistory/') ?>' + lead_id;
|
||||||
console.log("*********" + url);
|
console.log("******** Fetching:", url);
|
||||||
fetch('<?= base_url('/util/getLeadEmailHistory/') ?>' + lead_id, {
|
|
||||||
|
fetch(url, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: { "Accept": "application/json" }
|
||||||
"Accept": "application/json"
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(response => {
|
.then(response => {
|
||||||
let container = document.querySelector(".history-container");
|
let container = document.querySelector(".history-container");
|
||||||
container.innerHTML = ""; // clear old content
|
container.innerHTML = "";
|
||||||
if (response.status === "success" && response.data.length > 0) {
|
if (response.status === "success" && response.data.length > 0) {
|
||||||
console.log("******** 1" + response.status);
|
console.log("******** 1" + response.status);
|
||||||
let table = `
|
let table = `
|
||||||
@ -576,24 +588,24 @@ document.addEventListener("click", function(e) {
|
|||||||
|
|
||||||
table += `</tbody></table>`;
|
table += `</tbody></table>`;
|
||||||
container.innerHTML = table;
|
container.innerHTML = table;
|
||||||
|
// show modal (if using Bootstrap 5)
|
||||||
} else {
|
} else {
|
||||||
console.log("******** 2" + response.status);
|
|
||||||
container.innerHTML = `
|
container.innerHTML = `
|
||||||
<div class="d-flex justify-content-center align-items-center" style="height: 50vh; width:100%;">
|
<div class="d-flex justify-content-center align-items-center" style="height: 50vh; width:100%;">
|
||||||
<p class="text-center"><i>${response.message ?? 'No history found'}</i></p>
|
<p class="text-center font-color-black"><i>${response.message ?? "No History Available"}</i></p>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
// Show modal always
|
||||||
|
new bootstrap.Modal(document.getElementById("EmailModal")).show();
|
||||||
|
|
||||||
// show modal (if using Bootstrap 5)
|
|
||||||
let EmailModal = new bootstrap.Modal(document.getElementById("EmailModal"));
|
|
||||||
EmailModal.show();
|
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.log("******** 3" + error);
|
console.log("******** 3" + error);
|
||||||
document.querySelector(".history-container").innerHTML = `
|
document.querySelector(".history-container").innerHTML = `
|
||||||
<div class="d-flex justify-content-center align-items-center" style="height: 50vh; width:100%;">
|
<div class="d-flex justify-content-center align-items-center" style="height: 50vh; width:100%;">
|
||||||
<p class="text-center"><i>No Data Found</i></p>
|
<p class="text-center font-color-black"><i>No Data Found</i></p>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
let EmailModal = new bootstrap.Modal(document.getElementById("EmailModal"));
|
let EmailModal = new bootstrap.Modal(document.getElementById("EmailModal"));
|
||||||
@ -601,7 +613,6 @@ document.addEventListener("click", function(e) {
|
|||||||
console.error(error);
|
console.error(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user