This commit is contained in:
Mathieu Lagace
2019-09-30 17:06:31 -04:00
parent d1ce6ba6da
commit 0166c48daa
38 changed files with 618 additions and 201 deletions

View File

@@ -40,4 +40,18 @@ class Event extends Model
{ {
return $this->morphMany('App\Log', 'logable'); 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->is_mandatory = 0;
} }
$event->desc = request('desc'); $event->desc = request('desc');
$event->msg = request('msg');
$event->date_msg = request('date_msg');
$event->save(); $event->save();
if ($event->type == 1) { if ($event->type == 1) {
@@ -60,7 +61,7 @@ class EventController extends Controller
$course = new \App\Course(); $course = new \App\Course();
$users = \App\User::all(); $users = \App\User::all();
$instructor = 1; $instructor = request('instruc_n'.$l.'_p'.$p);
foreach ($users as $user) { foreach ($users as $user) {
if($user->fullname() == request('instruc_n'.$l.'_p'.$p)) if($user->fullname() == request('instruc_n'.$l.'_p'.$p))
@@ -130,6 +131,7 @@ class EventController extends Controller
$event->is_mandatory = 0; $event->is_mandatory = 0;
} }
$event->desc = request('desc'); $event->desc = request('desc');
$event->msg = \request('msg');
$event->save(); $event->save();
@@ -151,7 +153,7 @@ class EventController extends Controller
} }
$users = \App\User::all(); $users = \App\User::all();
$instructor = 1; $instructor = request('instruc_n'.$l.'_p'.$p);
foreach ($users as $user) { foreach ($users as $user) {
if($user->fullname() == request('instruc_n'.$l.'_p'.$p)) if($user->fullname() == request('instruc_n'.$l.'_p'.$p))

View File

@@ -20,7 +20,7 @@ class JobController extends Controller
$jobs = $jobs_sorted->values(); $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() 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() public function indexAdmin()
{ {
clogNav('a consulté les nouvelles'); 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,9 +69,15 @@ class NewsController extends Controller
*/ */
public function show($id) public function show($id)
{ {
clog('see','success','a consulté une nouvelle',null,'App\News',$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)]); return view('public.news', ['new' => \App\News::find($id)]);
} }
}
/** /**
* Show the form for editing the specified resource. * Show the form for editing the specified resource.

View File

@@ -2,6 +2,7 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\News;
use Illuminate\Http\Request; use Illuminate\Http\Request;
class PublicController extends Controller class PublicController extends Controller
@@ -14,7 +15,7 @@ class PublicController extends Controller
public function index() public function index()
{ {
return view('public.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'), 'activities' => \App\ComplementaryActivity::all()->where('is_promoted','1'),
'pictures' => \App\Picture::all()->sortByDesc('created_at')->take(\App\Config::getData('nb_activity_public')) '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); $activity = \App\ComplementaryActivity::find($type);
$begin_time = $date." ".$activity->begin_time; $begin_time = $date." ".$activity->begin_time;
$end_time = $date." ".$activity->end_time; $end_time = $date." ".$activity->end_time;
$msg_time = Date('c',strtotime($begin_time.'-4day'));
return view('admin.schedule.modal.add',[ return view('admin.schedule.modal.add',[
'activity' => \App\ComplementaryActivity::find($type), 'activity' => \App\ComplementaryActivity::find($type),
'begin_time' => $begin_time, '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 class Job extends Model
{ {
protected $casts = [ public function permissions()
'perm' => 'array', {
]; 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 class News extends Model
{ {
protected $casts = [
'tags' => 'array',
];
public function user() public function user()
{ {
return $this->belongsTo('App\User'); return $this->belongsTo('App\User');
@@ -20,4 +24,39 @@ class News extends Model
{ {
return $this->morphMany('App\Log', 'logable'); 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

@@ -4,6 +4,8 @@ namespace App\Providers;
use Illuminate\Support\ServiceProvider; 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 class AppServiceProvider extends ServiceProvider
{ {
@@ -15,6 +17,29 @@ class AppServiceProvider extends ServiceProvider
public function boot() public function boot()
{ {
Schema::defaultStringLength(191); 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'); return $this->belongsTo('App\Rank');
} }
public function job()
{
return $this->belongsTo('App\Job');
}
public function logs() public function logs()
{ {
return $this->hasMany(Log::class); return $this->hasMany(Log::class);
@@ -286,9 +291,16 @@ class User extends Authenticatable
} }
public function permission($perm) public function permission($perm)
{
if ($this->job->permission($perm) == 0)
{ {
return $this->rank->permission($perm); return $this->rank->permission($perm);
} }
else
{
return $this->job->permission($perm);
}
}
public function p($perm) public function p($perm)
{ {

View File

@@ -25,23 +25,7 @@ class CreateUsersTable extends Migration
$table->string('age'); $table->string('age');
$table->string('avatar')->default('1'); $table->string('avatar')->default('1');
$table->string('sexe'); $table->string('sexe');
$table->string('job')->default(6); $table->string('job_id')->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('api_token', 60)->unique()->default(str_shuffle(str_random(60))); $table->string('api_token', 60)->unique()->default(str_shuffle(str_random(60)));
$table->rememberToken(); $table->rememberToken();
$table->timestamps(); $table->timestamps();

View File

@@ -17,22 +17,7 @@ class CreateJobsTable extends Migration
$table->increments('id'); $table->increments('id');
$table->string('name'); $table->string('name');
$table->text('desc'); $table->text('desc');
$table->text('acces_level'); $table->text('permissions');
$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->timestamps(); $table->timestamps();
}); });
} }

View File

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

View File

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

View File

@@ -221,6 +221,11 @@ class ConfigsTableSeeder extends Seeder
'name' => 'public_index_img_url', 'name' => 'public_index_img_url',
'state' => 0, 'state' => 0,
'data' => '["./assets/img/bg2.jpg"]' '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é", 'name' => "Indéterminé",
'desc' => "Aucun poste", 'desc' => "Aucun poste",
'acces_level' => '0', 'permissions' => \App\Permission::allToString(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
] ]
]); ]);
} }

View File

@@ -15,7 +15,7 @@ class RanksTableSeeder extends Seeder
[ [
'name' => "SuperAdmin", 'name' => "SuperAdmin",
'acces_level' => '2', '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) 'permissions' => \App\Permission::allToString(1)
] ]
]); ]);

View File

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

34
public/css/custom.css vendored
View File

@@ -2,6 +2,14 @@
margin-top: 50px; margin-top: 50px;
} }
.news-title {
height: 3.2rem;
}
.news-tags {
height: 1.5rem;
}
.news-body-small { .news-body-small {
height: 15rem; height: 15rem;
overflow: hidden; overflow: hidden;
@@ -53,6 +61,32 @@
height: 3rem; height: 3rem;
overflow: hidden; 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) { @media only screen and (max-width: 800px) {
.calendar-container { .calendar-container {

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; margin-top: 50px;
} }
.news-title {
height: 3.2rem;
}
.news-tags {
height: 1.5rem;
}
.news-body-small { .news-body-small {
height: 15rem; height: 15rem;
overflow: hidden; overflow: hidden;
@@ -53,6 +61,32 @@
height: 3rem; height: 3rem;
overflow: hidden; 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) { @media only screen and (max-width: 800px) {
.calendar-container { .calendar-container {

View File

@@ -25,7 +25,11 @@
{{$event->fulldesc}} {{$event->fulldesc}}
</div> </div>
<div class="col-md-6 text-right"> <div class="col-md-6 text-right">
@if(is_numeric($event->user_id))
{{$event->user->fullname()}} {{$event->user->fullname()}}
@else
{{$event->user_id}}
@endif
</div> </div>
</div> </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>
<div class="card-body mt-5"> <div class="card-body mt-5">
<div class="row"> <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) @foreach($ranks as $rank)
<div class="col-md-4"> <div class="col-md-4">
<div class="card"> <div class="card">
@@ -16,11 +19,22 @@
</div> </div>
<div class="card-body"> <div class="card-body">
<div> <div>
{{$rank->desc}} {!! $rank->desc!!}
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <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> <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> </div>
</div> </div>

View File

@@ -96,7 +96,7 @@
</div> </div>
<div class="card-body"> <div class="card-body">
<div class="row"> <div class="row">
@foreach (\App\News::all()->forPage(1,4); as $msg) @foreach (\App\News::all()->forPage(1,3) as $msg)
<div class="col-12 text-center"> <div class="col-12 text-center">
<a href="/admin/message/{{$msg->id}}"> <a href="/admin/message/{{$msg->id}}">
<div style="height:2rem;">{{$msg->title}}</div> <div style="height:2rem;">{{$msg->title}}</div>

View File

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

View File

@@ -3,14 +3,14 @@
@section('content') @section('content')
<div class="col-md-12"> <div class="col-md-12">
<div class="card"> <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> <strong class="card-title">Nouvelles <a href="#"><i class="fa fa-question-circle" aria-hidden="true"></i>
</a></strong> </a></strong>
</div> </div>
<div class="card-body"> <div class="card-body">
<div class="btn-group btn-block"> <div class="btn-group btn-block">
@if(\Auth::user()->p('news_add') == 1) @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 @endif
</div> </div>
<hr> <hr>
@@ -24,8 +24,19 @@
<div class="col-md-4"> <div class="col-md-4">
<div class="card"> <div class="card">
<div class="card-header"> <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}} <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> @if($n->publish == 0) <span class="badge badge-warning float-right">Brouillon</span> @endif</p>
</div> </div>
<div class="card-body news-body-small"> <div class="card-body news-body-small">
@@ -33,10 +44,12 @@
</div> </div>
<div class="card-footer"> <div class="card-footer">
<div class="btn-group"> <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> <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 @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> <a type="button" class="btn btn-danger" onclick="deleteEvent({{$n->id}});"><i class="fa fa-times-circle" style="color:white;"></i></a>
@endif @endif
</div> </div>
@@ -44,6 +57,9 @@
</div> </div>
</div> </div>
@endforeach @endforeach
<div class="col-12">
{{ $news->links() }}
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -23,6 +23,9 @@
</div> </div>
</div> </div>
<div class="row" id="container"> <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="col-md-12">
<div class="form-group"> <div class="form-group">
<label for="name">Nom de l'événement</label> <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> <small id="nameHelp" class="text-muted">Veuillez entrer le nom de l'événement</small>
</div> </div>
</div> </div>
<div class="col-md-2"> <div class="col-lg-3 col-md-4">
<div class="form-group"> <div class="form-group">
<label class="label-control">Date et Heure de début</label> <label class="label-control">Date et Heure de début</label>
<input name="begin" type="text" id="datetimepickerbegin" class="form-control datetimepicker" required/> <input name="begin" type="text" id="datetimepickerbegin" class="form-control datetimepicker" required/>
</div> </div>
</div> </div>
<div class="col-md-2"> <div class="col-lg-3 col-md-4">
<div class="form-group"> <div class="form-group">
<label class="label-control">Date et Heure de fin</label> <label class="label-control">Date et Heure de fin</label>
<input name="end" type="text" id="datetimepickerend" class="form-control datetimepicker" required/> <input name="end" type="text" id="datetimepickerend" class="form-control datetimepicker" required/>
</div> </div>
</div> </div>
<div class="col-md-5"> <div class="col-lg-6 col-md-4">
<div class="form-group"> <div class="form-group">
<label for="name">Lieux</label> <label for="name">Lieux</label>
<input type="text" name="location" id="location" class="form-control" placeholder="" aria-describedby="nameHelp" value="{{$activity->location}}" required> <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> <small id="nameHelp" class="text-muted">Veuillez entrer le lieu de l'événement</small>
</div> </div>
</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-group">
<div class="form-check"> <div class="form-check">
<label class="form-check-label"> <label class="form-check-label">
@@ -57,7 +60,7 @@
@if ($activity->is_mandatory == 1) @if ($activity->is_mandatory == 1)
checked checked
@endif> @endif>
L'événement est obligatoire L'événement est t-il obligatoire pour tous les cadets ?
<span class="form-check-sign"> <span class="form-check-sign">
<span class="check"></span> <span class="check"></span>
</span> </span>
@@ -65,15 +68,46 @@
</div> </div>
</div> </div>
</div> </div>
<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="col-md-12">
<div class="form-group"> <div class="form-group">
<label for="desc">Commentaire</label> <textarea class="form-control richeditor" name="msg" id="msg" rows="6" required>{{$activity->msg}}</textarea>
<br> </div>
<textarea class="form-control" name="desc" id="desc" rows="6" required>{!!$activity->desc!!}</textarea> </div>
</div>
</div>
</div> </div>
</div> </div>
@if ($activity->type == 1) @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 class="col-md-12">
<div id="accordion" role="tablist"> <div id="accordion" role="tablist">
@for ($i = 1; $i <= \App\Config::getData('admin_level_in_schedule_nb'); $i++) @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">
<div class="form-group"> <div class="form-group">
<label for="name">Instructeur</label> <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> <small id="nameHelp" class="text-muted">Veuillez entrer le nom de l'instructeur</small>
</div> </div>
</div> </div>
@@ -146,9 +182,12 @@
@section('custom_scripts') @section('custom_scripts')
<script src="/js/calendar.js"></script> <script src="/js/calendar.js"></script>
<script src="/js/plugins/autocomplete.js"></script>
<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 begin = "<?php echo $activity->date_begin ?>";
var end = "<?php echo $activity->date_end ?>"; var end = "<?php echo $activity->date_end ?>";
var msg = "<?php echo $activity->date_msg ?>";
$('#datetimepickerbegin').datetimepicker({ $('#datetimepickerbegin').datetimepicker({
icons: { icons: {
time: "fa fa-clock-o", time: "fa fa-clock-o",
@@ -177,12 +216,24 @@
}, },
date: new Date(end) 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' lang: 'fr'
}); });
$( ".basicAutoComplete" ).autocomplete({ initAutoComplete("AutoComplete");
source: '/api/user/list?api_token='+api_token
});
</script> </script>
@endsection @endsection

View File

@@ -27,7 +27,7 @@
<small id="nameHelp" class="text-muted">Veuillez entrer le lieu de l'événement</small> <small id="nameHelp" class="text-muted">Veuillez entrer le lieu de l'événement</small>
</div> </div>
</div> </div>
<div class="col-md-5 my-auto"> <div class="col-md-12 my-auto text-center">
<div class="form-group"> <div class="form-group">
<div class="form-check"> <div class="form-check">
<label class="form-check-label"> <label class="form-check-label">
@@ -47,22 +47,39 @@
<h4>Options Supplémentaires</h4> <h4>Options Supplémentaires</h4>
</div> </div>
<div class="col-md-12 mt-4"> <div class="col-md-12 mt-4">
<ul class="nav nav-tabs"> <ul class="nav nav-pills mb-3 justify-content-center" id="pills-tab" role="tablist">
<li class="nav-item"> <li class="nav-item w-25">
<a class="nav-link active text-primary" href="#">Active</a> <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>
<li class="nav-item"> <li class="nav-item w-25">
<a class="nav-link text-primary" href="#">Link</a> <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> </li>
</ul> </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>
<div class="col-md-12"> <div class="col-md-12">
<div class="form-group"> <div class="form-group">
<label for="desc">Commentaire</label> <label for="desc">Message de le semaine</label>
<textarea class="form-control" name="desc" id="desc" rows="6" required>{{$activity->admin_desc}}</textarea> <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>
</div> </div>
@if ($activity->id == 1) @if ($activity->id == 1)
<div class="col-md-12 mt-4 text-center"> <div class="col-md-12 mt-4 text-center">
<h4>Horaire d'instruction</h4> <h4>Horaire d'instruction</h4>
@@ -89,7 +106,7 @@
<div class="col-sm-6 my-2"> <div class="col-sm-6 my-2">
<div class="form-group"> <div class="form-group">
<label for="name">Nom du cours</label> <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> <small id="nameHelp" class="text-muted">Veuillez entrer le nom du cours</small>
</div> </div>
</div> </div>
@@ -109,20 +126,17 @@
<div class="col-sm-6 my-2"> <div class="col-sm-6 my-2">
<div class="form-group"> <div class="form-group">
<label for="name">OCOM</label> <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> <small id="nameHelp" class="text-muted">Veuillez entrer l'OCOM</small>
</div> </div>
</div> </div>
<div class="col-sm-6 my-2"> <div class="col-sm-6 my-2">
<div class="form-group"> <div class="form-group">
<label for="name">Lieux</label> <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> <small id="nameHelp" class="text-muted">Veuillez entrer le lieux</small>
</div> </div>
</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> <hr>
@endfor @endfor
@@ -137,6 +151,7 @@
<script> <script>
var begin = "<?php echo $begin_time ?>"; var begin = "<?php echo $begin_time ?>";
var end = "<?php echo $end_time ?>"; var end = "<?php echo $end_time ?>";
var msg = "<?php echo $msg_time ?>";
$('#datetimepickerbegin').datetimepicker({ $('#datetimepickerbegin').datetimepicker({
icons: { icons: {
time: "fa fa-clock-o", time: "fa fa-clock-o",
@@ -165,7 +180,21 @@ $('#datetimepickerend').datetimepicker({
}, },
date: new Date(end) 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' lang: 'fr'
}); });
$( ".basicAutoComplete" ).autocomplete({ $( ".basicAutoComplete" ).autocomplete({

View File

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

View File

@@ -23,7 +23,7 @@
<td style="width: 5%;">{{$item->id}}</td> <td style="width: 5%;">{{$item->id}}</td>
<td>{{$item->fullname()}}</td> <td>{{$item->fullname()}}</td>
<td>{{$item->rank->name}}</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%;"> <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-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> <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="col-sm-6 text-center">
<div class="row mt-3"> <div class="row mt-3">
<div class="col-md-12"> <div class="col-md-12">
<p>{{\App\Rank::find($user->job)->name}}</p> <p>{{$user->job->name}}</p>
<hr> <hr>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">

View File

@@ -213,17 +213,29 @@
</li> </li>
@endif @endif
<li class="nav-item "> <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> <i class="material-icons">folder</i>
<p> Fichier</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> </a>
</li> </li>
<li class="nav-item "> <li class="nav-item ">
<a class="nav-link" href="/admin/guide"> <a class="nav-link" href="/admin/files">
<i class="material-icons">library_books</i> <span class="sidebar-mini"> <i class="fas fa-cog"></i> </span>
<p> Guide pédagogique</p> <span class="sidebar-normal"> Divers </span>
</a> </a>
</li> </li>
</ul>
</div>
</li>
@if(\Auth::user()->p('config_edit') == 1) @if(\Auth::user()->p('config_edit') == 1)
<li class="nav-item "> <li class="nav-item ">
<a class="nav-link" data-toggle="collapse" href="#config"> <a class="nav-link" data-toggle="collapse" href="#config">

View File

@@ -9,10 +9,27 @@
<div class="row"> <div class="row">
@foreach ($news as $new) @foreach ($news as $new)
<div class="col-md-4"> <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> <div class="news-body-small"> {!! $new->body !!}</div>
<span class="news-small">{{ \App\User::find($new->user_id)->fullname()}}, {{$new->created_at}}</span> <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> </div>
@endforeach @endforeach
</div> </div>

View File

@@ -1,7 +1,7 @@
@extends('layouts.public.main') @extends('layouts.public.main')
@section('content') @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="container">
<div class="row"> <div class="row">
<div class="col-md-8 ml-auto mr-auto"> <div class="col-md-8 ml-auto mr-auto">
@@ -22,12 +22,29 @@
<div class="row"> <div class="row">
@foreach ($news as $new) @foreach ($news as $new)
<div class="col-md-4"> <div class="col-md-4">
<h3>{{ $new->title }}</h3> <h3 class="news-title" >{{ $new->title }}</h3>
<div class="news-body-small"> <div class="news-body-small">
{!! $new->body !!} {!! $new->body !!}
</div> </div>
<span class="news-small">{{ \App\User::find($new->user_id)->fullname()}}, {{ $new->created_at }}</span> <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> </div>
@endforeach @endforeach
</div> </div>

View File

@@ -1,12 +1,12 @@
@extends('layouts.public.main') @extends('layouts.public.main')
@section('content') @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="container">
<div class="row"> <div class="row">
<div class="col-md-8 ml-auto mr-auto"> <div class="col-md-8 ml-auto mr-auto">
<div class="brand"> <div class="brand">
<h2>{{ $new->title }}</h2> <h2 class="news-title">{{ $new->title }}</h2>
</div> </div>
</div> </div>
</div> </div>
@@ -30,6 +30,17 @@
{!! $new->body !!} {!! $new->body !!}
</p> </p>
<span class="news-small">{{ \App\User::find($new->user_id)->fullname()}}, {{ $new->created_at }}</span> <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>
</div> </div>
<a href="{{ url()->previous() }}" class="btn button primary">Retour</a> <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'); Route::post('/admin/schedule/event/edit/{id}','EventController@update')->middleware('perm:schedule_edit');
/** Statistique */ /** Statistique */
Route::get('/admin/stats/log' , 'LogController@index')->middleware('perm:stats_see');; Route::get('/admin/stats/log' , 'LogController@index')->middleware('perm:stats_see');
/** Message */ /** Message */
Route::get('/admin/message' , 'MessageController@index')->middleware('perm:msg_see'); 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'); Route::post('/admin/user/edit/{id}' , 'UserController@update')->middleware('perm:user_edit');
/** Config */ /** 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::get('/admin/config/schedule' , 'ScheduleController@index')->middleware('perm:config_edit');
Route::post('/admin/config/schedule/edit' , 'ScheduleController@update')->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'); 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::get('/admin/config/ranks/{id}','RankController@show')->middleware('perm:config_edit');
Route::post('/admin/config/ranks/{id}','RankController@update')->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','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 */ /** Public page */
Route::get('/admin/public/edit/{config}', 'PublicController@edit')->middleware('perm:config_edit'); Route::get('/admin/public/edit/{config}', 'PublicController@edit')->middleware('perm:config_edit');