Skip to content

Commit

Permalink
feat(ZMS-1632): merge into main
Browse files Browse the repository at this point in the history
  • Loading branch information
manjencic committed Dec 18, 2023
2 parents 5ed1222 + 3e6f8e7 commit 3f6e92c
Show file tree
Hide file tree
Showing 4 changed files with 1,449 additions and 28 deletions.
35 changes: 35 additions & 0 deletions zmscalldisplay/js/block/queueList.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ class View extends BaseView {
this.hideMessages(0);
$('#queueImport').html(data);
var audioCheck = new RingAudio();

// currently the logic to detect new queue ids is located in the RingAudio
// we should probably pull this functionality out of RingAudio and refactor it.
let newIds = audioCheck.getNewQueueIds();
newIds.forEach((id) => {
var spansToBlink = $('span[data-appointment="' + id + '"]');
this.blinkElements(spansToBlink, 3, 900);
});

audioCheck.initSoundCheck();
this.getDestinationToNumber();
})
Expand Down Expand Up @@ -67,6 +76,32 @@ class View extends BaseView {
}, delay)
}
}

async blinkElements(elements, blinkCount, blinkTime) {
var blinkColor = 'rgb(27, 152, 213)';

const blinkAllOnce = async () => {
// Store the original colors for each element
const originalColors = elements.map(function() {
return $(this).css('color');
});

// Set all elements to the blink color
elements.css('color', blinkColor);
await new Promise(resolve => setTimeout(resolve, blinkTime));

// Reset all elements to their original colors
elements.each(function(index) {
$(this).css('color', originalColors[index]);
});
await new Promise(resolve => setTimeout(resolve, blinkTime));
};

for (let i = 0; i < blinkCount; i++) {
await blinkAllOnce();
}
}

}

export default View;
8 changes: 6 additions & 2 deletions zmscalldisplay/js/block/ringAudio.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ class View extends BaseView {
this.writeCalledQueueIds(newQueueIds);
}

hasNewQueueId() {
getNewQueueIds() {
let newQueueIds = this.getCalledQueueIds();
let oldQueueIds = window.bo.zmscalldisplay.queue.calledIds;
let diff = $(newQueueIds).not(oldQueueIds).get();
return (0 < diff.length);
return diff;
}

hasNewQueueId() {
return (0 < this.getNewQueueIds().length);
}

getCalledQueueIds() {
Expand Down
1,432 changes: 1,407 additions & 25 deletions zmscalldisplay/public/_js/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion zmscalldisplay/public/_js/index.js.map

Large diffs are not rendered by default.

0 comments on commit 3f6e92c

Please sign in to comment.