@model HomePageModel

@{
   @using CommonHelpers; <!-- H…-types from DotNetHelpers library -->
   HomePageModel M() => HNN._(Model);
   bool isUserSessionOpen = Model != null ? Model.DataNN.IsUserSessionOpen : false;
   ViewData["Title"] = isUserSessionOpen ? "MyFlat (homepage)" : "MyFlat (login)";
   ViewData["AddAppNameToPageTitle"] = false;
   var errorMessages = Model?.DataNN.ErrorMessages;
}

@if (!isUserSessionOpen)
{
   <div>
      <partial name="Index_GetLoginBlock" />
   </div>
}
@if (errorMessages != null && !@M().AreLoginInputErrors)
{
   @if (errorMessages.Length > 0)
   {
      <p>
         @for (int i=0; i<errorMessages.Length; i++)
         {
            @if (errorMessages.Length > 1 && i > 0)
            {<br>}
            <span class="errorSPAN">@errorMessages[i]</span>
         }
      </p>
   }
   else
   {
      <p class="error_text">
         There are errors.
      </p>
   }
}
@if (isUserSessionOpen)
{
   <table>
      @{ var ap = M().AccountPropsNN; }
      <tbody>
         <tr><td>Initials (owner)</td><td><b>@ap.Initials</b></td></tr>
         <tr><td>Address (flat)</td><td><b>@ap.Address</b></td></tr>
         <tr><td>Really live (persons)</td><td><b>@ap.PersonCount</b></td></tr>
         <tr><td>Total square (m²)</td><td><b>@ap.TotalSquare</b></td></tr>
         <tr><td>Living square (m²)</td><td><b>@ap.LivingSquare</b></td></tr>
         <tr><td>City district</td><td><b>@ap.DistrictName</b></td></tr>
         <tr><td>Tech.subdivision org.</td><td><b>@ap.TechsubdivOrgName</b></td></tr>
      </tbody>
   </table>
}

<script src="~/ts/Home.page.js?@DateTime.Now.Ticks"></script>
