Files
moadiran/TaxPayerFull/CUSComponent/Notifications.razor
mmrbnjd 75b9644151 ...
2024-06-25 20:54:16 +03:30

30 lines
943 B
Plaintext

@using Front.Services
@using Shared.DTOs
@inject HttpClientController hc;
@inject Fixedvalues fv;
@foreach (var item in items)
{
<Alert OnClosed="()=>OnClosedAlert(item)" Color="(AlertColor)Enum.Parse(typeof(AlertColor), item.Status.ToString())" Dismissable="true"> @item.Message </Alert>
}
@code {
[Parameter] public List<AlertDTO> items { get; set; }
[Parameter] public EventCallback<int> OnMultipleOfThree { get; set; }
public async Task OnClosedAlert(AlertDTO nt)
{
var rsp= await hc.Put($"User/ReadNotification/{Convert.ToInt32(nt.ViewSize)}");
if (rsp.IsSuccessStatusCode)
{
var ddd= fv.dashBoard?.Notifications.Remove(fv.dashBoard?.Notifications.Where(w=>w.ViewSize==nt.ViewSize&&w.Status==nt.Status
&&w.Path==nt.Path&&w.Message==nt.Message).First());
await OnMultipleOfThree.InvokeAsync(fv.dashBoard.Notifications.Count());
}
}
}