Compare commits

...

4 Commits

Author SHA1 Message Date
e3f8514824 affichage centré depart arrivée 2025-04-08 11:45:28 +02:00
7af121748b force pour le design 2025-03-27 15:46:26 +01:00
c53896f8bd Gestion depart arrivées qui fonctionne 2025-03-27 15:39:42 +01:00
a6f04a142a New page gestion départ 2025-03-27 15:23:27 +01:00
4 changed files with 201 additions and 0 deletions

View File

@ -21,5 +21,8 @@
<Button Text="Gérer les Réservations"
Clicked="OnReservationsClicked"
Margin="0,10"/>
<Button Text="Gérer les départs et arrivées"
Clicked="OnGestionDepartClicked"
Margin="0,10"/>
</StackLayout>
</ContentPage>

View File

@ -2,6 +2,7 @@ using HegreHotel.Views;
using HegreHotel.Views.Chambre;
using HegreHotel.Views.Client;
using HegreHotel.Views.Reservation;
using HegreHotel.Views.GestionDepart;
using Microsoft.Maui.Controls;
namespace HegreHotel
@ -27,5 +28,10 @@ namespace HegreHotel
{
await Navigation.PushAsync(new ReservationsPage());
}
private async void OnGestionDepartClicked(object sender, EventArgs e)
{
await Navigation.PushAsync(new GestionDepartPage());
}
}
}

View File

@ -0,0 +1,136 @@
<?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"
x:Class="HegreHotel.Views.GestionDepart.GestionDepartPage"
Title="Gestion des départs et arrivées"
Appearing="GestionPage_OnAppearing">
<ContentPage.Content>
<StackLayout>
<StackLayout>
<StackLayout Padding="20" Orientation="Vertical">
<StackLayout Padding="20" Orientation="Horizontal">
<BoxView HeightRequest="5" Color="MediumPurple"/>
<Label Text="Arrivée(s)"
FontSize="24"
FontAttributes="Bold"
HorizontalOptions="Center"/>
</StackLayout>
<ListView x:Name="GestionArriveListView" HasUnevenRows="True">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Orientation="Vertical" Padding="5" HorizontalOptions="FillAndExpand">
<!-- Première ligne : ID chambre et Nombre de personnes -->
<StackLayout Orientation="Horizontal" Padding="5" HorizontalOptions="FillAndExpand">
<Label Text="ID chambre :"
VerticalOptions="Center"
WidthRequest="120"/>
<Label Text="{Binding ChambreId}"
VerticalOptions="Center"
WidthRequest="50"/>
<Label Text="Nombres de personnes :"
VerticalOptions="Center"
WidthRequest="160"/>
<Label Text="{Binding NbPersonnes}"
VerticalOptions="Center"
WidthRequest="50"/>
</StackLayout>
<!-- Deuxième ligne : Date d'arrivée -->
<StackLayout Orientation="Horizontal" Padding="5" HorizontalOptions="FillAndExpand">
<Label Text="Date d'arrivée :"
VerticalOptions="Center"
WidthRequest="150"/>
<Label Text="{Binding DateDebut, StringFormat='{0:dd/MM/yyyy}'}"
VerticalOptions="Center"
WidthRequest="100"/>
</StackLayout>
<!-- Troisième ligne : Date de départ -->
<StackLayout Orientation="Horizontal" Padding="5" HorizontalOptions="FillAndExpand">
<Label Text="Date de départ :"
VerticalOptions="Center"
WidthRequest="150"/>
<Label Text="Aujourd'hui"
VerticalOptions="Center"
WidthRequest="100"/>
</StackLayout>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</StackLayout>
<StackLayout Padding="20" Orientation="Vertical">
<StackLayout Padding="20" Orientation="Horizontal">
<BoxView HeightRequest="5" Color="MediumPurple"/>
<Label Text="Départ(s)"
FontSize="24"
FontAttributes="Bold"
HorizontalOptions="Center" />
</StackLayout>
<ListView x:Name="GestionDepartListView" HasUnevenRows="True">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<!-- StackLayout principal avec orientation verticale -->
<StackLayout Orientation="Vertical" Padding="5" HorizontalOptions="FillAndExpand">
<!-- Première ligne : ID chambre et Nombre de personnes -->
<StackLayout Orientation="Horizontal" Padding="5" HorizontalOptions="FillAndExpand">
<Label Text="ID chambre :"
VerticalOptions="Center"
WidthRequest="120"/>
<Label Text="{Binding ChambreId}"
VerticalOptions="Center"
WidthRequest="50"/>
<Label Text="Nombres de personnes :"
VerticalOptions="Center"
WidthRequest="160"/>
<Label Text="{Binding NbPersonnes}"
VerticalOptions="Center"
WidthRequest="50"/>
</StackLayout>
<!-- Deuxième ligne : Date d'arrivée -->
<StackLayout Orientation="Horizontal" Padding="5" HorizontalOptions="FillAndExpand">
<Label Text="Date d'arrivée :"
VerticalOptions="Center"
WidthRequest="150"/>
<Label Text="{Binding DateDebut, StringFormat='{0:dd/MM/yyyy}'}"
VerticalOptions="Center"
WidthRequest="100"/>
</StackLayout>
<!-- Troisième ligne : Date de départ -->
<StackLayout Orientation="Horizontal" Padding="5" HorizontalOptions="FillAndExpand">
<Label Text="Date de départ :"
VerticalOptions="Center"
WidthRequest="150"/>
<Label Text="Aujourd'hui"
VerticalOptions="Center"
WidthRequest="100"/>
</StackLayout>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</StackLayout>
</ContentPage.Content>
</ContentPage>

View File

@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using HegreHotel.Models;
using Microsoft.Maui.Controls;
using System.Collections.ObjectModel;
using System.IO;
using Microsoft.Maui.Storage;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HegreHotel.Views.GestionDepart;
public partial class GestionDepartPage : ContentPage
{
public ObservableCollection<Models.Reservation> ReservationsDeb { get; set; } = new ObservableCollection<Models.Reservation>();
public ObservableCollection<Models.Reservation> ReservationsFin { get; set; } = new ObservableCollection<Models.Reservation>();
public GestionDepartPage()
{
InitializeComponent();
LoadReservations();
}
private async void LoadReservations()
{
string dbPath = Path.Combine(FileSystem.AppDataDirectory, "HegreHotel.db3");
var db = SingletonConnection.GetInstance(dbPath);
var reservationList = await db.Table<Models.Reservation>().ToListAsync();
ReservationsDeb.Clear();
ReservationsFin.Clear();
foreach (var reservation in reservationList)
{
if (reservation.DateDebut == DateTime.Now.Date)
{
ReservationsDeb.Add(reservation);
} else if (reservation.DateFin == DateTime.Now.Date)
{
ReservationsFin.Add(reservation);
}
}
GestionArriveListView.ItemsSource = ReservationsDeb;
GestionDepartListView.ItemsSource = ReservationsFin;
}
private void GestionPage_OnAppearing(object? sender, EventArgs e)
{
LoadReservations();
}
}