forked from DGNum/gestioCOF
Use Set() natively
This commit is contained in:
parent
e54324e9f1
commit
50cb6e51a1
1 changed files with 3 additions and 4 deletions
|
@ -134,7 +134,7 @@ $(document).ready(function() {
|
|||
* Websocket
|
||||
*/
|
||||
|
||||
var conflicts = [];
|
||||
var conflicts = new Set();
|
||||
var websocket_msg_default = {'articles':[]}
|
||||
|
||||
var websocket_protocol = window.location.protocol == 'https:' ? 'wss' : 'ws';
|
||||
|
@ -146,7 +146,7 @@ $(document).ready(function() {
|
|||
for (let article of data['articles']) {
|
||||
var $line = $('input[value="'+article.id+'"]').parent();
|
||||
if ($line.find('.finished input').is(":checked")) {
|
||||
conflicts.push(article.id);
|
||||
conflicts.add(article.id);
|
||||
//Display warning
|
||||
$line.addClass('inventory_modified');
|
||||
|
||||
|
@ -166,9 +166,8 @@ $(document).ready(function() {
|
|||
$('input[type="submit"]').on("click", function(e) {
|
||||
console.log(e.keyCode);
|
||||
e.preventDefault();
|
||||
conflicts = [...new Set(conflicts)]; //remove duplicates
|
||||
|
||||
if (conflicts.length) {
|
||||
if (conflicts.size) {
|
||||
content = '';
|
||||
content += "Conflits possibles :"
|
||||
content += '<ul>';
|
||||
|
|
Loading…
Reference in a new issue