<?php
include('session.php');

$colname_person = $_GET['ime'];
$query_person = "SELECT * FROM le_users WHERE ime = '".$colname_person."'";
$person = mysqli_query($leld,$query_person) or die(mysqli_error());
$row_person = mysqli_fetch_assoc($person);
$totalRows_person = mysqli_num_rows($person);
?>
<!doctype html>
<html lang="en">

<head>
<title><?php echo $row_korisnik['ime']; ?> | Profil</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="description" content="">
<meta name="author" content="LaktusDev, design by: laktusdev.com">

<link rel="icon" href="favicon.ico" type="image/x-icon">
<!-- VENDOR CSS -->
<link rel="stylesheet" href="assets/vendor/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/vendor/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="assets/vendor/animate-css/vivify.min.css">

<link rel="stylesheet" href="assets/vendor/bootstrap-multiselect/bootstrap-multiselect.css">
<link rel="stylesheet" href="assets/vendor/parsleyjs/css/parsley.css">

<!-- MAIN CSS -->
<link rel="stylesheet" href="assets/css/mooli.min.css">

</head>
<body>
    
<div id="body" class="theme-green">

<?php require 'includes/page-loader.php'; ?>

<?php require 'includes/themesetting.php'; ?>

    <!-- Overlay For Sidebars -->
    <div class="overlay"></div>

    <div id="wrapper">

<?php require 'includes/topbar.php'; ?>
<?php require 'includes/leftbar.php'; ?> 
        <!-- Main body part  -->
        <div id="main-content">
            <div class="container-fluid">
                <!-- Page header section  -->
                <div class="block-header">
                    <div class="row clearfix">
                        <div class="col-lg-4 col-md-12 col-sm-12">
                            <h1><?php echo $row_korisnik['ime']; ?></h1>
                            <span>Profil</span>
                        </div>            
                        <div class="col-lg-8 col-md-12 col-sm-12 text-lg-right">
                            <div class="d-flex align-items-center justify-content-lg-end mt-4 mt-lg-0 flex-wrap vivify pullUp delay-550">
                                
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row clearfix">
                    <div class="col-md-12">
                        <div class="card social theme-bg gradient">
                            <div class="profile-header d-sm-flex justify-content-between justify-content-center">
                                <div class="d-flex">
                                    <div class="mr-3">
                                        <?php if ($row_korisnik['level'] == '1') { ?><img src="assets/images/user.png" class="rounded" alt="User Profile Picture"><?php } else if ($row_korisnik['level'] == '2') { ?><img src="assets/images/user2.png" class="rounded" alt="User Profile Picture"><?php } ?>
                                    </div>
                                    <div class="details">
                                        <h5 class="mb-0"><?php echo $row_korisnik['ime']; ?></h5>
                                        <span class="text-light"><?php if ($row_korisnik['level'] == '1') { ?>Webmaster<?php } else if ($row_korisnik['level'] == '2') { ?>Administrator<?php } ?></span>
                                    </div>                                
                                </div>
                                <div>
                                    
                                </div>
                            </div>
                        </div>                    
                    </div>
                    <div class="col-xl-12 col-lg-12 col-md-12">
                        <div class="card">
                            <div class="header">
                                <h2>Account Data</h2>
								<ul class="header-dropdown dropdown">                                
                                    <li><a href="javascript:void(0);" class="full-screen"><i class="fa fa-expand"></i></a></li>
                                    
                                </ul>
                            </div>
                            <div class="body">
                                <form action="user_edit.php" id="advanced-form" data-parsley-validate novalidate>
								<div class="row clearfix">
                                    <div class="col-lg-4 col-md-12">
                                        <div class="form-group c_form_group">
                                            <label>Email</label>
											<input type="email" name="email" class="form-control" value="<?php echo htmlentities($row_person['email'], ENT_COMPAT, 'utf-8'); ?>" required data-parsley-maxlength="255" placeholder="Email">
                                        </div>
                                    </div>
                                    <div class="col-lg-4 col-md-12">
                                        <div class="form-group c_form_group">
                                            <label>Ime</label>
											<input type="text" name="ime" class="form-control" value="<?php echo htmlentities($row_person['ime'], ENT_COMPAT, 'utf-8'); ?>" required data-parsley-maxlength="40" placeholder="Ime">
                                        </div>
                                    </div>                                
                                    <div class="col-lg-4 col-md-12">
                                        <div class="form-group c_form_group">
                                            <label>Lozinka</label>
                                            <input type="text" name="lozinka" value="<?php echo htmlentities($row_person['lozinka'], ENT_COMPAT, 'utf-8'); ?>" class="form-control" required data-parsley-maxlength="60" placeholder="Enter Password">
                                        </div>
                                    </div>
                                </div>
                                <button type="submit" class="btn btn-primary theme-bg gradient">Update</button>
								<input type="hidden" name="id" value="<?php echo $row_person['id']; ?>" />
								<input type="hidden" name="edit" value="1" />
								</form>
                            </div>
                        </div>                  
                    </div>                
                </div>
            </div>
        </div>

    </div>

</div>
<!-- Javascript -->
<script src="assets/bundles/libscripts.bundle.js"></script>    
<script src="assets/bundles/vendorscripts.bundle.js"></script>

<!-- Vedor js file and create bundle with grunt  --> 
<script src="assets/vendor/bootstrap-multiselect/bootstrap-multiselect.js"></script>
<script src="assets/vendor/parsleyjs/js/parsley.min.js"></script>


<!-- Project core js file minify with grunt --> 
<script src="assets/bundles/mainscripts.bundle.js"></script>
<script>
    $(function() {
        // validation needs name of the element
        $('#food').multiselect();

        // initialize after multiselect
        $('#advanced-form').parsley();
    });
</script>
</body>
</html>