mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-21 02:39:10 -04:00
Merge branch 'hide-event' into 'dev'
Hide event See merge request TheGamecraft/c-cms!115
This commit is contained in:
221
Envoy.blade.php
221
Envoy.blade.php
@@ -1,175 +1,178 @@
|
||||
@servers(['web' => 'deployer@vps188754.vps.ovh.ca'])
|
||||
|
||||
@setup
|
||||
$repository = 'git@gitlab.com:TheGamecraft/c-cms.git';
|
||||
$release = date('YmdHis');
|
||||
$repository = 'git@gitlab.com:TheGamecraft/c-cms.git';
|
||||
$release = date('YmdHis');
|
||||
|
||||
$releases_dir_697 = '/var/www/c-cms/escadron697/releases';
|
||||
$app_dir_697 = '/var/www/c-cms/escadron697';
|
||||
$new_release_dir_697 = $releases_dir_697 .'/'. $release;
|
||||
$releases_dir_697 = '/var/www/c-cms/escadron697/releases';
|
||||
$app_dir_697 = '/var/www/c-cms/escadron697';
|
||||
$new_release_dir_697 = $releases_dir_697 .'/'. $release;
|
||||
|
||||
$releases_dir_736 = '/var/www/c-cms/escadron736/releases';
|
||||
$app_dir_736 = '/var/www/c-cms/escadron736';
|
||||
$new_release_dir_736 = $releases_dir_736 .'/'. $release;
|
||||
$releases_dir_736 = '/var/www/c-cms/escadron736/releases';
|
||||
$app_dir_736 = '/var/www/c-cms/escadron736';
|
||||
$new_release_dir_736 = $releases_dir_736 .'/'. $release;
|
||||
|
||||
$releases_dir_dev = '/var/www/c-cms/dev/releases';
|
||||
$app_dir_dev = '/var/www/c-cms/dev';
|
||||
$new_release_dir_dev = $releases_dir_dev .'/'. $release;
|
||||
$releases_dir_dev = '/var/www/c-cms/dev/releases';
|
||||
$app_dir_dev = '/var/www/c-cms/dev';
|
||||
$new_release_dir_dev = $releases_dir_dev .'/'. $release;
|
||||
|
||||
$releases_dir_227 = '/var/www/c-cms/ccmrc227/releases';
|
||||
$app_dir_227 = '/var/www/c-cms/ccmrc227';
|
||||
$new_release_dir_227 = $releases_dir_227 .'/'. $release;
|
||||
$releases_dir_227 = '/var/www/c-cms/ccmrc227/releases';
|
||||
$app_dir_227 = '/var/www/c-cms/ccmrc227';
|
||||
$new_release_dir_227 = $releases_dir_227 .'/'. $release;
|
||||
|
||||
$releases_dir_117 = '/var/www/c-cms/ccmrc117/releases';
|
||||
$app_dir_117 = '/var/www/c-cms/ccmrc117';
|
||||
$new_release_dir_117 = $releases_dir_117 .'/'. $release;
|
||||
$releases_dir_117 = '/var/www/c-cms/ccmrc117/releases';
|
||||
$app_dir_117 = '/var/www/c-cms/ccmrc117';
|
||||
$new_release_dir_117 = $releases_dir_117 .'/'. $release;
|
||||
@endsetup
|
||||
|
||||
@story('deploy_697')
|
||||
clone_repository_697
|
||||
run_composer_697
|
||||
update_symlinks_697
|
||||
clone_repository_697
|
||||
run_composer_697
|
||||
update_symlinks_697
|
||||
@endstory
|
||||
|
||||
@story('deploy_736')
|
||||
clone_repository_736
|
||||
run_composer_736
|
||||
update_symlinks_736
|
||||
clone_repository_736
|
||||
run_composer_736
|
||||
update_symlinks_736
|
||||
@endstory
|
||||
|
||||
@story('deploy_dev')
|
||||
clone_repository_dev
|
||||
run_composer_dev
|
||||
update_symlinks_dev
|
||||
remove_old_release_dev
|
||||
clone_repository_dev
|
||||
run_composer_dev
|
||||
update_symlinks_dev
|
||||
remove_old_release_dev
|
||||
@endstory
|
||||
|
||||
@story('deploy_227')
|
||||
clone_repository_227
|
||||
run_composer_227
|
||||
update_symlinks_227
|
||||
clone_repository_227
|
||||
run_composer_227
|
||||
update_symlinks_227
|
||||
@endstory
|
||||
|
||||
@story('deploy_117')
|
||||
clone_repository_117
|
||||
run_composer_117
|
||||
update_symlinks_117
|
||||
clone_repository_117
|
||||
run_composer_117
|
||||
update_symlinks_117
|
||||
@endstory
|
||||
|
||||
@task('clone_repository_697')
|
||||
echo 'Cloning repository'
|
||||
[ -d {{ $releases_dir_697 }} ] || mkdir {{ $releases_dir_697 }}
|
||||
git clone --depth 1 {{ $repository }} {{ $new_release_dir_697 }}
|
||||
cd {{ $new_release_dir_697 }}
|
||||
git reset --hard {{ $commit }}
|
||||
echo 'Cloning repository'
|
||||
[ -d {{ $releases_dir_697 }} ] || mkdir {{ $releases_dir_697 }}
|
||||
git clone --depth 1 {{ $repository }} {{ $new_release_dir_697 }}
|
||||
cd {{ $new_release_dir_697 }}
|
||||
git reset --hard {{ $commit }}
|
||||
@endtask
|
||||
|
||||
@task('run_composer_697')
|
||||
echo "Starting deployment ({{ $release }})"
|
||||
cd {{ $new_release_dir_697 }}
|
||||
composer install --prefer-dist --no-scripts -q -o --no-dev
|
||||
npm install
|
||||
npm run production
|
||||
echo "Starting deployment ({{ $release }})"
|
||||
cd {{ $new_release_dir_697 }}
|
||||
composer install --prefer-dist --no-scripts -q -o --no-dev
|
||||
npm install
|
||||
npm run production
|
||||
@endtask
|
||||
|
||||
@task('update_symlinks_697')
|
||||
echo "Linking storage directory"
|
||||
rm -rf {{ $new_release_dir_697 }}/storage
|
||||
ln -nfs {{ $app_dir_697 }}/storage {{ $new_release_dir_697 }}/storage
|
||||
echo "Linking storage directory"
|
||||
rm -rf {{ $new_release_dir_697 }}/storage
|
||||
ln -nfs {{ $app_dir_697 }}/storage {{ $new_release_dir_697 }}/storage
|
||||
|
||||
echo 'Linking .env file'
|
||||
ln -nfs {{ $app_dir_697 }}/.env {{ $new_release_dir_697 }}/.env
|
||||
echo 'Linking .env file'
|
||||
ln -nfs {{ $app_dir_697 }}/.env {{ $new_release_dir_697 }}/.env
|
||||
|
||||
echo 'Linking current release'
|
||||
ln -nfs {{ $new_release_dir_697 }} {{ $app_dir_697 }}/current
|
||||
echo 'Linking current release'
|
||||
ln -nfs {{ $new_release_dir_697 }} {{ $app_dir_697 }}/current
|
||||
|
||||
echo 'Setting permission'
|
||||
chmod -R 777 {{ $app_dir_697 }}/current/bootstrap/
|
||||
echo 'Setting permission'
|
||||
chmod -R 777 {{ $app_dir_697 }}/current/bootstrap/
|
||||
|
||||
echo 'Migrate DB'
|
||||
cd {{ $app_dir_697 }}/current/
|
||||
yes|php artisan migrate
|
||||
yes|php artisan db:seed --class=ConfigsTableSeeder
|
||||
echo 'Migrate DB'
|
||||
cd {{ $app_dir_697 }}/current/
|
||||
yes|php artisan migrate
|
||||
yes|php artisan db:seed --class=ConfigsTableSeeder
|
||||
php artisan update
|
||||
|
||||
@endtask
|
||||
|
||||
@task('clone_repository_736')
|
||||
echo 'Cloning repository'
|
||||
[ -d {{ $releases_dir_736 }} ] || mkdir {{ $releases_dir_736 }}
|
||||
git clone --depth 1 {{ $repository }} {{ $new_release_dir_736 }}
|
||||
cd {{ $new_release_dir_736 }}
|
||||
git reset --hard {{ $commit }}
|
||||
echo 'Cloning repository'
|
||||
[ -d {{ $releases_dir_736 }} ] || mkdir {{ $releases_dir_736 }}
|
||||
git clone --depth 1 {{ $repository }} {{ $new_release_dir_736 }}
|
||||
cd {{ $new_release_dir_736 }}
|
||||
git reset --hard {{ $commit }}
|
||||
@endtask
|
||||
|
||||
@task('run_composer_736')
|
||||
echo "Starting deployment ({{ $release }})"
|
||||
cd {{ $new_release_dir_736 }}
|
||||
composer install --prefer-dist --no-scripts -q -o --no-dev
|
||||
npm install
|
||||
npm run production
|
||||
echo "Starting deployment ({{ $release }})"
|
||||
cd {{ $new_release_dir_736 }}
|
||||
composer install --prefer-dist --no-scripts -q -o --no-dev
|
||||
npm install
|
||||
npm run production
|
||||
@endtask
|
||||
|
||||
@task('update_symlinks_736')
|
||||
echo "Linking storage directory"
|
||||
rm -rf {{ $new_release_dir_736 }}/storage
|
||||
ln -nfs {{ $app_dir_736 }}/storage {{ $new_release_dir_736 }}/storage
|
||||
echo "Linking storage directory"
|
||||
rm -rf {{ $new_release_dir_736 }}/storage
|
||||
ln -nfs {{ $app_dir_736 }}/storage {{ $new_release_dir_736 }}/storage
|
||||
|
||||
echo 'Linking .env file'
|
||||
ln -nfs {{ $app_dir_736 }}/.env {{ $new_release_dir_736 }}/.env
|
||||
echo 'Linking .env file'
|
||||
ln -nfs {{ $app_dir_736 }}/.env {{ $new_release_dir_736 }}/.env
|
||||
|
||||
echo 'Linking current release'
|
||||
ln -nfs {{ $new_release_dir_736 }} {{ $app_dir_736 }}/current
|
||||
echo 'Linking current release'
|
||||
ln -nfs {{ $new_release_dir_736 }} {{ $app_dir_736 }}/current
|
||||
|
||||
echo 'Setting permission'
|
||||
chmod -R 777 {{ $app_dir_736 }}/current/bootstrap/
|
||||
echo 'Setting permission'
|
||||
chmod -R 777 {{ $app_dir_736 }}/current/bootstrap/
|
||||
|
||||
echo 'Migrate DB'
|
||||
cd {{ $app_dir_736 }}/current/
|
||||
yes|php artisan migrate
|
||||
yes|php artisan db:seed --class=ConfigsTableSeeder
|
||||
echo 'Migrate DB'
|
||||
cd {{ $app_dir_736 }}/current/
|
||||
yes|php artisan migrate
|
||||
yes|php artisan db:seed --class=ConfigsTableSeeder
|
||||
php artisan update
|
||||
|
||||
@endtask
|
||||
|
||||
@task('clone_repository_dev')
|
||||
echo 'Cloning repository'
|
||||
[ -d {{ $releases_dir_dev }} ] || mkdir {{ $releases_dir_dev }}
|
||||
git clone --depth 1 --single-branch -b dev {{ $repository }} {{ $new_release_dir_dev }}
|
||||
cd {{ $new_release_dir_dev }}
|
||||
git reset --hard {{ $commit }}
|
||||
echo 'Cloning repository'
|
||||
[ -d {{ $releases_dir_dev }} ] || mkdir {{ $releases_dir_dev }}
|
||||
git clone --depth 1 --single-branch -b dev {{ $repository }} {{ $new_release_dir_dev }}
|
||||
cd {{ $new_release_dir_dev }}
|
||||
git reset --hard {{ $commit }}
|
||||
@endtask
|
||||
|
||||
@task('run_composer_dev')
|
||||
echo "Starting deployment ({{ $release }})"
|
||||
cd {{ $new_release_dir_dev }}
|
||||
composer install --prefer-dist --no-scripts -q -o --no-dev
|
||||
npm install
|
||||
npm run production
|
||||
echo "Starting deployment ({{ $release }})"
|
||||
cd {{ $new_release_dir_dev }}
|
||||
composer install --prefer-dist --no-scripts -q -o --no-dev
|
||||
npm install
|
||||
npm run production
|
||||
@endtask
|
||||
|
||||
@task('update_symlinks_dev')
|
||||
echo "Linking storage directory"
|
||||
rm -rf {{ $new_release_dir_dev }}/storage
|
||||
ln -nfs {{ $app_dir_dev }}/storage {{ $new_release_dir_dev }}/storage
|
||||
echo "Linking storage directory"
|
||||
rm -rf {{ $new_release_dir_dev }}/storage
|
||||
ln -nfs {{ $app_dir_dev }}/storage {{ $new_release_dir_dev }}/storage
|
||||
|
||||
echo 'Linking .env file'
|
||||
ln -nfs {{ $app_dir_dev }}/.env {{ $new_release_dir_dev }}/.env
|
||||
echo 'Linking .env file'
|
||||
ln -nfs {{ $app_dir_dev }}/.env {{ $new_release_dir_dev }}/.env
|
||||
|
||||
echo 'Linking current release'
|
||||
ln -nfs {{ $new_release_dir_dev }} {{ $app_dir_dev }}/current
|
||||
echo 'Linking current release'
|
||||
ln -nfs {{ $new_release_dir_dev }} {{ $app_dir_dev }}/current
|
||||
|
||||
echo 'Setting permission'
|
||||
chmod -R 777 {{ $app_dir_dev }}/current/bootstrap/
|
||||
echo 'Setting permission'
|
||||
chmod -R 777 {{ $app_dir_dev }}/current/bootstrap/
|
||||
|
||||
echo 'Migrate DB'
|
||||
cd {{ $app_dir_dev }}/current/
|
||||
yes|php artisan migrate
|
||||
yes|php artisan db:seed --class=ConfigsTableSeeder
|
||||
echo 'Migrate DB'
|
||||
cd {{ $app_dir_dev }}/current/
|
||||
yes|php artisan migrate
|
||||
yes|php artisan db:seed --class=ConfigsTableSeeder
|
||||
php artisan update
|
||||
|
||||
@endtask
|
||||
|
||||
@task('remove_old_release_dev')
|
||||
cd {{ $releases_dir_dev }}
|
||||
rm -fr $(ls -t1 | tail -n +3)
|
||||
cd {{ $releases_dir_dev }}
|
||||
rm -fr $(ls -t1 | tail -n +3)
|
||||
@endtask
|
||||
|
||||
@task('clone_repository_227')
|
||||
@@ -204,8 +207,9 @@ chmod -R 777 {{ $app_dir_227 }}/current/bootstrap/
|
||||
|
||||
echo 'Migrate DB'
|
||||
cd {{ $app_dir_227 }}/current/
|
||||
yes|php artisan migrate
|
||||
yes|php artisan db:seed --class=ConfigsTableSeeder
|
||||
yes|php artisan migrate
|
||||
yes|php artisan db:seed --class=ConfigsTableSeeder
|
||||
php artisan update
|
||||
|
||||
@endtask
|
||||
|
||||
@@ -241,7 +245,8 @@ chmod -R 777 {{ $app_dir_117 }}/current/bootstrap/
|
||||
|
||||
echo 'Migrate DB'
|
||||
cd {{ $app_dir_117 }}/current/
|
||||
yes|php artisan migrate
|
||||
yes|php artisan db:seed --class=ConfigsTableSeeder
|
||||
yes|php artisan migrate
|
||||
yes|php artisan db:seed --class=ConfigsTableSeeder
|
||||
php artisan update
|
||||
|
||||
@endtask
|
||||
|
||||
81
app/Console/Commands/update.php
Normal file
81
app/Console/Commands/update.php
Normal 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;
|
||||
}
|
||||
}
|
||||
@@ -94,8 +94,18 @@ class Event extends Model
|
||||
return $c;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
$error = new \App\Course();
|
||||
$error->name = "Cours manquant dans la BD";
|
||||
$error->ocom = "ERREUR";
|
||||
$error->periode = $p;
|
||||
$error->level = $l;
|
||||
$error->location = "";
|
||||
$error->desc = "";
|
||||
$error->comment = "Le cours est manquant dans la base de données";
|
||||
$error->comment_officier = "Le cours est manquant dans la base de données";
|
||||
$error->event_id = $this->id;
|
||||
$error->user_id = 1;
|
||||
return $error;
|
||||
}
|
||||
|
||||
public function logs()
|
||||
|
||||
@@ -37,6 +37,9 @@ class CalendarController extends Controller
|
||||
|
||||
public function indexTable()
|
||||
{
|
||||
return view('admin.schedule.table.index',['events' => \App\Event::allThisYear()]);
|
||||
$event = \App\Event::allThisYear()->sortBy('date_begin')->filter(function ($value,$key) {
|
||||
return $value->hidden != 1;
|
||||
});
|
||||
return view('admin.schedule.table.index',['events' => $event]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,6 +100,15 @@ class EventController extends Controller
|
||||
$event->use_schedule = 0;
|
||||
}
|
||||
|
||||
if(\request("hidden"))
|
||||
{
|
||||
$event->hidden = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$event->hidden = 0;
|
||||
}
|
||||
|
||||
$event->calendar_color = \request('calendar_color');
|
||||
$event->calendar_icon = \request('calendar_icon');
|
||||
|
||||
@@ -225,7 +234,15 @@ class EventController extends Controller
|
||||
*/
|
||||
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)
|
||||
{
|
||||
$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())
|
||||
// {
|
||||
@@ -297,6 +321,15 @@ class EventController extends Controller
|
||||
$event->use_schedule = 0;
|
||||
}
|
||||
|
||||
if(\request("hidden"))
|
||||
{
|
||||
$event->hidden = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$event->hidden = 0;
|
||||
}
|
||||
|
||||
$event->calendar_color = \request('calendar_color');
|
||||
$event->calendar_icon = \request('calendar_icon');
|
||||
|
||||
|
||||
@@ -62,6 +62,14 @@ class EventTypeController extends Controller
|
||||
{
|
||||
$eventType->use_schedule = 0;
|
||||
}
|
||||
if(\request("hidden"))
|
||||
{
|
||||
$eventType->hidden = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$eventType->hidden = 0;
|
||||
}
|
||||
if ($request->is_mandatory == 'on')
|
||||
{
|
||||
$eventType->is_mandatory = 1;
|
||||
@@ -174,6 +182,14 @@ class EventTypeController extends Controller
|
||||
{
|
||||
$eventType->use_schedule = 0;
|
||||
}
|
||||
if(\request("hidden"))
|
||||
{
|
||||
$eventType->hidden = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$eventType->hidden = 0;
|
||||
}
|
||||
if ($request->is_mandatory == 'on')
|
||||
{
|
||||
$eventType->is_mandatory = 1;
|
||||
|
||||
@@ -46,11 +46,28 @@ class ScheduleController extends Controller
|
||||
}
|
||||
|
||||
foreach ($allevents as $event) {
|
||||
if(strtotime($event->date_begin) >= $start && strtotime($event->date_begin) <= $end) {
|
||||
array_push($events,$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) {
|
||||
array_push($events,$event);
|
||||
}
|
||||
else if(strtotime($event->date_end) >= $start && strtotime($event->date_end) <= $end) {
|
||||
array_push($events,$event);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(strtotime($event->date_end) >= $start && strtotime($event->date_end) <= $end) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,8 +107,16 @@ class ScheduleController extends Controller
|
||||
$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 = [
|
||||
'title' => $event->name,
|
||||
'title' => $name,
|
||||
'start' => date('c',strtotime($event->date_begin)),
|
||||
'end' => date('c',strtotime($event->date_end)),
|
||||
'color' => $color,
|
||||
@@ -106,6 +131,45 @@ class ScheduleController extends Controller
|
||||
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)
|
||||
{
|
||||
if($db_type == "event")
|
||||
@@ -216,6 +280,13 @@ class ScheduleController extends Controller
|
||||
public function delete($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)
|
||||
{
|
||||
$course->delete();
|
||||
|
||||
@@ -16,7 +16,7 @@ use Illuminate\Support\Arr;
|
||||
class Permission extends Model
|
||||
{
|
||||
const PERMISSIONS = [
|
||||
'news' => [
|
||||
'Nouvelle' => [
|
||||
'news_see' => [
|
||||
'ckey' => 'news_see',
|
||||
'communName' => 'Voir les nouvelles',
|
||||
@@ -46,7 +46,7 @@ class Permission extends Model
|
||||
'valeur' => 0
|
||||
]
|
||||
],
|
||||
'inventory' => [
|
||||
'Inventaire' => [
|
||||
'inventory_see' => [
|
||||
'ckey' => 'inventory_see',
|
||||
'communName' => 'Voir l\'inventaire',
|
||||
@@ -76,7 +76,7 @@ class Permission extends Model
|
||||
'valeur' => 0
|
||||
],
|
||||
],
|
||||
'user' => [
|
||||
'Utilisateur' => [
|
||||
'user_see' => [
|
||||
'ckey' => 'user_see',
|
||||
'communName' => 'Voir la liste des utilisateurs',
|
||||
@@ -106,7 +106,7 @@ class Permission extends Model
|
||||
'valeur' => 0
|
||||
],
|
||||
],
|
||||
'config' => [
|
||||
'Configuration' => [
|
||||
'config_see' => [
|
||||
'ckey' => 'config_see',
|
||||
'communName' => 'Voir les configurations',
|
||||
@@ -116,13 +116,48 @@ class Permission extends Model
|
||||
],
|
||||
'config_edit' => [
|
||||
'ckey' => 'config_edit',
|
||||
'communName' => 'Modifier les configurations',
|
||||
'desc' => 'L\'utilisateur peut-il modifier les configurations',
|
||||
'communName' => 'Modifier les configurations générales',
|
||||
'desc' => 'L\'utilisateur peut-il modifier les configurations générales',
|
||||
'icon' => 'fa-eye',
|
||||
'valeur' => 0
|
||||
],
|
||||
'config_edit_instruction' => [
|
||||
'ckey' => 'config_edit_instruction',
|
||||
'communName' => 'Modifier les configurations de l\'instruction',
|
||||
'desc' => 'L\'utilisateur peut-il modifier les configurations de l\'instruction',
|
||||
'icon' => 'fa-eye',
|
||||
'valeur' => 0
|
||||
],
|
||||
'config_edit_administration' => [
|
||||
'ckey' => 'config_edit_administration',
|
||||
'communName' => 'Modifier les configurations de l\'administration',
|
||||
'desc' => 'L\'utilisateur peut-il modifier les configurations de l\'administration',
|
||||
'icon' => 'fa-eye',
|
||||
'valeur' => 0
|
||||
],
|
||||
'config_edit_rank' => [
|
||||
'ckey' => 'config_edit_rank',
|
||||
'communName' => 'Modifier les configurations des grades',
|
||||
'desc' => 'L\'utilisateur peut-il modifier les configurations des grades',
|
||||
'icon' => 'fa-eye',
|
||||
'valeur' => 0
|
||||
],
|
||||
'config_edit_job' => [
|
||||
'ckey' => 'config_edit_job',
|
||||
'communName' => 'Modifier les configurations des postes',
|
||||
'desc' => 'L\'utilisateur peut-il modifier les configurations des postes',
|
||||
'icon' => 'fa-eye',
|
||||
'valeur' => 0
|
||||
],
|
||||
'config_edit_customization' => [
|
||||
'ckey' => 'config_edit_customization',
|
||||
'communName' => 'Modifier les configurations de l\'apparence du site',
|
||||
'desc' => 'L\'utilisateur peut-il modifier les configurations de l\'apparence du site',
|
||||
'icon' => 'fa-eye',
|
||||
'valeur' => 0
|
||||
]
|
||||
],
|
||||
'statistique' => [
|
||||
'Statistique' => [
|
||||
'stats_see' => [
|
||||
'ckey' => 'stats_see',
|
||||
'communName' => 'Voir les statistiques',
|
||||
@@ -195,6 +230,20 @@ class Permission extends Model
|
||||
'icon' => 'fa-eye',
|
||||
'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' => [
|
||||
'cadet_list_see' => [
|
||||
@@ -235,7 +284,7 @@ class Permission extends Model
|
||||
'valeur' => 0
|
||||
]
|
||||
],
|
||||
'article' => [
|
||||
'Articles' => [
|
||||
'article_see' => [
|
||||
'ckey' => 'article_see',
|
||||
'communName' => 'Voir les articles',
|
||||
@@ -265,7 +314,7 @@ class Permission extends Model
|
||||
'valeur' => 0
|
||||
],
|
||||
],
|
||||
'picture' => [
|
||||
'Photos & Images' => [
|
||||
'picture_see' => [
|
||||
'ckey' => 'picture_see',
|
||||
'communName' => 'Voir les images',
|
||||
@@ -295,7 +344,7 @@ class Permission extends Model
|
||||
'valeur' => 0
|
||||
],
|
||||
],
|
||||
'file' => [
|
||||
'Fichiers' => [
|
||||
'file_see' => [
|
||||
'ckey' => 'file_see',
|
||||
'communName' => 'Voir les fichiers publiques',
|
||||
@@ -346,6 +395,11 @@ class Permission extends Model
|
||||
return self::PERMISSIONS;
|
||||
}
|
||||
|
||||
public static function allToJSON()
|
||||
{
|
||||
return self::all()->toJson();
|
||||
}
|
||||
|
||||
public static function allToString($value = null)
|
||||
{
|
||||
$perm = [];
|
||||
|
||||
@@ -5,7 +5,7 @@ current:
|
||||
major: 3
|
||||
minor: 2
|
||||
patch: 5
|
||||
prerelease: 41-g465bac0e
|
||||
prerelease: 54-g63301aec
|
||||
buildmetadata: ''
|
||||
commit: 41845
|
||||
timestamp:
|
||||
|
||||
@@ -31,6 +31,7 @@ class CreateEventsTable extends Migration
|
||||
$table->string('calendar_color');
|
||||
$table->string('calendar_icon');
|
||||
$table->string('weekly_msg_publication_time')->default('-5day');
|
||||
$table->boolean('hidden')->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ class CreateEventTypesTable extends Migration
|
||||
$table->boolean('use_schedule')->default(false);
|
||||
$table->text('schedule_model');
|
||||
$table->boolean('is_promoted')->default(false);
|
||||
$table->boolean('hidden')->default(false);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
36
public/js/calendar.js
vendored
36
public/js/calendar.js
vendored
@@ -19,7 +19,7 @@ function initFullCalendar(authToken) {
|
||||
right: 'prev,next'
|
||||
},
|
||||
defaultDate: initDate,
|
||||
events: '/api/schedule/events',
|
||||
events: '/api/schedule/events/auth?api_token='+authToken,
|
||||
eventRender: function(event, element) {
|
||||
if (event.event.extendedProps.icon && event.view.type == 'dayGridMonth')
|
||||
{
|
||||
@@ -130,22 +130,32 @@ function deleteEvent(pid){
|
||||
if (result.value) {
|
||||
|
||||
(function($) {
|
||||
$.post('/api/schedule/event/delete/'+pid+'?api_token='+api_token, function(data) {
|
||||
console.log('Delete');
|
||||
$.post('/api/schedule/event/delete/'+pid+'?api_token='+api_token, function(data, status, xhr) {
|
||||
swal(
|
||||
'Supprimé!',
|
||||
"L'évenement a été supprimé",
|
||||
'success'
|
||||
).then((result) => {
|
||||
if (result.value) {
|
||||
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);
|
||||
|
||||
swal(
|
||||
'Supprimé!',
|
||||
"L'évenement a été supprimé",
|
||||
'success'
|
||||
).then((result) => {
|
||||
if (result.value) {
|
||||
location.reload();
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
18
public/js/plugins/schedule/editorv2.js
vendored
18
public/js/plugins/schedule/editorv2.js
vendored
@@ -488,6 +488,15 @@ function loadEventType(date,id = 1)
|
||||
switchUseSchedule();
|
||||
}
|
||||
|
||||
if (eventType['hidden'] == 1)
|
||||
{
|
||||
$('#hidden').prop('checked',true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#hidden').removeAttr('checked');
|
||||
}
|
||||
|
||||
if (eventType['use_weekly_msg'] == 1)
|
||||
{
|
||||
$('#use_weekly_msg').prop('checked',true);
|
||||
@@ -604,6 +613,15 @@ function loadEvent(date,id)
|
||||
switchUseSchedule();
|
||||
}
|
||||
|
||||
if (eventType['hidden'] == 1)
|
||||
{
|
||||
$('#hidden').prop('checked',true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#hidden').removeAttr('checked');
|
||||
}
|
||||
|
||||
if (eventType['use_weekly_msg'] == 1)
|
||||
{
|
||||
$('#use_weekly_msg').prop('checked',true);
|
||||
|
||||
@@ -31,41 +31,34 @@
|
||||
<p>
|
||||
Choisissez quels permissions doivent être associé avec ce grade.
|
||||
</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)
|
||||
<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)
|
||||
<div class="col-3 text-center">
|
||||
<input class="d-none" type="text" id="{{$r['ckey']}}" name="{{$r['ckey']}}">
|
||||
<h5>{{$r['communName']}}</h5>
|
||||
<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>
|
||||
<p>
|
||||
<small>{{$r['desc']}}</small>
|
||||
</p>
|
||||
</div>
|
||||
@endforeach
|
||||
@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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endforeach
|
||||
</div>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-md-12 mt-5">
|
||||
<button type="submit" class="btn btn-primary">Sauvegarder</button>
|
||||
@@ -83,5 +76,17 @@
|
||||
$('#desc').trumbowyg({
|
||||
lang: 'fr'
|
||||
});
|
||||
$(document).ready(function() {
|
||||
$('#permission-table').DataTable({
|
||||
rowGroup: {
|
||||
dataSrc: 0
|
||||
},
|
||||
pageLength: 100,
|
||||
lengthChange: false,
|
||||
columnDefs: [
|
||||
{ "visible": false, "targets": [0] }
|
||||
]
|
||||
});
|
||||
} );
|
||||
</script>
|
||||
@endsection
|
||||
@@ -31,7 +31,41 @@
|
||||
<p>
|
||||
Choisissez quels permissions doivent être associé avec ce grade.
|
||||
</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)
|
||||
<div class="mb-4">
|
||||
<h3 class="text-capitalize">{{$key}}</h3>
|
||||
@@ -56,12 +90,11 @@
|
||||
<i class="fa fa-plus"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>--}}
|
||||
</div>
|
||||
<div class="col-md-12 mt-5">
|
||||
<button type="submit" class="btn btn-primary">Sauvegarder</button>
|
||||
@@ -79,5 +112,17 @@
|
||||
$('#desc').trumbowyg({
|
||||
lang: 'fr'
|
||||
});
|
||||
$(document).ready(function() {
|
||||
$('#permission-table').DataTable({
|
||||
rowGroup: {
|
||||
dataSrc: 0
|
||||
},
|
||||
pageLength: 100,
|
||||
lengthChange: false,
|
||||
columnDefs: [
|
||||
{ "visible": false, "targets": [0] }
|
||||
]
|
||||
});
|
||||
} );
|
||||
</script>
|
||||
@endsection
|
||||
@@ -69,7 +69,7 @@
|
||||
@else
|
||||
@foreach ($futureEvent as $event)
|
||||
<div class="col-md-12">
|
||||
<div class="alert" style="background-color: @if($event->calendar_color == null){{ \App\ComplementaryActivity::find($event->type)->calendar_color}} @else {{$event->calendar_color}} @endif">
|
||||
<div class="alert cursor" style="background-color: @if($event->calendar_color == null){{ \App\ComplementaryActivity::find($event->type)->calendar_color}} @else {{$event->calendar_color}} @endif" onclick="navigate('schedule?e={{$event->id}}')">
|
||||
<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;">@if($event->calendar_icon == null) {!! \App\ComplementaryActivity::find($event->type)->calendar_icon !!} @else <i class="{{$event->calendar_icon}}"></i> @endif</h3>
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
<form method="post">
|
||||
@csrf
|
||||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label class="label-control">Nom</label>
|
||||
<input type="text" class="form-control" name="name" required/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label class="label-control">Emplacement</label>
|
||||
<input type="text" class="form-control" name="location" required/>
|
||||
@@ -32,6 +32,15 @@
|
||||
</label>
|
||||
</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="form-group">
|
||||
<label class="label-control">Heure de début</label>
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
@method('PATCH')
|
||||
@csrf
|
||||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label class="label-control">Nom</label>
|
||||
<input type="text" class="form-control" value="{{$event_type->name}}" name="name" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label class="label-control">Emplacement</label>
|
||||
<input type="text" class="form-control" value="{{$event_type->location}}" name="location" />
|
||||
@@ -33,6 +33,15 @@
|
||||
</label>
|
||||
</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="form-group">
|
||||
<label class="label-control">Heure de début</label>
|
||||
|
||||
@@ -31,7 +31,35 @@
|
||||
<p>
|
||||
Choisissez quels permissions doivent être associé avec ce poste.
|
||||
</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)
|
||||
<div class="card card-collapse">
|
||||
<div class="card-header" role="tab" id="headingOne">
|
||||
@@ -65,7 +93,7 @@
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>--}}
|
||||
</div>
|
||||
<div class="col-md-12 mt-5">
|
||||
<button type="submit" class="btn btn-primary">Sauvegarder</button>
|
||||
@@ -83,5 +111,17 @@
|
||||
$('#desc').trumbowyg({
|
||||
lang: 'fr'
|
||||
});
|
||||
$(document).ready(function() {
|
||||
$('#permission-table').DataTable({
|
||||
rowGroup: {
|
||||
dataSrc: 0
|
||||
},
|
||||
pageLength: 100,
|
||||
lengthChange: false,
|
||||
columnDefs: [
|
||||
{ "visible": false, "targets": [0] }
|
||||
]
|
||||
});
|
||||
} );
|
||||
</script>
|
||||
@endsection
|
||||
@@ -31,7 +31,35 @@
|
||||
<p>
|
||||
Choisissez quels permissions doivent être associé avec ce poste.
|
||||
</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)
|
||||
<div class="card card-collapse">
|
||||
<div class="card-header" role="tab" id="headingOne">
|
||||
@@ -65,7 +93,7 @@
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>--}}
|
||||
</div>
|
||||
<div class="col-md-12 mt-5">
|
||||
<button type="submit" class="btn btn-primary">Sauvegarder</button>
|
||||
@@ -83,5 +111,17 @@
|
||||
$('#desc').trumbowyg({
|
||||
lang: 'fr'
|
||||
});
|
||||
$(document).ready(function() {
|
||||
$('#permission-table').DataTable({
|
||||
rowGroup: {
|
||||
dataSrc: 0
|
||||
},
|
||||
pageLength: 100,
|
||||
lengthChange: false,
|
||||
columnDefs: [
|
||||
{ "visible": false, "targets": [0] }
|
||||
]
|
||||
});
|
||||
} );
|
||||
</script>
|
||||
@endsection
|
||||
@@ -157,6 +157,17 @@
|
||||
</label>
|
||||
</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 class="card card-collapse">
|
||||
<div class="card-header" role="tab" id="heading-apparence">
|
||||
|
||||
@@ -170,6 +170,17 @@
|
||||
</label>
|
||||
</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 class="card card-collapse">
|
||||
<div class="card-header" role="tab" id="heading-apparence">
|
||||
|
||||
@@ -65,59 +65,68 @@
|
||||
<td>
|
||||
<div class="row" style="width: 29rem">
|
||||
<div class="col-2 text-center m-auto">
|
||||
1
|
||||
{{ $loop->iteration }}
|
||||
</div>
|
||||
<div class="col-4 m-auto">
|
||||
{{$event->name}}
|
||||
</div>
|
||||
<div class="col-3 m-auto">
|
||||
{{$event->date_begin}}
|
||||
{{$event->date_begin}} à {{ $event->date_end }}
|
||||
</div>
|
||||
<div class="col-3 m-auto pr-0">
|
||||
@foreach($event->schedule["periodes"] as $periode)
|
||||
<table class="table-borderless">
|
||||
<tr>
|
||||
<td style="height: 6rem;vertical-align: middle">
|
||||
P{{$loop->iteration}} - {{ $periode['begin_time'] }} à {{ $periode['end_time'] }}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@endforeach
|
||||
@if($event->use_schedule == 1)
|
||||
@foreach($event->schedule["periodes"] as $periode)
|
||||
<table class="table-borderless">
|
||||
<tr>
|
||||
<td style="height: 6rem;vertical-align: middle">
|
||||
P{{$loop->iteration}} - {{ $periode['begin_time'] }} à {{ $periode['end_time'] }}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@endforeach
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@for($n = 1;$n <= $event->nbNiveau();$n++)
|
||||
<td style="padding: 0px;">
|
||||
@for($p = 1;$p <= $event->nbPeriode();$p++)
|
||||
<table class="table-borderless">
|
||||
<tr @if($p != $event->nbPeriode())class="border-bottom"@endif>
|
||||
<td style="height: 6rem;">
|
||||
<div class="row" style="width: 35rem">
|
||||
@php($course = $event->course($p,$n))
|
||||
<div class="col-5 m-auto">
|
||||
@if(!$course->use_course())
|
||||
<b>{{ $course->ocom }}</b> - {{ $course->name }}
|
||||
@else
|
||||
{{ $course->desc }}
|
||||
@endif
|
||||
@if($event->use_schedule == 1)
|
||||
@for($n = 1;$n <= $event->nbNiveau();$n++)
|
||||
<td style="padding: 0px;">
|
||||
@for($p = 1;$p <= $event->nbPeriode();$p++)
|
||||
<table class="table-borderless">
|
||||
<tr @if($p != $event->nbPeriode())class="border-bottom"@endif>
|
||||
<td style="height: 6rem;">
|
||||
<div class="row" style="width: 35rem">
|
||||
@php($course = $event->course($p,$n))
|
||||
<div class="col-5 m-auto">
|
||||
@if(!$course->use_course())
|
||||
<b>{{ $course->ocom }}</b> - {{ $course->name }}
|
||||
@else
|
||||
{{ $course->desc }}
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-3">
|
||||
{{ $course->instructor() }}
|
||||
</div>
|
||||
<div class="col-2">
|
||||
{{ $course->location }}
|
||||
</div>
|
||||
<div class="col-2">
|
||||
NA
|
||||
</div>
|
||||
@php($course = null)
|
||||
</div>
|
||||
<div class="col-3">
|
||||
{{ $course->instructor() }}
|
||||
</div>
|
||||
<div class="col-2">
|
||||
{{ $course->location }}
|
||||
</div>
|
||||
<div class="col-2">
|
||||
NA
|
||||
</div>
|
||||
@php($course = null)
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@endfor
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@endfor
|
||||
</td>
|
||||
@endfor
|
||||
@else
|
||||
<td colspan="{{\App\Event::getMaxLevels($events)}}">
|
||||
{!! $event->desc !!}
|
||||
</td>
|
||||
@endfor
|
||||
@endif
|
||||
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
|
||||
@@ -95,7 +95,7 @@ $sidebar = [
|
||||
'Configuration' => [
|
||||
'route' => null,
|
||||
'icon' => 'menu_book',
|
||||
'perm' => 'config_edit',
|
||||
'perm' => 'config_see',
|
||||
'child' => [
|
||||
'Général' => [
|
||||
'route' => 'admin.config.general',
|
||||
@@ -136,7 +136,7 @@ $sidebar = [
|
||||
'Apparence' => [
|
||||
'route' => 'admin.config.customisation',
|
||||
'icon' => 'fas fa-palette',
|
||||
'perm' => 'config_edit_instruction',
|
||||
'perm' => 'config_edit_customization',
|
||||
'child' => null
|
||||
]
|
||||
]
|
||||
|
||||
@@ -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">
|
||||
<h5 class="modal-title" id="exampleModalLabel">{{$event->name}}</h5>
|
||||
<button type="button" class="close" onclick="closeScheduleModal()" aria-label="Close">
|
||||
|
||||
@@ -17,6 +17,7 @@ Route::get('/schedule/events/modal/{id}/{db_type}','ScheduleController@loadModal
|
||||
|
||||
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/add/modal/{type}/{date}','ScheduleController@loadModalDefautType')->middleware('perm:schedule_add');
|
||||
Route::get('/schedule/editor/init/{id}','ScheduleEditorController@getTemplate')->middleware('perm:schedule_edit');
|
||||
|
||||
@@ -57,7 +57,7 @@ Route::middleware(['auth', 'firstlogin'])->name('admin.')->group(function () {
|
||||
|
||||
/** Statistique */
|
||||
Route::get('/admin/stats/log', 'LogController@index')->middleware('perm:stats_see')->name('stats.log');
|
||||
Route::get('/admin/stats/instruction', 'StatsController@instruction')->middleware('perm:stats_see')->name('stats.instruction');
|
||||
Route::get('/admin/stats/instruction', 'StatsController@instruction')->middleware('perm:stats_instruction_see')->name('stats.instruction');
|
||||
|
||||
/** Message */
|
||||
Route::get('/admin/message', 'MessageController@index')->middleware('perm:msg_see')->name('message');
|
||||
@@ -75,39 +75,39 @@ Route::middleware(['auth', 'firstlogin'])->name('admin.')->group(function () {
|
||||
Route::post('/admin/user/edit/{id}', 'UserController@update')->middleware('perm:user_edit');
|
||||
|
||||
/** Config */
|
||||
Route::get('/admin/config/instruction', 'ScheduleController@index')->middleware('perm:config_edit')->name('config.schedule');
|
||||
Route::get('/admin/config/instruction/event_type/create', 'EventTypeController@create')->middleware('perm:config_edit')->name('config.schedule.event_type.create');
|
||||
Route::post('/admin/config/instruction/event_type/create', 'EventTypeController@store')->middleware('perm:config_edit');
|
||||
Route::get('/admin/config/instruction/event_type/{id}', 'EventTypeController@show')->middleware('perm:config_edit')->name('config.schedule.event_type');
|
||||
Route::patch('/admin/config/instruction/event_type/{id}', 'EventTypeController@update')->middleware('perm:config_edit');
|
||||
Route::patch('/admin/config/instruction', 'ScheduleController@update')->middleware('perm:config_edit');
|
||||
Route::get('/admin/config/activity', 'ComplementaryActivityController@index')->middleware('perm:config_edit')->name('config.complementary-activity');
|
||||
Route::get('/admin/config/activity/add', 'ComplementaryActivityController@create')->middleware('perm:config_edit')->name('config.complementary-activity.add');
|
||||
Route::post('/admin/config/activity/add', 'ComplementaryActivityController@store')->middleware('perm:config_edit');
|
||||
Route::get('/admin/config/activity/edit/{id}', 'ComplementaryActivityController@edit')->middleware('perm:config_edit')->name('config.complementary-activity.edit');
|
||||
Route::post('/admin/config/activity/edit/{id}', 'ComplementaryActivityController@update')->middleware('perm:config_edit');
|
||||
Route::get('/admin/config/instruction', 'ScheduleController@index')->middleware('perm:config_edit_instruction')->name('config.schedule');
|
||||
Route::get('/admin/config/instruction/event_type/create', 'EventTypeController@create')->middleware('perm:config_edit_instruction')->name('config.schedule.event_type.create');
|
||||
Route::post('/admin/config/instruction/event_type/create', 'EventTypeController@store')->middleware('perm:config_edit_instruction');
|
||||
Route::get('/admin/config/instruction/event_type/{id}', 'EventTypeController@show')->middleware('perm:config_edit_instruction')->name('config.schedule.event_type');
|
||||
Route::patch('/admin/config/instruction/event_type/{id}', 'EventTypeController@update')->middleware('perm:config_edit_instruction');
|
||||
Route::patch('/admin/config/instruction', 'ScheduleController@update')->middleware('perm:config_edit_instruction');
|
||||
Route::get('/admin/config/activity', 'ComplementaryActivityController@index')->middleware('perm:config_edit_administration')->name('config.complementary-activity');
|
||||
Route::get('/admin/config/activity/add', 'ComplementaryActivityController@create')->middleware('perm:config_edit_administration')->name('config.complementary-activity.add');
|
||||
Route::post('/admin/config/activity/add', 'ComplementaryActivityController@store')->middleware('perm:config_edit_administration');
|
||||
Route::get('/admin/config/activity/edit/{id}', 'ComplementaryActivityController@edit')->middleware('perm:config_edit_administration')->name('config.complementary-activity.edit');
|
||||
Route::post('/admin/config/activity/edit/{id}', 'ComplementaryActivityController@update')->middleware('perm:config_edit_administration');
|
||||
Route::post('/admin/config/general/edit', 'ConfigController@update')->middleware('perm:config_edit');
|
||||
Route::get('/admin/config/', 'ConfigController@index')->middleware('perm:config_edit')->name('config.general');
|
||||
Route::get('/admin/config/customisation', 'ConfigController@customisation')->middleware('perm:config_edit')->name('config.customisation');
|
||||
Route::post('/admin/config/customisation', 'ConfigController@customisationUpdate')->middleware('perm:config_edit');
|
||||
Route::get('/admin/config/customisation', 'ConfigController@customisation')->middleware('perm:config_edit_customization')->name('config.customisation');
|
||||
Route::post('/admin/config/customisation', 'ConfigController@customisationUpdate')->middleware('perm:config_edit_customization');
|
||||
|
||||
Route::get('/admin/config/ranks', 'RankController@index')->middleware('perm:config_edit')->name('config.rank');
|
||||
Route::get('/admin/config/ranks/add', 'RankController@create')->middleware('perm:config_edit')->name('config.rank.add');
|
||||
Route::post('/admin/config/ranks/add', 'RankController@store')->middleware('perm:config_edit');
|
||||
Route::get('/admin/config/ranks/{id}', 'RankController@show')->middleware('perm:config_edit')->name('config.rank.edit');
|
||||
Route::post('/admin/config/ranks/{id}', 'RankController@update')->middleware('perm:config_edit');
|
||||
Route::get('/admin/config/jobs', 'JobController@index')->middleware('perm:config_edit')->name('config.jobs');
|
||||
Route::get('/admin/config/jobs/add', 'JobController@create')->middleware('perm:config_edit')->name('config.jobs.add');
|
||||
Route::post('/admin/config/jobs/add', 'JobController@store')->middleware('perm:config_edit');
|
||||
Route::get('/admin/config/jobs/{id}', 'JobController@edit')->middleware('perm:config_edit')->name('config.jobs.edit');
|
||||
Route::post('/admin/config/jobs/{id}', 'JobController@update')->middleware('perm:config_edit');
|
||||
Route::get('/admin/config/ranks', 'RankController@index')->middleware('perm:config_edit_rank')->name('config.rank');
|
||||
Route::get('/admin/config/ranks/add', 'RankController@create')->middleware('perm:config_edit_rank')->name('config.rank.add');
|
||||
Route::post('/admin/config/ranks/add', 'RankController@store')->middleware('perm:config_edit_rank');
|
||||
Route::get('/admin/config/ranks/{id}', 'RankController@show')->middleware('perm:config_edit_rank')->name('config.rank.edit');
|
||||
Route::post('/admin/config/ranks/{id}', 'RankController@update')->middleware('perm:config_edit_rank');
|
||||
Route::get('/admin/config/jobs', 'JobController@index')->middleware('perm:config_edit_job')->name('config.jobs');
|
||||
Route::get('/admin/config/jobs/add', 'JobController@create')->middleware('perm:config_edit_job')->name('config.jobs.add');
|
||||
Route::post('/admin/config/jobs/add', 'JobController@store')->middleware('perm:config_edit_job');
|
||||
Route::get('/admin/config/jobs/{id}', 'JobController@edit')->middleware('perm:config_edit_job')->name('config.jobs.edit');
|
||||
Route::post('/admin/config/jobs/{id}', 'JobController@update')->middleware('perm:config_edit_job');
|
||||
|
||||
Route::get('/admin/config/files', 'ConfigController@showfilesConfig')->middleware('perm:config_edit')->name('config.files');
|
||||
Route::post('/admin/config/files', 'ConfigController@editfilesConfig')->middleware('perm:config_edit');
|
||||
|
||||
/** Public page */
|
||||
Route::get('/admin/public/edit/{config}', 'PublicController@edit')->middleware('perm:config_edit');
|
||||
Route::post('/admin/public/edit/{config}', 'PublicController@update')->middleware('perm:config_edit');
|
||||
Route::get('/admin/public/edit/{config}', 'PublicController@edit')->middleware('perm:config_edit_customization');
|
||||
Route::post('/admin/public/edit/{config}', 'PublicController@update')->middleware('perm:config_edit_customization');
|
||||
|
||||
/** Picture */
|
||||
Route::get('/admin/picture', 'PictureController@indexAdmin')->middleware('perm:picture_see')->name('picture');
|
||||
|
||||
Reference in New Issue
Block a user