<template>
    <v-card
        tile
        flat
        :height="loginForm.height"
        :width="loginForm.width"
        :color="loginForm.color"
        :outlined="loginForm.outlined"
    >
        <v-card-title class="text-dark-blue">
            {{ __(loginForm.title) }}
        </v-card-title>

        <v-card-subtitle>
            <span class="text-caption text-dark-blue">
                {{ __(loginForm.subtitle) }}
            </span>
        </v-card-subtitle>

        <v-card-text>
            <login-form-input 
                class="mt-3"
                :app="app"
            />
        </v-card-text>

        <v-card-actions>
            <v-sheet 
                width="100%"
                class="transparent text-center"
            >
                <cs-orange-btn 
                    caption="Login"
                    :small="false"
                    :loading="app.forms.Login.processing"
                    :disabled="app.forms.Login.actionButtonDisabled"
                    :click="() => app.forms.Login.formprovider.Trigger()"
                />
            </v-sheet>
        </v-card-actions>

        <v-card-text>
            <v-sheet 
                width="100%"
                class="transparent d-flex justify-center align-center"
            >
                <v-btn
                    plain
                    text
                    :href="$url + 'forgot-password'"
                    class="text-no-transform text-dark-blue"
                >
                    {{ __('Am uitat parola') }} 
                </v-btn>


                <v-btn
                    v-if="app.appConfig.canCreateAccount"
                    plain
                    text
                    :href="$url + 'register'"
                    class="text-dark-blue text-no-transform"
                >
                    {{ __('Creează cont') }}
                </v-btn>
            </v-sheet>
        </v-card-text>
    </v-card>
</template>

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

        computed: {
            loginForm() {
                return this.app.classes.Loginform;
            }
        },
        
        components: {
            LoginFormInput: require('./Input/LoginFormInput').default,
            CsOrangeBtn: require('@CsVueComp/buttons/CsOrangeBtn').default,
        },

        name: 'LoginForm'
    }
</script>