Paul Schneider 9 years ago
parent fc8a64de96
commit 2e364df4f6
12 changed files with 161 additions and 43 deletions

@ -21,6 +21,20 @@ namespace BookAStar.Helpers
return result;
}
public static ImageSource SmallAvatar(string avatarPath, string username)
{
return avatarPath == null ?
ImageSource.FromResource("BookAStar.Images.Users.icon_user.png") :
ImageSource.FromUri(new Uri($"{Constants.YavscHomeUrl}/Avatars/{username}.s.png"));
}
public static ImageSource ExtraSmallAvatar(string avatarPath, string username)
{
return avatarPath == null ?
ImageSource.FromResource("BookAStar.Images.Users.icon_user.png") :
ImageSource.FromUri(new Uri($"{Constants.YavscHomeUrl}/Avatars/{username}.xs.png"));
}
public static HttpClient CreateJsonClient()
{
return CreateJsonClient(MainSettings.CurrentUser.YavscTokens.AccessToken);
@ -36,8 +50,6 @@ namespace BookAStar.Helpers
return client;
}
/// <summary>
/// Uploads the given stream to
/// /api/fs, in order to be saved under the given file name

@ -30,29 +30,34 @@
<ScrollView>
<StackLayout Padding="10,10,10,10" x:Name="mainLayout">
<ListView RefreshCommand="{Binding RefreshQueries}" IsPullToRefreshEnabled="True"
ItemsSource="{Binding Queries}" x:Name="list" ItemTapped="OnViewDetail" HasUnevenRows="true" RowHeight="80">
<ListView.ItemTemplate HeightRequest="80" VerticalOptions="StartAndExpand">
ItemsSource="{Binding Queries}" x:Name="list" ItemTapped="OnViewDetail" HasUnevenRows="true"
SeparatorVisibility="Default" SeparatorColor="Black">
<ListView.ItemTemplate VerticalOptions="StartAndExpand">
<DataTemplate>
<ViewCell>
<ViewCell.View>
<StackLayout Orientation="Horizontal" Padding="10,10,10,10" VerticalOptions="StartAndExpand">
<StackLayout Orientation="Vertical"
HeightRequest="80" VerticalOptions="StartAndExpand">
<StackLayout Orientation="Vertical" >
<Image Source="{Binding Client.Avatar}" />
<Label Text="{Binding Client.UserName}"
Style="{StaticResource labelStyle}"></Label>
</StackLayout>
<Label LineBreakMode="WordWrap" Text="{Binding EventDate, StringFormat='{0:dddd d MMMM à HH:mm}'}" FontSize="12" FontFamily="Italic"/>
</StackLayout>
<StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand">
<Label LineBreakMode="WordWrap" Text="{Binding Location.Address}"/>
<Label Text="{Binding Previsionnal}" />
<Label Text="{Binding Id}" HorizontalTextAlignment="End"/>
</StackLayout>
</StackLayout>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Image Grid.Row="0" Grid.Column="0" Grid.RowSpan="3" Source="{Binding Avatar}" />
<Label Grid.Row="3" Grid.Column="0" Grid.RowSpan="2" Text="{Binding Client.UserName}" Style="{StaticResource labelStyle}"></Label>
<Label Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" Grid.RowSpan="2" Text="{Binding Data.Reason}"></Label>
<Label Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" LineBreakMode="WordWrap" Text="{Binding EventDate, StringFormat='{0:dddd d MMMM à HH:mm}'}" FontFamily="Italic"/>
<Label Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2" LineBreakMode="WordWrap" Text="{Binding Location.Address}"/>
<Label Grid.Row="4" Grid.Column="1" Text="{Binding Previsionnal}" />
<Label Grid.Row="4" Grid.Column="2" Text="{Binding Id}" />
</Grid>
</ViewCell.View>
</ViewCell>
</DataTemplate>

@ -26,8 +26,8 @@ namespace BookAStar.Pages
private void OnViewDetail(object sender, ItemTappedEventArgs e)
{
BookQueryData data = e.Item as BookQueryData;
App.NavigationService.NavigateTo<BookQueryPage>(true,data);
var item = e.Item as BookQueryViewModel;
App.NavigationService.NavigateTo<BookQueryPage>(true,item);
}
}
}

@ -19,20 +19,24 @@
<StackLayout x:Name="bookQueryLayout">
<StackLayout Orientation="Vertical">
<Image Source="{Binding Client.AvatarOrNot}" Aspect="AspectFit" VisualElement.HeightRequest="{StaticResource BigUserAvatarSize}"/>
<Image Source="{Binding Avatar}" Aspect="AspectFit" VisualElement.HeightRequest="{StaticResource BigUserAvatarSize}"/>
<Label Text="{Binding Client.UserName}" />
<Label Text="{Binding EventDate, StringFormat='le {0:dddd d MMMM yyyy à hh:mm}'}" />
<Label Text="{Binding Data.Reason}" />
<Label Text="{Binding Location.Address}" />
<Label Text="{Binding Previsional}" />
</StackLayout>
<StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" >
<maps:Map x:Name="map" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"></maps:Map>
<StackLayout Orientation="Horizontal">
<Button Text="{x:Static local:Strings.ViewEstimate}"
<Button Text="{Binding EditEstimateButtonText}" Clicked="OnEditEstimate" />
<Button Text="{x:Static local:Strings.DeclineQuery}" Clicked="OnDropQuery" />
<Button Text="{x:Static local:Strings.BlockThisUser}" Clicked="OnBlockThisUser" />
<Button Text="{x:Static local:Strings.ViewEstimate}"
BorderRadius="50" BorderWidth="2" BorderColor="Aqua" x:Name ="btn"
IsEnabled="{Binding EstimationDone}"
VisualElement.IsVisible="{Binding EstimationDone}"
Clicked="OnViewEstimate" Image="exclam.png" />
<Button Text="{Binding EditEstimateButtonText}" Clicked="OnEditEstimate" />
</StackLayout>
</StackLayout>
</StackLayout>

@ -47,14 +47,14 @@ namespace BookAStar.Pages
{
InitializeComponent();
}
public BookQueryPage(BookQueryData bookQuery=null)
public BookQueryPage(BookQueryViewModel bookQuery =null)
{
InitializeComponent();
// when TODO update?
// Task.Run( async () => { bookQuery = await App.CurrentApp.DataManager.BookQueries.Get(bookQueryId); });
BindingContext = new BookQueryViewModel(bookQuery);
BindingContext = bookQuery;
}
private void OnEditEstimate(object sender, EventArgs ev)
@ -112,5 +112,13 @@ namespace BookAStar.Pages
}
base.OnSizeAllocated(width, height);
}
private void OnBlockThisUser(object sender, EventArgs ev)
{
throw new NotImplementedException();
}
private void OnDropQuery(object sender, EventArgs ev)
{
throw new NotImplementedException();
}
}
}

@ -3,7 +3,7 @@
xmlns:local="clr-namespace:BookAStar;assembly=BookAStar"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="BookAStar.Pages.UserProfile.AccountChooserPage"
Title="Paramètres Booking star" Style="{StaticResource PageStyle}"
Title="{x:Static local:Strings.UserAccounts}" Style="{StaticResource PageStyle}"
xmlns:lc="clr-namespace:XLabs.Forms.Controls;assembly=XLabs.Forms"
xmlns:lb="clr-namespace:XLabs.Forms.Behaviors;assembly=XLabs.Forms">
@ -20,17 +20,18 @@
</StackLayout>
</ListView.Header>
<ListView.ItemTemplate HeightRequest="60" VerticalOptions="StartAndExpand">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid Padding="5"
ColumnSpacing="10"
RowSpacing="2" >
<Image Source="{Binding AvatarSource}" HeightRequest="80"
x:Name="avatarImage"/>
<Label Grid.Column="0" Text="{Binding UserName}" >
<Image Grid.Column="0" Source="{Binding AvatarSource}" HeightRequest="80" />
<Label Grid.Column="1" Text="{Binding UserName}" >
</Label>
<Label Grid.Column="2" Text="{Binding EMails.ToString()}" />
<Label Grid.Column="3" Text="{Binding Roles.ToString()}" />
<Label Grid.Column="4" Text="{Binding Address}" />
</Grid>
</ViewCell>
</DataTemplate>

@ -44,8 +44,8 @@
<Label Text="{x:Static local:Strings.Profprof}" Style="{StaticResource LabelStyle}"/>
<views:RatingView Rating="{Binding Rating, Mode=TwoWay}" x:Name="ratingView" />
<StackLayout Orientation="Horizontal" VerticalOptions="Start">
<Label Text="Ne recevoir de demande de devis que de la part de professionnels uniquement" />
<Switch HorizontalOptions="End" IsToggled="{Binding AllowProBookingOnly, Mode=TwoWay}"/>
<Label Text="{x:Static local:Strings.ClientProRequest}" />
<Switch HorizontalOptions="End" IsToggled="{Binding AllowProBookingOnly, Mode=TwoWay}" />
</StackLayout>
</StackLayout>
</StackLayout>

@ -70,6 +70,15 @@ namespace BookAStar {
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Bloquer cet utilisateur.
/// </summary>
public static string BlockThisUser {
get {
return ResourceManager.GetString("BlockThisUser", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Annuler la validation.
/// </summary>
@ -79,6 +88,15 @@ namespace BookAStar {
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Restreindre la demande aux clients professionnels.
/// </summary>
public static string ClientProRequest {
get {
return ResourceManager.GetString("ClientProRequest", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à La création a échoué, contenu envoyé: {stringContent} @ Uri: {ControllerUri.AbsoluteUri}: Erreur : {errcontent}.
/// </summary>
@ -88,6 +106,15 @@ namespace BookAStar {
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Décliner cette proposition (envoyer un refus, et archiver la demande).
/// </summary>
public static string DeclineQuery {
get {
return ResourceManager.GetString("DeclineQuery", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Faire un devis.
/// </summary>
@ -268,6 +295,15 @@ namespace BookAStar {
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Comptes utilisateur.
/// </summary>
public static string UserAccounts {
get {
return ResourceManager.GetString("UserAccounts", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Voir les devis validés.
/// </summary>

@ -197,4 +197,16 @@
<data name="Profprof" xml:space="preserve">
<value>Profile professionnel</value>
</data>
<data name="ClientProRequest" xml:space="preserve">
<value>Restreindre la demande aux clients professionnels</value>
</data>
<data name="UserAccounts" xml:space="preserve">
<value>Comptes utilisateur</value>
</data>
<data name="BlockThisUser" xml:space="preserve">
<value>Bloquer cet utilisateur</value>
</data>
<data name="DeclineQuery" xml:space="preserve">
<value>Décliner cette proposition (envoyer un refus, et archiver la demande)</value>
</data>
</root>

@ -5,18 +5,24 @@ namespace BookAStar.ViewModels.EstimateAndBilling
{
using Data;
using Model;
using System.Linq;
public class BookQueriesViewModel : XLabs.Forms.Mvvm.ViewModel
{
public BookQueriesViewModel()
{
queries = new ObservableCollection<BookQueryViewModel>
(DataManager.Current.BookQueries.Select(
q =>
new BookQueryViewModel(q)));
}
private ObservableCollection<BookQueryViewModel> queries;
public ObservableCollection<BookQueryData> Queries
public ObservableCollection<BookQueryViewModel> Queries
{
get
{
return DataManager.Current.BookQueries;
return queries;
}
}

@ -6,14 +6,16 @@ using XLabs.Forms.Mvvm;
namespace BookAStar.ViewModels.EstimateAndBilling
{
using Data;
using Helpers;
using Interfaces;
using Model;
using Model.Social;
using Model.Workflow;
using System.Collections.ObjectModel;
using System.Linq;
using Xamarin.Forms;
class BookQueryViewModel : ViewModel, IBookQueryData
public class BookQueryViewModel : ViewModel, IBookQueryData
{
public BookQueryViewModel()
{
@ -41,6 +43,20 @@ namespace BookAStar.ViewModels.EstimateAndBilling
}
}
public ClientProviderInfo Client { get; set; }
public ImageSource Avatar
{
get
{
return UserHelpers.Avatar(Client.Avatar);
}
}
public ImageSource SmallAvatar
{
get
{
return UserHelpers.SmallAvatar(Client.Avatar, Client.UserName);
}
}
public Location Location { get; set; }
public long Id { get; set; }
public DateTime EventDate { get; set; }

@ -53,5 +53,23 @@ namespace BookAStar.ViewModels.Messaging
return UserHelpers.Avatar(Data.Avatar);
}
}
[JsonIgnore]
public ImageSource SmallAvatar
{
get
{
return UserHelpers.SmallAvatar(Data.Avatar, Data.UserName);
}
}
[JsonIgnore]
public ImageSource ExtraSmallAvatar
{
get
{
return UserHelpers.ExtraSmallAvatar(Data.Avatar, Data.UserName);
}
}
}
}

Loading…