Compare commits
88 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 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,54 @@
|
||||
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
|
||||
@@ -0,0 +1,87 @@
|
||||
/** 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,92 @@
|
||||
@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;
|
||||
@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
|
||||
|
||||
@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
|
||||
@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
|
||||
@endtask
|
||||
@@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2015 phpDocumentor
|
||||
Copyright (c) 2018 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
|
||||
@@ -19,4 +19,3 @@ 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,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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,23 @@ class AdminController extends Controller
|
||||
{
|
||||
Log::saveLog('Affichage du tableau de bord');
|
||||
|
||||
return view('admin.dashboard');
|
||||
$futureEvent_to_filtered = \App\Schedule::all()->sortBy('date');
|
||||
$futureEvent_to_filtered_pass_1 = collect();
|
||||
$futureEvent = collect();
|
||||
|
||||
foreach ($futureEvent_to_filtered as $day) {
|
||||
if ($day->date >= date('Y-m-d')) {
|
||||
$futureEvent_to_filtered_pass_1->push($day);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($futureEvent_to_filtered_pass_1 as $day) {
|
||||
if ($day->date <= date('Y-m-d',strtotime("+2 week"))) {
|
||||
$futureEvent->push($day);
|
||||
}
|
||||
}
|
||||
|
||||
return view('admin.dashboard',['futureEvent' => $futureEvent,'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.
|
||||
|
||||
@@ -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>";
|
||||
@@ -191,9 +192,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>'
|
||||
);
|
||||
@@ -445,8 +443,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 +459,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 +521,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 +697,44 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
<?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('public.activity');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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\ComplementaryActivity $complementaryActivity
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(ComplementaryActivity $complementaryActivity)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\ComplementaryActivity $complementaryActivity
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(ComplementaryActivity $complementaryActivity)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\ComplementaryActivity $complementaryActivity
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, ComplementaryActivity $complementaryActivity)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\ComplementaryActivity $complementaryActivity
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(ComplementaryActivity $complementaryActivity)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ class ConfigController extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
return view ('admin.configs.general',['configs' => Config::all()]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,9 +67,19 @@ class ConfigController extends Controller
|
||||
* @param \App\Config $config
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, Config $config)
|
||||
public function update()
|
||||
{
|
||||
//
|
||||
$config = Config::all()->where('name',request('perm'))->first();
|
||||
|
||||
if (request('value') == "true") {
|
||||
$config->state = 1;
|
||||
} else {
|
||||
$config->state = 0;
|
||||
}
|
||||
|
||||
$config->save();
|
||||
|
||||
\App\Log::saveLog('Modification de la configuration du site');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use DummyRootNamespaceHttp\Controllers\Controller;
|
||||
|
||||
class DummyClass extends Controller
|
||||
class FilesController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
@@ -14,7 +13,7 @@ class DummyClass extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
return view('admin.files.index');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,4 +81,9 @@ class DummyClass extends Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -70,7 +84,7 @@ class InventoryController extends Controller
|
||||
$schedule->$periode_item = $final_items;
|
||||
|
||||
$schedule->save();
|
||||
|
||||
|
||||
return redirect('/admin/inventory/'.$id.'/'.$periode.'/'.$niveau);
|
||||
}
|
||||
|
||||
@@ -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)]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\News;
|
||||
use Illuminate\Http\Request;
|
||||
use DummyRootNamespaceHttp\Controllers\Controller;
|
||||
|
||||
class DummyClass extends Controller
|
||||
class NewsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
@@ -13,6 +13,16 @@ class DummyClass extends Controller
|
||||
* @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()
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -31,10 +41,21 @@ class DummyClass extends Controller
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @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)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -43,10 +64,10 @@ class DummyClass extends Controller
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @param \App\News $news
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
public function update(Request $request, News $news)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -54,10 +75,10 @@ class DummyClass extends Controller
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @param \App\News $news
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
public function destroy(News $news)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use DummyFullModelClass;
|
||||
use App\Picture;
|
||||
use Illuminate\Http\Request;
|
||||
use DummyRootNamespaceHttp\Controllers\Controller;
|
||||
|
||||
class DummyClass extends Controller
|
||||
class PictureController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
@@ -15,7 +14,7 @@ class DummyClass extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
return view('public.allpicture',['pictures' => \App\Picture::paginate(\App\Config::getData('text_public_picture_nb'))]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,21 +41,21 @@ class DummyClass extends Controller
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \DummyFullModelClass $DummyModelVariable
|
||||
* @param \App\Picture $picture
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(DummyModelClass $DummyModelVariable)
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
return view('public.picture',['picture' => \App\Picture::find($id)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \DummyFullModelClass $DummyModelVariable
|
||||
* @param \App\Picture $picture
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(DummyModelClass $DummyModelVariable)
|
||||
public function edit(Picture $picture)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -65,10 +64,10 @@ class DummyClass extends Controller
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \DummyFullModelClass $DummyModelVariable
|
||||
* @param \App\Picture $picture
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, DummyModelClass $DummyModelVariable)
|
||||
public function update(Request $request, Picture $picture)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -76,10 +75,10 @@ class DummyClass extends Controller
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \DummyFullModelClass $DummyModelVariable
|
||||
* @param \App\Picture $picture
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(DummyModelClass $DummyModelVariable)
|
||||
public function destroy(Picture $picture)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -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(),
|
||||
'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('/');;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,9 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use \App\Schedule;
|
||||
|
||||
class ScheduleController extends Controller
|
||||
{
|
||||
//
|
||||
//
|
||||
}
|
||||
|
||||
@@ -165,4 +165,86 @@ 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('status', '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('status', '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('status', 'Modification enregistré');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,15 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,13 +65,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 +97,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');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
],
|
||||
"psr-4": {
|
||||
"App\\": "app/"
|
||||
}
|
||||
},
|
||||
"files": ["app/Http/helpers.php"]
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
|
||||
@@ -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',
|
||||
],
|
||||
|
||||
/*
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class DummyClass extends Migration
|
||||
class CreateNewsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
@@ -13,8 +13,12 @@ class DummyClass extends Migration
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('DummyTable', function (Blueprint $table) {
|
||||
Schema::create('news', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('title');
|
||||
$table->text('body');
|
||||
$table->integer('user_id');
|
||||
$table->boolean('publish');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
@@ -26,6 +30,6 @@ class DummyClass extends Migration
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('DummyTable');
|
||||
Schema::dropIfExists('news');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?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('admin_desc');
|
||||
$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');
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateNotificationsTable extends Migration
|
||||
class CreatePicturesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
@@ -13,12 +13,13 @@ class CreateNotificationsTable extends Migration
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('notifications', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary();
|
||||
$table->string('type');
|
||||
$table->morphs('notifiable');
|
||||
$table->text('data');
|
||||
$table->timestamp('read_at')->nullable();
|
||||
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();
|
||||
});
|
||||
}
|
||||
@@ -30,6 +31,6 @@ class CreateNotificationsTable extends Migration
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('notifications');
|
||||
Schema::dropIfExists('pictures');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ComplementaryActivitiesSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
DB::table('complementary_activities')->insert([
|
||||
[
|
||||
'name' => 'Précidrill',
|
||||
'public_body' => 'Veuillez modifier le text de description publique par défaut',
|
||||
'admin_desc' => 'Veuillez modifier la description admin par défaut',
|
||||
],
|
||||
[
|
||||
'name' => 'Musique',
|
||||
'public_body' => 'Veuillez modifier le text de description publique par défaut',
|
||||
'admin_desc' => 'Veuillez modifier la description admin par défaut',
|
||||
],
|
||||
[
|
||||
'name' => 'Tir de précision',
|
||||
'public_body' => 'Veuillez modifier le text de description publique par défaut',
|
||||
'admin_desc' => 'Veuillez modifier la description admin par défaut',
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,177 @@ class ConfigsTableSeeder extends Seeder
|
||||
'name' => 'is_schedule_public',
|
||||
'state' => 0,
|
||||
'data' => 'null'
|
||||
]
|
||||
],
|
||||
[
|
||||
'name' => 'is_schedule_build',
|
||||
'state' => 0,
|
||||
'data' => 'null'
|
||||
],
|
||||
[
|
||||
'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_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"]'
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,17 @@ class UsersTableSeeder extends Seeder
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
//
|
||||
DB::table('users')->insert([
|
||||
'firstname' => 'Administrateur',
|
||||
'lastname' => 'Administrateur',
|
||||
'email' => 'admin@exvps.ca',
|
||||
'password' => bcrypt('SuperAdmin'),
|
||||
'rank' => '1',
|
||||
'adress' => 'Inconnu',
|
||||
'age' => '99',
|
||||
'avatar' => '3',
|
||||
'sexe' => 'm',
|
||||
'job' => '1',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"/>
|
||||
|
||||
@@ -2253,7 +2253,7 @@ header .form-inline {
|
||||
vertical-align: middle !important;
|
||||
border: solid 1px #d9d9d9 !important;
|
||||
padding: 0px !important;
|
||||
display: flex;
|
||||
background-color: white;
|
||||
}
|
||||
.calendar-date{
|
||||
float: left;
|
||||
@@ -2261,11 +2261,14 @@ header .form-inline {
|
||||
}
|
||||
.calendar-text{
|
||||
float: right;
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
.calendar-text > div {
|
||||
text-align:start;
|
||||
}
|
||||
.calendar_event_name {
|
||||
height: 3rem;
|
||||
overflow: hidden;
|
||||
}
|
||||
@media only screen and (max-width: 800px) {
|
||||
.calendar-container{
|
||||
width: 100%;
|
||||
@@ -2318,4 +2321,8 @@ header .form-inline {
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
.cs-notification:hover {
|
||||
background-color: #F2F2F2 !important;
|
||||
color:white;
|
||||
}
|
||||
@@ -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');
|
||||
}
|
||||
};
|
||||
|
||||
}));
|
||||
@@ -1,2 +0,0 @@
|
||||
/* breakpoints.js v1.0 | @ajlkn | MIT licensed */
|
||||
var breakpoints=function(){"use strict";function e(e){t.init(e)}var t={list:null,media:{},events:[],init:function(e){t.list=e,window.addEventListener("resize",t.poll),window.addEventListener("orientationchange",t.poll),window.addEventListener("load",t.poll),window.addEventListener("fullscreenchange",t.poll)},active:function(e){var n,a,s,i,r,d,c;if(!(e in t.media)){if(">="==e.substr(0,2)?(a="gte",n=e.substr(2)):"<="==e.substr(0,2)?(a="lte",n=e.substr(2)):">"==e.substr(0,1)?(a="gt",n=e.substr(1)):"<"==e.substr(0,1)?(a="lt",n=e.substr(1)):"!"==e.substr(0,1)?(a="not",n=e.substr(1)):(a="eq",n=e),n&&n in t.list)if(i=t.list[n],Array.isArray(i)){if(r=parseInt(i[0]),d=parseInt(i[1]),isNaN(r)){if(isNaN(d))return;c=i[1].substr(String(d).length)}else c=i[0].substr(String(r).length);if(isNaN(r))switch(a){case"gte":s="screen";break;case"lte":s="screen and (max-width: "+d+c+")";break;case"gt":s="screen and (min-width: "+(d+1)+c+")";break;case"lt":s="screen and (max-width: -1px)";break;case"not":s="screen and (min-width: "+(d+1)+c+")";break;default:s="screen and (max-width: "+d+c+")"}else if(isNaN(d))switch(a){case"gte":s="screen and (min-width: "+r+c+")";break;case"lte":s="screen";break;case"gt":s="screen and (max-width: -1px)";break;case"lt":s="screen and (max-width: "+(r-1)+c+")";break;case"not":s="screen and (max-width: "+(r-1)+c+")";break;default:s="screen and (min-width: "+r+c+")"}else switch(a){case"gte":s="screen and (min-width: "+r+c+")";break;case"lte":s="screen and (max-width: "+d+c+")";break;case"gt":s="screen and (min-width: "+(d+1)+c+")";break;case"lt":s="screen and (max-width: "+(r-1)+c+")";break;case"not":s="screen and (max-width: "+(r-1)+c+"), screen and (min-width: "+(d+1)+c+")";break;default:s="screen and (min-width: "+r+c+") and (max-width: "+d+c+")"}}else s="("==i.charAt(0)?"screen and "+i:i;t.media[e]=!!s&&s}return t.media[e]!==!1&&window.matchMedia(t.media[e]).matches},on:function(e,n){t.events.push({query:e,handler:n,state:!1}),t.active(e)&&n()},poll:function(){var e,n;for(e=0;e<t.events.length;e++)n=t.events[e],t.active(n.query)?n.state||(n.state=!0,n.handler()):n.state&&(n.state=!1)}};return e._=t,e.on=function(e,n){t.on(e,n)},e.active=function(e){return t.active(e)},e}();!function(e,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?module.exports=t():e.breakpoints=t()}(this,function(){return breakpoints});
|
||||
@@ -1,2 +0,0 @@
|
||||
/* browser.js v1.0 | @ajlkn | MIT licensed */
|
||||
var browser=function(){"use strict";var e={name:null,version:null,os:null,osVersion:null,touch:null,mobile:null,_canUse:null,canUse:function(n){e._canUse||(e._canUse=document.createElement("div"));var o=e._canUse.style,r=n.charAt(0).toUpperCase()+n.slice(1);return n in o||"Moz"+r in o||"Webkit"+r in o||"O"+r in o||"ms"+r in o},init:function(){var n,o,r,i,t=navigator.userAgent;for(n="other",o=0,r=[["firefox",/Firefox\/([0-9\.]+)/],["bb",/BlackBerry.+Version\/([0-9\.]+)/],["bb",/BB[0-9]+.+Version\/([0-9\.]+)/],["opera",/OPR\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)/],["edge",/Edge\/([0-9\.]+)/],["safari",/Version\/([0-9\.]+).+Safari/],["chrome",/Chrome\/([0-9\.]+)/],["ie",/MSIE ([0-9]+)/],["ie",/Trident\/.+rv:([0-9]+)/]],i=0;i<r.length;i++)if(t.match(r[i][1])){n=r[i][0],o=parseFloat(RegExp.$1);break}for(e.name=n,e.version=o,n="other",o=0,r=[["ios",/([0-9_]+) like Mac OS X/,function(e){return e.replace("_",".").replace("_","")}],["ios",/CPU like Mac OS X/,function(e){return 0}],["wp",/Windows Phone ([0-9\.]+)/,null],["android",/Android ([0-9\.]+)/,null],["mac",/Macintosh.+Mac OS X ([0-9_]+)/,function(e){return e.replace("_",".").replace("_","")}],["windows",/Windows NT ([0-9\.]+)/,null],["bb",/BlackBerry.+Version\/([0-9\.]+)/,null],["bb",/BB[0-9]+.+Version\/([0-9\.]+)/,null],["linux",/Linux/,null],["bsd",/BSD/,null],["unix",/X11/,null]],i=0;i<r.length;i++)if(t.match(r[i][1])){n=r[i][0],o=parseFloat(r[i][2]?r[i][2](RegExp.$1):RegExp.$1);break}e.os=n,e.osVersion=o,e.touch="wp"==e.os?navigator.msMaxTouchPoints>0:!!("ontouchstart"in window),e.mobile="wp"==e.os||"android"==e.os||"ios"==e.os||"bb"==e.os}};return e.init(),e}();!function(e,n){"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?module.exports=n():e.browser=n()}(this,function(){return browser});
|
||||
@@ -0,0 +1,315 @@
|
||||
type = ['','info','success','warning','danger'];
|
||||
|
||||
|
||||
demo = {
|
||||
initPickColor: function(){
|
||||
$('.pick-class-label').click(function(){
|
||||
var new_class = $(this).attr('new-class');
|
||||
var old_class = $('#display-buttons').attr('data-class');
|
||||
var display_div = $('#display-buttons');
|
||||
if(display_div.length) {
|
||||
var display_buttons = display_div.find('.btn');
|
||||
display_buttons.removeClass(old_class);
|
||||
display_buttons.addClass(new_class);
|
||||
display_div.attr('data-class', new_class);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
initChartist: function(){
|
||||
|
||||
var dataSales = {
|
||||
labels: ['9:00AM', '12:00AM', '3:00PM', '6:00PM', '9:00PM', '12:00PM', '3:00AM', '6:00AM'],
|
||||
series: [
|
||||
[287, 385, 490, 562, 594, 626, 698, 895, 952],
|
||||
[67, 152, 193, 240, 387, 435, 535, 642, 744],
|
||||
[23, 113, 67, 108, 190, 239, 307, 410, 410]
|
||||
]
|
||||
};
|
||||
|
||||
var optionsSales = {
|
||||
lineSmooth: false,
|
||||
low: 0,
|
||||
high: 1000,
|
||||
showArea: true,
|
||||
height: "245px",
|
||||
axisX: {
|
||||
showGrid: false,
|
||||
},
|
||||
lineSmooth: Chartist.Interpolation.simple({
|
||||
divisor: 3
|
||||
}),
|
||||
showLine: true,
|
||||
showPoint: false,
|
||||
};
|
||||
|
||||
var responsiveSales = [
|
||||
['screen and (max-width: 640px)', {
|
||||
axisX: {
|
||||
labelInterpolationFnc: function (value) {
|
||||
return value[0];
|
||||
}
|
||||
}
|
||||
}]
|
||||
];
|
||||
|
||||
Chartist.Line('#chartHours', dataSales, optionsSales, responsiveSales);
|
||||
|
||||
|
||||
var data = {
|
||||
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
||||
series: [
|
||||
[542, 543, 520, 680, 653, 753, 326, 434, 568, 610, 756, 895],
|
||||
[230, 293, 380, 480, 503, 553, 600, 664, 698, 710, 736, 795]
|
||||
]
|
||||
};
|
||||
|
||||
var options = {
|
||||
seriesBarDistance: 10,
|
||||
axisX: {
|
||||
showGrid: false
|
||||
},
|
||||
height: "245px"
|
||||
};
|
||||
|
||||
var responsiveOptions = [
|
||||
['screen and (max-width: 640px)', {
|
||||
seriesBarDistance: 5,
|
||||
axisX: {
|
||||
labelInterpolationFnc: function (value) {
|
||||
return value[0];
|
||||
}
|
||||
}
|
||||
}]
|
||||
];
|
||||
|
||||
Chartist.Line('#chartActivity', data, options, responsiveOptions);
|
||||
|
||||
var dataPreferences = {
|
||||
series: [
|
||||
[25, 30, 20, 25]
|
||||
]
|
||||
};
|
||||
|
||||
var optionsPreferences = {
|
||||
donut: true,
|
||||
donutWidth: 40,
|
||||
startAngle: 0,
|
||||
total: 100,
|
||||
showLabel: false,
|
||||
axisX: {
|
||||
showGrid: false
|
||||
}
|
||||
};
|
||||
|
||||
Chartist.Pie('#chartPreferences', dataPreferences, optionsPreferences);
|
||||
|
||||
Chartist.Pie('#chartPreferences', {
|
||||
labels: ['62%','32%','6%'],
|
||||
series: [62, 32, 6]
|
||||
});
|
||||
},
|
||||
|
||||
initGoogleMaps: function(){
|
||||
var myLatlng = new google.maps.LatLng(40.748817, -73.985428);
|
||||
var mapOptions = {
|
||||
zoom: 13,
|
||||
center: myLatlng,
|
||||
scrollwheel: false, //we disable de scroll over the map, it is a really annoing when you scroll through page
|
||||
styles: [{"featureType":"water","stylers":[{"saturation":43},{"lightness":-11},{"hue":"#0088ff"}]},{"featureType":"road","elementType":"geometry.fill","stylers":[{"hue":"#ff0000"},{"saturation":-100},{"lightness":99}]},{"featureType":"road","elementType":"geometry.stroke","stylers":[{"color":"#808080"},{"lightness":54}]},{"featureType":"landscape.man_made","elementType":"geometry.fill","stylers":[{"color":"#ece2d9"}]},{"featureType":"poi.park","elementType":"geometry.fill","stylers":[{"color":"#ccdca1"}]},{"featureType":"road","elementType":"labels.text.fill","stylers":[{"color":"#767676"}]},{"featureType":"road","elementType":"labels.text.stroke","stylers":[{"color":"#ffffff"}]},{"featureType":"poi","stylers":[{"visibility":"off"}]},{"featureType":"landscape.natural","elementType":"geometry.fill","stylers":[{"visibility":"on"},{"color":"#b8cb93"}]},{"featureType":"poi.park","stylers":[{"visibility":"on"}]},{"featureType":"poi.sports_complex","stylers":[{"visibility":"on"}]},{"featureType":"poi.medical","stylers":[{"visibility":"on"}]},{"featureType":"poi.business","stylers":[{"visibility":"simplified"}]}]
|
||||
|
||||
}
|
||||
var map = new google.maps.Map(document.getElementById("map"), mapOptions);
|
||||
|
||||
var marker = new google.maps.Marker({
|
||||
position: myLatlng,
|
||||
title:"Hello World!"
|
||||
});
|
||||
|
||||
// To add the marker to the map, call setMap();
|
||||
marker.setMap(map);
|
||||
},
|
||||
|
||||
showNotification: function(from, align){
|
||||
color = Math.floor((Math.random() * 4) + 1);
|
||||
|
||||
$.notify({
|
||||
icon: "ti-gift",
|
||||
message: "Welcome to <b>Paper Dashboard</b> - a beautiful freebie for every web developer."
|
||||
|
||||
},{
|
||||
type: type[color],
|
||||
timer: 4000,
|
||||
placement: {
|
||||
from: from,
|
||||
align: align
|
||||
}
|
||||
});
|
||||
},
|
||||
initDocumentationCharts: function(){
|
||||
// init single simple line chart
|
||||
var dataPerformance = {
|
||||
labels: ['6pm','9pm','11pm', '2am', '4am', '8am', '2pm', '5pm', '8pm', '11pm', '4am'],
|
||||
series: [
|
||||
[1, 6, 8, 7, 4, 7, 8, 12, 16, 17, 14, 13]
|
||||
]
|
||||
};
|
||||
|
||||
var optionsPerformance = {
|
||||
showPoint: false,
|
||||
lineSmooth: true,
|
||||
height: "200px",
|
||||
axisX: {
|
||||
showGrid: false,
|
||||
showLabel: true
|
||||
},
|
||||
axisY: {
|
||||
offset: 40,
|
||||
},
|
||||
low: 0,
|
||||
high: 16,
|
||||
height: "250px"
|
||||
};
|
||||
|
||||
Chartist.Line('#chartPerformance', dataPerformance, optionsPerformance);
|
||||
|
||||
// init single line with points chart
|
||||
var dataStock = {
|
||||
labels: ['\'07','\'08','\'09', '\'10', '\'11', '\'12', '\'13', '\'14', '\'15'],
|
||||
series: [
|
||||
[22.20, 34.90, 42.28, 51.93, 62.21, 80.23, 62.21, 82.12, 102.50, 107.23]
|
||||
]
|
||||
};
|
||||
|
||||
var optionsStock = {
|
||||
lineSmooth: false,
|
||||
height: "200px",
|
||||
axisY: {
|
||||
offset: 40,
|
||||
labelInterpolationFnc: function(value) {
|
||||
return '$' + value;
|
||||
}
|
||||
|
||||
},
|
||||
low: 10,
|
||||
height: "250px",
|
||||
high: 110,
|
||||
classNames: {
|
||||
point: 'ct-point ct-green',
|
||||
line: 'ct-line ct-green'
|
||||
}
|
||||
};
|
||||
|
||||
Chartist.Line('#chartStock', dataStock, optionsStock);
|
||||
|
||||
// init multiple lines chart
|
||||
var dataSales = {
|
||||
labels: ['9:00AM', '12:00AM', '3:00PM', '6:00PM', '9:00PM', '12:00PM', '3:00AM', '6:00AM'],
|
||||
series: [
|
||||
[287, 385, 490, 562, 594, 626, 698, 895, 952],
|
||||
[67, 152, 193, 240, 387, 435, 535, 642, 744],
|
||||
[23, 113, 67, 108, 190, 239, 307, 410, 410]
|
||||
]
|
||||
};
|
||||
|
||||
var optionsSales = {
|
||||
lineSmooth: false,
|
||||
low: 0,
|
||||
high: 1000,
|
||||
showArea: true,
|
||||
height: "245px",
|
||||
axisX: {
|
||||
showGrid: false,
|
||||
},
|
||||
lineSmooth: Chartist.Interpolation.simple({
|
||||
divisor: 3
|
||||
}),
|
||||
showLine: true,
|
||||
showPoint: false,
|
||||
};
|
||||
|
||||
var responsiveSales = [
|
||||
['screen and (max-width: 640px)', {
|
||||
axisX: {
|
||||
labelInterpolationFnc: function (value) {
|
||||
return value[0];
|
||||
}
|
||||
}
|
||||
}]
|
||||
];
|
||||
|
||||
Chartist.Line('#chartHours', dataSales, optionsSales, responsiveSales);
|
||||
|
||||
// pie chart
|
||||
Chartist.Pie('#chartPreferences', {
|
||||
labels: ['62%','32%','6%'],
|
||||
series: [62, 32, 6]
|
||||
});
|
||||
|
||||
// bar chart
|
||||
var dataViews = {
|
||||
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
||||
series: [
|
||||
[542, 443, 320, 780, 553, 453, 326, 434, 568, 610, 756, 895]
|
||||
]
|
||||
};
|
||||
|
||||
var optionsViews = {
|
||||
seriesBarDistance: 10,
|
||||
classNames: {
|
||||
bar: 'ct-bar'
|
||||
},
|
||||
axisX: {
|
||||
showGrid: false,
|
||||
|
||||
},
|
||||
height: "250px"
|
||||
|
||||
};
|
||||
|
||||
var responsiveOptionsViews = [
|
||||
['screen and (max-width: 640px)', {
|
||||
seriesBarDistance: 5,
|
||||
axisX: {
|
||||
labelInterpolationFnc: function (value) {
|
||||
return value[0];
|
||||
}
|
||||
}
|
||||
}]
|
||||
];
|
||||
|
||||
Chartist.Bar('#chartViews', dataViews, optionsViews, responsiveOptionsViews);
|
||||
|
||||
// multiple bars chart
|
||||
var data = {
|
||||
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
||||
series: [
|
||||
[542, 543, 520, 680, 653, 753, 326, 434, 568, 610, 756, 895],
|
||||
[230, 293, 380, 480, 503, 553, 600, 664, 698, 710, 736, 795]
|
||||
]
|
||||
};
|
||||
|
||||
var options = {
|
||||
seriesBarDistance: 10,
|
||||
axisX: {
|
||||
showGrid: false
|
||||
},
|
||||
height: "245px"
|
||||
};
|
||||
|
||||
var responsiveOptions = [
|
||||
['screen and (max-width: 640px)', {
|
||||
seriesBarDistance: 5,
|
||||
axisX: {
|
||||
labelInterpolationFnc: function (value) {
|
||||
return value[0];
|
||||
}
|
||||
}
|
||||
}]
|
||||
];
|
||||
|
||||
Chartist.Line('#chartActivity', data, options, responsiveOptions);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
/* jquery.scrollex v0.2.1 | (c) @ajlkn | github.com/ajlkn/jquery.scrollex | MIT licensed */
|
||||
!function(t){function e(t,e,n){return"string"==typeof t&&("%"==t.slice(-1)?t=parseInt(t.substring(0,t.length-1))/100*e:"vh"==t.slice(-2)?t=parseInt(t.substring(0,t.length-2))/100*n:"px"==t.slice(-2)&&(t=parseInt(t.substring(0,t.length-2)))),t}var n=t(window),i=1,o={};n.on("scroll",function(){var e=n.scrollTop();t.map(o,function(t){window.clearTimeout(t.timeoutId),t.timeoutId=window.setTimeout(function(){t.handler(e)},t.options.delay)})}).on("load",function(){n.trigger("scroll")}),jQuery.fn.scrollex=function(l){var s=t(this);if(0==this.length)return s;if(this.length>1){for(var r=0;r<this.length;r++)t(this[r]).scrollex(l);return s}if(s.data("_scrollexId"))return s;var a,u,h,c,p;switch(a=i++,u=jQuery.extend({top:0,bottom:0,delay:0,mode:"default",enter:null,leave:null,initialize:null,terminate:null,scroll:null},l),u.mode){case"top":h=function(t,e,n,i,o){return t>=i&&o>=t};break;case"bottom":h=function(t,e,n,i,o){return n>=i&&o>=n};break;case"middle":h=function(t,e,n,i,o){return e>=i&&o>=e};break;case"top-only":h=function(t,e,n,i,o){return i>=t&&n>=i};break;case"bottom-only":h=function(t,e,n,i,o){return n>=o&&o>=t};break;default:case"default":h=function(t,e,n,i,o){return n>=i&&o>=t}}return c=function(t){var i,o,l,s,r,a,u=this.state,h=!1,c=this.$element.offset();i=n.height(),o=t+i/2,l=t+i,s=this.$element.outerHeight(),r=c.top+e(this.options.top,s,i),a=c.top+s-e(this.options.bottom,s,i),h=this.test(t,o,l,r,a),h!=u&&(this.state=h,h?this.options.enter&&this.options.enter.apply(this.element):this.options.leave&&this.options.leave.apply(this.element)),this.options.scroll&&this.options.scroll.apply(this.element,[(o-r)/(a-r)])},p={id:a,options:u,test:h,handler:c,state:null,element:this,$element:s,timeoutId:null},o[a]=p,s.data("_scrollexId",p.id),p.options.initialize&&p.options.initialize.apply(this),s},jQuery.fn.unscrollex=function(){var e=t(this);if(0==this.length)return e;if(this.length>1){for(var n=0;n<this.length;n++)t(this[n]).unscrollex();return e}var i,l;return(i=e.data("_scrollexId"))?(l=o[i],window.clearTimeout(l.timeoutId),delete o[i],e.removeData("_scrollexId"),l.options.terminate&&l.options.terminate.apply(this),e):e}}(jQuery);
|
||||
@@ -1,2 +0,0 @@
|
||||
/* jquery.scrolly v1.0.0-dev | (c) @ajlkn | MIT licensed */
|
||||
(function(e){function u(s,o){var u,a,f;if((u=e(s))[t]==0)return n;a=u[i]()[r];switch(o.anchor){case"middle":f=a-(e(window).height()-u.outerHeight())/2;break;default:case r:f=Math.max(a,0)}return typeof o[i]=="function"?f-=o[i]():f-=o[i],f}var t="length",n=null,r="top",i="offset",s="click.scrolly",o=e(window);e.fn.scrolly=function(i){var o,a,f,l,c=e(this);if(this[t]==0)return c;if(this[t]>1){for(o=0;o<this[t];o++)e(this[o]).scrolly(i);return c}l=n,f=c.attr("href");if(f.charAt(0)!="#"||f[t]<2)return c;a=jQuery.extend({anchor:r,easing:"swing",offset:0,parent:e("body,html"),pollOnce:!1,speed:1e3},i),a.pollOnce&&(l=u(f,a)),c.off(s).on(s,function(e){var t=l!==n?l:u(f,a);t!==n&&(e.preventDefault(),a.parent.stop().animate({scrollTop:t},a.speed,a.easing))})}})(jQuery);
|
||||
@@ -1,258 +0,0 @@
|
||||
/*
|
||||
Massively by HTML5 UP
|
||||
html5up.net | @ajlkn
|
||||
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
var $window = $(window),
|
||||
$body = $('body'),
|
||||
$wrapper = $('#wrapper'),
|
||||
$header = $('#header'),
|
||||
$nav = $('#nav'),
|
||||
$main = $('#main'),
|
||||
$navPanelToggle, $navPanel, $navPanelInner;
|
||||
|
||||
// Breakpoints.
|
||||
breakpoints({
|
||||
default: ['1681px', null ],
|
||||
xlarge: ['1281px', '1680px' ],
|
||||
large: ['981px', '1280px' ],
|
||||
medium: ['737px', '980px' ],
|
||||
small: ['481px', '736px' ],
|
||||
xsmall: ['361px', '480px' ],
|
||||
xxsmall: [null, '360px' ]
|
||||
});
|
||||
|
||||
/**
|
||||
* Applies parallax scrolling to an element's background image.
|
||||
* @return {jQuery} jQuery object.
|
||||
*/
|
||||
$.fn._parallax = function(intensity) {
|
||||
|
||||
var $window = $(window),
|
||||
$this = $(this);
|
||||
|
||||
if (this.length == 0 || intensity === 0)
|
||||
return $this;
|
||||
|
||||
if (this.length > 1) {
|
||||
|
||||
for (var i=0; i < this.length; i++)
|
||||
$(this[i])._parallax(intensity);
|
||||
|
||||
return $this;
|
||||
|
||||
}
|
||||
|
||||
if (!intensity)
|
||||
intensity = 0.25;
|
||||
|
||||
$this.each(function() {
|
||||
|
||||
var $t = $(this),
|
||||
$bg = $('<div class="bg"></div>').appendTo($t),
|
||||
on, off;
|
||||
|
||||
on = function() {
|
||||
|
||||
$bg
|
||||
.removeClass('fixed')
|
||||
.css('transform', 'matrix(1,0,0,1,0,0)');
|
||||
|
||||
$window
|
||||
.on('scroll._parallax', function() {
|
||||
|
||||
var pos = parseInt($window.scrollTop()) - parseInt($t.position().top);
|
||||
|
||||
$bg.css('transform', 'matrix(1,0,0,1,0,' + (pos * intensity) + ')');
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
off = function() {
|
||||
|
||||
$bg
|
||||
.addClass('fixed')
|
||||
.css('transform', 'none');
|
||||
|
||||
$window
|
||||
.off('scroll._parallax');
|
||||
|
||||
};
|
||||
|
||||
// Disable parallax on ..
|
||||
if (browser.name == 'ie' // IE
|
||||
|| browser.name == 'edge' // Edge
|
||||
|| window.devicePixelRatio > 1 // Retina/HiDPI (= poor performance)
|
||||
|| browser.mobile) // Mobile devices
|
||||
off();
|
||||
|
||||
// Enable everywhere else.
|
||||
else {
|
||||
|
||||
breakpoints.on('>large', on);
|
||||
breakpoints.on('<=large', off);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$window
|
||||
.off('load._parallax resize._parallax')
|
||||
.on('load._parallax resize._parallax', function() {
|
||||
$window.trigger('scroll');
|
||||
});
|
||||
|
||||
return $(this);
|
||||
|
||||
};
|
||||
|
||||
// Play initial animations on page load.
|
||||
$window.on('load', function() {
|
||||
window.setTimeout(function() {
|
||||
$body.removeClass('is-preload');
|
||||
}, 100);
|
||||
});
|
||||
|
||||
// Scrolly.
|
||||
$('.scrolly').scrolly();
|
||||
|
||||
// Background.
|
||||
$wrapper._parallax(0.925);
|
||||
|
||||
// Nav Panel.
|
||||
|
||||
// Toggle.
|
||||
$navPanelToggle = $(
|
||||
'<a href="#navPanel" id="navPanelToggle">Menu</a>'
|
||||
)
|
||||
.appendTo($wrapper);
|
||||
|
||||
// Change toggle styling once we've scrolled past the header.
|
||||
$header.scrollex({
|
||||
bottom: '5vh',
|
||||
enter: function() {
|
||||
$navPanelToggle.removeClass('alt');
|
||||
},
|
||||
leave: function() {
|
||||
$navPanelToggle.addClass('alt');
|
||||
}
|
||||
});
|
||||
|
||||
// Panel.
|
||||
$navPanel = $(
|
||||
'<div id="navPanel">' +
|
||||
'<nav>' +
|
||||
'</nav>' +
|
||||
'<a href="#navPanel" class="close"></a>' +
|
||||
'</div>'
|
||||
)
|
||||
.appendTo($body)
|
||||
.panel({
|
||||
delay: 500,
|
||||
hideOnClick: true,
|
||||
hideOnSwipe: true,
|
||||
resetScroll: true,
|
||||
resetForms: true,
|
||||
side: 'right',
|
||||
target: $body,
|
||||
visibleClass: 'is-navPanel-visible'
|
||||
});
|
||||
|
||||
// Get inner.
|
||||
$navPanelInner = $navPanel.children('nav');
|
||||
|
||||
// Move nav content on breakpoint change.
|
||||
var $navContent = $nav.children();
|
||||
|
||||
breakpoints.on('>medium', function() {
|
||||
|
||||
// NavPanel -> Nav.
|
||||
$navContent.appendTo($nav);
|
||||
|
||||
// Flip icon classes.
|
||||
$nav.find('.icons, .icon')
|
||||
.removeClass('alt');
|
||||
|
||||
});
|
||||
|
||||
breakpoints.on('<=medium', function() {
|
||||
|
||||
// Nav -> NavPanel.
|
||||
$navContent.appendTo($navPanelInner);
|
||||
|
||||
// Flip icon classes.
|
||||
$navPanelInner.find('.icons, .icon')
|
||||
.addClass('alt');
|
||||
|
||||
});
|
||||
|
||||
// Hack: Disable transitions on WP.
|
||||
if (browser.os == 'wp'
|
||||
&& browser.osVersion < 10)
|
||||
$navPanel
|
||||
.css('transition', 'none');
|
||||
|
||||
// Intro.
|
||||
var $intro = $('#intro');
|
||||
|
||||
if ($intro.length > 0) {
|
||||
|
||||
// Hack: Fix flex min-height on IE.
|
||||
if (browser.name == 'ie') {
|
||||
$window.on('resize.ie-intro-fix', function() {
|
||||
|
||||
var h = $intro.height();
|
||||
|
||||
if (h > $window.height())
|
||||
$intro.css('height', 'auto');
|
||||
else
|
||||
$intro.css('height', h);
|
||||
|
||||
}).trigger('resize.ie-intro-fix');
|
||||
}
|
||||
|
||||
// Hide intro on scroll (> small).
|
||||
breakpoints.on('>small', function() {
|
||||
|
||||
$main.unscrollex();
|
||||
|
||||
$main.scrollex({
|
||||
mode: 'bottom',
|
||||
top: '25vh',
|
||||
bottom: '-50vh',
|
||||
enter: function() {
|
||||
$intro.addClass('hidden');
|
||||
},
|
||||
leave: function() {
|
||||
$intro.removeClass('hidden');
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// Hide intro on scroll (<= small).
|
||||
breakpoints.on('<=small', function() {
|
||||
|
||||
$main.unscrollex();
|
||||
|
||||
$main.scrollex({
|
||||
mode: 'middle',
|
||||
top: '15vh',
|
||||
bottom: '-15vh',
|
||||
enter: function() {
|
||||
$intro.addClass('hidden');
|
||||
},
|
||||
leave: function() {
|
||||
$intro.removeClass('hidden');
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,157 @@
|
||||
/*!
|
||||
|
||||
=========================================================
|
||||
* Paper Dashboard - v1.1.2
|
||||
=========================================================
|
||||
|
||||
* Product Page: http://www.creative-tim.com/product/paper-dashboard
|
||||
* Copyright 2017 Creative Tim (http://www.creative-tim.com)
|
||||
* Licensed under MIT (https://github.com/creativetimofficial/paper-dashboard/blob/master/LICENSE.md)
|
||||
|
||||
=========================================================
|
||||
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
var fixedTop = false;
|
||||
var transparent = true;
|
||||
var navbar_initialized = false;
|
||||
|
||||
$(document).ready(function(){
|
||||
window_width = $(window).width();
|
||||
|
||||
// Init navigation toggle for small screens
|
||||
if(window_width <= 991){
|
||||
pd.initRightMenu();
|
||||
}
|
||||
|
||||
// Activate the tooltips
|
||||
$('[rel="tooltip"]').tooltip();
|
||||
|
||||
});
|
||||
|
||||
// activate collapse right menu when the windows is resized
|
||||
$(window).resize(function(){
|
||||
if($(window).width() <= 991){
|
||||
pd.initRightMenu();
|
||||
}
|
||||
});
|
||||
|
||||
pd = {
|
||||
misc:{
|
||||
navbar_menu_visible: 0
|
||||
},
|
||||
checkScrollForTransparentNavbar: debounce(function() {
|
||||
if($(document).scrollTop() > 381 ) {
|
||||
if(transparent) {
|
||||
transparent = false;
|
||||
$('.navbar-color-on-scroll').removeClass('navbar-transparent');
|
||||
$('.navbar-title').removeClass('hidden');
|
||||
}
|
||||
} else {
|
||||
if( !transparent ) {
|
||||
transparent = true;
|
||||
$('.navbar-color-on-scroll').addClass('navbar-transparent');
|
||||
$('.navbar-title').addClass('hidden');
|
||||
}
|
||||
}
|
||||
}),
|
||||
initRightMenu: function(){
|
||||
if(!navbar_initialized){
|
||||
$off_canvas_sidebar = $('nav').find('.navbar-collapse').first().clone(true);
|
||||
|
||||
$sidebar = $('.sidebar');
|
||||
sidebar_bg_color = $sidebar.data('background-color');
|
||||
sidebar_active_color = $sidebar.data('active-color');
|
||||
|
||||
$logo = $sidebar.find('.logo').first();
|
||||
logo_content = $logo[0].outerHTML;
|
||||
|
||||
ul_content = '';
|
||||
|
||||
// set the bg color and active color from the default sidebar to the off canvas sidebar;
|
||||
$off_canvas_sidebar.attr('data-background-color',sidebar_bg_color);
|
||||
$off_canvas_sidebar.attr('data-active-color',sidebar_active_color);
|
||||
|
||||
$off_canvas_sidebar.addClass('off-canvas-sidebar');
|
||||
|
||||
//add the content from the regular header to the right menu
|
||||
$off_canvas_sidebar.children('ul').each(function(){
|
||||
content_buff = $(this).html();
|
||||
ul_content = ul_content + content_buff;
|
||||
});
|
||||
|
||||
// add the content from the sidebar to the right menu
|
||||
content_buff = $sidebar.find('.nav').html();
|
||||
ul_content = ul_content + '<li class="divider"></li>'+ content_buff;
|
||||
|
||||
ul_content = '<ul class="nav navbar-nav">' + ul_content + '</ul>';
|
||||
|
||||
navbar_content = logo_content + ul_content;
|
||||
navbar_content = '<div class="sidebar-wrapper">' + navbar_content + '</div>';
|
||||
|
||||
$off_canvas_sidebar.html(navbar_content);
|
||||
|
||||
$('body').append($off_canvas_sidebar);
|
||||
|
||||
$toggle = $('.navbar-toggle');
|
||||
|
||||
$off_canvas_sidebar.find('a').removeClass('btn btn-round btn-default');
|
||||
$off_canvas_sidebar.find('button').removeClass('btn-round btn-fill btn-info btn-primary btn-success btn-danger btn-warning btn-neutral');
|
||||
$off_canvas_sidebar.find('button').addClass('btn-simple btn-block');
|
||||
|
||||
$toggle.click(function (){
|
||||
if(pd.misc.navbar_menu_visible == 1) {
|
||||
$('html').removeClass('nav-open');
|
||||
pd.misc.navbar_menu_visible = 0;
|
||||
$('#bodyClick').remove();
|
||||
setTimeout(function(){
|
||||
$toggle.removeClass('toggled');
|
||||
}, 400);
|
||||
|
||||
} else {
|
||||
setTimeout(function(){
|
||||
$toggle.addClass('toggled');
|
||||
}, 430);
|
||||
|
||||
div = '<div id="bodyClick"></div>';
|
||||
$(div).appendTo("body").click(function() {
|
||||
$('html').removeClass('nav-open');
|
||||
pd.misc.navbar_menu_visible = 0;
|
||||
$('#bodyClick').remove();
|
||||
setTimeout(function(){
|
||||
$toggle.removeClass('toggled');
|
||||
}, 400);
|
||||
});
|
||||
|
||||
$('html').addClass('nav-open');
|
||||
pd.misc.navbar_menu_visible = 1;
|
||||
|
||||
}
|
||||
});
|
||||
navbar_initialized = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Returns a function, that, as long as it continues to be invoked, will not
|
||||
// be triggered. The function will be called after it stops being called for
|
||||
// N milliseconds. If `immediate` is passed, trigger the function on the
|
||||
// leading edge, instead of the trailing.
|
||||
|
||||
function debounce(func, wait, immediate) {
|
||||
var timeout;
|
||||
return function() {
|
||||
var context = this, args = arguments;
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(function() {
|
||||
timeout = null;
|
||||
if (!immediate) func.apply(context, args);
|
||||
}, wait);
|
||||
if (immediate && !timeout) func.apply(context, args);
|
||||
};
|
||||
};
|
||||
@@ -1,587 +0,0 @@
|
||||
(function($) {
|
||||
|
||||
/**
|
||||
* Generate an indented list of links from a nav. Meant for use with panel().
|
||||
* @return {jQuery} jQuery object.
|
||||
*/
|
||||
$.fn.navList = function() {
|
||||
|
||||
var $this = $(this);
|
||||
$a = $this.find('a'),
|
||||
b = [];
|
||||
|
||||
$a.each(function() {
|
||||
|
||||
var $this = $(this),
|
||||
indent = Math.max(0, $this.parents('li').length - 1),
|
||||
href = $this.attr('href'),
|
||||
target = $this.attr('target');
|
||||
|
||||
b.push(
|
||||
'<a ' +
|
||||
'class="link depth-' + indent + '"' +
|
||||
( (typeof target !== 'undefined' && target != '') ? ' target="' + target + '"' : '') +
|
||||
( (typeof href !== 'undefined' && href != '') ? ' href="' + href + '"' : '') +
|
||||
'>' +
|
||||
'<span class="indent-' + indent + '"></span>' +
|
||||
$this.text() +
|
||||
'</a>'
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
return b.join('');
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Panel-ify an element.
|
||||
* @param {object} userConfig User config.
|
||||
* @return {jQuery} jQuery object.
|
||||
*/
|
||||
$.fn.panel = function(userConfig) {
|
||||
|
||||
// No elements?
|
||||
if (this.length == 0)
|
||||
return $this;
|
||||
|
||||
// Multiple elements?
|
||||
if (this.length > 1) {
|
||||
|
||||
for (var i=0; i < this.length; i++)
|
||||
$(this[i]).panel(userConfig);
|
||||
|
||||
return $this;
|
||||
|
||||
}
|
||||
|
||||
// Vars.
|
||||
var $this = $(this),
|
||||
$body = $('body'),
|
||||
$window = $(window),
|
||||
id = $this.attr('id'),
|
||||
config;
|
||||
|
||||
// Config.
|
||||
config = $.extend({
|
||||
|
||||
// Delay.
|
||||
delay: 0,
|
||||
|
||||
// Hide panel on link click.
|
||||
hideOnClick: false,
|
||||
|
||||
// Hide panel on escape keypress.
|
||||
hideOnEscape: false,
|
||||
|
||||
// Hide panel on swipe.
|
||||
hideOnSwipe: false,
|
||||
|
||||
// Reset scroll position on hide.
|
||||
resetScroll: false,
|
||||
|
||||
// Reset forms on hide.
|
||||
resetForms: false,
|
||||
|
||||
// Side of viewport the panel will appear.
|
||||
side: null,
|
||||
|
||||
// Target element for "class".
|
||||
target: $this,
|
||||
|
||||
// Class to toggle.
|
||||
visibleClass: 'visible'
|
||||
|
||||
}, userConfig);
|
||||
|
||||
// Expand "target" if it's not a jQuery object already.
|
||||
if (typeof config.target != 'jQuery')
|
||||
config.target = $(config.target);
|
||||
|
||||
// Panel.
|
||||
|
||||
// Methods.
|
||||
$this._hide = function(event) {
|
||||
|
||||
// Already hidden? Bail.
|
||||
if (!config.target.hasClass(config.visibleClass))
|
||||
return;
|
||||
|
||||
// If an event was provided, cancel it.
|
||||
if (event) {
|
||||
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
}
|
||||
|
||||
// Hide.
|
||||
config.target.removeClass(config.visibleClass);
|
||||
|
||||
// Post-hide stuff.
|
||||
window.setTimeout(function() {
|
||||
|
||||
// Reset scroll position.
|
||||
if (config.resetScroll)
|
||||
$this.scrollTop(0);
|
||||
|
||||
// Reset forms.
|
||||
if (config.resetForms)
|
||||
$this.find('form').each(function() {
|
||||
this.reset();
|
||||
});
|
||||
|
||||
}, config.delay);
|
||||
|
||||
};
|
||||
|
||||
// Vendor fixes.
|
||||
$this
|
||||
.css('-ms-overflow-style', '-ms-autohiding-scrollbar')
|
||||
.css('-webkit-overflow-scrolling', 'touch');
|
||||
|
||||
// Hide on click.
|
||||
if (config.hideOnClick) {
|
||||
|
||||
$this.find('a')
|
||||
.css('-webkit-tap-highlight-color', 'rgba(0,0,0,0)');
|
||||
|
||||
$this
|
||||
.on('click', 'a', function(event) {
|
||||
|
||||
var $a = $(this),
|
||||
href = $a.attr('href'),
|
||||
target = $a.attr('target');
|
||||
|
||||
if (!href || href == '#' || href == '' || href == '#' + id)
|
||||
return;
|
||||
|
||||
// Cancel original event.
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
// Hide panel.
|
||||
$this._hide();
|
||||
|
||||
// Redirect to href.
|
||||
window.setTimeout(function() {
|
||||
|
||||
if (target == '_blank')
|
||||
window.open(href);
|
||||
else
|
||||
window.location.href = href;
|
||||
|
||||
}, config.delay + 10);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Event: Touch stuff.
|
||||
$this.on('touchstart', function(event) {
|
||||
|
||||
$this.touchPosX = event.originalEvent.touches[0].pageX;
|
||||
$this.touchPosY = event.originalEvent.touches[0].pageY;
|
||||
|
||||
})
|
||||
|
||||
$this.on('touchmove', function(event) {
|
||||
|
||||
if ($this.touchPosX === null
|
||||
|| $this.touchPosY === null)
|
||||
return;
|
||||
|
||||
var diffX = $this.touchPosX - event.originalEvent.touches[0].pageX,
|
||||
diffY = $this.touchPosY - event.originalEvent.touches[0].pageY,
|
||||
th = $this.outerHeight(),
|
||||
ts = ($this.get(0).scrollHeight - $this.scrollTop());
|
||||
|
||||
// Hide on swipe?
|
||||
if (config.hideOnSwipe) {
|
||||
|
||||
var result = false,
|
||||
boundary = 20,
|
||||
delta = 50;
|
||||
|
||||
switch (config.side) {
|
||||
|
||||
case 'left':
|
||||
result = (diffY < boundary && diffY > (-1 * boundary)) && (diffX > delta);
|
||||
break;
|
||||
|
||||
case 'right':
|
||||
result = (diffY < boundary && diffY > (-1 * boundary)) && (diffX < (-1 * delta));
|
||||
break;
|
||||
|
||||
case 'top':
|
||||
result = (diffX < boundary && diffX > (-1 * boundary)) && (diffY > delta);
|
||||
break;
|
||||
|
||||
case 'bottom':
|
||||
result = (diffX < boundary && diffX > (-1 * boundary)) && (diffY < (-1 * delta));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (result) {
|
||||
|
||||
$this.touchPosX = null;
|
||||
$this.touchPosY = null;
|
||||
$this._hide();
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Prevent vertical scrolling past the top or bottom.
|
||||
if (($this.scrollTop() < 0 && diffY < 0)
|
||||
|| (ts > (th - 2) && ts < (th + 2) && diffY > 0)) {
|
||||
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Event: Prevent certain events inside the panel from bubbling.
|
||||
$this.on('click touchend touchstart touchmove', function(event) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
// Event: Hide panel if a child anchor tag pointing to its ID is clicked.
|
||||
$this.on('click', 'a[href="#' + id + '"]', function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
config.target.removeClass(config.visibleClass);
|
||||
|
||||
});
|
||||
|
||||
// Body.
|
||||
|
||||
// Event: Hide panel on body click/tap.
|
||||
$body.on('click touchend', function(event) {
|
||||
$this._hide(event);
|
||||
});
|
||||
|
||||
// Event: Toggle.
|
||||
$body.on('click', 'a[href="#' + id + '"]', function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
config.target.toggleClass(config.visibleClass);
|
||||
|
||||
});
|
||||
|
||||
// Window.
|
||||
|
||||
// Event: Hide on ESC.
|
||||
if (config.hideOnEscape)
|
||||
$window.on('keydown', function(event) {
|
||||
|
||||
if (event.keyCode == 27)
|
||||
$this._hide(event);
|
||||
|
||||
});
|
||||
|
||||
return $this;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Apply "placeholder" attribute polyfill to one or more forms.
|
||||
* @return {jQuery} jQuery object.
|
||||
*/
|
||||
$.fn.placeholder = function() {
|
||||
|
||||
// Browser natively supports placeholders? Bail.
|
||||
if (typeof (document.createElement('input')).placeholder != 'undefined')
|
||||
return $(this);
|
||||
|
||||
// No elements?
|
||||
if (this.length == 0)
|
||||
return $this;
|
||||
|
||||
// Multiple elements?
|
||||
if (this.length > 1) {
|
||||
|
||||
for (var i=0; i < this.length; i++)
|
||||
$(this[i]).placeholder();
|
||||
|
||||
return $this;
|
||||
|
||||
}
|
||||
|
||||
// Vars.
|
||||
var $this = $(this);
|
||||
|
||||
// Text, TextArea.
|
||||
$this.find('input[type=text],textarea')
|
||||
.each(function() {
|
||||
|
||||
var i = $(this);
|
||||
|
||||
if (i.val() == ''
|
||||
|| i.val() == i.attr('placeholder'))
|
||||
i
|
||||
.addClass('polyfill-placeholder')
|
||||
.val(i.attr('placeholder'));
|
||||
|
||||
})
|
||||
.on('blur', function() {
|
||||
|
||||
var i = $(this);
|
||||
|
||||
if (i.attr('name').match(/-polyfill-field$/))
|
||||
return;
|
||||
|
||||
if (i.val() == '')
|
||||
i
|
||||
.addClass('polyfill-placeholder')
|
||||
.val(i.attr('placeholder'));
|
||||
|
||||
})
|
||||
.on('focus', function() {
|
||||
|
||||
var i = $(this);
|
||||
|
||||
if (i.attr('name').match(/-polyfill-field$/))
|
||||
return;
|
||||
|
||||
if (i.val() == i.attr('placeholder'))
|
||||
i
|
||||
.removeClass('polyfill-placeholder')
|
||||
.val('');
|
||||
|
||||
});
|
||||
|
||||
// Password.
|
||||
$this.find('input[type=password]')
|
||||
.each(function() {
|
||||
|
||||
var i = $(this);
|
||||
var x = $(
|
||||
$('<div>')
|
||||
.append(i.clone())
|
||||
.remove()
|
||||
.html()
|
||||
.replace(/type="password"/i, 'type="text"')
|
||||
.replace(/type=password/i, 'type=text')
|
||||
);
|
||||
|
||||
if (i.attr('id') != '')
|
||||
x.attr('id', i.attr('id') + '-polyfill-field');
|
||||
|
||||
if (i.attr('name') != '')
|
||||
x.attr('name', i.attr('name') + '-polyfill-field');
|
||||
|
||||
x.addClass('polyfill-placeholder')
|
||||
.val(x.attr('placeholder')).insertAfter(i);
|
||||
|
||||
if (i.val() == '')
|
||||
i.hide();
|
||||
else
|
||||
x.hide();
|
||||
|
||||
i
|
||||
.on('blur', function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
var x = i.parent().find('input[name=' + i.attr('name') + '-polyfill-field]');
|
||||
|
||||
if (i.val() == '') {
|
||||
|
||||
i.hide();
|
||||
x.show();
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
x
|
||||
.on('focus', function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
var i = x.parent().find('input[name=' + x.attr('name').replace('-polyfill-field', '') + ']');
|
||||
|
||||
x.hide();
|
||||
|
||||
i
|
||||
.show()
|
||||
.focus();
|
||||
|
||||
})
|
||||
.on('keypress', function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
x.val('');
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// Events.
|
||||
$this
|
||||
.on('submit', function() {
|
||||
|
||||
$this.find('input[type=text],input[type=password],textarea')
|
||||
.each(function(event) {
|
||||
|
||||
var i = $(this);
|
||||
|
||||
if (i.attr('name').match(/-polyfill-field$/))
|
||||
i.attr('name', '');
|
||||
|
||||
if (i.val() == i.attr('placeholder')) {
|
||||
|
||||
i.removeClass('polyfill-placeholder');
|
||||
i.val('');
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
})
|
||||
.on('reset', function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
$this.find('select')
|
||||
.val($('option:first').val());
|
||||
|
||||
$this.find('input,textarea')
|
||||
.each(function() {
|
||||
|
||||
var i = $(this),
|
||||
x;
|
||||
|
||||
i.removeClass('polyfill-placeholder');
|
||||
|
||||
switch (this.type) {
|
||||
|
||||
case 'submit':
|
||||
case 'reset':
|
||||
break;
|
||||
|
||||
case 'password':
|
||||
i.val(i.attr('defaultValue'));
|
||||
|
||||
x = i.parent().find('input[name=' + i.attr('name') + '-polyfill-field]');
|
||||
|
||||
if (i.val() == '') {
|
||||
i.hide();
|
||||
x.show();
|
||||
}
|
||||
else {
|
||||
i.show();
|
||||
x.hide();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'checkbox':
|
||||
case 'radio':
|
||||
i.attr('checked', i.attr('defaultValue'));
|
||||
break;
|
||||
|
||||
case 'text':
|
||||
case 'textarea':
|
||||
i.val(i.attr('defaultValue'));
|
||||
|
||||
if (i.val() == '') {
|
||||
i.addClass('polyfill-placeholder');
|
||||
i.val(i.attr('placeholder'));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
i.val(i.attr('defaultValue'));
|
||||
break;
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
return $this;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Moves elements to/from the first positions of their respective parents.
|
||||
* @param {jQuery} $elements Elements (or selector) to move.
|
||||
* @param {bool} condition If true, moves elements to the top. Otherwise, moves elements back to their original locations.
|
||||
*/
|
||||
$.prioritize = function($elements, condition) {
|
||||
|
||||
var key = '__prioritize';
|
||||
|
||||
// Expand $elements if it's not already a jQuery object.
|
||||
if (typeof $elements != 'jQuery')
|
||||
$elements = $($elements);
|
||||
|
||||
// Step through elements.
|
||||
$elements.each(function() {
|
||||
|
||||
var $e = $(this), $p,
|
||||
$parent = $e.parent();
|
||||
|
||||
// No parent? Bail.
|
||||
if ($parent.length == 0)
|
||||
return;
|
||||
|
||||
// Not moved? Move it.
|
||||
if (!$e.data(key)) {
|
||||
|
||||
// Condition is false? Bail.
|
||||
if (!condition)
|
||||
return;
|
||||
|
||||
// Get placeholder (which will serve as our point of reference for when this element needs to move back).
|
||||
$p = $e.prev();
|
||||
|
||||
// Couldn't find anything? Means this element's already at the top, so bail.
|
||||
if ($p.length == 0)
|
||||
return;
|
||||
|
||||
// Move element to top of parent.
|
||||
$e.prependTo($parent);
|
||||
|
||||
// Mark element as moved.
|
||||
$e.data(key, $p);
|
||||
|
||||
}
|
||||
|
||||
// Moved already?
|
||||
else {
|
||||
|
||||
// Condition is true? Bail.
|
||||
if (condition)
|
||||
return;
|
||||
|
||||
$p = $e.data(key);
|
||||
|
||||
// Move element back to its original location (using our placeholder).
|
||||
$e.insertAfter($p);
|
||||
|
||||
// Unmark element as moved.
|
||||
$e.removeData(key);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||