diff --git a/osinaweb/db.sqlite3 b/osinaweb/db.sqlite3 index c647587d..e7b1afe2 100644 Binary files a/osinaweb/db.sqlite3 and b/osinaweb/db.sqlite3 differ diff --git a/osinaweb/osinacore/__pycache__/admin.cpython-310.pyc b/osinaweb/osinacore/__pycache__/admin.cpython-310.pyc index 6e555c86..c1db5bfa 100644 Binary files a/osinaweb/osinacore/__pycache__/admin.cpython-310.pyc and b/osinaweb/osinacore/__pycache__/admin.cpython-310.pyc differ diff --git a/osinaweb/osinacore/__pycache__/models.cpython-310.pyc b/osinaweb/osinacore/__pycache__/models.cpython-310.pyc index 98e3d851..fa23cbf2 100644 Binary files a/osinaweb/osinacore/__pycache__/models.cpython-310.pyc and b/osinaweb/osinacore/__pycache__/models.cpython-310.pyc differ diff --git a/osinaweb/osinacore/__pycache__/views.cpython-310.pyc b/osinaweb/osinacore/__pycache__/views.cpython-310.pyc index ff92ef67..2bd27f66 100644 Binary files a/osinaweb/osinacore/__pycache__/views.cpython-310.pyc and b/osinaweb/osinacore/__pycache__/views.cpython-310.pyc differ diff --git a/osinaweb/osinacore/admin.py b/osinaweb/osinacore/admin.py index 7e36521a..5bca6652 100644 --- a/osinaweb/osinacore/admin.py +++ b/osinaweb/osinacore/admin.py @@ -32,5 +32,6 @@ admin.site.register(Note) admin.site.register(Task) admin.site.register(Status) admin.site.register(Tag) +admin.site.register(Point) diff --git a/osinaweb/osinacore/migrations/0032_point.py b/osinaweb/osinacore/migrations/0032_point.py new file mode 100644 index 00000000..a6ce34de --- /dev/null +++ b/osinaweb/osinacore/migrations/0032_point.py @@ -0,0 +1,23 @@ +# Generated by Django 4.2.5 on 2023-09-22 17:52 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('osinacore', '0031_alter_staffprofile_image'), + ] + + operations = [ + migrations.CreateModel( + name='Point', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('text', models.TextField(blank=True)), + ('status', models.CharField(choices=[('Not Completed', 'Not Completed'), ('Working On', 'Working On'), ('Completed', 'Completed')], max_length=200, null=True)), + ('task', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='osinacore.task')), + ], + ), + ] diff --git a/osinaweb/osinacore/migrations/0033_point_date_completed_point_date_workingon_and_more.py b/osinaweb/osinacore/migrations/0033_point_date_completed_point_date_workingon_and_more.py new file mode 100644 index 00000000..373578b3 --- /dev/null +++ b/osinaweb/osinacore/migrations/0033_point_date_completed_point_date_workingon_and_more.py @@ -0,0 +1,33 @@ +# Generated by Django 4.2.5 on 2023-09-22 17:57 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('osinacore', '0032_point'), + ] + + operations = [ + migrations.AddField( + model_name='point', + name='date_completed', + field=models.CharField(max_length=200, null=True), + ), + migrations.AddField( + model_name='point', + name='date_workingon', + field=models.CharField(max_length=200, null=True), + ), + migrations.AddField( + model_name='point', + name='time_completed', + field=models.CharField(max_length=200, null=True), + ), + migrations.AddField( + model_name='point', + name='time_workingon', + field=models.CharField(max_length=200, null=True), + ), + ] diff --git a/osinaweb/osinacore/migrations/0034_alter_point_date_completed_and_more.py b/osinaweb/osinacore/migrations/0034_alter_point_date_completed_and_more.py new file mode 100644 index 00000000..33d90f8f --- /dev/null +++ b/osinaweb/osinacore/migrations/0034_alter_point_date_completed_and_more.py @@ -0,0 +1,33 @@ +# Generated by Django 4.2.5 on 2023-09-22 18:07 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('osinacore', '0033_point_date_completed_point_date_workingon_and_more'), + ] + + operations = [ + migrations.AlterField( + model_name='point', + name='date_completed', + field=models.CharField(blank=True, max_length=200, null=True), + ), + migrations.AlterField( + model_name='point', + name='date_workingon', + field=models.CharField(blank=True, max_length=200, null=True), + ), + migrations.AlterField( + model_name='point', + name='time_completed', + field=models.CharField(blank=True, max_length=200, null=True), + ), + migrations.AlterField( + model_name='point', + name='time_workingon', + field=models.CharField(blank=True, max_length=200, null=True), + ), + ] diff --git a/osinaweb/osinacore/migrations/__pycache__/0032_point.cpython-310.pyc b/osinaweb/osinacore/migrations/__pycache__/0032_point.cpython-310.pyc new file mode 100644 index 00000000..bb374ac7 Binary files /dev/null and b/osinaweb/osinacore/migrations/__pycache__/0032_point.cpython-310.pyc differ diff --git a/osinaweb/osinacore/migrations/__pycache__/0033_point_date_completed_point_date_workingon_and_more.cpython-310.pyc b/osinaweb/osinacore/migrations/__pycache__/0033_point_date_completed_point_date_workingon_and_more.cpython-310.pyc new file mode 100644 index 00000000..903bfd65 Binary files /dev/null and b/osinaweb/osinacore/migrations/__pycache__/0033_point_date_completed_point_date_workingon_and_more.cpython-310.pyc differ diff --git a/osinaweb/osinacore/migrations/__pycache__/0034_alter_point_date_completed_and_more.cpython-310.pyc b/osinaweb/osinacore/migrations/__pycache__/0034_alter_point_date_completed_and_more.cpython-310.pyc new file mode 100644 index 00000000..0772d671 Binary files /dev/null and b/osinaweb/osinacore/migrations/__pycache__/0034_alter_point_date_completed_and_more.cpython-310.pyc differ diff --git a/osinaweb/osinacore/models.py b/osinaweb/osinacore/models.py index 0e65fc6e..f0337950 100644 --- a/osinaweb/osinacore/models.py +++ b/osinaweb/osinacore/models.py @@ -216,6 +216,23 @@ class Task(models.Model): return f"{parts[2]}-{parts[1]}-{parts[0]}" + +class Point(models.Model): + text = models.TextField(blank=True) + STATUS_CHOICES = ( + ('Not Completed', 'Not Completed'), + ('Working On', 'Working On'), + ('Completed', 'Completed') + ) + status = models.CharField(max_length=200, choices=STATUS_CHOICES, null=True) + task = models.ForeignKey(Task, on_delete=models.CASCADE, null=True) + date_workingon = models.CharField(max_length=200, null=True, blank=True) + date_completed = models.CharField(max_length=200, null=True, blank=True) + time_workingon = models.CharField(max_length=200, null=True, blank=True) + time_completed = models.CharField(max_length=200, null=True, blank=True) + + + class Status(models.Model): text = models.TextField(blank=True) date = models.CharField(max_length=40) diff --git a/osinaweb/osinacore/views.py b/osinaweb/osinacore/views.py index fe5afc1c..0fb7d5e7 100644 --- a/osinaweb/osinacore/views.py +++ b/osinaweb/osinacore/views.py @@ -288,9 +288,11 @@ def staffs(request): @login_required def detailed_task(request, task_id): task = get_object_or_404(Task, task_id=task_id) + points = Point.objects.filter(task=task).order_by('-id') context = { 'task': task, + 'points' : points, } @@ -371,8 +373,10 @@ def add_credentials_modal(request, *args, **kwargs): return render(request, 'addcredentials-modal.html', context) -def add_point_modal(request, *args, **kwargs): +def add_point_modal(request, task_id): + task = get_object_or_404(Task, task_id=task_id) context = { + 'task' : task, } return render(request, 'addpoint-modal.html', context) @@ -389,8 +393,12 @@ def delete_task_modal(request, *args, **kwargs): } return render(request, 'deletetask-modal.html', context) -def show_points_modal(request, *args, **kwargs): +def show_points_modal(request, task_id): + task = get_object_or_404(Task, task_id=task_id) + points = Point.objects.filter(task=task).order_by('-id') context = { + 'task' : task, + 'points' : points, } return render(request, 'showpoints-modal.html', context) @@ -460,6 +468,7 @@ def add_daily_report(request): #Fetch Views + def fetch_related_tasks(request): # Get the selected epic ID from the request epic_id = request.GET.get("epic_id") @@ -486,6 +495,8 @@ def fetch_related_tasks(request): #Save Functions + + @login_required def save_note(request): if request.method == 'POST': @@ -805,8 +816,6 @@ def save_staff(request): - - @login_required def save_status(request): if request.method == 'POST': @@ -898,6 +907,67 @@ def save_tag(request): return redirect('tags') + +@login_required +def save_point(request): + if request.method == 'POST': + text = request.POST.get('text') + task = request.POST.get('task') + + taskobj = get_object_or_404(Task, id=task) + + + point = Point( + text = text, + task = taskobj, + status='Not Completed' + ) + point.save() + + + return render(request, 'addpoint-modal.html') + + +@login_required +def mark_point_working_on(request, point_id): + point = get_object_or_404(Point, id=point_id) + point.status = 'Working On' + current_datetime = timezone.now() + point.date_workingon = current_datetime.date() + point.time_workingon = current_datetime.strftime("%I:%M %p") + + point.save() + + # Create a new Status object + status_text = f'Working On: {point.text}' + status = Status(text=status_text, date=current_datetime.date(), time=current_datetime.strftime("%I:%M %p"), staff=request.user.staffprofile) + status.save() + + + + return redirect(request, 'showpoints-modal.html') + + +@login_required +def mark_point_completed(request, point_id): + point = get_object_or_404(Point, id=point_id) + point.status = 'Completed' + current_datetime = timezone.now() + point.date_completed = current_datetime.date() + point.time_completed = current_datetime.strftime("%I:%M %p") + + point.save() + + # Create a new Status object + status_text = f'{point.text} - Completed' + status = Status(text=status_text, date=current_datetime.date(), time=current_datetime.strftime("%I:%M %p"), staff=request.user.staffprofile) + status.save() + + + + return redirect(request, 'showpoints-modal.html') + + # EDIT TEMPLATES @login_required @@ -978,6 +1048,7 @@ def edit_project_type(request, projecttype_id): return render(request, 'edit_pages/edit-project-type.html', {'projecttype': projecttype}) + @login_required def edit_reference(request, reference_id): reference = get_object_or_404(Reference, id=reference_id) @@ -992,6 +1063,7 @@ def edit_reference(request, reference_id): return render(request, 'edit_pages/edit-reference.html', {'reference': reference}) + @login_required def edit_tag(request, tag_id): tag = get_object_or_404(Tag, id=tag_id) diff --git a/osinaweb/osinaweb/__pycache__/urls.cpython-310.pyc b/osinaweb/osinaweb/__pycache__/urls.cpython-310.pyc index 949a0d9c..2fe6baf7 100644 Binary files a/osinaweb/osinaweb/__pycache__/urls.cpython-310.pyc and b/osinaweb/osinaweb/__pycache__/urls.cpython-310.pyc differ diff --git a/osinaweb/osinaweb/urls.py b/osinaweb/osinaweb/urls.py index 8ca94787..d99d804a 100644 --- a/osinaweb/osinaweb/urls.py +++ b/osinaweb/osinaweb/urls.py @@ -63,8 +63,8 @@ urlpatterns = [ path('addfile/', views.add_file_modal, name='addfile'), path('addcredentials/', views.add_credentials_modal, name='addcredentials'), path('updatestatus/', views.update_status_modal, name='updatestatus'), - path('addpoint/', views.add_point_modal, name='addpoint'), - path('showpoints/', views.show_points_modal, name='showpoints'), + path('addpoint//', views.add_point_modal, name='addpoint'), + path('showpoints//', views.show_points_modal, name='showpoints'), path('addtime/', views.add_time_modal, name='addtime'), path('timeline/', views.timeline_modal, name='timeline'), path('deletetask/', views.delete_task_modal, name='deletetask'), @@ -88,8 +88,12 @@ urlpatterns = [ path('save_projecttype/', views.save_projecttype, name='save_projecttype'), path('save_reference/', views.save_reference, name='save_reference'), path('save_tag/', views.save_tag, name='save_tag'), + path('save_point/', views.save_point, name='save_point'), - # Edit Templates + + + + # Edit Urls path('editproject/', views.edit_project, name='editproject'), path('editepic/', views.edit_epic, name='editepic'), path('edittask/', views.edit_task, name='edittask'), @@ -100,6 +104,8 @@ urlpatterns = [ path('editreference/', views.edit_reference, name='editreference'), path('edittag/', views.edit_tag, name='edittag'), path('editstaffposition/', views.edit_staff_position, name='editstaffposition'), + path('mark_point_working_on//', views.mark_point_working_on, name='mark_point_working_on'), + path('mark_point_completed//', views.mark_point_completed, name='mark_point_completed'), ] diff --git a/osinaweb/templates/addpoint-modal.html b/osinaweb/templates/addpoint-modal.html index 39dc3795..eaacd2b9 100644 --- a/osinaweb/templates/addpoint-modal.html +++ b/osinaweb/templates/addpoint-modal.html @@ -15,13 +15,19 @@ -
+
+ {% csrf_token %}

Add Point

+
- + >
@@ -30,13 +36,9 @@

- - -
@@ -44,7 +46,7 @@
- --> -
+ \ No newline at end of file diff --git a/osinaweb/templates/index.html b/osinaweb/templates/index.html index 2c0d0fc1..2f9da78f 100644 --- a/osinaweb/templates/index.html +++ b/osinaweb/templates/index.html @@ -161,11 +161,11 @@ + +
+ {% csrf_token %} + - +
+ {% endif %} + {% if point.status == 'Completed' %}
-

Fix the LaylNhar Header

+

{{point.text}}

-
- - +
+
+ {% endif %} + + {% if point.status == 'Working On' %}
-

Fix the LaylNhar Header Lorem ipsum dolor sit amet - consectetur - adipisicing elit. Autem sit esse, cupiditate voluptas, dolorem nisi sunt, molestiae eaque neque - cumque ex amet! Sequi aliquid quos ullam, sapiente iste impedit explicabo?

+

{{point.text}}

-
- +
+ +
+ {% csrf_token %} + +
+
+ {% endif %} + + {% endfor %} + + + +
diff --git a/osinaweb/templates/task-details.html b/osinaweb/templates/task-details.html index 047c5446..5ea8054b 100644 --- a/osinaweb/templates/task-details.html +++ b/osinaweb/templates/task-details.html @@ -56,9 +56,21 @@
+ {% if task.status == 'Open' %}
-

Task Name

+

{{task.name}}

+ {% endif %} + {% if task.status == 'Working On' %} +
+

{{task.name}}

+
+ {% endif %} + {% if task.status == 'Closed' %} +
+

{{task.name}}

+
+ {% endif %}
+ +
+ {% csrf_token %} + - +
+ {% endif %} + {% if point.status == 'Completed' %}
-

Fix the LaylNhar Header

+

{{point.text}}

-
- - +
+
+ {% endif %} + -
+ {% if point.status == 'Working On' %} +
-

Fix the LaylNhar Header Lorem ipsum dolor sit amet - consectetur - adipisicing elit. Autem sit esse, cupiditate voluptas, dolorem nisi sunt, molestiae eaque neque - cumque ex amet! Sequi aliquid quos ullam, sapiente iste impedit explicabo?

+

{{point.text}}

-
- +
+ +
+ {% csrf_token %} + +
+
+ {% endif %} + + {% endfor %} +
- +
@@ -284,14 +323,7 @@

Description:

- Lorem Ipsum is simply dummy text of the printing and typesetting industry. - Lorem Ipsum has been the industry's standard dummy text ever since the - 1500s, when an unknown printer took a galley of type and scrambled it to - make a type specimen book. It has survived not only five centuries, but also - the leap into electronic typesetting, remaining essentially unchanged. It - was popularised in the 1960s with the release of Letraset sheets containing - Lorem Ipsum passages, and more recently with desktop publishing software - like Aldus PageMaker including versions of Lorem Ipsum. + {{task.description}}

diff --git a/osinaweb/templates/tasks.html b/osinaweb/templates/tasks.html index 3b612c56..55802c78 100644 --- a/osinaweb/templates/tasks.html +++ b/osinaweb/templates/tasks.html @@ -118,6 +118,13 @@

{{task.name}}

{% endif %} + {% if task.status == 'Closed' %} +
+

{{task.name}}

+
+ {% endif %} +

{{task.status}}

@@ -182,17 +189,17 @@ -
+