<template>
    <v-card
        tile
        flat
        :height="app.height"
        :width="app.width"
        class="mx-auto overflow-x-auto overflow-y-hidden"
    >  

        <v-card-title class="pa-1">
            <image-icon 
                :src="app.url + 'imgs/blue-icons/customer.png'"
            />
            {{ __('Clienți') }}

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

            <cs-records-count 
                :dataprovider="customersDataprovider"
                field="itemsCount"
            >
                <cs-btn-reload 
                    :dataprovider="customersDataprovider" 
                />
            </cs-records-count>
        </v-card-title>

        <v-card-subtitle class="pl-12 py-0 my-0">
            {{ __('Lista clienților înregistrați în platformă') }}
        </v-card-subtitle>

        <cs-toolbar 
            :toolbar="customersToolbar"
        >
            <v-sheet 
                max-width="200"
                class="transparent text-truncate text-orange font-weight-bold"
            >
                {{ customer ? customer.name : null}}
            </v-sheet>
        </cs-toolbar>

        <v-sheet
            :height="app.height - 62 - 48"
            :width="app.width"
        >
            <customers-datatable 
                :app="app"
                :dataprovider="customersDataprovider"
                :height="app.height  - 108"
                :width="app.width"
            />
        </v-sheet>

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

<script>
    /**
     * title + subtitle = 40 + 22 = 62
     */
    export default {
        props: {
            app: {required: true},

            /** activeCustomer */
            customer: {default: null},
        },

        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: 'CustomersPage',
    }
</script>