<form
  name="action_Form"
  id="rulesChoiceCfgModal"
  ng-submit="addActionToFeatureType(currentEditedAction); closeThisDialog();"
  class="form"
  role="form"
>
  <div ng-switch="editMode">
    <h3 ng-switch-when="add">
      <translate>model.featuretypes.actions.create</translate>
    </h3>
    <h3 ng-switch-when="update">
      <translate>model.featuretypes.actions.update</translate>
    </h3>
  </div>

  <br />

  <select
    class="form-control"
    ng-model="currentEditedAction.actionType"
    ng-options="option for option in actionsOptions"
    ng-init="currentEditedAction.actionType = currentEditedAction.actionType || actionsOptions[0]"
    required
  >
  </select>

  <div class="action-role">
    <div class="action-add-role-button" ng-click="openActionRole(currentEditedAction)">
      <img src="img/common/add-friend.png" height="16" width="16"/>
    </div>
    <div
        ng-if="!currentEditedAction.roles || currentEditedAction.roles.length === 0"
        class="action-role-list">
      <translate>model.featuretypes.actions.roleRestriction</translate>
    </div>
    <div
        ng-show="currentEditedAction.roles && currentEditedAction.roles.length > 0"
        class="action-role-list">
      {{currentEditedAction.roles}}
    </div>
  </div>

  <hr />

  <div>
    <div
      ng-if="currentEditedAction.actionType === ( 'model.featuretypes.actions.form' | translate )"
    >
      <featuretypeactions-form
        currentformdata="currentEditedAction"
      ></featuretypeactions-form>
    </div>
    <div
      ng-if="currentEditedAction.actionType === ( 'model.featuretypes.actions.jasper' | translate )"
    >
      <featuretypeactions-jasper
        currentformdata="currentEditedAction"
        fti="currentfeaturetype"
      ></featuretypeactions-jasper>
    </div>
    <div
      ng-if="currentEditedAction.actionType === ( 'model.featuretypes.actions.url' | translate )"
    >
      <featuretypeactions-url
        currentformdata="currentEditedAction"
        fti="currentfeaturetype"
      ></featuretypeactions-url>
    </div>
    <div
        ng-if="currentEditedAction.actionType === ( 'model.featuretypes.actions.esrigeoprocess' | translate )"
    >
      <featuretypeactions-esrigeoprocess
          currentformdata="currentEditedAction"
          fti="currentfeaturetype"
      ></featuretypeactions-esrigeoprocess>
    </div>
    <div
      ng-if="currentEditedAction.actionType === ( 'model.featuretypes.actions.html' | translate )"
    >
      <featuretypeactions-html
        currentformdata="currentEditedAction"
        fti="currentfeaturetype"
      ></featuretypeactions-html>
    </div>
    <div
      ng-if="currentEditedAction.actionType === ( 'model.featuretypes.actions.anomalie' | translate )"
    >
      <featuretypeactions-anomalie
        currentformdata="currentEditedAction"
        fti="currentfeaturetype"
      ></featuretypeactions-anomalie>
    </div>
    <div
      ng-if="currentEditedAction.actionType === ( 'model.featuretypes.actions.is_detail' | translate )"
    >
      <featuretypeactions-is-detail
        currentformdata="currentEditedAction"
        fti="currentfeaturetype"
      ></featuretypeactions-is-detail>
    </div>
    <div
      ng-if="currentEditedAction.actionType === ( 'model.featuretypes.actions.widget' | translate )"
    >
      <featuretypeactions-widget
          currentformdata="currentEditedAction"
          fti="currentfeaturetype"
      ></featuretypeactions-widget>
    </div>
  </div>

  <hr />

  <!-- Boutons d'actions -->
  <div class="form-group clearfix">
    <div class="col-xs-12">
      <div class="text-right">
        <close-modale-button></close-modale-button>
        <button
          type="submit"
          class="btn btn-primary"
          title="{{'model.featuretypes.rules.addorupdate' | translate}}"
        >
          <translate>common.save</translate>
        </button>
      </div>
    </div>
  </div>
</form>
