Correction nom

This commit is contained in:
Teddy Cornaut 2022-03-24 15:19:58 +01:00
parent 0a2310f6ac
commit e0f098d33d
6 changed files with 22 additions and 17 deletions

View File

@ -41,11 +41,17 @@ class MyPopup extends PanelMenu.Button {
let time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds(); let time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
let timeItem = new PopupMenu.PopupMenuItem(''); let timeItem = new PopupMenu.PopupMenuItem('');
let timeLabel = new St.Label({text:'Capital actuel : +0:00'}); let timeLabel = new St.Label({text:'CAPITAL TOTAL : +0:00'});
timeItem.add(timeLabel); timeItem.add(timeLabel);
this.menu.addMenuItem(timeItem); this.menu.addMenuItem(timeItem);
let ifValidateItem = new PopupMenu.PopupMenuItem('');
let ifValidateLabel = new St.Label({text:'CAPITAL SI VALIDÉ : +0:00'});
ifValidateItem.add(ifValidateLabel);
//this.menu.addMenuItem(ifValidateItem);
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
let startItem = new PopupMenu.PopupMenuItem(''); let startItem = new PopupMenu.PopupMenuItem('');
@ -59,9 +65,10 @@ class MyPopup extends PanelMenu.Button {
this.menu.connect('open-state-changed', (menu, open) => { this.menu.connect('open-state-changed', (menu, open) => {
if (open) { if (open) {
log('opened'); try {
let result = send_request('https://badge.cadoles.com/ninebadge/rest/showtimers', 'POST', key) let result = send_request('https://badge.cadoles.com/ninebadge/rest/showtimers', 'POST', key)
timeLabel.set_text('Capital actuel : ' + result.capitaltime) timeLabel.set_text('CAPITAL TOTAL : ' + result.capitaltime)
let status = send_request('https://badge.cadoles.com/ninebadge/rest/status', 'POST', key) let status = send_request('https://badge.cadoles.com/ninebadge/rest/status', 'POST', key)
if(status.status == "started") { if(status.status == "started") {
label.set_text('FIN POINTAGE'); label.set_text('FIN POINTAGE');
@ -70,17 +77,15 @@ class MyPopup extends PanelMenu.Button {
started = false started = false
label.set_text('DÉBUT POINTAGE'); label.set_text('DÉBUT POINTAGE');
} }
ifValidateLabel.set_text('CAPITAL SI VALIDÉ : +0:00')
} catch(error) {
log(error);
}
} }
}); });
startItem.connect('activate', () => { startItem.connect('activate', () => {
try {
let result = send_request('https://badge.cadoles.com/ninebadge/rest/showtimers', 'POST', key)
timeLabel.set_text('CAPITAL : ' + result.capitaltime)
} catch(error) {
log(error);
}
if(started){ if(started){
send_request('https://badge.cadoles.com/ninebadge/rest/clockout', 'POST', key) send_request('https://badge.cadoles.com/ninebadge/rest/clockout', 'POST', key)
started = false started = false

View File

Before

Width:  |  Height:  |  Size: 943 B

After

Width:  |  Height:  |  Size: 943 B

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB