btcpayserver/BTCPayServer/Plugins/PointOfSale/Models/ViewPointOfSaleViewModel.cs

76 lines
2.6 KiB
C#
Raw Normal View History

using System;
2023-05-23 02:18:57 +02:00
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using BTCPayServer.Client.Models;
using BTCPayServer.Models;
using Microsoft.AspNetCore.Mvc.Rendering;
2018-04-03 11:50:41 +09:00
2022-07-18 20:51:53 +02:00
namespace BTCPayServer.Plugins.PointOfSale.Models
2018-04-03 11:50:41 +09:00
{
public class ViewPointOfSaleViewModel
{
public class CurrencyInfoData
{
public bool Prefixed { get; set; }
public string CurrencySymbol { get; set; }
public string ThousandSeparator { get; set; }
public string DecimalSeparator { get; set; }
public int Divisibility { get; set; }
public bool SymbolSpace { get; set; }
}
public StoreBrandingViewModel StoreBranding { get; set; }
public string StoreName { get; set; }
public CurrencyInfoData CurrencyInfo { get; set; }
public PosViewType ViewType { get; set; }
public bool ShowItems { get; set; }
2018-04-26 22:09:18 +09:00
public bool ShowCustomAmount { get; set; }
public bool ShowDiscount { get; set; }
public bool ShowSearch { get; set; } = true;
public bool ShowCategories { get; set; } = true;
public bool EnableTips { get; set; }
2018-04-26 22:09:18 +09:00
public string Step { get; set; }
2018-04-03 11:50:41 +09:00
public string Title { get; set; }
AppItem[] _Items;
public AppItem[] Items
{
get
{
return _Items;
}
set
{
_Items = value;
UpdateGroups();
}
}
private void UpdateGroups()
{
AllCategories = null;
if (Items is null)
return;
var groups = Items.SelectMany(g => g.Categories ?? Array.Empty<string>())
.ToHashSet()
.Select(o => new KeyValuePair<string, string>(o, o))
.ToList();
if (groups.Count == 0)
return;
groups.Insert(0, new KeyValuePair<string, string>("All", "*"));
AllCategories = new SelectList(groups, "Value", "Key", "*");
}
public string CurrencyCode { get; set; }
public string CurrencySymbol { get; set; }
public string AppId { get; set; }
public string ButtonText { get; set; }
public string CustomButtonText { get; set; }
public string CustomTipText { get; set; }
public int[] CustomTipPercentages { get; set; }
public string Description { get; set; }
public SelectList AllCategories { get; set; }
public string StoreId { get; set; }
2018-04-03 11:50:41 +09:00
}
}