<?php
// *************************************************************************
// *                                                                       *
// * DEPRIXA BASIC -  Freight Forwarding & Shipping Software Solutions     *
// * Copyright (c) JAOMWEB. All Rights Reserved                            *
// *                                                                       *
// *************************************************************************
// *                                                                       *
// * Email: support@jaom.info                                              *
// * Website: https://deprixa.link/documentation/                          *
// *                                                                       *
// *************************************************************************
// *                                                                       *
// * This software is furnished under a license and may be used and copied *
// * only  in  accordance  with  the  terms  of such  license and with the *
// * inclusion of the above copyright notice.                              *
// * If you Purchased from Codecanyon, Please read the full License from   *
// * here- http://codecanyon.net/licenses/standard                         *
// *                                                                       *
// *************************************************************************


require_once("loader.php");

$login = new User;
$core = new Core;

if ($login->cdp_loginCheck() == true) {

    header("location: view.php");
}

if (isset($_POST['login'])) {

    $result = $login->cdp_login($_POST['username'], $_POST['password']);



    if ($result) {
        header("location: view.php");
    }
}


?>

<!DOCTYPE html>
<html lang="en" data-theme="system">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0 shrink-to-fit=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="keywords" content="Courier DEPRIXA-Integral Web System">
    <meta name="author" content="Jaomweb">
    <meta name="description" content="">
    <title>Login | <?php echo $core->site_name ?></title>
    <link rel="icon" type="image/png" sizes="16x16" href="assets/<?php echo $core->favicon ?>">

    <link href="https://fonts.googleapis.com/css2?family=Work+Sans:wght@400;500;600&amp;display=swap" rel="stylesheet">
    <link href="assets/dist/css/screen.min.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="assets/dist/css/cards.min.css">

    <style>
        .members-wrap2 {
            padding: 2rem;
            border: 1px solid #DADCE5;
            border-radius: 8px;
            background: #ffffff;
        }
    </style>
</head>

<body class="page-template page-signin">
    <div class="site-wrap">
        <div class="main">
            <div class="members-page-wrap">
                <div class="members-content-wrap">
                    <a class="back-home-link" href="index.php"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
                            <path d="M22.5 10.5H4.703l5.449-6.54a1.499 1.499 0 10-2.304-1.92l-7.5 9c-.058.07-.088.153-.132.23-.036.064-.08.118-.106.187a1.478 1.478 0 00-.108.537L0 12l.002.006c0 .183.04.364.107.537.028.069.071.123.107.186.044.078.073.16.132.23l7.5 9a1.498 1.498 0 002.112.193c.636-.53.723-1.476.192-2.112l-5.45-6.54H22.5a1.5 1.5 0 000-3" />
                        </svg> <?php echo $lang['left111'] ?></a>
                    <div class="">
                        <?php echo ($core->logo_web) ? '<img src="assets/' . $core->logo_web . '" alt="' . $core->site_name . '" width="' . $core->thumb_web . '" height="' . $core->thumb_hweb . '"/>' : $core->site_name; ?>
                    </div>
                    <div><br></div>
                    <div class="members-wrap2">
                        <h1 class="members-title h3 text-center">
                            <?php echo $lang['left114'] ?>
                        </h1>
                        <div class="members-description text-center">
                            <?php echo $lang['leftorder285'] ?>
                        </div>
                        <div id="msgholder2">
                            <?php
                            if (isset($login)) {
                                if ($login->errors) {
                            ?>
                                    <div class="alert alert-danger" id="success-alert">
                                        <p><span class="icon-minus-sign"></span>
                                            <i class="close icon-remove-circle"></i>
                                            <span>Error!</span>
                                            <?php
                                            foreach ($login->errors as $error) {

                                                echo $error;
                                            } ?>
                                        </p>
                                    </div>

                            <?php
                                }
                            }
                            ?>
                        </div>
                        <div id="loader" style="display:none"></div>
                        <form class="members-form text-left js-member-form" method="post" name="login_form" id="login-form">

                            <div class="members-form-box">
                                <div class="form-field-wrap">

                                    <label for="email" class="sr-only"><?php echo $lang['left115'] ?> <span class="text-danger">*</span></label>
                                    <input type="text" class="username form-field" placeholder="<?php echo $lang['left116'] ?>" name="username" id="username" required="">


                                    <label for="email" class="sr-only"><?php echo $lang['left117'] ?> <span class="text-danger">*</span></label>
                                    <input type="password" class="username form-field" placeholder="<?php echo $lang['left118'] ?>" name="password" id="password" required="">

                                    <div class="col-lg-12">
                                        <p class="float-right forgot-pass"><a href="forgot-password.php" class="text-dark font-weight-bold"><?php echo $lang['left119'] ?></a></p>
                                        <div class="form-group">
                                            <div class="custom-control custom-checkbox">
                                                <input type="checkbox" class="custom-control-input" id="customCheck1">
                                                <label class="custom-control-label" for="customCheck1"><?php echo $lang['left120'] ?></label>
                                            </div>
                                        </div>
                                    </div>


                                    <button class="btn btn-block form-field"><span><?php echo $lang['left121'] ?></span></button>
                                    <input name="login" type="hidden" value="1" />
                                </div>
                            </div>

                        </form>
                        <div class="alternate-option text-center">
                            <small><?php echo $lang['left122'] ?> <a href="sign-up.php"><?php echo $lang['left123'] ?></a></small>
                        </div>
                        <?php
                        if (CDP_APP_MODE_DEMO === true) {

                        ?>
                            <span class="title">
                                <h6>Fast connection</h6>
                            </span>

                            <div class="social-links-wrap d-flex ">
                                <div class="social-links d-flex ">
                                    <button onclick="$('#username').val('admin'); $('#password').val('09731');" class="btn btn-sm btn-menuitem ">Admin</button>
                                    &nbsp;
                                    <button type="button" onclick="$('#username').val('employee'); $('#password').val('09731');" class="btn btn-sm btn-menuitem">Manager</button>
                                    &nbsp;
                                    <button type="button" onclick="$('#username').val('customer'); $('#password').val('09731');" class="btn btn-sm btn-menuitem ">Customer</button>
                                    &nbsp;
                                    <button type="button" onclick="$('#username').val('driver'); $('#password').val('09731');" class="btn btn-sm btn-menuitem ">Driver</button>

                                </div>
                            </div>

                            <!--end col-->
                        <?php
                        }
                        ?>
                    </div>
                </div>
                <div class="cover-wrap">
                    <img class="cover-image" loading="lazy" srcset="assets/images/content_web/logistic_login.jpg" sizes="(max-width: 1000px)" src="assets/images/content_web/logistic_login.jpg" alt="Sign in">
                </div>
            </div>
        </div>
    </div>

    <script src="assets/dist/js/app.bundle.min.js"></script>
    <script src="assets/dist/js/plugin/prism.js"></script>
    <script src="assets/libs/jquery/dist/jquery.min.js"></script>
</body>


</html>