parent
bf281a327d
commit
d73d36f4e8
@ -0,0 +1,380 @@
|
||||
<?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="Views.New_DetailAnimal"
|
||||
Title="{Binding Nom}" x:Name="page_creation">
|
||||
<ScrollView>
|
||||
<VerticalStackLayout>
|
||||
<HorizontalStackLayout
|
||||
VerticalOptions="Start"
|
||||
HorizontalOptions="End">
|
||||
<Button Text="Valider"
|
||||
Background="{StaticResource Primary}"
|
||||
Margin="20"
|
||||
Clicked="Validate_OnClick"/>
|
||||
<Button Text="Supprimer"
|
||||
Background="{StaticResource Primary}"
|
||||
Margin="20"
|
||||
Clicked="Button_OnClick"/>
|
||||
</HorizontalStackLayout>
|
||||
<Image Source="{Binding Image}"
|
||||
MaximumWidthRequest="300"
|
||||
Margin="20"
|
||||
HorizontalOptions="Center"/>
|
||||
<Button Text="Ajouter photo"
|
||||
Background="{StaticResource Primary}"
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="Center"
|
||||
Margin="20"
|
||||
Clicked="TakePhoto"/>
|
||||
<Entry Text="{Binding Nom}"
|
||||
HorizontalOptions="Center">
|
||||
<Entry.Triggers>
|
||||
<DataTrigger TargetType="Entry"
|
||||
Binding="{Binding NomIsValid}"
|
||||
Value="false">
|
||||
<Setter Property="BackgroundColor" Value="{StaticResource Error}" />
|
||||
</DataTrigger>
|
||||
<DataTrigger TargetType="Entry"
|
||||
Binding="{Binding NomIsValid}"
|
||||
Value="true">
|
||||
<Setter Property="BackgroundColor" Value="{StaticResource White}" />
|
||||
</DataTrigger>
|
||||
</Entry.Triggers>
|
||||
</Entry>
|
||||
<Border Stroke="{StaticResource Secondary}"
|
||||
StrokeThickness="2"
|
||||
Margin="20"
|
||||
Padding="10"
|
||||
Background="{StaticResource Primary}"
|
||||
VerticalOptions="Start"
|
||||
Grid.Column="1">
|
||||
<Grid RowDefinitions="Auto, Auto, Auto, Auto, Auto, Auto, Auto, Auto, Auto"
|
||||
ColumnDefinitions="*, *"
|
||||
RowSpacing="8">
|
||||
<Label FontAttributes="Bold"
|
||||
Text="Date de naissance"/>
|
||||
<Entry Grid.Column="1"
|
||||
HorizontalOptions="End"
|
||||
Text="{Binding DateNaissance}"/>
|
||||
<Label Grid.Row="1"
|
||||
FontAttributes="Bold"
|
||||
Text="Sexe"/>
|
||||
<Entry Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
HorizontalOptions="End"
|
||||
Text="{Binding Sexe}"/>
|
||||
<Label Grid.Row="2"
|
||||
FontAttributes="Bold"
|
||||
Text="Date d'adoption"/>
|
||||
<Entry Grid.Column="1"
|
||||
Grid.Row="2"
|
||||
HorizontalOptions="End"
|
||||
Text="{Binding DateAdoption}"/>
|
||||
<Label Grid.Row="3"
|
||||
FontAttributes="Bold"
|
||||
Text="Taille"/>
|
||||
<HorizontalStackLayout Grid.Column="1"
|
||||
Grid.Row="3"
|
||||
HorizontalOptions="End">
|
||||
<Entry Text="{Binding Taille}"/>
|
||||
<Label Text=" cm" VerticalOptions="Center"/>
|
||||
</HorizontalStackLayout>
|
||||
<Label Grid.Row="4"
|
||||
FontAttributes="Bold"
|
||||
Text="Poids"/>
|
||||
<HorizontalStackLayout Grid.Column="2"
|
||||
Grid.Row="4"
|
||||
HorizontalOptions="End">
|
||||
<Entry Text="{Binding Poids}"/>
|
||||
<Label Text=" kg" VerticalOptions="Center"/>
|
||||
</HorizontalStackLayout>
|
||||
<Label Grid.Row="5"
|
||||
FontAttributes="Bold"
|
||||
Text="Alimentation"/>
|
||||
<Entry Grid.Column="2"
|
||||
Grid.Row="5"
|
||||
HorizontalOptions="End"
|
||||
Text="{Binding Alimentation}"/>
|
||||
<Label Grid.Row="6"
|
||||
FontAttributes="Bold"
|
||||
Text="Espèce"/>
|
||||
<Grid Grid.Row="6"
|
||||
Grid.Column="1"
|
||||
ColumnDefinitions="*"
|
||||
RowDefinitions="Auto, Auto">
|
||||
<Label Text="{Binding Espece}"
|
||||
VerticalOptions="Start"
|
||||
HorizontalOptions="End"/>
|
||||
<Picker Grid.Row="1"
|
||||
HorizontalOptions="End"
|
||||
x:Name="Picker_especes"
|
||||
ItemsSource="{Binding ListeEspeces}"
|
||||
ItemDisplayBinding="{Binding Nom}"
|
||||
SelectedIndexChanged="EspeceClic">
|
||||
</Picker>
|
||||
</Grid>
|
||||
<Label Grid.Row="7"
|
||||
FontAttributes="Bold"
|
||||
Text="Race"/>
|
||||
<Grid Grid.Row="7"
|
||||
Grid.Column="1"
|
||||
ColumnDefinitions="*"
|
||||
RowDefinitions="Auto, Auto">
|
||||
<Label Text="{Binding Race}"
|
||||
VerticalOptions="Start"
|
||||
HorizontalOptions="End"/>
|
||||
<Picker Grid.Row="1"
|
||||
HorizontalOptions="End"
|
||||
ItemsSource="{Binding Espece.ListeRaces}"
|
||||
ItemDisplayBinding="{Binding Nom}"
|
||||
SelectedIndexChanged="RaceClic">
|
||||
</Picker>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<VerticalStackLayout
|
||||
Margin="20">
|
||||
<Label Text="Petsitter"
|
||||
FontSize="Large"/>
|
||||
<Border Stroke="{StaticResource Secondary}"
|
||||
StrokeThickness="2"
|
||||
Padding="10"
|
||||
Background="{StaticResource Primary}">
|
||||
<Grid RowDefinitions="Auto, Auto, Auto, Auto, Auto"
|
||||
ColumnDefinitions="*, *">
|
||||
<Label FontAttributes="Bold"
|
||||
Text="Nom"/>
|
||||
<Entry Grid.Column="1"
|
||||
HorizontalOptions="End"
|
||||
Text="{Binding Petsitter.Entite.Nom}"/>
|
||||
<Label Grid.Row="1"
|
||||
FontAttributes="Bold"
|
||||
Text="Adresse"/>
|
||||
<Entry Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
HorizontalOptions="End"
|
||||
Text="{Binding Petsitter.Entite.Adresse}"/>
|
||||
<Label Grid.Row="2"
|
||||
FontAttributes="Bold"
|
||||
Text="Code postal"/>
|
||||
<Entry Grid.Column="1"
|
||||
Grid.Row="2"
|
||||
HorizontalOptions="End"
|
||||
Text="{Binding Petsitter.Entite.CodePostal}"/>
|
||||
<Label Grid.Row="3"
|
||||
FontAttributes="Bold"
|
||||
Text="Ville"/>
|
||||
<Entry Grid.Column="1"
|
||||
Grid.Row="3"
|
||||
HorizontalOptions="End"
|
||||
Text="{Binding Petsitter.Entite.Ville}"/>
|
||||
<Label Grid.Row="4"
|
||||
FontAttributes="Bold"
|
||||
Text="Numéro de téléphone"/>
|
||||
<Entry Grid.Column="1"
|
||||
Grid.Row="4"
|
||||
HorizontalOptions="End"
|
||||
Text="{Binding Petsitter.Entite.NumTel}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</VerticalStackLayout>
|
||||
|
||||
<VerticalStackLayout
|
||||
Margin="20">
|
||||
<Label Text="Chenil"
|
||||
FontSize="Large"/>
|
||||
<Border Stroke="{StaticResource Secondary}"
|
||||
StrokeThickness="2"
|
||||
Padding="10"
|
||||
Background="{StaticResource Primary}">
|
||||
<Grid RowDefinitions="Auto, Auto, Auto, Auto, Auto"
|
||||
ColumnDefinitions="*, *">
|
||||
<Label FontAttributes="Bold"
|
||||
Text="Nom"/>
|
||||
<Entry Grid.Column="1"
|
||||
HorizontalOptions="End"
|
||||
Text="{Binding Chenil.Entite.Nom}"/>
|
||||
<Label Grid.Row="1"
|
||||
FontAttributes="Bold"
|
||||
Text="Adresse"/>
|
||||
<Entry Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
HorizontalOptions="End"
|
||||
Text="{Binding Chenil.Entite.Adresse}"/>
|
||||
<Label Grid.Row="2"
|
||||
FontAttributes="Bold"
|
||||
Text="Code postal"/>
|
||||
<Entry Grid.Column="1"
|
||||
Grid.Row="2"
|
||||
HorizontalOptions="End"
|
||||
Text="{Binding Chenil.Entite.CodePostal}"/>
|
||||
<Label Grid.Row="3"
|
||||
FontAttributes="Bold"
|
||||
Text="Ville"/>
|
||||
<Entry Grid.Column="1"
|
||||
Grid.Row="3"
|
||||
HorizontalOptions="End"
|
||||
Text="{Binding Chenil.Entite.Ville}"/>
|
||||
<Label Grid.Row="4"
|
||||
FontAttributes="Bold"
|
||||
Text="Numéro de téléphone"/>
|
||||
<Entry Grid.Column="1"
|
||||
Grid.Row="4"
|
||||
HorizontalOptions="End"
|
||||
Text="{Binding Chenil.Entite.NumTel}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</VerticalStackLayout>
|
||||
|
||||
<VerticalStackLayout
|
||||
Margin="20">
|
||||
<Label Text="Vétérinaire"
|
||||
FontSize="Large"/>
|
||||
<Border Stroke="{StaticResource Secondary}"
|
||||
StrokeThickness="2"
|
||||
Padding="10"
|
||||
Background="{StaticResource Primary}">
|
||||
<Grid RowDefinitions="Auto, Auto, Auto, Auto, Auto, Auto"
|
||||
ColumnDefinitions="*, *">
|
||||
<Label FontAttributes="Bold"
|
||||
Text="Nom"/>
|
||||
<Entry Grid.Column="1"
|
||||
HorizontalOptions="End"
|
||||
Text="{Binding Veterinaire.Entite.Nom}"/>
|
||||
<Label Grid.Row="1"
|
||||
FontAttributes="Bold"
|
||||
Text="Clinique"/>
|
||||
<Entry Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
HorizontalOptions="End"
|
||||
Text="{Binding Veterinaire.Clinique}"/>
|
||||
<Label Grid.Row="2"
|
||||
FontAttributes="Bold"
|
||||
Text="Adresse"/>
|
||||
<Entry Grid.Column="1"
|
||||
Grid.Row="2"
|
||||
HorizontalOptions="End"
|
||||
Text="{Binding Veterinaire.Entite.Adresse}"/>
|
||||
<Label Grid.Row="3"
|
||||
FontAttributes="Bold"
|
||||
Text="Code postal"/>
|
||||
<Entry Grid.Column="1"
|
||||
Grid.Row="3"
|
||||
HorizontalOptions="End"
|
||||
Text="{Binding Veterinaire.Entite.CodePostal}"/>
|
||||
<Label Grid.Row="4"
|
||||
FontAttributes="Bold"
|
||||
Text="Ville"/>
|
||||
<Entry Grid.Column="1"
|
||||
Grid.Row="4"
|
||||
HorizontalOptions="End"
|
||||
Text="{Binding Veterinaire.Entite.Ville}"/>
|
||||
<Label Grid.Row="5"
|
||||
FontAttributes="Bold"
|
||||
Text="Numéro de téléphone"/>
|
||||
<Entry Grid.Column="1"
|
||||
Grid.Row="5"
|
||||
HorizontalOptions="End"
|
||||
Text="{Binding Veterinaire.Entite.NumTel}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</VerticalStackLayout>
|
||||
|
||||
<VerticalStackLayout
|
||||
Margin="20">
|
||||
<Label Text="Magasin alimentaire"
|
||||
FontSize="Large"/>
|
||||
<Border Stroke="{StaticResource Secondary}"
|
||||
StrokeThickness="2"
|
||||
Padding="10"
|
||||
Background="{StaticResource Primary}">
|
||||
<Grid RowDefinitions="Auto, Auto, Auto, Auto, Auto"
|
||||
ColumnDefinitions="*, *">
|
||||
<Label FontAttributes="Bold"
|
||||
Text="Nom"/>
|
||||
<Entry Grid.Column="1"
|
||||
HorizontalOptions="End"
|
||||
Text="{Binding MagasinAlimentaire.Entite.Nom}"/>
|
||||
<Label Grid.Row="1"
|
||||
FontAttributes="Bold"
|
||||
Text="Adresse"/>
|
||||
<Entry Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
HorizontalOptions="End"
|
||||
Text="{Binding MagasinAlimentaire.Entite.Adresse}"/>
|
||||
<Label Grid.Row="2"
|
||||
FontAttributes="Bold"
|
||||
Text="Code postal"/>
|
||||
<Entry Grid.Column="1"
|
||||
Grid.Row="2"
|
||||
HorizontalOptions="End"
|
||||
Text="{Binding MagasinAlimentaire.Entite.CodePostal}"/>
|
||||
<Label Grid.Row="3"
|
||||
FontAttributes="Bold"
|
||||
Text="Ville"/>
|
||||
<Entry Grid.Column="1"
|
||||
Grid.Row="3"
|
||||
HorizontalOptions="End"
|
||||
Text="{Binding MagasinAlimentaire.Entite.Ville}"/>
|
||||
<Label Grid.Row="4"
|
||||
FontAttributes="Bold"
|
||||
Text="Numéro de téléphone"/>
|
||||
<Entry Grid.Column="1"
|
||||
Grid.Row="4"
|
||||
HorizontalOptions="End"
|
||||
Text="{Binding MagasinAlimentaire.Entite.NumTel}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</VerticalStackLayout>
|
||||
|
||||
<VerticalStackLayout
|
||||
Margin="20">
|
||||
<Label Text="Refuge, élevage, chenil de provenance"
|
||||
FontSize="Large"/>
|
||||
<Border Stroke="{StaticResource Secondary}"
|
||||
StrokeThickness="2"
|
||||
Padding="10"
|
||||
Background="{StaticResource Primary}">
|
||||
<Grid RowDefinitions="Auto, Auto, Auto, Auto, Auto"
|
||||
ColumnDefinitions="*, *">
|
||||
<Label FontAttributes="Bold"
|
||||
Text="Nom"/>
|
||||
<Entry Grid.Column="1"
|
||||
HorizontalOptions="End"
|
||||
Text="{Binding Provenance.Entite.Nom}"/>
|
||||
<Label Grid.Row="1"
|
||||
FontAttributes="Bold"
|
||||
Text="Adresse"/>
|
||||
<Entry Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
HorizontalOptions="End"
|
||||
Text="{Binding Provenance.Entite.Adresse}"/>
|
||||
<Label Grid.Row="2"
|
||||
FontAttributes="Bold"
|
||||
Text="Code postal"/>
|
||||
<Entry Grid.Column="1"
|
||||
Grid.Row="2"
|
||||
HorizontalOptions="End"
|
||||
Text="{Binding Provenance.Entite.CodePostal}"/>
|
||||
<Label Grid.Row="3"
|
||||
FontAttributes="Bold"
|
||||
Text="Ville"/>
|
||||
<Entry Grid.Column="1"
|
||||
Grid.Row="3"
|
||||
HorizontalOptions="End"
|
||||
Text="{Binding Provenance.Entite.Ville}"/>
|
||||
<Label Grid.Row="4"
|
||||
FontAttributes="Bold"
|
||||
Text="Numéro de téléphone"/>
|
||||
<Entry Grid.Column="1"
|
||||
Grid.Row="4"
|
||||
HorizontalOptions="End"
|
||||
Text="{Binding Provenance.Entite.NumTel}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</VerticalStackLayout>
|
||||
</VerticalStackLayout>
|
||||
</ScrollView>
|
||||
</ContentPage>
|
@ -0,0 +1,59 @@
|
||||
using Model;
|
||||
|
||||
namespace Views;
|
||||
|
||||
public partial class New_DetailAnimal : ContentPage
|
||||
{
|
||||
public New_DetailAnimal()
|
||||
{
|
||||
InitializeComponent();
|
||||
BindingContext = (App.Current as App).AnimalSelectionner;
|
||||
Picker_especes.BindingContext = (App.Current as App).Theque;
|
||||
}
|
||||
|
||||
public async void Button_OnClick(object sender, EventArgs e)
|
||||
{
|
||||
(App.Current as App).Theque.SupprimerAnimal((App.Current as App).AnimalSelectionner);
|
||||
await Shell.Current.GoToAsync("//Animaux");
|
||||
}
|
||||
|
||||
public async void Validate_OnClick(object sender, EventArgs e)
|
||||
{
|
||||
if ((App.Current as App).AnimalSelectionner.NomIsValid == true)
|
||||
{
|
||||
await Shell.Current.GoToAsync("//Animal");
|
||||
//(App.Current as App).AnimalSelectionner = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void EspeceClic(object sender, EventArgs e)
|
||||
{
|
||||
(App.Current as App).AnimalSelectionner.Espece = (sender as Picker).SelectedItem as Espece;
|
||||
(App.Current as App).AnimalSelectionner.Race = null;
|
||||
}
|
||||
|
||||
private void RaceClic(object sender, EventArgs e)
|
||||
{
|
||||
(App.Current as App).AnimalSelectionner.Race = (sender as Picker).SelectedItem as Race;
|
||||
}
|
||||
|
||||
public async void TakePhoto(object sender, EventArgs e)
|
||||
{
|
||||
if (MediaPicker.Default.IsCaptureSupported)
|
||||
{
|
||||
FileResult photo = await MediaPicker.Default.PickPhotoAsync();
|
||||
|
||||
if (photo != null)
|
||||
{
|
||||
string localFilePath = Path.Combine(FileSystem.AppDataDirectory, photo.FileName);
|
||||
|
||||
using Stream sourceStream = await photo.OpenReadAsync();
|
||||
using FileStream localFileStream = File.OpenWrite(localFilePath);
|
||||
|
||||
await sourceStream.CopyToAsync(localFileStream);
|
||||
|
||||
(App.Current as App).AnimalSelectionner.Image = Path.Combine(FileSystem.AppDataDirectory, photo.FileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue