From c185d2612e40a4b250468ab2d62908b2822b90e5 Mon Sep 17 00:00:00 2001 From: "bojana.marojevikj" <bojana.marojevikj@finki.ukim.mk> Date: Wed, 12 Feb 2025 12:01:36 +0100 Subject: [PATCH 1/8] coordinator validation bootbox confirm --- .../templates/coordinator/journalDetails.html | 33 ++++++++++++++++--- src/main/resources/templates/layout.html | 5 +-- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/src/main/resources/templates/coordinator/journalDetails.html b/src/main/resources/templates/coordinator/journalDetails.html index 1ea77ec..704b96b 100644 --- a/src/main/resources/templates/coordinator/journalDetails.html +++ b/src/main/resources/templates/coordinator/journalDetails.html @@ -6,6 +6,29 @@ <head> <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet"> <title>Дневник</title> + <script> + function confirmAction(form, message) { + bootbox.confirm({ + message: message, + buttons: { + confirm: { + label: 'Да', + className: 'btn-success' + }, + cancel: { + label: 'РќРµ', + className: 'btn-danger' + } + }, + callback: function (result) { + if (result) { + form.submit(); + } + } + }); + return false; + } + </script> <style> textarea { resize: none; @@ -117,16 +140,18 @@ <div th:if="${internship.getStatus() == InternshipStatus.VALIDATED_BY_COMPANY}" style="display: flex; justify-content: center; flex-direction: row; margin-bottom: 2rem; margin-top: 2rem;"> <form method="post" th:action="@{'/coordinator-internships/' + ${internship.getId()} + '/approve'}" - onsubmit="return confirm('Дали сте СЃРёРіСѓСЂРЅРё дека сакате РґР° СР° валидирате праксата?')"> + onsubmit="return confirmAction(this, 'Дали сте СЃРёРіСѓСЂРЅРё дека сакате РґР° СР° валидирате праксата?')"> <input type="hidden" name="internshipId" th:value="${internship.getId()}"> - <button type="submit" class="btn btn-success" style="color: white; padding: 0.5rem 1rem; border-radius: 0.75rem;" th:disabled="${internship.getStatus() == T(mk.ukim.finki.wp.internships.model.internships.InternshipStatus).ACCEPTED}"> + <button type="submit" class="btn btn-success" style="color: white; padding: 0.5rem 1rem; border-radius: 0.75rem;" + th:disabled="${internship.getStatus() == T(mk.ukim.finki.wp.internships.model.internships.InternshipStatus).ACCEPTED}"> Р’Р°Р»РёРґРёСЂР°С </button> </form> + <form method="post" th:action="@{'/coordinator-internships/' + ${internship.getId()} + '/disapprove'}" - onsubmit="return confirm('Дали сте СЃРёРіСѓСЂРЅРё дека сакате РґР° СР° поништите праксата?')"> + onsubmit="return confirmAction(this, 'Дали сте СЃРёРіСѓСЂРЅРё дека сакате РґР° СР° вратите праксата РІРѕ статус ACCEPTED?')"> <input type="hidden" name="internshipId" th:value="${internship.getId()}"> - <button type="submit" class="btn btn-danger" style="color: white; padding: 0.5rem 1rem; border-radius: 0.75rem; margin-right: 0.5rem; margin-left: 0.5rem" > + <button type="submit" class="btn btn-danger" style="color: white; padding: 0.5rem 1rem; border-radius: 0.75rem; margin-right: 0.5rem; margin-left: 0.5rem;"> РћРґР±РёС </button> </form> diff --git a/src/main/resources/templates/layout.html b/src/main/resources/templates/layout.html index 06b0430..23db79a 100644 --- a/src/main/resources/templates/layout.html +++ b/src/main/resources/templates/layout.html @@ -7,8 +7,9 @@ integrity="sha384-4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHDEXuppvnDJzQIu9" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"> - - + <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> + <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js"></script> + <script src="https://cdnjs.cloudflare.com/ajax/libs/bootbox.js/5.5.2/bootbox.min.js"></script> </head> <body> <!--/* Standard layout can be mixed with Layout Dialect */--> -- GitLab From 5d8af068c1bdf45bc8841c632fa3ebbbc1ee7f8f Mon Sep 17 00:00:00 2001 From: "bojana.marojevikj" <bojana.marojevikj@finki.ukim.mk> Date: Wed, 12 Feb 2025 12:05:22 +0100 Subject: [PATCH 2/8] company validation bootbox confirm --- .../templates/company/journalDetails.html | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/main/resources/templates/company/journalDetails.html b/src/main/resources/templates/company/journalDetails.html index 30880c6..ee50219 100644 --- a/src/main/resources/templates/company/journalDetails.html +++ b/src/main/resources/templates/company/journalDetails.html @@ -8,6 +8,29 @@ <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet"> <meta charset="UTF-8"> <title>Дневник</title> + <script> + function confirmAction(form, message) { + bootbox.confirm({ + message: message, + buttons: { + confirm: { + label: 'Да', + className: 'btn-success' + }, + cancel: { + label: 'РќРµ', + className: 'btn-danger' + } + }, + callback: function (result) { + if (result) { + form.submit(); + } + } + }); + return false; + } + </script> <style> textarea { resize: none; @@ -82,14 +105,16 @@ style="display: flex; justify-content: center; align-items: center; padding: 10px;"> <form style="display: inline" th:method="POST" - th:action="@{'/company-internships/' + ${internship.getId()} + '/valid' }"> + th:action="@{'/company-internships/' + ${internship.getId()} + '/valid' }" + onsubmit="return confirmAction(this, 'Дали сте СЃРёРіСѓСЂРЅРё дека сакате РґР° СР° валидирате праксата?')"> <button type="submit" class="btn btn-success" style="color: white; padding: 0.5rem 1rem; border-radius: 0.75rem;">Р’Р°Р»РёРґРёСЂР°С РґРЅРµРІРЅРёРє </button> </form> <form style="display: inline" th:method="POST" - th:action="@{'/company-internships/' + ${internship.getId()} + '/invalid' }"> + th:action="@{'/company-internships/' + ${internship.getId()} + '/invalid' }" + onsubmit="return confirmAction(this, 'Дали сте СЃРёРіСѓСЂРЅРё дека сакате РґР° СР° вратите праксата РІРѕ статус ACCEPTED?')"> <button type="submit" class="btn btn-danger" style="color: white; padding: 0.5rem 1rem; border-radius: 0.75rem; margin-right: 0.5rem; margin-left: 0.5rem">РћРґР±РёС РґРЅРµРІРЅРёРє </button> </form> -- GitLab From ac048f449444eccfbd974a1c30e3d91e032c77bb Mon Sep 17 00:00:00 2001 From: "bojana.marojevikj" <bojana.marojevikj@finki.ukim.mk> Date: Wed, 12 Feb 2025 12:14:27 +0100 Subject: [PATCH 3/8] button color change --- src/main/resources/templates/company/journalDetails.html | 2 +- src/main/resources/templates/coordinator/journalDetails.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/templates/company/journalDetails.html b/src/main/resources/templates/company/journalDetails.html index ee50219..e0c8b86 100644 --- a/src/main/resources/templates/company/journalDetails.html +++ b/src/main/resources/templates/company/journalDetails.html @@ -19,7 +19,7 @@ }, cancel: { label: 'РќРµ', - className: 'btn-danger' + className: 'btn-secondary' } }, callback: function (result) { diff --git a/src/main/resources/templates/coordinator/journalDetails.html b/src/main/resources/templates/coordinator/journalDetails.html index 704b96b..99f5873 100644 --- a/src/main/resources/templates/coordinator/journalDetails.html +++ b/src/main/resources/templates/coordinator/journalDetails.html @@ -17,7 +17,7 @@ }, cancel: { label: 'РќРµ', - className: 'btn-danger' + className: 'btn-secondary' } }, callback: function (result) { -- GitLab From e681adb07f5541cf889f90eee924d780502349db Mon Sep 17 00:00:00 2001 From: "bojana.marojevikj" <bojana.marojevikj@finki.ukim.mk> Date: Wed, 12 Feb 2025 12:36:23 +0100 Subject: [PATCH 4/8] student submit journal bootbox validation --- .../templates/student/journalDetails.html | 31 +++++++++++++- .../templates/student/journalEdit.html | 40 ++++++++++++++++--- 2 files changed, 64 insertions(+), 7 deletions(-) diff --git a/src/main/resources/templates/student/journalDetails.html b/src/main/resources/templates/student/journalDetails.html index 7ccedec..e65615c 100644 --- a/src/main/resources/templates/student/journalDetails.html +++ b/src/main/resources/templates/student/journalDetails.html @@ -8,6 +8,30 @@ <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet"> <meta charset="UTF-8"> <title>Дневник</title> + <script> + function confirmAction(element, message) { + bootbox.confirm({ + message: message, + buttons: { + confirm: { + label: 'Да', + className: 'btn-success' + }, + cancel: { + label: 'РќРµ', + className: 'btn-secondary' + } + }, + callback: function (result) { + if (result) { + window.location.href = element.getAttribute("data-url"); + } + } + }); + return false; + } + + </script> <style> .cardWeek:hover { outline: #1a3f8a solid 2px; @@ -80,10 +104,13 @@ <a th:href="'/student-internships/edit/' + ${internship.getId()}" th:if="${internship.getStatus() == InternshipStatus.ACCEPTED}" class="bg-yellow-500 text-white px-4 py-2 rounded"><i class="fa fa-edit"></i> Уреди дневник</a> - <a th:href="'/student-internships/submit/' + ${internship.getId()}" + <a href="#" + th:attr="data-url='/student-internships/submit/' + ${internship.getId()}" th:if="${internship.getStatus() == InternshipStatus.ACCEPTED}" class="bg-green-500 text-white px-4 py-2 rounded" - onclick="return confirm('Дали сте СЃРёРіСѓСЂРЅРё дека сакате РґР° РіРѕ поднесете дневникот?')"><i class="fa fa-check"></i> Поднеси дневник</a> + onclick="return confirmAction(this, 'Дали сте СЃРёРіСѓСЂРЅРё дека сакате РґР° РіРѕ поднесете дневникот?')"> + <i class="fa fa-check"></i> Поднеси дневник + </a> </div> diff --git a/src/main/resources/templates/student/journalEdit.html b/src/main/resources/templates/student/journalEdit.html index c0c5247..5f4608b 100644 --- a/src/main/resources/templates/student/journalEdit.html +++ b/src/main/resources/templates/student/journalEdit.html @@ -8,6 +8,30 @@ <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet"> <meta charset="UTF-8"> <title>Дневник</title> + <script> + function confirmAction(element, message) { + bootbox.confirm({ + message: message, + buttons: { + confirm: { + label: 'Да', + className: 'btn-success' + }, + cancel: { + label: 'РќРµ', + className: 'btn-secondary' + } + }, + callback: function (result) { + if (result) { + window.location.href = element.getAttribute("data-url"); + } + } + }); + return false; + } + + </script> <style> .cardWeek:hover{ outline: #2A93D1 solid 2px; @@ -110,10 +134,13 @@ <a th:href="'/student-internships/' + ${internship.getId()} + '/addWeek'" class="bg-blue-500 text-white px-4 py-2 rounded" th:if="${internship.getStatus() == InternshipStatus.ACCEPTED}"><i class="fa fa-plus"></i> Додади седмица</a> - <a th:href="'/student-internships/submit/' + ${internship.getId()}" + <a href="#" + th:attr="data-url='/student-internships/submit/' + ${internship.getId()}" th:if="${internship.getStatus() == InternshipStatus.ACCEPTED}" class="bg-green-500 text-white px-4 py-2 rounded" - onclick="return confirm('Дали сте СЃРёРіСѓСЂРЅРё дека сакате РґР° РіРѕ поднесете дневникот?')"><i class="fa fa-check"></i> Поднеси дневник</a> + onclick="return confirmAction(this, 'Дали сте СЃРёРіСѓСЂРЅРё дека сакате РґР° РіРѕ поднесете дневникот?')"> + <i class="fa fa-check"></i> Поднеси дневник + </a> </div> <div th:if="${journal == null or journal.isEmpty()}" class="mt-5"> @@ -168,9 +195,12 @@ <button type="submit" class="btn btn-sm btn-success" disabled>ЗачуваС</button> - <a th:href="'/student-internships/'+${internship.getId()}+'/internship-weeks/'+${week.getId()}+'/delete'" - onclick="return confirm('Дали сте СЃРёРіСѓСЂРЅРё дека сакате РґР° СР° избришете седмицата?')"> - <i class="fas btn btn-danger fa-trash-alt"></i> + <a href="#" + th:attr="data-url='/student-internships/'+${internship.getId()}+'/internship-weeks/'+${week.getId()}+'/delete'" + th:if="${internship.getStatus() == InternshipStatus.ACCEPTED}" + class="btn btn-danger" + onclick="return confirmAction(this, 'Дали сте СЃРёРіСѓСЂРЅРё дека сакате РґР° СР° избришете седмицата?')"> + <i class="fas fa-trash-alt"></i> </a> </div> </div> -- GitLab From ba5631e8c6fba06ecda05c55c8312c77d9bb2422 Mon Sep 17 00:00:00 2001 From: "bojana.marojevikj" <bojana.marojevikj@finki.ukim.mk> Date: Wed, 12 Feb 2025 12:47:42 +0100 Subject: [PATCH 5/8] fix --- src/main/resources/templates/student/journalEdit.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/templates/student/journalEdit.html b/src/main/resources/templates/student/journalEdit.html index 5f4608b..ec207cf 100644 --- a/src/main/resources/templates/student/journalEdit.html +++ b/src/main/resources/templates/student/journalEdit.html @@ -151,7 +151,7 @@ <form th:each="week : ${journal}" th:action="'/student-internships/'+${internship.getId()}+'/internship-weeks/'+${week.getId()}+'/save'" - method="post" + th:method="post" style="display: contents;"> <div style="display: flex; flex-direction: column; box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1); border-radius: 20px; padding: 16px; min-height: auto;" class="lg:h-auto flex flex-col shadowCard rounded-xl p-4 shadow-xl h-[30vh] lg:h-auto cardWeek"> -- GitLab From 025a7b43c29590f5f5a982d7648a1c27b9b53b5f Mon Sep 17 00:00:00 2001 From: "bojana.marojevikj" <bojana.marojevikj@finki.ukim.mk> Date: Wed, 12 Feb 2025 12:59:05 +0100 Subject: [PATCH 6/8] fix --- src/main/resources/templates/student/journalEdit.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/templates/student/journalEdit.html b/src/main/resources/templates/student/journalEdit.html index ec207cf..36b2db7 100644 --- a/src/main/resources/templates/student/journalEdit.html +++ b/src/main/resources/templates/student/journalEdit.html @@ -150,8 +150,8 @@ <div th:if="${internship.getStatus() == InternshipStatus.ACCEPTED}" style="width: 100%; height: max-content; max-width: none; flex-basis: 75%; margin-left: auto; margin-right: auto;" class="lg:w-fit md:basis-2/3 lg:basis-3/4 p-8 w-full lg:w-fit mx-auto grid grid-cols-1 lg:grid-cols-2 gap-4"> <form th:each="week : ${journal}" - th:action="'/student-internships/'+${internship.getId()}+'/internship-weeks/'+${week.getId()}+'/save'" - th:method="post" + th:action="@{'/student-internships/'+${internship.getId()}+'/internship-weeks/'+${week.getId()}+'/save'}" + th:method="POST" style="display: contents;"> <div style="display: flex; flex-direction: column; box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1); border-radius: 20px; padding: 16px; min-height: auto;" class="lg:h-auto flex flex-col shadowCard rounded-xl p-4 shadow-xl h-[30vh] lg:h-auto cardWeek"> -- GitLab From 536fa131081b9a3127313772cad29542a581075f Mon Sep 17 00:00:00 2001 From: "bojana.marojevikj" <bojana.marojevikj@finki.ukim.mk> Date: Wed, 12 Feb 2025 14:05:11 +0100 Subject: [PATCH 7/8] fix --- .../templates/student/journalEdit.html | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/main/resources/templates/student/journalEdit.html b/src/main/resources/templates/student/journalEdit.html index 36b2db7..11f2bba 100644 --- a/src/main/resources/templates/student/journalEdit.html +++ b/src/main/resources/templates/student/journalEdit.html @@ -110,25 +110,25 @@ <i class="fas fa-exclamation-circle me-2"></i> <span th:text="${error}"></span> </div> -<!-- <div th:if="${internship.getStatus() == InternshipStatus.ACCEPTED}" class="text-center mt-6">--> -<!-- <form th:action="'/student-internships/'+${internship.getId()}+'/update-dates'"--> -<!-- method="post">--> -<!-- <div class="row" style="display: flex; justify-content: center; align-items: center;">--> -<!-- <div class="col-2" style="display: flex; flex-direction: column; justify-content: space-between;">--> -<!-- <label for="internshipStartDate" style="color: #333; font-weight: bold; margin-bottom: 0.5rem;">Почеток РЅР° пракса</label>--> -<!-- <input type="date" id="internshipStartDate" name="internshipStartDate" th:value="${internship?.getStartDate()}"--> -<!-- style="border-radius: 0.5rem; border: 1px solid #ccc; padding: 0.5rem;">--> -<!-- </div>--> -<!-- <div class="col-2" style="display: flex; flex-direction: column; justify-content: space-between;">--> -<!-- <label for="internshipEndDate" style="color: #333; font-weight: bold; margin-bottom: 0.5rem;">РљСЂР°С РЅР° пракса</label>--> -<!-- <input type="date" id="internshipEndDate" name="internshipEndDate" th:value="${internship?.getEndDate()}"--> -<!-- style="border-radius: 0.5rem; border: 1px solid #ccc; padding: 0.5rem;">--> -<!-- </div>--> -<!-- </div>--> -<!-- <button type="submit" class="btn btn-success btn-sm mt-2"--> -<!-- >ЗачуваС</button>--> -<!-- </form>--> -<!-- </div>--> + <div th:if="${internship.getStatus() == InternshipStatus.ACCEPTED}" class="text-center mt-6"> + <form th:action="'/student-internships/'+${internship.getId()}+'/update-dates'" + method="post"> + <div class="row" style="display: flex; justify-content: center; align-items: center;"> + <div class="col-2" style="display: flex; flex-direction: column; justify-content: space-between;"> + <label for="internshipStartDate" style="color: #333; font-weight: bold; margin-bottom: 0.5rem;">Почеток РЅР° пракса</label> + <input type="date" id="internshipStartDate" name="internshipStartDate" th:value="${internship?.getStartDate()}" + style="border-radius: 0.5rem; border: 1px solid #ccc; padding: 0.5rem;"> + </div> + <div class="col-2" style="display: flex; flex-direction: column; justify-content: space-between;"> + <label for="internshipEndDate" style="color: #333; font-weight: bold; margin-bottom: 0.5rem;">РљСЂР°С РЅР° пракса</label> + <input type="date" id="internshipEndDate" name="internshipEndDate" th:value="${internship?.getEndDate()}" + style="border-radius: 0.5rem; border: 1px solid #ccc; padding: 0.5rem;"> + </div> + </div> + <button type="submit" class="btn btn-success btn-sm mt-2" + >ЗачуваС</button> + </form> + </div> <div class="text-center mt-6"> <a th:href="'/student-internships/' + ${internship.getId()} + '/addWeek'" @@ -150,7 +150,7 @@ <div th:if="${internship.getStatus() == InternshipStatus.ACCEPTED}" style="width: 100%; height: max-content; max-width: none; flex-basis: 75%; margin-left: auto; margin-right: auto;" class="lg:w-fit md:basis-2/3 lg:basis-3/4 p-8 w-full lg:w-fit mx-auto grid grid-cols-1 lg:grid-cols-2 gap-4"> <form th:each="week : ${journal}" - th:action="@{'/student-internships/'+${internship.getId()}+'/internship-weeks/'+${week.getId()}+'/save'}" + th:action="@{'/student-internships/' + ${internship.id} + '/internship-weeks/' + ${week.id} + '/save'}" th:method="POST" style="display: contents;"> <div style="display: flex; flex-direction: column; box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1); border-radius: 20px; padding: 16px; min-height: auto;" -- GitLab From b98314381be6f0aeef91d0caa7c10a0f915011c8 Mon Sep 17 00:00:00 2001 From: "bojana.marojevikj" <bojana.marojevikj@finki.ukim.mk> Date: Wed, 12 Feb 2025 14:56:18 +0100 Subject: [PATCH 8/8] bootbox confirmation --- .../service/impl/ProfessorServiceImpl.java | 3 +- .../templates/admin/coordinators.html | 4 --- .../templates/admin/listInternships.html | 30 +++++++++++++++++-- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/main/java/mk/ukim/finki/wp/internships/service/impl/ProfessorServiceImpl.java b/src/main/java/mk/ukim/finki/wp/internships/service/impl/ProfessorServiceImpl.java index f8d5128..a393bf2 100644 --- a/src/main/java/mk/ukim/finki/wp/internships/service/impl/ProfessorServiceImpl.java +++ b/src/main/java/mk/ukim/finki/wp/internships/service/impl/ProfessorServiceImpl.java @@ -7,6 +7,7 @@ import mk.ukim.finki.wp.internships.model.User; import mk.ukim.finki.wp.internships.repository.ProfessorRepository; import mk.ukim.finki.wp.internships.repository.UserRepository; import mk.ukim.finki.wp.internships.service.ProfessorService; +import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; import java.util.List; @@ -24,7 +25,7 @@ public class ProfessorServiceImpl implements ProfessorService { @Override public List<Professor> listAll() { - return professorRepository.findAll(); + return professorRepository.findAll(Sort.by(Sort.Order.asc("name"))); } } diff --git a/src/main/resources/templates/admin/coordinators.html b/src/main/resources/templates/admin/coordinators.html index baf1363..3e3c917 100644 --- a/src/main/resources/templates/admin/coordinators.html +++ b/src/main/resources/templates/admin/coordinators.html @@ -5,10 +5,6 @@ layout:decorate="~{layout}"> <head> <title>Пракси</title> - <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/css/bootstrap.min.css" rel="stylesheet" - integrity="sha384-4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHDEXuppvnDJzQIu9" crossorigin="anonymous"> - <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css"> - </head> <body layout:fragment="content"> <div class="container"> diff --git a/src/main/resources/templates/admin/listInternships.html b/src/main/resources/templates/admin/listInternships.html index 091fc74..8519305 100644 --- a/src/main/resources/templates/admin/listInternships.html +++ b/src/main/resources/templates/admin/listInternships.html @@ -8,7 +8,29 @@ <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHDEXuppvnDJzQIu9" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css"> - + <script> + function confirmAction(form, message) { + bootbox.confirm({ + message: message, + buttons: { + confirm: { + label: 'Да', + className: 'btn-success' + }, + cancel: { + label: 'РќРµ', + className: 'btn-secondary' + } + }, + callback: function (result) { + if (result) { + form.submit(); + } + } + }); + return false; + } + </script> </head> <body layout:fragment="content"> <div class="container"> @@ -73,7 +95,8 @@ <td th:with="InternshipStatus=${T(mk.ukim.finki.wp.internships.model.internships.InternshipStatus)}"> <form th:unless="${internship.getStatus() == InternshipStatus.VALIDATED_BY_COORDINATOR or internship.getStatus() == InternshipStatus.ARCHIVED}" - th:action="@{'/all-internships/' + ${internship.getId()} + '/assign-coordinator'}" method="post"> + th:action="@{'/all-internships/' + ${internship.getId()} + '/assign-coordinator'}" method="post" + onsubmit="return confirmAction(this, 'Дали сте СЃРёРіСѓСЂРЅРё дека сакате РґР° РіРѕ промените координаторот?')"> <div class="d-flex align-items-center"> <select class="form-control me-2" name="professorId" style="width: auto;"> <option value="" th:selected="${internship.coordinator == null}">Нема определен координатор</option> @@ -100,7 +123,8 @@ </td> <td th:with="InternshipStatus=${T(mk.ukim.finki.wp.internships.model.internships.InternshipStatus)}"> <form th:if="${internship.getStatus() == InternshipStatus.VALIDATED_BY_COORDINATOR}" - th:action="@{'/all-internships/' + ${internship.getId()} + '/archive'}" method="post"> + th:action="@{'/all-internships/' + ${internship.getId()} + '/archive'}" method="post" + onsubmit="return confirmAction(this, 'Дали сте СЃРёРіСѓСЂРЅРё дека сакате РґР° СР° архивирате праксата?')"> <button class="btn btn-warning btn-md" type="submit"> РђСЂС…РёРІРёСЂР°С </button> -- GitLab