Handlebars Helper LastCall Queue Agent

  • lastcall : Unix timestamp in seconds
  • status :
    • '1': 'Not in use'
    • '2': 'in call' 'In use'
    • '6': 'Ring'
  • paused : '1 || 0'
  • agent : Agent name
    function ifLen(v) {
        if (v < 10) {
            return '0' + v;
        } else {
            return v;
        }
    }
 
Handlebars.registerHelper("lastCall", function(lastcall, status, paused, agent) {
 
        if (status == '1' && paused !== '1') {
            var dateFromAPI = lastcall;
 
            var now = new Date();
            var nowTimeStamp = now.getTime() / 1000;
            localStorage.setItem('startcall-' + agent, nowTimeStamp);
 
            var microSecondsDiff = nowTimeStamp - dateFromAPI;
            var date = new Date(microSecondsDiff * 1000);
            var minute = date.getMinutes();
            var seconds = date.getSeconds();
 
            return new Handlebars.SafeString("<span class='text-info'>" + ifLen(minute) + ":" + ifLen(seconds) + "</span>");
        } else if (status == '2' || status  == '6') {
            var dateFromAPI = lastcall;
 
            var now = new Date();
            var nowTimeStamp = now.getTime() / 1000;
            var startCall = localStorage.getItem('startcall-' + agent);
            var microSecondsDiff = nowTimeStamp - startCall;
            var date = new Date(microSecondsDiff * 1000);
            var minute = date.getMinutes();
            var seconds = date.getSeconds();
 
            if (status == '2') {
                if (minute < 1) {
            return new Handlebars.SafeString("<span class='text-success'>" + ifLen(minute) + ":" + ifLen(seconds) + "</span>");
        } else {
            return new Handlebars.SafeString("<span class='text-success'><b>" + ifLen(minute) + ":" + ifLen(seconds) + "</b></span>");
        }
        } else if (status == '6') {
            return new Handlebars.SafeString("<span class='text-warning'>" + ifLen(minute) + ":" + ifLen(seconds) + "</span>");
          }
        } else {
            return new Handlebars.SafeString('<span class="text-muted">&nbsp;--:--</span>');
        }
    });

asterisk_supervisor_call_center_panel

Предыдущие записи >>

Только авторизованные участники могут оставлять комментарии.
  • blog.txt
  • Последние изменения: 2018/07/04