@{ 
	var userContext = GreenTree.Nachtragsmanagement.Core.CommonHelper.UserContext();
}

<div style="width: 100%; overflow: auto; max-height: 380px; overflow-x: hidden">

@Html.DevExpress().GridView(t =>
{
	t.Name = "devGridViewAppendixDeviations";
	t.Width = Unit.Percentage(100);
	t.SettingsPager.Mode = GridViewPagerMode.ShowAllRecords;

	t.Columns.Add(column =>
	{
		column.FieldName = "CustomNumber";
		column.Caption = "#";
		column.CellStyle.Wrap = DefaultBoolean.True;
	});
	t.Columns.Add(column =>
	{
		column.FieldName = "Description";
		column.Caption = "Bezeichnung";
		column.CellStyle.Wrap = DefaultBoolean.True;
	});
	t.Columns.Add(column =>
	{
		column.Caption = "Eingang";
		column.FieldName = "ReceiptDate";
		column.PropertiesEdit.DisplayFormatString = "dd.MM.yyyy";
	});
	t.Columns.Add(column =>
	{
		column.Caption = "Bewertung";
		column.FieldName = "Value";
		column.PropertiesEdit.DisplayFormatString = "c2";
		column.Width = new Unit(100, UnitType.Pixel);
	});
	t.Columns.Add("KindDescription", "VA-Art");
	t.Columns.Add("StatusDescription", "Status");
	t.Columns.Add(column =>
	{
		column.FieldName = "DisturbanceValuesDescription";
		column.Caption = "Kategorien";
		column.CellStyle.Wrap = DefaultBoolean.True;
		column.Width = new Unit(170, UnitType.Pixel);
	});
	t.Columns.Add(column =>
	{
		column.Caption = "Kommentar";
		column.CellStyle.Wrap = DefaultBoolean.True;
		column.SetDataItemTemplateContent(c =>
		{
			var id = Convert.ToInt32(DataBinder.Eval(c.DataItem, "Id"));

			var comment = DataBinder.Eval(c.DataItem, "Comment");
			var text = comment == null
				? String.Empty
				: comment.ToString();

			if (text.ToString().Length > 40)
			{
				ViewContext.Writer.Write(text.Substring(0, 40) + " ...");
				ViewContext.Writer.Write("<a href=\"#\" onclick='showComment(\"deviation\"," + id + ",this)'><br />Anzeigen</a>");
			}
			else
				ViewContext.Writer.Write(text);
		});
	});

	t.HtmlRowPrepared = (sender, e) =>
	{

	};

	t.Style.Add("box-shadow", "none");
	t.Styles.Cell.VerticalAlign = VerticalAlign.Top;
	t.Styles.Cell.Paddings.PaddingTop = new Unit(14, UnitType.Pixel);
	t.Styles.Cell.Paddings.PaddingBottom = new Unit(14, UnitType.Pixel);
}).Bind(ViewData["AppendixDeviations"]).GetHtml()

</div>