Compare commits
2 Commits
main
...
feature/lu
Author | SHA1 | Date | |
---|---|---|---|
96792c02d9 | |||
a2f833d35d |
@ -9,7 +9,7 @@ public partial class App : Application
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
// On démarre sur MainPage dans une NavigationPage pour permettre la navigation
|
// On démarre sur MainPage dans une NavigationPage pour permettre la navigation
|
||||||
MainPage = new AppShell();
|
MainPage = new NavigationPage(new MainPage());
|
||||||
InitializeDatabase();
|
InitializeDatabase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,15 +3,14 @@
|
|||||||
x:Class="MauiAppStock.AppShell"
|
x:Class="MauiAppStock.AppShell"
|
||||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
xmlns:local="clr-namespace:MauiAppStock"
|
||||||
xmlns:views="clr-namespace:MauiAppStock.Views"
|
xmlns:views="clr-namespace:MauiAppStock.Views"
|
||||||
Shell.FlyoutBehavior="Disabled"
|
Shell.FlyoutBehavior="Disabled"
|
||||||
Title="MauiAppStock">
|
Title="MauiAppStock">
|
||||||
|
|
||||||
<Tab>
|
<ShellContent
|
||||||
<ShellContent Title="Acceuil" ContentTemplate="{DataTemplate views:MainPage}" />
|
Title="Home"
|
||||||
<ShellContent Title="Appareils" ContentTemplate="{DataTemplate views:AppareilsPage}"/>
|
ContentTemplate="{DataTemplate views:MainPage}"
|
||||||
<ShellContent Title="Pièces" ContentTemplate="{DataTemplate views:PiecesPage}"/>
|
Route="MainPage" />
|
||||||
<ShellContent Title="Association" ContentTemplate="{DataTemplate views:SelectAppareilForAssociationPage}"/>
|
|
||||||
</Tab>
|
|
||||||
|
|
||||||
</Shell>
|
</Shell>
|
||||||
|
@ -1,22 +1,9 @@
|
|||||||
using MauiAppStock.Views;
|
namespace MauiAppStock;
|
||||||
|
|
||||||
namespace MauiAppStock;
|
|
||||||
|
|
||||||
public partial class AppShell : Shell
|
public partial class AppShell : Shell
|
||||||
{
|
{
|
||||||
public AppShell()
|
public AppShell()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
Routing.RegisterRoute(nameof(MainPage), typeof(MainPage));
|
|
||||||
Routing.RegisterRoute(nameof(AppareilsPage), typeof(AppareilsPage));
|
|
||||||
Routing.RegisterRoute(nameof(PiecesPage), typeof(PiecesPage));
|
|
||||||
Routing.RegisterRoute(nameof(SelectAppareilForAssociationPage), typeof(SelectAppareilForAssociationPage));
|
|
||||||
}
|
|
||||||
protected override void OnNavigating(ShellNavigatingEventArgs args)
|
|
||||||
{
|
|
||||||
base.OnNavigating(args);
|
|
||||||
|
|
||||||
bool isMainPage = args.Target?.Location?.OriginalString == "//MainPage";
|
|
||||||
Shell.SetBackButtonBehavior(this, new BackButtonBehavior { IsVisible = !isMainPage });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -20,6 +20,7 @@ namespace MauiAppStock.Data
|
|||||||
await db.CreateTableAsync<Appareil>();
|
await db.CreateTableAsync<Appareil>();
|
||||||
await db.CreateTableAsync<Piece>();
|
await db.CreateTableAsync<Piece>();
|
||||||
await db.CreateTableAsync<AppareilPiece>(); // Table de liaison
|
await db.CreateTableAsync<AppareilPiece>(); // Table de liaison
|
||||||
|
await db.CreateTableAsync<Fournisseur>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,6 +66,29 @@ namespace MauiAppStock.Data
|
|||||||
return db.DeleteAsync(piece);
|
return db.DeleteAsync(piece);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// CRUD pour Fournisseur
|
||||||
|
public static Task<int> AddFournisseurAsync(Fournisseur fournisseur)
|
||||||
|
{
|
||||||
|
return db.InsertAsync(fournisseur);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Task<List<Fournisseur>> GetFournisseursAsync()
|
||||||
|
{
|
||||||
|
return db.Table<Fournisseur>().ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Task<int> UpdateFournisseursync(Fournisseur fournisseur)
|
||||||
|
{
|
||||||
|
return db.UpdateAsync(fournisseur);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Task<int> DeleteFournisseurAsync(Fournisseur fournisseur)
|
||||||
|
{
|
||||||
|
return db.DeleteAsync(fournisseur);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Liaison entre Appareil et Piece
|
// Liaison entre Appareil et Piece
|
||||||
public static Task<int> AddAppareilPieceAsync(AppareilPiece appareilPiece)
|
public static Task<int> AddAppareilPieceAsync(AppareilPiece appareilPiece)
|
||||||
{
|
{
|
||||||
|
13
MauiAppStock/Models/Fournisseur.cs
Normal file
13
MauiAppStock/Models/Fournisseur.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using SQLite;
|
||||||
|
|
||||||
|
namespace MauiAppStock.Models
|
||||||
|
{
|
||||||
|
public class Fournisseur
|
||||||
|
{
|
||||||
|
[PrimaryKey, AutoIncrement]
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Nom { get; set; }
|
||||||
|
public string Numtel { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true"></application>
|
<application android:allowBackup="true" android:icon="@mipmap/image" android:roundIcon="@mipmap/image" android:supportsRtl="true"></application>
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
</manifest>
|
</manifest>
|
BIN
MauiAppStock/Platforms/Android/Resources/mipmap/image.png
Normal file
BIN
MauiAppStock/Platforms/Android/Resources/mipmap/image.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 98 KiB |
BIN
MauiAppStock/Resources/Images/logo.png
Normal file
BIN
MauiAppStock/Resources/Images/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 98 KiB |
42
MauiAppStock/ViewModels/FournisseursViewModel.cs
Normal file
42
MauiAppStock/ViewModels/FournisseursViewModel.cs
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using MauiAppStock.Models;
|
||||||
|
using MauiAppStock.Data;
|
||||||
|
using MauiAppStock.Helpers;
|
||||||
|
|
||||||
|
namespace MauiAppStock.ViewModels
|
||||||
|
{
|
||||||
|
public class FournisseursViewModel : BaseViewModel
|
||||||
|
{
|
||||||
|
public ObservableCollection<Fournisseur> Fournisseurs { get; set; }
|
||||||
|
public ICommand LoadFournisseursCommand { get; }
|
||||||
|
public ICommand DeleteFournisseurCommand { get; }
|
||||||
|
|
||||||
|
public FournisseursViewModel()
|
||||||
|
{
|
||||||
|
Fournisseurs = new ObservableCollection<Fournisseur>();
|
||||||
|
LoadFournisseursCommand = new AsyncCommand(LoadFournisseurs);
|
||||||
|
DeleteFournisseurCommand = new AsyncCommand<Fournisseur>(DeleteFournisseur);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task LoadFournisseurs()
|
||||||
|
{
|
||||||
|
Fournisseurs.Clear();
|
||||||
|
var fournisseursList = await Database.GetFournisseursAsync();
|
||||||
|
foreach (var fournisseur in fournisseursList)
|
||||||
|
{
|
||||||
|
Fournisseurs.Add(fournisseur);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task DeleteFournisseur(Fournisseur fournisseur)
|
||||||
|
{
|
||||||
|
if (fournisseur != null)
|
||||||
|
{
|
||||||
|
await Database.DeleteFournisseurAsync(fournisseur);
|
||||||
|
Fournisseurs.Remove(fournisseur);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
MauiAppStock/Views/AddFournisseurPage.xaml
Normal file
11
MauiAppStock/Views/AddFournisseurPage.xaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentPage x:Class="MauiAppStock.Views.AddFournisseurPage"
|
||||||
|
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
|
||||||
|
<StackLayout Padding="10">
|
||||||
|
<Label Text="Ajouter un Fournisseur" FontSize="24" HorizontalOptions="Center"/>
|
||||||
|
<Entry x:Name="NomEntry" Placeholder="Nom"/>
|
||||||
|
<Entry x:Name="NumEntry" Placeholder="NumTel" Keyboard="Numeric"/>
|
||||||
|
<Button Text="Enregistrer" Clicked="OnSaveClicked"/>
|
||||||
|
</StackLayout>
|
||||||
|
</ContentPage>
|
29
MauiAppStock/Views/AddFournisseurPage.xaml.cs
Normal file
29
MauiAppStock/Views/AddFournisseurPage.xaml.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
using MauiAppStock.Models;
|
||||||
|
using MauiAppStock.Data;
|
||||||
|
|
||||||
|
namespace MauiAppStock.Views
|
||||||
|
{
|
||||||
|
public partial class AddFournisseurPage : ContentPage
|
||||||
|
{
|
||||||
|
public AddFournisseurPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void OnSaveClicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
var fournisseur = new Fournisseur
|
||||||
|
{
|
||||||
|
Nom = NomEntry.Text,
|
||||||
|
Numtel = NumEntry.Text
|
||||||
|
|
||||||
|
}
|
||||||
|
;
|
||||||
|
await Database.AddFournisseurAsync(fournisseur);
|
||||||
|
await Navigation.PopAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -4,11 +4,15 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
|
||||||
<StackLayout Padding="10">
|
<StackLayout Padding="10">
|
||||||
<Label Text="Ajouter une Pièce" FontSize="24" HorizontalOptions="Center"/>
|
<Label Text="Ajouter une Pièce" FontSize="24" HorizontalOptions="Center"/>
|
||||||
|
|
||||||
<Entry x:Name="NomEntry" Placeholder="Nom"/>
|
<Entry x:Name="NomEntry" Placeholder="Nom"/>
|
||||||
<Editor x:Name="DescriptionEditor" Placeholder="Description" HeightRequest="100"/>
|
<Editor x:Name="DescriptionEditor" Placeholder="Description" HeightRequest="100"/>
|
||||||
<Entry x:Name="PrixEntry" Placeholder="Prix" Keyboard="Numeric"/>
|
<Entry x:Name="PrixEntry" Placeholder="Prix" Keyboard="Numeric"/>
|
||||||
<Entry x:Name="StockEntry" Placeholder="Stock" Keyboard="Numeric"/>
|
<Entry x:Name="StockEntry" Placeholder="Stock" Keyboard="Numeric"/>
|
||||||
<Entry x:Name="FournisseurEntry" Placeholder="Fournisseur"/>
|
|
||||||
|
<Label Text="Sélectionnez un fournisseur:"/>
|
||||||
|
<Picker x:Name="FournisseurPicker" Title="Fournisseurs"/>
|
||||||
|
|
||||||
<Button Text="Enregistrer" Clicked="OnSaveClicked"/>
|
<Button Text="Enregistrer" Clicked="OnSaveClicked"/>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</ContentPage>
|
</ContentPage>
|
@ -1,27 +1,42 @@
|
|||||||
using MauiAppStock.Models;
|
using MauiAppStock.Models;
|
||||||
using MauiAppStock.Data;
|
using MauiAppStock.Data;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace MauiAppStock.Views
|
namespace MauiAppStock.Views
|
||||||
{
|
{
|
||||||
public partial class AddPiecePage : ContentPage
|
public partial class AddPiecePage : ContentPage
|
||||||
{
|
{
|
||||||
|
private List<Fournisseur> _fournisseurs;
|
||||||
|
|
||||||
public AddPiecePage()
|
public AddPiecePage()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
LoadFournisseurs();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void LoadFournisseurs()
|
||||||
|
{
|
||||||
|
_fournisseurs = await Database.GetFournisseursAsync();
|
||||||
|
FournisseurPicker.ItemsSource = _fournisseurs;
|
||||||
|
FournisseurPicker.ItemDisplayBinding = new Binding("Nom");
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void OnSaveClicked(object sender, EventArgs e)
|
private async void OnSaveClicked(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (double.TryParse(PrixEntry.Text, out double prix) && int.TryParse(StockEntry.Text, out int stock))
|
if (double.TryParse(PrixEntry.Text, out double prix) && int.TryParse(StockEntry.Text, out int stock))
|
||||||
{
|
{
|
||||||
|
var selectedFournisseur = FournisseurPicker.SelectedItem as Fournisseur;
|
||||||
|
|
||||||
var piece = new Piece
|
var piece = new Piece
|
||||||
{
|
{
|
||||||
Nom = NomEntry.Text,
|
Nom = NomEntry.Text,
|
||||||
Description = DescriptionEditor.Text,
|
Description = DescriptionEditor.Text,
|
||||||
Prix = prix,
|
Prix = prix,
|
||||||
Stock = stock,
|
Stock = stock,
|
||||||
Fournisseur = FournisseurEntry.Text
|
Fournisseur = selectedFournisseur?.Nom
|
||||||
};
|
};
|
||||||
|
|
||||||
await Database.AddPieceAsync(piece);
|
await Database.AddPieceAsync(piece);
|
||||||
await Navigation.PopAsync();
|
await Navigation.PopAsync();
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,7 @@
|
|||||||
<ListView x:Name="AssociationsListView" ItemsSource="{Binding AppareilPieces}"
|
<ListView x:Name="AssociationsListView" ItemsSource="{Binding AppareilPieces}"
|
||||||
IsPullToRefreshEnabled="True"
|
IsPullToRefreshEnabled="True"
|
||||||
RefreshCommand="{Binding LoadAssociationsCommand}"
|
RefreshCommand="{Binding LoadAssociationsCommand}"
|
||||||
ItemTapped="OnAssociationTapped"
|
ItemTapped="OnAssociationTapped">
|
||||||
HasUnevenRows="True"
|
|
||||||
HeightRequest="500">
|
|
||||||
<ListView.ItemTemplate>
|
<ListView.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<ViewCell>
|
<ViewCell>
|
||||||
|
@ -4,11 +4,15 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
|
||||||
<StackLayout Padding="10">
|
<StackLayout Padding="10">
|
||||||
<Label Text="Modifier la Pièce" FontSize="24" HorizontalOptions="Center"/>
|
<Label Text="Modifier la Pièce" FontSize="24" HorizontalOptions="Center"/>
|
||||||
|
|
||||||
<Entry x:Name="NomEntry" Placeholder="Nom"/>
|
<Entry x:Name="NomEntry" Placeholder="Nom"/>
|
||||||
<Editor x:Name="DescriptionEditor" Placeholder="Description" HeightRequest="100"/>
|
<Editor x:Name="DescriptionEditor" Placeholder="Description" HeightRequest="100"/>
|
||||||
<Entry x:Name="PrixEntry" Placeholder="Prix" Keyboard="Numeric"/>
|
<Entry x:Name="PrixEntry" Placeholder="Prix" Keyboard="Numeric"/>
|
||||||
<Entry x:Name="StockEntry" Placeholder="Stock" Keyboard="Numeric"/>
|
<Entry x:Name="StockEntry" Placeholder="Stock" Keyboard="Numeric"/>
|
||||||
<Entry x:Name="FournisseurEntry" Placeholder="Fournisseur"/>
|
|
||||||
|
<Label Text="Sélectionnez un fournisseur:"/>
|
||||||
|
<Picker x:Name="FournisseurPicker" Title="Fournisseurs"/>
|
||||||
|
|
||||||
<Button Text="Enregistrer" Clicked="OnSaveClicked"/>
|
<Button Text="Enregistrer" Clicked="OnSaveClicked"/>
|
||||||
<Button Text="Supprimer" Clicked="OnDeleteClicked" TextColor="Red"/>
|
<Button Text="Supprimer" Clicked="OnDeleteClicked" TextColor="Red"/>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
|
@ -6,15 +6,39 @@ namespace MauiAppStock.Views
|
|||||||
public partial class EditPiecePage : ContentPage
|
public partial class EditPiecePage : ContentPage
|
||||||
{
|
{
|
||||||
private Piece _piece;
|
private Piece _piece;
|
||||||
|
private List<Fournisseur> _fournisseurs;
|
||||||
|
|
||||||
public EditPiecePage(Piece piece)
|
public EditPiecePage(Piece piece)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_piece = piece;
|
_piece = piece;
|
||||||
|
|
||||||
|
// Remplir les champs de base
|
||||||
NomEntry.Text = piece.Nom;
|
NomEntry.Text = piece.Nom;
|
||||||
DescriptionEditor.Text = piece.Description;
|
DescriptionEditor.Text = piece.Description;
|
||||||
PrixEntry.Text = piece.Prix.ToString();
|
PrixEntry.Text = piece.Prix.ToString();
|
||||||
StockEntry.Text = piece.Stock.ToString();
|
StockEntry.Text = piece.Stock.ToString();
|
||||||
FournisseurEntry.Text = piece.Fournisseur;
|
}
|
||||||
|
|
||||||
|
protected override async void OnAppearing()
|
||||||
|
{
|
||||||
|
base.OnAppearing();
|
||||||
|
|
||||||
|
// Charger les fournisseurs
|
||||||
|
_fournisseurs = await Database.GetFournisseursAsync();
|
||||||
|
|
||||||
|
FournisseurPicker.ItemsSource = _fournisseurs;
|
||||||
|
FournisseurPicker.ItemDisplayBinding = new Binding("Nom");
|
||||||
|
|
||||||
|
// Sélectionner le fournisseur existant (si défini)
|
||||||
|
if (!string.IsNullOrEmpty(_piece.Fournisseur))
|
||||||
|
{
|
||||||
|
var fournisseurActuel = _fournisseurs.FirstOrDefault(f => f.Nom == _piece.Fournisseur);
|
||||||
|
if (fournisseurActuel != null)
|
||||||
|
{
|
||||||
|
FournisseurPicker.SelectedItem = fournisseurActuel;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void OnSaveClicked(object sender, EventArgs e)
|
private async void OnSaveClicked(object sender, EventArgs e)
|
||||||
@ -25,7 +49,10 @@ namespace MauiAppStock.Views
|
|||||||
_piece.Description = DescriptionEditor.Text;
|
_piece.Description = DescriptionEditor.Text;
|
||||||
_piece.Prix = prix;
|
_piece.Prix = prix;
|
||||||
_piece.Stock = stock;
|
_piece.Stock = stock;
|
||||||
// _piece.Fournisseur = SelectedFournisseur;
|
|
||||||
|
var fournisseurSelectionne = FournisseurPicker.SelectedItem as Fournisseur;
|
||||||
|
_piece.Fournisseur = fournisseurSelectionne?.Nom;
|
||||||
|
|
||||||
await Database.UpdatePieceAsync(_piece);
|
await Database.UpdatePieceAsync(_piece);
|
||||||
await Navigation.PopAsync();
|
await Navigation.PopAsync();
|
||||||
}
|
}
|
||||||
|
29
MauiAppStock/Views/FournisseursPage.xaml
Normal file
29
MauiAppStock/Views/FournisseursPage.xaml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentPage
|
||||||
|
x:Class="MauiAppStock.Views.FournisseursPage"
|
||||||
|
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
xmlns:vm="clr-namespace:MauiAppStock.ViewModels">
|
||||||
|
|
||||||
|
<ContentPage.BindingContext>
|
||||||
|
<vm:FournisseursViewModel/>
|
||||||
|
</ContentPage.BindingContext>
|
||||||
|
|
||||||
|
<ContentPage.ToolbarItems>
|
||||||
|
<ToolbarItem Text="+" Clicked="OnAddFournisseurClicked"/>
|
||||||
|
</ContentPage.ToolbarItems>
|
||||||
|
|
||||||
|
<StackLayout Padding="10">
|
||||||
|
<Label Text="Liste des Fournisseurs" FontSize="24" HorizontalOptions="Center"/>
|
||||||
|
<ListView x:Name="FournisseursListView" ItemsSource="{Binding Fournisseurs}"
|
||||||
|
IsPullToRefreshEnabled="True"
|
||||||
|
RefreshCommand="{Binding LoadFournisseursCommand}"
|
||||||
|
>
|
||||||
|
<ListView.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextCell Text="{Binding Nom}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListView.ItemTemplate>
|
||||||
|
</ListView>
|
||||||
|
</StackLayout>
|
||||||
|
</ContentPage>
|
26
MauiAppStock/Views/FournisseursPage.xaml.cs
Normal file
26
MauiAppStock/Views/FournisseursPage.xaml.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
using MauiAppStock.Models;
|
||||||
|
using MauiAppStock.ViewModels;
|
||||||
|
|
||||||
|
namespace MauiAppStock.Views
|
||||||
|
{
|
||||||
|
public partial class FournisseursPage : ContentPage
|
||||||
|
{
|
||||||
|
public FournisseursPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAppearing()
|
||||||
|
{
|
||||||
|
base.OnAppearing();
|
||||||
|
var viewModel = BindingContext as FournisseursViewModel;
|
||||||
|
viewModel.LoadFournisseursCommand.Execute(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void OnAddFournisseurClicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// Navigation vers la page d'ajout
|
||||||
|
await Navigation.PushAsync(new AddFournisseurPage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -2,7 +2,19 @@
|
|||||||
<ContentPage x:Class="MauiAppStock.Views.MainPage"
|
<ContentPage x:Class="MauiAppStock.Views.MainPage"
|
||||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
|
||||||
<VerticalStackLayout Padding="10" Spacing="10" >
|
<StackLayout Padding="20" Spacing="20" VerticalOptions="Center">
|
||||||
<Label Text="Bienvenue sur le site : AppStock" FontSize="20"/>
|
<Label Text="Menu Principal" FontSize="30" HorizontalOptions="Center" />
|
||||||
</VerticalStackLayout>
|
<Button Text="Gestion des Appareils" BackgroundColor="Black" Clicked="OnAppareilsClicked" />
|
||||||
|
<Button Text="Gestion des Pièces" BackgroundColor="Black" Clicked="OnPiecesClicked" />
|
||||||
|
<Button Text="Gestion des Fournisseurs" BackgroundColor="Black" Clicked="OnFournisseursClicked" />
|
||||||
|
<Button Text="Associer une Pièce à un Appareil" BackgroundColor="Black" Clicked="OnAssocierPieceClicked" />
|
||||||
|
<VerticalStackLayout Padding="20" Spacing="20">
|
||||||
|
<Image Source="logo.png"
|
||||||
|
HeightRequest="200"
|
||||||
|
Aspect="AspectFit" />
|
||||||
|
</VerticalStackLayout>
|
||||||
|
</StackLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</ContentPage>
|
</ContentPage>
|
@ -20,6 +20,12 @@ namespace MauiAppStock.Views
|
|||||||
await Navigation.PushAsync(new PiecesPage());
|
await Navigation.PushAsync(new PiecesPage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async void OnFournisseursClicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
await Navigation.PushAsync(new FournisseursPage());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private async void OnAssocierPieceClicked(object sender, EventArgs e)
|
private async void OnAssocierPieceClicked(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// On navigue vers une page qui permet de sélectionner un appareil pour ensuite associer une pièce.
|
// On navigue vers une page qui permet de sélectionner un appareil pour ensuite associer une pièce.
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
|
||||||
<StackLayout Padding="10">
|
<StackLayout Padding="10">
|
||||||
|
|
||||||
<Label Text="Sélectionnez un Appareil" FontSize="24" HorizontalOptions="Center" />
|
<Label Text="Sélectionnez un Appareil" FontSize="24" HorizontalOptions="Center" />
|
||||||
<ListView x:Name="AppareilsListView" ItemTapped="OnAppareilTapped">
|
<ListView x:Name="AppareilsListView" ItemTapped="OnAppareilTapped">
|
||||||
<ListView.ItemTemplate>
|
<ListView.ItemTemplate>
|
||||||
|
@ -10,11 +10,7 @@ namespace MauiAppStock.Views
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
LoadAppareils();
|
LoadAppareils();
|
||||||
}
|
}
|
||||||
protected override void OnAppearing()
|
|
||||||
{
|
|
||||||
base.OnAppearing();
|
|
||||||
LoadAppareils(); // Rafraîchit la liste à chaque affichage
|
|
||||||
}
|
|
||||||
private async void LoadAppareils()
|
private async void LoadAppareils()
|
||||||
{
|
{
|
||||||
var appareils = await Database.GetAppareilsAsync();
|
var appareils = await Database.GetAppareilsAsync();
|
||||||
@ -29,7 +25,5 @@ namespace MauiAppStock.Views
|
|||||||
await Navigation.PushAsync(new AppareilPiecesPage(selectedAppareil));
|
await Navigation.PushAsync(new AppareilPiecesPage(selectedAppareil));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user