Compare commits
122 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7c95145459 | |||
| 52f2d242da | |||
| 615752d61a | |||
| 54adf4ea22 | |||
| a630de66e2 | |||
| 2b9cd625d6 | |||
| d2a884b0bb | |||
| 1cb85d50ca | |||
| 82b5ef34bf | |||
| e595c1d7de | |||
| db63c4ea4d | |||
| 9a32aa1730 | |||
| bfdfcb87cf | |||
| 1b4eecb54d | |||
| 44efcd8e32 | |||
| abf3da8030 | |||
| 1d3f07b7b7 | |||
| 7869a96c81 | |||
| 3b2937d189 | |||
| cf5f7effbf | |||
| e453c0edcc | |||
| 3546298a08 | |||
| d277180e45 | |||
| a63eafb833 | |||
| d4b3b1b47d | |||
| c4d382dbf0 | |||
| b850b38b85 | |||
| 7d1a208534 | |||
| f1ee7cfeaf | |||
| ea03d22558 | |||
| 45566d373f | |||
| e9fd3407a7 | |||
| 1419032b64 | |||
| 9f85296cea | |||
| cb3fdc44e2 | |||
| d57c648d7f | |||
| c6110b47e8 | |||
| fd73dc388d | |||
| 818a84c3df | |||
| 7364c3494c | |||
| 76c60d512f | |||
| 54d57c7b13 | |||
| e679cacb7d | |||
| b28b7cdab5 | |||
| eee82e3b81 | |||
| 97a7be702e | |||
| 47128ea6fc | |||
| fdc2772ee2 | |||
| c4f96fbfc4 | |||
| 75a4a0a080 | |||
| f262392672 | |||
| 1679252930 | |||
| 9dc4d1103f | |||
| 07e409a922 | |||
| 0fddd138bf | |||
| 8bb9655c9f | |||
| f98cd85872 | |||
| f6944d7b70 | |||
| fc9d14e735 | |||
| fcf96df5e8 | |||
| 1ee9848312 | |||
| 333679c510 | |||
| f65a38ca26 | |||
| 84e17938a7 | |||
| 0690d36eb2 | |||
| e0f3a26bc2 | |||
| 96ec0fdb03 | |||
| 01f8cf75b8 | |||
| 72d51850c2 | |||
| e76a6e9f40 | |||
| c58cf9ee8d | |||
| 2b6bd17b8d | |||
| 87264660bc | |||
| 932de1b154 | |||
| 6353208b20 | |||
| d3dbd21da5 | |||
| c5f9890ace | |||
| e554f011b4 | |||
| 7b2d16642c | |||
| 64f5d54d3d | |||
| 016e65b495 | |||
| 23e4abc5c4 | |||
| ac829d58b9 | |||
| c162184035 | |||
| 1a321d1021 | |||
| 0d8117c96d | |||
| 535048b687 | |||
| fc6255363e | |||
| 7732bbe85e | |||
| 027e6e6b28 | |||
| ffe8032cc8 | |||
| 2ffa5d1ba3 | |||
| 839340acc2 | |||
| b44a8b94fb | |||
| 70bb173eb0 | |||
| 712246e6cb | |||
| c036745988 | |||
| d5151920d8 | |||
| bcc293a5d4 | |||
| 5922024c70 | |||
| f600c5cbb4 | |||
| 871877ca37 | |||
| 5597ded1ea | |||
| 34a4ebb2a8 | |||
| 1d13c8c8a9 | |||
| e3aa153cf8 | |||
| afa7e47ef3 | |||
| 033a2d65d8 | |||
| 863a701e08 | |||
| d5c6a534b5 | |||
| 0ddf99318d | |||
| 3b593297cd | |||
| d41147346c | |||
| 0ce0480942 | |||
| 252ff658e0 | |||
| 269811533e | |||
| 99ae047998 | |||
| 390e6c82e7 | |||
| dda5094386 | |||
| d1c3d60791 | |||
| 7be3c65812 | |||
| 97fdd671a2 |
@@ -1,20 +1,20 @@
|
||||
APP_NAME=C-CMS
|
||||
APP_ENV=local
|
||||
APP_KEY=base64:FQH+yWnhFyB+2gpByIg2Rybmqn5EXkL7VeFawzSJ/Lc=
|
||||
APP_DEBUG=true
|
||||
APP_URL=https://dev.c-cms.cf/
|
||||
APP_KEY=
|
||||
APP_DEBUG=false
|
||||
APP_URL=https://dev.c-cms.cf/ # Adresse de votre site web
|
||||
|
||||
SQN_NUMBER=000
|
||||
SQN_FULLNAME="Escadron 000 Exemple"
|
||||
SQN_NUMBER=000 # Numéro de votre escadron
|
||||
SQN_FULLNAME="Escadron 000 Exemple" # Nom complet de votre escadron
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=ddb_dev
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=nHpz39lp
|
||||
DB_DATABASE=ddb # Nom de la base de donnée
|
||||
DB_USERNAME=user # Nom d'utilisateur pour ce connecter a la base de donnée
|
||||
DB_PASSWORD=password # Mot de passe de la base de donnée
|
||||
|
||||
BROADCAST_DRIVER=log
|
||||
CACHE_DRIVER=file
|
||||
@@ -33,8 +33,8 @@ MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_ENCRYPTION=null
|
||||
|
||||
NEXMO_KEY=f52074e0
|
||||
NEXMO_SECRET=lXK9GasDUdotWqL3
|
||||
NEXMO_KEY=4587feffd # Votre Clé Nexmo API
|
||||
NEXMO_SECRET=54dasf4e8fa4s4fd4f5s # Votre Mot de passe Nexmo API
|
||||
|
||||
PUSHER_APP_ID=
|
||||
PUSHER_APP_KEY=
|
||||
@@ -43,3 +43,4 @@ PUSHER_APP_CLUSTER=mt1
|
||||
|
||||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
||||
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
/node_modules
|
||||
/public/hot
|
||||
/public/storage
|
||||
/storage/*.key
|
||||
/vendor
|
||||
/.idea
|
||||
/.vscode
|
||||
/.vagrant
|
||||
node_modules
|
||||
public/hot
|
||||
public/storage
|
||||
storage/*.key
|
||||
vendor
|
||||
.idea
|
||||
.vscode
|
||||
.vagrant
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
.env
|
||||
/public/assets/public
|
||||
/resources/views/public.blade.php
|
||||
.env.testing
|
||||
public/theme
|
||||
resources/views/public.blade.php
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
image: registry.gitlab.com/thegamecraft/c-cms:latest
|
||||
|
||||
services:
|
||||
- mysql:5.7
|
||||
|
||||
variables:
|
||||
MYSQL_DATABASE: homestead
|
||||
MYSQL_ROOT_PASSWORD: secret
|
||||
DB_HOST: mysql
|
||||
DB_USERNAME: root
|
||||
|
||||
stages:
|
||||
- build
|
||||
- deploy
|
||||
- deploy
|
||||
|
||||
build:
|
||||
stage: build
|
||||
script:
|
||||
- cp .env.example .env
|
||||
- composer install
|
||||
- php artisan key:generate
|
||||
|
||||
deploy_697:
|
||||
stage: deploy
|
||||
script:
|
||||
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
|
||||
- eval $(ssh-agent -s)
|
||||
- ssh-add <(echo "$SSH_PRIVATE_KEY")
|
||||
- mkdir -p ~/.ssh
|
||||
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
|
||||
|
||||
- ~/.composer/vendor/bin/envoy run deploy_697 --commit="$CI_COMMIT_SHA"
|
||||
environment:
|
||||
name: escadron697
|
||||
url: http://escadron697.ca
|
||||
only:
|
||||
- master
|
||||
|
||||
deploy_736:
|
||||
stage: deploy
|
||||
script:
|
||||
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
|
||||
- eval $(ssh-agent -s)
|
||||
- ssh-add <(echo "$SSH_PRIVATE_KEY")
|
||||
- mkdir -p ~/.ssh
|
||||
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
|
||||
|
||||
- ~/.composer/vendor/bin/envoy run deploy_736 --commit="$CI_COMMIT_SHA"
|
||||
environment:
|
||||
name: escadron736
|
||||
url: http://736.exvps.ca
|
||||
only:
|
||||
- master
|
||||
|
||||
deploy_dev:
|
||||
stage: deploy
|
||||
script:
|
||||
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
|
||||
- eval $(ssh-agent -s)
|
||||
- ssh-add <(echo "$SSH_PRIVATE_KEY")
|
||||
- mkdir -p ~/.ssh
|
||||
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
|
||||
|
||||
- ~/.composer/vendor/bin/envoy run deploy_dev --commit="$CI_COMMIT_SHA"
|
||||
environment:
|
||||
name: dev
|
||||
url: http://dev.exvps.ca
|
||||
only:
|
||||
- dev
|
||||
@@ -0,0 +1,106 @@
|
||||
/** Version 3.2.0 **/
|
||||
Nouveauté
|
||||
|
||||
Modernisation de l'affichage de l'horaire avec fullcalendar
|
||||
Modernisation de la structure de la base de donnée de l'horaire
|
||||
Modernisation de l'interface avec Material UI / Dashboard
|
||||
Ajout d'une bibliothèque d'image
|
||||
Ajout de nouvelle configuration
|
||||
Le nombre de période dans l'horaire est maintenant dynamique
|
||||
Le nombre de niveau dans l'horaire est maintenant dynamique
|
||||
Les activitées sont maintenant dynamique
|
||||
L'horaire est maintenant disponible sur le site publique
|
||||
Les photos du calendrier sont disponible au publique depuis la page d'accueil
|
||||
|
||||
Bug
|
||||
|
||||
Correction de 22 bugs
|
||||
|
||||
|
||||
/** ALPHA 3.0.5 **/
|
||||
Front-End
|
||||
|
||||
Ajout d'un quantité d'item dans l'inventaire.
|
||||
Modification de l'interface de la gestion d'inventaire pour accomoder l'ajout de quantité.
|
||||
Ajout d'un indicateur de status sur la page de connexion..
|
||||
Le rapport de bug est maintenant publique.
|
||||
Ajout du dashboard administrateur.
|
||||
Ajout d'option de configuration générale.'
|
||||
|
||||
Back End & API
|
||||
|
||||
Modification du model de réservation pour accomoder l'ajout de quantité.
|
||||
Ajout d'une quantité d'item a l'inventaire.
|
||||
Ajout d'un « Helper » pour connaitre le status des services.
|
||||
Ajout d'une section « Alerte » dans le modele de page Admin.
|
||||
|
||||
Correction de bug
|
||||
|
||||
Correction de - Bug avec les heures quand il s'agit d'une activité "Autre" - #22
|
||||
Correction de - Bug ECC" - #21
|
||||
Correction de multiple bug
|
||||
|
||||
/** ALPHA 3.0.4 **/
|
||||
Nouveauté
|
||||
|
||||
Création de l'espace cadet cadre.
|
||||
Ajout de nouveau type d'icones.
|
||||
|
||||
Back End & API
|
||||
|
||||
Ajout de CSS spécifique au calendrier
|
||||
Ajout d'un controller pour l'ECC
|
||||
|
||||
Correction de bug
|
||||
|
||||
Correction de multiple bug
|
||||
|
||||
|
||||
/** ALPHA 3.0.3 **/
|
||||
Nouveauté
|
||||
|
||||
Mise à jour de la section notification.
|
||||
Ajout d'une option pour bloquer les notifications de l'horaire lors de ça construction initiale.
|
||||
|
||||
Back End & API
|
||||
|
||||
Mise à jours du nom de l'adresse d'envois de Email
|
||||
Mise à jours de l'adresse d'envois de Email
|
||||
Ajout de la suppression de notification
|
||||
Ajout de notification Email et Alert lors de l'ajout d'evenement a l'horaire
|
||||
|
||||
Correction de bug
|
||||
|
||||
Correction de multiple bug
|
||||
|
||||
|
||||
|
||||
/** ALPHA 3.0.2 **/
|
||||
Nouveauté
|
||||
|
||||
Amélioration générale de l'horaire
|
||||
Ajout de la section message
|
||||
Ajout de la section statistique
|
||||
Ajout de la section utilisateur
|
||||
Ajout de la section configuration
|
||||
Ajout de modèle de poste
|
||||
Ajout de modèle de grade
|
||||
Ajout de notification par Email
|
||||
Ajout de notification par SMS
|
||||
Ajout de notification interne
|
||||
|
||||
Back End & API
|
||||
|
||||
Ajout d'une liste de locaux dynamique
|
||||
Ajout d'une liste de poste dynamique
|
||||
Ajout d'une liste de grade dynamique
|
||||
Ajout d'une authentification par token pour les requetes API
|
||||
Ajout d'un "Middleware" pour les staffs
|
||||
Ajout d'un "Middleware" pour les admins
|
||||
Ajout du plugin DataTable
|
||||
Modification de la table de données des permissions de "Boolean" a "String"
|
||||
Ajout de page d'erreur personnalisé
|
||||
|
||||
Correction de bug
|
||||
|
||||
Correction de multiple bug
|
||||
@@ -0,0 +1,23 @@
|
||||
# Set the base image for subsequent instructions
|
||||
FROM php:7.2
|
||||
|
||||
# Update packages
|
||||
RUN apt-get update
|
||||
|
||||
# Install PHP and composer dependencies
|
||||
RUN apt-get install -qq git curl libmcrypt-dev libjpeg-dev libpng-dev libfreetype6-dev libbz2-dev autoconf libc-dev pkg-config
|
||||
|
||||
# Clear out the local repository of retrieved package files
|
||||
RUN apt-get clean
|
||||
|
||||
# Install needed extensions
|
||||
# Here you can install any other extension that you need during the test and deployment process
|
||||
RUN docker-php-ext-install pdo_mysql zip
|
||||
|
||||
RUN pecl install mcrypt-1.0.1
|
||||
|
||||
# Install Composer
|
||||
RUN curl --silent --show-error https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
|
||||
# Install Laravel Envoy
|
||||
RUN composer global require "laravel/envoy"
|
||||
@@ -0,0 +1,141 @@
|
||||
@servers(['web' => 'deployer@vps188754.vps.ovh.ca'])
|
||||
|
||||
@setup
|
||||
$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_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;
|
||||
@endsetup
|
||||
|
||||
@story('deploy_697')
|
||||
clone_repository_697
|
||||
run_composer_697
|
||||
update_symlinks_697
|
||||
@endstory
|
||||
|
||||
@story('deploy_736')
|
||||
clone_repository_736
|
||||
run_composer_736
|
||||
update_symlinks_736
|
||||
@endstory
|
||||
|
||||
@story('deploy_dev')
|
||||
clone_repository_dev
|
||||
run_composer_dev
|
||||
update_symlinks_dev
|
||||
@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 }}
|
||||
@endtask
|
||||
|
||||
@task('run_composer_697')
|
||||
echo "Starting deployment ({{ $release }})"
|
||||
cd {{ $new_release_dir_697 }}
|
||||
composer install --prefer-dist --no-scripts -q -o
|
||||
@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 .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 'Setting permission'
|
||||
chmod -R 777 {{ $app_dir_697 }}/current/bootstrap/
|
||||
|
||||
echo 'Migrate DB'
|
||||
cd {{ $app_dir_697 }}/current/
|
||||
php artisan migrate
|
||||
php artisan db:seed --class=ConfigsTableSeeder
|
||||
|
||||
@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 }}
|
||||
@endtask
|
||||
|
||||
@task('run_composer_736')
|
||||
echo "Starting deployment ({{ $release }})"
|
||||
cd {{ $new_release_dir_736 }}
|
||||
composer install --prefer-dist --no-scripts -q -o
|
||||
@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 .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 'Setting permission'
|
||||
chmod -R 777 {{ $app_dir_736 }}/current/bootstrap/
|
||||
|
||||
echo 'Migrate DB'
|
||||
cd {{ $app_dir_736 }}/current/
|
||||
php artisan migrate
|
||||
php artisan db:seed --class=ConfigsTableSeeder
|
||||
|
||||
@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 }}
|
||||
@endtask
|
||||
|
||||
@task('run_composer_dev')
|
||||
echo "Starting deployment ({{ $release }})"
|
||||
cd {{ $new_release_dir_dev }}
|
||||
composer install --prefer-dist --no-scripts -q -o
|
||||
@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 .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 'Setting permission'
|
||||
chmod -R 777 {{ $app_dir_dev }}/current/bootstrap/
|
||||
|
||||
echo 'Migrate DB'
|
||||
cd {{ $app_dir_dev }}/current/
|
||||
php artisan migrate
|
||||
php artisan db:seed --class=ConfigsTableSeeder
|
||||
|
||||
@endtask
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 Mathieu Lagace
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Booking extends Model
|
||||
{
|
||||
public function bookable()
|
||||
{
|
||||
return $this->morphTo();
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\User');
|
||||
}
|
||||
|
||||
public function item()
|
||||
{
|
||||
return $this->belongsTo('App\Item');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ComplementaryActivity extends Model
|
||||
{
|
||||
public function pictures()
|
||||
{
|
||||
return $this->morphMany('App\Picture', 'pictureable');
|
||||
}
|
||||
}
|
||||
@@ -6,5 +6,17 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Config extends Model
|
||||
{
|
||||
//
|
||||
protected $casts = [
|
||||
'data' => 'array',
|
||||
];
|
||||
|
||||
public function data()
|
||||
{
|
||||
return $this->data[0];
|
||||
}
|
||||
|
||||
public static function getData($configName)
|
||||
{
|
||||
return Config::where('name',$configName)->first()->data();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Course extends Model
|
||||
{
|
||||
public function bookings()
|
||||
{
|
||||
return $this->morphMany('App\Booking', 'bookable');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\User');
|
||||
}
|
||||
|
||||
public function event()
|
||||
{
|
||||
return $this->belongsTo('App\Event');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Event extends Model
|
||||
{
|
||||
public function bookings()
|
||||
{
|
||||
return $this->morphMany('App\Booking', 'bookable');
|
||||
}
|
||||
|
||||
public function courses()
|
||||
{
|
||||
return $this->hasMany('App\Course');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\User');
|
||||
}
|
||||
|
||||
public function course($p,$l)
|
||||
{
|
||||
$courses = $this->courses;
|
||||
|
||||
foreach ($courses as $c)
|
||||
{
|
||||
if ($c->periode == $p && $c->level == $l)
|
||||
{
|
||||
return $c;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,23 @@ class AdminController extends Controller
|
||||
{
|
||||
Log::saveLog('Affichage du tableau de bord');
|
||||
|
||||
return view('admin.dashboard');
|
||||
$futureEvent_to_filtered = \App\Event::all()->sortBy('date_begin');
|
||||
$futureEvent_to_filtered_pass_1 = collect();
|
||||
$futureEvent = collect();
|
||||
|
||||
foreach ($futureEvent_to_filtered as $day) {
|
||||
if (date('U',strtotime($day->date_begin)) >= date('U')) {
|
||||
$futureEvent_to_filtered_pass_1->push($day);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($futureEvent_to_filtered_pass_1 as $day) {
|
||||
if (date('U',strtotime($day->date_begin)) <= date('U',strtotime("+2 week"))) {
|
||||
$futureEvent->push($day);
|
||||
}
|
||||
}
|
||||
|
||||
return view('admin.dashboard',['futureEvent' => $futureEvent->take(3),'userClasse' => \Auth::User()->getClasse()->forPage(1,6)]);
|
||||
}
|
||||
|
||||
public function update()
|
||||
|
||||
@@ -20,12 +20,21 @@ class LoginController extends Controller
|
||||
|
||||
use AuthenticatesUsers;
|
||||
|
||||
protected function redirectTo()
|
||||
{
|
||||
if(\Auth::User()->getAcces(2))
|
||||
{
|
||||
return '/admin';
|
||||
} else if(\Auth::User()->getAcces(1)){
|
||||
return '/ecc';
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Where to redirect users after login.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = '/admin';
|
||||
/**protected $redirectTo = '/admin';*/
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Booking;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class BookingController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Booking $booking
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Booking $booking)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Booking $booking
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Booking $booking)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\Booking $booking
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, Booking $booking)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Booking $booking
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Booking $booking)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,8 @@ class CalendarController extends Controller
|
||||
{
|
||||
Log::saveLog("Affichage de l'horaire");
|
||||
|
||||
$this->listClass();
|
||||
|
||||
return view('admin.calendar.calendar_display');
|
||||
}
|
||||
|
||||
@@ -95,11 +97,10 @@ class CalendarController extends Controller
|
||||
if ($activityToday->isEmpty()) {
|
||||
echo '<a class="calendar-container calendar-empty" name="'.$today.'" type="button" data-toggle="modal" data-target="#scrollmodal" id="calendar_'.$calendar[(($i*7) + $a)].'" class="btn btn-block btn-calendar" onclick="openCalendar(this.name)"><div class="calendar-date">'.date("j", strtotime($today)).'</div></a>';
|
||||
} else {
|
||||
echo '<a class="calendar-container" name="'.$today.'" type="button" data-toggle="modal" data-target="#scrollmodal" id="calendar_'.$calendar[(($i*7) + $a)].'" class="btn btn-block btn-calendar" onclick="openCalendar(this.name)">';
|
||||
echo '<a class="calendar-container" name="'.$today.'" type="button" data-toggle="modal" data-target="#scrollmodal" id="calendar_'.$calendar[(($i*7) + $a)].'" class="btn btn-block btn-calendar" onclick="openCalendar(this.name)"><div class="calendar-date">'.date("j", strtotime($today)).'</div>';
|
||||
$text = "";
|
||||
foreach ($activityToday as $activity) {
|
||||
echo '<div class="calendar-date">'.date("j", strtotime($today)).'</div>
|
||||
<div class="calendar-text" style="width:90%;">';
|
||||
echo '<div class="calendar-text" style="width:90%;height:3rem;">';
|
||||
switch ($activity->type) {
|
||||
case 'regular':
|
||||
echo '<div class="row" style="color:orange;"><span class="fa-stack fa-lg col-md-2"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-book fa-stack-1x fa-inverse"></i></span><div class="col-md-10 calendar_event_name">'.ucfirst($activity->data['event_name'])."</div></div>";
|
||||
@@ -133,8 +134,12 @@ class CalendarController extends Controller
|
||||
echo '<div class="row" style="color:#DF0174;"><span class="fa-stack fa-lg col-md-2"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-handshake-o fa-stack-1x fa-inverse"></i></span><div class="col-md-10 calendar_event_name">'.ucfirst($activity->data['event_name'])."</div></div>";
|
||||
break;
|
||||
|
||||
case 'other':
|
||||
echo '<div class="row" style="color:#DF0174;"><span class="fa-stack fa-lg col-md-2"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-handshake-o fa-stack-1x fa-inverse"></i></span><div class="col-md-10 calendar_event_name">'.ucfirst($activity->data['event_name'])."</div></div>";
|
||||
break;
|
||||
|
||||
default:
|
||||
echo '<div class="row" style="color:#0B615E;"><span class="fa-stack fa-lg col-md-2"><i class="fa fa-circle fa-stack-2x"></i></span><div class="col-md-10 calendar_event_name">'.ucfirst($activity->data['event_name'])."</div></div>";
|
||||
echo '<div class="row" style="color:'.\App\ComplementaryActivity::find($activity->type)->calendar_color.';"><span class="fa-stack fa-lg col-md-2">'.\App\ComplementaryActivity::find($activity->type)->calendar_icon.'</span><div class="col-md-10 calendar_event_name">'.ucfirst($activity->data['event_name'])."</div></div>";
|
||||
break;
|
||||
}
|
||||
echo '</div>';
|
||||
@@ -191,9 +196,6 @@ class CalendarController extends Controller
|
||||
'<a type="button" class="btn btn-danger" onclick="deleteEvent('.$date->id.');"><i class="fa fa-times-circle" style="color:white;"></i></a>'.
|
||||
'</div>'.
|
||||
'</div>'.
|
||||
'<p>'.
|
||||
"L'activité auras lieux a l'escadron entre 18h30 et 21h30".
|
||||
'</p>'.
|
||||
'<p>'.$date->data['event_desc'].
|
||||
'</p>'
|
||||
);
|
||||
@@ -368,7 +370,11 @@ class CalendarController extends Controller
|
||||
$UserList = User::all();
|
||||
$LocalList = Local::all();
|
||||
|
||||
return view('admin.calendar.calendar_add' ,['RequestDate' => $date, 'Userslist' => $UserList, 'LocalsList' => $LocalList]);
|
||||
return view('admin.calendar.calendar_add' ,[
|
||||
'RequestDate' => $date,
|
||||
'Userslist' => $UserList,
|
||||
'LocalsList' => $LocalList,
|
||||
'ComplementaryActivity' => \App\ComplementaryActivity::all()]);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
@@ -445,8 +451,15 @@ class CalendarController extends Controller
|
||||
$schedule->save();
|
||||
|
||||
/** Logs and Notification */
|
||||
Log::saveLog("Ajout de l'activité, ".$schedule->event_name." à l'horaire le ".$schedule->event_date);
|
||||
Log::saveLog("Ajout de l'activité, ".$schedule->data['event_name']." à l'horaire le ".$schedule->date);
|
||||
|
||||
$userToNotify = $schedule->getUserToNotify();
|
||||
\Notification::send($userToNotify, new Alert(\Auth::User()->id,"Ajout de l'activité, ".$schedule->data['event_name']." à l'horaire le ".$schedule->date,"/admin/calendar"));
|
||||
|
||||
if(\App\Config::where('name','is_schedule_build')->first()->state == 1)
|
||||
{
|
||||
\Notification::send($userToNotify, new mail(\Auth::User(),"Ajout d'une activité a l'horaire",\Auth::User()->fullname()." à ajouté l'activité, ".$schedule->data['event_name']." à l'horaire le ".$schedule->date));
|
||||
}
|
||||
return redirect('/admin/calendar');
|
||||
|
||||
}
|
||||
@@ -454,6 +467,7 @@ class CalendarController extends Controller
|
||||
public function patch($id)
|
||||
{
|
||||
$schedule = Schedule::find($id);
|
||||
$original = clone($schedule);
|
||||
|
||||
$schedule->date = request('event_date');
|
||||
$schedule->type = request('event_type');
|
||||
@@ -515,6 +529,171 @@ class CalendarController extends Controller
|
||||
|
||||
$schedule->save();
|
||||
|
||||
/** Notification */
|
||||
$asChange = false;
|
||||
$userToNotify = $schedule->getUserToNotify();
|
||||
$changes = [];
|
||||
$found = false;
|
||||
|
||||
if ($schedule->type == "regular") {
|
||||
for ($p=1; $p < 3; $p++) {
|
||||
for ($n=1; $n < 4; $n++) {
|
||||
$pUser = \App\User::find($schedule->data['n'.$n.'_p'.$p.'_instructor']);
|
||||
foreach ($userToNotify as $user) {
|
||||
if ($user->id == $pUser->id) {
|
||||
$found = true;
|
||||
}
|
||||
}
|
||||
if (!$found) {
|
||||
$userToNotify->push($pUser);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($schedule->data['event_begin_time'] != $original->data['event_begin_time']) {
|
||||
array_push($changes,"L'heure de début a été modifié de ".$original->data['event_begin_time']." à ".$schedule->data['event_begin_time']);
|
||||
}
|
||||
if ($schedule->data['event_end_time'] != $original->data['event_end_time']) {
|
||||
array_push($changes,"L'heure de fin a été modifié de ".$original->data['event_end_time']." à ".$schedule->data['event_end_time']);
|
||||
}
|
||||
if ($schedule->type != $original->type) {
|
||||
array_push($changes,"Le type d'évenement a été modifié de ".$original->type." à ".$schedule->type);
|
||||
}
|
||||
if ($schedule->data['event_name'] != $original->data['event_name']) {
|
||||
array_push($changes,"Le nom de l'évenement a été modifié de ".$original->data['event_name']." à ".$schedule->data['event_name']);
|
||||
}
|
||||
if ($schedule->data['is_event_mandatory'] != $original->data['is_event_mandatory']) {
|
||||
if ($schedule->data['is_event_mandatory'] == "on") {
|
||||
array_push($changes,"L'évenement est maintenant obligatoire");
|
||||
} else {
|
||||
array_push($changes,"L'évenement n'est plus obligatoire");
|
||||
}
|
||||
}
|
||||
if ($schedule->data['event_location'] != $original->data['event_location']) {
|
||||
array_push($changes,"Le lieu de l'évenement a été modifié de ".$original->data['event_location']." à ".$schedule->data['event_location']);
|
||||
}
|
||||
if ($schedule->data['event_desc'] != $original->data['event_desc']) {
|
||||
array_push($changes,"La description de l'évenement a été modifié de ".$original->data['event_desc']." à ".$schedule->data['event_desc']);
|
||||
}
|
||||
|
||||
if ($schedule->type == "regular") {
|
||||
/** Check Instructor */
|
||||
if ($schedule->data['n1_p1_instructor'] != $original->data['n1_p1_instructor']) {
|
||||
array_push($changes,"L'instructeur du niveau 1 pour la première période a été changé de ".\App\User::find($original->data['n1_p1_instructor'])->fullname()." à ".\App\User::find($schedule->data['n1_p1_instructor'])->fullname());
|
||||
\Notification::send(\App\User::find($original->data['n1_p1_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le cours ".$original->data['n1_p1_name']." du ".$original->date." vous a été retiré."));
|
||||
\Notification::send(\App\User::find($schedule->data['n1_p1_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le cours ".$schedule->data['n1_p1_name']." du ".$schedule->date." vous a été ajouté."));
|
||||
}
|
||||
if ($schedule->data['n1_p2_instructor'] != $original->data['n1_p2_instructor']) {
|
||||
array_push($changes,"L'instructeur du niveau 1 pour la deuxième période a été changé de ".\App\User::find($original->data['n1_p2_instructor'])->fullname()." à ".\App\User::find($schedule->data['n1_p2_instructor'])->fullname());
|
||||
\Notification::send(\App\User::find($original->data['n1_p2_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le cours ".$original->data['n1_p2_name']." du ".$original->date." vous a été retiré."));
|
||||
\Notification::send(\App\User::find($schedule->data['n1_p2_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le cours ".$schedule->data['n1_p2_name']." du ".$schedule->date." vous a été ajouté."));
|
||||
}
|
||||
if ($schedule->data['n2_p1_instructor'] != $original->data['n2_p1_instructor']) {
|
||||
array_push($changes,"L'instructeur du niveau 2 pour la première période a été changé de ".\App\User::find($original->data['n2_p1_instructor'])->fullname()." à ".\App\User::find($schedule->data['n2_p1_instructor'])->fullname());
|
||||
\Notification::send(\App\User::find($original->data['n2_p1_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le cours ".$original->data['n2_p1_name']." du ".$original->date." vous a été retiré."));
|
||||
\Notification::send(\App\User::find($schedule->data['n2_p1_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le cours ".$schedule->data['n2_p1_name']." du ".$schedule->date." vous a été ajouté."));
|
||||
}
|
||||
if ($schedule->data['n2_p2_instructor'] != $original->data['n2_p2_instructor']) {
|
||||
array_push($changes,"L'instructeur du niveau 2 pour la deuxième période a été changé de ".\App\User::find($original->data['n2_p2_instructor'])->fullname()." à ".\App\User::find($schedule->data['n2_p2_instructor'])->fullname());
|
||||
\Notification::send(\App\User::find($original->data['n2_p2_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le cours ".$original->data['n2_p2_name']." du ".$original->date." vous a été retiré."));
|
||||
\Notification::send(\App\User::find($schedule->data['n2_p2_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le cours ".$schedule->data['n2_p2_name']." du ".$schedule->date." vous a été ajouté."));
|
||||
}
|
||||
if ($schedule->data['n3_p1_instructor'] != $original->data['n3_p1_instructor']) {
|
||||
array_push($changes,"L'instructeur du niveau 3 pour la première période a été changé de ".\App\User::find($original->data['n3_p1_instructor'])->fullname()." à ".\App\User::find($schedule->data['n3_p1_instructor'])->fullname());
|
||||
\Notification::send(\App\User::find($original->data['n3_p1_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le cours ".$original->data['n3_p1_name']." du ".$original->date." vous a été retiré."));
|
||||
\Notification::send(\App\User::find($schedule->data['n3_p1_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le cours ".$schedule->data['n3_p1_name']." du ".$schedule->date." vous a été ajouté."));
|
||||
}
|
||||
if ($schedule->data['n3_p2_instructor'] != $original->data['n3_p2_instructor']) {
|
||||
array_push($changes,"L'instructeur du niveau 3 pour la deuxième période a été changé de ".\App\User::find($original->data['n3_p2_instructor'])->fullname()." à ".\App\User::find($schedule->data['n3_p2_instructor'])->fullname());
|
||||
\Notification::send(\App\User::find($original->data['n3_p2_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le cours ".$original->data['n3_p2_name']." du ".$original->date." vous a été retiré."));
|
||||
\Notification::send(\App\User::find($schedule->data['n3_p2_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le cours ".$schedule->data['n3_p2_name']." du ".$schedule->date." vous a été ajouté."));
|
||||
}
|
||||
/** Check OCOM */
|
||||
if ($schedule->data['n1_p1_ocom'] != $original->data['n1_p1_ocom']) {
|
||||
array_push($changes,"L'OCOM du niveau 1 pour la première période a été changé de ".$original->data['n1_p1_ocom']." à ".$schedule->data['n1_p1_ocom']);
|
||||
\Notification::send(\App\User::find($schedule->data['n1_p1_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","L'ocom du cours ".$schedule->data['n1_p1_name']." du ".$schedule->date." a été changé pour ".$schedule->data['n1_p1_ocom']));
|
||||
}
|
||||
if ($schedule->data['n1_p2_ocom'] != $original->data['n1_p2_ocom']) {
|
||||
array_push($changes,"L'OCOM du niveau 1 pour la deuxième période a été changé de ".$original->data['n1_p2_ocom']." à ".$schedule->data['n1_p2_ocom']);
|
||||
\Notification::send(\App\User::find($schedule->data['n1_p2_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","L'ocom du cours ".$schedule->data['n1_p2_name']." du ".$schedule->date." a été changé pour ".$schedule->data['n1_p2_ocom']));
|
||||
}
|
||||
if ($schedule->data['n2_p1_ocom'] != $original->data['n2_p1_ocom']) {
|
||||
array_push($changes,"L'OCOM du niveau 2 pour la première période a été changé de ".$original->data['n2_p1_ocom']." à ".$schedule->data['n2_p1_ocom']);
|
||||
\Notification::send(\App\User::find($schedule->data['n2_p1_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","L'ocom du cours ".$schedule->data['n2_p1_name']." du ".$schedule->date." a été changé pour ".$schedule->data['n2_p1_ocom']));
|
||||
}
|
||||
if ($schedule->data['n2_p2_ocom'] != $original->data['n2_p2_ocom']) {
|
||||
array_push($changes,"L'OCOM du niveau 2 pour la deuxième période a été changé de ".$original->data['n2_p2_ocom']." à ".$schedule->data['n2_p2_ocom']);
|
||||
\Notification::send(\App\User::find($schedule->data['n2_p2_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","L'ocom du cours ".$schedule->data['n2_p2_name']." du ".$schedule->date." a été changé pour ".$schedule->data['n2_p2_ocom']));
|
||||
}
|
||||
if ($schedule->data['n3_p1_ocom'] != $original->data['n3_p1_ocom']) {
|
||||
array_push($changes,"L'OCOM du niveau 3 pour la première période a été changé de ".$original->data['n3_p1_ocom']." à ".$schedule->data['n3_p1_ocom']);
|
||||
\Notification::send(\App\User::find($schedule->data['n3_p1_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","L'ocom du cours ".$schedule->data['n3_p1_name']." du ".$schedule->date." a été changé pour ".$schedule->data['n3_p1_ocom']));
|
||||
}
|
||||
if ($schedule->data['n3_p2_ocom'] != $original->data['n3_p2_ocom']) {
|
||||
array_push($changes,"L'OCOM du niveau 3 pour la deuxième période a été changé de ".$original->data['n3_p2_ocom']." à ".$schedule->data['n3_p2_ocom']);
|
||||
\Notification::send(\App\User::find($schedule->data['n3_p2_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","L'ocom du cours ".$schedule->data['n3_p2_name']." du ".$schedule->date." a été changé pour ".$schedule->data['n3_p2_ocom']));
|
||||
}
|
||||
/** Check Local */
|
||||
if ($schedule->data['n1_p1_local'] != $original->data['n1_p1_local']) {
|
||||
array_push($changes,"Le local du niveau 1 pour la première période a été changé de ".$original->data['n1_p1_local']." à ".$schedule->data['n1_p1_local']);
|
||||
}
|
||||
if ($schedule->data['n1_p2_local'] != $original->data['n1_p2_local']) {
|
||||
array_push($changes,"Le local du niveau 1 pour la deuxième période a été changé de ".$original->data['n1_p2_local']." à ".$schedule->data['n1_p2_local']);
|
||||
}
|
||||
if ($schedule->data['n2_p1_local'] != $original->data['n2_p1_local']) {
|
||||
array_push($changes,"Le local du niveau 2 pour la première période a été changé de ".$original->data['n2_p1_local']." à ".$schedule->data['n2_p1_local']);
|
||||
}
|
||||
if ($schedule->data['n2_p2_local'] != $original->data['n2_p2_local']) {
|
||||
array_push($changes,"Le local du niveau 2 pour la deuxième période a été changé de ".$original->data['n2_p2_local']." à ".$schedule->data['n2_p2_local']);
|
||||
}
|
||||
if ($schedule->data['n3_p1_local'] != $original->data['n3_p1_local']) {
|
||||
array_push($changes,"Le local du niveau 3 pour la première période a été changé de ".$original->data['n3_p1_local']." à ".$schedule->data['n3_p1_local']);
|
||||
}
|
||||
if ($schedule->data['n3_p2_local'] != $original->data['n3_p2_local']) {
|
||||
array_push($changes,"Le local du niveau 3 pour la deuxième période a été changé de ".$original->data['n3_p2_local']." à ".$schedule->data['n3_p2_local']);
|
||||
}
|
||||
/** Check Name */
|
||||
if ($schedule->data['n1_p1_name'] != $original->data['n1_p1_name']) {
|
||||
array_push($changes,"Le nom du cours niveau 1 pour la première période a été changé de ".$original->data['n1_p1_name']." à ".$schedule->data['n1_p1_name']);
|
||||
\Notification::send(\App\User::find($schedule->data['n1_p1_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le nom du cours ".$original->data['n1_p1_name']." du ".$schedule->date." a été changé pour ".$schedule->data['n1_p1_name']));
|
||||
}
|
||||
if ($schedule->data['n1_p2_name'] != $original->data['n1_p2_name']) {
|
||||
array_push($changes,"Le nom du cours niveau 1 pour la deuxième période a été changé de ".$original->data['n1_p2_name']." à ".$schedule->data['n1_p2_name']);
|
||||
\Notification::send(\App\User::find($schedule->data['n1_p2_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le nom du cours ".$original->data['n1_p2_name']." du ".$schedule->date." a été changé pour ".$schedule->data['n1_p2_name']));
|
||||
}
|
||||
if ($schedule->data['n2_p1_name'] != $original->data['n2_p1_name']) {
|
||||
array_push($changes,"Le nom du cours niveau 2 pour la première période a été changé de ".$original->data['n2_p1_name']." à ".$schedule->data['n2_p1_name']);
|
||||
\Notification::send(\App\User::find($schedule->data['n2_p1_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le nom du cours ".$original->data['n2_p1_name']." du ".$schedule->date." a été changé pour ".$schedule->data['n2_p1_name']));
|
||||
}
|
||||
if ($schedule->data['n2_p2_name'] != $original->data['n2_p2_name']) {
|
||||
array_push($changes,"Le nom du cours niveau 2 pour la deuxième période a été changé de ".$original->data['n2_p2_name']." à ".$schedule->data['n2_p2_name']);
|
||||
\Notification::send(\App\User::find($schedule->data['n2_p2_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le nom du cours ".$original->data['n2_p2_name']." du ".$schedule->date." a été changé pour ".$schedule->data['n2_p2_name']));
|
||||
}
|
||||
if ($schedule->data['n3_p1_name'] != $original->data['n3_p1_name']) {
|
||||
array_push($changes,"Le nom du cours niveau 3 pour la première période a été changé de ".$original->data['n3_p1_name']." à ".$schedule->data['n3_p1_name']);
|
||||
\Notification::send(\App\User::find($schedule->data['n3_p1_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le nom du cours ".$original->data['n3_p1_name']." du ".$schedule->date." a été changé pour ".$schedule->data['n3_p1_name']));
|
||||
}
|
||||
if ($schedule->data['n3_p2_name'] != $original->data['n3_p2_name']) {
|
||||
array_push($changes,"Le nom du cours niveau 3 pour la deuxième période a été changé de ".$original->data['n3_p2_name']." à ".$schedule->data['n3_p2_name']);
|
||||
\Notification::send(\App\User::find($schedule->data['n3_p2_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le nom du cours ".$original->data['n3_p2_name']." du ".$schedule->date." a été changé pour ".$schedule->data['n3_p2_name']));
|
||||
}
|
||||
}
|
||||
|
||||
\Notification::send($userToNotify, new Alert(\Auth::User()->id,"Modification de l'activité, ".$schedule->data['event_name']." à l'horaire le ".$schedule->date,"/admin/calendar"));
|
||||
|
||||
$string_Change = "<ul>";
|
||||
foreach ($changes as $value) {
|
||||
$string_Change = $string_Change."<li>".$value."</li>";
|
||||
}
|
||||
$string_Change = $string_Change."</ul>";
|
||||
if(\App\Config::where('name','is_schedule_build')->first()->state == 1)
|
||||
{
|
||||
\Notification::send($userToNotify, new mail(\Auth::User(),"Modification d'une activité a l'horaire",\Auth::User()->fullname()." à modifié l'activité, ".$schedule->data['event_name']." à l'horaire le ".$schedule->date."<br>".$string_Change));
|
||||
}
|
||||
|
||||
Log::saveLog("Modification de l'activité, ".$schedule->data['event_name']." à l'horaire le ".$schedule->date);
|
||||
|
||||
return redirect('/admin/calendar');
|
||||
|
||||
}
|
||||
@@ -526,6 +705,50 @@ class CalendarController extends Controller
|
||||
$schedule = Schedule::find($id);
|
||||
|
||||
$schedule->delete();
|
||||
|
||||
\Notification::send($userToNotify, new Alert(\Auth::User()->id,"Suppresion de l'activité, ".$schedule->data['event_name']." à l'horaire le ".$schedule->date,"/admin/calendar"));
|
||||
|
||||
if(\App\Config::where('name','is_schedule_build')->first()->state == 1)
|
||||
{
|
||||
\Notification::send($userToNotify, new mail(\Auth::User(),"Suppression d'une activité a l'horaire",\Auth::User()->fullname()." à supprimé l'activité, ".$schedule->data['event_name']." à l'horaire le ".$schedule->date));
|
||||
}
|
||||
|
||||
Log::saveLog("Suppression de l'activité, ".$schedule->data['event_name']." à l'horaire le ".$schedule->date);
|
||||
|
||||
}
|
||||
|
||||
private function listClass()
|
||||
{
|
||||
$schedules = \App\Schedule::all();
|
||||
$filtered_schedules = collect();
|
||||
$classes = [];
|
||||
|
||||
foreach($schedules as $schedule)
|
||||
{
|
||||
if($schedule->type == "regular")
|
||||
{
|
||||
$filtered_schedules->push($schedule);
|
||||
}
|
||||
}
|
||||
|
||||
foreach($filtered_schedules as $schedule)
|
||||
{
|
||||
array_push($classes,$schedule->data['n1_p1_ocom']);
|
||||
array_push($classes,$schedule->data['n1_p2_ocom']);
|
||||
array_push($classes,$schedule->data['n2_p1_ocom']);
|
||||
array_push($classes,$schedule->data['n2_p2_ocom']);
|
||||
array_push($classes,$schedule->data['n3_p1_ocom']);
|
||||
array_push($classes,$schedule->data['n3_p2_ocom']);
|
||||
}
|
||||
|
||||
$filtered_classes = array_unique($classes);
|
||||
|
||||
return $filtered_classes;
|
||||
}
|
||||
|
||||
public function show()
|
||||
{
|
||||
$date = request('date');
|
||||
return view('admin.calendar.modal.show',['schedules' => \App\Schedule::all()->where('date',$date),'date' => $date]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\ComplementaryActivity;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ComplementaryActivityController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('admin.configs.activity',['configs' => \App\Config::all(),'activities' => \App\ComplementaryActivity::all()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('admin.configs.activity-add');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store()
|
||||
{
|
||||
$activity = new ComplementaryActivity();
|
||||
|
||||
$activity->name = request('name');
|
||||
$activity->admin_desc = request('admin_desc');
|
||||
$activity->public_body = 'Veuillez modifier le text de description publique par défaut';
|
||||
$activity->calendar_color = request('calendar_color');
|
||||
$activity->calendar_icon = request('calendar_icon');
|
||||
$activity->begin_time = request('begin_time');
|
||||
$activity->end_time = request('end_time');
|
||||
$activity->location = request('location');
|
||||
$activity->public_slogan = "Veuillez modifier le slogan publique par défaut";
|
||||
$activity->public_header_picture = "./assets/img/bg2.jpg";
|
||||
$activity->location = request('location');
|
||||
$activity->location = request('location');
|
||||
if(request('is_mandatory') == 'on')
|
||||
{
|
||||
$activity->is_mandatory = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$activity->is_mandatory = false;
|
||||
}
|
||||
if(request('is_promoted') == 'on')
|
||||
{
|
||||
$activity->is_promoted = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$activity->is_promoted = false;
|
||||
}
|
||||
|
||||
$activity->save();
|
||||
|
||||
return redirect('/admin/config/activity')->with('success','Activité ajouté avec succes');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\ComplementaryActivity $complementaryActivity
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('public.activity',['activity' => ComplementaryActivity::find($id)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\ComplementaryActivity $complementaryActivity
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
return view('admin.configs.activity-edit',['activity' => \App\ComplementaryActivity::find($id)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\ComplementaryActivity $complementaryActivity
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update($id)
|
||||
{
|
||||
$activity = ComplementaryActivity::find($id);
|
||||
|
||||
$activity->name = request('name');
|
||||
$activity->admin_desc = request('admin_desc');
|
||||
$activity->calendar_color = request('calendar_color');
|
||||
$activity->calendar_icon = request('calendar_icon');
|
||||
$activity->begin_time = request('begin_time');
|
||||
$activity->end_time = request('end_time');
|
||||
$activity->location = request('location');
|
||||
if(request('is_mandatory') == 'true')
|
||||
{
|
||||
$activity->is_mandatory = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$activity->is_mandatory = false;
|
||||
}
|
||||
if(request('is_promoted') == 'true')
|
||||
{
|
||||
$activity->is_promoted = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$activity->is_promoted = false;
|
||||
}
|
||||
|
||||
$activity->save();
|
||||
|
||||
return redirect('/admin/config/activity')->with('success','Modification sauvegarder avec succes');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\ComplementaryActivity $complementaryActivity
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy()
|
||||
{
|
||||
$id = request('id');
|
||||
|
||||
$activity = ComplementaryActivity::find($id);
|
||||
|
||||
$activity->delete();
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ class ConfigController extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
return view ('admin.configs.general',['configs' => Config::all()]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,9 +67,35 @@ class ConfigController extends Controller
|
||||
* @param \App\Config $config
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, Config $config)
|
||||
public function update()
|
||||
{
|
||||
//
|
||||
$configs = [
|
||||
'is_schedule_public',
|
||||
'is_schedule_build',
|
||||
'escadron_name_full',
|
||||
'escadron_name_short',
|
||||
'escadron_number',
|
||||
'escadron_phone',
|
||||
'escadron_element',
|
||||
'element_title',
|
||||
'escadron_address',
|
||||
'escadron_direct_googlemap_link',
|
||||
'media_facebook',
|
||||
'media_twitter',
|
||||
'media_instagram',
|
||||
'media_email',
|
||||
|
||||
];
|
||||
|
||||
foreach ($configs as $config) {
|
||||
$c = \App\Config::all()->where('name',$config)->first();
|
||||
$c->data = [request($config)];
|
||||
$c->save();
|
||||
}
|
||||
|
||||
\App\Log::saveLog('Modification de la configuration du site');
|
||||
|
||||
return redirect('/admin/config')->with('success','Modification sauvegarder avec succès !');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Course;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CourseController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Course $course
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Course $course)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Course $course
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Course $course)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\Course $course
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, Course $course)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Course $course
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Course $course)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,348 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use \App\Schedule;
|
||||
|
||||
class ECCController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$messages = \App\Message::all()->forPage(1,4);
|
||||
return view('ecc.dashboard',['userClasse' => \Auth::User()->getClasse()->forPage(1,8), 'messages' => $messages,'AlluserClasse' => \Auth::User()->getClasse()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update()
|
||||
{
|
||||
return view('ecc.update');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function messages($page = 1)
|
||||
{
|
||||
if ($page < 1) {
|
||||
$page = 1;
|
||||
}
|
||||
$messages = \App\Message::all()->forPage($page,6);
|
||||
return view('ecc.messages',['messages' => $messages,'page'=>$page]);
|
||||
}
|
||||
|
||||
public function message($id)
|
||||
{
|
||||
$messages = \App\Message::find($id);
|
||||
return view('ecc.message',['message' => $messages]);
|
||||
}
|
||||
|
||||
public function guide()
|
||||
{
|
||||
return view('ecc.guide');
|
||||
}
|
||||
|
||||
public function calendar()
|
||||
{
|
||||
return view('ecc.calendar');
|
||||
}
|
||||
|
||||
public function generateCalendar()
|
||||
{
|
||||
$lang = str_replace('_', '-', app()->getLocale());
|
||||
setlocale(LC_ALL, $lang.'_'.strtoupper($lang).'.utf8','fra');
|
||||
|
||||
$month = request('month');
|
||||
$year = request('year');
|
||||
|
||||
$nextMonth = $month + 1;
|
||||
$nextYear = $year;
|
||||
|
||||
if ($nextMonth > 12) {
|
||||
$nextMonth = 1;
|
||||
$nextYear = $nextYear + 1;
|
||||
}
|
||||
|
||||
$prevMonth = $month - 1;
|
||||
$prevYear = $year;
|
||||
|
||||
if ($prevMonth < 1) {
|
||||
$prevMonth = 12;
|
||||
$prevYear = $prevYear - 1;
|
||||
}
|
||||
|
||||
$calendar = array();
|
||||
|
||||
$dayinmonth = cal_days_in_month(CAL_GREGORIAN, $month, $year);
|
||||
|
||||
$firstdaymonth = date("w", strtotime("01-".$month."-".$year));
|
||||
|
||||
$addingday = 0;
|
||||
|
||||
for ($i=$firstdaymonth ; $addingday < $dayinmonth ; $i++) {
|
||||
$addingday = $addingday + 1;
|
||||
$calendar[$i] = $addingday;
|
||||
}
|
||||
|
||||
echo '<div class="table calendar">';
|
||||
echo '<div class="thead-dark">';
|
||||
echo '<div class="row calendar-head"><div class="col-sm-2"><a class="btn" onclick="generate('.$prevMonth.','.$prevYear.')"><i class="fa fa-chevron-left" aria-hidden="true"></i></a></div><div class="col-sm-8">'.ucfirst(strftime("%B %Y", strtotime("01-".$month."-".$year))).'</div><div class="col-sm-2"><a class="btn" onclick="generate('.$nextMonth.','.$nextYear.')"><i class="fa fa-chevron-right" aria-hidden="true"></i></a></div></div>';
|
||||
echo '<div class="row calendar-head"><div style="width:14%;">Dimanche</div><div style="width:14%;">Lundi</div><div style="width:14%;">Mardi</div><div style="width:14%;">Mercredi</div><div style="width:14%;">Jeudi</div><div style="width:14%;">Vendredi</div><div style="width:14%;">Samedi</div></div>';
|
||||
echo '</div>';
|
||||
echo '<div class="calendar-body">';
|
||||
for ($i=0; $i < 6 ; $i++)
|
||||
{
|
||||
echo '<div class="calendar-row">';
|
||||
for ($a=0; $a < 7 ; $a++)
|
||||
{
|
||||
if (isset($calendar[(($i*7) + $a)]))
|
||||
{
|
||||
/** Date info */
|
||||
$today = date("Y-m-d", strtotime($year."-".$month."-".$calendar[(($i*7) + $a)]));
|
||||
$activityToday = Schedule::where('date','=',$today)->get();
|
||||
|
||||
/** If nothing today */
|
||||
if ($activityToday->isEmpty()) {
|
||||
echo '<a href="/ecc/calendar/'.$today.'" class="calendar-container calendar-empty" name="'.$today.'" id="calendar_'.$calendar[(($i*7) + $a)].'"><div class="calendar-date">'.date("j", strtotime($today)).'</div></a>';
|
||||
} else {
|
||||
echo '<a href="/ecc/calendar/'.$today.'" class="calendar-container" name="'.$today.'" id="calendar_'.$calendar[(($i*7) + $a)].'">';
|
||||
$text = "";
|
||||
echo '<div class="calendar-date">'.date("j", strtotime($today)).'</div>';
|
||||
foreach ($activityToday as $activity) {
|
||||
echo '<div class="calendar-text" style="width:90%;">';
|
||||
switch ($activity->type) {
|
||||
case 'regular':
|
||||
echo '<div class="row" style="color:orange;"><span class="fa-stack fa-lg col-md-2"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-book fa-stack-1x fa-inverse"></i></span><div class="col-md-10 calendar_event_name">'.ucfirst($activity->data['event_name'])."</div></div>";
|
||||
break;
|
||||
|
||||
case 'pilotage':
|
||||
echo '<div class="row" style="color:#58D3F7;"><span class="fa-stack fa-lg col-md-2"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-plane fa-stack-1x fa-inverse"></i></span><div class="col-md-10 calendar_event_name">'.ucfirst($activity->data['event_name'])."</div></div>";
|
||||
break;
|
||||
|
||||
case 'drill':
|
||||
echo '<div class="row" style="color:blue;"><span class="fa-stack fa-lg col-md-2"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-trophy fa-stack-1x fa-inverse"></i></span><div class="col-md-10 calendar_event_name">'.ucfirst($activity->data['event_name'])."</div></div>";
|
||||
break;
|
||||
|
||||
case 'music':
|
||||
echo '<div class="row" style="color:green;"><span class="fa-stack fa-lg col-md-2"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-music fa-stack-1x fa-inverse"></i></span><div class="col-md-10 calendar_event_name">'.ucfirst($activity->data['event_name'])."</div></div>";
|
||||
break;
|
||||
|
||||
case 'biathlon':
|
||||
echo '<div class="row" style="color:red;"><span class="fa-stack fa-lg col-md-2"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-snowflake-o fa-stack-1x fa-inverse"></i></span><div class="col-md-10 calendar_event_name">'.ucfirst($activity->data['event_name'])."</div></div>";
|
||||
break;
|
||||
|
||||
case 'marksmanship':
|
||||
echo '<div class="row" style="color:grey;"><span class="fa-stack fa-lg col-md-2"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-star fa-stack-1x fa-inverse"></i></span><div class="col-md-10 calendar_event_name">'.ucfirst($activity->data['event_name'])."</div></div>";
|
||||
break;
|
||||
|
||||
case 'founding':
|
||||
echo '<div class="row" style="color:#00FF40;"><span class="fa-stack fa-lg col-md-2"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-usd fa-stack-1x fa-inverse"></i></span><div class="col-md-10 calendar_event_name">'.ucfirst($activity->data['event_name'])."</div></div>";
|
||||
break;
|
||||
|
||||
case 'volunteer':
|
||||
echo '<div class="row" style="color:#DF0174;"><span class="fa-stack fa-lg col-md-2"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-handshake-o fa-stack-1x fa-inverse"></i></span><div class="col-md-10 calendar_event_name">'.ucfirst($activity->data['event_name'])."</div></div>";
|
||||
break;
|
||||
|
||||
default:
|
||||
echo '<div class="row" style="color:#0B615E;"><span class="fa-stack fa-lg col-md-2"><i class="fa fa-circle fa-stack-2x"></i></span><div class="col-md-10 calendar_event_name">'.ucfirst($activity->data['event_name'])."</div></div>";
|
||||
break;
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
echo '</a>';
|
||||
}
|
||||
} else {
|
||||
echo '<div class="calendar-container¸calendar-empty" style="border:none !important; width:14%;"></div>';
|
||||
}
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function calendar_date($date)
|
||||
{
|
||||
$schedules = \App\Schedule::all()->where('date',$date);
|
||||
|
||||
return view('ecc.calendar_date',['schedules' => $schedules]);
|
||||
}
|
||||
|
||||
public function booking($id,$niveau,$periode)
|
||||
{
|
||||
$schedule = Schedule::find($id);
|
||||
|
||||
$periode_item = 'n'.$niveau.'_p'.$periode.'_item';
|
||||
$periode_instr = 'n'.$niveau.'_p'.$periode.'_instructor';
|
||||
|
||||
if(\Auth::User()->id != $schedule->data[$periode_instr])
|
||||
{
|
||||
abort(401);
|
||||
}
|
||||
|
||||
$items = collect();
|
||||
if (isset($schedule->$periode_item)) {
|
||||
$items_array = explode("-",$schedule->$periode_item);
|
||||
|
||||
foreach ($items_array as $item_array) {
|
||||
if ($item_array != "") {
|
||||
$item_array_ex = explode(":",$item_array);
|
||||
$this_item = \App\Item::find($item_array_ex[0]);
|
||||
$this_item->quantity = $item_array_ex[1];
|
||||
$items->push($this_item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return view('ecc.booking',['schedule' => $schedule, 'periode' => $periode, 'niveau' => $niveau, 'items' => $items, 'dispo_item' => $schedule->getInventory($periode)]);
|
||||
}
|
||||
|
||||
public function booking_add($id,$periode,$niveau)
|
||||
{
|
||||
$schedule = Schedule::find($id);
|
||||
$id_to_modify = "passet";
|
||||
$qt_to_add = 0;
|
||||
$periode_item = 'n'.$niveau.'_p'.$periode.'_item';
|
||||
|
||||
if (isset($schedule->$periode_item)) {
|
||||
$array_items = explode("-",$schedule->$periode_item);
|
||||
for ($i=0; $i < count($array_items); $i++) {
|
||||
$array_item_id = explode(":",$array_items[$i]);
|
||||
|
||||
if ($array_item_id[0] == request('add')) {
|
||||
$id_to_modify = $i;
|
||||
$qt_to_add = $array_item_id[1];
|
||||
}
|
||||
}
|
||||
if ($id_to_modify === "passet") {
|
||||
array_push($array_items,request('add').":".request('qt'));
|
||||
} else {
|
||||
$toadd = $qt_to_add+request('qt');
|
||||
$array_items[$id_to_modify] = request('add').":".$toadd;
|
||||
}
|
||||
} else {
|
||||
$array_items = [];
|
||||
array_push($array_items,request('add').":".request('qt'));
|
||||
}
|
||||
|
||||
$final_items = implode("-",$array_items);
|
||||
|
||||
$schedule->$periode_item = $final_items;
|
||||
|
||||
$schedule->save();
|
||||
|
||||
return redirect('/ecc/inventory/'.$id.'/'.$niveau.'/'.$periode);
|
||||
}
|
||||
|
||||
public function booking_remove($id,$periode,$niveau)
|
||||
{
|
||||
$schedule = Schedule::find($id);
|
||||
$remove = [request('remove')];
|
||||
$periode_item = 'n'.$niveau.'_p'.$periode.'_item';
|
||||
|
||||
if (isset($schedule->$periode_item)) {
|
||||
$array_items = explode("-",$schedule->$periode_item);
|
||||
$array_items = array_diff($array_items,$remove);
|
||||
} else {
|
||||
$array_items = [];
|
||||
$array_items = array_diff($array_items,$remove);
|
||||
}
|
||||
|
||||
$final_items = implode("-",$array_items);
|
||||
$schedule->$periode_item = $final_items;
|
||||
$schedule->save();
|
||||
|
||||
return redirect('/ecc/inventory/'.$id.'/'.$niveau.'/'.$periode);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return view('ecc.list');
|
||||
}
|
||||
|
||||
public function files()
|
||||
{
|
||||
return view('ecc.files');
|
||||
}
|
||||
|
||||
public function settings()
|
||||
{
|
||||
return view('ecc.settings');
|
||||
}
|
||||
|
||||
public function UserPassword()
|
||||
{
|
||||
return view('ecc.settings.password');
|
||||
}
|
||||
|
||||
public function UserAvatar()
|
||||
{
|
||||
return view('ecc.settings.avatar');
|
||||
}
|
||||
|
||||
public function UserAdress()
|
||||
{
|
||||
return view('ecc.settings.adress');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Event;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class EventController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return Response
|
||||
*/
|
||||
public function store()
|
||||
{
|
||||
$event = new Event();
|
||||
|
||||
$event->name = request('name');
|
||||
$event->date_begin = request('begin');
|
||||
$event->date_end = request('end');
|
||||
$event->type = request('type');
|
||||
$event->user_id = \Auth::user()->id;
|
||||
$event->location = request('location');
|
||||
if(request('is_mandatory') != null){
|
||||
$event->is_mandatory = 1;
|
||||
} else {
|
||||
$event->is_mandatory = 0;
|
||||
}
|
||||
$event->desc = request('desc');
|
||||
|
||||
$event->save();
|
||||
|
||||
if ($event->type == 1) {
|
||||
for ($l=1; $l <= \App\Config::getData('admin_level_in_schedule_nb'); $l++) {
|
||||
for ($p=1; $p <= \App\Config::getData('admin_periode_nb'); $p++) {
|
||||
|
||||
$course = new \App\Course();
|
||||
|
||||
$users = \App\User::all();
|
||||
$instructor = 1;
|
||||
|
||||
foreach ($users as $user) {
|
||||
if($user->fullname() == request('instruc_n'.$l.'_p'.$p))
|
||||
{
|
||||
$instructor = $user->id;
|
||||
}
|
||||
}
|
||||
|
||||
$course->name = request('name_n'.$l.'_p'.$p);
|
||||
$course->user_id = $instructor;
|
||||
$course->ocom = request('ocom_n'.$l.'_p'.$p);
|
||||
$course->location = request('loc_n'.$l.'_p'.$p);
|
||||
$course->periode = $p;
|
||||
$course->level = $l;
|
||||
|
||||
$course->comment = "";
|
||||
$course->event_id = $event->id;
|
||||
|
||||
$course->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return redirect('/admin/calendar')->with('success','Événement ajouter à l\'horaire');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Event $event
|
||||
* @return Response
|
||||
*/
|
||||
public function show(Event $event)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param $id
|
||||
* @return Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
return view('admin.schedule.event.edit',['activity' => \App\Event::find($id)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\Event $event
|
||||
* @return Response
|
||||
*/
|
||||
public function update($id)
|
||||
{
|
||||
$event = Event::find($id);
|
||||
|
||||
$event->name = request('name');
|
||||
$event->date_begin = request('begin');
|
||||
$event->date_end = request('end');
|
||||
$event->location = request('location');
|
||||
if(request('is_mandatory') != null){
|
||||
$event->is_mandatory = 1;
|
||||
} else {
|
||||
$event->is_mandatory = 0;
|
||||
}
|
||||
$event->desc = request('desc');
|
||||
|
||||
$event->save();
|
||||
|
||||
if ($event->type == 1) {
|
||||
for ($l=1; $l <= \App\Config::getData('admin_level_in_schedule_nb'); $l++) {
|
||||
for ($p=1; $p <= \App\Config::getData('admin_periode_nb'); $p++) {
|
||||
|
||||
$course = new \App\Course();
|
||||
|
||||
$users = \App\User::all();
|
||||
$instructor = 1;
|
||||
|
||||
foreach ($users as $user) {
|
||||
if($user->fullname() == request('instruc_n'.$l.'_p'.$p))
|
||||
{
|
||||
$instructor = $user->id;
|
||||
}
|
||||
}
|
||||
|
||||
$course->name = request('name_n'.$l.'_p'.$p);
|
||||
$course->user_id = $instructor;
|
||||
$course->ocom = request('ocom_n'.$l.'_p'.$p);
|
||||
$course->location = request('loc_n'.$l.'_p'.$p);
|
||||
$course->periode = $p;
|
||||
$course->level = $l;
|
||||
|
||||
$course->comment = "";
|
||||
$course->event_id = $event->id;
|
||||
|
||||
$course->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return redirect('/admin/calendar')->with('success','Modification à l\'événement sauvegarder à l\'horaire');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Event $event
|
||||
* @return Response
|
||||
*/
|
||||
public function destroy(Event $event)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class FilesController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('admin.files.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function guide()
|
||||
{
|
||||
return view('admin.files.guide');
|
||||
}
|
||||
}
|
||||
@@ -54,15 +54,29 @@ class InventoryController extends Controller
|
||||
public function store($id,$periode,$niveau)
|
||||
{
|
||||
$schedule = Schedule::find($id);
|
||||
|
||||
$id_to_modify = "passet";
|
||||
$qt_to_add = 0;
|
||||
$periode_item = 'n'.$niveau.'_p'.$periode.'_item';
|
||||
|
||||
if (isset($schedule->$periode_item)) {
|
||||
$array_items = explode("-",$schedule->$periode_item);
|
||||
array_push($array_items,request('add'));
|
||||
for ($i=0; $i < count($array_items); $i++) {
|
||||
$array_item_id = explode(":",$array_items[$i]);
|
||||
|
||||
if ($array_item_id[0] == request('add')) {
|
||||
$id_to_modify = $i;
|
||||
$qt_to_add = $array_item_id[1];
|
||||
}
|
||||
}
|
||||
if ($id_to_modify === "passet") {
|
||||
array_push($array_items,request('add').":".request('qt'));
|
||||
} else {
|
||||
$toadd = $qt_to_add+request('qt');
|
||||
$array_items[$id_to_modify] = request('add').":".$toadd;
|
||||
}
|
||||
} else {
|
||||
$array_items = [];
|
||||
array_push($array_items,request('add'));
|
||||
array_push($array_items,request('add').":".request('qt'));
|
||||
}
|
||||
|
||||
$final_items = implode("-",$array_items);
|
||||
@@ -91,10 +105,14 @@ class InventoryController extends Controller
|
||||
|
||||
foreach ($items_array as $item_array) {
|
||||
if ($item_array != "") {
|
||||
$items->push(Item::find($item_array));
|
||||
$item_array_ex = explode(":",$item_array);
|
||||
$this_item = Item::find($item_array_ex[0]);
|
||||
$this_item->quantity = $item_array_ex[1];
|
||||
$items->push($this_item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return view('admin.inventory.show',['schedule' => $schedule, 'periode' => $periode, 'niveau' => $niveau, 'items' => $items, 'dispo_item' => $schedule->getInventory($periode)]);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ class ItemController extends Controller
|
||||
|
||||
$item->name = request('name');
|
||||
$item->desc = request('desc');
|
||||
$item->quantiy = request('qt');
|
||||
|
||||
$item->save();
|
||||
|
||||
@@ -82,6 +83,7 @@ class ItemController extends Controller
|
||||
|
||||
$item->name = request('name');
|
||||
$item->desc = request('desc');
|
||||
$item->quantity = request('qt');
|
||||
|
||||
$item->save();
|
||||
|
||||
|
||||
@@ -78,22 +78,8 @@ class MessageController extends Controller
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$this_msg = Message::find($id);
|
||||
|
||||
if(isset($this_msg->data['as_seen']))
|
||||
{
|
||||
if (!strpos($this_msg->data['as_seen'],"-".\Auth::user()->id."-")) {
|
||||
$data = [
|
||||
'as_seen' => $this_msg->data['as_seen']."-".\Auth::user()->id."-",
|
||||
'parameter' => $this_msg->data['parameter']
|
||||
];
|
||||
|
||||
$this_msg->data = $data;
|
||||
|
||||
$this_msg->save();
|
||||
}
|
||||
}
|
||||
return view('admin.message.show', ['message' => $this_msg]);
|
||||
\Auth::User()->seenMessage($id);
|
||||
return view('admin.message.show', ['message' => Message::find($id)]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\News;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class NewsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('public.allnews',['news' => \App\News::paginate(9)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\News $news
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('public.news', ['new' => \App\News::find($id)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\News $news
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(News $news)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\News $news
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, News $news)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\News $news
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(News $news)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Picture;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class PictureController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('public.allpicture',['pictures' => \App\Picture::paginate(\App\Config::getData('text_public_picture_nb'))]);
|
||||
}
|
||||
|
||||
public function indexAdmin()
|
||||
{
|
||||
return view('admin.picture.index',['pictures' => \App\Picture::paginate(\App\Config::getData('text_public_picture_nb'))]);
|
||||
}
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('admin.picture.add');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store()
|
||||
{
|
||||
$pic = new Picture();
|
||||
|
||||
$pic->title = request('title');
|
||||
$pic->url = request('url');
|
||||
$pic->desc = request('desc');
|
||||
$pic->pictureable_id = 0;
|
||||
$pic->pictureable_type = "";
|
||||
|
||||
$pic->save();
|
||||
|
||||
return redirect('/admin/picture')->with('success','Image ajoutée avec succès');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Picture $picture
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('public.picture',['picture' => \App\Picture::find($id)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Picture $picture
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
return view('admin.picture.edit',['picture' => Picture::find($id)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\Picture $picture
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update($id)
|
||||
{
|
||||
$pic = Picture::find($id);
|
||||
|
||||
$pic->title = request('title');
|
||||
$pic->url = request('url');
|
||||
$pic->desc = request('desc');
|
||||
|
||||
$pic->save();
|
||||
|
||||
return redirect('/admin/picture')->with('success','Image sauvegarder avec succès');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Picture $picture
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
$pic = Picture::find($id);
|
||||
|
||||
$pic->delete();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class PublicController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('public.index',[
|
||||
'news' => \App\News::all()->sortByDesc('created_at')->take(3),
|
||||
'activities' => \App\ComplementaryActivity::all()->where('is_promoted','1'),
|
||||
'pictures' => \App\Picture::all()->sortByDesc('created_at')->take(\App\Config::getData('nb_activity_public'))
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($config)
|
||||
{
|
||||
return view('admin.public.edit',['config' => \App\Config::where('name',$config)->first()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $config)
|
||||
{
|
||||
$config = \App\Config::where('name',$config)->first();
|
||||
|
||||
$config->data = [request('data')];
|
||||
|
||||
$config->save();
|
||||
|
||||
return redirect('/?editMode');;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,226 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use \App\Schedule;
|
||||
use function GuzzleHttp\json_encode;
|
||||
use PDF;
|
||||
|
||||
class ScheduleController extends Controller
|
||||
{
|
||||
//
|
||||
public function index()
|
||||
{
|
||||
return view('admin.configs.schedule',['configs' => \App\Config::all()]);
|
||||
}
|
||||
|
||||
public function update()
|
||||
{
|
||||
$configs = ['admin_periode_nb'];
|
||||
|
||||
foreach ($configs as $config) {
|
||||
$c = \App\Config::all()->where('name',$config)->first();
|
||||
$c->data = [request($config)];
|
||||
$c->save();
|
||||
}
|
||||
|
||||
$new_admin_periode_begin = [];
|
||||
$new_admin_periode_end = [];
|
||||
for ($i=1; $i <= request('admin_periode_nb'); $i++) {
|
||||
if(request('admin_periode_begin_'.$i))
|
||||
{
|
||||
$new_admin_periode_begin[$i] = request('admin_periode_begin_'.$i);
|
||||
}
|
||||
else
|
||||
{
|
||||
$new_admin_periode_begin[$i] = "00:00";
|
||||
}
|
||||
if(request('admin_periode_end_'.$i))
|
||||
{
|
||||
$new_admin_periode_end[$i] = request('admin_periode_end_'.$i);
|
||||
}
|
||||
else
|
||||
{
|
||||
$new_admin_periode_end[$i] = "00:00";
|
||||
}
|
||||
}
|
||||
|
||||
$temp = \App\Config::all()->where('name','admin_periode_begin')->first();
|
||||
$temp->data = $new_admin_periode_begin;
|
||||
$temp->save();
|
||||
|
||||
$temp = \App\Config::all()->where('name','admin_periode_end')->first();
|
||||
$temp->data = $new_admin_periode_end;
|
||||
$temp->save();
|
||||
|
||||
return redirect('/admin/config/schedule')->with('success','Modification sauvegarder avec succès !');
|
||||
}
|
||||
|
||||
public function apiIndex()
|
||||
{
|
||||
$start = strtotime(request()->start);
|
||||
$end = strtotime(request()->end);
|
||||
$allschedules = Schedule::all();
|
||||
|
||||
$allevents = \App\Event::all();
|
||||
$events = [];
|
||||
$jsonevents = [];
|
||||
$schedules = [];
|
||||
|
||||
foreach ($allschedules as $schedule) {
|
||||
if(strtotime($schedule->date) >= $start && strtotime($schedule->date) <= $end) {
|
||||
array_push($schedules,$schedule);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($allevents as $event) {
|
||||
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) {
|
||||
|
||||
$color = $this->getColor($schedule->type);
|
||||
|
||||
$event = [
|
||||
'title' => $schedule->data['event_name'],
|
||||
'start' => $schedule->date.'T'.$schedule->data['event_begin_time'],
|
||||
'end' => $schedule->date.'T'.$schedule->data['event_end_time'],
|
||||
'color' => $color,
|
||||
'source' => 'schedule',
|
||||
'id' => $schedule->id
|
||||
];
|
||||
array_push($jsonevents,$event);
|
||||
}
|
||||
|
||||
foreach ($events as $event) {
|
||||
|
||||
$color = $this->getColor($event->type);
|
||||
|
||||
$myevent = [
|
||||
'title' => $event->name,
|
||||
'start' => date('c',strtotime($event->date_begin)),
|
||||
'end' => date('c',strtotime($event->date_end)),
|
||||
'color' => $color,
|
||||
'extraParams' => [
|
||||
'db_type' => 'event'],
|
||||
'id' => $event->id
|
||||
];
|
||||
array_push($jsonevents,$myevent);
|
||||
}
|
||||
|
||||
return json_encode($jsonevents);
|
||||
}
|
||||
|
||||
public function loadModal($id,$db_type)
|
||||
{
|
||||
if($db_type == "event")
|
||||
{
|
||||
$event = \App\Event::find($id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$event = \App\Schedule::find($id);
|
||||
}
|
||||
return view('public.modal.schedule',['event' => $event]);
|
||||
}
|
||||
|
||||
public function loadModalFull($id,$db_type)
|
||||
{
|
||||
if($db_type == "event")
|
||||
{
|
||||
$event = \App\Event::find($id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$event = \App\Schedule::find($id);
|
||||
}
|
||||
return view('admin.schedule.modal.show',['event' => $event]);
|
||||
}
|
||||
|
||||
public function getColor($type)
|
||||
{
|
||||
$activity = \App\ComplementaryActivity::all();
|
||||
$color = 'blue';
|
||||
switch ($type) {
|
||||
case 'regular':
|
||||
$color = 'orange';
|
||||
break;
|
||||
|
||||
case 'pilotage':
|
||||
$color = '#58D3F7';
|
||||
break;
|
||||
|
||||
case 'drill':
|
||||
$color = 'blue';
|
||||
break;
|
||||
|
||||
case 'music':
|
||||
$color = 'green';
|
||||
break;
|
||||
|
||||
case 'biathlon':
|
||||
$color = 'red';
|
||||
break;
|
||||
|
||||
case 'marksmanship':
|
||||
$color = 'grey';
|
||||
break;
|
||||
|
||||
case 'founding':
|
||||
$color = '#00FF40';
|
||||
break;
|
||||
|
||||
case 'volunteer':
|
||||
$color = '#DF0174';
|
||||
break;
|
||||
|
||||
case 'other':
|
||||
$color = '#DF0174';
|
||||
break;
|
||||
|
||||
default:
|
||||
if ($activity->find($type)) {
|
||||
$color = $activity->find($type)->calendar_color;
|
||||
}
|
||||
break;
|
||||
};
|
||||
return $color;
|
||||
}
|
||||
|
||||
public function printtopdf($id)
|
||||
{
|
||||
$event = \App\Event::find($id);
|
||||
$pdf = PDF::loadView('admin.schedule.modal.show',['event' => $event]);
|
||||
return $pdf->download($event->date_begin.'.pdf');
|
||||
}
|
||||
|
||||
public function create($date)
|
||||
{
|
||||
$date = str_replace('/','-',$date);
|
||||
return view('admin.schedule.event.add',['date' => $date]);
|
||||
}
|
||||
|
||||
public function loadModalDefautType($type,$date)
|
||||
{
|
||||
|
||||
$activity = \App\ComplementaryActivity::find($type);
|
||||
$begin_time = $date." ".$activity->begin_time;
|
||||
$end_time = $date." ".$activity->end_time;
|
||||
return view('admin.schedule.modal.add',[
|
||||
'activity' => \App\ComplementaryActivity::find($type),
|
||||
'begin_time' => $begin_time,
|
||||
'end_time' => $end_time
|
||||
]);
|
||||
}
|
||||
|
||||
public function delete($id)
|
||||
{
|
||||
$event = \App\Event::find($id);
|
||||
|
||||
$event->delete();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ namespace App\Http\Controllers;
|
||||
use Illuminate\Http\Request;
|
||||
use App\User;
|
||||
|
||||
use function GuzzleHttp\json_encode;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
/**
|
||||
@@ -165,4 +167,99 @@ class UserController extends Controller
|
||||
|
||||
$user->delete();
|
||||
}
|
||||
|
||||
public function notificationmark($id)
|
||||
{
|
||||
$notification = \Auth::User()->unreadNotifications->where('id',$id)->first();
|
||||
|
||||
$notification->delete();
|
||||
return redirect(request('url'));
|
||||
}
|
||||
|
||||
public function notificationmarkALL()
|
||||
{
|
||||
$notifications = \Auth::User()->unreadNotifications;
|
||||
foreach($notifications as $notification)
|
||||
{
|
||||
$notification->delete();
|
||||
}
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
public function notificationmarkECC($id)
|
||||
{
|
||||
$notification = \Auth::User()->unreadNotifications->where('id',$id)->first();
|
||||
|
||||
$notification->delete();
|
||||
return redirect('/ecc');
|
||||
}
|
||||
|
||||
public function showUserProfil($id = 0)
|
||||
{
|
||||
if ($id == 0) {
|
||||
$id = \Auth::User()->id;
|
||||
}
|
||||
return view('admin.user.profil',['user' => \App\User::find($id)]);
|
||||
}
|
||||
|
||||
public function editUserAvatar($id)
|
||||
{
|
||||
$user = \Auth::User();
|
||||
|
||||
$user->avatar = $id;
|
||||
|
||||
$user->save();
|
||||
|
||||
return back()->with('success', 'Votre avatar a été mis à jour !');
|
||||
}
|
||||
|
||||
public function UserAvatar()
|
||||
{
|
||||
return view('admin.user.profil.avatar');
|
||||
}
|
||||
|
||||
public function UserPassword()
|
||||
{
|
||||
return view('admin.user.profil.password');
|
||||
}
|
||||
|
||||
public function editUserPassword()
|
||||
{
|
||||
$user = \Auth::User();
|
||||
|
||||
$user->password = bcrypt(request('psw'));
|
||||
|
||||
$user->save();
|
||||
|
||||
return back()->with('success', 'Modification enregistré');
|
||||
}
|
||||
|
||||
public function UserAdress()
|
||||
{
|
||||
return view('admin.user.profil.adress');
|
||||
}
|
||||
|
||||
public function editUserAdress()
|
||||
{
|
||||
$user = \Auth::user();
|
||||
|
||||
$user->adress = request('adress');
|
||||
|
||||
$user->save();
|
||||
|
||||
return back()->with('success', 'Modification enregistré');
|
||||
}
|
||||
|
||||
public function apiList()
|
||||
{
|
||||
$users = \App\User::all();
|
||||
|
||||
$name = [];
|
||||
|
||||
foreach ($users as $user) {
|
||||
array_push($name, $user->fullname());
|
||||
}
|
||||
|
||||
return json_encode($name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
function getStatus()
|
||||
{
|
||||
$client = new GuzzleHttp\Client();
|
||||
$incidents = $client->get('https://status.exvps.ca/api/v1/incidents');
|
||||
|
||||
$isBroken = false;
|
||||
|
||||
$incidents_decode = json_decode($incidents->getBody(),true);
|
||||
|
||||
foreach ($incidents_decode['data'] as $incident) {
|
||||
if (!$incident['is_resolved']) {
|
||||
$isBroken = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $isBroken;
|
||||
}
|
||||
@@ -6,5 +6,20 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Item extends Model
|
||||
{
|
||||
//
|
||||
public static function explodeItems($items)
|
||||
{
|
||||
$array_items = explode("-",$items);
|
||||
$col_items = collect();
|
||||
|
||||
foreach ($array_items as $item) {
|
||||
$col_items->push(Item::find($item));
|
||||
}
|
||||
$col_items->forget(0);
|
||||
return $col_items;
|
||||
}
|
||||
|
||||
public function bookings()
|
||||
{
|
||||
return $this->hasMany('App\Booking');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class News extends Model
|
||||
{
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\User');
|
||||
}
|
||||
|
||||
public function pictures()
|
||||
{
|
||||
return $this->morphMany('App\Picture', 'pictureable');
|
||||
}
|
||||
}
|
||||
@@ -19,10 +19,11 @@ class Alert extends Notification
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($user,$msg)
|
||||
public function __construct($user,$msg,$url)
|
||||
{
|
||||
$this->myNotification = $msg;
|
||||
$this->fromUser = $user;
|
||||
$this->myUrl = $url;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,6 +48,7 @@ class Alert extends Notification
|
||||
return [
|
||||
'from' => $this->fromUser,
|
||||
'msg' => $this->myNotification,
|
||||
'url' => $this->myUrl,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Picture extends Model
|
||||
{
|
||||
public function pictureable()
|
||||
{
|
||||
return $this->morphTo();
|
||||
}
|
||||
}
|
||||
@@ -13,8 +13,10 @@ class Schedule extends Model
|
||||
|
||||
public function getInventory($periode)
|
||||
{
|
||||
$dispo = [];
|
||||
$used = [];
|
||||
$dispo_id = [];
|
||||
$dispo_qt = [];
|
||||
$used_id = [];
|
||||
$used_qt = [];
|
||||
$dispo_item = collect();
|
||||
|
||||
$string_periode = 'p'.$periode;
|
||||
@@ -22,36 +24,142 @@ class Schedule extends Model
|
||||
$inventory = Item::all();
|
||||
|
||||
foreach ($inventory as $item) {
|
||||
array_push($dispo, $item->id);
|
||||
array_push($dispo_id, $item->id);
|
||||
array_push($dispo_qt, $item->quantity);
|
||||
}
|
||||
|
||||
$n1 = 'n1_'.$string_periode.'_item';
|
||||
$items_array = explode("-",$this->$n1);
|
||||
|
||||
foreach ($items_array as $item_array) {
|
||||
array_push($used,$item_array);
|
||||
if ($items_array[0] == "") {
|
||||
unset($items_array[0]);
|
||||
}
|
||||
$items_array = array_values($items_array);
|
||||
if ($items_array != "") {
|
||||
foreach ($items_array as $item_array) {
|
||||
$items_for = explode(":",$item_array);
|
||||
array_push($used_id,$items_for[0]);
|
||||
array_push($used_qt,$items_for[1]);
|
||||
}
|
||||
}
|
||||
|
||||
$n2 = 'n2_'.$string_periode.'_item';
|
||||
$items_array = explode("-",$this->$n2);
|
||||
if ($items_array[0] == "") {
|
||||
unset($items_array[0]);
|
||||
}
|
||||
$items_array = array_values($items_array);
|
||||
|
||||
foreach ($items_array as $item_array) {
|
||||
array_push($used,$item_array);
|
||||
if ($items_array != "") {
|
||||
foreach ($items_array as $item_array) {
|
||||
$items_for = explode(":",$item_array);
|
||||
array_push($used_id,$items_for[0]);
|
||||
array_push($used_qt,$items_for[1]);
|
||||
}
|
||||
}
|
||||
|
||||
$n3 = 'n3_'.$string_periode.'_item';
|
||||
$items_array = explode("-",$this->$n3);
|
||||
|
||||
foreach ($items_array as $item_array) {
|
||||
array_push($used,$item_array);
|
||||
if ($items_array[0] == "") {
|
||||
unset($items_array[0]);
|
||||
}
|
||||
$items_array = array_values($items_array);
|
||||
if ($items_array != "") {
|
||||
foreach ($items_array as $item_array) {
|
||||
$items_for = explode(":",$item_array);
|
||||
array_push($used_id,$items_for[0]);
|
||||
array_push($used_qt,$items_for[1]);
|
||||
}
|
||||
}
|
||||
|
||||
$dispo = array_diff($dispo,$used);
|
||||
|
||||
foreach ($dispo as $key) {
|
||||
$dispo_item->push(Item::find($key));
|
||||
for ($i=0; $i < count($used_id); $i++) {
|
||||
for ($e=0; $e < count($dispo_id); $e++) {
|
||||
if (isset($dispo_id[0])) {
|
||||
if ($used_id[$i] == $dispo_id[$e]) {
|
||||
$dispo_qt[$e] = $dispo_qt[$e] - $used_qt[$i];
|
||||
if ($dispo_qt[$e] < 1) {
|
||||
unset($dispo_id[$e]);
|
||||
unset($dispo_qt[$e]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$dispo_id = array_values($dispo_id);
|
||||
$dispo_qt = array_values($dispo_qt);
|
||||
for ($i=0; $i < count($dispo_id); $i++) {
|
||||
$this_item = Item::find($dispo_id[$i]);
|
||||
$this_item->quantity = $dispo_qt[$i];
|
||||
$dispo_item->push($this_item);
|
||||
}
|
||||
|
||||
return $dispo_item;
|
||||
}
|
||||
|
||||
public function getUserToNotify($priority = 0)
|
||||
{
|
||||
$users = \App\User::all();
|
||||
|
||||
if($priority == 0)
|
||||
{
|
||||
$userToNotify = collect();
|
||||
foreach ($users as $user) {
|
||||
if ($user->getPerm('schedule_notify')) {
|
||||
$userToNotify->push($user);
|
||||
}
|
||||
}
|
||||
|
||||
return $userToNotify;
|
||||
} else if ($priority == 1)
|
||||
{
|
||||
return $users;
|
||||
}
|
||||
}
|
||||
|
||||
public static function checkForWarning()
|
||||
{
|
||||
$schedule = Schedule::all();
|
||||
$warning = collect();
|
||||
$today = date('U');
|
||||
|
||||
foreach ($schedule as $activity) {
|
||||
|
||||
if ($activity->type == "regular") {
|
||||
|
||||
$time = date('U',strtotime($activity->date));
|
||||
if ($time >= $today) {
|
||||
for ($niv=1; $niv <= 3; $niv++) {
|
||||
for ($pe=1; $pe <= 2; $pe++) {
|
||||
|
||||
/** Check name */
|
||||
if ($activity->data['n'.$niv."_p".$pe."_name"] == "") {
|
||||
$warning->push(['warning' => 'Il doit y avoir un nom pour le cours', 'niveau' => $niv, 'periode' => $pe,'date' => $activity->date]);
|
||||
}
|
||||
|
||||
/** Check OCOM */
|
||||
if ($activity->data['n'.$niv."_p".$pe."_ocom"] == "") {
|
||||
$warning->push(['warning' => "Il doit y avoir un OCOM pour le cours", 'niveau' => $niv, 'periode' => $pe,'date' => $activity->date]);
|
||||
} else {
|
||||
$regex = '/[MC]['.$niv.']\d\d.\d\d/';
|
||||
if (preg_match($regex,trim($activity->data['n'.$niv."_p".$pe."_ocom"])) == 0 && $activity->data['n'.$niv."_p".$pe."_ocom"] != "S.O") {
|
||||
$warning->push(['warning' => "L'OCOM du cours de semble pas être valide", 'niveau' => $niv, 'periode' => $activity->data['n'.$niv."_p".$pe."_ocom"],'date' => $activity->date]);
|
||||
}
|
||||
}
|
||||
|
||||
/** Check Instructor */
|
||||
if ($activity->data['n'.$niv."_p".$pe."_instructor"] == "") {
|
||||
$warning->push(['warning' => "Il doit y avoir un instructeur pour le cours", 'niveau' => $niv, 'periode' => $pe,'date' => $activity->date]);
|
||||
}
|
||||
|
||||
/** Check local */
|
||||
if ($activity->data['n'.$niv."_p".$pe."_local"] == "") {
|
||||
$warning->push(['warning' => "Il doit y avoir un local pour le cours", 'niveau' => $niv, 'periode' => $pe,'date' => $activity->date]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $warning;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,21 @@ class User extends Authenticatable
|
||||
return $this->hasMany(Message::class);
|
||||
}
|
||||
|
||||
public function events()
|
||||
{
|
||||
return $this->hasMany('App\Event');
|
||||
}
|
||||
|
||||
public function bookings()
|
||||
{
|
||||
return $this->hasMany('App\Booking');
|
||||
}
|
||||
|
||||
public function courses()
|
||||
{
|
||||
return $this->hasMany('App\Course');
|
||||
}
|
||||
|
||||
public function routeNotificationForNexmo($notification)
|
||||
{
|
||||
return $this->telephone;
|
||||
@@ -65,13 +80,13 @@ class User extends Authenticatable
|
||||
$user_perm_value = $this->$perm;
|
||||
|
||||
if ($user_perm_value == 1 ) {
|
||||
$perm_value = 1;
|
||||
$perm_value = true;
|
||||
} else if ($job_perm_value== 1) {
|
||||
$perm_value = 1;
|
||||
$perm_value = true;
|
||||
} else if ($rank_perm_value == 1) {
|
||||
$perm_value = 1;
|
||||
$perm_value = true;
|
||||
} else {
|
||||
$perm_value = 0;
|
||||
$perm_value = false;
|
||||
}
|
||||
|
||||
return $perm_value;
|
||||
@@ -97,4 +112,171 @@ class User extends Authenticatable
|
||||
}
|
||||
return $perm_value;
|
||||
}
|
||||
|
||||
public function getClasse()
|
||||
{
|
||||
$schedules = Schedule::all()->where('type','regular')->sortBy('date');
|
||||
$currentUser = \Auth::User();
|
||||
|
||||
$filtered_schedule = collect();
|
||||
$user_classes = collect();
|
||||
|
||||
foreach ($schedules as $day) {
|
||||
if ($day->date >= date('Y-m-d')) {
|
||||
$filtered_schedule->push($day);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($filtered_schedule as $schedule) {
|
||||
if ($schedule->data['n1_p1_instructor'] == $currentUser->id) {
|
||||
$user_classes->push(collect([
|
||||
'date' => $schedule->date,
|
||||
'periode' => '1',
|
||||
'niveau' => '1',
|
||||
'name' => $schedule->data['n1_p1_name'],
|
||||
'ocom' => $schedule->data['n1_p1_ocom'],
|
||||
'local' => $schedule->data['n1_p1_local'],
|
||||
'plan_done' => $schedule->data['n1_p1_plandone'],
|
||||
'material' => $schedule->n1_p1_item,
|
||||
]));
|
||||
}
|
||||
|
||||
if ($schedule->data['n1_p2_instructor'] == $currentUser->id) {
|
||||
$user_classes->push(collect([
|
||||
'date' => $schedule->date,
|
||||
'periode' => '2',
|
||||
'niveau' => '1',
|
||||
'name' => $schedule->data['n1_p2_name'],
|
||||
'ocom' => $schedule->data['n1_p2_ocom'],
|
||||
'local' => $schedule->data['n1_p2_local'],
|
||||
'plan_done' => $schedule->data['n1_p2_plandone'],
|
||||
'material' => $schedule->n1_p2_item,
|
||||
]));
|
||||
}
|
||||
|
||||
if ($schedule->data['n2_p1_instructor'] == $currentUser->id) {
|
||||
$user_classes->push(collect([
|
||||
'date' => $schedule->date,
|
||||
'periode' => '1',
|
||||
'niveau' => '2',
|
||||
'name' => $schedule->data['n2_p1_name'],
|
||||
'ocom' => $schedule->data['n2_p1_ocom'],
|
||||
'local' => $schedule->data['n2_p1_local'],
|
||||
'plan_done' => $schedule->data['n2_p1_plandone'],
|
||||
'material' => $schedule->n2_p1_item,
|
||||
]));
|
||||
}
|
||||
|
||||
if ($schedule->data['n2_p2_instructor'] == $currentUser->id) {
|
||||
$user_classes->push(collect([
|
||||
'date' => $schedule->date,
|
||||
'periode' => '2',
|
||||
'niveau' => '2',
|
||||
'name' => $schedule->data['n2_p2_name'],
|
||||
'ocom' => $schedule->data['n2_p2_ocom'],
|
||||
'local' => $schedule->data['n2_p2_local'],
|
||||
'plan_done' => $schedule->data['n2_p2_plandone'],
|
||||
'material' => $schedule->n2_p2_item,
|
||||
]));
|
||||
}
|
||||
|
||||
if ($schedule->data['n3_p1_instructor'] == $currentUser->id) {
|
||||
$user_classes->push(collect([
|
||||
'date' => $schedule->date,
|
||||
'periode' => '1',
|
||||
'niveau' => '3',
|
||||
'name' => $schedule->data['n3_p1_name'],
|
||||
'ocom' => $schedule->data['n3_p1_ocom'],
|
||||
'local' => $schedule->data['n3_p1_local'],
|
||||
'plan_done' => $schedule->data['n3_p1_plandone'],
|
||||
'material' => $schedule->n3_p1_item,
|
||||
]));
|
||||
}
|
||||
|
||||
if ($schedule->data['n3_p2_instructor'] == $currentUser->id) {
|
||||
$user_classes->push(collect([
|
||||
'date' => $schedule->date,
|
||||
'periode' => '2',
|
||||
'niveau' => '3',
|
||||
'name' => $schedule->data['n3_p2_name'],
|
||||
'ocom' => $schedule->data['n3_p2_ocom'],
|
||||
'local' => $schedule->data['n3_p2_local'],
|
||||
'plan_done' => $schedule->data['n3_p2_plandone'],
|
||||
'material' => $schedule->n3_p2_item,
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
||||
return $user_classes;
|
||||
}
|
||||
|
||||
public function countActivity()
|
||||
{
|
||||
return count(\App\Log::all()->where('user_id',$this->id));
|
||||
}
|
||||
|
||||
public function countClasse()
|
||||
{
|
||||
$nbClasse = 0;
|
||||
|
||||
$schedules = Schedule::all()->where('type','regular')->sortBy('date');
|
||||
|
||||
$filtered_schedule = collect();
|
||||
|
||||
foreach ($schedules as $day) {
|
||||
if ($day->date >= date('Y-m-d')) {
|
||||
$filtered_schedule->push($day);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($filtered_schedule as $schedule) {
|
||||
if ($schedule->data['n1_p1_instructor'] == $this->id) {
|
||||
$nbClasse = ++$nbClasse;
|
||||
}
|
||||
if ($schedule->data['n1_p2_instructor'] == $this->id) {
|
||||
$nbClasse = ++$nbClasse;
|
||||
}
|
||||
if ($schedule->data['n2_p1_instructor'] == $this->id) {
|
||||
$nbClasse = ++$nbClasse;
|
||||
}
|
||||
if ($schedule->data['n2_p2_instructor'] == $this->id) {
|
||||
$nbClasse = ++$nbClasse;
|
||||
}
|
||||
if ($schedule->data['n3_p1_instructor'] == $this->id) {
|
||||
$nbClasse = ++$nbClasse;
|
||||
}
|
||||
if ($schedule->data['n3_p2_instructor'] == $this->id) {
|
||||
$nbClasse = ++$nbClasse;
|
||||
}
|
||||
}
|
||||
return $nbClasse;
|
||||
}
|
||||
|
||||
public function seenMessage($id)
|
||||
{
|
||||
$this_msg = Message::find($id);
|
||||
|
||||
if(isset($this_msg->data['as_seen']))
|
||||
{
|
||||
$as_seen = explode("-",$this_msg->data['as_seen']);
|
||||
if (array_search(strval($this->id),$as_seen) === false) {
|
||||
array_push($as_seen,$this->id);
|
||||
}
|
||||
$as_seen = array_filter($as_seen);
|
||||
$as_seen_str = implode('-',$as_seen);
|
||||
$data = [
|
||||
'as_seen' => $as_seen_str,
|
||||
'parameter' => $this_msg->data['parameter']
|
||||
];
|
||||
|
||||
$this_msg->data = $data;
|
||||
|
||||
$this_msg->save();
|
||||
}
|
||||
}
|
||||
|
||||
public function news()
|
||||
{
|
||||
return $this->hasMany('App\News');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
"type": "project",
|
||||
"require": {
|
||||
"php": "^7.1.3",
|
||||
"barryvdh/laravel-dompdf": "^0.8.4",
|
||||
"barryvdh/laravel-ide-helper": "v2.6.2",
|
||||
"fideloper/proxy": "^4.0",
|
||||
"guzzlehttp/guzzle": "^6.3",
|
||||
"laravel/framework": "5.6.*",
|
||||
@@ -26,7 +28,8 @@
|
||||
],
|
||||
"psr-4": {
|
||||
"App\\": "app/"
|
||||
}
|
||||
},
|
||||
"files": ["app/Http/helpers.php"]
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
|
||||
@@ -158,9 +158,12 @@ return [
|
||||
Illuminate\Validation\ValidationServiceProvider::class,
|
||||
Illuminate\View\ViewServiceProvider::class,
|
||||
|
||||
|
||||
/*
|
||||
* Package Service Providers...
|
||||
*/
|
||||
Barryvdh\DomPDF\ServiceProvider::class,
|
||||
'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider',
|
||||
|
||||
/*
|
||||
* Application Service Providers...
|
||||
@@ -219,6 +222,7 @@ return [
|
||||
'URL' => Illuminate\Support\Facades\URL::class,
|
||||
'Validator' => Illuminate\Support\Facades\Validator::class,
|
||||
'View' => Illuminate\Support\Facades\View::class,
|
||||
'PDF' => Barryvdh\DomPDF\Facade::class,
|
||||
|
||||
],
|
||||
|
||||
|
||||
@@ -56,8 +56,8 @@ return [
|
||||
*/
|
||||
|
||||
'from' => [
|
||||
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
|
||||
'name' => env('MAIL_FROM_NAME', 'Example'),
|
||||
'address' => 'noreply@c-cms.cf',
|
||||
'name' => 'C-CMS',
|
||||
],
|
||||
|
||||
/*
|
||||
|
||||
@@ -42,7 +42,7 @@ class CreateUsersTable extends Migration
|
||||
$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_random(60));
|
||||
$table->string('api_token', 60)->unique()->default(str_shuffle(str_random(60)));
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
@@ -15,6 +15,7 @@ class CreateItemsTable extends Migration
|
||||
{
|
||||
Schema::create('items', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('quantity');
|
||||
$table->string('name');
|
||||
$table->string('desc');
|
||||
$table->timestamps();
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateNewsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('news', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('title');
|
||||
$table->text('body');
|
||||
$table->integer('user_id');
|
||||
$table->boolean('publish');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('news');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateComplementaryActivitiesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('complementary_activities', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name');
|
||||
$table->text('public_body');
|
||||
$table->text('public_slogan');
|
||||
$table->string('public_header_picture');
|
||||
$table->text('admin_desc');
|
||||
$table->string('calendar_color')->default('blue');
|
||||
$table->string('calendar_icon')->default('<i class="fa fa-question-circle"></i>');
|
||||
$table->string('begin_time')->default('12:00');
|
||||
$table->string('end_time')->default('13:00');
|
||||
$table->string('location')->default('Escadron');
|
||||
$table->boolean('is_mandatory')->default(false);
|
||||
$table->boolean('is_promoted')->default(false);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('complementary_activities');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreatePicturesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('pictures', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('url');
|
||||
$table->string('title');
|
||||
$table->text('desc');
|
||||
$table->integer('pictureable_id');
|
||||
$table->string('pictureable_type');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('pictures');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateEventsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('events', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name');
|
||||
$table->string('date_begin');
|
||||
$table->string('date_end');
|
||||
$table->string('type');
|
||||
$table->string('user_id');
|
||||
$table->string('location');
|
||||
$table->boolean('is_mandatory');
|
||||
$table->text('desc');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('events');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCoursesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('courses', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name');
|
||||
$table->string('ocom');
|
||||
$table->integer('periode');
|
||||
$table->integer('level');
|
||||
$table->string('location');
|
||||
$table->text('comment');
|
||||
$table->integer('event_id');
|
||||
$table->integer('user_id');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('courses');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateBookingsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('bookings', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('item_id');
|
||||
$table->integer('amount');
|
||||
$table->integer('bookable_id');
|
||||
$table->string('bookable_type');
|
||||
$table->integer('user_id');
|
||||
$table->text('comment');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('bookings');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ComplementaryActivitiesSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
DB::table('complementary_activities')->insert([
|
||||
[
|
||||
'name' => 'Soirée d\'instruction régulière',
|
||||
'calendar_color' => 'orange',
|
||||
'calendar_icon' => '<i class="fas fa-book"></i>',
|
||||
'begin_time' => '18:30',
|
||||
'end_time' => '21:45',
|
||||
'Location' => 'Escadron',
|
||||
'public_body' => 'Veuillez modifier le text de description publique par défaut',
|
||||
'public_slogan' => 'Veuillez modifier le slogan publique par défaut',
|
||||
'public_header_picture' => './assets/img/bg2.jpg',
|
||||
'admin_desc' => 'Veuillez modifier la description admin par défaut',
|
||||
],
|
||||
[
|
||||
'name' => 'Congé',
|
||||
'calendar_color' => 'red',
|
||||
'calendar_icon' => '<i class="fa fa-times"></i>',
|
||||
'begin_time' => '00:01',
|
||||
'end_time' => '23:59',
|
||||
'Location' => 'Escadron',
|
||||
'public_body' => 'Veuillez modifier le text de description publique par défaut',
|
||||
'public_slogan' => 'Veuillez modifier le slogan publique par défaut',
|
||||
'public_header_picture' => './assets/img/bg2.jpg',
|
||||
'admin_desc' => 'Veuillez modifier la description admin par défaut',
|
||||
],
|
||||
[
|
||||
'name' => 'Financement',
|
||||
'calendar_color' => 'light-green',
|
||||
'calendar_icon' => '<i class="fa fa-usd"></i>',
|
||||
'begin_time' => '00:01',
|
||||
'end_time' => '23:59',
|
||||
'Location' => 'Escadron',
|
||||
'public_body' => 'Veuillez modifier le text de description publique par défaut',
|
||||
'public_slogan' => 'Veuillez modifier le slogan publique par défaut',
|
||||
'public_header_picture' => './assets/img/bg2.jpg',
|
||||
'admin_desc' => 'Veuillez modifier la description admin par défaut',
|
||||
],
|
||||
[
|
||||
'name' => 'Bénévolat',
|
||||
'calendar_color' => 'green',
|
||||
'calendar_icon' => '<i class="fa fa-handshake-o "></i>',
|
||||
'begin_time' => '00:01',
|
||||
'end_time' => '23:59',
|
||||
'Location' => 'Escadron',
|
||||
'public_body' => 'Veuillez modifier le text de description publique par défaut',
|
||||
'public_slogan' => 'Veuillez modifier le slogan publique par défaut',
|
||||
'public_header_picture' => './assets/img/bg2.jpg',
|
||||
'admin_desc' => 'Veuillez modifier la description admin par défaut',
|
||||
],
|
||||
[
|
||||
'name' => 'Autre',
|
||||
'calendar_color' => 'purple',
|
||||
'calendar_icon' => '<i class="fa fa-circle "></i>',
|
||||
'begin_time' => '00:01',
|
||||
'end_time' => '23:59',
|
||||
'Location' => 'Escadron',
|
||||
'public_body' => 'Veuillez modifier le text de description publique par défaut',
|
||||
'public_slogan' => 'Veuillez modifier le slogan publique par défaut',
|
||||
'public_header_picture' => './assets/img/bg2.jpg',
|
||||
'admin_desc' => 'Veuillez modifier la description admin par défaut',
|
||||
],
|
||||
[
|
||||
'name' => 'Précidrill',
|
||||
'calendar_color' => 'blue',
|
||||
'calendar_icon' => '<i class="fa fa-trophy"></i>',
|
||||
'begin_time' => '19:00',
|
||||
'end_time' => '21:00',
|
||||
'Location' => 'Escadron',
|
||||
'public_body' => 'Veuillez modifier le text de description publique par défaut',
|
||||
'public_slogan' => 'Veuillez modifier le slogan publique par défaut',
|
||||
'public_header_picture' => './assets/img/bg2.jpg',
|
||||
'admin_desc' => 'Veuillez modifier la description admin par défaut',
|
||||
],
|
||||
[
|
||||
'name' => 'Musique',
|
||||
'calendar_color' => 'gold',
|
||||
'calendar_icon' => '<i class="fa fa-music"></i>',
|
||||
'begin_time' => '19:00',
|
||||
'end_time' => '21:00',
|
||||
'Location' => 'Escadron',
|
||||
'public_body' => 'Veuillez modifier le text de description publique par défaut',
|
||||
'public_slogan' => 'Veuillez modifier le slogan publique par défaut',
|
||||
'public_header_picture' => './assets/img/bg2.jpg',
|
||||
'admin_desc' => 'Veuillez modifier la description admin par défaut',
|
||||
],
|
||||
[
|
||||
'name' => 'Tir de précision',
|
||||
'calendar_color' => 'grey',
|
||||
'calendar_icon' => '<i class="fa fa-bullseye"></i>',
|
||||
'begin_time' => '19:00',
|
||||
'end_time' => '21:00',
|
||||
'Location' => 'Escadron',
|
||||
'public_body' => 'Veuillez modifier le text de description publique par défaut',
|
||||
'public_slogan' => 'Veuillez modifier le slogan publique par défaut',
|
||||
'public_header_picture' => './assets/img/bg2.jpg',
|
||||
'admin_desc' => 'Veuillez modifier la description admin par défaut',
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -11,12 +11,238 @@ class ConfigsTableSeeder extends Seeder
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
DB::table('configs')->insert([
|
||||
$configs = [
|
||||
[
|
||||
'name' => 'is_schedule_public',
|
||||
'state' => 0,
|
||||
'data' => 'null'
|
||||
'data' => '["true"]'
|
||||
],
|
||||
[
|
||||
'name' => 'is_schedule_build',
|
||||
'state' => 0,
|
||||
'data' => '["false"]'
|
||||
],
|
||||
[
|
||||
'name' => 'text_public_banner_cadet_desc',
|
||||
'state' => 0,
|
||||
'data' => '["Les cadets de l\'air s\'adressent aux jeunes de 12 à 18 ans qui désirent vivre des expériences enrichissantes et relever de nouveaux défis, en participant à des activités stimulantes dans un cadre dynamique et chaleureux."]'
|
||||
],
|
||||
[
|
||||
'name' => 'text_public_banner_apprendre_plus',
|
||||
'state' => 0,
|
||||
'data' => '["En apprendre plus!"]'
|
||||
],
|
||||
[
|
||||
'name' => 'text_public_intro_title',
|
||||
'state' => 0,
|
||||
'data' => '["L\'escadron c\'est ..."]'
|
||||
],
|
||||
[
|
||||
'name' => 'text_public_intro_desc',
|
||||
'state' => 0,
|
||||
'data' => '["De nombreuses activités hebdomadaires dont : les soirées du vendredi, les soirées de musique (fanfare), l\'entrainement au tir, une équipe de biathlon, des cours de pilotage et plus encore !"]'
|
||||
],
|
||||
[
|
||||
'name' => 'text_public_picture_title',
|
||||
'state' => 0,
|
||||
'data' => '["Photos"]'
|
||||
],
|
||||
[
|
||||
'name' => 'text_public_picture_desc',
|
||||
'state' => 0,
|
||||
'data' => '["Voici quelques photos de nos activités, même s\'il est mieux d\'y participer réellement!"]'
|
||||
],
|
||||
[
|
||||
'name' => 'text_public_news_title',
|
||||
'state' => 0,
|
||||
'data' => '["Nouvelles"]'
|
||||
],
|
||||
[
|
||||
'name' => 'text_public_news_desc',
|
||||
'state' => 0,
|
||||
'data' => '["Retrouver ici les dernieres nouvelles de l\'escadron"]'
|
||||
],
|
||||
[
|
||||
'name' => 'text_public_news_button',
|
||||
'state' => 0,
|
||||
'data' => '["Voir toutes les nouvelles!"]'
|
||||
],
|
||||
[
|
||||
'name' => 'text_public_schedule_desc',
|
||||
'state' => 0,
|
||||
'data' => '["Voici les activitées à venir !"]'
|
||||
],
|
||||
[
|
||||
'name' => 'text_public_schedule_title',
|
||||
'state' => 0,
|
||||
'data' => '["Calendrier"]'
|
||||
],
|
||||
[
|
||||
'name' => 'text_public_picture_nb',
|
||||
'state' => 0,
|
||||
'data' => '["6"]'
|
||||
],
|
||||
[
|
||||
'name' => 'text_public_cta',
|
||||
'state' => 0,
|
||||
'data' => '["Êtes-vous prêt à en faire partie ?"]'
|
||||
],
|
||||
[
|
||||
'name' => 'media_facebook',
|
||||
'state' => 0,
|
||||
'data' => '["https://www.facebook.com/"]'
|
||||
],
|
||||
[
|
||||
'name' => 'media_twitter',
|
||||
'state' => 0,
|
||||
'data' => '["https://twitter.com"]'
|
||||
],
|
||||
[
|
||||
'name' => 'media_instagram',
|
||||
'state' => 0,
|
||||
'data' => '["https://www.instagram.com"]'
|
||||
],
|
||||
[
|
||||
'name' => 'media_email',
|
||||
'state' => 0,
|
||||
'data' => '["exemple@email.com"]'
|
||||
],
|
||||
[
|
||||
'name' => 'escadron_address',
|
||||
'state' => 0,
|
||||
'data' => '["000 Rue Exemple, Québec, Canada"]'
|
||||
],
|
||||
[
|
||||
'name' => 'escadron_name_full',
|
||||
'state' => 0,
|
||||
'data' => '["Escadron 000 Exemple"]'
|
||||
],
|
||||
[
|
||||
'name' => 'escadron_name_short',
|
||||
'state' => 0,
|
||||
'data' => '["Escadron 000"]'
|
||||
],
|
||||
[
|
||||
'name' => 'escadron_number',
|
||||
'state' => 0,
|
||||
'data' => '["000"]'
|
||||
],
|
||||
[
|
||||
'name' => 'escadron_element',
|
||||
'state' => 0,
|
||||
'data' => '["Aviation"]'
|
||||
],
|
||||
[
|
||||
'name' => 'element_title',
|
||||
'state' => 0,
|
||||
'data' => '["Cadet de l\'aviation royale du Canada"]'
|
||||
],
|
||||
[
|
||||
'name' => 'escadron_direct_googlemap_link',
|
||||
'state' => 0,
|
||||
'data' => '["https://goo.gl/maps/iLwGZLwWXujwoAg59"]'
|
||||
],
|
||||
[
|
||||
'name' => 'escadron_phone',
|
||||
'state' => 0,
|
||||
'data' => '["(418) 722-7712"]'
|
||||
],
|
||||
[
|
||||
'name' => 'nb_activity_public',
|
||||
'state' => 0,
|
||||
'data' => '["3"]'
|
||||
],
|
||||
[
|
||||
'name' => 'file_GP_Niv_1',
|
||||
'state' => 0,
|
||||
'data' => '["https://drive.google.com/uc?export=download&id=1tZhDqCvMor9p6lXxYek7Q0Xc8c2o5pG7"]'
|
||||
],
|
||||
[
|
||||
'name' => 'file_GQ_Niv_1',
|
||||
'state' => 0,
|
||||
'data' => '["https://drive.google.com/uc?export=download&id=1MK6Lgr_qgP8vwBIiTyIveQu9p2rh1mXj"]'
|
||||
],
|
||||
[
|
||||
'name' => 'file_GP_Niv_2',
|
||||
'state' => 0,
|
||||
'data' => '["https://drive.google.com/uc?export=download&id=1oLTavI1AQsXMdhZ4QqEkbecfV4j1LKDx"]'
|
||||
],
|
||||
[
|
||||
'name' => 'file_GQ_Niv_2',
|
||||
'state' => 0,
|
||||
'data' => '["https://drive.google.com/uc?export=download&id=1YzIqyVEfCiGVEI_hKB-ZHt0pAgh-QRxe"]'
|
||||
],
|
||||
[
|
||||
'name' => 'file_GP_Niv_3',
|
||||
'state' => 0,
|
||||
'data' => '["https://drive.google.com/uc?export=download&id=1FrczHmiGCeONlHCuuxHNx-BZ-qEfEBK8"]'
|
||||
],
|
||||
[
|
||||
'name' => 'file_GQ_Niv_3',
|
||||
'state' => 0,
|
||||
'data' => '["https://drive.google.com/uc?export=download&id=1S-NFjqlixzC9GNZSqZ1_PqBDFcm-LS1t"]'
|
||||
],
|
||||
[
|
||||
'name' => 'file_GP_Niv_4',
|
||||
'state' => 0,
|
||||
'data' => '["https://drive.google.com/uc?export=download&id=1EeibjlytdzEpRdzs-eg0pGL8TBv_ZCsu]'
|
||||
],
|
||||
[
|
||||
'name' => 'file_GQ_Niv_4',
|
||||
'state' => 0,
|
||||
'data' => '["https://drive.google.com/uc?export=download&id=1VmVL4wb6llIc09HkWfzL8YOQYo3ygx86"]'
|
||||
],
|
||||
[
|
||||
'name' => 'file_empty_lesson_plan',
|
||||
'state' => 0,
|
||||
'data' => '["https://drive.google.com/uc?export=download&id=1i1a0sjI8I3nzt4mlcLvznjqYF-12JgfQ"]'
|
||||
],
|
||||
[
|
||||
'name' => 'admin_periode_begin',
|
||||
'state' => 0,
|
||||
'data' => '["1" => "19:10","2" => "20:30"]'
|
||||
],
|
||||
[
|
||||
'name' => 'admin_periode_end',
|
||||
'state' => 0,
|
||||
'data' => '["1" => "20:10","2" => "21:20"]'
|
||||
],
|
||||
[
|
||||
'name' => 'admin_periode_nb',
|
||||
'state' => 0,
|
||||
'data' => '["2"]'
|
||||
],
|
||||
[
|
||||
'name' => 'admin_level_in_schedule_nb',
|
||||
'state' => 0,
|
||||
'data' => '["3"]'
|
||||
],
|
||||
[
|
||||
'name' => 'public_index_img_url',
|
||||
'state' => 0,
|
||||
'data' => '["./assets/img/bg2.jpg"]'
|
||||
]
|
||||
]);
|
||||
];
|
||||
|
||||
$actualConfigs = \App\Config::all();
|
||||
|
||||
$configToAdd = [];
|
||||
|
||||
foreach ($configs as $config) {
|
||||
$found = false;
|
||||
foreach ($actualConfigs as $actualConfig) {
|
||||
if ($actualConfig->name == $config['name']) {
|
||||
$found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found) {
|
||||
array_push($configToAdd, $config);
|
||||
}
|
||||
}
|
||||
|
||||
if ($configToAdd != []) {
|
||||
DB::table('configs')->insert($configToAdd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,9 @@ class DatabaseSeeder extends Seeder
|
||||
$this->call([
|
||||
JobsTableSeeder::class,
|
||||
RanksTableSeeder::class,
|
||||
ConfigsTableSeeder::class
|
||||
ConfigsTableSeeder::class,
|
||||
UsersTableSeeder::class,
|
||||
ComplementaryActivitiesSeeder::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,33 @@ class UsersTableSeeder extends Seeder
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
//
|
||||
DB::table('users')->insert([
|
||||
[
|
||||
'firstname' => 'visiteur',
|
||||
'lastname' => 'Autre',
|
||||
'email' => 'visiteur@exvps.ca',
|
||||
'password' => bcrypt('f329er8kl2jHJGHdEj12567'),
|
||||
'rank' => '1',
|
||||
'adress' => 'Inconnu',
|
||||
'age' => '99',
|
||||
'avatar' => '3',
|
||||
'sexe' => 'm',
|
||||
'job' => '1',
|
||||
'api_token' => str_shuffle(str_random(60)),
|
||||
],
|
||||
[
|
||||
'firstname' => 'Administrateur',
|
||||
'lastname' => 'Administrateur',
|
||||
'email' => 'admin@exvps.ca',
|
||||
'password' => bcrypt('SuperAdmin'),
|
||||
'rank' => '1',
|
||||
'adress' => 'Inconnu',
|
||||
'age' => '99',
|
||||
'avatar' => '3',
|
||||
'sexe' => 'm',
|
||||
'job' => '1',
|
||||
'api_token' => str_shuffle(str_random(60)),
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
</filter>
|
||||
<php>
|
||||
<env name="APP_ENV" value="testing"/>
|
||||
<env name="APP_KEY" value="base64:FQH+yWnhFyB+2gpByIg2Rybmqn5EXkL7VeFawzSJ/Lc="/>
|
||||
<env name="BCRYPT_ROUNDS" value="4"/>
|
||||
<env name="CACHE_DRIVER" value="array"/>
|
||||
<env name="SESSION_DRIVER" value="array"/>
|
||||
|
||||
@@ -2238,84 +2238,3 @@ header .form-inline {
|
||||
padding: 5px; } }
|
||||
|
||||
/*# sourceMappingURL=style.css.map */
|
||||
|
||||
.calendar{
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
.calendar-body-column {
|
||||
display: flex;
|
||||
}
|
||||
.calendar-container{
|
||||
width: 14%;
|
||||
height: 7.5rem;
|
||||
text-align: center;
|
||||
vertical-align: middle !important;
|
||||
border: solid 1px #d9d9d9 !important;
|
||||
padding: 0px !important;
|
||||
display: flex;
|
||||
}
|
||||
.calendar-date{
|
||||
float: left;
|
||||
margin-left: 1rem;
|
||||
}
|
||||
.calendar-text{
|
||||
float: right;
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
.calendar-text > div {
|
||||
text-align:start;
|
||||
}
|
||||
@media only screen and (max-width: 800px) {
|
||||
.calendar-container{
|
||||
width: 100%;
|
||||
}
|
||||
.calendar-head{
|
||||
display: none;
|
||||
}
|
||||
.calendar-empty{
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.btn-calendar{
|
||||
padding: 36px 0;
|
||||
height: 7.5rem;
|
||||
margin: 0px;
|
||||
}
|
||||
.btn-calendar:hover{
|
||||
background-color: #f2f2f26e;
|
||||
}
|
||||
.thead-dark {
|
||||
color: #fff;
|
||||
background-color: #212529;
|
||||
border-color: #32383e;
|
||||
text-align: center;
|
||||
}
|
||||
.loader{
|
||||
text-align: center;
|
||||
}
|
||||
.loader-bg{
|
||||
width: 70px;
|
||||
margin-top: 50px;
|
||||
margin-bottom: 50px;
|
||||
}
|
||||
.loader-spinner {
|
||||
position: absolute;
|
||||
border: 16px solid #f3f3f3;
|
||||
border-top: 16px solid #272c33;
|
||||
border-radius: 50%;
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
animation: spin 2s linear infinite;
|
||||
left: 0px;
|
||||
right: 0px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
top: 44px;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
.calendar-head{
|
||||
display: flex;
|
||||
text-align: center;
|
||||
margin: auto;
|
||||
}
|
||||
.calendar-container{
|
||||
display: table-cell;;
|
||||
width: 14%;
|
||||
height: 12rem;
|
||||
box-shadow:
|
||||
2px 0 0 0 #e6e6e6,
|
||||
0 2px 0 0 #e6e6e6,
|
||||
2px 2px 0 0 #e6e6e6, /* Just to fix the corner */
|
||||
2px 0 0 0 #e6e6e6 inset,
|
||||
0 2px 0 0 #e6e6e6 inset;
|
||||
}
|
||||
.calendar-row{
|
||||
display: flex;
|
||||
}
|
||||
.calendar-body{
|
||||
margin:auto;
|
||||
}
|
||||
.calendar-date{
|
||||
margin-left: 2rem;
|
||||
margin-top: 0.8rem;
|
||||
}
|
||||
.calendar-text{
|
||||
margin-left: 2rem;
|
||||
}
|
||||
.calendar_event_name{
|
||||
display: flex;
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
@media (min-width: 992px){
|
||||
.typo-line{
|
||||
padding-left: 140px;
|
||||
margin-bottom: 40px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.typo-line .category{
|
||||
transform: translateY(-50%);
|
||||
top: 50%;
|
||||
left: 0px;
|
||||
position: absolute;
|
||||
}
|
||||
}
|
||||
|
||||
.icon-section {
|
||||
margin: 0 0 3em;
|
||||
clear: both;
|
||||
overflow: hidden;
|
||||
}
|
||||
.icon-container {
|
||||
width: 240px;
|
||||
padding: .7em 0;
|
||||
float: left;
|
||||
position: relative;
|
||||
text-align: left;
|
||||
}
|
||||
.icon-container [class^="ti-"],
|
||||
.icon-container [class*=" ti-"] {
|
||||
color: #000;
|
||||
position: absolute;
|
||||
margin-top: 3px;
|
||||
transition: .3s;
|
||||
}
|
||||
.icon-container:hover [class^="ti-"],
|
||||
.icon-container:hover [class*=" ti-"] {
|
||||
font-size: 2.2em;
|
||||
margin-top: -5px;
|
||||
}
|
||||
.icon-container:hover .icon-name {
|
||||
color: #000;
|
||||
}
|
||||
.icon-name {
|
||||
color: #aaa;
|
||||
margin-left: 35px;
|
||||
font-size: .8em;
|
||||
transition: .3s;
|
||||
}
|
||||
.icon-container:hover .icon-name {
|
||||
margin-left: 45px;
|
||||
}
|
||||
|
||||
.places-buttons .btn{
|
||||
margin-bottom: 30px
|
||||
}
|
||||
.sidebar .nav > li.active-pro{
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
bottom: 10px;
|
||||
}
|
||||
.sidebar .nav > li.active-pro a{
|
||||
background: rgba(255, 255, 255, 0.14);
|
||||
opacity: 1;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.table-upgrade td:nth-child(2),
|
||||
.table-upgrade td:nth-child(3){
|
||||
text-align: center;
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
@import url(font-awesome.min.css);
|
||||
|
||||
/*
|
||||
Massively by HTML5 UP
|
||||
html5up.net | @ajlkn
|
||||
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
|
||||
*/
|
||||
|
||||
/* Wrapper */
|
||||
|
||||
#wrapper {
|
||||
background-color: #212931;
|
||||
background-image: url("../../images/overlay.png"), linear-gradient(0deg, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1)), url("../../images/bg.jpg");
|
||||
background-size: auto, auto, 100% auto;
|
||||
background-position: center, center, top center;
|
||||
background-repeat: repeat, no-repeat, no-repeat;
|
||||
background-attachment: fixed, fixed, fixed;
|
||||
}
|
||||
|
||||
#wrapper.fade-in:before {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Intro */
|
||||
|
||||
body.is-preload #intro {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
body.is-preload #intro:not(.hidden) + #header + #nav {
|
||||
-moz-transform: none;
|
||||
-webkit-transform: none;
|
||||
-ms-transform: none;
|
||||
transform: none;
|
||||
opacity: 1;
|
||||
}
|
||||
|
Before Width: | Height: | Size: 434 KiB |
|
After Width: | Height: | Size: 229 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 55 KiB |
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
@@ -0,0 +1,248 @@
|
||||
!function ($) {
|
||||
|
||||
/* CHECKBOX PUBLIC CLASS DEFINITION
|
||||
* ============================== */
|
||||
|
||||
var Checkbox = function (element, options) {
|
||||
this.init(element, options);
|
||||
}
|
||||
|
||||
Checkbox.prototype = {
|
||||
|
||||
constructor: Checkbox
|
||||
|
||||
, init: function (element, options) {
|
||||
var $el = this.$element = $(element)
|
||||
|
||||
this.options = $.extend({}, $.fn.checkbox.defaults, options);
|
||||
$el.before(this.options.template);
|
||||
this.setState();
|
||||
}
|
||||
|
||||
, setState: function () {
|
||||
var $el = this.$element
|
||||
, $parent = $el.closest('.checkbox');
|
||||
|
||||
$el.prop('disabled') && $parent.addClass('disabled');
|
||||
$el.prop('checked') && $parent.addClass('checked');
|
||||
}
|
||||
|
||||
, toggle: function () {
|
||||
var ch = 'checked'
|
||||
, $el = this.$element
|
||||
, $parent = $el.closest('.checkbox')
|
||||
, checked = $el.prop(ch)
|
||||
, e = $.Event('toggle')
|
||||
|
||||
if ($el.prop('disabled') == false) {
|
||||
$parent.toggleClass(ch) && checked ? $el.removeAttr(ch) : $el.prop(ch, ch);
|
||||
$el.trigger(e).trigger('change');
|
||||
}
|
||||
}
|
||||
|
||||
, setCheck: function (option) {
|
||||
var d = 'disabled'
|
||||
, ch = 'checked'
|
||||
, $el = this.$element
|
||||
, $parent = $el.closest('.checkbox')
|
||||
, checkAction = option == 'check' ? true : false
|
||||
, e = $.Event(option)
|
||||
|
||||
$parent[checkAction ? 'addClass' : 'removeClass' ](ch) && checkAction ? $el.prop(ch, ch) : $el.removeAttr(ch);
|
||||
$el.trigger(e).trigger('change');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* CHECKBOX PLUGIN DEFINITION
|
||||
* ======================== */
|
||||
|
||||
var old = $.fn.checkbox
|
||||
|
||||
$.fn.checkbox = function (option) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
, data = $this.data('checkbox')
|
||||
, options = $.extend({}, $.fn.checkbox.defaults, $this.data(), typeof option == 'object' && option);
|
||||
if (!data) $this.data('checkbox', (data = new Checkbox(this, options)));
|
||||
if (option == 'toggle') data.toggle()
|
||||
if (option == 'check' || option == 'uncheck') data.setCheck(option)
|
||||
else if (option) data.setState();
|
||||
});
|
||||
}
|
||||
|
||||
$.fn.checkbox.defaults = {
|
||||
template: '<span class="icons"><span class="first-icon fa fa-square fa-base"></span><span class="second-icon fa fa-check-square fa-base"></span></span>'
|
||||
}
|
||||
|
||||
|
||||
/* CHECKBOX NO CONFLICT
|
||||
* ================== */
|
||||
|
||||
$.fn.checkbox.noConflict = function () {
|
||||
$.fn.checkbox = old;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/* CHECKBOX DATA-API
|
||||
* =============== */
|
||||
|
||||
$(document).on('click.checkbox.data-api', '[data-toggle^=checkbox], .checkbox', function (e) {
|
||||
var $checkbox = $(e.target);
|
||||
if (e.target.tagName != "A") {
|
||||
e && e.preventDefault() && e.stopPropagation();
|
||||
if (!$checkbox.hasClass('checkbox')) $checkbox = $checkbox.closest('.checkbox');
|
||||
$checkbox.find(':checkbox').checkbox('toggle');
|
||||
}
|
||||
});
|
||||
|
||||
$(function () {
|
||||
$('input[type="checkbox"]').each(function () {
|
||||
var $checkbox = $(this);
|
||||
$checkbox.checkbox();
|
||||
});
|
||||
});
|
||||
|
||||
}(window.jQuery);
|
||||
|
||||
/* =============================================================
|
||||
* flatui-radio v0.0.3
|
||||
* ============================================================ */
|
||||
|
||||
!function ($) {
|
||||
|
||||
/* RADIO PUBLIC CLASS DEFINITION
|
||||
* ============================== */
|
||||
|
||||
var Radio = function (element, options) {
|
||||
this.init(element, options);
|
||||
}
|
||||
|
||||
Radio.prototype = {
|
||||
|
||||
constructor: Radio
|
||||
|
||||
, init: function (element, options) {
|
||||
var $el = this.$element = $(element)
|
||||
|
||||
this.options = $.extend({}, $.fn.radio.defaults, options);
|
||||
$el.before(this.options.template);
|
||||
this.setState();
|
||||
}
|
||||
|
||||
, setState: function () {
|
||||
var $el = this.$element
|
||||
, $parent = $el.closest('.radio');
|
||||
|
||||
$el.prop('disabled') && $parent.addClass('disabled');
|
||||
$el.prop('checked') && $parent.addClass('checked');
|
||||
}
|
||||
|
||||
, toggle: function () {
|
||||
var d = 'disabled'
|
||||
, ch = 'checked'
|
||||
, $el = this.$element
|
||||
, checked = $el.prop(ch)
|
||||
, $parent = $el.closest('.radio')
|
||||
, $parentWrap = $el.closest('form').length ? $el.closest('form') : $el.closest('body')
|
||||
, $elemGroup = $parentWrap.find(':radio[name="' + $el.attr('name') + '"]')
|
||||
, e = $.Event('toggle')
|
||||
|
||||
if ($el.prop(d) == false) {
|
||||
$elemGroup.not($el).each(function () {
|
||||
var $el = $(this)
|
||||
, $parent = $(this).closest('.radio');
|
||||
|
||||
if ($el.prop(d) == false) {
|
||||
$parent.removeClass(ch) && $el.removeAttr(ch).trigger('change');
|
||||
}
|
||||
});
|
||||
|
||||
if (checked == false) $parent.addClass(ch) && $el.prop(ch, true);
|
||||
$el.trigger(e);
|
||||
|
||||
if (checked !== $el.prop(ch)) {
|
||||
$el.trigger('change');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
, setCheck: function (option) {
|
||||
var ch = 'checked'
|
||||
, $el = this.$element
|
||||
, $parent = $el.closest('.radio')
|
||||
, checkAction = option == 'check' ? true : false
|
||||
, checked = $el.prop(ch)
|
||||
, $parentWrap = $el.closest('form').length ? $el.closest('form') : $el.closest('body')
|
||||
, $elemGroup = $parentWrap.find(':radio[name="' + $el['attr']('name') + '"]')
|
||||
, e = $.Event(option)
|
||||
|
||||
$elemGroup.not($el).each(function () {
|
||||
var $el = $(this)
|
||||
, $parent = $(this).closest('.radio');
|
||||
|
||||
$parent.removeClass(ch) && $el.removeAttr(ch);
|
||||
});
|
||||
|
||||
$parent[checkAction ? 'addClass' : 'removeClass'](ch) && checkAction ? $el.prop(ch, ch) : $el.removeAttr(ch);
|
||||
$el.trigger(e);
|
||||
|
||||
if (checked !== $el.prop(ch)) {
|
||||
$el.trigger('change');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* RADIO PLUGIN DEFINITION
|
||||
* ======================== */
|
||||
|
||||
var old = $.fn.radio
|
||||
|
||||
$.fn.radio = function (option) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
, data = $this.data('radio')
|
||||
, options = $.extend({}, $.fn.radio.defaults, $this.data(), typeof option == 'object' && option);
|
||||
if (!data) $this.data('radio', (data = new Radio(this, options)));
|
||||
if (option == 'toggle') data.toggle()
|
||||
if (option == 'check' || option == 'uncheck') data.setCheck(option)
|
||||
else if (option) data.setState();
|
||||
});
|
||||
}
|
||||
|
||||
$.fn.radio.defaults = {
|
||||
template: '<span class="icons"><span class="first-icon fa fa-circle-o fa-base"></span><span class="second-icon fa fa-dot-circle-o fa-base"></span></span>'
|
||||
}
|
||||
|
||||
|
||||
/* RADIO NO CONFLICT
|
||||
* ================== */
|
||||
|
||||
$.fn.radio.noConflict = function () {
|
||||
$.fn.radio = old;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/* RADIO DATA-API
|
||||
* =============== */
|
||||
|
||||
$(document).on('click.radio.data-api', '[data-toggle^=radio], .radio', function (e) {
|
||||
var $radio = $(e.target);
|
||||
e && e.preventDefault() && e.stopPropagation();
|
||||
if (!$radio.hasClass('radio')) $radio = $radio.closest('.radio');
|
||||
$radio.find(':radio').radio('toggle');
|
||||
});
|
||||
|
||||
$(function () {
|
||||
$('input[type="radio"]').each(function () {
|
||||
var $radio = $(this);
|
||||
$radio.radio();
|
||||
});
|
||||
});
|
||||
|
||||
}(window.jQuery);
|
||||
@@ -0,0 +1,404 @@
|
||||
/*
|
||||
|
||||
|
||||
|
||||
Creative Tim Modifications
|
||||
|
||||
Lines: 239, 240 was changed from top: 5px to top: 50% and we added margin-top: -13px. In this way the close button will be aligned vertically
|
||||
Line:242 - modified when the icon is set, we add the class "alert-with-icon", so there will be enough space for the icon.
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Project: Bootstrap Notify = v3.1.5
|
||||
* Description: Turns standard Bootstrap alerts into "Growl-like" notifications.
|
||||
* Author: Mouse0270 aka Robert McIntosh
|
||||
* License: MIT License
|
||||
* Website: https://github.com/mouse0270/bootstrap-growl
|
||||
*/
|
||||
|
||||
/* global define:false, require: false, jQuery:false */
|
||||
|
||||
(function (factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['jquery'], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node/CommonJS
|
||||
factory(require('jquery'));
|
||||
} else {
|
||||
// Browser globals
|
||||
factory(jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
// Create the defaults once
|
||||
var defaults = {
|
||||
element: 'body',
|
||||
position: null,
|
||||
type: "info",
|
||||
allow_dismiss: true,
|
||||
allow_duplicates: true,
|
||||
newest_on_top: false,
|
||||
showProgressbar: false,
|
||||
placement: {
|
||||
from: "top",
|
||||
align: "right"
|
||||
},
|
||||
offset: 20,
|
||||
spacing: 10,
|
||||
z_index: 1031,
|
||||
delay: 5000,
|
||||
timer: 1000,
|
||||
url_target: '_blank',
|
||||
mouse_over: null,
|
||||
animate: {
|
||||
enter: 'animated fadeInDown',
|
||||
exit: 'animated fadeOutUp'
|
||||
},
|
||||
onShow: null,
|
||||
onShown: null,
|
||||
onClose: null,
|
||||
onClosed: null,
|
||||
icon_type: 'class',
|
||||
template: '<div data-notify="container" class="col-xs-11 col-sm-4 alert alert-{0}" role="alert"><button type="button" aria-hidden="true" class="close" data-notify="dismiss">×</button><span data-notify="icon"></span> <span data-notify="title">{1}</span> <span data-notify="message">{2}</span><div class="progress" data-notify="progressbar"><div class="progress-bar progress-bar-{0}" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div></div><a href="{3}" target="{4}" data-notify="url"></a></div>'
|
||||
};
|
||||
|
||||
String.format = function () {
|
||||
var str = arguments[0];
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
str = str.replace(RegExp("\\{" + (i - 1) + "\\}", "gm"), arguments[i]);
|
||||
}
|
||||
return str;
|
||||
};
|
||||
|
||||
function isDuplicateNotification(notification) {
|
||||
var isDupe = false;
|
||||
|
||||
$('[data-notify="container"]').each(function (i, el) {
|
||||
var $el = $(el);
|
||||
var title = $el.find('[data-notify="title"]').text().trim();
|
||||
var message = $el.find('[data-notify="message"]').html().trim();
|
||||
|
||||
// The input string might be different than the actual parsed HTML string!
|
||||
// (<br> vs <br /> for example)
|
||||
// So we have to force-parse this as HTML here!
|
||||
var isSameTitle = title === $("<div>" + notification.settings.content.title + "</div>").html().trim();
|
||||
var isSameMsg = message === $("<div>" + notification.settings.content.message + "</div>").html().trim();
|
||||
var isSameType = $el.hasClass('alert-' + notification.settings.type);
|
||||
|
||||
if (isSameTitle && isSameMsg && isSameType) {
|
||||
//we found the dupe. Set the var and stop checking.
|
||||
isDupe = true;
|
||||
}
|
||||
return !isDupe;
|
||||
});
|
||||
|
||||
return isDupe;
|
||||
}
|
||||
|
||||
function Notify(element, content, options) {
|
||||
// Setup Content of Notify
|
||||
var contentObj = {
|
||||
content: {
|
||||
message: typeof content === 'object' ? content.message : content,
|
||||
title: content.title ? content.title : '',
|
||||
icon: content.icon ? content.icon : '',
|
||||
url: content.url ? content.url : '#',
|
||||
target: content.target ? content.target : '-'
|
||||
}
|
||||
};
|
||||
|
||||
options = $.extend(true, {}, contentObj, options);
|
||||
this.settings = $.extend(true, {}, defaults, options);
|
||||
this._defaults = defaults;
|
||||
if (this.settings.content.target === "-") {
|
||||
this.settings.content.target = this.settings.url_target;
|
||||
}
|
||||
this.animations = {
|
||||
start: 'webkitAnimationStart oanimationstart MSAnimationStart animationstart',
|
||||
end: 'webkitAnimationEnd oanimationend MSAnimationEnd animationend'
|
||||
};
|
||||
|
||||
if (typeof this.settings.offset === 'number') {
|
||||
this.settings.offset = {
|
||||
x: this.settings.offset,
|
||||
y: this.settings.offset
|
||||
};
|
||||
}
|
||||
|
||||
//if duplicate messages are not allowed, then only continue if this new message is not a duplicate of one that it already showing
|
||||
if (this.settings.allow_duplicates || (!this.settings.allow_duplicates && !isDuplicateNotification(this))) {
|
||||
this.init();
|
||||
}
|
||||
}
|
||||
|
||||
$.extend(Notify.prototype, {
|
||||
init: function () {
|
||||
var self = this;
|
||||
|
||||
this.buildNotify();
|
||||
if (this.settings.content.icon) {
|
||||
this.setIcon();
|
||||
}
|
||||
if (this.settings.content.url != "#") {
|
||||
this.styleURL();
|
||||
}
|
||||
this.styleDismiss();
|
||||
this.placement();
|
||||
this.bind();
|
||||
|
||||
this.notify = {
|
||||
$ele: this.$ele,
|
||||
update: function (command, update) {
|
||||
var commands = {};
|
||||
if (typeof command === "string") {
|
||||
commands[command] = update;
|
||||
} else {
|
||||
commands = command;
|
||||
}
|
||||
for (var cmd in commands) {
|
||||
switch (cmd) {
|
||||
case "type":
|
||||
this.$ele.removeClass('alert-' + self.settings.type);
|
||||
this.$ele.find('[data-notify="progressbar"] > .progress-bar').removeClass('progress-bar-' + self.settings.type);
|
||||
self.settings.type = commands[cmd];
|
||||
this.$ele.addClass('alert-' + commands[cmd]).find('[data-notify="progressbar"] > .progress-bar').addClass('progress-bar-' + commands[cmd]);
|
||||
break;
|
||||
case "icon":
|
||||
var $icon = this.$ele.find('[data-notify="icon"]');
|
||||
if (self.settings.icon_type.toLowerCase() === 'class') {
|
||||
$icon.removeClass(self.settings.content.icon).addClass(commands[cmd]);
|
||||
} else {
|
||||
if (!$icon.is('img')) {
|
||||
$icon.find('img');
|
||||
}
|
||||
$icon.attr('src', commands[cmd]);
|
||||
}
|
||||
break;
|
||||
case "progress":
|
||||
var newDelay = self.settings.delay - (self.settings.delay * (commands[cmd] / 100));
|
||||
this.$ele.data('notify-delay', newDelay);
|
||||
this.$ele.find('[data-notify="progressbar"] > div').attr('aria-valuenow', commands[cmd]).css('width', commands[cmd] + '%');
|
||||
break;
|
||||
case "url":
|
||||
this.$ele.find('[data-notify="url"]').attr('href', commands[cmd]);
|
||||
break;
|
||||
case "target":
|
||||
this.$ele.find('[data-notify="url"]').attr('target', commands[cmd]);
|
||||
break;
|
||||
default:
|
||||
this.$ele.find('[data-notify="' + cmd + '"]').html(commands[cmd]);
|
||||
}
|
||||
}
|
||||
var posX = this.$ele.outerHeight() + parseInt(self.settings.spacing) + parseInt(self.settings.offset.y);
|
||||
self.reposition(posX);
|
||||
},
|
||||
close: function () {
|
||||
self.close();
|
||||
}
|
||||
};
|
||||
|
||||
},
|
||||
buildNotify: function () {
|
||||
var content = this.settings.content;
|
||||
this.$ele = $(String.format(this.settings.template, this.settings.type, content.title, content.message, content.url, content.target));
|
||||
this.$ele.attr('data-notify-position', this.settings.placement.from + '-' + this.settings.placement.align);
|
||||
if (!this.settings.allow_dismiss) {
|
||||
this.$ele.find('[data-notify="dismiss"]').css('display', 'none');
|
||||
}
|
||||
if ((this.settings.delay <= 0 && !this.settings.showProgressbar) || !this.settings.showProgressbar) {
|
||||
this.$ele.find('[data-notify="progressbar"]').remove();
|
||||
}
|
||||
},
|
||||
setIcon: function () {
|
||||
|
||||
this.$ele.addClass('alert-with-icon');
|
||||
|
||||
if (this.settings.icon_type.toLowerCase() === 'class') {
|
||||
this.$ele.find('[data-notify="icon"]').addClass(this.settings.content.icon);
|
||||
} else {
|
||||
if (this.$ele.find('[data-notify="icon"]').is('img')) {
|
||||
this.$ele.find('[data-notify="icon"]').attr('src', this.settings.content.icon);
|
||||
} else {
|
||||
this.$ele.find('[data-notify="icon"]').append('<img src="' + this.settings.content.icon + '" alt="Notify Icon" />');
|
||||
}
|
||||
}
|
||||
},
|
||||
styleDismiss: function () {
|
||||
this.$ele.find('[data-notify="dismiss"]').css({
|
||||
position: 'absolute',
|
||||
right: '10px',
|
||||
top: '50%',
|
||||
marginTop: '-13px',
|
||||
zIndex: this.settings.z_index + 2
|
||||
});
|
||||
},
|
||||
styleURL: function () {
|
||||
this.$ele.find('[data-notify="url"]').css({
|
||||
backgroundImage: 'url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)',
|
||||
height: '100%',
|
||||
left: 0,
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
width: '100%',
|
||||
zIndex: this.settings.z_index + 1
|
||||
});
|
||||
},
|
||||
placement: function () {
|
||||
var self = this,
|
||||
offsetAmt = this.settings.offset.y,
|
||||
css = {
|
||||
display: 'inline-block',
|
||||
margin: '0px auto',
|
||||
position: this.settings.position ? this.settings.position : (this.settings.element === 'body' ? 'fixed' : 'absolute'),
|
||||
transition: 'all .5s ease-in-out',
|
||||
zIndex: this.settings.z_index
|
||||
},
|
||||
hasAnimation = false,
|
||||
settings = this.settings;
|
||||
|
||||
$('[data-notify-position="' + this.settings.placement.from + '-' + this.settings.placement.align + '"]:not([data-closing="true"])').each(function () {
|
||||
offsetAmt = Math.max(offsetAmt, parseInt($(this).css(settings.placement.from)) + parseInt($(this).outerHeight()) + parseInt(settings.spacing));
|
||||
});
|
||||
if (this.settings.newest_on_top === true) {
|
||||
offsetAmt = this.settings.offset.y;
|
||||
}
|
||||
css[this.settings.placement.from] = offsetAmt + 'px';
|
||||
|
||||
switch (this.settings.placement.align) {
|
||||
case "left":
|
||||
case "right":
|
||||
css[this.settings.placement.align] = this.settings.offset.x + 'px';
|
||||
break;
|
||||
case "center":
|
||||
css.left = 0;
|
||||
css.right = 0;
|
||||
break;
|
||||
}
|
||||
this.$ele.css(css).addClass(this.settings.animate.enter);
|
||||
$.each(Array('webkit-', 'moz-', 'o-', 'ms-', ''), function (index, prefix) {
|
||||
self.$ele[0].style[prefix + 'AnimationIterationCount'] = 1;
|
||||
});
|
||||
|
||||
$(this.settings.element).append(this.$ele);
|
||||
|
||||
if (this.settings.newest_on_top === true) {
|
||||
offsetAmt = (parseInt(offsetAmt) + parseInt(this.settings.spacing)) + this.$ele.outerHeight();
|
||||
this.reposition(offsetAmt);
|
||||
}
|
||||
|
||||
if ($.isFunction(self.settings.onShow)) {
|
||||
self.settings.onShow.call(this.$ele);
|
||||
}
|
||||
|
||||
this.$ele.one(this.animations.start, function () {
|
||||
hasAnimation = true;
|
||||
}).one(this.animations.end, function () {
|
||||
if ($.isFunction(self.settings.onShown)) {
|
||||
self.settings.onShown.call(this);
|
||||
}
|
||||
});
|
||||
|
||||
setTimeout(function () {
|
||||
if (!hasAnimation) {
|
||||
if ($.isFunction(self.settings.onShown)) {
|
||||
self.settings.onShown.call(this);
|
||||
}
|
||||
}
|
||||
}, 600);
|
||||
},
|
||||
bind: function () {
|
||||
var self = this;
|
||||
|
||||
this.$ele.find('[data-notify="dismiss"]').on('click', function () {
|
||||
self.close();
|
||||
});
|
||||
|
||||
this.$ele.mouseover(function () {
|
||||
$(this).data('data-hover', "true");
|
||||
}).mouseout(function () {
|
||||
$(this).data('data-hover', "false");
|
||||
});
|
||||
this.$ele.data('data-hover', "false");
|
||||
|
||||
if (this.settings.delay > 0) {
|
||||
self.$ele.data('notify-delay', self.settings.delay);
|
||||
var timer = setInterval(function () {
|
||||
var delay = parseInt(self.$ele.data('notify-delay')) - self.settings.timer;
|
||||
if ((self.$ele.data('data-hover') === 'false' && self.settings.mouse_over === "pause") || self.settings.mouse_over != "pause") {
|
||||
var percent = ((self.settings.delay - delay) / self.settings.delay) * 100;
|
||||
self.$ele.data('notify-delay', delay);
|
||||
self.$ele.find('[data-notify="progressbar"] > div').attr('aria-valuenow', percent).css('width', percent + '%');
|
||||
}
|
||||
if (delay <= -(self.settings.timer)) {
|
||||
clearInterval(timer);
|
||||
self.close();
|
||||
}
|
||||
}, self.settings.timer);
|
||||
}
|
||||
},
|
||||
close: function () {
|
||||
var self = this,
|
||||
posX = parseInt(this.$ele.css(this.settings.placement.from)),
|
||||
hasAnimation = false;
|
||||
|
||||
this.$ele.data('closing', 'true').addClass(this.settings.animate.exit);
|
||||
self.reposition(posX);
|
||||
|
||||
if ($.isFunction(self.settings.onClose)) {
|
||||
self.settings.onClose.call(this.$ele);
|
||||
}
|
||||
|
||||
this.$ele.one(this.animations.start, function () {
|
||||
hasAnimation = true;
|
||||
}).one(this.animations.end, function () {
|
||||
$(this).remove();
|
||||
if ($.isFunction(self.settings.onClosed)) {
|
||||
self.settings.onClosed.call(this);
|
||||
}
|
||||
});
|
||||
|
||||
setTimeout(function () {
|
||||
if (!hasAnimation) {
|
||||
self.$ele.remove();
|
||||
if (self.settings.onClosed) {
|
||||
self.settings.onClosed(self.$ele);
|
||||
}
|
||||
}
|
||||
}, 600);
|
||||
},
|
||||
reposition: function (posX) {
|
||||
var self = this,
|
||||
notifies = '[data-notify-position="' + this.settings.placement.from + '-' + this.settings.placement.align + '"]:not([data-closing="true"])',
|
||||
$elements = this.$ele.nextAll(notifies);
|
||||
if (this.settings.newest_on_top === true) {
|
||||
$elements = this.$ele.prevAll(notifies);
|
||||
}
|
||||
$elements.each(function () {
|
||||
$(this).css(self.settings.placement.from, posX);
|
||||
posX = (parseInt(posX) + parseInt(self.settings.spacing)) + $(this).outerHeight();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$.notify = function (content, options) {
|
||||
var plugin = new Notify(this, content, options);
|
||||
return plugin.notify;
|
||||
};
|
||||
$.notifyDefaults = function (options) {
|
||||
defaults = $.extend(true, {}, defaults, options);
|
||||
return defaults;
|
||||
};
|
||||
$.notifyClose = function (command) {
|
||||
if (typeof command === "undefined" || command === "all") {
|
||||
$('[data-notify]').find('[data-notify="dismiss"]').trigger('click');
|
||||
} else {
|
||||
$('[data-notify-position="' + command + '"]').find('[data-notify="dismiss"]').trigger('click');
|
||||
}
|
||||
};
|
||||
|
||||
}));
|
||||