diff --git a/osinaweb/db.sqlite3 b/osinaweb/db.sqlite3 index 2e62e622..bb48b1c8 100644 Binary files a/osinaweb/db.sqlite3 and b/osinaweb/db.sqlite3 differ diff --git a/osinaweb/osinacore/__pycache__/views.cpython-310.pyc b/osinaweb/osinacore/__pycache__/views.cpython-310.pyc index 7e835955..75633720 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/views.py b/osinaweb/osinacore/views.py index abd05cff..395e6686 100644 --- a/osinaweb/osinacore/views.py +++ b/osinaweb/osinacore/views.py @@ -1146,14 +1146,67 @@ def save_dailyreport(request): # EDIT TEMPLATES @login_required -def edit_project(request, *args, **kwargs): - +def edit_project(request, project_id): + project = get_object_or_404(Project, project_id=project_id) + + staffs = StaffProfile.objects.all().order_by('-id') + current_manager = project.manager + customers = CustomerProfile.objects.all().order_by('-id') + current_client = project.customer + types = ProjectType.objects.all().order_by('-id') + + + if request.method == 'POST': + + project.name = request.POST.get('name') + + new_customer_id = request.POST.get('customer') + customer = get_object_or_404(CustomerProfile, id=new_customer_id) + project.customer = customer + + new_manager_id = request.POST.get('manager') + manager = get_object_or_404(StaffProfile, id=new_manager_id) + project.manager = manager + + + members_ids = request.POST.getlist('members') + members_profiles = StaffProfile.objects.filter(id__in=members_ids) + project.members.set(members_profiles) + + + project.status = request.POST.get('status') + + + type_ids = request.POST.getlist('types') + types = ProjectType.objects.filter(id__in=type_ids) + project.project_type.set(type_ids) + + + project.details = request.POST.get('details') + project.start_date = request.POST.get('start_date') + project.end_date = request.POST.get('end_date') + + + project.save() + return redirect('detailed-project', project_id=project.project_id) + + + context = { + 'project' : project, + 'staffs' : staffs, + 'current_manager' : current_manager, + 'customers' : customers, + 'current_client' : current_client, + 'types' : types, + + } return render(request, 'edit_pages/edit-project.html', context) + @login_required def edit_epic(request, *args, **kwargs): @@ -1164,10 +1217,14 @@ def edit_epic(request, *args, **kwargs): @login_required -def edit_task(request, *args, **kwargs): +def edit_task(request, task_id): + task = get_object_or_404(Task, task_id=task_id) + + projects = Project.objects.all().order_by('-id') context = { - + 'task' :task, + 'projects' : projects, } return render(request, 'edit_pages/edit-task.html', context) diff --git a/osinaweb/osinaweb/__pycache__/urls.cpython-310.pyc b/osinaweb/osinaweb/__pycache__/urls.cpython-310.pyc index 6131bdd8..4b79fbe1 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 a88780f3..7f53c7fb 100644 --- a/osinaweb/osinaweb/urls.py +++ b/osinaweb/osinaweb/urls.py @@ -105,9 +105,9 @@ urlpatterns = [ #Edit Pages - path('edit-project/', views.edit_project, name='editproject'), + path('edit-project//', views.edit_project, name='editproject'), path('edit-epic/', views.edit_epic, name='editepic'), - path('edit-task/', views.edit_task, name='edittask'), + path('edit-task/', views.edit_task, name='edittask'), path('edit-customer//', views.edit_customer, name='editcustomer'), path('edit-business//', views.edit_business, name='editbusiness'), path('edit-staff//', views.edit_staff, name='editstaff'), diff --git a/osinaweb/templates/details_pages/project-details.html b/osinaweb/templates/details_pages/project-details.html index 7931dff6..2dbbc026 100644 --- a/osinaweb/templates/details_pages/project-details.html +++ b/osinaweb/templates/details_pages/project-details.html @@ -120,7 +120,7 @@ - + diff --git a/osinaweb/templates/details_pages/task-details.html b/osinaweb/templates/details_pages/task-details.html index d9c0cead..0a57e13f 100644 --- a/osinaweb/templates/details_pages/task-details.html +++ b/osinaweb/templates/details_pages/task-details.html @@ -76,7 +76,7 @@ - + diff --git a/osinaweb/templates/edit_pages/edit-project.html b/osinaweb/templates/edit_pages/edit-project.html index edd2348d..6113a36a 100644 --- a/osinaweb/templates/edit_pages/edit-project.html +++ b/osinaweb/templates/edit_pages/edit-project.html @@ -8,125 +8,106 @@ Edit Project -
+ {% csrf_token %} - - - - - - - - - - - - - - -
-
- +
+
+ +
- - +
+ + +
+ +
+ + +
- + +
+ + +
+ +
+ +
- - -
- +
+ + +
+ +
+ + +
+ +
+ +
+ + class="w-full p-3 border border-gray-300 rounded-md bg-transparent outline-none mt-2">
-
- + +
+ + class="w-full p-3 border border-gray-300 rounded-md bg-transparent outline-none mt-2">
+
diff --git a/osinaweb/templates/edit_pages/edit-task.html b/osinaweb/templates/edit_pages/edit-task.html index 0020723f..5d577580 100644 --- a/osinaweb/templates/edit_pages/edit-task.html +++ b/osinaweb/templates/edit_pages/edit-task.html @@ -11,97 +11,89 @@ {% csrf_token %} - +
+ + +
- +
+ + +
- +
+ + +
- +
+ + +
- +
+ + +
- +
+ + +
-
- +
+
-
- +
+ + class="w-full p-3 border border-gray-300 rounded-md bg-transparent outline-none mt-2">
-
- +
+ -
- -
-
- - Upload - Document(s) - - -
+ class="w-full p-3 border border-gray-300 rounded-md bg-transparent outline-none mt-2">
- -
- + diff --git a/osinaweb/templates/index.html b/osinaweb/templates/index.html index 78dda50b..089a855c 100644 --- a/osinaweb/templates/index.html +++ b/osinaweb/templates/index.html @@ -198,7 +198,7 @@ class="p-2 border border-gray-200 text-base h-[70px] bg-gray-100 text-gray-500 deleteTaskButton" data-modal-url="{% url 'deletetask' %}">Delete - + @@ -345,7 +345,7 @@ class="p-2 border border-gray-200 text-sm h-[70px] bg-gray-100 text-gray-500 deleteTaskButton" data-modal-url="{% url 'deletetask' %}">Delete - + diff --git a/osinaweb/templates/listing_pages/projects.html b/osinaweb/templates/listing_pages/projects.html index ea9fb7c1..97812340 100644 --- a/osinaweb/templates/listing_pages/projects.html +++ b/osinaweb/templates/listing_pages/projects.html @@ -158,7 +158,7 @@
- +
diff --git a/osinaweb/templates/listing_pages/tasks.html b/osinaweb/templates/listing_pages/tasks.html index d2232f37..87c781f8 100644 --- a/osinaweb/templates/listing_pages/tasks.html +++ b/osinaweb/templates/listing_pages/tasks.html @@ -217,7 +217,7 @@ class="p-2 border border-gray-200 text-base h-[70px] bg-gray-100 text-gray-500 deleteTaskButton" data-modal-url="{% url 'deletetask' %}">Delete -
+