2025-03-17 22:17:28 +08:00

29 lines
951 B
C#

using System.Collections.ObjectModel;
using CommunityToolkit.Mvvm.ComponentModel;
using Seyounth.Core.Extensions;
using Seyounth.Hyosung.Data.Entities;
using Seyounth.Hyosung.Data.Models;
namespace Seyounth.Hyosung.ViewModels;
public partial class VarietyViewModel : ObservableObject
{
[ObservableProperty] private ObservableCollection<Variety> _varieties;
[ObservableProperty] private ObservableCollection<Pallet> _pallets;
public IEnumerable<NeedTypeEnumItem> NeedTypeItems { get; }
public VarietyViewModel(PalletManagerViewModel palletManagerViewModel)
{
Pallets = new ObservableCollection<Pallet>(palletManagerViewModel.Pallets);
_varieties = new ObservableCollection<Variety>();
var needTypes = EnumHelper.GetValues<NeedType>();
NeedTypeItems = needTypes.Select(nt => new NeedTypeEnumItem
{
Value = nt,
Description = nt.GetDescription()
});
}
}