emile 1 year ago
parent adb4efe623
commit 29d7a73520

Binary file not shown.

@ -0,0 +1,26 @@
# Generated by Django 4.2.5 on 2024-01-19 18:53
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('osinacore', '0049_alter_customerprofile_business'),
]
operations = [
migrations.AddField(
model_name='projectrequirement',
name='added_by',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='projectrequirement',
name='date',
field=models.DateField(auto_now=True, null=True),
),
]

@ -0,0 +1,19 @@
# Generated by Django 4.2.5 on 2024-01-19 18:54
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('osinacore', '0050_projectrequirement_added_by_projectrequirement_date'),
]
operations = [
migrations.AlterField(
model_name='task',
name='requirement',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='osinacore.projectrequirement'),
),
]

@ -172,6 +172,8 @@ class Epic(models.Model):
class ProjectRequirement(models.Model):
content = models.CharField(max_length=350)
project = models.ForeignKey(Project, on_delete=models.CASCADE, null=True)
date = models.DateField(null=True, auto_now=True)
added_by = models.ForeignKey(User, on_delete=models.SET_NULL, null=True)
class ProjectFile(models.Model):
@ -211,6 +213,7 @@ class Task(models.Model):
start_date = models.CharField(max_length=200)
end_date = models.CharField(max_length=200)
assigned_to = models.ForeignKey(StaffProfile, on_delete=models.CASCADE, null=True)
requirement = models.ForeignKey(ProjectRequirement, on_delete=models.SET_NULL, null=True)
task_id = models.CharField(max_length=20, null=True, blank=True)
def save(self, *args, **kwargs):
if not self.task_id:

@ -514,18 +514,24 @@ def add_businesstype_modal(request, *args, **kwargs):
}
return render(request, 'popup_modals/addbusinesstype-modal.html', context)
def add_reference_modal(request, *args, **kwargs):
context = {
}
return render(request, 'popup_modals/addreference-modal.html', context)
def add_tag_modal(request, *args, **kwargs):
context = {
}
return render(request, 'popup_modals/addtag-modal.html', context)
def add_business_modal(request, *args, **kwargs):
context = {
@ -535,15 +541,33 @@ def add_business_modal(request, *args, **kwargs):
return render(request, 'popup_modals/addbusiness-modal.html', context)
def add_user_story_modal(request):
def add_user_story_modal(request, project_id):
project = get_object_or_404(Project, project_id=project_id)
if request.method == 'POST':
content = request.POST.get('content')
story = ProjectRequirement(
content = content,
project = project,
added_by = request.user,
)
story.save()
# Reload the parent page using JavaScript
response = HttpResponse('<script>window.top.location.reload();</script>')
return response
context = {
'project' : project,
}
return render(request, 'popup_modals/add-userstory-modal.html', context)
def staff_position_modal(request):
context = {
@ -701,10 +725,10 @@ def save_project(request):
project.members.set(members_profiles)
# Save project requirements
requirements = request.POST.getlist('requirements') # Assuming 'requirements' is the name of your requirement input field
requirements = request.POST.getlist('requirements')
for requirement_content in requirements:
if requirement_content:
requirement = ProjectRequirement(content=requirement_content, project=project)
requirement = ProjectRequirement(content=requirement_content, project=project, added_by=request.user)
requirement.save()
return redirect('my-projects')
@ -717,28 +741,26 @@ def save_epic(request):
title = request.POST.get('title')
status = request.POST.get('status')
description = request.POST.get('description')
project_id = request.POST.get('project') # Get project ID as a string
# Retrieve the Project instance
try:
project = Project.objects.get(id=project_id)
except Project.DoesNotExist:
pass
project_id = request.POST.get('project')
project = get_object_or_404(Project, id=project_id)
start_date = request.POST.get('start_date')
end_date = request.POST.get('end_date')
# Create the Epic object with the Project instance
epic = Epic(
title=title,
status=status,
project=project, # Assign the Project instance
project=project,
description=description,
start_date=start_date,
end_date=end_date
)
# Save the Epic object to the database
epic.save()
# Redirect to the detailed project page
@ -746,43 +768,28 @@ def save_epic(request):
return redirect(redirect_url)
@login_required
def save_task(request):
if request.method == 'POST':
name = request.POST.get('name')
status = request.POST.get('status')
project_id = request.POST.get('project')
epic_id = request.POST.get('epic')
assigned_to_id = request.POST.get('assigned_to')
extra = request.POST.get('extra')
description = request.POST.get('description')
start_date = request.POST.get('start_date')
end_date = request.POST.get('end_date')
try:
project = Project.objects.get(id=project_id)
except Project.DoesNotExist:
# Handle the case where the project with the provided ID doesn't exist
# You might want to display an error message or redirect to an appropriate page.
pass
try:
epic = Epic.objects.get(id=epic_id)
except Epic.DoesNotExist:
# Handle the case where the epic with the provided ID doesn't exist
# You might want to display an error message or redirect to an appropriate page.
pass
project_id = request.POST.get('project')
project = get_object_or_404(Project, id=project_id)
epic_id = request.POST.get('epic')
epic = get_object_or_404(Epic, id=epic_id)
try:
assigned_to = StaffProfile.objects.get(id=assigned_to_id)
except StaffProfile.DoesNotExist:
# Handle the case where the StaffProfile with the provided ID doesn't exist
# You might want to display an error message or redirect to an appropriate page.
pass
assigned_to_id = request.POST.get('assigned_to')
assigned_to = get_object_or_404(StaffProfile, id=assigned_to_id)
# Create the Task object with the Project and Epic instances
task = Task(
name=name,
status=status,
@ -799,7 +806,6 @@ def save_task(request):
# Save the Task object to the database
task.save()
task_id = task.id
# Redirect to the task detailed page
task_details_url = reverse('detailed-task', args=[task.task_id])

@ -73,7 +73,7 @@ urlpatterns = [
path('add-note/', views.add_note_modal, name='addnote'),
path('add-project-note/', views.add_project_note_modal, name='addprojectnote'),
path('add-file/', views.add_file_modal, name='addfile'),
path('add-user-story/', views.add_user_story_modal, name='adduserstory'),
path('add-user-story/<str:project_id>/', views.add_user_story_modal, name='adduserstory'),
path('add-credentials/', views.add_credentials_modal, name='addcredentials'),
path('update-status/<str:task_id>/', views.update_status_modal, name='updatestatus'),
path('add-point/<str:task_id>/', views.add_point_modal, name='addpoint'),

@ -963,10 +963,6 @@ video {
width: 12rem;
}
.w-\[100px\] {
width: 100px;
}
.w-\[120px\] {
width: 120px;
}
@ -1862,6 +1858,10 @@ video {
padding-right: 1rem;
}
.pr-8 {
padding-right: 2rem;
}
.pt-3 {
padding-top: 0.75rem;
}

@ -243,8 +243,8 @@
<div>
<div>
<p class="text-gray-500 text-xl">Project Details:</p>
<div class="w-full px-8">
<p class="text-gray-500">
<div class="w-full pr-8">
<p class="text-slate-800 font-semibold">
{{project.details}}
</p>
</div>
@ -263,7 +263,7 @@
<button
class="h-full rounded-tr-md px-4 bg-gray-300 text-slate-700 text-[18px] outline-none border-none cursor-pointer flex justify-center items-center addUserStoryButton"
data-modal-url="{% url 'adduserstory' %}">
data-modal-url="{% url 'adduserstory' project.project_id %}">
<i class="fa fa-plus"></i>
</button>
</div>

@ -13,7 +13,7 @@
</head>
<body>
<form id="hiddenContent" method="POST" action="">
<form id="hiddenContent" method="POST" action="{% url 'adduserstory' project.project_id %}">
{% csrf_token %}
<h1 class="text-slate-800 text-2xl font-semibold text-center">Add User Story</h1>

Loading…
Cancel
Save