Skip to content

Commit

Permalink
Merge branch 'main' into feat/initial-feed-view
Browse files Browse the repository at this point in the history
  • Loading branch information
anasinik committed Jul 3, 2024
2 parents 3b830c6 + 6e9885e commit 7b2bbfe
Show file tree
Hide file tree
Showing 13 changed files with 352 additions and 10 deletions.
5 changes: 3 additions & 2 deletions AdoptionAgency/AdoptionAgency.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.18" />
</ItemGroup>


<ItemGroup>
<Folder Include="Frontend\ViewModel\AdminViewModel\" />
<Folder Include="Frontend\ViewModel\MemberViewModel\" />
<Resource Include="Frontend\Assets\Icons\continue.png" />
<Resource Include="Frontend\Assets\Logos\logo.png" />
</ItemGroup>

<ItemGroup>
Expand Down
Binary file added AdoptionAgency/Frontend/Assets/Icons/continue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AdoptionAgency/Frontend/Assets/Logos/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
96 changes: 96 additions & 0 deletions AdoptionAgency/Frontend/View/Post/AddAnimal.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<UserControl x:Class="AdoptionAgency.Frontend.View.Post.AddAnimal"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="690" d:DesignWidth="800">
<Grid Background="#FFF8FDFA">

<Label Content="Please enter information about the animal" HorizontalAlignment="Center" Height="35" Margin="0,33,0,0" VerticalAlignment="Top" Width="644" Foreground="#FF577B47" FontFamily="Elephant" FontStretch="Expanded" FontStyle="Italic" FontSize="16" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"/>

<!-- first group box-->
<GroupBox Header="Animal spieces" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,92,0,0" Width="700" Height="192">
<Grid Margin="0,0,0,0" Background="#FFEDEDED" >

<Expander HorizontalAlignment="Left" Height="88" Margin="61,36,0,0" VerticalAlignment="Top" Width="164">
<TextBlock TextWrapping="Wrap"> Before adding an animal, it is necessary to add the species.</TextBlock>
</Expander>

<!--animal species-->
<Label Content="Animal species" HorizontalAlignment="Left" Height="25" Margin="432,48,0,0" VerticalAlignment="Top" Width="224" Foreground="#FF577B47" FontFamily="Elephant" FontStretch="Expanded" InputScope="Srgs" Padding="6,5,5,5"/>
<TextBox HorizontalAlignment="Left" Height="23" Margin="432,25,0,0" TextWrapping="Wrap"
BorderThickness="2" VerticalAlignment="Top" Width="224" VerticalContentAlignment="Center" Background="#FFEFFCF3" BorderBrush="#FF7B996F" FontFamily="Bahnschrift Light" SelectionTextBrush="#FFF3B0B0" SelectionBrush="#FFFFEBEB"
Padding="1,0,0,0"></TextBox>

<!--animal breed-->
<Label Content="Animal breed" HorizontalAlignment="Left" Height="24" Margin="432,100,0,0" VerticalAlignment="Top" Width="224" Foreground="#FF577B47" FontFamily="Elephant" FontStretch="Expanded" InputScope="Srgs" Padding="6,5,5,5"/>
<TextBox HorizontalAlignment="Left" Height="22" Margin="432,78,0,0" TextWrapping="Wrap"
BorderThickness="2" VerticalAlignment="Top" Width="224" VerticalContentAlignment="Center" Background="#FFEFFCF3" BorderBrush="#FF7B996F" FontFamily="Bahnschrift Light" SelectionTextBrush="#FFF3B0B0" SelectionBrush="#FFFFEBEB"
Padding="1,0,0,0"></TextBox>

<!-- add spieces button-->
<Button Content="Add animal spieces" HorizontalAlignment="Left" Height="28" Margin="432,129,0,0" VerticalAlignment="Top" Width="224" BorderBrush="White" Background="#FFDADADA" Foreground="#FF577B47" FontFamily="Elephant"/>

</Grid>
</GroupBox>

<!--second text box-->
<GroupBox Header="Animal" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,299,0,0" Width="700" Height="300">
<Grid Background="#FFEDEDED" Margin="0,0,0,0">

<!--animal behaviour-->
<Label Content="Animal behaviour" HorizontalAlignment="Left" Height="25" Margin="34,33,0,0" VerticalAlignment="Top" Width="264" Foreground="#FF577B47" FontFamily="Elephant" FontStretch="Expanded" InputScope="Srgs" Padding="6,5,5,5"/>
<TextBox HorizontalAlignment="Left" Height="22" Margin="34,58,0,0" TextWrapping="Wrap"
BorderThickness="2" VerticalAlignment="Top" Width="264" VerticalContentAlignment="Center" Background="#FFEFFCF3" BorderBrush="#FF7B996F" FontFamily="Bahnschrift Light" SelectionTextBrush="#FFF3B0B0" SelectionBrush="#FFFFEBEB"
Padding="1,0,0,0" IsEnabled="False"></TextBox>

<!--found location-->
<Label Content="Found location" HorizontalAlignment="Left" Height="24" Margin="34,90,0,0" VerticalAlignment="Top" Width="264" Foreground="#FF577B47" FontFamily="Elephant" FontStretch="Expanded" InputScope="Srgs" Padding="6,5,5,5"/>
<TextBox HorizontalAlignment="Left" Height="22" Margin="34,174,0,0" TextWrapping="Wrap"
BorderThickness="2" VerticalAlignment="Top" Width="264" VerticalContentAlignment="Center" Background="#FFEFFCF3" BorderBrush="#FF7B996F" FontFamily="Bahnschrift Light" SelectionTextBrush="#FFF3B0B0" SelectionBrush="#FFFFEBEB"
Padding="1,0,0,0" IsEnabled="False"></TextBox>

<!--health condition-->
<Label Content="Health condition" HorizontalAlignment="Left" Height="24" Margin="34,150,0,0" VerticalAlignment="Top" Width="264" Foreground="#FF577B47" FontFamily="Elephant" FontStretch="Expanded" InputScope="Srgs" Padding="6,5,5,5"/>
<TextBox HorizontalAlignment="Left" Height="22" Margin="394,58,0,0" TextWrapping="Wrap"
BorderThickness="2" VerticalAlignment="Top" Width="118" VerticalContentAlignment="Center" Background="#FFEFFCF3" BorderBrush="#FF7B996F" FontFamily="Bahnschrift Light" SelectionTextBrush="#FFF3B0B0" SelectionBrush="#FFFFEBEB"
Padding="1,0,0,0" IsEnabled="False"></TextBox>

<!--weight-->
<Label Content="Weight" HorizontalAlignment="Left" Height="24" Margin="394,34,0,0" VerticalAlignment="Top" Width="132" Foreground="#FF577B47" FontFamily="Elephant" FontStretch="Expanded" InputScope="Srgs" Padding="6,5,5,5"/>
<TextBox HorizontalAlignment="Left" Height="22" Margin="34,114,0,0" TextWrapping="Wrap"
BorderThickness="2" VerticalAlignment="Top" Width="264" VerticalContentAlignment="Center" Background="#FFEFFCF3" BorderBrush="#FF7B996F" FontFamily="Bahnschrift Light" SelectionTextBrush="#FFF3B0B0" SelectionBrush="#FFFFEBEB"
Padding="1,0,0,0" IsEnabled="False"></TextBox>

<!--size-->
<Label Content="Size" HorizontalAlignment="Left" Height="24" Margin="526,33,0,0" VerticalAlignment="Top" Width="132" Foreground="#FF577B47" FontFamily="Elephant" FontStretch="Expanded" InputScope="Srgs" Padding="6,5,5,5"/>
<TextBox HorizontalAlignment="Left" Height="22" Margin="531,58,0,0" TextWrapping="Wrap"
BorderThickness="2" VerticalAlignment="Top" Width="127" VerticalContentAlignment="Center" Background="#FFEFFCF3" BorderBrush="#FF7B996F" FontFamily="Bahnschrift Light" SelectionTextBrush="#FFF3B0B0" SelectionBrush="#FFFFEBEB"
Padding="1,0,0,0" IsEnabled="False"></TextBox>

<!--gender-->
<Label Content="Gender" HorizontalAlignment="Left" Height="24" Margin="394,90,0,0" VerticalAlignment="Top" Width="264" Foreground="#FF577B47" FontFamily="Elephant" FontStretch="Expanded" InputScope="Srgs" Padding="6,5,5,5"/>
<ComboBox HorizontalAlignment="Left" Height="22" Width="264" Margin="394,114,0,141" BorderBrush="#FFE8E8E8" IsEnabled="False"/>

<!--birthdate-->
<Label Content="BirthDate" HorizontalAlignment="Left" Height="24" Margin="394,150,0,0" VerticalAlignment="Top" Width="264" Foreground="#FF577B47" FontFamily="Elephant" FontStretch="Expanded" InputScope="Srgs" Padding="6,5,5,5"/>

<DatePicker HorizontalAlignment="Left" Height="24" Width="264" Background="#FFEDEDED" Margin="394,172,0,81" IsEnabled="False">
<DatePicker.BorderBrush>
<LinearGradientBrush EndPoint="0.5,0" StartPoint="0.5,1">
<GradientStop Color="#FFEDEDED"/>
</LinearGradientBrush>
</DatePicker.BorderBrush>
</DatePicker>

<Button Content="Add animal" HorizontalAlignment="Left" Height="28" Margin="166,239,0,0" VerticalAlignment="Top" Width="346" BorderBrush="White" Background="#FFDADADA" Foreground="#FF577B47" FontFamily="Elephant" IsEnabled="False"/>
</Grid>
</GroupBox>

<Button Margin="657,604,50,10" Click="NextPage_Click">
<Image Source="/Frontend/Assets/Icons/continue.png" Stretch="Fill" Width="73"/>
</Button>
</Grid>

</UserControl>
22 changes: 22 additions & 0 deletions AdoptionAgency/Frontend/View/Post/AddAnimal.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System.Windows;
using System.Windows.Controls;

namespace AdoptionAgency.Frontend.View.Post
{
public partial class AddAnimal : UserControl
{
private readonly Post _parentWindow;
public AddAnimal(Post parentWindow)
{
InitializeComponent();
_parentWindow = parentWindow;
}

private void NextPage_Click(object sender, RoutedEventArgs e)
{
_parentWindow.contentGrid.Children.Clear();
_parentWindow.contentGrid.Children.Add(new AddPost());
}

}
}
20 changes: 20 additions & 0 deletions AdoptionAgency/Frontend/View/Post/AddPost.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<UserControl x:Class="AdoptionAgency.Frontend.View.Post.AddPost"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="690" d:DesignWidth="800">
<Grid Background="#FFF8FDFA">

<TextBox HorizontalAlignment="Center" Height="94" Margin="0,52,0,0" TextWrapping="Wrap"
BorderThickness="2" VerticalAlignment="Top" Width="378" VerticalContentAlignment="Center" Background="#FFEFFCF3" BorderBrush="#FF7B996F" FontFamily="Bahnschrift Light" SelectionTextBrush="#FFF3B0B0" SelectionBrush="#FFFFEBEB"
Padding="1,0,0,0"></TextBox>

<Label Content="Please enter post description" HorizontalAlignment="Center" Height="37" Margin="0,10,0,0" VerticalAlignment="Top" Width="378" Foreground="#FF577B47" FontFamily="Elephant" FontStretch="Expanded" FontSize="16" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"/>
<Grid x:Name="pictureGrid" Background="AliceBlue" HorizontalAlignment="Center" Height="322" Margin="0,168,0,0" VerticalAlignment="Top" Width="478"/>
<Button Content="Attach pictures" HorizontalAlignment="Center" Height="50" Margin="0,526,0,0" VerticalAlignment="Top" Width="378" BorderBrush="White" Background="#FFDADADA" Foreground="#FF577B47" FontFamily="Elephant" IsEnabled="False"/>
<Button Content="Publish Post" HorizontalAlignment="Center" Height="50" Margin="0,601,0,0" VerticalAlignment="Top" Width="378" BorderBrush="White" Background="#FFDADADA" Foreground="#FF577B47" FontFamily="Elephant" IsEnabled="False"/>

</Grid>
</UserControl>
15 changes: 15 additions & 0 deletions AdoptionAgency/Frontend/View/Post/AddPost.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using AdoptionAgency.Backend.Domain.Model.Post;
using AdoptionAgency.Frontend.View.Common;
using System.Windows.Controls;

namespace AdoptionAgency.Frontend.View.Post
{
public partial class AddPost : UserControl
{
public AddPost()
{
InitializeComponent();
pictureGrid.Children.Add(new ImageDisplay(new List<Picture>()));
}
}
}
23 changes: 23 additions & 0 deletions AdoptionAgency/Frontend/View/Post/Post.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Window x:Class="AdoptionAgency.Frontend.View.Post.Post"
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"
xmlns:local="clr-namespace:AdoptionAgency.Frontend.View.Post"
mc:Ignorable="d"
Title="Post" Height="770" Width="800"
WindowStartupLocation="CenterScreen"
ResizeMode="NoResize">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>

<Label Content="Create post" HorizontalAlignment="Center" Height="62" VerticalAlignment="Center" Width="175" Foreground="#FF577B47" FontFamily="Elephant" FontStretch="Expanded" FontStyle="Italic" FontSize="24" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"/>
<Image Source="/Frontend/Assets/Logos/logo.png" Width="58" Height="53" Margin="260,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<Grid Grid.Row="1" x:Name="contentGrid"></Grid>

</Grid>
</Window>

13 changes: 13 additions & 0 deletions AdoptionAgency/Frontend/View/Post/Post.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System.Windows;

namespace AdoptionAgency.Frontend.View.Post
{
public partial class Post : Window
{
public Post()
{
InitializeComponent();
contentGrid.Children.Add(new AddAnimal(this));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<Window x:Class="AdoptionAgency.Frontend.View.VolunteerView.VolunteerRequestsView"
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"
xmlns:local="clr-namespace:AdoptionAgency.Frontend.View.VolunteerView"
mc:Ignorable="d"
Title="VolunteerRequestsView" Height="450" Width="800">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="8*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="3*"/>
<RowDefinition Height="5*"/>
<RowDefinition Height="2.5*"/>
<RowDefinition Height=".5*"/>
</Grid.RowDefinitions>
<ListView Grid.Row="1" Grid.Column="1" Margin="0,20" ItemsSource="{Binding MembersView}" HorizontalAlignment="Center" SelectedItem="{Binding SelectedMember}">
<ListView.View>
<GridView>
<GridViewColumn DisplayMemberBinding="{Binding Username}" Header="Username"/>
<GridViewColumn DisplayMemberBinding="{Binding Name}" Header="Name"/>
<GridViewColumn DisplayMemberBinding="{Binding LastName}" Header="Last name"/>
<GridViewColumn DisplayMemberBinding="{Binding Email}" Header="Email"/>
<GridViewColumn DisplayMemberBinding="{Binding PhoneNumber}" Header="Phone number"/>
</GridView>
</ListView.View>
</ListView>
<StackPanel VerticalAlignment="Center" Grid.Row="2" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Center">
<Button Click="AcceptReqBtn" Margin="20,0" MaxHeight="96" MaxWidth="96">
Accept request
</Button>
<Button Click="RejectReqBtn" Margin="20,0" MaxHeight="96" MaxWidth="96">
Reject request
</Button>
</StackPanel>
</Grid>
</Window>
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using AdoptionAgency.Backend.Domain.Model.Person;
using AdoptionAgency.Backend.Domain.Model.Person.Member;
using AdoptionAgency.Backend.Services;
using AdoptionAgency.Frontend.ViewModel.VolunteerViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace AdoptionAgency.Frontend.View.VolunteerView
{
/// <summary>
/// Interaction logic for VolunteerRequestsView.xaml
/// </summary>
public partial class VolunteerRequestsView : Window
{
public VolunteerRequestsViewModel ViewModel { get; set; }
public VolunteerRequestsView()
{
InitializeComponent();
ViewModel = new VolunteerRequestsViewModel();
DataContext = ViewModel;
}
private void AcceptReqBtn(object sender, RoutedEventArgs e)
{
var member = ViewModel.SelectedMember;
var personService = new PersonService();
//TODO Check if there is need for new User object
personService.Add(new Volunteer(member.Id, member.User, member.Name,
member.LastName, member.Email, member.PhoneNumber));
personService.Delete(member.Id);
var members = ViewModel.Members;
members.Remove(member);
}
private void RejectReqBtn(object sender, RoutedEventArgs e)
{
var member = ViewModel.SelectedMember;
var members = ViewModel.Members;
members.Remove(member);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
using AdoptionAgency.Backend.Domain.Model.Person.Member;
using AdoptionAgency.Backend.Domain.Model.User;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Navigation;

namespace AdoptionAgency.Frontend.ViewModel.MemberVM
{
Expand All @@ -20,7 +14,25 @@ public int Id
OnPropertyChanged();
}
}
public User User
public string Username
{
get => Username;
set
{
Username = value;
OnPropertyChanged();
}
}
public string Password
{
get => Password;
set
{
Password = value;
OnPropertyChanged();
}
}
public User User
{
get => User;
set
Expand Down Expand Up @@ -67,10 +79,21 @@ public string PhoneNumber
}

public MemberViewModel() { }
public MemberViewModel(Member member)
{
Id = member.Id;
Username = member.User.Username;
Password = member.User.Password;
Name = member.Name;
LastName = member.LastName;
Email = member.Email;
PhoneNumber = member.PhoneNumber;
}
public MemberViewModel(int id, User user, string name, string lastName, string email, string phoneNumber)
{
Id = id;
User = user;
Username = user.Username;
Password = user.Password;
Name = name;
LastName = lastName;
Email = email;
Expand Down
Loading

0 comments on commit 7b2bbfe

Please sign in to comment.