feat: Implement Database Service and ViewModels for Messages and Support Requests
- Added DatabaseService to handle database operations for messages and support requests. - Created IDatabaseService interface to define the contract for database operations. - Developed ViewModels for Dashboard, Messages, and Support pages to manage data and commands. - Implemented XAML views for Dashboard, Messages, and Support, including data binding and UI elements. - Created SQL script for setting up the database schema and inserting test data.
This commit is contained in:
165
TravelMateAdmin/Views/DashboardPage.xaml
Normal file
165
TravelMateAdmin/Views/DashboardPage.xaml
Normal file
@@ -0,0 +1,165 @@
|
||||
<?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:TravelMateAdmin.ViewModels"
|
||||
x:Class="TravelMateAdmin.Views.DashboardPage"
|
||||
x:DataType="vm:DashboardViewModel"
|
||||
Title="Tableau de Bord"
|
||||
BackgroundColor="{StaticResource Primary}">
|
||||
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<Color x:Key="Primary">#1a1a1a</Color>
|
||||
<Color x:Key="Secondary">#2d2d2d</Color>
|
||||
<Color x:Key="Accent">#5E50D9</Color>
|
||||
<Color x:Key="TextPrimary">#FFFFFF</Color>
|
||||
<Color x:Key="TextSecondary">#B0B0B0</Color>
|
||||
<Color x:Key="Success">#4CAF50</Color>
|
||||
<Color x:Key="Warning">#FFA726</Color>
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
|
||||
<ScrollView>
|
||||
<VerticalStackLayout Padding="20" Spacing="20">
|
||||
|
||||
<!-- Header -->
|
||||
<Frame BackgroundColor="{StaticResource Secondary}"
|
||||
CornerRadius="10"
|
||||
Padding="20"
|
||||
HasShadow="True">
|
||||
<Grid RowDefinitions="Auto,Auto" ColumnDefinitions="*,Auto">
|
||||
<Label Text="TravelMate Admin"
|
||||
FontSize="32"
|
||||
FontAttributes="Bold"
|
||||
TextColor="{StaticResource TextPrimary}"
|
||||
Grid.Row="0" Grid.Column="0"/>
|
||||
<Label Text="Panneau d'Administration"
|
||||
FontSize="16"
|
||||
TextColor="{StaticResource TextSecondary}"
|
||||
Grid.Row="1" Grid.Column="0"/>
|
||||
<Label Text="{Binding ConnectionStatus}"
|
||||
FontSize="14"
|
||||
TextColor="{StaticResource Success}"
|
||||
VerticalOptions="Center"
|
||||
Grid.Row="0" Grid.Column="1" Grid.RowSpan="2"/>
|
||||
</Grid>
|
||||
</Frame>
|
||||
|
||||
<!-- Loading Indicator -->
|
||||
<ActivityIndicator IsRunning="{Binding IsLoading}"
|
||||
IsVisible="{Binding IsLoading}"
|
||||
Color="{StaticResource Accent}"
|
||||
HeightRequest="50"/>
|
||||
|
||||
<!-- Stats Cards -->
|
||||
<Grid ColumnDefinitions="*,*"
|
||||
RowDefinitions="Auto,Auto"
|
||||
ColumnSpacing="15"
|
||||
RowSpacing="15">
|
||||
|
||||
<!-- Messages Pending -->
|
||||
<Frame BackgroundColor="{StaticResource Secondary}"
|
||||
CornerRadius="10"
|
||||
Padding="20"
|
||||
HasShadow="True"
|
||||
Grid.Row="0" Grid.Column="0">
|
||||
<Frame.GestureRecognizers>
|
||||
<TapGestureRecognizer Command="{Binding NavigateToMessagesCommand}"/>
|
||||
</Frame.GestureRecognizers>
|
||||
<VerticalStackLayout Spacing="10">
|
||||
<Label Text="Messages"
|
||||
FontSize="16"
|
||||
TextColor="{StaticResource TextSecondary}"/>
|
||||
<Label Text="{Binding MessagesPending}"
|
||||
FontSize="48"
|
||||
FontAttributes="Bold"
|
||||
TextColor="{StaticResource Warning}"/>
|
||||
<Label Text="En attente"
|
||||
FontSize="14"
|
||||
TextColor="{StaticResource TextSecondary}"/>
|
||||
</VerticalStackLayout>
|
||||
</Frame>
|
||||
|
||||
<!-- Messages Done -->
|
||||
<Frame BackgroundColor="{StaticResource Secondary}"
|
||||
CornerRadius="10"
|
||||
Padding="20"
|
||||
HasShadow="True"
|
||||
Grid.Row="0" Grid.Column="1">
|
||||
<Frame.GestureRecognizers>
|
||||
<TapGestureRecognizer Command="{Binding NavigateToMessagesCommand}"/>
|
||||
</Frame.GestureRecognizers>
|
||||
<VerticalStackLayout Spacing="10">
|
||||
<Label Text="Messages"
|
||||
FontSize="16"
|
||||
TextColor="{StaticResource TextSecondary}"/>
|
||||
<Label Text="{Binding MessagesDone}"
|
||||
FontSize="48"
|
||||
FontAttributes="Bold"
|
||||
TextColor="{StaticResource Success}"/>
|
||||
<Label Text="Traités"
|
||||
FontSize="14"
|
||||
TextColor="{StaticResource TextSecondary}"/>
|
||||
</VerticalStackLayout>
|
||||
</Frame>
|
||||
|
||||
<!-- Support Pending -->
|
||||
<Frame BackgroundColor="{StaticResource Secondary}"
|
||||
CornerRadius="10"
|
||||
Padding="20"
|
||||
HasShadow="True"
|
||||
Grid.Row="1" Grid.Column="0">
|
||||
<Frame.GestureRecognizers>
|
||||
<TapGestureRecognizer Command="{Binding NavigateToSupportCommand}"/>
|
||||
</Frame.GestureRecognizers>
|
||||
<VerticalStackLayout Spacing="10">
|
||||
<Label Text="Support"
|
||||
FontSize="16"
|
||||
TextColor="{StaticResource TextSecondary}"/>
|
||||
<Label Text="{Binding SupportRequestsPending}"
|
||||
FontSize="48"
|
||||
FontAttributes="Bold"
|
||||
TextColor="{StaticResource Warning}"/>
|
||||
<Label Text="En attente"
|
||||
FontSize="14"
|
||||
TextColor="{StaticResource TextSecondary}"/>
|
||||
</VerticalStackLayout>
|
||||
</Frame>
|
||||
|
||||
<!-- Support Done -->
|
||||
<Frame BackgroundColor="{StaticResource Secondary}"
|
||||
CornerRadius="10"
|
||||
Padding="20"
|
||||
HasShadow="True"
|
||||
Grid.Row="1" Grid.Column="1">
|
||||
<Frame.GestureRecognizers>
|
||||
<TapGestureRecognizer Command="{Binding NavigateToSupportCommand}"/>
|
||||
</Frame.GestureRecognizers>
|
||||
<VerticalStackLayout Spacing="10">
|
||||
<Label Text="Support"
|
||||
FontSize="16"
|
||||
TextColor="{StaticResource TextSecondary}"/>
|
||||
<Label Text="{Binding SupportRequestsDone}"
|
||||
FontSize="48"
|
||||
FontAttributes="Bold"
|
||||
TextColor="{StaticResource Success}"/>
|
||||
<Label Text="Traités"
|
||||
FontSize="14"
|
||||
TextColor="{StaticResource TextSecondary}"/>
|
||||
</VerticalStackLayout>
|
||||
</Frame>
|
||||
</Grid>
|
||||
|
||||
<!-- Refresh Button -->
|
||||
<Button Text="Actualiser"
|
||||
Command="{Binding LoadDashboardCommand}"
|
||||
BackgroundColor="{StaticResource Accent}"
|
||||
TextColor="{StaticResource TextPrimary}"
|
||||
CornerRadius="10"
|
||||
HeightRequest="50"
|
||||
FontSize="16"
|
||||
FontAttributes="Bold"/>
|
||||
|
||||
</VerticalStackLayout>
|
||||
</ScrollView>
|
||||
</ContentPage>
|
||||
Reference in New Issue
Block a user