
<form role="form" name="accountRightsEdit">



    <div class="row">

        <h3 class="col-md-9" translate>Additional rights scheduling for {{user.lastname}} {{user.firstname}}</h3>

        <div class="col-md-3 text-right">
            <br />
            <button class="btn btn-primary" ng-click="addAccountRight()">
                <i class="fa fa-plus-circle"></i> <span translate>Add right</span>
            </button>
        </div>
    </div>

    <div class="bg-info pad10 top30">
        <i class="fa fa-question-circle fa-pull-left fa-3x" style="color:white"></i>
        <p translate>Only the rights out of user collection are listed here, you can add more rights only if they are lot linked to a collection.
                According to the same principle, the rights linked to users will not be available to build a collection.</p>
        <p translate>The optional period configured here can be used as a reference in right rules.</p>
    </div>

    <div class="row top30" ng-repeat="accountRight in accountRights">
        <div class="col-md-6 form-group">
            <label for="user_accountRight{{$index}}" translate>Leave right</label>

            <div class="input-group">
                <div class="input-group-btn">
                    <button type="button" class="btn btn-warning" ng-click="removeAccountCollection($index)" ng-disabled="removeIsDisabled(accountRight)"><span class="glyphicon glyphicon-remove"></span><span class="sr-only" translate>Remove</span></button>
                </div>
                <select class="form-control" id="user_accountRight{{$index}}" ng-model="accountRight.right._id" ng-options="right._id as right.name for right in rights" ng-required>
                    <option></option>
                </select>
            </div>
        </div>

        <div class="col-md-3 form-group">
            <label for="beneficiary_from{{$index}}" translate>From</label>
            <input type="text" id="beneficiary_from{{$index}}" class="form-control" ng-model="accountRight.from" data-autoclose="1" container="body" bs-datepicker />
        </div>

        <div class="col-md-3 form-group">
            <label for="beneficiary_to{{$index}}" translate>To</label>
            <input type="text" id="beneficiary_to{{$index}}" class="form-control" ng-model="accountRight.to" data-autoclose="1" container="body" bs-datepicker />
        </div>
    </div>



    <div class="col-sm-12 text-center top30">
        <button class="btn btn-primary" ng-click="accountRightsEdit.$valid && saveBeneficiaries()" translate>Save</button>
        <button class="btn btn-link" ng-click="cancel()" translate>Cancel</button>
    </div>

</form>
