<template>

    <index-page 
        :app="app"
        :controller="controller"
    >
        <template #append-breadcrumbs>
            <customer-entities-popup 
                :menu="app.menus.Entitiespopup"
            />
        </template>

        <template #prepend>
            <departament-form-menu 
                :app="app"
                :form="controller.form"
            />

            <departamente-filter-menu 
                :app="app"
                :filterform="controller.filterform"
            />
			
        </template>
    </index-page>
    
</template>

<script>


    export default {
        props: {
            app: {require: true},
        },

        computed: {
            controller() {
                return this.app.classes.Departamente;
            }
        },

        methods: {

            LoadResources() {
                this.app.AddClassesByContext(require.context('./../../Classes', true, /\.class.js$/i));
                this.app.AddDataProvidersByContext(require.context('./../../DataSessions', true, /\.dataprovider.js$/i));
                this.app.AddDatatablesByContext(require.context('./../../Datatables', true, /\.datatable.js$/i));
                this.app.AddFormProvidersByContext(require.context('./../../FormProviders', true, /\.formprovider.js$/i));                
                this.app.AddFormsByContext(require.context('./../../Forms', true, /\.form.js$/i));
                this.app.AddFilterFormsByContext(require.context('./../../Filterforms', true, /\.filterform.js$/i));
                this.app.AddMenusByContext(require.context('./../../Toolbars', true, /\.toolbar.js$/i));
                this.app.AddMenusByContext(require.context('./../../Menus', true, /\.menu.js$/i));
                this.app.AddMenusByContext(require.context('./../../Breadcrumbs', true, /\.breadcrumbs.js$/i));
                this.app.AddRequestsByContext(require.context('./../../Requests', true, /\.request.js$/i));
            },

            InitDatatable() {
                this.controller.DatatableRegisterDataProvider(this.controller.model);
            },

            InitForms() {
                this.controller.FormRegisterFormProvider(this.controller.model);

                this.controller.MakeEditableColumn(this.controller.model, 'departament-column');
            },

            /**
             * Filtering
             */
            InitFiltering() {
                /**
                 * formularul de filtrare își inregistreaza dataprovider-ul
                 */
                this.controller.FilterformRegisterDataProvider(this.controller.model);


                /**
                 * La coloana name atasez filter controlul name din formularul de filtrare, etc
                 */
                this.controller.MakeFilterableColumn(this.controller.model, 'departament-column', 'departament');
            },

            LoadData() {
                this.app.dataSession.Customers.GetById(this.controller.customer_id);
            }
        },

        
        mixins: [
            require('VUEMIX/Index/IndexPage'),
        ],

        name: 'Index',
    }
</script>