@using Common.Dtos.Conversation

<small>پیام های اخیر شما ...</small>
<div class="row">
    @foreach (var item in Conversations)
    {
        <div class="col-sm-3">
            <Card>
                <CardBody>
                    <CardText>@GetTitleCon(item.LastText)</CardText>
                    <Button Color="ButtonColor.Primary" @onclick="async()=>await OnMultipleOfThree.InvokeAsync(item.ID)" Type="ButtonType.Link">Go somewhere</Button>
                </CardBody>
                <ul class="list-group list-group-flush">
                    <li class="list-group-item">@item.ExperFullName (@item.LastMsgdate @item.LastMsgtime)</li>
                </ul>
                @if (item.status == Common.Enums.ConversationStatus.InProgress && item.NoReadCount > 0)
                {
                    <Badge Color="BadgeColor.Danger"
                           Position="Position.Absolute"
                           Placement="BadgePlacement.TopLeft"
                           IndicatorType="BadgeIndicatorType.RoundedPill"
                           VisuallyHiddenText="unread messages">@item.NoReadCount </Badge>
                }

                

            </Card>
        </div>
    }

</div>

@code {
    [Parameter] public EventCallback<int> OnMultipleOfThree { get; set; }
    [Parameter] public List<Read_ConversationDto> Conversations { get; set; }
    string GetTitleCon(string str)
    {
        if (str.Length > 15) return str.Substring(0, 15) + "...";
        return str;

    }
}
