You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.5 KiB
56 lines
1.5 KiB
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.JSInterop;
|
|
|
|
namespace Biskilog_Accounting.Client.Elements
|
|
{
|
|
public partial class Headbar
|
|
{
|
|
private const string c_show = "show";
|
|
private const string c_hide = "hidden";
|
|
private string m_dropDownClass = c_hide;
|
|
protected override void OnInitialized()
|
|
{
|
|
m_searchService.ClearTextBox += ClearTextBox;
|
|
m_searchService.CloseMenus += HideProfileDropdown;
|
|
base.OnInitialized();
|
|
}
|
|
|
|
private void HideProfileDropdown(string a_sender)
|
|
{
|
|
if (a_sender != "Profile")
|
|
{
|
|
m_dropDownClass = c_hide;
|
|
StateHasChanged();
|
|
}
|
|
}
|
|
|
|
private void ToggleDropdown()
|
|
{
|
|
if (m_dropDownClass == c_hide)
|
|
{
|
|
m_dropDownClass = c_show;
|
|
}
|
|
else
|
|
{
|
|
m_dropDownClass = c_hide;
|
|
}
|
|
}
|
|
private void ClearTextBox()
|
|
{
|
|
ClearInputField("mainSearch");
|
|
}
|
|
private async Task ClearInputField(string elementId)
|
|
{
|
|
await JSRuntime.InvokeVoidAsync("eval", $"document.getElementById('{elementId}').value = ''");
|
|
}
|
|
private void SearchInput(string a_key)
|
|
{
|
|
m_searchService.PerformSearch(a_key);
|
|
}
|
|
private async Task LogOut()
|
|
{
|
|
await m_tokenService.ClearToken();
|
|
m_navigationManager.NavigateTo("/login");
|
|
}
|
|
}
|
|
}
|
|
|