@page "/Login"
@using FruitBank.Common.Models
@using Mango.Nop.Core.Dtos

<h3>Bejelentkezés</h3>


@if (!LoggedInModel.IsLoggedIn)
{
	<DxFormLayout CaptionPosition="CaptionPosition.Vertical" CssClass="w-500">
		<DxFormLayoutItem Caption="Válasszon felhasználót:" ColSpanMd="6">
			<DxComboBox Data="@LoggedInModel.MeasuringUsers"
						@bind-Value="@SelectedUser"
						Text="Select Employee"
						ValueFieldName="@nameof(CustomerDto.Id)"
						TextFieldName="@nameof(CustomerDto.FullName)"
						CssClass="cw-320"
						DropDownBodyCssClass="dd-body-class"
						InputId="cbItemTemplate">
				<ItemDisplayTemplate Context="ctxCombo">
					<div class="combobox-item-template">
						<img src="@GetImageFileName(ctxCombo.DataItem)" alt="@ctxCombo.DataItem.Email" />
						<div class="combobox-item-template-text">
							<span>@ctxCombo.DataItem.FullName</span>
							<span class="combobox-item-template-employee-phone">@ctxCombo.DataItem.Email</span>
						</div>
					</div>
				</ItemDisplayTemplate>
			</DxComboBox>
		</DxFormLayoutItem>

		<DxFormLayoutItem Caption="Adja meg a jelszavát:" ColSpanMd="6">
			<DxTextBox @bind-Text="@PasswordValue"
					   @onkeydown="OnPasswordKeyDown"
					   Password="true"
					   CssClass="cw-320"
					   ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Auto"
					   BindValueMode="BindValueMode.OnInput"
					   NullText="Enter password"
					   InputId="tbPassword" />
		</DxFormLayoutItem>

		<DxFormLayoutItem ColSpanMd="12" BeginRow="true">
			<DxButton Text="Bejelentkezés" Click="OnLoginClick" CssClass="w-100" />
		</DxFormLayoutItem>

	</DxFormLayout>
}

<div class="row w-100" style="margin-top: 30px;">
	<div class="col-md-12">
		<b>@(LoggedInModel.CustomerDto == null ? LoginModelResponse?.ErrorMessage : LoggedInModel.CustomerDto.FullName + $" [{_rolesText}]")</b>
	</div>
</div>