This commit is contained in:
Marwan Alwali 2025-08-30 16:13:37 +03:00
parent be70e47e22
commit d1cee9194e
8 changed files with 1463 additions and 101 deletions

View File

@ -36,9 +36,9 @@ urlpatterns = [
# System Configuration CRUD URLs
path('system-configuration/create/', views.SystemConfigurationCreateView.as_view(), name='system_configuration_create'),
path('system-configuration/<uuid:pk>/', views.SystemConfigurationDetailView.as_view(), name='system_configuration_detail'),
path('system-configuration/<uuid:pk>/edit/', views.SystemConfigurationUpdateView.as_view(), name='system_configuration_update'),
path('system-configuration/<uuid:pk>/delete/', views.SystemConfigurationDeleteView.as_view(), name='system_configuration_delete'),
path('system-configuration/<int:pk>/', views.SystemConfigurationDetailView.as_view(), name='system_configuration_detail'),
path('system-configuration/<int:pk>/edit/', views.SystemConfigurationUpdateView.as_view(), name='system_configuration_update'),
path('system-configuration/<int:pk>/delete/', views.SystemConfigurationDeleteView.as_view(), name='system_configuration_delete'),
path('api/department-hierarchy/', views.get_department_hierarchy, name='get_department_hierarchy'),
path('htmx/department-tree/', views.department_tree, name='department_tree'),

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -340,7 +340,7 @@ class ImagingOrderDetailView(LoginRequiredMixin, DetailView):
"""
model = ImagingOrder
template_name = 'radiology/orders/imaging_order_detail.html'
context_object_name = 'imaging_order'
context_object_name = 'order'
def get_queryset(self):
return ImagingOrder.objects.filter(tenant=self.request.user.tenant)
@ -358,7 +358,7 @@ class ImagingOrderDetailView(LoginRequiredMixin, DetailView):
# for study in studies:
study_reports = RadiologyReport.objects.filter(
study=studies.first,
# tenant=self.request.user.tenant
study__tenant=self.request.user.tenant
).order_by('-created_at')
# reports[study.id] = study_reports

View File

@ -3,6 +3,53 @@
{% block title %}System Configuration - {{ block.super }}{% endblock %}
{% block css %}
<style>
.config-key {
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
font-size: 0.9rem;
color: #495057;
background: #f8f9fa;
padding: 0.25rem 0.5rem;
border-radius: 0.25rem;
border: 1px solid #dee2e6;
}
.config-value {
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
font-size: 0.9rem;
white-space: pre-wrap;
word-break: break-all;
}
.config-item {
transition: all 0.2s ease;
}
.config-item:hover {
background-color: rgba(0, 0, 0, 0.02) !important;
}
.bg-warning-subtle {
background-color: #fff3cd !important;
}
.badge {
font-size: 0.75rem;
}
@media (max-width: 768px) {
.config-item .row {
flex-direction: column;
}
.config-item .col-lg-3,
.config-item .col-lg-6 {
margin-bottom: 1rem;
}
}
</style>
{% endblock %}
{% block content %}
<div class="container-fluid">
<!-- Page Header -->
@ -34,9 +81,9 @@
<i class="fas fa-undo me-2"></i>Reset to Defaults
</a></li>
</ul>
<button type="button" class="btn btn-primary" onclick="addConfiguration()">
<a href="{% url 'core:system_configuration_create' %}" type="button" class="btn btn-primary">
<i class="fas fa-plus me-2"></i>Add Configuration
</button>
</a>
</div>
</div>
@ -157,18 +204,18 @@
<div class="col-lg-3">
<div class="d-flex justify-content-end mb-2">
{% if not config.is_readonly %}
<button class="btn btn-sm btn-outline-primary me-1"
onclick="editConfiguration('{{ config.id }}')"
<a href="{% url 'core:system_configuration_update' config.id %}" class="btn btn-sm btn-outline-primary me-1"
{# onclick="editConfiguration('{{ config.id }}')"#}
title="Edit Configuration">
<i class="fas fa-edit"></i>
</button>
</a>
{% endif %}
<button class="btn btn-sm btn-outline-info me-1"
onclick="viewConfigDetails('{{ config.id }}')"
<a href="{% url 'core:system_configuration_detail' config.id %}" class="btn btn-sm btn-outline-info me-1"
{# onclick="viewConfigDetails('{{ config.id }}')"#}
title="View Details">
<i class="fas fa-info-circle"></i>
</button>
</a>
{% if config.validation_rules %}
<button class="btn btn-sm btn-outline-secondary"
@ -298,33 +345,33 @@ function clearFilters() {
filterConfigurations();
}
function editConfiguration(configId) {
// Load configuration edit form
fetch(`/core/configurations/${configId}/edit/`)
.then(response => response.text())
.then(html => {
document.getElementById('configModalBody').innerHTML = html;
new bootstrap.Modal(document.getElementById('configModal')).show();
})
.catch(error => {
console.error('Error loading configuration:', error);
alert('Error loading configuration details');
});
}
function viewConfigDetails(configId) {
// Load configuration details
fetch(`/core/configurations/${configId}/`)
.then(response => response.text())
.then(html => {
document.getElementById('configModalBody').innerHTML = html;
new bootstrap.Modal(document.getElementById('configModal')).show();
})
.catch(error => {
console.error('Error loading configuration:', error);
alert('Error loading configuration details');
});
}
{#function editConfiguration(configId) {#}
{# // Load configuration edit form#}
{# fetch(`/core/configurations/${configId}/edit/`)#}
{# .then(response => response.text())#}
{# .then(html => {#}
{# document.getElementById('configModalBody').innerHTML = html;#}
{# new bootstrap.Modal(document.getElementById('configModal')).show();#}
{# })#}
{# .catch(error => {#}
{# console.error('Error loading configuration:', error);#}
{# alert('Error loading configuration details');#}
{# });#}
{# }#}
{##}
{#function viewConfigDetails(configId) {#}
{# // Load configuration details#}
{# fetch(`/en/system-configuration/${configId}/`)#}
{# .then(response => response.text())#}
{# .then(html => {#}
{# document.getElementById('configModalBody').innerHTML = html;#}
{# new bootstrap.Modal(document.getElementById('configModal')).show();#}
{# })#}
{# .catch(error => {#}
{# console.error('Error loading configuration:', error);#}
{# alert('Error loading configuration details');#}
{# });#}
{# }#}
function showValidationRules(configId) {
const validationElement = document.getElementById(`validation-${configId}`);
@ -333,19 +380,19 @@ function showValidationRules(configId) {
}
}
function addConfiguration() {
// Load new configuration form
fetch('/core/configurations/add/')
.then(response => response.text())
.then(html => {
document.getElementById('configModalBody').innerHTML = html;
new bootstrap.Modal(document.getElementById('configModal')).show();
})
.catch(error => {
console.error('Error loading form:', error);
alert('Error loading configuration form');
});
}
{#function addConfiguration() {#}
{# // Load new configuration form#}
{# fetch('/core/configurations/add/')#}
{# .then(response => response.text())#}
{# .then(html => {#}
{# document.getElementById('configModalBody').innerHTML = html;#}
{# new bootstrap.Modal(document.getElementById('configModal')).show();#}
{# })#}
{# .catch(error => {#}
{# console.error('Error loading form:', error);#}
{# alert('Error loading configuration form');#}
{# });#}
{# }#}
function exportConfigurations() {
const categoryFilter = document.getElementById('categoryFilter').value;
@ -413,50 +460,6 @@ document.addEventListener('keydown', function(e) {
});
</script>
<style>
.config-key {
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
font-size: 0.9rem;
color: #495057;
background: #f8f9fa;
padding: 0.25rem 0.5rem;
border-radius: 0.25rem;
border: 1px solid #dee2e6;
}
.config-value {
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
font-size: 0.9rem;
white-space: pre-wrap;
word-break: break-all;
}
.config-item {
transition: all 0.2s ease;
}
.config-item:hover {
background-color: rgba(0, 0, 0, 0.02) !important;
}
.bg-warning-subtle {
background-color: #fff3cd !important;
}
.badge {
font-size: 0.75rem;
}
@media (max-width: 768px) {
.config-item .row {
flex-direction: column;
}
.config-item .col-lg-3,
.config-item .col-lg-6 {
margin-bottom: 1rem;
}
}
</style>
{% endblock %}

View File

@ -187,7 +187,8 @@
<i class="fa fa-plus me-2"></i>Add Configuration Setting
</a>
</div>
{% endregroup %}
{% endfor %}
</div>
</div>
<!-- END panel -->
@ -231,9 +232,7 @@
</div>
</div>
</div>
{% endblock %}
{% block js %}
<script>
function filterByCategory(category) {
// Update active button
@ -311,5 +310,5 @@ $(document).ready(function() {
});
});
</script>
{% endblock %}
{% endblock content %}