Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zms 1632 blink new queue items #52

Merged
merged 2 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading
Loading