@inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>

@{ 
	string pageId = GetGlobalValue("Global:Page.ID");

	string invalidOldPassword = !string.IsNullOrEmpty(GetString("UserManagement:User.OldPassword.Input.Error")) ? "is-invalid" : "";
	string invalidPassword = !string.IsNullOrEmpty(GetString("UserManagement:User.NewPassword.Input.Error")) ? "is-invalid" : "";
	string invalidConfirmPassword = !string.IsNullOrEmpty(GetString("UserManagement:User.NewPasswordConfirm.Input.Error")) ? "is-invalid" : "";
}

<div>
	@* Desktop *@
	@if (Pageview.Page.Item["Title"] != null) {
		<div class="d-none d-lg-block mb-5">
			<h1 class="h2">@Pageview.Page.Item["Title"]</h1>
		</div>
	}

	@GetString("UserManagement:User.FormStart")
		<input type="hidden" name="ID" value="@pageId">

		<div class="form-floating mb-3">
			<input type="text" class="form-control @invalidOldPassword" id="UserManagement_Form_OldPassword" name="UserManagement_Form_OldPassword" placeholder="@Translate("Old password")" required>
			<label for="UserManagement_Form_OldPassword">@Translate("Current password")</label>
			<div class="invalid-feedback">@GetString("UserManagement:User.OldPassword.Input.Error")</div>
		</div>

		<div class="form-floating mb-3">
			<input type="text" class="form-control @invalidPassword" id="UserManagement_Form_NewPassword" name="UserManagement_Form_NewPassword" placeholder="@Translate("Old password")" required>
			<label for="UserManagement_Form_NewPassword">@Translate("New password")</label>
			<div class="invalid-feedback">@GetString("UserManagement:User.NewPassword.Input.Error")</div>
		</div>
		
		<div class="form-floating mb-5">
			<input type="text" class="form-control @invalidConfirmPassword" id="UserManagement_Form_NewPasswordConfirm" name="UserManagement_Form_NewPasswordConfirm" placeholder="@Translate("Old password")" required>
			<label for="UserManagement_Form_NewPasswordConfirm">@Translate("Confirm new password")</label>
			<div class="invalid-feedback">@GetString("UserManagement:User.NewPasswordConfirm.Input.Error")</div>
		</div>

		<div class="mb-3">
			<button type="submit" class="btn btn-primary" data-dw-button="primary" id="UpdatePasswordButton">@Translate("Update password")</button>
		</div>
	@GetString("UserManagement:User.FormEnd")
</div>
