New page gestion départ

This commit is contained in:
leroyv 2025-03-27 15:23:27 +01:00
parent 3a149b8b5e
commit a6f04a142a
4 changed files with 133 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,81 @@
<?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="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>
<Label Text="{Binding Id}"
VerticalOptions="Center"
WidthRequest="50"/>
<Label Text="{Binding NbPersonnes}"
VerticalOptions="Center"
WidthRequest="50"/>
<Label Text="{Binding DateDebut, StringFormat='{0:dd/MM/yyyy}'}"
VerticalOptions="Center"
WidthRequest="100"/>
<Label Text="{Binding DateFin, StringFormat='{0:dd/MM/yyyy}'}"
VerticalOptions="Center"
WidthRequest="100"/>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
<StackLayout>
<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>
<Label Text="{Binding Id}"
VerticalOptions="Center"
WidthRequest="50"/>
<Label Text="{Binding NbPersonnes}"
VerticalOptions="Center"
WidthRequest="50"/>
<Label Text="{Binding DateDebut, StringFormat='{0:dd/MM/yyyy}'}"
VerticalOptions="Center"
WidthRequest="100"/>
<Label Text="{Binding DateFin, StringFormat='{0:dd/MM/yyyy}'}"
VerticalOptions="Center"
WidthRequest="100"/>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</StackLayout>
</ContentPage.Content>
</ContentPage>

View File

@ -0,0 +1,43 @@
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> Reservations { 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();
Reservations.Clear();
foreach (var reservation in reservationList)
{
Reservations.Add(reservation);
}
GestionDepartListView.ItemsSource = Reservations;
GestionArriveListView.ItemsSource = Reservations;
}
private void GestionPage_OnAppearing(object? sender, EventArgs e)
{
LoadReservations();
}
}