Selaa lähdekoodia

- Found / Missing history

- Scroll lock bug
- Minor fixes
master
Flo Smilari 4 vuotta sitten
vanhempi
commit
ee57f36226

+ 51
- 40
Pages/CaritasServiceFundVeloPendingOverviewPage.razor Näytä tiedosto

@@ -9,39 +9,40 @@
@inject ReportRepositoryService ReportRepositoryService
@inject IStringLocalizer<Resources> i18n;
@inject Toaster Toaster;
@inject IMatDialogService MatDialogService;
@inject ScrollLockRemover ScrollLockRemover;
<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 style="@getTypeBackgroundStyle(context.ReportType)">@translateType(context.ReportType)</td>
<td style="white-space: nowrap">@ReportRepositoryService.GetCurrentDateTimeFromMillis(context.ID)</td>
<td style="white-space: nowrap">@getAddress(context)</td>
<td>@getPicture(context)</td>
<td>
<MatIconButton Icon="delete_forever" OnClick="@(_ => DeleteReport(context))"></MatIconButton>
</td>
</MatTableRow>
</MatTable>
</div>
</div>
<div class="row px-3">
<div class="row no-gutters align-items-start justify-content-center w-100" style="padding-top:1em">
<h2>@i18n["Pending"]</h2>
</div>
<div class="row no-gutters align-items-start w-100">
<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 style="width:2400px">@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 style="@getTypeBackgroundStyle(context.ReportType)">@translateType(context.ReportType)</td>
<td style="white-space: nowrap">@ReportRepositoryService.GetCurrentDateTimeFromMillis(context.ID)</td>
<td style="white-space: nowrap">@getAddress(context)</td>
<td>@getPicture(context)</td>
<td>
<MatIconButton Icon="delete_forever" OnClick="@(_ => DeleteReport(context))"></MatIconButton>
</td>
</MatTableRow>
</MatTable>
</div>
</div>
@@ -80,7 +81,11 @@
private string getAddress(ReportRepositoryItem item) {
return ReportRepositoryItem.Type.FOUND.Equals(item.ReportType) ? ((FoundReportRepositoryItem)item).Report.GeographicInfo.Address : "";
if (ReportRepositoryItem.Type.FOUND.Equals(item.ReportType)) {
GeographicInfo geoInfo = ((FoundReportRepositoryItem)item).Report.GeographicInfo;
return geoInfo.Address + ", " + geoInfo.Postcode + " " + geoInfo.Town;
}
return "";
}
private string getPicture(ReportRepositoryItem item) {
@@ -89,13 +94,19 @@
}
private async void DeleteReport(ReportRepositoryItem item) {
try {
await ReportRepositoryService.DeleteReport(item);
pendingReports.Remove(item);
StateHasChanged();
Toaster.ShowSuccess(i18n.GetString("Success.DeleteReport.Title"), i18n.GetString("Success.DeleteReport.Msg", item.ID));
} catch (Exception ex) {
Toaster.ShowWarning(i18n.GetString("Error.DeleteReport.Title"), i18n.GetString("Error.DeleteReport.Msg", item.ID));
string yes = i18n.GetString("Yes");
string no = i18n.GetString("No");
string result = await MatDialogService.AskAsync(i18n.GetString("Pending." + item.ReportType + ".Delete"), new string[] { yes, no });
await ScrollLockRemover.removeScrollLockAsync();
if (result.Equals(yes)) {
try {
await ReportRepositoryService.DeleteReport(item);
pendingReports.Remove(item);
StateHasChanged();
Toaster.ShowSuccess(i18n.GetString("Success.DeleteReport.Title"), i18n.GetString("Success.DeleteReport.Msg", item.ID));
} catch (Exception ex) {
Toaster.ShowWarning(i18n.GetString("Error.DeleteReport.Title"), i18n.GetString("Error.DeleteReport.Msg", item.ID));
}
}
}

+ 1
- 0
Program.cs Näytä tiedosto

@@ -25,6 +25,7 @@ namespace CaritasPWA {
builder.Services.AddSingleton<PageHistoryManager>();
builder.Services.AddSingleton<ReportDataProvider>();
builder.Services.AddSingleton<OnlineStatusProvider>();
builder.Services.AddSingleton<ScrollLockRemover>();
builder.Services.AddScoped<ReportRepositoryService>();
builder.Services.AddScoped<Toaster>();
builder.Services.AddScoped<UserDataProvider>();

+ 1
- 0
Shared/MainLayout.razor Näytä tiedosto

@@ -7,6 +7,7 @@
</div>
</div>
<MatToastContainer />
<MatPortalHost />

+ 25
- 2
Shared/Models/OSM/BicycleGeoPosition.cs Näytä tiedosto

@@ -1,13 +1,22 @@
namespace cwebplusApp.Shared.Models {
using System;
namespace cwebplusApp.Shared.Models {
public class BicycleGeoPosition {
private string displayCity;
public double Latitude { get; set; }
public double Longitude { get; set; }
public string Address { get; set; }
public string City { get; set; }
public string Zip { get; set; }
public string DisplayCity { get; set; }
public string DisplayCity {
get { return displayCity; }
set {
displayCity = value;
decodeDisplayCity(value);
}
}
public BicycleGeoPosition() {
Latitude = 0.0;
@@ -17,5 +26,19 @@
City = "";
DisplayCity = "";
}
private void decodeDisplayCity(string displayCity) {
if (!String.IsNullOrEmpty(displayCity)) {
char[] delimiterChars = { '-', ' ' };
string[] tokens = displayCity.Split(delimiterChars);
if (tokens.Length == 3) {
Zip = tokens[1];
City = tokens[2];
} else if (tokens.Length == 2) {
Zip = tokens[0];
City = tokens[1];
}
}
}
}
}

+ 1
- 6
Shared/Models/SearchService.cs Näytä tiedosto

@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace cwebplusApp.Shared.Models {
namespace cwebplusApp.Shared.Models {
public class SearchService {
public int Id { get; set; }

+ 41
- 17
Shared/NavMenu.razor Näytä tiedosto

@@ -47,19 +47,36 @@
<MatListItemText Style="padding-left:0.5em">@i18n["account"]</MatListItemText>
</MatListItem>
</MatRipple>
<MatNavMenu @ref="extrasNavMenu">
<MatNavSubMenu @bind-Expanded="@navSubMenuOpen">
<MatNavSubMenuHeader Title=@i18n["Extras"]>
<MatNavItem AllowSelection="false">
<MatIcon Icon="@MatIconNames.View_quilt" />&nbsp; @i18n["Extras"]
</MatNavItem>
</MatNavSubMenuHeader>
<MatNavSubMenuList>
<MatNavSubMenu>
<MatNavSubMenuHeader>
<MatNavItem AllowSelection="false">
<MatIcon Icon="@MatIconNames.Directions_bike" />&nbsp; @i18n["fundvelo/lost_found"]
</MatNavItem>
</MatNavSubMenuHeader>
<MatNavSubMenuList>
<MatNavItem Href="fundvelo/history_found" AllowSelection="true" Class="@((Index == 3)? "selected": "")" @onclick="@((e) => ButtonClicked(3))">
<MatIcon Icon="@MatIconNames.History" />&nbsp; @i18n["HistoryFound"]
</MatNavItem>
<MatNavItem Href="fundvelo/history_missing" AllowSelection="true" Class="@((Index == 4)? "selected": "")" @onclick="@((e) => ButtonClicked(4))">
<MatIcon Icon="@MatIconNames.History" />&nbsp; @i18n["HistoryMissing"]
</MatNavItem>
</MatNavSubMenuList>
</MatNavSubMenu>
</MatNavSubMenuList>
</MatNavSubMenu>
</MatNavMenu>
<MatRipple Class="navmenu-mat-ripple" Color="@MatRippleColor.Default">
<MatListItem Class="@((Index == 3) ? "bg-primary-color text-white" : "")" Style="margin-left:0;margin-right:0"
Disabled="true"
Href="extras"
@onclick="@((e) => ButtonClicked(3))">
<MatIcon Icon="@MatIconNames.View_quilt"></MatIcon>
<MatListItemText Style="padding-left:0.5em">@i18n["Extras"]</MatListItemText>
</MatListItem>
</MatRipple>
<MatRipple Class="navmenu-mat-ripple" Color="@MatRippleColor.Default">
<MatListItem Class="@((Index == 4) ? "bg-primary-color text-white" : "")" Style="margin-left:0;margin-right:0"
<MatListItem Class="@((Index == 5) ? "bg-primary-color text-white" : "")" Style="margin-left:0;margin-right:0"
Href="info"
@onclick="@((e) => ButtonClicked(4))">
@onclick="@((e) => ButtonClicked(5))">
<MatIcon Icon="@MatIconNames.Error_outline" Style="transform: rotate(180deg)"></MatIcon>
<MatListItemText Style="padding-left:0.5em">@i18n["info"]</MatListItemText>
</MatListItem>
@@ -76,9 +93,10 @@
@code {
private MatNavMenu extrasNavMenu;
private bool navSubMenuOpen = false;
private bool Opened = false;
private static int Index = 1;
private int Index = 1;
private string locUrl;
private string LocationUrl {
@@ -109,6 +127,8 @@
private void ButtonClicked(int _Index) {
Index = _Index;
navSubMenuOpen = (Index == 3 || Index == 4);
StateHasChanged();
ButtonClicked();
}
@@ -123,10 +143,12 @@
Index = 1;
} else if (e.Location.Contains("account")) {
Index = 2;
} else if (e.Location.Contains("extras")) {
} else if (e.Location.Contains("history_found")) {
Index = 3;
} else if (e.Location.Contains("info")) {
} else if (e.Location.Contains("history_missing")) {
Index = 4;
} else if (e.Location.Contains("info")) {
Index = 5;
} else {
Index = 0;
}
@@ -150,10 +172,12 @@
Index = 1;
} else if (delta.Equals("account")) {
Index = 2;
} else if (delta.Equals("extras")) {
} else if (delta.Equals("fundvelo/history_found")) {
Index = 3;
} else if (delta.Equals("info")) {
} else if (delta.Equals("fundvelo/history_missing")) {
Index = 4;
} else if (delta.Equals("info")) {
Index = 5;
} else {
Index = 0;
}

+ 30
- 0
Shared/ResourceFiles/Resources.de.resx Näytä tiedosto

@@ -369,6 +369,12 @@
<data name="fundvelo/conclusion_missing" xml:space="preserve">
<value>Fundvelo &gt; Vermisst &gt; Bestätigung</value>
</data>
<data name="fundvelo/history_found" xml:space="preserve">
<value>Fundvelo &gt; Historie Fundmeldungen</value>
</data>
<data name="fundvelo/history_missing" xml:space="preserve">
<value>Fundvelo &gt; Historie Suchaufträge</value>
</data>
<data name="fundvelo/keydata/Found" xml:space="preserve">
<value>Fundvelo &gt; Gefunden &gt; Daten</value>
</data>
@@ -381,6 +387,15 @@
<data name="fundvelo/pending_overview" xml:space="preserve">
<value>Fundvelo &gt; Übersicht Pendente</value>
</data>
<data name="History.DELETE" xml:space="preserve">
<value>Wollen Sie die Historie wirklich löschen?</value>
</data>
<data name="HistoryFound" xml:space="preserve">
<value>Historie Fundmeldungen</value>
</data>
<data name="HistoryMissing" xml:space="preserve">
<value>Historie Suchaufträge</value>
</data>
<data name="info" xml:space="preserve">
<value>Info</value>
</data>
@@ -426,9 +441,21 @@
<data name="Mobile" xml:space="preserve">
<value>Mobile</value>
</data>
<data name="No" xml:space="preserve">
<value>Nein</value>
</data>
<data name="Password" xml:space="preserve">
<value>Passwort</value>
</data>
<data name="Pending" xml:space="preserve">
<value>Pendente</value>
</data>
<data name="Pending.FOUND.Delete" xml:space="preserve">
<value>Wollen Sie die Fundmeldung wirklich löschen?</value>
</data>
<data name="Pending.MISSING.Delete" xml:space="preserve">
<value>Wollen Sie den Suchauftrag wirklich löschen?</value>
</data>
<data name="Phone" xml:space="preserve">
<value>Telefon</value>
</data>
@@ -516,6 +543,9 @@
<data name="Welcome" xml:space="preserve">
<value>Willkommen bei Caritas!</value>
</data>
<data name="Yes" xml:space="preserve">
<value>Ja</value>
</data>
<data name="Zip" xml:space="preserve">
<value>PLZ</value>
</data>

+ 30
- 0
Shared/ResourceFiles/Resources.fr.resx Näytä tiedosto

@@ -369,6 +369,12 @@
<data name="fundvelo/conclusion_missing" xml:space="preserve">
<value>Velo &gt;Perdue &gt; Data trouver</value>
</data>
<data name="fundvelo/history_found" xml:space="preserve">
<value>Velo &gt; Histoire des Rapport de découverte</value>
</data>
<data name="fundvelo/history_missing" xml:space="preserve">
<value>Velo &gt; Historie des Rapport de disparition</value>
</data>
<data name="fundvelo/keydata/Found" xml:space="preserve">
<value>Velo &gt;Trouvé &gt; Data</value>
</data>
@@ -381,6 +387,15 @@
<data name="fundvelo/pending_overview" xml:space="preserve">
<value>Velo &gt; Raportes en attente</value>
</data>
<data name="History.DELETE" xml:space="preserve">
<value>Voulez-vous vraiment supprimer l'historique?</value>
</data>
<data name="HistoryFound" xml:space="preserve">
<value>Histoire des Rapport de découverte</value>
</data>
<data name="HistoryMissing" xml:space="preserve">
<value>Historie des Rapport de disparition</value>
</data>
<data name="info" xml:space="preserve">
<value>Information</value>
</data>
@@ -426,9 +441,21 @@
<data name="Mobile" xml:space="preserve">
<value>Mobile</value>
</data>
<data name="No" xml:space="preserve">
<value>Non</value>
</data>
<data name="Password" xml:space="preserve">
<value>Mot de passe</value>
</data>
<data name="Pending" xml:space="preserve">
<value>Attente</value>
</data>
<data name="Pending.FOUND.Delete" xml:space="preserve">
<value>Voulez-vous vraiment supprimer le rapport de découverte?</value>
</data>
<data name="Pending.MISSING.Delete" xml:space="preserve">
<value>Voulez-vous vraiment supprimer le rapport de disparition?</value>
</data>
<data name="Phone" xml:space="preserve">
<value>Téléphone</value>
</data>
@@ -516,6 +543,9 @@
<data name="Welcome" xml:space="preserve">
<value>Bienvenue chez Caritas!</value>
</data>
<data name="Yes" xml:space="preserve">
<value>Oui</value>
</data>
<data name="Zip" xml:space="preserve">
<value>Code postal</value>
</data>

+ 30
- 0
Shared/ResourceFiles/Resources.it.resx Näytä tiedosto

@@ -369,6 +369,12 @@
<data name="fundvelo/conclusion_missing" xml:space="preserve">
<value>Bicicletta &gt; Perduta &gt; Conferma</value>
</data>
<data name="fundvelo/history_found" xml:space="preserve">
<value>Bicicletta &gt; Cronologia Raporti Ritrovamento</value>
</data>
<data name="fundvelo/history_missing" xml:space="preserve">
<value>Bicicletta &gt; Cronologia Raporti perdita</value>
</data>
<data name="fundvelo/keydata/Found" xml:space="preserve">
<value>Bicicletta &gt; Trovata &gt; Dati</value>
</data>
@@ -381,6 +387,15 @@
<data name="fundvelo/pending_overview" xml:space="preserve">
<value>Bicicletta &gt; Raporti in attesa</value>
</data>
<data name="History.DELETE" xml:space="preserve">
<value>É sicuro di volere cancellare la cronologia?</value>
</data>
<data name="HistoryFound" xml:space="preserve">
<value>Cronologia Raporti Ritrovamento</value>
</data>
<data name="HistoryMissing" xml:space="preserve">
<value>Cronologia Raporti perdita</value>
</data>
<data name="info" xml:space="preserve">
<value>Informazione</value>
</data>
@@ -426,9 +441,21 @@
<data name="Mobile" xml:space="preserve">
<value>Cellulare</value>
</data>
<data name="No" xml:space="preserve">
<value>No</value>
</data>
<data name="Password" xml:space="preserve">
<value>Password</value>
</data>
<data name="Pending" xml:space="preserve">
<value>In Attesa</value>
</data>
<data name="Pending.FOUND.Delete" xml:space="preserve">
<value>É sicuro di volere cancellare il rapporto di ritrovamento?</value>
</data>
<data name="Pending.MISSING.Delete" xml:space="preserve">
<value>É sicuro di volere cancellare il rapporto di perdita</value>
</data>
<data name="Phone" xml:space="preserve">
<value>Telefono</value>
</data>
@@ -516,6 +543,9 @@
<data name="Welcome" xml:space="preserve">
<value>Benvenuti alla Caritas!</value>
</data>
<data name="Yes" xml:space="preserve">
<value>Si</value>
</data>
<data name="Zip" xml:space="preserve">
<value>CAP</value>
</data>

+ 30
- 0
Shared/ResourceFiles/Resources.resx Näytä tiedosto

@@ -369,6 +369,12 @@
<data name="fundvelo/conclusion_missing" xml:space="preserve">
<value>Bicycle &gt; Missing &gt; Confirmation</value>
</data>
<data name="fundvelo/history_found" xml:space="preserve">
<value>Bicycle &gt; History Found Reports</value>
</data>
<data name="fundvelo/history_missing" xml:space="preserve">
<value>Bicycle &gt; History Missing Reports</value>
</data>
<data name="fundvelo/keydata/Found" xml:space="preserve">
<value>Bicycle &gt; Found &gt;Data</value>
</data>
@@ -381,6 +387,15 @@
<data name="fundvelo/pending_overview" xml:space="preserve">
<value>Bicycle &gt; Overview Pendigs</value>
</data>
<data name="History.DELETE" xml:space="preserve">
<value>Do you really want to delete the history?</value>
</data>
<data name="HistoryFound" xml:space="preserve">
<value>History Found Reports</value>
</data>
<data name="HistoryMissing" xml:space="preserve">
<value>History Missing Reports</value>
</data>
<data name="info" xml:space="preserve">
<value>Info</value>
</data>
@@ -426,9 +441,21 @@
<data name="Mobile" xml:space="preserve">
<value>Mobile</value>
</data>
<data name="No" xml:space="preserve">
<value>No</value>
</data>
<data name="Password" xml:space="preserve">
<value>Password</value>
</data>
<data name="Pending" xml:space="preserve">
<value>Pending</value>
</data>
<data name="Pending.FOUND.Delete" xml:space="preserve">
<value>Do you really want to delete the found report?</value>
</data>
<data name="Pending.MISSING.Delete" xml:space="preserve">
<value>Do you really want to delete the missing report?</value>
</data>
<data name="Phone" xml:space="preserve">
<value>Phone</value>
</data>
@@ -516,6 +543,9 @@
<data name="Welcome" xml:space="preserve">
<value>Welcome to Caritas!</value>
</data>
<data name="Yes" xml:space="preserve">
<value>Yes</value>
</data>
<data name="Zip" xml:space="preserve">
<value>Zip</value>
</data>

+ 1
- 1
Shared/Services/MasterDataService.cs Näytä tiedosto

@@ -57,7 +57,7 @@ namespace cwebplusApp.Shared.Services {
_brands = Defaults.GetBrandDefaults(_i18n).ToArray();
_colors = Defaults.GetColorDefaults(_i18n).ToArray();
_bicycleTypes = Defaults.GetBicycleTypeDefaults(_i18n).ToArray();
_searchServices= Defaults.GetSearchServiceDefaults(_i18n).ToArray();
_searchServices = Defaults.GetSearchServiceDefaults(_i18n).ToArray();
}
public async Task SynchronizeMasterdata() {

+ 5
- 0
wwwroot/css/app.css Näytä tiedosto

@@ -243,4 +243,9 @@ div.mat-select.required span#outlined-select-label.mdc-floating-label::after {
position: absolute;
z-index: 3;
transform: translate(-24px, -8px)
}
.mdc-nav-item.selected {
background-color: var(--primary);
color: #fff !important;
}

+ 4
- 0
wwwroot/index.html Näytä tiedosto

@@ -64,6 +64,10 @@
window.addEventListener("online", onlineStatusHandler);
window.addEventListener("offline", onlineStatusHandler);
}
function RemoveScrollLock(dotNetObjRef) {
document.querySelector("body.mdc-dialog-scroll-lock")?.classList.remove("mdc-dialog-scroll-lock");
}
</script>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"

+ 1
- 1
wwwroot/manifest.json Näytä tiedosto

@@ -5,7 +5,7 @@
"display": "standalone",
"background_color": "#ffffff",
"theme_color": "#ffffff",
"orientation": "portrait-primary",
"orientation": "any",
"icons": [
{
"src": "icons/icon-48.png",

+ 3
- 0
wwwroot/service-worker.js Näytä tiedosto

@@ -18,6 +18,9 @@ const assets = [
'/keydata/Missing',
'/conclusion_found',
'/conclusion_missing',
'/pending_overview',
'/history_found',
'/history_missing',
'/doneimage',
'/failureimage',
'/warningimage',

Loading…
Peruuta
Tallenna