159 lines
4.9 KiB
JavaScript
Executable File
159 lines
4.9 KiB
JavaScript
Executable File
/**
|
|
* First we will load all of this project's JavaScript dependencies which
|
|
* includes Vue and other libraries. It is a great starting point when
|
|
* building robust, powerful web applications using Vue and Laravel.
|
|
*/
|
|
|
|
require('./bootstrap');
|
|
//window.Vue = require('vue');
|
|
|
|
/**
|
|
* Next, we will create a fresh Vue application instance and attach it to
|
|
* the page. Then, you may begin adding components to this application
|
|
* or customize the JavaScript scaffolding to fit your unique needs.
|
|
*/
|
|
/*
|
|
Vue.component('example-component', require('./components/ExampleComponent.vue'));
|
|
|
|
const app = new Vue({
|
|
el: '#app'
|
|
});
|
|
*/
|
|
try {
|
|
window.$ = window.jQuery = require('jquery');
|
|
require('bootstrap');
|
|
require('@fortawesome/fontawesome-free/js/all.js');
|
|
//require('moment');
|
|
window.moment = require('moment');
|
|
require('tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.js');
|
|
require('datatables.net-bs4');
|
|
require('datatables.net-dt');
|
|
} catch (e) {
|
|
}
|
|
|
|
/* Set the width of the side navigation to 250px and the left margin of the page content to 250px */
|
|
window.openNav = function () {
|
|
document.getElementById("mySidenav").style.width = "250px";
|
|
document.getElementById("mySidenav").classList.remove("closed");
|
|
document.getElementById("mySidenav").classList.add("opened");
|
|
document.getElementById("main").style.marginLeft = "250px";
|
|
}
|
|
|
|
|
|
/* Set the width of the side navigation to 0 and the left margin of the page content to 0 */
|
|
window.closeNav = function () {
|
|
document.getElementById("mySidenav").style.width = "90px";
|
|
document.getElementById("mySidenav").classList.add("closed");
|
|
document.getElementById("mySidenav").classList.remove("opened");
|
|
document.getElementById("main").style.marginLeft = "90px";
|
|
}
|
|
|
|
|
|
window.getallkarts = function () {
|
|
|
|
selected_kartid = getCookie('active_kartid');
|
|
selected_kartname = getCookie('active_kartname');
|
|
|
|
$.ajaxSetup({
|
|
headers: {
|
|
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
|
}
|
|
});
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: '/getkartsalldata',
|
|
data: {},
|
|
success: function (data) {
|
|
$("#btnChoiceKart").html("");
|
|
$.each(data.data, function (k, v) {
|
|
|
|
if (selected_kartid == v.id) {
|
|
$("#kartid").val(v.id);
|
|
$('#btnChoiceKartTitle').html(v.name);
|
|
}
|
|
|
|
$("#btnChoiceKart").append("<a class='dropdown-item' onclick='reloadData(" + v.id + ",String(\"" + v.name + "\"))' >" + v.name + "</a>");
|
|
});
|
|
|
|
if ($("#kartid").val() == "") {
|
|
$('#btnChoiceKartTitle').html('Choix du kart');
|
|
}
|
|
$("#btnChoiceKart").append("<div class=\"dropdown-divider\"></div>");
|
|
$("#btnChoiceKart").append("<a class=\"dropdown-item\" onclick='reloadData(null,\"Vue générale\")'>Vue générale</a>");
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
window.getallraces = function () {
|
|
|
|
|
|
selected_raceid = getCookie('active_raceid');
|
|
selected_racename = getCookie('active_racename');
|
|
|
|
$.ajaxSetup({
|
|
headers: {
|
|
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
|
}
|
|
});
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: '/getsmallraces',
|
|
success: function (data) {
|
|
console.log(data.data);
|
|
$("#btnChoiceRace").html("");
|
|
$.each(data.data, function (k, v) {
|
|
|
|
if (selected_raceid == v.id) {
|
|
$("#raceid").val(v.id);
|
|
$('#btnChoiceRaceTitle').html(v.name);
|
|
}
|
|
|
|
$("#btnChoiceRace").append("<a class='dropdown-item' onclick='reloadRaceData(" + v.id + ",String(\"" + v.name + "\"))' >" + v.name + "</a>");
|
|
});
|
|
|
|
if ($("#raceid").val() == "") {
|
|
$('#btnChoiceRaceTitle').html('Choix de la course');
|
|
}
|
|
$("#btnChoiceRace").append("<div class=\"dropdown-divider\"></div>");
|
|
$("#btnChoiceRace").append("<a class=\"dropdown-item\" onclick='reloadData(null,\"Vue générale\")'>Vue générale</a>");
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
window.reloadRaceData = function (id, name) {
|
|
|
|
document.cookie = "active_raceid=" + id;
|
|
document.cookie = "active_racename=" + name;
|
|
|
|
if (name != null)
|
|
$('#btnChoiceRaceTitle').html(name);
|
|
|
|
}
|
|
|
|
window.getCookie = function (cname) {
|
|
var name = cname + "=";
|
|
var decodedCookie = decodeURIComponent(document.cookie);
|
|
var ca = decodedCookie.split(';');
|
|
for (var i = 0; i < ca.length; i++) {
|
|
var c = ca[i];
|
|
while (c.charAt(0) == ' ') {
|
|
c = c.substring(1);
|
|
}
|
|
if (c.indexOf(name) == 0) {
|
|
return c.substring(name.length, c.length);
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
|
|
|
|
$(() => {
|
|
moment.locale('fr');
|
|
getallraces();
|
|
getallkarts();
|
|
})
|
|
//<a class="dropdown-item" href="/?name=chooseKart&kartID=0">Vue générale</a>
|
|
|