<!DOCTYPE html>
<html lang="id">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Login - Flo.do</title>

    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.css">
    <link rel="stylesheet" href="{{ asset('css/app.css') }}">
</head>

<body>

    <div class="login-page">
        <div class="login-card">
            <img src="{{ asset('img/logo.png') }}" alt="Flo.do Logo" class="login-logo">
            <form action="{{ route('login.proses') }}" method="POST">
                @csrf

                <div class="mb-3">
                    <label for="username" class="form-label">Username</label>
                    <input type="text" class="form-control @error('username') is-invalid @enderror" id="username"
                        name="username" value="{{ old('username') }}" placeholder="Masukkan Usernamemu"
                        style="font-size: 13px" required>

                    @error('username')
                        <div class="invalid-feedback">
                            {{ $message }}
                        </div>
                    @enderror
                </div>

                <div class="mb-3">
                    <label class="form-label">Kata Sandi</label>

                    <div class="position-relative">

                        <input type="password" class="form-control @error('password') is-invalid @enderror"
                            style="font-size: 13px; padding-right: 40px;" id="passBaru" name="password"
                            placeholder="**************" required>

                        <span class="position-absolute top-50 end-0 translate-middle-y me-3"
                            onclick="toggleDynamic('passBaru', 'iconPass')" style="cursor: pointer;">
                            <i class="bi bi-eye text-secondary" style="font-size: 16px" id="iconPass"></i>
                        </span>

                    </div>
                    @error('password')
                        <div class="invalid-feedback d-block">
                            {{ $message }}
                        </div>
                    @enderror

                </div>

                <button type="submit" class="btn btn-primary rounded-pill w-100 py-2 mt-2">Masuk</button>
            </form>
        </div>
    </div>

    <script>
        function toggleDynamic(inputId, iconId) {
            const passwordInput = document.getElementById(inputId);
            const eyeIcon = document.getElementById(iconId);

            if (passwordInput.type === 'password') {
                passwordInput.type = 'text';
                eyeIcon.classList.remove('bi-eye');
                eyeIcon.classList.add('bi-eye-slash');
            } else {
                passwordInput.type = 'password';
                eyeIcon.classList.remove('bi-eye-slash');
                eyeIcon.classList.add('bi-eye');
            }
        }
    </script>
</body>

</html>
