@using GreenTree.Nachtragsmanagement.Web.Extensions

@model GreenTree.Nachtragsmanagement.Web.Models.Misc.LogDataModel

<div class="logViewContainer">

	@Html.DevExpress().PopupControl(s =>
{
	s.Name = "devPopupControlViewLog";
	s.HeaderText = String.Format("Log \"{0}\" betrachten", Model.Id);
	s.Modal = true;
	s.Width = new Unit(500, UnitType.Pixel);
	s.CloseAction = CloseAction.CloseButton;
	s.PopupHorizontalAlign = PopupHorizontalAlign.WindowCenter;
	s.PopupVerticalAlign = PopupVerticalAlign.WindowCenter;
	s.AllowDragging = false;
	s.AllowResize = false;
	s.ShowFooter = false;
	s.ShowOnPageLoad = true;
	s.SetContent(() =>
	{
		ViewContext.Writer.Write("<div class='editFormWrapper'>");

		ViewContext.Writer.Write(Html.CustomLabelFor(m => m.Id, "ID:").ToHtmlString() + "&nbsp;");
		ViewContext.Writer.Write("<b>" + Html.DisplayTextFor(m => m.Id).ToHtmlString() + "</b><br/>");

		ViewContext.Writer.Write(Html.CustomLabelFor(m => m.LogLevelDescription, "Level:").ToHtmlString()  + "&nbsp;");
		ViewContext.Writer.Write("<b>" + Html.DisplayTextFor(m => m.LogLevelDescription).ToHtmlString() + "</b><br/>");

		ViewContext.Writer.Write(Html.CustomLabelFor(m => m.ShortMessage, "Betreff:").ToHtmlString()  + "&nbsp;");
		ViewContext.Writer.Write("<b>" + Html.DisplayTextFor(m => m.ShortMessage).ToHtmlString() + "</b><br/>");

		ViewContext.Writer.Write(Html.CustomLabelFor(m => m.FullMessage, "Nachricht:").ToHtmlString()  + "&nbsp;");
		ViewContext.Writer.Write(
			"<b>" + Html.TextAreaFor(m => m.FullMessage, new { disabled = "disabled", style = "width: 100%; height: 80px" }).ToHtmlString() + "</b><br/>");

		ViewContext.Writer.Write(Html.CustomLabelFor(m => m.IpAddress, "IP-Adresse:").ToHtmlString() + "&nbsp;");
		ViewContext.Writer.Write("<b>" + Html.DisplayTextFor(m => m.IpAddress).ToHtmlString() + "</b><br/>");

		ViewContext.Writer.Write(Html.CustomLabelFor(m => m.UserDescription, "Mitarbeiter:").ToHtmlString() + "&nbsp;");
		ViewContext.Writer.Write("<b>" + Html.DisplayTextFor(m => m.UserDescription).ToHtmlString() + "</b><br/>");

		ViewContext.Writer.Write(Html.CustomLabelFor(m => m.EntityType, "Datentyp:").ToHtmlString() + "&nbsp;");
		ViewContext.Writer.Write("<b>" + Html.DisplayTextFor(m => m.EntityType).ToHtmlString() + "</b><br/>");

		ViewContext.Writer.Write(Html.CustomLabelFor(m => m.EntityId, "Daten ID:").ToHtmlString() + "&nbsp;");
		ViewContext.Writer.Write("<b>" + Html.DisplayTextFor(m => m.EntityId).ToHtmlString() + "</b><br/>");

		ViewContext.Writer.Write(Html.CustomLabelFor(m => m.PageUrl, "Seiten-URL:").ToHtmlString() + "&nbsp;");
		ViewContext.Writer.Write("<b>" + Html.DisplayTextFor(m => m.PageUrl).ToHtmlString() + "</b><br/>");

		ViewContext.Writer.Write(Html.CustomLabelFor(m => m.ReferrerUrl, "Relative URL:").ToHtmlString() + "&nbsp;");
		ViewContext.Writer.Write("<b>" + Html.DisplayTextFor(m => m.ReferrerUrl).ToHtmlString() + "</b><br/>");

		ViewContext.Writer.Write(Html.CustomLabelFor(m => m.CreatedOnUtc, "Zeitpunkt:").ToHtmlString() + "&nbsp;");
		ViewContext.Writer.Write(
			"<b><span>" + Model.CreatedOnUtc.ToLocalTime().ToString("dd.MM.yyyy - HH:mm:ss.fff \"Uhr\"") + "</span></b><br/>");

		ViewContext.Writer.Write("</div>");

		Html.RenderPartial(
			"~/Views/Shared/_PopupButtonPanelOption.cshtml",
			new GreenTree.Nachtragsmanagement.Web.Models.Global.OptionDialogModel
			{
				OptionItems = new List<GreenTree.Nachtragsmanagement.Web.Models.Global.OptionDialogItemModel>
				{
						new GreenTree.Nachtragsmanagement.Web.Models.Global.OptionDialogItemModel
						{
							Name = "ViewLogAccept",
							Text = "Ok",
							Function = "function (s, e) { devPopupControlViewLog.Hide(); }"
						}
				}
			}
		);
	});
	s.Styles.Content.Paddings.Padding = new Unit(0);
	s.Styles.ModalBackground.Opacity = 0;
}).GetHtml()
</div>