Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- consultantsChannel.onsignal = function(e) {
- console.log('received signal ' + JSON.stringify(e.data));
- var packet;
- try {
- packet = JSON.parse(e.data);
- } catch (e) {
- console.log('Unable to parse data. - consultantsChannel');
- return;
- }
- // fast consult
- if(packet.type == '".Signal::CONSULT_REQUEST."' && is_available && !during_consult) {
- $('#consult-accept').data('hash', packet.data.hash);
- $('#consult-request-modal .symptoms').text(packet.data.symptoms);
- // for all consultants
- if(packet.data.docId == null) {
- if(is_employee && packet.data.iteration == 1){
- $('#consult-request-modal').modal('show');
- playSound();
- }
- else if(!is_employee && packet.data.iteration > 1){
- $('#consult-request-modal').modal('show');
- playSound();
- }
- }
- //selected consultant
- else if (packet.data.docId != null && packet.data.docId == user_id) {
- $('#consult-request-modal').modal('show');
- playSound();
- }
- }
- else if(packet.type == '".Signal::CONSULT_ACCEPT."') {
- $('#consult-request-modal').modal('hide');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement