Rework the profile page
Add the accept/refuse for unreg request
This commit is contained in:
		| @ -70,6 +70,9 @@ public class ApplicationsController { | |||||||
|  |  | ||||||
|         if (!authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin},token)){  |         if (!authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin},token)){  | ||||||
|           authorizedApps.add(Applications.UsersList);} |           authorizedApps.add(Applications.UsersList);} | ||||||
|  |  | ||||||
|  |         if (!authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin, Role.InscriptionService},token)){ | ||||||
|  |             authorizedApps.add(Applications.Payments);} | ||||||
|         return authorizedApps; |         return authorizedApps; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -34,4 +34,12 @@ public class PaymentController { | |||||||
|         return new ResponseEntity<>(toReturn, HttpStatus.OK); |         return new ResponseEntity<>(toReturn, HttpStatus.OK); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     @GetMapping("/payment") | ||||||
|  |     public ResponseEntity<ArrayList<Payment>> getAllPayments(){ | ||||||
|  |         ArrayList<Payment> toReturn = new ArrayList<Payment>(); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |         paymentRepository.findAll().forEach(toReturn::add); | ||||||
|  |         return new ResponseEntity<>(toReturn, HttpStatus.OK); | ||||||
|  |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -10,6 +10,7 @@ import ovh.herisson.Clyde.Repositories.Inscription.UnregisterRequestRepository; | |||||||
| import ovh.herisson.Clyde.Repositories.UserRepository; | import ovh.herisson.Clyde.Repositories.UserRepository; | ||||||
| import ovh.herisson.Clyde.Responses.UnauthorizedResponse; | import ovh.herisson.Clyde.Responses.UnauthorizedResponse; | ||||||
| import ovh.herisson.Clyde.Services.AuthenticatorService; | import ovh.herisson.Clyde.Services.AuthenticatorService; | ||||||
|  | import ovh.herisson.Clyde.Services.UserService; | ||||||
| import ovh.herisson.Clyde.Tables.*; | import ovh.herisson.Clyde.Tables.*; | ||||||
| import ovh.herisson.Clyde.Tables.Inscription.ExemptionsRequest; | import ovh.herisson.Clyde.Tables.Inscription.ExemptionsRequest; | ||||||
| import ovh.herisson.Clyde.Tables.Inscription.ScholarshipRequest; | import ovh.herisson.Clyde.Tables.Inscription.ScholarshipRequest; | ||||||
| @ -29,15 +30,16 @@ public class RequestsController { | |||||||
|     public final AuthenticatorService authServ; |     public final AuthenticatorService authServ; | ||||||
|     public final UnregisterRequestRepository unregisterRequestRepository; |     public final UnregisterRequestRepository unregisterRequestRepository; | ||||||
|     public final CourseRepository courseRepository; |     public final CourseRepository courseRepository; | ||||||
|  |     public final UserService userService; | ||||||
|  |  | ||||||
|  |     public RequestsController(ExemptionsRequestRepository err, ScholarshipRequestRepository srr, UserRepository userRepository, AuthenticatorService authServ, UnregisterRequestRepository unregisterRequestRepository, CourseRepository courseRepository, UserService userService) { | ||||||
|     public RequestsController(ExemptionsRequestRepository err, ScholarshipRequestRepository srr, UserRepository userRepository, AuthenticatorService authServ, UnregisterRequestRepository unregisterRequestRepository, CourseRepository courseRepository) { |  | ||||||
|         this.err = err; |         this.err = err; | ||||||
|         this.srr = srr; |         this.srr = srr; | ||||||
|         this.userRepository = userRepository; |         this.userRepository = userRepository; | ||||||
|         this.authServ = authServ; |         this.authServ = authServ; | ||||||
|         this.unregisterRequestRepository = unregisterRequestRepository; |         this.unregisterRequestRepository = unregisterRequestRepository; | ||||||
|         this.courseRepository = courseRepository; |         this.courseRepository = courseRepository; | ||||||
|  |         this.userService = userService; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @PostMapping(value="/exemptionreq") |     @PostMapping(value="/exemptionreq") | ||||||
| @ -123,4 +125,24 @@ public class RequestsController { | |||||||
|         unregisterRequestRepository.findAll().forEach(toReturn::add); |         unregisterRequestRepository.findAll().forEach(toReturn::add); | ||||||
|         return new ResponseEntity<>(toReturn, HttpStatus.OK); |         return new ResponseEntity<>(toReturn, HttpStatus.OK); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     @GetMapping(value = "/unregister/{id}") | ||||||
|  |     public ResponseEntity<UnregisterRequest> getUnregbyId(@PathVariable long id){ | ||||||
|  |         UnregisterRequest unregisterRequest = unregisterRequestRepository.findById(id); | ||||||
|  |         return new ResponseEntity<>(unregisterRequest, HttpStatus.OK); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     @PatchMapping(value = "/unregister/{id}/{newstate}") | ||||||
|  |     public ResponseEntity<String> pathUnregReq(@PathVariable long id, @PathVariable RequestState newstate){ | ||||||
|  |         UnregisterRequest unregisterRequest = unregisterRequestRepository.findById(id); | ||||||
|  |  | ||||||
|  |         unregisterRequest.setState(newstate); | ||||||
|  |  | ||||||
|  |         if (newstate == RequestState.Accepted){ | ||||||
|  |             userService.delete(userRepository.findById(unregisterRequest.getRegNo())); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         unregisterRequestRepository.save(unregisterRequest); | ||||||
|  |         return new ResponseEntity<>(HttpStatus.OK); | ||||||
|  |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -4,5 +4,5 @@ import org.springframework.data.repository.CrudRepository; | |||||||
| import ovh.herisson.Clyde.Tables.Inscription.UnregisterRequest; | import ovh.herisson.Clyde.Tables.Inscription.UnregisterRequest; | ||||||
|  |  | ||||||
| public interface UnregisterRequestRepository extends CrudRepository<UnregisterRequest, Long> { | public interface UnregisterRequestRepository extends CrudRepository<UnregisterRequest, Long> { | ||||||
|  |     public UnregisterRequest findById(long l); | ||||||
| } | } | ||||||
|  | |||||||
| @ -19,5 +19,6 @@ public enum Applications { | |||||||
|  |  | ||||||
|     // InscriptionService authorization |     // InscriptionService authorization | ||||||
|     Requests, |     Requests, | ||||||
|     StudentsList |     StudentsList, | ||||||
|  |     Payments | ||||||
| } | } | ||||||
|  | |||||||
| @ -12,7 +12,6 @@ public class Payment { | |||||||
|     @Id |     @Id | ||||||
|     @GeneratedValue(strategy = GenerationType.AUTO) |     @GeneratedValue(strategy = GenerationType.AUTO) | ||||||
|     private long id; |     private long id; | ||||||
|  |  | ||||||
|     private long studentRegNo; |     private long studentRegNo; | ||||||
|     private String card; |     private String card; | ||||||
|     private String client; |     private String client; | ||||||
|  | |||||||
| @ -7,15 +7,16 @@ import ovh.herisson.Clyde.Tables.RequestState; | |||||||
| import ovh.herisson.Clyde.Tables.User; | import ovh.herisson.Clyde.Tables.User; | ||||||
|  |  | ||||||
| import java.util.Date; | import java.util.Date; | ||||||
|  | import java.util.Map; | ||||||
|  |  | ||||||
| @Entity | @Entity | ||||||
| public class ScholarshipRequest { | public class ScholarshipRequest { | ||||||
|     @Id |     @Id | ||||||
|     @GeneratedValue(strategy = GenerationType.AUTO) |     @GeneratedValue(strategy = GenerationType.AUTO) | ||||||
|     private long id; |     private long id; | ||||||
|  |  | ||||||
|     @JoinColumn(name="Users") |     @JoinColumn(name="Users") | ||||||
|     @ManyToOne(fetch = FetchType.EAGER) |     @ManyToOne(fetch = FetchType.EAGER) | ||||||
|  |     @OnDelete(action = OnDeleteAction.CASCADE) | ||||||
|     private User user; |     private User user; | ||||||
|     private RequestState state; |     private RequestState state; | ||||||
|     private Date date; |     private Date date; | ||||||
|  | |||||||
| @ -1,6 +1,8 @@ | |||||||
| package ovh.herisson.Clyde.Tables; | package ovh.herisson.Clyde.Tables; | ||||||
|  |  | ||||||
| import jakarta.persistence.*; | import jakarta.persistence.*; | ||||||
|  | import org.hibernate.annotations.OnDelete; | ||||||
|  | import org.hibernate.annotations.OnDeleteAction; | ||||||
| import ovh.herisson.Clyde.Tables.Msg.Discussion; | import ovh.herisson.Clyde.Tables.Msg.Discussion; | ||||||
| import ovh.herisson.Clyde.Tables.Msg.Message; | import ovh.herisson.Clyde.Tables.Msg.Message; | ||||||
|  |  | ||||||
|  | |||||||
| @ -28,6 +28,7 @@ app.language=Language | |||||||
| app.manage.profile=Manage profile | app.manage.profile=Manage profile | ||||||
| app.studentList=Students List | app.studentList=Students List | ||||||
| app.users=Users | app.users=Users | ||||||
|  | app.payments = Payments | ||||||
| request.moreInfos=More Infos | request.moreInfos=More Infos | ||||||
| request.accept=Accept | request.accept=Accept | ||||||
| request.refuse=Refuse | request.refuse=Refuse | ||||||
|  | |||||||
| @ -28,6 +28,7 @@ app.language=Langue | |||||||
| app.manage.profile=Gérer le profil | app.manage.profile=Gérer le profil | ||||||
| app.studentList=Liste des étudiants | app.studentList=Liste des étudiants | ||||||
| app.users=Utilisateurs | app.users=Utilisateurs | ||||||
|  | app.payments = Payements | ||||||
| request.moreInfos=Plus d'Infos | request.moreInfos=Plus d'Infos | ||||||
| request.accept=Accepter | request.accept=Accepter | ||||||
| request.refuse=Refuser | request.refuse=Refuser | ||||||
| @ -52,3 +53,4 @@ Curriculum=Cursus | |||||||
| Credits=Credits | Credits=Credits | ||||||
| InscriptionService=S.I. | InscriptionService=S.I. | ||||||
| faculty=Faculté | faculty=Faculté | ||||||
|  |  | ||||||
|  | |||||||
| @ -67,7 +67,6 @@ window.addEventListener('hashchange', () => { | |||||||
|                     {{i18n("app.manage.profile")}} |                     {{i18n("app.manage.profile")}} | ||||||
|                   </a> |                   </a> | ||||||
|                   </div> |                   </div> | ||||||
|  |  | ||||||
|                 </div> |                 </div> | ||||||
|             </a></li> |             </a></li> | ||||||
|       </ul> |       </ul> | ||||||
|  | |||||||
							
								
								
									
										109
									
								
								frontend/src/Apps/Inscription/AboutUnregister.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								frontend/src/Apps/Inscription/AboutUnregister.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,109 @@ | |||||||
|  | <script setup> | ||||||
|  |  | ||||||
|  | import { | ||||||
|  |   addUninscReq, | ||||||
|  |   editScholarshipReq, | ||||||
|  |   editUnregReq, | ||||||
|  |   getScholarshipReqById, | ||||||
|  |   getUnregisterbyId | ||||||
|  | } from "@/rest/requests.js"; | ||||||
|  | import i18n from "@/i18n.js"; | ||||||
|  | import {getUser} from "@/rest/Users.js"; | ||||||
|  | import {reactive, ref} from "vue"; | ||||||
|  |  | ||||||
|  | const props = defineProps(["reqId"]) | ||||||
|  | const req = ref(await getUnregisterbyId(props.reqId)) | ||||||
|  |  | ||||||
|  | function getPP(){ | ||||||
|  |   if(user.profilePictureUrl === null){ | ||||||
|  |     return "/Clyde.png" | ||||||
|  |   } | ||||||
|  |   return user.profilePictureUrl | ||||||
|  | } | ||||||
|  |  | ||||||
|  | async function uploadandrefreshUnregRequest(state){ | ||||||
|  |   await editUnregReq(req.value.id, state) | ||||||
|  |   req.value.state = state | ||||||
|  | } | ||||||
|  | </script> | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <template> | ||||||
|  |   <div class="body"> | ||||||
|  |     <div class="container"> | ||||||
|  |       <div class="globalInfos"> | ||||||
|  |         <div class="infosContainer"> | ||||||
|  |           <div> | ||||||
|  |             Firstname/Name : {{req.firstName}} {{req.lastName}} | ||||||
|  |           </div> | ||||||
|  |           <div> | ||||||
|  |             E-mail: {{req.email}} | ||||||
|  |           </div> | ||||||
|  |           <div> | ||||||
|  |             regNo : {{req.regNo}} | ||||||
|  |           </div> | ||||||
|  |           <div> | ||||||
|  |             Reason : | ||||||
|  |             <input type="text" v-model="req.reason" readonly/> | ||||||
|  |           </div> | ||||||
|  |           <div> | ||||||
|  |             <button v-if="req.state === 'Pending'" @click="req.state='Accepted';uploadandrefreshUnregRequest('Accepted')">Accept</button> | ||||||
|  |             <button v-if="req.state === 'Pending'" @click="req.state='Refused';uploadandrefreshUnregRequest('Refused')" style="margin-left: 2%;">Refuse</button> | ||||||
|  |           </div> | ||||||
|  |         </div> | ||||||
|  |       </div> | ||||||
|  |     </div> | ||||||
|  |   </div> | ||||||
|  | </template> | ||||||
|  |  | ||||||
|  | <style scoped> | ||||||
|  | .container{ | ||||||
|  |   min-width:675px; | ||||||
|  |   display:grid; | ||||||
|  |   grid-template-columns:10vw 50vw; | ||||||
|  |   grid-template-rows:200px auto; | ||||||
|  |   column-gap:2.7%; | ||||||
|  |   row-gap:45px; | ||||||
|  |   grid-template-areas: | ||||||
|  |   "profilPic globalInfos" | ||||||
|  |   "minfos minfos"; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .profilPic{ | ||||||
|  |   width:100%; | ||||||
|  |   grid-area:profilPic; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .globalInfos { | ||||||
|  |   grid-area:globalInfos; | ||||||
|  |   align-self :center; | ||||||
|  |  | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .body { | ||||||
|  |   min-width:960px; | ||||||
|  |   width:100%; | ||||||
|  |   display:flex; | ||||||
|  |   align-items:center; | ||||||
|  |   justify-content:center; | ||||||
|  |   margin-top:7%; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .subContainter{ | ||||||
|  |   width:100%; | ||||||
|  |   background-color:rgb(50,50,50); | ||||||
|  |   border-radius:20px; | ||||||
|  |   border:4px solid black; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .infosContainer { | ||||||
|  |   min-width:350px; | ||||||
|  |   padding-bottom:50px; | ||||||
|  |   border:2px solid black; | ||||||
|  |   font-size:25px; | ||||||
|  |   color:white; | ||||||
|  |   padding:20px; | ||||||
|  |   background-color:rgb(50,50,50); | ||||||
|  |   border-radius:20px; | ||||||
|  | } | ||||||
|  | </style> | ||||||
| @ -5,6 +5,7 @@ | |||||||
|   import AboutRequest from "@/Apps/Inscription/AboutRequest.vue"; |   import AboutRequest from "@/Apps/Inscription/AboutRequest.vue"; | ||||||
|   import {getAllExemptionsRequest, getAllScholarShipsRequest, getAllUnregisters} from "@/rest/requests.js"; |   import {getAllExemptionsRequest, getAllScholarShipsRequest, getAllUnregisters} from "@/rest/requests.js"; | ||||||
|   import AboutScholarship from "@/Apps/Inscription/AboutScholarship.vue"; |   import AboutScholarship from "@/Apps/Inscription/AboutScholarship.vue"; | ||||||
|  |   import AboutUnregister from "@/Apps/Inscription/AboutUnregister.vue"; | ||||||
|  |  | ||||||
|   const requests = ref(await getAllRegisters()); |   const requests = ref(await getAllRegisters()); | ||||||
|   let targetId = ""; |   let targetId = ""; | ||||||
| @ -12,7 +13,7 @@ | |||||||
|   const requestType = ref("inscription"); |   const requestType = ref("inscription"); | ||||||
|   const filterType = ref("None"); |   const filterType = ref("None"); | ||||||
|  |  | ||||||
|   //0 = liste, 1 = détails, 2 = sure?, 3 = manage scholarship |   //0 = liste, 1 = détails, 2 = sure?, 3 = manage scholarship, 4 manage unregister | ||||||
|   let windowsState = ref(0); |   let windowsState = ref(0); | ||||||
|  |  | ||||||
|   async function upPage(id,review){ |   async function upPage(id,review){ | ||||||
| @ -101,7 +102,7 @@ | |||||||
|           <div class="studentlastname">{{item.lastName}}</div> |           <div class="studentlastname">{{item.lastName}}</div> | ||||||
|           <div class="regno">id : {{item.regNo}}</div> |           <div class="regno">id : {{item.regNo}}</div> | ||||||
|           <div class="reqState">{{item.state}}</div> |           <div class="reqState">{{item.state}}</div> | ||||||
|           <div class="infos"><button>More infos</button></div> |           <div class="infos"><button @click="windowsState=4;targetId=item.id">More infos</button></div> | ||||||
|         </div> |         </div> | ||||||
|       </div> |       </div> | ||||||
|     </div> |     </div> | ||||||
| @ -111,12 +112,15 @@ | |||||||
|     <button style="background-color:rgb(105,05,105);" @click="upPage(targetId,'Accepted');windowsState=0;">Valider</button> |     <button style="background-color:rgb(105,05,105);" @click="upPage(targetId,'Accepted');windowsState=0;">Valider</button> | ||||||
|     <button style="background-color:rgb(105,05,105);" @click="windowsState=0;">Retour</button> |     <button style="background-color:rgb(105,05,105);" @click="windowsState=0;">Retour</button> | ||||||
|   </div> |   </div> | ||||||
|   <div v-if="windowsState == 3"> |   <div v-if="windowsState === 3"> | ||||||
|     <AboutScholarship :req-id="targetId"></AboutScholarship> |     <AboutScholarship :req-id="targetId"></AboutScholarship> | ||||||
|     <div> |     <div> | ||||||
|       <button style="margin-left: 30%" @click="loadRequests();windowsState=0">Back</button> |       <button style="margin-left: 30%" @click="loadRequests();windowsState=0">Back</button> | ||||||
|     </div> |     </div> | ||||||
|   </div> |   </div> | ||||||
|  |   <div v-if="windowsState === 4"> | ||||||
|  |     <AboutUnregister :req-id="targetId"></AboutUnregister> | ||||||
|  |   </div> | ||||||
| </template> | </template> | ||||||
|  |  | ||||||
| <style scoped> | <style scoped> | ||||||
|  | |||||||
							
								
								
									
										77
									
								
								frontend/src/Apps/Inscription/PaymentInfo.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										77
									
								
								frontend/src/Apps/Inscription/PaymentInfo.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,77 @@ | |||||||
|  | <script setup> | ||||||
|  | import i18n from "@/i18n.js"; | ||||||
|  | import {ref} from "vue"; | ||||||
|  | import {getAllPayments} from "@/rest/requests.js"; | ||||||
|  |  | ||||||
|  | const paymentsList = await getAllPayments() | ||||||
|  | </script> | ||||||
|  |  | ||||||
|  | <template style="margin-top:5%;"> | ||||||
|  |   <div style="display:flex; justify-content:center; " v-for="item in paymentsList"> | ||||||
|  |     <div class="bodu"> | ||||||
|  |       <div class="container"> | ||||||
|  |         <div class="regNo"><a style="margin-left:30px">RegNo : {{item.studentRegNo}}</a></div> | ||||||
|  |         <div class="client"><a>Client : {{item.client}}</a></div> | ||||||
|  |         <div class="amount"><a>Amount : {{item.amount}}</a></div> | ||||||
|  |         <div class="date" style="margin-left: 10%">{{item.date.slice(0,10)}}</div> | ||||||
|  |       </div> | ||||||
|  |     </div> | ||||||
|  |   </div> | ||||||
|  | </template> | ||||||
|  |  | ||||||
|  | <style scoped> | ||||||
|  | .container{ | ||||||
|  |   color:white; | ||||||
|  |   height:100px; | ||||||
|  |   font-size:30px; | ||||||
|  |   display:grid; | ||||||
|  |   grid-template-columns:20% 25% 15% 17%; | ||||||
|  |   grid-template-areas: | ||||||
|  |     "date regNo client amount"; | ||||||
|  |   column-gap:10px; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .regNo { | ||||||
|  |   grid-area:regNo; | ||||||
|  |   align-self:center; | ||||||
|  |   font-size: 70%; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .client{ | ||||||
|  |   grid-area:client; | ||||||
|  |   align-self:center; | ||||||
|  |   font-size: 70%; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .amount{ | ||||||
|  |   grid-area:amount; | ||||||
|  |   align-self:center; | ||||||
|  |   font-size: 70%; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .date{ | ||||||
|  |   grid-area:date; | ||||||
|  |   align-self:center; | ||||||
|  |   font-size: 70%; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | button{ | ||||||
|  |   font-size:15px; | ||||||
|  |   height:50px; | ||||||
|  |   width:75%; | ||||||
|  |   border:none; | ||||||
|  |   border-radius:20px; | ||||||
|  |  | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .bodu { | ||||||
|  |   margin-top:2%; | ||||||
|  |   width:66%; | ||||||
|  |   border:2px solid black; | ||||||
|  |   border-radius:9px; | ||||||
|  |   background-color:rgb(50,50,50); | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | </style> | ||||||
|  |  | ||||||
| @ -22,17 +22,12 @@ | |||||||
|   if(user.role === "Teacher"){ |   if(user.role === "Teacher"){ | ||||||
|     UserCurriculum.value = await getCourses("Teacher"); |     UserCurriculum.value = await getCourses("Teacher"); | ||||||
|   } |   } | ||||||
|   const modif = ref(false); |  | ||||||
|   const curric = ref(false); |  | ||||||
|   const reg = ref(false); |  | ||||||
|   const courseslist = ref(false); |  | ||||||
|   const minerval = ref(false); |  | ||||||
|   const paymentPage = ref(false); |  | ||||||
|   const scholarship = ref(false); |  | ||||||
|   const scholarshipinfos = ref(false); |  | ||||||
|   const uninscr = ref(false); |  | ||||||
|   const sure = ref(0); |   const sure = ref(0); | ||||||
|  |  | ||||||
|  |   //0 base, 1 modif, 2 curriculum, 3 register, 4 courselist, 5 minerval, 6 payment, 7 scholarship, 8 scholarshipinfos, 9 unregister, 10 sure, 11 aboutunregister | ||||||
|  |   const windowState = ref(0); | ||||||
|  |  | ||||||
|   const pattern = { |   const pattern = { | ||||||
|     profilPictureUrl:null, |     profilPictureUrl:null, | ||||||
|     email:null, |     email:null, | ||||||
| @ -82,17 +77,17 @@ | |||||||
|    |    | ||||||
|   async function ChangeInfos(){ |   async function ChangeInfos(){ | ||||||
|     for (let element in toModify){ |     for (let element in toModify){ | ||||||
|          if (element =="email" && (toModify[element] !== null)){ |          if (element ==="email" && (toModify[element] !== null)){ | ||||||
|           await  alterSelf(user.value.regNo,{email : toModify[element]}); |           await  alterSelf(user.value.regNo,{email : toModify[element]}); | ||||||
|         }       |         }       | ||||||
|  |  | ||||||
|         if (element =="profilPictureUrl" && (toModify[element] !== null)){ |         if (element ==="profilPictureUrl" && (toModify[element] !== null)){ | ||||||
|           await  alterSelf(user.value.regNo,{ profilPictureUrl : toModify[element]}); |           await  alterSelf(user.value.regNo,{ profilPictureUrl : toModify[element]}); | ||||||
|         } |         } | ||||||
|         else if(element == "address" && (toModify[element] !== null)){ |         else if(element === "address" && (toModify[element] !== null)){ | ||||||
|           await  alterSelf(user.value.regNo,{address : toModify[element]}); |           await  alterSelf(user.value.regNo,{address : toModify[element]}); | ||||||
|         } |         } | ||||||
|         else if(element == "password" && (toModify[element] !== null)){ |         else if(element === "password" && (toModify[element] !== null)){ | ||||||
|           await  alterSelf(user.value.regNo,{password : toModify[element]}); |           await  alterSelf(user.value.regNo,{password : toModify[element]}); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @ -159,12 +154,12 @@ | |||||||
|  |  | ||||||
| <template> | <template> | ||||||
|   <div class="body"> |   <div class="body"> | ||||||
|   <div class="container" v-if="courseslist == false"> |   <div class="container" v-if="windowState!==4"> | ||||||
|     <div class="profilPic"> |     <div class="profilPic" v-if="windowState===0"> | ||||||
|       <img class="subContainter" :src=getPP()> |       <img class="subContainter" :src=getPP()> | ||||||
|     </div> |     </div> | ||||||
|       <div class="globalInfos"> |       <div class="globalInfos"> | ||||||
|         <div v-if="modif==false && curric==false && reg==false && minerval==false && paymentPage == false && scholarship==false && uninscr == false" class="infosContainer"> |         <div v-if="windowState === 0" class="infosContainer"> | ||||||
|           <div> |           <div> | ||||||
|             {{user.firstName}} {{user.lastName}}    |             {{user.firstName}} {{user.lastName}}    | ||||||
|           </div> |           </div> | ||||||
| @ -178,24 +173,24 @@ | |||||||
|             Role:  {{i18n((user.role))}}  |             Role:  {{i18n((user.role))}}  | ||||||
|           </div> |           </div> | ||||||
|           <div> |           <div> | ||||||
|             <button @click="modif=!modif; setModify(user)"> {{i18n("profile.modify.data")}} </button> |             <button @click="windowState=1; setModify(user)"> {{i18n("profile.modify.data")}} </button> | ||||||
|           </div> |           </div> | ||||||
|           <div v-if="(user.role==='Student')"> |           <div v-if="(user.role==='Student')"> | ||||||
|             <button @click="reg=!reg">{{i18n("profile.reRegister")}}</button> |             <button @click="windowState=3">{{i18n("profile.reRegister")}}</button> | ||||||
|             <button @click="uninscr = !uninscr" style="float:right;background-color:rgb(150,0,0);">{{i18n("profile.unRegister")}}</button> |             <button @click="windowState=9" style="float:right;background-color:rgb(150,0,0);">{{i18n("profile.unRegister")}}</button> | ||||||
|           </div> |           </div> | ||||||
|           <div v-if="(user.role==='Student')"> |           <div v-if="(user.role==='Student')"> | ||||||
|             <button @click="curric=!curric">{{i18n("profile.change.curriculum")}}</button> |             <button @click="windowState=2">{{i18n("profile.change.curriculum")}}</button> | ||||||
|           </div> |           </div> | ||||||
|           <div v-if="(user.role==='Student')"> |           <div v-if="(user.role==='Student')"> | ||||||
|             <button @click="courseslist=!courseslist">Manage Courses</button> |             <button @click="windowState=4">Manage Courses</button> | ||||||
|             <button @click="minerval = !minerval" style="margin-left: 2%">Manage minerval</button> |             <button @click="windowState=5" style="margin-left: 2%">Manage minerval</button> | ||||||
|           </div> |           </div> | ||||||
|         </div> |         </div> | ||||||
|         <div v-else-if="uninscr" class="infosContainer"> |         <div v-else-if="windowState === 9" class="infosContainer"> | ||||||
|             <div v-if="sure != 2">Please enter the reason you leave the university</div> |             <div v-if="sure !== 2">Please enter the reason you leave the university</div> | ||||||
|             <textarea v-if="sure != 2" v-model="uninscriptionData.reason"></textarea> |             <textarea v-if="sure !== 2" v-model="uninscriptionData.reason"></textarea> | ||||||
|             <div v-if="sure != 2"> |             <div v-if="sure !== 2"> | ||||||
|               <button @click="sure++">Submit</button> |               <button @click="sure++">Submit</button> | ||||||
|             </div> |             </div> | ||||||
|             <div v-if="sure==1"> |             <div v-if="sure==1"> | ||||||
| @ -205,24 +200,24 @@ | |||||||
|             </div> |             </div> | ||||||
|             <p v-if="sure==2">You request has been send !</p> |             <p v-if="sure==2">You request has been send !</p> | ||||||
|         </div> |         </div> | ||||||
|         <div v-else-if="minerval" class="infosContainer"> |         <div v-else-if="windowState === 5" class="infosContainer"> | ||||||
|           <div v-if="minerv.value.toPay != 0"> |           <div v-if="minerv.value.toPay !== 0"> | ||||||
|             Payment : {{minerv.value.toPay}}€ left to pay |             Payment : {{minerv.value.toPay}}€ left to pay | ||||||
|             <div v-if="minerv.value.paidAmount <= 50"> |             <div v-if="minerv.value.paidAmount <= 50"> | ||||||
|               <button @click="minerval = !minerval; paymentPage = !paymentPage; paymentAmount = 50">Pay deposit (50€)</button> |               <button @click="windowState=6; paymentAmount = 50">Pay deposit (50€)</button> | ||||||
|             </div> |             </div> | ||||||
|             <div> |             <div> | ||||||
|               <button @click="minerval = !minerval; paymentPage = !paymentPage; paymentAmount = minerv.value.toPay">Pay all the rest ({{minerv.value.toPay}}€)</button> |               <button @click="windowState=6; paymentAmount = minerv.value.toPay">Pay all the rest ({{minerv.value.toPay}}€)</button> | ||||||
|             </div> |             </div> | ||||||
|           </div> |           </div> | ||||||
|           <div v-else> |           <div v-else> | ||||||
|             Payment : School fees have already been paid this year |             Payment : School fees have already been paid this year | ||||||
|           </div> |           </div> | ||||||
|           <div> |           <div> | ||||||
|             <button @click="scholarship=!scholarship; minerval=!minerval">Ask for a scholarship</button> |             <button @click="windowState=7">Ask for a scholarship</button> | ||||||
|           </div> |           </div> | ||||||
|         </div> |         </div> | ||||||
|         <div v-else-if="scholarship && !scholarshipinfos" class="infosContainer"> |         <div v-else-if="windowState === 7" class="infosContainer"> | ||||||
|           <p>Please upload the required documents</p> |           <p>Please upload the required documents</p> | ||||||
|           <div> |           <div> | ||||||
|             Tax justification document : |             Tax justification document : | ||||||
| @ -232,18 +227,18 @@ | |||||||
|             Residency justification document : |             Residency justification document : | ||||||
|             <input type="file" style="margin-top:2%" @change="scholarshipData.residencyDocUrl = $event.target.files"> |             <input type="file" style="margin-top:2%" @change="scholarshipData.residencyDocUrl = $event.target.files"> | ||||||
|           </div> |           </div> | ||||||
|           <button style="margin-top: 5%" @click="scholarshipinfos = !scholarshipinfos;postScholarshipRequest(scholarshipData.taxDocUrl, 'JustificationDocument',scholarshipData.residencyDocUrl, 'JustificationDocument');">Submit scholarship request</button> |           <button style="margin-top: 5%" @click="windowState=8;postScholarshipRequest(scholarshipData.taxDocUrl, 'JustificationDocument',scholarshipData.residencyDocUrl, 'JustificationDocument');">Submit scholarship request</button> | ||||||
|         </div> |         </div> | ||||||
|         <div v-else-if="scholarship && scholarshipinfos" class="infosContainer"> |         <div v-else-if="windowState === 8" class="infosContainer"> | ||||||
|           <div> |           <div> | ||||||
|             Your request has been sent to the inscription service you will get notified when |             Your request has been sent to the inscription service you will get notified when | ||||||
|             the request is reviewed. |             the request is reviewed. | ||||||
|           </div> |           </div> | ||||||
|           <button @click="scholarshipinfos=!scholarshipinfos; scholarship=!scholarship"> |           <button @click="windowState = 0"> | ||||||
|             Go back to profile |             Go back to profile | ||||||
|           </button> |           </button> | ||||||
|         </div> |         </div> | ||||||
|         <div v-else-if="paymentPage" class="infosContainer"> |         <div v-else-if="windowState === 6" class="infosContainer"> | ||||||
|           Proceed to payment of {{paymentAmount}}€ |           Proceed to payment of {{paymentAmount}}€ | ||||||
|           <div style="margin-top: 1%"> |           <div style="margin-top: 1%"> | ||||||
|             Client: |             Client: | ||||||
| @ -258,20 +253,20 @@ | |||||||
|             <input type="date" v-model="paymentData.expDate"> |             <input type="date" v-model="paymentData.expDate"> | ||||||
|           </div> |           </div> | ||||||
|           <div style="margin-top: 1%"> |           <div style="margin-top: 1%"> | ||||||
|             <button @click="paymentPage=!paymentPage;minerval=!minerval;paymentData.amount=paymentAmount;paymentData.date=new Date();postPayment(paymentData);minerv.value.toPay -= paymentAmount; minerv.value.paidAmount += paymentAmount; editMinerval(minerv.value)">Process Payment</button> |             <button @click="windowState=5;paymentData.amount=paymentAmount;paymentData.date=new Date();postPayment(paymentData);minerv.value.toPay -= paymentAmount; minerv.value.paidAmount += paymentAmount; editMinerval(minerv.value)">Process Payment</button> | ||||||
|           </div> |           </div> | ||||||
|           <div> |           <div> | ||||||
|             <button @click="minerval = !minerval; paymentPage = !paymentPage;">Back</button> |             <button @click="windowState = 5">Back</button> | ||||||
|           </div> |           </div> | ||||||
|         </div> |         </div> | ||||||
|         <div v-else-if="modif" class="infosContainer"> |         <div v-else-if="windowState === 1" class="infosContainer"> | ||||||
|           <div> |           <div> | ||||||
|             {{i18n("profile.picture")}}: |             {{i18n("profile.picture")}}: | ||||||
|             <input type="file" @change="user.profilPicture = uploadProfilePicture($event.target.files);" accept="image/*"> |             <input type="file" @change="user.profilPicture = uploadProfilePicture($event.target.files);" accept="image/*"> | ||||||
|           </div> |           </div> | ||||||
|           <div> |           <div> | ||||||
|             E-mail:   |             E-mail:   | ||||||
|             <input type="mail" v-model="toModify.email" /> |             <input type="email" v-model="toModify.email" /> | ||||||
|           </div> |           </div> | ||||||
|           <div> |           <div> | ||||||
|             {{i18n("profile.address")}}: |             {{i18n("profile.address")}}: | ||||||
| @ -286,11 +281,11 @@ | |||||||
|             <input type="password" v-model="toModify.passwordConfirm"> |             <input type="password" v-model="toModify.passwordConfirm"> | ||||||
|           </div> |           </div> | ||||||
|           <div> |           <div> | ||||||
|             <button @click=" modif=!modif; ChangeInfos();">{{i18n("courses.confirm")}}</button> |             <button @click=" windowState = 0; ChangeInfos();">{{i18n("courses.confirm")}}</button> | ||||||
|             <button @click="modif=!modif; resetInputs(toModify,pattern);" style="float:right;">{{i18n("courses.back")}}</button> |             <button @click="windowState = 0; resetInputs(toModify,pattern);" style="float:right;">{{i18n("courses.back")}}</button> | ||||||
|           </div> |           </div> | ||||||
|         </div> |         </div> | ||||||
|         <div v-else-if="curric" class="infosContainer"> |         <div v-else-if="windowState === 2" class="infosContainer"> | ||||||
|           <div style="height:40px;"> |           <div style="height:40px;"> | ||||||
|             {{i18n("Curriculum")}}:   |             {{i18n("Curriculum")}}:   | ||||||
|             <select v-model="curriculum" > |             <select v-model="curriculum" > | ||||||
| @ -299,14 +294,14 @@ | |||||||
|           </div> |           </div> | ||||||
|  |  | ||||||
|           <div> |           <div> | ||||||
|             <button @click=" curric=!curric;">{{i18n("courses.confirm")}}</button> |             <button @click=" windowState = 0;">{{i18n("courses.confirm")}}</button> | ||||||
|             <button @click="curric=!curric; resetInputs(personnalInfos,patternInfos);" style="float:right;">{{i18n("courses.back")}}</button> |             <button @click="windowState = 0; resetInputs(personnalInfos,patternInfos);" style="float:right;">{{i18n("courses.back")}}</button> | ||||||
|           </div> |           </div> | ||||||
|         </div> |         </div> | ||||||
|         <div v-else-if="reg" class="infosContainer"> |         <div v-else-if="windowState === 3" class="infosContainer"> | ||||||
|           <div> |           <div> | ||||||
|             E-mail:   |             E-mail:   | ||||||
|             <input type="mail" v-model="toModify.email" /> |             <input type="email" v-model="toModify.email" /> | ||||||
|           </div> |           </div> | ||||||
|           <div> |           <div> | ||||||
|             ID : |             ID : | ||||||
| @ -322,12 +317,12 @@ | |||||||
|           </div> |           </div> | ||||||
|  |  | ||||||
|           <div> |           <div> | ||||||
|             <button @click=" reg=!reg;">{{i18n("courses.confirm")}}</button> |             <button @click=" windowState=0;">{{i18n("courses.confirm")}}</button> | ||||||
|             <button @click=" reg=!reg; resetInputs(personnalInfos,patternInfos);" style="float:right;">{{i18n("courses.back")}}</button> |             <button @click=" windowState=0; resetInputs(personnalInfos,patternInfos);" style="float:right;">{{i18n("courses.back")}}</button> | ||||||
|           </div> |           </div> | ||||||
|         </div> |         </div> | ||||||
|       </div> |       </div> | ||||||
|       <div v-if="user.role == 'Student' && modif==false && curric==false && reg==false && minerval==false && scholarship == false && uninscr == false" class="moreInfos"> |       <div v-if="windowState === 0" class="moreInfos"> | ||||||
|         <div class = "oldcursus"> |         <div class = "oldcursus"> | ||||||
|             <div class="listTitle"> |             <div class="listTitle"> | ||||||
|               Anciens Cursus |               Anciens Cursus | ||||||
| @ -354,9 +349,9 @@ | |||||||
|           </div> |           </div> | ||||||
|       </div> |       </div> | ||||||
|   </div> |   </div> | ||||||
|     <div v-if="courseslist === true" style="width: 80%"> |     <div v-if="windowState===4" style="width: 80%"> | ||||||
|       <CourseList :cursuslist="getActualCurriculumList()"/> |       <CourseList :cursuslist="getActualCurriculumList()"/> | ||||||
|       <button style="width: 10%; margin-top: 5%" @click="courseslist = false">Return to profile</button> |       <button style="width: 10%; margin-top: 5%" @click="windowState = 0">Return to profile</button> | ||||||
|     </div> |     </div> | ||||||
| </div> | </div> | ||||||
| </template> | </template> | ||||||
|  | |||||||
| @ -4,13 +4,12 @@ import i18n from '@/i18n.js' | |||||||
|  |  | ||||||
| // Liste des apps | // Liste des apps | ||||||
| import LoginPage from '@/Apps/Login.vue' | import LoginPage from '@/Apps/Login.vue' | ||||||
| import Inscription from "@/Apps/Inscription/ManageRequests.vue" |  | ||||||
| import Profil from "@/Apps/Profil.vue" | import Profil from "@/Apps/Profil.vue" | ||||||
| import Courses from "@/Apps/ManageCourses.vue" | import Courses from "@/Apps/ManageCourses.vue" | ||||||
| import Users from "@/Apps/UsersList.vue" | import Users from "@/Apps/UsersList.vue" | ||||||
| import Students from "@/Apps/StudentsList.vue" | import Students from "@/Apps/StudentsList.vue" | ||||||
| import AboutStudent from "@/Apps/Inscription/AboutStudent.vue"; |  | ||||||
| import Msg from "@/Apps/Msg.vue" | import Msg from "@/Apps/Msg.vue" | ||||||
|  | import Payments from "@/Apps/Inscription/PaymentInfo.vue"; | ||||||
| import ManageRequests from "@/Apps/Inscription/ManageRequests.vue"; | import ManageRequests from "@/Apps/Inscription/ManageRequests.vue"; | ||||||
|  |  | ||||||
| const apps = { | const apps = { | ||||||
| @ -21,6 +20,7 @@ const apps = { | |||||||
| 		'/users-list' : Users, | 		'/users-list' : Users, | ||||||
| 		'/students-list' : Students, | 		'/students-list' : Students, | ||||||
| 		'/msg' : Msg, | 		'/msg' : Msg, | ||||||
|  | 		'/payments': Payments | ||||||
| } | } | ||||||
|  |  | ||||||
| const appsList = { | const appsList = { | ||||||
| @ -32,6 +32,7 @@ const appsList = { | |||||||
| 		'ManageCourses': { path: '#/manage-courses', icon: 'fa-book', text: i18n("app.manage.courses") }, | 		'ManageCourses': { path: '#/manage-courses', icon: 'fa-book', text: i18n("app.manage.courses") }, | ||||||
| 		'StudentsList':{ path: '#/students-list',icon: 'fa-users',text: i18n("app.studentList")}, | 		'StudentsList':{ path: '#/students-list',icon: 'fa-users',text: i18n("app.studentList")}, | ||||||
| 		'UsersList':{ path: '#/users-list',icon: 'fa-users',text: i18n("app.users")}, | 		'UsersList':{ path: '#/users-list',icon: 'fa-users',text: i18n("app.users")}, | ||||||
|  | 		'Payments':{path: '#/payments', icon:'fa-users', text:i18n("app.payments")} | ||||||
| } | } | ||||||
|  |  | ||||||
| const currentPath = ref(window.location.hash) | const currentPath = ref(window.location.hash) | ||||||
|  | |||||||
| @ -35,3 +35,15 @@ export async function getScholarshipReqById(id){ | |||||||
| export async function getAllUnregisters(){ | export async function getAllUnregisters(){ | ||||||
|     return restGet("/unregister") |     return restGet("/unregister") | ||||||
| } | } | ||||||
|  |  | ||||||
|  | export async function getUnregisterbyId(id){ | ||||||
|  |     return restGet("/unregister/"+id) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | export async function editUnregReq(id, newstate){ | ||||||
|  |     return restPatch("/unregister/"+id+"/"+newstate) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | export async function getAllPayments(){ | ||||||
|  |     return restGet("/payment") | ||||||
|  | } | ||||||
		Reference in New Issue
	
	Block a user