Fixes the estimation total
This commit is contained in:
parent
2b02d8c01a
commit
59daaaef53
9 changed files with 54 additions and 47 deletions
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
|
||||
<Color x:Key="BackgroundColor">#30AAAAFA</Color>
|
||||
<Color x:Key="LabelBackgroundColor">#30FAFAFA</Color>
|
||||
<Color x:Key="OddColor">#207AFAFA</Color>
|
||||
<Color x:Key="TextColor">#FF103010</Color>
|
||||
<Color x:Key="LabelColor">#FF303010</Color>
|
||||
|
|
@ -44,8 +45,11 @@
|
|||
</Style>
|
||||
|
||||
<Style x:Key="LabelStyle" TargetType="Label">
|
||||
<Setter Property="TextColor" Value="{StaticResource TextColor}" />
|
||||
<Setter Property="TextColor" Value="{StaticResource LabelColor}" />
|
||||
<Setter Property="BackgroundColor" Value="{StaticResource LabelBackgroundColor}" />
|
||||
|
||||
<Setter Property="LineBreakMode" Value="WordWrap" />
|
||||
<Setter Property="Margin" Value="2,4,2,4" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="BigLabel" BasedOn="{StaticResource LabelStyle}" TargetType="Label">
|
||||
|
|
@ -73,8 +77,8 @@
|
|||
<Setter Property="HorizontalOptions" Value="Center" />
|
||||
<Setter Property="VerticalOptions" Value="CenterAndExpand" />
|
||||
<Setter Property="BorderColor" Value="Lime" />
|
||||
<Setter Property="BorderRadius" Value="5" />
|
||||
<Setter Property="BorderWidth" Value="5" />
|
||||
<Setter Property="BorderRadius" Value="15" />
|
||||
<Setter Property="BorderWidth" Value="10" />
|
||||
<Setter Property="WidthRequest" Value="200" />
|
||||
<Setter Property="TextColor" Value="Teal" />
|
||||
</Style>
|
||||
|
|
@ -83,6 +87,8 @@
|
|||
<Setter Property="Padding" Value="5,5,5,5" />
|
||||
<Setter Property="BackgroundColor" Value="{StaticResource PageBackgroundColor}" />
|
||||
</Style>
|
||||
|
||||
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
|
|
@ -10,7 +10,9 @@ namespace BookAStar
|
|||
public class LocalEntity<V, K> : ObservableCollection<V>, ILocalEntity<V, K> where K : IEquatable<K>
|
||||
{
|
||||
public V CurrentItem { get; protected set; }
|
||||
|
||||
public Func<V, K> GetKey { get; set; }
|
||||
|
||||
public LocalEntity(Func<V, K> getKey) : base()
|
||||
{
|
||||
if (getKey == null) throw new InvalidOperationException();
|
||||
|
|
@ -28,6 +30,7 @@ namespace BookAStar
|
|||
Add(item);
|
||||
CurrentItem = item;
|
||||
}
|
||||
|
||||
public V LocalGet(K key)
|
||||
{
|
||||
CurrentItem = this.Single(x => GetKey(x).Equals(key));
|
||||
|
|
@ -38,6 +41,11 @@ namespace BookAStar
|
|||
{
|
||||
this.Populate<V>();
|
||||
}
|
||||
|
||||
public void Load(string subKey)
|
||||
{
|
||||
this.Populate<V>(subKey);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -33,7 +33,6 @@ namespace BookAStar
|
|||
#region Setting Constants
|
||||
public static readonly string SettingsDefault = string.Empty;
|
||||
public static readonly string EntityDataSettingsPrefix = "Ed";
|
||||
public static readonly string EntityCursorSettingsPrefix = "Ec";
|
||||
private const string userNameKey = "user_id";
|
||||
private const string PushNotificationsKey = "pushNotifs";
|
||||
private const string AllowGPSUsageKey = "allowGPSUsage";
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ namespace BookAStar.Model.Interfaces
|
|||
{
|
||||
public interface IEstimate
|
||||
{
|
||||
List<string> AttachedFiles { get; set; }
|
||||
List<string> AttachedGraphics { get; }
|
||||
List<BillingLine> Bill { get; set; }
|
||||
IList<string> AttachedFiles { get; set; }
|
||||
IList<string> AttachedGraphics { get; }
|
||||
IList<BillingLine> Bill { get; set; }
|
||||
string ClientId { get; set; }
|
||||
long? CommandId { get; set; }
|
||||
string CommandType { get; set; }
|
||||
|
|
|
|||
|
|
@ -7,6 +7,11 @@ namespace BookAStar
|
|||
void Load();
|
||||
}
|
||||
|
||||
public interface IPersistentOnDemand : ILoadable
|
||||
{
|
||||
void Save();
|
||||
}
|
||||
|
||||
public interface ILocalEntity<V, K> : ILoadable where K : IEquatable<K>
|
||||
{
|
||||
V CurrentItem { get; }
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace BookAStar.Model.Workflow
|
|||
public string Description { get; set; }
|
||||
public int? Status { get; set; }
|
||||
public string Title { get; set; }
|
||||
public List<BillingLine> Bill { get; set; }
|
||||
public IList<BillingLine> Bill { get; set; }
|
||||
/// <summary>
|
||||
/// List of attached graphic files
|
||||
/// to this estimate, as relative pathes to
|
||||
|
|
@ -22,7 +22,7 @@ namespace BookAStar.Model.Workflow
|
|||
/// In db, they are separated by <c>:</c>
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<string> AttachedGraphics { get; set; }
|
||||
public IList<string> AttachedGraphics { get; set; }
|
||||
|
||||
public string AttachedGraphicsString
|
||||
{
|
||||
|
|
@ -36,7 +36,7 @@ namespace BookAStar.Model.Workflow
|
|||
/// In db, they are separated by <c>:</c>
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<string> AttachedFiles { get; set; }
|
||||
public IList<string> AttachedFiles { get; set; }
|
||||
public string AttachedFilesString
|
||||
{
|
||||
get { return AttachedFiles == null ? null : string.Join(":", AttachedFiles); }
|
||||
|
|
|
|||
|
|
@ -37,8 +37,9 @@
|
|||
></views:MarkdownView>
|
||||
|
||||
|
||||
<ListView x:Name="BillListView" ItemsSource="{Binding Bill}" >
|
||||
<ListView.ItemTemplate RowHeight="20">
|
||||
<ListView x:Name="BillListView" ItemsSource="{Binding Bill}"
|
||||
VerticalOptions="End" MinimumHeightRequest="30" >
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate >
|
||||
<ViewCell>
|
||||
<ViewCell.View>
|
||||
|
|
@ -54,51 +55,20 @@
|
|||
</Grid.ColumnDefinitions>
|
||||
<Label Text="{Binding Description}"
|
||||
Grid.Row="0" Grid.Column="0" ></Label>
|
||||
<Label Text="{Binding Duration}"
|
||||
<Label Text="{Binding Duration, StringFormat=\{0\}}"
|
||||
Grid.Row="0" Grid.Column="1" ></Label>
|
||||
<Label Text="{Binding Count}"
|
||||
Grid.Row="0" Grid.Column="2" ></Label>
|
||||
<Label Text="{Binding UnitaryCost}"
|
||||
Grid.Row="0" Grid.Column="3" ></Label>
|
||||
Grid.Row="0" Grid.Column="3"
|
||||
FontFamily="Monospace"></Label>
|
||||
</Grid>
|
||||
</ViewCell.View>
|
||||
</ViewCell>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
<!--
|
||||
<ListView x:Name="BillListView" View.VerticalOptions="End"
|
||||
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height Factor=.4}"
|
||||
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}">
|
||||
<ListView.ItemTemplate RowHeight="20">
|
||||
<DataTemplate >
|
||||
<ViewCell>
|
||||
<ViewCell.View>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="30" />
|
||||
<ColumnDefinition Width="90" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Text="{Binding Description}"
|
||||
Grid.Row="0" Grid.Column="0" ></Label>
|
||||
<Label Text="{Binding Duration}"
|
||||
Grid.Row="0" Grid.Column="1" ></Label>
|
||||
<Label Text="{Binding Count}"
|
||||
Grid.Row="0" Grid.Column="2" ></Label>
|
||||
<Label Text="{Binding UnitaryCost}"
|
||||
Grid.Row="0" Grid.Column="3" ></Label>
|
||||
</Grid>
|
||||
|
||||
</ViewCell.View>
|
||||
</ViewCell>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView> -->
|
||||
|
||||
<Button Text="Ajouter une ligne de facture" Clicked="OnNewCommanLine"></Button>
|
||||
<Label FormattedText="{Binding FormattedTotal}"/>
|
||||
<Button Text="Valider ce devis"></Button>
|
||||
|
|
|
|||
|
|
@ -25,6 +25,18 @@ namespace BookAStar.Pages
|
|||
BindingContext = model;
|
||||
}
|
||||
|
||||
protected override void OnBindingContextChanged()
|
||||
{
|
||||
base.OnBindingContextChanged();
|
||||
((EditEstimateViewModel)BindingContext).PropertyChanged += EditEstimatePage_PropertyChanged;
|
||||
|
||||
}
|
||||
|
||||
private void EditEstimatePage_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected void OnNewCommanLine(object sender, EventArgs e)
|
||||
{
|
||||
var com = new BillingLine() { Count = 1, UnitaryCost = 0.01m };
|
||||
|
|
|
|||
|
|
@ -18,6 +18,13 @@ namespace BookAStar.ViewModels
|
|||
AttachedFiles = new ObservableCollection<string>(data.AttachedFiles);
|
||||
AttachedGraphicList = new ObservableCollection<string>(data.AttachedGraphics);
|
||||
Bill = new ObservableCollection<BillingLine>(data.Bill);
|
||||
Bill.CollectionChanged += Bill_CollectionChanged;
|
||||
}
|
||||
|
||||
private void Bill_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
Data.Bill = Bill;
|
||||
NotifyPropertyChanged("FormattedTotal");
|
||||
}
|
||||
|
||||
public Estimate Data { get; protected set; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue