New changes.

main
nataly 12 months ago
parent 41fb8fa457
commit f494a5b84a

Binary file not shown.

@ -26,22 +26,28 @@
<div class="w-full h-fit flex justify-end items-center bg-gray-100 shadow-md rounded-md px-3 py-3 mt-3"> <div class="w-full h-fit flex justify-end items-center bg-gray-100 shadow-md rounded-md px-3 py-3 mt-3">
<div class="w-full md:w-fit flex flex-col md:flex-row justify-end items-center gap-3"> <div class="w-full md:w-fit flex flex-col md:flex-row justify-end items-center gap-3">
<a href="{% url 'addticket' customer.id %}"> <button
class="w-full md:w-fit text-base px-3 py-2 bg-osiblue text-white outline-none border border-osiblue rounded-md cursor-pointer hover:bg-white hover:text-osiblue duration-300">Update
Status</button>
<a href="{% url 'addproject' %}" class="w-full md:w-fit">
<button
class="w-full md:w-fit text-base px-3 py-2 bg-osiblue text-white outline-none border border-osiblue rounded-md cursor-pointer hover:bg-white hover:text-osiblue duration-300">Add
Project</button>
</a>
<a href="{% url 'addticket' customer.id %}" class="w-full md:w-fit">
<button <button
class="w-full md:w-fit text-base px-3 py-2 bg-osiblue text-white outline-none border border-osiblue rounded-md cursor-pointer hover:bg-white hover:text-osiblue duration-300">Add class="w-full md:w-fit text-base px-3 py-2 bg-osiblue text-white outline-none border border-osiblue rounded-md cursor-pointer hover:bg-white hover:text-osiblue duration-300">Add
Ticket</button> Ticket</button>
</a> </a>
<a href="{% url 'addorder' customer.id %}"> <a href="{% url 'addorder' customer.id %}" class="w-full md:w-fit">
<button <button
class="w-full md:w-fit text-base px-3 py-2 bg-osiblue text-white outline-none border border-osiblue rounded-md cursor-pointer hover:bg-white hover:text-osiblue duration-300">Add class="w-full md:w-fit text-base px-3 py-2 bg-osiblue text-white outline-none border border-osiblue rounded-md cursor-pointer hover:bg-white hover:text-osiblue duration-300">Add
Order</button> Order</button>
</a> </a>
<button
class="w-full md:w-fit text-base px-3 py-2 bg-red-500 text-white outline-none border border-red-500 rounded-md cursor-pointer hover:bg-white hover:text-red-500 duration-300 deleteCustomerButton"
data-modal-url="{% url 'deletecustomermodal' customer.id %}">Delete
Customer</button>
<a href="{% url 'editcustomer' customer.customer_id %}" class="w-full md:w-fit"> <a href="{% url 'editcustomer' customer.customer_id %}" class="w-full md:w-fit">
<button <button
class="w-full md:w-fit text-base px-3 py-2 bg-fifthosiblue text-white outline-none border border-fifthosiblue rounded-md cursor-pointer hover:bg-white hover:text-fifthosiblue duration-300">Edit class="w-full md:w-fit text-base px-3 py-2 bg-fifthosiblue text-white outline-none border border-fifthosiblue rounded-md cursor-pointer hover:bg-white hover:text-fifthosiblue duration-300">Edit
@ -292,9 +298,16 @@
</table> </table>
</div> </div>
</div> </div>
<button
class="w-full text-base px-3 py-2 bg-red-500 text-white outline-none border border-red-500 rounded-md cursor-pointer hover:bg-white hover:text-red-500 duration-300 mt-5 deleteCustomerButton"
data-modal-url="{% url 'deletecustomermodal' customer.id %}">Delete
Customer</button>
</div> </div>
<!-- POPUP MODAL --> <!-- POPUP MODAL -->
<div class="w-full h-full bg-black bg-opacity-40 z-20 fixed justify-center items-center hidden inset-0" id="popUpModal"> <div class="w-full h-full bg-black bg-opacity-40 z-20 fixed justify-center items-center hidden inset-0" id="popUpModal">
<div class="w-[95%] md:w-fit h-fit bg-white rounded-md p-9 relative"> <div class="w-[95%] md:w-fit h-fit bg-white rounded-md p-9 relative">

@ -0,0 +1,36 @@
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Osina</title>
<link rel="stylesheet" type="text/css" href='{% static "dist/output.css" %}'>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
</head>
<body class="font-poppinsLight">
<form method="POST" action="">
{% csrf_token %}
<h1 class="text-secondosiblue text-2xl font-semibold text-center">Update Customer Status</h1>
<select name="status" id="" class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md mt-4">
<option value="Completed">Completed</option>
<option value="In Progress">In Progress</option>
<option value="Pending">Pending</option>
<option value="Cancelled">Cancelled</option>
</select>
<div class="w-full flex justify-center items-center mt-4">
<button type="submit"
class="w-fit bg-osiblue border border-osiblue rounded-md text-white text-xl px-5 py-1 hover:bg-white hover:text-osiblue">Save</button>
</div>
</form>
</body>
</html>

@ -1,6 +1,6 @@
{% load static %} {% load static %}
{% for project in projects %} {% for project in filtered_projects %}
<div class="w-full h-fit bg-white rounded-md shadow-md p-3 projectContainer"> <div class="w-full h-fit bg-white rounded-md shadow-md p-3 projectContainer">
<p id="projectId" class="hidden">{{project.id}}</p> <p id="projectId" class="hidden">{{project.id}}</p>

@ -288,8 +288,8 @@ def my_projects(request, *args, **kwargs):
# Fetch projects with their last status as "In Progress" # Fetch projects with their last status as "In Progress"
in_progress_projects = [] in_progress_projects = []
for project in projects: for project in projects:
last_status = project.projectstatus_set.aggregate(last_status=Max('date', filter=Q(status='In Progress'))) last_status = ProjectStatus.objects.filter(project = project).last()
if last_status['last_status']: if last_status.status == 'In Progress':
in_progress_projects.append(project) in_progress_projects.append(project)
for project in in_progress_projects: for project in in_progress_projects:
@ -859,7 +859,23 @@ def reset_password(request, uidb64, token):
def fetch_projects_by_status(request, status): def fetch_projects_by_status(request, status):
projects = Project.objects.filter(projectstatus__status=status) user = request.user
if user.is_superuser:
# Superadmin can see all projects with total time worked on each project
projects = Project.objects.all().order_by('-project_id')
else:
# Non-superuser, filter projects where the user is either the manager or a member
projects = Project.objects.filter(
Q(manager=user.staffprofile) | Q(members=user.staffprofile)
).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)
for project in projects: for project in projects:
total_time_seconds = 0 total_time_seconds = 0
@ -887,7 +903,7 @@ def fetch_projects_by_status(request, status):
project.open_user_tasks_count = open_user_tasks_count project.open_user_tasks_count = open_user_tasks_count
context = { context = {
'projects': projects, 'filtered_projects': filtered_projects,
'status': status, 'status': status,
} }
return render(request, 'projects-by-status.html', context) return render(request, 'projects-by-status.html', context)

Loading…
Cancel
Save