Skip to content

Commit

Permalink
AllYourRequest actualizado, no completo #52
Browse files Browse the repository at this point in the history
  • Loading branch information
AcabreraT committed Dec 4, 2017
1 parent df86f32 commit 6f4a533
Show file tree
Hide file tree
Showing 9 changed files with 145 additions and 198 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ public class RequestModel
public string RequestComments { get; set; }
public AddressModel RequestAddress { get; set; }


public string RequestTimeStamp { get; set; }
public RequestModel()
{

}

public RequestModel(RequestType RequestType,string RequestLocation, string RequestDate, string RequestTime, string RequestComments, AddressModel RequestAddress)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Xamarin.Forms.GoogleMaps;
using System.Threading.Tasks;
using AeccApp.Core.Services;
using System.Collections.Generic;

namespace AeccApp.Core.ViewModels
{
Expand All @@ -23,26 +24,29 @@ public override Task ActivateAsync()
{
return ExecuteOperationAsync(async () =>
{
HomeRequestsList = new List<RequestModel>();
HospitalRequestsList = new List<RequestModel>();
var HomeRequests = await HomeRequestsDataService.GetListAsync();
HomeRequestsList.AddRange(HomeRequests);
var HospitalRequest = await HospitalRequestDataService.GetListAsync();
HospitalRequestsList.AddRange(HospitalRequest);
if (HomeRequestsList.Count == 0)
{
IsHomeRequestsListEmpty = true;
}
if (HospitalRequestsList.Count == 0)
{
IsHospitalRequestsListEmpty = true;
}
int i = 0;
});
}

public override Task InitializeAsync(object navigationData)
{
if (HomeRequestsList.Count == 0)
{
IsHomeRequestsListEmpty = true;
}
if (HospitalRequestsList.Count == 0)
{
IsHospitalRequestsListEmpty = true;
}

return Task.CompletedTask;
}


#endregion

#region Commands
Expand All @@ -61,10 +65,6 @@ public ICommand HospitalTabCommand
void OnHospitalTabCommand(object obj)
{
SwitchHomeAndHospitalList = true;
RequestModel mockRequest = new RequestModel(new RequestType() { Name = "tipo" }, "location", "fecha", "hora", "comentarios", new AddressModel("Hospital rey Juan Carlos", "Fake street", "Madrid", "123", "1a", "", new Position(0, 0)));
HospitalRequestsList.Add(mockRequest);


}
private Command _homeTabCommand;
public ICommand HomeTabCommand
Expand All @@ -79,29 +79,8 @@ public ICommand HomeTabCommand
void OnHomeTabCommand(object obj)
{
SwitchHomeAndHospitalList = false;

RequestModel mockRequest = new RequestModel(new RequestType() { Name = "tipo" }, "location", "fecha", "hora", "comentarios", new AddressModel("Mi casa", "Fake street", "Madrid", "123", "1a", "", new Position(0, 0)));
HomeRequestsList.Add(mockRequest);
}



private Command _applyFiltersCommand;
public ICommand ApplyFiltersCommand
{
get
{
return _applyFiltersCommand ??
(_applyFiltersCommand = new Command(OnApplyFiltersCommand, o => !IsBusy));
}
}

void OnApplyFiltersCommand(object obj)
{
//TODO Apply home requests filters
//TimeToFilterWith
//DateToFilterWith
}


private Command _newRequestCommand;
public ICommand NewRequestCommand
Expand All @@ -120,7 +99,6 @@ async void OnNewRequestCommand(object obj)

}


#endregion

#region Properties
Expand All @@ -140,42 +118,22 @@ public bool IsHospitalRequestsListEmpty
set { Set(ref _isHospitalRequestsListEmpty, value); }
}

private List<RequestModel> _homeRequestsList;


private ObservableCollection<RequestModel> _homeRequestsList = new ObservableCollection<RequestModel>();

public ObservableCollection<RequestModel> HomeRequestsList
public List<RequestModel> HomeRequestsList
{
get { return _homeRequestsList; }
set { Set(ref _homeRequestsList, value); }
}
private ObservableCollection<RequestModel> _hospitalRequestsList = new ObservableCollection<RequestModel>();
private List<RequestModel> _hospitalRequestsList;

public ObservableCollection<RequestModel> HospitalRequestsList
public List<RequestModel> HospitalRequestsList
{
get { return _hospitalRequestsList; }
set { Set(ref _hospitalRequestsList, value); }
}


private DateTime _dateToFilterWith = DateTime.Now;

public DateTime DateToFilterWith
{
get { return _dateToFilterWith; }
set { Set(ref _dateToFilterWith, value); }
}


private TimeSpan _timeToFilterWith = new TimeSpan(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second);

public TimeSpan TimeToFilterWith
{
get { return _timeToFilterWith; }
set { Set(ref _timeToFilterWith, value); }
}


private bool _switchHomeAndHospitalList;

public bool SwitchHomeAndHospitalList
Expand All @@ -188,9 +146,7 @@ public bool SwitchHomeAndHospitalList

#endregion

#region Methods

#endregion


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ private async void OnSendRequestConfirmationCommand(object sender, EventArgs e)
CurrentRequest.RequestDate = DateToApplyParsed;
CurrentRequest.RequestTime = TimeToApplyParsed;
//TODO #33 Send request with email service
CurrentRequest.RequestTimeStamp = new TimeSpan(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second).ToString().Remove(5);

await HomeRequestsDataService.InsertOrUpdateAsync(CurrentRequest);
await NavigationService.HidePopupAsync();
await NavigationService.ShowPopupAsync(RequestSentPopupVM);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ private async void OnSendRequestConfirmationCommand(object sender, EventArgs e)
CurrentRequest.RequestComments = RequestComments;
CurrentRequest.RequestDate = DateToApplyParsed;
CurrentRequest.RequestTime = TimeToApplyParsed;

CurrentRequest.RequestTimeStamp = new TimeSpan(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second).ToString().Remove(5);

if (IsAddressGettingSaved)
{
CurrentRequest.RequestAddress.IsHospitalAddress = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,54 +23,27 @@
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>



<Label
Grid.Row="0"
Grid.Column="0"
Text="{Binding RequestType}">
<Label.Margin>
<OnPlatform x:TypeArguments="Thickness">
<On Platform="WinPhone, Windows" Value="50,15,0,5" />
<On Platform="iOS" Value="35,15,0,5" />
<On Platform="Android" Value="55,15,0,5" />
</OnPlatform>
</Label.Margin>

</Label>
Text="{Binding RequestType.Name}" />
<Label
Grid.Row="0"
Grid.Column="1"
HorizontalOptions="End"
Text="{Binding RequestDate}">
<Label.Margin>
<OnPlatform x:TypeArguments="Thickness">
<On Platform="WinPhone, Windows" Value="100,15,15,5" />
<On Platform="iOS" Value="70,15,15,5" />
<On Platform="Android" Value="100,15,15,5" />
</OnPlatform>
</Label.Margin>
</Label>

Text="{Binding RequestDate}" />

<Label
Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2"
Text="{Binding RequestAddress.DisplayAddress}">

<Label.Margin>
<OnPlatform x:TypeArguments="Thickness">
<On Platform="WinPhone, Windows" Value="50,15,0,5" />
<On Platform="iOS" Value="35,15,0,5" />
<On Platform="Android" Value="55,15,0,5" />
</OnPlatform>
</Label.Margin>


</Label>
Text="{Binding RequestAddress.DisplayAddress}" />
<BoxView
Grid.Row="2"
HorizontalOptions="FillAndExpand"
Color="LightGray" />
</Grid>
</ViewCell>
</DataTemplate>
Expand All @@ -83,8 +56,8 @@

<!-- Sub navigation bar with home and hospital tabs -->
<StackLayout
BackgroundColor="Gray"
HeightRequest="100"
BackgroundColor="{StaticResource AccentColor}"
HeightRequest="56"
HorizontalOptions="FillAndExpand">
<Grid HorizontalOptions="Center">
<Grid.ColumnDefinitions>
Expand All @@ -104,15 +77,15 @@
<OnPlatform x:TypeArguments="Thickness">
<On Platform="WinPhone, Windows" Value="0" />
<On Platform="iOS" Value="0,15,25,15" />
<On Platform="Android" Value="0,15,25,15" />
<On Platform="Android" Value="0,15,100,15" />
</OnPlatform>
</StackLayout.Margin>

<ctrl:CustomImage
HeightRequest="50"
SourcePlatform="bell"
HeightRequest="25"
SourcePlatform="ico_house"
VerticalOptions="Center"
WidthRequest="50" />
WidthRequest="25" />
<Label
FontSize="{StaticResource MediumSize}"
Text="{Binding [AllYourRequestsHome]}"
Expand All @@ -134,10 +107,10 @@
</OnPlatform>
</StackLayout.Margin>
<ctrl:CustomImage
HeightRequest="50"
SourcePlatform="bell"
HeightRequest="25"
SourcePlatform="ico_hospital"
VerticalOptions="Center"
WidthRequest="50" />
WidthRequest="25" />
<Label
FontSize="{StaticResource MediumSize}"
Text="{Binding [AllYourRequestsHospital]}"
Expand Down
6 changes: 6 additions & 0 deletions src/Mobile/AeccApp/AeccApp.Droid/AeccApp.Droid.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -282,5 +282,11 @@
<ItemGroup>
<AndroidResource Include="Resources\drawable\ico_first_request.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\ico_hospital.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\ico_house.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
</Project>
Loading

0 comments on commit 6f4a533

Please sign in to comment.