<commit_before>{% load i18n %}

<script type="text/html" id="case-config:condition">
    <!--ko with: condition -->
    <span data-bind="text: $parent.actionType"></span>
    <div data-bind="visible: type() === 'always'">
        <a href="#" data-bind="click: function () {type('if')}"><i class="fa fa-plus"></i> {% trans "Only if the answer to..." %}</a>
    </div>
    <div class="form-inline" data-bind="visible: type() === 'if'">
        <a href="#" data-bind="click: function () {type('always')}">
            <i class="fa fa-remove"></i>
        </a>
        {% trans "Only if the answer to" %}
        <!-- 
            This would normally use .form-control, but it's going to become a select2,
            which adds wonky height & borders on Firefox when it uses .form-control
        -->
        <input type="hidden" data-bind="
            questionsSelect: $root.getQuestions('select select1', false, $parent.config.allow.repeats()),
            value: question,
            optionsCaption: ' '
        "/>
        <select class="form-control" data-bind="
                optstr: [
                    {label:'{% trans "is" %}', value:'='},
                    {label:'{% trans "has selected" %}', value:'selected'},
                    {label:'{% trans "is true" %}', value:'boolean_true'}
                ],
                value: operator"></select>
        <span data-bind="if: $root.getAnswers({question: question()}).length && operator() != 'boolean_true'">
            <select class="form-control" data-bind="
                optstr: $root.getAnswers({question: question()}),
                value: answer"></select>
        </span>
        <span data-bind="if: !$root.getAnswers({question: question()}).length && operator() != 'boolean_true'">
            <input type="text" class="form-control" data-bind="value: answer"/>
        </span>
    </div>
    <!--/ko-->
</script>

<script type="text/html" id="case-config:case-properties:question">
    <!-- 
        This would normally use .form-control, but it's going to become a select2,
        which adds wonky height & borders on Firefox when it uses .form-control
    -->
    <input type="hidden" data-bind="
        questionsSelect: $root.getQuestions('all', false, case_transaction.allow.repeats(), true),
        value: path,
        optionsCaption: ' ',
        event: { change: function(view, e) {
            if (e.target.closest('#case-config-ko')) {
                var action = e.target.closest('.case-preload') ? 'Load' : 'Save';
                ga_track_event('Case Management', 'Form Level', action + ' Property (add/edit)');
            }
        } }
    "/>
    <p class="help-block" data-bind="visible: required() && !path()">{% trans "Required" %}</p>
    <p class="help-block" data-bind="visible: !required() && !path() && key()">{% trans "Not assigned" %}</p>
</script>

<script type="text/html" id="case-config:case-properties:property">
    <span data-bind="visible: !property.required()">
        <input type="text" class="form-control" data-bind="
            valueDefault: property.key,
            default: property.defaultKey,
            casePropertySelect2: suggestedProperties,
            select2options: {allowFreetext: 1, allowHtml: 1, width: 'off'},
            event: {
                change: function(){
                    var el = $($element),
                        caretPosition = el.caret();
                    el.val(el.val().replace(/ /g,'_'));
                    if(el.is(':focus')) {
                        el.caret(caretPosition);
                    }
                    return true;
                }
            }
        "/>
    </span>
    <span data-bind="visible: property.required()">
        <code data-bind="text: property.key"></code>
    </span>
</script>

<script type="text/html" id="case-config:case-transaction:case-preload">
    <div class="panel-heading panel-title">{% trans "Load the following case properties into the form" %}</div>
    <table class="table table-condensed" data-bind="visible: case_preload().length">
        <thead>
            <tr>
                <th></th>
                <th>{% trans "Case Property" %}</th>
                <th></th>
                <th>{% trans "Question" %}</th>
            </tr>
        </thead><commit_msg>stop passing unneeded options to casePropertySelect2<commit_after>{% load i18n %}

<script type="text/html" id="case-config:condition">
    <!--ko with: condition -->
    <span data-bind="text: $parent.actionType"></span>
    <div data-bind="visible: type() === 'always'">
        <a href="#" data-bind="click: function () {type('if')}"><i class="fa fa-plus"></i> {% trans "Only if the answer to..." %}</a>
    </div>
    <div class="form-inline" data-bind="visible: type() === 'if'">
        <a href="#" data-bind="click: function () {type('always')}">
            <i class="fa fa-remove"></i>
        </a>
        {% trans "Only if the answer to" %}
        <!-- 
            This would normally use .form-control, but it's going to become a select2,
            which adds wonky height & borders on Firefox when it uses .form-control
        -->
        <input type="hidden" data-bind="
            questionsSelect: $root.getQuestions('select select1', false, $parent.config.allow.repeats()),
            value: question,
            optionsCaption: ' '
        "/>
        <select class="form-control" data-bind="
                optstr: [
                    {label:'{% trans "is" %}', value:'='},
                    {label:'{% trans "has selected" %}', value:'selected'},
                    {label:'{% trans "is true" %}', value:'boolean_true'}
                ],
                value: operator"></select>
        <span data-bind="if: $root.getAnswers({question: question()}).length && operator() != 'boolean_true'">
            <select class="form-control" data-bind="
                optstr: $root.getAnswers({question: question()}),
                value: answer"></select>
        </span>
        <span data-bind="if: !$root.getAnswers({question: question()}).length && operator() != 'boolean_true'">
            <input type="text" class="form-control" data-bind="value: answer"/>
        </span>
    </div>
    <!--/ko-->
</script>

<script type="text/html" id="case-config:case-properties:question">
    <!-- 
        This would normally use .form-control, but it's going to become a select2,
        which adds wonky height & borders on Firefox when it uses .form-control
    -->
    <input type="hidden" data-bind="
        questionsSelect: $root.getQuestions('all', false, case_transaction.allow.repeats(), true),
        value: path,
        optionsCaption: ' ',
        event: { change: function(view, e) {
            if (e.target.closest('#case-config-ko')) {
                var action = e.target.closest('.case-preload') ? 'Load' : 'Save';
                ga_track_event('Case Management', 'Form Level', action + ' Property (add/edit)');
            }
        } }
    "/>
    <p class="help-block" data-bind="visible: required() && !path()">{% trans "Required" %}</p>
    <p class="help-block" data-bind="visible: !required() && !path() && key()">{% trans "Not assigned" %}</p>
</script>

<script type="text/html" id="case-config:case-properties:property">
    <span data-bind="visible: !property.required()">
        <input type="text" class="form-control" data-bind="
            valueDefault: property.key,
            default: property.defaultKey,
            casePropertySelect2: suggestedProperties,
            event: {
                change: function(){
                    var el = $($element),
                        caretPosition = el.caret();
                    el.val(el.val().replace(/ /g,'_'));
                    if(el.is(':focus')) {
                        el.caret(caretPosition);
                    }
                    return true;
                }
            }
        "/>
    </span>
    <span data-bind="visible: property.required()">
        <code data-bind="text: property.key"></code>
    </span>
</script>

<script type="text/html" id="case-config:case-transaction:case-preload">
    <div class="panel-heading panel-title">{% trans "Load the following case properties into the form" %}</div>
    <table class="table table-condensed" data-bind="visible: case_preload().length">
        <thead>
            <tr>
                <th></th>
                <th>{% trans "Case Property" %}</th>
                <th></th>
                <th>{% trans "Question" %}</th>
            </tr>
        </thead>
{'fraction_non_alphanumeric': 0.17857560519237517, 'fraction_numerical': 0.0018711261840720383, 'mean_word_length': 2.0840245221781464, 'pattern_counts': {'":': 0, '<': 127, '<?xml version=': 0, '>': 127, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1894245', 'n_tokens_mistral': 2501, 'n_tokens_neox': 2380, 'n_words': 579}