<template>
    <services-page 
        v-if="isPageBooted"
        :app="app"
    />

    <cs-centered-alert
        v-else
        :height="app.height"
        :width="app.width"
        message="Se încarcă..."
    >
        <v-progress-circular
            indeterminate
            color="orange darken-1"
        >
        </v-progress-circular>
    </cs-centered-alert>
</template>

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

        methods: {
            
            /**
             * Incarca resursele necesare: clase, providere, etc
             */
            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.AddRequestsByContext(require.context('./../../Requests', true, /\.request.js$/i));
            },

            /**
             * Se ataseaza formprovider-ele la formulare
             */
            InitForms() {
                this.app.forms.Services.SetFormProvider( this.app.formproviders.Services );
            },

            /**
             * Ca fac coloane editabile
             */
            InitEditableColumns() {
               
            },

            /**
             * atasez dataproviderul la datatable
             */
            InitDatatable() {
            },

            /**
             * Filtering
             */
            InitFiltering() {
            },

            LoadData() {
                this.app.dataSession.Services.Refresh();
                this.app.dataSession.Servicestypes.Refresh();
            }
        },

        created() {
            this.LoadResources();
            this.InitForms();
            this.InitEditableColumns();
            this.InitDatatable();
            this.InitFiltering();
            this.LoadData();
        },

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

        name: 'Index',
    }
</script>