commit ba296a279848b685d25d01f95d619eee01955187
Author: lbihannic <lucas.bihannic@inrae.fr>
Date:   Tue Mar 25 10:00:29 2025 +0100

    add animal information entry function

diff --git a/GES_PAC/AppShell.xaml b/GES_PAC/AppShell.xaml
index efa0306..65f9619 100644
--- a/GES_PAC/AppShell.xaml
+++ b/GES_PAC/AppShell.xaml
@@ -24,6 +24,7 @@
         Route="CreatePlace"
         ContentTemplate="{DataTemplate local:CreatePlaceView}" />
 
+    <!-- ONLY FOR TESTS -->
     <ShellContent 
         Title="Chambres (test)" 
         Route="Chambers"
diff --git a/GES_PAC/GES_PAC.csproj b/GES_PAC/GES_PAC.csproj
index 266dff9..167b1bf 100644
--- a/GES_PAC/GES_PAC.csproj
+++ b/GES_PAC/GES_PAC.csproj
@@ -84,6 +84,9 @@
 	  <Compile Update="View\CreatePlaceView.xaml.cs">
 	    <DependentUpon>CreatePlaceView.xaml</DependentUpon>
 	  </Compile>
+	  <Compile Update="View\EnterAnimalView.xaml.cs">
+	    <DependentUpon>EnterAnimalView.xaml</DependentUpon>
+	  </Compile>
 	  <Compile Update="View\SetListView.xaml.cs">
 	    <DependentUpon>SetListView.xaml</DependentUpon>
 	  </Compile>
@@ -105,7 +108,7 @@
 	  <MauiXaml Update="View\CreateSetView.xaml">
 	    <Generator>MSBuild:Compile</Generator>
 	  </MauiXaml>
-	  <MauiXaml Update="View\EnterAnimal.xaml">
+	  <MauiXaml Update="View\EnterAnimalView.xaml">
 	    <Generator>MSBuild:Compile</Generator>
 	  </MauiXaml>
 	  <MauiXaml Update="View\MainView.xaml">
diff --git a/GES_PAC/Model/Journee.cs b/GES_PAC/Model/Journee.cs
index 06242e3..61aa442 100644
--- a/GES_PAC/Model/Journee.cs
+++ b/GES_PAC/Model/Journee.cs
@@ -71,6 +71,11 @@ namespace GES_PAC.Model
             }
             return TypeCalibration.All.Except(Calibrations.Last().GetTypesDone()).ToList();
         }
+        
+        public Serie GetCurrentSet()
+        {
+            return Series.Last();
+        }
         #endregion
     }
 }
diff --git a/GES_PAC/Model/Serie.cs b/GES_PAC/Model/Serie.cs
index 92b9ae7..bd27ebc 100644
--- a/GES_PAC/Model/Serie.cs
+++ b/GES_PAC/Model/Serie.cs
@@ -3,6 +3,7 @@ namespace GES_PAC.Model
 {
     public class Serie
     {
+        #region Propriétés
         public long Id { get; set; }
         public DateTime Time { get; set; }
         public DateTime MiseAJeun { get; set; }
@@ -10,7 +11,9 @@ namespace GES_PAC.Model
         public double Humidite { get; set; }
         public double Pression { get; set; }
         public List<SerieAnimal> SeriesAnimales { get; set; }
+        #endregion
 
+        #region Constructeurs
         public Serie(DateTime Time, DateTime MiseAJeun, double Temperature, double Humidite, double Pression)
         {
             this.Time = Time;
@@ -20,5 +23,13 @@ namespace GES_PAC.Model
             this.Pression = Pression;
             SeriesAnimales = [];
         }
+        #endregion
+
+        #region Méthodes
+        public void AddSerieAnimal(SerieAnimal serieAnimal)
+        {
+            SeriesAnimales.Add(serieAnimal);
+        }
+        #endregion
     }
 }
diff --git a/GES_PAC/Model/SerieAnimal.cs b/GES_PAC/Model/SerieAnimal.cs
index 968210c..404a842 100644
--- a/GES_PAC/Model/SerieAnimal.cs
+++ b/GES_PAC/Model/SerieAnimal.cs
@@ -6,9 +6,19 @@ namespace GES_PAC.Model
         public long Id { get; set; }
         public int NumeroBoite { get; set; }
         public double Poids { get; set; }
-        public double DatePesee { get; set; }
+        public DateTime DatePesee { get; set; }
         public string RFID { get; set; }
         public List<Mesure> Mesures { get; set; }
         public List<Comportement> Comportements { get; set; }
+
+        public SerieAnimal(int numeroBoite, double poids, DateTime datePesee, string rFID)
+        {
+            NumeroBoite = numeroBoite;
+            Poids = poids;
+            DatePesee = datePesee;
+            RFID = rFID;
+            Mesures = [];
+            Comportements = [];
+        }
     }
 }
diff --git a/GES_PAC/View/ChambersView.xaml b/GES_PAC/View/ChambersView.xaml
index 2972c73..b3c2111 100644
--- a/GES_PAC/View/ChambersView.xaml
+++ b/GES_PAC/View/ChambersView.xaml
@@ -72,9 +72,9 @@
                            HeightRequest="75"
                            WidthRequest="75"
                            Rotation="-90"
-                           TranslationY="-60"
+                           TranslationY="20"
                            HorizontalOptions="Center"
-                           BackgroundColor="gray"/>
+                           BackgroundColor="Transparent"/>
                     </VerticalStackLayout>
 
 
diff --git a/GES_PAC/View/EnterAnimal.xaml b/GES_PAC/View/EnterAnimal.xaml
deleted file mode 100644
index 90c0bad..0000000
--- a/GES_PAC/View/EnterAnimal.xaml
+++ /dev/null
@@ -1,83 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
-             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
-             xmlns:vm="clr-namespace:GES_PAC.ViewModel"
-             xmlns:tools="clr-namespace:GES_PAC.View.Tools"
-             x:Class="GES_PAC.View.EnterAnimalView"
-             x:DataType="vm:EnterAnimalViewModel">
-
-    <Grid>
-        <StackLayout BackgroundColor="White" Spacing="50">
-            <tools:ConnectionIndicatorView />
-            <ScrollView>
-
-                <VerticalStackLayout Grid.Row="1" Spacing="30">
-
-                    <Label Text="Informations de la série"
-                       FontSize="20"
-                       FontAttributes="Bold"
-                       HorizontalOptions="Center" />
-                    <VerticalStackLayout Spacing="15" WidthRequest="300">
-
-                        <!-- Num RFID -->
-                        <VerticalStackLayout>
-
-                            <Label Text="Numéro RFID" FontSize="14" TextColor="Gray" FontAttributes="Bold"/>
-                            <Entry Text="{Binding NumRFID}" FontSize="16" TextColor="Black" Placeholder="25"/>
-                            <Label Text="Entrez une valeur"
-                                FontSize="12"
-                                TextColor="Red"
-                                IsVisible="{Binding NumRFIDError}"/>
-
-                        </VerticalStackLayout>
-
-                        <!-- Poids -->
-                        <VerticalStackLayout>
-                            <Label Text="Température (°C)" FontSize="14" TextColor="Gray" FontAttributes="Bold"/>
-                            <Entry Text="{Binding Temperature}" FontSize="16" TextColor="Black" Placeholder="25" Keyboard="Numeric"/>
-                            <Label Text="Entrez une valeur"
-                                FontSize="12"
-                                TextColor="Red"
-                                IsVisible="{Binding TemperatureError}"/>
-                        </VerticalStackLayout>
-
-                    </VerticalStackLayout>
-                </VerticalStackLayout>
-            </ScrollView>
-            <StackLayout
-                Margin="10"
-                HorizontalOptions="CenterAndExpand"
-                Orientation="Horizontal"
-                VerticalOptions="FillAndExpand">
-
-                <Button 
-                    Text="Enregistrer"
-                    Command="{Binding CreateSetCommand}"
-                    Style="{StaticResource btnNormal}"
-                    IsEnabled="{Binding IsFormValid}"
-                    VerticalOptions="End"/>
-            </StackLayout>
-        </StackLayout>
-        <Grid Grid.RowSpan="1" IsVisible="{Binding IsBusy}">
-            <Border StrokeThickness="0"
-                            Background="Black"
-                            Opacity="0.5"
-                            Padding="20"
-                            WidthRequest="160"
-                            HeightRequest="160"
-                            HorizontalOptions="Center"
-                            VerticalOptions="Center"
-                            StrokeShape="RoundRectangle 20">
-
-                <VerticalStackLayout HorizontalOptions="Center" VerticalOptions="Center">
-                    <ActivityIndicator IsRunning="True" Color="White" />
-                    <Label Text="Chargement..."
-                            FontSize="14"
-                            TextColor="white"
-                            HorizontalOptions="Center"/>
-                </VerticalStackLayout>
-            </Border>
-        </Grid>
-    </Grid>
-
-</ContentPage>
\ No newline at end of file
diff --git a/GES_PAC/View/EnterAnimal.xaml.cs b/GES_PAC/View/EnterAnimal.xaml.cs
deleted file mode 100644
index c669bf0..0000000
--- a/GES_PAC/View/EnterAnimal.xaml.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using GES_PAC.ViewModel;
-
-namespace GES_PAC.View;
-
-public partial class EnterAnimalView
-{
-    public EnterAnimalView()
-    {
-        InitializeComponent();
-        BindingContext = new EnterAnimalViewModel();
-    }
-}
diff --git a/GES_PAC/View/EnterAnimalView.xaml b/GES_PAC/View/EnterAnimalView.xaml
new file mode 100644
index 0000000..a7ef462
--- /dev/null
+++ b/GES_PAC/View/EnterAnimalView.xaml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
+             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+             xmlns:vm="clr-namespace:GES_PAC.ViewModel"
+             xmlns:tools="clr-namespace:GES_PAC.View.Tools"
+             x:Class="GES_PAC.View.EnterAnimalView"
+             x:DataType="vm:EnterAnimalViewModel">
+
+    <Grid>
+        <StackLayout BackgroundColor="White" Spacing="50">
+            <tools:ConnectionIndicatorView />
+            <ScrollView>
+
+                <VerticalStackLayout Grid.Row="1" Spacing="30">
+
+                    <Label Text="{Binding Titre}"
+                       FontSize="20"
+                       FontAttributes="Bold"
+                       HorizontalOptions="Center" />
+                    <VerticalStackLayout Spacing="15" WidthRequest="300">
+
+                        <!-- Num RFID -->
+                        <VerticalStackLayout>
+
+                            <Label Text="Numéro RFID" FontSize="14" TextColor="Gray" FontAttributes="Bold"/>
+                            <Entry Text="{Binding NumRFID}" FontSize="16" TextColor="Black" Placeholder="25"/>
+                            <Label Text="Min. 5 caractères"
+                                FontSize="12"
+                                TextColor="Red"
+                                IsVisible="{Binding NumRFIDError}"/>
+
+                        </VerticalStackLayout>
+
+                        <!-- Poids -->
+                        <VerticalStackLayout>
+                            <Label Text="Poids (kg)" FontSize="14" TextColor="Gray" FontAttributes="Bold"/>
+                            <Entry Text="{Binding Poids}" FontSize="16" TextColor="Black" Placeholder="25" Keyboard="Numeric"/>
+                            <Label Text="Entrez une valeur"
+                                FontSize="12"
+                                TextColor="Red"
+                                IsVisible="{Binding PoidsError}"/>
+                        </VerticalStackLayout>
+
+                    </VerticalStackLayout>
+                </VerticalStackLayout>
+            </ScrollView>
+            <StackLayout
+                Margin="10"
+                HorizontalOptions="CenterAndExpand"
+                Orientation="Horizontal"
+                VerticalOptions="FillAndExpand">
+
+                <Button 
+                    Text="Enregistrer"
+                    Command="{Binding EnterAnimalCommand}"
+                    Style="{StaticResource btnNormal}"
+                    IsEnabled="{Binding IsFormValid}"
+                    VerticalOptions="End"/>
+            </StackLayout>
+        </StackLayout>
+        <Grid Grid.RowSpan="1" IsVisible="{Binding IsBusy}">
+            <Border StrokeThickness="0"
+                            Background="Black"
+                            Opacity="0.5"
+                            Padding="20"
+                            WidthRequest="160"
+                            HeightRequest="160"
+                            HorizontalOptions="Center"
+                            VerticalOptions="Center"
+                            StrokeShape="RoundRectangle 20">
+
+                <VerticalStackLayout HorizontalOptions="Center" VerticalOptions="Center">
+                    <ActivityIndicator IsRunning="True" Color="White" />
+                    <Label Text="Chargement..."
+                            FontSize="14"
+                            TextColor="white"
+                            HorizontalOptions="Center"/>
+                </VerticalStackLayout>
+            </Border>
+        </Grid>
+    </Grid>
+
+</ContentPage>
\ No newline at end of file
diff --git a/GES_PAC/View/EnterAnimalView.xaml.cs b/GES_PAC/View/EnterAnimalView.xaml.cs
new file mode 100644
index 0000000..c669bf0
--- /dev/null
+++ b/GES_PAC/View/EnterAnimalView.xaml.cs
@@ -0,0 +1,12 @@
+using GES_PAC.ViewModel;
+
+namespace GES_PAC.View;
+
+public partial class EnterAnimalView
+{
+    public EnterAnimalView()
+    {
+        InitializeComponent();
+        BindingContext = new EnterAnimalViewModel();
+    }
+}
diff --git a/GES_PAC/ViewModel/ChambersViewModel.cs b/GES_PAC/ViewModel/ChambersViewModel.cs
index 10dd23d..dc738d0 100644
--- a/GES_PAC/ViewModel/ChambersViewModel.cs
+++ b/GES_PAC/ViewModel/ChambersViewModel.cs
@@ -21,7 +21,11 @@ namespace GES_PAC.ViewModel
         #region Constructeurs
         public ChambersViewModel()
         {
-            OnClickChamberCommand = new Command<int>(async (id) => await GoToEnterAnimal(id));
+            OnClickChamberCommand = new Command<string>(async (idStr) =>
+            {
+                int id = int.Parse(idStr);
+                await GoToEnterAnimal(id);
+            });
 
         }
         #endregion
diff --git a/GES_PAC/ViewModel/CreateSetViewModel.cs b/GES_PAC/ViewModel/CreateSetViewModel.cs
index e57d5b7..50875ef 100644
--- a/GES_PAC/ViewModel/CreateSetViewModel.cs
+++ b/GES_PAC/ViewModel/CreateSetViewModel.cs
@@ -103,7 +103,7 @@ namespace GES_PAC.ViewModel
             var newSet = new Serie(date, DateTimeMAJ, Temperature ?? 0, Humidite ?? 0, Pression ?? 0);
             journeeActuelle.AddSerie(newSet);
 
-            await Shell.Current.GoToAsync(nameof(CreateCalibrationView));
+            await Shell.Current.GoToAsync(nameof(ChambersView));
             IsBusy = false;
         }
 
diff --git a/GES_PAC/ViewModel/EnterAnimalViewModel.cs b/GES_PAC/ViewModel/EnterAnimalViewModel.cs
index 494f618..e77c7e4 100644
--- a/GES_PAC/ViewModel/EnterAnimalViewModel.cs
+++ b/GES_PAC/ViewModel/EnterAnimalViewModel.cs
@@ -4,6 +4,7 @@ using System.Windows.Input;
 
 namespace GES_PAC.ViewModel
 {
+    [QueryProperty(nameof(ChamberId), "chamberId")]
     public class EnterAnimalViewModel : BaseViewModel
     {
 
@@ -29,6 +30,7 @@ namespace GES_PAC.ViewModel
             {
                 _chamberId = value;
                 OnPropertyChanged();
+                OnPropertyChanged(nameof(Titre));
             }
         }
 
@@ -66,6 +68,8 @@ namespace GES_PAC.ViewModel
 
         public bool NumRFIDError { get; private set; } = true;
         public bool PoidsError { get; private set; } = true;
+        public string Titre => $"Information animal chambre {ChamberId}";
+
         #endregion
 
         #region Constructeurs
@@ -76,22 +80,21 @@ namespace GES_PAC.ViewModel
         #endregion
 
         #region Méthodes
-
         private async Task EnterAnimal()
         {
             IsBusy = true;
             var date = DateTime.Now;
             var journeeActuelle = JourneeViewModel.Instance.GetCurrentDay();
-            var newSet = new SerieAnimal();
-            journeeActuelle.AddSerie(newSet); //getcurrentset a créer
+            var newAnimalSet = new SerieAnimal(ChamberId, Poids ?? 0, date, NumRFID);
+            journeeActuelle.GetCurrentSet().AddSerieAnimal(newAnimalSet);
 
-            await Shell.Current.GoToAsync(nameof(CreateCalibrationView));
+            await Shell.Current.GoToAsync(nameof(ChambersView));
             IsBusy = false;
         }
 
         private void ValidateForm()
         {
-            NumRFIDError = NumRFID == null;
+            NumRFIDError = NumRFID.Length < 5 ;
             PoidsError = Poids == null;
 
             OnPropertyChanged(nameof(NumRFIDError));
