<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">

    <!-- Theme Config Js -->
    <script src="<?php echo e(config('app.url')); ?>/public/public/assets/assets/js/config.js"></script>

    <!-- App css -->
    <link href="<?php echo e(config('app.url')); ?>/public/public/assets/assets/css/app.min.css" rel="stylesheet"
        type="text/css" id="app-style" />

    <!-- Icons css -->
    <link href="<?php echo e(config('app.url')); ?>/public/public/assets/assets/css/icons.min.css" rel="stylesheet"
        type="text/css" />

    <link href="<?php echo e(config('app.url')); ?>/public/public/vendors/sweetalert2/sweetalert2.min.css" rel="stylesheet">
    
    <link href="<?php echo e(config('app.url')); ?>/public/public/assets/assets/vendor/select2/css/select2.min.css" rel="stylesheet" type="text/css" />
    <title>Publisher Login</title>
</head>
<body>  
    <div class="account-pages pt-2 pt-sm-5 pb-4 pb-sm-5 position-relative">
        <div class="container">
            <div class="row justify-content-center">
                <div class="col-xxl-6 col-lg-5">
                    <div class="position-relative rounded-3 overflow-hidden"
                        style="background-image: url(<?php echo e(config('app.url')); ?>/public/public/assets/assets/images/flowers/img-3.png); background-position: top right; background-repeat: no-repeat;">
                        <div class="card bg-transparent mb-0">
                            <!-- Logo-->
                            <div class="auth-brand">
                                <a href="<?php echo e(route('home')); ?>" class="logo-light">
                                    <img src="<?php echo e(asset('site_images')); ?>/<?php echo e($site_data->logo); ?>" alt="logo"
                                        height="22">
                                </a>
                                <a href="<?php echo e(route('home')); ?>" class="logo-dark">
                                    <img src="<?php echo e(asset('site_images')); ?>/<?php echo e($site_data->logo); ?>" alt="dark logo"
                                        height="22">
                                </a>
                            </div>

                            <div class="card-body p-4">
                                <div class="w-50">
                                    <h4 class="pb-0 fw-bold">Sign In</h4>
                                    <p class="fw-semibold mb-4">Enter your email address and password to access admin panel.
                                    </p>
                                </div>

                                <form method="POST" id="publishar_login" action="<?php echo e(route('publisher.login')); ?>">
                                    <?php echo csrf_field(); ?>
                                    <div class="mb-3">
                                                <label for="email" class="form-label">Email address</label>
                                                <input id="device" type="hidden"
                                                    class="form-control <?php $__errorArgs = ['device'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
                                                    name="device" value="<?php echo e(old('device')); ?>" required
                                                    autocomplete="device" autofocus>
                                                <input id="browser" type="hidden"
                                                    class="form-control <?php $__errorArgs = ['browser'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
                                                    name="browser" value="<?php echo e(old('browser')); ?>" required
                                                    autocomplete="browser" autofocus>
                                                <input id="country" type="hidden"
                                                    class="form-control <?php $__errorArgs = ['country'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
                                                    name="country" value="<?php echo e(old('country')); ?>" value="" required
                                                    autocomplete="country" autofocus>
                                                <input id="city" type="hidden"
                                                    class="form-control <?php $__errorArgs = ['city'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" name="city"
                                                    value="<?php echo e(old('city')); ?>" value="" required autocomplete="city"
                                                    autofocus>
                                                <input id="email" type="email"
                                                    class="form-control <?php $__errorArgs = ['email'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" name="email"
                                                    value="<?php echo e(old('email')); ?>" required autocomplete="email"
                                                    placeholder="Email address" autofocus>

                                        <?php $__errorArgs = ['email'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                            <span class="invalid-feedback" role="alert">
                                                <strong><?php echo e($message); ?></strong>
                                            </span>
                                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                    </div>
                                   

                                    <div class="mb-3">
                                        <a href="<?php echo e(route('publisher.forgot_password')); ?>" class="float-end fs-12">Forgot your password?</a>
                                        <label for="password" class="form-label">Password</label>
                                        <div class="input-group input-group-merge">
                                            <input id="password" type="password" class="form-control <?php $__errorArgs = ['password'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
                                             name="password" placeholder="Enter your password" required autocomplete="current-password">
                                            <div class="input-group-text" data-password="false">
                                                <span class="password-eye"></span>
                                            </div>
                                        </div>
                                        <?php $__errorArgs = ['password'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                            <span class="invalid-feedback" role="alert">
                                                <strong><?php echo e($message); ?></strong>
                                            </span>
                                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                    </div>


                                    <div class="mb-3 mb-3">
                                        <div class="form-check">
                                            <input class="form-check-input" type="checkbox" id="checkbox-signin" checked="checked" />
                                            <label class="form-check-label" for="checkbox-signin">Remember me</label>
                                        </div>
                                    </div>

                                    <div class="mb-3 mb-0 text-center">
                                        <button class="btn btn-primary w-100" type="submit" name="submit"> Log In </button>
                                    </div>

                                </form>
                            </div> <!-- end card-body -->
                        </div>
                        <!-- end card -->
                    </div>

                    <div class="row mt-3">
                        <div class="col-12 text-center">
                            <p class="text-muted bg-body">Don't have an account? <a href="<?php echo e(route('publisher.register')); ?>"
                                    class="text-muted ms-1 link-offset-3 text-decoration-underline"><b>Sign Up</b></a></p>
                        </div> <!-- end col -->
                    </div>
                    <!-- end row -->

                </div> <!-- end col -->
            </div>
            <!-- end row -->
        </div>
        <!-- end container -->
    </div>


    <script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>

    <!-- Vendor js -->
    <script src="<?php echo e(config('app.url')); ?>/public/public/assets/assets/js/vendor.min.js"></script>
    
    <script src="<?php echo e(config('app.url')); ?>/public/public/vendors/sweetalert2/sweetalert2.min.js"></script>

    <!-- Bootstrap Wizard Form js -->
    <script src="<?php echo e(config('app.url')); ?>/public/public/assets/assets/vendor/twitter-bootstrap-wizard/jquery.bootstrap.wizard.min.js"></script>

    <!-- Wizard Form Demo js -->
    <script src="<?php echo e(config('app.url')); ?>/public/public/assets/assets/js/pages/demo.form-wizard.js"></script>
    <!--  Select2 Plugin Js -->
    <script src="<?php echo e(config('app.url')); ?>/public/public/assets/assets/vendor/select2/js/select2.min.js"></script>
    <script src="<?php echo e(config('app.url')); ?>/public/public/assets/assets/js/app.min.js"></script>

    <script type="text/javascript">
        // window.addEventListener('load', function() {
        <?php if(Session::has('success')): ?>
            Swal.fire('Success', '<?php echo e(Session::get('success')); ?>', 'success');
        <?php endif; ?>
        <?php if(Session::has('error')): ?>
            Swal.fire('Error', '<?php echo e(Session::get('error')); ?>', 'error');
        <?php endif; ?>
        $(document).ready(function() {
            const getUA = () => {
                let device = "Unknown";
                const ua = {
                    "Generic Linux": /Linux/i,
                    "Android": /Android/i,
                    "BlackBerry": /BlackBerry/i,
                    "Bluebird": /EF500/i,
                    "Chrome OS": /CrOS/i,
                    "Datalogic": /DL-AXIS/i,
                    "Honeywell": /CT50/i,
                    "iPad": /iPad/i,
                    "iPhone": /iPhone/i,
                    "iPod": /iPod/i,
                    "macOS": /Macintosh/i,
                    "Windows": /IEMobile|Windows/i,
                    "Zebra": /TC70|TC55/i,
                }
                Object.keys(ua).map(v => navigator.userAgent.match(ua[v]) && (device = v));
                return device;
            }



            // Opera 8.0+
            var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(
                ' OPR/') >= 0;

            // Firefox 1.0+
            var isFirefox = typeof InstallTrigger !== 'undefined';

            // Safari 3.0+ "[object HTMLElementConstructor]"
            var isSafari = /constructor/i.test(window.HTMLElement) || (function(p) {
                return p.toString() === "[object SafariRemoteNotification]";
            })(!window['safari'] || (typeof safari !== 'undefined' && safari.pushNotification));

            // Internet Explorer 6-11
            var isIE = /*@cc_on!@*/ false || !!document.documentMode;

            // Edge 20+
            var isEdge = !isIE && !!window.StyleMedia;

            // Chrome 1 - 79
            var isChrome = !!window.chrome && (!!window.chrome.webstore || !!window.chrome.runtime);

            // Edge (based on chromium) detection
            var isEdgeChromium = isChrome && (navigator.userAgent.indexOf("Edg") != -1);

            // Blink engine detection
            var isBlink = (isChrome || isOpera) && !!window.CSS;


            browser = '';
            if (isOpera) {
                browser = 'Opera';
            } else if (isFirefox) {
                browser = 'Firefox';
            } else if (isSafari) {
                browser = 'Safari';
            } else if (isIE) {
                browser = 'Internet Explorer';
            } else if (isChrome) {
                browser = 'Chrome';

            } else if (isEdge) {
                browser = 'Edge';
            } else if (isEdgeChromium) {
                browser = 'Edge chromium';
            } else if (isBlink) {
                browser = 'Blink';
            }


            // $('input[name=device]').val(getUA());
            // $('input[name=browser]').val(browser);
            $('input[name=device]').val('<?php echo e($getos); ?>');
            $('input[name=browser]').val('<?php echo e($getbrowser); ?>');
            //  $.ajax('https://api.ipbase.com/v1/json/')
            //   .then(
            //       function success(response) {

            $('input[name=country]').val('<?php echo e($data->countryName); ?>');
            $('input[name=city]').val('<?php echo e($data->cityName); ?>');
            //         })



            $('#publishar_login').submit(function(e) {

                $('.loader').fadeIn();
                e.preventDefault();
                var form = $(this);
                form.prev('.alert').remove();
                form.find('.text-danger').remove();
                $.ajax({
                    url: "<?php echo e(route('publisher.login.submit')); ?>",
                    type: 'POST',
                    dataType: 'JSON',
                    data: form.serialize(),
                    success: function(result) {
                        $('.loader').fadeOut();
                        // console.log(result);
                        if (!result.status) {
                            Swal.fire('Failed', result.message, 'error').then(function() {
                                if(result.data!==''){
                                // location.replace(result.data);
                                }
                            });;

                        } else {
                            Swal.fire('Success', result.message, 'success');

                            form[0].reset();
                            location.replace('<?php echo e(route('publisher.dashboard')); ?>');

                        }
                    },
                    error: function(xhr) {
                        $('.loader').fadeOut();
                        if (xhr.status == 422) {
                            $.each(xhr.responseJSON.errors, function(k, v) {
                                form.find('[name="' + k + '"]').after(
                                    '<div class="text-danger">' + v[0] +
                                    '</div>');
                            });
                        } else if (xhr.status == 419) {
                            window.location.href = "";
                        }
                        // console.log(xhr);
                    }
                });
            });
        });
    </script>
</body>
</html><?php /**PATH /home/cpalider/aff.cpalider.com/backend/resources/views/Auth/publisher/login.blade.php ENDPATH**/ ?>