backupApp.directive('backupNotificationForm', function(gettextCatalog) {
    return {
      restrict: 'E',
      scope: {
        ngRecipient: '=',
        ngLevels: '=',
      },
      templateUrl: 'templates/backupNotificationForm.html',
      controller: function($scope, AppService, AppUtils, SystemInfo, EditUriBackendConfig, DialogService, EditUriBuiltins) {

        $scope.AllLevelsChecked = false

        $scope.CheckIfAllSelected = function () {
          $scope.AllLevelsChecked = $scope.ngLevels.filter(l => l.checked === true).length === $scope.ngLevels.length
        }

        $scope.SelectRemoveAll = function() {
          for (const level of $scope.ngLevels) {
            level.checked = $scope.AllLevelsChecked
          }
        }

        $scope.$watchCollection('ngLevels', $scope.CheckIfAllSelected);
      }
    }
})