Skip to content
Commits on Source (13)
......@@ -52,6 +52,7 @@ public class BootstrapData implements CommandLineRunner {
pilote1.setPrenom("Apprenti1");
pilote1.setAge(100);
pilote1.setRace(RacePilote.CHALACTEENS);
pilote1.setEtat(EtatPilote.DISPONIBLE);
pilote1.setType(TypePilote.APPRENTI);
pilote1.setGrade(GradePilote.OFFICIER);
pilote1.setEtat(EtatPilote.DISPONIBLE);
......@@ -193,7 +194,7 @@ public class BootstrapData implements CommandLineRunner {
affectationRepository.save(affectation4);
mission2.getAffectation().add(affectation2);
pilote5.getAffectation().add(affectation2);
pilote1.getAffectation().add(affectation2);
chasseur4.getAffectation().add(affectation2);
mission3.getAffectation().add(affectation1);
......
......@@ -9,6 +9,7 @@ import fr.ldnr.starWars.domains.Mission;
import fr.ldnr.starWars.domains.Pilote;
import fr.ldnr.starWars.enumerations.GradePilote;
import fr.ldnr.starWars.enumerations.StatutMission;
import fr.ldnr.starWars.enumerations.TypeMission;
import fr.ldnr.starWars.enumerations.TypePilote;
import fr.ldnr.starWars.services.MissionService;
import java.util.HashSet;
......@@ -39,22 +40,83 @@ public class Calculs {
totalNbHeure += mission.getNbHeure();
}
}
// return total nbHeure
return totalNbHeure;
}
public int calculNbMission() {
// calcul nb de mission type COMBAT
public int calculNbMissionCombat(Pilote pilote) {
int nbMissionCombat = 0;
Set<Mission> missions = new HashSet<>(); // Create a set to store missions
for (Affectation affectation : pilote.getAffectation()) {
Mission mission = affectation.getMission();
if (mission != null && mission.getType().equals(TypeMission.COMBAT)) {
missions.add(mission);
// recuperate nbHeure
nbMissionCombat++;
}
}
return nbMissionCombat;
}
// calcul nb de mission type ALL
public int calculTotalNbMission(Pilote pilote) {
int totalNbMission = 0;
Set<Mission> missions = new HashSet<>(); // Create a set to store missions
for (Affectation affectation : pilote.getAffectation()) {
Mission mission = affectation.getMission();
if (mission != null) {
missions.add(mission);
// recuperate nbHeure
totalNbMission++;
}
}
return totalNbMission;
}
public GradePilote updateGradePilote() {
// update Grade Pilote :
// Officier < 500 heures
// Lieutenant >= 500
// Capitaine 501 - 1500 + 1 Mission COMBAT
// Major 1500-3999 + 3 TOTAL Mission
// Commandant >=4000 + 10 TOTAL Mission
public GradePilote checkGradePilote(int nbHeures, int totalNbMission, int totalNbMissionCombat) {
// Officier: Less than 500 hours
if (nbHeures < 500) {
return GradePilote.OFFICIER;
}
// Lieutenant: 500 hours or more
if (nbHeures >= 500) {
return GradePilote.LIEUTENANT;
}
// Capitaine: Between 501 and 1500 hours with at least 1 Mission COMBAT
if (nbHeures > 500 && nbHeures <= 1500 && totalNbMissionCombat >= 1) {
return GradePilote.CAPITAINE;
}
// Major: Between 1500 and 3999 hours with at least 3 TOTAL Missions and 1 Mission COMBAT
if (nbHeures >= 1500 && nbHeures <= 3999 && totalNbMission >= 3 && totalNbMissionCombat >= 1) {
return GradePilote.MAJOR;
}
// Commandant: 4000 hours or more with at least 3 TOTAL Missions and 1 Mission COMBAT
if (nbHeures >= 4000 && totalNbMission >= 3 && totalNbMissionCombat >= 1) {
return GradePilote.COMMANDANT;
}
public TypePilote updateTypePilote() {
// No matching conditions, return null to indicate no grade assigned
return null;
}
// update Type Pilote. Apprenti < 100 heures. Combattant >= 100 heures.
public TypePilote checkTypePilote(int nbHeures) {
if (nbHeures < 100) {
return TypePilote.APPRENTI;
}
return TypePilote.COMBATTANT;
}
}
......@@ -5,12 +5,18 @@
package fr.ldnr.starWars.controllers;
import fr.ldnr.starWars.calculs.Calculs;
import fr.ldnr.starWars.domains.Affectation;
import fr.ldnr.starWars.domains.Chasseur;
import fr.ldnr.starWars.domains.Mission;
import fr.ldnr.starWars.domains.Pilote;
import fr.ldnr.starWars.enumerations.GradePilote;
import fr.ldnr.starWars.enumerations.ResultatMission;
import fr.ldnr.starWars.enumerations.StatutMission;
import fr.ldnr.starWars.enumerations.TypePilote;
import fr.ldnr.starWars.services.MissionService;
import fr.ldnr.starWars.services.PiloteService;
import java.util.HashSet;
import java.util.Set;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -58,16 +64,62 @@ public class ClotureMission {
// persister missionRecupere dans la db
missionService.save(missionRecupere);
// boucle tous les pilotes dans la Mission
Set<Pilote> pilotes = new HashSet<>(); // Create a set to store pilotes in the Mission
for (Affectation affectation : missionRecupere.getAffectation()) {
Pilote pilote = affectation.getPilote();
if (pilote != null) {
pilotes.add(pilote);
}
}
model.addAttribute("pilotes", pilotes);
// boucle tous les chasseurs dans la Mission
Set<Chasseur> chasseurs = new HashSet<>(); // Create a set to store pilotes in the Mission
for (Affectation affectation : missionRecupere.getAffectation()) {
Chasseur chasseur = affectation.getChasseur();
if (chasseur != null) {
chasseurs.add(chasseur);
}
}
model.addAttribute("chasseurs", chasseurs);
for (Pilote pilote : pilotes) {
// ---------- DÉBUT CALCUL NB HEURE ET PUIS UPDATE GRADE OU TYPE
//calculNbHeure
Calculs calculs = new Calculs(missionService);
Pilote pilote = piloteService.findById(5);
// Pilote pilote = piloteService.findById(5); // DON'T DELETE THIS PLEASE !!!
int nbHeure = calculs.calculNbHeure(pilote);
System.out.println("CHECK nbHeure : " + nbHeure);
return "clotureMission";
}
public void updateGradePilote() {
// test calculNbHeure
//calcul nb de mission de combat
int nbMissionCombat = calculs.calculNbMissionCombat(pilote);
System.out.println("nbMissionCombat : " + nbMissionCombat);
//calcul total nb de mission
int totalNbMission = calculs.calculTotalNbMission(pilote);
System.out.println("totalNbMission : " + totalNbMission);
// update Grade de pilote
GradePilote newGrade = calculs.checkGradePilote(nbHeure, totalNbMission, nbMissionCombat);
pilote.setGrade(newGrade);
System.out.println("newGrade : " + newGrade);
// update Type de pilote
TypePilote newType = calculs.checkTypePilote(nbHeure);
pilote.setType(newType);
System.out.println("newType : " + newType);
// test calculNbHeure
// then update to db
piloteService.save(pilote);
// ---------- FIN CALCUL NB HEURE ET PUIS UPDATE GRADE OU TYPE
}
return "clotureMission";
}
}
......@@ -5,11 +5,14 @@
package fr.ldnr.starWars.controllers;
import fr.ldnr.starWars.domains.Chasseur;
import fr.ldnr.starWars.enumerations.EtatChasseur;
import fr.ldnr.starWars.services.ChasseurService;
import org.springframework.stereotype.Controller;
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
......@@ -18,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestParam;
public class FicheChasseurController {
private final ChasseurService chasseurService;
Integer idChasseur;
public FicheChasseurController(ChasseurService chasseurService) {
this.chasseurService = chasseurService;
......@@ -27,7 +31,26 @@ public class FicheChasseurController {
public String afficherFicheChasseur(@RequestParam Long id_chasseur, Model model) {
model.addAttribute("ficheChasseur", chasseurService.trouverParId(id_chasseur));
model.addAttribute("etat", chasseurService.listeEtatChasseur());
idChasseur = id_chasseur.intValue();
return "ficheChasseur";
}
@PostMapping("/ficheChasseur")
public String afficherFicheChasseur(Model model,
@RequestParam(value = "etat") String etat) {
// model.getAttribute("id_chasseur");
EtatChasseur etat2 = EtatChasseur.valueOf(etat);
Chasseur chasseur = chasseurService.findById(idChasseur);
chasseur.setEtat(etat2);
chasseurService.save(chasseur);
System.out.println("chasseur : " + chasseur);
model.addAttribute("ficheChasseur", chasseurService.trouverParId(idChasseur.longValue()));
model.addAttribute("etat", chasseurService.listeEtatChasseur());
return "ficheChasseur";
}
}
......@@ -4,11 +4,21 @@
*/
package fr.ldnr.starWars.controllers;
import fr.ldnr.starWars.calculs.Calculs;
import fr.ldnr.starWars.domains.Affectation;
import fr.ldnr.starWars.domains.Chasseur;
import fr.ldnr.starWars.domains.Mission;
import fr.ldnr.starWars.domains.Pilote;
import fr.ldnr.starWars.enumerations.EtatChasseur;
import fr.ldnr.starWars.enumerations.EtatPilote;
import fr.ldnr.starWars.services.MissionService;
import fr.ldnr.starWars.services.PiloteService;
import java.util.HashSet;
import java.util.Set;
import org.springframework.stereotype.Controller;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
......@@ -18,10 +28,14 @@ import org.springframework.web.bind.annotation.RequestParam;
*/
@Controller
public class FichePiloteController {
private final PiloteService piloteService;
private final MissionService missionService;
Integer idPilote;
public FichePiloteController(PiloteService piloteService) {
public FichePiloteController(PiloteService piloteService, MissionService missionService) {
this.piloteService = piloteService;
this.missionService = missionService;
}
@GetMapping("/fichePilote")
......@@ -29,9 +43,42 @@ public class FichePiloteController {
Pilote pilote = new Pilote();
pilote = piloteService.findById(Integer.valueOf(id_pilote));
model.addAttribute("pilote", pilote);
Set<Mission> missions = new HashSet<>(); // Create a set to store pilotes in the Mission
for (Affectation affectation : pilote.getAffectation()) {
Mission mission = affectation.getMission();
if (mission != null) {
missions.add(mission);
}
}
//System.out.println("list de missions : + " + missions);
model.addAttribute("missions", missions);
Calculs calculs = new Calculs(missionService);
int nbHeure = calculs.calculNbHeure(pilote);
model.addAttribute("nbHeure", nbHeure);
System.out.println("");
idPilote = Integer.valueOf(id_pilote);
model.addAttribute("ficheChasseur", piloteService.findById(idPilote));
model.addAttribute("etat", piloteService.listEtat());
return "fichePilote";
}
@PostMapping("/fichePilote")
public String afficherFichepilote(Model model,
@RequestParam(value = "etat") String etat) {
// model.getAttribute("id_chasseur");
EtatPilote etat2 = EtatPilote.valueOf(etat);
Pilote pilote = piloteService.findById(idPilote);
pilote.setEtat(etat2);
piloteService.save(pilote);
System.out.println("chasseur : " + pilote);
model.addAttribute("pilote", piloteService.findById(idPilote));
model.addAttribute("etat", piloteService.listEtat());
return "fichePilote";
}
}
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package fr.ldnr.starWars.controllers;
import fr.ldnr.starWars.enumerations.EtatChasseur;
import fr.ldnr.starWars.services.ChasseurService;
import org.springframework.stereotype.Controller;
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 Johad
*/
@Controller
public class ModifierEtatChasseurController {
private final ChasseurService chasseurService;
public ModifierEtatChasseurController(ChasseurService chasseurService) {
this.chasseurService = chasseurService;
}
@GetMapping("/modifierEtatChasseur")
public String modifierEtatPilote(Model model) {
model.addAttribute("etatChasseur", chasseurService.listeTypeChasseur());
return "modifierEtatChasseur";
}
@PostMapping("/modifierEtatChasseur")
public String modifierEtatChasseur(@RequestParam Long id_chasseur, Model model,
@RequestParam(value="etat") String etat) {
model.addAttribute("etatChasseur", chasseurService.modifierEtat(id_chasseur, EtatChasseur.valueOf(etat)));
return "modifierEtatChasseur";
}
}
///*
// * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
// * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
// */
//package fr.ldnr.starWars.controllers;
//
//import fr.ldnr.starWars.enumerations.EtatChasseur;
//import fr.ldnr.starWars.services.ChasseurService;
//import org.springframework.stereotype.Controller;
//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 Johad
// */
//@Controller
//public class ModifierEtatChasseurController {
//
// private final ChasseurService chasseurService;
//
// public ModifierEtatChasseurController(ChasseurService chasseurService) {
// this.chasseurService = chasseurService;
// }
//
// @GetMapping("/modifierEtatChasseur")
// public String modifierEtatPilote(Model model) {
// model.addAttribute("etatChasseur", chasseurService.listeTypeChasseur());
// return "modifierEtatChasseur";
// }
//
// @PostMapping("/modifierEtatChasseur")
// public String modifierEtatChasseur(@RequestParam Long id_chasseur, Model model,
// @RequestParam(value="etat") String etat) {
//
// model.addAttribute("etatChasseur", chasseurService.modifierEtat(id_chasseur, EtatChasseur.valueOf(etat)));
// return "modifierEtatChasseur";
// }
//}
......@@ -33,4 +33,6 @@ public interface ChasseurService {
public Chasseur findById(Integer idChasseur);
public Iterable<EtatChasseur> listeEtatChasseur();
}
......@@ -56,6 +56,13 @@ public class ChasseurServiceImpl implements ChasseurService {
return list;
}
@Override
public Iterable<EtatChasseur> listeEtatChasseur() {
List<EtatChasseur> list = Arrays.asList(EtatChasseur.values());
return list;
}
@Override
public Iterable<Chasseur> trouverParId(Long id_chasseur) {
List<Chasseur> list = new ArrayList();
......
license: Freeware, Non-Commercial
link: https://www.fontspace.com/starkiller-font-f35874
\ No newline at end of file
The FontStruction “AnakinMono”
(http://fontstruct.com/fontstructions/show/773756) by “opipik” is licensed
under a Creative Commons Attribution Share Alike license
(http://creativecommons.org/licenses/by-sa/3.0/).
The font file in this archive was created using Fontstruct the free, online
font-building tool.
This font was created by “opipik”.
This font has a homepage where this archive and other versions may be found:
http://fontstruct.com/fontstructions/show/773756
Try Fontstruct at http://fontstruct.com
It’s easy and it’s fun.
NOTE FOR FLASH USERS: Fontstruct fonts (fontstructions) are optimized for Flash.
If the font in this archive is a pixel font, it is best displayed at a font-size
of 8.
Fontstruct is sponsored by FontShop.
Visit them at http://www.fontshop.com
FontShop is the original independent font retailer. We’ve been around since
the dawn of digital type. Whether you need the right font or need to create the
right font from scratch, let our 22 years of experience work for you.
Fontstruct is copyright ©2013 Rob Meek
LEGAL NOTICE:
In using this font you must comply with the licensing terms described in the
file “license.txt” included with this archive.
If you redistribute the font file in this archive, it must be accompanied by all
the other files from this archive, including this one.
@font-face{
font-family:'Star Wars', sans-serif;
font-family:'Starkiller';
src:
url('/fonts/StarkillerOutline-3L5L.ttf') format('truetype');
}
@font-face{
font-family:'anakinmono';
src:
url('/fonts/anakinmono.ttf') format('truetype');
}
:root {
--glow-color: hsl(60 100% 50%);
}
*,
*::before,
*::after {
box-sizing: border-box;
}
h1 {
font-family: 'Star Wars', sans-serif;
font-family: 'Starkiller';
}
h2{
text-align: left;
margin-inline-end: auto;
margin-left: 15%;
}
body {
font-family: 'Star Wars', sans-serif;
font-family: anakinmono, sans-serif;
background-image: url("https://p.turbosquid.com/ts-thumb/p4/gieJXZ/ZM/screenshot001/png/1650377346/1920x1080/fit_q99/cfea16e5fcc5a49514ffdb25a1eeb849c115d0eb/screenshot001.jpg");
background-size: 50%;
//background-position: bottom right;
background-repeat: no-repeat;
background-size: cover;
}
fieldset{
border-color: yellow;
}
body{
display: flex;
......@@ -35,22 +61,34 @@ a{
.tri{
display: flex;
flex-direction: row;
width: 50%;
width: 100%;
justify-content: space-between;
}
.box {
.mission > h2{
margin-left: 43%;
}
button{
font-family: anakinmono, sans-serif;
background-color: black;
color: yellow;
display: flex;
align-items: center;
justify-content: center;
margin: auto;
}
.mission{
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
}
.label {
width: 100px; /* Largeur souhaitée pour les labels */
text-align: right; /* Alignez le texte du label à droite */
margin-right: auto; /* Marge à droite pour l'espacement du texte du label */
margin-left : auto;
.box {
display: flex;
align-items: center;
justify-content: center;
margin: auto;
}
.bouton {
......@@ -70,3 +108,266 @@ main::before {
background: rgba(0, 0, 0, 0.5); /* Adjust the last value (alpha) to control the transparency */
z-index: -1; /* Place the overlay behind the content */
}
main{
width: 50%;
display: flex;
flex-direction: column;
align-items: center;
}
form{
display: flex;
justify-content: center;
}
.laber{
text-align: left;
}
.inscription {
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
}
.box{
display: flex;
flex-direction: row;
justify-content: space-between;
}
.button{
display: flex;
flex-direction: row;
justify-content: space-evenly;
}
input{
font-family: "anakinmono", sans-serif;
background-color: black;
color: yellow;
}
ul{
width: 100%;
margin-left: 50%;
}
li{
list-style: none;
}
select{
font-family: "anakinmono", sans-serif;
background-color: black;
color: yellow;
}
.radio {
padding: 0.3rem 0.5rem;
border: 1px dashed #ccc;
background-color: black;
}
.radio {
border: 1px solid #000;
}
.glowing-btn {
position: relative;
color: var(--glow-color);
cursor: pointer;
padding: 0.35em 1em;
border: 0.15em solid var(--glow-color);
border-radius: 0.45em;
background: none;
perspective: 2em;
font-family: "Starkiller", sans-serif;
font-size: 2em;
font-weight: 900;
letter-spacing: 0.2em;
-webkit-box-shadow: inset 0px 0px 0.5em 0px var(--glow-color),
0px 0px 0.5em 0px var(--glow-color);
-moz-box-shadow: inset 0px 0px 0.5em 0px var(--glow-color),
0px 0px 0.5em 0px var(--glow-color);
box-shadow: inset 0px 0px 0.5em 0px var(--glow-color),
0px 0px 0.5em 0px var(--glow-color);
animation: border-flicker 2s linear infinite;
}
.glowing-txt {
float: left;
margin-right: -0.8em;
-webkit-text-shadow: 0 0 0.125em hsl(0 0% 100% / 0.3),
0 0 0.45em var(--glow-color);
-moz-text-shadow: 0 0 0.125em hsl(0 0% 100% / 0.3),
0 0 0.45em var(--glow-color);
text-shadow: 0 0 0.125em hsl(0 0% 100% / 0.3), 0 0 0.45em var(--glow-color);
animation: text-flicker 3s linear infinite;
}
.faulty-letter {
opacity: 0.5;
animation: faulty-flicker 2s linear infinite;
}
.glowing-btn::before {
content: "";
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
opacity: 0.7;
filter: blur(1em);
transform: translateY(120%) rotateX(95deg) scale(1, 0.35);
background: var(--glow-color);
pointer-events: none;
}
.glowing-btn::after {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
opacity: 0;
z-index: -1;
background-color: var(--glow-color);
box-shadow: 0 0 2em 0.2em var(--glow-color);
transition: opacity 100ms linear;
}
.glowing-btn:hover {
color: rgba(0, 0, 0, 0.8);
text-shadow: none;
animation: none;
}
.glowing-btn:hover .glowing-txt {
animation: none;
}
.glowing-btn:hover .faulty-letter {
animation: none;
text-shadow: none;
opacity: 1;
}
.glowing-btn:hover:before {
filter: blur(1.5em);
opacity: 1;
}
.glowing-btn:hover:after {
opacity: 1;
}
@keyframes faulty-flicker {
0% {
opacity: 0.1;
}
2% {
opacity: 0.1;
}
4% {
opacity: 0.5;
}
19% {
opacity: 0.5;
}
21% {
opacity: 0.1;
}
23% {
opacity: 1;
}
80% {
opacity: 0.5;
}
83% {
opacity: 0.4;
}
87% {
opacity: 1;
}
}
@keyframes text-flicker {
0% {
opacity: 0.1;
}
2% {
opacity: 1;
}
8% {
opacity: 0.1;
}
9% {
opacity: 1;
}
12% {
opacity: 0.1;
}
20% {
opacity: 1;
}
25% {
opacity: 0.3;
}
30% {
opacity: 1;
}
70% {
opacity: 0.7;
}
72% {
opacity: 0.2;
}
77% {
opacity: 0.9;
}
100% {
opacity: 0.9;
}
}
@keyframes border-flicker {
0% {
opacity: 0.1;
}
2% {
opacity: 1;
}
4% {
opacity: 0.1;
}
8% {
opacity: 1;
}
70% {
opacity: 0.7;
}
100% {
opacity: 1;
}
}
@media only screen and (max-width: 600px) {
.glowing-btn{
font-size: 1em;
}
}