 @extends('Dashboard.master_page')




 @section('content')
 <div class="content content-boxed">
     <div class="block block-rounded">
        <div class="block-header block-header-default">

            <h3 class="block-title">Two-Factor Authentication
                            </h3>


        </div>


         <div class="block-content block-content-full" >
             <form class="js-validation-reminder" action="{{ route('profile.google2fa.verify') }}" method="POST">
                 @csrf
                 <div class="mb-4 col-8" style="margin:0 auto;">

                     <p style="text-align: justify;font-size: 15px;">Setup your 2FAs by scanning the barcode below using
                         Google
                         or Microsoft Authenticator App Alternatively, you can use the code {{ $secret }}</p>

                     @if (Auth::user()->googlef2_status == 1)
                         <h4 style="text-align: justify;color:red;font-size: 14px;">You have already enabled the 2FA on
                             {{ Auth::user()->google_date }} Do you want to setup again on new device?
                         </h4>
                         <br>
                         <br>
                     @endif


                     <div style="text-align: center">
                         <img src="{!! $QR_Image !!}" />
                     </div>

                     <div class="form-floating mb-2">
                         <input type="password" class="form-control" name="secret" placeholder="Enter 6-digit code">
                         <label for="example-password-input-floating">Enter 6-digit code</label>
                     </div>



                     @if (Session::has('success_message'))
                         <div style="color:green;font-size: .875rem;margin-top: .375rem;width:100%">
                             {{ Session::get('success_message') }}</div>
                     @endif

                     @error('secret')
                     <div style="color:#dc2626;font-size: .875rem;margin-top: .375rem;width:100%">
                        {{ $message }}</div>
                     @enderror

                     <div class="text-center">

                         @if (Auth::user()->googlef2_status == 1)
                             <button id="button" type="submit"class="btn btn-lg btn-alt-primary">Enable on New Device</button>
                         @endif

                         @if (Auth::user()->googlef2_status == 0)
                             <button id="button" type="submit" class="btn btn-lg btn-alt-primary">Enable</button>
                         @endif

                     </div>


                 </div>

             </form>
         </div>

     </div>
 </div> 
 @endsection
