| private async void AfterRenderMap() { | private async void AfterRenderMap() { | ||||
| FoundReport report = ReportDataProvider.GetFoundReport(); | FoundReport report = ReportDataProvider.GetFoundReport(); | ||||
| if (report.GeographicInfo.Latitude != 0 && report.GeographicInfo.Longitude != 0) { | if (report.GeographicInfo.Latitude != 0 && report.GeographicInfo.Longitude != 0) { | ||||
| bicycleGeoPosition.DisplayCity = GetFormattedAddressZipAndTown(); | |||||
| bicycleGeoPosition.DisplayCity = await GetFormattedAddressZipAndTown(ReportDataProvider); | |||||
| LatLng coordinates = new LatLng(report.GeographicInfo.Latitude, report.GeographicInfo.Longitude); | LatLng coordinates = new LatLng(report.GeographicInfo.Latitude, report.GeographicInfo.Longitude); | ||||
| MouseEvent mouseEvent = new MouseEvent(); | MouseEvent mouseEvent = new MouseEvent(); | ||||
| mouseEvent.LatLng = coordinates; | mouseEvent.LatLng = coordinates; | ||||
| await InitializeMapPosition(); | await InitializeMapPosition(); | ||||
| await AddBicycleMarkerOnClickPosition(mouseEvent); | await AddBicycleMarkerOnClickPosition(mouseEvent); | ||||
| StateHasChanged(); | |||||
| } | } | ||||
| } | } | ||||
| protected async Task InitializeMapPosition() { | protected async Task InitializeMapPosition() { | ||||
| CreateBicycleMarkerOptions(); | CreateBicycleMarkerOptions(); | ||||
| await AddEventsToMap(); | await AddEventsToMap(); | ||||
| await ShowDeviceGeoLocation(); | |||||
| if (this.bicycleGeoPosition.Latitude == 0 && this.bicycleGeoPosition.Longitude == 0) { | |||||
| await ShowDeviceGeoLocation(); | |||||
| } else { | |||||
| await ShowBicycleGeoLocation(); | |||||
| } | |||||
| } | } | ||||
| protected static string GetFormattedAddressZipAndTown() { | |||||
| protected async Task<string> GetFormattedAddressZipAndTown(ReportDataProvider ReportDataProvider) { | |||||
| if (addressDto == null) { | |||||
| this.bicycleGeoPosition.Latitude = ReportDataProvider.GetFoundReport().GeographicInfo.Latitude; | |||||
| this.bicycleGeoPosition.Longitude = ReportDataProvider.GetFoundReport().GeographicInfo.Longitude; | |||||
| addressDto =await NominatimService.GetAddressForCoordinates(this.bicycleGeoPosition.Latitude, this.bicycleGeoPosition.Longitude); | |||||
| } | |||||
| return GetFormattedAddressZipAndTown(addressDto); | return GetFormattedAddressZipAndTown(addressDto); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| private async Task ShowBicycleGeoLocation() { | |||||
| if (this.bicycleGeoPosition.Latitude != 0 && this.bicycleGeoPosition.Longitude != 0) { | |||||
| LatLng geoPosition = new(this.bicycleGeoPosition.Latitude, this.bicycleGeoPosition.Longitude); | |||||
| if (this.devicePositionMarker != null) { | |||||
| await devicePositionMarker.Remove(); | |||||
| } | |||||
| this.devicePositionMarker = await this.MarkerFactory.CreateAndAddToMap(geoPosition, this.mapRef); | |||||
| await this.mapRef.SetZoom(16); | |||||
| await this.mapRef.SetView(geoPosition); | |||||
| } | |||||
| } | |||||
| private static string GetFormattedAddressZipAndTown(NominatimReverseAddress addressDto) { | private static string GetFormattedAddressZipAndTown(NominatimReverseAddress addressDto) { | ||||
| string country_code = addressDto.address.country_code; | string country_code = addressDto.address.country_code; | ||||
| string zip = SplitAndGetFirstPostcode(addressDto.address.postcode); | string zip = SplitAndGetFirstPostcode(addressDto.address.postcode); |
| @inject PageHistoryManager PageHistoryManager | @inject PageHistoryManager PageHistoryManager | ||||
| @inject ReportDataProvider ReportDataProvider | @inject ReportDataProvider ReportDataProvider | ||||
| @inject UserDataProvider UserDataProvider | @inject UserDataProvider UserDataProvider | ||||
| @inject ReportRepositoryService ReportRepositoryService | |||||
| <div class="row px-3 h-100"> | |||||
| <div class="row no-gutters align-items-center w-100"> | |||||
| <div class="mat-layout-grid w-100"> | |||||
| <div class="mat-layout-grid-inner"> | |||||
| <div class="mat-layout-grid-cell mat-layout-grid-cell-span-1"> | |||||
| </div> | |||||
| <div class="mat-layout-grid-cell mat-layout-grid-cell-span-2"> | |||||
| <MatCard Class="fv-mat-card"> | |||||
| <MatCardContent> | |||||
| <MatCardMedia Square="true" ImageUrl="./images/batch_found.png" @onclick="Found"></MatCardMedia> | |||||
| </MatCardContent> | |||||
| </MatCard> | |||||
| </div> | |||||
| <div class="mat-layout-grid-cell mat-layout-grid-cell-span-1"> | |||||
| </div> | |||||
| <div class="mat-layout-grid-cell mat-layout-grid-cell-span-1"> | |||||
| </div> | |||||
| <div class="mat-layout-grid-cell mat-layout-grid-cell-span-2"> | |||||
| <MatCard Class="fv-mat-card"> | |||||
| <MatCardContent> | |||||
| <MatCardMedia Square="true" ImageUrl="./images/batch_missing.png" @onclick="Missing"></MatCardMedia> | |||||
| </MatCardContent> | |||||
| </MatCard> | |||||
| </div> | |||||
| <div class="mat-layout-grid-cell mat-layout-grid-cell-span-1"> | |||||
| <div class="row px-3 h-100"> | |||||
| <div class="row no-gutters align-items-center w-100"> | |||||
| <div class="mat-layout-grid w-100"> | |||||
| <div class="mat-layout-grid-inner"> | |||||
| <div class="mat-layout-grid-cell mat-layout-grid-cell-span-1"> | |||||
| </div> | |||||
| <div class="mat-layout-grid-cell mat-layout-grid-cell-span-2"> | |||||
| <MatCard Class="fv-mat-card"> | |||||
| <MatCardContent> | |||||
| <MatCardMedia Square="true" ImageUrl="./images/batch_found.png" @onclick="Found"></MatCardMedia> | |||||
| </MatCardContent> | |||||
| </MatCard> | |||||
| </div> | |||||
| <div class="mat-layout-grid-cell mat-layout-grid-cell-span-1"> | |||||
| </div> | |||||
| <div class="mat-layout-grid-cell mat-layout-grid-cell-span-1"> | |||||
| </div> | |||||
| <div class="mat-layout-grid-cell mat-layout-grid-cell-span-2"> | |||||
| <MatCard Class="fv-mat-card"> | |||||
| <MatCardContent> | |||||
| <MatCardMedia Square="true" ImageUrl="./images/batch_missing.png" @onclick="Missing"></MatCardMedia> | |||||
| </MatCardContent> | |||||
| </MatCard> | |||||
| </div> | |||||
| <div class="mat-layout-grid-cell mat-layout-grid-cell-span-1"> | |||||
| </div> | |||||
| <div class="mat-layout-grid-cell mat-layout-grid-cell-span-1"> | |||||
| </div> | |||||
| <div class="mat-layout-grid-cell mat-layout-grid-cell-span-2" style="text-align:end"> | |||||
| @if (NbrPendingReports > 0) { | |||||
| <div> | |||||
| <MatChip Label="@NbrPendingReports.ToString()" Class="pending_batch"></MatChip> | |||||
| </div> | |||||
| } | |||||
| <MatCard Class="fv-mat-card"> | |||||
| <MatCardContent> | |||||
| <MatCardMedia Square="true" ImageUrl="./images/batch_pending.png" @onclick="Pending" Style="@getOpacity()"></MatCardMedia> | |||||
| </MatCardContent> | |||||
| </MatCard> | |||||
| </div> | |||||
| <div class="mat-layout-grid-cell mat-layout-grid-cell-span-1"> | |||||
| </div> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | |||||
| @code { | |||||
| @code { | |||||
| protected override void OnInitialized() { | |||||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | |||||
| ReportDataProvider.Report = null; | |||||
| ReportDataProvider.ReportRepositoryItem = null; | |||||
| base.OnInitialized(); | |||||
| } | |||||
| private int NbrPendingReports; | |||||
| private async void Found() { | |||||
| Report report = new FoundReport(); | |||||
| UserDataProvider.mapReport(report, await UserDataProvider.Get()); | |||||
| ReportDataProvider.Report = report; | |||||
| NavigationManager.NavigateTo("fundvelo/keydata/Found"); | |||||
| } | |||||
| protected async override void OnInitialized() { | |||||
| base.OnInitialized(); | |||||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | |||||
| ReportDataProvider.Report = null; | |||||
| ReportDataProvider.ReportRepositoryItem = null; | |||||
| NbrPendingReports = await ReportRepositoryService.GetNbrOfPendingReports(); | |||||
| StateHasChanged(); | |||||
| } | |||||
| private async void Found() { | |||||
| Report report = new FoundReport(); | |||||
| UserDataProvider.mapReport(report, await UserDataProvider.Get()); | |||||
| ReportDataProvider.Report = report; | |||||
| NavigationManager.NavigateTo("fundvelo/keydata/Found"); | |||||
| } | |||||
| private async void Missing() { | |||||
| Report report = new MissingReport(); | |||||
| UserDataProvider.mapReport(report, await UserDataProvider.Get()); | |||||
| ReportDataProvider.Report = report; | |||||
| NavigationManager.NavigateTo("fundvelo/keydata/Missing"); | |||||
| } | |||||
| private void Pending() { | |||||
| if(NbrPendingReports > 0) { | |||||
| NavigationManager.NavigateTo("fundvelo/pending_overview"); | |||||
| } | |||||
| } | |||||
| private async void Missing() { | |||||
| Report report = new MissingReport(); | |||||
| UserDataProvider.mapReport(report, await UserDataProvider.Get()); | |||||
| ReportDataProvider.Report = report; | |||||
| NavigationManager.NavigateTo("fundvelo/keydata/Missing"); | |||||
| private string getOpacity() { | |||||
| return NbrPendingReports > 0 ? "opacity:1.0" : "opacity:0.5"; | |||||
| } | |||||
| } | } | ||||
| } |
| </MatIcon> | </MatIcon> | ||||
| <MatSubtitle1 Class="w-100" Style="font-family:Ubuntu; text-align:left; font-weight:800; display:contents">@i18n["FinishedTextMissing_LostOffice_Address"]</MatSubtitle1> | <MatSubtitle1 Class="w-100" Style="font-family:Ubuntu; text-align:left; font-weight:800; display:contents">@i18n["FinishedTextMissing_LostOffice_Address"]</MatSubtitle1> | ||||
| </div> | </div> | ||||
| } else { | |||||
| } else if (ResposeStatus.Error == responseStatus) { | |||||
| <Animate Animation="Animations.ZoomIn" Duration="TimeSpan.FromSeconds(2.5)"> | <Animate Animation="Animations.ZoomIn" Duration="TimeSpan.FromSeconds(2.5)"> | ||||
| <FailureImage></FailureImage> | <FailureImage></FailureImage> | ||||
| </Animate> | </Animate> | ||||
| } else { | |||||
| <Animate Animation="Animations.ZoomIn" Duration="TimeSpan.FromSeconds(2.5)"> | |||||
| <WarningImage></WarningImage> | |||||
| </Animate> | |||||
| } | } | ||||
| } | } | ||||
| </div> | </div> |
| @page "/fundvelo/pending_overview" | |||||
| @using cwebplusApp.Shared.Services; | |||||
| @using cwebplusApp.Shared.Models; | |||||
| @inject NavigationManager NavigationManager | |||||
| @inject PageHistoryManager PageHistoryManager | |||||
| @inject ReportDataProvider ReportDataProvider | |||||
| @inject ReportRepositoryService ReportRepositoryService | |||||
| @inject IStringLocalizer<Resources> i18n; | |||||
| <div class="row px-3 h-100"> | |||||
| <div class="row no-gutters align-items-start w-100" style="padding-top: 1rem;"> | |||||
| <div class="mat-layout-grid w-100"> | |||||
| <div> | |||||
| <MatTable RowClass="ReportRepositoryItem" Items="pendingReports" class="mat-elevation-z5" ShowPaging="false" UseSortHeaderRow="true" | |||||
| OnRowDbClick="OnReportDblClicked" AllowSelection="true"> | |||||
| <MatTableHeader> | |||||
| <th>Id</th> | |||||
| <th>@i18n["Type"]</th> | |||||
| <th>@i18n["Date"]</th> | |||||
| <th>@i18n["Address"]</th> | |||||
| <th>@i18n["Picture"]</th> | |||||
| <th>@i18n["Action"]</th> | |||||
| </MatTableHeader> | |||||
| <MatTableRow> | |||||
| <td style="display:inline-flex"> | |||||
| <div> | |||||
| <MatIconButton Icon="play_circle_filled" OnClick="@(_ => SendReport(context))"></MatIconButton> | |||||
| </div> | |||||
| <div style="padding-top: 0.8rem">@context.ID</div> | |||||
| </td> | |||||
| <td>@translateType(context.ReportType)</td> | |||||
| <td>@ReportRepositoryService.GetCurrentDateTimeFromMillis(context.ID)</td> | |||||
| <td>@getAddress(context)</td> | |||||
| <td>@getPicture(context)</td> | |||||
| <td> | |||||
| <MatIconButton Icon="delete_forever" OnClick="@(_ => DeleteReport(context))"></MatIconButton> | |||||
| </td> | |||||
| </MatTableRow> | |||||
| </MatTable> | |||||
| </div> | |||||
| </div> | |||||
| </div> | |||||
| </div> | |||||
| @code { | |||||
| private List<ReportRepositoryItem> pendingReports = new(); | |||||
| private ReportRepositoryItem selectedReport; | |||||
| protected async override void OnInitialized() { | |||||
| base.OnInitialized(); | |||||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | |||||
| pendingReports.AddRange(await ReportRepositoryService.GetPendingFoundReports()); | |||||
| pendingReports.AddRange(await ReportRepositoryService.GetPendingMissingReports()); | |||||
| StateHasChanged(); | |||||
| } | |||||
| private void OnReportDblClicked(object item) { | |||||
| var report = item as ReportRepositoryItem; | |||||
| if (report == null) { | |||||
| selectedReport = null; | |||||
| return; | |||||
| } | |||||
| selectedReport = report; | |||||
| } | |||||
| private string translateType(ReportRepositoryItem.Type type) { | |||||
| return i18n.GetString("ReportType." + type); | |||||
| } | |||||
| private string getAddress(ReportRepositoryItem item) { | |||||
| return ReportRepositoryItem.Type.FOUND.Equals(item.ReportType) ? ((FoundReportRepositoryItem)item).Report.GeographicInfo.Address : ""; | |||||
| } | |||||
| private string getPicture(ReportRepositoryItem item) { | |||||
| string picData = ReportRepositoryItem.Type.FOUND.Equals(item.ReportType) ? ((FoundReportRepositoryItem)item).Report.FotoString : ((MissingReportRepositoryItem)item).Report.FotoString; | |||||
| return ""; | |||||
| } | |||||
| private void DeleteReport(ReportRepositoryItem item) { | |||||
| } | |||||
| private void SendReport(ReportRepositoryItem item) { | |||||
| ReportDataProvider.ReportRepositoryItem = item; | |||||
| if (ReportRepositoryItem.Type.FOUND.Equals(item.ReportType)) { | |||||
| ReportDataProvider.Report = ((FoundReportRepositoryItem)item).Report; | |||||
| NavigationManager.NavigateTo("fundvelo/keydata/Found"); | |||||
| } else { | |||||
| ReportDataProvider.Report = ((MissingReportRepositoryItem)item).Report; | |||||
| NavigationManager.NavigateTo("fundvelo/keydata/Missing"); | |||||
| } | |||||
| } | |||||
| } |
| showProgressCircle = true; | showProgressCircle = true; | ||||
| StateHasChanged(); | StateHasChanged(); | ||||
| try { | try { | ||||
| BicycleRestService.Initialize(Configuration); | |||||
| await MasterDataService.SynchronizeMasterdata(); | |||||
| await BicycleRestService.TrySendPendingReports(); | |||||
| } catch (Exception) { | |||||
| Toaster.ShowWarning(i18n.GetString("Warning.Masterdata.Title"), i18n.GetString("Warning.Masterdata.Msg")); | |||||
| try { | |||||
| BicycleRestService.Initialize(Configuration); | |||||
| await MasterDataService.SynchronizeMasterdata(); | |||||
| } catch (Exception) { | |||||
| Toaster.ShowWarning(i18n.GetString("Warning.Masterdata.Title"), i18n.GetString("Warning.Masterdata.Msg")); | |||||
| } | |||||
| int sent = await BicycleRestService.TrySendPendingReports(); | |||||
| if (sent > 0) { | |||||
| Toaster.ShowSuccess(i18n.GetString("Info.SendPendigs.Title"), i18n.GetString("Info.SendPendigs.Msg", sent)); | |||||
| } | |||||
| } finally { | } finally { | ||||
| showProgressCircle = false; | showProgressCircle = false; | ||||
| NavigateToNext(); | NavigateToNext(); |
| return (ID == rri.ID); | return (ID == rri.ID); | ||||
| } | } | ||||
| } | } | ||||
| public override int GetHashCode() { | |||||
| return base.GetHashCode(); | |||||
| } | |||||
| public override string ToString() { | |||||
| return base.ToString(); | |||||
| } | |||||
| } | } | ||||
| } | } |
| <data name="account" xml:space="preserve"> | <data name="account" xml:space="preserve"> | ||||
| <value>Konto</value> | <value>Konto</value> | ||||
| </data> | </data> | ||||
| <data name="Action" xml:space="preserve"> | |||||
| <value>Aktion</value> | |||||
| </data> | |||||
| <data name="Address" xml:space="preserve"> | <data name="Address" xml:space="preserve"> | ||||
| <value>Adresse</value> | <value>Adresse</value> | ||||
| </data> | </data> | ||||
| <data name="Continue" xml:space="preserve"> | <data name="Continue" xml:space="preserve"> | ||||
| <value>Weiter</value> | <value>Weiter</value> | ||||
| </data> | </data> | ||||
| <data name="Date" xml:space="preserve"> | |||||
| <value>Datum</value> | |||||
| </data> | |||||
| <data name="DevelopedBy" xml:space="preserve"> | <data name="DevelopedBy" xml:space="preserve"> | ||||
| <value>Entwickelt durch</value> | <value>Entwickelt durch</value> | ||||
| </data> | </data> | ||||
| <data name="fundvelo/lost_found" xml:space="preserve"> | <data name="fundvelo/lost_found" xml:space="preserve"> | ||||
| <value>Fundvelo</value> | <value>Fundvelo</value> | ||||
| </data> | </data> | ||||
| <data name="fundvelo/pending_overview" xml:space="preserve"> | |||||
| <value>Fundvelo > Übersicht Pendente</value> | |||||
| </data> | |||||
| <data name="info" xml:space="preserve"> | <data name="info" xml:space="preserve"> | ||||
| <value>Info</value> | <value>Info</value> | ||||
| </data> | </data> | ||||
| <data name="Info.Report.Transmitting" xml:space="preserve"> | <data name="Info.Report.Transmitting" xml:space="preserve"> | ||||
| <value>Am Übertragen der Meldung...</value> | <value>Am Übertragen der Meldung...</value> | ||||
| </data> | </data> | ||||
| <data name="Info.SendPendigs.Msg" xml:space="preserve"> | |||||
| <value>{0:d} ausstehende Berichte erfolgreich gesendet.</value> | |||||
| </data> | |||||
| <data name="Info.SendPendigs.Title" xml:space="preserve"> | |||||
| <value>Ausstehende Berichte erfolgreich gesendet!</value> | |||||
| </data> | |||||
| <data name="Lastname" xml:space="preserve"> | <data name="Lastname" xml:space="preserve"> | ||||
| <value>Nachname</value> | <value>Nachname</value> | ||||
| </data> | </data> | ||||
| <data name="PickupContact" xml:space="preserve"> | <data name="PickupContact" xml:space="preserve"> | ||||
| <value>Abholkontakt</value> | <value>Abholkontakt</value> | ||||
| </data> | </data> | ||||
| <data name="Picture" xml:space="preserve"> | |||||
| <value>Bild</value> | |||||
| </data> | |||||
| <data name="PlaceOfDiscovery" xml:space="preserve"> | <data name="PlaceOfDiscovery" xml:space="preserve"> | ||||
| <value>Fundort</value> | <value>Fundort</value> | ||||
| </data> | </data> | ||||
| <data name="Remark" xml:space="preserve"> | <data name="Remark" xml:space="preserve"> | ||||
| <value>Bemerkung</value> | <value>Bemerkung</value> | ||||
| </data> | </data> | ||||
| <data name="ReportType.FOUND" xml:space="preserve"> | |||||
| <value>Fundmeldung</value> | |||||
| </data> | |||||
| <data name="ReportType.MISSING" xml:space="preserve"> | |||||
| <value>Suchauftrag</value> | |||||
| </data> | |||||
| <data name="Salutation" xml:space="preserve"> | <data name="Salutation" xml:space="preserve"> | ||||
| <value>Anrede</value> | <value>Anrede</value> | ||||
| </data> | </data> |
| <data name="account" xml:space="preserve"> | <data name="account" xml:space="preserve"> | ||||
| <value>Compte</value> | <value>Compte</value> | ||||
| </data> | </data> | ||||
| <data name="Action" xml:space="preserve"> | |||||
| <value>Action</value> | |||||
| </data> | |||||
| <data name="Address" xml:space="preserve"> | <data name="Address" xml:space="preserve"> | ||||
| <value>Adresse</value> | <value>Adresse</value> | ||||
| </data> | </data> | ||||
| <data name="Continue" xml:space="preserve"> | <data name="Continue" xml:space="preserve"> | ||||
| <value>Continue</value> | <value>Continue</value> | ||||
| </data> | </data> | ||||
| <data name="Date" xml:space="preserve"> | |||||
| <value>Date</value> | |||||
| </data> | |||||
| <data name="DevelopedBy" xml:space="preserve"> | <data name="DevelopedBy" xml:space="preserve"> | ||||
| <value>Développé par</value> | <value>Développé par</value> | ||||
| </data> | </data> | ||||
| <value>Erreur {0:d} lors de la détermination de la position géographique.</value> | <value>Erreur {0:d} lors de la détermination de la position géographique.</value> | ||||
| </data> | </data> | ||||
| <data name="Error.IOException.Msg" xml:space="preserve"> | <data name="Error.IOException.Msg" xml:space="preserve"> | ||||
| <value>The file could not be read.</value> | |||||
| <value>Le fichier n'a pas pu être lu.</value> | |||||
| </data> | </data> | ||||
| <data name="Error.IOException.Title" xml:space="preserve"> | <data name="Error.IOException.Title" xml:space="preserve"> | ||||
| <value>Error while reading file!</value> | |||||
| <value>Erreur lors de la lecture du fichier !</value> | |||||
| </data> | </data> | ||||
| <data name="Error.PhotoOrPictureToBig.Msg" xml:space="preserve"> | <data name="Error.PhotoOrPictureToBig.Msg" xml:space="preserve"> | ||||
| <value>La taille de l'image sélectionnée ou de la photo prise dépasse la taille maximale autorisée de {0:d} MB.</value> | <value>La taille de l'image sélectionnée ou de la photo prise dépasse la taille maximale autorisée de {0:d} MB.</value> | ||||
| <data name="fundvelo/lost_found" xml:space="preserve"> | <data name="fundvelo/lost_found" xml:space="preserve"> | ||||
| <value>Velo</value> | <value>Velo</value> | ||||
| </data> | </data> | ||||
| <data name="fundvelo/pending_overview" xml:space="preserve"> | |||||
| <value>Velo > Raportes en attente</value> | |||||
| </data> | |||||
| <data name="info" xml:space="preserve"> | <data name="info" xml:space="preserve"> | ||||
| <value>Information</value> | <value>Information</value> | ||||
| </data> | </data> | ||||
| <data name="Info.Report.Transmitting" xml:space="preserve"> | <data name="Info.Report.Transmitting" xml:space="preserve"> | ||||
| <value>Transmettant le rapport...</value> | <value>Transmettant le rapport...</value> | ||||
| </data> | </data> | ||||
| <data name="Info.SendPendigs.Msg" xml:space="preserve"> | |||||
| <value>{0:d} rapports en attente envoyés avec succès.</value> | |||||
| </data> | |||||
| <data name="Info.SendPendigs.Title" xml:space="preserve"> | |||||
| <value>Rapports en attente envoyés avec succès !</value> | |||||
| </data> | |||||
| <data name="Lastname" xml:space="preserve"> | <data name="Lastname" xml:space="preserve"> | ||||
| <value>Nom de famille</value> | <value>Nom de famille</value> | ||||
| </data> | </data> | ||||
| <data name="PickupContact" xml:space="preserve"> | <data name="PickupContact" xml:space="preserve"> | ||||
| <value>Contact de ramassage</value> | <value>Contact de ramassage</value> | ||||
| </data> | </data> | ||||
| <data name="Picture" xml:space="preserve"> | |||||
| <value>Photo</value> | |||||
| </data> | |||||
| <data name="PlaceOfDiscovery" xml:space="preserve"> | <data name="PlaceOfDiscovery" xml:space="preserve"> | ||||
| <value>Lieu de découverte</value> | <value>Lieu de découverte</value> | ||||
| </data> | </data> | ||||
| <data name="Remark" xml:space="preserve"> | <data name="Remark" xml:space="preserve"> | ||||
| <value>Comment</value> | <value>Comment</value> | ||||
| </data> | </data> | ||||
| <data name="ReportType.FOUND" xml:space="preserve"> | |||||
| <value>Rapport de découverte</value> | |||||
| </data> | |||||
| <data name="ReportType.MISSING" xml:space="preserve"> | |||||
| <value>Rapport de disparition</value> | |||||
| </data> | |||||
| <data name="Salutation" xml:space="preserve"> | <data name="Salutation" xml:space="preserve"> | ||||
| <value>Salutation</value> | <value>Salutation</value> | ||||
| </data> | </data> |
| <data name="account" xml:space="preserve"> | <data name="account" xml:space="preserve"> | ||||
| <value>Profilo</value> | <value>Profilo</value> | ||||
| </data> | </data> | ||||
| <data name="Action" xml:space="preserve"> | |||||
| <value>Azione</value> | |||||
| </data> | |||||
| <data name="Address" xml:space="preserve"> | <data name="Address" xml:space="preserve"> | ||||
| <value>Indirizzo</value> | <value>Indirizzo</value> | ||||
| </data> | </data> | ||||
| <data name="Continue" xml:space="preserve"> | <data name="Continue" xml:space="preserve"> | ||||
| <value>Continua</value> | <value>Continua</value> | ||||
| </data> | </data> | ||||
| <data name="Date" xml:space="preserve"> | |||||
| <value>Data</value> | |||||
| </data> | |||||
| <data name="DevelopedBy" xml:space="preserve"> | <data name="DevelopedBy" xml:space="preserve"> | ||||
| <value>Sviluppata da</value> | <value>Sviluppata da</value> | ||||
| </data> | </data> | ||||
| <data name="fundvelo/lost_found" xml:space="preserve"> | <data name="fundvelo/lost_found" xml:space="preserve"> | ||||
| <value>Bicicletta</value> | <value>Bicicletta</value> | ||||
| </data> | </data> | ||||
| <data name="fundvelo/pending_overview" xml:space="preserve"> | |||||
| <value>Bicicletta > Raporti in attesa</value> | |||||
| </data> | |||||
| <data name="info" xml:space="preserve"> | <data name="info" xml:space="preserve"> | ||||
| <value>Informazione</value> | <value>Informazione</value> | ||||
| </data> | </data> | ||||
| <data name="Info.Report.Transmitting" xml:space="preserve"> | <data name="Info.Report.Transmitting" xml:space="preserve"> | ||||
| <value>Trasmissione del rapporto...</value> | <value>Trasmissione del rapporto...</value> | ||||
| </data> | </data> | ||||
| <data name="Info.SendPendigs.Msg" xml:space="preserve"> | |||||
| <value>{0:d} rapporti in sospeso inviati con successo.</value> | |||||
| </data> | |||||
| <data name="Info.SendPendigs.Title" xml:space="preserve"> | |||||
| <value>Rapporti in sospeso inviati con successo!</value> | |||||
| </data> | |||||
| <data name="Lastname" xml:space="preserve"> | <data name="Lastname" xml:space="preserve"> | ||||
| <value>Cognome</value> | <value>Cognome</value> | ||||
| </data> | </data> | ||||
| <data name="PickupContact" xml:space="preserve"> | <data name="PickupContact" xml:space="preserve"> | ||||
| <value>Contatto di prelievo</value> | <value>Contatto di prelievo</value> | ||||
| </data> | </data> | ||||
| <data name="Picture" xml:space="preserve"> | |||||
| <value>Immagine</value> | |||||
| </data> | |||||
| <data name="PlaceOfDiscovery" xml:space="preserve"> | <data name="PlaceOfDiscovery" xml:space="preserve"> | ||||
| <value>Luogo del ritrovamento</value> | <value>Luogo del ritrovamento</value> | ||||
| </data> | </data> | ||||
| <data name="Remark" xml:space="preserve"> | <data name="Remark" xml:space="preserve"> | ||||
| <value>Commento</value> | <value>Commento</value> | ||||
| </data> | </data> | ||||
| <data name="ReportType.FOUND" xml:space="preserve"> | |||||
| <value>Rapporto di ritrovamento</value> | |||||
| </data> | |||||
| <data name="ReportType.MISSING" xml:space="preserve"> | |||||
| <value>Rapporto di perdita</value> | |||||
| </data> | |||||
| <data name="Salutation" xml:space="preserve"> | <data name="Salutation" xml:space="preserve"> | ||||
| <value>Saluto</value> | <value>Saluto</value> | ||||
| </data> | </data> | ||||
| <value>Dati anagrafici non disponibili!</value> | <value>Dati anagrafici non disponibili!</value> | ||||
| </data> | </data> | ||||
| <data name="Warning.NoConnection.Msg" xml:space="preserve"> | <data name="Warning.NoConnection.Msg" xml:space="preserve"> | ||||
| <value>Il messaggio non può essere trasmesso. È stato salvato e sarà trasmesso al più presto.</value> | |||||
| <value>Il rapporto non può essere trasmesso. È stato salvato e sarà trasmesso al più presto.</value> | |||||
| </data> | </data> | ||||
| <data name="Warning.NoConnection.Title" xml:space="preserve"> | <data name="Warning.NoConnection.Title" xml:space="preserve"> | ||||
| <value>Nessuna connessione a Internet!</value> | <value>Nessuna connessione a Internet!</value> |
| <data name="account" xml:space="preserve"> | <data name="account" xml:space="preserve"> | ||||
| <value>Account</value> | <value>Account</value> | ||||
| </data> | </data> | ||||
| <data name="Action" xml:space="preserve"> | |||||
| <value>Action</value> | |||||
| </data> | |||||
| <data name="Address" xml:space="preserve"> | <data name="Address" xml:space="preserve"> | ||||
| <value>Address</value> | <value>Address</value> | ||||
| </data> | </data> | ||||
| <data name="Continue" xml:space="preserve"> | <data name="Continue" xml:space="preserve"> | ||||
| <value>Continue</value> | <value>Continue</value> | ||||
| </data> | </data> | ||||
| <data name="Date" xml:space="preserve"> | |||||
| <value>Date</value> | |||||
| </data> | |||||
| <data name="DevelopedBy" xml:space="preserve"> | <data name="DevelopedBy" xml:space="preserve"> | ||||
| <value>Developed by</value> | <value>Developed by</value> | ||||
| </data> | </data> | ||||
| <data name="fundvelo/lost_found" xml:space="preserve"> | <data name="fundvelo/lost_found" xml:space="preserve"> | ||||
| <value>Bicycle</value> | <value>Bicycle</value> | ||||
| </data> | </data> | ||||
| <data name="fundvelo/pending_overview" xml:space="preserve"> | |||||
| <value>Bicycle > Overview Pendigs</value> | |||||
| </data> | |||||
| <data name="info" xml:space="preserve"> | <data name="info" xml:space="preserve"> | ||||
| <value>Info</value> | <value>Info</value> | ||||
| </data> | </data> | ||||
| <data name="Info.Report.Transmitting" xml:space="preserve"> | <data name="Info.Report.Transmitting" xml:space="preserve"> | ||||
| <value>Transmitting report...</value> | <value>Transmitting report...</value> | ||||
| </data> | </data> | ||||
| <data name="Info.SendPendigs.Msg" xml:space="preserve"> | |||||
| <value>{0:d} pending reports successfully sent.</value> | |||||
| </data> | |||||
| <data name="Info.SendPendigs.Title" xml:space="preserve"> | |||||
| <value>Pending reports successfully sent!</value> | |||||
| </data> | |||||
| <data name="Lastname" xml:space="preserve"> | <data name="Lastname" xml:space="preserve"> | ||||
| <value>Last name</value> | <value>Last name</value> | ||||
| </data> | </data> | ||||
| <data name="PickupContact" xml:space="preserve"> | <data name="PickupContact" xml:space="preserve"> | ||||
| <value>Pickup Contact</value> | <value>Pickup Contact</value> | ||||
| </data> | </data> | ||||
| <data name="Picture" xml:space="preserve"> | |||||
| <value>Picture</value> | |||||
| </data> | |||||
| <data name="PlaceOfDiscovery" xml:space="preserve"> | <data name="PlaceOfDiscovery" xml:space="preserve"> | ||||
| <value>Place Of Discovery</value> | <value>Place Of Discovery</value> | ||||
| </data> | </data> | ||||
| <data name="Remark" xml:space="preserve"> | <data name="Remark" xml:space="preserve"> | ||||
| <value>Remark</value> | <value>Remark</value> | ||||
| </data> | </data> | ||||
| <data name="ReportType.FOUND" xml:space="preserve"> | |||||
| <value>Found report</value> | |||||
| </data> | |||||
| <data name="ReportType.MISSING" xml:space="preserve"> | |||||
| <value>Missing report</value> | |||||
| </data> | |||||
| <data name="Salutation" xml:space="preserve"> | <data name="Salutation" xml:space="preserve"> | ||||
| <value>Salutation</value> | <value>Salutation</value> | ||||
| </data> | </data> |
| public async Task<ReportResponse> SendFoundReport(Report report) { | public async Task<ReportResponse> SendFoundReport(Report report) { | ||||
| string subResourceUrl = configuration.GetValue<string>("subresource_url_foundreport"); | string subResourceUrl = configuration.GetValue<string>("subresource_url_foundreport"); | ||||
| return await SendReport(report, subResourceUrl, new FoundReportRepositoryItem((FoundReport)report, GetCurrentTimeInMillis())); | |||||
| return await SendReport(report, subResourceUrl, new FoundReportRepositoryItem((FoundReport)report, ReportRepositoryService.GetCurrentTimeInMillis())); | |||||
| } | } | ||||
| private async Task<ReportResponse> SendFoundReport(FoundReportRepositoryItem reportRepositoryItem) { | private async Task<ReportResponse> SendFoundReport(FoundReportRepositoryItem reportRepositoryItem) { | ||||
| public async Task<ReportResponse> SendMissingReport(Report report) { | public async Task<ReportResponse> SendMissingReport(Report report) { | ||||
| string subResourceUrl = configuration.GetValue<string>("subresource_url_missingreport"); | string subResourceUrl = configuration.GetValue<string>("subresource_url_missingreport"); | ||||
| return await SendReport(report, subResourceUrl, new MissingReportRepositoryItem((MissingReport)report, GetCurrentTimeInMillis())); | |||||
| return await SendReport(report, subResourceUrl, new MissingReportRepositoryItem((MissingReport)report, ReportRepositoryService.GetCurrentTimeInMillis())); | |||||
| } | } | ||||
| public async Task<ReportResponse> SendMissingReport(MissingReportRepositoryItem reportRepositoryItem) { | public async Task<ReportResponse> SendMissingReport(MissingReportRepositoryItem reportRepositoryItem) { | ||||
| return await SendReport(reportRepositoryItem.Report, subResourceUrl, reportRepositoryItem); | return await SendReport(reportRepositoryItem.Report, subResourceUrl, reportRepositoryItem); | ||||
| } | } | ||||
| public async Task TrySendPendingReports() { | |||||
| await TrySendFoundPendingReports(); | |||||
| await TrySendMissingPendingReports(); | |||||
| public async Task<int> TrySendPendingReports() { | |||||
| int sent = 0; | |||||
| if (onlineStatusProvider.Online) { | |||||
| sent = await TrySendFoundPendingReports(); | |||||
| sent += await TrySendMissingPendingReports(); | |||||
| } | |||||
| return sent; | |||||
| } | } | ||||
| public async Task TrySendFoundPendingReports() { | |||||
| public async Task<int> TrySendFoundPendingReports() { | |||||
| int sent = 0; | |||||
| List<FoundReportRepositoryItem> pendingFoundReports = await reportRepositoryService.GetPendingFoundReports(); | List<FoundReportRepositoryItem> pendingFoundReports = await reportRepositoryService.GetPendingFoundReports(); | ||||
| foreach (FoundReportRepositoryItem item in pendingFoundReports) { | foreach (FoundReportRepositoryItem item in pendingFoundReports) { | ||||
| try { | try { | ||||
| ReportResponse response = await SendFoundReport(item); | ReportResponse response = await SendFoundReport(item); | ||||
| if (HttpStatusCode.OK == response.StatusCode) { | |||||
| sent++; | |||||
| } | |||||
| } catch (Exception) { | } catch (Exception) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| } | } | ||||
| return sent; | |||||
| } | } | ||||
| public async Task TrySendMissingPendingReports() { | |||||
| public async Task<int> TrySendMissingPendingReports() { | |||||
| int sent = 0; | |||||
| List<MissingReportRepositoryItem> pendingMissingReports = await reportRepositoryService.GetPendingMissingReports(); | List<MissingReportRepositoryItem> pendingMissingReports = await reportRepositoryService.GetPendingMissingReports(); | ||||
| foreach (MissingReportRepositoryItem item in pendingMissingReports) { | foreach (MissingReportRepositoryItem item in pendingMissingReports) { | ||||
| try { | try { | ||||
| ReportResponse response = await SendMissingReport(item); | ReportResponse response = await SendMissingReport(item); | ||||
| if (HttpStatusCode.OK == response.StatusCode) { | |||||
| sent++; | |||||
| } | |||||
| } catch (Exception) { | } catch (Exception) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| } | } | ||||
| return sent; | |||||
| } | } | ||||
| protected async Task<ReportResponse> SendReport(Report report, string subResourceUrl, ReportRepositoryItem reportRepositoryItem) { | protected async Task<ReportResponse> SendReport(Report report, string subResourceUrl, ReportRepositoryItem reportRepositoryItem) { | ||||
| await reportRepositoryService.SaveReport(reportRepositoryItem); | await reportRepositoryService.SaveReport(reportRepositoryItem); | ||||
| return response; | return response; | ||||
| } | } | ||||
| private long GetCurrentTimeInMillis() { | |||||
| return DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond; | |||||
| } | |||||
| } | } | ||||
| } | } |
| Task<ReportResponse> SendMissingReport(Report report); | Task<ReportResponse> SendMissingReport(Report report); | ||||
| Task TrySendPendingReports(); | |||||
| Task<int> TrySendPendingReports(); | |||||
| Task TrySendFoundPendingReports(); | |||||
| Task<int> TrySendFoundPendingReports(); | |||||
| Task TrySendMissingPendingReports(); | |||||
| Task<int> TrySendMissingPendingReports(); | |||||
| } | } | ||||
| } | } |
| await jsRuntime.InvokeVoidAsync("BlazorSetLocalStorage", KeyNameMissingReports, json); | await jsRuntime.InvokeVoidAsync("BlazorSetLocalStorage", KeyNameMissingReports, json); | ||||
| } | } | ||||
| public async ValueTask<int> GetNbrOfPendingReports() { | |||||
| List<FoundReportRepositoryItem> foundReportRepositoryItems = await GetPendingFoundReports(); | |||||
| List<MissingReportRepositoryItem> missingReportRepositoryItems = await GetPendingMissingReports(); | |||||
| return foundReportRepositoryItems.Count + missingReportRepositoryItems.Count; | |||||
| } | |||||
| // This method is called from BlazorRegisterStorageEvent when the storage changed | // This method is called from BlazorRegisterStorageEvent when the storage changed | ||||
| [JSInvokable] | [JSInvokable] | ||||
| public void OnStorageUpdated(string key) { | public void OnStorageUpdated(string key) { | ||||
| Changed?.Invoke(this, EventArgs.Empty); | Changed?.Invoke(this, EventArgs.Empty); | ||||
| } | } | ||||
| } | } | ||||
| public static long GetCurrentTimeInMillis() { | |||||
| return DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond; | |||||
| } | |||||
| public static string GetCurrentDateTimeFromMillis(long millis) { | |||||
| TimeSpan time = TimeSpan.FromMilliseconds(millis); | |||||
| DateTime date = new DateTime() + time; | |||||
| return date.ToString("dd.MM.yyyy HH:mm:ss"); | |||||
| } | |||||
| } | } | ||||
| } | } |
| <PropertyGroup> | <PropertyGroup> | ||||
| <ActiveDebugProfile>CaritasPWA</ActiveDebugProfile> | <ActiveDebugProfile>CaritasPWA</ActiveDebugProfile> | ||||
| <NameOfLastUsedPublishProfile>D:\Work\Caritas\cwebplusApp\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile> | <NameOfLastUsedPublishProfile>D:\Work\Caritas\cwebplusApp\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile> | ||||
| <ShowAllFiles>true</ShowAllFiles> | |||||
| </PropertyGroup> | </PropertyGroup> | ||||
| </Project> | </Project> |
| { | { | ||||
| "host_base_url": "https://integrate.dynalias.net:9443/Fundvelo/", | "host_base_url": "https://integrate.dynalias.net:9443/Fundvelo/", | ||||
| //"host_base_url": "https://vm-caritas/Fundvelo/", | |||||
| "subresource_url_colors": "api/{0}/{1}/fundvelo/colors", | "subresource_url_colors": "api/{0}/{1}/fundvelo/colors", | ||||
| "subresource_url_brands": "api/{0}/{1}/fundvelo/brands", | "subresource_url_brands": "api/{0}/{1}/fundvelo/brands", | ||||
| "subresource_url_types": "api/{0}/{1}/fundvelo/types", | "subresource_url_types": "api/{0}/{1}/fundvelo/types", |
| .mat-toast-container.mat-toast-bottom-center > div { | .mat-toast-container.mat-toast-bottom-center > div { | ||||
| width: 95%; | width: 95%; | ||||
| } | |||||
| .pending_batch { | |||||
| background-color: royalblue; | |||||
| color: white; | |||||
| position: absolute; | |||||
| z-index: 3; | |||||
| transform: translate(-24px, -8px) | |||||
| } | } |
| 'images/batch_kulturlegi.png', | 'images/batch_kulturlegi.png', | ||||
| 'images/batch_markt.png', | 'images/batch_markt.png', | ||||
| 'images/batch_missing.png', | 'images/batch_missing.png', | ||||
| 'images/batch_pending.png', | |||||
| 'images/caritas_logo.png', | 'images/caritas_logo.png', | ||||
| 'images/integrate_logo.png', | 'images/integrate_logo.png', | ||||
| 'images/done.png', | 'images/done.png', |