<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' && $parent.config.hasPrivilege">
    <a href="#"
       class="btn btn-default"
       data-bind="click: function () {type('if')}">
      <i class="fa fa-plus"></i>
      {% trans "Only if the answer to..." %}
    </a>
  </div>

  <div data-bind="visible: type() === 'always' && !$parent.config.hasPrivilege">
    {% blocktrans %}
      Configuration no longer allowed.
    {% endblocktrans %}
  </div>

  <div class="row" data-bind="visible: type() === 'if'">
    <div class="col-sm-1">
      {% trans "Only if the answer to" %}
    </div>
    <div class="col-sm-4">
      <select class="form-control"
              data-bind="questionsSelect: $root.getQuestions('select select1', false, $parent.config.allow.repeats()),
                         disable: !$parent.config.hasPrivilege,
                         value: question"></select>
    </div>
    <div class="col-sm-2">
      <select class="form-control"
              data-bind="optstr: [
                           {label:'{% trans "is" %}', value:'='},
                           {label:'{% trans "has selected" %}', value:'selected'},
                           {label:'{% trans "is true" %}', value:'boolean_true'}
                         ],
                         disable: !$parent.config.hasPrivilege,
                         value: operator"></select>
    </div>
    <!-- Input for question's answer -->
    <div class="col-sm-4"
         data-bind="visible: operator() != 'boolean_true'">
      <!-- Select question: answer is a dropdown -->
      <span data-bind="if: $root.getAnswers({question: question()}).length">
        <select class="form-control"
                data-bind="optstr: $root.getAnswers({question: question()}),
                           disable: !$parent.config.hasPrivilege,
                           value: answer"></select>
      </span>
      <!-- Non-select question: answer is a text box -->
      <span data-bind="if: !$root.getAnswers({question: question()}).length">
        <input type="text"
               class="form-control"
               data-bind="value: answer,
                          disable: !$parent.config.hasPrivilege"/>
      </span>
    </div>
    <div class="col-sm-1"
         data-bind="if: $parent.config.hasPrivilege">
        <a href="#"
           class="btn btn-default"
           data-bind="click: function () {type('always')}">
          <i class="fa fa-remove"></i>
        </a>
    </div>
  </div>
  <!--/ko-->
</script>

<script type="text/html"
        id="case-config:case-properties:question">
  <select class="form-control"
          data-bind="questionsSelect: $root.getQuestions('all', false, case_transaction.allow.repeats(), true),
                     value: path,
                     disable: !$parent.hasPrivilege,
                     event: {
                       change: function(view, e) {
                         if (e.target.closest('#case-config-ko')) {
                           var action = e.target.closest('.case-preload') ? 'Load' : 'Save';
                           hqImport('analytix/js/google').track.event('Case Management', 'Form Level', action + ' Property (add/edit)');
                         }
                       }
                     }"></select>
  <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,
                      disable: isDisabled,
                      casePropertyAutocomplete: suggestedProperties"/>
    </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">
    <h4 class="panel-title panel-title-nolink">
      <i class="fa fa-arrow-right"></i><i class="fa fa-file-o"></i>
      {% trans "Load the following properties into the form questions" %}
    </h4>
  </div>
  <div class="panel-body">
    <table class="table table-savecaseprops"
           data-bind="visible: case_preload().length">
      <thead>
      <tr>
        <th></th>
        <th>
          {% trans "Property" %}
        </th>
        <th></th>
        <th>
          {% trans "Question" %}
        </th>
      </tr>
      </thead>

      <tbody data-bind="foreach: case_preload">
      <tr class="form-group"
          data-bind="css: {
                       'has-error': validateProperty || validateQuestion,
                     }">
        <td class="col-sm-1 text-center">
          <a href="#"
             class="btn btn-danger"
             data-bind="click: $parent.removePreload,
                        visible: !(isBlank() && $index() === $parent.case_preload().length - 1)">
            <i class="fa fa-remove"></i>
          </a>
        </td>
        <td class="col-sm-5">
          <div class="full-width-select2"
               data-bind="template: {
                            name: 'case-config:case-properties:property',
                            data: {
                              'property': $data,
                              'suggestedProperties': case_transaction.suggestedPreloadProperties,
                              'isDisabled': false,
                            }
                          }"></div>
          <p class="help-block"
             data-bind="html: validateProperty,
                        visible: validateProperty"></p>
        </td>
        <td class="col-sm-1 text-center">
          <i class="fa fa-arrow-right"></i><i class="fa fa-file-o"></i>
        </td>
        <td class="col-sm-5">
          <div class="full-width-select2"
               data-bind="template: 'case-config:case-properties:question'"></div>
          <p class="help-block"
             data-bind="html: validateQuestion,
                        visible: validateQuestion"></p>
        </td>
      </tr>
      </tbody>
    </table>
    <div class="alert alert-block alert-info"
         data-bind="visible: !case_preload().length">
      {% trans "No properties will be loaded" %}
    </div>
    <a href="#"
       class="firstProperty btn btn-default"
       data-bind="click: addPreload,
                  visible: !case_preload().length">
      <i class="fa fa-plus"></i>
      {% trans "Load properties" %}
    </a>
  </div>
</script>

<script type="text/html"
        id="case-config:case-transaction:case-properties">
  <div class="panel-heading">
    <h4 class="panel-title panel-title-nolink">
      <i class="fa fa-arrow-right"></i><i class="fa fa-save"></i>
      {% trans "Save Questions to Case Properties" %}
    </h4>
  </div>
  <div class="panel-body">
    <table class="table table-savecaseprops"
           data-bind="visible: case_properties().length">
      <thead>
      <tr>
        <th class="col-sm-1"></th>
        <th class="col-sm-5">
          {% trans "Question" %}
        </th>
        <th class="col-sm-1"></th>
        <th class="col-sm-5">
          {% trans "Case Property" %}
        </th>
      </tr>
      </thead>

      <tbody data-bind="foreach: case_properties">
      <tr class="form-group"
          data-bind="css: {
                      'has-error': validate,
                      warning: (!validate() && required() && !path()) || (!validate() && !required() && !path() && key())
                    }">
        <td class="col-sm-1 text-center"
            data-bind="if: $parent.hasPrivilege">
          <a href="#"
             class="btn btn-danger"
             data-bind="click: $parent.removeProperty,
                        visible: !required() && !(isBlank() && $index() === $parent.case_properties().length - 1)">
            <i class="fa fa-remove"></i>
          </a>
        </td>
        <td class="col-sm-5">
          <div class="full-width-select2"
               data-bind="template: 'case-config:case-properties:question'"></div>
        </td>
        <td class="text-center col-sm-1">
          <i class="fa fa-arrow-right"></i><i class="fa fa-save"></i>
        </td>
        <td class="col-sm-5">
          <div class="full-width-select2"
               data-bind="template: {
                            name: 'case-config:case-properties:property',
                            data: {
                              property: $data,
                              suggestedProperties: case_transaction.suggestedSaveProperties,
                              'isDisabled': !$parent.hasPrivilege,
                            },
                            afterRender: $root.makePopover
                          }"></div>
          <p class="help-block"
             data-bind="html: validate,
                        visible: validate"></p>
          <!-- ko if: $data.description() && $parent.hasPrivilege() -->
          <inline-edit params="value: $data.description,
                               rows: 3,
                               cols: 30,
                               placeholder: '{% trans "Click here to add a description" %}',
                               url: '{% url "update_property_description" domain %}',<commit_msg>hasPrivilege is not an observable<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' && $parent.config.hasPrivilege">
    <a href="#"
       class="btn btn-default"
       data-bind="click: function () {type('if')}">
      <i class="fa fa-plus"></i>
      {% trans "Only if the answer to..." %}
    </a>
  </div>

  <div data-bind="visible: type() === 'always' && !$parent.config.hasPrivilege">
    {% blocktrans %}
      Configuration no longer allowed.
    {% endblocktrans %}
  </div>

  <div class="row" data-bind="visible: type() === 'if'">
    <div class="col-sm-1">
      {% trans "Only if the answer to" %}
    </div>
    <div class="col-sm-4">
      <select class="form-control"
              data-bind="questionsSelect: $root.getQuestions('select select1', false, $parent.config.allow.repeats()),
                         disable: !$parent.config.hasPrivilege,
                         value: question"></select>
    </div>
    <div class="col-sm-2">
      <select class="form-control"
              data-bind="optstr: [
                           {label:'{% trans "is" %}', value:'='},
                           {label:'{% trans "has selected" %}', value:'selected'},
                           {label:'{% trans "is true" %}', value:'boolean_true'}
                         ],
                         disable: !$parent.config.hasPrivilege,
                         value: operator"></select>
    </div>
    <!-- Input for question's answer -->
    <div class="col-sm-4"
         data-bind="visible: operator() != 'boolean_true'">
      <!-- Select question: answer is a dropdown -->
      <span data-bind="if: $root.getAnswers({question: question()}).length">
        <select class="form-control"
                data-bind="optstr: $root.getAnswers({question: question()}),
                           disable: !$parent.config.hasPrivilege,
                           value: answer"></select>
      </span>
      <!-- Non-select question: answer is a text box -->
      <span data-bind="if: !$root.getAnswers({question: question()}).length">
        <input type="text"
               class="form-control"
               data-bind="value: answer,
                          disable: !$parent.config.hasPrivilege"/>
      </span>
    </div>
    <div class="col-sm-1"
         data-bind="if: $parent.config.hasPrivilege">
        <a href="#"
           class="btn btn-default"
           data-bind="click: function () {type('always')}">
          <i class="fa fa-remove"></i>
        </a>
    </div>
  </div>
  <!--/ko-->
</script>

<script type="text/html"
        id="case-config:case-properties:question">
  <select class="form-control"
          data-bind="questionsSelect: $root.getQuestions('all', false, case_transaction.allow.repeats(), true),
                     value: path,
                     disable: !$parent.hasPrivilege,
                     event: {
                       change: function(view, e) {
                         if (e.target.closest('#case-config-ko')) {
                           var action = e.target.closest('.case-preload') ? 'Load' : 'Save';
                           hqImport('analytix/js/google').track.event('Case Management', 'Form Level', action + ' Property (add/edit)');
                         }
                       }
                     }"></select>
  <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,
                      disable: isDisabled,
                      casePropertyAutocomplete: suggestedProperties"/>
    </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">
    <h4 class="panel-title panel-title-nolink">
      <i class="fa fa-arrow-right"></i><i class="fa fa-file-o"></i>
      {% trans "Load the following properties into the form questions" %}
    </h4>
  </div>
  <div class="panel-body">
    <table class="table table-savecaseprops"
           data-bind="visible: case_preload().length">
      <thead>
      <tr>
        <th></th>
        <th>
          {% trans "Property" %}
        </th>
        <th></th>
        <th>
          {% trans "Question" %}
        </th>
      </tr>
      </thead>

      <tbody data-bind="foreach: case_preload">
      <tr class="form-group"
          data-bind="css: {
                       'has-error': validateProperty || validateQuestion,
                     }">
        <td class="col-sm-1 text-center">
          <a href="#"
             class="btn btn-danger"
             data-bind="click: $parent.removePreload,
                        visible: !(isBlank() && $index() === $parent.case_preload().length - 1)">
            <i class="fa fa-remove"></i>
          </a>
        </td>
        <td class="col-sm-5">
          <div class="full-width-select2"
               data-bind="template: {
                            name: 'case-config:case-properties:property',
                            data: {
                              'property': $data,
                              'suggestedProperties': case_transaction.suggestedPreloadProperties,
                              'isDisabled': false,
                            }
                          }"></div>
          <p class="help-block"
             data-bind="html: validateProperty,
                        visible: validateProperty"></p>
        </td>
        <td class="col-sm-1 text-center">
          <i class="fa fa-arrow-right"></i><i class="fa fa-file-o"></i>
        </td>
        <td class="col-sm-5">
          <div class="full-width-select2"
               data-bind="template: 'case-config:case-properties:question'"></div>
          <p class="help-block"
             data-bind="html: validateQuestion,
                        visible: validateQuestion"></p>
        </td>
      </tr>
      </tbody>
    </table>
    <div class="alert alert-block alert-info"
         data-bind="visible: !case_preload().length">
      {% trans "No properties will be loaded" %}
    </div>
    <a href="#"
       class="firstProperty btn btn-default"
       data-bind="click: addPreload,
                  visible: !case_preload().length">
      <i class="fa fa-plus"></i>
      {% trans "Load properties" %}
    </a>
  </div>
</script>

<script type="text/html"
        id="case-config:case-transaction:case-properties">
  <div class="panel-heading">
    <h4 class="panel-title panel-title-nolink">
      <i class="fa fa-arrow-right"></i><i class="fa fa-save"></i>
      {% trans "Save Questions to Case Properties" %}
    </h4>
  </div>
  <div class="panel-body">
    <table class="table table-savecaseprops"
           data-bind="visible: case_properties().length">
      <thead>
      <tr>
        <th class="col-sm-1"></th>
        <th class="col-sm-5">
          {% trans "Question" %}
        </th>
        <th class="col-sm-1"></th>
        <th class="col-sm-5">
          {% trans "Case Property" %}
        </th>
      </tr>
      </thead>

      <tbody data-bind="foreach: case_properties">
      <tr class="form-group"
          data-bind="css: {
                      'has-error': validate,
                      warning: (!validate() && required() && !path()) || (!validate() && !required() && !path() && key())
                    }">
        <td class="col-sm-1 text-center"
            data-bind="if: $parent.hasPrivilege">
          <a href="#"
             class="btn btn-danger"
             data-bind="click: $parent.removeProperty,
                        visible: !required() && !(isBlank() && $index() === $parent.case_properties().length - 1)">
            <i class="fa fa-remove"></i>
          </a>
        </td>
        <td class="col-sm-5">
          <div class="full-width-select2"
               data-bind="template: 'case-config:case-properties:question'"></div>
        </td>
        <td class="text-center col-sm-1">
          <i class="fa fa-arrow-right"></i><i class="fa fa-save"></i>
        </td>
        <td class="col-sm-5">
          <div class="full-width-select2"
               data-bind="template: {
                            name: 'case-config:case-properties:property',
                            data: {
                              property: $data,
                              suggestedProperties: case_transaction.suggestedSaveProperties,
                              'isDisabled': !$parent.hasPrivilege,
                            },
                            afterRender: $root.makePopover
                          }"></div>
          <p class="help-block"
             data-bind="html: validate,
                        visible: validate"></p>
          <!-- ko if: $data.description() && $parent.hasPrivilege -->
          <inline-edit params="value: $data.description,
                               rows: 3,
                               cols: 30,
                               placeholder: '{% trans "Click here to add a description" %}',
                               url: '{% url "update_property_description" domain %}',
{'fraction_non_alphanumeric': 0.16905621454357916, 'fraction_numerical': 0.0034038164002062918, 'mean_word_length': 1.6566652966159747, 'pattern_counts': {'":': 0, '<': 341, '<?xml version=': 0, '>': 339, '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': '538520', 'n_tokens_mistral': 5644, 'n_tokens_neox': 5446, 'n_words': 1090}