PWA Fundvelo der Caritas.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CaritasServiceFundVeloFoundConclusion.razor 3.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. @page "/fundvelo/conclusion_found"
  2. @using cwebplusApp.Shared.Services;
  3. @using cwebplusApp.Shared.Models;
  4. @using cwebplusApp.Components;
  5. @inject NavigationManager NavigationManager;
  6. @inject IStringLocalizer<Resources> i18n;
  7. @inject PageHistoryManager PageHistoryManager;
  8. @inject ReportDataProvider ReportDataProvider;
  9. @inject IBicycleRestService IBicycleRestService;
  10. @inject Toaster Toaster;
  11. @inject AppState AppState;
  12. <div class="row px-3 h-100">
  13. <div class="row no-gutters align-items-start justify-content-center w-100">
  14. <MatHeadline4 Style="font-family:Ubuntu;padding-top:1em">@i18n["Confirmation"]</MatHeadline4>
  15. </div>
  16. @if (responseOk) {
  17. <div class="row no-gutters align-items-start justify-content-center w-100" style="height:fit-content">
  18. <div class="w-100" style="text-align: center">
  19. <MatHeadline6 Style="font-family:Ubuntu">@i18n["FinishedTextFound"]</MatHeadline6>
  20. </div>
  21. <div class="w-100" style="text-align: center">
  22. <MatHeadline6 Style="font-family:Ubuntu">@referenceNumber</MatHeadline6>
  23. </div>
  24. </div>
  25. }
  26. <div class="row no-gutters align-items-start justify-content-center w-100" style="height:fit-content">
  27. @if (running) {
  28. <div style="width:48px;margin:0 auto;">
  29. <MatProgressCircle Indeterminate="true" Size="MatProgressCircleSize.Large" />
  30. </div>
  31. <div class="w-100" style="text-align:center;">
  32. <h6 style="font-style:italic;padding-bottom:1em">@i18n["Info.Report.Transmitting"]</h6>
  33. </div>
  34. } else {
  35. if (responseOk) {
  36. <Animate Animation="Animations.ZoomIn" Duration="TimeSpan.FromSeconds(2.5)">
  37. <DoneImage></DoneImage>
  38. </Animate>
  39. } else {
  40. <Animate Animation="Animations.ZoomIn" Duration="TimeSpan.FromSeconds(2.5)">
  41. <FailureImage></FailureImage>
  42. </Animate>
  43. }
  44. }
  45. </div>
  46. <div class="row no-gutters align-items-end justify-content-center w-100" style="padding-bottom:2em;padding-top:2em">
  47. <div class="col w-100 text-center">
  48. <MatButton Class="w-50" Raised="true" @onclick="Finished">@i18n["Finished"]</MatButton>
  49. </div>
  50. </div>
  51. </div>
  52. @code {
  53. private Animate doneAnimZoom;
  54. private bool responseOk = false;
  55. private bool running = true;
  56. private string referenceNumber;
  57. ReportResponse response;
  58. protected async override void OnInitialized() {
  59. base.OnInitialized();
  60. PageHistoryManager.AddPageToHistory(NavigationManager.Uri);
  61. try {
  62. response = await IBicycleRestService.SendFoundReport(ReportDataProvider.Report);
  63. responseOk = System.Net.HttpStatusCode.OK == response.StatusCode ? true : false;
  64. } catch (HttpRequestException ex) {
  65. response = new(i18n.GetString("FoundBike"), new string[] { ex.Message });
  66. responseOk = false;
  67. }
  68. running = false;
  69. if (responseOk) {
  70. Toaster.ShowSuccess(i18n.GetString("FoundBike"), response.Message);
  71. referenceNumber = (response.Data != null && response.Data.Length > 0) ? response.Data[0] : "-";
  72. PageHistoryManager.Reset();
  73. } else {
  74. Toaster.ShowError(response.Message, response.GetDataAsFormattedList());
  75. }
  76. StateHasChanged();
  77. AppState.NotifyChanged();
  78. }
  79. private void Finished() {
  80. NavigationManager.NavigateTo("caritas_services");
  81. }
  82. }