LocalGovIMS_localgov-ims/src/Admin/Views/ImportProcessingRuleCondition/_List.cshtml
@model Admin.Models.ImportProcessingRuleCondition.ListViewModel

@if (Model.Items != null && Model.Items.Any())
{
    var groupCount = 0;
    foreach (var group in Model.Items.Select(x => x.Group).Distinct().OrderBy(x => x))
    {
        groupCount++;

        if (groupCount > 1)
        {
            <div class="my-2">Or</div>
        }
        <div class="d-inline-flex rounded-1 p-2 bg-primary bg-opacity-75" role="group">
            @{ var conditionCount = 0; }
            @foreach (var condition in Model.Items.Where(x => x.Group == group).OrderBy(x => x.Id))
            {
                conditionCount++;
                if (conditionCount > 1)
                {
                    if (!string.IsNullOrEmpty(condition.LogicalOperator))
                    {
                        <span class="mx-2 p-2">@condition.LogicalOperator.ToLower()</span>
                    }
                }
                <span class="rounded-1 p-2 bg-primary fw-normal text-white">
                    @condition.DisplaySummary()
                </span>
            }
        </div>
    }
}
else
{
    Html.RenderPartial("_NothingSpecified", "conditions");
}

