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

<head>
    <meta charset="utf-8">
    <meta content="width=device-width, initial-scale=1.0" name="viewport">
    <meta name="csrf-token" content="{{ csrf_token() }}">

    <title>Login</title>
    <meta content="" name="description">
    <meta content="" name="keywords">

    <!-- Favicons -->
     <link rel="icon" href="{{asset('images/favicon.ico')}}" type="image/png">
    <!--<link href="assets/img/apple-touch-icon.png" rel="apple-touch-icon">-->

    <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.3/dist/semantic.min.css">
    <script src="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.3/dist/semantic.min.js"></script>
    <!-- Bootstrap Styles -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
    <link href="https://api.fontshare.com/v2/css?f[]=satoshi@300,301,400,401,500,501,700,701,900,901&display=swap"
        rel="stylesheet">

    <!-- font-awesome -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css" />
    <link rel="stylesheet" href="{{ asset('assets/auth.css') }}">
    <!-- Toastr CSS -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css">
</head>

<body>
    <section class="auth_sec">
        <div class="auth_logo d-flex justify-content-center">
            <a href="auth.html"><img src="{{ asset('images/logo-green.png') }}" alt=""></a>
        </div>
        <div class="form-modal">
            <div class="form-toggle">
                <button id="login-toggle" onclick="toggleLogin()">log in</button>
                <button id="signup-toggle" onclick="toggleSignup()">sign up</button>
            </div>

            <div id="login-form" style="display: block;">
                <form method="POST" action="{{ route('store.login') }}">
                @csrf
                    <input name="email" type="email" class="mt-5" placeholder="Enter Email" required />
                    <input name="password" type="password" placeholder="Enter Password" required />
                    <button type="submit" class="btn login">lOGIN</button>
                </form>
            </div>

            <div id="signup-form" style="display: none;">
                <section class="signup-step-container">
                    <div class="row d-flex justify-content-center">
                        <div class="col-md-12">
                            <div class="wizard">
                                <div class="wizard-inner">
                                    <div class="connecting-line"></div>
                                    <ul class="nav nav-tabs" role="tablist">
                                        <li role="presentation" class="active" onclick="toggleSignup()">
                                            <a href="#step1" data-toggle="tab" aria-controls="step1" role="tab"
                                                aria-expanded="true"><span class="round-tab">1 </span> <i>Step 1</i></a>
                                        </li>
                                        <li role="presentation" class="disabled">
                                            <a href="#step2" data-toggle="tab" aria-controls="step2" role="tab"
                                                aria-expanded="false"><span class="round-tab">2</span> <i>Step 2</i></a>
                                        </li>

                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>
                <form id="register-form">
                    <input id="name" name="name" type="text" placeholder="Enter your name" required />
                    <input id="email" name="email" type="email" placeholder="Enter you email" required />
                    <input id="password" name="password" type="password" placeholder="Enter your password" required />
                    <button type="button" class="btn signup register">Continue to next step
                    </button>
                </form>
            </div>

            <div id="second-form" style="display: none;">
                <section class="signup-step-container">
                    <div class="row d-flex justify-content-center">
                        <div class="col-md-12">
                            <div class="wizard">
                                <div class="wizard-inner">
                                    <div class="connecting-line"></div>
                                    <ul class="nav nav-tabs" role="tablist">
                                        <li role="presentation" onclick="toggleSignup()">
                                            <a data-toggle="tab" aria-controls="step1" role="tab"
                                                aria-expanded="true"><span class="round-tab">1 </span> <i>Step 1</i></a>
                                        </li>
                                        <li role="presentation" class="active disabled">
                                            <a href="#step2" data-toggle="tab" aria-controls="step2" role="tab"
                                                aria-expanded="false"><span class="round-tab">2</span> <i>Step 2</i></a>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>
                <form method="POST" action="{{ route('store.company') }}">
                @csrf
                    <input name="company_domain" type="text" placeholder="Enter your domain (example.com)" required />
                    
                    <input name="company_name" type="text" placeholder="Enter your company name" required />
                    
                    <input name="company_email" type="email" placeholder="Enter your company email" required />
                    <textarea name="about" name="" id="" cols="30" rows="10" placeholder="Enter your about..."></textarea>
                    <button type="submit" class="btn signup">SIGN UP
                    </button>
                </form>
            </div>
        </div>

    </section>
    <script>
        function toggleSignup() {
            document.getElementById("login-toggle").style.backgroundColor = "#fff";
            document.getElementById("login-toggle").style.color = "#222";
            document.getElementById("signup-toggle").style.backgroundColor = "#748C62";
            document.getElementById("signup-toggle").style.color = "#fff";
            document.getElementById("login-form").style.display = "none";
            document.getElementById("signup-form").style.display = "block";
            document.getElementById("second-form").style.display = "none";
            document.getElementById("third-form").style.display = "none";
        }

        function toggleLogin() {
            document.getElementById("login-toggle").style.backgroundColor = "#748C62";
            document.getElementById("login-toggle").style.color = "#fff";
            document.getElementById("signup-toggle").style.backgroundColor = "#fff";
            document.getElementById("signup-toggle").style.color = "#222";
            document.getElementById("signup-form").style.display = "none";
            document.getElementById("login-form").style.display = "block";
            document.getElementById("second-form").style.display = "none";
        }

        // function showSecondForm() {
        //     document.getElementById("signup-form").style.display = "none";
        //     document.getElementById("second-form").style.display = "block";
        // }


    </script>
    <!-- jQuery (necessary for Toastr) -->
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <!-- Toastr JS -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>

    <script>
        $(document).ready(function() {
            @if (session('success'))
                toastr.success("{{ session('success') }}");
            @endif

            @if (session('error'))
                toastr.error("{{ session('error') }}");
            @endif
        });
    </script>
    <script>
        $(document).ready(function() {
            $('.register').click(function(){
                // Get the CSRF token from the meta tag
                var csrfToken = $('meta[name="csrf-token"]').attr('content');
                $.ajax({
                url: '{{ route('store.register') }}',
                type: 'POST',
                data: $('#register-form').serialize(),
                headers: {
                    'X-CSRF-TOKEN': csrfToken
                },
                success: function(response) {
                    // Handle the response
                    console.log('Form submitted successfully');
                    // Hide the signup form and show the second form
                    $('#signup-form').hide();
                    $('#second-form').show();
                },
                error: function(xhr) {
                    var message = xhr.responseJSON ? xhr.responseJSON.message : 'Form submission failed';
                    toastr.error(message);
                }
                });
            });
        });
    </script>
</body>


</html>