Merge branch '3.2.0' into 'dev'

3.2.0

See merge request TheGamecraft/c-cms!33
This commit is contained in:
Mathieu Lagace
2019-08-17 22:04:28 +00:00
30 changed files with 1267 additions and 269 deletions

23
app/Booking.php Normal file
View File

@@ -0,0 +1,23 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Booking extends Model
{
public function bookable()
{
return $this->morphTo();
}
public function user()
{
return $this->belongsTo('App\User');
}
public function item()
{
return $this->belongsTo('App\Item');
}
}

23
app/Course.php Normal file
View File

@@ -0,0 +1,23 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Course extends Model
{
public function bookings()
{
return $this->morphMany('App\Booking', 'bookable');
}
public function user()
{
return $this->belongsTo('App\User');
}
public function event()
{
return $this->belongsTo('App\Event');
}
}

23
app/Event.php Normal file
View File

@@ -0,0 +1,23 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Event extends Model
{
public function bookings()
{
return $this->morphMany('App\Booking', 'bookable');
}
public function courses()
{
return $this->hasMany('App\Course');
}
public function user()
{
return $this->belongsTo('App\User');
}
}

View File

@@ -0,0 +1,85 @@
<?php
namespace App\Http\Controllers;
use App\Booking;
use Illuminate\Http\Request;
class BookingController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function 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 \App\Booking $booking
* @return \Illuminate\Http\Response
*/
public function show(Booking $booking)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Booking $booking
* @return \Illuminate\Http\Response
*/
public function edit(Booking $booking)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Booking $booking
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Booking $booking)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param \App\Booking $booking
* @return \Illuminate\Http\Response
*/
public function destroy(Booking $booking)
{
//
}
}

View File

@@ -72,9 +72,9 @@ class ConfigController extends Controller
$config = Config::all()->where('name',request('perm'))->first();
if (request('value') == "true") {
$config->state = 1;
$config->data = ["true"];
} else {
$config->state = 0;
$config->data = ["false"];
}
$config->save();

View File

@@ -0,0 +1,85 @@
<?php
namespace App\Http\Controllers;
use App\Course;
use Illuminate\Http\Request;
class CourseController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function 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 \App\Course $course
* @return \Illuminate\Http\Response
*/
public function show(Course $course)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Course $course
* @return \Illuminate\Http\Response
*/
public function edit(Course $course)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Course $course
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Course $course)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param \App\Course $course
* @return \Illuminate\Http\Response
*/
public function destroy(Course $course)
{
//
}
}

View File

@@ -0,0 +1,85 @@
<?php
namespace App\Http\Controllers;
use App\Event;
use Illuminate\Http\Request;
class EventController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function 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 \App\Event $event
* @return \Illuminate\Http\Response
*/
public function show(Event $event)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Event $event
* @return \Illuminate\Http\Response
*/
public function edit(Event $event)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Event $event
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Event $event)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param \App\Event $event
* @return \Illuminate\Http\Response
*/
public function destroy(Event $event)
{
//
}
}

View File

@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
use \App\Schedule;
use function GuzzleHttp\json_encode;
use PDF;
class ScheduleController extends Controller
{
@@ -57,14 +58,96 @@ class ScheduleController extends Controller
public function apiIndex()
{
$schedules = Schedule::all();
$activity = \App\ComplementaryActivity::all();
$start = substr(request()->start,0,10);
$end = substr(request()->end,0,10);
$allschedules = Schedule::all();
$allevents = \App\Event::all();
$events = [];
$jsonevents = [];
$schedules = [];
foreach ($allschedules as $schedule) {
if($schedule->date >= $start && $schedule->date <= $end) {
array_push($schedules,$schedule);
}
}
foreach ($allevents as $event) {
if($event->date_begin >= $start && $event->date_begin <= $end) {
array_push($events,$event);
}
else if($event->date_end >= $start && $event->date_end <= $end) {
array_push($events,$event);
}
}
foreach ($schedules as $schedule) {
$color = $this->getColor($schedule->type);
$event = [
'title' => $schedule->data['event_name'],
'start' => $schedule->date.'T'.$schedule->data['event_begin_time'],
'end' => $schedule->date.'T'.$schedule->data['event_end_time'],
'color' => $color,
'source' => 'schedule',
'id' => $schedule->id
];
array_push($jsonevents,$event);
}
foreach ($events as $event) {
$color = $this->getColor($event->type);
$myevent = [
'title' => $event->name,
'start' => $event->date_begin,
'end' => $event->date_end,
'color' => $color,
'extraParams' => [
'db_type' => 'event'],
'id' => $event->id
];
array_push($jsonevents,$myevent);
}
return json_encode($jsonevents);
}
public function loadModal($id,$db_type)
{
if($db_type == "event")
{
$event = \App\Event::find($id);
}
else
{
$event = \App\Schedule::find($id);
}
return view('public.modal.schedule',['event' => $event]);
}
public function loadModalFull($id,$db_type)
{
if($db_type == "event")
{
$event = \App\Event::find($id);
}
else
{
$event = \App\Schedule::find($id);
}
return view('admin.schedule.modal.show',['event' => $event]);
}
public function getColor($type)
{
$activity = \App\ComplementaryActivity::all();
$color = 'blue';
switch ($schedule->type) {
switch ($type) {
case 'regular':
$color = 'orange';
break;
@@ -102,27 +185,18 @@ class ScheduleController extends Controller
break;
default:
if ($activity->find($schedule->type)) {
$color = $activity->find($schedule->type)->calendar_color;
if ($activity->find($type)) {
$color = $activity->find($type)->calendar_color;
}
break;
};
$event = [
'title' => $schedule->data['event_name'],
'start' => $schedule->date.'T'.$schedule->data['event_begin_time'],
'end' => $schedule->date.'T'.$schedule->data['event_end_time'],
'color' => $color,
'id' => $schedule->id
];
array_push($events,$event);
return $color;
}
return json_encode($events);
}
public function loadModal($id)
public function printtopdf($id)
{
return view('public.modal.schedule',['event' => \App\Schedule::find($id)]);
$event = \App\Event::find($id);
$pdf = PDF::loadView('admin.schedule.modal.show',['event' => $event]);
return $pdf->download($event->date_begin.'.pdf');
}
}

View File

@@ -17,4 +17,9 @@ class Item extends Model
$col_items->forget(0);
return $col_items;
}
public function bookings()
{
return $this->hasMany('App\Booking');
}
}

View File

@@ -50,6 +50,21 @@ class User extends Authenticatable
return $this->hasMany(Message::class);
}
public function events()
{
return $this->hasMany('App\Event');
}
public function bookings()
{
return $this->hasMany('App\Booking');
}
public function courses()
{
return $this->hasMany('App\Course');
}
public function routeNotificationForNexmo($notification)
{
return $this->telephone;

View File

@@ -6,6 +6,7 @@
"type": "project",
"require": {
"php": "^7.1.3",
"barryvdh/laravel-dompdf": "^0.8.4",
"fideloper/proxy": "^4.0",
"guzzlehttp/guzzle": "^6.3",
"laravel/framework": "5.6.*",

245
composer.lock generated
View File

@@ -4,8 +4,64 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "b914f34bb5ca62a2b7d916629dc30d1a",
"content-hash": "a92d2a9579b7e0ef7e3c8b77e8c5dcde",
"packages": [
{
"name": "barryvdh/laravel-dompdf",
"version": "v0.8.4",
"source": {
"type": "git",
"url": "https://github.com/barryvdh/laravel-dompdf.git",
"reference": "3fd817065e1c820b1ddace8b2bf65ca45088df4f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/barryvdh/laravel-dompdf/zipball/3fd817065e1c820b1ddace8b2bf65ca45088df4f",
"reference": "3fd817065e1c820b1ddace8b2bf65ca45088df4f",
"shasum": ""
},
"require": {
"dompdf/dompdf": "^0.8",
"illuminate/support": "5.5.x|5.6.x|5.7.x|5.8.x",
"php": ">=7"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "0.8-dev"
},
"laravel": {
"providers": [
"Barryvdh\\DomPDF\\ServiceProvider"
],
"aliases": {
"PDF": "Barryvdh\\DomPDF\\Facade"
}
}
},
"autoload": {
"psr-4": {
"Barryvdh\\DomPDF\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Barry vd. Heuvel",
"email": "barryvdh@gmail.com"
}
],
"description": "A DOMPDF Wrapper for Laravel",
"keywords": [
"dompdf",
"laravel",
"pdf"
],
"time": "2019-02-26T18:07:43+00:00"
},
{
"name": "dnoegel/php-xdg-base-dir",
"version": "0.1",
@@ -168,6 +224,72 @@
],
"time": "2019-07-30T19:33:28+00:00"
},
{
"name": "dompdf/dompdf",
"version": "v0.8.3",
"source": {
"type": "git",
"url": "https://github.com/dompdf/dompdf.git",
"reference": "75f13c700009be21a1965dc2c5b68a8708c22ba2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dompdf/dompdf/zipball/75f13c700009be21a1965dc2c5b68a8708c22ba2",
"reference": "75f13c700009be21a1965dc2c5b68a8708c22ba2",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-mbstring": "*",
"phenx/php-font-lib": "0.5.*",
"phenx/php-svg-lib": "0.3.*",
"php": ">=5.4.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8|^5.5|^6.5",
"squizlabs/php_codesniffer": "2.*"
},
"suggest": {
"ext-gd": "Needed to process images",
"ext-gmagick": "Improves image processing performance",
"ext-imagick": "Improves image processing performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-develop": "0.7-dev"
}
},
"autoload": {
"psr-4": {
"Dompdf\\": "src/"
},
"classmap": [
"lib/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.1"
],
"authors": [
{
"name": "Fabien Ménager",
"email": "fabien.menager@gmail.com"
},
{
"name": "Brian Sweeney",
"email": "eclecticgeek@gmail.com"
},
{
"name": "Gabriel Bull",
"email": "me@gabrielbull.com"
}
],
"description": "DOMPDF is a CSS 2.1 compliant HTML to PDF converter",
"homepage": "https://github.com/dompdf/dompdf",
"time": "2018-12-14T02:40:31+00:00"
},
{
"name": "dragonmantank/cron-expression",
"version": "v2.3.0",
@@ -1319,6 +1441,83 @@
],
"time": "2018-07-02T15:55:56+00:00"
},
{
"name": "phenx/php-font-lib",
"version": "0.5.1",
"source": {
"type": "git",
"url": "https://github.com/PhenX/php-font-lib.git",
"reference": "760148820110a1ae0936e5cc35851e25a938bc97"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PhenX/php-font-lib/zipball/760148820110a1ae0936e5cc35851e25a938bc97",
"reference": "760148820110a1ae0936e5cc35851e25a938bc97",
"shasum": ""
},
"require-dev": {
"phpunit/phpunit": "^4.8"
},
"type": "library",
"autoload": {
"psr-4": {
"FontLib\\": "src/FontLib"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0"
],
"authors": [
{
"name": "Fabien Ménager",
"email": "fabien.menager@gmail.com"
}
],
"description": "A library to read, parse, export and make subsets of different types of font files.",
"homepage": "https://github.com/PhenX/php-font-lib",
"time": "2017-09-13T16:14:37+00:00"
},
{
"name": "phenx/php-svg-lib",
"version": "v0.3.2",
"source": {
"type": "git",
"url": "https://github.com/PhenX/php-svg-lib.git",
"reference": "ccc46ef6340d4b8a4a68047e68d8501ea961442c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PhenX/php-svg-lib/zipball/ccc46ef6340d4b8a4a68047e68d8501ea961442c",
"reference": "ccc46ef6340d4b8a4a68047e68d8501ea961442c",
"shasum": ""
},
"require": {
"sabberworm/php-css-parser": "8.1.*"
},
"require-dev": {
"phpunit/phpunit": "~5.0"
},
"type": "library",
"autoload": {
"psr-0": {
"Svg\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0"
],
"authors": [
{
"name": "Fabien Ménager",
"email": "fabien.menager@gmail.com"
}
],
"description": "A library to read, parse and export to PDF SVG files.",
"homepage": "https://github.com/PhenX/php-svg-lib",
"time": "2018-06-03T10:10:03+00:00"
},
{
"name": "php-http/guzzle6-adapter",
"version": "v1.1.1",
@@ -1927,6 +2126,50 @@
],
"time": "2018-07-19T23:38:55+00:00"
},
{
"name": "sabberworm/php-css-parser",
"version": "8.1.0",
"source": {
"type": "git",
"url": "https://github.com/sabberworm/PHP-CSS-Parser.git",
"reference": "850cbbcbe7fbb155387a151ea562897a67e242ef"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sabberworm/PHP-CSS-Parser/zipball/850cbbcbe7fbb155387a151ea562897a67e242ef",
"reference": "850cbbcbe7fbb155387a151ea562897a67e242ef",
"shasum": ""
},
"require": {
"php": ">=5.3.2"
},
"require-dev": {
"phpunit/phpunit": "*"
},
"type": "library",
"autoload": {
"psr-0": {
"Sabberworm\\CSS": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Raphael Schweikert"
}
],
"description": "Parser for CSS Files written in PHP",
"homepage": "http://www.sabberworm.com/blog/2010/6/10/php-css-parser",
"keywords": [
"css",
"parser",
"stylesheet"
],
"time": "2016-07-19T19:14:21+00:00"
},
{
"name": "swiftmailer/swiftmailer",
"version": "v6.2.1",

View File

@@ -158,9 +158,11 @@ return [
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
/*
* Package Service Providers...
*/
Barryvdh\DomPDF\ServiceProvider::class,
/*
* Application Service Providers...
@@ -219,6 +221,7 @@ return [
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'PDF' => Barryvdh\DomPDF\Facade::class,
],

View File

@@ -0,0 +1,39 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateEventsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('events', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('date_begin');
$table->string('date_end');
$table->string('type');
$table->string('user_id');
$table->string('location');
$table->boolean('is_mandatory');
$table->text('desc');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('events');
}
}

View File

@@ -0,0 +1,39 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCoursesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('courses', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('ocom');
$table->integer('periode');
$table->integer('level');
$table->string('location');
$table->text('comment');
$table->integer('event_id');
$table->integer('user_id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('courses');
}
}

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateBookingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('bookings', function (Blueprint $table) {
$table->increments('id');
$table->integer('item_id');
$table->integer('amount');
$table->integer('bookable_id');
$table->string('bookable_type');
$table->integer('user_id');
$table->text('comment');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('bookings');
}
}

24
public/css/custom.css vendored
View File

@@ -5,6 +5,7 @@
.calendar-body-column {
display: flex;
}
.calendar-container {
width: 14%;
height: 7.5rem;
@@ -14,20 +15,25 @@
padding: 0px !important;
background-color: white;
}
.calendar-date {
float: left;
margin-left: 1rem;
}
.calendar-text {
float: right;
}
.calendar-text>div {
text-align: start;
}
.calendar_event_name {
height: 3rem;
overflow: hidden;
}
@media only screen and (max-width: 800px) {
.calendar-container {
width: 100%;
@@ -45,23 +51,28 @@
height: 7.5rem;
margin: 0px;
}
.btn-calendar:hover {
background-color: #f2f2f26e;
}
.thead-dark {
color: #fff;
background-color: #212529;
border-color: #32383e;
text-align: center;
}
.loader {
text-align: center;
}
.loader-bg {
width: 70px;
margin-top: 50px;
margin-bottom: 50px;
}
.loader-spinner {
position: absolute;
border: 16px solid #f3f3f3;
@@ -78,10 +89,19 @@
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.cs-notification:hover {
background-color: #F2F2F2 !important;
color: white;
}
.modal-lg {
max-width: 1150px !important;
}

40
public/js/calendar.js vendored Normal file
View File

@@ -0,0 +1,40 @@
function initFullCalendar(authToken) {
document.addEventListener('DOMContentLoaded', function () {
var calendarEl = document.getElementById('fullCalendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
plugins: ['dayGrid','interaction'],
locale: 'fr-ca',
header: {
left: 'title',
center: '',
right: 'prev,next'
},
events: '/api/schedule/events',
eventClick: function (info) {
$.get("/api/schedule/full/events/" + info.event.id + "/"+ info.event.extendedProps.extraParams.db_type + "/modal?api_token="+authToken, function (data) {
$("#modal-content").html(data);
});
$('#schedulemodal').modal('toggle')
},
dateClick: function (info) {
var date = moment(info.date).format("YYYY-MM-DD");
Swal.fire({
title: 'Ajouter un evenement?',
text: "Voulez vous ajouter un evenement le "+date,
type: 'warning',
showCancelButton: true,
confirmButtonText: 'Oui',
cancelButtonText: 'Non',
}).then((result) => {
if (result.value) {
window.location.href = '/admin/schedule/add/'+date;
}
})
}
});
calendar.render();
});
}

24
resources/custom.css vendored
View File

@@ -5,6 +5,7 @@
.calendar-body-column {
display: flex;
}
.calendar-container {
width: 14%;
height: 7.5rem;
@@ -14,20 +15,25 @@
padding: 0px !important;
background-color: white;
}
.calendar-date {
float: left;
margin-left: 1rem;
}
.calendar-text {
float: right;
}
.calendar-text>div {
text-align: start;
}
.calendar_event_name {
height: 3rem;
overflow: hidden;
}
@media only screen and (max-width: 800px) {
.calendar-container {
width: 100%;
@@ -45,23 +51,28 @@
height: 7.5rem;
margin: 0px;
}
.btn-calendar:hover {
background-color: #f2f2f26e;
}
.thead-dark {
color: #fff;
background-color: #212529;
border-color: #32383e;
text-align: center;
}
.loader {
text-align: center;
}
.loader-bg {
width: 70px;
margin-top: 50px;
margin-bottom: 50px;
}
.loader-spinner {
position: absolute;
border: 16px solid #f3f3f3;
@@ -78,10 +89,19 @@
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.cs-notification:hover {
background-color: #F2F2F2 !important;
color: white;
}
.modal-lg {
width: 80%;
}

View File

@@ -4,14 +4,7 @@
<div class="col-sm-12 col-lg-12">
<div class="card">
<div class="card-body pb-0">
<div class="dropdown float-right">
<button class="btn bg-transparent dropdown-toggle theme-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown">
<i class="fa fa-cog"></i>
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
</div>
</div>
<div class="calendar"></div>
<div id="fullCalendar"></div>
</div>
</div>
</div>
@@ -61,8 +54,14 @@
@endsection
@section('custom_scripts')
<script src='/assets/fullcalendar/core/main.js'></script>
<script src='/assets/fullcalendar/daygrid/main.js'></script>
<script src='/assets/fullcalendar/interaction/main.js'></script>
<script src="/js/calendar.js"></script>
<div class="log"></div>
<script>
initFullCalendar(api_token)
function deleteEvent(pid){
swal({
title: 'Êtes vous certain ?',
@@ -97,4 +96,10 @@
})
}
</script>
<div class="modal fade" id="schedulemodal" tabindex="-1" role="dialog" aria-labelledby="schedulemodal" aria-hidden="true">
<div class="modal-dialog w-100 modal-lg mx-2 mx-lg-auto" role="document">
<div class="modal-content" id="modal-content">
</div>
</div>
</div>
@endsection

View File

@@ -12,14 +12,14 @@
<div class="col col-md-8"><label for="text-input" class=" form-control-label">Horaire publique</label><small class="form-text text-muted">L'horaire est t-il disponible publique sur la page d'accueil du site</small></div>
<div class="col col-md-4" style="margin: auto;">
<label for="disabled-input" class=" form-control-label"></label>
<label class="switch switch-3d switch-primary mr-3" style="margin-left: 3rem;"><input id="is_schedule_public" name="is_schedule_public" class="switch-input" @if($configs->where('name','is_schedule_public')->first()->state == 1) checked="true" @endif type="checkbox" onchange="saveChange('is_schedule_public')"><span class="switch-label"></span><span class="switch-handle"></span></label>
<label class="switch switch-3d switch-primary mr-3" style="margin-left: 3rem;"><input id="is_schedule_public" name="is_schedule_public" class="switch-input" @if(\App\Config::getData('is_schedule_public') === "true") checked="true" @endif type="checkbox" onchange="saveChange('is_schedule_public')"><span class="switch-label"></span><span class="switch-handle"></span></label>
</div>
</div>
<div class="col-md-6">
<div class="col col-md-8"><label for="text-input" class=" form-control-label">Horaire complet</label><small class="form-text text-muted">L'horaire est t-il complet ? Si cette option est désactivé les utilisateurs ne reseverons pas de notification concernant l'horaire</small></div>
<div class="col col-md-4" style="margin: auto;">
<label for="disabled-input" class=" form-control-label"></label>
<label class="switch switch-3d switch-primary mr-3" style="margin-left: 3rem;"><input id="is_schedule_build" name="is_schedule_build" class="switch-input" @if($configs->where('name','is_schedule_build')->first()->state == 1) checked="true" @endif type="checkbox" onchange="saveChange('is_schedule_build')"><span class="switch-label"></span><span class="switch-handle"></span></label>
<label class="switch switch-3d switch-primary mr-3" style="margin-left: 3rem;"><input id="is_schedule_build" name="is_schedule_build" class="switch-input" @if(\App\Config::getData('is_schedule_build') === "true") checked="true" @endif type="checkbox" onchange="saveChange('is_schedule_build')"><span class="switch-label"></span><span class="switch-handle"></span></label>
</div>
</div>
</div>

View File

@@ -0,0 +1,105 @@
@extends('layouts.modal.schedule.show')
@section('content')
<div class="row">
<div class="col-md-6">
Du <strong>{{$event->date_begin}}</strong> au <strong>{{$event->date_end}}</strong><br>
<small>{{$event->location}} </small>
</div>
<div class="col-md-6 text-right">
@if ($event->is_mandatory)
<span class="badge badge-pill badge-warning">Obligatoire</span>
@else
<span class="badge badge-pill badge-info">Optionnel</span>
@endif
@if (is_int($event->type))
<span class="badge badge-pill badge-default">{{$event->type}}</span>
@else
<span class="badge badge-pill" style="background-color: {{\App\ComplementaryActivity::find($event->type)->calendar_color}}">{{\App\ComplementaryActivity::find($event->type)->name}}</span>
@endif
</div>
</div>
<div class="row mt-4">
<div class="col-md-12">
{{$event->desc}}
</div>
</div>
@if (!$event->courses->isEmpty())
<div class="row mt-4">
<div class="col-md-12">
<h4 class="title text-center">Horaire</h4>
<div class="row d-none d-md-flex">
<div class="col-md-2 m-3"></div>
@for ($p = 1; $p <= \App\Config::getData('admin_periode_nb'); $p++)
<div class="col-md m-3">
Période {{$p}} <small>{{\App\Config::all()->where('name','admin_periode_begin')->first()->data[$p]}} à {{\App\Config::all()->where('name','admin_periode_end')->first()->data[$p]}} </small>
</div>
@endfor
</div>
@for ($l = 1; $l <= \App\Config::getData('admin_level_in_schedule_nb'); $l++)
<div class="row">
<div class="col-md-2 m-3">
Niveau {{$l}}
</div>
@for ($p = 1; $p <= \App\Config::getData('admin_periode_nb'); $p++)
<div class="col-md m-3">
@foreach ($event->courses as $course)
@if ($course->periode == $p && $course->level == $l)
<div class="row">
<div class="col-sm-6 my-2">
{{$course->name}}
</div>
<div class="col-sm-6 my-2 text-sm-right">
{{\App\User::find($course->user_id)->fullname()}}
</div>
<div class="col-sm-6 my-2">
{{$course->ocom}}
</div>
<div class="col-sm-6 my-2 text-sm-right">
{{$course->location}}
</div>
<div class="col-sm-12">
<a class="btn btn-primary btn-sm btn-block" data-toggle="collapse" href="#collapse{{$l.$p}}" aria-expanded="false" aria-controls="collapse{{$l.$p}}">Réservation de materiel</a>
<div class="collapse" id="collapse{{$l.$p}}">
<div class="m-3">
@if (!$course->bookings->isEmpty())
<div class="row">
<div class="col-sm-8 p-2">
<strong>Item</strong>
</div>
<div class="col-sm-4 text-right p-2">
<strong>Quantité</strong>
</div>
<hr>
@foreach ($course->bookings as $booking)
<div class="col-sm-8 p-2">
<a href="/admin/item/{{$booking->item->id}}">{{$booking->item->name}}</a>
</div>
<div class="col-sm-4 text-right p-2">
{{$booking->amount}}
</div>
@endforeach
</div>
@else
<p class="text-center">
<strong>Aucune réservation</strong>
</p>
@endif
<hr>
<a class="btn btn-primary btn-sm btn-block mt-2" href="/admin/booking/course/{{$course->id}}" role="button">Modifier les réservation</a>
</div>
</div>
</div>
</div>
@endif
@endforeach
</div>
@endfor
</div>
@endfor
</div>
</div>
@endif
@endsection

View File

@@ -20,5 +20,9 @@
<!-- Material Dashboard CSS -->
<link href="/css/material-dashboard.css" rel="stylesheet">
<!-- Plugin CSS -->
<link href='/assets/fullcalendar/core/main.css' rel='stylesheet' />
<link href='/assets/fullcalendar/daygrid/main.css' rel='stylesheet' />
<!-- Custom CSS -->
<link rel="stylesheet" href="/css/custom.css">

View File

@@ -13,8 +13,6 @@
<script src="/js/plugins/bootstrap-datetimepicker.min.js"></script>
<!-- DataTables.net Plugin, full documentation here: https://datatables.net/ -->
<script src="/js/plugins/jquery.dataTables.min.js"></script>
<!-- Full Calendar Plugin, full documentation here: https://github.com/fullcalendar/fullcalendar -->
<script src="/js/plugins/fullcalendar.min.js"></script>
<!-- Plugin for the Sliders, full documentation here: http://refreshless.com/nouislider/ -->
<script src="/js/plugins/nouislider.min.js" ></script>
<!-- Include a polyfill for ES6 Promises (optional) for IE11, UC Browser and Android browser support SweetAlert -->

View File

@@ -0,0 +1,14 @@
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">{{$event->name}}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
@yield('content')
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Fermer</button>
</div>

View File

@@ -22,16 +22,16 @@
<i class="material-icons">airplanemode_active</i> L'escadron
</a>
<div class="dropdown-menu">
<a class="dropdown-item" href="#">
<a class="dropdown-item" href="#news">
<i class="material-icons mr-2">new_releases</i>Nouvelles
</a>
<a class="dropdown-item" href="#">
<a class="dropdown-item" href="#activity">
<i class="material-icons mr-2">landscape</i>Nos Activitées
</a>
<a class="dropdown-item" href="#">
<a class="dropdown-item" href="#picture">
<i class="material-icons mr-2">photo_camera</i>Photos
</a>
<a class="dropdown-item" href="#">
<a class="dropdown-item" href="#calendar">
<i class="material-icons mr-2">calendar_today</i>Calendrier
</a>
<a class="dropdown-item" href="#cta">

View File

@@ -65,8 +65,8 @@
events: '/api/schedule/events',
eventClick: function(info) {
console.log(info.event.id)
$.get( "/api/schedule/events/"+info.event.id+"/modal", function( data ) {
$( "#schedulemodal" ).html( data );
$.get( "/api/schedule/events/" + info.event.id + "/"+ info.event.extendedProps.extraParams.db_type + "/modal", function( data ) {
$( "#modal-content" ).html( data );
});
$('#schedulemodal').modal('toggle')
}
@@ -77,22 +77,8 @@
</script>
<div class="modal fade" id="schedulemodal" tabindex="-1" role="dialog" aria-labelledby="schedulemodal" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
<div class="modal-dialog w-100 modal-lg mx-2 mx-lg-auto" role="document">
<div class="modal-content" id="modal-content"></div>
</div>
</div>
</body>

View File

@@ -1,17 +1,34 @@
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">{{$event->data['event_name']}}</h5>
<h5 class="modal-title" id="exampleModalLabel">{{$event->name}}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
{{$event->type}}
<div class="row">
<div class="col-md-6">
Du <strong>{{$event->date_begin}}</strong> au <strong>{{$event->date_end}}</strong><br>
<small>{{$event->location}} </small>
</div>
<div class="col-md-6 text-right">
@if ($event->is_mandatory)
<span class="badge badge-pill badge-warning">Obligatoire</span>
@else
<span class="badge badge-pill badge-info">Optionnel</span>
@endif
@if (is_int($event->type))
<span class="badge badge-pill badge-default">{{$event->type}}</span>
@else
<span class="badge badge-pill" style="background-color: {{\App\ComplementaryActivity::find($event->type)->calendar_color}}">{{\App\ComplementaryActivity::find($event->type)->name}}</span>
@endif
</div>
</div>
<div class="row mt-4">
<div class="col-md-12">
{{$event->desc}}
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Fermer</button>
</div>

View File

@@ -13,7 +13,7 @@ use Illuminate\Http\Request;
|
*/
Route::get('/schedule/events','ScheduleController@apiIndex');
Route::get('/schedule/events/{id}/modal','ScheduleController@loadModal');
Route::get('/schedule/events/{id}/{db_type}/modal','ScheduleController@loadModal');
Route::middleware('auth:api')->group(function () {
Route::get('/user', function (Request $request) {
@@ -26,6 +26,8 @@ Route::middleware('auth:api')->group(function () {
Route::post('/calendar/loadDay', 'CalendarController@show');
Route::post('/calendar/delete', 'CalendarController@delete');
Route::get('/schedule/full/events/{id}/{db_type}/modal','ScheduleController@loadModalFull');
/** Message Route */
Route::post('/message/delete', 'MessageController@destroy');

View File

@@ -36,11 +36,13 @@ Route::middleware(['auth','admin'])->group(function () {
/** Calendar */
Route::get('/admin/calendar', 'CalendarController@index');
Route::get('/admin/calendar/add/{type}/{date}', ['uses' =>'CalendarController@add']);
Route::get('/admin/calendar/add/{date}', ['uses' =>'CalendarController@add']);
Route::get('/admin/calendar/edit/{id}', ['uses' =>'CalendarController@edit']);
Route::post('/admin/calendar/add', 'CalendarController@store');
Route::patch('/admin/calendar/edit/{id}', ['uses' =>'CalendarController@patch']);
Route::get('/admin/calendar/pdf/{id}','ScheduleController@printtopdf');
/** Statistique */
Route::get('/admin/stats/log' , 'LogController@index');
@@ -82,6 +84,11 @@ Route::middleware(['auth','admin'])->group(function () {
Route::post('/admin/inventory/add/{id}/{periode}/{niveau}' , 'InventoryController@store');
Route::post('/admin/inventory/remove/{id}/{periode}/{niveau}' , 'InventoryController@destroy');
/** Booking */
Route::get('/admin/booking/{type}/{id}',function() {
return 'A faire';
});
/** Item */
Route::get('/admin/item/add' , 'ItemController@create');
Route::get('/admin/item/edit/{id}' , 'ItemController@edit');