<commit_before>﻿@using MvcContrib.FluentHtml
@model CRP.Controllers.ViewModels.ItemTypeViewModel

@{
    ViewBag.Title = "CreateItemTypeNew";
    Layout = "~/Views/Shared/_PublicLayout.cshtml";
}

@section NavButtons
{
    <div class="pull-right">
        @Html.Partial("_LogonPartial")
    </div>
}

<div class="boundary">
    <h2>Create ItemType</h2>
    @Html.ValidationSummary("Create was unsuccessful. Please correct the errors and try again.")
    
    @using (Html.BeginForm())
    {
        @Html.AntiForgeryToken()
        <div class="form-group">
            <label for="ItemType.Name">Name</label>

            @Html.TextBox("ItemType.Name", Model.ItemType != null ? Model.ItemType.Name : string.Empty, new { @class = "form-control" })
            @Html.ValidationMessageFor(x => x.ItemType.Name)

        </div>
        <fieldset>
            <legend>Extended Properties</legend>
            @Html.ValidationMessageFor(x => x.ItemType.ItemTypeExtendedProperties)

            <!-- This is the container for the extended properties -->
            <div id="ExtendedProperties">

                @if (Model.ItemType != null)
                {
                    //foreach (var prop in Model.ItemType.ExtendedProperties)
                    for (var i = 0; i < Model.ItemType.ExtendedProperties.Count; i++ )
                    {
                        var prop = Model.ItemType.ExtendedProperties.ElementAt(i);
                
                        <div>
                            <label>Property Name:</label>
                            <input id='@Html.Encode("ExtendedProperties[" + i + "]_Name")' name='@Html.Encode("ExtendedProperties[" + i + "].Name")' value='@Html.Encode(prop.Name)' />
                            <span id='@Html.Encode("ExtendedProperties[" + i + "]_QuestionType")' style="display:block">
                                <label>Question Type:</label>
                                <select id='@Html.Encode("ExtendedProperties[" + i + "]_QuestionType")' name='@Html.Encode("ExtendedProperties[" + i + "].QuestionType")'>
                                    <option value="">Select a Question Type</option>
                                    @foreach(var o in Model.QuestionTypes) { 
                                        <option value='@Html.Encode(o.Id)'>@Html.Encode(o.Name)</option>
                                    }
                                </select>
                            </span>
                        </div>

                    }
                }

            </div>

            <img id="addExtendedProperty" src="@Url.Content("~/Images/plus.png")" style="width:24px; height:24px" />
        </fieldset>

        <span id="QuestionTypeBase" style="display:none;">
            @this.Select("QuestionTypeBase").Options(Model.QuestionTypes, x=>x.Id, x=>x.Name).FirstOption("Select a Question Type").Label("Question Type: ")
        </span>

        <div class="form-group" style="margin-top: 5px">
            <p>
                <input type="submit" value="Create" class="btn btn-default" />
            </p>
        </div>
    }
</div>

@section AdditionalStyles
{
    
}

@section AdditionalScripts
{
    <script type="text/javascript">

        $(document).ready(function() {
            $("img#addExtendedProperty").click(function() { AddExtendedProperty(); });
        });

        function AddExtendedProperty() {

            var count = $("div#ExtendedProperties").children().length;
            var div = $("<div>");
            div.append($("<label>").html("Property Name:"));
            div.append($("<input>").attr("id", "ExtendedProperties[" + count + "]_Name").attr("name", "ExtendedProperties[" + count + "].Name"));
            div.append($("span#QuestionTypeBase").clone().css("display", "block").attr("id", "ExtendedProperties[" + count + "]_QuestionType"));
            div.find("select").attr("id", "ExtendedProperties[" + count + "]_QuestionType").attr("name", "ExtendedProperties[" + count + "].QuestionType");<commit_msg>styling<commit_after>﻿@using MvcContrib.FluentHtml
@model CRP.Controllers.ViewModels.ItemTypeViewModel

@{
    ViewBag.Title = "CreateItemTypeNew";
    Layout = "~/Views/Shared/_PublicLayout.cshtml";
}

@section NavButtons
{
    <div class="pull-right">
        @Html.Partial("_LogonPartial")
    </div>
}

<div class="boundary">
    <h2>Create ItemType</h2>
    @Html.ValidationSummary("Create was unsuccessful. Please correct the errors and try again.")
    
    @using (Html.BeginForm())
    {
        @Html.AntiForgeryToken()
        <div class="form-group">
            <label for="ItemType.Name">Name</label>

            @Html.TextBox("ItemType.Name", Model.ItemType != null ? Model.ItemType.Name : string.Empty, new { @class = "form-control" })
            @Html.ValidationMessageFor(x => x.ItemType.Name)

        </div>
        <fieldset>
            <legend>Extended Properties</legend>
            @Html.ValidationMessageFor(x => x.ItemType.ItemTypeExtendedProperties)

            <!-- This is the container for the extended properties -->
            <div id="ExtendedProperties" class="form-group">

                @if (Model.ItemType != null)
                {
                    //foreach (var prop in Model.ItemType.ExtendedProperties)
                    for (var i = 0; i < Model.ItemType.ExtendedProperties.Count; i++ )
                    {
                        var prop = Model.ItemType.ExtendedProperties.ElementAt(i);
                
                        <div style="margin-top: 10px">
                            <label>Property Name:</label>
                            <input id='@Html.Encode("ExtendedProperties[" + i + "]_Name")' name='@Html.Encode("ExtendedProperties[" + i + "].Name")' value='@Html.Encode(prop.Name)' />
                            <span id='@Html.Encode("ExtendedProperties[" + i + "]_QuestionType")' style="display:block">
                                <label>Question Type:</label>
                                <select id='@Html.Encode("ExtendedProperties[" + i + "]_QuestionType")' name='@Html.Encode("ExtendedProperties[" + i + "].QuestionType")'>
                                    <option value="">Select a Question Type</option>
                                    @foreach(var o in Model.QuestionTypes) { 
                                        <option value='@Html.Encode(o.Id)'>@Html.Encode(o.Name)</option>
                                    }
                                </select>
                            </span>
                        </div>

                    }
                }

            </div>

            <img id="addExtendedProperty" src="@Url.Content("~/Images/plus.png")" style="width:24px; height:24px" />
        </fieldset>

        <span id="QuestionTypeBase" style="display:none;">
            @this.Select("QuestionTypeBase").Options(Model.QuestionTypes, x=>x.Id, x=>x.Name).FirstOption("Select a Question Type").Label("Question Type: ")
        </span>

        <div class="form-group" style="margin-top: 5px">
            <p>
                <input type="submit" value="Create" class="btn btn-default" />
            </p>
        </div>
    }
</div>

@section AdditionalStyles
{
    
}

@section AdditionalScripts
{
    <script type="text/javascript">

        $(document).ready(function() {
            $("img#addExtendedProperty").click(function() { AddExtendedProperty(); });
        });

        function AddExtendedProperty() {

            var count = $("div#ExtendedProperties").children().length;
            var div = $("<div style='margin-top: 10px'>");
            div.append($("<label>").html("Property Name:"));
            div.append($("<input>").attr("id", "ExtendedProperties[" + count + "]_Name").attr("name", "ExtendedProperties[" + count + "].Name"));
            div.append($("span#QuestionTypeBase").clone().css("display", "block").attr("id", "ExtendedProperties[" + count + "]_QuestionType"));
            div.find("select").attr("id", "ExtendedProperties[" + count + "]_QuestionType").attr("name", "ExtendedProperties[" + count + "].QuestionType");
{'fraction_non_alphanumeric': 0.15849895074682138, 'fraction_numerical': 0.002468831008517467, 'mean_word_length': 1.986361960928861, 'pattern_counts': {'":': 0, '<': 93, '<?xml version=': 0, '>': 99, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '13099', 'n_tokens_mistral': 2246, 'n_tokens_neox': 2102, 'n_words': 378}