more modifications

This commit is contained in:
Flatlogic Bot 2026-02-02 03:53:32 +00:00
parent 8ac308c73f
commit c2bd9dc53c
9 changed files with 235 additions and 37 deletions

View File

@ -296,6 +296,8 @@ JAZZMIN_SETTINGS = {
"use_google_fonts_cdn": True,
"show_ui_builder": False,
"language_chooser": True,
"changeform_format": "horizontal_tabs",
"changeform_format_overrides": {"core.platformprofile": "vertical_tabs"}
}
JAZZMIN_UI_TWEAKS = {

View File

@ -201,6 +201,11 @@ class ParcelAdmin(admin.ModelAdmin):
export_pdf.short_description = _("Download Selected as PDF")
class PlatformProfileAdmin(admin.ModelAdmin):
class Media:
js = ("js/admin_platform_profile.js",)
css = {
"all": ("css/admin_platform_profile.css",)
}
fieldsets = (
(_('General Info'), {
'fields': ('name', 'logo', 'favicon', 'admin_panel_logo', 'slogan', 'address', 'phone_number', 'registration_number', 'vat_number')

View File

@ -84,46 +84,47 @@
<label class="text-muted small text-uppercase">{% trans "Preferred Language" %}</label>
<p class="fw-semibold">{{ profile.get_language_display }}</p>
</div>
{% if profile.role == 'car_owner' %}
<hr class="my-5">
{% if profile.role == 'car_owner' %}
<div class="mb-4">
<h4 class="fw-bold">{% trans "Driver Rating" %}</h4>
<div class="d-flex align-items-center mb-3">
<div class="display-4 fw-bold me-3">{{ profile.get_average_rating|default:"0.0"|floatformat:1 }}</div>
<div>
<div class="text-warning fs-5">
<i class="fas fa-star"></i>
</div>
<div class="text-muted small">
{{ profile.get_rating_count }} {% trans "reviews" %}
</div>
</div>
</div>
</div> <!-- row g-4 end -->
{% if reviews %}
<div class="list-group list-group-flush">
{% for review in reviews %}
<div class="list-group-item px-0 py-3">
<div class="d-flex justify-content-between align-items-center mb-2">
<div>
<span class="fw-bold">{{ review.shipper.first_name }}</span>
<small class="text-muted ms-2">{{ review.created_at|date:"M d, Y" }}</small>
</div>
<div class="text-warning">
{{ review.rating }} <i class="fas fa-star small"></i>
</div>
{% if profile.role == 'car_owner' %}
<hr class="my-5">
<div class="mb-4">
<h4 class="fw-bold">{% trans "Driver Rating" %}</h4>
<div class="d-flex align-items-center mb-3">
<div class="display-4 fw-bold me-3">{{ profile.get_average_rating|default:"0.0"|floatformat:1 }}</div>
<div>
<div class="text-warning fs-5">
<i class="fas fa-star"></i>
</div>
<div class="text-muted small">
{{ profile.get_rating_count }} {% trans "reviews" %}
</div>
{% if review.comment %}
<p class="mb-0 text-muted">{{ review.comment }}</p>
{% endif %}
</div>
{% endfor %}
</div>
{% else %}
<p class="text-muted">{% trans "No reviews yet." %}</p>
{% endif %}
</div>
{% if reviews %}
<div class="list-group list-group-flush">
{% for review in reviews %}
<div class="list-group-item px-0 py-3">
<div class="d-flex justify-content-between align-items-center mb-2">
<div>
<span class="fw-bold">{{ review.shipper.first_name }}</span>
<small class="text-muted ms-2">{{ review.created_at|date:"M d, Y" }}</small>
</div>
<div class="text-warning">
{{ review.rating }} <i class="fas fa-star small"></i>
</div>
</div>
{% if review.comment %}
<p class="mb-0 text-muted">{{ review.comment }}</p>
{% endif %}
</div>
{% endfor %}
</div>
{% else %}
<p class="text-muted">{% trans "No reviews yet." %}</p>
{% endif %}
</div>
{% endif %}
</div>
@ -141,4 +142,4 @@
border-radius: 8px;
}
</style>
{% endblock %}
{% endblock %}

View File

@ -0,0 +1,44 @@
/* Custom sidebar-like styling for vertical tabs in Platform Profile */
.col-sm-3 .nav-pills.flex-column {
background: #f8f9fa;
border-radius: 8px;
padding: 10px;
border: 1px solid #dee2e6;
}
.col-sm-3 .nav-pills.flex-column .nav-link {
color: #495057;
margin-bottom: 5px;
border-radius: 6px;
transition: all 0.2s ease;
padding: 12px 15px;
font-weight: 500;
}
.col-sm-3 .nav-pills.flex-column .nav-link:hover {
background-color: #e9ecef;
color: #007bff;
}
.col-sm-3 .nav-pills.flex-column .nav-link.active {
background-color: #007bff;
color: #fff;
box-shadow: 0 4px 6px rgba(0, 123, 255, 0.2);
}
.col-sm-3 .nav-pills.flex-column .nav-link i {
font-size: 1.1rem;
vertical-align: middle;
}
/* Adjust the main content area */
.col-sm-9 {
padding-left: 20px;
}
.card-primary.card-outline {
border-top: 3px solid #007bff;
border-radius: 8px;
box-shadow: 0 0 1px rgba(0,0,0,.125), 0 1px 3px rgba(0,0,0,.2);
}

View File

@ -0,0 +1,51 @@
document.addEventListener('DOMContentLoaded', function() {
const iconMap = {
'General Info': 'fas fa-info-circle',
'Financial Configuration': 'fas fa-money-bill-wave',
'Maintenance / Availability': 'fas fa-tools',
'Driver Warning & Rejection / Auto-Ban': 'fas fa-user-slash',
'Testing / Development': 'fas fa-flask',
'Integrations': 'fas fa-plug',
'Policies': 'fas fa-file-contract',
'WhatsApp Configuration (Wablas Gateway)': 'fab fa-whatsapp',
'Tools': 'fas fa-wrench'
};
const iconMapAr = {
'معلومات عامة': 'fas fa-info-circle',
'التكوين المالي': 'fas fa-money-bill-wave',
'الصيانة / التوفر': 'fas fa-tools',
'تحذير السائق ورفضه / الحظر التلقائي': 'fas fa-user-slash',
'الاختبار / التطوير': 'fas fa-flask',
'التكاملات': 'fas fa-plug',
'السياسات': 'fas fa-file-contract',
'تكوين واتساب (بوابة وابلأس)': 'fab fa-whatsapp',
'أدوات': 'fas fa-wrench'
};
const fullIconMap = {...iconMap, ...iconMapAr};
function applyIcons() {
const tabs = document.querySelectorAll('.nav-link');
tabs.forEach(tab => {
// Check if icon already exists
if (tab.querySelector('i.fas, i.fab')) return;
const text = tab.textContent.trim();
for (const [key, icon] of Object.entries(fullIconMap)) {
if (text.includes(key)) {
const i = document.createElement('i');
i.className = icon + ' mr-2';
i.style.width = '20px';
i.style.textAlign = 'center';
tab.prepend(i);
break;
}
}
});
}
applyIcons();
// Sometimes jazzmin loads tabs dynamically or with a delay
setTimeout(applyIcons, 500);
});

View File

@ -0,0 +1,44 @@
/* Custom sidebar-like styling for vertical tabs in Platform Profile */
.col-sm-3 .nav-pills.flex-column {
background: #f8f9fa;
border-radius: 8px;
padding: 10px;
border: 1px solid #dee2e6;
}
.col-sm-3 .nav-pills.flex-column .nav-link {
color: #495057;
margin-bottom: 5px;
border-radius: 6px;
transition: all 0.2s ease;
padding: 12px 15px;
font-weight: 500;
}
.col-sm-3 .nav-pills.flex-column .nav-link:hover {
background-color: #e9ecef;
color: #007bff;
}
.col-sm-3 .nav-pills.flex-column .nav-link.active {
background-color: #007bff;
color: #fff;
box-shadow: 0 4px 6px rgba(0, 123, 255, 0.2);
}
.col-sm-3 .nav-pills.flex-column .nav-link i {
font-size: 1.1rem;
vertical-align: middle;
}
/* Adjust the main content area */
.col-sm-9 {
padding-left: 20px;
}
.card-primary.card-outline {
border-top: 3px solid #007bff;
border-radius: 8px;
box-shadow: 0 0 1px rgba(0,0,0,.125), 0 1px 3px rgba(0,0,0,.2);
}

View File

@ -0,0 +1,51 @@
document.addEventListener('DOMContentLoaded', function() {
const iconMap = {
'General Info': 'fas fa-info-circle',
'Financial Configuration': 'fas fa-money-bill-wave',
'Maintenance / Availability': 'fas fa-tools',
'Driver Warning & Rejection / Auto-Ban': 'fas fa-user-slash',
'Testing / Development': 'fas fa-flask',
'Integrations': 'fas fa-plug',
'Policies': 'fas fa-file-contract',
'WhatsApp Configuration (Wablas Gateway)': 'fab fa-whatsapp',
'Tools': 'fas fa-wrench'
};
const iconMapAr = {
'معلومات عامة': 'fas fa-info-circle',
'التكوين المالي': 'fas fa-money-bill-wave',
'الصيانة / التوفر': 'fas fa-tools',
'تحذير السائق ورفضه / الحظر التلقائي': 'fas fa-user-slash',
'الاختبار / التطوير': 'fas fa-flask',
'التكاملات': 'fas fa-plug',
'السياسات': 'fas fa-file-contract',
'تكوين واتساب (بوابة وابلأس)': 'fab fa-whatsapp',
'أدوات': 'fas fa-wrench'
};
const fullIconMap = {...iconMap, ...iconMapAr};
function applyIcons() {
const tabs = document.querySelectorAll('.nav-link');
tabs.forEach(tab => {
// Check if icon already exists
if (tab.querySelector('i.fas, i.fab')) return;
const text = tab.textContent.trim();
for (const [key, icon] of Object.entries(fullIconMap)) {
if (text.includes(key)) {
const i = document.createElement('i');
i.className = icon + ' mr-2';
i.style.width = '20px';
i.style.textAlign = 'center';
tab.prepend(i);
break;
}
}
});
}
applyIcons();
// Sometimes jazzmin loads tabs dynamically or with a delay
setTimeout(applyIcons, 500);
});