WIP estimate
This commit is contained in:
@ -63,4 +63,8 @@
|
|||||||
<uses-permission android:name="android.permission.PERSISTENT_ACTIVITY" />
|
<uses-permission android:name="android.permission.PERSISTENT_ACTIVITY" />
|
||||||
<uses-permission android:name="android.permission.READ_CONTACTS" />
|
<uses-permission android:name="android.permission.READ_CONTACTS" />
|
||||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||||
|
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||||
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
|
<uses-permission android:name="android.permission.WRITE_SOCIAL_STREAM" />
|
||||||
</manifest>
|
</manifest>
|
@ -258,11 +258,12 @@ namespace BookAStar
|
|||||||
masterDetail.ToolbarItems.Add(tiSetts);
|
masterDetail.ToolbarItems.Add(tiSetts);
|
||||||
masterDetail.ToolbarItems.Add(tiPubChat);
|
masterDetail.ToolbarItems.Add(tiPubChat);
|
||||||
this.MainPage = masterDetail;
|
this.MainPage = masterDetail;
|
||||||
|
|
||||||
NavigationService = new NavigationService(masterDetail.Detail.Navigation);
|
NavigationService = new NavigationService(masterDetail.Detail.Navigation);
|
||||||
}
|
}
|
||||||
public static Task<string> DisplayActionSheet(string title, string cancel, string destruction, string [] buttons)
|
public static Task<string> DisplayActionSheet(string title, string cancel, string destruction, string [] buttons)
|
||||||
{
|
{
|
||||||
var currentPage = ((NavigationPage)Current.MainPage).CurrentPage;
|
var currentPage = CurrentApp.masterDetail.Detail.Navigation.NavigationStack.Last();
|
||||||
return currentPage.DisplayActionSheet(title, cancel, destruction, buttons);
|
return currentPage.DisplayActionSheet(title, cancel, destruction, buttons);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,9 +29,9 @@
|
|||||||
<maps:Map x:Name="map" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"></maps:Map>
|
<maps:Map x:Name="map" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"></maps:Map>
|
||||||
<StackLayout Orientation="Horizontal">
|
<StackLayout Orientation="Horizontal">
|
||||||
<Button Text="{x:Static local:Strings.ViewEstimate}"
|
<Button Text="{x:Static local:Strings.ViewEstimate}"
|
||||||
BorderRadius="10" BorderWidth="2" BorderColor="Aqua" x:Name ="btn"
|
BorderRadius="50" BorderWidth="2" BorderColor="Aqua" x:Name ="btn"
|
||||||
IsEnabled="{Binding EstimationDone}"
|
IsEnabled="{Binding EstimationDone}"
|
||||||
Clicked="OnViewEstimate" Image="exclam.png"/>
|
Clicked="OnViewEstimate" Image="exclam.png" />
|
||||||
<Button Text="{Binding EditEstimateButtonText}" Clicked="OnEditEstimate" />
|
<Button Text="{Binding EditEstimateButtonText}" Clicked="OnEditEstimate" />
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
|
@ -92,11 +92,18 @@ namespace BookAStar.Pages
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnViewEstimate(object sender, EventArgs ev)
|
private async void OnViewEstimate(object sender, EventArgs ev)
|
||||||
{
|
{
|
||||||
var bookQueryViewModel = (BookQueryViewModel) BindingContext;
|
var bookQueryViewModel = (BookQueryViewModel) BindingContext;
|
||||||
App.NavigationService.NavigateTo<ViewEstimatePage>(true,
|
var buttons = bookQueryViewModel.Estimates.Select(e => $"{e.Id} / {e.Title} / {e.Total}").ToArray();
|
||||||
new EditEstimateViewModel(bookQueryViewModel.Estimate));
|
var action = await App.DisplayActionSheet("Estimations validées", "Annuler", null, buttons);
|
||||||
|
if (buttons.Contains(action))
|
||||||
|
{
|
||||||
|
var index = Array.IndexOf(buttons,action);
|
||||||
|
var estimate = bookQueryViewModel.Estimates[index];
|
||||||
|
App.NavigationService.NavigateTo<ViewEstimatePage>(true,
|
||||||
|
new EditEstimateViewModel(estimate));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnSizeAllocated(double width, double height)
|
protected override void OnSizeAllocated(double width, double height)
|
||||||
|
@ -102,12 +102,12 @@
|
|||||||
Converter={StaticResource boolToStyleImage}}" />
|
Converter={StaticResource boolToStyleImage}}" />
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<StackLayout Orientation="Horizontal">
|
<StackLayout Orientation="Horizontal">
|
||||||
<Button Text="Supprimer"
|
|
||||||
Command="{Binding DeleteCommand}"
|
|
||||||
Clicked="OnDeleteClicked"></Button>
|
|
||||||
<Button Text="Términé"
|
<Button Text="Términé"
|
||||||
Command="{Binding ValidateCommand}"
|
Command="{Binding ValidateCommand}"
|
||||||
Clicked="OnValidateClicked"></Button>
|
Clicked="OnValidateClicked"></Button>
|
||||||
|
<Button Text="Supprimer"
|
||||||
|
Command="{Binding DeleteCommand}"
|
||||||
|
Clicked="OnDeleteClicked"></Button>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
@ -49,6 +49,7 @@ namespace BookAStar.Pages
|
|||||||
bill.Add(com);
|
bill.Add(com);
|
||||||
DataManager.Current.EstimationCache.SaveEntity();
|
DataManager.Current.EstimationCache.SaveEntity();
|
||||||
})};
|
})};
|
||||||
|
lineView.PropertyChanged += LineView_PropertyChanged;
|
||||||
App.NavigationService.NavigateTo<EditBillingLinePage>(
|
App.NavigationService.NavigateTo<EditBillingLinePage>(
|
||||||
true, lineView );
|
true, lineView );
|
||||||
}
|
}
|
||||||
@ -62,11 +63,14 @@ namespace BookAStar.Pages
|
|||||||
DataManager.Current.EstimationCache.SaveEntity();
|
DataManager.Current.EstimationCache.SaveEntity();
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
lineView.PropertyChanged += LineView_PropertyChanged;
|
||||||
|
|
||||||
lineView.PropertyChanged += LineView_PropertyChanged;
|
lineView.PropertyChanged += LineView_PropertyChanged;
|
||||||
App.NavigationService.NavigateTo<EditBillingLinePage>(
|
App.NavigationService.NavigateTo<EditBillingLinePage>(
|
||||||
true, lineView );
|
true, lineView );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void LineView_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
private void LineView_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||||
{
|
{
|
||||||
DataManager.Current.EstimationCache.SaveEntity();
|
DataManager.Current.EstimationCache.SaveEntity();
|
||||||
|
@ -10,6 +10,7 @@ namespace BookAStar.ViewModels.EstimateAndBilling
|
|||||||
using Model;
|
using Model;
|
||||||
using Model.Social;
|
using Model.Social;
|
||||||
using Model.Workflow;
|
using Model.Workflow;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
class BookQueryViewModel : ViewModel, IBookQueryData
|
class BookQueryViewModel : ViewModel, IBookQueryData
|
||||||
@ -26,6 +27,10 @@ namespace BookAStar.ViewModels.EstimateAndBilling
|
|||||||
EventDate = data.EventDate;
|
EventDate = data.EventDate;
|
||||||
Previsionnal = data.Previsionnal;
|
Previsionnal = data.Previsionnal;
|
||||||
Id = data.Id;
|
Id = data.Id;
|
||||||
|
estimates = new ObservableCollection<Estimate>(
|
||||||
|
DataManager.Current.Estimates.Where(
|
||||||
|
e => e.Query.Id == Id
|
||||||
|
));
|
||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
private BookQueryData data;
|
private BookQueryData data;
|
||||||
@ -47,19 +52,17 @@ namespace BookAStar.ViewModels.EstimateAndBilling
|
|||||||
return DataManager.Current.EstimationCache.LocalGet(this.Id);
|
return DataManager.Current.EstimationCache.LocalGet(this.Id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public Estimate Estimate { get
|
private ObservableCollection<Estimate> estimates;
|
||||||
{
|
public ObservableCollection<Estimate> Estimates {
|
||||||
return DataManager.Current.Estimates.FirstOrDefault(
|
get {
|
||||||
e=>e.Query.Id == Id
|
return estimates;
|
||||||
);
|
|
||||||
} }
|
} }
|
||||||
|
|
||||||
|
|
||||||
public bool EstimationDone
|
public bool EstimationDone
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Estimate != null;
|
return Estimates != null && Estimates.Count>0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,10 +32,11 @@ namespace BookAStar.ViewModels.EstimateAndBilling
|
|||||||
{
|
{
|
||||||
Data.Bill = new List<BillingLine>( Bill );
|
Data.Bill = new List<BillingLine>( Bill );
|
||||||
NotifyPropertyChanged("FormattedTotal");
|
NotifyPropertyChanged("FormattedTotal");
|
||||||
|
NotifyPropertyChanged("Bill");
|
||||||
}
|
}
|
||||||
private Estimate data;
|
private Estimate data;
|
||||||
public Estimate Data { get { return data; } set {
|
public Estimate Data { get { return data; } set {
|
||||||
data = value;
|
SetProperty<Estimate>(ref data, value);
|
||||||
if (data.AttachedFiles == null) data.AttachedFiles = new List<string>();
|
if (data.AttachedFiles == null) data.AttachedFiles = new List<string>();
|
||||||
if (data.AttachedGraphics == null) data.AttachedGraphics = new List<string>();
|
if (data.AttachedGraphics == null) data.AttachedGraphics = new List<string>();
|
||||||
if (data.Bill == null) data.Bill = new List<BillingLine>();
|
if (data.Bill == null) data.Bill = new List<BillingLine>();
|
||||||
@ -43,6 +44,11 @@ namespace BookAStar.ViewModels.EstimateAndBilling
|
|||||||
AttachedGraphicList = new ObservableCollection<string>(data.AttachedGraphics);
|
AttachedGraphicList = new ObservableCollection<string>(data.AttachedGraphics);
|
||||||
Bill = new ObservableCollection<BillingLine>(data.Bill);
|
Bill = new ObservableCollection<BillingLine>(data.Bill);
|
||||||
Bill.CollectionChanged += Bill_CollectionChanged;
|
Bill.CollectionChanged += Bill_CollectionChanged;
|
||||||
|
Title = Data.Title;
|
||||||
|
Description = Data.Description;
|
||||||
|
NotifyPropertyChanged("FormattedTotal");
|
||||||
|
NotifyPropertyChanged("Query");
|
||||||
|
NotifyPropertyChanged("CLient");
|
||||||
} }
|
} }
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
|
Reference in New Issue
Block a user