From 744fc5dbfc33084459545f2cdd1055187abd167c Mon Sep 17 00:00:00 2001 From: bglacial Date: Sun, 21 Apr 2019 21:13:58 +0200 Subject: [PATCH] WIP : kart dashboard --- blank.html | 2 +- buttons.html | 2 +- cards.html | 2 +- charts.html | 2 +- drivers.html | 2 +- index.html | 2 +- index_kart.html | 192 +++------------------------------------ index_ori.html | 2 +- js/timelaps.js | 94 +++++++++++++++++-- karts.html | 2 +- params.html | 2 +- tables.html | 2 +- utilities-animation.html | 2 +- utilities-border.html | 2 +- utilities-color.html | 2 +- utilities-other.html | 2 +- 16 files changed, 115 insertions(+), 199 deletions(-) diff --git a/blank.html b/blank.html index fa58ce1..c62731a 100644 --- a/blank.html +++ b/blank.html @@ -41,7 +41,7 @@ diff --git a/buttons.html b/buttons.html index ee8dbd0..0b9d018 100644 --- a/buttons.html +++ b/buttons.html @@ -41,7 +41,7 @@ diff --git a/cards.html b/cards.html index d4837a2..829115c 100644 --- a/cards.html +++ b/cards.html @@ -41,7 +41,7 @@ diff --git a/charts.html b/charts.html index 306823d..4bcd242 100644 --- a/charts.html +++ b/charts.html @@ -41,7 +41,7 @@ diff --git a/drivers.html b/drivers.html index 3b6a2ec..cd0e80b 100644 --- a/drivers.html +++ b/drivers.html @@ -45,7 +45,7 @@ diff --git a/index.html b/index.html index 007fcee..df20166 100644 --- a/index.html +++ b/index.html @@ -42,7 +42,7 @@ diff --git a/index_kart.html b/index_kart.html index 55da042..1af3f78 100644 --- a/index_kart.html +++ b/index_kart.html @@ -43,7 +43,7 @@ @@ -212,34 +212,23 @@ Card image cap -
Pich
+

Total : 15:30:02

+
- - - - - - + + + + + +
@@ -323,159 +312,7 @@ Next drivers
-
-
-
- - Card image cap - -
-
Nico
-

Total : 03:39:36
- Tps de repos : 14:05:26
- -

-
- - - - - - - -
-

-
-
-
- -
-
- - Card image cap - -
-
Phillipe
-

Total : 02:45:40
- Tps de repos : 14:50:03
- -

-
- - - - - - - -
-

-
-
-
- -
-
- - Card image cap - -
-
Paul
-

Total : 03:48:44
- Tps de repos : 13:20:32
- -

-
- - - - - - - -
-

-
-
-
- -
-
- - Card image cap - -
-
BenoƮt
-

Total : 03:37:02
- Tps de repos : 12:38:57
- -

-
- - - - - - - -
-

-
-
-
- +
@@ -553,6 +390,7 @@ $(document).ready(function () { getKartsMenu(); + getDashboardKartInfo(); }); diff --git a/index_ori.html b/index_ori.html index f0c8eee..2a6dde2 100644 --- a/index_ori.html +++ b/index_ori.html @@ -41,7 +41,7 @@ diff --git a/js/timelaps.js b/js/timelaps.js index ba463dd..a56a854 100644 --- a/js/timelaps.js +++ b/js/timelaps.js @@ -1,7 +1,16 @@ timelapsStorage = localStorage; -if(typeof timelapsStorage.current_kart_id === "undefined"){ +if (typeof timelapsStorage.current_kart_id === "undefined") { timelapsStorage.setItem('current_kart_id', null); } +if (typeof timelapsStorage.params_max_relay_time === "undefined") { + timelapsStorage.setItem('params_max_relay_time', null); +} +if (typeof timelapsStorage.params_min_stand_time === "undefined") { + timelapsStorage.setItem('params_min_stand_time', null); +} +if (typeof timelapsStorage.params_max_fuel_autonomy === "undefined") { + timelapsStorage.setItem('params_max_fuel_autonomy', null); +} function getKartsMenu() { $.ajax({ @@ -12,12 +21,12 @@ function getKartsMenu() { success: function (data, status) { actual_kart = timelapsStorage.current_kart_id; $.each(data.reverse(), function (index, value) { - btn_class = 'btn-light'; - if(actual_kart == value.id ){ - btn_class = 'btn-primary'; + btn_class = 'btn-light'; + if (actual_kart == value.id) { + btn_class = 'btn-primary'; } $('#link_all').after("" + - " \n \n" + + " \n \n" + " \n" + " \n" + "\n" + @@ -290,7 +299,7 @@ function getDriversByKart() { { data: "id", render: function (data, type, row, meta) { - return ' '; + return ' '; } }, { @@ -404,7 +413,76 @@ function startRace() { } +function getDashboardKartInfo() { + + $.ajax({ + type: 'GET', + crossDomain: true, + url: api_url + 'relaysbykart/' + timelapsStorage.current_kart_id + '/', + dataType: 'json', + success: function (data, status) { + console.log(data); + $.each(data.reverse(), function (index, value) { + console.log(value); + if(value.relay_end == null){ + $('#current_driver_name').text(value.driver.first_name); + $('#refTime_current_driver').val(value.driver.ref_time); + }else{ + $('#next_driver_list').append("" + + "
\n" + + "
\n" + + " \n" + + " \"Card\n" + + " \n" + + "
\n" + + "
"+value.driver.first_name+"
\n" + + "

Total : 03:39:36
\n" + + " Tps de repos : 14:05:26
\n" + + " \n" + + "

\n" + + "\n" + + "
\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "
\n" + + "
\n" + + "
\n" + + "
" + + ""); + } + + }); + }, + error: function (xhr) { + $.notify("APIs unreachable!", "error"); + console.log('Request Status: ' + xhr.status + ' Status Text: ' + xhr.statusText + ' ' + xhr.responseText); + }, + }); + +} + function showKartDashboard(kart_id) { timelapsStorage.setItem('current_kart_id', kart_id); - window.location.href='index_kart.html'; -} \ No newline at end of file + if (kart_id != null) { + window.location.href = 'index_kart.html'; + } else { + window.location.href = 'index.html'; + } +} + +$(document).ready(function () { + + if (timelapsStorage.current_kart_id == "null" || typeof timelapsStorage.current_kart_id === "undefined") { + $('#link_all').removeClass('btn-light').addClass('btn-primary'); + } + +}); \ No newline at end of file diff --git a/karts.html b/karts.html index e264331..c0eeb0c 100644 --- a/karts.html +++ b/karts.html @@ -45,7 +45,7 @@ diff --git a/params.html b/params.html index 0be8674..9b884ae 100644 --- a/params.html +++ b/params.html @@ -42,7 +42,7 @@ diff --git a/tables.html b/tables.html index dae8060..10c4611 100644 --- a/tables.html +++ b/tables.html @@ -45,7 +45,7 @@ diff --git a/utilities-animation.html b/utilities-animation.html index 06ee875..f057b81 100644 --- a/utilities-animation.html +++ b/utilities-animation.html @@ -41,7 +41,7 @@ diff --git a/utilities-border.html b/utilities-border.html index c635371..195a48c 100644 --- a/utilities-border.html +++ b/utilities-border.html @@ -41,7 +41,7 @@ diff --git a/utilities-color.html b/utilities-color.html index 308a697..dba2b7f 100644 --- a/utilities-color.html +++ b/utilities-color.html @@ -41,7 +41,7 @@ diff --git a/utilities-other.html b/utilities-other.html index b6d3ea1..136f65f 100644 --- a/utilities-other.html +++ b/utilities-other.html @@ -41,7 +41,7 @@