@model GreenTree.Nachtragsmanagement.Web.Models.Appendix.AppendixDataModel

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

@Html.DevExpress().ListBox(lb =>
{
	lb.Name = "devListBoxInvoices";
	lb.Width = new Unit(100, UnitType.Percentage);
	lb.Properties.TextField = "CustomNumber";
	lb.Properties.ValueField = "Id";
	lb.Properties.ValueType = typeof(int);
	lb.Properties.EnableClientSideAPI = true;
	lb.EncodeHtml = false;
	lb.CallbackRouteValues = new { Controller = "Appendix", Action = "PartialInvoices", appendixId = Model.Id };
	lb.SetItemTemplateContent(i =>
	{
		var id = Convert.ToInt32(DataBinder.Eval(i.DataItem, "Id"));
		var customNumber = DataBinder.Eval(i.DataItem, "CustomNumber").ToString();

		ViewContext.Writer.Write("<span class=\"invoiceText\">" + customNumber + "</span>");
		ViewContext.Writer.Write(
			"<a class=\"devHyperLinkEditInvoice\" style=\"float: right\" href=\"#\" onclick='editInvoice(" + id + ")'>Bearbeiten</a>" +
			"<a class=\"devHyperLinkEditInvoice\" style=\"float: right\" href=\"#\" onclick='deleteInvoice(" + id + ")'>Löschen</a>");
	});
	lb.ControlStyle.Border.BorderStyle = BorderStyle.None;
	lb.Properties.ClientSideEvents.EndCallback = "function (s, e) { setInvoiceDropDownTest(); }";
}).BindList(Model.Invoices).GetHtml()