Skip to content
Commits on Source (20)
...@@ -77,7 +77,7 @@ public class BootstrapData implements CommandLineRunner { ...@@ -77,7 +77,7 @@ public class BootstrapData implements CommandLineRunner {
pilote4.setAge(29); pilote4.setAge(29);
pilote4.setRace(RacePilote.MIRALUKAS); pilote4.setRace(RacePilote.MIRALUKAS);
pilote4.setType(TypePilote.COMBATTANT); pilote4.setType(TypePilote.COMBATTANT);
pilote4.setGrade(GradePilote.LIUTENANT); pilote4.setGrade(GradePilote.LIEUTENANT);
pilote4.setEtat(EtatPilote.TUE); pilote4.setEtat(EtatPilote.TUE);
Pilote pilote5 = new Pilote(); Pilote pilote5 = new Pilote();
...@@ -129,13 +129,13 @@ public class BootstrapData implements CommandLineRunner { ...@@ -129,13 +129,13 @@ public class BootstrapData implements CommandLineRunner {
mission1.setTitre("Mission 1"); mission1.setTitre("Mission 1");
mission1.setType(TypeMission.COMBAT); mission1.setType(TypeMission.COMBAT);
mission1.setNbHeure(70); mission1.setNbHeure(70);
mission1.setResultat(ResultatMission.ECHEC); mission1.setResultat(ResultatMission.DEFAITE);
Mission mission2 = new Mission(); Mission mission2 = new Mission();
mission2.setTitre("Mission 2"); mission2.setTitre("Mission 2");
mission2.setType(TypeMission.ENTRAINEMENT); mission2.setType(TypeMission.ENTRAINEMENT);
mission2.setNbHeure(66); mission2.setNbHeure(66);
mission2.setResultat(ResultatMission.SUCCESS); mission2.setResultat(ResultatMission.VICTOIRE);
Mission mission3 = new Mission(); Mission mission3 = new Mission();
mission3.setTitre("Mission 3"); mission3.setTitre("Mission 3");
......
...@@ -18,7 +18,6 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -18,7 +18,6 @@ import org.springframework.web.bind.annotation.RequestParam;
*/ */
@Controller @Controller
public class FichePiloteController { public class FichePiloteController {
private final PiloteService piloteService; private final PiloteService piloteService;
public FichePiloteController(PiloteService piloteService) { public FichePiloteController(PiloteService piloteService) {
...@@ -34,4 +33,5 @@ public class FichePiloteController { ...@@ -34,4 +33,5 @@ public class FichePiloteController {
return "fichePilote"; return "fichePilote";
} }
} }
...@@ -4,10 +4,32 @@ ...@@ -4,10 +4,32 @@
*/ */
package fr.ldnr.starWars.controllers; package fr.ldnr.starWars.controllers;
import fr.ldnr.starWars.services.ChasseurService;
import fr.ldnr.starWars.services.MissionService;
import fr.ldnr.starWars.services.PiloteService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
/** /**
* *
* @author stag * @author stag
*/ */
@Controller
public class FinMissionController { public class FinMissionController {
private final MissionService missionService;
public FinMissionController(MissionService missionService) {
this.missionService = missionService;
}
@GetMapping("/clotureMission")
public String clotureMission(Model model) {
model.addAttribute("resultatMission", missionService.resultatMission());
return "clotureMission";
}
} }
...@@ -12,6 +12,7 @@ import org.springframework.ui.Model; ...@@ -12,6 +12,7 @@ import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
/** /**
* *
* @author stag * @author stag
......
...@@ -4,11 +4,30 @@ ...@@ -4,11 +4,30 @@
*/ */
package fr.ldnr.starWars.controllers; package fr.ldnr.starWars.controllers;
import fr.ldnr.starWars.services.MissionService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
/** /**
* *
* @author stag * @author vincent
*/ */
@Controller
public class ListeMissionController { public class ListeMissionController {
private final MissionService missionService;
public ListeMissionController(MissionService missionService) {
this.missionService = missionService;
}
@GetMapping("/listeMission")
public String listeMission(Model model) {
model.addAttribute("missions", missionService.findAll());
return "listeMission";
}
......
...@@ -24,7 +24,7 @@ public class NouvelleMissionController { ...@@ -24,7 +24,7 @@ public class NouvelleMissionController {
@RequestMapping("/nouvelleMission") @RequestMapping("/nouvelleMission")
public String getMission(Model model) { public String getMission(Model model) {
// model.addAttribute("typeMissions", missionService.listMission()); model.addAttribute("typeMissions", missionService.listMission());
return "nouvelleMission"; return "nouvelleMission";
} }
......
...@@ -69,7 +69,6 @@ public class Pilote { ...@@ -69,7 +69,6 @@ public class Pilote {
this.age = age; this.age = age;
} }
public Set<Affectation> getAffectation() { public Set<Affectation> getAffectation() {
return affectation; return affectation;
} }
......
...@@ -5,13 +5,13 @@ ...@@ -5,13 +5,13 @@
package fr.ldnr.starWars.enumerations; package fr.ldnr.starWars.enumerations;
/** /**
* Apprenti : moins de 100 heures de vol * Apprenti : moins de 100 heures de vol Officier : moins de 500 heures de vol
* Officier : moins de 500 heures de vol
* Lieutenant : moins de 1500 heures de vol et au moins une mission de combat * Lieutenant : moins de 1500 heures de vol et au moins une mission de combat
* Capitaine : moins de 4000 heures de vol et au moins 3 missions * Capitaine : moins de 4000 heures de vol et au moins 3 missions Commandant :
* Commandant : 4000 heures de vol et au moins 10 missions * 4000 heures de vol et au moins 10 missions
*
* @author stag * @author stag
*/ */
public enum GradePilote { public enum GradePilote {
OFFICIER, LIUTENANT, CAPITAINE, COMMANDANT OFFICIER, LIEUTENANT, CAPITAINE, COMMANDANT
} }
...@@ -9,5 +9,5 @@ package fr.ldnr.starWars.enumerations; ...@@ -9,5 +9,5 @@ package fr.ldnr.starWars.enumerations;
* @author stag * @author stag
*/ */
public enum ResultatMission { public enum ResultatMission {
SUCCESS, ECHEC, NA VICTOIRE, DEFAITE, NA
} }
...@@ -29,6 +29,7 @@ public class ChasseurServiceImpl implements ChasseurService { ...@@ -29,6 +29,7 @@ public class ChasseurServiceImpl implements ChasseurService {
@Override @Override
public Iterable<Chasseur> findAll() { public Iterable<Chasseur> findAll() {
return chasseurRepository.findAll(); return chasseurRepository.findAll();
} }
...@@ -56,22 +57,24 @@ public class ChasseurServiceImpl implements ChasseurService { ...@@ -56,22 +57,24 @@ public class ChasseurServiceImpl implements ChasseurService {
} }
@Override @Override
public Iterable<Chasseur> trouverParType(TypeChasseur type) { public Iterable<Chasseur> trouverParId(Long id_chasseur) {
List<Chasseur> list = new ArrayList(); List<Chasseur> list = new ArrayList();
list = em.createQuery("FROM Chasseur c WHERE c.type = :type") list = em.createQuery("FROM Chasseur c WHERE c.id = :id")
.setParameter("type", type) .setParameter("id", id_chasseur)
.getResultList(); .getResultList();
return list; return list;
} }
@Override @Override
public Iterable<Chasseur> trouverParId(Long id_chasseur) { public Iterable<Chasseur> trouverParType(TypeChasseur type) {
List<Chasseur> list = new ArrayList(); List<Chasseur> list = new ArrayList();
list = em.createQuery("FROM Chasseur c WHERE c.id = :id") list = em.createQuery("FROM Chasseur c WHERE c.type = :type")
.setParameter("id", id_chasseur) .setParameter("type", type)
.getResultList(); .getResultList();
return list; return list;
} }
} }
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
package fr.ldnr.starWars.services; package fr.ldnr.starWars.services;
import fr.ldnr.starWars.domains.Mission; import fr.ldnr.starWars.domains.Mission;
import fr.ldnr.starWars.enumerations.ResultatMission;
import fr.ldnr.starWars.enumerations.TypeMission; import fr.ldnr.starWars.enumerations.TypeMission;
/** /**
...@@ -14,7 +15,12 @@ import fr.ldnr.starWars.enumerations.TypeMission; ...@@ -14,7 +15,12 @@ import fr.ldnr.starWars.enumerations.TypeMission;
public interface MissionService { public interface MissionService {
Iterable<Mission> findAll(); Iterable<Mission> findAll();
Mission save(Mission mission);
public Iterable<TypeMission> listMission(); public Iterable<TypeMission> listMission();
public Iterable<ResultatMission> resultatMission();
} }
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
package fr.ldnr.starWars.services; package fr.ldnr.starWars.services;
import fr.ldnr.starWars.domains.Mission; import fr.ldnr.starWars.domains.Mission;
import fr.ldnr.starWars.enumerations.ResultatMission;
import fr.ldnr.starWars.enumerations.TypeMission; import fr.ldnr.starWars.enumerations.TypeMission;
import fr.ldnr.starWars.repositories.MissionRepository; import fr.ldnr.starWars.repositories.MissionRepository;
import jakarta.persistence.EntityManager; import jakarta.persistence.EntityManager;
...@@ -38,6 +39,15 @@ public class MissionServiceImpl implements MissionService { ...@@ -38,6 +39,15 @@ public class MissionServiceImpl implements MissionService {
List<TypeMission> list = Arrays.asList(TypeMission.values()); List<TypeMission> list = Arrays.asList(TypeMission.values());
return list; return list;
} }
@Override
public Iterable<ResultatMission>resultatMission(){
List<ResultatMission>resultat = Arrays.asList(ResultatMission.values());
return resultat;
}
@Override
public Mission save(Mission mission) {
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
}
} }
...@@ -23,16 +23,22 @@ Click nbfs://nbhost/SystemFileSystem/Templates/Other/html.html to edit this temp ...@@ -23,16 +23,22 @@ Click nbfs://nbhost/SystemFileSystem/Templates/Other/html.html to edit this temp
<div> <div>
<label for="resultat">Resultat Mission : </label> <label for="resultat">Resultat Mission : </label>
<select id="resultat" name="resultats"> <select id="resultat" name="resultats">
<option th:each="resultats : ${resultatMission}" th:value="${resultat}" th:text="${resultat}"></option> <option th:each="resultat : ${resultatMission}" th:value="${resultat}" th:text="${resultat}"></option>
</select> </select>
</div> </div>
<div> <div>
<label>Détail</label> <label>Détail</label>
<div> <div>
<label for="pilote">Pilote</label> <label for="pilote">Pilote</label>
<select id="" <select id="pilote" name="pilote">
<option th:each="pilote : ${etatPilote}" th:value="${etatPilote}" th:text="${etatPilote}"></option>
</select>
<label for="chasseur">Chasseur</label>
<select id="chasseur" name="chasseur">
<option th:each="chasseur : ${etatChasseur}" th:value="${etatChasseur}" th:text="${etatChasseur}"></option>
</select>
</div>
</div> </div>
</form> </form>
<footer> <footer>
<a href="/menu" class="menu">Retour au Menu</a> <a href="/menu" class="menu">Retour au Menu</a>
......
...@@ -7,9 +7,7 @@ ...@@ -7,9 +7,7 @@
<link rel="stylesheet" href="/style.css"> <link rel="stylesheet" href="/style.css">
</head> </head>
<body> <body>
<header>
<h1>Fiche Chasseur</h1> <h1>Fiche Chasseur</h1>
</header>
<table> <table>
<tr> <tr>
<th>Identifiant</th> <th>Identifiant</th>
...@@ -22,8 +20,6 @@ ...@@ -22,8 +20,6 @@
<td th:text="${chasseur.etat_chasseur}"></td> <td th:text="${chasseur.etat_chasseur}"></td>
</tr> </tr>
</table> </table>
<footer> <a th:href="@{/listeChasseur}">Retour à la liste des chasseurs</a>
<a href="/menu" class="menu">Retour au Menu</a>
</footer>
</body> </body>
</html> </html>
...@@ -8,16 +8,17 @@ Click nbfs://nbhost/SystemFileSystem/Templates/Other/html.html to edit this temp ...@@ -8,16 +8,17 @@ Click nbfs://nbhost/SystemFileSystem/Templates/Other/html.html to edit this temp
<title>Fiche Pilote</title> <title>Fiche Pilote</title>
<meta charset="UTF-8"/> <meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="/style.css">
</head> </head>
<body> <body>
<header> <header>
<h1>Fiche Pilote</h1> <h1>Fiche Pilote</h1>
</header> </header>
<p th:text="${pilote.prenom}">Prénom</p> <p>Prénom : <span th:text="${pilote.prenom}"></span></p>
<p th:text="${pilote.nom}">Nom</p> <p>Nom : <span th:text="${pilote.nom}"></span></p>
<p th:text="${pilote.race}">Race</p> <p>Race : <span th:text="${pilote.race}"></span></p>
<p th:text="${pilote.age}">Age_inscription</p> <p>Age_inscription : <span th:text="${pilote.age}"></span></p>
<p th:text="${pilote.etat}">État</p> <p>État : <span th:text="${pilote.etat}"></span></p>
<!--besoin db des missions afin pouvoir afficher Missions--> <!--besoin db des missions afin pouvoir afficher Missions-->
<p>Nombre d'heures de vol : </p> <p>Nombre d'heures de vol : </p>
<p>Grade : <span th:text="${pilote.grade}"></span></p> <p>Grade : <span th:text="${pilote.grade}"></span></p>
......
...@@ -4,29 +4,26 @@ ...@@ -4,29 +4,26 @@
<title>Liste Chasseur</title> <title>Liste Chasseur</title>
<meta charset="UTF-8"/> <meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="/style.css"> <link rel="stylesheet" href="/style.css"/>
</head> </head>
<body> <body>
<header>
<h1>Liste Chasseur</h1> <h1>Liste Chasseur</h1>
</header>
<form action="/nouveauChasseur" method="post">
<table> <table>
<tr> <tr>
<th>Identifiant chasseur</th> <th>Identifiant</th>
<th>Type chasseur</th> <th>Type chasseur</th>
<th>Etat chasseur</th> <th>Etat chasseur</th>
</tr> </tr>
<tr> <tr th:each="chasseur: ${listeChasseur}">
<td th:each="chasseur : ${chasseur}" th:text="${chasseur.id_chasseur}"></td> <td>
<td th:each="chasseur : ${chasseur}" th:text="${chasseur.type}"></td> <a th:href="'/ficheChasseur?id_chasseur=' + ${chasseur.idChasseur}" th:text="${chasseur.idChasseur}">
<td th:each="chasseur : ${chasseur}" th:text="${chasseur.etat}"></td> </a>
</td>
<td th:text="${chasseur.type}"></td>
<td th:text="${chasseur.etat}"></td>
</tr> </tr>
</table> </table>
</form>
<footer>
<a href="/menu" class="menu">Retour au Menu</a> <a href="/menu" class="menu">Retour au Menu</a>
</footer>
</body> </body>
</html> </html>
<!DOCTYPE html>
<!--
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
Click nbfs://nbhost/SystemFileSystem/Templates/Other/html.html to edit this template
-->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
<title>Liste Mission</title>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="/style.css">
</head>
<body>
<header>
<h1>Liste Mission</h1>
</header>
<div>
<label for="tri mission">sélection de mission :</label>
<select name="mission" id="tri-mission">
<option value="">--Please choose an option--</option>
<option value="Terminée">Terminée</option>
<option value="En cours">En Cours</option>
<option value="Victoire">Victoire</option>
<option value="Défaite">Défaite</option>
<option value="Entrainement">Entrainement</option>
<option value="Combat">Combat</option>
</select>
</div>
<footer>
<a href="/menu" class="menu">Retour au Menu</a>
</footer>
</body>
</html>
...@@ -19,7 +19,6 @@ Click nbfs://nbhost/SystemFileSystem/Templates/Other/html.html to edit this temp ...@@ -19,7 +19,6 @@ Click nbfs://nbhost/SystemFileSystem/Templates/Other/html.html to edit this temp
<ul> <ul>
<li><a href="/inscriptionPilote" class="menu">Inscription d'un nouveau pilote</a></li> <li><a href="/inscriptionPilote" class="menu">Inscription d'un nouveau pilote</a></li>
<li><a href="/listePilote" class="menu">Liste des pilotes actifs</a></li> <li><a href="/listePilote" class="menu">Liste des pilotes actifs</a></li>
<li><a href="/memorial" class="menu">Mémorial </a></li>
</ul> </ul>
<h2>Chasseur</h2> <h2>Chasseur</h2>
......