diff --git a/osinaweb/billing/__pycache__/models.cpython-312.pyc b/osinaweb/billing/__pycache__/models.cpython-312.pyc index 494d1f7a..df55ae31 100644 Binary files a/osinaweb/billing/__pycache__/models.cpython-312.pyc and b/osinaweb/billing/__pycache__/models.cpython-312.pyc differ diff --git a/osinaweb/billing/add/__pycache__/urls.cpython-312.pyc b/osinaweb/billing/add/__pycache__/urls.cpython-312.pyc index e33f922c..806d9875 100644 Binary files a/osinaweb/billing/add/__pycache__/urls.cpython-312.pyc and b/osinaweb/billing/add/__pycache__/urls.cpython-312.pyc differ diff --git a/osinaweb/billing/add/__pycache__/views.cpython-312.pyc b/osinaweb/billing/add/__pycache__/views.cpython-312.pyc index 852b6921..cf57796e 100644 Binary files a/osinaweb/billing/add/__pycache__/views.cpython-312.pyc and b/osinaweb/billing/add/__pycache__/views.cpython-312.pyc differ diff --git a/osinaweb/customercore/__pycache__/views.cpython-312.pyc b/osinaweb/customercore/__pycache__/views.cpython-312.pyc index b0efdb33..ecbe78f1 100644 Binary files a/osinaweb/customercore/__pycache__/views.cpython-312.pyc and b/osinaweb/customercore/__pycache__/views.cpython-312.pyc differ diff --git a/osinaweb/db.sqlite3 b/osinaweb/db.sqlite3 index d2639dc3..fd6347e1 100644 Binary files a/osinaweb/db.sqlite3 and b/osinaweb/db.sqlite3 differ diff --git a/osinaweb/osinacore/__pycache__/urls.cpython-312.pyc b/osinaweb/osinacore/__pycache__/urls.cpython-312.pyc index ce6f4872..801fbe20 100644 Binary files a/osinaweb/osinacore/__pycache__/urls.cpython-312.pyc and b/osinaweb/osinacore/__pycache__/urls.cpython-312.pyc differ diff --git a/osinaweb/osinacore/__pycache__/views.cpython-312.pyc b/osinaweb/osinacore/__pycache__/views.cpython-312.pyc index 59e00fe0..492fceca 100644 Binary files a/osinaweb/osinacore/__pycache__/views.cpython-312.pyc and b/osinaweb/osinacore/__pycache__/views.cpython-312.pyc differ diff --git a/osinaweb/osinacore/add/__pycache__/views.cpython-312.pyc b/osinaweb/osinacore/add/__pycache__/views.cpython-312.pyc index e65cf6f7..1b824b25 100644 Binary files a/osinaweb/osinacore/add/__pycache__/views.cpython-312.pyc and b/osinaweb/osinacore/add/__pycache__/views.cpython-312.pyc differ diff --git a/osinaweb/osinacore/templates/add-edit-main.html b/osinaweb/osinacore/templates/add-edit-main.html index cf9f75ef..6286d95a 100644 --- a/osinaweb/osinacore/templates/add-edit-main.html +++ b/osinaweb/osinacore/templates/add-edit-main.html @@ -762,7 +762,7 @@ - + diff --git a/osinaweb/osinacore/templates/details_templates/project-details.html b/osinaweb/osinacore/templates/details_templates/project-details.html index dddc18cc..3118228f 100644 --- a/osinaweb/osinacore/templates/details_templates/project-details.html +++ b/osinaweb/osinacore/templates/details_templates/project-details.html @@ -51,6 +51,13 @@ + + + + + + + + + + + +
- +
-

Type: - {% for type in project.project_type.all %} - - {{type.name}} {% if not forloop.last %}, {% endif %} - {% endfor %} -

-
- +
+
+
+

Tickets

+
- -
-

Status: - {% if project.status == 'Cancelled' %} - {{project.status}} - {% endif %} - {% if project.status == 'Completed' %} - {{project.status}} - {% endif %} - {% if project.status == 'Active' %} - {{project.status}} - {% endif %} - {% if project.status == 'Pending' %} - {{project.status}} - {% endif %} -

-
+ +
+ + + + + + + + + + + + + + + + - -
-
-

Project Details:

-
-

- {{project.details}} -

-
-
-
+ + - -
-

Tags:

-
- +
+ + - + + + + +
+ Subject + + Ticket ID + + Regarding + + Last Updated + + Updated By + + Actions +
+

hhh

+
+

hhh

+
+

hhh

+
+

hhh

+
+

hhh

+
+
+ + + - + + + + + + + + + + + +
+ + + +
+
+
@@ -253,15 +367,16 @@ class="w-fit py-2 px-3 bg-green-700 border border-green-700 text-white rounded-md cursor-pointer hover:bg-white hover:text-green-700">Add Task
- -
- -
+ + +
- -
- +
+ + +
@@ -281,7 +396,7 @@ -
+
@@ -349,7 +464,7 @@
-
+
diff --git a/osinaweb/osinacore/templates/listing_pages/projects.html b/osinaweb/osinacore/templates/listing_pages/projects.html index 6f9be4ef..d15b28d2 100644 --- a/osinaweb/osinacore/templates/listing_pages/projects.html +++ b/osinaweb/osinacore/templates/listing_pages/projects.html @@ -40,7 +40,6 @@
- - + diff --git a/osinaweb/osinacore/templates/projects-by-status.html b/osinaweb/osinacore/templates/projects-by-status.html index b4b3d612..2b967cba 100644 --- a/osinaweb/osinacore/templates/projects-by-status.html +++ b/osinaweb/osinacore/templates/projects-by-status.html @@ -4,6 +4,9 @@
+ + +
+
+
+
+
+
diff --git a/osinaweb/osinacore/urls.py b/osinaweb/osinacore/urls.py index b16e43e1..0774d537 100644 --- a/osinaweb/osinacore/urls.py +++ b/osinaweb/osinacore/urls.py @@ -81,6 +81,7 @@ urlpatterns = [ path('recent-activities-page/', views.recent_activities_page, name='recentactivitiespage'), path('fetch_epics/', views.fetch_epics, name='fetch_epics'), path('projects/status//', views.fetch_projects_by_status, name='projects_by_status'), + path('all-projects/', views.fetch_projects_by_status, name='all_projects'), ] urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) \ No newline at end of file diff --git a/osinaweb/osinacore/views.py b/osinaweb/osinacore/views.py index bd56454c..01148f64 100644 --- a/osinaweb/osinacore/views.py +++ b/osinaweb/osinacore/views.py @@ -868,7 +868,7 @@ def reset_password(request, uidb64, token): -def fetch_projects_by_status(request, status): +def fetch_projects_by_status(request, status=None): user = request.user if user.is_superuser: @@ -881,12 +881,15 @@ def fetch_projects_by_status(request, status): ).distinct().order_by('-project_id') # Fetch projects with their last status as "In Progress" - filtered_projects = [] - for project in projects: - last_status = ProjectStatus.objects.filter(project = project).last() - if last_status.status == status: - filtered_projects.append(project) - + if status: + filtered_projects = [] + for project in projects: + last_status = ProjectStatus.objects.filter(project = project).last() + if last_status.status == status: + filtered_projects.append(project) + else: + filtered_projects = projects + for project in projects: total_time_seconds = 0 open_user_tasks_count = 0 diff --git a/osinaweb/static/images/before.png b/osinaweb/static/images/before.png new file mode 100644 index 00000000..99ec1e30 Binary files /dev/null and b/osinaweb/static/images/before.png differ diff --git a/osinaweb/static/js/calculate-all-projects-time.js b/osinaweb/static/js/calculate-all-projects-time.js index 0b6d8d9b..8bbc13fe 100644 --- a/osinaweb/static/js/calculate-all-projects-time.js +++ b/osinaweb/static/js/calculate-all-projects-time.js @@ -23,17 +23,23 @@ function calculateProgress(startDate, endDate, progressBar) { } } -const projectContainers = document.querySelectorAll(".projectContainer"); +function updateAllProjectProgress() { + const projectContainers = document.querySelectorAll(".projectContainer"); -// Loop through each project container -projectContainers.forEach(projectContainer => { - const startDateElement = projectContainer.querySelector(".startDate"); - const endDateElement = projectContainer.querySelector(".endDate"); + // Loop through each project container + projectContainers.forEach(projectContainer => { + const startDateElement = projectContainer.querySelector(".startDate"); + const endDateElement = projectContainer.querySelector(".endDate"); - const progressBar = projectContainer.querySelector(".progressBar"); + const progressBar = projectContainer.querySelector(".progressBar"); - const startDate = new Date(startDateElement.textContent); - const endDate = new Date(endDateElement.textContent); + const startDate = new Date(startDateElement.textContent); + const endDate = new Date(endDateElement.textContent); - calculateProgress(startDate, endDate, progressBar); -}); + calculateProgress(startDate, endDate, progressBar); + }); +} + + +updateAllProjectProgress(); +export { updateAllProjectProgress }; \ No newline at end of file diff --git a/osinaweb/static/js/pop-modals.js b/osinaweb/static/js/pop-modals.js index 4a53e1b2..db791de6 100644 --- a/osinaweb/static/js/pop-modals.js +++ b/osinaweb/static/js/pop-modals.js @@ -1,26 +1,30 @@ -document.addEventListener("DOMContentLoaded", function () { - // Function to open a modal with dimensions +function initializeModalButtons() { + // OPEN THE MODAL WITH DIMENSIONS function openModalWithDimensions(url, width, height) { const modalUrl = url; openModal(modalUrl); + console.log('hii4'); const iframe = document.getElementById("popupModalFrame"); iframe.style.height = height; iframe.style.width = width; } - // Function to open a modal + // OPEN MODAL function openModal(url) { const modalContainer = document.getElementById("popUpModal"); const iframe = document.getElementById("popupModalFrame"); const body = document.body; body.style.overflow = "hidden"; + console.log('hii1'); iframe.src = url; + console.log('hii2') modalContainer.style.display = "flex"; + console.log('hii3') } - // Function to close the modal + // CLOSE MODAL function closeModal() { const modalContainer = document.getElementById("popUpModal"); const iframe = document.getElementById("popupModalFrame"); @@ -38,11 +42,11 @@ document.addEventListener("DOMContentLoaded", function () { button.addEventListener("click", () => { const modalUrl = button.getAttribute("data-modal-url"); openModalWithDimensions(modalUrl, width, height); + console.log('hii5') }); }); } - // Add button click listeners with dimensions for specific class names addButtonClickListener("addStatusButton", "450px", "200px"); addButtonClickListener("addNoteButton", "400px", "225px"); addButtonClickListener("addProjectNoteButton", "400px", "225px"); @@ -75,10 +79,6 @@ document.addEventListener("DOMContentLoaded", function () { addButtonClickListener("editProjectStatusButton", "400px", "220px"); addButtonClickListener("editCustomerStatusButton", "400px", "160px"); addButtonClickListener("addProjectMemberModal", "400px", "230px"); - - - - // DELETE BUTTONS addButtonClickListener("deleteCustomerButton", "400px", "140px"); @@ -92,10 +92,6 @@ document.addEventListener("DOMContentLoaded", function () { addButtonClickListener("deleteTicketButton", "400px", "140px"); addButtonClickListener("deletePaymentButton", "400px", "140px"); addButtonClickListener("deletePaymentMethodButton", "400px", "140px"); - - - - const closeButton = document.getElementById("closeModalButton"); closeButton.addEventListener("click", () => { @@ -108,4 +104,9 @@ document.addEventListener("DOMContentLoaded", function () { closeModal(); } }); -}); +} + + +initializeModalButtons(); +export { initializeModalButtons }; + diff --git a/osinaweb/static/js/projects-filtering.js b/osinaweb/static/js/projects-filtering.js index d9988451..0b8246df 100644 --- a/osinaweb/static/js/projects-filtering.js +++ b/osinaweb/static/js/projects-filtering.js @@ -1,10 +1,12 @@ +import { initializeModalButtons } from '../js/pop-modals.js'; +import { updateAllProjectProgress } from '../js/calculate-all-projects-time.js'; + document.addEventListener('DOMContentLoaded', function () { const inProgressProjectsContainer = document.getElementById('inProgressProjectsContainer'); const projectsByStatusContainer = document.getElementById('projectsByStatusContainer'); const allProjectsContainer = document.getElementById('allProjectsContainer'); const projectLoader = document.getElementById('projectLoader'); - - var statusesSelectTag = document.getElementById('statusesSelectTag'); + const statusesSelectTag = document.getElementById('statusesSelectTag'); statusesSelectTag.addEventListener('change', function () { var selectedStatus = statusesSelectTag.value; @@ -14,17 +16,20 @@ document.addEventListener('DOMContentLoaded', function () { projectsByStatusContainer.classList.add('hidden'); allProjectsContainer.classList.add('hidden'); - // Check if "All" is selected if (selectedStatus === 'All') { - allProjectsContainer.classList.remove('hidden'); - projectLoader.classList.add('hidden'); + fetch('/all-projects/') + .then(response => response.text()) + .then(data => { + projectsByStatusContainer.classList.remove('hidden'); + $(projectsByStatusContainer).html(data); + projectLoader.classList.add('hidden'); + initializeModalButtons(); + updateAllProjectProgress(); + }) + .catch(error => console.error('Error:', error)); - // Check if "In Progress" is selected - } else if (selectedStatus === 'In Progress') { - inProgressProjectsContainer.classList.remove('hidden'); - projectsByStatusContainer.classList.add('hidden'); projectLoader.classList.add('hidden'); - allProjectsContainer.classList.add('hidden'); + } else { fetch('/projects/status/' + selectedStatus + '/') .then(response => response.text()) @@ -32,8 +37,10 @@ document.addEventListener('DOMContentLoaded', function () { projectsByStatusContainer.classList.remove('hidden'); $(projectsByStatusContainer).html(data); projectLoader.classList.add('hidden'); + initializeModalButtons(); + updateAllProjectProgress(); }) .catch(error => console.error('Error:', error)); } }); -}); \ No newline at end of file +});