| <div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-8-tablet mat-layout-grid-cell-span-4-desktop"> | <div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-8-tablet mat-layout-grid-cell-span-4-desktop"> | ||||
| <div class="mat-layout-grid-inner"> | <div class="mat-layout-grid-inner"> | ||||
| <div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-12-desktop"> | <div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-12-desktop"> | ||||
| <MatStringField Class="w-100 form-check-label" Label="@getAddressLbl()" Outlined="true" Required="true" type="text" @bind-Value="@bicycleGeoPosition.Address" ></MatStringField> | |||||
| <MatStringField Class="w-100 form-check-label" Label="@getAddressLbl()" Outlined="true" Required="true" type="text" @bind-Value="@bicycleGeoPosition.Address"></MatStringField> | |||||
| </div> | </div> | ||||
| <div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-12-desktop"> | <div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-12-desktop"> | ||||
| <MatStringField Class="w-100 form-check-label" Label="@getPlaceLbl()" Outlined="true" Required="true" type="text" @bind-Value="@bicycleGeoPosition.City"></MatStringField> | <MatStringField Class="w-100 form-check-label" Label="@getPlaceLbl()" Outlined="true" Required="true" type="text" @bind-Value="@bicycleGeoPosition.City"></MatStringField> | ||||
| loading = true; | loading = true; | ||||
| StateHasChanged(); | StateHasChanged(); | ||||
| try { | try { | ||||
| //string text = new(await JS.InvokeAsync<string>("LoadFile", e)); | |||||
| //imgUrl = text; | |||||
| using (var stream = imgFile.OpenReadStream(MAX_FILE_SIZE)) { | using (var stream = imgFile.OpenReadStream(MAX_FILE_SIZE)) { | ||||
| await stream.ReadAsync(buffer); | await stream.ReadAsync(buffer); | ||||
| imgUrl = $"data:{imgFile.ContentType};base64,{Convert.ToBase64String(buffer)}"; | imgUrl = $"data:{imgFile.ContentType};base64,{Convert.ToBase64String(buffer)}"; | ||||
| } | } | ||||
| } | } | ||||
| //public void Show(MatToastType type, string title, string message, string icon = "") { | |||||
| // Toaster.Add(message, type, title, icon); | |||||
| //} | |||||
| //private async Task OnGatheringPicture(InputFileChangeEventArgs e) { | |||||
| // //public async Task ReadFile() { | |||||
| // //foreach (var file in await fileReaderService.CreateReference(inputTypeFileElement).EnumerateFilesAsync()) { | |||||
| // //IFileInfo fileInfo = await file.ReadFileInfoAsync(); | |||||
| // IBrowserFile imgFile = e.File; | |||||
| // //IFileInfo fileInfo = await imgFile.ReadFileInfoAsync(); | |||||
| // if (fileInfo.Size > MAX_FILE_SIZE) { | |||||
| // Show(MatToastType.Danger, i18n.GetString("Error.PhotoOrPictureToBig.Title"), i18n.GetString("Error.PhotoOrPictureToBig.Msg", MAX_FILE_SIZE / (1024 * 1024))); | |||||
| // } else { | |||||
| // imgUrl = string.Empty; | |||||
| // loading = true; | |||||
| // StateHasChanged(); | |||||
| // byte[] buffer = new byte[fileInfo.Size]; | |||||
| // await using (Stream stream = await imgFile.OpenReadAsync()) { | |||||
| // buffer = new Byte[stream.Length]; | |||||
| // await stream.ReadAsync(buffer); | |||||
| // } | |||||
| // using (MemoryStream memoryStream = await imgFile.CreateMemoryStreamAsync(4096)) { | |||||
| // memoryStream.Read(buffer); | |||||
| // string imageType = fileInfo.Type; | |||||
| // loading = false; | |||||
| // imgUrl = $"data:{imageType};base64,{Convert.ToBase64String(buffer)}"; | |||||
| // StateHasChanged(); | |||||
| // } | |||||
| // //} | |||||
| // } | |||||
| //} | |||||
| } | } |
| using Microsoft.AspNetCore.Components; | |||||
| using System; | |||||
| using System.Threading.Tasks; | |||||
| using FisSst.BlazorMaps; | |||||
| using BlazorGeolocation; | |||||
| using Microsoft.Extensions.Localization; | |||||
| using CaritasPWA.Shared.ResourceFiles; | |||||
| using BlazorGeolocation; | |||||
| using CaritasPWA.Shared.Models; | using CaritasPWA.Shared.Models; | ||||
| using CaritasPWA.Shared.ResourceFiles; | |||||
| using CaritasPWA.Shared.Services; | using CaritasPWA.Shared.Services; | ||||
| using FisSst.BlazorMaps; | |||||
| using Microsoft.AspNetCore.Components; | |||||
| using Microsoft.Extensions.Localization; | |||||
| using System; | |||||
| using System.Threading.Tasks; | |||||
| namespace CaritasPWA.Pages { | namespace CaritasPWA.Pages { | ||||
| public partial class CaritasServiceFundVeloKeyDataPageBase : ComponentBase { | public partial class CaritasServiceFundVeloKeyDataPageBase : ComponentBase { | ||||
| private async Task OnMouseMapClicked(MouseEvent mouseEvent) { | private async Task OnMouseMapClicked(MouseEvent mouseEvent) { | ||||
| await AddBicycleMarkerOnClickPosition(mouseEvent); | await AddBicycleMarkerOnClickPosition(mouseEvent); | ||||
| this.bicycleGeoPosition.Latitude = mouseEvent.LatLng.Lat; | this.bicycleGeoPosition.Latitude = mouseEvent.LatLng.Lat; | ||||
| this.bicycleGeoPosition.Longitude = mouseEvent.LatLng.Lng; | this.bicycleGeoPosition.Longitude = mouseEvent.LatLng.Lng; | ||||
| NominatimReverseAddress addressDto = await nominatimService.GetAddressForCoordinates(mouseEvent.LatLng.Lat, mouseEvent.LatLng.Lng); | NominatimReverseAddress addressDto = await nominatimService.GetAddressForCoordinates(mouseEvent.LatLng.Lat, mouseEvent.LatLng.Lng); | ||||
| if (addressDto != null) { | if (addressDto != null) { | ||||
| this.bicycleGeoPosition.Address = getFormattedAddressStreet(addressDto); | this.bicycleGeoPosition.Address = getFormattedAddressStreet(addressDto); | ||||
| } else { | } else { | ||||
| Show(MatBlazor.MatToastType.Warning, I18n.GetString("Warning.Nominatim.Title"), I18n.GetString("Warning.Nominatim.Msg")); | Show(MatBlazor.MatToastType.Warning, I18n.GetString("Warning.Nominatim.Title"), I18n.GetString("Warning.Nominatim.Msg")); | ||||
| } | } | ||||
| StateHasChanged(); | StateHasChanged(); | ||||
| } | } | ||||
| using BlazorGeolocation; | |||||
| using CaritasPWA.Shared; | using CaritasPWA.Shared; | ||||
| using CaritasPWA.Shared.Services; | using CaritasPWA.Shared.Services; | ||||
| using FisSst.BlazorMaps.DependencyInjection; | using FisSst.BlazorMaps.DependencyInjection; | ||||
| using BlazorGeolocation; | |||||
| using MatBlazor; | using MatBlazor; | ||||
| using Microsoft.AspNetCore.Components.WebAssembly.Hosting; | using Microsoft.AspNetCore.Components.WebAssembly.Hosting; | ||||
| using Microsoft.Extensions.DependencyInjection; | using Microsoft.Extensions.DependencyInjection; |
| public string Name { get; set; } | public string Name { get; set; } | ||||
| public string RGB { get; set; } | public string RGB { get; set; } | ||||
| public ColorItem() { } | |||||
| public ColorItem() { } | |||||
| public ColorItem(int index, string name, string rgb) { | public ColorItem(int index, string name, string rgb) { | ||||
| Index = index; | Index = index; |
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Threading.Tasks; | |||||
| namespace CaritasPWA.Shared.Models { | |||||
| namespace CaritasPWA.Shared.Models { | |||||
| public class BicycleGeoPosition { | public class BicycleGeoPosition { | ||||
| public BicycleGeoPosition() { | public BicycleGeoPosition() { |
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Threading.Tasks; | |||||
| using Json.Net; | |||||
| namespace CaritasPWA.Shared.Models { | |||||
| namespace CaritasPWA.Shared.Models { | |||||
| public class NominatimReverseAddress { | public class NominatimReverseAddress { | ||||
| public string place_id; | public string place_id; |
| using System; | |||||
| using System.Collections.Generic; | |||||
| using CaritasPWA.Shared.Models; | |||||
| using Json.Net; | |||||
| using System; | |||||
| using System.Globalization; | using System.Globalization; | ||||
| using System.Linq; | |||||
| using System.Net.Http; | using System.Net.Http; | ||||
| using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
| using CaritasPWA.Shared.Models; | |||||
| using Json.Net; | |||||
| namespace CaritasPWA.Shared.Services { | namespace CaritasPWA.Shared.Services { | ||||
| public class NominatimService { | public class NominatimService { | ||||
| }; | }; | ||||
| try { | try { | ||||
| HttpResponseMessage httpResult = await httpClient.GetAsync(string.Format("reverse?format=json&lat={0}&lon={1}", lat, lng)); | HttpResponseMessage httpResult = await httpClient.GetAsync(string.Format("reverse?format=json&lat={0}&lon={1}", lat, lng)); | ||||
| if (httpResult.StatusCode == System.Net.HttpStatusCode.OK) { | if (httpResult.StatusCode == System.Net.HttpStatusCode.OK) { | ||||
| NominatimReverseAddress addressDto = JsonNet.Deserialize<NominatimReverseAddress>(await httpResult.Content.ReadAsStringAsync()); | NominatimReverseAddress addressDto = JsonNet.Deserialize<NominatimReverseAddress>(await httpResult.Content.ReadAsStringAsync()); | ||||
| return addressDto; | return addressDto; |
| :root { | |||||
| body { | |||||
| overscroll-behavior-y: contain; | |||||
| } | |||||
| :root { | |||||
| --caritas-red: #db001b; | --caritas-red: #db001b; | ||||
| --caritas-red-accent: #FF4081; | --caritas-red-accent: #FF4081; | ||||
| --caritas-red-dark: #d0001a; | --caritas-red-dark: #d0001a; |
| const fileInput = document.getElementById('file-999'); | |||||
| fileInput.addEventListener('change', (e) => LoadFiles(e.target.files)); | |||||
| function LoadFiles(fileList) { | |||||
| let file = null; | |||||
| for (let i = 0; i < fileList.length;) { | |||||
| if (fileList[i].type.match(/^image\//)) { | |||||
| file = fileList[i]; | |||||
| break; | |||||
| } | |||||
| } | |||||
| } | |||||
| <head> | <head> | ||||
| <title>Caritas PWA</title> | <title>Caritas PWA</title> | ||||
| <base href="/FundveloApp/" /> | |||||
| <base href="/" /> | |||||
| <meta charset="utf-8" /> | <meta charset="utf-8" /> | ||||
| <meta name="description" content="Caritas PWA, developed by INTEGRATE AG, Switzerland"> | <meta name="description" content="Caritas PWA, developed by INTEGRATE AG, Switzerland"> | ||||
| <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, user-scalable=yes" /> | <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, user-scalable=yes" /> | ||||
| integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA==" | integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA==" | ||||
| crossorigin=""> | crossorigin=""> | ||||
| </script> | </script> | ||||
| <script> | |||||
| window.LoadFile = (evt) => { | |||||
| var tgt = evt.target || window.event.srcElement, | |||||
| files = tgt.files; | |||||
| let file = files[0]; | |||||
| file64 = URL.createObjectURL(file); | |||||
| //const reader = new FileReader(); | |||||
| //reader.onloadend = function () { | |||||
| // file64 = reader.result; | |||||
| //} | |||||
| //reader.addEventListener("load", function () { | |||||
| // file64 = reader.result; | |||||
| //}, false); | |||||
| //if (file) { | |||||
| // // reader.readAsDataURL(file); | |||||
| // read(reader); | |||||
| //} | |||||
| return file64; | |||||
| } | |||||
| async function read(reader) { | |||||
| await reader.readAsDataURL(file); | |||||
| } | |||||
| </script> | |||||
| </body> | </body> | ||||