Files
moadiran/TaxPayerFull/CUSComponent/Notifications.razor

30 lines
943 B
Plaintext
Raw Permalink Normal View History

2024-06-25 17:14:08 +03:30
@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>
}
2024-06-24 17:33:26 +03:30
@code {
[Parameter] public List<AlertDTO> items { get; set; }
2024-06-25 20:54:16 +03:30
[Parameter] public EventCallback<int> OnMultipleOfThree { get; set; }
2024-06-25 17:14:08 +03:30
public async Task OnClosedAlert(AlertDTO nt)
{
var rsp= await hc.Put($"User/ReadNotification/{Convert.ToInt32(nt.ViewSize)}");
2024-06-25 20:54:16 +03:30
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());
2024-06-25 17:14:08 +03:30
2024-06-25 20:54:16 +03:30
await OnMultipleOfThree.InvokeAsync(fv.dashBoard.Notifications.Count());
}
2024-06-25 17:14:08 +03:30
}
2024-06-24 17:33:26 +03:30
}