<script setup lang="ts">
import MainLayout from "@/Layouts/MainLayout.vue";
import GlassBox from "@/Components/FlightsGoneBy/GlassBox.vue";
import { Head, useForm } from "@inertiajs/vue3";

defineOptions({ layout: MainLayout });

const form = useForm({
    password: '',
});

const submit = () => {
    form.post(route('password.confirm'), {
        onFinish: () => form.reset(),
    });
};
</script>

<template>
    <Head title="Confirm Password" />
    <GlassBox>
        <h2>Confirm Password</h2>
        <p>This is a secure area. Please confirm your password before continuing.</p>

        <v-form style="width: 100%" @submit.prevent="submit">
            <v-container>
                <v-row>
                    <v-col cols="12">
                        <v-text-field
                            v-model="form.password"
                            label="Password"
                            type="password"
                            autocomplete="current-password"
                            autofocus
                            :error-messages="form.errors.password"
                        />
                    </v-col>
                </v-row>

                <v-row>
                    <v-col cols="12" class="d-flex justify-end">
                        <v-btn
                            size="large"
                            type="submit"
                            :loading="form.processing"
                            :disabled="form.processing"
                        >
                            Confirm
                        </v-btn>
                    </v-col>
                </v-row>
            </v-container>
        </v-form>
    </GlassBox>
</template>

<style scoped>
h2 {
    font-size: 2rem;
    text-align: center;
}

p {
    text-align: center;
    width: 100%;
    opacity: 0.7;
    margin-bottom: 1rem;
}
</style>
