Tutorial: 14. Records

14. Records

Record

getUnavailableHistory

Method to retrieve the unavailable records of the day which returns the event UnavailableStatusHistory.

getUnavailableHistory();

UnavailableStatusHistory

Retrievs the unavailable list used by the agent

/**
 * @description Regresa la lista de no disponibles del agente y su detalle ejecuta el metodo getUnavailableHistory
 * @event onUnavailableHistory
 * @param {Array} UnavailableStatusHistory [{accumulatedTime:String, count:int, maxTime:string, total:String, statusName:String, <br/>
 * statusLog:[{time:String,hour:String}]
 * }]
 * @example 
 * [{
 *      accumulatedTime:"00:12:15", count:3, maxTime:"00:15:00", total:"00:15:00", statusName:"Baño", 
 *      statusLog:[
 *          {time:"00:05:00",hour:"08:10:13"},
 *          {time:"00:05:00",hour:"10:15:43"},
 *          {time:"00:02:15",hour:"12:25:00"} 
 *      ]
 * },
 *      accumulatedTime:"00:30:00", count:1, maxTime:"00:30:00", total:"00:30:00", statusName:"Comida", 
 *      statusLog:[{time:"00:30:00",hour:"13:30:00"} ]
 * }
 * ]
 * @tutorial HistoricRecords
 */
function onUnavailableHistory(UnavailableStatusHistory) {
    console.log('UnavailableStatusHistory: ' + UnavailableStatusHistory);
    var tbodyUnavailableHistory = $("#tbodyUnavailableHistory").html("");
    for (var i = 0; i < UnavailableStatusHistory.length; i++) {
        var history = UnavailableStatusHistory[i];
        var tr = $("<tr>");
        var statusName = history.statusName;
        var accumulatedTime = history.accumulatedTime;
        var count = history.count;
        var maxTime = history.maxTime;
        var total = history.total;
        var statusLog = history.statusLog;

        tr.append("<td>" + statusName + "</td>");
        tr.append("<td>" + accumulatedTime + "</td>");
        tr.append("<td>" + count + "</td>");
        tr.append("<td>" + maxTime + "</td>");
        tr.append("<td>" + total + "</td>");

        tbodyUnavailableHistory.append(tr);
    }
}

getCallHistory

Method to retrieve the call records of the day which returns the event onCallHistory.

nuxibaIntegration.getCallHistory();

onCallHistory

Event that retrieves the call records of the day onCallHistory.

/**
 * @description Regresa la lista de las llamadas del agente
 * @event onCallHistory
 * @param {array} HistoryDataCall [{CallId:int, CallKey:String, CallType:String, Description:String, Disposition:String, Duration:string, Hour:string, IDCampEsp:int, Telephone:string}]
 * @example 
 * [{
 * 	CallId: 45,
 * 	CallKey: "",
 * 	CallType: "IN",
 * 	Description: "CommonACD",
 * 	Disposition: "Se Corto la Llamada",
 * 	Duration: "00:01:35",
 * 	GraphicID: 1,
 * 	HidePhone: true,
 * 	Hour: "11:10:59",
 * 	IDCampEsp: 1,
 * 	Telephone: "1005",
 * 	selectionActive: false
 * },{
 * 	CallId: 96,
 * 	CallKey: "",
 * 	CallType: "OUT",
 * 	Description: "CommonCamp",
 * 	Disposition: "Gestión Efectiva",
 * 	Duration: "00:02:23",
 * 	GraphicID: 1,
 * 	HidePhone: true,
 * 	Hour: "11:10:41", 
 *  IDCampEsp: 1,
 * 	Telephone: "2005",
 * 	selectionActive: false
 * },{
 * CallId: 95,
 * CallKey: "",
 * CallType: "OUT",
 * Description: "CommonCamp",
 * Disposition: "Gestión Efectiva",
 * Duration: "00:05:24",
 * GraphicID: 1,
 * HidePhone: true,
 * Hour: "11:05:01",
 * IDCampEsp: 1,
 * Telephone: "2005",
 * selectionActive: false
 * }]
 * @see getCallHistory
 * @tutorial HistoricRecords
 */
function onCallHistory(data) {
    console.log("onCallHistory ", data);
    let callLogData = data.data;
    let callLogTable = '';
    let tbodyCallHistory = document.getElementById("tbodyCallHistory");
    tbodyCallHistory.innerHTML = "";
    if (callLogData.length > 0) {
        for (i = 0; i < callLogData.length; i++) {
            callLogTable += '<tr><th scope="col">' +
                callLogData[i].Hour + '</th><th scope="col">' +
                callLogData[i].Telephone + '</th><th scope="col">' +
                callLogData[i].Duration + '</th><th scope="col">' +
                callLogData[i].CallKey + '</th><th scope="col">' +
                callLogData[i].Description + '</th><th scope="col">' +
                callLogData[i].Disposition + '</th></tr>';
        }
        tbodyCallHistory.innerHTML = callLogTable;
    }
}