@model IEnumerable<GreenTree.Nachtragsmanagement.Core.Domain.Deviation.Kind>

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

@Html.DevExpress().ListBox(s =>
{
	s.Name = "devListBoxKinds";
	s.Properties.ValueType = typeof(int);
	s.Properties.ValueField = "Id";
	s.Properties.TextField = "Description";
	if (userContext.CurrentUser.HasFunction("Deviation-Claims-Edit"))
	{
		s.SetItemTemplateContent(c =>
		{
			var isDefault = (bool)DataBinder.Eval(c.DataItem, "IsDefault");

			if (isDefault)
				ViewContext.Writer.Write("<b><i>" + DataBinder.Eval(c.DataItem, "Description") + "</i></b>");
			else
				ViewContext.Writer.Write(DataBinder.Eval(c.DataItem, "Description"));

			ViewContext.Writer.Write(
				"<div class=\"devExListItemControlContainer\">" +
					"<a href=\"#\" onclick='editClaim(\"kind\", " + DataBinder.Eval(c.DataItem, "Id") + ")'>Bearbeiten</a>&nbsp;" +
					"<a href=\"#\" onclick='confirmDelete(\"kind\", " + DataBinder.Eval(c.DataItem, "Id") + ")'>Löschen</a>" +
				"</div>"
			);
		});
	}
	s.CallbackRouteValues = new { Controller = "Deviation", Action = "PartialClaims", claimType = "kind" };
	s.Width = Unit.Percentage(100);
	s.Height = Unit.Pixel(370);
}).BindList(Model).GetHtml()