diff --git a/app/Config.php b/app/Config.php new file mode 100644 index 00000000..161d2b8d --- /dev/null +++ b/app/Config.php @@ -0,0 +1,10 @@ +middleware('auth', ['except' => ['generate','load']]); + $this->middleware('auth', ['except' => ['generate','load','delete']]); } /** @@ -71,43 +74,79 @@ class CalendarController extends Controller $calendar[$i] = $addingday; } - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - + echo '
'; + echo '
'; + echo '
'.ucfirst(strftime("%B %Y", strtotime("01-".$month."-".$year))).'
'; + echo '
Dimanche
Lundi
Mardi
Mercredi
Jeudi
Vendredi
Samedi
'; + echo '
'; + echo '
'; for ($i=0; $i < 6 ; $i++) { - echo '
'; + echo '
'; for ($a=0; $a < 7 ; $a++) { if (isset($calendar[(($i*7) + $a)])) { - echo '
'; } else { - echo ''; + echo '
'; } } - echo ''; + echo ''; } - echo '
'.ucfirst(strftime("%B %Y", strtotime("01-".$month."-".$year))).'
DimancheLundiMardiMercrediJeudiVendrediSamedi
'; - + /** 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 '
'.date("j", strtotime($today)).'
'; + echo '
'.date("j", strtotime($today)).'
'; } else { + echo ''; $text = ""; foreach ($activityToday as $activity) { - $text = $text.'
'.ucfirst($activity->data['event_name'])."

"; + echo '
'.date("j", strtotime($today)).'
+
'; + switch ($activity->type) { + case 'regular': + echo '
'.ucfirst($activity->data['event_name'])."
"; + break; + + case 'pilotage': + echo '
'.ucfirst($activity->data['event_name'])."
"; + break; + + case 'drill': + echo '
'.ucfirst($activity->data['event_name'])."
"; + break; + + case 'music': + echo '
'.ucfirst($activity->data['event_name'])."
"; + break; + + case 'biathlon': + echo '
'.ucfirst($activity->data['event_name'])."
"; + break; + + case 'marksmanship': + echo '
'.ucfirst($activity->data['event_name'])."
"; + break; + + case 'founding': + echo '
'.ucfirst($activity->data['event_name'])."
"; + break; + + case 'volunteer': + echo '
'.ucfirst($activity->data['event_name'])."
"; + break; + + default: + echo '
'.ucfirst($activity->data['event_name'])."
"; + break; + } + echo '
'; } - - echo '
'.date("j", strtotime($today)).'
'.$text.'
'; + echo ''; } - - - echo '
'; } @@ -217,11 +256,11 @@ class CalendarController extends Controller - + - + @@ -231,11 +270,11 @@ class CalendarController extends Controller
'.User::find($date->data['n1_p1_instructor'])->fullname().''.User::find($date->data['n1_p1_instructor'])->fullname().' '.$isdone_n1_p1.'
'.$date->data['n1_p1_ocom'].' - '.$date->data['n1_p1_name'].''.$date->data['n1_p1_ocom'].' - '.$date->data['n1_p1_name'].' '.Local::find($date->data['n1_p1_local'])->name.'
- + - + @@ -248,11 +287,11 @@ class CalendarController extends Controller
'.User::find($date->data['n1_p2_instructor'])->fullname().''.User::find($date->data['n1_p2_instructor'])->fullname().' '.$isdone_n1_p2.'
'.$date->data['n1_p2_ocom'].' - '.$date->data['n1_p2_name'].''.$date->data['n1_p2_ocom'].' - '.$date->data['n1_p2_name'].' '.Local::find($date->data['n1_p2_local'])->name.'
- + - + @@ -262,11 +301,11 @@ class CalendarController extends Controller
'.User::find($date->data['n2_p1_instructor'])->fullname().''.User::find($date->data['n2_p1_instructor'])->fullname().' '.$isdone_n2_p1.'
'.$date->data['n2_p1_ocom'].' - '.$date->data['n2_p1_name'].''.$date->data['n2_p1_ocom'].' - '.$date->data['n2_p1_name'].' '.Local::find($date->data['n2_p1_local'])->name.'
- + - + @@ -279,11 +318,11 @@ class CalendarController extends Controller
'.User::find($date->data['n2_p2_instructor'])->fullname().''.User::find($date->data['n2_p2_instructor'])->fullname().' '.$isdone_n2_p2.'
'.$date->data['n2_p2_ocom'].' - '.$date->data['n2_p2_name'].''.$date->data['n2_p2_ocom'].' - '.$date->data['n2_p2_name'].' '.Local::find($date->data['n2_p2_local'])->name.'
- + - + @@ -293,11 +332,11 @@ class CalendarController extends Controller
'.User::find($date->data['n3_p1_instructor'])->fullname().''.User::find($date->data['n3_p1_instructor'])->fullname().' '.$isdone_n3_p1.'
'.$date->data['n3_p1_ocom'].' - '.$date->data['n3_p1_name'].''.$date->data['n3_p1_ocom'].' - '.$date->data['n3_p1_name'].' '.Local::find($date->data['n3_p1_local'])->name.'
- + - + @@ -307,6 +346,7 @@ class CalendarController extends Controller
'.User::find($date->data['n3_p2_instructor'])->fullname().''.User::find($date->data['n3_p2_instructor'])->fullname().' '.$isdone_n3_p2.'
'.$date->data['n3_p2_ocom'].' - '.$date->data['n3_p2_name'].''.$date->data['n3_p2_ocom'].' - '.$date->data['n3_p2_name'].' '.Local::find($date->data['n3_p2_local'])->name.'
'; } + echo '


'; } echo ''.trans('calendar.add_to_schedule').''; @@ -321,7 +361,7 @@ class CalendarController extends Controller $UserList = User::all(); $LocalList = Local::all(); - + return view('admin.calendar.calendar_add' ,['RequestDate' => $date, 'Userslist' => $UserList, 'LocalsList' => $LocalList]); } @@ -397,6 +437,10 @@ class CalendarController extends Controller $schedule->data = $eventData; $schedule->save(); + + /** Logs and Notification */ + Log::saveLog("Ajout de l'activité, ".$schedule->event_name." à l'horaire le ".$schedule->event_date); + } public function patch($id) @@ -468,4 +512,13 @@ class CalendarController extends Controller dd($check); } + public function delete() + { + $id = request('id'); + + $schedule = Schedule::find($id); + + $schedule->delete(); + } + } diff --git a/app/Http/Controllers/ConfigController.php b/app/Http/Controllers/ConfigController.php new file mode 100644 index 00000000..73dc2c2b --- /dev/null +++ b/app/Http/Controllers/ConfigController.php @@ -0,0 +1,85 @@ +sortBy('name'); + + $jobs = $jobs_sorted->values(); + + return view('admin.job.index', ['jobs' => $jobs]); + } + + /** + * 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\Job $job + * @return \Illuminate\Http\Response + */ + public function show(Job $job) + { + // + } + + /** + * Show the form for editing the specified resource. + * + * @param \App\Job $job + * @return \Illuminate\Http\Response + */ + public function edit(Job $job) + { + // + } + + /** + * Update the specified resource in storage. + * + * @param \Illuminate\Http\Request $request + * @param \App\Job $job + * @return \Illuminate\Http\Response + */ + public function update(Request $request, Job $job) + { + // + } + + /** + * Remove the specified resource from storage. + * + * @param \App\Job $job + * @return \Illuminate\Http\Response + */ + public function destroy(Job $job) + { + // + } +} diff --git a/app/Http/Controllers/LogController.php b/app/Http/Controllers/LogController.php new file mode 100644 index 00000000..1acafa5e --- /dev/null +++ b/app/Http/Controllers/LogController.php @@ -0,0 +1,87 @@ +sortByDesc('created_at')->take(500); + + return view('admin.log.display' ,['log' => $logs]); + } + + /** + * Show the form for creating a new resource. + * + * @return \Illuminate\Http\Response + */ + public function create() + { + // + } + + /** + * Store a newly created resource in storage. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function store(Request $request) + { + // + } + + /** + * Display the specified resource. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function show($id) + { + // + } + + /** + * Show the form for editing the specified resource. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function edit($id) + { + // + } + + /** + * Update the specified resource in storage. + * + * @param \Illuminate\Http\Request $request + * @param int $id + * @return \Illuminate\Http\Response + */ + public function update(Request $request, $id) + { + // + } + + /** + * Remove the specified resource from storage. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function destroy($id) + { + // + } +} diff --git a/app/Http/Controllers/MessageController.php b/app/Http/Controllers/MessageController.php new file mode 100644 index 00000000..cdba1aec --- /dev/null +++ b/app/Http/Controllers/MessageController.php @@ -0,0 +1,134 @@ +middleware('auth', ['except' => ['destroy']]); + } + + /** + * Display a listing of the resource. + * + * @return \Illuminate\Http\Response + */ + public function index() + { + return view('admin.message.index', ['messages' => \App\Message::all()]); + } + + /** + * Show the form for creating a new resource. + * + * @return \Illuminate\Http\Response + */ + public function create() + { + return view('admin.message.add', ['messages' => \App\Message::all()]); + } + + /** + * Store a newly created resource in storage. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function store(Request $request) + { + $msg = new Message; + + $msg->title = request('msg_title'); + $msg->body = request('msg_body'); + + $msg->user_id = \Auth::user()->id; + + /** Basic Shit to change */ + + $msg->data = [ + 'as_seen' => "", + 'parameter' => "" + ]; + + $msg->publish = true; + $msg->private = true; + + $msg->save(); + + \App\Log::savelog("Publication du message : ".request('msg_title')); + } + + /** + * Display the specified resource. + * + * @param \App\Message $message + * @return \Illuminate\Http\Response + */ + 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]); + } + + /** + * Show the form for editing the specified resource. + * + * @param \App\Message $message + * @return \Illuminate\Http\Response + */ + public function edit(Message $message) + { + // + } + + /** + * Update the specified resource in storage. + * + * @param \Illuminate\Http\Request $request + * @param \App\Message $message + * @return \Illuminate\Http\Response + */ + public function update(Request $request, Message $message) + { + // + } + + /** + * Remove the specified resource from storage. + * + * @param \App\Message $message + * @return \Illuminate\Http\Response + */ + public function destroy() + { + $id = request('id'); + + $msg = Message::find($id); + + $msg->delete(); + } +} diff --git a/app/Http/Controllers/RankController.php b/app/Http/Controllers/RankController.php new file mode 100644 index 00000000..db5b967b --- /dev/null +++ b/app/Http/Controllers/RankController.php @@ -0,0 +1,85 @@ + $UserList]); + } + + /** + * Show the form for creating a new resource. + * + * @return \Illuminate\Http\Response + */ + public function create() + { + // + } + + /** + * Store a newly created resource in storage. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function store(Request $request) + { + // + } + + /** + * Display the specified resource. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function show($id) + { + // + } + + /** + * Show the form for editing the specified resource. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function edit($id) + { + // + } + + /** + * Update the specified resource in storage. + * + * @param \Illuminate\Http\Request $request + * @param int $id + * @return \Illuminate\Http\Response + */ + public function update(Request $request, $id) + { + // + } + + /** + * Remove the specified resource from storage. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function destroy() + { + $id = request('id'); + + $user = User::find($id); + + $user->delete(); + } +} diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 3439540c..76785d61 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -59,5 +59,7 @@ class Kernel extends HttpKernel 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, + 'staff' => \App\Http\Middleware\AccesStaff::class, + 'admin' => \App\Http\Middleware\AccesAdmin::class, ]; } diff --git a/app/Http/Middleware/AccesAdmin.php b/app/Http/Middleware/AccesAdmin.php new file mode 100644 index 00000000..71770222 --- /dev/null +++ b/app/Http/Middleware/AccesAdmin.php @@ -0,0 +1,24 @@ +getAcces(2) == false) { + abort(401); + } + + return $next($request); + } +} diff --git a/app/Http/Middleware/AccesStaff.php b/app/Http/Middleware/AccesStaff.php new file mode 100644 index 00000000..03c0dea6 --- /dev/null +++ b/app/Http/Middleware/AccesStaff.php @@ -0,0 +1,23 @@ +getAcces(1) == false) { + abord(401); + } + return $next($request); + } +} diff --git a/app/Job.php b/app/Job.php new file mode 100644 index 00000000..73a19e40 --- /dev/null +++ b/app/Job.php @@ -0,0 +1,12 @@ + 'array', + ]; +} diff --git a/app/Message.php b/app/Message.php new file mode 100644 index 00000000..a537497e --- /dev/null +++ b/app/Message.php @@ -0,0 +1,12 @@ + 'array', + ]; +} diff --git a/app/Notifications/mail.php b/app/Notifications/mail.php new file mode 100644 index 00000000..16a007a6 --- /dev/null +++ b/app/Notifications/mail.php @@ -0,0 +1,52 @@ +myMsg = $msg; + $this->myTitle = $title; + $this->notifiable = $notifiable; + } + + /** + * Get the notification's delivery channels. + * + * @param mixed $notifiable + * @return array + */ + public function via($notifiable) + { + return ['mail']; + } + + /** + * Get the mail representation of the notification. + * + * @param mixed $notifiable + * @return \Illuminate\Notifications\Messages\MailMessage + */ + public function toMail($notifiable) + { + return (new MailMessage) + ->subject($this->myTitle.' - '.config('squadron.fullname')) + ->line('Vous avez reçus une nouvelle notification !') + ->line($this->myMsg) + ->action("Consulter !", url('/login')) + ->line('Merci'); + } +} diff --git a/app/Notifications/sms.php b/app/Notifications/sms.php new file mode 100644 index 00000000..d46ebe63 --- /dev/null +++ b/app/Notifications/sms.php @@ -0,0 +1,49 @@ +myNotification = $msg; + $this->notifiable = $notifiable; + } + + /** + * Get the notification's delivery channels. + * + * @param mixed $notifiable + * @return array + */ + public function via($notifiable) + { + return ['nexmo']; + } + + /** + * Get the mail representation of the notification. + * + * @param mixed $notifiable + * @return \Illuminate\Notifications\Messages\MailMessage + */ + public function toNexmo($notifiable) + { + return (new NexmoMessage) + ->content($this->myNotification) + ->unicode(); + } +} diff --git a/app/Rank.php b/app/Rank.php new file mode 100644 index 00000000..1e74e9cb --- /dev/null +++ b/app/Rank.php @@ -0,0 +1,12 @@ + 'array', + ]; +} diff --git a/app/User.php b/app/User.php index ebed9892..17296c45 100644 --- a/app/User.php +++ b/app/User.php @@ -32,9 +32,69 @@ class User extends Authenticatable return $this->hasMany(Log::class); } + public function updateAPI() + { + $this->api_token = str_random(60); + + $this->save(); + } + public function fullname() { $fullname = $this->lastname.' '.$this->firstname; return $fullname; } + + public function messages() + { + return $this->hasMany(Message::class); + } + + public function routeNotificationForNexmo($notification) + { + return $this->telephone; + } + + public function getPerm($perm) + { + $rank = \App\Rank::find($this->rank); + $job = \App\Job::find($this->job); + + $rank_perm_value = $rank->$perm; + $job_perm_value = $job->$perm; + $user_perm_value = $this->$perm; + + if ($user_perm_value == 1 ) { + $perm_value = 1; + } else if ($job_perm_value== 1) { + $perm_value = 1; + } else if ($rank_perm_value == 1) { + $perm_value = 1; + } else { + $perm_value = 0; + } + + return $perm_value; + } + + public function getAcces($level) + { + $rank = \App\Rank::find($this->rank); + $job = \App\Job::find($this->job); + + $rank_perm_value = $rank->acces_level; + $job_perm_value = $job->acces_level; + $user_perm_value = $this->acces_level; + + if ($user_perm_value >= $level ) { + $perm_value = true; + } else if ($job_perm_value >= $level) { + $perm_value = true; + } else if ($rank_perm_value >= $level) { + $perm_value = true; + } else { + $perm_value = false; + } + return $perm_value; + } } diff --git a/bootstrap/app.php b/bootstrap/app.php old mode 100644 new mode 100755 diff --git a/composer.json b/composer.json index 65bf8b4f..bf2e145f 100644 --- a/composer.json +++ b/composer.json @@ -7,8 +7,10 @@ "require": { "php": "^7.1.3", "fideloper/proxy": "^4.0", + "guzzlehttp/guzzle": "^6.3", "laravel/framework": "5.6.*", - "laravel/tinker": "^1.0" + "laravel/tinker": "^1.0", + "nexmo/client": "^1.4" }, "require-dev": { "filp/whoops": "^2.0", diff --git a/composer.lock b/composer.lock index 078de7b2..c433da54 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d5bca48e56bbf3a25645858fcab9c285", + "content-hash": "b914f34bb5ca62a2b7d916629dc30d1a", "packages": [ { "name": "dnoegel/php-xdg-base-dir", @@ -366,6 +366,187 @@ ], "time": "2018-02-07T20:20:57+00:00" }, + { + "name": "guzzlehttp/guzzle", + "version": "6.3.3", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba", + "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba", + "shasum": "" + }, + "require": { + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.4", + "php": ">=5.5" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", + "psr/log": "^1.0" + }, + "suggest": { + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.3-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2018-04-22T15:46:56+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2016-12-20T10:07:11+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c", + "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "request", + "response", + "stream", + "uri", + "url" + ], + "time": "2017-03-20T17:10:46+00:00" + }, { "name": "jakub-onderka/php-console-color", "version": "0.1", @@ -655,6 +836,64 @@ ], "time": "2018-05-17T13:42:07+00:00" }, + { + "name": "lcobucci/jwt", + "version": "3.2.4", + "source": { + "type": "git", + "url": "https://github.com/lcobucci/jwt.git", + "reference": "c9704b751315d21735dc98d78d4f37bd73596da7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/lcobucci/jwt/zipball/c9704b751315d21735dc98d78d4f37bd73596da7", + "reference": "c9704b751315d21735dc98d78d4f37bd73596da7", + "shasum": "" + }, + "require": { + "ext-openssl": "*", + "php": ">=5.5" + }, + "require-dev": { + "mdanter/ecc": "~0.3.1", + "mikey179/vfsstream": "~1.5", + "phpmd/phpmd": "~2.2", + "phpunit/php-invoker": "~1.1", + "phpunit/phpunit": "~4.5", + "squizlabs/php_codesniffer": "~2.3" + }, + "suggest": { + "mdanter/ecc": "Required to use Elliptic Curves based algorithms." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Lcobucci\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Luís Otávio Cobucci Oblonczyk", + "email": "lcobucci@gmail.com", + "role": "Developer" + } + ], + "description": "A simple library to work with JSON Web Token and JSON Web Signature", + "keywords": [ + "JWS", + "jwt" + ], + "time": "2018-08-03T11:23:50+00:00" + }, { "name": "league/flysystem", "version": "1.0.45", @@ -870,6 +1109,54 @@ ], "time": "2018-03-19T15:50:49+00:00" }, + { + "name": "nexmo/client", + "version": "1.4.0", + "source": { + "type": "git", + "url": "https://github.com/Nexmo/nexmo-php.git", + "reference": "b2a5d5fa371e0f4c8ce20e7f1282bb2bbe303703" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Nexmo/nexmo-php/zipball/b2a5d5fa371e0f4c8ce20e7f1282bb2bbe303703", + "reference": "b2a5d5fa371e0f4c8ce20e7f1282bb2bbe303703", + "shasum": "" + }, + "require": { + "lcobucci/jwt": "^3.2", + "php": ">=5.6", + "php-http/client-implementation": "^1.0", + "php-http/guzzle6-adapter": "^1.0", + "zendframework/zend-diactoros": "^1.3" + }, + "require-dev": { + "estahn/phpunit-json-assertions": "@stable", + "php-http/mock-client": "^0.3.0", + "phpunit/phpunit": "^5.3", + "squizlabs/php_codesniffer": "^3.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Nexmo\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Tim Lytle", + "email": "tim@nexmo.com", + "homepage": "http://twitter.com/tjlytle", + "role": "Developer" + } + ], + "description": "PHP Client for using Nexmo's API.", + "time": "2018-06-03T18:00:34+00:00" + }, { "name": "nikic/php-parser", "version": "v4.0.2", @@ -970,6 +1257,172 @@ ], "time": "2018-07-04T16:31:37+00:00" }, + { + "name": "php-http/guzzle6-adapter", + "version": "v1.1.1", + "source": { + "type": "git", + "url": "https://github.com/php-http/guzzle6-adapter.git", + "reference": "a56941f9dc6110409cfcddc91546ee97039277ab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/guzzle6-adapter/zipball/a56941f9dc6110409cfcddc91546ee97039277ab", + "reference": "a56941f9dc6110409cfcddc91546ee97039277ab", + "shasum": "" + }, + "require": { + "guzzlehttp/guzzle": "^6.0", + "php": ">=5.5.0", + "php-http/httplug": "^1.0" + }, + "provide": { + "php-http/async-client-implementation": "1.0", + "php-http/client-implementation": "1.0" + }, + "require-dev": { + "ext-curl": "*", + "php-http/adapter-integration-tests": "^0.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2-dev" + } + }, + "autoload": { + "psr-4": { + "Http\\Adapter\\Guzzle6\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + }, + { + "name": "David de Boer", + "email": "david@ddeboer.nl" + } + ], + "description": "Guzzle 6 HTTP Adapter", + "homepage": "http://httplug.io", + "keywords": [ + "Guzzle", + "http" + ], + "time": "2016-05-10T06:13:32+00:00" + }, + { + "name": "php-http/httplug", + "version": "v1.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-http/httplug.git", + "reference": "1c6381726c18579c4ca2ef1ec1498fdae8bdf018" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/httplug/zipball/1c6381726c18579c4ca2ef1ec1498fdae8bdf018", + "reference": "1c6381726c18579c4ca2ef1ec1498fdae8bdf018", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "php-http/promise": "^1.0", + "psr/http-message": "^1.0" + }, + "require-dev": { + "henrikbjorn/phpspec-code-coverage": "^1.0", + "phpspec/phpspec": "^2.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "Http\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Eric GELOEN", + "email": "geloen.eric@gmail.com" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + } + ], + "description": "HTTPlug, the HTTP client abstraction for PHP", + "homepage": "http://httplug.io", + "keywords": [ + "client", + "http" + ], + "time": "2016-08-31T08:30:17+00:00" + }, + { + "name": "php-http/promise", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-http/promise.git", + "reference": "dc494cdc9d7160b9a09bd5573272195242ce7980" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/promise/zipball/dc494cdc9d7160b9a09bd5573272195242ce7980", + "reference": "dc494cdc9d7160b9a09bd5573272195242ce7980", + "shasum": "" + }, + "require-dev": { + "henrikbjorn/phpspec-code-coverage": "^1.0", + "phpspec/phpspec": "^2.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "Http\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + }, + { + "name": "Joel Wurtz", + "email": "joel.wurtz@gmail.com" + } + ], + "description": "Promise used for asynchronous HTTP requests", + "homepage": "http://httplug.io", + "keywords": [ + "promise" + ], + "time": "2016-01-26T13:27:02+00:00" + }, { "name": "psr/container", "version": "1.0.0", @@ -1019,6 +1472,56 @@ ], "time": "2017-02-14T16:28:37+00:00" }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06T14:39:51+00:00" + }, { "name": "psr/log", "version": "1.0.2", @@ -2290,6 +2793,69 @@ "environment" ], "time": "2018-07-01T10:25:50+00:00" + }, + { + "name": "zendframework/zend-diactoros", + "version": "1.8.5", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-diactoros.git", + "reference": "3e4edb822c942f37ade0d09579cfbab11e2fee87" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-diactoros/zipball/3e4edb822c942f37ade0d09579cfbab11e2fee87", + "reference": "3e4edb822c942f37ade0d09579cfbab11e2fee87", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0", + "psr/http-message": "^1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "ext-dom": "*", + "ext-libxml": "*", + "phpunit/phpunit": "^5.7.16 || ^6.0.8 || ^7.2.7", + "zendframework/zend-coding-standard": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8.x-dev", + "dev-develop": "1.9.x-dev", + "dev-release-2.0": "2.0.x-dev" + } + }, + "autoload": { + "files": [ + "src/functions/create_uploaded_file.php", + "src/functions/marshal_headers_from_sapi.php", + "src/functions/marshal_method_from_sapi.php", + "src/functions/marshal_protocol_version_from_sapi.php", + "src/functions/marshal_uri_from_sapi.php", + "src/functions/normalize_server.php", + "src/functions/normalize_uploaded_files.php", + "src/functions/parse_cookie_header.php" + ], + "psr-4": { + "Zend\\Diactoros\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "description": "PSR HTTP Message implementations", + "homepage": "https://github.com/zendframework/zend-diactoros", + "keywords": [ + "http", + "psr", + "psr-7" + ], + "time": "2018-08-10T14:16:32+00:00" } ], "packages-dev": [ diff --git a/config/app.php b/config/app.php index 7657817f..642649e6 100644 --- a/config/app.php +++ b/config/app.php @@ -65,7 +65,7 @@ return [ | */ - 'timezone' => 'UTC', + 'timezone' => 'America/New_York', /* |-------------------------------------------------------------------------- diff --git a/config/mail.php b/config/mail.php index bb92224c..86eaf54d 100644 --- a/config/mail.php +++ b/config/mail.php @@ -16,7 +16,7 @@ return [ | */ - 'driver' => env('MAIL_DRIVER', 'smtp'), + 'driver' => env('MAIL_DRIVER', 'mailgun'), /* |-------------------------------------------------------------------------- diff --git a/config/services.php b/config/services.php index aa1f7f82..1b92d078 100644 --- a/config/services.php +++ b/config/services.php @@ -15,8 +15,8 @@ return [ */ 'mailgun' => [ - 'domain' => env('MAILGUN_DOMAIN'), - 'secret' => env('MAILGUN_SECRET'), + 'domain' => "mail.c-cms.cf", + 'secret' => "2b3638c8d4ec6e6d1f2987a4f02024fb-a5d1a068-beffcbdb", ], 'ses' => [ @@ -35,4 +35,9 @@ return [ 'secret' => env('STRIPE_SECRET'), ], + 'nexmo' => [ + 'key' => env('NEXMO_KEY'), + 'secret' => env('NEXMO_SECRET'), + 'sms_from' => '12046743506', + ], ]; diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index 358c17b9..85278a53 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -19,13 +19,30 @@ class CreateUsersTable extends Migration $table->string('lastname'); $table->string('email')->unique(); $table->string('password'); - $table->string('rank')->default('0'); - $table->string('adress'); - $table->string('telephone'); + $table->string('rank')->default(1); + $table->string('adress')->default('null'); + $table->string('telephone')->default('null'); $table->string('age'); - $table->string('avatar'); + $table->string('avatar')->default('null'); $table->string('sexe'); - $table->string('job'); + $table->string('job')->default(6); + $table->integer('acces_level')->default(0); + $table->string('schedule_see')->default(0); + $table->string('schedule_edit')->default(0); + $table->string('schedule_notify')->default(0); + $table->string('message_see')->default(0); + $table->string('message_edit')->default(0); + $table->string('message_notify')->default(0); + $table->string('paper_edit')->default(0); + $table->string('paper_publish')->default(0); + $table->string('paper_notify')->default(0); + $table->string('inventory_see')->default(0); + $table->string('inventory_edit')->default(0); + $table->string('inventory_notify')->default(0); + $table->string('user_see')->default(0); + $table->string('user_edit')->default(0); + $table->string('user_notify')->default(0); + $table->string('api_token', 60)->unique()->default(str_random(60)); $table->rememberToken(); $table->timestamps(); }); diff --git a/database/migrations/2018_08_21_094628_create_jobs_table.php b/database/migrations/2018_08_21_094628_create_jobs_table.php new file mode 100644 index 00000000..d2747004 --- /dev/null +++ b/database/migrations/2018_08_21_094628_create_jobs_table.php @@ -0,0 +1,49 @@ +increments('id'); + $table->string('name'); + $table->text('desc'); + $table->text('acces_level'); + $table->boolean('schedule_see'); + $table->boolean('schedule_edit'); + $table->boolean('schedule_notify'); + $table->boolean('message_see'); + $table->boolean('message_edit'); + $table->boolean('message_notify'); + $table->boolean('paper_edit'); + $table->boolean('paper_publish'); + $table->boolean('paper_notify'); + $table->boolean('inventory_see'); + $table->boolean('inventory_edit'); + $table->boolean('inventory_notify'); + $table->boolean('user_see'); + $table->boolean('user_edit'); + $table->boolean('user_notify'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('jobs'); + } +} diff --git a/database/migrations/2018_08_21_094646_create_ranks_table.php b/database/migrations/2018_08_21_094646_create_ranks_table.php new file mode 100644 index 00000000..69bea7da --- /dev/null +++ b/database/migrations/2018_08_21_094646_create_ranks_table.php @@ -0,0 +1,48 @@ +increments('id'); + $table->string('name'); + $table->text('acces_level'); + $table->boolean('schedule_see'); + $table->boolean('schedule_edit'); + $table->boolean('schedule_notify'); + $table->boolean('message_see'); + $table->boolean('message_edit'); + $table->boolean('message_notify'); + $table->boolean('paper_edit'); + $table->boolean('paper_publish'); + $table->boolean('paper_notify'); + $table->boolean('inventory_see'); + $table->boolean('inventory_edit'); + $table->boolean('inventory_notify'); + $table->boolean('user_see'); + $table->boolean('user_edit'); + $table->boolean('user_notify'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('ranks'); + } +} diff --git a/database/migrations/2018_08_21_135453_create_messages_table.php b/database/migrations/2018_08_21_135453_create_messages_table.php new file mode 100644 index 00000000..54d4050e --- /dev/null +++ b/database/migrations/2018_08_21_135453_create_messages_table.php @@ -0,0 +1,37 @@ +increments('id'); + $table->string('title'); + $table->text('body'); + $table->boolean('publish'); + $table->boolean('private'); + $table->integer('user_id'); + $table->text('data'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('messages'); + } +} diff --git a/database/migrations/2018_08_29_172124_create_configs_table.php b/database/migrations/2018_08_29_172124_create_configs_table.php new file mode 100644 index 00000000..a93f2700 --- /dev/null +++ b/database/migrations/2018_08_29_172124_create_configs_table.php @@ -0,0 +1,34 @@ +increments('id'); + $table->string('name'); + $table->boolean('state'); + $table->text('data'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('configs'); + } +} diff --git a/database/seeds/ConfigsTableSeeder.php b/database/seeds/ConfigsTableSeeder.php new file mode 100644 index 00000000..c13f2602 --- /dev/null +++ b/database/seeds/ConfigsTableSeeder.php @@ -0,0 +1,22 @@ +insert([ + [ + 'name' => 'is_schedule_public', + 'state' => 0, + 'data' => 'null' + ] + ]); + } +} diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php index 91cb6d1c..ca430b50 100644 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeds/DatabaseSeeder.php @@ -11,6 +11,10 @@ class DatabaseSeeder extends Seeder */ public function run() { - // $this->call(UsersTableSeeder::class); + $this->call([ + JobsTableSeeder::class, + RanksTableSeeder::class, + ConfigsTableSeeder::class + ]); } } diff --git a/database/seeds/JobsTableSeeder.php b/database/seeds/JobsTableSeeder.php new file mode 100644 index 00000000..c3f05fe4 --- /dev/null +++ b/database/seeds/JobsTableSeeder.php @@ -0,0 +1,97 @@ +insert([ + [ + 'name' => "Indéterminé", + 'desc' => "Aucun poste", + 'acces_level' => '0', + 'schedule_see' => false, + 'schedule_edit' => false, + 'schedule_notify' => false, + 'message_see' => false, + 'message_edit' => false, + 'message_notify' => false, + 'paper_edit' => false, + 'paper_publish' => false, + 'paper_notify' => false, + 'inventory_see' => false, + 'inventory_edit' => false, + 'inventory_notify' => false, + 'user_see' => false, + 'user_edit' => false, + 'user_notify' => false + ], + [ + 'name' => "Cadet Commandant", + 'desc' => "Description a modifier ...", + 'acces_level' => '2', + 'schedule_see' => true, + 'schedule_edit' => true, + 'schedule_notify' => true, + 'message_see' => true, + 'message_edit' => true, + 'message_notify' => true, + 'paper_edit' => true, + 'paper_publish' => true, + 'paper_notify' => false, + 'inventory_see' => true, + 'inventory_edit' => true, + 'inventory_notify' => false, + 'user_see' => true, + 'user_edit' => true, + 'user_notify' => false + ], + [ + 'name' => "Chef Instructeur", + 'desc' => "Description a modifier ...", + 'acces_level' => '2', + 'schedule_see' => true, + 'schedule_edit' => true, + 'schedule_notify' => false, + 'message_see' => true, + 'message_edit' => true, + 'message_notify' => true, + 'paper_edit' => true, + 'paper_publish' => true, + 'paper_notify' => false, + 'inventory_see' => true, + 'inventory_edit' => true, + 'inventory_notify' => false, + 'user_see' => true, + 'user_edit' => false, + 'user_notify' => false + ], + [ + 'name' => "Adjudant Maitre d'Escadron", + 'desc' => "Description a modifier ...", + 'acces_level' => '2', + 'schedule_see' => true, + 'schedule_edit' => false, + 'schedule_notify' => false, + 'message_see' => true, + 'message_edit' => true, + 'message_notify' => true, + 'paper_edit' => true, + 'paper_publish' => true, + 'paper_notify' => false, + 'inventory_see' => true, + 'inventory_edit' => true, + 'inventory_notify' => false, + 'user_see' => true, + 'user_edit' => false, + 'user_notify' => false + ] + ]); + } +} diff --git a/database/seeds/RanksTableSeeder.php b/database/seeds/RanksTableSeeder.php new file mode 100644 index 00000000..e5ca8a9c --- /dev/null +++ b/database/seeds/RanksTableSeeder.php @@ -0,0 +1,188 @@ +insert([ + [ + 'name' => "SuperAdmin", + 'acces_level' => '2', + 'schedule_see' => true, + 'schedule_edit' => true, + 'schedule_notify' => true, + 'message_see' => true, + 'message_edit' => true, + 'message_notify' => true, + 'paper_edit' => true, + 'paper_publish' => true, + 'paper_notify' => true, + 'inventory_see' => true, + 'inventory_edit' => true, + 'inventory_notify' => true, + 'user_see' => true, + 'user_edit' => true, + 'user_notify' => true + ], + [ + 'name' => "Cadet", + 'acces_level' => '0', + 'schedule_see' => false, + 'schedule_edit' => false, + 'schedule_notify' => false, + 'message_see' => false, + 'message_edit' => false, + 'message_notify' => false, + 'paper_edit' => false, + 'paper_publish' => false, + 'paper_notify' => false, + 'inventory_see' => false, + 'inventory_edit' => false, + 'inventory_notify' => false, + 'user_see' => false, + 'user_edit' => false, + 'user_notify' => false + ], + [ + 'name' => "1er classe", + 'acces_level' => '0', + 'schedule_see' => false, + 'schedule_edit' => false, + 'schedule_notify' => false, + 'message_see' => false, + 'message_edit' => false, + 'message_notify' => false, + 'paper_edit' => false, + 'paper_publish' => false, + 'paper_notify' => false, + 'inventory_see' => false, + 'inventory_edit' => false, + 'inventory_notify' => false, + 'user_see' => false, + 'user_edit' => false, + 'user_notify' => false + ], + [ + 'name' => "Caporal", + 'acces_level' => '0', + 'schedule_see' => false, + 'schedule_edit' => false, + 'schedule_notify' => false, + 'message_see' => false, + 'message_edit' => false, + 'message_notify' => false, + 'paper_edit' => false, + 'paper_publish' => false, + 'paper_notify' => false, + 'inventory_see' => false, + 'inventory_edit' => false, + 'inventory_notify' => false, + 'user_see' => false, + 'user_edit' => false, + 'user_notify' => false + ], + [ + 'name' => "Caporal de section", + 'acces_level' => '0', + 'schedule_see' => false, + 'schedule_edit' => false, + 'schedule_notify' => false, + 'message_see' => false, + 'message_edit' => false, + 'message_notify' => false, + 'paper_edit' => false, + 'paper_publish' => false, + 'paper_notify' => false, + 'inventory_see' => false, + 'inventory_edit' => false, + 'inventory_notify' => false, + 'user_see' => false, + 'user_edit' => false, + 'user_notify' => false + ], + [ + 'name' => "Sergent", + 'acces_level' => '1', + 'schedule_see' => true, + 'schedule_edit' => false, + 'schedule_notify' => false, + 'message_see' => true, + 'message_edit' => false, + 'message_notify' => true, + 'paper_edit' => false, + 'paper_publish' => false, + 'paper_notify' => false, + 'inventory_see' => true, + 'inventory_edit' => false, + 'inventory_notify' => false, + 'user_see' => false, + 'user_edit' => false, + 'user_notify' => false + ], + [ + 'name' => "Sergent de section", + 'acces_level' => '1', + 'schedule_see' => true, + 'schedule_edit' => false, + 'schedule_notify' => false, + 'message_see' => true, + 'message_edit' => false, + 'message_notify' => true, + 'paper_edit' => false, + 'paper_publish' => false, + 'paper_notify' => false, + 'inventory_see' => true, + 'inventory_edit' => false, + 'inventory_notify' => false, + 'user_see' => false, + 'user_edit' => false, + 'user_notify' => false + ], + [ + 'name' => "Adjudant 2e Classe", + 'acces_level' => '2', + 'schedule_see' => true, + 'schedule_edit' => false, + 'schedule_notify' => false, + 'message_see' => true, + 'message_edit' => true, + 'message_notify' => true, + 'paper_edit' => true, + 'paper_publish' => false, + 'paper_notify' => false, + 'inventory_see' => true, + 'inventory_edit' => false, + 'inventory_notify' => false, + 'user_see' => true, + 'user_edit' => false, + 'user_notify' => false + ], + [ + 'name' => "Adjudant 1er Classe", + 'acces_level' => '2', + 'schedule_see' => true, + 'schedule_edit' => true, + 'schedule_notify' => true, + 'message_see' => true, + 'message_edit' => true, + 'message_notify' => true, + 'paper_edit' => true, + 'paper_publish' => true, + 'paper_notify' => true, + 'inventory_see' => true, + 'inventory_edit' => true, + 'inventory_notify' => true, + 'user_see' => true, + 'user_edit' => true, + 'user_notify' => true + ], + ]); + } +} diff --git a/database/seeds/UsersTableSeeder.php b/database/seeds/UsersTableSeeder.php new file mode 100644 index 00000000..362668fb --- /dev/null +++ b/database/seeds/UsersTableSeeder.php @@ -0,0 +1,16 @@ + div { + text-align:start; +} +@media only screen and (max-width: 800px) { + .calendar-container{ + width: 100%; + } + .calendar-head{ + display: none; + } + .calendar-empty{ + display: none; + } +} + .btn-calendar{ padding: 36px 0; height: 7.5rem; diff --git a/public/assets/js/calendar/calendar.js b/public/assets/js/calendar/calendar.js index 759d7fbc..e2756bae 100644 --- a/public/assets/js/calendar/calendar.js +++ b/public/assets/js/calendar/calendar.js @@ -22,7 +22,7 @@ function openCalendar(btnDate) { (function($) { var calendarModal = $('.modal-content'); - $.post('/api/calendar/loadDay', { date: btnDate } , function(data) { + $.post('/api/calendar/loadDay?api_token='+api_token, { date: btnDate } , function(data) { calendarModal.replaceWith(data); console.log('Test'); }); @@ -35,7 +35,7 @@ function calendarOpen(myid) { var mydate = document.getElementById(myid).name; $(function() { var loadingDiv = $('#calendarmodalload'); - $.get('/adminV2/assets/lib/calendar/calendarmodal.php?date='+mydate, function(data) { + $.get('/adminV2/assets/lib/calendar/calendarmodal.php?date='+mydate+'&api_token='+api_token, function(data) { loadingDiv.replaceWith(data); console.log("Loading day: "+mydate); }); @@ -46,7 +46,7 @@ function calendarEmptyDay(myid) { var mydate = document.getElementById(myid).name; $(function() { var loadingDiv = $('#calendarmodalload'); - $.get('/adminV2/assets/lib/calendar/calendarEmptyDay.php?date='+mydate, function(data) { + $.get('/adminV2/assets/lib/calendar/calendarEmptyDay.php?date='+mydate+'&api_token='+api_token, function(data) { loadingDiv.replaceWith(data); console.log("Loading empty day: "+mydate); }); @@ -57,7 +57,7 @@ function generate(pmonth,pyear){ (function($) { var mycalendar = $('.calendar'); - $.post('/api/calendar/generate', { month: pmonth, year: pyear } , function(data) { + $.post('/api/calendar/generate?api_token='+api_token, { month: pmonth, year: pyear } , function(data) { mycalendar.replaceWith(data); console.log('Calendar Initialised'); diff --git a/resources/views/admin/calendar/calendar_add.blade.php b/resources/views/admin/calendar/calendar_add.blade.php index 216a2f31..98a9550b 100644 --- a/resources/views/admin/calendar/calendar_add.blade.php +++ b/resources/views/admin/calendar/calendar_add.blade.php @@ -329,5 +329,12 @@ @section('custom_scripts') +
@endsection \ No newline at end of file diff --git a/resources/views/admin/calendar/calendar_display.blade.php b/resources/views/admin/calendar/calendar_display.blade.php index 2ce50c3d..c3556361 100644 --- a/resources/views/admin/calendar/calendar_display.blade.php +++ b/resources/views/admin/calendar/calendar_display.blade.php @@ -16,7 +16,11 @@ - + @if (!\App\Config::find(1)->state) + + @endif
@@ -70,24 +74,38 @@
@endsection \ No newline at end of file diff --git a/resources/views/admin/calendar/calendar_edit.blade.php b/resources/views/admin/calendar/calendar_edit.blade.php index 15fda4f6..a1f432a9 100644 --- a/resources/views/admin/calendar/calendar_edit.blade.php +++ b/resources/views/admin/calendar/calendar_edit.blade.php @@ -364,6 +364,13 @@ @section('custom_scripts') +
@endsection \ No newline at end of file diff --git a/resources/views/admin/job/add.blade.php b/resources/views/admin/job/add.blade.php new file mode 100644 index 00000000..bf92067b --- /dev/null +++ b/resources/views/admin/job/add.blade.php @@ -0,0 +1,227 @@ +@extends('layouts.admin.main') + +@section('content') +
+
+
+ Messages au staff + +
+
+ +
+
+ @foreach ($jobs as $job) +
+

{{ $job->desc }}

+
+
+ Description du poste
+
+
+
+
+
+ +
+
+
+
L'utilisateur avec ce poste peut t'il consulter les détails de l'horaire
+
+ + +
+
L'utilisateur avec ce poste peut t'il ajouter, modifier et supprimer des événements a l'horaire
+
+ + +
+
+
+
L'utilisateur avec ce poste doit t-il recevoir des notifiation pour tous les changements a l'horaire.
+
+ + +
+
L'utilisateur avec ce poste peut t'il consulter les messages
+
+ + +
+
+
+
L'utilisateur avec ce poste peut t'il ajouter, modifier et supprimer des messages
+
+ + +
+
L'utilisateur avec ce poste doit t-il recevoir des notifiation pour tous les changements en lien avec les messages.
+
+ + +
+
+
+
L'utilisateur avec ce poste peut t'il ajouter, modifier et supprimer des articles
+
+ + +
+
L'utilisateur avec ce poste peux t-il autoriser la publication ou appouver des changements a un articles
+
+ + +
+
+
+
L'utilisateur avec ce poste doit t-il recevoir des notifiation pour tous les changements en lien avec les articles.
+
+ + +
+
L'utilisateur avec ce poste peut t'il consulter l'inventaire
+
+ + +
+
+
+
L'utilisateur avec ce poste peut t'il ajouter, modifier et supprimer l'inventaire
+
+ + +
+
L'utilisateur avec ce poste doit t-il recevoir des notifiation pour tous les changements en lien avec les articles.
+
+ + +
+
+
+
L'utilisateur avec ce poste peut t'il ajouter, modifier et supprimer des utilisateurs
+
+ + +
+
L'utilisateur avec ce poste doit t-il recevoir des notifiation pour tous les changements en lien avec les utilisateurs.
+
+ + +
+
+
+ @endforeach + + +
+
+
+
+
+@endsection + +@section('breadcrumb') + +@endsection + +@section('custom_scripts') + + + + + + + + + + + + + + + @foreach ($jobs as $job) + + @endforeach + +@endsection diff --git a/resources/views/admin/job/index.blade.php b/resources/views/admin/job/index.blade.php new file mode 100644 index 00000000..1423fccd --- /dev/null +++ b/resources/views/admin/job/index.blade.php @@ -0,0 +1,237 @@ +@extends('layouts.admin.main') + +@section('content') +
+
+
+ Messages au staff + +
+
+ +
+
+ @foreach ($jobs as $job) +
+

{{ $job->desc }}

+
+
+ Description du poste
+
+
+
+
+
+ +
+
+
+
|| {{$job->schedule_see}} || L'utilisateur avec ce poste peut t'il consulter les détails de l'horaire
+
+ + +
+
|| {{$job->schedule_edit}} || L'utilisateur avec ce poste peut t'il ajouter, modifier et supprimer des événements a l'horaire
+
+ + +
+
+
+
|| {{$job->schedule_notify}} || L'utilisateur avec ce poste doit t-il recevoir des notifiation pour tous les changements a l'horaire.
+
+ + +
+
|| {{$job->message_see}} || L'utilisateur avec ce poste peut t'il consulter les messages
+
+ + +
+
+
+
L'utilisateur avec ce poste peut t'il ajouter, modifier et supprimer des messages
+
+ + +
+
L'utilisateur avec ce poste doit t-il recevoir des notifiation pour tous les changements en lien avec les messages.
+
+ + +
+
+
+
L'utilisateur avec ce poste peut t'il ajouter, modifier et supprimer des articles
+
+ + +
+
L'utilisateur avec ce poste peux t-il autoriser la publication ou appouver des changements a un articles
+
+ + +
+
+
+
L'utilisateur avec ce poste doit t-il recevoir des notifiation pour tous les changements en lien avec les articles.
+
+ + +
+
L'utilisateur avec ce poste peut t'il consulter l'inventaire
+
+ + +
+
+
+
L'utilisateur avec ce poste peut t'il ajouter, modifier et supprimer l'inventaire
+
+ + +
+
L'utilisateur avec ce poste doit t-il recevoir des notifiation pour tous les changements en lien avec les articles.
+
+ + +
+
+
+
L'utilisateur avec ce poste peut t'il ajouter, modifier et supprimer des utilisateurs
+
+ + +
+
L'utilisateur avec ce poste doit t-il recevoir des notifiation pour tous les changements en lien avec les utilisateurs.
+
+ + +
+
+
+ @endforeach + + +
+
+
+
+
+@endsection + +@section('breadcrumb') + +@endsection + +@section('custom_scripts') + + + + + + + + + + + + + + + @foreach ($jobs as $job) + + @endforeach + +@endsection diff --git a/resources/views/admin/log/display.blade.php b/resources/views/admin/log/display.blade.php new file mode 100644 index 00000000..19808e8f --- /dev/null +++ b/resources/views/admin/log/display.blade.php @@ -0,0 +1,81 @@ +@extends('layouts.admin.main') + +@section('content') +
+
+
+ Activitées des utilisateurs + +
+
+ +
+ + + + + + + + + + @foreach ($log as $item) + + + + + + @endforeach + + +
Horodatage UtilisateurAction
{{$item->created_at}}{{\App\User::find($item->user_id)->fullname()}}{{$item->action}}
+
+
+
+@endsection + +@section('breadcrumb') + +@endsection + +@section('custom_scripts') + + + + + + + + + + + + + +@endsection diff --git a/resources/views/admin/message/add.blade.php b/resources/views/admin/message/add.blade.php new file mode 100644 index 00000000..1f7cb3a5 --- /dev/null +++ b/resources/views/admin/message/add.blade.php @@ -0,0 +1,70 @@ +@extends('layouts.admin.main') + +@section('content') +
+
+
+ Ajouter un message +
+
+
+ + {{ csrf_field() }} + +
+
+
{{trans('calendar.add_form_event_name_help')}}
+
+
+
+
+ Veuillez écrire le message
+
+ + +
+
+
+
+@endsection + +@section('breadcrumb') + +@endsection + +@section('custom_scripts') + + + +
+@endsection \ No newline at end of file diff --git a/resources/views/admin/message/index.blade.php b/resources/views/admin/message/index.blade.php new file mode 100644 index 00000000..ba054e4c --- /dev/null +++ b/resources/views/admin/message/index.blade.php @@ -0,0 +1,125 @@ +@extends('layouts.admin.main') + +@section('content') +
+
+
+ Messages au staff + +
+
+ + + + + + + + + + sortByDesc('created_at'); + $messages = $messages->values(); + + $nbOfMsg = $messages->count(); + $nbOfRow = ceil($nbOfMsg/3); + + for ($i=0; $i < $nbOfRow ; $i++) { + echo ''; + for ($e=0; $e < 3 ; $e++) { + if ($e+(3*$i) < $nbOfMsg) { + echo ''; + } else { + echo ''; + } + } + echo ''; + } + ?> + +

'.$messages[$e+(3*$i)]->title.'


'.\App\User::find($messages[$e+(3*$i)]->user_id)->fullname().' - '.$messages[$e+(3*$i)]->created_at.'

'.$messages[$e+(3*$i)]->body.'
+
+
+
+@endsection + +@section('breadcrumb') + +@endsection + +@section('custom_scripts') + + + + + + + + + + + + + +@endsection diff --git a/resources/views/admin/message/show.blade.php b/resources/views/admin/message/show.blade.php new file mode 100644 index 00000000..5daccbc1 --- /dev/null +++ b/resources/views/admin/message/show.blade.php @@ -0,0 +1,46 @@ +@extends('layouts.admin.main') + +@section('content') +
+
+
+ {{ $message->title}} par {{ \App\User::find($message->user_id)->fullname() }} publié le {{$message->updated_at}} +
+
+ {!! $message->body !!} +
+
+
+@endsection + +@section('breadcrumb') + +@endsection + +@section('custom_scripts') + +
+@endsection \ No newline at end of file diff --git a/resources/views/admin/update.blade.php b/resources/views/admin/update.blade.php index 86506d98..b232b269 100644 --- a/resources/views/admin/update.blade.php +++ b/resources/views/admin/update.blade.php @@ -2,6 +2,51 @@ @section('content') + +
+ ALPHA 3.0.2STABLE ALPHA +
+
+

+ Nouveauté +

+

+
+

+ Back End & API +

+

+
+

+ Correction de bug +

+

+ 2018-05-09 13:20 +
+
ALPHA 3.0.1eUNSTABLE ALPHA diff --git a/resources/views/admin/user/index.blade.php b/resources/views/admin/user/index.blade.php new file mode 100644 index 00000000..aa20cfcd --- /dev/null +++ b/resources/views/admin/user/index.blade.php @@ -0,0 +1,118 @@ +@extends('layouts.admin.main') + +@section('content') +
+
+
+ Liste des utilisateurs + +
+
+ + + + + + + + + + + + @foreach ($Userslist as $item) + + + + + + + + @endforeach + +
IDNomGradePoste
{{$item->id}}{{$item->fullname()}}{{\App\Rank::find($item->rank)->name}}{{\App\Job::find($item->job)->name}}  Modifier
+
+ Ajouter un utilisateur +
+
+
+@endsection + +@section('breadcrumb') + +@endsection + +@section('custom_scripts') + + + + + + + + + + + + + +@endsection diff --git a/resources/views/errors/401.blade.php b/resources/views/errors/401.blade.php new file mode 100644 index 00000000..c6aa79dc --- /dev/null +++ b/resources/views/errors/401.blade.php @@ -0,0 +1,90 @@ + + + + + + Error + + + + + + + + +
+
+
+

401

+
+
+ +
+
+
+ Oups ... Vous n'avez pas l'autorisation de venir ici {{ $exception->getMessage() }}
+
+
+ + + \ No newline at end of file diff --git a/resources/views/errors/404.blade.php b/resources/views/errors/404.blade.php new file mode 100644 index 00000000..15a38e3a --- /dev/null +++ b/resources/views/errors/404.blade.php @@ -0,0 +1,90 @@ + + + + + + Error + + + + + + + + +
+
+
+

404

+
+
+ +
+
+
+ Oups ... Il n'y a malheureusement rien là {{ $exception->getMessage() }}
+
+
+ + + \ No newline at end of file diff --git a/resources/views/errors/500.blade.php b/resources/views/errors/500.blade.php new file mode 100644 index 00000000..257a17f6 --- /dev/null +++ b/resources/views/errors/500.blade.php @@ -0,0 +1,90 @@ + + + + + + Error + + + + + + + + +
+
+
+

500

+
+
+ +
+
+
+ Oups ... Le serveur n'aime pas ça, svp laisser lui le temps de soufler {{ $exception->getMessage() }}
+
+
+ + + \ No newline at end of file diff --git a/resources/views/layouts/admin.blade.php b/resources/views/layouts/admin.blade.php index aa201238..9f5e0295 100644 --- a/resources/views/layouts/admin.blade.php +++ b/resources/views/layouts/admin.blade.php @@ -6,7 +6,7 @@ - Espace Administration + Espace Administratio @@ -71,6 +71,10 @@ + + @yield('javascript') @@ -80,24 +84,6 @@ - diff --git a/resources/views/layouts/admin/head.blade.php b/resources/views/layouts/admin/head.blade.php index f9a79265..f5b19579 100644 --- a/resources/views/layouts/admin/head.blade.php +++ b/resources/views/layouts/admin/head.blade.php @@ -21,6 +21,7 @@ + diff --git a/resources/views/layouts/admin/scripts.blade.php b/resources/views/layouts/admin/scripts.blade.php index eb64744e..48fd383f 100644 --- a/resources/views/layouts/admin/scripts.blade.php +++ b/resources/views/layouts/admin/scripts.blade.php @@ -4,6 +4,9 @@ + @@ -12,3 +15,4 @@ + diff --git a/resources/views/layouts/admin/sidebar.blade.php b/resources/views/layouts/admin/sidebar.blade.php index 2766c4b1..47ae7c2e 100644 --- a/resources/views/layouts/admin/sidebar.blade.php +++ b/resources/views/layouts/admin/sidebar.blade.php @@ -18,9 +18,9 @@
  • {{ trans('admin/sidebar.public_page_see')}}
  • -
  • + Horaire
  • + diff --git a/resources/views/public.blade.php b/resources/views/public.blade.php index e4212079..09daeb8a 100644 --- a/resources/views/public.blade.php +++ b/resources/views/public.blade.php @@ -140,10 +140,10 @@