<div class="setDefaultValueByRole">
  <label class="rulesCfgTitle" translate>rulecfg.setdefaultvalueByRole.title</label>
  <br />
  <div ng-if="editTypeList">
    <div
      dual-list-box
      class="ruleCfgEditTypeList"
      data="editTypeList">
    </div>
  </div>
  <div class="row">
    <div class="col-xs-6">
      <label translate>rulecfg.setdefaultvalueByRole.attributecible</label>
      <select
        required
        class="form-control"
        ng-model="rule.parameters.targetField"
        ng-options="att.name as att.alias for att in currentfeaturetype.attributes | orderBy: 'alias'"
        ng-change="resetRolesAndValues()"
        >
        <option value="" translate>rulecfg.common.choiceprompt</option>
      </select>
    </div>
  </div>
  <br />
  <!-- table roles/values -->
  <div class="row">
    <div class="col-xs-12">
      <label translate>rulecfg.setdefaultvalueByRole.defaultValues</label>
      <table class="table table-bordered">
        <tr>
          <th
            class="text-center">
            <div
              class="btn btn-xs btn-success"
              ng-click="addNewRolesLine(undefined)"
              ng-disabled="!rule.parameters.targetField"
              >
              <i class="fa fa-plus"></i>
            </div>
            {{'rulecfg.setdefaultvalueByRole.columnRoles' | translate}}
          </th>
          <th>{{'rulecfg.setdefaultvalueByRole.columnValues' | translate}}</th>
          <th class="col-xs-2">{{'common.delete' | translate}}</th>
        </tr>
        <tr ng-repeat="x in rule.parameters.rolesAndValues track by $index">
          <td>
            <span ng-if="x.roles[0] === ''">
              {{'rulecfg.setdefaultvalueByRole.otherRoles' | translate}}
            </span>
            <span ng-if="x.roles[0] !== ''">
              <div
                class="btn btn-xs btn-default"
                ng-click="modifyRoles($index)"
                ng-disabled="rule.parameters.rolesAndValues.length===$index+1"
                >
                <i class="fa fa-pencil-square-o"></i>
              </div>
              {{x.roles.join(', ')}}
              <div
                class="modifyRoles"
                ng-if="currentlyEditedLine===$index">
                <get-roles
                  curtool="x">
                </get-roles>
              </div>
            </span>
          </td>
          <td>
            <div
              form-field
              ng-if="isTableRestriction()"
              ftid="currentfeaturetype.uid"
              attname="rule.parameters.targetField"
              res="x.keyTableRestriction"
              field-data="{restrictionKeyAsInt: attributeType === 'java.lang.Integer'}"
            ></div>
            <div
              form-field
              ng-if="!isTableRestriction()"
              ftid="currentfeaturetype.uid"
              attname="rule.parameters.targetField"
              res="x.value"
              field-data="{restrictionKeyAsInt: attributeType === 'java.lang.Integer'}"
            ></div>
          </td>
          <td class="text-center">
            <div
              class="btn btn-xs btn-danger"
              ng-click="removeRolesLine($index)"
            >
              <i class="fa fa-times"></i>
            </div>
          </td>
        </tr>
      </table>

    </div>
  </div>
</div>
  