zw.wang | 96c5d4e | 2025-07-01 11:35:13 +0800 | [diff] [blame^] | 1 | define("voice_dial_time","underscore jquery knockout set service".split(" "),
|
| 2 | function (_, $, ko, config, service) {
|
| 3 | var sc_startpSeconds = [];
|
| 4 |
|
| 5 | function sf_produceArray(start, end, arryName) {
|
| 6 | var item = {};
|
| 7 | for(var i = start; i <= end; i++) {
|
| 8 | item.name = i;
|
| 9 | item.value = i;
|
| 10 | arryName.push(new Option(item.name, item.value));
|
| 11 | }
|
| 12 | }
|
| 13 |
|
| 14 | sf_produceArray(1, 10, sc_startpSeconds);
|
| 15 |
|
| 16 | function DialTimeVM() {
|
| 17 | var target = this;
|
| 18 | var dialTimesInfo = service.getDialTimeInfo();
|
| 19 |
|
| 20 | target.dialTimeSeconds = ko.observable(parseInt(dialTimesInfo.dialTimeSeconds));
|
| 21 | target.scr_seconds = ko.observableArray(sc_startpSeconds);
|
| 22 |
|
| 23 | target.dialTimeSet = function () {
|
| 24 | showLoading();
|
| 25 | var params = {};
|
| 26 | params.dialTimeSeconds = target.dialTimeSeconds();
|
| 27 | service.setDialTimeInfo(params, function (result) {
|
| 28 | if (result.result != "success") {
|
| 29 | errorOverlay();
|
| 30 | } else {
|
| 31 | successOverlay();
|
| 32 | }
|
| 33 | });
|
| 34 | };
|
| 35 | }
|
| 36 |
|
| 37 | function initialize() {
|
| 38 | var container = $('#container');
|
| 39 | ko.cleanNode(container[0]);
|
| 40 | var imVm = new DialTimeVM();
|
| 41 | ko.applyBindings(imVm, container[0]);
|
| 42 | }
|
| 43 |
|
| 44 | return {
|
| 45 | init: initialize
|
| 46 | };
|
| 47 | });
|
| 48 |
|
| 49 | define("voice_call_duration","underscore jquery knockout set service".split(" "),
|
| 50 | function (_, $, ko, config, service) {
|
| 51 | var sc_startpMinutes = [];
|
| 52 |
|
| 53 | function sf_produceArray(start, end, arryName) {
|
| 54 | var item = {};
|
| 55 | for(var i = start; i <= end; i++) {
|
| 56 | item.name = i;
|
| 57 | item.value = i;
|
| 58 | arryName.push(new Option(item.name, item.value));
|
| 59 | }
|
| 60 | }
|
| 61 |
|
| 62 | sf_produceArray(1, 10, sc_startpMinutes);
|
| 63 |
|
| 64 | function CallTimeVM() {
|
| 65 | var target = this;
|
| 66 | var callTimesInfo = service.getCallTimeInfo();
|
| 67 |
|
| 68 | target.callingLimitSetting = ko.observable(callTimesInfo.callingLimitSetting);
|
| 69 | target.calledLimitSetting = ko.observable(callTimesInfo.calledLimitSetting);
|
| 70 | target.callingTimeMinutes = ko.observable(parseInt(callTimesInfo.callingTimeMinutes));
|
| 71 | target.calledTimeMinutes = ko.observable(parseInt(callTimesInfo.calledTimeMinutes));
|
| 72 | target.scr_minutes = ko.observableArray(sc_startpMinutes);
|
| 73 |
|
| 74 | target.callTimeSet = function () {
|
| 75 | showLoading();
|
| 76 | var params = {};
|
| 77 | params.callingLimitSetting = target.callingLimitSetting();
|
| 78 | params.calledLimitSetting = target.calledLimitSetting();
|
| 79 | params.callingTimeMinutes = target.callingTimeMinutes();
|
| 80 | params.calledTimeMinutes = target.calledTimeMinutes();
|
| 81 | service.setCallTimeInfo(params, function (result) {
|
| 82 | if (result.result != "success") {
|
| 83 | errorOverlay();
|
| 84 | } else {
|
| 85 | successOverlay();
|
| 86 | }
|
| 87 | });
|
| 88 | };
|
| 89 | }
|
| 90 |
|
| 91 | function initialize() {
|
| 92 | var container = $('#container');
|
| 93 | ko.cleanNode(container[0]);
|
| 94 | var imVm = new CallTimeVM();
|
| 95 | ko.applyBindings(imVm, container[0]);
|
| 96 | }
|
| 97 |
|
| 98 | return {
|
| 99 | init: initialize
|
| 100 | };
|
| 101 | });
|
| 102 |
|
| 103 | define("voice_call_hold","underscore jquery knockout set service".split(" "),
|
| 104 | function (_, $, ko, config, service) {
|
| 105 | function CallHoldVM() {
|
| 106 | var target = this;
|
| 107 | var callHoldInfo = service.getCallHoldInfo();
|
| 108 |
|
| 109 | target.callHoldSetting = ko.observable(callHoldInfo.callHoldSetting);
|
| 110 |
|
| 111 | target.callHoldSet = function () {
|
| 112 | showLoading();
|
| 113 | var params = {};
|
| 114 | params.callHoldSetting = target.callHoldSetting();
|
| 115 | service.setCallHoldInfo(params, function (result) {
|
| 116 | if (result.result != "success") {
|
| 117 | errorOverlay();
|
| 118 | } else {
|
| 119 | successOverlay();
|
| 120 | }
|
| 121 | });
|
| 122 | };
|
| 123 | }
|
| 124 |
|
| 125 | function initialize() {
|
| 126 | var container = $('#container');
|
| 127 | ko.cleanNode(container[0]);
|
| 128 | var imVm = new CallHoldVM();
|
| 129 | ko.applyBindings(imVm, container[0]);
|
| 130 | }
|
| 131 |
|
| 132 | return {
|
| 133 | init: initialize
|
| 134 | };
|
| 135 | });
|
| 136 |
|
| 137 | define("voice_hotline","underscore jquery knockout set service".split(" "),
|
| 138 | function (_, $, ko, config, service) {
|
| 139 | var sc_startpSeconds = [];
|
| 140 | var sc_startpTimes = [];
|
| 141 |
|
| 142 | function sf_produceArray(start, end, arryName) {
|
| 143 | var item = {};
|
| 144 | for(var i = start; i <= end; i++) {
|
| 145 | item.name = i;
|
| 146 | item.value = i;
|
| 147 | arryName.push(new Option(item.name, item.value));
|
| 148 | }
|
| 149 | }
|
| 150 |
|
| 151 | sf_produceArray(4, 10, sc_startpSeconds);
|
| 152 | sf_produceArray(1, 10, sc_startpTimes);
|
| 153 |
|
| 154 | function HotlineVM() {
|
| 155 | var target = this;
|
| 156 | var hotlineInfo = service.getHotlineInfo();
|
| 157 |
|
| 158 | target.hotlineSetting = ko.observable(hotlineInfo.hotlineSetting);
|
| 159 | target.hotlineSeconds = ko.observable(parseInt(hotlineInfo.hotlineSeconds));
|
| 160 | target.hotlineAttemptsNumber = ko.observable(parseInt(hotlineInfo.hotlineAttemptsNumber));
|
| 161 | target.hotlineNumber = ko.observable(hotlineInfo.hotlineNumber);
|
| 162 | target.scr_seconds = ko.observableArray(sc_startpSeconds);
|
| 163 | target.scr_times = ko.observableArray(sc_startpTimes);
|
| 164 |
|
| 165 | target.hotlineSet = function () {
|
| 166 | showLoading();
|
| 167 | var params = {};
|
| 168 | params.hotlineSetting = target.hotlineSetting();
|
| 169 | params.hotlineSeconds = target.hotlineSeconds();
|
| 170 | params.hotlineAttemptsNumber = target.hotlineAttemptsNumber();
|
| 171 | params.hotlineNumber = target.hotlineNumber();
|
| 172 | service.setHotlineInfo(params, function (result) {
|
| 173 | if (result.result != "success") {
|
| 174 | errorOverlay();
|
| 175 | } else {
|
| 176 | successOverlay();
|
| 177 | }
|
| 178 | });
|
| 179 | };
|
| 180 | }
|
| 181 |
|
| 182 | function initialize() {
|
| 183 | var container = $('#container');
|
| 184 | ko.cleanNode(container[0]);
|
| 185 | var imVm = new HotlineVM();
|
| 186 | ko.applyBindings(imVm, container[0]);
|
| 187 | }
|
| 188 |
|
| 189 | return {
|
| 190 | init: initialize
|
| 191 | };
|
| 192 | });
|
| 193 |
|
| 194 | define("voice_call_back", "underscore jquery knockout set service".split(" "),
|
| 195 | function (_, $, ko, config, service) {
|
| 196 | var sc_startpCallbackTimes = [];
|
| 197 | var sc_startpCallbackAttemptTimes = [];
|
| 198 | var sc_startpCallbackAnswerTimes = [];
|
| 199 | var sc_startpCallbackShutdowmTimes = [];
|
| 200 |
|
| 201 | function sf_produceArray(start, end, arryName) {
|
| 202 | var item = {};
|
| 203 | for(var i = start; i <= end; i++) {
|
| 204 | item.name = i;
|
| 205 | item.value = i;
|
| 206 | arryName.push(new Option(item.name, item.value));
|
| 207 | }
|
| 208 | }
|
| 209 |
|
| 210 | sf_produceArray(1, 10, sc_startpCallbackTimes);
|
| 211 | sf_produceArray(1, 10, sc_startpCallbackAttemptTimes);
|
| 212 | sf_produceArray(1, 10, sc_startpCallbackAnswerTimes);
|
| 213 | sf_produceArray(1, 10, sc_startpCallbackShutdowmTimes);
|
| 214 |
|
| 215 | function CallBackVM() {
|
| 216 | var target = this;
|
| 217 | var callBackInfo = service.getCallbackInfo();
|
| 218 |
|
| 219 | target.callBackSetting = ko.observable(callBackInfo.callBackSetting);
|
| 220 | target.callBackTime = ko.observable(parseInt(callBackInfo.callBackTime));
|
| 221 | target.callBackAttemptNumber = ko.observable(parseInt(callBackInfo.callBackAttemptNumber));
|
| 222 | target.callBackAnswerTime = ko.observable(parseInt(callBackInfo.callBackAnswerTime));
|
| 223 | target.callBackShutdownTime = ko.observable(parseInt(callBackInfo.callBackShutdownTime));
|
| 224 | target.scr_back_times = ko.observableArray(sc_startpCallbackTimes);
|
| 225 | target.scr_acc_times = ko.observableArray(sc_startpCallbackAttemptTimes);
|
| 226 | target.scr_answer_times = ko.observableArray(sc_startpCallbackAnswerTimes);
|
| 227 | target.scr_shutdown_times = ko.observableArray(sc_startpCallbackShutdowmTimes);
|
| 228 |
|
| 229 | target.callbackNumbers = ko.observableArray([]);
|
| 230 | getCallbackNumbers();
|
| 231 |
|
| 232 | target.callBackSet = function () {
|
| 233 | showLoading();
|
| 234 | var params = {};
|
| 235 | params.callBackSetting = target.callBackSetting();
|
| 236 | params.callBackTime = target.callBackTime();
|
| 237 | params.callBackAttemptNumber = target.callBackAttemptNumber();
|
| 238 | params.callBackAnswerTime = target.callBackAnswerTime();
|
| 239 | params.callBackShutdownTime = target.callBackShutdownTime();
|
| 240 | service.setCallbackInfo(params, function (result) {
|
| 241 | if (result.result != "success") {
|
| 242 | errorOverlay();
|
| 243 | } else {
|
| 244 | successOverlay();
|
| 245 | }
|
| 246 | });
|
| 247 | };
|
| 248 |
|
| 249 | function getCallbackNumbers() {
|
| 250 | service.getCallbackNumbersInfo({}, function (data) {
|
| 251 | var numbers = data.callbackList || [];
|
| 252 | numbers = numbers.map(function (number) {
|
| 253 | return number.trim();
|
| 254 | });
|
| 255 | target.callbackNumbers(numbers);
|
| 256 | console.log("Successfully loaded callback numbers:", numbers);
|
| 257 | });
|
| 258 | }
|
| 259 |
|
| 260 | target.addNumber = function() {
|
| 261 | var newNumber = $("#newPhoneNumber").val().trim();
|
| 262 | if (newNumber) {
|
| 263 | var numberExists = false;
|
| 264 | for (var i = 0; i < target.callbackNumbers().length; i++) {
|
| 265 | if (target.callbackNumbers()[i] === newNumber) {
|
| 266 | numberExists = true;
|
| 267 | break;
|
| 268 | }
|
| 269 | }
|
| 270 | if (numberExists) {
|
| 271 | showAlert("number_exists");
|
| 272 | return;
|
| 273 | }
|
| 274 |
|
| 275 | if (target.callbackNumbers().length >= 100) {
|
| 276 | showAlert("max_numbers_reached");
|
| 277 | return;
|
| 278 | }
|
| 279 |
|
| 280 | showLoading();
|
| 281 | var params = {};
|
| 282 | params.addNumber = newNumber;
|
| 283 | service.addCallbackNumbers(params, function (result) {
|
| 284 | if (result.result != "success") {
|
| 285 | errorOverlay();
|
| 286 | } else {
|
| 287 | getCallbackNumbers();
|
| 288 | successOverlay();
|
| 289 | }
|
| 290 | });
|
| 291 | }
|
| 292 | };
|
| 293 |
|
| 294 | target.removeNumber = function(index) {
|
| 295 | showConfirm("remove_number", function () {
|
| 296 | showLoading();
|
| 297 | var params = {};
|
| 298 | params.deleteIndex = index + 1;
|
| 299 | service.deleteCallbackNumbers(params, function (result) {
|
| 300 | if (result.result != "success") {
|
| 301 | errorOverlay();
|
| 302 | } else {
|
| 303 | getCallbackNumbers();
|
| 304 | successOverlay();
|
| 305 | }
|
| 306 | });
|
| 307 | });
|
| 308 | };
|
| 309 |
|
| 310 | target.clearAllNumbers = function() {
|
| 311 | showConfirm("clear_numbers", function () {
|
| 312 | showLoading();
|
| 313 | service.clearCallbackNumbers({}, function (result) {
|
| 314 | if (result.result != "success") {
|
| 315 | errorOverlay();
|
| 316 | } else {
|
| 317 | getCallbackNumbers();
|
| 318 | successOverlay();
|
| 319 | }
|
| 320 | });
|
| 321 | });
|
| 322 | };
|
| 323 | }
|
| 324 |
|
| 325 | function initialize() {
|
| 326 | var container = $('#container');
|
| 327 | ko.cleanNode(container[0]);
|
| 328 | var imVm = new CallBackVM();
|
| 329 | ko.applyBindings(imVm, container[0]);
|
| 330 | }
|
| 331 |
|
| 332 | return {
|
| 333 | init: initialize
|
| 334 | };
|
| 335 | });
|
| 336 |
|
| 337 | define("voice_hide_call","underscore jquery knockout set service".split(" "),
|
| 338 | function (_, $, ko, config, service) {
|
| 339 | function CallHideVM() {
|
| 340 | var target = this;
|
| 341 | var callHideInfo = service.getCallHideInfo();
|
| 342 |
|
| 343 | target.callHideSetting = ko.observable(callHideInfo.callHideSetting);
|
| 344 |
|
| 345 | target.callHideSet = function () {
|
| 346 | showLoading();
|
| 347 | var params = {};
|
| 348 | params.callHideSetting = target.callHideSetting();
|
| 349 | service.setCallHideInfo(params, function (result) {
|
| 350 | if (result.result != "success") {
|
| 351 | errorOverlay();
|
| 352 | } else {
|
| 353 | successOverlay();
|
| 354 | }
|
| 355 | });
|
| 356 | };
|
| 357 | }
|
| 358 |
|
| 359 | function initialize() {
|
| 360 | var container = $('#container');
|
| 361 | ko.cleanNode(container[0]);
|
| 362 | var imVm = new CallHideVM();
|
| 363 | ko.applyBindings(imVm, container[0]);
|
| 364 | }
|
| 365 |
|
| 366 | return {
|
| 367 | init: initialize
|
| 368 | };
|
| 369 | });
|
| 370 |
|
| 371 | define("voice_whitelist","underscore jquery knockout set service".split(" "),
|
| 372 | function (_, $, ko, config, service) {
|
| 373 |
|
| 374 | function CallWhiteVM() {
|
| 375 | var target = this;
|
| 376 | var callWhiteInfo = service.getCallWhiteInfo();
|
| 377 |
|
| 378 | target.callingWhiteSetting = ko.observable(callWhiteInfo.callingWhiteSetting);
|
| 379 | target.calledWhiteSetting = ko.observable(callWhiteInfo.calledWhiteSetting);
|
| 380 | target.callingWhiteNumbers = ko.observableArray([]);
|
| 381 | target.calledWhiteNumbers = ko.observableArray([]);
|
| 382 | getCallingWhiteNumbers();
|
| 383 | getCalledWhiteNumbers();
|
| 384 |
|
| 385 | target.callWhiteSet = function () {
|
| 386 | showLoading();
|
| 387 | var params = {};
|
| 388 | params.callingWhiteSetting = target.callingWhiteSetting();
|
| 389 | params.calledWhiteSetting = target.calledWhiteSetting();
|
| 390 | service.setCallWhiteInfo(params, function (result) {
|
| 391 | if (result.result != "success") {
|
| 392 | errorOverlay();
|
| 393 | } else {
|
| 394 | successOverlay();
|
| 395 | }
|
| 396 | });
|
| 397 | };
|
| 398 |
|
| 399 | function getCallingWhiteNumbers() {
|
| 400 | service.getCallingWhiteNumbersInfo({}, function (data) {
|
| 401 | var numbers = data.callingList || [];
|
| 402 | numbers = numbers.map(function (number) {
|
| 403 | return number.trim();
|
| 404 | });
|
| 405 | target.callingWhiteNumbers(numbers);
|
| 406 | console.log("Successfully loaded calling white numbers:", numbers);
|
| 407 | });
|
| 408 | }
|
| 409 |
|
| 410 | target.addCallingNumber = function() {
|
| 411 | var newNumber = $("#newCallingNumber").val().trim();
|
| 412 | if (newNumber) {
|
| 413 | var numberExists = false;
|
| 414 | for (var i = 0; i < target.callingWhiteNumbers().length; i++) {
|
| 415 | if (target.callingWhiteNumbers()[i] === newNumber) {
|
| 416 | numberExists = true;
|
| 417 | break;
|
| 418 | }
|
| 419 | }
|
| 420 | if (numberExists) {
|
| 421 | showAlert("number_exists");
|
| 422 | return;
|
| 423 | }
|
| 424 |
|
| 425 | if (target.callingWhiteNumbers().length >= 25) {
|
| 426 | showAlert("max_numbers_reached");
|
| 427 | return;
|
| 428 | }
|
| 429 |
|
| 430 | showLoading();
|
| 431 | var params = {};
|
| 432 | params.addNumber = newNumber;
|
| 433 | service.addCallingWhiteNumbers(params, function (result) {
|
| 434 | if (result.result != "success") {
|
| 435 | errorOverlay();
|
| 436 | } else {
|
| 437 | getCallingWhiteNumbers();
|
| 438 | successOverlay();
|
| 439 | }
|
| 440 | });
|
| 441 | }
|
| 442 | };
|
| 443 |
|
| 444 | target.removeCallingNumber = function(index) {
|
| 445 | showConfirm("remove_number", function () {
|
| 446 | showLoading();
|
| 447 | var params = {};
|
| 448 | params.deleteIndex = index + 1;
|
| 449 | service.deleteCallingWhiteNumbers(params, function (result) {
|
| 450 | if (result.result != "success") {
|
| 451 | errorOverlay();
|
| 452 | } else {
|
| 453 | getCallingWhiteNumbers();
|
| 454 | successOverlay();
|
| 455 | }
|
| 456 | });
|
| 457 | });
|
| 458 | };
|
| 459 |
|
| 460 | target.clearCallingNumbers = function() {
|
| 461 | showConfirm("clear_numbers", function () {
|
| 462 | showLoading();
|
| 463 | service.clearCallingWhiteNumbers({}, function (result) {
|
| 464 | if (result.result != "success") {
|
| 465 | errorOverlay();
|
| 466 | } else {
|
| 467 | getCallingWhiteNumbers();
|
| 468 | successOverlay();
|
| 469 | }
|
| 470 | });
|
| 471 | });
|
| 472 | };
|
| 473 |
|
| 474 | function getCalledWhiteNumbers() {
|
| 475 | service.getCalledWhiteNumbersInfo({}, function (data) {
|
| 476 | var numbers = data.calledList || [];
|
| 477 | numbers = numbers.map(function (number) {
|
| 478 | return number.trim();
|
| 479 | });
|
| 480 | target.calledWhiteNumbers(numbers);
|
| 481 | console.log("Successfully loaded called white numbers:", numbers);
|
| 482 | });
|
| 483 | }
|
| 484 |
|
| 485 | target.addCalledNumber = function() {
|
| 486 | var newNumber = $("#newCalledNumber").val().trim();
|
| 487 | if (newNumber) {
|
| 488 | var numberExists = false;
|
| 489 | for (var i = 0; i < target.calledWhiteNumbers().length; i++) {
|
| 490 | if (target.calledWhiteNumbers()[i] === newNumber) {
|
| 491 | numberExists = true;
|
| 492 | break;
|
| 493 | }
|
| 494 | }
|
| 495 | if (numberExists) {
|
| 496 | showAlert("number_exists");
|
| 497 | return;
|
| 498 | }
|
| 499 |
|
| 500 | if (target.calledWhiteNumbers().length >= 25) {
|
| 501 | showAlert("max_numbers_reached");
|
| 502 | return;
|
| 503 | }
|
| 504 |
|
| 505 | showLoading();
|
| 506 | var params = {};
|
| 507 | params.addNumber = newNumber;
|
| 508 | service.addCalledWhiteNumbers(params, function (result) {
|
| 509 | if (result.result != "success") {
|
| 510 | errorOverlay();
|
| 511 | } else {
|
| 512 | getCalledWhiteNumbers();
|
| 513 | successOverlay();
|
| 514 | }
|
| 515 | });
|
| 516 | }
|
| 517 | };
|
| 518 |
|
| 519 | target.removeCalledNumber = function(index) {
|
| 520 | showConfirm("remove_number", function () {
|
| 521 | showLoading();
|
| 522 | var params = {};
|
| 523 | params.deleteIndex = index + 1;
|
| 524 | service.deleteCalledWhiteNumbers(params, function (result) {
|
| 525 | if (result.result != "success") {
|
| 526 | errorOverlay();
|
| 527 | } else {
|
| 528 | getCalledWhiteNumbers();
|
| 529 | successOverlay();
|
| 530 | }
|
| 531 | });
|
| 532 | });
|
| 533 | };
|
| 534 |
|
| 535 | target.clearCalledNumbers = function() {
|
| 536 | showConfirm("clear_numbers", function () {
|
| 537 | showLoading();
|
| 538 | service.clearCalledWhiteNumbers({}, function (result) {
|
| 539 | if (result.result != "success") {
|
| 540 | errorOverlay();
|
| 541 | } else {
|
| 542 | getCalledWhiteNumbers();
|
| 543 | successOverlay();
|
| 544 | }
|
| 545 | });
|
| 546 | });
|
| 547 | };
|
| 548 | }
|
| 549 |
|
| 550 | function initialize() {
|
| 551 | var container = $('#container');
|
| 552 | ko.cleanNode(container[0]);
|
| 553 | var imVm = new CallWhiteVM();
|
| 554 | ko.applyBindings(imVm, container[0]);
|
| 555 | }
|
| 556 |
|
| 557 | return {
|
| 558 | init: initialize
|
| 559 | };
|
| 560 | });
|
| 561 |
|
| 562 | define("voice_blacklist","underscore jquery knockout set service".split(" "),
|
| 563 | function (_, $, ko, config, service) {
|
| 564 |
|
| 565 | function CallBlackVM() {
|
| 566 | var target = this;
|
| 567 | var callBlackInfo = service.getCallBlackInfo();
|
| 568 |
|
| 569 | target.callingBlackSetting = ko.observable(callBlackInfo.callingBlackSetting);
|
| 570 | target.calledBlackSetting = ko.observable(callBlackInfo.calledBlackSetting);
|
| 571 | target.callingBlackNumbers = ko.observableArray([]);
|
| 572 | target.calledBlackNumbers = ko.observableArray([]);
|
| 573 | getCallingBlackNumbers();
|
| 574 | getCalledBlackNumbers();
|
| 575 |
|
| 576 | target.callBlackSet = function () {
|
| 577 | showLoading();
|
| 578 | var params = {};
|
| 579 | params.callingBlackSetting = target.callingBlackSetting();
|
| 580 | params.calledBlackSetting = target.calledBlackSetting();
|
| 581 | service.setCallBlackInfo(params, function (result) {
|
| 582 | if (result.result != "success") {
|
| 583 | errorOverlay();
|
| 584 | } else {
|
| 585 | successOverlay();
|
| 586 | }
|
| 587 | });
|
| 588 | };
|
| 589 |
|
| 590 | function getCallingBlackNumbers() {
|
| 591 | service.getCallingBlackNumbersInfo({}, function (data) {
|
| 592 | var numbers = data.callingList || [];
|
| 593 | numbers = numbers.map(function (number) {
|
| 594 | return number.trim();
|
| 595 | });
|
| 596 | target.callingBlackNumbers(numbers);
|
| 597 | console.log("Successfully loaded calling white numbers:", numbers);
|
| 598 | });
|
| 599 | }
|
| 600 |
|
| 601 | target.addCallingNumber = function() {
|
| 602 | var newNumber = $("#newCallingNumber").val().trim();
|
| 603 | if (newNumber) {
|
| 604 | var numberExists = false;
|
| 605 | for (var i = 0; i < target.callingBlackNumbers().length; i++) {
|
| 606 | if (target.callingBlackNumbers()[i] === newNumber) {
|
| 607 | numberExists = true;
|
| 608 | break;
|
| 609 | }
|
| 610 | }
|
| 611 | if (numberExists) {
|
| 612 | showAlert("number_exists");
|
| 613 | return;
|
| 614 | }
|
| 615 |
|
| 616 | if (target.callingBlackNumbers().length >= 25) {
|
| 617 | showAlert("max_numbers_reached");
|
| 618 | return;
|
| 619 | }
|
| 620 |
|
| 621 | showLoading();
|
| 622 | var params = {};
|
| 623 | params.addNumber = newNumber;
|
| 624 | service.addCallingBlackNumbers(params, function (result) {
|
| 625 | if (result.result != "success") {
|
| 626 | errorOverlay();
|
| 627 | } else {
|
| 628 | getCallingBlackNumbers();
|
| 629 | successOverlay();
|
| 630 | }
|
| 631 | });
|
| 632 | }
|
| 633 | };
|
| 634 |
|
| 635 | target.removeCallingNumber = function(index) {
|
| 636 | showConfirm("remove_number", function () {
|
| 637 | showLoading();
|
| 638 | var params = {};
|
| 639 | params.deleteIndex = index + 1;
|
| 640 | service.deleteCallingBlackNumbers(params, function (result) {
|
| 641 | if (result.result != "success") {
|
| 642 | errorOverlay();
|
| 643 | } else {
|
| 644 | getCallingBlackNumbers();
|
| 645 | successOverlay();
|
| 646 | }
|
| 647 | });
|
| 648 | });
|
| 649 | };
|
| 650 |
|
| 651 | target.clearCallingNumbers = function() {
|
| 652 | showConfirm("clear_numbers", function () {
|
| 653 | showLoading();
|
| 654 | service.clearCallingBlackNumbers({}, function (result) {
|
| 655 | if (result.result != "success") {
|
| 656 | errorOverlay();
|
| 657 | } else {
|
| 658 | getCallingBlackNumbers();
|
| 659 | successOverlay();
|
| 660 | }
|
| 661 | });
|
| 662 | });
|
| 663 | };
|
| 664 |
|
| 665 | function getCalledBlackNumbers() {
|
| 666 | service.getCalledBlackNumbersInfo({}, function (data) {
|
| 667 | var numbers = data.calledList || [];
|
| 668 | numbers = numbers.map(function (number) {
|
| 669 | return number.trim();
|
| 670 | });
|
| 671 | target.calledBlackNumbers(numbers);
|
| 672 | console.log("Successfully loaded called white numbers:", numbers);
|
| 673 | });
|
| 674 | }
|
| 675 |
|
| 676 | target.addCalledNumber = function() {
|
| 677 | var newNumber = $("#newCalledNumber").val().trim();
|
| 678 | if (newNumber) {
|
| 679 | var numberExists = false;
|
| 680 | for (var i = 0; i < target.calledBlackNumbers().length; i++) {
|
| 681 | if (target.calledBlackNumbers()[i] === newNumber) {
|
| 682 | numberExists = true;
|
| 683 | break;
|
| 684 | }
|
| 685 | }
|
| 686 | if (numberExists) {
|
| 687 | showAlert("number_exists");
|
| 688 | return;
|
| 689 | }
|
| 690 |
|
| 691 | if (target.calledBlackNumbers().length >= 25) {
|
| 692 | showAlert("max_numbers_reached");
|
| 693 | return;
|
| 694 | }
|
| 695 |
|
| 696 | showLoading();
|
| 697 | var params = {};
|
| 698 | params.addNumber = newNumber;
|
| 699 | service.addCalledBlackNumbers(params, function (result) {
|
| 700 | if (result.result != "success") {
|
| 701 | errorOverlay();
|
| 702 | } else {
|
| 703 | getCalledBlackNumbers();
|
| 704 | successOverlay();
|
| 705 | }
|
| 706 | });
|
| 707 | }
|
| 708 | };
|
| 709 |
|
| 710 | target.removeCalledNumber = function(index) {
|
| 711 | showConfirm("remove_number", function () {
|
| 712 | showLoading();
|
| 713 | var params = {};
|
| 714 | params.deleteIndex = index + 1;
|
| 715 | service.deleteCalledBlackNumbers(params, function (result) {
|
| 716 | if (result.result != "success") {
|
| 717 | errorOverlay();
|
| 718 | } else {
|
| 719 | getCalledBlackNumbers();
|
| 720 | successOverlay();
|
| 721 | }
|
| 722 | });
|
| 723 | });
|
| 724 | };
|
| 725 |
|
| 726 | target.clearCalledNumbers = function() {
|
| 727 | showConfirm("clear_numbers", function () {
|
| 728 | showLoading();
|
| 729 | service.clearCalledBlackNumbers({}, function (result) {
|
| 730 | if (result.result != "success") {
|
| 731 | errorOverlay();
|
| 732 | } else {
|
| 733 | getCalledBlackNumbers();
|
| 734 | successOverlay();
|
| 735 | }
|
| 736 | });
|
| 737 | });
|
| 738 | };
|
| 739 | }
|
| 740 |
|
| 741 | function initialize() {
|
| 742 | var container = $('#container');
|
| 743 | ko.cleanNode(container[0]);
|
| 744 | var imVm = new CallBlackVM();
|
| 745 | ko.applyBindings(imVm, container[0]);
|
| 746 | }
|
| 747 |
|
| 748 | return {
|
| 749 | init: initialize
|
| 750 | };
|
| 751 | });
|
| 752 |
|
| 753 | define("voice_call_forwarding","underscore jquery knockout set service".split(" "),
|
| 754 | function (_, $, ko, config, service) {
|
| 755 |
|
| 756 | function CallForwardVM() {
|
| 757 | var target = this;
|
| 758 | var callForwardAllInfo = service.getCallForwardAllInfo();
|
| 759 | var callNoAnswerInfo = service.getCallNoAnswerInfo();
|
| 760 | var callNoReachInfo = service.getCallNoReachInfo();
|
| 761 | var callBusyInfo = service.getCallBusyInfo();
|
| 762 |
|
| 763 | target.forwardAllNumber = ko.observable(callForwardAllInfo.forwardAllNumber);
|
| 764 | target.forwardNoAnswerNumber = ko.observable(callNoAnswerInfo.forwardNoAnswerNumber);
|
| 765 | target.forwardNoReachNumber = ko.observable(callNoReachInfo.forwardNoReachNumber);
|
| 766 | target.forwardBusyNumber = ko.observable(callBusyInfo.forwardBusyNumber);
|
| 767 |
|
| 768 | target.forwardAllSet = function () {
|
| 769 | showLoading();
|
| 770 | var params = {};
|
| 771 | params.forwardAllNumber = target.forwardAllNumber();
|
| 772 | service.setCallForwardAllInfo(params, function (result) {
|
| 773 | if (result.result != "success") {
|
| 774 | errorOverlay();
|
| 775 | } else {
|
| 776 | successOverlay();
|
| 777 | }
|
| 778 | });
|
| 779 | };
|
| 780 |
|
| 781 | target.forwardNoAnswerSet = function () {
|
| 782 | showLoading();
|
| 783 | var params = {};
|
| 784 | params.forwardNoAnswerNumber = target.forwardNoAnswerNumber();
|
| 785 | service.setCallNoAnswerInfo(params, function (result) {
|
| 786 | if (result.result != "success") {
|
| 787 | errorOverlay();
|
| 788 | } else {
|
| 789 | successOverlay();
|
| 790 | }
|
| 791 | });
|
| 792 | };
|
| 793 |
|
| 794 | target.forwardNoReachSet = function () {
|
| 795 | showLoading();
|
| 796 | var params = {};
|
| 797 | params.forwardNoReachNumber = target.forwardNoReachNumber();
|
| 798 | service.setCallNoReachInfo(params, function (result) {
|
| 799 | if (result.result != "success") {
|
| 800 | errorOverlay();
|
| 801 | } else {
|
| 802 | successOverlay();
|
| 803 | }
|
| 804 | });
|
| 805 | };
|
| 806 |
|
| 807 | target.forwardBusySet = function () {
|
| 808 | showLoading();
|
| 809 | var params = {};
|
| 810 | params.forwardBusyNumber = target.forwardBusyNumber();
|
| 811 | service.setCallBusyInfo(params, function (result) {
|
| 812 | if (result.result != "success") {
|
| 813 | errorOverlay();
|
| 814 | } else {
|
| 815 | successOverlay();
|
| 816 | }
|
| 817 | });
|
| 818 | };
|
| 819 | }
|
| 820 |
|
| 821 | function initialize() {
|
| 822 | var container = $('#container');
|
| 823 | ko.cleanNode(container[0]);
|
| 824 | var imVm = new CallForwardVM();
|
| 825 | ko.applyBindings(imVm, container[0]);
|
| 826 | }
|
| 827 |
|
| 828 | return {
|
| 829 | init: initialize
|
| 830 | };
|
| 831 | });
|
| 832 |
|
| 833 | define("voice_call_lock","underscore jquery knockout set service".split(" "),
|
| 834 | function (_, $, ko, config, service) {
|
| 835 |
|
| 836 | function CallLockVM() {
|
| 837 | var target = this;
|
| 838 | var callingLockInfo = service.getCallingLockInfo();
|
| 839 | var calledLockInfo = service.getCalledLockInfo();
|
| 840 |
|
| 841 | target.localCallLockSetting = ko.observable(callingLockInfo.localCallLockSetting);
|
| 842 | target.dddCallLockSetting = ko.observable(callingLockInfo.dddCallLockSetting);
|
| 843 | target.ddiCallLockSetting = ko.observable(callingLockInfo.ddiCallLockSetting);
|
| 844 | target.receiveCallLockSetting = ko.observable(calledLockInfo.receiveCallLockSetting);
|
| 845 |
|
| 846 | target.callingLockSet = function () {
|
| 847 | showLoading();
|
| 848 | var params = {};
|
| 849 | params.localCallLockSetting = target.localCallLockSetting();
|
| 850 | params.dddCallLockSetting = target.dddCallLockSetting();
|
| 851 | params.ddiCallLockSetting = target.ddiCallLockSetting();
|
| 852 | service.setCallingLockInfo(params, function (result) {
|
| 853 | if (result.result != "success") {
|
| 854 | errorOverlay();
|
| 855 | } else {
|
| 856 | successOverlay();
|
| 857 | }
|
| 858 | });
|
| 859 | };
|
| 860 |
|
| 861 | target.calledLockSet = function () {
|
| 862 | showLoading();
|
| 863 | var params = {};
|
| 864 | params.receiveCallLockSetting = target.receiveCallLockSetting();
|
| 865 | service.setCalledLockInfo(params, function (result) {
|
| 866 | if (result.result != "success") {
|
| 867 | errorOverlay();
|
| 868 | } else {
|
| 869 | successOverlay();
|
| 870 | }
|
| 871 | });
|
| 872 | };
|
| 873 | }
|
| 874 |
|
| 875 | function initialize() {
|
| 876 | var container = $('#container');
|
| 877 | ko.cleanNode(container[0]);
|
| 878 | var imVm = new CallLockVM();
|
| 879 | ko.applyBindings(imVm, container[0]);
|
| 880 | }
|
| 881 |
|
| 882 | return {
|
| 883 | init: initialize
|
| 884 | };
|
| 885 | });
|
| 886 |
|
| 887 | define("voice_csp","underscore jquery knockout set service".split(" "),
|
| 888 | function (_, $, ko, config, service) {
|
| 889 |
|
| 890 | function CallCspVM() {
|
| 891 | var target = this;
|
| 892 | var callCspInfo = service.getCallCspInfo();
|
| 893 |
|
| 894 | target.cspSetting = ko.observable(callCspInfo.cspSetting);
|
| 895 | target.cspNumber = ko.observable(callCspInfo.cspNumber);
|
| 896 |
|
| 897 | target.cspSet = function () {
|
| 898 | showLoading();
|
| 899 | var params = {};
|
| 900 | params.cspSetting = target.cspSetting();
|
| 901 | params.cspNumber = target.cspNumber();
|
| 902 | service.setCallCspInfo(params, function (result) {
|
| 903 | if (result.result != "success") {
|
| 904 | errorOverlay();
|
| 905 | } else {
|
| 906 | successOverlay();
|
| 907 | }
|
| 908 | });
|
| 909 | };
|
| 910 | }
|
| 911 |
|
| 912 | function initialize() {
|
| 913 | var container = $('#container');
|
| 914 | ko.cleanNode(container[0]);
|
| 915 | var imVm = new CallCspVM();
|
| 916 | ko.applyBindings(imVm, container[0]);
|
| 917 | }
|
| 918 |
|
| 919 | return {
|
| 920 | init: initialize
|
| 921 | };
|
| 922 | }); |