This commit is contained in:
mmrbnjd
2024-06-25 17:14:08 +03:30
parent 4631d8f159
commit ce81911242
10 changed files with 76 additions and 23 deletions

View File

@@ -1,11 +1,25 @@
@using Shared.DTOs
<h3>Notifications</h3>
<h3>@items.Count()</h3>
@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>
}
<Alert Color="AlertColor.Warning" Dismissable="true"> <strong>Holy guacamole!</strong> You should check in on some of those fields below. </Alert>
@code {
[Parameter] public List<AlertDTO> items { get; set; }
public async Task OnClosedAlert(AlertDTO nt)
{
var rsp= await hc.Put($"User/ReadNotification/{Convert.ToInt32(nt.ViewSize)}");
// if (rsp.IsSuccessStatusCode)
// {
// fv.dashBoard.Notifications.Remove(nt);
// }
}
}

View File

@@ -166,11 +166,15 @@
</ul>
</li>
<!--/ User -->
<li class="nav-item lh-1 me-3 f-ir">
<Button Type="ButtonType.Button" @onclick="ShowNotifications" Color="ButtonColor.None">
<Badge Color="BadgeColor.Danger"><Icon Name="IconName.MegaphoneFill" /> @dashBoard?.Notifications.Count()</Badge>
</Button>
</li>
@if (dashBoard?.Notifications.Count()>0)
{
<li class="nav-item lh-1 me-3 f-ir">
<Button Type="ButtonType.Button" @onclick="ShowNotifications" Color="ButtonColor.None">
<Badge Color="BadgeColor.Danger"><Icon Name="IconName.MegaphoneFill" /> @dashBoard?.Notifications.Count()</Badge>
</Button>
</li>
}
</ul>
</div>
</nav>

View File

@@ -34,9 +34,9 @@ builder.Services.AddScoped(sp => new UserAuthenticationDTO()
}) ;
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") });
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") });
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("fa-Ir");