Delete comment
This commit is contained in:
@@ -1,18 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* Единый header для всех страниц AETERNA
|
||||
* Подключение: require_once 'includes/header.php';
|
||||
*/
|
||||
|
||||
// Запускаем сессию если еще не запущена
|
||||
if (session_status() === PHP_SESSION_NONE) {
|
||||
session_start();
|
||||
}
|
||||
|
||||
// Определяем текущую страницу
|
||||
$currentPage = basename($_SERVER['PHP_SELF'], '.php');
|
||||
|
||||
// Проверяем авторизацию
|
||||
$isLoggedIn = isset($_SESSION['isLoggedIn']) && $_SESSION['isLoggedIn'] === true;
|
||||
$isAdmin = isset($_SESSION['isAdmin']) && $_SESSION['isAdmin'] === true;
|
||||
$userEmail = $_SESSION['user_email'] ?? '';
|
||||
@@ -29,7 +22,7 @@ $fullName = $_SESSION['full_name'] ?? $userEmail;
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
|
||||
<style>
|
||||
/* Стили для профиля пользователя */
|
||||
|
||||
.user-profile-dropdown { position: relative; display: inline-block; }
|
||||
.user-profile-toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 8px 12px; border-radius: 4px; transition: all 0.3s ease; }
|
||||
.user-profile-toggle:hover { background-color: rgba(0, 0, 0, 0.05); }
|
||||
@@ -88,13 +81,12 @@ $fullName = $_SESSION['full_name'] ?? $userEmail;
|
||||
|
||||
<div class="header__icons--top">
|
||||
<?php if ($isLoggedIn): ?>
|
||||
<!-- Иконка корзины -->
|
||||
|
||||
<a href="checkout.php" class="icon cart-icon">
|
||||
<i class="fas fa-shopping-cart"></i>
|
||||
<span class="cart-count" id="cartCount">0</span>
|
||||
</a>
|
||||
|
||||
<!-- Блок профиля -->
|
||||
<div class="user-profile-dropdown">
|
||||
<div class="user-profile-toggle" id="profileToggle">
|
||||
<div class="user-avatar"><?= !empty($userEmail) ? strtoupper(substr($userEmail, 0, 1)) : 'U' ?></div>
|
||||
@@ -151,19 +143,18 @@ $fullName = $_SESSION['full_name'] ?? $userEmail;
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// Профиль пользователя - открытие/закрытие
|
||||
|
||||
$('#profileToggle').click(function(e) {
|
||||
e.stopPropagation();
|
||||
$('#profileMenu').toggle();
|
||||
});
|
||||
|
||||
|
||||
$(document).click(function(e) {
|
||||
if (!$(e.target).closest('.user-profile-dropdown').length) {
|
||||
$('#profileMenu').hide();
|
||||
}
|
||||
});
|
||||
|
||||
// Обновление счетчика корзины
|
||||
<?php if ($isLoggedIn): ?>
|
||||
$.ajax({
|
||||
url: 'api/cart.php?action=count',
|
||||
@@ -180,4 +171,3 @@ $(document).ready(function() {
|
||||
<?php endif; ?>
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user