Merge branch '3.2.4' into 'dev'

3.2.4

See merge request TheGamecraft/c-cms!70
This commit is contained in:
Mathieu Lagace
2019-10-02 12:16:14 +00:00
43 changed files with 789 additions and 381 deletions

View File

@@ -13,7 +13,7 @@ class Course extends Model
public function user()
{
return $this->belongsTo('App\User');
return $this->belongsTo('App\User');
}
public function event()

View File

@@ -18,7 +18,7 @@ class Event extends Model
public function user()
{
return $this->belongsTo('App\User');
return $this->belongsTo('App\User');
}
public function course($p,$l)
@@ -40,4 +40,18 @@ class Event extends Model
{
return $this->morphMany('App\Log', 'logable');
}
public static function future()
{
$events = collect();
foreach (Event::all() as $event)
{
if (date('U',strtotime($event->date_begin)) >= time())
{
$events->push($event);
}
}
return $events;
}
}

View File

@@ -50,7 +50,8 @@ class EventController extends Controller
$event->is_mandatory = 0;
}
$event->desc = request('desc');
$event->msg = request('msg');
$event->date_msg = request('date_msg');
$event->save();
if ($event->type == 1) {
@@ -60,7 +61,7 @@ class EventController extends Controller
$course = new \App\Course();
$users = \App\User::all();
$instructor = 1;
$instructor = request('instruc_n'.$l.'_p'.$p);
foreach ($users as $user) {
if($user->fullname() == request('instruc_n'.$l.'_p'.$p))
@@ -130,6 +131,7 @@ class EventController extends Controller
$event->is_mandatory = 0;
}
$event->desc = request('desc');
$event->msg = \request('msg');
$event->save();
@@ -151,7 +153,7 @@ class EventController extends Controller
}
$users = \App\User::all();
$instructor = 1;
$instructor = request('instruc_n'.$l.'_p'.$p);
foreach ($users as $user) {
if($user->fullname() == request('instruc_n'.$l.'_p'.$p))

View File

@@ -20,7 +20,7 @@ class JobController extends Controller
$jobs = $jobs_sorted->values();
return view('admin.job.index', ['jobs' => $jobs]);
return view('admin.configs.jobs.index', ['jobs' => $jobs]);
}
/**

View File

@@ -14,13 +14,13 @@ class NewsController extends Controller
*/
public function index()
{
return view('public.allnews',['news' => News::where('publish','=','1')->paginate(9)]);
return view('public.allnews',['news' => News::allWithWeeklyMsg()->where('publish','=','1')->sortByDesc('updated_at')->paginate(9)]);
}
public function indexAdmin()
{
clogNav('a consulté les nouvelles');
return view('admin.news.index',['news' => \App\News::paginate(9)]);
return view('admin.news.index',['news' => News::allWithWeeklyMsg()->sortByDesc('updated_at')->paginate(9)]);
}
/**
@@ -69,8 +69,14 @@ class NewsController extends Controller
*/
public function show($id)
{
clog('see','success','a consulté une nouvelle',null,'App\News',$id);
return view('public.news', ['new' => \App\News::find($id)]);
if (\request('type') == 'msg')
{
return view('public.news', ['new' => \App\News::getWeeklyMsg(\App\Event::find($id))]);
}
else
{
return view('public.news', ['new' => \App\News::find($id)]);
}
}
/**

View File

@@ -2,6 +2,7 @@
namespace App\Http\Controllers;
use App\News;
use Illuminate\Http\Request;
class PublicController extends Controller
@@ -14,7 +15,7 @@ class PublicController extends Controller
public function index()
{
return view('public.index',[
'news' => \App\News::all()->where('publish','1')->sortByDesc('created_at')->take(3),
'news' => \App\News::allWithWeeklyMsg()->where('publish','=','1')->sortByDesc('created_at')->take(3),
'activities' => \App\ComplementaryActivity::all()->where('is_promoted','1'),
'pictures' => \App\Picture::all()->sortByDesc('created_at')->take(\App\Config::getData('nb_activity_public'))
]);

View File

@@ -213,10 +213,14 @@ class ScheduleController extends Controller
$activity = \App\ComplementaryActivity::find($type);
$begin_time = $date." ".$activity->begin_time;
$end_time = $date." ".$activity->end_time;
$msg_time = Date('c',strtotime($begin_time.'-4day'));
return view('admin.schedule.modal.add',[
'activity' => \App\ComplementaryActivity::find($type),
'begin_time' => $begin_time,
'end_time' => $end_time
'end_time' => $end_time,
'msg_time' => $msg_time
]);
}

View File

@@ -6,7 +6,26 @@ use Illuminate\Database\Eloquent\Model;
class Job extends Model
{
protected $casts = [
'perm' => 'array',
];
public function permissions()
{
return collect(json_decode($this->permissions,true));
}
public function permission($permission)
{
foreach ($this->permissions() as $perm => $value)
{
if ($permission == $perm)
{
return $value;
}
}
return 0;
}
public function p($perm)
{
return $this->permission($perm);
}
}

View File

@@ -6,6 +6,10 @@ use Illuminate\Database\Eloquent\Model;
class News extends Model
{
protected $casts = [
'tags' => 'array',
];
public function user()
{
return $this->belongsTo('App\User');
@@ -20,4 +24,39 @@ class News extends Model
{
return $this->morphMany('App\Log', 'logable');
}
public static function allWithWeeklyMsg()
{
$news = \App\News::all();
foreach (\App\Event::future() as $event)
{
if($event->type = 1)
{
if (date('U',strtotime($event->date_msg)) <= time())
{
$news->push(self::getWeeklyMsg($event));
}
}
}
return $news;
}
public static function getWeeklyMsg(\App\Event $event)
{
$n = new News();
$n->event_id = $event->id;
$n->title = 'Message de la semaine du '.date('Y-m-d',strtotime($event->date_begin));
$n->body = $event->msg;
$n->user_id = $event->user_id;
$n->publish = 1;
$n->created_at = $event->created_at;
$n->updated_at = $event->updated_at;
$n->tags = ['message de la semaine','Important'];
return $n;
}
}

View File

@@ -3,7 +3,9 @@
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
class AppServiceProvider extends ServiceProvider
{
@@ -15,6 +17,29 @@ class AppServiceProvider extends ServiceProvider
public function boot()
{
Schema::defaultStringLength(191);
/**
* Paginate a standard Laravel Collection.
*
* @param int $perPage
* @param int $total
* @param int $page
* @param string $pageName
* @return array
*/
Collection::macro('paginate', function($perPage, $total = null, $page = null, $pageName = 'page') {
$page = $page ?: LengthAwarePaginator::resolveCurrentPage($pageName);
return new LengthAwarePaginator(
$this->forPage($page, $perPage),
$total ?: $this->count(),
$perPage,
$page,
[
'path' => LengthAwarePaginator::resolveCurrentPath(),
'pageName' => $pageName,
]
);
});
}
/**

View File

@@ -32,6 +32,11 @@ class User extends Authenticatable
return $this->belongsTo('App\Rank');
}
public function job()
{
return $this->belongsTo('App\Job');
}
public function logs()
{
return $this->hasMany(Log::class);
@@ -287,7 +292,14 @@ class User extends Authenticatable
public function permission($perm)
{
return $this->rank->permission($perm);
if ($this->job->permission($perm) == 0)
{
return $this->rank->permission($perm);
}
else
{
return $this->job->permission($perm);
}
}
public function p($perm)

View File

@@ -25,23 +25,7 @@ class CreateUsersTable extends Migration
$table->string('age');
$table->string('avatar')->default('1');
$table->string('sexe');
$table->string('job')->default(6);
$table->string('acces_level')->default('unknown');
$table->string('schedule_see')->default('unknown');
$table->string('schedule_edit')->default('unknown');
$table->string('schedule_notify')->default('unknown');
$table->string('message_see')->default('unknown');
$table->string('message_edit')->default('unknown');
$table->string('message_notify')->default('unknown');
$table->string('paper_edit')->default('unknown');
$table->string('paper_publish')->default('unknown');
$table->string('paper_notify')->default('unknown');
$table->string('inventory_see')->default('unknown');
$table->string('inventory_edit')->default('unknown');
$table->string('inventory_notify')->default('unknown');
$table->string('user_see')->default('unknown');
$table->string('user_edit')->default('unknown');
$table->string('user_notify')->default('unknown');
$table->string('job_id')->default(6);
$table->string('api_token', 60)->unique()->default(str_shuffle(str_random(60)));
$table->rememberToken();
$table->timestamps();

View File

@@ -17,22 +17,7 @@ class CreateJobsTable extends Migration
$table->increments('id');
$table->string('name');
$table->text('desc');
$table->text('acces_level');
$table->boolean('schedule_see');
$table->boolean('schedule_edit');
$table->boolean('schedule_notify');
$table->boolean('message_see');
$table->boolean('message_edit');
$table->boolean('message_notify');
$table->boolean('paper_edit');
$table->boolean('paper_publish');
$table->boolean('paper_notify');
$table->boolean('inventory_see');
$table->boolean('inventory_edit');
$table->boolean('inventory_notify');
$table->boolean('user_see');
$table->boolean('user_edit');
$table->boolean('user_notify');
$table->text('permissions');
$table->timestamps();
});
}

View File

@@ -19,6 +19,7 @@ class CreateNewsTable extends Migration
$table->text('body');
$table->integer('user_id');
$table->boolean('publish');
$table->string('tags')->default("[]");
$table->timestamps();
});
}

View File

@@ -23,6 +23,8 @@ class CreateEventsTable extends Migration
$table->string('location');
$table->boolean('is_mandatory');
$table->text('desc');
$table->text('msg');
$table->string('date_msg');
$table->timestamps();
});
}

View File

@@ -221,6 +221,11 @@ class ConfigsTableSeeder extends Seeder
'name' => 'public_index_img_url',
'state' => 0,
'data' => '["./assets/img/bg2.jpg"]'
],
[
'name' => 'default_weekly_msg',
'state' => 0,
'data' => "[\"<strong>/* Nom de l'évènement */</strong><br>Heure (Cadets):<br>Lieu:<br>Tenue:<br>Matériel:<br>/* Commentaire */\"]"
]
];

View File

@@ -15,82 +15,7 @@ class JobsTableSeeder extends Seeder
[
'name' => "Indéterminé",
'desc' => "Aucun poste",
'acces_level' => '0',
'schedule_see' => false,
'schedule_edit' => false,
'schedule_notify' => false,
'message_see' => false,
'message_edit' => false,
'message_notify' => false,
'paper_edit' => false,
'paper_publish' => false,
'paper_notify' => false,
'inventory_see' => false,
'inventory_edit' => false,
'inventory_notify' => false,
'user_see' => false,
'user_edit' => false,
'user_notify' => false
],
[
'name' => "Cadet Commandant",
'desc' => "Description a modifier ...",
'acces_level' => '2',
'schedule_see' => true,
'schedule_edit' => true,
'schedule_notify' => true,
'message_see' => true,
'message_edit' => true,
'message_notify' => true,
'paper_edit' => true,
'paper_publish' => true,
'paper_notify' => false,
'inventory_see' => true,
'inventory_edit' => true,
'inventory_notify' => false,
'user_see' => true,
'user_edit' => true,
'user_notify' => false
],
[
'name' => "Chef Instructeur",
'desc' => "Description a modifier ...",
'acces_level' => '2',
'schedule_see' => true,
'schedule_edit' => true,
'schedule_notify' => false,
'message_see' => true,
'message_edit' => true,
'message_notify' => true,
'paper_edit' => true,
'paper_publish' => true,
'paper_notify' => false,
'inventory_see' => true,
'inventory_edit' => true,
'inventory_notify' => false,
'user_see' => true,
'user_edit' => false,
'user_notify' => false
],
[
'name' => "Adjudant Maitre d'Escadron",
'desc' => "Description a modifier ...",
'acces_level' => '2',
'schedule_see' => true,
'schedule_edit' => false,
'schedule_notify' => false,
'message_see' => true,
'message_edit' => true,
'message_notify' => true,
'paper_edit' => true,
'paper_publish' => true,
'paper_notify' => false,
'inventory_see' => true,
'inventory_edit' => true,
'inventory_notify' => false,
'user_see' => true,
'user_edit' => false,
'user_notify' => false
'permissions' => \App\Permission::allToString(0)
]
]);
}

View File

@@ -15,7 +15,7 @@ class RanksTableSeeder extends Seeder
[
'name' => "SuperAdmin",
'acces_level' => '2',
'desc' => 'Compte SuperAdmin donne toutes les permissions ne peux être modifié',
'desc' => 'Compte SuperAdmin donne toutes les permissions <strong>ne peux être modifié</strong>',
'permissions' => \App\Permission::allToString(1)
]
]);

View File

@@ -22,7 +22,7 @@ class UsersTableSeeder extends Seeder
'age' => '99',
'avatar' => '3',
'sexe' => 'm',
'job' => '1',
'job_id' => '1',
'api_token' => str_shuffle(str_random(60)),
],
[
@@ -35,7 +35,7 @@ class UsersTableSeeder extends Seeder
'age' => '99',
'avatar' => '3',
'sexe' => 'm',
'job' => '1',
'job_id' => '1',
'api_token' => str_shuffle(str_random(60)),
]
]);

34
public/css/custom.css vendored
View File

@@ -2,6 +2,14 @@
margin-top: 50px;
}
.news-title {
height: 3.2rem;
}
.news-tags {
height: 1.5rem;
}
.news-body-small {
height: 15rem;
overflow: hidden;
@@ -53,6 +61,32 @@
height: 3rem;
overflow: hidden;
}
.autocomplete-items {
position: absolute;
border: 1px solid #d4d4d4;
border-bottom: none;
border-top: none;
z-index: 99;
/*position the autocomplete items to be the same width as the container:*/
top: 50%;
left: 0;
right: 0;
}
.autocomplete-items div {
padding: 10px;
cursor: pointer;
background-color: #fff;
border-bottom: 1px solid #d4d4d4;
}
.autocomplete-items div:hover {
/*when hovering an item:*/
background-color: #e9e9e9;
}
.autocomplete-active {
/*when navigating through the items using the arrow keys:*/
background-color: DodgerBlue !important;
color: #ffffff;
}
@media only screen and (max-width: 800px) {
.calendar-container {

View File

@@ -45,6 +45,7 @@ function switchType(date) {
$.get( "/api/schedule/events/add/modal/"+selectInput.val()+"/"+date+"?api_token="+api_token, function( data ) {
$( "#container" ).html( data );
console.log( "Loading defaut value for activity type ("+selectInput.val()+")" );
$('select').selectpicker();
});
}

106
public/js/plugins/autocomplete.js vendored Normal file
View File

@@ -0,0 +1,106 @@
function autocomplete(inp, arr) {
/*the autocomplete function takes two arguments,
the text field element and an array of possible autocompleted values:*/
var currentFocus;
/*execute a function when someone writes in the text field:*/
inp.addEventListener("input", function(e) {
var a, b, i, val = this.value;
/*close any already open lists of autocompleted values*/
closeAllLists();
if (!val) { return false;}
currentFocus = -1;
/*create a DIV element that will contain the items (values):*/
a = document.createElement("DIV");
a.setAttribute("id", this.id + "autocomplete-list");
a.setAttribute("class", "autocomplete-items");
/*append the DIV element as a child of the autocomplete container:*/
this.parentNode.appendChild(a);
/*for each item in the array...*/
for (i = 0; i < arr.length; i++) {
/*check if the item starts with the same letters as the text field value:*/
if (arr[i].substr(0, val.length).toUpperCase() == val.toUpperCase()) {
/*create a DIV element for each matching element:*/
b = document.createElement("DIV");
/*make the matching letters bold:*/
b.innerHTML = "<strong>" + arr[i].substr(0, val.length) + "</strong>";
b.innerHTML += arr[i].substr(val.length);
/*insert a input field that will hold the current array item's value:*/
b.innerHTML += "<input type='hidden' value='" + arr[i] + "'>";
/*execute a function when someone clicks on the item value (DIV element):*/
b.addEventListener("click", function(e) {
/*insert the value for the autocomplete text field:*/
inp.value = this.getElementsByTagName("input")[0].value;
/*close the list of autocompleted values,
(or any other open lists of autocompleted values:*/
closeAllLists();
});
a.appendChild(b);
}
}
});
/*execute a function presses a key on the keyboard:*/
inp.addEventListener("keydown", function(e) {
var x = document.getElementById(this.id + "autocomplete-list");
if (x) x = x.getElementsByTagName("div");
if (e.keyCode == 40) {
/*If the arrow DOWN key is pressed,
increase the currentFocus variable:*/
currentFocus++;
/*and and make the current item more visible:*/
addActive(x);
} else if (e.keyCode == 38) { //up
/*If the arrow UP key is pressed,
decrease the currentFocus variable:*/
currentFocus--;
/*and and make the current item more visible:*/
addActive(x);
} else if (e.keyCode == 13) {
/*If the ENTER key is pressed, prevent the form from being submitted,*/
e.preventDefault();
if (currentFocus > -1) {
/*and simulate a click on the "active" item:*/
if (x) x[currentFocus].click();
}
}
});
function addActive(x) {
/*a function to classify an item as "active":*/
if (!x) return false;
/*start by removing the "active" class on all items:*/
removeActive(x);
if (currentFocus >= x.length) currentFocus = 0;
if (currentFocus < 0) currentFocus = (x.length - 1);
/*add class "autocomplete-active":*/
x[currentFocus].classList.add("autocomplete-active");
}
function removeActive(x) {
/*a function to remove the "active" class from all autocomplete items:*/
for (var i = 0; i < x.length; i++) {
x[i].classList.remove("autocomplete-active");
}
}
function closeAllLists(elmnt) {
/*close all autocomplete lists in the document,
except the one passed as an argument:*/
var x = document.getElementsByClassName("autocomplete-items");
for (var i = 0; i < x.length; i++) {
if (elmnt != x[i] && elmnt != inp) {
x[i].parentNode.removeChild(x[i]);
}
}
}
/*execute a function when someone clicks in the document:*/
document.addEventListener("click", function (e) {
closeAllLists(e.target);
});
}
function initAutoComplete(htmlClass)
{
$.get('/api/user/list?api_token='+api_token, function ( data ) {
var users = JSON.parse(data);
$("."+htmlClass).each(function ( index ) {
autocomplete(document.getElementById(this.id), users);
})
});
}

34
resources/custom.css vendored
View File

@@ -2,6 +2,14 @@
margin-top: 50px;
}
.news-title {
height: 3.2rem;
}
.news-tags {
height: 1.5rem;
}
.news-body-small {
height: 15rem;
overflow: hidden;
@@ -53,6 +61,32 @@
height: 3rem;
overflow: hidden;
}
.autocomplete-items {
position: absolute;
border: 1px solid #d4d4d4;
border-bottom: none;
border-top: none;
z-index: 99;
/*position the autocomplete items to be the same width as the container:*/
top: 50%;
left: 0;
right: 0;
}
.autocomplete-items div {
padding: 10px;
cursor: pointer;
background-color: #fff;
border-bottom: 1px solid #d4d4d4;
}
.autocomplete-items div:hover {
/*when hovering an item:*/
background-color: #e9e9e9;
}
.autocomplete-active {
/*when navigating through the items using the arrow keys:*/
background-color: DodgerBlue !important;
color: #ffffff;
}
@media only screen and (max-width: 800px) {
.calendar-container {

View File

@@ -10,7 +10,7 @@
<div class="card-body">
<div class="row">
@foreach($activity as $a)
<div class="col-md-4">
<div class="col-xl-4 col-lg-6">
<div class="card">
<div class="card-header">
<h4 class="card-title">{{$a->name}}</h4>
@@ -23,17 +23,17 @@
<div class="card-footer">
<div class="row">
<div class="col-md-12">
<div class="btn-group w-100">
<div class="text-center">
@if(\Auth::user()->p('article_edit') == 1)
<a href="/admin/article/activity/edit/{{$a->id}}" type="button" class="btn btn-secondary btn-block"><i class="fa fa-cog"></i>&nbsp; Modifier l'article</a>
<a href="/admin/article/activity/edit/{{$a->id}}" type="button" class="btn btn-secondary"><i class="fa fa-cog"></i>&nbsp; Modifier l'article</a>
@endif
@if(\Auth::user()->p('article_edit') == 1 && \Auth::user()->p('picture_add'))
<a href="/admin/article/activity/picture/{{$a->id}}" type="button" class="btn btn-secondary btn-block"><i class="fa fa-picture-o"></i>&nbsp; Gérer les photos</a>
<a href="/admin/article/activity/picture/{{$a->id}}" type="button" class="btn btn-secondary"><i class="fa fa-picture-o"></i>&nbsp; Gérer les photos</a>
@endif
</div>
</div>
<div class="col-md-12">
<a href="/activity/{{$a->id}}" target="_blank" type="button" class="btn btn-outline-secondary btn-block"><i class="fa fa-picture-o"></i>&nbsp; Voir l'article</a>
<div class="col-md-12 text-center">
<a href="/activity/{{$a->id}}" target="_blank" type="button" class="btn btn-outline-secondary"><i class="fa fa-picture-o"></i>&nbsp; Voir l'article</a>
</div>
</div>
</div>

View File

@@ -25,7 +25,11 @@
{{$event->fulldesc}}
</div>
<div class="col-md-6 text-right">
{{$event->user->fullname()}}
@if(is_numeric($event->user_id))
{{$event->user->fullname()}}
@else
{{$event->user_id}}
@endif
</div>
</div>
</div>

View File

@@ -7,18 +7,18 @@
Configuration Générale
</div>
<div class="card-body">
<div class="row form-group">
<div class="row">
@foreach ($activities as $activity)
<div class="col-md-6 p-2">
<div class="col-lg-12 col-xl-6 p-2">
<div class="row m-auto">
<div class="col-md-8">
<div class="col">
<label for="text-input" class=" form-control-label">{{$activity->name}}</label>
<small class="form-text text-muted">{{$activity->admin_desc}}</small>
</div>
<div class="col-md-3">
<div class="col text-right">
<div class="btn-group">
<a href="/admin/config/activity/edit/{{$activity->id}}" class="btn btn-primary"><i class="fa fa-cog" aria-hidden="true"></i> Modifier</a>
<button class="btn btn-danger" onclick="delActivity({{$activity->id}})" ><i class="fa fa-times" aria-hidden="true" data-toggle="tooltip" data-placement="bottom" title="Supprimer"></i></button>
<button class="btn btn-danger" onclick="delActivity({{$activity->id}})" ><i class="fa fa-times" aria-hidden="true" data-toggle="tooltip" data-placement="bottom" title="Supprimer"></i></button>
</div>
</div>
</div>

View File

@@ -0,0 +1,48 @@
@extends('layouts.admin.main')
@section('content')
<div class="col-md-12">
<div class="card">
<div class="card-header card-header-primary">
<h4>Configuration des postes</h4>
</div>
<div class="card-body mt-5">
<div class="row">
<div class="col-md-12">
<a href="/admin/config/jobs/add" class="btn btn-primary btn-block mb-3">Ajouter un poste</a>
</div>
@foreach($jobs as $job)
<div class="col-md-4">
<div class="card">
<div class="card-header @if($job->id == 1) card-header-danger @else card-header-primary @endif">
<h4>{{$job->name}}</h4>
</div>
<div class="card-body">
<div>
{!! $job->desc!!}
</div>
<div class="row">
<div class="col-md-10">
@if($job->id == 1)
<button disabled class="btn btn-primary btn-block">Gérer</button>
@else
<a href="/admin/config/jobs/{{$job->id}}" class="btn btn-primary btn-block">Gérer</a>
@endif
</div>
<div class="col">
@if($job->id == 1)
<button disabled class="btn btn-danger btn-just-icon"><i class="fa fa-close"></i></button>
@else
<button class="btn btn-danger btn-just-icon"><i class="fa fa-close"></i></button>
@endif
</div>
</div>
</div>
</div>
</div>
@endforeach
</div>
</div>
</div>
</div>
@endsection

View File

@@ -8,6 +8,9 @@
</div>
<div class="card-body mt-5">
<div class="row">
<div class="col-md-12">
<a href="/admin/config/ranks/add" class="btn btn-primary btn-block mb-3">Ajouter un grade</a>
</div>
@foreach($ranks as $rank)
<div class="col-md-4">
<div class="card">
@@ -16,11 +19,22 @@
</div>
<div class="card-body">
<div>
{{$rank->desc}}
{!! $rank->desc!!}
</div>
<div class="row">
<div class="col-md-12">
<a href="/admin/config/ranks/{{$rank->id}}" class="btn btn-primary btn-block">Gérer</a>
<div class="col-md-10">
@if($rank->id == 1)
<button disabled class="btn btn-primary btn-block">Gérer</button>
@else
<a href="/admin/config/ranks/{{$rank->id}}" class="btn btn-primary btn-block">Gérer</a>
@endif
</div>
<div class="col">
@if($rank->id == 1)
<button disabled class="btn btn-danger btn-just-icon"><i class="fa fa-close"></i></button>
@else
<button class="btn btn-danger btn-just-icon"><i class="fa fa-close"></i></button>
@endif
</div>
</div>
</div>

View File

@@ -1,139 +1,144 @@
@extends('layouts.admin.main')
@section('content')
<div class="row">
<div class="col-lg-8 col-md-12">
<div class="col-md-12">
<div class="card">
<div class="card-header card-header-primary">
<h4 class="card-title"> Cours à venir</h4>
</div>
<div class="card-body">
@if(\Auth::user()->courses->isEmpty())
<div class="col-sm-12 text-center">
<h4 class="m-4">Aucun cours à venir</h4>
</div>
@endif
@foreach (\Auth::user()->courses->take(6) as $course)
<div class="col-sm-6">
<div class="card">
<div class="card-body">
<h4><strong>{{$course->ocom}} - {{$course->name}}</strong></h4>
<p class="float-left">{{date('Y-m-d',strtotime($course->event->date_begin))}}</p>
<p class="float-right">Période {{$course->periode}}, Niveau {{$course->level}}</p>
</div>
</div>
</div>
@endforeach
</div>
</div>
</div>
<div class="col-md-12">
<div class="card">
<div class="card-header card-header-primary">
<h4 class="card-title">Activité à venir</h4>
</div>
<div class="card-body">
<div class="row">
@if(count($futureEvent) == 0)
<div class="col-sm-12 text-center">
<h4 class="m-4">Aucune activité à venir</h4>
</div>
@endif
@foreach ($futureEvent as $event)
<div class="col-md-12">
<div class="alert" style="background-color: {{\App\ComplementaryActivity::find($event->type)->calendar_color}}">
<div class="row text-white">
<div class="col-md-2 text-capitalize m-auto d-none d-md-flex">
<h3 class="m-0 p-0" style="margin-top: -0.5rem !important;">{!! \App\ComplementaryActivity::find($event->type)->calendar_icon !!}</h3>
</div>
<div class="col-md">
{{$event->name}}
</div>
<div class="col-md-4">
{{$event->date_begin}}
</div>
</div>
</div>
</div>
@endforeach
</div>
<br>
<a href="/admin/schedule" type="button" class="btn btn-primary btn-lg btn-block">Afficher plus</a>
</div>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="col-12">
<div class="card card-profile">
<div class="card-avatar">
<a>
<img class="img" src="/assets/admin/images/avatar/user-{{\Auth::User()->avatar}}.jpg">
</a>
</div>
<div class="card-body">
<div class="mx-auto d-block">
<h5 class="text-sm-center mt-2 mb-1">{{\Auth::User()->fullname()}}</h5>
<div class="location text-sm-center"><i class="fa fa-id-card-o" aria-hidden="true"></i> {{\Auth::User()->rank->name}}</div>
</div>
<hr>
<div class="card-text text-sm-center">
<a class="btn btn-block btn-secondary" href="/admin/profil">Profil</a>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="card">
<div class="card-header card-header-info">
<h4 class="card-title">Nouvelles</h4>
</div>
<div class="card-body">
<div class="row">
@foreach (\App\News::all()->forPage(1,4); as $msg)
<div class="col-12 text-center">
<a href="/admin/message/{{$msg->id}}">
<div style="height:2rem;">{{$msg->title}}</div>
<br>
<div class="msg-body" style="height:12rem;overflow:hidden">
{!!$msg->body!!}
</div>
<br>
</a>
</div>
@endforeach
</div>
<br>
<a href="/admin/news" type="button" class="btn btn-primary btn-lg btn-block text-white">Afficher plus</a>
</div>
</div>
</div>
@if(\Auth::user()->p('stats_see') == 1)
<div class="col-12">
<div class="row">
<div class="col-lg-8 col-md-12">
<div class="col-md-12">
<div class="card">
<div class="card-header card-header-primary">
<h4 class="card-title">Activité sur le site</h4>
<h4 class="card-title"> Cours à venir</h4>
</div>
<div class="card-body">
@foreach (\App\Log::all()->forPage(1,3); as $log)
<div class="row mt-3">
<div class="col-lg-12 col-xl-3 mx-3 my-auto">
<span class="badge badge-pill badge-{{$log->typeColor()}} mr-2">{{$log->type}}</span>
</div>
<div class="col">
{{$log->user->fullname()}} - {{$log->event}}
</div>
<div class="row">
@if(\Auth::user()->courses->isEmpty())
<div class="col-sm-12 text-center">
<h4 class="m-4">Aucun cours à venir</h4>
</div>
@endforeach
<br>
<a href="/admin/stats/log" type="button" class="btn btn-primary btn-lg btn-block text-white">Afficher plus</a>
@else
@foreach (\Auth::user()->courses->take(6) as $course)
@if($course->event != null)
<div class="col-sm-6">
<div class="card">
<div class="card-body">
<h4><strong>{{$course->ocom}} - {{$course->name}}</strong></h4>
<p class="float-left">{{date('Y-m-d',strtotime($course->event->date_begin))}}</p>
<p class="float-right">Période {{$course->periode}}, Niveau {{$course->level}}</p>
</div>
</div>
</div>
@endif
@endforeach
@endif
</div>
</div>
</div>
</div>
@endif
<div class="col-md-12">
<div class="card">
<div class="card-header card-header-primary">
<h4 class="card-title">Activité à venir</h4>
</div>
<div class="card-body">
<div class="row">
@if(count($futureEvent) == 0)
<div class="col-sm-12 text-center">
<h4 class="m-4">Aucune activité à venir</h4>
</div>
@endif
@foreach ($futureEvent as $event)
<div class="col-md-12">
<div class="alert" style="background-color: {{\App\ComplementaryActivity::find($event->type)->calendar_color}}">
<div class="row text-white">
<div class="col-md-2 text-capitalize m-auto d-none d-md-flex">
<h3 class="m-0 p-0" style="margin-top: -0.5rem !important;">{!! \App\ComplementaryActivity::find($event->type)->calendar_icon !!}</h3>
</div>
<div class="col-md">
{{$event->name}}
</div>
<div class="col-md-4">
{{$event->date_begin}}
</div>
</div>
</div>
</div>
@endforeach
</div>
<br>
<a href="/admin/schedule" type="button" class="btn btn-primary btn-lg btn-block">Afficher plus</a>
</div>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="col-12">
<div class="card card-profile">
<div class="card-avatar">
<a>
<img class="img" src="/assets/admin/images/avatar/user-{{\Auth::User()->avatar}}.jpg">
</a>
</div>
<div class="card-body">
<div class="mx-auto d-block">
<h5 class="text-sm-center mt-2 mb-1">{{\Auth::User()->fullname()}}</h5>
<div class="location text-sm-center"><i class="fa fa-id-card-o" aria-hidden="true"></i> {{\Auth::User()->rank->name}}</div>
</div>
<hr>
<div class="card-text text-sm-center">
<a class="btn btn-block btn-secondary" href="/admin/profil">Profil</a>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="card">
<div class="card-header card-header-info">
<h4 class="card-title">Nouvelles</h4>
</div>
<div class="card-body">
<div class="row">
@foreach (\App\News::all()->forPage(1,3) as $msg)
<div class="col-12 text-center">
<a href="/admin/message/{{$msg->id}}">
<div style="height:2rem;">{{$msg->title}}</div>
<br>
<div class="msg-body" style="height:12rem;overflow:hidden">
{!!$msg->body!!}
</div>
<br>
</a>
</div>
@endforeach
</div>
<br>
<a href="/admin/news" type="button" class="btn btn-primary btn-lg btn-block text-white">Afficher plus</a>
</div>
</div>
</div>
@if(\Auth::user()->p('stats_see') == 1)
<div class="col-12">
<div class="card">
<div class="card-header card-header-primary">
<h4 class="card-title">Activité sur le site</h4>
</div>
<div class="card-body">
@foreach (\App\Log::all()->forPage(1,3); as $log)
<div class="row mt-3">
<div class="col-lg-12 col-xl-3 mx-3 my-auto">
<span class="badge badge-pill badge-{{$log->typeColor()}} mr-2">{{$log->type}}</span>
</div>
<div class="col">
{{$log->user->fullname()}} - {{$log->event}}
</div>
</div>
@endforeach
<br>
<a href="/admin/stats/log" type="button" class="btn btn-primary btn-lg btn-block text-white">Afficher plus</a>
</div>
</div>
</div>
@endif
</div>
</div>
</div>
@endsection
@section('breadcrumb')

View File

@@ -15,7 +15,7 @@
<div class="col-md-8">
<div class="form-group">
<label>Titre</label>
<input class="form-control" type="text" name="title">
<input class="form-control" type="text" name="title" required>
<small class="form-text text-muted">Titre de la nouvelle à publier</small>
</div>
</div>
@@ -33,7 +33,7 @@
<div class="col-md-12">
<div class="form-group">
<label>Contenu</label>
<textarea id="body" name="body"></textarea>
<textarea id="body" name="body" required></textarea>
</div>
</div>
<div class="col-md-12">

View File

@@ -3,14 +3,14 @@
@section('content')
<div class="col-md-12">
<div class="card">
<div class="card-header">
<div class="card-header card-header-primary">
<strong class="card-title">Nouvelles <a href="#"><i class="fa fa-question-circle" aria-hidden="true"></i>
</a></strong>
</div>
<div class="card-body">
<div class="btn-group btn-block">
@if(\Auth::user()->p('news_add') == 1)
<a name="add" id="add" class="btn btn-primary btn-block" href="/admin/news/add" role="button">Ajouter un nouvelle</a>
<a name="add" id="add" class="btn btn-outline-primary btn-block" href="/admin/news/add" role="button">Ajouter un nouvelle</a>
@endif
</div>
<hr>
@@ -24,8 +24,19 @@
<div class="col-md-4">
<div class="card">
<div class="card-header">
<h4 class="card-title">{{$n->title}}</h4>
<h4 class="card-title news-title">{{$n->title}}</h4>
<p class="category">{{$n->user->fullname()}} - {{$n->created_at}}
<div class="news-tags">
@if($n->tags != [])
@foreach($n->tags as $tag)
@if($tag == "Important")
<span class="badge badge-pill badge-danger">{{$tag}}</span>
@else
<span class="badge badge-pill badge-default">{{$tag}}</span>
@endif
@endforeach
@endif
</div>
@if($n->publish == 0) <span class="badge badge-warning float-right">Brouillon</span> @endif</p>
</div>
<div class="card-body news-body-small">
@@ -33,10 +44,12 @@
</div>
<div class="card-footer">
<div class="btn-group">
@if(\Auth::user()->p('news_edit') == 1)
@if(\Auth::user()->p('news_edit') == 1 && !isset($n->event_id))
<a href="/admin/news/edit/{{$n->id}}" type="button" class="btn btn-secondary"><i class="fa fa-cog"></i>&nbsp; Modifier</a>
@else
<a href="/admin/schedule/edit/{{$n->event_id}}" type="button" class="btn btn-secondary"><i class="fa fa-cog"></i>&nbsp; Modifier</a>
@endif
@if(\Auth::user()->p('news_delete') == 1)
@if(\Auth::user()->p('news_delete') == 1 && !isset($n->event_id))
<a type="button" class="btn btn-danger" onclick="deleteEvent({{$n->id}});"><i class="fa fa-times-circle" style="color:white;"></i></a>
@endif
</div>
@@ -44,6 +57,9 @@
</div>
</div>
@endforeach
<div class="col-12">
{{ $news->links() }}
</div>
</div>
</div>
</div>

View File

@@ -49,6 +49,7 @@ $('.datetimepicker').datetimepicker({
close: 'fa fa-remove'
}
});
$('select').selectpicker();
</script>
@endsection

View File

@@ -23,6 +23,9 @@
</div>
</div>
<div class="row" id="container">
<div class="col-md-12 mt-4 text-center">
<h4>Information Générale</h4>
</div>
<div class="col-md-12">
<div class="form-group">
<label for="name">Nom de l'événement</label>
@@ -30,26 +33,26 @@
<small id="nameHelp" class="text-muted">Veuillez entrer le nom de l'événement</small>
</div>
</div>
<div class="col-md-2">
<div class="col-lg-3 col-md-4">
<div class="form-group">
<label class="label-control">Date et Heure de début</label>
<input name="begin" type="text" id="datetimepickerbegin" class="form-control datetimepicker" required/>
</div>
</div>
<div class="col-md-2">
<div class="col-lg-3 col-md-4">
<div class="form-group">
<label class="label-control">Date et Heure de fin</label>
<input name="end" type="text" id="datetimepickerend" class="form-control datetimepicker" required/>
</div>
</div>
<div class="col-md-5">
<div class="col-lg-6 col-md-4">
<div class="form-group">
<label for="name">Lieux</label>
<input type="text" name="location" id="location" class="form-control" placeholder="" aria-describedby="nameHelp" value="{{$activity->location}}" required>
<small id="nameHelp" class="text-muted">Veuillez entrer le lieu de l'événement</small>
</div>
</div>
<div class="col-md-3 m-auto">
<div class="col-md-12 my-auto text-center">
<div class="form-group">
<div class="form-check">
<label class="form-check-label">
@@ -57,23 +60,54 @@
@if ($activity->is_mandatory == 1)
checked
@endif>
L'événement est obligatoire
L'événement est t-il obligatoire pour tous les cadets ?
<span class="form-check-sign">
<span class="check"></span>
</span>
<span class="check"></span>
</span>
</label>
</div>
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label for="desc">Commentaire</label>
<br>
<textarea class="form-control" name="desc" id="desc" rows="6" required>{!!$activity->desc!!}</textarea>
<div class="col-md-12 mt-4 text-center">
<h4>Options Supplémentaires</h4>
</div>
<div class="col-md-12 mt-4">
<ul class="nav nav-pills mb-3 justify-content-center" id="pills-tab" role="tablist">
<li class="nav-item w-25">
<a class="nav-link active w-100" id="pills-home-tab" data-toggle="pill" href="#comment" role="tab" aria-controls="pills-home" aria-selected="true">Description</a>
</li>
<li class="nav-item w-25">
<a class="nav-link" id="pills-profile-tab" data-toggle="pill" href="#msg" role="tab" aria-controls="pills-profile" aria-selected="false">Message de la semaine</a>
</li>
</ul>
<div class="tab-content" id="pills-tabContent">
<div class="tab-pane fade show active" id="comment" role="tabpanel" aria-labelledby="pills-home-tab">
<div class="form-group">
<textarea class="form-control richeditor" name="desc" id="desc" rows="6" required>{{$activity->desc}}</textarea>
</div>
</div>
<div class="tab-pane fade" id="msg" role="tabpanel" aria-labelledby="pills-profile-tab">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="label-control">Date et heure de publication des messages de la semaine</label>
<input name="date_msg" type="text" id="datetimepickermsg" class="form-control datetimepicker" required/>
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<textarea class="form-control richeditor" name="msg" id="msg" rows="6" required>{{$activity->msg}}</textarea>
</div>
</div>
</div>
</div>
</div>
</div>
@if ($activity->type == 1)
<div class="col-md-12 mt-4 text-center">
<h4>Horaire d'instruction</h4>
</div>
<div class="col-md-12">
<div id="accordion" role="tablist">
@for ($i = 1; $i <= \App\Config::getData('admin_level_in_schedule_nb'); $i++)
@@ -104,7 +138,9 @@
<div class="form-group">
<div class="form-group">
<label for="name">Instructeur</label>
<input type="text" name="instruc_n{{$i}}_p{{$p}}" id="instruc_n{{$i}}_p{{$p}}" class="form-control basicAutoComplete" aria-describedby="nameHelp" required @if($activity->course($p,$i) != null) value="{{\App\User::find($activity->course($p,$i)->user_id)->fullname()}}" @endif>
<div class="autocomplete">
<input type="text" name="instruc_n{{$i}}_p{{$p}}" id="instruc_n{{$i}}_p{{$p}}" class="form-control AutoComplete" aria-describedby="nameHelp" autocomplete="off" required @if($activity->course($p,$i) != null) value="@if(is_numeric($activity->course($p,$i)->user_id)){{\App\User::find($activity->course($p,$i)->user_id)->fullname()}} @else {{$activity->course($p,$i)->user_id}} @endif" @endif>
</div>
<small id="nameHelp" class="text-muted">Veuillez entrer le nom de l'instructeur</small>
</div>
</div>
@@ -146,9 +182,12 @@
@section('custom_scripts')
<script src="/js/calendar.js"></script>
<script src="/js/plugins/autocomplete.js"></script>
<script>
var countries = ["Afghanistan","Albania","Algeria","Andorra","Angola","Anguilla","Antigua &amp; Barbuda","Argentina","Armenia","Aruba","Australia","Austria","Azerbaijan","Bahamas","Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bermuda","Bhutan","Bolivia","Bosnia &amp; Herzegovina","Botswana","Brazil","British Virgin Islands","Brunei","Bulgaria","Burkina Faso","Burundi","Cambodia","Cameroon","Canada","Cape Verde","Cayman Islands","Central Arfrican Republic","Chad","Chile","China","Colombia","Congo","Cook Islands","Costa Rica","Cote D Ivoire","Croatia","Cuba","Curacao","Cyprus","Czech Republic","Denmark","Djibouti","Dominica","Dominican Republic","Ecuador","Egypt","El Salvador","Equatorial Guinea","Eritrea","Estonia","Ethiopia","Falkland Islands","Faroe Islands","Fiji","Finland","France","French Polynesia","French West Indies","Gabon","Gambia","Georgia","Germany","Ghana","Gibraltar","Greece","Greenland","Grenada","Guam","Guatemala","Guernsey","Guinea","Guinea Bissau","Guyana","Haiti","Honduras","Hong Kong","Hungary","Iceland","India","Indonesia","Iran","Iraq","Ireland","Isle of Man","Israel","Italy","Jamaica","Japan","Jersey","Jordan","Kazakhstan","Kenya","Kiribati","Kosovo","Kuwait","Kyrgyzstan","Laos","Latvia","Lebanon","Lesotho","Liberia","Libya","Liechtenstein","Lithuania","Luxembourg","Macau","Macedonia","Madagascar","Malawi","Malaysia","Maldives","Mali","Malta","Marshall Islands","Mauritania","Mauritius","Mexico","Micronesia","Moldova","Monaco","Mongolia","Montenegro","Montserrat","Morocco","Mozambique","Myanmar","Namibia","Nauro","Nepal","Netherlands","Netherlands Antilles","New Caledonia","New Zealand","Nicaragua","Niger","Nigeria","North Korea","Norway","Oman","Pakistan","Palau","Palestine","Panama","Papua New Guinea","Paraguay","Peru","Philippines","Poland","Portugal","Puerto Rico","Qatar","Reunion","Romania","Russia","Rwanda","Saint Pierre &amp; Miquelon","Samoa","San Marino","Sao Tome and Principe","Saudi Arabia","Senegal","Serbia","Seychelles","Sierra Leone","Singapore","Slovakia","Slovenia","Solomon Islands","Somalia","South Africa","South Korea","South Sudan","Spain","Sri Lanka","St Kitts &amp; Nevis","St Lucia","St Vincent","Sudan","Suriname","Swaziland","Sweden","Switzerland","Syria","Taiwan","Tajikistan","Tanzania","Thailand","Timor L'Este","Togo","Tonga","Trinidad &amp; Tobago","Tunisia","Turkey","Turkmenistan","Turks &amp; Caicos","Tuvalu","Uganda","Ukraine","United Arab Emirates","United Kingdom","United States of America","Uruguay","Uzbekistan","Vanuatu","Vatican City","Venezuela","Vietnam","Virgin Islands (US)","Yemen","Zambia","Zimbabwe"];
var begin = "<?php echo $activity->date_begin ?>";
var end = "<?php echo $activity->date_end ?>";
var msg = "<?php echo $activity->date_msg ?>";
$('#datetimepickerbegin').datetimepicker({
icons: {
time: "fa fa-clock-o",
@@ -177,12 +216,24 @@
},
date: new Date(end)
});
$('#desc').trumbowyg({
$('#datetimepickermsg').datetimepicker({
icons: {
time: "fa fa-clock-o",
date: "fa fa-calendar",
up: "fa fa-chevron-up",
down: "fa fa-chevron-down",
previous: 'fa fa-chevron-left',
next: 'fa fa-chevron-right',
today: 'fa fa-screenshot',
clear: 'fa fa-trash',
close: 'fa fa-remove'
},
date: new Date(msg)
});
$('.richeditor').trumbowyg({
lang: 'fr'
});
$( ".basicAutoComplete" ).autocomplete({
source: '/api/user/list?api_token='+api_token
});
initAutoComplete("AutoComplete");
</script>
@endsection

View File

@@ -1,3 +1,6 @@
<div class="col-md-12 mt-4 text-center">
<h4>Information Générale</h4>
</div>
<div class="col-md-12">
<div class="form-group">
<label for="name">Nom de l'événement</label>
@@ -5,34 +8,34 @@
<small id="nameHelp" class="text-muted">Veuillez entrer le nom de l'événement</small>
</div>
</div>
<div class="col-md-2">
<div class="col-lg-3 col-md-4">
<div class="form-group">
<label class="label-control">Date et Heure de début</label>
<input name="begin" type="text" id="datetimepickerbegin" class="form-control datetimepicker" required/>
</div>
</div>
<div class="col-md-2">
<div class="col-lg-3 col-md-4">
<div class="form-group">
<label class="label-control">Date et Heure de fin</label>
<input name="end" type="text" id="datetimepickerend" class="form-control datetimepicker" required/>
</div>
</div>
<div class="col-md-5">
<div class="col-lg-6 col-md-4">
<div class="form-group">
<label for="name">Lieux</label>
<input type="text" name="location" id="location" class="form-control" placeholder="" aria-describedby="nameHelp" value="{{$activity->location}}" required>
<small id="nameHelp" class="text-muted">Veuillez entrer le lieu de l'événement</small>
</div>
</div>
<div class="col-md-3 m-auto">
<div class="col-md-12 my-auto text-center">
<div class="form-group">
<div class="form-check">
<label class="form-check-label">
<input class="form-check-input" name="is_mandatory" type="checkbox" value="1"
@if ($activity->is_mandatory == 1)
checked
@endif>
L'événement est obligatoire
<input class="form-check-input" name="is_mandatory" type="checkbox" value="1"
@if ($activity->is_mandatory == 1)
checked
@endif>
L'événement est t-il obligatoire pour tous les cadets ?
<span class="form-check-sign">
<span class="check"></span>
</span>
@@ -40,14 +43,47 @@
</div>
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label for="desc">Commentaire</label>
<textarea class="form-control" name="desc" id="desc" rows="6" required>{{$activity->admin_desc}}</textarea>
<div class="col-md-12 mt-4 text-center">
<h4>Options Supplémentaires</h4>
</div>
<div class="col-md-12 mt-4">
<ul class="nav nav-pills mb-3 justify-content-center" id="pills-tab" role="tablist">
<li class="nav-item w-25">
<a class="nav-link active w-100" id="pills-home-tab" data-toggle="pill" href="#comment" role="tab" aria-controls="pills-home" aria-selected="true">Description</a>
</li>
<li class="nav-item w-25">
<a class="nav-link" id="pills-profile-tab" data-toggle="pill" href="#msg" role="tab" aria-controls="pills-profile" aria-selected="false">Message de la semaine</a>
</li>
</ul>
<div class="tab-content" id="pills-tabContent">
<div class="tab-pane fade show active" id="comment" role="tabpanel" aria-labelledby="pills-home-tab">
<div class="form-group">
<label for="desc">Description</label>
<textarea class="form-control richeditor" name="desc" id="desc" rows="6" required>{{$activity->admin_desc}}</textarea>
</div>
</div>
<div class="tab-pane fade" id="msg" role="tabpanel" aria-labelledby="pills-profile-tab">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="label-control">Date et heure de publication des messages de la semaine</label>
<input name="date_msg" type="text" id="datetimepickermsg" class="form-control datetimepicker" required/>
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label for="desc">Message de le semaine</label>
<textarea class="form-control richeditor" name="msg" id="msg" rows="6" required>{{\App\Config::getData('default_weekly_msg')}}</textarea>
</div>
</div>
</div>
</div>
</div>
</div>
@if ($activity->id == 1)
<div class="col-md-12 mt-4 text-center">
<h4>Horaire d'instruction</h4>
</div>
<div class="col-md-12">
<div id="accordion" role="tablist">
@for ($i = 1; $i <= \App\Config::getData('admin_level_in_schedule_nb'); $i++)
@@ -70,7 +106,7 @@
<div class="col-sm-6 my-2">
<div class="form-group">
<label for="name">Nom du cours</label>
<input type="text" name="name_n{{$i}}_p{{$p}}" id="name_n{{$i}}_p{{$p}}" class="form-control" aria-describedby="nameHelp" required>
<input type="text" name="name_n{{$i}}_p{{$p}}" id="name_n{{$i}}_p{{$p}}" class="form-control" aria-describedby="nameHelp" required @if(env('APP_DEBUG') == true)value="Nom du cours"@endif>
<small id="nameHelp" class="text-muted">Veuillez entrer le nom du cours</small>
</div>
</div>
@@ -78,7 +114,11 @@
<div class="form-group">
<div class="form-group">
<label for="name">Instructeur</label>
<input type="text" name="instruc_n{{$i}}_p{{$p}}" id="instruc_n{{$i}}_p{{$p}}" class="form-control basicAutoComplete" aria-describedby="nameHelp" required>
<select class="selectpicker d-block" data-style="btn btn-outline-primary w-100">
@foreach(\App\User::all() as $user)
<option value="{{$user->id}}">{{$user->fullname()}}</option>
@endforeach
</select>
<small id="nameHelp" class="text-muted">Veuillez entrer le nom de l'instructeur</small>
</div>
</div>
@@ -86,20 +126,17 @@
<div class="col-sm-6 my-2">
<div class="form-group">
<label for="name">OCOM</label>
<input type="text" name="ocom_n{{$i}}_p{{$p}}" id="ocom_n{{$i}}_p{{$p}}" class="form-control" aria-describedby="nameHelp" required>
<input type="text" name="ocom_n{{$i}}_p{{$p}}" id="ocom_n{{$i}}_p{{$p}}" class="form-control" aria-describedby="nameHelp" required @if(env('APP_DEBUG') == true)value="OCOM"@endif>
<small id="nameHelp" class="text-muted">Veuillez entrer l'OCOM</small>
</div>
</div>
<div class="col-sm-6 my-2">
<div class="form-group">
<label for="name">Lieux</label>
<input type="text" name="loc_n{{$i}}_p{{$p}}" id="loc_n{{$i}}_p{{$p}}" class="form-control" placeholder="" aria-describedby="nameHelp" required>
<input type="text" name="loc_n{{$i}}_p{{$p}}" id="loc_n{{$i}}_p{{$p}}" class="form-control" placeholder="" aria-describedby="nameHelp" required @if(env('APP_DEBUG') == true)value="Lieu"@endif>
<small id="nameHelp" class="text-muted">Veuillez entrer le lieux</small>
</div>
</div>
<div class="col-sm-12">
<button type="button" class="btn btn-primary btn-block" disabled>Réservation de materiel (Disponible une fois l'événement sauvegarder)</button>
</div>
</div>#
</div>
<hr>
@endfor
@@ -111,10 +148,10 @@
</div>
@endif
<script>
var begin = "<?php echo $begin_time ?>";
var end = "<?php echo $end_time ?>";
var msg = "<?php echo $msg_time ?>";
$('#datetimepickerbegin').datetimepicker({
icons: {
time: "fa fa-clock-o",
@@ -143,7 +180,21 @@ $('#datetimepickerend').datetimepicker({
},
date: new Date(end)
});
$('#desc').trumbowyg({
$('#datetimepickermsg').datetimepicker({
icons: {
time: "fa fa-clock-o",
date: "fa fa-calendar",
up: "fa fa-chevron-up",
down: "fa fa-chevron-down",
previous: 'fa fa-chevron-left',
next: 'fa fa-chevron-right',
today: 'fa fa-screenshot',
clear: 'fa fa-trash',
close: 'fa fa-remove'
},
date: new Date(msg)
});
$('.richeditor').trumbowyg({
lang: 'fr'
});
$( ".basicAutoComplete" ).autocomplete({

View File

@@ -54,7 +54,7 @@
@if(\App\User::find($course->user_id))
{{\App\User::find($course->user_id)->fullname()}}
@else
Utilisateur Inconnu
{{$course->user_id}}
@endif
</div>
<div class="col-sm-6 my-2">

View File

@@ -23,7 +23,7 @@
<td style="width: 5%;">{{$item->id}}</td>
<td>{{$item->fullname()}}</td>
<td>{{$item->rank->name}}</td>
<td>{{\App\Job::find($item->job)->name}}</td>
<td>{{$item->job->name}}</td>
<td class="td-actions text-right" style="width: 12%;">
<a class="btn btn-info p-2 text-white" href="/admin/user/edit/{{$item->id}}"><i class="material-icons">edit</i></a>
<a class="btn btn-danger p-2 text-white" onclick="deleteEvent({{$item->id}});"><i class="material-icons">close</i></a>

View File

@@ -16,7 +16,7 @@
<div class="col-sm-6 text-center">
<div class="row mt-3">
<div class="col-md-12">
<p>{{\App\Rank::find($user->job)->name}}</p>
<p>{{$user->job->name}}</p>
<hr>
</div>
<div class="col-md-6">
@@ -71,6 +71,7 @@
<thead class="thead-default">
<tr>
<th>Horodatage</th>
<th>Résultat</th>
<th>Action</th>
</tr>
</thead>
@@ -78,7 +79,8 @@
@foreach ($user->logs()->take(6)->get() as $log)
<tr>
<td scope="row">{{$log->created_at}}</td>
<td>{{$log->action}}</td>
<td><span class="badge badge-pill badge-{{$log->result}} text-uppercase">{{$log->result}}</span></td>
<td>{{$log->event}}</td>
</tr>
@endforeach
</tbody>
@@ -95,7 +97,7 @@
<a name="changepsw" id="changepsw" class="btn btn-warning btn-block" href="/admin/profil/password" role="button">Modifier mon mot de passe</a>
<a class="btn btn-secondary btn-block" href="/admin/profil/avatar" role="button">Modifier ma photo de profil</a>
<button disabled class="btn btn-secondary btn-block" href="/admin/profil/phone" role="button">Modifier mon numéro de téléphone</button>
<button disabled class="btn btn-secondary btn-block" href="/admin/profil/adress" role="button">Modifier mon adresse</button>
<a class="btn btn-secondary btn-block" href="/admin/profil/adress" role="button">Modifier mon adresse</a>
<button disabled class="btn btn-primary btn-block" href="/admin/profil/preference" role="button">Modifier mes préférences</button>
<a class="btn btn-danger btn-block" href="/logout" role="button">Déconnexion</a>
</div>

View File

@@ -4,46 +4,6 @@
$scheduleWarning = \App\Schedule::checkForWarning();
$id_warning = 1;
@endphp
@if (!$scheduleWarning->isEmpty())
@if (\Auth::User()->getPerm('schedule_edit'))
<div class="alert alert-warning" role="alert">
<a data-toggle="collapse" href="#schedulewarning" role="button" aria-expanded="false" aria-controls="schedulewarning"> Attention ! De potentiel erreur on été détecté dans l'horaire <span class="badge badge-warning">{{$scheduleWarning->count()}}</span> <i class="fa fa-caret-down" aria-hidden="true"></i></a>
<div class="collapse" id="schedulewarning">
<div class="ml-4 row">
@foreach ($scheduleWarning as $warning)
<div class="col-sm-12">
Le {{$warning['date']}} à la
@if ($warning['periode'] == 1) 1er période @else 2e période @endif du
@if ($warning['niveau'] == 1) niveau 1 @elseif($warning['niveau'] == 2) niveau 2 @else niveau 3 @endif
: {{$warning['warning']}}
</div>
@php
$id_warning = $id_warning + 1;
@endphp
@endforeach
</div>
</div>
</div>
@endif
@endif
@if (\App\Config::getData('is_schedule_public') == null)
@if (\Auth::User()->getPerm('schedule_edit'))
<div class="alert alert-danger" role="alert">
Attention ! L'horaire n'est présentement pas visible par le publique ! <a href="/admin/config#schedule_public">Cliquer ici pour accéder aux options</a>
</div>
@endif
@endif
@if (\App\Config::getData('is_schedule_build') == null)
@if (\Auth::User()->getPerm('schedule_edit'))
<div class="alert alert-warning" role="alert">
Attention ! L'horaire n'est pas marqué comme complet, les utilisateurs ne receverons pas de notification concernant l'horaire <a href="/admin/config#schedule_build">Cliquer ici pour accéder aux options</a>
</div>
@endif
@endif
<!-- Notification -->
@if (session('status'))
<div class="alert alert-info" role="alert">

View File

@@ -213,16 +213,28 @@
</li>
@endif
<li class="nav-item ">
<a class="nav-link" href="/admin/files">
<a class="nav-link" data-toggle="collapse" href="#file">
<i class="material-icons">folder</i>
<p> Fichier</p>
</a>
</li>
<li class="nav-item ">
<a class="nav-link" href="/admin/guide">
<i class="material-icons">library_books</i>
<p> Guide pédagogique</p>
<p> Fichier
<b class="caret"></b>
</p>
</a>
<div class="collapse" id="file">
<ul class="nav">
<li class="nav-item ">
<a class="nav-link" href="/admin/guide">
<span class="sidebar-mini"> <i class="fas fa-book"></i></span>
<span class="sidebar-normal"> Guide pédagogique </span>
</a>
</li>
<li class="nav-item ">
<a class="nav-link" href="/admin/files">
<span class="sidebar-mini"> <i class="fas fa-cog"></i> </span>
<span class="sidebar-normal"> Divers </span>
</a>
</li>
</ul>
</div>
</li>
@if(\Auth::user()->p('config_edit') == 1)
<li class="nav-item ">

View File

@@ -9,10 +9,27 @@
<div class="row">
@foreach ($news as $new)
<div class="col-md-4">
<h3>{{ $new->title }}</h3>
<h3 class="news-title mb-4">{{ $new->title }}</h3>
<div class="news-body-small"> {!! $new->body !!}</div>
<span class="news-small">{{ \App\User::find($new->user_id)->fullname()}}, {{$new->created_at}}</span>
<a name="news" id="news" class="btn btn-block btn-secondary mt-2" href="/news/{{$new->id}}" role="button">Voir plus!</a>
<div class="news-tags">
@if($new->tags != [])
@foreach($new->tags as $tag)
@if($tag == "Important")
<span class="badge badge-pill badge-danger">{{$tag}}</span>
@else
<span class="badge badge-pill badge-default">{{$tag}}</span>
@endif
@endforeach
@endif
</div>
<a name="news" id="news" class="btn btn-block btn-secondary mt-2"
@if(isset($new->event_id))
href="/news/{{$new->event_id}}?type=msg" role="button">Voir plus!
@else
href="/news/{{$new->id}}" role="button">Voir plus!
@endif
</a>
</div>
@endforeach
</div>

View File

@@ -1,7 +1,7 @@
@extends('layouts.public.main')
@section('content')
<div class="page-header header-filter clear-filter purple-filter" data-parallax="true" style="background-image: url({{'"'.\App\Config::getData('public_index_img_url').'"'}});">
<div class="page-header header-filter clear-filter" data-parallax="true" style="background-image: url({{'"'.\App\Config::getData('public_index_img_url').'"'}});">
<div class="container">
<div class="row">
<div class="col-md-8 ml-auto mr-auto">
@@ -22,12 +22,29 @@
<div class="row">
@foreach ($news as $new)
<div class="col-md-4">
<h3>{{ $new->title }}</h3>
<h3 class="news-title" >{{ $new->title }}</h3>
<div class="news-body-small">
{!! $new->body !!}
</div>
<span class="news-small">{{ \App\User::find($new->user_id)->fullname()}}, {{ $new->created_at }}</span>
<a name="news" id="news" class="btn btn-block btn-secondary mt-2" href="/news/{{ $new->id }}" role="button">Voir plus!</a>
<div class="news-tags">
@if($new->tags != [])
@foreach($new->tags as $tag)
@if($tag == "Important")
<span class="badge badge-pill badge-danger">{{$tag}}</span>
@else
<span class="badge badge-pill badge-default">{{$tag}}</span>
@endif
@endforeach
@endif
</div>
<a name="news" id="news" class="btn btn-block btn-secondary mt-2" role="button"
@if(isset($new->event_id))
href="/news/{{$new->event_id}}?type=msg" role="button">Voir plus!
@else
href="/news/{{$new->id}}" role="button">Voir plus!
@endif
</a>
</div>
@endforeach
</div>

View File

@@ -1,12 +1,12 @@
@extends('layouts.public.main')
@section('content')
<div class="page-header header-filter clear-filter purple-filter" data-parallax="true" style="background-image: url({{'"'.\App\Config::getData('public_index_img_url').'"'}});">
<div class="page-header header-filter clear-filter" data-parallax="true" style="background-image: url({{'"'.\App\Config::getData('public_index_img_url').'"'}});">
<div class="container">
<div class="row">
<div class="col-md-8 ml-auto mr-auto">
<div class="brand">
<h2>{{ $new->title }}</h2>
<h2 class="news-title">{{ $new->title }}</h2>
</div>
</div>
</div>
@@ -30,6 +30,17 @@
{!! $new->body !!}
</p>
<span class="news-small">{{ \App\User::find($new->user_id)->fullname()}}, {{ $new->created_at }}</span>
<div class="news-tags">
@if($new->tags != [])
@foreach($new->tags as $tag)
@if($tag == "Important")
<span class="badge badge-pill badge-danger">{{$tag}}</span>
@else
<span class="badge badge-pill badge-default">{{$tag}}</span>
@endif
@endforeach
@endif
</div>
</div>
</div>
<a href="{{ url()->previous() }}" class="btn button primary">Retour</a>

View File

@@ -48,7 +48,7 @@ Route::middleware(['auth'])->group(function () {
Route::post('/admin/schedule/event/edit/{id}','EventController@update')->middleware('perm:schedule_edit');
/** Statistique */
Route::get('/admin/stats/log' , 'LogController@index')->middleware('perm:stats_see');;
Route::get('/admin/stats/log' , 'LogController@index')->middleware('perm:stats_see');
/** Message */
Route::get('/admin/message' , 'MessageController@index')->middleware('perm:msg_see');
@@ -64,10 +64,6 @@ Route::middleware(['auth'])->group(function () {
Route::post('/admin/user/edit/{id}' , 'UserController@update')->middleware('perm:user_edit');
/** Config */
Route::get('/admin/config/job' , 'JobController@index')->middleware('perm:config_see');
Route::get('/admin/config/job/add' , 'JobController@create')->middleware('perm:config_add');
Route::post('/admin/config/job/add' , 'JobController@store')->middleware('perm:config_add');
Route::get('/admin/config/job/edit/{id}' , 'JobController@edit')->middleware('perm:config_add');
Route::get('/admin/config/schedule' , 'ScheduleController@index')->middleware('perm:config_edit');
Route::post('/admin/config/schedule/edit' , 'ScheduleController@update')->middleware('perm:config_edit');
Route::get('/admin/config/activity' , 'ComplementaryActivityController@index')->middleware('perm:config_edit');
@@ -86,6 +82,10 @@ Route::middleware(['auth'])->group(function () {
Route::get('/admin/config/ranks/{id}','RankController@show')->middleware('perm:config_edit');
Route::post('/admin/config/ranks/{id}','RankController@update')->middleware('perm:config_edit');
Route::get('/admin/config/jobs','JobController@index')->middleware('perm:config_edit');
Route::get('/admin/config/jobs/add','JobController@create')->middleware('perm:config_edit');
Route::post('/admin/config/jobs/add','JobController@store')->middleware('perm:config_edit');
Route::get('/admin/config/jobs/{id}','JobController@edit')->middleware('perm:config_edit');
Route::post('/admin/config/jobs/{id}','JobController@update')->middleware('perm:config_edit');
/** Public page */
Route::get('/admin/public/edit/{config}', 'PublicController@edit')->middleware('perm:config_edit');