emile 1 year ago
parent 4056ced693
commit 5d4726314b

BIN
.DS_Store vendored

Binary file not shown.

@ -0,0 +1,19 @@
# Generated by Django 4.2.5 on 2024-04-18 13:26
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('billing', '0036_alter_invoice_invoice_number'),
]
operations = [
migrations.AddField(
model_name='recurringcycle',
name='item',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='billing.item'),
),
]

@ -4,14 +4,6 @@ import requests
# Create your models here.
class RecurringCycle(models.Model):
months = models.IntegerField()
def __str__(self):
return f"{self.months} months"
class Item(models.Model):
TYPE = (
('Product', 'Product'),
@ -28,6 +20,13 @@ class Item(models.Model):
return self.title
class RecurringCycle(models.Model):
item = models.ForeignKey(Item, on_delete=models.CASCADE, null=True)
months = models.IntegerField()
def __str__(self):
return f"{self.months} months"
class Order(models.Model):
STATUS = (
('Completed', 'Completed'),

Binary file not shown.

@ -8,13 +8,12 @@ urlpatterns = [
path('customer/', views.add_customer, name='addcustomer'),
path('business/', views.add_business, name='addbusiness'),
path('businessmodal/', views.add_business_modal, name='addbusinessmodal'),
path('staff/', views.add_staff, name='adduser'),
path('project/', views.add_project, name='addproject'),
path('userstory/<str:project_id>/', views.add_user_story_modal, name='adduserstorymodal'),
path('projectnote/<str:project_id>/', views.add_project_note_modal, name='addprojectnotemodal'),
path('file/', views.add_file_modal, name='addfilemodal'),
path('credential/', views.add_credential_modal, name='addcredentialmodal'),
path('projectnote/<str:project_id>/', views.add_note_modal, name='addprojectnotemodal'),
path('task/', views.add_task, name='addtask'),
path('task/<str:project_id>/', views.add_task, name='addprojecttask'),
path('task/<str:project_id>/<int:requirement_id>/', views.add_task, name='adduserstorytask'),

@ -129,52 +129,6 @@ def add_business(request):
@staff_login_required
def add_business_modal(request):
if request.method == 'POST':
name = request.POST.get('name')
email = request.POST.get('email')
financial_number = request.POST.get('financial_number')
phone_number = request.POST.get('phone_number')
vat = request.POST.get('vat')
if vat == 'true':
vat = True
else:
vat = False
commercial_registration = request.POST.get('commercial_registration')
website = request.POST.get('website')
logo = request.FILES.get('logo')
business_type_id = request.POST.get('type')
business_type = get_object_or_404(BusinessType, id=business_type_id)
business = Business(
name=name,
email=email,
financial_number=financial_number,
vat=vat,
commercial_registration=commercial_registration,
website=website,
type=business_type,
logo=logo,
phone_number=phone_number,
)
business.save()
businesses = Business.objects.all()
updated_options = [{'id': business.id, 'name': business.name} for business in businesses]
return JsonResponse(updated_options, safe=False)
return render(request, 'add_templates/addbusiness-modal.html')
@staff_login_required
def add_staff(request):
staffpositions = StaffPosition.objects.all().order_by('-id')
@ -182,7 +136,7 @@ def add_staff(request):
email = request.POST.get('email').lower()
first_name = request.POST.get('first_name')
last_name = request.POST.get('last_name')
username = f"{first_name.lower()}{last_name.lower()}"
username = f"{first_name.replace(' ', '').lower()}{last_name.replace(' ', '').lower()}"
original_username = username
counter = 1
@ -190,10 +144,17 @@ def add_staff(request):
username = f"{original_username.lower()}{counter}"
counter += 1
if request.POST.get('active'):
active = True
else:
active = False
user = User.objects.create_user(
username=username,
email=email,
password= request.POST.get('password2')
password= request.POST.get('password2'),
is_staff = True,
is_active = active
)
user.first_name = first_name.lower().capitalize()
user.last_name = last_name.lower().capitalize()
@ -202,12 +163,17 @@ def add_staff(request):
staff_positionid = request.POST.get('staff_position')
staff_position = get_object_or_404(StaffPosition, id=staff_positionid)
if request.POST.get('intern'):
intern = True
else:
intern = False
StaffProfile.objects.create(
user=user,
image = request.FILES.get('image'),
mobile_number = request.POST.get('mobile_number'),
active = request.POST.get('active'),
intern = request.POST.get('intern'),
active = active,
intern = intern,
staff_position = staff_position,
)
return redirect('users')
@ -299,35 +265,7 @@ def add_user_story_modal(request, project_id):
}
return render(request, 'add_templates/add-userstory-modal.html', context)
@staff_login_required
def add_project_note_modal(request, project_id):
project = get_object_or_404(Project, project_id=project_id)
if request.method == 'POST':
text = request.POST.get('note_text')
color = request.POST.get('note_color')
user = request.user
date = timezone.now()
note = Note(
text=text,
color=color,
user=user,
date=date,
project=project,
)
note.save()
return HttpResponse('<script>window.top.location.reload();</script>')
context = {
'project' : project
}
return render(request, 'add_templates/add-project-note-modal.html', context)
@staff_login_required
@ -492,7 +430,12 @@ def add_epic(request, project_id):
@staff_login_required
def add_note_modal(request, *args, **kwargs):
def add_note_modal(request, project_id=None):
project = None
if project_id: #Case where user wants to add note for a project page(Adding a note for a project)
project = get_object_or_404(Project, project_id=project_id)
else:
project = None
if request.method == 'POST':
text = request.POST.get('note_text')
color = request.POST.get('note_color')
@ -504,12 +447,16 @@ def add_note_modal(request, *args, **kwargs):
color=color,
user=user,
date=date,
project=project,
)
note.save()
# Reload the parent page
return HttpResponse('<script>window.top.location.reload();</script>')
return render(request, 'add_templates/add-note-modal.html')
context={
'project': project,
}
return render(request, 'add_templates/add-note-modal.html', context)

@ -13,10 +13,6 @@ def edit_customer(request, customer_id):
#Utilities
references = Reference.objects.all()
businesses = Business.objects.all
customer_status = customer.status
customer_reference = customer.reference
customer_business = customer.business
if request.method == 'POST':
@ -24,6 +20,7 @@ def edit_customer(request, customer_id):
customer.user.first_name = request.POST.get('first_name')
customer.user.last_name = request.POST.get('last_name')
customer.user.email = request.POST.get('email')
customer.user.username = request.POST.get('email')
customer.user.save()
customer.mobile_number = request.POST.get('mobile_number')
customer.personal_website = request.POST.get('personal_website')
@ -32,14 +29,6 @@ def edit_customer(request, customer_id):
customer_reference = request.POST.get('reference')
reference = get_object_or_404(Reference, id=customer_reference)
customer.reference = reference
if customer.business:
new_business = request.POST.get('business')
business = get_object_or_404(Business, id=new_business)
customer.business = business
customer.save()
@ -50,10 +39,6 @@ def edit_customer(request, customer_id):
'customer' : customer,
'references' : references,
'businesses' : businesses,
'customer_status' : customer_status,
'customer_reference' : customer_reference,
'customer_business' : customer_business,
}
return render(request, 'edit_templates/edit-customer.html', context)
@ -65,24 +50,26 @@ def edit_customer(request, customer_id):
def edit_business(request, business_id):
business = get_object_or_404(Business, business_id=business_id)
business_types = BusinessType.objects.all().order_by('name')
current_business_type = None
if business.type:
current_business_type = business.type
customers = CustomerProfile.objects.all().order_by('-id')
if request.method == 'POST':
business.name= request.POST.get('name')
business.financial_number = request.POST.get('financial_number')
business.commercial_registration = request.POST.get('commercial_registration')
business.vat = request.POST.get('vat')
if request.POST.get('vat'):
business.vat = True
else:
business.vat = False
business.phone_number = request.POST.get('phone_number')
business.website = request.POST.get('website')
business_type = request.POST.get('business_type')
type = get_object_or_404(BusinessType, id=business_type)
business.type = type
if request.POST.get('business_type'):
business_type = request.POST.get('business_type')
type = get_object_or_404(BusinessType, id=business_type)
business.type = type
else:
business.type = None
new_logo = request.FILES.get('logo')
if new_logo:
@ -97,7 +84,7 @@ def edit_business(request, business_id):
context = {
'business' : business,
'business_types' : business_types,
'current_business_type' : current_business_type,
'customers' : customers,
}
return render(request, 'edit_templates/edit-business.html', context)
@ -115,23 +102,30 @@ def edit_staff(request, staff_id):
staff.user.first_name= request.POST.get('first_name')
staff.user.last_name = request.POST.get('last_name')
staff.user.email = request.POST.get('email')
if request.POST.get('active'):
active = True
else:
active = False
staff.user.is_active = active
staff.user.save()
staff.mobile_number = request.POST.get('mobile_number')
staff.active = request.POST.get('active')
staff.intern = request.POST.get('intern')
new_position_id = request.POST.get('staff_position')
new_position = get_object_or_404(StaffPosition, id=new_position_id)
staff.staff_position = new_position
staff.active = active
new_image = request.FILES.get('image')
if new_image:
staff.image = new_image
staff.active = request.POST.get('active') == 'on'
staff.intern = request.POST.get('intern') == 'on'
if request.POST.get('intern'):
intern = True
else:
intern = False
staff.intern = intern
staff.save()

@ -12,6 +12,21 @@
{% csrf_token %}
<div class="w-full flex flex-col gap-5">
<div class="w-full">
<label class="text-gray-500">Logo:</label>
<div class="inbox-box border border-gray-300 w-full rounded-md px-3 mt-1">
<div class="flex items-center justify-between">
<input name="logo" required type="file" class="file-input" accept="image/*" hidden />
<span class="file-name text-gray-500 text-base focus:outline-none outline-none">Upload
Logo</span>
<label
class="file-label bg-transparent text-gray-500 border border-white h-14 cursor-pointer flex items-center">
<i class="fa fa-upload" style="font-size: 25px;"></i>
</label>
</div>
</div>
</div>
<div class="w-full">
<label class="text-gray-500">Customer:</label>
<select name="customer" id="business_type"
@ -30,23 +45,6 @@
class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md mt-1" required>
</div>
<div class="w-full">
<label class="text-gray-500">Business Logo:</label>
<div class="inbox-box border border-gray-300 w-full rounded-md px-3 mt-1">
<div class="flex items-center justify-between">
<input name="logo" required type="file" class="file-input" accept="image/*" hidden />
<span class="file-name text-gray-500 text-base focus:outline-none outline-none">Upload
Logo</span>
<label
class="file-label bg-transparent text-gray-500 border border-white h-14 cursor-pointer flex items-center">
<i class="fa fa-upload" style="font-size: 25px;"></i>
</label>
</div>
</div>
</div>
<div class="w-full">
<label class="text-gray-500">Email:</label>
<input name="email" type="email"
@ -59,11 +57,6 @@
class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md mt-1" required>
</div>
<div class="w-full flex justify-start items-center gap-2 mt-1">
<input name="vat" type="checkbox">
<label class="text-slate-800">Vat</label>
</div>
<div class="w-full">
<label class="text-gray-500">Commercial Registration:</label>
<input name="commercial_registration" type="commercial_registration"
@ -84,7 +77,7 @@
</div>
<div class="w-full">
<label class="text-gray-500">Business Type:</label>
<label class="text-gray-500">Type:</label>
<select name="type" id="business_type"
class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md text-gray-500 mt-1">
<option value="" selected disabled>Select Business Type</option>
@ -94,6 +87,13 @@
</select>
</div>
<div class="w-full flex justify-start items-center gap-2 mt-1">
<input name="vat" type="checkbox" >
<label class="text-slate-800">VAT</label>
</div>
<div class="w-full flex justify-center items-center mt-3">
<button type="submit"
class="w-fit py-1 px-5 bg-osiblue rounded-md outline-none text-white border border-osiblue text-xl cursor-pointer hover:bg-white hover:text-osiblue duration-300">Save</button>

@ -14,7 +14,7 @@
</head>
<body class="font-poppinsLight">
<form id="hiddenContent" method="POST" action="{% url 'addnotemodal' %}">
<form id="hiddenContent" method="POST" {% if not project %} action="{% url 'addnotemodal' %}" {% else %} action="{% url 'addprojectnotemodal' project.project_id %}" {% endif %}>
{% csrf_token %}
<h1 class="text-secondosiblue text-2xl font-semibold text-center">Add Note</h1>

@ -1,116 +0,0 @@
{% 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 id="hiddenContent" method="POST" action="{% url 'addprojectnotemodal' project.project_id %}">
{% csrf_token %}
<h1 class="text-secondosiblue text-2xl font-semibold text-center">Add Note</h1>
<div class="w-full flex flex-col gap-3 justify-center items-center">
<input required name="note_text" type="text" placeholder="Type your note here..."
class="w-full p-3 border border-gray-300 rounded-md bg-transparent outline-none mt-4">
<select required name="project" id=""
class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md text-gray-500 hidden">
<option value="{{project.id}}">{{project.id}}</option>
</select>
</div>
<div class="w-full flex justify-between items-center flex-wrap mt-4">
<div class="color-option w-[40px] h-[40px] rounded-full bg-blue-200 cursor-pointer"
style="background-color: #BFDBFF;" id="blue">
</div>
<div class="color-option w-[40px] h-[40px] rounded-full bg-pink-200 cursor-pointer"
style="background-color: #FBCFE8;" id="pink">
</div>
<div class="color-option w-[40px] h-[40px] rounded-full bg-yellow-200 cursor-pointer"
style="background-color: #FEEF91;" id="yellow">
</div>
<div class="color-option w-[40px] h-[40px] rounded-full bg-green-200 cursor-pointer"
style="background-color: #B6FAD0;" id="green">
</div>
<div class="color-option w-[40px] h-[40px] rounded-full bg-purple-200 cursor-pointer"
style="background-color: #EBD6F9;" id="purple">
</div>
<div class="color-option w-[40px] h-[40px] rounded-full bg-red-200 cursor-pointer"
style="background-color: #FFCACA;" id="red">
</div>
</div>
<div>
<input required name="note_color" type="text"
class="w-full border border-gray-300 rounded-md py-1 px-3 outline-none h-[50px] mt-4 hidden"
id="hexCodeDisplay">
</div>
<script>
// TO GET THE COLOR OF THE DIV
const colorOptions = document.querySelectorAll('.color-option');
const hexCodeDisplay = document.getElementById('hexCodeDisplay');
colorOptions.forEach((colorOption) => {
colorOption.addEventListener('click', () => {
// Remove borders from all color-options
colorOptions.forEach((option) => {
option.style.border = 'none';
});
// Get the id and background color of the clicked color div
const colorId = colorOption.id;
const bgColor = colorOption.style.backgroundColor;
// Convert the RGB color to a hex code (if it's in RGB format)
const hexColor = rgbToHex(bgColor);
// Display the hex code in the input field
hexCodeDisplay.value = hexColor;
// Apply a black border to the selected color-option
colorOption.style.border = '3px solid gray';
console.log(`Selected color ID: ${colorId}`);
});
});
// Function to convert RGB color to hex code
function rgbToHex(rgb) {
const rgbaArray = rgb.match(/\d+/g);
const hexArray = rgbaArray.map((value) => {
const hex = parseInt(value, 10).toString(16);
return hex.length === 1 ? '0' + hex : hex;
});
return '#' + hexArray.join('');
}
</script>
<div class="w-full flex justify-center items-center mt-6">
<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 duration-300">Save</button>
</div>
</form>
</body>
</html>

@ -64,6 +64,7 @@
<label class="text-gray-500">Position:</label>
<select name="staff_position"
class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md text-gray-500 mt-1">
<option value="" selected disabled>Select Staff Position</option>
{% for position in staffpositions %}
<option value="{{position.id}}">{{position.name}}</option>
{% endfor %}
@ -71,28 +72,15 @@
</div>
<div class="w-full flex justify-start items-center gap-2">
<input name="active" type="checkbox" id="activeCheckbox"
onchange="updateCheckbox('activeCheckbox')">
<input name="active" type="checkbox">
<p class="text-gray-500">Active</p>
</div>
<div class="w-full flex justify-start items-center gap-2">
<input name="intern" type="checkbox" id="internCheckbox"
onchange="updateCheckbox('internCheckbox')">
<input name="intern" type="checkbox">
<p class="text-gray-500">Intern</p>
</div>
<script>
function updateCheckbox(checkboxId) {
const checkbox = document.getElementById(checkboxId);
const inputName = checkbox.getAttribute('name');
const inputValue = checkbox.checked ? 'True' : 'False';
// Set the input field value based on checkbox state
const inputField = document.querySelector(`input[name="${inputName}"]`);
inputField.value = inputValue;
}
</script>
<div class="w-full">
<label class="text-gray-500">Password:</label>

@ -18,6 +18,8 @@
{% else %}
action="{% url 'addtask' %}"
{% endif %}>
{% csrf_token %}
<div class="w-full">
<label class="text-gray-500">Task Name:</label>

@ -409,7 +409,7 @@
<button
class="h-full rounded-tr-md px-4 bg-secondosiblue text-gray-200 text-[18px] outline-none border-none cursor-pointer flex justify-center items-center addProjectNoteButton"
data-modal-url="{% url 'addprojectnotemodal' project.project_id %}">
data-modal-url="{% url 'addprojectnotemodal' project.project_id %}">
<i class="fa fa-plus"></i>
</button>
</div>

@ -13,6 +13,7 @@
<div class="w-full flex flex-col gap-5 justify-center items-center mt-5">
<div class="w-[70px] s:w-[100px] h-[70px] s:h-[100px] rounded-full border border-gray-200 mt-2"
id="image-container">
{% if business.logo %}
@ -44,7 +45,21 @@
</div>
<div class="w-full">
<label class="text-gray-500 text-xl">Name:</label>
<label class="text-gray-500">Customer:</label>
<select name="customer" id="business_type"
class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md text-gray-500 mt-1">
{% if not business.customer %}
<option value="" selected disabled>Select Customer</option>
{% endif %}
{% for customer in customers %}
<option value="{{ customer.id }}" {% if business.customer.id == customer.id %} selected {% endif %}>{{ customer.user.first_name }} {{ customer.user.last_name }}</option>
{% endfor %}
</select>
</div>
<div class="w-full">
<label class="text-gray-500">Name:</label>
<input name="name" type="text"
class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md mt-1"
value="{{business.name}}" required>
@ -59,7 +74,7 @@
</div>
<div class="w-full">
<label class="text-gray-500 text-xl">Financial Number:</label>
<label class="text-gray-500">Financial Number:</label>
<input name="financial_number" type="number"
class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md mt-1"
value="{{business.financial_number}}" required>
@ -87,36 +102,25 @@
</div>
<div class="w-full">
<label class="text-gray-500">Type</label>
<label class="text-gray-500">Type:</label>
<select name="business_type" id="business_type_select"
class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md text-gray-500 mt-1">
{% if not business.type %}
<option value="" selected>Select Business Type</option>
{% else %}
<option value="" selected disabled> Select Business Type {% endif %}
{% for type in business_types %}
<option value="{{ type.id }}"{% if current_business_type and current_business_type.id == type.id %}selected selected{% endif %}>
<option value="{{ type.id }}"{% if business.type == type.id %}selected {% endif %}>
{{ type.name }}
</option>
{% endfor %}
{% endif %}
</select>
</div>
<div class="w-full flex justify-start items-center gap-2 mt-1">
<input {% if business.vat %} checked {% endif %} type="checkbox" id="vatCheckbox"
onchange="updateVatValue(this.checked)">
<label class="text-gray-500 text-xl" for="vatCheckbox">VAT</label>
<input type="hidden" name="vat" value="False">
<input name="vat" {% if business.vat %} checked {% endif %} type="checkbox">
<label class="text-gray-500" for="vatCheckbox">VAT</label>
</div>
<script>
function updateVatValue(checked) {
const vatInput = document.querySelector('input[name="vat"]');
vatInput.value = checked ? 'True' : 'False';
}
</script>
<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 duration-300">Save</button>

@ -56,9 +56,9 @@
class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md text-gray-500 mt-1"
required>
<option value="" disabled>Status</option>
<option value="Active"{% if customer_status == 'Active' %} selected {% endif %}>Active</option>
<option value="Suspended"{% if customer_status == 'Suspended' %} selected {% endif %}>Suspended</option>
<option value="Terminated"{% if customer_status == 'Terminated' %} selected {% endif %}>Terminated</option>
<option value="Active"{% if customer.status == 'Active' %} selected {% endif %}>Active</option>
<option value="Suspended"{% if customer.status == 'Suspended' %} selected {% endif %}>Suspended</option>
<option value="Terminated"{% if customer.status == 'Terminated' %} selected {% endif %}>Terminated</option>
</select>
</div>
@ -68,41 +68,13 @@
class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md text-gray-500 mt-1"
required>
{% for reference in references %}
<option value="{{ reference.id }}" {% if reference.id == customer_reference.id %} selected {% endif %}>
<option value="{{ reference.id }}" {% if reference.id == customer.reference.id %} selected {% endif %}>
{{ reference.name }}
</option>
{% endfor %}
</select>
</div>
{% if not customer_business %}
<div class="w-full">
<label class="text-gray-500">Type:</label>
<select id="businessTypeSelect"
class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md text-gray-500 mt-1">
<option value="" disabled>Type</option>
<option value="business" {% if customer.business %} selected {% endif %} >Business</option>
<option value="personal" {% if not customer.business %} selected {% endif %}>Personal</option>
</select>
</div>
{% endif %}
{% if customer_business %}
<div class="w-full">
<label class="text-gray-500">Business:</label>
<select name="business"
class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md text-gray-500 mt-1"
required>
{% for business in businesses %}
<option value="{{ business.id }}" {% if business.id == customer_business.id %} selected {% endif %}>
{{ business.name }} {{business}}
</option>
{% endfor %}
</select>
</div>
{% endif %}
<div class="w-full flex justify-center items-center mt-4">

@ -13,7 +13,7 @@
<div class="w-full flex flex-col justify-center items-center mt-2">
<div class="w-full">
<label class="text-gray-500">Business Type:</label>
<label class="text-gray-500">Project Type:</label>
<input name="name" type="text" placeholder="Project Type Name" value="{{projecttype.name}}"
class="w-full p-3 border border-gray-300 rounded-md bg-transparent outline-none mt-1" required>
</div>

@ -77,29 +77,19 @@
</select>
</div>
{% if staff.active %}
<div class="w-full flex justify-start items-center gap-2">
<input checked type="checkbox" name="active">
<p class="text-gray-500 text-xl">Active</p>
</div>
{% else %}
<div class="w-full flex justify-start items-center gap-2">
<input type="checkbox" name="active">
<p class="text-gray-500 text-xl">Active</p>
<input {% if staff.active %}checked {% endif %}type="checkbox" name="active">
<p class="text-gray-500">Active</p>
</div>
{% endif %}
{% if staff.intern %}
<div class="w-full flex justify-start items-center gap-2">
<input checked type="checkbox" name="intern">
<p class="text-gray-500 text-xl">Intern</p>
</div>
{% else %}
<div class="w-full flex justify-start items-center gap-2">
<input type="checkbox" name="intern">
<p class="text-gray-500 text-xl">Intern</p>
<input{% if staff.intern %} checked {% endif %} type="checkbox" name="intern">
<p class="text-gray-500">Intern</p>
</div>
{% endif %}
<div class="w-full flex justify-center items-center mt-4">
<button type="submit"

@ -132,7 +132,7 @@
<!-- POPUP MODAL -->
<div class="w-full h-full bg-black bg-opacity-40 z-20 fixed justify-center items-center hidden" 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">
<button class="absolute top-3 right-5 text-slate-800 text-xl cursor-pointer outline-none border-none"
id="closeModalButton">

@ -71,7 +71,7 @@ urlpatterns = [
path('fetch_epics/', views.fetch_epics, name='fetch_epics'),
path('add_reaction/<int:status_id>/<str:emoji>/', views.add_reaction, name='add_reaction'),
]

@ -587,18 +587,3 @@ def recent_activities_page(request):
return render(request, 'recent-activities-page.html', context)
@staff_login_required
def add_reaction(request, status_id, emoji):
status = get_object_or_404(Status, pk=status_id)
user = request.user
existing_reaction = Reaction.objects.filter(status=status, user=user).first()
if existing_reaction:
# If the user has already reacted, update the reaction
existing_reaction.emoji = emoji
existing_reaction.save()
return JsonResponse({'message': 'Reaction updated successfully.'})
else:
# If the user hasn't reacted yet, create a new reaction
new_reaction = Reaction.objects.create(status=status, emoji=emoji, user=user)
return JsonResponse({'message': 'Reaction added successfully.'})

Binary file not shown.

After

Width:  |  Height:  |  Size: 739 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

@ -25,7 +25,7 @@ document.addEventListener('DOMContentLoaded', function () {
var csrftoken = document.querySelector("[name=csrfmiddlewaretoken]").value;
if (statusId) {
fetch('/add_reaction/' + statusId + '/' + emojiText + '/', {
fetch('/add/reaction/' + statusId + '/' + emojiText + '/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',

Loading…
Cancel
Save