Add Activity log Service and model

This commit is contained in:
2026-08-01 15:41:26 +05:30
parent 2d7d146ec3
commit e98e1422a0
6 changed files with 350 additions and 43 deletions

View File

@@ -168,6 +168,12 @@
<i class="bi bi-speedometer2 me-2"></i> Dashboard
</a>
</li>
<li>
<a class="dropdown-item" href="{{ url_for('activity.activity') }}">
<i class="bi bi-clock-history me-2"></i>
Activity Log
</a>
</li>
<li>
<a class="dropdown-item text-warning" href="/logout">
@@ -188,8 +194,7 @@
<!-- PAGE CONTENT -->
<div class="container-fluid vh-100 pt-5 overflow-hidden">
<!-- FLASH MESSAGES -->
<div class="position-fixed top-0 end-0 p-2 p-md-3 mt-5"
style="z-index:1080; width:min(95vw,500px);">
<div class="position-fixed top-0 end-0 p-2 p-md-3 mt-5" style="z-index:1080; width:min(95vw,500px);">
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
@@ -230,17 +235,13 @@
<!-- Timeline -->
<div class="progress mt-2" style="height:5px;">
<div class="progress-bar progress-bar-striped progress-bar-animated timer-bar"
role="progressbar"
style="width:100%">
<div class="progress-bar progress-bar-striped progress-bar-animated timer-bar" role="progressbar" style="width:100%">
</div>
</div>
</div>
</div>
<button type="button"
class="btn-close"
data-bs-dismiss="alert">
<button type="button" class="btn-close" data-bs-dismiss="alert">
</button>
</div>
@@ -298,80 +299,54 @@
<script src="https://cdn.jsdelivr.net/npm/bootstrap-multiselect@1.1.2/dist/js/bootstrap-multiselect.min.js"></script>
<script>
// show alert msg
document.addEventListener("DOMContentLoaded", function () {
document.querySelectorAll(".notification-alert").forEach(function(alert){
const progressBar = alert.querySelector(".timer-bar");
let width = 100;
const interval = setInterval(function() {
width -= 2;
progressBar.style.width = width + "%";
if(width <= 0){
clearInterval(interval);
const bsAlert = bootstrap.Alert.getOrCreateInstance(alert);
bsAlert.close();
}
}, 100);
});
});
// New
// show msg Processing your request
function showLoader(message = "Processing your request...") {
document.getElementById("loaderMessage").innerHTML = message;
document.getElementById("globalLoader").classList.remove("d-none");
}
// Automatically hide
function hideLoader(){
document.getElementById("globalLoader").classList.add("d-none");
}
// Automatically apply to all forms having class="loading-form"
document.addEventListener("DOMContentLoaded", function () {
document.querySelectorAll(".loading-form").forEach(function(form){
form.addEventListener("submit", function(){
if(!this.checkValidity())
return;
showLoader();
const btn = this.querySelector("button[type='submit']");
if(btn){
btn.disabled = true;
btn.innerHTML = `
<span class="spinner-border spinner-border-sm me-2"></span>
Processing...
`;
}
});
});
});
</script>