<template>
    <v-card
        tile
        flat
        :width="app.width"
        :height="app.height"
        class="overflow-x-auto overflow-y-hidden"
    >  
        <v-card-title class="px-1 py-0">
            <image-icon 
                :src="app.url + 'imgs/blue-icons/team.png'"
            />
            {{ __('Echipa Decalex') }}

            <v-spacer></v-spacer>
            
            <cs-quick-search 
                :dataprovider="dataprovider" 
                class="mr-2"
            />

            <cs-records-count 
                :dataprovider="dataprovider"
                field="itemsCount"
            >
                <cs-btn-reload 
                    :dataprovider="dataprovider" 
                />
            </cs-records-count>

        </v-card-title>

        <cs-toolbar 
            :toolbar="toolbar"
        >
            <v-sheet 
                max-width="200"
                class="transparent text-truncate text-dark-blue font-weight-bold"
            >
                {{ activeRecord ? activeRecord.full_name : '-' }}
            </v-sheet>
        </cs-toolbar>

        <v-card
            tile
            flat
            :width="app.width"
            :height="app.height - 84"
            :disabled="datatableDisabled"
        >
            <users-datatable 
                :app="app"
                :dataprovider="dataprovider"
                :height="app.height  - 84"
                :width="app.width"
            />
        </v-card>
        
        <user-status-form 
            :form="form"
            :statuses="statuses"
        />

        <user-form-menu 
            :app="app"
            :form="form"
        />

        <users-filter-menu 
            :app="app"
        />
    </v-card>
</template>

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

        computed: {

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

            statuses() {
                return this.app.dataSession.Statuses.statuses;
            },

            dataprovider() {
                return this.app.dataSession.Users;
            },

            toolbar() {
                return this.app.menus.Userstoolbar;
            },

            activeRecord() {
                return this.app.classes.Controller.activeRecord;
            },

            datatableDisabled() {
                return this.app.classes.Controller.datatableDisabled;
            }
        },

        components: {
            ImageIcon: require('@CsVueComp/helpers/images/ImageIcon').default,
            CsRecordsCount: require('@CsVueComp/dataprovider/CsRecordsCount').default,
            CsQuickSearch: require('@CsVueComp/dataprovider/CsQuickSearch').default,
            CsBtnReload: require('@CsVueComp/buttons/CsBtnReload').default,
            CsToolbar: require('@CsVueComp/menus/toolbar/CsToolbar').default,
        },

        name: 'TeamPage',
    }
</script>