<script setup>
import { Head, useForm } from "@inertiajs/inertia-vue3";
import JetAuthenticationCard from "@/Jetstream/AuthenticationCard.vue";
import JetAuthenticationCardLogo from "@/Jetstream/AuthenticationCardLogo.vue";
import JetButton from "@/Jetstream/Button.vue";
import JetInput from "@/Jetstream/Input.vue";
import JetLabel from "@/Jetstream/Label.vue";
import JetValidationErrors from "@/Jetstream/ValidationErrors.vue";
import Layout from "@/Layouts/PromoSidebar";

defineProps({
    status: String,
});

const form = useForm({
    email: "",
});

const submit = () => {
    form.post(route("password.email"));
};
</script>

<template>
    <Layout title="Forgot Password">
        <div
            class="container flex flex-col items-center justify-center flex-1 py-5"
        >
            <JetAuthenticationCard>
                <div class="flex items-center justify-center w-full pb-5">
                    <JetAuthenticationCardLogo />
                </div>

                <div class="mb-4 text-sm text-gray-600">
                    {{ $t("Register.forget_pass") }}
                </div>

                <div
                    v-if="status"
                    class="mb-4 text-sm font-medium text-green-600"
                >
                    {{ status }}
                </div>

                <JetValidationErrors class="mb-4" />

                <form @submit.prevent="submit">
                    <div>
                        <JetLabel for="email" value="Email" />
                        <JetInput
                            id="email"
                            v-model="form.email"
                            autofocus
                            class="block w-full mt-1"
                            required
                            type="email"
                        />
                    </div>

                    <div class="flex items-center justify-end mt-4">
                        <JetButton
                            :class="{ 'opacity-25': form.processing }"
                            :disabled="form.processing"
                            @click="submit"
                        >
                            {{ $t("Register.email_pass") }}
                        </JetButton>
                    </div>
                </form>
            </JetAuthenticationCard>
        </div>
    </Layout>
</template>
