Repository navigation
Expand file tree
/
Copy pathindex.php
More file actions
279 lines (265 loc) · 21.5 KB
/
Copy pathindex.php
File metadata and controls
279 lines (265 loc) · 21.5 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
<?php
// Full Call List Page
use UWMadison\CallLog\CallLog;
/** @var CallLog $module */
$projectId = (int)($_GET['pid'] ?? 0);
if (empty($module->tabsConfig) && $projectId) {
$module->tabsConfig = $module->getConfigService()->getTabConfig($projectId);
}
$tabsConfig = $module->tabsConfig['config'] ?? [];
$cookieState = null;
if (!empty($_COOKIE["call_log_dashboard_{$projectId}"])) {
$rawCookie = $_COOKIE["call_log_dashboard_{$projectId}"];
$cookieState = json_decode(urldecode($rawCookie), true) ?: json_decode($rawCookie, true);
}
$savedTab = $cookieState['tab'] ?? '';
$validTabIds = array_column($tabsConfig, 'tab_id');
$activeTabId = (!empty($savedTab) && in_array($savedTab, $validTabIds, true))
? $savedTab
: ($tabsConfig[0]['tab_id'] ?? '');
?>
<div class="call-list-dashboard pr-3 py-3" style="max-width: 1750px;" x-data="callListDashboard">
<!-- Header Card -->
<div class="d-flex flex-wrap align-items-center justify-content-between pb-3 mb-4 border-bottom gap-3">
<div class="d-flex align-items-center gap-3">
<div class="bg-primary text-white rounded-3 shadow-sm d-flex align-items-center justify-content-center flex-shrink-0" style="width: 48px; height: 48px;">
<i class="fas fa-phone-alt text-white" style="font-size: 1.65rem;"></i>
</div>
<div>
<div class="d-flex align-items-center gap-2">
<h3 class="fw-bold mb-0" style="color: #0f172a;">Call List Dashboard</h3>
</div>
<span class="text-muted small">Participant contact management, callback requests, and active call logs</span>
</div>
</div>
</div>
<?php if (empty($tabsConfig)) { ?>
<!-- Setup Required Card -->
<div class="card my-4 mx-auto border-0 shadow-sm" style="max-width: 750px; border-radius: 12px; background-color: #ffffff; border: 1px solid #cbd5e1 !important;">
<div class="card-header py-3 px-4 bg-light border-bottom" style="border-radius: 12px 12px 0 0;">
<h5 class="mb-0 fw-bold d-flex align-items-center" style="color: #0f172a;">
<i class="fas fa-sliders-h me-2 text-primary"></i> No Dashboard Call Tabs Configured
</h5>
</div>
<div class="card-body p-4 text-center">
<div class="mb-3">
<span class="d-inline-flex align-items-center justify-content-center bg-primary-subtle text-primary rounded-circle p-3 mb-2" style="width: 64px; height: 64px;">
<i class="fas fa-list-ol fa-2x"></i>
</span>
</div>
<h5 class="fw-bold mb-2" style="color: #0f172a;">Setup Required for Call List</h5>
<p class="text-muted mb-4 mx-auto" style="max-width: 500px; font-size: 0.95rem; line-height: 1.6;">
The Call List dashboard requires at least one configured <strong>Call Tab</strong> to organize and display active participant calls.
</p>
<a href="<?= $module->getUrl('config.php'); ?>" class="btn btn-primary text-white px-4 py-2 fw-semibold shadow-sm" style="color: #ffffff !important;">
<i class="fas fa-cog me-1 text-white"></i> Configure Call Log Settings
</a>
</div>
</div>
<?php } else { ?>
<!-- Main Call List UI Container -->
<div class="call-list-card card border-0 shadow-sm" style="border-radius: 10px; background-color: #ffffff; border: 1px solid #cbd5e1 !important;">
<?php if (count($tabsConfig) > 1) { ?>
<!-- Segmented Tabs Navigation -->
<div class="card-header p-2 border-bottom" style="background-color: #f1f5f9; border-radius: 10px 10px 0 0;">
<ul class="nav nav-pills call-list-nav-pills gap-1" role="tablist">
<?php foreach ($tabsConfig as $index => $tab) { ?>
<li class="nav-item call-tab" role="presentation">
<button type="button" class="nav-link call-link fw-semibold px-3 py-2 me-1 <?= ($tab['tab_id'] === $activeTabId) ? 'active' : '' ?>"
:class="{ 'active': activeTab === '<?php echo htmlspecialchars($tab['tab_id']); ?>' }"
@click="selectTab('<?php echo htmlspecialchars($tab['tab_id']); ?>')">
<span><?php echo htmlspecialchars($tab['tab_name']); ?></span>
</button>
</li>
<?php } ?>
</ul>
</div>
<?php } ?>
<div class="tab-content">
<?php foreach ($tabsConfig as $tab_index => $tab) { ?>
<div id="<?php echo htmlspecialchars($tab["tab_id"]); ?>"
class="call-list-tab-pane tab-pane show active"
x-show="activeTab === '<?php echo htmlspecialchars($tab['tab_id']); ?>'"
style="<?= ($tab['tab_id'] === $activeTabId) ? '' : 'display: none;' ?>">
<!-- Toolbar Bar -->
<div class="card-header bg-white border-bottom py-3 px-4">
<div class="d-flex flex-wrap align-items-center justify-content-between gap-3">
<div>
<h4 class="fw-bold mb-0 text-dark d-flex align-items-center">
<?php echo htmlspecialchars($tab["tab_name"]); ?>
</h4>
<?php if (!empty($tab["description"])) { ?>
<span class="text-muted small"><?php echo htmlspecialchars($tab["description"]); ?></span>
<?php } ?>
</div>
<div class="d-flex align-items-center gap-2 flex-wrap" :class="{ 'opacity-50 pointer-events-none': !dataLoaded }">
<div class="custom-search-wrap position-relative" style="width: 220px;">
<i class="fas fa-search search-icon text-muted"></i>
<input type="search" class="form-control form-control-sm customSearch" placeholder="Search calls..." title="Search calls or filter by column using ColName:Value (e.g. Record ID:101)" :disabled="!dataLoaded || (!displayedData['<?php echo htmlspecialchars($tab['tab_id']); ?>'] || displayedData['<?php echo htmlspecialchars($tab['tab_id']); ?>'].length === 0)">
</div>
<div class="position-relative d-inline-block" x-data="{ openCallerFilter: false }" @click.outside="openCallerFilter = false">
<button type="button"
@click="openCallerFilter = !openCallerFilter"
class="btn btn-sm d-inline-flex align-items-center justify-content-center caller-filter-btn position-relative"
:class="{ 'active': openCallerFilter || selectedCallers.length > 0 }"
:disabled="!dataLoaded"
title="Filter by Caller / User">
<i class="fas fa-user-friends"></i>
<span class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-primary"
x-show="selectedCallers.length > 0"
x-text="selectedCallers.length"
style="font-size: 0.62rem; padding: 0.22em 0.45em; display: none;"></span>
</button>
<div x-show="openCallerFilter"
x-transition
class="dropdown-menu show shadow-sm p-2 position-absolute end-0 mt-1 caller-filter-menu"
style="min-width: 250px; max-width: 320px; z-index: 1050; display: block;"
@click.stop>
<div class="px-2 pt-1 pb-2">
<div class="text-uppercase fw-bold text-muted mb-1" style="font-size: 0.68rem; letter-spacing: 0.5px;">Attempt Filter Mode</div>
<div class="btn-group btn-group-sm w-100 caller-mode-toggle" role="group">
<button type="button"
class="btn btn-sm py-1 caller-mode-btn"
:class="callerFilterMode === 'attempted' ? 'btn-primary text-white active fw-medium' : 'btn-outline-secondary'"
@click="callerFilterMode = 'attempted'">
Attempted
</button>
<button type="button"
class="btn btn-sm py-1 caller-mode-btn"
:class="callerFilterMode === 'never' ? 'btn-primary text-white active fw-medium' : 'btn-outline-secondary'"
@click="callerFilterMode = 'never'">
Not Attempted
</button>
</div>
</div>
<hr class="my-1 border-secondary-subtle">
<div class="d-flex align-items-center justify-content-between px-2 py-1">
<span class="text-uppercase fw-bold text-muted" style="font-size: 0.68rem; letter-spacing: 0.5px;">Callers / Users</span>
<button type="button"
class="btn btn-link btn-xs p-0 text-decoration-none text-muted"
style="font-size: 0.72rem;"
x-show="selectedCallers.length > 0"
@click="selectedCallers = []">
Clear all
</button>
</div>
<div class="caller-checkbox-list" style="max-height: 200px; overflow-y: auto;">
<label class="dropdown-item d-flex align-items-center gap-2 py-1.5 px-2 rounded cursor-pointer mb-0">
<input class="form-check-input mt-0" type="checkbox" value="__CURRENT_USER__" x-model="selectedCallers">
<span class="small fw-semibold text-primary">★ Current User (Me)</span>
</label>
<template x-for="caller in availableCallers" :key="caller">
<label class="dropdown-item d-flex align-items-center gap-2 py-1.5 px-2 rounded cursor-pointer mb-0">
<input class="form-check-input mt-0" type="checkbox" :value="caller" x-model="selectedCallers">
<span class="small fw-medium text-dark" x-text="caller"></span>
</label>
</template>
<div x-show="availableCallers.length === 0" class="px-2 py-2 text-muted small text-center">
No caller history found
</div>
</div>
<div class="px-2 pt-1 border-top mt-1" x-show="selectedCallers.length > 0">
<span class="text-muted" style="font-size: 0.72rem;">
Showing calls <strong x-text="callerFilterMode === 'never' ? 'NOT attempted' : 'attempted'"></strong> by <span x-text="selectedCallers.length"></span> user(s)
</span>
</div>
</div>
</div>
<div class="position-relative d-inline-block" x-data="{ openFilter: false }" @click.outside="openFilter = false">
<button type="button"
@click="openFilter = !openFilter"
class="btn btn-sm d-inline-flex align-items-center justify-content-center call-visibility-btn"
:class="{ 'active': openFilter }"
:disabled="!dataLoaded"
title="Filter Call Visibility">
<i class="fas fa-eye"></i>
</button>
<div x-show="openFilter"
x-transition
class="dropdown-menu show shadow-sm p-2 position-absolute end-0 mt-1"
style="min-width: 200px; z-index: 1050; display: block;"
@click.stop>
<div class="dropdown-header px-2 py-1 text-uppercase fw-bold text-muted" style="font-size: 0.68rem; letter-spacing: 0.5px;">Show Calls</div>
<label class="dropdown-item d-flex align-items-center gap-2 py-1.5 px-2 rounded cursor-pointer mb-0">
<input class="form-check-input mt-0" type="checkbox" x-model="showTypes.active">
<span class="small fw-medium text-dark">Active</span>
</label>
<label class="dropdown-item d-flex align-items-center gap-2 py-1.5 px-2 rounded cursor-pointer mb-0">
<input class="form-check-input mt-0" type="checkbox" x-model="showTypes.hidden">
<span class="small fw-medium text-dark">Hidden</span>
</label>
<label class="dropdown-item d-flex align-items-center gap-2 py-1.5 px-2 rounded cursor-pointer mb-0">
<input class="form-check-input mt-0" type="checkbox" x-model="showTypes.expired">
<span class="small fw-medium text-dark">Expired</span>
</label>
<label class="dropdown-item d-flex align-items-center gap-2 py-1.5 px-2 rounded cursor-pointer mb-0">
<input class="form-check-input mt-0" type="checkbox" x-model="showTypes.completed">
<span class="small fw-medium text-dark">Completed</span>
</label>
</div>
</div>
</div>
</div>
</div>
<!-- Card Body Container -->
<div class="card-body p-0">
<!-- Loading State Placeholder -->
<div x-show="!dataLoaded" class="call-list-loading-placeholder py-5 text-center">
<div class="placeholder-icon-circle bg-primary-subtle text-primary border-0">
<i class="fas fa-circle-notch fa-spin fa-2x"></i>
</div>
<h5 class="fw-bold text-dark mb-1">Loading Calls...</h5>
<p class="text-muted small mb-0 mx-auto" style="max-width: 440px;">
Retrieving active participant call records and schedule windows...
</p>
</div>
<!-- Empty Tab Placeholder (when no calls at all exist for this tab) -->
<div x-show="dataLoaded && (!displayedData['<?php echo htmlspecialchars($tab['tab_id']); ?>'] || displayedData['<?php echo htmlspecialchars($tab['tab_id']); ?>'].length === 0)" class="call-list-empty-placeholder py-5 text-center" style="display: none;">
<div class="placeholder-icon-circle bg-light text-success">
<i class="fas fa-clipboard-check fa-2x"></i>
</div>
<h5 class="fw-bold text-dark mb-1">No Calls on this Tab</h5>
<p class="text-muted small mb-3 mx-auto" style="max-width: 460px; line-height: 1.6;">
There are currently no active calls queued for <strong><?php echo htmlspecialchars($tab["tab_name"]); ?></strong>. Any newly generated calls or scheduled appointments will appear here automatically.
</p>
<div>
<button type="button" @click="refreshTableData(true)" class="btn btn-sm px-3 shadow-xs empty-refresh-btn" :disabled="isRefreshing">
<i class="fas fa-sync-alt me-1" :class="{ 'fa-spin': isRefreshing }"></i> Refresh
</button>
</div>
</div>
<!-- Data Table Container -->
<div x-show="dataLoaded && (displayedData['<?php echo htmlspecialchars($tab['tab_id']); ?>'] && displayedData['<?php echo htmlspecialchars($tab['tab_id']); ?>'].length > 0)" class="table-responsive" style="display: none;">
<!-- Columns Unlocked Notification Banner -->
<div x-show="isTabUnlocked('<?php echo htmlspecialchars($tab['tab_id']); ?>')" x-cloak class="columns-unlocked-banner py-1 px-3 border-bottom" style="display: none;">
<div class="d-flex align-items-center gap-2">
<i class="fas fa-arrows-alt text-warning"></i>
<span><strong>Column reordering active:</strong> Drag column headers to reposition them. Right-click any header for more options.</span>
</div>
<button type="button" class="btn btn-sm btn-outline-secondary py-0 px-2" @click="toggleLockColumns('<?php echo htmlspecialchars($tab['tab_id']); ?>')">
<i class="fas fa-lock me-1"></i> Lock Columns
</button>
</div>
<table class="table table-hover align-middle mb-0 callTable" style="width:100%">
</table>
</div>
</div>
</div>
<?php } ?>
</div>
<!-- Call List Footer: Most Recent Data Pull Time -->
<div class="card-footer py-2 px-3 d-flex flex-wrap align-items-center justify-content-between text-muted small call-list-footer" style="background-color: #f8fafc; border-top: 1px solid #e2e8f0; border-radius: 0 0 10px 10px;">
<div class="d-flex align-items-center gap-2">
<i class="far fa-clock text-secondary last-pull-icon"></i>
<span>Most recent data pull: <strong class="text-dark last-pull-time" x-text="lastDataPullText || 'Loading...'"></strong></span>
</div>
<div class="d-flex align-items-center gap-2">
<button type="button" @click="refreshTableData(true)" class="btn btn-sm btn-link text-decoration-none text-secondary p-0 d-inline-flex align-items-center gap-1" :disabled="isRefreshing" title="Refresh call data now">
<i class="fas fa-sync-alt" :class="{ 'fa-spin': isRefreshing }"></i>
<span x-text="isRefreshing ? 'Refreshing...' : 'Refresh'"></span>
</button>
</div>
</div>
</div>
<?php } ?>
</div>