<?php $__env->startSection('title', 'Login'); ?>
<?php $__env->startSection('content'); ?>
    <div class="box">
        <div class="img-cont">
            <img src="<?php echo e(asset('front/assets/img/login-logo.png')); ?>" alt="logo" class="img-fluid">
        </div>
        <div class="text-cont">
            <span>Hello there,</span>
            <h2>Welcome Back</h2>
        </div>
        
        <?php
$__split = function ($name, $params = []) {
    return [$name, $params];
};
[$__name, $__params] = $__split('front.login');

$__key = null;

$__key ??= \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::generateKey('lw-552569401-0', $__key);

$__html = app('livewire')->mount($__name, $__params, $__key);

echo $__html;

unset($__html);
unset($__key);
unset($__name);
unset($__params);
unset($__split);
if (isset($__slots)) unset($__slots);
?>

        <div class="login-with-social">


        </div>
        <form id="social-login-form" action="" method="POST" style="display: none;">
            <?php echo e(csrf_field()); ?>

            <input id="social-login-access-token" name="social-login-access-token" type="text">
            <input id="social-login-tokenId" name="social-login-tokenId" type="text">
            <input id="social-login-name" name="social_login_name" type="text">
            <input id="social-login-email" name="social_login_email" type="text">
            <input id="social-login-phone" name="social_login_phone" type="text">
            <input id="social-login-uid" name="social_login_uid" type="text">
            <input id="social-login-photo" name="social_login_photo" type="text">
          </form>
    </div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('scripts'); ?>
    <script src="https://www.gstatic.com/firebasejs/7.14.0/firebase-app.js"></script>
    <script src="https://www.gstatic.com/firebasejs/7.14.0/firebase-auth.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
    <script>
      // Initialize Firebase
        var config = {
            // This is the variable you got from Firebase's Firebase SDK snippet. It includes values for apiKey, authDomain, projectId, etc.
            apiKey: "AIzaSyB-C57QtBHq8Sm4CEE7CmPR9HZZc1lLcUY",
            authDomain: "trading-fmcg-292b2.firebaseapp.com",
            projectId: "trading-fmcg-292b2",
            storageBucket: "trading-fmcg-292b2.firebasestorage.app",
            messagingSenderId: "209774616786",
            appId: "1:209774616786:web:48c52b1e14f8c57f234d0b"
         
        };
        firebase.initializeApp(config);
        var facebookProvider = new firebase.auth.FacebookAuthProvider();
        var googleProvider = new firebase.auth.GoogleAuthProvider();
        var appleProvider = new firebase.auth.OAuthProvider('apple.com');
        var facebookCallbackLink = '/login/facebook/callback';
        var googleCallbackLink = '/login/google/callback';
        var appleCallbackLink = '/login/apple/callback';
        async function socialSignin(provider) {
            var socialProvider = null;
            if (provider == "facebook") {
                socialProvider = facebookProvider;
                document.getElementById('social-login-form').action = facebookCallbackLink;
            } else if (provider == "google") {
                socialProvider = googleProvider;
                document.getElementById('social-login-form').action = googleCallbackLink;
            } else {
                socialProvider = appleProvider;
                document.getElementById('social-login-form').action = appleCallbackLink;
            }
        
            firebase.auth().signInWithPopup(socialProvider).then(function(result) {
                console.log(result);
                document.getElementById('social-login-name').value = result.user.displayName;
                document.getElementById('social-login-email').value = result.user.email;
                document.getElementById('social-login-phone').value = result.user.phoneNumber;
                document.getElementById('social-login-photo').value = result.user.photoURL;
                document.getElementById('social-login-uid').value = result.user.providerData[0].uid;
                document.getElementById('social-login-form').submit();
                
                /*
                result.user.getIdToken().then(function(result) {
                        // console.log(result);
                    document.getElementById('social-login-tokenId').value = result;
                    //document.getElementById('social-login-form').submit();
                    });*/
            }).catch(function(error) {
                toastr.error(error);
            }); 
        }
      </script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('front.layouts.auth', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH E:\laragon\www\medibill\resources\views/front/auth/login.blade.php ENDPATH**/ ?>