<?php
include_once '../../sys/fnc.php';

if (!isset($user)) {
    header('location: /');
    exit;
}
$title = 'Кабинет';
include_once '../../sys/head.php';

$hist_money = mysql_num_rows(mysql_query("SELECT * FROM `history_money` WHERE `user` = '$user->id'"));
$products_kol = mysql_num_rows(mysql_query("SELECT * FROM `my_orders` WHERE `id_user` = '$user->id'"));
// $s_notice = mysql_num_rows(mysql_query("SELECT * FROM `system_notice` WHERE `id_user` = '$user->id'"));
// $new_notice = mysql_num_rows(mysql_query("SELECT * FROM `system_notice` WHERE `id_user` = '$user->id' AND `chit` = '1'"));
$ref_kol = mysql_num_rows(mysql_query("SELECT * FROM `userref` WHERE `user_id` = '$user->id'"));
$ref_suma = mysql_result(mysql_query("SELECT sum(profit_suma) FROM `userref` WHERE `user_id` = '$user->id'"), 0);
$logs_user = mysql_result(mysql_query("SELECT COUNT(*) FROM `logs_user` WHERE `id_user` = '$user->id'"),0);

echo '<div class="card widget-profile">
                        <div class="card__header card__header--highlight text-center">
                            <img src="'.$user->imguser.'" class="widget-profile__img" alt="">
                            <h2>'.$user->login.'</h2>

                           
                           
                        </div>

                        <div class="list-group list-group--striped">
                            <div class="list-group-item media">
                                <div class="pull-left">
                                    <div class="avatar-char"><i class="zmdi zmdi-account"></i></div>
                                </div>
                                <div class="media-body">
                                    <div class="list-group__heading">'.$user->name.'</div>
                                    <small class="list-group__text">Имя</small>
                                </div>
                            </div>
                            <div class="list-group-item media">
                                <div class="pull-left">
                                    <div class="avatar-char"><i class="zmdi zmdi-email"></i></div>
                                </div>
                                <div class="media-body">
                                    <div class="list-group__heading">'.$user->email.'</div>
                                    <small class="list-group__text">E-Mail</small>
                                </div>
                            </div>
                            <div class="list-group-item media">
                                <div class="pull-left">
                                    <div class="avatar-char"><i class="zmdi zmdi-vk"></i></div>
                                </div>
                                <div class="media-body">
                                    <div class="list-group__heading">'.$user->vkid.'</div>
                                    <small class="list-group__text">Профиль ВК</small>
                                </div>
                            </div>

                               

                        </div>
                    </div>';
echo '<div class="card">
                        <div class="card__header">
                            <h2>Профиль<small>Настройки профиля,и все что связано с ним!</small></h2>
                            
                        </div>

                        <div class="list-group">
                            <a href="/user'.$user->id.'" class="list-group-item media">
                                <div class="pull-left">
                                    <img class="avatar-img" src="/demo/img/profile-pics/2.jpg" alt="">
                                </div>

                                <div class="media-body">
                                    <div class="list-group__heading">Посмотреть свой профиль</div>
                                    <small class="list-group__text">Посмотреть как видят его другие</small>
                                </div>
                            </a>

                            <a href="/cabinet/password" class="list-group-item media">
                                <div class="pull-left">
                                    <img class="avatar-img" src="/demo/img/profile-pics/2.jpg" alt="">
                                </div>
                                <div class="media-body">
                                    <div class="list-group__heading">Смена пароля</div>
                                    <small class="list-group__text">Рекомендуем менять раз в месяц!</small>
                                </div>
                            </a>

                            <a href="/cabinet/logs" class="list-group-item media">
                                <div class="pull-left">
                                    <img class="avatar-img" src="/demo/img/profile-pics/2.jpg" alt="">
                                </div>
                                <div class="media-body">
                                    <div class="list-group__heading">Логи</div>
                                    <small class="list-group__text">Здесь информация о ваших входах!</small>
                                </div>
                            </a>

                            <a href="/cabinet/usl" class="list-group-item media">
                                <div class="pull-left">
                                    <img class="avatar-img" src="/demo/img/profile-pics/2.jpg" alt="">
                                </div>
                                <div class="media-body">
                                    <div class="list-group__heading">Заказы </div>
                                    <small class="list-group__text">Все ваши заказаные услуги!</small>
                                </div>
                            </a>

                            <a href="/cabinet/profile" class="list-group-item media">
                                <div class="pull-left">
                                    <img class="avatar-img" src="/demo/img/profile-pics/2.jpg" alt="">
                                </div>
                                <div class="media-body">
                                    <div class="list-group__heading">Изменение данных</div>
                                    <small class="list-group__text">Изменение данных о себе</small>
                                </div>
                            </a>

                        </div>
                    </div>';
echo '<div class="card">
                        <div class="card__header">
                            <h2>Биллинг<small>Биллинг,и все что связано с ним!</small></h2>
                            
                        </div>

                        <div class="list-group">
                            <a href="/balance" class="list-group-item media">
                                <div class="pull-left">
                                    <img class="avatar-img" src="demo/img/profile-pics/4.jpg" alt="">
                                </div>

                                <div class="media-body">
                                    <div class="list-group__heading">Пополнение баланса</div>
                                    <small class="list-group__text">Пополнить счета на хостинге</small>
                                </div>
                            </a>

                            <a href="#" class="list-group-item media">
                                <div class="pull-left">
                                     <img class="avatar-img" src="demo/img/profile-pics/4.jpg" alt="">
                                </div>
                                <div class="media-body">
                                    <div class="list-group__heading">'.sprintf("%.02f", $user->wmr).' Руб</div>
                                    <small class="list-group__text">Текущий баланс</small>
                                </div>
                            </a>

                            <a href="/balance/logs" class="list-group-item media">
                                <div class="pull-left">
                                      <img class="avatar-img" src="demo/img/profile-pics/4.jpg" alt="">
                                </div>
                                <div class="media-body">
                                    <div class="list-group__heading">Логи</div>
                                    <small class="list-group__text">Здесь информация о ваших расходах и доходах!</small>
                                </div>
                            </a>

                            <a href="/referal" class="list-group-item media">
                                <div class="pull-left">
                                    <img class="avatar-img" src="demo/img/profile-pics/4.jpg" alt="">
                                </div>
                                <div class="media-body">
                                    <div class="list-group__heading">Рефералы ['.$ref_kol.' |'.sprintf("%.02f", $ref_suma).' Руб.]</div>
                                    <small class="list-group__text">Заработай средства!!!</small>
                                </div>
                            </a>

                            <a href="#" class="list-group-item media">
                                <div class="pull-left">
                                    <img class="avatar-img" src="demo/img/profile-pics/1.jpg" alt="">
                                </div>
                                <div class="media-body">
                                    <div class="list-group__heading">В разработке!</div>
                                    <small class="list-group__text">Здесь будет новая функция!</small>
                                </div>
                            </a>

                        </div>
                    </div>';

echo '<div class="card">
                        <div class="card__header">
                            <h2>Дополнительно<small>Разные функции</small></h2>
                            
                        </div>

                        <div class="list-group">
                            <a href="/tickets" class="list-group-item media">
                                <div class="pull-left">
                                    <img class="avatar-img" src="demo/img/profile-pics/3.jpg" alt="">
                                </div>

                                <div class="media-body">
                                    <div class="list-group__heading">Тикеты</div>
                                    <small class="list-group__text">';

$output_t=mysql_query("SELECT `id`, `name` FROM `tickets` WHERE `user_read` = '0' AND `user` = '$user->id' AND `closed` = '0'");
if (mysql_num_rows($output_t) > 0){
while ($out_t = mysql_fetch_assoc($output_t)){
echo 'Вам ответили в тикете: <font color=\"red\">'.html($out_t['name']).'</font>';
}
}
echo '</small>
                                </div>
                            </a>

                            <a href="#" class="list-group-item media">
                                <div class="pull-left">
                                    <img class="avatar-img" src="demo/img/profile-pics/1.jpg" alt="">
                                </div>
                                <div class="media-body">
                                    <div class="list-group__heading">В разработке!</div>
                                    <small class="list-group__text">Здесь будет новая функция!</small>
                                </div>
                            </a>
							
							                            <a href="#" class="list-group-item media">
                                <div class="pull-left">
                                    <img class="avatar-img" src="demo/img/profile-pics/1.jpg" alt="">
                                </div>
                                <div class="media-body">
                                    <div class="list-group__heading">В разработке!</div>
                                    <small class="list-group__text">Здесь будет новая функция!</small>
                                </div>
                            </a>
							
							                            <a href="#" class="list-group-item media">
                                <div class="pull-left">
                                    <img class="avatar-img" src="demo/img/profile-pics/1.jpg" alt="">
                                </div>
                                <div class="media-body">
                                    <div class="list-group__heading">В разработке!</div>
                                    <small class="list-group__text">Здесь будет новая функция!</small>
                                </div>
                            </a>
							
							                            <a href="#" class="list-group-item media">
                                <div class="pull-left">
                                    <img class="avatar-img" src="demo/img/profile-pics/1.jpg" alt="">
                                </div>
                                <div class="media-body">
                                    <div class="list-group__heading">В разработке!</div>
                                    <small class="list-group__text">Здесь будет новая функция!</small>
                                </div>
                            </a>

                        </div>
                    </div>';
include_once '../../sys/foot.php';
?>