diff --git a/CartriX.Web/Layout/MainLayout.razor b/CartriX.Web/Layout/MainLayout.razor index aaa1b6f..4716145 100644 --- a/CartriX.Web/Layout/MainLayout.razor +++ b/CartriX.Web/Layout/MainLayout.razor @@ -1,6 +1,8 @@ @inherits LayoutComponentBase + + - + diff --git a/CartriX.Web/Layout/Sidebar.razor b/CartriX.Web/Layout/Sidebar.razor index 751df84..3591c83 100644 --- a/CartriX.Web/Layout/Sidebar.razor +++ b/CartriX.Web/Layout/Sidebar.razor @@ -4,16 +4,12 @@ - - - - - + diff --git a/CartriX.Web/Pages/Dashboard.razor b/CartriX.Web/Pages/Dashboard.razor index 6d92499..408755d 100644 --- a/CartriX.Web/Pages/Dashboard.razor +++ b/CartriX.Web/Pages/Dashboard.razor @@ -4,5 +4,8 @@

Dashboard

@code { - + protected async override Task OnInitializedAsync() + { + + } } diff --git a/CartriX.Web/Pages/PrinterPage.razor b/CartriX.Web/Pages/PrinterPage.razor index a59d817..fbc2c28 100644 --- a/CartriX.Web/Pages/PrinterPage.razor +++ b/CartriX.Web/Pages/PrinterPage.razor @@ -4,4 +4,9 @@ @code { [Parameter] public int PrinterId { get; set; } + + protected async override Task OnInitializedAsync() + { + PageTitleService.Title = "Информация о принтере"; + } } diff --git a/CartriX.Web/Pages/PrintersPage/Components/PrinterCard.razor b/CartriX.Web/Pages/PrintersPage/Components/PrinterCard.razor index e979d63..8968c1f 100644 --- a/CartriX.Web/Pages/PrintersPage/Components/PrinterCard.razor +++ b/CartriX.Web/Pages/PrintersPage/Components/PrinterCard.razor @@ -1,4 +1,6 @@ @inject NavigationManager navigationManager +@inject DialogService DialogService +@inject IJSRuntime JS @@ -13,9 +15,10 @@
- + - + + @@ -23,6 +26,31 @@ @code { [EditorRequired][Parameter] public Shared.Models.Printer.PrinterItemList Printer { get; set; } + protected async override Task OnInitializedAsync() + { + } + async Task ChangeCartridgeClick() + { + bool isPhone = await JS.InvokeAsync("getDeviceInfo"); + if (!isPhone) + { + var result = await DialogService.OpenAsync("Simple Dialog", ds => + @ + + + + + ); + } + else + { + navigationManager.NavigateTo($"/Printer/{Printer.Id}/CartridgeReplace"); + } + } + async Task DeleteClick() + { + await JS.InvokeVoidAsync("alert", "Удалить"); + } } diff --git a/CartriX.Web/Pages/PrintersPage/PrintersPage.razor b/CartriX.Web/Pages/PrintersPage/PrintersPage.razor index 554ac95..4539b70 100644 --- a/CartriX.Web/Pages/PrintersPage/PrintersPage.razor +++ b/CartriX.Web/Pages/PrintersPage/PrintersPage.razor @@ -1,6 +1,7 @@ @page "/Printers" @using CartriX.Web.Pages.PrintersPage.Components @inject HttpClient http +@inject IJSRuntime JS +@if (isPhone) +{ + +} + + + + + + @if (!isPhone) + { + + } + + @foreach (var location in locationItems) { - + - - - + + + + + + + + @@ -35,12 +56,15 @@ @code { - List locationItems = new(); + bool isPhone = false; + protected override async Task OnInitializedAsync() { + isPhone = await JS.InvokeAsync("getDeviceInfo"); await GetLocations(); + } async Task GetLocations() diff --git a/CartriX.Web/Program.cs b/CartriX.Web/Program.cs index ba642d0..b6757f9 100644 --- a/CartriX.Web/Program.cs +++ b/CartriX.Web/Program.cs @@ -1,4 +1,5 @@ using CartriX.Web; +using CartriX.Web.Services; using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.Components.WebAssembly.Hosting; using Radzen; @@ -10,5 +11,6 @@ builder.RootComponents.Add("#app"); builder.RootComponents.Add("head::after"); builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://0.0.0.0:5001/") }); +builder.Services.AddScoped(); await builder.Build().RunAsync(); diff --git a/CartriX.Web/Services/PageTitleService.cs b/CartriX.Web/Services/PageTitleService.cs new file mode 100644 index 0000000..22ccbc0 --- /dev/null +++ b/CartriX.Web/Services/PageTitleService.cs @@ -0,0 +1,7 @@ +namespace CartriX.Web.Services +{ + public class PageTitleService + { + public string Title { get; set; } = ""; + } +} diff --git a/CartriX.Web/_Imports.razor b/CartriX.Web/_Imports.razor index 230b5ec..11ea507 100644 --- a/CartriX.Web/_Imports.razor +++ b/CartriX.Web/_Imports.razor @@ -1,15 +1,15 @@ @using System.Net.Http @using System.Net.Http.Json +@using CartriX.Shared +@using CartriX.Shared.Models +@using CartriX.Web +@using CartriX.Web.Layout @using Microsoft.AspNetCore.Components.Forms @using Microsoft.AspNetCore.Components.Routing @using Microsoft.AspNetCore.Components.Web @using Microsoft.AspNetCore.Components.Web.Virtualization @using Microsoft.AspNetCore.Components.WebAssembly.Http @using Microsoft.JSInterop -@using CartriX.Web -@using CartriX.Web.Layout -@using Radzen -@using Radzen.Blazor @using Newtonsoft.Json -@using CartriX.Shared.Models -@using CartriX.Shared \ No newline at end of file +@using Radzen +@using Radzen.Blazor \ No newline at end of file diff --git a/CartriX.Web/wwwroot/index.html b/CartriX.Web/wwwroot/index.html index 7ea15dd..73c7c65 100644 --- a/CartriX.Web/wwwroot/index.html +++ b/CartriX.Web/wwwroot/index.html @@ -15,6 +15,7 @@ + diff --git a/CartriX.Web/wwwroot/scripts/CheckDevice.js b/CartriX.Web/wwwroot/scripts/CheckDevice.js new file mode 100644 index 0000000..69f0b89 --- /dev/null +++ b/CartriX.Web/wwwroot/scripts/CheckDevice.js @@ -0,0 +1,4 @@ +window.getDeviceInfo = () => { + return navigator.userAgentData?.mobile ?? + /Android|iPhone|iPad/i.test(navigator.userAgent); +}; \ No newline at end of file