commit fff89fc5feb879960cd7936814cccca978c2db89
Author: lbihannic <lucas.bihannic@inrae.fr>
Date:   Tue Mar 25 14:18:30 2025 +0100

    add first mesure after animal entry and green button when active animal in chamber

diff --git a/GES_PAC/AppShell.xaml.cs b/GES_PAC/AppShell.xaml.cs
index 2bd4fa6..874dd6c 100644
--- a/GES_PAC/AppShell.xaml.cs
+++ b/GES_PAC/AppShell.xaml.cs
@@ -19,7 +19,7 @@ namespace GES_PAC
             Routing.RegisterRoute(nameof(CreateSetView), typeof(CreateSetView));
             Routing.RegisterRoute(nameof(ChambersView), typeof(ChambersView));
             Routing.RegisterRoute(nameof(EnterAnimalView), typeof(EnterAnimalView));
+            Routing.RegisterRoute(nameof(CreateMeasureView), typeof(CreateMeasureView));
         }
     }
-
 }
diff --git a/GES_PAC/GES_PAC.csproj b/GES_PAC/GES_PAC.csproj
index 167b1bf..24b8b07 100644
--- a/GES_PAC/GES_PAC.csproj
+++ b/GES_PAC/GES_PAC.csproj
@@ -102,6 +102,9 @@
 	  <MauiXaml Update="View\CreateDayView.xaml">
 	    <Generator>MSBuild:Compile</Generator>
 	  </MauiXaml>
+	  <MauiXaml Update="View\CreateMeasureView.xaml">
+	    <Generator>MSBuild:Compile</Generator>
+	  </MauiXaml>
 	  <MauiXaml Update="View\CreatePersonView.xaml">
 	    <Generator>MSBuild:Compile</Generator>
 	  </MauiXaml>
diff --git a/GES_PAC/Model/Serie.cs b/GES_PAC/Model/Serie.cs
index bd27ebc..41af79b 100644
--- a/GES_PAC/Model/Serie.cs
+++ b/GES_PAC/Model/Serie.cs
@@ -30,6 +30,16 @@ namespace GES_PAC.Model
         {
             SeriesAnimales.Add(serieAnimal);
         }
+
+        public Dictionary<int, int> GetMeasureNumber()
+        {
+            return SeriesAnimales.ToDictionary(sa => sa.NumeroBoite, sa => sa.GetMeasureCount());
+        }
+
+        internal void AddMeasure(Mesure newMeasure, int numBoite)
+        {
+            SeriesAnimales.Select(sa => sa).Where(sa => sa.NumeroBoite == numBoite).First().AddMeasure(newMeasure);
+        }
         #endregion
     }
 }
diff --git a/GES_PAC/Model/SerieAnimal.cs b/GES_PAC/Model/SerieAnimal.cs
index 404a842..0bed6c4 100644
--- a/GES_PAC/Model/SerieAnimal.cs
+++ b/GES_PAC/Model/SerieAnimal.cs
@@ -20,5 +20,15 @@ namespace GES_PAC.Model
             Mesures = [];
             Comportements = [];
         }
+
+        public int GetMeasureCount()
+        {
+            return Mesures.Count();
+        }
+
+        internal void AddMeasure(Mesure newMeasure)
+        {
+            Mesures.Add(newMeasure);
+        }
     }
 }
diff --git a/GES_PAC/View/ChambersView.xaml b/GES_PAC/View/ChambersView.xaml
index b3c2111..e4ff252 100644
--- a/GES_PAC/View/ChambersView.xaml
+++ b/GES_PAC/View/ChambersView.xaml
@@ -47,20 +47,20 @@
                                 </Grid.RowDefinitions>
 
                                 <!-- Boutons Gauche -->
-                                <Button Grid.Row="5" Grid.Column="0" Text="1" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="1"/>
-                                <Button Grid.Row="4" Grid.Column="0" Text="3" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="3"/>
-                                <Button Grid.Row="3" Grid.Column="0" Text="5" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="5"/>
-                                <Button Grid.Row="2" Grid.Column="0" Text="7" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="7"/>
-                                <Button Grid.Row="1" Grid.Column="0" Text="9" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="9"/>
-                                <Button Grid.Row="0" Grid.Column="0" Text="11" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="11"/>
+                                <Button Grid.Row="5" Grid.Column="0" Text="1" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="1" BackgroundColor="{Binding ChamberColors[0]}"/>
+                                <Button Grid.Row="4" Grid.Column="0" Text="3" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="3" BackgroundColor="{Binding ChamberColors[2]}"/>
+                                <Button Grid.Row="3" Grid.Column="0" Text="5" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="5" BackgroundColor="{Binding ChamberColors[4]}"/>
+                                <Button Grid.Row="2" Grid.Column="0" Text="7" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="7" BackgroundColor="{Binding ChamberColors[6]}"/>
+                                <Button Grid.Row="1" Grid.Column="0" Text="9" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="9" BackgroundColor="{Binding ChamberColors[8]}"/>
+                                <Button Grid.Row="0" Grid.Column="0" Text="11" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="11" BackgroundColor="{Binding ChamberColors[10]}"/>
 
                                 <!-- Boutons Droite -->
-                                <Button Grid.Row="5" Grid.Column="2" Text="2" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="2"/>
-                                <Button Grid.Row="4" Grid.Column="2" Text="4" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="4"/>
-                                <Button Grid.Row="3" Grid.Column="2" Text="6" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="6"/>
-                                <Button Grid.Row="2" Grid.Column="2" Text="8" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="8"/>
-                                <Button Grid.Row="1" Grid.Column="2" Text="10" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="10"/>
-                                <Button Grid.Row="0" Grid.Column="2" Text="12" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="12"/>
+                                <Button Grid.Row="5" Grid.Column="2" Text="2" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="2" BackgroundColor="{Binding ChamberColors[1]}"/>
+                                <Button Grid.Row="4" Grid.Column="2" Text="4" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="4" BackgroundColor="{Binding ChamberColors[3]}"/>
+                                <Button Grid.Row="3" Grid.Column="2" Text="6" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="6" BackgroundColor="{Binding ChamberColors[5]}"/>
+                                <Button Grid.Row="2" Grid.Column="2" Text="8" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="8" BackgroundColor="{Binding ChamberColors[7]}"/>
+                                <Button Grid.Row="1" Grid.Column="2" Text="10" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="10" BackgroundColor="{Binding ChamberColors[9]}"/>
+                                <Button Grid.Row="0" Grid.Column="2" Text="12" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="12" BackgroundColor="{Binding ChamberColors[11]}"/>
 
                                 <!-- Couloir central -->
                                 <BoxView Grid.Column="1" Grid.RowSpan="6" HeightRequest="500" WidthRequest="75" Color="Gray"/>
diff --git a/GES_PAC/View/CreateMeasureView.xaml b/GES_PAC/View/CreateMeasureView.xaml
new file mode 100644
index 0000000..b3e4155
--- /dev/null
+++ b/GES_PAC/View/CreateMeasureView.xaml
@@ -0,0 +1,102 @@
+<?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.CreateMeasureView"
+             x:DataType="vm:CreateMeasureViewModel">
+
+    <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">
+
+                        <!-- CH4 -->
+                        <VerticalStackLayout>
+                            <Label Text="CH4 (ppm)" FontSize="14" TextColor="Gray" FontAttributes="Bold"/>
+                            <Entry Text="{Binding ConcCH4, Mode=TwoWay, TargetNullValue=''}" 
+                                   FontSize="16" 
+                                   TextColor="Black" 
+                                   Placeholder="0,0" 
+                                   Keyboard="Numeric"/>
+                            <Label Text="Entrez une valeur"
+                                FontSize="12"
+                                TextColor="Red"
+                                IsVisible="{Binding ConcCH4Error}"/>
+                        </VerticalStackLayout>
+
+                        <!-- O2 -->
+                        <VerticalStackLayout>
+                            <Label Text="O2 (% vol.)" FontSize="14" TextColor="Gray" FontAttributes="Bold"/>
+                            <Entry Text="{Binding ConcO2 , Mode=TwoWay, TargetNullValue=''}" 
+                                   FontSize="16" 
+                                   TextColor="Black" 
+                                   Placeholder="0,0" 
+                                   Keyboard="Numeric"/>
+                            <Label Text="Entrez une valeur"
+                                FontSize="12"
+                                TextColor="Red"
+                                IsVisible="{Binding ConcO2Error}"/>
+                        </VerticalStackLayout>
+
+                        <!-- CO2 -->
+                        <VerticalStackLayout>
+                            <Label Text="CO2 (% vol.)" FontSize="14" TextColor="Gray" FontAttributes="Bold"/>
+                            <Entry Text="{Binding ConcCO2, Mode=TwoWay, TargetNullValue=''}" 
+                                   FontSize="16" 
+                                   TextColor="Black" 
+                                   Placeholder="0,0" 
+                                   Keyboard="Numeric"/>
+                            <Label Text="Entrez une valeur"
+                                FontSize="12"
+                                TextColor="Red"
+                                IsVisible="{Binding ConcCO2Error}"/>
+                        </VerticalStackLayout>
+                    </VerticalStackLayout>
+                </VerticalStackLayout>
+            </ScrollView>
+            <StackLayout
+                Margin="10"
+                HorizontalOptions="CenterAndExpand"
+                Orientation="Horizontal"
+                VerticalOptions="FillAndExpand">
+
+                <Button 
+                    Text="Enregistrer les mesures"
+                    Command="{Binding CreateMeasureCommand}"
+                    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/CreateMeasureView.xaml.cs b/GES_PAC/View/CreateMeasureView.xaml.cs
new file mode 100644
index 0000000..91d7bc5
--- /dev/null
+++ b/GES_PAC/View/CreateMeasureView.xaml.cs
@@ -0,0 +1,13 @@
+using GES_PAC.ViewModel;
+
+namespace GES_PAC.View
+{
+    public partial class CreateMeasureView
+    {
+        public CreateMeasureView()
+        {
+            InitializeComponent();
+            BindingContext = new CreateMeasureViewModel();
+        }
+    }
+}
diff --git a/GES_PAC/View/EnterAnimalView.xaml b/GES_PAC/View/EnterAnimalView.xaml
index a7ef462..3448067 100644
--- a/GES_PAC/View/EnterAnimalView.xaml
+++ b/GES_PAC/View/EnterAnimalView.xaml
@@ -23,7 +23,7 @@
                         <VerticalStackLayout>
 
                             <Label Text="Numéro RFID" FontSize="14" TextColor="Gray" FontAttributes="Bold"/>
-                            <Entry Text="{Binding NumRFID}" FontSize="16" TextColor="Black" Placeholder="25"/>
+                            <Entry Text="{Binding NumRFID}" FontSize="16" TextColor="Black" Placeholder="04 9C 64 D2 45 2B 80"/>
                             <Label Text="Min. 5 caractères"
                                 FontSize="12"
                                 TextColor="Red"
@@ -34,7 +34,7 @@
                         <!-- Poids -->
                         <VerticalStackLayout>
                             <Label Text="Poids (kg)" FontSize="14" TextColor="Gray" FontAttributes="Bold"/>
-                            <Entry Text="{Binding Poids}" FontSize="16" TextColor="Black" Placeholder="25" Keyboard="Numeric"/>
+                            <Entry Text="{Binding Poids}" FontSize="16" TextColor="Black" Placeholder="75" Keyboard="Numeric"/>
                             <Label Text="Entrez une valeur"
                                 FontSize="12"
                                 TextColor="Red"
diff --git a/GES_PAC/ViewModel/ChambersViewModel.cs b/GES_PAC/ViewModel/ChambersViewModel.cs
index dc738d0..07455e0 100644
--- a/GES_PAC/ViewModel/ChambersViewModel.cs
+++ b/GES_PAC/ViewModel/ChambersViewModel.cs
@@ -1,5 +1,6 @@
 using GES_PAC.Model;
 using GES_PAC.View;
+using System.Collections.ObjectModel;
 using System.Windows.Input;
 
 namespace GES_PAC.ViewModel
@@ -8,6 +9,7 @@ namespace GES_PAC.ViewModel
     {
 
         #region Attributs
+        
         #endregion
 
         #region Commandes
@@ -16,17 +18,23 @@ namespace GES_PAC.ViewModel
 
         #region Propriétés
 
+        public Dictionary<int, int> NumberMeasure { get; set; }
+
+        public ObservableCollection<Color> ChamberColors { get; } = [];
+
         #endregion
 
         #region Constructeurs
         public ChambersViewModel()
         {
+            NumberMeasure = JourneeViewModel.Instance.GetCurrentDay().GetCurrentSet().GetMeasureNumber();
+            UpdateChamberColors();
+
             OnClickChamberCommand = new Command<string>(async (idStr) =>
             {
                 int id = int.Parse(idStr);
                 await GoToEnterAnimal(id);
             });
-
         }
         #endregion
 
@@ -37,6 +45,16 @@ namespace GES_PAC.ViewModel
             await Shell.Current.GoToAsync($"{nameof(EnterAnimalView)}?chamberId={id}");
             IsBusy = false;
         }
+
+        private void UpdateChamberColors()
+        {
+            ChamberColors.Clear();
+            for (int i = 1; i <= 12; i++)
+            {
+                int count = NumberMeasure.TryGetValue(i, out var val) ? val : 0;
+                ChamberColors.Add(count > 0 ? Colors.LightGreen : Colors.White);
+            }
+        }
         #endregion
     }
 }
diff --git a/GES_PAC/ViewModel/CreateMeasureViewModel.cs b/GES_PAC/ViewModel/CreateMeasureViewModel.cs
new file mode 100644
index 0000000..e4dd894
--- /dev/null
+++ b/GES_PAC/ViewModel/CreateMeasureViewModel.cs
@@ -0,0 +1,124 @@
+using GES_PAC.Model;
+using GES_PAC.View;
+using System.Collections.ObjectModel;
+using System.Windows.Input;
+
+namespace GES_PAC.ViewModel
+{
+    [QueryProperty(nameof(ChamberId), "chamberId")]
+    public class CreateMeasureViewModel : BaseViewModel
+    {
+
+        #region Attributs
+        private int _chamberId;
+        private double? _conc_o2;
+        private double? _conc_co2;
+        private double? _conc_ch4;
+        private bool _isFormValid;
+        #endregion
+
+        #region Commandes
+        public ICommand CreateMeasureCommand { get; }
+        #endregion
+
+        #region Propriétés
+        public int ChamberId
+        {
+            get => _chamberId;
+            set
+            {
+                _chamberId = value;
+                OnPropertyChanged();
+                OnPropertyChanged(nameof(Titre));
+            }
+        }
+
+        public double? ConcO2
+        {
+            get => _conc_o2;
+            set
+            {
+                _conc_o2 = value;
+                OnPropertyChanged();
+                ValidateForm();
+            }
+        }
+
+        public double? ConcCO2
+        {
+            get => _conc_co2;
+            set
+            {
+                _conc_co2 = value;
+                OnPropertyChanged();
+                ValidateForm();
+            }
+        }
+
+        public double? ConcCH4
+        {
+            get => _conc_ch4;
+            set
+            {
+                _conc_ch4 = value;
+                OnPropertyChanged();
+                ValidateForm();
+            }
+        }
+
+        public bool IsFormValid
+        {
+            get => _isFormValid;
+            set
+            {
+                _isFormValid = value;
+                OnPropertyChanged();
+            }
+        }
+
+        public bool ConcO2Error { get; private set; } = true;
+        public bool ConcCO2Error { get; private set; } = true;
+        public bool ConcCH4Error { get; private set; } = true;
+        public string Titre => $"Mesures chambre {ChamberId}";
+        #endregion
+
+        #region Constructeurs
+        public CreateMeasureViewModel()
+        {
+            CreateMeasureCommand = new Command(async () => await CreateMeasure());
+        }
+        #endregion
+
+        #region Méthodes
+        private async Task CreateMeasure()
+        {
+            IsBusy = true;
+
+            var date = DateTime.Now;
+            var newMeasure = new Mesure(date, ConcO2 ?? 0, ConcCO2 ?? 0, ConcCH4 ?? 0);
+            var phaseCalibration = JourneeViewModel.Instance.GetCurrentPhase();
+
+            JourneeViewModel.Instance.AddMeasureToCurrentSet(newMeasure, ChamberId);
+
+            await Shell.Current.GoToAsync(nameof(ChambersView));
+
+            IsBusy = false;
+        }
+
+        private void ValidateForm()
+        {
+            ConcO2Error = ConcO2 == null;
+            ConcCO2Error = ConcCO2 == null;
+            ConcCH4Error = ConcCH4 == null;
+
+            OnPropertyChanged(nameof(ConcO2Error));
+            OnPropertyChanged(nameof(ConcCO2Error));
+            OnPropertyChanged(nameof(ConcCH4Error));
+
+            IsFormValid = !ConcO2Error && !ConcCO2Error && !ConcCH4Error;
+
+            (CreateMeasureCommand as Command)?.ChangeCanExecute();
+        }
+        #endregion
+    }
+}
diff --git a/GES_PAC/ViewModel/EnterAnimalViewModel.cs b/GES_PAC/ViewModel/EnterAnimalViewModel.cs
index e77c7e4..febb2d0 100644
--- a/GES_PAC/ViewModel/EnterAnimalViewModel.cs
+++ b/GES_PAC/ViewModel/EnterAnimalViewModel.cs
@@ -68,7 +68,7 @@ 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}";
+        public string Titre => $"Informations animal chambre {ChamberId}";
 
         #endregion
 
@@ -88,7 +88,7 @@ namespace GES_PAC.ViewModel
             var newAnimalSet = new SerieAnimal(ChamberId, Poids ?? 0, date, NumRFID);
             journeeActuelle.GetCurrentSet().AddSerieAnimal(newAnimalSet);
 
-            await Shell.Current.GoToAsync(nameof(ChambersView));
+            await Shell.Current.GoToAsync($"{nameof(CreateMeasureView)}?chamberId={ChamberId}");
             IsBusy = false;
         }
 
diff --git a/GES_PAC/ViewModel/JourneeViewModel.cs b/GES_PAC/ViewModel/JourneeViewModel.cs
index 4df9dfd..b82dc00 100644
--- a/GES_PAC/ViewModel/JourneeViewModel.cs
+++ b/GES_PAC/ViewModel/JourneeViewModel.cs
@@ -34,6 +34,11 @@ namespace GES_PAC.ViewModel
             var journeeActuelle = GetCurrentDay();
             return journeeActuelle.GetCurrentPhase();
         }
+
+        public void AddMeasureToCurrentSet(Mesure newMeasure, int numBoite)
+        {
+            GetCurrentDay().GetCurrentSet().AddMeasure(newMeasure, numBoite);
+        }
         #endregion
     }
 }
