Advertisement
eerrtt

Untitled

Dec 17th, 2014
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. consultantsChannel.onsignal = function(e) {
  2.         console.log('received signal ' + JSON.stringify(e.data));
  3.  
  4.         var packet;
  5.         try {
  6.             packet = JSON.parse(e.data);
  7.         } catch (e) {
  8.             console.log('Unable to parse data. - consultantsChannel');
  9.             return;
  10.         }
  11.         // fast consult
  12.        
  13.         if(packet.type == '".Signal::CONSULT_REQUEST."' && is_available && !during_consult) {
  14.             $('#consult-accept').data('hash', packet.data.hash);
  15.             $('#consult-request-modal .symptoms').text(packet.data.symptoms);
  16.            
  17.             // for all consultants
  18.             if(packet.data.docId == null) {
  19.                 if(is_employee  && packet.data.iteration == 1){
  20.                     $('#consult-request-modal').modal('show');
  21.                     playSound();
  22.                 }
  23.                 else if(!is_employee && packet.data.iteration > 1){
  24.                     $('#consult-request-modal').modal('show');
  25.                     playSound();
  26.                 }
  27.             }
  28.             //selected consultant
  29.             else if (packet.data.docId != null && packet.data.docId == user_id) {
  30.            
  31.                     $('#consult-request-modal').modal('show');
  32.                     playSound();
  33.             }
  34.            
  35.         }
  36.         else if(packet.type == '".Signal::CONSULT_ACCEPT."') {
  37.             $('#consult-request-modal').modal('hide');
  38.         }
  39.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement