<div class="modalBody configWorkflow">
  <div class="header">
    <div class="btn btn-primary pull-right" ng-click="saveconfig();closeThisDialog()">
      <translate>common.save</translate>
    </div>
    <div class="btn btn-default" ng-click="addlinks(TYPE_FORM)">
      <i class="fa fa-plus"></i> Form
    </div>
    <div class="btn btn-default" ng-click="addlinks(TYPE_DATATABLE)">
      <i class="fa fa-plus"></i> Datatable
    </div>
    <div class="btn btn-default" ng-click="addlinks(TYPE_FORMTABLE)">
      <i class="fa fa-plus"></i> Formtable
    </div>
    <div class="btn btn-default" ng-click="addlinks(TYPE_TITLE)">
      <i class="fa fa-plus"></i> <translate>intervflowwidget.title</translate>
    </div>
  </div>

  <div class="row body form-container">
    <div class="col-xs-12">
      <!-- links -->
      <div ng-repeat="lks in links" class="link">
        <div class="row">
          <div class="col-xs-7">
            <!-- Formulaire -->
            <div ng-if="lks.type==TYPE_FORM || lks.type==TYPE_FORMTABLE">
              <div class="row">
                <div class="col-xs-12">
                  <label><i ng-class="lks.type==TYPE_FORM?'fa fa-clipboard':'fa fa-list-ul'"></i> {{lks.title}}</label>
                </div>
                <div class="col-xs-12">
                  <div class="input-group">
                    <span class="input-group-addon"> Nom </span>
                    <input type="text" class="form-control" placeholder="lks.title" ng-model="lks.title" />
                  </div>
                </div>
                <div class="col-xs-12">
                  <div
                    class="btn btn-default pull-right btn-sm link-open-button"
                    ng-click="openConfigBrowser($index)"
                    style="margin: 2px;"
                  >
                    ...
                  </div>
                  <div class="input-group link-open-input">
                <span class="input-group-addon">
                  <i class="fa fa-folder-o"></i></span>
                    <input type="text" class="form-control" ng-model="lks.config.templatedir" />
                    <span class="input-group-addon"><i class="fa fa-cube"></i>
                </span>
                    <input
                      type="text"
                      class="form-control templateform"
                      ng-model="lks.config.templateform"
                    />
                  </div>
                </div>
                <div class="col-xs-2">Hauteur</div>
                <div class="col-xs-4">
                  <select class="selectpicker form-control" ng-model="lks.config.height">
                    <option disabled selected hidden value>
                      {{'statistiques.choisir' | translate}}
                    </option>
                    <option value="height500">500</option>
                    <option value="height600">600</option>
                    <option value="height700">700</option>
                    <option value="height800">800</option>
                  </select>
                </div>
                <div class="col-xs-6">
                  <div ng-if="lks.type==='Form' && (lks.template.formtype==='intervention_simple' || lks.template.formtype==='table_simple')">
                    <label class="checkbox">
                      <input type="checkbox" ng-model="lks.config.modeWithoutSearchTab" />
                      <span translate>intervflowwidget.openInAddMode</span>
                    </label>
                  </div>
                </div>
              </div>
            </div>

            <!--datatable-->
            <div ng-if="lks.type==TYPE_DATATABLE">
              <div class="row">
                <div class="col-xs-12">
                  <label><i class="fa fa-database"></i> {{lks.title}}</label>
                </div>
                <div class="col-xs-12">
                  <div class="input-group">
                    <span class="input-group-addon">{{lks.type}}</span>
                    <input type="text" class="form-control" placeholder="lks.title" ng-model="lks.title" />
                  </div>
                </div>
                <div class="col-xs-12">
                  <div class="input-group">
                    <span class="input-group-addon">fti</span>
                    <input type="text" class="form-control" ng-model="lks.config.fti" />
                    <span class="input-group-addon">where</span>
                    <input type="text" class="form-control" ng-model="lks.config.where" />
                  </div>
                </div>

                <div class="col-xs-12">
                  <hr/>
                  <label for="singleSelect"> Selectionner une action: </label><br />
                  <select id="singleSelect" name="singleSelect" class="form-control" ng-model="selectedactiontype">
                    <option value="openform"> Ouvrir un formulaire </option>
                    <!-- <option value="printdocxTemplate"> Impression de rapport </option> -->
                  </select><br/>

                  <div class="input-group" ng-if="selectedactiontype=='openform'">
                    <span class="input-group-addon">form </span>
                    <input type="text" class="form-control" ng-model="param.form" />
                  </div>
                  <div class="btn btn-default" ng-click="addaction(lks,selectedactiontype,param)">
                    <i class="fa fa-plus"></i> Actions
                  </div>

                  <div ng-repeat="action in lks.config.actions track by $index" style="margin: 20px 0;">

                    <div class="btn btn-xs btn-danger"
                         style="float: right; margin: 6px 3px;" ng-click="removeFlowAction(lks,$index)">
                      <i class="fa fa-times"></i>
                    </div>
                    <div class="input-group">
                      <span class="input-group-addon">btn action</span>
                      <span class="input-group-addon">name</span>
                      <input type="text" class="form-control" ng-model="action.name" />
                      <span class="input-group-addon">icone</span>
                      <input type="text" class="form-control" ng-model="action.icone" />
                    </div>
                    <div class="input-group">
                      <span class="input-group-addon">formulaire</span>
                      <input type="text" class="form-control" ng-model="action.form" />
                      <span class="input-group-addon">Titre popup</span>
                      <input type="text" class="form-control" ng-model="action.form_title" />
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <!-- roles restrictions -->
          <div class="col-xs-4" ng-if="lks.type===TYPE_FORM || lks.type===TYPE_FORMTABLE || lks.type===TYPE_DATATABLE">
            <get-roles curtool="lks"></get-roles>
          </div>
          <!-- title -->
          <div ng-if="lks.type===TYPE_TITLE" class="col-xs-11">
            <div class="row">
              <div class="col-xs-12">
                <label><i class="fa fa-text-width"></i> {{lks.title}}</label>
              </div>
              <div class="col-xs-12">
                <div class="input-group">
                  <span class="input-group-addon" translate>intervflowwidget.title</span>
                  <input
                    type="text"
                    class="form-control"
                    placeholder="{{'intervflowwidget.title' | translate}}"
                    ng-model="lks.title"/>
                </div>
              </div>
            </div>
          </div>
          <!-- item actions -->
          <div class="col-xs-1 itemAction">
            <!-- delete -->
            <div class="btn btn-danger  btn-xs"
              ng-click="delconfig($index)">
              <i class="fa fa-times"></i>
            </div>
            <!-- move up -->
            <button type="button"
              class="btn btn-xs btn-default"
              ng-class="$index==0?'disabled':''"
              ng-click="moveItem($index,'up')">
              <i class="fa fa-arrow-up"></i>
            </button>
            <!-- move down -->
            <button type="button"
              class="btn btn-xs btn-default"
              ng-class="$index==links.length-1?'disabled':''"
              ng-click="moveItem($index,'down')">
              <i class="fa fa-arrow-down"></i>
            </button>
          </div>
        </div>
        <hr ng-if="!$last"/>
      </div>
      <br/>
      <br/>
    </div>
  </div>
</div>