<div class="row">
  <div class="col-md-12">
    <div class="form-group">
      <label>
        <input data-ng-model="resources.node.disable_submissions" type="checkbox" />
        <span data-translate>Disable submissions</span>
      </label>
    </div>

    <div class="form-group">
      <label>
        <input data-ng-model="resources.node.encryption" type="checkbox" data-ng-change="enableEncryption()" data-ng-disabled="resources.node.encryption" />
        <span data-translate>Enable encryption</span>
      </label>
    </div>

    <div data-ng-if="resources.node.encryption">
      <div class="form-group">
        <label>
          <input data-ng-model="resources.node.escrow" type="checkbox" data-ng-change="toggleEscrow()" data-ng-disabled="resources.node.escrow && !resources.preferences.escrow" />
          <span data-translate>Enable administrators to change user passwords</span>
        </label>
      </div>
      <div class="form-group" data-ng-if="resources.node.escrow">
        <label data-translate>Administrators authorized to change user passwords:</label>
        <ol class="selectionList">
          <li data-ng-repeat="user in resources.users | filter: {escrow: true}">
            <span>{{user.name}}</span>
          </li>
        </ol>
      </div>
    </div>

    <div class="form-group" data-ng-if="resources.node.root_tenant">
      <label>
        <input data-ng-model="resources.node.multisite" type="checkbox" />
        <span data-translate>Enable multisite feature</span>
      </label>
    </div>

    <div class="form-group">
      <label>
        <input data-ng-model="resources.node.simplified_login" type="checkbox" />
        <span data-translate>Enable simplified login</span>
      </label>
    </div>

    <div class="form-group">
      <label>
        <input data-ng-model="resources.node.allow_indexing" type="checkbox" />
        <span data-translate>Enable search engines indexing</span>
      </label>
    </div>

    <div class="form-group">
      <label data-translate>Default questionnaire</label>
      <select class="form-control" data-ng-model="resources.node.default_questionnaire" data-ng-options="item.id as item.name for item in resources.questionnaires"></select>
    </div>

    <div class="form-group">
      <label data-translate>Text shown on top of the interface for selecting channels</label>
      <div>
        <textarea class="form-control" data-ng-model="resources.node.contexts_clarification"></textarea>
      </div>
    </div>

    <div class="form-group">
      <label>
        <input data-ng-model="resources.node.show_contexts_in_alphabetical_order" type="checkbox" />
        <span data-translate>Show contexts in alphabetical order</span>
      </label>
    </div>

    <div class="form-group">
      <label>
        <span data-translate>Size limit for file attachments</span> <span>(</span><span data-translate>megabytes</span><span>)</span>
      </label>
      <input class="form-control" data-ng-model="resources.node.maximum_filesize" type="number" min="0" />
    </div>

    <div class="form-group">
      <label>
        <input data-ng-model="resources.node.two_factor" type="checkbox" />
        <span data-translate>Require two factor authentication</span>
      </label>
    </div>

    <div class="form-group">
      <label data-translate>Password change interval</label>
      <input class="form-control" data-ng-model="resources.node.password_change_period" type="number" min="0" />
      <div data-translate>For security reasons, password changes are required at regular intervals.</div>
      <div data-translate>Set the value to 0 to disable this feature.</div>
    </div>

    <div class="form-group" data-ng-if="resources.node.root_tenant">
      <label data-translate>Number of days till notifying unread reports to users</label>
      <input class="form-control" data-ng-model="resources.node.unread_reminder_time" type="number" min="1" />
    </div>

    <div class="form-group">
      <label>
        <input data-ng-model="resources.node.disable_privacy_badge" type="checkbox" />
        <span data-translate>Disable the privacy panel</span>
      </label>
    </div>

    <div class="form-group" data-ng-if="!resources.node.disable_privacy_badge">
      <label>
        <input data-ng-model="resources.node.enable_custom_privacy_badge" type="checkbox" />
        <span data-translate>Enable custom privacy panel</span>
      </label>
    </div>

    <div class="form-group" data-ng-if="!resources.node.disable_privacy_badge && resources.node.enable_custom_privacy_badge">
      <label data-translate>Custom privacy panel</label>
      <div>
        <textarea class="form-control" data-ng-model="resources.node.custom_privacy_badge_text" type="text"></textarea>
      </div>
    </div>

    <div class="form-group">
      <input data-ng-model="resources.node.enable_custodian" type="checkbox">
      <label data-translate>Enable custodian user role</label>
    </div>

    <div class="form-group">
      <input data-ng-model="resources.node.enable_scoring_system" type="checkbox">
      <label data-translate>Enable scoring system</label>
    </div>

    <div class="form-group" data-ng-if="resources.node.root_tenant">
      <label data-translate>Logging level</label>
      <select class="form-control" data-ng-model="resources.node.log_level">
        <option value="ERROR">ERROR</option>
        <option value="INFO">INFO</option>
        <option value="DEBUG">DEBUG</option>
      </select>
    </div>

    <div class="form-group" data-ng-if="resources.node.root_tenant">
      <label data-translate>Anomaly detection thresholds</label>
      <table class="table-responsive">
        <thead>
          <tr>
            <th></th>
            <th data-translate>Low</th>
            <th data-translate>High</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td>
              <label>
                <span data-translate>Available disk space</span>
                <span>(</span><span data-translate>megabytes</span><span>)</span>
              </label>
            </td>
            <td><input class="form-control" data-ng-model="resources.node.threshold_free_disk_megabytes_low" type="number" min="0" /></td>
            <td><input class="form-control" data-ng-model="resources.node.threshold_free_disk_megabytes_high" type="number" min="0" /></td>
          </tr>
          <tr>
            <td>
              <label>
                <span data-translate>Available disk space</span>
                <span>(</span><span data-translate>percentage</span><span>)</span>
              </label>
            </td>
            <td><input class="form-control" data-ng-model="resources.node.threshold_free_disk_percentage_low" type="number"  min="0" max="100" /></td>
            <td><input class="form-control" data-ng-model="resources.node.threshold_free_disk_percentage_high" type="number"  min="0" max="100" /></td>
          </tr>
        </tbody>
      </table>
    </div>

    <div class="form-group">
      <input data-ng-model="resources.node.log_accesses_of_internal_users" type="checkbox" />
      <label data-translate>Log accesses of internal users</label>
    </div>

    <div class="form-group" data-ng-if="resources.node.root_tenant">
      <input data-ng-model="resources.node.enable_admin_exception_notification" type="checkbox">
      <label data-translate>Notify administrators of software problems</label>
    </div>

    <div class="form-group" data-ng-if="resources.node.root_tenant">
      <input data-ng-model="resources.node.enable_developers_exception_notification" type="checkbox">
      <label data-translate>Notify developers of software problems</label>
      <div data-translate>By enabling this feature, you will contribute to the development and security of the platform.</div>
    </div>

    <div class="form-group">
      <button class="btn btn-primary"
        data-ng-disabled="advancedForm.$invalid"
        data-ng-click="updateNode()" type="submit">
        <i class="fa-solid fa-check"></i>
        <span data-translate>Save</span>
      </button>

      <button class="btn btn-danger"
        data-ng-click="resetSubmissions()">
        <i class="fa-solid fa-trash"></i>
        <span data-translate>Reset reports</span>
      </button>
    </div>
  </div>
</div>
