<?php
include('include/headscript.php');
if (isset($_SESSION["tempcode"])) {
    unset($_SESSION["tempcode"]);
} ?>
<?php



$trfnumbersuser = new WA_MySQLi_RS("trfnumbersuser", $cmctrfdb, 1);
$trfnumbersuser->setQuery("SELECT * FROM `trf-details` WHERE `trf-details`.iduser='$iduserlogin'");
$trfnumbersuser->execute();
$numbertrfuser = $trfnumbersuser->TotalRows;
?>
<?php
$trfnumberpercompany = new WA_MySQLi_RS("trfnumberpercompany", $cmctrfdb, 1);
$trfnumberpercompany->setQuery("SELECT * FROM `trf-details` WHERE `trf-details`.idcompany='$idcompany'");
$trfnumberpercompany->execute(); ?>
<?php
$totalparts = new WA_MySQLi_RS("totalparts", $cmctrfdb, 1);
$totalparts->setQuery("SELECT * FROM identificationparts LEFT JOIN `trf-details` ON identificationparts.idtrfdetails=`trf-details`.idtrfdetails WHERE `trf-details`.iduser='$user'");
$totalparts->execute();
?><?php $totalpartstrf = $totalparts->TotalRows ?>
<?php
$numbertrfcompany = $trfnumberpercompany->TotalRows;
?>
<?php //search if any module 2 go
?>
<?php
$modulego = new WA_MySQLi_RS("modulego", $cmctrfdb, 0);
$modulego->setQuery("SELECT * FROM `trf-details` WHERE `trf-details`.iduser='$iduserlogin' AND `trf-details`.csgo='Y' AND `trf-details`.signedonsecondcert IS NULL");
$modulego->execute();
?>
<?php if (!empty($modulego->getColumnVal("csgo"))) {
    $csgoyes = 'Y';
}
?>



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

<head>
    <meta charset="utf-8" />
    <title><?php echo $titlepage; ?> </title>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta content="CIMAC TRF Portal" name="description" />
    <meta content="" name="author" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />

    <!-- App favicon -->
    <link rel="shortcut icon" href="../images/favicon.ico">

    <!--Form Wizard-->
    <link href="../plugins/jquery-steps/jquery.steps.css" rel="stylesheet" type="text/css">

    <!-- App css -->
    <link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="assets/css/jquery-ui.min.css" rel="stylesheet">
    <link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" />
    <link href="assets/css/metisMenu.min.css" rel="stylesheet" type="text/css" />
    <link href="assets/css/app.min.css" rel="stylesheet" type="text/css" />
    <style>
        .btn-custom {
            background-color: rgb(143, 176, 248);
            /* Azzurro pastello chiaro */
            border: none;
            padding: 20px;
            font-size: 1.5rem;
            font-weight: 500;
            transition: background-color 0.3s ease;
        }

        .btn-custom:hover {
            background-color: rgb(114, 145, 238);
            /* Leggermente più scuro al passaggio del mouse */
        }

        .btn-custom-dark {
            background-color: rgb(101, 136, 241);
            /* Azzurro pastello medio */
            border: none;
            padding: 20px;
            font-size: 1.5rem;
            font-weight: 500;
            transition: background-color 0.3s ease;
        }

        .btn-custom-dark:hover {
            background-color: rgb(71, 85, 214);
            /* Più scuro al passaggio del mouse */
        }

        .btn-block {
            display: block;
            width: 100%;
        }
    </style>
</head>

<body>

    <!-- Top Bar Start -->
    <?php include('include/topbar.php'); ?>
    <!-- Top Bar End -->


    <!-- Left Sidenav -->
    <?php include('include/leftsidenav.php'); ?>
    <!-- end left-sidenav-->

    <div class="page-wrapper">
        <!-- Page Content-->
        <div class="page-content">

            <div class="container-fluid">
                <!-- Page-Title -->
                <div class="row">
                    <div class="col-sm-12">
                        <div class="page-title-box">
                            <div class="float-right">
                                <ol class="breadcrumb">
                                    <li class="breadcrumb-item"><a href="javascript:void(0);"><?php echo $titlepage; ?></a></li>
                                    <li class="breadcrumb-item active">Starter</li>
                                </ol>
                            </div>
                            <h4 class="page-title"><?php echo $titlewb; ?></h4>
                        </div><!--end page-title-box-->
                    </div><!--end col-->
                </div>

                <div class="row">
                    <div class="col-xl-12">
                        <div class="card">
                            <div class="card-body">
                                <div class="media">
                                    <img src="upload/users/<?php echo $avatarname; ?>" alt="" class="thumb-md rounded-circle mr-2">
                                    <div class="media-body align-self-center">
                                        <h4 class="mt-0 mb-1"><?php echo $welcomeuser; ?><?php echo $nameuser; ?></h4>
                                        <p class="text-muted mb-0 font-14 pr-5"><?php echo $welcome_help; ?></p>
                                    </div><!--end media-body-->
                                </div><!--end media-->
                                <br>
                                <!-- Due tasti -->
                                <div class="row mt-4">
                                    <div class="col-md-4 mb-3">
                                        <a href="typeofcertificatenew.php?varcertificate=m&certotherclient=N" class="btn btn-custom-dark btn-lg btn-block text-white">
                                            <i class="fas fa-plus mr-2"></i> <?php echo $insertnewrequest; ?>
                                        </a>
                                    </div>
                                    <div class="col-md-4 mb-3">
                                        <a href="archivetrf.php" class="btn btn-custom btn-lg btn-block text-white">
                                            <i class="fas fa-archive mr-2"></i> <?php echo $showarchive; ?>
                                        </a>
                                    </div>
                                </div><!--end row dei tasti -->
                            </div><!--end card-body-->
                        </div><!--end card-->

                        <!-- Rimangono i riquadri con i numeri -->
                        <div class="row">
                            <div class="col-sm-3">
                                <div class="card crm-data-card">
                                    <div class="card-body">
                                        <div class="row">
                                            <div class="col-4 align-self-center">
                                                <div class="icon-info">
                                                    <i class="far fa-user rounded-circle bg-soft-success"></i>
                                                </div>
                                            </div><!-- end col-->

                                            <div class="col-8 text-right">
                                                <p class="text-muted font-14"><?php echo $numbertrfusertitle; ?></p>
                                                <h3 class="mb-0"><?php echo $numbertrfuser; ?></h3>
                                            </div><!-- end col-->
                                        </div><!-- end row-->
                                    </div><!--end card-body-->
                                </div><!--end card-->
                            </div><!--end col-->
                            <div class="col-sm-3">
                                <div class="card crm-data-card">
                                    <div class="card-body">
                                        <div class="row">
                                            <div class="col-4 align-self-center">
                                                <div class="icon-info">
                                                    <i class="fas fa-chess-rook rounded-circle bg-soft-pink"></i>
                                                </div>
                                            </div><!-- end col-->
                                            <div class="col-8 text-right">
                                                <p class="text-muted font-14"><?php echo $numbertrfcompanytitle; ?></p>
                                                <h3 class="mb-0"><?php echo $numbertrfcompany; ?></h3>
                                            </div><!-- end col-->
                                        </div><!-- end row-->
                                    </div><!--end card-body-->
                                </div><!--end card-->
                            </div><!--end col-->

                            <div class="col-sm-3">
                                <div class="card crm-data-card">
                                    <div class="card-body">
                                        <div class="row">
                                            <div class="col-4 align-self-center">
                                                <div class="icon-info">
                                                    <i class="fas fa-angle-double-up rounded-circle bg-soft-purple"></i>
                                                </div>
                                            </div><!-- end col-->
                                            <div class="col-8 text-right">
                                                <p class="text-muted font-14"><?php echo $partsnumbertitle; ?></p>
                                                <h3 class="mb-0"><?php echo $totalpartstrf; ?></h3>
                                            </div><!-- end col-->
                                        </div><!-- end row-->
                                    </div><!--end card-body-->
                                </div><!--end card-->
                            </div><!--end col-->
                            <div class="col-sm-3">
                                <div class="card crm-data-card">
                                    <div class="card-body">
                                        <div class="row">
                                            <div class="col-4 align-self-center">
                                                <div class="icon-info">
                                                    <i class="far fa-registered rounded-circle bg-soft-warning"></i>
                                                </div>
                                            </div><!-- end col-->
                                            <div class="col-8 text-right">
                                                <p class="text-muted font-14"></p>
                                                <h3 class="mb-0">-</h3>

                                            </div><!-- end col-->
                                        </div><!-- end row-->
                                    </div><!--end card-body-->
                                </div><!--end card-->
                            </div><!--end col-->
                        </div><!--end row-->
                    </div><!--end col-->
                </div><!--end row-->
            </div><!-- container -->
            <!-- footer start -->
            <?php include('include/footer.php'); ?>
            </footer><!--end footer-->
        </div>
        <!-- end page content -->
    </div>
    <!-- end page-wrapper -->




    <!-- jQuery  -->
    <script src="assets/js/jquery.min.js"></script>
    <script src="assets/js/bootstrap.bundle.min.js"></script>
    <script src="assets/js/metismenu.min.js"></script>
    <script src="assets/js/waves.js"></script>
    <script src="assets/js/feather.min.js"></script>
    <script src="assets/js/jquery.slimscroll.min.js"></script>
    <script src="assets/js/jquery-ui.min.js"></script>

    <script src="../plugins/jquery-steps/jquery.steps.min.js"></script>
    <script src="assets/pages/jquery.form-wizard.init.js"></script>

    <!-- App js -->
    <script src="assets/js/app.js"></script>
</body>

</html>