Jóváhagyás gomb MOBIL-on
This commit is contained in:
@@ -85,6 +85,17 @@
|
|||||||
Command="{Binding BindingContext.UnblockCommand, Source={x:Reference CheckList}}"
|
Command="{Binding BindingContext.UnblockCommand, Source={x:Reference CheckList}}"
|
||||||
CommandParameter="{Binding .}">
|
CommandParameter="{Binding .}">
|
||||||
</Button>
|
</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"
|
<Button Text="Folytatás"
|
||||||
Margin="5,0,0,0"
|
Margin="5,0,0,0"
|
||||||
BackgroundColor="Blue"
|
BackgroundColor="Blue"
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ public partial class CheckListPage : ContentPage
|
|||||||
public ICommand ContinueCommand { get; set; }
|
public ICommand ContinueCommand { get; set; }
|
||||||
public ICommand UnblockCommand { get; set; }
|
public ICommand UnblockCommand { get; set; }
|
||||||
public ICommand BlockCommand { get; set; }
|
public ICommand BlockCommand { get; set; }
|
||||||
|
public ICommand AcceptCommand { get; set; }
|
||||||
public bool IsLoading
|
public bool IsLoading
|
||||||
{
|
{
|
||||||
get => _isLoading;
|
get => _isLoading;
|
||||||
@@ -44,6 +45,7 @@ public partial class CheckListPage : ContentPage
|
|||||||
ContinueCommand = new Command<CheckListHeaderDTO>(OnContinueItem);
|
ContinueCommand = new Command<CheckListHeaderDTO>(OnContinueItem);
|
||||||
UnblockCommand = new Command<CheckListHeaderDTO>(OnUnblockItem);
|
UnblockCommand = new Command<CheckListHeaderDTO>(OnUnblockItem);
|
||||||
BlockCommand = new Command<CheckListHeaderDTO>(OnBlockItem);
|
BlockCommand = new Command<CheckListHeaderDTO>(OnBlockItem);
|
||||||
|
AcceptCommand = new Command<CheckListHeaderDTO>(OnAcceptItem);
|
||||||
|
|
||||||
}
|
}
|
||||||
private void SetInfo()
|
private void SetInfo()
|
||||||
@@ -146,6 +148,15 @@ public partial class CheckListPage : ContentPage
|
|||||||
await LoadCheckList();
|
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()
|
private async Task LoadCheckListTemplate()
|
||||||
{
|
{
|
||||||
IsLoading = true;
|
IsLoading = true;
|
||||||
@@ -233,6 +244,26 @@ public class ContinueConverter : IValueConverter
|
|||||||
return false;
|
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)
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|||||||
@@ -178,6 +178,37 @@ namespace WorkFlowCheck.MAUI.Services
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> UnBlockCheckListHeader(CheckListHeaderDTO checkListHeaderDTO)
|
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;
|
var retVal = false;
|
||||||
try
|
try
|
||||||
@@ -208,7 +239,36 @@ namespace WorkFlowCheck.MAUI.Services
|
|||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
public async Task<bool> BlockCheckListHeader(CheckListHeaderDTO checkListHeaderDTO) => throw new NotImplementedException();
|
public async Task<bool> AcceptCheckListHeader(CheckListHeaderDTO checkListHeaderDTO)
|
||||||
public async Task<bool> AcceptCheckListHeader(CheckListHeaderDTO checkListHeaderDTO) => throw new NotImplementedException();
|
{
|
||||||
|
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