| | | 1 | | using Services.ApiServices.OpenRouterApi.Models; |
| | | 2 | | |
| | | 3 | | namespace Services.AiAssistant; |
| | | 4 | | |
| | | 5 | | public static class AiStatusPaletteBuilder |
| | | 6 | | { |
| | | 7 | | public static Dictionary<string, string> FromOrders(IEnumerable<OrderSummaryDto> orders) |
| | | 8 | | { |
| | 42 | 9 | | var palette = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); |
| | | 10 | | |
| | 171 | 11 | | foreach (var o in orders) |
| | | 12 | | { |
| | 44 | 13 | | if (!string.IsNullOrWhiteSpace(o.AppStatus) && !string.IsNullOrWhiteSpace(o.AppStatusColor)) |
| | 15 | 14 | | palette.TryAdd(o.AppStatus.Trim(), o.AppStatusColor); |
| | | 15 | | |
| | 44 | 16 | | if (!string.IsNullOrWhiteSpace(o.ClientStatus) && !string.IsNullOrWhiteSpace(o.ClientStatusColor)) |
| | 4 | 17 | | palette.TryAdd(o.ClientStatus.Trim(), o.ClientStatusColor); |
| | | 18 | | |
| | 44 | 19 | | if (!string.IsNullOrWhiteSpace(o.Supplier)) |
| | 7 | 20 | | palette.TryAdd(o.Supplier.Trim(), "#dbeafe"); |
| | | 21 | | |
| | 44 | 22 | | if (!string.IsNullOrWhiteSpace(o.ShipmentWarehouseName)) |
| | 6 | 23 | | palette.TryAdd(o.ShipmentWarehouseName.Trim(), "#ffedd5"); |
| | | 24 | | |
| | 44 | 25 | | if (!string.IsNullOrWhiteSpace(o.OzonClientName)) |
| | 4 | 26 | | palette.TryAdd(o.OzonClientName.Trim(), "#ede9fe"); |
| | | 27 | | } |
| | | 28 | | |
| | 41 | 29 | | if (!palette.ContainsKey("Не указан")) |
| | 36 | 30 | | palette["Не указан"] = "#e9ecef"; |
| | | 31 | | |
| | 41 | 32 | | return palette; |
| | | 33 | | } |
| | | 34 | | } |