| | | 1 | | using OzonDomains; |
| | | 2 | | |
| | | 3 | | namespace OzonOrdersWeb.Areas.Studio2.ViewModels.TransactionTimeTracking; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// Согласовано с <see cref="TransactionTimeTrackingReportViewModel.GetTransactionTypeBadgeClass"/>: |
| | | 7 | | /// цвета как у Bootstrap 5 для соответствия бейджам в таблице. |
| | | 8 | | /// </summary> |
| | | 9 | | public static class TransactionTimeTrackingChartStyle |
| | | 10 | | { |
| | | 11 | | public static string GetChartDisplayName(string transactionTypeKey) |
| | | 12 | | { |
| | 0 | 13 | | if (string.IsNullOrWhiteSpace(transactionTypeKey) || transactionTypeKey == "—") |
| | | 14 | | { |
| | 0 | 15 | | return "Не указан"; |
| | | 16 | | } |
| | | 17 | | |
| | 0 | 18 | | if (!Enum.TryParse<TransactionType>(transactionTypeKey, true, out var parsed)) |
| | | 19 | | { |
| | 0 | 20 | | return transactionTypeKey; |
| | | 21 | | } |
| | | 22 | | |
| | 0 | 23 | | return parsed.GetDisplayName(); |
| | | 24 | | } |
| | | 25 | | |
| | | 26 | | public static string GetChartColorHex(string transactionTypeKey) |
| | | 27 | | { |
| | 0 | 28 | | if (string.IsNullOrWhiteSpace(transactionTypeKey) || transactionTypeKey == "—") |
| | | 29 | | { |
| | 0 | 30 | | return "#6c757d"; |
| | | 31 | | } |
| | | 32 | | |
| | 0 | 33 | | if (!Enum.TryParse<TransactionType>(transactionTypeKey, true, out var parsed)) |
| | | 34 | | { |
| | 0 | 35 | | return "#6c757d"; |
| | | 36 | | } |
| | | 37 | | |
| | 0 | 38 | | return parsed switch |
| | 0 | 39 | | { |
| | 0 | 40 | | TransactionType.OrderedToSupplier => "#198754", |
| | 0 | 41 | | TransactionType.ShippedBySupplier => "#0dcaf0", |
| | 0 | 42 | | TransactionType.ShippedToSeller => "#ffc107", |
| | 0 | 43 | | TransactionType.OrderedToSeller => "#6c757d", |
| | 0 | 44 | | TransactionType.ShippedToClient => "#0d6efd", |
| | 0 | 45 | | TransactionType.Percentage => "#212529", |
| | 0 | 46 | | TransactionType.ReceiptNote => "#f8f9fa", |
| | 0 | 47 | | TransactionType.AcceptedToWarehouse => "#0dcaf0", |
| | 0 | 48 | | TransactionType.ToCancellation => "#6c757d", |
| | 0 | 49 | | TransactionType.Cancelled => "#dc3545", |
| | 0 | 50 | | TransactionType.CustomerReturn => "#ffc107", |
| | 0 | 51 | | TransactionType.WarehouseChange => "#0d6efd", |
| | 0 | 52 | | TransactionType.ReturnToSupplier => "#ffc107", |
| | 0 | 53 | | TransactionType.ReturnToWarehouse => "#0dcaf0", |
| | 0 | 54 | | TransactionType.WarehouseTransfer => "#0d6efd", |
| | 0 | 55 | | TransactionType.ShippedToCommissioner => "#0d6efd", |
| | 0 | 56 | | _ => "#6c757d" |
| | 0 | 57 | | }; |
| | | 58 | | } |
| | | 59 | | } |