@using GreenTree.Nachtragsmanagement.Web.Extensions

@model GreenTree.Nachtragsmanagement.Web.Models.Config.ConfigItemDataModel

<div class="configItemValueEdit">

	@switch (Model.TypeFullName)
	{
		case "System.Int32":
			Html.DevExpress().SpinEditFor(m => m.Value, t =>
			{
				t.Width = new Unit(100, UnitType.Percentage);
				t.Properties.MinValue = Int32.MinValue;
				t.Properties.MaxValue = Int32.MaxValue;
			}).GetHtml();
			break;
		case "System.Int64":
			Html.DevExpress().SpinEditFor(m => m.Value, t =>
			{
				t.Width = new Unit(100, UnitType.Percentage);
				t.Properties.MinValue = Int64.MinValue;
				t.Properties.MaxValue = Int64.MaxValue;
			}).GetHtml();
			break;
		case "System.Boolean":
			ViewContext.Writer.Write("<div class='inlineModelPropertyContainer'>");
			{
				ViewContext.Writer.Write("<div class='inlineModelProperty' style='width: 100%'>");
				{
					ViewContext.Writer.Write("<div style=\"overflow: hidden\">");
					{
						ViewContext.Writer.Write("<div style=\"float: left\">");
						{
							Html.DevExpress().RadioButtonFor(m => m.Value, t =>
							{
								t.Text = "Ja";
								t.GroupName = "isDefault";
							}).Render();
						}
						ViewContext.Writer.Write("</div>");

						ViewContext.Writer.Write("<div style=\"float: left; margin-left: 8px\">");
						{
							Html.DevExpress().RadioButton(t =>
							{
								t.Name = "isDefaultFalse";
								t.Text = "Nein";
								t.GroupName = "isDefault";
								t.Checked = !Convert.ToBoolean(Model.Value);
							}).Render();
						}
						ViewContext.Writer.Write("</div>");
					}
					ViewContext.Writer.Write("</div>");
				}
				ViewContext.Writer.Write("</div>");
			}
			ViewContext.Writer.Write("</div>");
			break;
		case "System.Double":
			Html.DevExpress().SpinEditFor(m => m.Value, t =>
			{
				t.Width = new Unit(100, UnitType.Percentage);
				t.Properties.NumberType = SpinEditNumberType.Float;
				t.Properties.MinValue = Decimal.MinValue;
				t.Properties.MaxValue = Decimal.MaxValue;
			}).GetHtml();
			break;
		case "System.DateTime":
			Html.DevExpress().DateEditFor(m => m.Value, t =>
			{
				t.Width = new Unit(100, UnitType.Percentage);
			}).GetHtml();
			break;
		case "System.Drawing.Color":
			Html.DevExpress().ColorEditFor(m => m.Value, t =>
			{
				t.Width = new Unit(100, UnitType.Percentage);
			}).GetHtml();
			break;
		default:
			Html.DevExpress().TextBoxFor(m => m.Value, t =>
			{
				t.Width = new Unit(100, UnitType.Percentage);
			}).GetHtml();
			break;
	}

</div>