| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 | /**
 * Created by robin on 11/2/15.
 */
angular.module('luticate')
    .controller('GroupUsersController', ['$scope', 'luticateAuthGroups', 'data', 'dialogs',
        function($scope, luticateAuthGroups, data, dialogs) {
            $scope.group = data;
            $scope.itemPicker = {
                columns: [
                    {
                        name: "Username",
                        width: 3,
                        getValue: function (item) {
                            return item.Username;
                        }
                    }, {
                        name: "Email",
                        width: 3,
                        getValue: function (item) {
                            return item.Email;
                        }
                    }, {
                        name: "Firstname",
                        width: 3,
                        getValue: function (item) {
                            return item.Firstname;
                        }
                    }, {
                        name: "Lastname",
                        width: 3,
                        getValue: function (item) {
                            return item.Lastname;
                        }
                    }
                ],
                onItemClicked: function(item)
                {
                    $scope.itemPicker.luBasicTableScope.toggleCheckedItem(item);
                },
                editData: $scope.group,
                canAdd: 'LU_GROUP_USER_ADD',
                canDel: 'LU_GROUP_USER_DEL',
                canEdit: function()
                {
                    return true;
                },
                canFilter: function()
                {
                    return false;
                },
                getLoadPagePromise: function (page, perPage, query, promise) {
                    return luticateAuthGroups.usersGetAll({
                        group_id: $scope.group.Id,
                        page: page,
                        perPage: perPage,
                        query: query
                    }, promise);
                },
                getDelPromise: function (id, promise) {
                    return luticateAuthGroups.usersDel({
                        group_id: $scope.group.Id,
                        user_id: id
                    }, promise);
                },
                getEditController: function () {
                    return "GroupUsersAdd";
                },
                getItemText: function(item)
                {
                    return item.Username;
                }
            };
        }]);
 |