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