-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheader.php
More file actions
292 lines (279 loc) · 16.9 KB
/
header.php
File metadata and controls
292 lines (279 loc) · 16.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php wp_head(); ?>
</head>
<body <?php body_class('bg-gray-50 dark:bg-gray-900'); ?>>
<?php wp_body_open(); ?>
<div id="dofs-app" class="min-h-screen flex flex-col">
<!-- Topbar -->
<header class="sticky top-0 z-40 flex-shrink-0 h-16 bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 shadow-sm">
<div class="flex items-center justify-between h-full px-4 lg:px-6">
<!-- Left section: Mobile menu button + Logo -->
<div class="flex items-center gap-4">
<!-- Mobile sidebar toggle -->
<button
type="button"
id="sidebar-toggle"
class="lg:hidden p-2 rounded-lg text-gray-500 hover:text-gray-700 hover:bg-gray-100 dark:text-gray-400 dark:hover:text-gray-200 dark:hover:bg-gray-700 transition-colors"
aria-label="<?php esc_attr_e('Toggle sidebar', 'dofs-theme'); ?>"
>
<?php echo dofs_icon('menu', 'w-6 h-6'); ?>
</button>
<!-- Logo/Brand -->
<a href="<?php echo esc_url(home_url('/')); ?>" class="flex items-center gap-3">
<?php if (has_custom_logo()): ?>
<?php the_custom_logo(); ?>
<?php else: ?>
<div class="w-9 h-9 rounded-xl bg-gradient-to-br from-primary-500 to-primary-700 flex items-center justify-center shadow-lg shadow-primary-500/25">
<span class="text-white font-bold text-lg">D</span>
</div>
<span class="hidden sm:block font-semibold text-lg text-gray-900 dark:text-white">
<?php bloginfo('name'); ?>
</span>
<?php endif; ?>
</a>
</div>
<!-- Center section: Search -->
<div class="hidden md:flex flex-1 max-w-xl mx-8">
<div class="relative w-full" id="search-container">
<div class="absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none">
<?php echo dofs_icon('search', 'w-5 h-5 text-gray-400'); ?>
</div>
<input
type="search"
id="topbar-search"
class="block w-full ps-10 pe-4 py-2.5 text-sm text-gray-900 dark:text-white bg-gray-100 dark:bg-gray-700 border-0 rounded-xl focus:ring-2 focus:ring-primary-500 dark:focus:ring-primary-400 placeholder-gray-500 dark:placeholder-gray-400 transition-shadow"
placeholder="<?php esc_attr_e('Search entries...', 'dofs-theme'); ?>"
autocomplete="off"
>
<!-- Search loading indicator -->
<div id="search-loading" class="hidden absolute inset-y-0 end-3 flex items-center">
<svg class="animate-spin w-5 h-5 text-primary-500" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"></path>
</svg>
</div>
<!-- Search results dropdown -->
<div
id="search-results"
class="hidden absolute top-full left-0 right-0 mt-2 rounded-xl bg-white dark:bg-gray-800 shadow-lg ring-1 ring-black ring-opacity-5 dark:ring-gray-700 z-50 overflow-hidden"
>
<div class="max-h-96 overflow-y-auto" id="search-results-list">
<!-- Results populated by JavaScript -->
</div>
</div>
</div>
</div>
<!-- Right section: Actions + User -->
<div class="flex items-center gap-2 sm:gap-3">
<!-- Mobile search button -->
<button
type="button"
id="mobile-search-toggle"
class="md:hidden p-2 rounded-lg text-gray-500 hover:text-gray-700 hover:bg-gray-100 dark:text-gray-400 dark:hover:text-gray-200 dark:hover:bg-gray-700 transition-colors"
aria-label="<?php esc_attr_e('Search', 'dofs-theme'); ?>"
>
<?php echo dofs_icon('search', 'w-5 h-5'); ?>
</button>
<!-- Theme toggle -->
<button
type="button"
id="theme-toggle"
class="p-2 rounded-lg text-gray-500 hover:text-gray-700 hover:bg-gray-100 dark:text-gray-400 dark:hover:text-gray-200 dark:hover:bg-gray-700 transition-colors"
aria-label="<?php esc_attr_e('Toggle theme', 'dofs-theme'); ?>"
>
<span class="dark:hidden"><?php echo dofs_icon('moon', 'w-5 h-5'); ?></span>
<span class="hidden dark:inline"><?php echo dofs_icon('sun', 'w-5 h-5'); ?></span>
</button>
<!-- App Launcher (Services) -->
<div class="relative" id="app-launcher-container">
<button
type="button"
id="app-launcher-toggle"
class="p-2 rounded-lg text-gray-500 hover:text-gray-700 hover:bg-gray-100 dark:text-gray-400 dark:hover:text-gray-200 dark:hover:bg-gray-700 transition-colors"
aria-label="<?php esc_attr_e('Services', 'dofs-theme'); ?>"
>
<?php echo dofs_icon('apps', 'w-5 h-5'); ?>
</button>
<!-- App Launcher dropdown -->
<div
id="app-launcher-dropdown"
class="hidden absolute end-0 mt-2 w-72 rounded-xl bg-white dark:bg-gray-800 shadow-lg ring-1 ring-black ring-opacity-5 dark:ring-gray-700 z-50"
>
<div class="px-4 py-3 border-b border-gray-100 dark:border-gray-700">
<h3 class="text-sm font-semibold text-gray-900 dark:text-white">
<?php esc_html_e('Services', 'dofs-theme'); ?>
</h3>
</div>
<div class="p-3 grid grid-cols-3 gap-2">
<?php
/**
* Get services from admin settings
* Configure via Dashboard > DOFS Dashboard > Services
*/
$services = dofs_get_configured_services();
foreach ($services as $service):
?>
<a
href="<?php echo esc_url($service['url']); ?>"
target="_blank"
rel="noopener noreferrer"
class="flex flex-col items-center gap-2 p-3 rounded-xl hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors group"
>
<?php if (!empty($service['image'])): ?>
<img
src="<?php echo esc_url($service['image']); ?>"
alt="<?php echo esc_attr($service['title']); ?>"
class="w-10 h-10 rounded-lg object-contain"
>
<?php else: ?>
<div class="w-10 h-10 rounded-lg bg-gradient-to-br from-primary-500 to-primary-700 flex items-center justify-center text-white">
<?php echo dofs_icon($service['icon'] ?? 'external-link', 'w-5 h-5'); ?>
</div>
<?php endif; ?>
<span class="text-xs text-center text-gray-600 dark:text-gray-400 group-hover:text-gray-900 dark:group-hover:text-white truncate w-full">
<?php echo esc_html($service['title']); ?>
</span>
</a>
<?php endforeach; ?>
</div>
<div class="px-4 py-3 border-t border-gray-100 dark:border-gray-700">
<a href="<?php echo esc_url(admin_url('admin.php?page=dofs-services')); ?>" class="block text-xs text-primary-600 dark:text-primary-400 text-center hover:underline">
<?php esc_html_e('Manage Services', 'dofs-theme'); ?>
</a>
</div>
</div>
</div>
<!-- Notifications -->
<div class="relative" id="notifications-container">
<button
type="button"
id="notifications-toggle"
class="relative p-2 rounded-lg text-gray-500 hover:text-gray-700 hover:bg-gray-100 dark:text-gray-400 dark:hover:text-gray-200 dark:hover:bg-gray-700 transition-colors"
aria-label="<?php esc_attr_e('Notifications', 'dofs-theme'); ?>"
>
<?php echo dofs_icon('bell', 'w-5 h-5'); ?>
<?php
/**
* Hook: dofs_notification_count
* Render notification badge count
*/
do_action('dofs_notification_count');
?>
</button>
<!-- Notifications dropdown -->
<div
id="notifications-dropdown"
class="hidden absolute end-0 mt-2 w-80 rounded-xl bg-white dark:bg-gray-800 shadow-lg ring-1 ring-black ring-opacity-5 dark:ring-gray-700 z-50"
>
<div class="px-4 py-3 border-b border-gray-100 dark:border-gray-700">
<h3 class="text-sm font-semibold text-gray-900 dark:text-white">
<?php esc_html_e('Notifications', 'dofs-theme'); ?>
</h3>
</div>
<div class="max-h-96 overflow-y-auto">
<?php
/**
* Hook: dofs_topbar_notifications
* Render notification items in dropdown
*/
do_action('dofs_topbar_notifications');
?>
</div>
</div>
</div>
<!-- User dropdown -->
<?php if (is_user_logged_in()):
$current_user = wp_get_current_user();
?>
<div class="relative" id="user-dropdown-container">
<button
type="button"
id="user-dropdown-toggle"
class="flex items-center gap-2 p-1.5 rounded-xl hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors"
>
<img
src="<?php echo esc_url(get_avatar_url($current_user->ID, ['size' => 80])); ?>"
alt="<?php echo esc_attr($current_user->display_name); ?>"
class="w-8 h-8 rounded-lg object-cover ring-2 ring-gray-200 dark:ring-gray-600"
>
<div class="hidden sm:block text-start">
<p class="text-sm font-medium text-gray-900 dark:text-white leading-tight">
<?php echo esc_html($current_user->display_name); ?>
</p>
<p class="text-xs text-gray-500 dark:text-gray-400 leading-tight">
<?php echo esc_html(ucfirst($current_user->roles[0] ?? 'User')); ?>
</p>
</div>
<?php echo dofs_icon('chevron-down', 'hidden sm:block w-4 h-4 text-gray-400'); ?>
</button>
<!-- Dropdown menu -->
<div
id="user-dropdown-menu"
class="hidden absolute end-0 mt-2 w-56 rounded-xl bg-white dark:bg-gray-800 shadow-lg ring-1 ring-black ring-opacity-5 dark:ring-gray-700 py-1 z-50"
>
<div class="px-4 py-3 border-b border-gray-100 dark:border-gray-700">
<p class="text-sm font-medium text-gray-900 dark:text-white">
<?php echo esc_html($current_user->display_name); ?>
</p>
<p class="text-xs text-gray-500 dark:text-gray-400 truncate">
<?php echo esc_html($current_user->user_email); ?>
</p>
</div>
<a href="<?php echo esc_url(home_url('/my-hr/')); ?>" class="flex items-center gap-3 px-4 py-2.5 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors">
<?php echo dofs_icon('user', 'w-4 h-4'); ?>
<?php esc_html_e('My Profile', 'dofs-theme'); ?>
</a>
<a href="<?php echo esc_url(home_url('/settings/')); ?>" class="flex items-center gap-3 px-4 py-2.5 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors">
<?php echo dofs_icon('settings', 'w-4 h-4'); ?>
<?php esc_html_e('Settings', 'dofs-theme'); ?>
</a>
<div class="border-t border-gray-100 dark:border-gray-700 my-1"></div>
<a href="<?php echo esc_url(wp_logout_url(home_url('/'))); ?>" class="flex items-center gap-3 px-4 py-2.5 text-sm text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors">
<?php echo dofs_icon('logout', 'w-4 h-4'); ?>
<?php esc_html_e('Sign Out', 'dofs-theme'); ?>
</a>
</div>
</div>
<?php endif; ?>
</div>
</div>
</header>
<!-- Mobile Search Overlay -->
<div id="mobile-search-overlay" class="hidden fixed inset-0 z-50 md:hidden">
<div class="absolute inset-0 bg-gray-900/50 backdrop-blur-sm" id="mobile-search-backdrop"></div>
<div class="relative bg-white dark:bg-gray-800 p-4 shadow-lg">
<div class="flex items-center gap-3">
<div class="relative flex-1">
<div class="absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none">
<?php echo dofs_icon('search', 'w-5 h-5 text-gray-400'); ?>
</div>
<input
type="search"
id="mobile-search-input"
class="block w-full ps-10 pe-4 py-3 text-base text-gray-900 dark:text-white bg-gray-100 dark:bg-gray-700 border-0 rounded-xl focus:ring-2 focus:ring-primary-500 dark:focus:ring-primary-400 placeholder-gray-500 dark:placeholder-gray-400"
placeholder="<?php esc_attr_e('Search entries...', 'dofs-theme'); ?>"
autocomplete="off"
>
</div>
<button
type="button"
id="mobile-search-close"
class="p-2 rounded-lg text-gray-500 hover:text-gray-700 hover:bg-gray-100 dark:text-gray-400 dark:hover:text-gray-200 dark:hover:bg-gray-700 transition-colors"
>
<?php echo dofs_icon('close', 'w-6 h-6'); ?>
</button>
</div>
<!-- Mobile search results -->
<div id="mobile-search-results" class="hidden mt-3 max-h-[60vh] overflow-y-auto rounded-xl bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700">
<div id="mobile-search-results-list">
<!-- Results populated by JavaScript -->
</div>
</div>
</div>
</div>
<!-- Main layout with sidebar -->
<div class="flex flex-1 overflow-hidden">