emile 2 years ago
parent 658095ff16
commit 1f1ade0173

Binary file not shown.

@ -0,0 +1,12 @@
from .models import Task
def utilities(request):
if request.user.is_superuser:
open_task_count = Task.objects.filter(status='Open').count()
working_on_task_count = Task.objects.filter(status='Working On').count()
else:
open_task_count = Task.objects.filter(assigned_to=request.user.staffprofile, status='Open').count()
working_on_task_count = Task.objects.filter(assigned_to=request.user.staffprofile, status='Working On').count()
total_tasks = open_task_count + working_on_task_count
return {'total_tasks': total_tasks}

@ -53,15 +53,10 @@ def home(request, *args, **kwargs):
if request.user.is_superuser: if request.user.is_superuser:
# Superadmin can see the last 8 tasks for all users # Superadmin can see the last 8 tasks for all users
tasks = Task.objects.filter(Q(status='Open') | Q(status='Working On')).order_by('-id')[:8] tasks = Task.objects.filter(Q(status='Open') | Q(status='Working On')).order_by('-id')[:8]
open_task_count = Task.objects.filter(status='Open').count()
working_on_task_count = Task.objects.filter(status='Working On').count()
total_tasks = open_task_count + working_on_task_count
else: else:
# Non-superadmin user can only see their assigned tasks # Non-superadmin user can only see their assigned tasks
tasks = Task.objects.filter(Q(assigned_to=request.user.staffprofile) & (Q(status='Open') | Q(status='Working On'))) tasks = Task.objects.filter(Q(assigned_to=request.user.staffprofile) & (Q(status='Open') | Q(status='Working On')))
open_task_count = Task.objects.filter(assigned_to=request.user.staffprofile,status='Open').count()
working_on_task_count = Task.objects.filter(assigned_to=request.user.staffprofile, status='Working On').count()
total_tasks = open_task_count + working_on_task_count
# Initialize last_note_color with a default color # Initialize last_note_color with a default color
last_note_color = 'black' last_note_color = 'black'
@ -74,7 +69,6 @@ def home(request, *args, **kwargs):
'notes': notes, 'notes': notes,
'recent_note': recent_note, 'recent_note': recent_note,
'tasks': tasks, 'tasks': tasks,
'total_tasks' :total_tasks,
'last_note_color': last_note_color, 'last_note_color': last_note_color,
} }
@ -661,8 +655,8 @@ def save_customer(request):
form = SignUpForm(request.POST) form = SignUpForm(request.POST)
if form.is_valid(): if form.is_valid():
email = form.cleaned_data['email'] email = form.cleaned_data['email']
first_name = form.cleaned_data['first_name'].replace(" ", "") # Remove spaces first_name = form.cleaned_data['first_name'].replace(" ", "")
last_name = form.cleaned_data['last_name'].replace(" ", "") # Remove spaces last_name = form.cleaned_data['last_name'].replace(" ", "")
username = f"{first_name.lower()}{last_name.lower()}" username = f"{first_name.lower()}{last_name.lower()}"
original_username = username original_username = username

@ -65,6 +65,7 @@ TEMPLATES = [
'APP_DIRS': True, 'APP_DIRS': True,
'OPTIONS': { 'OPTIONS': {
'context_processors': [ 'context_processors': [
'osinacore.custom_context.utilities',
'django.template.context_processors.debug', 'django.template.context_processors.debug',
'django.template.context_processors.request', 'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth', 'django.contrib.auth.context_processors.auth',

@ -65,6 +65,7 @@ urlpatterns = [
path('addtag/', views.add_tag_modal, name='addtag'), path('addtag/', views.add_tag_modal, name='addtag'),
path('addbusinesscustomer/', views.add_business_modal, name='addbusinesscustomer'), path('addbusinesscustomer/', views.add_business_modal, name='addbusinesscustomer'),
# Save Urls # Save Urls
path('save_note/', views.save_note, name='save_note'), path('save_note/', views.save_note, name='save_note'),
path('save_project/', views.save_project, name='save_project'), path('save_project/', views.save_project, name='save_project'),

@ -23,7 +23,7 @@
<input name="mobile_number" type="number" placeholder="Mobile Number" <input name="mobile_number" type="number" placeholder="Mobile Number"
class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md" required> class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md" required>
<input name="personal_website" type="text" placeholder="Personal Website" <input name="personal_website" type="url" placeholder="Personal Website"
class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md"> class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md">
<select name="status" <select name="status"
class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md text-gray-500" class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md text-gray-500"

@ -81,7 +81,7 @@
<div <div
class="menuItem w-full flex justify-between items-center border-b border-slate-600 py-3 cursor-pointer"> class="menuItem w-full flex justify-between items-center border-b border-slate-600 py-3 cursor-pointer">
<div class="w-full flex justify-start items-center gap-3"> <div class="w-full flex justify-start items-center gap-3">
<i class="fa fa-list" style="font-size: 22px; color: white;"></i> <i class="fas fa-users" style="font-size: 22px; color: white;"></i>
<p class="text-white text-xl">Accounts</p> <p class="text-white text-xl">Accounts</p>
</div> </div>
<div> <div>
@ -163,7 +163,7 @@
<div class="w-full flex justify-between items-center border-b border-slate-600 py-3"> <div class="w-full flex justify-between items-center border-b border-slate-600 py-3">
<div class="w-full flex justify-start items-center gap-3"> <div class="w-full flex justify-start items-center gap-3">
<i class="fa fa-euro" style="font-size: 22px; color: white;"></i> <i class="fas fa-cash-register" style="font-size: 22px; color: white;"></i>
<p class="text-white text-xl">Billing</p> <p class="text-white text-xl">Billing</p>
</div> </div>
<div> <div>

Loading…
Cancel
Save