UNPKG

soft-phone

Version:
271 lines 15.2 kB
import { Component, Input } from '@angular/core'; import { PhoneService } from '../../../service/index'; import { User, Agent, CallState, UserDetail } from '../../index'; var KeypadComponent = /** @class */ (function () { function KeypadComponent(service) { this.service = service; this.a = "a"; this.b = "b"; this.users = new Array(); this.filteredUsers = new Array(); this.agents = new Array(); this.filteredAgents = new Array(); this.services = service; } Object.defineProperty(KeypadComponent.prototype, "displayText", { get: function () { return this._displayText; }, set: function (displayText) { var _this = this; this._displayText = displayText; if (this.service.status === CallState.DialPadOutbound) { var res = this.users.filter(function (us) { return us.phoneNumber.indexOf(_this.service.displayText) == 0 || us.fullname.indexOf(_this.service.displayText) == 0; }); this.filteredUsers = []; (_a = this.filteredUsers).push.apply(_a, res); // if(this.service.selectedUser){ // if(this.service.selectedUser.phoneNumber.indexOf(this.service.displayText) != 0 || this.service.selectedUser.fullname.indexOf(this.service.displayText) != 0 ){ // this.service.selectedUser = null; // } // } } else if (this.service.status === CallState.DialPadForwarding) { var res2 = this.agents.filter(function (ag) { return ag.extension.indexOf(_this.service.displayText) == 0 || ag.fullname.indexOf(_this.service.displayText) != 0; }); this.filteredAgents = []; (_b = this.filteredAgents).push.apply(_b, res2); // if(this.service.selectedAgent){ // if( this.service.selectedAgent.extension.indexOf(this.service.displayText) != 0 || this.service.selectedAgent.fullname.indexOf(this.service.displayText) != 0 ){ // this.service.selectedAgent = null; // } // } } var _a, _b; }, enumerable: true, configurable: true }); KeypadComponent.prototype.ngOnInit = function () { this.displayText = ""; this.showKeys = true; var agent = new Agent(); agent.fullname = "Tewa"; agent.phoneNumber = "07088878899"; agent.emailAddress = "tewa@yahoo.com"; agent.address = "address"; agent.extension = "104"; this.agents.push(agent); var agent = new Agent(); agent.fullname = "Femi"; agent.phoneNumber = "09088857579"; agent.emailAddress = "fem@yahoo.com"; agent.address = "address"; agent.extension = "105"; this.agents.push(agent); var agent = new Agent(); agent.fullname = "Daniel"; agent.phoneNumber = "07078589859"; agent.emailAddress = "da@yahoo.com"; agent.address = "address"; agent.extension = "109"; this.agents.push(agent); var user = new User(); user.fullname = "Sade Ada Abubakar"; user.phoneNumber = "09082645162"; user.emailAddress = "info@yahoo.com"; user.address = "address"; user.anniversary = "anniversary"; user.demography = "demography"; user.details = new Array(); var d1 = new UserDetail(); d1.description = "2 Sales"; var d2 = new UserDetail(); d2.description = "3 Opportunities"; var d3 = new UserDetail(); d3.description = "10 Support"; var d4 = new UserDetail(); d4.description = "9 On Site Support"; user.details.push(d1); user.details.push(d2); user.details.push(d3); user.details.push(d4); this.users.push(user); var user = new User(); user.fullname = "Daniel Abu"; user.phoneNumber = "09032443447"; user.emailAddress = "info@yahoo.com"; user.address = "address"; user.anniversary = "anniversary"; user.demography = "demography"; user.details = new Array(); var d1 = new UserDetail(); d1.description = "2 Sales"; var d2 = new UserDetail(); d2.description = "3 Opportunities"; var d3 = new UserDetail(); d3.description = "10 Support"; var d4 = new UserDetail(); d4.description = "9 On Site Support"; user.details.push(d1); user.details.push(d2); user.details.push(d3); user.details.push(d4); this.users.push(user); var user = new User(); user.fullname = "Ada Bisola"; user.phoneNumber = "09037637848"; user.emailAddress = "info@yahoo.com"; user.address = "address"; user.anniversary = "anniversary"; user.demography = "demography"; user.details = new Array(); var d1 = new UserDetail(); d1.description = "2 Sales"; var d2 = new UserDetail(); d2.description = "3 Opportunities"; var d3 = new UserDetail(); d3.description = "10 Support"; var d4 = new UserDetail(); d4.description = "9 On Site Support"; user.details.push(d1); user.details.push(d2); user.details.push(d3); user.details.push(d4); this.users.push(user); var user = new User(); user.fullname = "Tope Joe"; user.phoneNumber = "09086837673"; user.emailAddress = "info@yahoo.com"; user.address = "address"; user.anniversary = "anniversary"; user.demography = "demography"; user.details = new Array(); var d1 = new UserDetail(); d1.description = "2 Sales"; var d2 = new UserDetail(); d2.description = "3 Opportunities"; var d3 = new UserDetail(); d3.description = "10 Support"; var d4 = new UserDetail(); d4.description = "9 On Site Support"; user.details.push(d1); user.details.push(d2); user.details.push(d3); user.details.push(d4); this.users.push(user); var user = new User(); user.fullname = "Bisi Akomolafe"; user.phoneNumber = "09099839844"; user.emailAddress = "info@yahoo.com"; user.address = "address"; user.anniversary = "anniversary"; user.demography = "demography"; user.details = new Array(); var d1 = new UserDetail(); d1.description = "2 Sales"; var d2 = new UserDetail(); d2.description = "3 Opportunities"; var d3 = new UserDetail(); d3.description = "10 Support"; var d4 = new UserDetail(); d4.description = "9 On Site Support"; user.details.push(d1); user.details.push(d2); user.details.push(d3); user.details.push(d4); this.users.push(user); }; KeypadComponent.prototype.showKey = function () { this.showKeys = true; }; KeypadComponent.prototype.hideKey = function () { this.showKeys = false; }; KeypadComponent.prototype.count = function (event) { if (event !== "a" && event !== "b") { this.service.displayText += event; } else if (event === "a") { this.service.displayText += "*"; } else if (event === "b") { this.service.displayText += "#"; } }; KeypadComponent.prototype.clearDisplayText = function () { this.service.selectedUser = null; this.service.displayText = ""; }; KeypadComponent.prototype.forwardCall = function () { if (this.service.selectedAgent) { this.service.status = CallState.ActiveCallForwarding; this.transferCall(this.service.selectedAgent.extension); } else { if (this.service.displayText) { this.service.selectedAgent = new Agent(); this.service.selectedAgent.fullname = this.service.displayText; this.service.selectedAgent.extension = this.service.displayText; this.service.status = CallState.ActiveCallForwarding; this.transferCall(this.service.selectedAgent.extension); } } }; KeypadComponent.prototype.transferCall = function (phoneNumber) { if (this.service.callSession) { if (phoneNumber) { this.service.forwardCallvalue = true; if (this.service.callSession.transfer(phoneNumber) != 0) { this.service.callStat = 'Call transfer failed'; this.service.forwardCallvalue = false; return; } this.service.callStat = 'Transfering the call...'; } } }; KeypadComponent.prototype.customerClick = function (user) { this.service.selectedUser = user; this.service.displayText = user.phoneNumber; }; KeypadComponent.prototype.agentClick = function (agent) { this.service.selectedAgent = agent; this.service.displayText = agent.extension; }; KeypadComponent.prototype.isOutboundStatus = function () { if (this.service.status === CallState.DialPadForwarding) { return true; } return false; }; KeypadComponent.prototype.displayFwCall = function () { if (this.service.status === CallState.DialPadForwarding) { return true; } return false; }; KeypadComponent.prototype.displayCall = function () { if (this.service.status === CallState.DialPadOutbound) { return true; } return false; }; KeypadComponent.decorators = [ { type: Component, args: [{ selector: 'keypad', template: "\n <div class=\"ui-g phone-width\" >\n <div class=\"ui-g-12 nopad recip\" >\n <recipient-summary *ngIf=\"service.selectedUser\" [user]=\"service.selectedUser\" [displayOutbound] =\"true\" ></recipient-summary>\n </div> \n <div class=\"ui-g-12 nopad\" >\n <recipient-summary *ngIf=\"service.selectedAgent\" [agent]=\"service.selectedAgent\" [displayOutbound] =\"false\" [displayForward]=\"true\"></recipient-summary>\n </div> \n \n <div class=\"ui-g-12\" >\n <input type=\"text\" class=\"ui-g-11\" [(ngModel)]=\"service.displayText\" pInputText >\n <span class=\"ui-g-1\" style=\"font-size: 15px;padding-left: 3px\" class=\"material-icons ui-icon-close item-icon\" (click)=\"clearDisplayText()\" ></span> \n </div>\n <div *ngIf=\"!isOutboundStatus()\" class=\"ui-g-12 expand\">\n \n <recipient-summary *ngFor=\"let user of filteredUsers\" (click)=\"customerClick(user)\" [user]=\"user\"></recipient-summary>\n \n </div> \n \n <div *ngIf=\"isOutboundStatus()\" class=\"ui-g-12 expand\">\n \n <recipient-summary *ngFor=\"let agent of filteredAgents\" (click)=\"agentClick(agent)\" [agent]=\"agent\"></recipient-summary>\n \n </div> \n \n <div class=\"ui-g-12\" style=\"text-align: center; margin: 0px;padding:0px;height:15px\" >\n <span *ngIf=\"!showKeys\" (click)=\"showKey()\" class=\"material-icons ui-icon-expand-less item-icon\" style=\"font-size:20px;\" ></span>\n <span *ngIf=\"showKeys\" (click)=\"hideKey()\" class=\"material-icons ui-icon-expand-more item-icon\" style=\"font-size:20px;\" ></span>\n </div>\n\n <div class=\"ui-g-12\" *ngIf=\"showKeys\" >\n \n <div class=\"ui-g-12 butgrp\" > \n <button class=\"ui-g-3 but-size\" pButton type=\"button\" (click)=\"count(1)\" label=\"1\" ></button>\n <button class=\"ui-g-3 but-size\" pButton type=\"button\" (click)=\"count(2)\" label=\"2\" ></button>\n <button (click)=\"count(3)\" class=\"ui-g-3 but-size\" pButton type=\"button\" label=\"3\" ></button>\n </div>\n <div class=\"ui-g-12 butgrp\" > \n <button (click)=\"count(4)\" class=\"ui-g-3 but-size\" pButton type=\"button\" label=\"4\"></button>\n <button (click)=\"count(5)\" class=\"ui-g-3 but-size\" pButton type=\"button\" label=\"5\"></button>\n <button (click)=\"count(6)\" class=\"ui-g-3 but-size\" pButton type=\"button\" label=\"6\"></button>\n </div>\n <div class=\"ui-g-12 butgrp\" >\n <button (click)=\"count(7)\" class=\"ui-g-3 but-size\" pButton type=\"button\" label=\"7\"></button>\n <button (click)=\"count(8)\" class=\"ui-g-3 but-size\" pButton type=\"button\" label=\"8\"></button>\n <button (click)=\"count(9)\" class=\"ui-g-3 but-size\" pButton type=\"button\" label=\"9\"></button>\n </div>\n <div class=\"ui-g-12 butgrp\" > \n <button (click)=\"count(a)\" class=\"ui-g-3 but-size\" pButton type=\"button\" label=\"*\"></button>\n <button (click)=\"count(0)\" class=\"ui-g-3 but-size\" pButton type=\"button\" label=\"0\"></button>\n <button (click)=\"count(b)\" class=\"ui-g-3 but-size\" pButton type=\"button\" label=\"#\"></button>\n </div>\n\n \n\n <div *ngIf=\"displayCall()\" class=\"ui-g-12 butgrp\" id=\"kpp\">\n <button (click)=\"service.makeCall()\" pButton type=\"button\" label=\"Call\"></button>\n </div>\n <div *ngIf=\"displayFwCall()\" class=\"ui-g-12 butgrp\" id=\"kpp\" > \n <button (click)=\"forwardCall()\" pButton type=\"button\" label=\"Forward Call\"></button>\n </div>\n </div>\n\n </div>\n ", styles: ["\n #panel{width:450px;margin:0 auto}#panel-heada{text-align:center}.Caller-details{text-align:center}.Call-button{text-align:center}#btn{width:250px}.fone{text-align:center}body #kpp .ui-button{width:280px;height:40px}body #kp .ui-button{width:80px;height:80px;float:none}.butgrp{padding-bottom:0px}.nopad{padding:0px}.short{height:184px;max-height:184px;overflow-y:auto;overflow-x:hidden;width:280px}.phone-width{width:290px}.expand{min-height:184px;max-height:395px;overflow-x:hidden;overflow-y:auto}.full-width{width:100%}body .md-inputfield{margin-bottom:5px}.c-input span input{width:100% !important}.recip{width:280px;height:60px;margin:0px}\n "] },] }, ]; /** @nocollapse */ KeypadComponent.ctorParameters = function () { return [ { type: PhoneService, }, ]; }; KeypadComponent.propDecorators = { 'displayText': [{ type: Input },], }; return KeypadComponent; }()); export { KeypadComponent }; //# sourceMappingURL=keypad.component.js.map