-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/anasinik/AdoptionAgency
- Loading branch information
Showing
16 changed files
with
277 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
134 changes: 134 additions & 0 deletions
134
AdoptionAgency/Frontend/View/UserViews/VolunteerView.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
<Window x:Class="AdoptionAgency.Frontend.View.UserViews.VolunteerView" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" | ||
Title="AdoptionAgency" | ||
Height="800" | ||
Width="800" | ||
WindowStartupLocation="CenterScreen" | ||
ResizeMode="NoResize"> | ||
|
||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto"/> | ||
<RowDefinition Height="*"/> | ||
<RowDefinition Height="Auto"/> | ||
</Grid.RowDefinitions> | ||
<Border Grid.Row="2" Height="1" Background="#FF577B47" HorizontalAlignment="Stretch" VerticalAlignment="Top"/> | ||
|
||
<Grid Grid.Row="0" Background="#FFE0E0E0" Margin="0,0,0,613" Grid.RowSpan="2"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="*"/> | ||
<ColumnDefinition Width="Auto"/> | ||
</Grid.ColumnDefinitions> | ||
|
||
<Image Source="/Frontend/Assets/Logos/logo.png" Width="59" Height="53" Margin="66,13,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"/> | ||
|
||
<TextBlock Text="Animal Adoption Agency" Foreground="#FF577B47" FontSize="19" FontFamily="Elephant" TextWrapping="Wrap" Margin="119,34,0,-11" HorizontalAlignment="Left" FontStyle="Italic" Width="279"/> | ||
|
||
<StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,20"> | ||
<Button x:Name="logoutBtn" Content="Logout" Height="33" Width="100" BorderBrush="White" Background="#FFAFBDAD" Foreground="#FF577B47" FontFamily="Elephant" | ||
Margin="10,0" Click="LogoutBtn_Click"/> | ||
</StackPanel> | ||
</Grid> | ||
|
||
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,100,0,0"> | ||
<Button x:Name="addPostBtn" Content="Add new post" BorderBrush="White" Background="#FFAFBDAD" Foreground="#FF577B47" FontFamily="Elephant" | ||
Margin="10,0" Height="33" Width="150" Click="AddPostBtn_Click"/> | ||
<Button x:Name="viewPostReqBtn" Content="View post requests" BorderBrush="White" Background="#FFAFBDAD" Foreground="#FF577B47" FontFamily="Elephant" | ||
Margin="10,0" Height="33" Width="150"/> | ||
<Button x:Name="viewRegReqBtn" Content="View registration requests" BorderBrush="White" Background="#FFAFBDAD" Foreground="#FF577B47" FontFamily="Elephant" | ||
Margin="10,0" Height="33" Width="164" Click="ViewRegReqBtn_Click"/> | ||
</StackPanel> | ||
|
||
<ScrollViewer Grid.Row="1" Background="#FFE5E5E5" Margin="0,10,0,0"> | ||
<ListBox x:Name="postsListBox" ItemsSource="{Binding Posts}" HorizontalAlignment="Center" Background="#FFF3FFF1"> | ||
<ListBox.ItemTemplate> | ||
<DataTemplate> | ||
<Border BorderBrush="#FF577B47" BorderThickness="1" Margin="5" Padding="10"> | ||
<StackPanel> | ||
<TextBlock Text="{Binding Author}" FontSize="20" Foreground="#FF577B47" TextWrapping="Wrap" FontWeight="Bold" VerticalAlignment="Center"/> | ||
<TextBlock Text="{Binding Description}" FontSize="15" Foreground="#FF577B47" TextWrapping="Wrap" FontWeight="Bold" VerticalAlignment="Center"/> | ||
<Image Source="{Binding IconPath}" Width="120" Height="120" HorizontalAlignment="Right" VerticalAlignment="Top"/> | ||
|
||
<Separator BorderBrush="#FF577B47" BorderThickness="1"/> | ||
|
||
<StackPanel Margin="15,0,0,0"> | ||
<TextBlock FontSize="15" Foreground="#FF577B47"> | ||
<TextBlock.Text> | ||
<MultiBinding StringFormat="Species: {0}"> | ||
<Binding Path="Animal.Species" /> | ||
</MultiBinding> | ||
</TextBlock.Text> | ||
</TextBlock> | ||
<TextBlock FontSize="15" Foreground="#FF577B47"> | ||
<TextBlock.Text> | ||
<MultiBinding StringFormat="Estimated year of birth: {0:yyyy}"> | ||
<Binding Path="Animal.BirthDate" /> | ||
</MultiBinding> | ||
</TextBlock.Text> | ||
</TextBlock> | ||
<TextBlock FontSize="15" Foreground="#FF577B47"> | ||
<TextBlock.Text> | ||
<MultiBinding StringFormat="Found Location: {0}"> | ||
<Binding Path="Animal.FoundLocation" /> | ||
</MultiBinding> | ||
</TextBlock.Text> | ||
</TextBlock> | ||
|
||
<TextBlock FontSize="15" Foreground="#FF577B47"> | ||
<TextBlock.Text> | ||
<MultiBinding StringFormat="Health Condition: {0}"> | ||
<Binding Path="Animal.HealthCondition" /> | ||
</MultiBinding> | ||
</TextBlock.Text> | ||
</TextBlock> | ||
|
||
<TextBlock FontSize="15" Foreground="#FF577B47"> | ||
<TextBlock.Text> | ||
<MultiBinding StringFormat="Behaviour: {0}"> | ||
<Binding Path="Animal.Behaviour" /> | ||
</MultiBinding> | ||
</TextBlock.Text> | ||
</TextBlock> | ||
|
||
<TextBlock FontSize="15" Foreground="#FF577B47"> | ||
<TextBlock.Text> | ||
<MultiBinding StringFormat="Gender: {0}"> | ||
<Binding Path="Animal.Gender" /> | ||
</MultiBinding> | ||
</TextBlock.Text> | ||
</TextBlock> | ||
|
||
<TextBlock FontSize="15" Foreground="#FF577B47"> | ||
<TextBlock.Text> | ||
<MultiBinding StringFormat="Weight: {0}"> | ||
<Binding Path="Animal.Weight" /> | ||
</MultiBinding> | ||
</TextBlock.Text> | ||
</TextBlock> | ||
|
||
<TextBlock FontSize="15" Foreground="#FF577B47"> | ||
<TextBlock.Text> | ||
<MultiBinding StringFormat="Size: {0}"> | ||
<Binding Path="Animal.Size" /> | ||
</MultiBinding> | ||
</TextBlock.Text> | ||
</TextBlock> | ||
</StackPanel> | ||
|
||
<ContentControl Content="{Binding ImageDisplays}" Margin="0,10,0,0" Width="450" Height="300"/> | ||
<Button x:Name="adoptBtn" Content="Adopt" Height="33" Width="100" BorderBrush="White" Background="#FFAFBDAD" Foreground="#FF577B47" FontFamily="Elephant" | ||
HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="10,10,0,0" Click="AdoptBtn_Click"/> | ||
</StackPanel> | ||
</Border> | ||
</DataTemplate> | ||
</ListBox.ItemTemplate> | ||
</ListBox> | ||
</ScrollViewer> | ||
|
||
<Border Grid.Row="2" Height="1" Background="#FF577B47" HorizontalAlignment="Stretch" VerticalAlignment="Top"/> | ||
</Grid> | ||
</Window> |
78 changes: 78 additions & 0 deletions
78
AdoptionAgency/Frontend/View/UserViews/VolunteerView.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
using AdoptionAgency.Backend.Domain.Model.Animal; | ||
using AdoptionAgency.Backend.Domain.Model.Common; | ||
using AdoptionAgency.Backend.Services.AnimalServices; | ||
using AdoptionAgency.Frontend.ViewModel.PostViewModels.EntityViewModels; | ||
using AdoptionAgency.Frontend.ViewModel.VolunteerViewModel; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
|
||
namespace AdoptionAgency.Frontend.View.UserViews | ||
{ | ||
public partial class VolunteerView : Window | ||
{ | ||
public VolunteerPageViewModel ViewModel { get; set; } | ||
public VolunteerView() | ||
{ | ||
InitializeComponent(); | ||
ViewModel = new VolunteerPageViewModel(); | ||
DataContext = ViewModel; | ||
} | ||
|
||
private void AdoptBtn_Click(object sender, RoutedEventArgs e) | ||
{ | ||
Button adoptButton = sender as Button; | ||
var post = adoptButton.DataContext as PostViewModel; | ||
|
||
var requestService = new AdoptionRequestService(); | ||
|
||
if (post == null) return; | ||
postsListBox.SelectedItem = post; | ||
|
||
if (post.Animal.Adopted) | ||
ShowInfo("Animal is already adopted, please select another."); | ||
|
||
else if (requestService.Exists(post.Animal, post.Person)) | ||
ShowInfo("Adoption request has already been sent."); | ||
|
||
else | ||
AskUserForPermanentAdoption(post); | ||
} | ||
|
||
private void AskUserForPermanentAdoption(PostViewModel post) | ||
{ | ||
AdoptionRequest request = new() | ||
{ | ||
Adopter = post.Person, // TODO: when loggedIn is saved | ||
Animal = post.Animal, | ||
SentAt = DateTime.Now, | ||
ReceivedAt = DateTime.Now, | ||
Status = Status.Pending, | ||
FosterUntil = DateTime.Now | ||
}; | ||
AdoptionConfirmation confirmation = new(request); | ||
confirmation.Show(); | ||
} | ||
|
||
private void ShowInfo(string text) | ||
{ | ||
MessageBox.Show(text, "Notification", MessageBoxButton.OK, MessageBoxImage.Information); | ||
} | ||
|
||
private void AddPostBtn_Click(object sender, RoutedEventArgs e) | ||
{ | ||
var window = new Post.Post(); | ||
window.Show(); | ||
} | ||
|
||
private void LogoutBtn_Click(object sender, RoutedEventArgs e) | ||
{ | ||
Close(); | ||
} | ||
|
||
private void ViewRegReqBtn_Click(object sender, RoutedEventArgs e) | ||
{ | ||
VolunteerRequestsView window = new(); | ||
window.Show(); | ||
} | ||
} | ||
} |
12 changes: 0 additions & 12 deletions
12
AdoptionAgency/Frontend/View/VolunteerView/VolunteerView.xaml
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.