<template>
    <v-card
        tile
        flat
        :width="width"
        :height="height"
        class="overflow-y-auto text-caption"
    >
        <cs-centered-alert 
            v-if="permissions.length == 0"
            :height="height"
            :message="__('Nu sunt definite permisiuni')"
        />

        <permissions v-else
            :app="app"
            :permissions="permissions"
            :parentPermission="null"
            class="mt-3"
        />

        <right-menu 
            :menu="menu"
        />

        <permission-form-menu 
            :app="app"
            :form="form"
        />
    </v-card>
</template>

<script>
    export default {
        props: {
            app: {required: true},
            width: {default: null},
            height: {default: null},
        },  

        computed: {
            dataprovider() {
                return this.app.dataSession.Permissions;
            },

            permissions() {
                return this.dataprovider.items;
            },

            form() {
                return this.app.forms.Permissions;
            },

            menu() {
                return this.app.menus.Permissionrightmenu
            }
        },

        components: {
            CsCenteredAlert: require('@CsVueComp/sheets/CsCenteredAlert').default,
            RightMenu: require('@CsVueComp/menus/rightmenu/RightMenu').default,
        },

        name: 'PermissionsList',
    }
</script>