<commit_before>{% extends "hqwebapp/base_section.html" %}
{% load hq_shared_tags %}
{% load i18n %}

{% requirejs_main 'domain/js/case_search_main' %}

{% block page_content %}
  {% include 'domain/admin/partials/case_search_templates.html' %}
  {% initial_page_data 'case_types' case_types %}
  {% initial_page_data 'values' values %}
  {% registerurl 'case_search_config' request.domain %}
  <h1>{% trans "Enable Case Search" %}</h1>

  <div class="row">
    <div class="col-sm-6">
      <form id="case-search-config">
        {% csrf_token %}
        <div data-bind="saveButton: saveButton"></div>
        <p class="spacer"></p>

        <p>
          {% blocktrans %}Enabling case search for the project will allow mobile users to look up cases
            that don't necessarily belong to them, and claim them. Possible applications range from cases
            for patients who move from one location to another, and other lost-to-follow-up scenarios, to
            any scenario involving searching for information, products, people or items.{% endblocktrans %}
        </p>
        <p class="text-danger">
          {% blocktrans %}WARNING: Enabling Case Search allows users to read the data of
            other users' cases, and take ownership of them, from modules whose case lists are configured
            for searching.{% endblocktrans %}
        </p>

        <p>
          <input id="enable" type="checkbox" data-bind="checked: toggleEnabled"/>
          <label for="enable">{% trans "Enable Case Search" %}</label>
        </p>

        {% if request.user.is_superuser %}
          <div data-bind="visible: toggleEnabled">
            {% blocktrans %}
              Visit <a href='{{ case_search_url }}' target='_blank'>Case Search</a> to test out your configuration.
            {% endblocktrans %}
          </div>
        {% endif %}

        <div id="fuzzies_div" data-bind="visible: toggleEnabled">
          <h2>{% trans "Fuzzy Search Properties" %}</h2>
          <p>
            {% blocktrans %}
              Add a list of all fuzzy search properties by case type below. These are
              properties that might be spelled inexactly by a user, e.g. "name".
            {% endblocktrans %}
          </p>

          <div data-bind="template: { name: 'case_type_template',
                                    foreach: fuzzyProperties,
                                    as: 'caseTypeProps' }"></div>
          <button type="button"
                  class="btn btn-primary"
                  data-bind="click: $root.addCaseType">
            <i class="fa fa-plus"></i> {% trans "Add case type" %}
          </button>
        </div>

        <div id="remove-characters" data-bind="visible: toggleEnabled">
          <h2>{% trans "Remove Special Characters" %}</h2><commit_msg>Updated help text on case search config<commit_after>{% extends "hqwebapp/base_section.html" %}
{% load hq_shared_tags %}
{% load i18n %}

{% requirejs_main 'domain/js/case_search_main' %}

{% block page_content %}
  {% include 'domain/admin/partials/case_search_templates.html' %}
  {% initial_page_data 'case_types' case_types %}
  {% initial_page_data 'values' values %}
  {% registerurl 'case_search_config' request.domain %}
  <h1>{% trans "Enable Case Search" %}</h1>

  <div class="row">
    <div class="col-sm-6">
      <form id="case-search-config">
        {% csrf_token %}
        <div data-bind="saveButton: saveButton"></div>
        <p class="spacer"></p>

        <p>
          {% blocktrans %}Enabling case search for the project will allow mobile users to look up cases
            that don't necessarily belong to them, and claim them. Possible applications range from cases
            for patients who move from one location to another, and other lost-to-follow-up scenarios, to
            any scenario involving searching for information, products, people or items.{% endblocktrans %}
        </p>
        <p class="text-danger">
          {% blocktrans %}WARNING: Enabling Case Search allows users to read the data of
            other users' cases, and take ownership of them, from modules whose case lists are configured
            for searching.{% endblocktrans %}
        </p>

        <p>
          <input id="enable" type="checkbox" data-bind="checked: toggleEnabled"/>
          <label for="enable">{% trans "Enable Case Search" %}</label>
        </p>

        {% if request.user.is_superuser %}
          <div data-bind="visible: toggleEnabled">
            {% blocktrans %}
              Visit <a href='{{ case_search_url }}' target='_blank'>Case Search</a> to test out your configuration.
            {% endblocktrans %}
          </div>
        {% endif %}

        <div id="fuzzies_div" data-bind="visible: toggleEnabled">
          <h2>{% trans "Fuzzy Search Properties" %}</h2>
          <p>
            {% blocktrans %}
              Add a list of all fuzzy search properties by case type below. These are
              properties that might be spelled inexactly by a user, e.g. "name".
              <br><br>
              When working with related case properties, add them to the case type that
              you willbe searching on, not the related case type. For example, if fuzzy matching
              on the parent's case name, add <strong>parent/name</strong> here as a property of
              the child case type.
            {% endblocktrans %}
          </p>

          <div data-bind="template: { name: 'case_type_template',
                                    foreach: fuzzyProperties,
                                    as: 'caseTypeProps' }"></div>
          <button type="button"
                  class="btn btn-primary"
                  data-bind="click: $root.addCaseType">
            <i class="fa fa-plus"></i> {% trans "Add case type" %}
          </button>
        </div>

        <div id="remove-characters" data-bind="visible: toggleEnabled">
          <h2>{% trans "Remove Special Characters" %}</h2>
{'fraction_non_alphanumeric': 0.12196754224527355, 'fraction_numerical': 0.0030115442529697173, 'mean_word_length': 2.198501872659176, 'pattern_counts': {'":': 0, '<': 81, '<?xml version=': 0, '>': 81, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5626262', 'n_tokens_mistral': 1715, 'n_tokens_neox': 1583, 'n_words': 521}