disable "Add" button in Nested Content config when no available docTypes are left

This commit is contained in:
2019-08-11 14:25:43 +02:00
parent ab0c4d2700
commit b686dc6362
2 changed files with 5 additions and 2 deletions
@@ -15,6 +15,10 @@
});
}
$scope.canAdd = function () {
return !$scope.model.docTypes || !$scope.model.value || $scope.model.value.length < $scope.model.docTypes.length;
}
$scope.remove = function (index) {
$scope.model.value.splice(index, 1);
}
@@ -60,7 +64,6 @@
// Count doctype name occurrences
var docTypeNameOccurrences = _.countBy(docTypes, 'name');
console.info(docTypeNameOccurrences);
// Populate document type tab dictionary
// And append alias to name if multiple doctypes have the same name
@@ -43,7 +43,7 @@
</tbody>
</table>
<div>
<button type="button" class="btn" ng-click="add()">
<button type="button" class="btn" ng-click="add()" ng-disabled="!canAdd()">
<localize key="general_add">Add</localize>
</button>
<i class="icon icon-help-alt medium umb-nested-content__help-icon" ng-click="showHelpText = !showHelpText"></i>