<div class="row">
    <div class="col-xs-12">
        <button
          type="button"
          class="btn btn-primary"
          ng-click="chooseDatabase()"
          ng-disabled="editAncObj.data.properties.billingQuery === 'database'">
           Activer la facturation depuis la base de données uniquement
        </button>
    </div>
    <div class="col-xs-12">
        <h3> 1. Date de référence </h3>
    </div>
    <div class="col-xs-12">
        <div class="alert alert-info" style="padding: 10px; margin-bottom: 10px;">
            <i class="fa fa-info-circle"></i> Cette date sera utilisée pour générer automatiquement les factures des contrôles.
        </div>
    </div>
    <div class="col-xs-12">
        <select class="form-control" ng-model="periodesCfg.dateReference" ng-options="o.value as o.label for o in choixDateReferenceFacturation"></select>
        </select>
    </div>
</div>
<hr/>
<div class="row">
    <div class="col-xs-12">
        <button type="button" class="btn btn-default pull-right pushFloatRightAdminButton" ng-click="ouvrirPeriodeDialog()">
            <i class="fa fa-plus"></i> Période
        </button>
        <h3> 2. Périodes de Tarification</h3>
    </div>
</div>
<div class="row spbrow">
    <div class="col-xs-12">
        <table class="table table-striped table-bordered">
            <tr>
                <th>Nom</th>
                <th>Début</th>
                <th>Fin</th>
                <th>Date de délibération</th>
                <th class="col-xs-1">Actions</th>
            </tr>
            <tr ng-repeat="x in periodesCfg.periodes track by $index">
                <td>
                    <input type="text" class="form-control" ng-model="x.nom" disabled/>
                </td>
                <td>

                    <input type="text" data-date-format="dd-MM-yyyy" model-date-format="yyyy-MM-dd" class="form-control" ng-model="x.debut"
                           data-max-date="{{x.fin}}" disabled bs-datepicker
                           data-autoclose="true"/>
                </td>
                <td>
                    <input type="text" data-date-format="dd-MM-yyyy" model-date-format="yyyy-MM-dd" class="form-control" ng-model="x.fin"
                           data-min-date="{{x.debut}}" disabled bs-datepicker
                           data-autoclose="true"/>
                </td>
                <td>
                    <input type="text" data-date-format="dd-MM-yyyy" model-date-format="yyyy-MM-dd" class="form-control" ng-model="x.deliberation"
                           disabled bs-datepicker
                           data-autoclose="true"/>
                </td>
                <td class="col-xs-1 text-center">
                    <button type="button" class="btn btn-default btn-xs" ng-click="modifierPeriode($index)">
                        <i class="fa fa-edit"></i>
                    </button>
                    <button type="button" class="btn btn-xs btn-danger" ng-click="supprimerPeriode($index)" ng-disabled="canDeletePeriode(x.key)">
                        <i class="fa fa-times"></i>
                    </button>
                </td>
            </tr>
        </table>
    </div>
</div>