Ich Ich, gros commit

This commit is contained in:
bglacial 2018-10-08 22:31:58 +02:00
parent ecded0947f
commit b11b2befd7
49 changed files with 37276 additions and 11977 deletions

View File

@ -0,0 +1,84 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class AdminController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return view('admin.index');
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}

View File

@ -3,6 +3,7 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Yajra\Datatables\Datatables;
use App\Kart; use App\Kart;
class KartController extends Controller class KartController extends Controller
@ -14,7 +15,7 @@ class KartController extends Controller
*/ */
public function index() public function index()
{ {
// return view('kart.index');
} }
/** /**
@ -35,7 +36,10 @@ class KartController extends Controller
*/ */
public function store(Request $request) public function store(Request $request)
{ {
// $hero = new Kart;
$hero->name = $request->name;
$hero->save();
return redirect('/kart');
} }
/** /**
@ -81,6 +85,21 @@ class KartController extends Controller
*/ */
public function destroy($id) public function destroy($id)
{ {
//
$kart = \App\Kart::find($id);
$kart->delete();
return redirect('/kart');
} }
/**
* Process datatables ajax request.
*
* @return \Illuminate\Http\JsonResponse
*/
public function getKartsAllData()
{
return Datatables::of(Kart::query())->make();
}
} }

View File

@ -3,6 +3,9 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Yajra\Datatables\Datatables;
use App\Pilot;
class PilotController extends Controller class PilotController extends Controller
{ {
@ -13,7 +16,7 @@ class PilotController extends Controller
*/ */
public function index() public function index()
{ {
// return view('pilot.index');
} }
/** /**
@ -23,7 +26,7 @@ class PilotController extends Controller
*/ */
public function create() public function create()
{ {
// return view('pilot.create');
} }
/** /**
@ -34,7 +37,13 @@ class PilotController extends Controller
*/ */
public function store(Request $request) public function store(Request $request)
{ {
// $pilot = new Pilot;
$pilot->name = $request->name;
$pilot->first_name = $request->first_name;
$pilot->ref_time = $request->ref_time;
$pilot->kart_id = $request->kart_id;
$pilot->save();
return redirect('/pilot');
} }
/** /**
@ -68,7 +77,13 @@ class PilotController extends Controller
*/ */
public function update(Request $request, $id) public function update(Request $request, $id)
{ {
// $pilot = \App\Pilot::find($id);
$pilot->name = $request->get('name');
$pilot->email = $request->get('first_name');
$pilot->ref_time = $request->get('ref_time');
$pilot->kart_id = $request->get('kart_id');
$pilot->save();
return redirect('/pilot');
} }
/** /**
@ -77,8 +92,49 @@ class PilotController extends Controller
* @param int $id * @param int $id
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function destroy($id) public function destroy($id = null)
{ {
// $pilot = \App\Pilot::find($id);
$pilot->delete();
return redirect('/pilot');
}
/**
* Process datatables ajax request.
*
* @return \Illuminate\Http\JsonResponse
*/
public function getPilotAllData()
{
return Datatables::of(
Pilot::query()
->select('pilots.id', 'pilots.name', 'pilots.first_name', 'pilots.ref_time', 'karts.name as kart_name')
->leftJoin('karts', 'kart_id', '=', 'karts.id')
)->make();
}
/**
* Process datatables ajax request.
*
* @return \Illuminate\Http\JsonResponse
*/
public function getPilotsByKart(Request $request)
{
$id = $request->input('id');
if ($id == null) {
return self::getPilotAllData();
} else {
$request->session()->put('kartid', $id);
return Datatables::of(
Pilot::query()
->select('pilots.id', 'pilots.name', 'pilots.first_name', 'pilots.ref_time', 'karts.name as kart_name')
->leftJoin('karts', 'kart_id', '=', 'karts.id')
->where('karts.id', $id)
)->make();
}
} }
} }

View File

@ -3,6 +3,8 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Yajra\Datatables\Datatables;
use App\Race;
class RaceController extends Controller class RaceController extends Controller
{ {
@ -13,7 +15,7 @@ class RaceController extends Controller
*/ */
public function index() public function index()
{ {
// return view('race.index');
} }
/** /**
@ -23,7 +25,7 @@ class RaceController extends Controller
*/ */
public function create() public function create()
{ {
// return view('race.create');
} }
/** /**
@ -34,7 +36,17 @@ class RaceController extends Controller
*/ */
public function store(Request $request) public function store(Request $request)
{ {
// $pilot = new Race();
$pilot->name = $request->name;
$pilot->start_date = $request->start_date;
$pilot->duration = $request->duration;
$pilot->autonomie_kart_sec = $request->autonomie_kart_sec;
$pilot->autonomie_kart_humide = $request->autonomie_kart_humide;
$pilot->relay_default_duration = $request->relay_default_duration;
$pilot->stand_duration = $request->stand_duration;
$pilot->comment = $request->comment;
$pilot->save();
return redirect('/race');
} }
/** /**
@ -45,7 +57,9 @@ class RaceController extends Controller
*/ */
public function show($id) public function show($id)
{ {
// var_dump('show');
var_dump(Race::query()->where('id', $id));
} }
/** /**
@ -81,4 +95,48 @@ class RaceController extends Controller
{ {
// //
} }
/**
* Process datatables ajax request.
*
* @return \Illuminate\Http\JsonResponse
*/
public function getRaceParams(Request $request)
{
$id = $request->input('id');
return Datatables::of(
Race::query()->where('id', $id)
)->make();
}
/**
* Process datatables ajax request.
*
* @return \Illuminate\Http\JsonResponse
*/
public function getraces()
{
return Datatables::of(Race::query())->make();
}
/**
* Process datatables ajax request.
*
* @return \Illuminate\Http\JsonResponse
*/
public function getsmallraces(Request $request)
{
return Datatables::of(
Race::query()
->select('id', 'name')
)->make();
}
} }

View File

@ -13,6 +13,7 @@ class RelayController extends Controller
*/ */
public function index() public function index()
{ {
return view('relay.index');
// //
} }

View File

@ -60,5 +60,6 @@ class Kernel extends HttpKernel
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
'admin' => \App\Http\Middleware\Admin::class,
]; ];
} }

View File

@ -0,0 +1,24 @@
<?php
namespace App\Http\Middleware;
use Closure;
class Admin
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$user = $request->user();
if ($user && $user->admin) {
return $next($request);
}
return redirect()->route('home');
}
}

View File

@ -3,6 +3,7 @@
namespace App\Providers; namespace App\Providers;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Blade;
class AppServiceProvider extends ServiceProvider class AppServiceProvider extends ServiceProvider
{ {
@ -13,7 +14,9 @@ class AppServiceProvider extends ServiceProvider
*/ */
public function boot() public function boot()
{ {
// Blade::if('admin', function () {
return auth()->check() && auth()->user()->admin;
});
} }
/** /**

View File

@ -26,4 +26,14 @@ class User extends Authenticatable
protected $hidden = [ protected $hidden = [
'password', 'remember_token', 'password', 'remember_token',
]; ];
/**
* User is admin.
*
* @return integer
*/
public function getAdminAttribute()
{
return $this->role === 'admin';
}
} }

View File

@ -8,7 +8,8 @@
"php": "^7.1.3", "php": "^7.1.3",
"fideloper/proxy": "^4.0", "fideloper/proxy": "^4.0",
"laravel/framework": "5.7.*", "laravel/framework": "5.7.*",
"laravel/tinker": "^1.0" "laravel/tinker": "^1.0",
"yajra/laravel-datatables-oracle": "~8.0"
}, },
"require-dev": { "require-dev": {
"barryvdh/laravel-debugbar": "^3.2", "barryvdh/laravel-debugbar": "^3.2",

73
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "a875862ccc0c27fcee12c6892c3e2b32", "content-hash": "8f1cad91a521f912aed4c570675dfe0e",
"packages": [ "packages": [
{ {
"name": "dnoegel/php-xdg-base-dir", "name": "dnoegel/php-xdg-base-dir",
@ -2297,6 +2297,77 @@
"environment" "environment"
], ],
"time": "2018-07-29T20:33:41+00:00" "time": "2018-07-29T20:33:41+00:00"
},
{
"name": "yajra/laravel-datatables-oracle",
"version": "v8.8.0",
"source": {
"type": "git",
"url": "https://github.com/yajra/laravel-datatables.git",
"reference": "f2959bf773fc315e1b3319fb0a34c880b97706d5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/yajra/laravel-datatables/zipball/f2959bf773fc315e1b3319fb0a34c880b97706d5",
"reference": "f2959bf773fc315e1b3319fb0a34c880b97706d5",
"shasum": ""
},
"require": {
"illuminate/database": "5.4.*|5.5.*|5.6.*|5.7.*",
"illuminate/filesystem": "5.4.*|5.5.*|5.6.*|5.7.*",
"illuminate/http": "5.4.*|5.5.*|5.6.*|5.7.*",
"illuminate/support": "5.4.*|5.5.*|5.6.*|5.7.*",
"illuminate/view": "5.4.*|5.5.*|5.6.*|5.7.*",
"php": ">=7.0"
},
"require-dev": {
"orchestra/testbench": "~3.5"
},
"suggest": {
"yajra/laravel-datatables-buttons": "Plugin for server-side exporting of dataTables.",
"yajra/laravel-datatables-editor": "Plugin to use DataTables Editor (requires a license).",
"yajra/laravel-datatables-fractal": "Plugin for server-side response using Fractal.",
"yajra/laravel-datatables-html": "Plugin for server-side HTML builder of dataTables."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "8.0-dev"
},
"laravel": {
"providers": [
"Yajra\\DataTables\\DataTablesServiceProvider"
],
"aliases": {
"DataTables": "Yajra\\DataTables\\Facades\\DataTables"
}
}
},
"autoload": {
"psr-4": {
"Yajra\\DataTables\\": "src/"
},
"files": [
"src/helper.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Arjay Angeles",
"email": "aqangeles@gmail.com"
}
],
"description": "jQuery DataTables API for Laravel 4|5",
"keywords": [
"datatables",
"jquery",
"laravel"
],
"time": "2018-09-05T05:43:38+00:00"
} }
], ],
"packages-dev": [ "packages-dev": [

View File

@ -159,7 +159,7 @@ return [
// App\Providers\BroadcastServiceProvider::class, // App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class, App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class, App\Providers\RouteServiceProvider::class,
Yajra\Datatables\DatatablesServiceProvider::class,
], ],
/* /*
@ -208,6 +208,7 @@ return [
'URL' => Illuminate\Support\Facades\URL::class, 'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class, 'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class, 'View' => Illuminate\Support\Facades\View::class,
'Datatables' => Yajra\Datatables\Facades\Datatables::class,
], ],

View File

@ -19,6 +19,7 @@ class CreateUsersTable extends Migration
$table->string('email')->unique(); $table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable(); $table->timestamp('email_verified_at')->nullable();
$table->string('password'); $table->string('password');
$table->enum('role', ['user', 'admin'])->default('user');
$table->rememberToken(); $table->rememberToken();
$table->timestamps(); $table->timestamps();
}); });

View File

@ -15,9 +15,15 @@ class CreateRacesTable extends Migration
{ {
Schema::create('races', function (Blueprint $table) { Schema::create('races', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
$table->string('name');
$table->dateTime('start_date'); $table->dateTime('start_date');
$table->dateTime('end_date'); $table->dateTime('end_date')->nullable();
$table->integer('duration'); $table->integer('duration');
$table->integer('autonomie_kart_sec');
$table->integer('autonomie_kart_humide');
$table->integer('relay_default_duration');
$table->string('stand_duration');
$table->text('comment')->nullable();
$table->timestamps(); $table->timestamps();
}); });
} }

View File

@ -16,8 +16,8 @@ class CreateKartsTable extends Migration
Schema::create('karts', function (Blueprint $table) { Schema::create('karts', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
$table->string('name')->unique(); $table->string('name')->unique();
$table->integer('race_id')->unsigned(); $table->dateTime('updated_at');
$table->foreign('race_id')->references('id')->on('races')->onDelete('no action'); $table->dateTime('created_at');
}); });
} }

View File

@ -17,6 +17,7 @@ class CreatePilotsTable extends Migration
$table->increments('id'); $table->increments('id');
$table->string('name'); $table->string('name');
$table->string('first_name'); $table->string('first_name');
$table->integer('ref_time');
$table->integer('kart_id')->unsigned(); $table->integer('kart_id')->unsigned();
$table->foreign('kart_id')->references('id')->on('karts')->onDelete('no action'); $table->foreign('kart_id')->references('id')->on('karts')->onDelete('no action');
$table->timestamps(); $table->timestamps();

View File

@ -11,6 +11,9 @@ class DatabaseSeeder extends Seeder
*/ */
public function run() public function run()
{ {
// $this->call(UsersTableSeeder::class); $this->call(UsersTableSeeder::class);
$this->call(RaceTableSeeder::class);
$this->call(KartTableSeeder::class);
$this->call(PilotTableSeeder::class);
} }
} }

View File

@ -0,0 +1,23 @@
<?php
use Illuminate\Database\Seeder;
use App\Kart;
use Carbon\Carbon;
class KartTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Kart::create([
'name' => 'OCK-1'
]);
Kart::create([
'name' => 'OCK-2'
]);
}
}

View File

@ -0,0 +1,79 @@
<?php
use Illuminate\Database\Seeder;
use App\Pilot;
use Carbon\Carbon;
class PilotTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Pilot::create([
'name' => 'Nicolas',
'first_name' => 'RIAULT',
'ref_time' => 67,
'kart_id' => 1
]);
Pilot::create([
'name' => 'Maxime',
'first_name' => 'LEGER',
'ref_time' => 58,
'kart_id' => 1
]);
Pilot::create([
'name' => 'Julien',
'first_name' => 'ROGER',
'ref_time' => 63,
'kart_id' => 1
]);
Pilot::create([
'name' => 'Romain',
'first_name' => 'PICHONNEAU',
'ref_time' => 63,
'kart_id' => 1
]);
Pilot::create([
'name' => 'Olivier',
'first_name' => 'PIRON',
'ref_time' => 63,
'kart_id' => 1
]);
Pilot::create([
'name' => 'test',
'first_name' => '1',
'ref_time' => 67,
'kart_id' => 2
]);
Pilot::create([
'name' => 'test',
'first_name' => '2',
'ref_time' => 58,
'kart_id' => 2
]);
Pilot::create([
'name' => 'test',
'first_name' => '3',
'ref_time' => 63,
'kart_id' => 2
]);
Pilot::create([
'name' => 'Romain',
'first_name' => '4',
'ref_time' => 63,
'kart_id' => 2
]);
Pilot::create([
'name' => 'test',
'first_name' => '5',
'ref_time' => 63,
'kart_id' => 2
]);
}
}

View File

@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Seeder;
use App\Race;
use Carbon\Carbon;
class RaceTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Race::create([
'name' => 'Course 24h',
'start_date' => Carbon::now(),
'end_date' => Carbon::now(),
'duration' => 24,
'autonomie_kart_sec' => 120,
'autonomie_kart_humide' => 200,
'relay_default_duration' => 45,
'stand_duration' => '60',
'comment' => 'Top',
]);
}
}

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Seeder;
use App\User;
use Carbon\Carbon;
class UsersTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
User::create([
'name' => 'Dupont',
'email' => 'dupont@chezlui.fr',
'role' => 'admin',
'password' => bcrypt('admin'),
'email_verified_at' => Carbon::now(),
]);
User::create([
'name' => 'Martin',
'email' => 'martin@chezlui.fr',
'password' => bcrypt('user'),
'email_verified_at' => Carbon::now(),
]);
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,5 @@
{ {
"/js/app.js": "/js/app.js", "/js/app.js": "/js/app.js",
"/css/app.css": "/css/app.css" "/css/app.css": "/css/app.css",
"/css/metronic.css": "/css/metronic.css"
} }

View File

@ -7,6 +7,29 @@
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/license.svg" alt="License"></a> <a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/license.svg" alt="License"></a>
</p> </p>
## About l'installation
- composer install
- npn run dev
Et roule ma poule !
## About les commandes utiles
- Générer la base de donnée et peupler celle-ci :
`_php artisan migrate:fresh --seed_`
- Créer un middleware "Admin":
`_php artisan make:middleware Admin_`
- Lister les routes disponibles":
`_php artisan route:list_`
Et roule ma poule !
## About Laravel ## About Laravel
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as: Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as:

View File

@ -1,4 +1,3 @@
/** /**
* First we will load all of this project's JavaScript dependencies which * First we will load all of this project's JavaScript dependencies which
* includes Vue and other libraries. It is a great starting point when * includes Vue and other libraries. It is a great starting point when
@ -6,26 +5,31 @@
*/ */
require('./bootstrap'); require('./bootstrap');
//window.Vue = require('vue');
window.Vue = require('vue');
/** /**
* Next, we will create a fresh Vue application instance and attach it to * Next, we will create a fresh Vue application instance and attach it to
* the page. Then, you may begin adding components to this application * the page. Then, you may begin adding components to this application
* or customize the JavaScript scaffolding to fit your unique needs. * or customize the JavaScript scaffolding to fit your unique needs.
*/ */
/*
Vue.component('example-component', require('./components/ExampleComponent.vue')); Vue.component('example-component', require('./components/ExampleComponent.vue'));
const app = new Vue({ const app = new Vue({
el: '#app' el: '#app'
}); });
*/
try { try {
window.$ = window.jQuery = require('jquery'); window.$ = window.jQuery = require('jquery');
require('bootstrap'); require('bootstrap');
require('@fortawesome/fontawesome-free/js/all.js'); require('@fortawesome/fontawesome-free/js/all.js');
} catch (e) {} //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 */ /* Set the width of the side navigation to 250px and the left margin of the page content to 250px */
window.openNav = function () { window.openNav = function () {
@ -38,8 +42,117 @@ window.openNav = function () {
/* Set the width of the side navigation to 0 and the left margin of the page content to 0 */ /* Set the width of the side navigation to 0 and the left margin of the page content to 0 */
window.closeNav = function () { window.closeNav = function () {
document.getElementById("mySidenav").style.width = "90px", document.getElementById("mySidenav").style.width = "90px";
document.getElementById("mySidenav").classList.add("closed"); document.getElementById("mySidenav").classList.add("closed");
document.getElementById("mySidenav").classList.remove("opened"); document.getElementById("mySidenav").classList.remove("opened");
document.getElementById("main").style.marginLeft = "90px"; 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&amp;kartID=0">Vue générale</a>

View File

@ -0,0 +1,35 @@
/**
* French translation
* @name French
* @anchor French
* @author
*/
{
"sProcessing": "Traitement en cours...",
"sSearch": "Rechercher&nbsp;:",
"sLengthMenu": "Afficher _MENU_ &eacute;l&eacute;ments",
"sInfo": "Affichage de l'&eacute;l&eacute;ment _START_ &agrave; _END_ sur _TOTAL_ &eacute;l&eacute;ments",
"sInfoEmpty": "Affichage de l'&eacute;l&eacute;ment 0 &agrave; 0 sur 0 &eacute;l&eacute;ment",
"sInfoFiltered": "(filtr&eacute; de _MAX_ &eacute;l&eacute;ments au total)",
"sInfoPostFix": "",
"sLoadingRecords": "Chargement en cours...",
"sZeroRecords": "Aucun &eacute;l&eacute;ment &agrave; afficher",
"sEmptyTable": "Aucune donn&eacute;e disponible dans le tableau",
"oPaginate": {
"sFirst": "Premier",
"sPrevious": "Pr&eacute;c&eacute;dent",
"sNext": "Suivant",
"sLast": "Dernier"
},
"oAria": {
"sSortAscending": ": activer pour trier la colonne par ordre croissant",
"sSortDescending": ": activer pour trier la colonne par ordre d&eacute;croissant"
},
"select": {
"rows": {
"_": "%d lignes séléctionnées",
"0": "Aucune ligne séléctionnée",
"1": "1 ligne séléctionnée"
}
}

View File

@ -1,6 +1,8 @@
// Body // Body
$body-bg: #343a40; $body-bg: #343a40;
$body-text-bg: #a3b3c6;
$body-light-bg: #E2E7ED;
// Typography // Typography
$font-family-sans-serif: "Nunito", sans-serif; $font-family-sans-serif: "Nunito", sans-serif;
@ -18,6 +20,7 @@ $yellow: #ffed4a;
$green: #38c172; $green: #38c172;
$teal: #4dc0b5; $teal: #4dc0b5;
$cyan: #6cb2eb; $cyan: #6cb2eb;
$black: #111;
// Card // Card
$card-border-width: 4px; $card-border-width: 4px;

View File

@ -4,6 +4,10 @@
@import 'variables'; @import 'variables';
// Bootstrap // Bootstrap
@import '~bootstrap/scss/bootstrap'; @import '~bootstrap/scss/bootstrap';
//Datatables
@import '~datatables.net-bs4/css/dataTables.bootstrap4.min.css';
//DatePicker
@import '~tempusdominus-bootstrap-4/build/css/tempusdominus-bootstrap-4.min.css';
.navbar-laravel { .navbar-laravel {
background-color: #fff; background-color: #fff;
@ -19,16 +23,21 @@ $card-border-width: 4px;
$card-border-radius: .3rem; $card-border-radius: .3rem;
$card-border-color: rgba(255, 242, 242, .3); $card-border-color: rgba(255, 242, 242, .3);
//MainNavbar
#mainNav {
z-index: 1;
}
//Sidebar //Sidebar
/* The side navigation menu */ /* The side navigation menu */
.sidenav { .sidenav {
height: 100%; /* 100% Full-height */ height: 100%; /* 100% Full-height */
width: 90px; /* 0 width - change this with JavaScript */ width: 90px; /* 0 width - change this with JavaScript */
position: fixed; /* Stay in place */ position: fixed; /* Stay in place */
z-index: 1; /* Stay on top */ z-index: 1000; /* Stay on top */
top: 0; /* Stay at the top */ top: 0; /* Stay at the top */
left: 0; left: 0;
background-color: #111; /* Black*/ background-color: $black; /* Black*/
overflow-x: hidden; /* Disable horizontal scroll */ overflow-x: hidden; /* Disable horizontal scroll */
padding-top: 60px; /* Place content 60px from the top */ padding-top: 60px; /* Place content 60px from the top */
transition: 0.5s; /* 0.5 second transition effect to slide in the sidenav */ transition: 0.5s; /* 0.5 second transition effect to slide in the sidenav */
@ -37,10 +46,12 @@ $card-border-color: rgba(255, 242, 242, .3);
.closed > a > span { .closed > a > span {
display: none; display: none;
} }
.opened a.openbtn {
.opened .openbtn {
display: none; display: none;
} }
.closed a.closebtn {
.closed .closebtn {
display: none; display: none;
} }
@ -52,6 +63,7 @@ $card-border-color: rgba(255, 242, 242, .3);
color: #818181; color: #818181;
display: block; display: block;
transition: 0.3s; transition: 0.3s;
z-index: 100;
} }
/* When you mouse over the navigation links, change their color */ /* When you mouse over the navigation links, change their color */
@ -67,6 +79,7 @@ $card-border-color: rgba(255, 242, 242, .3);
font-size: 36px; font-size: 36px;
margin-left: 50px; margin-left: 50px;
} }
.sidenav .openbtn { .sidenav .openbtn {
position: absolute; position: absolute;
top: 0; top: 0;
@ -75,6 +88,10 @@ $card-border-color: rgba(255, 242, 242, .3);
margin-left: 50px; margin-left: 50px;
} }
.sidenav a.active {
color: #f1f1f1 !important;
}
/* Style page content - use this if you want to push the page content to the right when you open the side navigation */ /* Style page content - use this if you want to push the page content to the right when you open the side navigation */
#main { #main {
transition: margin-left .5s; transition: margin-left .5s;
@ -91,3 +108,58 @@ $card-border-color: rgba(255, 242, 242, .3);
font-size: 18px; font-size: 18px;
} }
} }
//BOuton de selection du karting
.btn {
border-color:$body-light-bg;
padding: 0.35rem 1.5rem;
color: $body-text-bg!important;
background-color: transparent;
background-image: none;
}
.dropdown-menu{
top: 100%;
text-align: left;
display: none;
position: absolute;
z-index: 101;
padding-top: 0;
width: 245px;
border-radius: 4px;
-webkit-transform: translateZ(0);
transform: translateZ(0);
-webkit-transform-style: preserve-3d;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
border-color: $body-light-bg;
color: $body-bg!important;
}
.dropdown-item:hover{
cursor: pointer;
color: $body-bg!important;
}
.textarea-form {
width: 100%;
}
//Widgets Admin
.widget-thumb {
padding: 20px 10px 20px 10px;
border-radius: 4px;
vertical-align: center;
text-align: center;
}
.widget-thumb:hover {
cursor: pointer;
}
.widget-thumb-red {
background-color: #E7505A !important;
}
.widget-thumb-blue {
background-color: #0076A8 !important;
}

0
resources/sass/metronic.scss Executable file
View File

View File

@ -0,0 +1,62 @@
@extends('layouts.loggedform')
@section('card')
@component('components.card')
@slot('title')
@lang('Paramétrer la course')
@endslot
<form method="POST" action="{{ route('race.store') }}">
{{ csrf_field() }}
@include('partials.form-group', [
'title' => __('Nom'),
'type' => 'text',
'name' => 'name',
'required' => true,
])
@include('partials.form-group', [
'title' => __('Date de début'),
'type' => 'date',
'name' => 'start_date',
'required' => true,
])
@include('partials.form-group', [
'title' => __('Date de fin'),
'type' => 'date',
'name' => 'end_date',
'required' => true,
])
@include('partials.form-group', [
'title' => __('Durée'),
'type' => 'integer',
'name' => 'duration',
'required' => true,
])
@include('partials.form-group', [
'title' => __('Autonomie du karting (Sec)'),
'type' => 'integer',
'name' => 'autonomie_kart_sec',
'required' => true,
])
@include('partials.form-group', [
'title' => __('Autonomie du karting (Humide)'),
'type' => 'integer',
'name' => 'autonomie_kart_humide',
'required' => true,
])
@include('partials.form-group', [
'title' => __('Durée des relais par défaut (Minutes)'),
'type' => 'integer',
'name' => 'relay_default_duration',
'required' => true,
])
@include('partials.form-group', [
'title' => __('Duree dans les stands minimum (Minutes)'),
'type' => 'integer',
'name' => 'stand_duration',
'required' => true,
])
@component('components.button')
@lang('Envoyer')
@endcomponent
</form>
@endcomponent
@endsection

View File

@ -0,0 +1,29 @@
@extends('layouts.loggedform')
@section('card')
<div class="row">
<div class="col-md-6">
<div class="widget-thumb widget-thumb-blue" onclick="location.href ='/race'">
<div class="widget-thumb-wrap">
<div class="widget-thumb-body">
<h4 class="widget-thumb-heading-white">Gérer les courses</h4>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<div class="widget-thumb widget-thumb-red" onclick="location.href ='/race'">
<h4 class="widget-thumb-heading-white">Gérer le championnat</h4>
<div class="widget-thumb-wrap">
<div class="widget-thumb-body">
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(() => {
console.log('Admin');
})
</script>
@endsection

View File

@ -0,0 +1,9 @@
@extends('layouts.form')
@section('card')
@component('components.card')
@slot('title')
@lang('Ajouter une team')
@endslot
@endcomponent
@endsection

View File

@ -0,0 +1,10 @@
<div id="{{$idContainer}}" class="btn-group show">
<button id="{{$btnId}}" type="button" class="btn dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
{{$btnText}}
<span class="sr-only">Toggle Dropdown</span>
</button>
<div id="{{$divId}}" class="dropdown-menu dropdown-menu-right" x-placement="bottom-end" style="position: absolute; transform: translate3d(-32px, 38px, 0px); top: 0px; left: 0px; will-change: transform;">
<div class="dropdown-divider"></div>
<a class="dropdown-item" onclick="{{$onclickAction}}">{{$onclickText}}</a>
</div>
</div>

View File

@ -3,7 +3,7 @@
@section('content') @section('content')
<div class="container"> <div class="container">
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-md-8"> <div class="col-md-12">
<div class="card"> <div class="card">
<div class="card-header">Dashboard</div> <div class="card-header">Dashboard</div>
@ -15,6 +15,8 @@
@endif @endif
You are logged in! You are logged in!
</div> </div>
</div> </div>
</div> </div>

View File

@ -4,7 +4,7 @@
@slot('title') @slot('title')
@lang('Ajouter un karting') @lang('Ajouter un karting')
@endslot @endslot
<form method="POST" action="{{ route('kart.store') }}"> <form method="POST" action="{{ url('kart') }}">
{{ csrf_field() }} {{ csrf_field() }}
@include('partials.form-group', [ @include('partials.form-group', [
'title' => __('Nom'), 'title' => __('Nom'),

View File

@ -0,0 +1,60 @@
@extends('layouts.loggedform')
@section('card')
@component('components.card')
@slot('title')
@lang('Liste des kartings - ') <a href="{{route("kart.create")}}"><i class="far fa-plus-square"></i></a>
@endslot
<table class="table table-bordered" id="pilots-table">
<thead>
<tr>
<th></th>
<th>Nom du karting</th>
</tr>
</thead>
</table>
<script type="text/javascript">
var tableKarts = '';
window.deletePilot = function (id) {
$.ajax({
url: '/kart/'+id,
type: 'DELETE', // user.destroy
success: function(result) {
console.log('OK');
}
});
}
window.reloadData = function (id, name) {
document.cookie = "active_kartid=" + id;
document.cookie = "active_kartname=" + name;
if (name != null)
$('#btnChoiceKartTitle').html(name);
}
$(() => {
tableKarts = $('#pilots-table').DataTable({
processing: true,
ajax: '/getkartsalldata',
columns: [
{
data: 'id',
searchable: false,
render:
function (data, type, row, meta) {
return '<a onclick="deleteKart(' + data + ');tableKarts.row( $(this).parents(\'tr\') ).remove().draw();"><i class="far fa-trash-alt"></i></a>';
}
},
{data: 'name'}
]
});
})
</script>
@endcomponent
@endsection

View File

@ -7,25 +7,76 @@
<meta name="csrf-token" content="{{ csrf_token() }}"> <meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'Album') }}</title> <title>{{ config('app.name', 'Album') }}</title>
<link href="{{ asset('css/app.css') }}" rel="stylesheet"> <link href="{{ asset('css/app.css') }}" rel="stylesheet">
<link href="{{ asset('css/metronic.css') }}" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
@yield('css') @yield('css')
</head> </head>
<body> <body>
<nav id="mainNav" class="navbar fixed-top navbar-expand-lg navbar-dark bg-dark">
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-auto">
@guest
<li class="nav-item{{ currentRoute(route('login')) }}"><a class="nav-link"
href="{{ route('login') }}">@lang('Connexion')</a>
</li>
<li class="nav-item{{ currentRoute(route('register')) }}"><a class="nav-link"
href="{{ route('register') }}">@lang('Inscription')</a>
</li>
@else
<li class="nav-item">
@component('components.kartChoice')
@slot('idContainer') btnChoiceRaceContainer @endslot
@slot('btnId') btnChoiceRaceTitle @endslot
@slot('btnText') Choix de la course @endslot
@slot('divId') btnChoiceRace @endslot
@slot('onclickAction') reloadRaceData(null, 'Choix de la course') @endslot
@slot('onclickText') Choix de la course @endslot
@endcomponent
</li>
<li class="nav-item">
@component('components.kartChoice')
@slot('idContainer') btnChoiceKartContainer @endslot
@slot('btnId') btnChoiceKartTitle @endslot
@slot('btnText') Choix du kart @endslot
@slot('divId') btnChoiceKart @endslot
@slot('onclickAction') reloadData(null, 'Choix du kart') @endslot
@slot('onclickText') Choix du kart @endslot
@endcomponent
</li>
<li class="nav-item">
<a id="logout" class="nav-link" href="{{ route('logout') }}">@lang('Déconnexion')</a>
<form id="logout-form" action="{{ route('logout') }}" method="POST" class="hide">
{{ csrf_field() }}
</form>
</li>
@endguest
</ul>
</div>
</nav>
<div id="mySidenav" class="sidenav closed"> <div id="mySidenav" class="sidenav closed">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()"><i class="fas fa-times"></i></a> <a href="javascript:void(0)" class="closebtn" onclick="closeNav()"><i class="fas fa-times"></i></a>
<img src="{{ url('img/timelaps-logo.png') }}" > <img class="closebtn" src="{{ url('img/timelaps-logo3.png') }}">
<a href="javascript:void(0)" class="openbtn" onclick="openNav()"><i class="fas fa-bars"></i></a> <a href="javascript:void(0)" class="openbtn" onclick="openNav()"><i class="fas fa-bars"></i></a>
<br> <br>
<a href="#"><i class="fas fa-tachometer-alt"></i>&nbsp;<span>Dashboard</span></a> @admin
<a href="#"><i class="fas fa-car-crash"></i>&nbsp;<span>Karts</span></a> <a class="{{ currentRoute(route('admin.index')) }}" href="{{ route('admin.index') }}"><i class="fas fa-road"></i>&nbsp;<span>Admin dash</span></a>
<a href="#"><i class="fab fa-accessible-icon"></i>&nbsp;<span>Pilotes</span></a> @endadmin
<a href="#"><i class="fas fa-cogs"></i>&nbsp;<span>Paramètres</span></a> <a class="{{ currentRoute(route('relay.index')) }}" href="{{ route('relay.index') }}"><i class="fas fa-tachometer-alt"></i>&nbsp;<span>Vue course</span></a>
<a href="#"><i class="fas fa-flag-checkered"></i>&nbsp;<span>Démarrer</span></a> <a class="{{ currentRoute(route('kart.index')) }}" href="{{ route('kart.index') }}"><i class="fas fa-car-crash"></i>&nbsp;<span>Karts</span></a>
<a id="logout" class="nav-link" href="{{ route('logout') }}"><i class="fas fa-sign-out-alt"></i>&nbsp;<span>@lang('Déconnexion')</span></a> <a class="{{ currentRoute(route('pilot.index')) }}" href="{{ route('pilot.index') }}"><i class="fab fa-accessible-icon"></i>&nbsp;<span>Pilotes</span></a>
<a class="{{ currentRoute(route('race')) }}" href="{{ route('race') }}"><i class="fas fa-cogs"></i>&nbsp;<span>Paramètres</span></a>
<a class="{{ currentRoute(route('home')) }}" href="{{ route('home') }}"><i class="fas fa-flag-checkered"></i>&nbsp;<span>Démarrer</span></a>
<a id="logout" class="nav-link" href="{{ route('logout') }}"><i
class="fas fa-sign-out-alt"></i>&nbsp;<span>@lang('Déconnexion')</span></a>
<form id="logout-form" action="{{ route('logout') }}" method="POST" class="hide"> <form id="logout-form" action="{{ route('logout') }}" method="POST" class="hide">
{{ csrf_field() }} {{ csrf_field() }}
</form> </form>
</div> </div>
<imput id='kartid' type="hidden" value=""></imput>
<imput id='raceid' type="hidden" value=""></imput>
<div id="main"> <div id="main">
<!--<nav class="navbar fixed-top navbar-expand-lg navbar-dark bg-dark"> <!--<nav class="navbar fixed-top navbar-expand-lg navbar-dark bg-dark">
<a class="navbar-brand" href="{{ route('home') }}">{{ config('app.name', 'Album') }}</a> <a class="navbar-brand" href="{{ route('home') }}">{{ config('app.name', 'Album') }}</a>

View File

@ -0,0 +1,10 @@
@extends('layouts.logged')
@section('content')
<div class="container ">
<div class="row">
<div class="col-md-10 offset-md-1">
@yield('card')
</div>
</div>
</div>
@endsection

View File

@ -0,0 +1,73 @@
@extends('layouts.loggedform')
@section('card')
@component('components.card')
@slot('title')
@lang('Ajouter un pilote')
@endslot
<form method="POST" action="{{url('pilot')}}">
{{ csrf_field() }}
@include('partials.form-group', [
'title' => __('Prénom du pilote'),
'type' => 'text',
'name' => 'name',
'required' => true,
])
@include('partials.form-group', [
'title' => __('Nom du pilote'),
'type' => 'text',
'name' => 'first_name',
'required' => true,
])
@include('partials.form-group', [
'title' => __('Temp de référence'),
'type' => 'text',
'name' => 'ref_time',
'required' => true,
])
<div class="form-group">
<label for="first_name">Nom du pilote</label>
<select id="kart_id" class="form-control" name="kart_id" >
</select>
</div>
@component('components.button')
@lang('Envoyer')
@endcomponent
</form>
@endcomponent
<script type="text/javascript">
$(() => {
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$.ajax({
type: 'POST',
url: '/getkartsalldata',
data: {},
success: function (data) {
$( "#kart_id" ).html("");
$.each(data.data, function(k, v) {
if( $( "#kart_id" ).val() == v.id){
$('#kart_id').append($('<option>', {
value: v.id,
selected:true,
text: v.name
}));
}else{
$('#kart_id').append($('<option>', {
value: v.id,
text: v.name
}));
}
});
}
});
})
</script>
@endsection

View File

@ -0,0 +1,93 @@
@extends('layouts.loggedform')
@section('card')
@component('components.card')
@slot('title')
@lang('Liste des pilotes - ') <a href="{{route("pilot.create")}}"><i class="far fa-plus-square"></i></a>
@endslot
<table class="table table-bordered" id="pilots-table">
<thead>
<tr>
<th></th>
<th>kart_name</th>
<th>Name</th>
<th>first_name</th>
<th>ref_time</th>
</tr>
</thead>
</table>
<script type="text/javascript">
var tablePilots = '';
window.deletePilot = function (id) {
$.ajax({
url: '/pilot/' + id,
type: 'DELETE', // user.destroy
success: function (result) {
console.log('OK');
}
});
}
window.reloadData = function (id, name) {
document.cookie = "active_kartid=" + id;
document.cookie = "active_kartname=" + name;
if (name != null)
$('#btnChoiceKartTitle').html(name);
$.ajax({
url: '/getpilotsBykart',
data: {id: id},
success: function (data) {
$("#kartid").val(id);
if (tablePilots != '')
tablePilots.destroy();
tablePilots = $('#pilots-table').DataTable({
data: data.data,
columns: [
{
data: 'id',
render:
function (data, type, row, meta) {
return '<a onclick="deletePilot(' + data + ');tablePilots.row( $(this).parents(\'tr\') ).remove().draw();"><i class="far fa-trash-alt"></i></a>';
}
},
{
data: 'kart_name'
}
,
{
data: 'name'
}
,
{
data: 'first_name'
}
,
{
data: 'ref_time',
render:
function (data, type, row, meta) {
return moment.utc(data*1000).format('mm:ss');
}
}
]
})
;
}
});
}
$(() => {
reloadData(getCookie('active_kartid'), getCookie('active_kartname'));
})
</script>
@endcomponent
@endsection

View File

@ -0,0 +1,9 @@
@extends('layouts.form')
@section('card')
@component('components.card')
@slot('title')
@lang('Ajouter une team')
@endslot
@endcomponent
@endsection

View File

@ -0,0 +1,87 @@
@extends('layouts.loggedform')
@section('card')
@component('components.card')
@slot('title')
@lang('Paramétrer la course')
@endslot
<form method="POST" action="{{ route('race.store') }}">
{{ csrf_field() }}
@include('partials.form-group', [
'title' => __('Nom'),
'type' => 'text',
'name' => 'name',
'required' => true,
])
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="start_date">Date de début</label>
<div class="input-group date" id="datetimepicker2" data-target-input="nearest">
<input type="text" class="form-control datetimepicker-input" name="start_date"
required="true"
data-target="#datetimepicker2" data-toggle="datetimepicker"/>
<div class="input-group-append" data-target="#datetimepicker2" data-toggle="datetimepicker">
<div class="input-group-text"><i class="fa fa-calendar"></i></div>
</div>
</div>
</div>
@include('partials.form-group', [
'title' => __('Autonomie du karting (Sec)'),
'type' => 'integer',
'name' => 'autonomie_kart_sec',
'required' => true,
])
@include('partials.form-group', [
'title' => __('Durée des relais par défaut (Minutes)'),
'type' => 'integer',
'name' => 'relay_default_duration',
'required' => true,
])
</div>
<div class="col-md-6">
@include('partials.form-group', [
'title' => __('Durée'),
'type' => 'integer',
'name' => 'duration',
'required' => true,
])
@include('partials.form-group', [
'title' => __('Autonomie du karting (Humide)'),
'type' => 'integer',
'name' => 'autonomie_kart_humide',
'required' => true,
])
@include('partials.form-group', [
'title' => __('Duree dans les stands minimum (Minutes)'),
'type' => 'integer',
'name' => 'stand_duration',
'required' => true,
])
</div>
</div>
<div class="form-group">
<label for="comment">Commentaire</label><br />
<textarea class="textarea-form" name="comment" rows="5" cols="50">
</textarea>
</div>
@component('components.button')
@lang('Envoyer')
@endcomponent
</form>
<script>
$(() => {
$('#datetimepicker2').datetimepicker({
locale: 'fr',
format:'YYYY-MM-DD HH:mm:ss'
});
})
</script>
@endcomponent
@endsection

View File

@ -0,0 +1,85 @@
@extends('layouts.loggedform')
@section('card')
@component('components.card')
@slot('title')
@lang('Liste des courses - ') <a href="{{route("race.create")}}"><i class="far fa-plus-square"></i></a>
@endslot
<table class="table table-bordered" id="race-table">
<thead>
<tr>
<th></th>
<th>Nom</th>
<th>Date de début</th>
<th>Durée de la course</th>
<th>Durée relai</th>
<th>Durée stand</th>
</tr>
</thead>
</table>
<script type="text/javascript">
var tableRaces = '';
$(() => {
$.ajax({
url: '/getraces',
success: function (data) {
tableRaces = $('#race-table').DataTable({
data: data.data,
columns: [
{
data: 'id',
render:
function (data, type, row, meta) {
return '<a href="/race/' + data + '" "><i class="far fa-edit"></i></a>';
}
},
{
data: 'name'
}
,
{
data: 'start_date',
render:
function (data, type, row, meta) {
return moment.utc(data).format('DD/MM/YYYY hh:mm:ss');
}
}
,
{
data: 'duration',
render:
function (data, type, row, meta) {
return moment.utc(data * 1000 * 60).format('mm:ss');
}
}
,
{
data: 'relay_default_duration',
render:
function (data, type, row, meta) {
return moment.utc(data * 1000).format('mm:ss');
}
}
,
{
data: 'stand_duration',
render:
function (data, type, row, meta) {
return moment.utc(data * 1000).format('mm:ss');
}
}
]
});
}
});
})
</script>
@endcomponent
@endsection

View File

@ -0,0 +1,9 @@
@extends('layouts.form')
@section('card')
@component('components.card')
@slot('title')
@lang('Ajouter une team')
@endslot
@endcomponent
@endsection

View File

@ -0,0 +1,42 @@
@extends('layouts.loggedform')
@section('card')
@component('components.card')
@slot('title')
@lang('YO les ptits loups - ') <a href="{{route("pilot.create")}}"><i class="far fa-plus-square"></i></a>
@endslot
<script type="text/javascript">
var tableRelays = '';
var pilots = '';
var raceParams = '';
window.reloadData = function (id, name) {
document.cookie = "active_kartid=" + id;
document.cookie = "active_kartname=" + name;
if (name != null)
$('#btnChoiceKartTitle').html(name);
$.ajax({
url: '/getpilotsBykart',
data: {id: id},
success: function (data) {
pilots = data.data;
}
});
$.ajax({
url: '/getRaceParams',
success: function (data) {
raceParams = data.data;
}
});
}
$(() => {
reloadData(getCookie('active_kartid'), getCookie('active_kartname'));
})
</script>
@endsection

View File

@ -1,4 +1,4 @@
@extends('layouts.form') @extends('layouts.loggedform')
@section('card') @section('card')
@component('components.card') @component('components.card')
@slot('title') @slot('title')

View File

@ -16,9 +16,43 @@ Route::get('/', function () {
}); });
Auth::routes(); Auth::routes();
Route::middleware('admin')->group(function () {
Route::resource ('admin', 'AdminController', [
'except' => 'show'
]);
});
Route::resource('kart', 'KartController'); Route::resource('kart', 'KartController');
Route::resource('pilot', 'PilotController'); Route::resource('pilot', 'PilotController');
Route::resource('race', 'RaceController'); Route::resource('race', 'RaceController');
Route::resource('relay', 'RelayController'); Route::resource('relay', 'RelayController');
Route::get('/home', 'HomeController@index')->name('home'); Route::get('/home', 'HomeController@index')->name('home');
Route::get('/race', 'RaceController@index')->name('race');
/*
Route::get('/pilote', 'PilotController@index')->name('pilote');
Route::get('/addpilot', 'PilotController@create')->name('addpilot');
*/
///Routes pour les pilotes
Route::delete('/deletepilote', 'PilotController@create')->name('deletepilote');
Route::post('/getpilotalldata', 'PilotController@getPilotAllData')->name('getpilotalldata');
Route::get('/getpilotalldata', 'PilotController@getPilotAllData')->name('getpilotalldata');
Route::post('/getpilotsBykart', 'PilotController@getPilotsByKart')->name('getpilotsBykart');
Route::get('/getpilotsBykart', 'PilotController@getPilotsByKart')->name('getpilotsBykart');
///Routes pour les kartings
Route::post('/getkartsalldata', 'KartController@getKartsAllData')->name('getkartsalldata');
Route::get('/getkartsalldata', 'KartController@getKartsAllData')->name('getkartsalldata');
///
/// getallrace
Route::post('/getsmallraces', 'RaceController@getsmallraces')->name('getsmallraces');
Route::get('/getsmallraces', 'RaceController@getsmallraces')->name('getsmallraces');
Route::post('/getRaceParams', 'RaceController@getRaceParams')->name('getRaceParams');
Route::get('/getRaceParams', 'RaceController@getRaceParams')->name('getRaceParams');
Route::post('/getraces', 'RaceController@getraces')->name('getraces');
Route::get('/getraces', 'RaceController@getraces')->name('getraces');

View File

@ -11,4 +11,5 @@
const mix = require('laravel-mix'); const mix = require('laravel-mix');
mix.js('resources/js/app.js', 'public/js') mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css'); .sass('resources/sass/app.scss', 'public/css')
.sass('resources/sass/metronic.scss', 'public/css');