252 lines
11 KiB
C#
252 lines
11 KiB
C#
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using Elwig.Helpers;
|
|
using Elwig.Models.Entities;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Linq;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Media;
|
|
|
|
namespace Elwig.ViewModels {
|
|
public partial class MemberAdminViewModel : ObservableObject {
|
|
|
|
[ObservableProperty]
|
|
public partial string Title { get; set; } = "Mitglieder - Elwig";
|
|
|
|
public int? TransferPredecessorAreaComs { get; set; } = null;
|
|
public int? CancelAreaComs { get; set; } = null;
|
|
|
|
public ObservableCollection<KeyValuePair<string, string>> PhoneNrTypes { get; set; } = new(Utils.PhoneNrTypes);
|
|
|
|
[ObservableProperty]
|
|
public partial string? SearchQuery { get; set; } = "";
|
|
public List<string> TextFilter => [.. SearchQuery?.ToLower().Split(' ').ToList().FindAll(e => e.Length > 0) ?? []];
|
|
|
|
[ObservableProperty]
|
|
public partial bool ShowOnlyActiveMembers { get; set; } = true;
|
|
|
|
[ObservableProperty]
|
|
public partial Member? SelectedMember { get; set; }
|
|
[ObservableProperty]
|
|
public partial IEnumerable<Member> Members { get; set; } = [];
|
|
|
|
[ObservableProperty]
|
|
public partial bool IsMemberSelected { get; set; }
|
|
[ObservableProperty]
|
|
public partial bool IsMemberSelectedOrCreating { get; set; }
|
|
[ObservableProperty]
|
|
public partial bool MemberHasEmail { get; set; }
|
|
[ObservableProperty]
|
|
public partial bool MemberCanSendEmail { get; set; }
|
|
[ObservableProperty]
|
|
public partial bool EnableMemberReferenceButton { get; set; }
|
|
[ObservableProperty]
|
|
public partial bool EnableSearchInputs { get; set; } = true;
|
|
[ObservableProperty]
|
|
public partial IEnumerable<bool> MemberHasDeliveries { get; set; } = [.. Enumerable.Range(0, 9999).Select(i => false)];
|
|
|
|
[ObservableProperty]
|
|
public partial bool MemberListOrderByMgNr { get; set; }
|
|
[ObservableProperty]
|
|
public partial bool MemberListOrderByName { get; set; }
|
|
[ObservableProperty]
|
|
public partial bool MemberListOrderByOrt { get; set; }
|
|
|
|
[ObservableProperty]
|
|
public partial string? MgNrString { get; set; }
|
|
public int? MgNr {
|
|
get => int.TryParse(MgNrString, out var mgnr) ? mgnr : null;
|
|
set => MgNrString = $"{value}";
|
|
}
|
|
[ObservableProperty]
|
|
public partial string? PredecessorMgNrString { get; set; }
|
|
public int? PredecessorMgNr {
|
|
get => int.TryParse(PredecessorMgNrString, out var mgnr) ? mgnr : null;
|
|
set => PredecessorMgNrString = $"{value}";
|
|
}
|
|
[ObservableProperty]
|
|
public partial bool IsJuridicalPerson { get; set; }
|
|
[ObservableProperty]
|
|
public partial string? Prefix { get; set; }
|
|
[ObservableProperty]
|
|
public partial string? GivenName { get; set; }
|
|
[ObservableProperty]
|
|
public partial string? Name { get; set; }
|
|
[ObservableProperty]
|
|
public partial string? Suffix { get; set; }
|
|
[ObservableProperty]
|
|
public partial string? ForTheAttentionOf { get; set; }
|
|
[ObservableProperty]
|
|
public partial string? Birthday { get; set; }
|
|
[ObservableProperty]
|
|
public partial string? Age { get; set; }
|
|
[ObservableProperty]
|
|
public partial bool IsDeceased { get; set; }
|
|
[ObservableProperty]
|
|
public partial string? Address { get; set; }
|
|
[ObservableProperty]
|
|
public partial string? PlzString { get; set; }
|
|
public int? Plz {
|
|
get => int.TryParse(PlzString, out var plz) ? plz : null;
|
|
set => PlzString = $"{value}";
|
|
}
|
|
[ObservableProperty]
|
|
public partial AT_PlzDest? Ort { get; set; }
|
|
[ObservableProperty]
|
|
public partial IEnumerable<AT_PlzDest> OrtSource { get; set; } = [];
|
|
|
|
[ObservableProperty]
|
|
public partial string? BillingName { get; set; }
|
|
[ObservableProperty]
|
|
public partial string? BillingAddress { get; set; }
|
|
[ObservableProperty]
|
|
public partial string? BillingPlzString { get; set; }
|
|
public int? BillingPlz {
|
|
get => int.TryParse(BillingPlzString, out var plz) ? plz : null;
|
|
set => BillingPlzString = $"{value}";
|
|
}
|
|
[ObservableProperty]
|
|
public partial AT_PlzDest? BillingOrt { get; set; }
|
|
[ObservableProperty]
|
|
public partial IEnumerable<AT_PlzDest> BillingOrtSource { get; set; } = [];
|
|
|
|
[ObservableProperty]
|
|
public partial string? Iban { get; set; }
|
|
[ObservableProperty]
|
|
public partial string? Bic { get; set; }
|
|
|
|
[ObservableProperty]
|
|
public partial string? UstIdNr { get; set; }
|
|
[ObservableProperty]
|
|
public partial string? LfbisNr { get; set; }
|
|
[ObservableProperty]
|
|
public partial string? OrganicOperatorId { get; set; }
|
|
[ObservableProperty]
|
|
public partial string? OrganicAuthorityCode { get; set; }
|
|
[ObservableProperty]
|
|
public partial bool IsBuchführend { get; set; }
|
|
[ObservableProperty]
|
|
public partial bool IsOrganic { get; set; }
|
|
|
|
[ObservableProperty]
|
|
public partial string? OrganicState { get; set; }
|
|
[ObservableProperty]
|
|
public partial string? OrganicDetails { get; set; } = "-";
|
|
[ObservableProperty]
|
|
public partial Brush? OrganicColor { get; set; } = Brushes.Black;
|
|
[ObservableProperty]
|
|
public partial string? OrganicToolTip { get; set; }
|
|
|
|
[ObservableProperty]
|
|
public partial string? EntryDate { get; set; }
|
|
[ObservableProperty]
|
|
public partial string? ExitDate { get; set; }
|
|
[ObservableProperty]
|
|
public partial string? BusinessShares1String { get; set; }
|
|
public int? BusinessShares1 {
|
|
get => int.TryParse(BusinessShares1String, out var shares) ? shares : null;
|
|
set => BusinessShares1String = $"{value}";
|
|
}
|
|
[ObservableProperty]
|
|
public partial string? BusinessShares2String { get; set; }
|
|
public int? BusinessShares2 {
|
|
get => int.TryParse(BusinessShares2String, out var shares) ? shares : null;
|
|
set => BusinessShares2String = $"{value}";
|
|
}
|
|
[ObservableProperty]
|
|
public partial string? BusinessShares3String { get; set; }
|
|
public int? BusinessShares3 {
|
|
get => int.TryParse(BusinessShares3String, out var shares) ? shares : null;
|
|
set => BusinessShares3String = $"{value}";
|
|
}
|
|
[ObservableProperty]
|
|
public partial string? AccountingNr { get; set; }
|
|
[ObservableProperty]
|
|
public partial bool IsActive { get; set; }
|
|
[ObservableProperty]
|
|
public partial bool IsVollLieferant { get; set; }
|
|
[ObservableProperty]
|
|
public partial bool IsFunktionär { get; set; }
|
|
[ObservableProperty]
|
|
public partial Branch? Branch { get; set; }
|
|
[ObservableProperty]
|
|
public partial IEnumerable<Branch> BranchSource { get; set; } = [];
|
|
[ObservableProperty]
|
|
public partial AT_Kg? DefaultKg { get; set; }
|
|
[ObservableProperty]
|
|
public partial IEnumerable<AT_Kg> DefaultKgSource { get; set; } = [];
|
|
[ObservableProperty]
|
|
public partial string? Comment { get; set; }
|
|
[ObservableProperty]
|
|
public partial bool ContactViaPost { get; set; }
|
|
[ObservableProperty]
|
|
public partial bool ContactViaEmail { get; set; }
|
|
|
|
[ObservableProperty]
|
|
public partial string CreatedAt { get; set; } = "-";
|
|
[ObservableProperty]
|
|
public partial string ModifiedAt { get; set; } = "-";
|
|
[ObservableProperty]
|
|
public partial string ModifiedAtShort { get; set; } = "-";
|
|
[ObservableProperty]
|
|
public partial string ExportedAt { get; set; } = "-";
|
|
[ObservableProperty]
|
|
public partial string ImportedAt { get; set; } = "-";
|
|
|
|
public ObservableCollection<string?> EmailAddresses { get; private set; } = [null, null, null, null, null, null, null, null, null];
|
|
|
|
public partial class PhoneNr(int? type = null, string? number = null, string? comment = null) : ObservableObject {
|
|
[ObservableProperty]
|
|
public partial int Type { get; set; } = type ?? -1;
|
|
[ObservableProperty]
|
|
public partial string? Number { get; set; } = number;
|
|
[ObservableProperty]
|
|
public partial string? Comment { get; set; } = comment;
|
|
|
|
public override bool Equals(object? obj) {
|
|
return obj is PhoneNr nr && Type == nr.Type && Number == nr.Number && Comment == nr.Comment;
|
|
}
|
|
|
|
public override int GetHashCode() {
|
|
return Type ^ (Number?.GetHashCode() ?? 0) ^ (Comment?.GetHashCode() ?? 0);
|
|
}
|
|
}
|
|
public ObservableCollection<PhoneNr> PhoneNrs { get; private set; } = [new(), new(), new(), new(), new(), new(), new(), new(), new()];
|
|
|
|
[ObservableProperty]
|
|
public partial string StatusMembers { get; set; } = "-";
|
|
[ObservableProperty]
|
|
public partial string? StatusMembersToolTip { get; set; }
|
|
[ObservableProperty]
|
|
public partial TextBlock? StatusBusinessShares { get; set; }
|
|
[ObservableProperty]
|
|
public partial string StatusDeliveriesLastSeason { get; set; } = "-";
|
|
[ObservableProperty]
|
|
public partial string StatusDeliveriesLastSeasonInfo { get; set; } = "letzte Saison";
|
|
[ObservableProperty]
|
|
public partial Grid? StatusDeliveriesLastSeasonToolTip { get; set; }
|
|
[ObservableProperty]
|
|
public partial string StatusDeliveriesThisSeason { get; set; } = "-";
|
|
[ObservableProperty]
|
|
public partial string StatusDeliveriesThisSeasonInfo { get; set; } = "aktuelle Saison";
|
|
[ObservableProperty]
|
|
public partial Grid? StatusDeliveriesThisSeasonToolTip { get; set; }
|
|
[ObservableProperty]
|
|
public partial string StatusAreaCommitment { get; set; } = "-";
|
|
[ObservableProperty]
|
|
public partial Grid? StatusAreaCommitmentToolTip { get; set; }
|
|
[ObservableProperty]
|
|
public partial string StatusAreaCommitmentInfo { get; set; } = "aktuelle Saison";
|
|
|
|
[ObservableProperty]
|
|
public partial Visibility ControlButtonsVisibility { get; set; } = Visibility.Visible;
|
|
[ObservableProperty]
|
|
public partial Visibility EditingButtonsVisibility { get; set; } = Visibility.Hidden;
|
|
[ObservableProperty]
|
|
public partial Visibility PersonalNameVisibility { get; set; } = Visibility.Visible;
|
|
[ObservableProperty]
|
|
public partial Visibility JuridicalNameVisibility { get; set; } = Visibility.Hidden;
|
|
}
|
|
}
|