версия 2.0.10: после загрузки прайса — сразу в «Прайс-лист»; Enter в поле кол-ва добавляет в заказ
Some checks failed
Desktop tests / test (push) Has been cancelled
Some checks failed
Desktop tests / test (push) Has been cancelled
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
3d89fac6e0
commit
96aa963c27
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#define MyAppName "Электронная Фармация"
|
#define MyAppName "Электронная Фармация"
|
||||||
#define MyAppBrand "ЭльФиСА"
|
#define MyAppBrand "ЭльФиСА"
|
||||||
#define MyAppVersion "2.0.9"
|
#define MyAppVersion "2.0.10"
|
||||||
#define MyAppPublisher "PharmData"
|
#define MyAppPublisher "PharmData"
|
||||||
#define MyAppURL "https://cdn.24pharmdata.ru"
|
#define MyAppURL "https://cdn.24pharmdata.ru"
|
||||||
#define MyAppSupportURL "https://24pharmdata.ru"
|
#define MyAppSupportURL "https://24pharmdata.ru"
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||||
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
||||||
<Version>2.0.9</Version>
|
<Version>2.0.10</Version>
|
||||||
<AssemblyVersion>2.0.9.0</AssemblyVersion>
|
<AssemblyVersion>2.0.9.0</AssemblyVersion>
|
||||||
<FileVersion>2.0.9.0</FileVersion>
|
<FileVersion>2.0.9.0</FileVersion>
|
||||||
<Product>ЭльФиСА — Электронная Фармация</Product>
|
<Product>ЭльФиСА — Электронная Фармация</Product>
|
||||||
|
|||||||
@ -92,6 +92,9 @@ public partial class LoadPriceViewModel : ViewModelBase
|
|||||||
var suppliers = all.Select(x => x.SupplierName).Where(s => !string.IsNullOrWhiteSpace(s)).Distinct().Count();
|
var suppliers = all.Select(x => x.SupplierName).Where(s => !string.IsNullOrWhiteSpace(s)).Distinct().Count();
|
||||||
Result = $"Прайс загружен: {all.Count} позиций от {suppliers} поставщик(ов).";
|
Result = $"Прайс загружен: {all.Count} позиций от {suppliers} поставщик(ов).";
|
||||||
OnPropertyChanged(nameof(LastLoaded));
|
OnPropertyChanged(nameof(LastLoaded));
|
||||||
|
|
||||||
|
// Успешно загрузили → сразу в раздел «Прайс-лист».
|
||||||
|
ShellNavigator.Navigate?.Invoke("Прайс-лист");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,12 +2,19 @@ using System;
|
|||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Avalonia.Threading;
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using CommunityToolkit.Mvvm.Input;
|
using CommunityToolkit.Mvvm.Input;
|
||||||
using Elfisa.Core;
|
using Elfisa.Core;
|
||||||
|
|
||||||
namespace Elfisa.Avalonia.ViewModels;
|
namespace Elfisa.Avalonia.ViewModels;
|
||||||
|
|
||||||
|
/// <summary>Навигация между разделами из любой VM (напр. после загрузки прайса).</summary>
|
||||||
|
public static class ShellNavigator
|
||||||
|
{
|
||||||
|
public static Action<string>? Navigate;
|
||||||
|
}
|
||||||
|
|
||||||
public class NavItem
|
public class NavItem
|
||||||
{
|
{
|
||||||
public string Title { get; }
|
public string Title { get; }
|
||||||
@ -85,6 +92,13 @@ public partial class ShellViewModel : ViewModelBase
|
|||||||
|
|
||||||
SelectedNav = NavItems.First(n => n.Title == "Отчёты");
|
SelectedNav = NavItems.First(n => n.Title == "Отчёты");
|
||||||
if (Session.Current.IsAuthenticated) _ = LoadPharmacyAsync();
|
if (Session.Current.IsAuthenticated) _ = LoadPharmacyAsync();
|
||||||
|
|
||||||
|
// Навигация из других VM (напр. LoadPrice после успешной загрузки → «Прайс-лист»).
|
||||||
|
ShellNavigator.Navigate = title => Dispatcher.UIThread.Post(() =>
|
||||||
|
{
|
||||||
|
var nav = NavItems.FirstOrDefault(n => n.Title == title);
|
||||||
|
if (nav != null) SelectedNav = nav;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task LoadPharmacyAsync()
|
private async Task LoadPharmacyAsync()
|
||||||
|
|||||||
@ -44,7 +44,7 @@
|
|||||||
<Border DockPanel.Dock="Bottom" Margin="14" Padding="0">
|
<Border DockPanel.Dock="Bottom" Margin="14" Padding="0">
|
||||||
<StackPanel Orientation="Horizontal" Spacing="10" VerticalAlignment="Center">
|
<StackPanel Orientation="Horizontal" Spacing="10" VerticalAlignment="Center">
|
||||||
<TextBlock Text="Кол-во" Classes="label" VerticalAlignment="Center"/>
|
<TextBlock Text="Кол-во" Classes="label" VerticalAlignment="Center"/>
|
||||||
<NumericUpDown Value="{Binding SelectedOffer.OrderQty}" Minimum="0" Maximum="100000" Increment="1" FormatString="0" Width="120"
|
<NumericUpDown x:Name="QtyBox" Value="{Binding SelectedOffer.OrderQty}" Minimum="0" Maximum="100000" Increment="1" FormatString="0" Width="120"
|
||||||
IsEnabled="{Binding SelectedOffer, Converter={x:Static conv:ObjectConverters.IsNotNull}}"/>
|
IsEnabled="{Binding SelectedOffer, Converter={x:Static conv:ObjectConverters.IsNotNull}}"/>
|
||||||
<Button Classes="primary" Content="Добавить в заказ ▸" Command="{Binding AddToOrderCommand}"/>
|
<Button Classes="primary" Content="Добавить в заказ ▸" Command="{Binding AddToOrderCommand}"/>
|
||||||
<TextBlock Text="или выдели строку и набери число на клавиатуре, Enter — добавить" Classes="muted" VerticalAlignment="Center" TextWrapping="Wrap" MaxWidth="240"/>
|
<TextBlock Text="или выдели строку и набери число на клавиатуре, Enter — добавить" Classes="muted" VerticalAlignment="Center" TextWrapping="Wrap" MaxWidth="240"/>
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
|
using Avalonia.Interactivity;
|
||||||
using Avalonia.Markup.Xaml;
|
using Avalonia.Markup.Xaml;
|
||||||
using Elfisa.Avalonia.ViewModels;
|
using Elfisa.Avalonia.ViewModels;
|
||||||
|
|
||||||
@ -16,6 +17,20 @@ public partial class PriceListView : UserControl
|
|||||||
AvaloniaXamlLoader.Load(this);
|
AvaloniaXamlLoader.Load(this);
|
||||||
var grid = this.FindControl<DataGrid>("OffersGrid");
|
var grid = this.FindControl<DataGrid>("OffersGrid");
|
||||||
if (grid != null) grid.KeyDown += OffersGrid_KeyDown;
|
if (grid != null) grid.KeyDown += OffersGrid_KeyDown;
|
||||||
|
|
||||||
|
// Enter в поле «Кол-во» (мышью выставил число) — тоже добавляет в заказ.
|
||||||
|
// Tunnel, чтобы перехватить до внутреннего TextBox NumericUpDown.
|
||||||
|
var qty = this.FindControl<NumericUpDown>("QtyBox");
|
||||||
|
if (qty != null) qty.AddHandler(KeyDownEvent, QtyBox_KeyDown, RoutingStrategies.Tunnel);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void QtyBox_KeyDown(object? sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == Key.Enter)
|
||||||
|
{
|
||||||
|
(DataContext as PriceListViewModel)?.AddSelectedOffer();
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Выделил предложение → набираешь число цифрами (как колонка «Заказ» в старой программе).
|
// Выделил предложение → набираешь число цифрами (как колонка «Заказ» в старой программе).
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user