Compare commits
12 Commits
master
...
feature/Ro
Author | SHA1 | Date | |
---|---|---|---|
7f05f4f634 | |||
460b12f066 | |||
53ebad6fe5 | |||
![]() |
1d09ec3979 | ||
7af121748b | |||
c53896f8bd | |||
a6f04a142a | |||
1920b8a164 | |||
dde7dd9f73 | |||
![]() |
8cd917cbba | ||
![]() |
05a1982c2a | ||
![]() |
9eb0330f33 |
@ -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>
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
@ -17,4 +17,7 @@ public class Chambre
|
||||
public int NbPersonne { get; set; }
|
||||
|
||||
public int StatusId { get; set; }
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
public Status Status { get; set; }
|
||||
}
|
BIN
Resources/Images/delete_icon.png
Normal file
BIN
Resources/Images/delete_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
BIN
Resources/Images/edit_icon.png
Normal file
BIN
Resources/Images/edit_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.9 KiB |
@ -6,7 +6,7 @@ namespace HegreHotel
|
||||
{
|
||||
public class SingletonConnection : SQLiteAsyncConnection
|
||||
{
|
||||
private static SingletonConnection instance;
|
||||
private static SingletonConnection? _instance;
|
||||
|
||||
private SingletonConnection(string dbPath) : base(dbPath)
|
||||
{
|
||||
@ -14,11 +14,11 @@ namespace HegreHotel
|
||||
|
||||
public static SingletonConnection GetInstance(string dbPath)
|
||||
{
|
||||
if (instance == null)
|
||||
if (_instance == null)
|
||||
{
|
||||
instance = new SingletonConnection(dbPath);
|
||||
_instance = new SingletonConnection(dbPath);
|
||||
}
|
||||
return instance;
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +1,10 @@
|
||||
<?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.Chambre.ChambresPage"
|
||||
Title="Gestion des Chambres"
|
||||
Appearing="ChambresPage_OnAppearing">
|
||||
<StackLayout Padding="10">
|
||||
|
||||
<Picker x:Name="PickerFiltreStatus" Title="Filtrer par statut" SelectedIndexChanged="OnFiltreChanged"/>
|
||||
|
||||
<Button Text="Ajouter Chambre"
|
||||
@ -18,26 +16,34 @@
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ViewCell>
|
||||
<StackLayout Orientation="Horizontal" Padding="5">
|
||||
<StackLayout Orientation="Horizontal" Padding="5" Spacing="10">
|
||||
<!-- Nom de la chambre -->
|
||||
<Label Text="{Binding Nom}"
|
||||
FontAttributes="Bold"
|
||||
WidthRequest="100"/>
|
||||
<Label Text="{Binding Description}"
|
||||
WidthRequest="150"/>
|
||||
<Label Text="{Binding Status.Libelle}"
|
||||
TextColor="Gray"/>
|
||||
VerticalOptions="Center"
|
||||
WidthRequest="120"/> <!-- Ajusté pour laisser de la place -->
|
||||
|
||||
<Button Text="Modifier"
|
||||
CommandParameter="{Binding .}"
|
||||
Clicked="OnModifierChambreClicked"
|
||||
HorizontalOptions="EndAndExpand"
|
||||
Margin="5,0"/>
|
||||
<!-- Statut de la chambre -->
|
||||
<Label Text="{Binding Status.Libelle}"
|
||||
FontAttributes="Italic"
|
||||
VerticalOptions="Center"
|
||||
WidthRequest="100"/>
|
||||
|
||||
<Button Text="Supprimer"
|
||||
CommandParameter="{Binding .}"
|
||||
Clicked="OnSupprimerChambreClicked"
|
||||
HorizontalOptions="End"
|
||||
Margin="5,0"/>
|
||||
<!-- Icônes Modifier / Supprimer -->
|
||||
<StackLayout Orientation="Horizontal" HorizontalOptions="EndAndExpand" Spacing="5">
|
||||
<ImageButton Source="edit_icon.png"
|
||||
Clicked="OnModifierChambreClicked"
|
||||
CommandParameter="{Binding .}"
|
||||
HeightRequest="30"
|
||||
WidthRequest="30"
|
||||
BackgroundColor="Transparent"/>
|
||||
<ImageButton Source="delete_icon.png"
|
||||
Clicked="OnSupprimerChambreClicked"
|
||||
CommandParameter="{Binding .}"
|
||||
HeightRequest="30"
|
||||
WidthRequest="30"
|
||||
BackgroundColor="Transparent"/>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</ViewCell>
|
||||
</DataTemplate>
|
||||
|
@ -4,6 +4,7 @@ using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Microsoft.Maui.Storage;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace HegreHotel.Views.Chambre
|
||||
{
|
||||
@ -24,12 +25,47 @@ namespace HegreHotel.Views.Chambre
|
||||
var db = SingletonConnection.GetInstance(dbPath);
|
||||
|
||||
_statuts = await db.Table<Status>().ToListAsync();
|
||||
|
||||
var statutsAvecTous = new List<string> { "Tous" };
|
||||
statutsAvecTous.AddRange(_statuts.Select(s => s.Libelle));
|
||||
|
||||
PickerFiltreStatus.ItemsSource = statutsAvecTous;
|
||||
|
||||
var chambresList = await db.Table<Models.Chambre>().ToListAsync();
|
||||
var reservationsList = await db.Table<Models.Reservation>().ToListAsync();
|
||||
|
||||
DateTime today = DateTime.Today;
|
||||
|
||||
foreach (var chambre in chambresList)
|
||||
{
|
||||
var chambreReservee = reservationsList
|
||||
.Where(r => r.ChambreId == chambre.Id && r.DateDebut <= today && r.DateFin >= today)
|
||||
.OrderByDescending(r => r.DateFin)
|
||||
.FirstOrDefault();
|
||||
|
||||
if (chambreReservee != null)
|
||||
{
|
||||
chambre.StatusId = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
var chambreFinieRecemment = reservationsList
|
||||
.Where(r => r.ChambreId == chambre.Id && r.DateFin >= today.AddDays(-2) && r.DateFin < today)
|
||||
.OrderByDescending(r => r.DateFin)
|
||||
.FirstOrDefault();
|
||||
|
||||
if (chambreFinieRecemment != null)
|
||||
{
|
||||
chambre.StatusId = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
chambre.StatusId = 1;
|
||||
}
|
||||
}
|
||||
chambre.Status = _statuts.FirstOrDefault(s => s.Id == chambre.StatusId);
|
||||
await db.UpdateAsync(chambre);
|
||||
}
|
||||
|
||||
_toutesLesChambres.Clear();
|
||||
foreach (var chambre in chambresList)
|
||||
{
|
||||
@ -38,7 +74,7 @@ namespace HegreHotel.Views.Chambre
|
||||
|
||||
FiltrerChambres();
|
||||
}
|
||||
|
||||
|
||||
private void OnFiltreChanged(object sender, EventArgs e)
|
||||
{
|
||||
FiltrerChambres();
|
||||
@ -52,8 +88,17 @@ namespace HegreHotel.Views.Chambre
|
||||
}
|
||||
else
|
||||
{
|
||||
var statutSelectionne = _statuts[PickerFiltreStatus.SelectedIndex - 1].Id;
|
||||
ChambresListView.ItemsSource = _toutesLesChambres.Where(c => c.StatusId == statutSelectionne).ToList();
|
||||
string statutSelectionne = PickerFiltreStatus.SelectedItem.ToString();
|
||||
var statut = _statuts.FirstOrDefault(s => s.Libelle == statutSelectionne);
|
||||
|
||||
if (statut != null)
|
||||
{
|
||||
ChambresListView.ItemsSource = _toutesLesChambres.Where(c => c.StatusId == statut.Id).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"⚠ Filtrage impossible : statut '{statutSelectionne}' introuvable.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,8 +109,7 @@ namespace HegreHotel.Views.Chambre
|
||||
|
||||
private async void OnModifierChambreClicked(object sender, EventArgs e)
|
||||
{
|
||||
var chambre = ((Button)sender).CommandParameter as Models.Chambre;
|
||||
if (chambre != null)
|
||||
if (sender is ImageButton imageButton && imageButton.CommandParameter is Models.Chambre chambre)
|
||||
{
|
||||
await Navigation.PushAsync(new ModifierChambrePage(chambre));
|
||||
}
|
||||
@ -73,8 +117,7 @@ namespace HegreHotel.Views.Chambre
|
||||
|
||||
private async void OnSupprimerChambreClicked(object sender, EventArgs e)
|
||||
{
|
||||
var chambre = ((Button)sender).CommandParameter as Models.Chambre;
|
||||
if (chambre != null)
|
||||
if (sender is ImageButton imageButton && imageButton.CommandParameter is Models.Chambre chambre)
|
||||
{
|
||||
bool confirmation = await DisplayAlert("Suppression", "Voulez-vous vraiment supprimer cette chambre ?", "Oui", "Non");
|
||||
if (confirmation)
|
||||
|
@ -4,11 +4,44 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="HegreHotel.Views.Chambre.ModifierChambrePage"
|
||||
Title="Modifier la Chambre">
|
||||
<StackLayout Padding="10">
|
||||
<Entry x:Name="EntryNom" Placeholder="Nom de la chambre"/>
|
||||
<Entry x:Name="EntryDescription" Placeholder="Description"/>
|
||||
<Entry x:Name="EntryTarif" Placeholder="Tarif" Keyboard="Numeric"/>
|
||||
<Entry x:Name="EntryNbPersonne" Placeholder="Nombre de personnes" Keyboard="Numeric"/>
|
||||
<Button Text="Enregistrer les modifications" Clicked="OnEnregistrerClicked" Margin="0,20"/>
|
||||
</StackLayout>
|
||||
|
||||
<ScrollView>
|
||||
<VerticalStackLayout Padding="20" Spacing="15">
|
||||
|
||||
<!-- Champ Nom -->
|
||||
<Frame Padding="10" CornerRadius="10" BackgroundColor="White" BorderColor="#E5E7EB">
|
||||
<Entry x:Name="EntryNom" Placeholder="Nom de la chambre"/>
|
||||
</Frame>
|
||||
|
||||
<!-- Champ Description -->
|
||||
<Frame Padding="10" CornerRadius="10" BackgroundColor="White" BorderColor="#E5E7EB">
|
||||
<Editor x:Name="EntryDescription" Placeholder="Description" AutoSize="TextChanges"/>
|
||||
</Frame>
|
||||
|
||||
<!-- Champ Tarif -->
|
||||
<Frame Padding="10" CornerRadius="10" BackgroundColor="White" BorderColor="#E5E7EB">
|
||||
<Entry x:Name="EntryTarif" Placeholder="Tarif (€)" Keyboard="Numeric"/>
|
||||
</Frame>
|
||||
|
||||
<!-- Champ Nombre de personnes -->
|
||||
<Frame Padding="10" CornerRadius="10" BackgroundColor="White" BorderColor="#E5E7EB">
|
||||
<Entry x:Name="EntryNbPersonne" Placeholder="Nombre de personnes" Keyboard="Numeric"/>
|
||||
</Frame>
|
||||
|
||||
<Label Text="Modifier le Statut" Margin="10,0,0,0"/>
|
||||
<Picker x:Name="PickerStatut" Title=""/>
|
||||
|
||||
<!-- Bouton Enregistrer -->
|
||||
<Button Text="Enregistrer les modifications"
|
||||
Clicked="OnEnregistrerClicked"
|
||||
BackgroundColor="#007AFF"
|
||||
TextColor="White"
|
||||
CornerRadius="10"
|
||||
Padding="12"
|
||||
FontAttributes="Bold"
|
||||
HorizontalOptions="Center"/>
|
||||
|
||||
</VerticalStackLayout>
|
||||
</ScrollView>
|
||||
|
||||
</ContentPage>
|
||||
|
@ -8,6 +8,8 @@ namespace HegreHotel.Views.Chambre
|
||||
public partial class ModifierChambrePage : ContentPage
|
||||
{
|
||||
Models.Chambre _chambre;
|
||||
private List<Status> _statuts;
|
||||
|
||||
public ModifierChambrePage(Models.Chambre chambre)
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -17,17 +19,40 @@ namespace HegreHotel.Views.Chambre
|
||||
EntryDescription.Text = _chambre.Description;
|
||||
EntryTarif.Text = _chambre.Tarif.ToString();
|
||||
EntryNbPersonne.Text = _chambre.NbPersonne.ToString();
|
||||
|
||||
LoadStatuts();
|
||||
}
|
||||
|
||||
private async void LoadStatuts()
|
||||
{
|
||||
string dbPath = Path.Combine(FileSystem.AppDataDirectory, "HegreHotel.db3");
|
||||
var db = SingletonConnection.GetInstance(dbPath);
|
||||
|
||||
_statuts = await db.Table<Status>().ToListAsync();
|
||||
|
||||
PickerStatut.ItemsSource = _statuts.Select(s => s.Libelle).ToList();
|
||||
PickerStatut.SelectedIndex = _statuts.FindIndex(s => s.Id == _chambre.StatusId);
|
||||
}
|
||||
|
||||
private async void OnEnregistrerClicked(object sender, EventArgs e)
|
||||
{
|
||||
if (PickerStatut.SelectedIndex == -1)
|
||||
{
|
||||
await DisplayAlert("Erreur", "Veuillez sélectionner un statut", "OK");
|
||||
return;
|
||||
}
|
||||
|
||||
_chambre.Nom = EntryNom.Text;
|
||||
_chambre.Description = EntryDescription.Text;
|
||||
_chambre.Tarif = decimal.TryParse(EntryTarif.Text, out decimal tarif) ? tarif : _chambre.Tarif;
|
||||
_chambre.NbPersonne = int.TryParse(EntryNbPersonne.Text, out int nb) ? nb : _chambre.NbPersonne;
|
||||
|
||||
_chambre.StatusId = _statuts[PickerStatut.SelectedIndex].Id;
|
||||
|
||||
string dbPath = Path.Combine(FileSystem.AppDataDirectory, "HegreHotel.db3");
|
||||
var db = SingletonConnection.GetInstance(dbPath);
|
||||
|
||||
Console.WriteLine(_chambre.StatusId);
|
||||
await db.UpdateAsync(_chambre);
|
||||
await Navigation.PopAsync();
|
||||
}
|
||||
|
@ -1,46 +1,61 @@
|
||||
<?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.Client.ClientsPage"
|
||||
Title="Gestion des Clients"
|
||||
Appearing="ClientsPage_OnAppearing">
|
||||
<StackLayout Padding="10">
|
||||
|
||||
<StackLayout Padding="15" Spacing="10">
|
||||
|
||||
<!-- Bouton Ajouter Client -->
|
||||
<Button Text="Ajouter Client"
|
||||
Clicked="OnAjouterClientClicked"
|
||||
HorizontalOptions="Center"
|
||||
Margin="0,10"/>
|
||||
|
||||
HorizontalOptions="Center"
|
||||
BackgroundColor="#007AFF"
|
||||
TextColor="White"
|
||||
CornerRadius="10"
|
||||
Padding="10"
|
||||
FontAttributes="Bold"
|
||||
WidthRequest="200"/>
|
||||
|
||||
<!-- Liste des clients -->
|
||||
<ListView x:Name="ClientsListView" HasUnevenRows="True" ItemTapped="OnClientTapped">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ViewCell>
|
||||
<StackLayout Orientation="Horizontal" Padding="5">
|
||||
<Label Text="{Binding Nom}"
|
||||
VerticalOptions="Center"
|
||||
FontAttributes="Bold"
|
||||
WidthRequest="100"/>
|
||||
<Label Text="{Binding Prenom}"
|
||||
VerticalOptions="Center"
|
||||
WidthRequest="100"/>
|
||||
|
||||
<Button Text="Modifier"
|
||||
Clicked="OnModifierClientClicked"
|
||||
CommandParameter="{Binding .}"
|
||||
HorizontalOptions="EndAndExpand"
|
||||
Margin="5,0"/>
|
||||
|
||||
<Button Text="Supprimer"
|
||||
Clicked="OnSupprimerClientClicked"
|
||||
CommandParameter="{Binding .}"
|
||||
HorizontalOptions="End"
|
||||
Margin="5,0"/>
|
||||
</StackLayout>
|
||||
<Frame Padding="10" CornerRadius="10" BackgroundColor="White" BorderColor="#E5E7EB" Margin="0,5">
|
||||
<StackLayout Orientation="Horizontal" Spacing="15">
|
||||
<!-- Icône ou Avatar -->
|
||||
<Image Source="user_icon.png" WidthRequest="40" HeightRequest="40"/>
|
||||
|
||||
<!-- Infos du client -->
|
||||
<VerticalStackLayout>
|
||||
<Label Text="{Binding Nom}" FontAttributes="Bold" FontSize="16"/>
|
||||
<Label Text="{Binding Prenom}" FontSize="14" TextColor="Gray"/>
|
||||
</VerticalStackLayout>
|
||||
|
||||
<!-- Actions Modifier / Supprimer -->
|
||||
<StackLayout Orientation="Horizontal" HorizontalOptions="EndAndExpand" Spacing="5">
|
||||
<ImageButton Source="edit_icon.png"
|
||||
Clicked="OnModifierClientClicked"
|
||||
CommandParameter="{Binding .}"
|
||||
HeightRequest="30"
|
||||
WidthRequest="30"
|
||||
BackgroundColor="Transparent"/>
|
||||
<ImageButton Source="delete_icon.png"
|
||||
Clicked="OnSupprimerClientClicked"
|
||||
CommandParameter="{Binding .}"
|
||||
HeightRequest="30"
|
||||
WidthRequest="30"
|
||||
BackgroundColor="Transparent"/>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</Frame>
|
||||
</ViewCell>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
|
||||
|
||||
|
||||
</StackLayout>
|
||||
|
||||
</ContentPage>
|
||||
|
@ -15,7 +15,7 @@ namespace HegreHotel.Views.Client
|
||||
InitializeComponent();
|
||||
LoadClients();
|
||||
}
|
||||
|
||||
|
||||
private async void LoadClients()
|
||||
{
|
||||
string dbPath = Path.Combine(FileSystem.AppDataDirectory, "HegreHotel.db3");
|
||||
@ -37,17 +37,16 @@ namespace HegreHotel.Views.Client
|
||||
|
||||
private async void OnModifierClientClicked(object sender, EventArgs e)
|
||||
{
|
||||
var client = ((Button)sender).CommandParameter as Models.Client;
|
||||
if (client != null)
|
||||
if (sender is ImageButton imageButton && imageButton.CommandParameter is Models.Client client)
|
||||
{
|
||||
await Navigation.PushAsync(new ModifierClientPage(client));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private async void OnSupprimerClientClicked(object sender, EventArgs e)
|
||||
{
|
||||
var client = ((Button)sender).CommandParameter as Models.Client;
|
||||
if (client != null)
|
||||
if (sender is ImageButton imageButton && imageButton.CommandParameter is Models.Client client)
|
||||
{
|
||||
bool confirmation = await DisplayAlert("Suppression", "Voulez-vous vraiment supprimer ce client ?", "Oui", "Non");
|
||||
if (confirmation)
|
||||
@ -60,6 +59,7 @@ namespace HegreHotel.Views.Client
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void ClientsPage_OnAppearing(object? sender, EventArgs e)
|
||||
{
|
||||
LoadClients();
|
||||
@ -69,13 +69,10 @@ namespace HegreHotel.Views.Client
|
||||
{
|
||||
if (e.Item != null)
|
||||
{
|
||||
// Désélectionne l'élément tappé
|
||||
((ListView)sender).SelectedItem = null;
|
||||
|
||||
// Récupère le client sélectionné
|
||||
var client = e.Item as Models.Client;
|
||||
|
||||
// Navigue vers la page de détails du client
|
||||
await Navigation.PushAsync(new DetailsClientPage(client));
|
||||
}
|
||||
}
|
||||
|
@ -1,35 +1,59 @@
|
||||
<?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.Client.DetailsClientPage">
|
||||
<ContentPage.Content>
|
||||
<ScrollView>
|
||||
<StackLayout Padding="10" Spacing="5">
|
||||
<HorizontalStackLayout Spacing="5">
|
||||
<Label Text="{Binding Nom}" FontAttributes="Bold" FontSize="18"/>
|
||||
<Label Text="{Binding Prenom}" FontSize="18"/>
|
||||
x:Class="HegreHotel.Views.Client.DetailsClientPage"
|
||||
Title="Détails du Client">
|
||||
<ScrollView>
|
||||
<VerticalStackLayout Padding="20" Spacing="15">
|
||||
|
||||
<!-- Nom et prénom -->
|
||||
<Frame Padding="10" CornerRadius="10" BackgroundColor="#F3F4F6">
|
||||
<HorizontalStackLayout Spacing="10">
|
||||
<Label Text="{Binding Nom}" FontAttributes="Bold" FontSize="22"/>
|
||||
<Label Text="{Binding Prenom}" FontSize="22"/>
|
||||
</HorizontalStackLayout>
|
||||
<VerticalStackLayout>
|
||||
<Label Text="{Binding Email}"/>
|
||||
<Label Text="{Binding Telephone}"/>
|
||||
</Frame>
|
||||
|
||||
<!-- Coordonnées -->
|
||||
<Frame Padding="10" CornerRadius="10" BackgroundColor="#F9FAFB">
|
||||
<VerticalStackLayout Spacing="5">
|
||||
<HorizontalStackLayout Spacing="10">
|
||||
<Image Source="email_icon.png" WidthRequest="20" HeightRequest="20"/>
|
||||
<Label Text="{Binding Email}" FontSize="16"/>
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout Spacing="10">
|
||||
<Image Source="phone_icon.png" WidthRequest="20" HeightRequest="20"/>
|
||||
<Label Text="{Binding Telephone}" FontSize="16"/>
|
||||
</HorizontalStackLayout>
|
||||
</VerticalStackLayout>
|
||||
<Label Text="Historique des réservations :" FontAttributes="Bold" FontSize="Large"/>
|
||||
<ListView x:Name="ListeReservations">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ViewCell>
|
||||
<StackLayout Orientation="Horizontal" Padding="5" Spacing="10">
|
||||
</Frame>
|
||||
|
||||
<!-- Historique des réservations -->
|
||||
<Label Text="Historique des réservations :" FontAttributes="Bold" FontSize="18" Margin="0,10,0,5"/>
|
||||
<CollectionView x:Name="ListeReservations">
|
||||
<CollectionView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Frame Padding="10" CornerRadius="10" BackgroundColor="White" BorderColor="#E5E7EB" Margin="0,5">
|
||||
<VerticalStackLayout Spacing="5">
|
||||
<Label Text="{Binding ChambreNom}" FontAttributes="Bold" FontSize="16"/>
|
||||
<HorizontalStackLayout Spacing="10">
|
||||
<Label Text="Début :" FontAttributes="Bold"/>
|
||||
<Label Text="{Binding DateDebut, StringFormat='{0:dd/MM/yyyy}'}"/>
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout Spacing="10">
|
||||
<Label Text="Fin :" FontAttributes="Bold"/>
|
||||
<Label Text="{Binding DateFin, StringFormat='{0:dd/MM/yyyy}'}"/>
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout Spacing="10">
|
||||
<Label Text="Invités :" FontAttributes="Bold"/>
|
||||
<Label Text="{Binding NbInvite}"/>
|
||||
<Label Text="{Binding ChambreNom}"/>
|
||||
</StackLayout>
|
||||
</ViewCell>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
</StackLayout>
|
||||
</ScrollView>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
||||
</HorizontalStackLayout>
|
||||
</VerticalStackLayout>
|
||||
</Frame>
|
||||
</DataTemplate>
|
||||
</CollectionView.ItemTemplate>
|
||||
</CollectionView>
|
||||
|
||||
</VerticalStackLayout>
|
||||
</ScrollView>
|
||||
</ContentPage>
|
||||
|
@ -1,14 +1,47 @@
|
||||
<?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.Client.ModifierClientPage"
|
||||
Title="Modifier le Client">
|
||||
<StackLayout Padding="10">
|
||||
<Entry x:Name="EntryNom" Placeholder="Nom du client"/>
|
||||
<Entry x:Name="EntryPrenom" Placeholder="Prenom"/>
|
||||
<Entry x:Name="EntryEmail" Placeholder="Email" />
|
||||
<Entry x:Name="EntryTelephone" Placeholder="Téléphone" Keyboard="Numeric"/>
|
||||
<Button Text="Enregistrer" Clicked="OnEnregistrerClicked" Margin="0,20"/>
|
||||
</StackLayout>
|
||||
</ContentPage>
|
||||
|
||||
<ScrollView>
|
||||
<VerticalStackLayout Padding="20" Spacing="15">
|
||||
|
||||
<!-- Champ Nom -->
|
||||
<Label Text="Nom du client" FontAttributes="Bold" FontSize="16"/>
|
||||
<Frame Padding="10" CornerRadius="10" BackgroundColor="White" BorderColor="#E5E7EB">
|
||||
<Entry x:Name="EntryNom" Placeholder="Entrez le nom du client"/>
|
||||
</Frame>
|
||||
|
||||
<!-- Champ Prénom -->
|
||||
<Label Text="Prénom" FontAttributes="Bold" FontSize="16"/>
|
||||
<Frame Padding="10" CornerRadius="10" BackgroundColor="White" BorderColor="#E5E7EB">
|
||||
<Entry x:Name="EntryPrenom" Placeholder="Entrez le prénom"/>
|
||||
</Frame>
|
||||
|
||||
<!-- Champ Email -->
|
||||
<Label Text="Email" FontAttributes="Bold" FontSize="16"/>
|
||||
<Frame Padding="10" CornerRadius="10" BackgroundColor="White" BorderColor="#E5E7EB">
|
||||
<Entry x:Name="EntryEmail" Placeholder="Entrez l'email" Keyboard="Email"/>
|
||||
</Frame>
|
||||
|
||||
<!-- Champ Téléphone -->
|
||||
<Label Text="Téléphone" FontAttributes="Bold" FontSize="16"/>
|
||||
<Frame Padding="10" CornerRadius="10" BackgroundColor="White" BorderColor="#E5E7EB">
|
||||
<Entry x:Name="EntryTelephone" Placeholder="Entrez le téléphone" Keyboard="Telephone"/>
|
||||
</Frame>
|
||||
|
||||
<!-- Bouton Enregistrer -->
|
||||
<Button Text="Enregistrer les modifications"
|
||||
Clicked="OnEnregistrerClicked"
|
||||
BackgroundColor="#007AFF"
|
||||
TextColor="White"
|
||||
CornerRadius="10"
|
||||
Padding="12"
|
||||
FontAttributes="Bold"
|
||||
HorizontalOptions="Center"/>
|
||||
|
||||
</VerticalStackLayout>
|
||||
</ScrollView>
|
||||
|
||||
</ContentPage>
|
||||
|
99
Views/GestionDepart/GestionDepartPage.xaml
Normal file
99
Views/GestionDepart/GestionDepartPage.xaml
Normal file
@ -0,0 +1,99 @@
|
||||
<?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="Arrivée(s)"
|
||||
FontSize="24"
|
||||
FontAttributes="Bold"
|
||||
HorizontalOptions="Center"/>
|
||||
|
||||
</StackLayout>
|
||||
<ListView x:Name="GestionArriveListView" HasUnevenRows="True">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ViewCell>
|
||||
<StackLayout>
|
||||
<Label Text="ID chambre :"
|
||||
VerticalOptions="Center"
|
||||
WidthRequest="50"/>
|
||||
<Label Text="{Binding ChambreId}"
|
||||
VerticalOptions="Center"
|
||||
WidthRequest="50"/>
|
||||
<Label Text="Nombres de personnes :"
|
||||
VerticalOptions="Center"
|
||||
WidthRequest="50"/>
|
||||
<Label Text="{Binding NbPersonnes}"
|
||||
VerticalOptions="Center"
|
||||
WidthRequest="50"/>
|
||||
<Label Text="Date d'arrivée : aujourd'hui"
|
||||
VerticalOptions="Center"
|
||||
WidthRequest="100"/>
|
||||
<Label Text="Date de départ :"
|
||||
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="Départ(s)"
|
||||
FontSize="24"
|
||||
FontAttributes="Bold"
|
||||
HorizontalOptions="Center" />
|
||||
|
||||
</StackLayout>
|
||||
<ListView x:Name="GestionDepartListView" HasUnevenRows="True">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ViewCell>
|
||||
<StackLayout>
|
||||
<Label Text="ID chambre :"
|
||||
VerticalOptions="Center"
|
||||
WidthRequest="50"/>
|
||||
<Label Text="{Binding ChambreId}"
|
||||
VerticalOptions="Center"
|
||||
WidthRequest="50"/>
|
||||
<Label Text="Nombres de personnes :"
|
||||
VerticalOptions="Center"
|
||||
WidthRequest="50"/>
|
||||
<Label Text="{Binding NbPersonnes}"
|
||||
VerticalOptions="Center"
|
||||
WidthRequest="50"/>
|
||||
<Label Text="Date d'arrivée :"
|
||||
VerticalOptions="Center"
|
||||
WidthRequest="100"/>
|
||||
<Label Text="{Binding DateDebut, StringFormat='{0:dd/MM/yyyy}'}"
|
||||
VerticalOptions="Center"
|
||||
WidthRequest="100"/>
|
||||
<Label Text="Date de départ : aujourd'hui"
|
||||
VerticalOptions="Center"
|
||||
WidthRequest="100"/>
|
||||
</StackLayout>
|
||||
</ViewCell>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
</StackLayout>
|
||||
|
||||
</StackLayout>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
56
Views/GestionDepart/GestionDepartPage.xaml.cs
Normal file
56
Views/GestionDepart/GestionDepartPage.xaml.cs
Normal 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();
|
||||
}
|
||||
}
|
@ -1,24 +1,20 @@
|
||||
<?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.Reservation.ReservationsPage"
|
||||
Title="Gestion des Réservations"
|
||||
Appearing="ReservationsPage_OnAppearing">
|
||||
<StackLayout Padding="10">
|
||||
|
||||
<Button Text="Ajouter Réservation"
|
||||
Clicked="OnAjouterReservationClicked"
|
||||
HorizontalOptions="Center"
|
||||
Margin="0,10"/>
|
||||
|
||||
|
||||
<ListView x:Name="ReservationsListView" HasUnevenRows="True">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ViewCell>
|
||||
<StackLayout Orientation="Horizontal" Padding="5">
|
||||
|
||||
<StackLayout Orientation="Horizontal" Padding="5" Spacing="10">
|
||||
<Label Text="{Binding NbInvite}"
|
||||
VerticalOptions="Center"
|
||||
WidthRequest="50"/>
|
||||
@ -29,17 +25,20 @@
|
||||
VerticalOptions="Center"
|
||||
WidthRequest="100"/>
|
||||
|
||||
<Button Text="Modifier"
|
||||
CommandParameter="{Binding .}"
|
||||
Clicked="OnModifierReservationClicked"
|
||||
HorizontalOptions="EndAndExpand"
|
||||
Margin="5,0"/>
|
||||
|
||||
<Button Text="Supprimer"
|
||||
CommandParameter="{Binding .}"
|
||||
Clicked="OnSupprimerReservationClicked"
|
||||
HorizontalOptions="End"
|
||||
Margin="5,0"/>
|
||||
<StackLayout Orientation="Horizontal" HorizontalOptions="EndAndExpand" Spacing="5">
|
||||
<ImageButton Source="edit_icon.png"
|
||||
Clicked="OnModifierReservationClicked"
|
||||
CommandParameter="{Binding .}"
|
||||
HeightRequest="30"
|
||||
WidthRequest="30"
|
||||
BackgroundColor="Transparent"/>
|
||||
<ImageButton Source="delete_icon.png"
|
||||
Clicked="OnSupprimerReservationClicked"
|
||||
CommandParameter="{Binding .}"
|
||||
HeightRequest="30"
|
||||
WidthRequest="30"
|
||||
BackgroundColor="Transparent"/>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</ViewCell>
|
||||
</DataTemplate>
|
||||
|
@ -36,8 +36,7 @@ namespace HegreHotel.Views.Reservation
|
||||
|
||||
private async void OnModifierReservationClicked(object sender, EventArgs e)
|
||||
{
|
||||
var reservation = ((Button)sender).CommandParameter as Models.Reservation;
|
||||
if (reservation != null)
|
||||
if (sender is ImageButton imageButton && imageButton.CommandParameter is Models.Reservation reservation)
|
||||
{
|
||||
await Navigation.PushAsync(new ModifierReservationPage(reservation));
|
||||
}
|
||||
@ -45,8 +44,7 @@ namespace HegreHotel.Views.Reservation
|
||||
|
||||
private async void OnSupprimerReservationClicked(object sender, EventArgs e)
|
||||
{
|
||||
var reservation = ((Button)sender).CommandParameter as Models.Reservation;
|
||||
if (reservation != null)
|
||||
if (sender is ImageButton imageButton && imageButton.CommandParameter is Models.Reservation reservation)
|
||||
{
|
||||
bool confirmation = await DisplayAlert("Suppression", "Voulez-vous vraiment supprimer cette réservation ?", "Oui", "Non");
|
||||
if (confirmation)
|
||||
|
Loading…
x
Reference in New Issue
Block a user