diff --git a/templates/main/instance_detail.html b/templates/main/instance_detail.html
index 240ed62..ab733e6 100644
--- a/templates/main/instance_detail.html
+++ b/templates/main/instance_detail.html
@@ -93,6 +93,16 @@
Contacts
+
+
+
+
+
+
@@ -170,6 +180,7 @@
Phone |
Company |
Position |
+ Role |
Status |
Actions |
@@ -182,6 +193,115 @@
+
+
+
+
+
+
+
+
+
Activity Log
+
+
+
+
+
+
+
+
+
+
+
+
+ | Timestamp |
+ Event Type |
+ User |
+ IP Address |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Mail Log
+
+
+
+
+
+
+
+
+
+
+
+
+ | Created At |
+ Recipient |
+ Subject |
+ Sent At |
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -318,6 +438,36 @@
+
+
+
+
+
+
{% endblock %}
{% block extra_js %}
@@ -461,22 +611,17 @@ async function fetchCompanyInfo() {
// Update company name separately with debugging
const companyNameElement = document.getElementById('company-name-value');
const companyNameLabel = document.getElementById('company-name-label');
- console.log('Before update - Label:', companyNameLabel?.textContent);
- console.log('Before update - Value:', companyNameElement?.textContent);
+
+ // Ensure label text is set and maintained
+ if (companyNameLabel) {
+ companyNameLabel.textContent = 'Company Name:';
+ }
if (companyNameElement) {
companyNameElement.textContent = data.company_name || 'Not set';
}
- // Ensure label text is set
- if (companyNameLabel && !companyNameLabel.textContent) {
- companyNameLabel.textContent = 'Company Name:';
- }
-
- console.log('After update - Label:', companyNameLabel?.textContent);
- console.log('After update - Value:', companyNameElement?.textContent);
-
- // Update company details
+ // Update other company details
const updateElement = (id, value) => {
const element = document.getElementById(id);
if (element && element.classList.contains('company-value')) {
@@ -594,7 +739,6 @@ window.addEventListener('beforeunload', function() {
async function fetchContacts() {
try {
// First get JWT token
- console.log('Getting management token for contacts...');
const tokenResponse = await fetch(`{{ instance.main_url }}/api/admin/management-token`, {
method: 'POST',
headers: {
@@ -612,7 +756,6 @@ async function fetchContacts() {
throw new Error('No token received');
}
- // Then fetch contacts using the JWT token
const response = await fetch(`{{ instance.main_url }}/api/admin/contacts`, {
headers: {
'Accept': 'application/json',
@@ -628,29 +771,44 @@ async function fetchContacts() {
const contactsList = document.getElementById('contactsTableBody');
contactsList.innerHTML = '';
- if (contacts.length === 0) {
- contactsList.innerHTML = `
-
- `;
- return;
- }
-
contacts.forEach(contact => {
const row = document.createElement('tr');
+
+ // Role badge color mapping
+ const roleBadgeClass = {
+ 'admin': 'bg-danger',
+ 'manager': 'bg-warning',
+ 'user': 'bg-info'
+ }[contact.role] || 'bg-secondary';
+
+ // Status badge color mapping
+ const statusBadgeClass = contact.is_active ? 'bg-success' : 'bg-secondary';
+
+ // Format phone number for tel: link (remove any non-digit characters)
+ const phoneNumber = contact.phone ? contact.phone.replace(/\D/g, '') : '';
+
row.innerHTML = `
- ${contact.username} |
- ${contact.email || 'Not set'} |
- ${contact.phone || 'Not set'} |
- ${contact.company || 'Not set'} |
- ${contact.position || 'Not set'} |
+ ${contact.username} ${contact.last_name} |
-
- ${contact.is_active ? 'Active' : 'Inactive'}
-
+
+
+ ${contact.email}
+
+
|
+
+ ${contact.phone ? `
+
+
+ ${contact.phone}
+
+
+ ` : '-'}
+ |
+ ${contact.company || '-'} |
+ ${contact.position || '-'} |
+ ${contact.role.charAt(0).toUpperCase() + contact.role.slice(1)} |
+ ${contact.is_active ? 'Active' : 'Inactive'} |
|