Dernières vérifications suite au problèmes de merge et ajout d'une fonctionnalité manquante
Signé Yann
This commit is contained in:
parent
aa52129905
commit
686cf2edb9
@ -20,6 +20,7 @@ namespace MauiAppStock.Data
|
||||
await db.CreateTableAsync<Appareil>();
|
||||
await db.CreateTableAsync<Piece>();
|
||||
await db.CreateTableAsync<AppareilPiece>(); // Table de liaison
|
||||
await db.CreateTableAsync<MouvementStock>();
|
||||
await db.CreateTableAsync<Fournisseur>();
|
||||
}
|
||||
}
|
||||
|
@ -63,4 +63,17 @@
|
||||
<PackageReference Include="sqlite-net-pcl" Version="1.10.196-beta" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<MauiXaml Update="Views\EditFournisseurPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</MauiXaml>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Views\EditFournisseurPage.xaml.cs">
|
||||
<DependentUpon>EditFournisseurPage.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
14
MauiAppStock/Views/EditFournisseurPage.xaml
Normal file
14
MauiAppStock/Views/EditFournisseurPage.xaml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage
|
||||
x:Class="MauiAppStock.Views.EditFournisseurPage"
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
|
||||
|
||||
<StackLayout Padding="10">
|
||||
<Label Text="Modifier l'Appareil" FontSize="24" HorizontalOptions="Center"/>
|
||||
<Entry x:Name="NomEntry" Placeholder="Nom"/>
|
||||
<Entry x:Name="NumEntry" Placeholder="NumTel" Keyboard="Numeric"/>
|
||||
<Button Text="Enregistrer" Clicked="OnSaveClicked"/>
|
||||
<Button Text="Supprimer" Clicked="OnDeleteClicked" TextColor="Red"/>
|
||||
</StackLayout>
|
||||
</ContentPage>
|
35
MauiAppStock/Views/EditFournisseurPage.xaml.cs
Normal file
35
MauiAppStock/Views/EditFournisseurPage.xaml.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using MauiAppStock.Models;
|
||||
using MauiAppStock.Data;
|
||||
|
||||
namespace MauiAppStock.Views
|
||||
{
|
||||
public partial class EditFournisseurPage : ContentPage
|
||||
{
|
||||
private Fournisseur _fournisseur;
|
||||
public EditFournisseurPage(Fournisseur fournisseur)
|
||||
{
|
||||
InitializeComponent();
|
||||
_fournisseur = fournisseur;
|
||||
NomEntry.Text = fournisseur.Nom;
|
||||
NumEntry.Text = fournisseur.Numtel;
|
||||
}
|
||||
|
||||
private async void OnSaveClicked(object sender, EventArgs e)
|
||||
{
|
||||
_fournisseur.Nom = NomEntry.Text;
|
||||
_fournisseur.Numtel = NumEntry.Text;
|
||||
await Database.UpdateFournisseursync(_fournisseur);
|
||||
await Navigation.PopAsync();
|
||||
}
|
||||
|
||||
private async void OnDeleteClicked(object sender, EventArgs e)
|
||||
{
|
||||
bool confirm = await DisplayAlert("Confirmation", "Voulez-vous vraiment supprimer ce fournisseur ?", "Oui", "Non");
|
||||
if (confirm)
|
||||
{
|
||||
await Database.DeleteFournisseurAsync(_fournisseur);
|
||||
await Navigation.PopAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -18,7 +18,7 @@
|
||||
<ListView x:Name="FournisseursListView" ItemsSource="{Binding Fournisseurs}"
|
||||
IsPullToRefreshEnabled="True"
|
||||
RefreshCommand="{Binding LoadFournisseursCommand}"
|
||||
>
|
||||
ItemTapped="OnFournisseurTapped">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextCell Text="{Binding Nom}"/>
|
||||
|
@ -22,5 +22,14 @@ namespace MauiAppStock.Views
|
||||
// Navigation vers la page d'ajout
|
||||
await Navigation.PushAsync(new AddFournisseurPage());
|
||||
}
|
||||
|
||||
private async void OnFournisseurTapped(object sender, ItemTappedEventArgs e)
|
||||
{
|
||||
if (e.Item is Fournisseur selectedFournisseur)
|
||||
{
|
||||
// Navigation vers la page d'édition avec l'appareil sélectionné
|
||||
await Navigation.PushAsync(new EditFournisseurPage(selectedFournisseur));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user