hide event

This commit is contained in:
Mathieu Lagacé
2020-10-06 18:54:56 -04:00
parent 63301aec97
commit f7845d8f1b
22 changed files with 614 additions and 187 deletions

View File

@@ -90,6 +90,7 @@
cd {{ $app_dir_697 }}/current/ cd {{ $app_dir_697 }}/current/
yes|php artisan migrate yes|php artisan migrate
yes|php artisan db:seed --class=ConfigsTableSeeder yes|php artisan db:seed --class=ConfigsTableSeeder
php artisan update
@endtask @endtask
@@ -127,6 +128,7 @@
cd {{ $app_dir_736 }}/current/ cd {{ $app_dir_736 }}/current/
yes|php artisan migrate yes|php artisan migrate
yes|php artisan db:seed --class=ConfigsTableSeeder yes|php artisan db:seed --class=ConfigsTableSeeder
php artisan update
@endtask @endtask
@@ -164,6 +166,7 @@
cd {{ $app_dir_dev }}/current/ cd {{ $app_dir_dev }}/current/
yes|php artisan migrate yes|php artisan migrate
yes|php artisan db:seed --class=ConfigsTableSeeder yes|php artisan db:seed --class=ConfigsTableSeeder
php artisan update
@endtask @endtask
@@ -206,6 +209,7 @@ echo 'Migrate DB'
cd {{ $app_dir_227 }}/current/ cd {{ $app_dir_227 }}/current/
yes|php artisan migrate yes|php artisan migrate
yes|php artisan db:seed --class=ConfigsTableSeeder yes|php artisan db:seed --class=ConfigsTableSeeder
php artisan update
@endtask @endtask
@@ -243,5 +247,6 @@ echo 'Migrate DB'
cd {{ $app_dir_117 }}/current/ cd {{ $app_dir_117 }}/current/
yes|php artisan migrate yes|php artisan migrate
yes|php artisan db:seed --class=ConfigsTableSeeder yes|php artisan db:seed --class=ConfigsTableSeeder
php artisan update
@endtask @endtask

View File

@@ -0,0 +1,81 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Schema;
class update extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'update';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Update C-CMS';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$this->info('Starting update ...');
$this->updateDatabase();
$this->info('Update completed !');
}
private function updateDatabase()
{
$this->info('Updating database ...');
// Check event table
if (!Schema::hasColumn('events','hidden'))
{
$this->info('Updating events table ...');
Schema::table('events', function ($table) {
$table->boolean('hidden')->default(0);
});
}
else
{
$this->info('Events table is up to date ...');
}
// Check event_type table
if (!Schema::hasColumn('event_types','hidden'))
{
$this->info('Updating event_types table ...');
Schema::table('event_types', function ($table) {
$table->boolean('hidden')->default(0);
});
}
else
{
$this->info('Event_types table is up to date ...');
}
return 0;
}
}

View File

@@ -37,6 +37,9 @@ class CalendarController extends Controller
public function indexTable() public function indexTable()
{ {
return view('admin.schedule.table.index',['events' => \App\Event::allThisYear()->sortBy('date_begin')]); $event = \App\Event::allThisYear()->sortBy('date_begin')->filter(function ($value,$key) {
return $value->hidden != 1;
});
return view('admin.schedule.table.index',['events' => $event]);
} }
} }

View File

@@ -100,6 +100,15 @@ class EventController extends Controller
$event->use_schedule = 0; $event->use_schedule = 0;
} }
if(\request("hidden"))
{
$event->hidden = 1;
}
else
{
$event->hidden = 0;
}
$event->calendar_color = \request('calendar_color'); $event->calendar_color = \request('calendar_color');
$event->calendar_icon = \request('calendar_icon'); $event->calendar_icon = \request('calendar_icon');
@@ -225,7 +234,15 @@ class EventController extends Controller
*/ */
public function edit($id) public function edit($id)
{ {
return view('admin.schedule.event.edit',['event' => \App\Event::find($id)]); $event = \App\Event::find($id);
if ($event->hidden == 1)
{
if (\Auth::user()->p('instruction_see_hidden_event') != 1)
{
return redirect('/admin/schedule')->with('error','Modification non authorisé');
}
}
return view('admin.schedule.event.edit',['event' => $event]);
} }
/** /**
@@ -238,6 +255,13 @@ class EventController extends Controller
public function update($id) public function update($id)
{ {
$event = Event::findOrFail($id); $event = Event::findOrFail($id);
if ($event->hidden == 1)
{
if (\Auth::user()->p('instruction_see_hidden_event') != 1)
{
return redirect('/admin/schedule')->with('error','Modification non authorisé');
}
}
// if (\App\GoogleDriveFile::checkConfig()) // if (\App\GoogleDriveFile::checkConfig())
// { // {
@@ -297,6 +321,15 @@ class EventController extends Controller
$event->use_schedule = 0; $event->use_schedule = 0;
} }
if(\request("hidden"))
{
$event->hidden = 1;
}
else
{
$event->hidden = 0;
}
$event->calendar_color = \request('calendar_color'); $event->calendar_color = \request('calendar_color');
$event->calendar_icon = \request('calendar_icon'); $event->calendar_icon = \request('calendar_icon');

View File

@@ -62,6 +62,14 @@ class EventTypeController extends Controller
{ {
$eventType->use_schedule = 0; $eventType->use_schedule = 0;
} }
if(\request("hidden"))
{
$eventType->hidden = 1;
}
else
{
$eventType->hidden = 0;
}
if ($request->is_mandatory == 'on') if ($request->is_mandatory == 'on')
{ {
$eventType->is_mandatory = 1; $eventType->is_mandatory = 1;
@@ -174,6 +182,14 @@ class EventTypeController extends Controller
{ {
$eventType->use_schedule = 0; $eventType->use_schedule = 0;
} }
if(\request("hidden"))
{
$eventType->hidden = 1;
}
else
{
$eventType->hidden = 0;
}
if ($request->is_mandatory == 'on') if ($request->is_mandatory == 'on')
{ {
$eventType->is_mandatory = 1; $eventType->is_mandatory = 1;

View File

@@ -46,6 +46,11 @@ class ScheduleController extends Controller
} }
foreach ($allevents as $event) { foreach ($allevents as $event) {
if ($event->hidden == 1) {
if (\Auth::check())
{
if (\Auth::user()->p('instruction_see_hidden_event') == 1)
{
if(strtotime($event->date_begin) >= $start && strtotime($event->date_begin) <= $end) { if(strtotime($event->date_begin) >= $start && strtotime($event->date_begin) <= $end) {
array_push($events,$event); array_push($events,$event);
} }
@@ -53,6 +58,18 @@ class ScheduleController extends Controller
array_push($events,$event); array_push($events,$event);
} }
} }
}
}
else
{
if(strtotime($event->date_begin) >= $start && strtotime($event->date_begin) <= $end) {
array_push($events,$event);
}
else if(strtotime($event->date_end) >= $start && strtotime($event->date_end) <= $end) {
array_push($events,$event);
}
}
}
foreach ($schedules as $schedule) { foreach ($schedules as $schedule) {
@@ -90,8 +107,16 @@ class ScheduleController extends Controller
$icon = $event->calendar_icon; $icon = $event->calendar_icon;
} }
$name = $event->name;
if ($event->hidden == 1) {
$color = $this->hex2rgba($color,0.5);
$icon = 'fas fa-eye-slash';
$name = 'Caché - '.$name;
}
$myevent = [ $myevent = [
'title' => $event->name, 'title' => $name,
'start' => date('c',strtotime($event->date_begin)), 'start' => date('c',strtotime($event->date_begin)),
'end' => date('c',strtotime($event->date_end)), 'end' => date('c',strtotime($event->date_end)),
'color' => $color, 'color' => $color,
@@ -106,6 +131,45 @@ class ScheduleController extends Controller
return json_encode($jsonevents); return json_encode($jsonevents);
} }
function hex2rgba($color, $opacity = false) {
$default = 'rgb(0,0,0)';
//Return default if no color provided
if(empty($color))
return $default;
//Sanitize $color if "#" is provided
if ($color[0] == '#' ) {
$color = substr( $color, 1 );
}
//Check if color has 6 or 3 characters and get values
if (strlen($color) == 6) {
$hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] );
} elseif ( strlen( $color ) == 3 ) {
$hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] );
} else {
return $default;
}
//Convert hexadec to rgb
$rgb = array_map('hexdec', $hex);
//Check if opacity is set(rgba or rgb)
if($opacity){
if(abs($opacity) > 1)
$opacity = 1.0;
$output = 'rgba('.implode(",",$rgb).','.$opacity.')';
} else {
$output = 'rgb('.implode(",",$rgb).')';
}
//Return rgb(a) color string
return $output;
}
public function loadModal($id,$db_type) public function loadModal($id,$db_type)
{ {
if($db_type == "event") if($db_type == "event")
@@ -216,6 +280,13 @@ class ScheduleController extends Controller
public function delete($id) public function delete($id)
{ {
$event = \App\Event::find($id); $event = \App\Event::find($id);
if ($event->hidden == 1)
{
if (\Auth::user()->p('instruction_see_hidden_event') != 1)
{
abort(403);
}
}
foreach ($event->courses as $course) foreach ($event->courses as $course)
{ {
$course->delete(); $course->delete();

View File

@@ -16,7 +16,7 @@ use Illuminate\Support\Arr;
class Permission extends Model class Permission extends Model
{ {
const PERMISSIONS = [ const PERMISSIONS = [
'news' => [ 'Nouvelle' => [
'news_see' => [ 'news_see' => [
'ckey' => 'news_see', 'ckey' => 'news_see',
'communName' => 'Voir les nouvelles', 'communName' => 'Voir les nouvelles',
@@ -46,7 +46,7 @@ class Permission extends Model
'valeur' => 0 'valeur' => 0
] ]
], ],
'inventory' => [ 'Inventaire' => [
'inventory_see' => [ 'inventory_see' => [
'ckey' => 'inventory_see', 'ckey' => 'inventory_see',
'communName' => 'Voir l\'inventaire', 'communName' => 'Voir l\'inventaire',
@@ -76,7 +76,7 @@ class Permission extends Model
'valeur' => 0 'valeur' => 0
], ],
], ],
'user' => [ 'Utilisateur' => [
'user_see' => [ 'user_see' => [
'ckey' => 'user_see', 'ckey' => 'user_see',
'communName' => 'Voir la liste des utilisateurs', 'communName' => 'Voir la liste des utilisateurs',
@@ -106,7 +106,7 @@ class Permission extends Model
'valeur' => 0 'valeur' => 0
], ],
], ],
'config' => [ 'Configuration' => [
'config_see' => [ 'config_see' => [
'ckey' => 'config_see', 'ckey' => 'config_see',
'communName' => 'Voir les configurations', 'communName' => 'Voir les configurations',
@@ -157,7 +157,7 @@ class Permission extends Model
'valeur' => 0 'valeur' => 0
] ]
], ],
'statistique' => [ 'Statistique' => [
'stats_see' => [ 'stats_see' => [
'ckey' => 'stats_see', 'ckey' => 'stats_see',
'communName' => 'Voir les statistiques', 'communName' => 'Voir les statistiques',
@@ -202,13 +202,6 @@ class Permission extends Model
'icon' => 'fa-eye', 'icon' => 'fa-eye',
'valeur' => 0 'valeur' => 0
], ],
'stats_instruction_see' => [
'ckey' => 'stats_instruction_see',
'communName' => 'Voir les statistiques de l\'instruction',
'desc' => 'L\'utilisateur peut-il voir les statistiques de l\'instruction',
'icon' => 'fa-eye',
'valeur' => 0
],
'course_see_all' => [ 'course_see_all' => [
'ckey' => 'course_see_all', 'ckey' => 'course_see_all',
'communName' => 'Voir les cours de tous les utilisateurs', 'communName' => 'Voir les cours de tous les utilisateurs',
@@ -237,6 +230,20 @@ class Permission extends Model
'icon' => 'fa-eye', 'icon' => 'fa-eye',
'valeur' => 0 'valeur' => 0
], ],
'stats_instruction_see' => [
'ckey' => 'stats_instruction_see',
'communName' => 'Voir les statistiques de l\'instruction',
'desc' => 'L\'utilisateur peut-il voir les statistiques de l\'instruction',
'icon' => 'fa-eye',
'valeur' => 0
],
'instruction_see_hidden_event' => [
'ckey' => 'instruction_see_hidden_event',
'communName' => 'Voir les évenements cachés',
'desc' => 'L\'utilisateur peut-il voir les évenements cachés',
'icon' => 'fa-eye',
'valeur' => 0
],
], ],
'Administration' => [ 'Administration' => [
'cadet_list_see' => [ 'cadet_list_see' => [
@@ -277,7 +284,7 @@ class Permission extends Model
'valeur' => 0 'valeur' => 0
] ]
], ],
'article' => [ 'Articles' => [
'article_see' => [ 'article_see' => [
'ckey' => 'article_see', 'ckey' => 'article_see',
'communName' => 'Voir les articles', 'communName' => 'Voir les articles',
@@ -307,7 +314,7 @@ class Permission extends Model
'valeur' => 0 'valeur' => 0
], ],
], ],
'picture' => [ 'Photos & Images' => [
'picture_see' => [ 'picture_see' => [
'ckey' => 'picture_see', 'ckey' => 'picture_see',
'communName' => 'Voir les images', 'communName' => 'Voir les images',
@@ -337,7 +344,7 @@ class Permission extends Model
'valeur' => 0 'valeur' => 0
], ],
], ],
'file' => [ 'Fichiers' => [
'file_see' => [ 'file_see' => [
'ckey' => 'file_see', 'ckey' => 'file_see',
'communName' => 'Voir les fichiers publiques', 'communName' => 'Voir les fichiers publiques',
@@ -388,6 +395,11 @@ class Permission extends Model
return self::PERMISSIONS; return self::PERMISSIONS;
} }
public static function allToJSON()
{
return self::all()->toJson();
}
public static function allToString($value = null) public static function allToString($value = null)
{ {
$perm = []; $perm = [];

View File

@@ -5,7 +5,7 @@ current:
major: 3 major: 3
minor: 2 minor: 2
patch: 5 patch: 5
prerelease: 41-g465bac0e prerelease: 54-g63301aec
buildmetadata: '' buildmetadata: ''
commit: 41845 commit: 41845
timestamp: timestamp:

View File

@@ -31,6 +31,7 @@ class CreateEventsTable extends Migration
$table->string('calendar_color'); $table->string('calendar_color');
$table->string('calendar_icon'); $table->string('calendar_icon');
$table->string('weekly_msg_publication_time')->default('-5day'); $table->string('weekly_msg_publication_time')->default('-5day');
$table->boolean('hidden')->default(0);
$table->timestamps(); $table->timestamps();
}); });
} }

View File

@@ -28,6 +28,7 @@ class CreateEventTypesTable extends Migration
$table->boolean('use_schedule')->default(false); $table->boolean('use_schedule')->default(false);
$table->text('schedule_model'); $table->text('schedule_model');
$table->boolean('is_promoted')->default(false); $table->boolean('is_promoted')->default(false);
$table->boolean('hidden')->default(false);
$table->timestamps(); $table->timestamps();
}); });
} }

26
public/js/calendar.js vendored
View File

@@ -19,7 +19,7 @@ function initFullCalendar(authToken) {
right: 'prev,next' right: 'prev,next'
}, },
defaultDate: initDate, defaultDate: initDate,
events: '/api/schedule/events', events: '/api/schedule/events/auth?api_token='+authToken,
eventRender: function(event, element) { eventRender: function(event, element) {
if (event.event.extendedProps.icon && event.view.type == 'dayGridMonth') if (event.event.extendedProps.icon && event.view.type == 'dayGridMonth')
{ {
@@ -130,13 +130,7 @@ function deleteEvent(pid){
if (result.value) { if (result.value) {
(function($) { (function($) {
$.post('/api/schedule/event/delete/'+pid+'?api_token='+api_token, function(data) { $.post('/api/schedule/event/delete/'+pid+'?api_token='+api_token, function(data, status, xhr) {
console.log('Delete');
});
})(jQuery);
swal( swal(
'Supprimé!', 'Supprimé!',
"L'évenement a été supprimé", "L'évenement a été supprimé",
@@ -146,6 +140,22 @@ function deleteEvent(pid){
location.reload(); location.reload();
} }
}) })
}).fail(function (data, status, xhr) {
if (xhr == 'Forbidden') {
swal(
'Oups!',
"Vous n'avez pas les permissions nécessaires...",
'error'
).then((result) => {
if (result.value) {
location.reload();
}
})
}
});
})(jQuery);
} }
}) })
} }

View File

@@ -488,6 +488,15 @@ function loadEventType(date,id = 1)
switchUseSchedule(); switchUseSchedule();
} }
if (eventType['hidden'] == 1)
{
$('#hidden').prop('checked',true);
}
else
{
$('#hidden').removeAttr('checked');
}
if (eventType['use_weekly_msg'] == 1) if (eventType['use_weekly_msg'] == 1)
{ {
$('#use_weekly_msg').prop('checked',true); $('#use_weekly_msg').prop('checked',true);
@@ -604,6 +613,15 @@ function loadEvent(date,id)
switchUseSchedule(); switchUseSchedule();
} }
if (eventType['hidden'] == 1)
{
$('#hidden').prop('checked',true);
}
else
{
$('#hidden').removeAttr('checked');
}
if (eventType['use_weekly_msg'] == 1) if (eventType['use_weekly_msg'] == 1)
{ {
$('#use_weekly_msg').prop('checked',true); $('#use_weekly_msg').prop('checked',true);

View File

@@ -31,41 +31,34 @@
<p> <p>
Choisissez quels permissions doivent être associé avec ce grade. Choisissez quels permissions doivent être associé avec ce grade.
</p> </p>
<div id="accordion" role="tablist"> <table id="permission-table" class="table table-bordered" style="width:100%">
<thead class="d-none">
<th class="d-none">Cat</th>
<th>Nom</th>
<th></th>
</thead>
<tbody>
@foreach(\App\Permission::allToArray() as $key => $cat) @foreach(\App\Permission::allToArray() as $key => $cat)
<div class="card card-collapse">
<div class="card-header" role="tab" id="headingOne">
<h5 class="mb-0">
<a class="text-capitalize" data-toggle="collapse" href="#coll-{{$key}}" @if ($loop->first) aria-expanded="true" @endif aria-controls="collapseOne">
{{$key}}
<i class="material-icons">keyboard_arrow_down</i>
</a>
</h5>
</div>
<div id="coll-{{$key}}" class="collapse @if ($loop->first) show @endif" role="tabpanel" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body">
<div class="row">
@foreach($cat as $r) @foreach($cat as $r)
<div class="col-3 text-center"> <tr>
<td class="d-none">{{$key}}</td>
<td>
<input class="d-none" type="text" id="{{$r['ckey']}}" name="{{$r['ckey']}}"> <input class="d-none" type="text" id="{{$r['ckey']}}" name="{{$r['ckey']}}">
<h5>{{$r['communName']}}</h5> {{$r['communName']}}<br>
<small>{{$r['desc']}}</small>
</td>
<td class="text-center">
<div class="btn-group"> <div class="btn-group">
<button type="button" id="{{$r['ckey']}}-close" class="btn btn-just-icon btn-outline-danger" onclick="switchPermissionSwitch('{{$r['ckey']}}','close')"><i class="fas fa-times"></i></button> <button type="button" id="{{$r['ckey']}}-close" class="btn btn-just-icon btn-outline-danger" onclick="switchPermissionSwitch('{{$r['ckey']}}','close')"><i class="fas fa-times"></i></button>
<!--<button type="button" id="{{$r['ckey']}}-slash" class="btn btn-just-icon btn-warning" onclick="switchPermissionSwitch('{{$r['ckey']}}','slash')"><i class="fa fa-slash"></i></button>--> <!--<button type="button" id="{{$r['ckey']}}-slash" class="btn btn-just-icon btn-warning" onclick="switchPermissionSwitch('{{$r['ckey']}}','slash')"><i class="fa fa-slash"></i></button>-->
<button type="button" id="{{$r['ckey']}}-plus" class="btn btn-just-icon btn-outline-success" onclick="switchPermissionSwitch('{{$r['ckey']}}','plus')"><i class="fa fa-plus"></i></button> <button type="button" id="{{$r['ckey']}}-plus" class="btn btn-just-icon btn-outline-success" onclick="switchPermissionSwitch('{{$r['ckey']}}','plus')"><i class="fa fa-plus"></i></button>
</div> </div>
<p> </td>
<small>{{$r['desc']}}</small> </tr>
</p>
</div>
@endforeach @endforeach
</div>
</div>
</div>
</div>
@endforeach @endforeach
</div> </tbody>
</table>
</div> </div>
<div class="col-md-12 mt-5"> <div class="col-md-12 mt-5">
<button type="submit" class="btn btn-primary">Sauvegarder</button> <button type="submit" class="btn btn-primary">Sauvegarder</button>
@@ -83,5 +76,17 @@
$('#desc').trumbowyg({ $('#desc').trumbowyg({
lang: 'fr' lang: 'fr'
}); });
$(document).ready(function() {
$('#permission-table').DataTable({
rowGroup: {
dataSrc: 0
},
pageLength: 100,
lengthChange: false,
columnDefs: [
{ "visible": false, "targets": [0] }
]
});
} );
</script> </script>
@endsection @endsection

View File

@@ -31,7 +31,41 @@
<p> <p>
Choisissez quels permissions doivent être associé avec ce grade. Choisissez quels permissions doivent être associé avec ce grade.
</p> </p>
<div id="accordion" role="tablist"> <table id="permission-table" class="table table-bordered" style="width:100%">
<thead class="d-none">
<th class="d-none">Cat</th>
<th>Nom</th>
<th></th>
</thead>
<tbody>
@foreach(\App\Permission::allToArray() as $key => $cat)
@foreach($cat as $r)
<tr>
<td class="d-none">{{$key}}</td>
<td>
<input class="d-none" type="text" id="{{$r['ckey']}}"
name="{{$r['ckey']}}" value="{{$rank->p($r['ckey'])}}">
{{$r['communName']}}<br>
<small>{{$r['desc']}}</small>
</td>
<td class="text-center">
<div class="btn-group">
<button type="button" id="{{$r['ckey']}}-close"
class="btn btn-just-icon @if($rank->p($r['ckey']) != -1) btn-outline-danger @else btn-danger @endif"
onclick="switchPermissionSwitch('{{$r['ckey']}}','close')">
<i class="fas fa-times"></i></button>
<button type="button" id="{{$r['ckey']}}-plus"
class="btn btn-just-icon @if($rank->p($r['ckey']) != 1) btn-outline-success @else btn-success @endif"
onclick="switchPermissionSwitch('{{$r['ckey']}}','plus')">
<i class="fa fa-plus"></i></button>
</div>
</td>
</tr>
@endforeach
@endforeach
</tbody>
</table>
{{--<div id="accordion" role="tablist">
@foreach(\App\Permission::allToArray() as $key => $cat) @foreach(\App\Permission::allToArray() as $key => $cat)
<div class="mb-4"> <div class="mb-4">
<h3 class="text-capitalize">{{$key}}</h3> <h3 class="text-capitalize">{{$key}}</h3>
@@ -56,12 +90,11 @@
<i class="fa fa-plus"></i></button> <i class="fa fa-plus"></i></button>
</div> </div>
</div> </div>
<hr>
@endforeach @endforeach
</div> </div>
</div> </div>
@endforeach @endforeach
</div> </div>--}}
</div> </div>
<div class="col-md-12 mt-5"> <div class="col-md-12 mt-5">
<button type="submit" class="btn btn-primary">Sauvegarder</button> <button type="submit" class="btn btn-primary">Sauvegarder</button>
@@ -79,5 +112,17 @@
$('#desc').trumbowyg({ $('#desc').trumbowyg({
lang: 'fr' lang: 'fr'
}); });
$(document).ready(function() {
$('#permission-table').DataTable({
rowGroup: {
dataSrc: 0
},
pageLength: 100,
lengthChange: false,
columnDefs: [
{ "visible": false, "targets": [0] }
]
});
} );
</script> </script>
@endsection @endsection

View File

@@ -11,13 +11,13 @@
<form method="post"> <form method="post">
@csrf @csrf
<div class="row"> <div class="row">
<div class="col-md-5"> <div class="col-md-4">
<div class="form-group"> <div class="form-group">
<label class="label-control">Nom</label> <label class="label-control">Nom</label>
<input type="text" class="form-control" name="name" required/> <input type="text" class="form-control" name="name" required/>
</div> </div>
</div> </div>
<div class="col-md-5"> <div class="col-md-4">
<div class="form-group"> <div class="form-group">
<label class="label-control">Emplacement</label> <label class="label-control">Emplacement</label>
<input type="text" class="form-control" name="location" required/> <input type="text" class="form-control" name="location" required/>
@@ -32,6 +32,15 @@
</label> </label>
</div> </div>
</div> </div>
<div class="col-md-2">
<div class="togglebutton">
<label>
<input type="checkbox" name="hidden">
<span class="toggle"></span>
Évenement caché
</label>
</div>
</div>
<div class="col-md-3"> <div class="col-md-3">
<div class="form-group"> <div class="form-group">
<label class="label-control">Heure de début</label> <label class="label-control">Heure de début</label>

View File

@@ -12,13 +12,13 @@
@method('PATCH') @method('PATCH')
@csrf @csrf
<div class="row"> <div class="row">
<div class="col-md-5"> <div class="col-md-4">
<div class="form-group"> <div class="form-group">
<label class="label-control">Nom</label> <label class="label-control">Nom</label>
<input type="text" class="form-control" value="{{$event_type->name}}" name="name" /> <input type="text" class="form-control" value="{{$event_type->name}}" name="name" />
</div> </div>
</div> </div>
<div class="col-md-5"> <div class="col-md-4">
<div class="form-group"> <div class="form-group">
<label class="label-control">Emplacement</label> <label class="label-control">Emplacement</label>
<input type="text" class="form-control" value="{{$event_type->location}}" name="location" /> <input type="text" class="form-control" value="{{$event_type->location}}" name="location" />
@@ -33,6 +33,15 @@
</label> </label>
</div> </div>
</div> </div>
<div class="col-md-2">
<div class="togglebutton">
<label>
<input type="checkbox" name="hidden" @if($event_type->hidden == 1) checked @endif>
<span class="toggle"></span>
Évenement caché
</label>
</div>
</div>
<div class="col-md-3"> <div class="col-md-3">
<div class="form-group"> <div class="form-group">
<label class="label-control">Heure de début</label> <label class="label-control">Heure de début</label>

View File

@@ -31,7 +31,35 @@
<p> <p>
Choisissez quels permissions doivent être associé avec ce poste. Choisissez quels permissions doivent être associé avec ce poste.
</p> </p>
<div id="accordion" role="tablist"> <table id="permission-table" class="table table-bordered" style="width:100%">
<thead class="d-none">
<th class="d-none">Cat</th>
<th>Nom</th>
<th></th>
</thead>
<tbody>
@foreach(\App\Permission::allToArray() as $key => $cat)
@foreach($cat as $r)
<tr>
<td class="d-none">{{$key}}</td>
<td>
<input class="d-none" type="text" id="{{$r['ckey']}}" name="{{$r['ckey']}}">
{{$r['communName']}}<br>
<small>{{$r['desc']}}</small>
</td>
<td class="text-center">
<div class="btn-group">
<button type="button" id="{{$r['ckey']}}-close" class="btn btn-just-icon btn-outline-danger" onclick="switchPermissionSwitch('{{$r['ckey']}}','close')"><i class="fas fa-times"></i></button>
<button type="button" id="{{$r['ckey']}}-slash" class="btn btn-just-icon btn-warning" onclick="switchPermissionSwitch('{{$r['ckey']}}','slash')"><i class="fa fa-slash"></i></button>
<button type="button" id="{{$r['ckey']}}-plus" class="btn btn-just-icon btn-outline-success" onclick="switchPermissionSwitch('{{$r['ckey']}}','plus')"><i class="fa fa-plus"></i></button>
</div>
</td>
</tr>
@endforeach
@endforeach
</tbody>
</table>
{{--<div id="accordion" role="tablist">
@foreach(\App\Permission::allToArray() as $key => $cat) @foreach(\App\Permission::allToArray() as $key => $cat)
<div class="card card-collapse"> <div class="card card-collapse">
<div class="card-header" role="tab" id="headingOne"> <div class="card-header" role="tab" id="headingOne">
@@ -65,7 +93,7 @@
</div> </div>
</div> </div>
@endforeach @endforeach
</div> </div>--}}
</div> </div>
<div class="col-md-12 mt-5"> <div class="col-md-12 mt-5">
<button type="submit" class="btn btn-primary">Sauvegarder</button> <button type="submit" class="btn btn-primary">Sauvegarder</button>
@@ -83,5 +111,17 @@
$('#desc').trumbowyg({ $('#desc').trumbowyg({
lang: 'fr' lang: 'fr'
}); });
$(document).ready(function() {
$('#permission-table').DataTable({
rowGroup: {
dataSrc: 0
},
pageLength: 100,
lengthChange: false,
columnDefs: [
{ "visible": false, "targets": [0] }
]
});
} );
</script> </script>
@endsection @endsection

View File

@@ -31,7 +31,35 @@
<p> <p>
Choisissez quels permissions doivent être associé avec ce poste. Choisissez quels permissions doivent être associé avec ce poste.
</p> </p>
<div id="accordion" role="tablist"> <table id="permission-table" class="table table-bordered" style="width:100%">
<thead class="d-none">
<th class="d-none">Cat</th>
<th>Nom</th>
<th></th>
</thead>
<tbody>
@foreach(\App\Permission::allToArray() as $key => $cat)
@foreach($cat as $r)
<tr>
<td class="d-none">{{$key}}</td>
<td>
<input class="d-none" type="text" id="{{$r['ckey']}}" name="{{$r['ckey']}}" value="{{$job->p($r['ckey'])}}">
{{$r['communName']}}<br>
<small>{{$r['desc']}}</small>
</td>
<td class="text-center">
<div class="btn-group">
<button type="button" id="{{$r['ckey']}}-close" class="btn btn-just-icon @if($job->p($r['ckey']) != -1) btn-outline-danger @else btn-danger @endif" onclick="switchPermissionSwitch('{{$r['ckey']}}','close')"><i class="fas fa-times"></i></button>
<button type="button" id="{{$r['ckey']}}-slash" class="btn btn-just-icon @if($job->p($r['ckey']) == 0) btn-warning @else btn-outline-warning @endif" onclick="switchPermissionSwitch('{{$r['ckey']}}','slash')"><i class="fas fa-slash"></i></button>
<button type="button" id="{{$r['ckey']}}-plus" class="btn btn-just-icon @if($job->p($r['ckey']) != 1) btn-outline-success @else btn-success @endif" onclick="switchPermissionSwitch('{{$r['ckey']}}','plus')"><i class="fas fa-plus"></i></button>
</div>
</td>
</tr>
@endforeach
@endforeach
</tbody>
</table>
{{-- <div id="accordion" role="tablist">
@foreach(\App\Permission::allToArray() as $key => $cat) @foreach(\App\Permission::allToArray() as $key => $cat)
<div class="card card-collapse"> <div class="card card-collapse">
<div class="card-header" role="tab" id="headingOne"> <div class="card-header" role="tab" id="headingOne">
@@ -65,7 +93,7 @@
</div> </div>
</div> </div>
@endforeach @endforeach
</div> </div>--}}
</div> </div>
<div class="col-md-12 mt-5"> <div class="col-md-12 mt-5">
<button type="submit" class="btn btn-primary">Sauvegarder</button> <button type="submit" class="btn btn-primary">Sauvegarder</button>
@@ -83,5 +111,17 @@
$('#desc').trumbowyg({ $('#desc').trumbowyg({
lang: 'fr' lang: 'fr'
}); });
$(document).ready(function() {
$('#permission-table').DataTable({
rowGroup: {
dataSrc: 0
},
pageLength: 100,
lengthChange: false,
columnDefs: [
{ "visible": false, "targets": [0] }
]
});
} );
</script> </script>
@endsection @endsection

View File

@@ -157,6 +157,17 @@
</label> </label>
</div> </div>
</div> </div>
<div class="form-group">
<label class="m-0" for="type">Évenement caché</label>
<small class="text-muted d-block">L'évenement doit t-il être caché?</small>
<div class="togglebutton">
<label>
<input type="checkbox" id="hidden" name="hidden">
<span class="toggle"></span>
Caché
</label>
</div>
</div>
<div id="accordion-apparence" role="tablist"> <div id="accordion-apparence" role="tablist">
<div class="card card-collapse"> <div class="card card-collapse">
<div class="card-header" role="tab" id="heading-apparence"> <div class="card-header" role="tab" id="heading-apparence">

View File

@@ -170,6 +170,17 @@
</label> </label>
</div> </div>
</div> </div>
<div class="form-group">
<label class="m-0" for="type">Évenement caché</label>
<small class="text-muted d-block">L'évenement doit t-il être caché?</small>
<div class="togglebutton">
<label>
<input type="checkbox" id="hidden" name="hidden">
<span class="toggle"></span>
Caché
</label>
</div>
</div>
<div id="accordion-apparence" role="tablist"> <div id="accordion-apparence" role="tablist">
<div class="card card-collapse"> <div class="card card-collapse">
<div class="card-header" role="tab" id="heading-apparence"> <div class="card-header" role="tab" id="heading-apparence">

View File

@@ -1,3 +1,8 @@
@if($event->hidden == 1)
<div class="alert alert-danger text-center" role="alert" style="margin-top:-4rem">
<b>Évenement caché</b>
</div>
@endif
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">{{$event->name}}</h5> <h5 class="modal-title" id="exampleModalLabel">{{$event->name}}</h5>
<button type="button" class="close" onclick="closeScheduleModal()" aria-label="Close"> <button type="button" class="close" onclick="closeScheduleModal()" aria-label="Close">

View File

@@ -17,6 +17,7 @@ Route::get('/schedule/events/modal/{id}/{db_type}','ScheduleController@loadModal
Route::middleware('auth:api')->group(function () { Route::middleware('auth:api')->group(function () {
Route::get('/schedule/events/auth','ScheduleController@apiIndex');
Route::get('/schedule/events/modal/full/{id}/{db_type}','ScheduleController@loadModalFull')->middleware('perm:schedule_see'); Route::get('/schedule/events/modal/full/{id}/{db_type}','ScheduleController@loadModalFull')->middleware('perm:schedule_see');
Route::get('/schedule/events/add/modal/{type}/{date}','ScheduleController@loadModalDefautType')->middleware('perm:schedule_add'); Route::get('/schedule/events/add/modal/{type}/{date}','ScheduleController@loadModalDefautType')->middleware('perm:schedule_add');
Route::get('/schedule/editor/init/{id}','ScheduleEditorController@getTemplate')->middleware('perm:schedule_edit'); Route::get('/schedule/editor/init/{id}','ScheduleEditorController@getTemplate')->middleware('perm:schedule_edit');