Jóváhagyás gomb MOBIL-on
This commit is contained in:
@@ -85,6 +85,17 @@
|
||||
Command="{Binding BindingContext.UnblockCommand, Source={x:Reference CheckList}}"
|
||||
CommandParameter="{Binding .}">
|
||||
</Button>
|
||||
<Button Text="Jóváhagyás"
|
||||
Margin="5,0,0,0"
|
||||
BackgroundColor="DarkGreen"
|
||||
HeightRequest="50"
|
||||
MaximumHeightRequest="50"
|
||||
WidthRequest="120"
|
||||
MaximumWidthRequest="120"
|
||||
IsVisible="{Binding CheckStatus, Converter={StaticResource AcceptConverter}}"
|
||||
Command="{Binding BindingContext.AcceptCommand, Source={x:Reference CheckList}}"
|
||||
CommandParameter="{Binding .}">
|
||||
</Button>
|
||||
<Button Text="Folytatás"
|
||||
Margin="5,0,0,0"
|
||||
BackgroundColor="Blue"
|
||||
|
||||
@@ -23,6 +23,7 @@ public partial class CheckListPage : ContentPage
|
||||
public ICommand ContinueCommand { get; set; }
|
||||
public ICommand UnblockCommand { get; set; }
|
||||
public ICommand BlockCommand { get; set; }
|
||||
public ICommand AcceptCommand { get; set; }
|
||||
public bool IsLoading
|
||||
{
|
||||
get => _isLoading;
|
||||
@@ -44,6 +45,7 @@ public partial class CheckListPage : ContentPage
|
||||
ContinueCommand = new Command<CheckListHeaderDTO>(OnContinueItem);
|
||||
UnblockCommand = new Command<CheckListHeaderDTO>(OnUnblockItem);
|
||||
BlockCommand = new Command<CheckListHeaderDTO>(OnBlockItem);
|
||||
AcceptCommand = new Command<CheckListHeaderDTO>(OnAcceptItem);
|
||||
|
||||
}
|
||||
private void SetInfo()
|
||||
@@ -146,6 +148,15 @@ public partial class CheckListPage : ContentPage
|
||||
await LoadCheckList();
|
||||
}
|
||||
}
|
||||
private async void OnAcceptItem(CheckListHeaderDTO checkListHeaderDTO)
|
||||
{
|
||||
bool answer = await DisplayAlert("Megerõsítés", "Biztosan jóváhagyod a folyamatot?", "Igen", "Mégsem");
|
||||
if (answer)
|
||||
{
|
||||
await _checkListService.AcceptCheckListHeader(checkListHeaderDTO);
|
||||
await LoadCheckList();
|
||||
}
|
||||
}
|
||||
private async Task LoadCheckListTemplate()
|
||||
{
|
||||
IsLoading = true;
|
||||
@@ -233,6 +244,26 @@ public class ContinueConverter : IValueConverter
|
||||
return false;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
public class AcceptConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is CheckStatus status)
|
||||
{
|
||||
if (status == CheckStatus.Sent)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
@@ -178,6 +178,37 @@ namespace WorkFlowCheck.MAUI.Services
|
||||
}
|
||||
|
||||
public async Task<bool> UnBlockCheckListHeader(CheckListHeaderDTO checkListHeaderDTO)
|
||||
{
|
||||
var retVal = false;
|
||||
try
|
||||
{
|
||||
var checkListHeader = await _dbContext.CheckListHeaders
|
||||
.Where(w => w.Id == checkListHeaderDTO.Id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (checkListHeader != null)
|
||||
{
|
||||
var userDTO = _userService.GetCurrentUser();
|
||||
var endpoint = $"{_httpClient.BaseAddress}api/CheckList/BlockCheckListHeader/{checkListHeaderDTO.Id}/{userDTO.Id}";
|
||||
var response = await _httpClient.GetFromJsonAsync<ApiResponseDTO<bool>>(endpoint);
|
||||
if (response != null)
|
||||
{
|
||||
if (response.IsSuccess)
|
||||
{
|
||||
checkListHeader.CheckStatus = CheckStatus.InProgress;
|
||||
await _dbContext.SaveChangesAsync();
|
||||
retVal = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
public async Task<bool> BlockCheckListHeader(CheckListHeaderDTO checkListHeaderDTO)
|
||||
{
|
||||
var retVal = false;
|
||||
try
|
||||
@@ -208,7 +239,36 @@ namespace WorkFlowCheck.MAUI.Services
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
public async Task<bool> BlockCheckListHeader(CheckListHeaderDTO checkListHeaderDTO) => throw new NotImplementedException();
|
||||
public async Task<bool> AcceptCheckListHeader(CheckListHeaderDTO checkListHeaderDTO) => throw new NotImplementedException();
|
||||
public async Task<bool> AcceptCheckListHeader(CheckListHeaderDTO checkListHeaderDTO)
|
||||
{
|
||||
var retVal = false;
|
||||
try
|
||||
{
|
||||
var checkListHeader = await _dbContext.CheckListHeaders
|
||||
.Where(w => w.Id == checkListHeaderDTO.Id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (checkListHeader != null)
|
||||
{
|
||||
var userDTO = _userService.GetCurrentUser();
|
||||
var endpoint = $"{_httpClient.BaseAddress}api/CheckList/AcceptCheckListHeader/{checkListHeaderDTO.Id}/{userDTO.Id}";
|
||||
var response = await _httpClient.GetFromJsonAsync<ApiResponseDTO<bool>>(endpoint);
|
||||
if (response != null)
|
||||
{
|
||||
if (response.IsSuccess)
|
||||
{
|
||||
checkListHeader.CheckStatus = CheckStatus.InProgress;
|
||||
await _dbContext.SaveChangesAsync();
|
||||
retVal = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user