<template>
  <div class="account-page">
    <!-- Main Wrapper -->
    <div class="main-wrapper">
      <div class="container">
        <div class="row justify-content-center">
          <div class="col-md-5 mx-auto">
            <form @submit.prevent="submitForm">
              <div class="d-flex flex-column justify-content-between vh-100">
                <div class="mx-auto p-4 text-center">
                  <img
                    src="@/assets/img/authentication/authentication-logo.svg"
                    class="img-fluid"
                    alt="Logo"
                  />
                </div>
                <div class="card">
                  <div class="card-body pb-3">
                    <div class="mb-4">
                      <h2 class="mb-2">Reset Password?</h2>
                      <p class="mb-0">
                        Enter New Password & Confirm Password to get inside
                      </p>
                    </div>
                    <div class="mb-3">
                      <label class="form-label">Old Password</label>
                      <div class="pass-group">
                        <input
                          class="pass-input form-control"
                          v-model="password"
                          :type="showPassword ? 'text' : 'password'"
                        />
                        <span
                          class="ti toggle-password"
                          :class="showPassword ? 'ti-eye' : 'ti-eye-off'"
                          @click="togglePasswordVisibility"
                        ></span>
                      </div>
                    </div>
                    <div class="mb-3">
                      <label class="form-label">New Password</label>
                      <div class="pass-group">
                        <input
                          class="pass-input form-control"
                          v-model="passwordOne"
                          :type="showPasswordOne ? 'text' : 'password'"
                        />
                        <span
                          class="ti toggle-password"
                          :class="showPasswordOne ? 'ti-eye' : 'ti-eye-off'"
                          @click="togglePasswordVisibilityOne"
                        ></span>
                      </div>
                    </div>
                    <div class="mb-3">
                      <label class="form-label">New Confirm Password</label>
                      <div class="pass-group">
                        <input
                          class="pass-input form-control"
                          v-model="passwordTwo"
                          :type="showPasswordTwo ? 'text' : 'password'"
                        />
                        <span
                          class="ti toggle-password"
                          :class="showPasswordTwo ? 'ti-eye' : 'ti-eye-off'"
                          @click="togglePasswordVisibilityTwo"
                        ></span>
                      </div>
                    </div>
                    <div class="mb-3">
                      <button type="submit" class="btn btn-primary w-100">
                        Change Password
                      </button>
                    </div>
                    <div class="text-center">
                      <h6 class="fw-normal text-dark mb-0">
                        Return to<router-link to="/login-3" class="hover-a">
                          Login</router-link
                        >
                      </h6>
                    </div>
                  </div>
                </div>
                <div class="p-4 text-center">
                  <p class="mb-0">Copyright &copy; {{ new Date().getFullYear() }} - Preskool</p>
                </div>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
    <!-- /Main Wrapper -->
  </div>
</template>
<script>
import { ref } from "vue";

export default {
  setup() {
    // Reactive variables
    const password = ref("");
    const passwordOne = ref("");
    const passwordTwo = ref("");
    const showPassword = ref(false);
    const showPasswordOne = ref(false);
    const showPasswordTwo = ref(false);

    // Method to toggle password visibility
    const togglePasswordVisibility = () => {
      showPassword.value = !showPassword.value;
    };
    const togglePasswordVisibilityOne = () => {
      showPasswordOne.value = !showPasswordOne.value;
    };
    const togglePasswordVisibilityTwo = () => {
      showPasswordTwo.value = !showPasswordTwo.value;
    };

    return {
      password,
      passwordOne,
      passwordTwo,
      showPassword,
      showPasswordOne,
      showPasswordTwo,
      togglePasswordVisibility,
      togglePasswordVisibilityOne,
      togglePasswordVisibilityTwo,
    };
  },
  methods: {
    submitForm() {
      this.$router.push("/reset-password-success-3");
    },
  },
};
</script>
