| Line 97... |
Line 97... |
| 97 |
font-size: 12px;
|
97 |
font-size: 12px;
|
| 98 |
}
|
98 |
}
|
| 99 |
</style>
|
99 |
</style>
|
| 100 |
|
100 |
|
| 101 |
<div class="container-fluid">
|
101 |
<div class="container-fluid">
|
| - |
|
102 |
<div class="d-flex align-items-center mb-2">
|
| 102 |
<h3>RBM Call Target Summary</h3>
|
103 |
<h3 class="mb-0 mr-3">RBM Call Target Summary</h3>
|
| - |
|
104 |
<div class="d-flex align-items-center">
|
| - |
|
105 |
<label for="filterDate" class="mb-0 mr-2" style="font-size: 14px; white-space: nowrap;">Date:</label>
|
| - |
|
106 |
<input type="date" id="filterDate" class="form-control form-control-sm mr-2" style="width: 150px;"
|
| - |
|
107 |
value="$queryDate">
|
| - |
|
108 |
<button type="button" class="btn btn-primary btn-sm" onclick="filterByDate()">Go</button>
|
| - |
|
109 |
</div>
|
| - |
|
110 |
</div>
|
| 103 |
<div class="row">
|
111 |
<div class="row">
|
| 104 |
<div class="col-md-7">
|
112 |
<div class="col-md-7">
|
| 105 |
<!-- Date-wise Called Partner Filter -->
|
113 |
<!-- Date-wise Called Partner Filter -->
|
| 106 |
<div class="card mb-3" style="max-width: 500px;">
|
114 |
<div class="card mb-3" style="max-width: 500px;">
|
| 107 |
<div class="card-body py-2">
|
115 |
<div class="card-body py-2">
|
| Line 292... |
Line 300... |
| 292 |
#else
|
300 |
#else
|
| 293 |
-
|
301 |
-
|
| 294 |
#end
|
302 |
#end
|
| 295 |
</td>
|
303 |
</td>
|
| 296 |
<td class="agent-status-cell" data-authid="$model.getAuthId()">
|
304 |
<td class="agent-status-cell" data-authid="$model.getAuthId()">
|
| - |
|
305 |
#if($isToday)
|
| 297 |
#if($agentStatus && $agentStatus.getAgentStatus())
|
306 |
#if($agentStatus && $agentStatus.getAgentStatus())
|
| 298 |
#if($agentStatus.getAgentStatus() == "On Call")
|
307 |
#if($agentStatus.getAgentStatus() == "On Call")
|
| - |
|
308 |
<span class="badge"
|
| 299 |
<span class="badge" style="background-color: #28a745; color: white;">$agentStatus.getAgentStatus()</span>
|
309 |
style="background-color: #28a745; color: white;">$agentStatus.getAgentStatus()</span>
|
| 300 |
#elseif($agentStatus.getAgentStatus() == "Available")
|
310 |
#elseif($agentStatus.getAgentStatus() == "Available")
|
| 301 |
<span class="badge"
|
311 |
<span class="badge"
|
| 302 |
style="background-color: #dc3545; color: white;">$agentStatus.getAgentStatus()</span>
|
312 |
style="background-color: #dc3545; color: white;">$agentStatus.getAgentStatus()</span>
|
| 303 |
#elseif($agentStatus.getAgentStatus().toLowerCase().contains("break"))
|
313 |
#elseif($agentStatus.getAgentStatus().toLowerCase().contains("break"))
|
| 304 |
<span class="badge"
|
314 |
<span class="badge"
|
| 305 |
style="background-color: #fd7e14; color: white;">$agentStatus.getAgentStatus()</span>
|
315 |
style="background-color: #fd7e14; color: white;">$agentStatus.getAgentStatus()</span>
|
| 306 |
#elseif($agentStatus.getAgentStatus() == "Logged Out")
|
316 |
#elseif($agentStatus.getAgentStatus() == "Logged Out")
|
| 307 |
<span class="badge"
|
317 |
<span class="badge"
|
| 308 |
style="background-color: #6c757d; color: white;">$agentStatus.getAgentStatus()</span>
|
318 |
style="background-color: #6c757d; color: white;">$agentStatus.getAgentStatus()</span>
|
| 309 |
#elseif($agentStatus.getAgentStatus() == "Trying")
|
319 |
#elseif($agentStatus.getAgentStatus() == "Trying")
|
| 310 |
<span class="badge"
|
320 |
<span class="badge"
|
| 311 |
style="background-color: #ffc107; color: black;">$agentStatus.getAgentStatus()</span>
|
321 |
style="background-color: #ffc107; color: black;">$agentStatus.getAgentStatus()</span>
|
| - |
|
322 |
#else
|
| - |
|
323 |
<span class="badge"
|
| - |
|
324 |
style="background-color: #6c757d; color: white;">$agentStatus.getAgentStatus()</span>
|
| - |
|
325 |
#end
|
| 312 |
#else
|
326 |
#else
|
| 313 |
<span class="badge" style="background-color: #6c757d; color: white;">$agentStatus.getAgentStatus()</span>
|
327 |
<span class="badge" style="background-color: #6c757d; color: white;">-</span>
|
| 314 |
#end
|
328 |
#end
|
| 315 |
#else
|
329 |
#else
|
| 316 |
<span class="badge" style="background-color: #6c757d; color: white;">-</span>
|
330 |
<span class="badge" style="background-color: #6c757d; color: white;">-</span>
|
| 317 |
#end
|
331 |
#end
|
| 318 |
</td>
|
332 |
</td>
|
| 319 |
<td class="time-in-status-cell" data-authid="$model.getAuthId()">
|
333 |
<td class="time-in-status-cell" data-authid="$model.getAuthId()">
|
| - |
|
334 |
#if($isToday)
|
| 320 |
#if($agentStatus && $agentStatus.getTimeInStatus())
|
335 |
#if($agentStatus && $agentStatus.getTimeInStatus())
|
| 321 |
$agentStatus.getTimeInStatus()
|
336 |
$agentStatus.getTimeInStatus()
|
| - |
|
337 |
#else
|
| - |
|
338 |
-
|
| - |
|
339 |
#end
|
| 322 |
#else
|
340 |
#else
|
| 323 |
-
|
341 |
-
|
| 324 |
#end
|
342 |
#end
|
| 325 |
</td>
|
343 |
</td>
|
| 326 |
<td style="background-color: #e7f1ff;">
|
344 |
<td style="background-color: #e7f1ff;">
|
| Line 409... |
Line 427... |
| 409 |
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
427 |
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
| 410 |
<span aria-hidden="true">×</span>
|
428 |
<span aria-hidden="true">×</span>
|
| 411 |
</button>
|
429 |
</button>
|
| 412 |
</div>
|
430 |
</div>
|
| 413 |
<div class="modal-body">
|
431 |
<div class="modal-body">
|
| 414 |
<!-- Tabs Navigation -->
|
- |
|
| 415 |
<ul class="nav nav-tabs" id="calledModalTabs" role="tablist">
|
- |
|
| 416 |
<li class="nav-item">
|
- |
|
| 417 |
<a class="nav-link active" id="called-tab" data-toggle="tab" href="#calledTabContent"
|
- |
|
| 418 |
role="tab">
|
- |
|
| 419 |
Called Partners
|
- |
|
| 420 |
</a>
|
- |
|
| 421 |
</li>
|
- |
|
| 422 |
<li class="nav-item">
|
- |
|
| 423 |
<a class="nav-link" id="break-time-tab" data-toggle="tab" href="#breakTimeTabContent"
|
- |
|
| 424 |
role="tab">
|
- |
|
| 425 |
Break Time
|
- |
|
| 426 |
</a>
|
- |
|
| 427 |
</li>
|
- |
|
| 428 |
</ul>
|
- |
|
| 429 |
<!-- Tabs Content -->
|
- |
|
| 430 |
<div class="tab-content mt-3" id="calledModalTabContent">
|
- |
|
| 431 |
<div class="tab-pane fade show active" id="calledTabContent" role="tabpanel">
|
- |
|
| 432 |
<div id="calledDetailsContent">
|
432 |
<div id="calledDetailsContent">
|
| 433 |
<p>Loading...</p>
|
433 |
<p>Loading...</p>
|
| 434 |
</div>
|
- |
|
| 435 |
</div>
|
- |
|
| 436 |
<div class="tab-pane fade" id="breakTimeTabContent" role="tabpanel">
|
- |
|
| 437 |
<div id="breakTimeDetailsContent">
|
- |
|
| 438 |
<p>Click on Break Time tab to load data.</p>
|
- |
|
| 439 |
</div>
|
- |
|
| 440 |
</div>
|
- |
|
| 441 |
</div>
|
434 |
</div>
|
| 442 |
</div>
|
435 |
</div>
|
| 443 |
<div class="modal-footer">
|
436 |
<div class="modal-footer">
|
| 444 |
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
437 |
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
| 445 |
</div>
|
438 |
</div>
|
| Line 469... |
Line 462... |
| 469 |
</div>
|
462 |
</div>
|
| 470 |
</div>
|
463 |
</div>
|
| 471 |
</div>
|
464 |
</div>
|
| 472 |
|
465 |
|
| 473 |
<script type="text/javascript">
|
466 |
<script type="text/javascript">
|
| - |
|
467 |
// Store globally so it persists across AJAX reloads
|
| - |
|
468 |
window.pageQueryDate = '$queryDate';
|
| - |
|
469 |
var pageQueryDate = window.pageQueryDate;
|
| - |
|
470 |
|
| - |
|
471 |
function filterByDate() {
|
| - |
|
472 |
var date = document.getElementById('filterDate').value;
|
| - |
|
473 |
if (date) {
|
| - |
|
474 |
var container = document.getElementById('rbm-call-target-container');
|
| - |
|
475 |
if (container) {
|
| - |
|
476 |
// Update global date BEFORE AJAX so click handlers use new date
|
| - |
|
477 |
window.pageQueryDate = date;
|
| - |
|
478 |
// AJAX reload only calling target fragment
|
| - |
|
479 |
container.innerHTML = '<div class="text-center p-5"><i class="fa fa-spinner fa-spin fa-2x"></i><br/>Loading...</div>';
|
| - |
|
480 |
fetch('/indent/rbm_call_target?date=' + date)
|
| - |
|
481 |
.then(function (response) {
|
| - |
|
482 |
return response.text();
|
| - |
|
483 |
})
|
| - |
|
484 |
.then(function (html) {
|
| - |
|
485 |
container.innerHTML = html;
|
| - |
|
486 |
// Re-run lakh formatting
|
| - |
|
487 |
var elems = container.querySelectorAll('.lakh');
|
| - |
|
488 |
for (var i = 0; i < elems.length; i++) {
|
| - |
|
489 |
var val = parseInt(elems[i].textContent.trim());
|
| - |
|
490 |
if (!isNaN(val)) {
|
| - |
|
491 |
elems[i].textContent = (val / 100000).toFixed(1) + 'L';
|
| - |
|
492 |
}
|
| - |
|
493 |
}
|
| - |
|
494 |
})
|
| - |
|
495 |
.catch(function () {
|
| - |
|
496 |
container.innerHTML = '<p class="text-danger">Error loading data. Please try again.</p>';
|
| - |
|
497 |
});
|
| - |
|
498 |
} else {
|
| - |
|
499 |
// Standalone page — full reload
|
| - |
|
500 |
window.location.href = '/indent/rbm_call_target?date=' + date;
|
| - |
|
501 |
}
|
| - |
|
502 |
}
|
| - |
|
503 |
}
|
| - |
|
504 |
|
| 474 |
// Store current authId and agentName for break time loading
|
505 |
// Store current authId and agentName for break time loading
|
| 475 |
var currentModalAuthId = null;
|
506 |
var currentModalAuthId = null;
|
| 476 |
var currentModalDate = null;
|
507 |
var currentModalDate = null;
|
| 477 |
var currentModalAgentName = null;
|
508 |
var currentModalAgentName = null;
|
| 478 |
|
509 |
|
| Line 511... |
Line 542... |
| 511 |
document.getElementById('oosDetailsContent').innerHTML = '<p>Error loading details. Please try again.</p>';
|
542 |
document.getElementById('oosDetailsContent').innerHTML = '<p>Error loading details. Please try again.</p>';
|
| 512 |
});
|
543 |
});
|
| 513 |
}
|
544 |
}
|
| 514 |
|
545 |
|
| 515 |
function showCalledPartnerDetails(authId, rbmName) {
|
546 |
function showCalledPartnerDetails(authId, rbmName) {
|
| - |
|
547 |
// Always use current global date (updated after AJAX reload)
|
| - |
|
548 |
var currentDate = window.pageQueryDate;
|
| 516 |
// Store authId and agentName for break time tab
|
549 |
// Store authId and agentName for break time tab
|
| 517 |
currentModalAuthId = authId;
|
550 |
currentModalAuthId = authId;
|
| 518 |
currentModalDate = null;
|
551 |
currentModalDate = currentDate;
|
| 519 |
currentModalAgentName = rbmName;
|
552 |
currentModalAgentName = rbmName;
|
| 520 |
|
553 |
|
| 521 |
document.getElementById('calledModalLabel').textContent = 'Activity - ' + rbmName;
|
554 |
document.getElementById('calledModalLabel').textContent = 'Called Partners - ' + rbmName + ' (' + currentDate + ')';
|
| 522 |
document.getElementById('calledDetailsContent').innerHTML = '<p>Loading...</p>';
|
555 |
document.getElementById('calledDetailsContent').innerHTML = '<p>Loading...</p>';
|
| 523 |
document.getElementById('breakTimeDetailsContent').innerHTML = '<p>Click to load break time data.</p>';
|
- |
|
| 524 |
|
- |
|
| 525 |
// Reset to Called tab
|
- |
|
| 526 |
$('#called-tab').tab('show');
|
- |
|
| 527 |
|
556 |
|
| 528 |
$('#calledModal').modal('show');
|
557 |
$('#calledModal').modal('show');
|
| 529 |
|
558 |
|
| - |
|
559 |
var dateParam = currentDate ? '&date=' + currentDate : '';
|
| 530 |
fetch('/indent/rbm_call_target/called_details?authId=' + authId + '&agentName=' + encodeURIComponent(rbmName))
|
560 |
fetch('/indent/rbm_call_target/called_details?authId=' + authId + '&agentName=' + encodeURIComponent(rbmName) + dateParam)
|
| 531 |
.then(function (response) {
|
561 |
.then(function (response) {
|
| 532 |
return response.json();
|
562 |
return response.json();
|
| 533 |
})
|
563 |
})
|
| 534 |
.then(function (data) {
|
564 |
.then(function (data) {
|
| - |
|
565 |
// Filter out break log entries — only show actual calls
|
| - |
|
566 |
var calls = (data || []).filter(function (d) {
|
| - |
|
567 |
return !d.breakLog;
|
| - |
|
568 |
});
|
| 535 |
if (data && data.length > 0) {
|
569 |
if (calls.length > 0) {
|
| 536 |
var html = '<table class="table table-bordered table-sm"><thead><tr><th>S.No</th><th style="width: 200px;">Party Name</th><th>Code</th><th style="width: 350px;">Remark</th><th>Call Status</th><th>Call Duration</th><th>Call Date/Time</th><th>Recording</th></tr></thead><tbody>';
|
570 |
var html = '<table class="table table-bordered table-sm"><thead><tr><th>S.No</th><th style="width: 200px;">Party Name</th><th>Code</th><th style="width: 350px;">Remark</th><th>Call Status</th><th>Call Duration</th><th>Call Date/Time</th><th>Recording</th></tr></thead><tbody>';
|
| 537 |
for (var i = 0; i < data.length; i++) {
|
571 |
for (var i = 0; i < calls.length; i++) {
|
| 538 |
var rowStyle = '';
|
- |
|
| 539 |
var recordingHtml = '-';
|
572 |
var recordingHtml = '-';
|
| 540 |
|
- |
|
| 541 |
// Check if this is a break log entry
|
- |
|
| 542 |
if (data[i].breakLog) {
|
- |
|
| 543 |
var status = (data[i].breakStatus || '').toLowerCase();
|
- |
|
| 544 |
if (status.indexOf('available') >= 0) {
|
- |
|
| 545 |
rowStyle = 'style="background-color: #f8d7da; color: #721c24;"'; // Light red
|
- |
|
| 546 |
} else if (status.indexOf('trying') >= 0) {
|
- |
|
| 547 |
rowStyle = 'style="background-color: #fff3cd; color: #856404;"'; // Light yellow
|
- |
|
| 548 |
} else if (status.indexOf('logged out') >= 0 || status.indexOf('logout') >= 0) {
|
- |
|
| 549 |
rowStyle = 'style="background-color: #e2e3e5; color: #383d41;"'; // Light grey
|
- |
|
| 550 |
} else if (status.indexOf('break') >= 0) {
|
- |
|
| 551 |
rowStyle = 'style="background-color: #ffe5cc; color: #c45200;"'; // Light orange
|
- |
|
| 552 |
} else {
|
- |
|
| 553 |
rowStyle = 'style="background-color: #f8f9fa; color: #333;"'; // Default light
|
- |
|
| 554 |
}
|
- |
|
| 555 |
var timeRange = data[i].callDateTime || '-';
|
- |
|
| 556 |
if (data[i].breakEndTime) {
|
- |
|
| 557 |
// Extract just the time part from callDateTime and show range
|
- |
|
| 558 |
var startTime = timeRange.split(' ').slice(-2).join(' '); // Get "hh:mm AM/PM"
|
- |
|
| 559 |
timeRange = startTime + ' to ' + data[i].breakEndTime;
|
- |
|
| 560 |
}
|
- |
|
| 561 |
html += '<tr ' + rowStyle + '><td>' + (i + 1) + '</td><td colspan="4"><i class="fa fa-coffee"></i> ' + (data[i].breakStatus || 'On Break') + '</td><td>' + (data[i].callDuration || '-') + '</td><td>' + timeRange + '</td><td>-</td></tr>';
|
- |
|
| 562 |
} else {
|
- |
|
| 563 |
if (data[i].recordingUrl) {
|
573 |
if (calls[i].recordingUrl) {
|
| 564 |
recordingHtml = '<audio controls style="width: 150px; height: 30px;"><source src="' + data[i].recordingUrl + '" type="audio/mpeg">Your browser does not support audio.</audio>';
|
574 |
recordingHtml = '<audio controls style="width: 150px; height: 30px;"><source src="' + calls[i].recordingUrl + '" type="audio/mpeg">Your browser does not support audio.</audio>';
|
| 565 |
}
|
- |
|
| 566 |
html += '<tr><td>' + (i + 1) + '</td><td>' + data[i].partyName + '</td><td>' + data[i].code + '</td><td>' + data[i].remark + '- ' + (data[i].message || '-') + '</td><td>' + (data[i].callStatus || '-') + '</td><td>' + (data[i].callDuration || '-') + '</td><td>' + (data[i].callDateTime || '-') + '</td><td>' + recordingHtml + '</td></tr>';
|
- |
|
| 567 |
}
|
575 |
}
|
| - |
|
576 |
html += '<tr><td>' + (i + 1) + '</td><td>' + calls[i].partyName + '</td><td>' + calls[i].code + '</td><td>' + calls[i].remark + '- ' + (calls[i].message || '-') + '</td><td>' + (calls[i].callStatus || '-') + '</td><td>' + (calls[i].callDuration || '-') + '</td><td>' + (calls[i].callDateTime || '-') + '</td><td>' + recordingHtml + '</td></tr>';
|
| 568 |
}
|
577 |
}
|
| 569 |
html += '</tbody></table>';
|
578 |
html += '</tbody></table>';
|
| 570 |
document.getElementById('calledDetailsContent').innerHTML = html;
|
579 |
document.getElementById('calledDetailsContent').innerHTML = html;
|
| 571 |
} else {
|
580 |
} else {
|
| 572 |
document.getElementById('calledDetailsContent').innerHTML = '<p>No called partners found.</p>';
|
581 |
document.getElementById('calledDetailsContent').innerHTML = '<p>No called partners found.</p>';
|
| Line 575... |
Line 584... |
| 575 |
.catch(function () {
|
584 |
.catch(function () {
|
| 576 |
document.getElementById('calledDetailsContent').innerHTML = '<p>Error loading details. Please try again.</p>';
|
585 |
document.getElementById('calledDetailsContent').innerHTML = '<p>Error loading details. Please try again.</p>';
|
| 577 |
});
|
586 |
});
|
| 578 |
}
|
587 |
}
|
| 579 |
|
588 |
|
| 580 |
// Load break time data when tab is clicked
|
- |
|
| 581 |
document.addEventListener('DOMContentLoaded', function () {
|
- |
|
| 582 |
var breakTimeTab = document.getElementById('break-time-tab');
|
- |
|
| 583 |
if (breakTimeTab) {
|
- |
|
| 584 |
breakTimeTab.addEventListener('shown.bs.tab', loadBreakTimeData);
|
- |
|
| 585 |
breakTimeTab.addEventListener('click', function () {
|
- |
|
| 586 |
// For Bootstrap 4 compatibility
|
- |
|
| 587 |
setTimeout(loadBreakTimeData, 100);
|
- |
|
| 588 |
});
|
- |
|
| 589 |
}
|
- |
|
| 590 |
});
|
- |
|
| 591 |
|
- |
|
| 592 |
function loadBreakTimeData() {
|
- |
|
| 593 |
if (!currentModalAuthId) {
|
- |
|
| 594 |
return;
|
- |
|
| 595 |
}
|
- |
|
| 596 |
|
- |
|
| 597 |
document.getElementById('breakTimeDetailsContent').innerHTML = '<p>Loading break time data...</p>';
|
- |
|
| 598 |
|
- |
|
| 599 |
var url = '/indent/rbm_call_target/break_time_details?authId=' + currentModalAuthId;
|
- |
|
| 600 |
if (currentModalDate) {
|
- |
|
| 601 |
url += '&date=' + currentModalDate;
|
- |
|
| 602 |
}
|
- |
|
| 603 |
if (currentModalAgentName) {
|
- |
|
| 604 |
url += '&agentName=' + encodeURIComponent(currentModalAgentName);
|
- |
|
| 605 |
}
|
- |
|
| 606 |
|
- |
|
| 607 |
fetch(url)
|
- |
|
| 608 |
.then(function (response) {
|
- |
|
| 609 |
return response.json();
|
- |
|
| 610 |
})
|
- |
|
| 611 |
.then(function (data) {
|
- |
|
| 612 |
var html = '';
|
- |
|
| 613 |
|
- |
|
| 614 |
// 4 Summary boxes in a row
|
- |
|
| 615 |
html += '<div class="row">';
|
- |
|
| 616 |
|
- |
|
| 617 |
// Available Box - Green
|
- |
|
| 618 |
html += '<div class="col-md-3 col-sm-6 mb-3">';
|
- |
|
| 619 |
html += '<div class="card text-white bg-success">';
|
- |
|
| 620 |
html += '<div class="card-body text-center">';
|
- |
|
| 621 |
html += '<h5 class="card-title">Available</h5>';
|
- |
|
| 622 |
html += '<h3 class="mb-0">' + (data.totalAvailableTime || '0h 0m 0s') + '</h3>';
|
- |
|
| 623 |
html += '<small>(' + (data.availableCount || 0) + ' times)</small>';
|
- |
|
| 624 |
html += '</div></div></div>';
|
- |
|
| 625 |
|
- |
|
| 626 |
// Trying Box - Yellow
|
- |
|
| 627 |
html += '<div class="col-md-3 col-sm-6 mb-3">';
|
- |
|
| 628 |
html += '<div class="card text-dark bg-warning">';
|
- |
|
| 629 |
html += '<div class="card-body text-center">';
|
- |
|
| 630 |
html += '<h5 class="card-title">Trying</h5>';
|
- |
|
| 631 |
html += '<h3 class="mb-0">' + (data.totalTryingTime || '0h 0m 0s') + '</h3>';
|
- |
|
| 632 |
html += '<small>(' + (data.tryingCount || 0) + ' times)</small>';
|
- |
|
| 633 |
html += '</div></div></div>';
|
- |
|
| 634 |
|
- |
|
| 635 |
// Logged Out Box - Red/Grey
|
- |
|
| 636 |
html += '<div class="col-md-3 col-sm-6 mb-3">';
|
- |
|
| 637 |
html += '<div class="card text-white bg-secondary">';
|
- |
|
| 638 |
html += '<div class="card-body text-center">';
|
- |
|
| 639 |
html += '<h5 class="card-title">Logged Out</h5>';
|
- |
|
| 640 |
html += '<h3 class="mb-0">' + (data.totalLoggedOutTime || '0h 0m 0s') + '</h3>';
|
- |
|
| 641 |
html += '<small>(' + (data.loggedOutCount || 0) + ' times)</small>';
|
- |
|
| 642 |
html += '</div></div></div>';
|
- |
|
| 643 |
|
- |
|
| 644 |
// Break Box - Orange
|
- |
|
| 645 |
html += '<div class="col-md-3 col-sm-6 mb-3">';
|
- |
|
| 646 |
html += '<div class="card text-dark" style="background-color: #fd7e14;">';
|
- |
|
| 647 |
html += '<div class="card-body text-center">';
|
- |
|
| 648 |
html += '<h5 class="card-title">Break</h5>';
|
- |
|
| 649 |
html += '<h3 class="mb-0">' + (data.totalBreakTime || '0h 0m 0s') + '</h3>';
|
- |
|
| 650 |
html += '<small>(' + (data.breakCount || 0) + ' times)</small>';
|
- |
|
| 651 |
html += '</div></div></div>';
|
- |
|
| 652 |
|
- |
|
| 653 |
html += '</div>';
|
- |
|
| 654 |
|
- |
|
| 655 |
// Second row: On Call, Total Login Time, Total On Call Time
|
- |
|
| 656 |
html += '<div class="row">';
|
- |
|
| 657 |
|
- |
|
| 658 |
// On Call Box - Dark Green
|
- |
|
| 659 |
html += '<div class="col-md-4 col-sm-6 mb-3">';
|
- |
|
| 660 |
html += '<div class="card text-white" style="background-color: #28a745;">';
|
- |
|
| 661 |
html += '<div class="card-body text-center">';
|
- |
|
| 662 |
html += '<h5 class="card-title"><i class="fa fa-phone"></i> On Call</h5>';
|
- |
|
| 663 |
html += '<h3 class="mb-0">' + (data.totalOnCallTime || '0h 0m 0s') + '</h3>';
|
- |
|
| 664 |
html += '<small>(From Call Logs)</small>';
|
- |
|
| 665 |
html += '</div></div></div>';
|
- |
|
| 666 |
|
- |
|
| 667 |
// Total Login Time Box - Blue
|
- |
|
| 668 |
html += '<div class="col-md-4 col-sm-6 mb-3">';
|
- |
|
| 669 |
html += '<div class="card text-white bg-primary">';
|
- |
|
| 670 |
html += '<div class="card-body text-center">';
|
- |
|
| 671 |
html += '<h5 class="card-title"><i class="fa fa-sign-in-alt"></i> Total Login Time</h5>';
|
- |
|
| 672 |
html += '<h3 class="mb-0">' + (data.totalLoginTime || '0h 0m 0s') + '</h3>';
|
- |
|
| 673 |
html += '<small>(Available + Trying + Break + On Call)</small>';
|
- |
|
| 674 |
html += '</div></div></div>';
|
- |
|
| 675 |
|
- |
|
| 676 |
// Total Idle Time Box - Red
|
- |
|
| 677 |
html += '<div class="col-md-4 col-sm-6 mb-3">';
|
- |
|
| 678 |
html += '<div class="card text-white bg-danger">';
|
- |
|
| 679 |
html += '<div class="card-body text-center">';
|
- |
|
| 680 |
html += '<h5 class="card-title"><i class="fa fa-clock"></i> Total Idle Time</h5>';
|
- |
|
| 681 |
html += '<h3 class="mb-0">' + (data.totalAvailableTime || '0h 0m 0s') + '</h3>';
|
- |
|
| 682 |
html += '<small>(Available - Not on call)</small>';
|
- |
|
| 683 |
html += '</div></div></div>';
|
- |
|
| 684 |
|
- |
|
| 685 |
html += '</div>';
|
- |
|
| 686 |
|
- |
|
| 687 |
// Check if no data
|
- |
|
| 688 |
if ((data.totalAvailableSeconds || 0) + (data.totalTryingSeconds || 0) +
|
- |
|
| 689 |
(data.totalLoggedOutSeconds || 0) + (data.totalBreakSeconds || 0) +
|
- |
|
| 690 |
(data.totalOnCallSeconds || 0) === 0) {
|
- |
|
| 691 |
html += '<p class="text-muted text-center mt-3">No break time data available for this date.</p>';
|
- |
|
| 692 |
}
|
- |
|
| 693 |
|
- |
|
| 694 |
document.getElementById('breakTimeDetailsContent').innerHTML = html;
|
- |
|
| 695 |
})
|
- |
|
| 696 |
.catch(function (err) {
|
- |
|
| 697 |
console.error('Error loading break time:', err);
|
- |
|
| 698 |
document.getElementById('breakTimeDetailsContent').innerHTML = '<p>Error loading break time data. Please try again.</p>';
|
- |
|
| 699 |
});
|
- |
|
| 700 |
}
|
- |
|
| 701 |
|
589 |
|
| 702 |
// Date-wise Called Partner History
|
590 |
// Date-wise Called Partner History
|
| 703 |
function showHistoryCalledPartners() {
|
591 |
function showHistoryCalledPartners() {
|
| 704 |
var selectedDate = document.getElementById('historyDate').value;
|
592 |
var selectedDate = document.getElementById('historyDate').value;
|
| 705 |
var selectedRbm = document.getElementById('historyRbm');
|
593 |
var selectedRbm = document.getElementById('historyRbm');
|
| Line 828... |
Line 716... |
| 828 |
}
|
716 |
}
|
| 829 |
|
717 |
|
| 830 |
return '<span class="badge" style="background-color: ' + bgColor + '; color: ' + textColor + ';">' + status + '</span>';
|
718 |
return '<span class="badge" style="background-color: ' + bgColor + '; color: ' + textColor + ';">' + status + '</span>';
|
| 831 |
}
|
719 |
}
|
| 832 |
|
720 |
|
| 833 |
// Refresh every 10 seconds
|
721 |
// Refresh every 10 seconds (only for today's view)
|
| - |
|
722 |
#if($isToday)
|
| 834 |
setInterval(refreshAgentStatus, 10000);
|
723 |
setInterval(refreshAgentStatus, 10000);
|
| 835 |
|
724 |
|
| 836 |
// Initial refresh after page load
|
725 |
// Initial refresh after page load
|
| 837 |
setTimeout(refreshAgentStatus, 2000);
|
726 |
setTimeout(refreshAgentStatus, 2000);
|
| - |
|
727 |
#end
|
| 838 |
|
728 |
|
| 839 |
// Download All Call Data by Date
|
729 |
// Download All Call Data by Date
|
| 840 |
function downloadCallData() {
|
730 |
function downloadCallData() {
|
| 841 |
var selectedDate = document.getElementById('downloadDate').value;
|
731 |
var selectedDate = document.getElementById('downloadDate').value;
|
| 842 |
if (!selectedDate) {
|
732 |
if (!selectedDate) {
|