feat(sidebar): Hebrew case status labels + show all linked cases (not just 5)

Two quality-of-life tweaks on the sidebar:

1. New CaseStatusToHebrewConverter translates standard EspoCRM Case
   statuses (New / Assigned / Pending / Closed / Rejected / Duplicate /
   In Progress / On Hold / Resolved / Cancelled / Closed Won / Closed
   Lost / Open) to Hebrew. Unknown values pass through unchanged so
   custom statuses configured per-tenant still render.
   Wired in ReadingPaneView.xaml via Status binding.

2. MatchingService now pulls up to 50 cases per contact instead of 5.
   The sidebar's ScrollViewer already handles long lists. 50 is well
   below EspoCRM's default page size and large enough for any realistic
   attorney/contact relationship. Section header changed from
   "תיקים אחרונים" to "תיקים מקושרים" to reflect that it's the
   complete list, not just the most recent.

Tests: 39 passing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
PointStar
2026-05-11 19:12:59 +03:00
parent 9f595c8ece
commit 137cb99fba
3 changed files with 49 additions and 3 deletions
@@ -75,7 +75,11 @@ namespace MarcusLaw.OutlookAddin.Core.Services
var cases = new System.Collections.Generic.List<CaseEntity>();
try
{
var list = await _client.ListCasesForContactAsync(contact.Id, 5, cancellationToken).ConfigureAwait(false);
// Pull up to 50 cases per contact so the sidebar can show the
// whole list, not just the 5 most recent. 50 is well below the
// EspoCRM default page limit and large enough for any realistic
// attorney/contact relationship.
var list = await _client.ListCasesForContactAsync(contact.Id, 50, cancellationToken).ConfigureAwait(false);
cases.AddRange(list.List);
}
catch (Exception ex)
@@ -71,6 +71,45 @@ namespace MarcusLaw.OutlookAddin.UI.Converters
}
}
/// <summary>
/// Maps EspoCRM Case status values (English) to Hebrew labels. Unknown
/// values pass through unchanged so installs with custom statuses
/// still render correctly.
/// </summary>
public sealed class CaseStatusToHebrewConverter : IValueConverter
{
private static readonly Dictionary<string, string> Map =
new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
{
["New"] = "חדש",
["Assigned"] = "הוקצה",
["Pending"] = "ממתין",
["In Progress"] = "בטיפול",
["InProgress"] = "בטיפול",
["Open"] = "פתוח",
["Closed"] = "סגור",
["Closed Lost"] = "סגור — אבד",
["Closed Won"] = "סגור — נצח",
["Rejected"] = "נדחה",
["Duplicate"] = "כפילות",
["On Hold"] = "מושהה",
["OnHold"] = "מושהה",
["Resolved"] = "טופל",
["Cancelled"] = "בוטל",
["Canceled"] = "בוטל"
};
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var s = value as string;
if (string.IsNullOrWhiteSpace(s)) return string.Empty;
return Map.TryGetValue(s!, out var hebrew) ? hebrew : s!;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
=> throw new NotSupportedException();
}
/// <summary>
/// Returns a small emoji marker per entity type to use next to the
/// Hebrew label in group headers.
@@ -1,11 +1,13 @@
<UserControl x:Class="MarcusLaw.OutlookAddin.UI.Views.ReadingPaneView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:conv="clr-namespace:MarcusLaw.OutlookAddin.UI.Converters"
FlowDirection="RightToLeft"
Background="White"
FontFamily="Segoe UI"
FontSize="12">
<UserControl.Resources>
<conv:CaseStatusToHebrewConverter x:Key="HebrewStatus" />
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
</Style>
@@ -75,7 +77,7 @@
<TextBlock Style="{StaticResource LabelStyle}" Text="לקוח/חברה" Visibility="{Binding AccountVisibility}" />
<TextBlock Text="{Binding Match.Account.Name}" Visibility="{Binding AccountVisibility}" />
<TextBlock Style="{StaticResource LabelStyle}" Text="תיקים אחרונים" Margin="0,12,0,2" />
<TextBlock Style="{StaticResource LabelStyle}" Text="תיקים מקושרים" Margin="0,12,0,2" />
<ItemsControl ItemsSource="{Binding RecentCases}">
<ItemsControl.ItemTemplate>
<DataTemplate>
@@ -85,7 +87,8 @@
<Run Text="["/><Run Text="{Binding Number, Mode=OneWay}"/><Run Text="] " />
<Run Text="{Binding Name, Mode=OneWay}" FontWeight="SemiBold" />
</TextBlock>
<TextBlock Text="{Binding Status}" Foreground="Gray" FontSize="10" />
<TextBlock Text="{Binding Status, Converter={StaticResource HebrewStatus}}"
Foreground="Gray" FontSize="10" />
</StackPanel>
</Border>
</DataTemplate>