@using GreenTree.Nachtragsmanagement.Web.Extensions
@using GreenTree.Nachtragsmanagement.Core.Domain.Appendix

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

@Html.DevExpress().PopupControl(s =>
{
	s.Name = "devCategoryValuePopup";
	s.HeaderText = "Kategorie zuweisen";
	s.Modal = true;
	s.Width = new Unit(350, UnitType.Pixel);
	s.CloseAction = CloseAction.CloseButton;
	s.PopupHorizontalAlign = PopupHorizontalAlign.WindowCenter;
	s.PopupVerticalAlign = PopupVerticalAlign.TopSides;
	s.PopupVerticalOffset = 40;
	s.AllowDragging = true;
	s.AllowResize = false;
	s.ShowFooter = false;
	s.SetContent(() =>
	{
		ViewContext.Writer.Write("<div class='editFormWrapper'>");
		{
			ViewContext.Writer.Write(Html.CustomLabelFor(m => m.CategoryEntities, "Kategorie:"));
			Html.DevExpress().DropDownEdit(t =>
			{
				t.Name = "devDropDownListAllCategories";
				t.Width = new Unit(100, UnitType.Percentage);
				t.Text = ((ICollection<Category>)ViewData["AllCategories"]).ToArray()[0].Description;
				t.SetDropDownWindowTemplateContent(l =>
				{
					Html.DevExpress().ListBox(lb =>
					{
						lb.Name = "devListBoxAllCategories";
						lb.Width = new Unit(100, UnitType.Percentage);
						lb.Properties.TextField = "Description";
						lb.Properties.ValueField = "Id";
						lb.Properties.ValueType = typeof(int);
						lb.Properties.SelectionMode = ListEditSelectionMode.Single;
						lb.SelectedIndex = 0;
						lb.Properties.ClientSideEvents.SelectedIndexChanged = "function (s, e) { devDropDownListAllCategories.SetText(s.GetSelectedItem().text); devDropDownListAllCategories.HideDropDown(); }";
						lb.ControlStyle.Border.BorderStyle = BorderStyle.None;
					}).BindList(ViewData["AllCategories"]).Render();
				});
			}).Render();

			ViewContext.Writer.Write(Html.CustomLabelFor(m => m.CategoryEntities, "Wert:"));
			Html.DevExpress().SpinEdit(t =>
			{
				t.Name = "devSpinEditCategoryValue";
				t.Number = 0;
				t.Properties.MinValue = 0;
				t.Properties.MaxValue = decimal.MaxValue;
				t.Properties.NumberType = SpinEditNumberType.Float;
				t.Properties.DisplayFormatString = "c2";
			}).Render();
		}
		ViewContext.Writer.Write("</div>");

		Html.RenderPartial(
			"~/Views/Shared/_PopupButtonPanel.cshtml",
			new GreenTree.Nachtragsmanagement.Web.Models.Global.PopupModel
			{
				PopupName = "devCategoryValuePopup",
				AcceptFunction = "function (s, e) { addCategoryValue(); }"
			}
		);
	});
	s.Styles.Content.Paddings.Padding = new Unit(0);
	s.Styles.ModalBackground.Opacity = 0;
}).GetHtml()