205 lines
7.9 KiB
JavaScript
205 lines
7.9 KiB
JavaScript
define([
|
|
'dojo/_base/array',
|
|
'dojo/dom-class',
|
|
'nuhjs/comparatore/main/columset/nuh_columnsets',
|
|
'dojo/domReady!'
|
|
], function (arrayUtil, domClass, nuh_columnsets) {
|
|
return {
|
|
alarm_label_red: function () {
|
|
let bg = 1 == LOCALSCOPE.alarm_level_active ? ' bg-black' : ''
|
|
let label =
|
|
'<span class="tab-icon-space"><i class="fas fa-exclamation-triangle nuhred"></i></span><span class="alarm-label-space"> (' +
|
|
LOCALSCOPE.alarms.a +
|
|
') Red</span> <span class="float-right border-box-market snuf-g-small ' +
|
|
bg +
|
|
'">' +
|
|
LOCALSCOPE.alarm_a +
|
|
'</span>'
|
|
if (dijit.byId('alarm_color_1'))
|
|
dijit.byId('alarm_color_1').set('label', label)
|
|
},
|
|
alarm_label_orange: function () {
|
|
if (LOCALSCOPE.alarm_b < LOCALSCOPE.alarm_a) {
|
|
let bg = 2 == LOCALSCOPE.alarm_level_active ? ' bg-black' : ''
|
|
let label =
|
|
'<span class="tab-icon-space"><i class="fas fa-exclamation-triangle nuhorange"></i></span><span class="alarm-label-space"> (' +
|
|
LOCALSCOPE.alarms.b +
|
|
') Orange</span> <span class="float-right border-box-market snuf-g-small ' +
|
|
bg +
|
|
'">' +
|
|
LOCALSCOPE.alarm_b +
|
|
'</span>'
|
|
if (dijit.byId('alarm_color_2'))
|
|
dijit.byId('alarm_color_2').set('label', label)
|
|
}
|
|
},
|
|
alarm_label_yellow: function () {
|
|
if (LOCALSCOPE.alarm_c < LOCALSCOPE.alarm_b) {
|
|
let bg = 3 == LOCALSCOPE.alarm_level_active ? ' bg-black' : ''
|
|
let label =
|
|
'<span class="tab-icon-space"><i class="fas fa-exclamation-triangle nuhgelb"></i></span><span class="alarm-label-space"> (' +
|
|
LOCALSCOPE.alarms.c +
|
|
') Yellow</span> <span class="float-right border-box-market snuf-g-small ' +
|
|
bg +
|
|
'">' +
|
|
LOCALSCOPE.alarm_c +
|
|
'</span>'
|
|
if (dijit.byId('alarm_color_3'))
|
|
dijit.byId('alarm_color_3').set('label', label)
|
|
}
|
|
},
|
|
alarm_label_green: function () {
|
|
if (LOCALSCOPE.alarm_d < LOCALSCOPE.alarm_c) {
|
|
let bg = 4 == LOCALSCOPE.alarm_level_active ? ' bg-black' : ''
|
|
let label =
|
|
'<span class="tab-icon-space"><i class="fas fa-exclamation-triangle nuhgreen"></i></span><span class="alarm-label-space"> (' +
|
|
LOCALSCOPE.alarms.d +
|
|
') Green</span> <span class="float-right border-box-market snuf-g-small ' +
|
|
bg +
|
|
'">' +
|
|
LOCALSCOPE.alarm_d +
|
|
'</span>'
|
|
if (dijit.byId('alarm_color_4'))
|
|
dijit.byId('alarm_color_4').set('label', label)
|
|
}
|
|
},
|
|
alarm_label_top: function () {
|
|
let color, num, str
|
|
switch (LOCALSCOPE.alarm_level_active) {
|
|
case 1:
|
|
str = 'Red '
|
|
color = 'nuhrot'
|
|
num = LOCALSCOPE.alarms.a
|
|
break
|
|
case 2:
|
|
str = 'Orange '
|
|
color = 'nuhorange'
|
|
num = LOCALSCOPE.alarms.b
|
|
break
|
|
case 3:
|
|
str = 'Yellow '
|
|
color = 'nuhgelb'
|
|
num = LOCALSCOPE.alarms.c
|
|
break
|
|
case 4:
|
|
str = 'Green '
|
|
color = 'nuhgreen'
|
|
num = LOCALSCOPE.alarms.d
|
|
break
|
|
}
|
|
|
|
let label =
|
|
'<i class="fas fa-exclamation-triangle ' +
|
|
color +
|
|
'"></i>' +
|
|
str +
|
|
LOCALSCOPE.alarm_market_active.toUpperCase() +
|
|
' (' +
|
|
num +
|
|
')'
|
|
if (LOCALSCOPE.filter_switch == 'alarm') {
|
|
domClass.add('popup_alarm', 'set-active')
|
|
} else {
|
|
domClass.remove('popup_alarm', 'set-active')
|
|
}
|
|
// topmenu
|
|
dijit.byId('popup_alarm').set('label', label)
|
|
//in Managment Menu force alarms
|
|
if (LOCALSCOPE.hasfeed == 1) {
|
|
dijit
|
|
.byId('force_alarms_menu')
|
|
.set(
|
|
'label',
|
|
'<i class="fa fa-arrow-right"></i> Force ' + label
|
|
)
|
|
}
|
|
},
|
|
market_label: function (item) {
|
|
if (dijit.byId('market_' + item.market) != undefined) {
|
|
let activebg =
|
|
LOCALSCOPE.alarm_market_active == item.market ? ' bg-black' : ''
|
|
let label =
|
|
'Market</span><span class="float-right alarm-label-space border-box-market ' +
|
|
activebg +
|
|
'">' +
|
|
item.market.toUpperCase() +
|
|
'</span>'
|
|
dijit.byId('market_' + item.market).set('label', label)
|
|
}
|
|
},
|
|
compare_odds: function (
|
|
id,
|
|
disabled,
|
|
smart,
|
|
market_odd,
|
|
client_odd,
|
|
market_all,
|
|
client_all
|
|
) {
|
|
if (
|
|
disabled ||
|
|
market_odd == undefined ||
|
|
market_odd == 0 ||
|
|
client_odd == undefined ||
|
|
client_odd == 0
|
|
) {
|
|
return false
|
|
}
|
|
|
|
// if (
|
|
// (LOCALSCOPE.alarm_proportional_or_direct == 0 || smart) &&
|
|
// market_all > 0 &&
|
|
// client_all > 0
|
|
// ) {
|
|
// market_odd = (market_odd * market_all) / (client_all - 3)
|
|
// }
|
|
|
|
// if (LOCALSCOPE.alarm_proportional_or_direct == 0) {
|
|
// // proportional
|
|
// p = 1 / market_odd - 1 / client_odd
|
|
// } else {
|
|
// // direct
|
|
// p = client_odd - market_odd
|
|
// }
|
|
|
|
p = client_odd - market_odd
|
|
if (p >= LOCALSCOPE.alarm_a) {
|
|
LOCALSCOPE.alarms.a++
|
|
if (LOCALSCOPE.alarm_level_active == 1) return 1
|
|
} else if (p < LOCALSCOPE.alarm_a && p >= LOCALSCOPE.alarm_b) {
|
|
LOCALSCOPE.alarms.b++
|
|
if (LOCALSCOPE.alarm_level_active == 2) return 1
|
|
} else if (p < LOCALSCOPE.alarm_b && p >= LOCALSCOPE.alarm_c) {
|
|
LOCALSCOPE.alarms.c++
|
|
if (LOCALSCOPE.alarm_level_active == 3) return 1
|
|
} else if (p < LOCALSCOPE.alarm_c && p >= LOCALSCOPE.alarm_d) {
|
|
LOCALSCOPE.alarms.d++
|
|
if (LOCALSCOPE.alarm_level_active == 4) return 1
|
|
}
|
|
return 0
|
|
},
|
|
go_to_set: function () {
|
|
if (LOCALSCOPE.sportid >= 100) {
|
|
return
|
|
}
|
|
var set = 1
|
|
arrayUtil.forEach(LOCALSCOPE.columnsets.data, function (item, i) {
|
|
if (item.market == LOCALSCOPE.alarm_market_active) {
|
|
if (i >= 2) {
|
|
set = 2
|
|
}
|
|
}
|
|
})
|
|
if (set == 1) {
|
|
dijit.byId('gridset1').set('class', 'set-active')
|
|
dijit.byId('gridset2').set('class', 'set-light')
|
|
matches_grid.set('columnSets', nuh_columnsets.init(1))
|
|
} else {
|
|
dijit.byId('gridset1').set('class', 'set-light')
|
|
dijit.byId('gridset2').set('class', 'set-active')
|
|
matches_grid.set('columnSets', nuh_columnsets.init(2))
|
|
}
|
|
}
|
|
}
|
|
})
|