Subversion Repositories SmartDukaan

Rev

Rev 35723 | Rev 35731 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 35723 Rev 35730
Line 78... Line 78...
78
    }
78
    }
79
</style>
79
</style>
80
 
80
 
81
<div class="container-fluid">
81
<div class="container-fluid">
82
    <h3>RBM Call Target Summary</h3>
82
    <h3>RBM Call Target Summary</h3>
-
 
83
 
-
 
84
    <!-- Date-wise Called Partner Filter -->
-
 
85
    <div class="card mb-3" style="max-width: 500px;">
-
 
86
        <div class="card-body py-2">
-
 
87
            <div class="d-flex align-items-center">
-
 
88
                <label for="historyDate" class="mb-0 mr-2" style="font-size: 14px; white-space: nowrap;">Date:</label>
-
 
89
                <input type="date" id="historyDate" class="form-control form-control-sm mr-2" style="width: 140px;">
-
 
90
                <label for="historyRbm" class="mb-0 mr-2" style="font-size: 14px; white-space: nowrap;">RBM:</label>
-
 
91
                <select id="historyRbm" class="form-control form-control-sm mr-2" style="width: 150px;">
-
 
92
                    <option value="">Select RBM</option>
-
 
93
                    #foreach($model in $rbmCallTargetModels)
-
 
94
                        <option value="$model.getAuthId()">$model.getRbmName()</option>
-
 
95
                    #end
-
 
96
                </select>
-
 
97
                <button type="button" class="btn btn-primary btn-sm" onclick="showHistoryCalledPartners()">View</button>
-
 
98
            </div>
-
 
99
        </div>
-
 
100
    </div>
-
 
101
 
83
    <table id="rbm-call-target-table" class="table table-bordered table-striped">
102
    <table id="rbm-call-target-table" class="table table-bordered table-striped">
84
        <thead>
103
        <thead>
85
        <tr>
104
        <tr>
86
            <th>RBM Name</th>
105
            <th>RBM Name</th>
87
            <th>Partner Count</th>
106
            <th>Partner Count</th>
Line 273... Line 292...
273
                    }
292
                    }
274
                })
293
                })
275
                .catch(function () {
294
                .catch(function () {
276
                    document.getElementById('calledDetailsContent').innerHTML = '<p>Error loading details. Please try again.</p>';
295
                    document.getElementById('calledDetailsContent').innerHTML = '<p>Error loading details. Please try again.</p>';
277
                });
296
                });
-
 
297
    }
-
 
298
 
-
 
299
    // Date-wise Called Partner History
-
 
300
    function showHistoryCalledPartners() {
-
 
301
        var selectedDate = document.getElementById('historyDate').value;
-
 
302
        var selectedRbm = document.getElementById('historyRbm');
-
 
303
        var authId = selectedRbm.value;
-
 
304
        var rbmName = selectedRbm.options[selectedRbm.selectedIndex].text;
-
 
305
 
-
 
306
        if (!selectedDate) {
-
 
307
            alert('Please select a date');
-
 
308
            return;
-
 
309
        }
-
 
310
        if (!authId) {
-
 
311
            alert('Please select an RBM');
-
 
312
            return;
-
 
313
        }
-
 
314
 
-
 
315
        document.getElementById('calledModalLabel').textContent = 'Called Partners - ' + rbmName + ' (' + selectedDate + ')';
-
 
316
        document.getElementById('calledDetailsContent').innerHTML = '<p>Loading...</p>';
-
 
317
        $('#calledModal').modal('show');
-
 
318
 
-
 
319
        fetch('/indent/rbm_call_target/called_details?authId=' + authId + '&date=' + selectedDate)
-
 
320
                .then(function (response) {
-
 
321
                    return response.json();
-
 
322
                })
-
 
323
                .then(function (data) {
-
 
324
                    if (data && data.length > 0) {
-
 
325
                        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>Remark Time</th><th>Call Status</th><th>Call Duration</th><th>Call Date/Time</th><th>Recording</th></tr></thead><tbody>';
-
 
326
                        for (var i = 0; i < data.length; i++) {
-
 
327
                            var recordingHtml = '-';
-
 
328
                            if (data[i].recordingUrl) {
-
 
329
                                recordingHtml = '<a href="' + data[i].recordingUrl + '" target="_blank" class="btn btn-sm btn-outline-primary">Play</a>';
-
 
330
                            }
-
 
331
                            html += '<tr><td>' + (i + 1) + '</td><td>' + data[i].partyName + '</td><td>' + data[i].code + '</td><td>' + data[i].remark + '- &nbsp;' + (data[i].message || '-') + '</td><td>' + data[i].time + '</td><td>' + (data[i].callStatus || '-') + '</td><td>' + (data[i].callDuration || '-') + '</td><td>' + (data[i].callDateTime || '-') + '</td><td>' + recordingHtml + '</td></tr>';
-
 
332
                        }
-
 
333
                        html += '</tbody></table>';
-
 
334
                        document.getElementById('calledDetailsContent').innerHTML = html;
-
 
335
                    } else {
-
 
336
                        document.getElementById('calledDetailsContent').innerHTML = '<p>No called partners found for selected date.</p>';
-
 
337
                    }
-
 
338
                })
-
 
339
                .catch(function () {
-
 
340
                    document.getElementById('calledDetailsContent').innerHTML = '<p>Error loading details. Please try again.</p>';
-
 
341
                });
278
    }
342
    }
279
</script>
343
</script>
280
344