PageRenderTime 35ms CodeModel.GetById 8ms RepoModel.GetById 0ms app.codeStats 0ms

/crm/symfony/src/MDR/PuntoVentaBundle/Resources/public/js/nuxibaCalls.js

https://gitlab.com/Alberto.SS/crm_verquet
JavaScript | 40 lines | 37 code | 3 blank | 0 comment | 5 complexity | ddc4582bdc1b99cc0e46a77ed257ab11 MD5 | raw file
  1. var EstatusNuxibaCall = {atendida:1, posponer: 2};
  2. var NuxibaCall = Backbone.Model.extend({
  3. initialize: function(){
  4. },
  5. defaults: {
  6. DNIS: '',
  7. phoneNumber: '',
  8. esEntrante: 0,
  9. callId: 0
  10. }
  11. });
  12. var NuxibaCallCollection = Backbone.Collection.extend({
  13. model: NuxibaCall,
  14. localStorage: new Backbone.LocalStorage("NuxibaCallsBackbone"),
  15. byEstatus: function(estatus) {
  16. filtered = this.filter(function(nuxibaCall) {
  17. return nuxibaCall.get('estatus') == estatus;
  18. });
  19. return new NuxibaCallCollection(filtered);
  20. },
  21. byCallId: function(callId)
  22. {
  23. filtered = this.filter(function(nuxibaCall) {
  24. return nuxibaCall.get('callId') == callId;
  25. });
  26. return new NuxibaCallCollection(filtered);
  27. },
  28. byPhoneNumberType: function(number, esEntrante)
  29. {
  30. number = quitarLada(number);
  31. filtered = this.filter(function(nuxibaCall) {
  32. return quitarLada(nuxibaCall.get('phoneNumber')) == number && nuxibaCall.get('esEntrante') == esEntrante;
  33. });
  34. return new NuxibaCallCollection(filtered);
  35. }
  36. });
  37. var nuxibaCalls = new NuxibaCallCollection();