<div class="lt-module-page">

    <div class="lt-module-page__top lt-module-page-top">
        <div class="lt-module-page-top__title">
            <h1>{{'Permissions' | translate}}</h1>
        </div>
        <div class="lt-module-page-top__actions">
            <div ng-if='(node == "Megamenu" || node == "CssGenerator")'>
                {{'Configuration' | translate}}
            </div>
            <div class="lt-module-page--paddingleft" ng-if='(node == "Megamenu" || node == "CssGenerator")'>
                <wizdom365-specific-configuration-picker module="node"></wizdom365-specific-configuration-picker>
            </div>
            <div class="lt-module-page--paddingleft">
                <button class="btn btn-primary"
                        ng-disabled="saving" ng-click="saveConfig()">
                    {{(saving ? 'Saving' : 'Save configuration')  | translate}}
                </button>
            </div>
        </div>
    </div>

    <!--<h2 class="remove-top-margin">{{'Permissions' | translate}}</h2>-->

    <div class="lt-module-page__content">
        <div class="container-fluid" ng-if="showPage">
        
            <div class="wizdom-controls">
                <div class="row wizdom-controls-row noborder" ng-repeat="permission in permissions"
                     ng-init="config.Wizdom365.Permissions[permission.groupName] = config.Wizdom365.Permissions[permission.groupName] || {}">
                    <div class="col-sm-12">
                        <h2>{{'Set ' | translate}}{{permission.groupName | translate}} {{' permissions' | translate}}</h2>
                        <div wizdom365-principalpicker principals="permission.principals" add-fn="add(config.Wizdom365.Permissions[permission.groupName], principal)" remove-fn="remove(config.Wizdom365.Permissions[permission.groupName], principal)" mode="groups" allowwizdomgroups="true" class="principal-picker"></div>
                    </div>
                </div>
            </div>
        </div>
        <div ng-if="!showPage">
            <p>{{'You do not have permissions to edit the permissions.' | translate}}</p>
        </div>
    </div>

</div>