Merge branch '3.2.4' into 'dev'

3.2.4

See merge request TheGamecraft/c-cms!74
This commit is contained in:
Mathieu Lagace
2019-10-19 19:19:20 +00:00
13 changed files with 302 additions and 409 deletions

View File

@@ -50,7 +50,14 @@ class EventController extends Controller
$event->is_mandatory = 0; $event->is_mandatory = 0;
} }
$event->desc = request('desc'); $event->desc = request('desc');
$event->msg = request('msg'); if(\request('msg'))
{
$event->msg = request('msg');
}
else
{
$event->msg = "";
}
$event->date_msg = request('date_msg'); $event->date_msg = request('date_msg');
$event->save(); $event->save();

View File

@@ -43,90 +43,22 @@ class JobController extends Controller
{ {
$job = new Job; $job = new Job;
$job->name = request('name'); $job->name = $request->name;
$job->acces_level = request('acces_level'); $job->desc = $request->desc;
$job->desc = request('desc');
$tpermission = [];
if (null !==(request('schedule_see'))) {
$job->schedule_see = request('schedule_see'); foreach (\App\Permission::all() as $perm)
} else { {
$job->schedule_see = false; $tkey = $perm->ckey;
} $tpermission[$tkey] = $request->$tkey;
if (null !==(request('schedule_edit'))) {
$job->schedule_edit = 1;
} else {
$job->schedule_edit = false;
}
if (null !==(request('schedule_notify'))) {
$job->schedule_notify = 1;
} else {
$job->schedule_notify = false;
}
if (null !==(request('message_see'))) {
$job->message_see = 1;
} else {
$job->message_see = false;
}
if (null !==(request('message_edit'))) {
$job->message_edit = 1;
} else {
$job->message_edit = false;
}
if (null !==(request('message_notify'))) {
$job->message_notify = 1;
} else {
$job->message_notify = false;
}
if (null !==(request('paper_edit'))) {
$job->paper_edit = 1;
} else {
$job->paper_edit = false;
}
if (null !==(request('paper_publish'))) {
$job->paper_publish = 1;
} else {
$job->paper_publish = false;
}
if (null !==(request('paper_notify'))) {
$job->paper_notify = 1;
} else {
$job->paper_notify = false;
}
if (null !==(request('inventory_see'))) {
$job->inventory_see = 1;
} else {
$job->inventory_see = false;
}
if (null !==(request('inventory_edit'))) {
$job->inventory_edit = 1;
} else {
$job->inventory_edit = false;
}
if (null !==(request('inventory_notify'))) {
$job->inventory_notify = 1;
} else {
$job->inventory_notify = false;
}
if (null !==(request('user_see'))) {
$job->user_see = 1;
} else {
$job->user_see = false;
}
if (null !==(request('user_edit'))) {
$job->user_edit = 1;
} else {
$job->user_edit = false;
}
if (null !==(request('user_notify'))) {
$job->user_notify = 1;
} else {
$job->user_notify = false;
} }
$job->permissions = json_encode($tpermission);
$job->save(); $job->save();
return redirect('/admin/config/job/'.$job->id); clog('add','success','Poste ajouté avec succès');
return redirect('/admin/config/jobs')->with('success','Poste ajouté avec succès');
} }
/** /**
@@ -162,19 +94,43 @@ class JobController extends Controller
* @param \App\Job $job * @param \App\Job $job
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function update(Request $request, Job $job) public function update(Request $request, $id)
{ {
// $job = Job::find($id);
$job->name = $request->name;
$job->desc = $request->desc;
$tpermission = [];
foreach (\App\Permission::all() as $perm)
{
$tkey = $perm->ckey;
$tpermission[$tkey] = $request->$tkey;
}
$job->permissions = json_encode($tpermission);
$job->save();
clog('add','success','Poste modifié avec succès');
return redirect('/admin/config/jobs')->with('success','Poste modifié avec succès');
} }
/** /**
* Remove the specified resource from storage. * Remove the specified resource from storage.
* *
* @param \App\Job $job
* @return \Illuminate\Http\Response
*/ */
public function destroy(Job $job) public function destroy(Request $request)
{ {
// $job = Job::find($request->id);
foreach (\App\User::all() as $user)
{
if($user->job->id == $job->id)
{
$user->job_id = 1;
$user->save();
}
}
$job->delete();
} }
} }

View File

@@ -109,12 +109,18 @@ class RankController extends Controller
/** /**
* Remove the specified resource from storage. * Remove the specified resource from storage.
*
* @param \App\Rank $rank
* @return \Illuminate\Http\Response
*/ */
public function destroy(Rank $rank) public function destroy(Request $request)
{ {
// $rank = Rank::find($request->id);
foreach (\App\User::all() as $user)
{
if($user->rank->id == $rank->id)
{
$user->rank_id = 1;
$user->save();
}
}
$rank->delete();
} }
} }

View File

@@ -70,7 +70,7 @@ class UserController extends Controller
$user->avatar = rand(1,16); $user->avatar = rand(1,16);
$user->rank_id = request('rank'); $user->rank_id = request('rank');
$user->job = request('job'); $user->job_id = request('job');
$user->password = bcrypt(request('psw')); $user->password = bcrypt(request('psw'));
$user->api_token = str_random(60); $user->api_token = str_random(60);
@@ -142,7 +142,7 @@ class UserController extends Controller
} }
$user->rank_id = request('rank'); $user->rank_id = request('rank');
$user->job = request('job'); $user->job_id = request('job');
if (request('psw') != null) { if (request('psw') != null) {
$user->password = bcrypt(request('psw')); $user->password = bcrypt(request('psw'));
} }

View File

@@ -32,7 +32,7 @@ class News extends Model
foreach (\App\Event::future() as $event) foreach (\App\Event::future() as $event)
{ {
if($event->type = 1) if($event->type == 1 && $event->msg != "")
{ {
if (date('U',strtotime($event->date_msg)) <= time()) if (date('U',strtotime($event->date_msg)) <= time())
{ {

4
public/js/app.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,4 @@
{ {
"/js/app.js": "/js/app.js", "/js/app.js": "/js/app.js",
"/css/app.css": "/css/app.css",
"/css/material-dashboard.css": "/css/material-dashboard.css",
"/css/custom.css": "/css/custom.css" "/css/custom.css": "/css/custom.css"
} }

View File

@@ -33,7 +33,7 @@
@if($job->id == 1) @if($job->id == 1)
<button disabled class="btn btn-danger btn-just-icon"><i class="fa fa-close"></i></button> <button disabled class="btn btn-danger btn-just-icon"><i class="fa fa-close"></i></button>
@else @else
<button class="btn btn-danger btn-just-icon"><i class="fa fa-close"></i></button> <button class="btn btn-danger btn-just-icon" onclick="deleteJobs({{$job->id}})"><i class="fa fa-close"></i></button>
@endif @endif
</div> </div>
</div> </div>
@@ -46,3 +46,43 @@
</div> </div>
</div> </div>
@endsection @endsection
@section('custom_scripts')
<script>
function deleteJobs(pid){
swal({
title: 'Êtes vous certain ?',
html:
'Vous ne pourrez annuler cette action! <br>' +
'<strong>Veuillez donner un nouveau poste a tous les utilisateurs posédant présentement le poste que vous voulez supprimer</strong>',
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Oui',
cancelButtonText: 'Non'
}).then((result) => {
if (result.value) {
(function($) {
$.post('/api/config/job/delete?api_token='+api_token, { id: pid } , function(data) {
console.log('Delete');
});
})(jQuery);
swal(
'Supprimé!',
"Le poste a été supprimé",
'success'
).then((result) => {
if (result.value) {
location.reload();
}
})
}
})
}
</script>
@endsection

View File

@@ -33,7 +33,7 @@
@if($rank->id == 1) @if($rank->id == 1)
<button disabled class="btn btn-danger btn-just-icon"><i class="fa fa-close"></i></button> <button disabled class="btn btn-danger btn-just-icon"><i class="fa fa-close"></i></button>
@else @else
<button class="btn btn-danger btn-just-icon"><i class="fa fa-close"></i></button> <button class="btn btn-danger btn-just-icon" onclick="deleteRanks({{$rank->id}})"><i class="fa fa-close"></i></button>
@endif @endif
</div> </div>
</div> </div>
@@ -46,3 +46,43 @@
</div> </div>
</div> </div>
@endsection @endsection
@section('custom_scripts')
<script>
function deleteRanks(pid){
swal({
title: 'Êtes vous certain ?',
html:
'Vous ne pourrez annuler cette action! <br>' +
'<strong>Veuillez donner un nouveau grade a tous les utilisateurs posédant présentement le grade que vous voulez supprimer</strong>',
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Oui',
cancelButtonText: 'Non'
}).then((result) => {
if (result.value) {
(function($) {
$.post('/api/config/rank/delete?api_token='+api_token, { id: pid } , function(data) {
console.log('Delete');
});
})(jQuery);
swal(
'Supprimé!',
"Le grade a été supprimé",
'success'
).then((result) => {
if (result.value) {
location.reload();
}
})
}
})
}
</script>
@endsection

View File

@@ -1,167 +1,87 @@
@extends('layouts.admin.main') @extends('layouts.admin.main')
@section('content') @section('content')
<div class="col-md-12"> <div class="col-md-12">
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header card-header-primary">
<strong class="card-title">Ajouter un poste <a href="#"><i class="fa fa-question-circle" aria-hidden="true"></i> <h4>Ajouter un poste</h4>
</a></strong> </div>
</div> <div class="card-body mt-5">
<div class="card-body"> <form method="post" action="/admin/config/jobs/add">
<form action="/admin/config/job/add" method="post"> @csrf
@csrf <div class="row">
<div class="col-md-12">
<div id="myTabContent">
<div id="name" role="tabpanel">
<div class="form-group"> <div class="form-group">
<label for="name">Nom du poste</label> <label>Nom</label>
<input type="text" class="form-control" name="name" id="name" aria-describedby="helpId" placeholder="" required> <input class="form-control" type="text" name="name">
<small id="helpId" class="form-text text-muted">Nom du poste</small> <small class="form-text text-muted">Nom du poste</small>
</div>
<div class="row form-group">
<div class="col-12"><textarea name="desc" id="desc" rows="9" class="form-control" required></textarea>
<small class="form-text text-muted">Description du poste</small></div>
</div>
<hr>
<div class="row form-group">
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Niveau d'accès</label></div>
<div class="col col-md-3">
<select name="acces_level" id="acces_level" class="form-control" required>
<option value="0">Cadet</option>
<option value="regular">Staff</option>
<option value="pilotage">Officer</option>
</select>
</div>
</div>
<div class="row form-group">
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Horaire détaillé</label><small class="form-text text-muted"> L'utilisateur avec ce poste peut t'il consulter les détails de l'horaire</small></div>
<div class="col col-md-3" style="margin: auto;">
<label for="disabled-input" class=" form-control-label"></label>
<label class="switch switch-3d switch-primary mr-3" style="margin-left: 3rem;"><input id="schedule_see" name="schedule_see" class="switch-input" type="checkbox"><span class="switch-label"></span><span class="switch-handle"></span></label>
</div>
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Modification horaire</label><small class="form-text text-muted"> L'utilisateur avec ce poste peut t'il ajouter, modifier et supprimer des événements a l'horaire</small></div>
<div class="col col-md-3" style="margin: auto;">
<label for="disabled-input" class=" form-control-label"></label>
<label class="switch switch-3d switch-primary mr-3" style="margin-left: 3rem;"><input id="schedule_edit" name="schedule_edit" class="switch-input" type="checkbox"><span class="switch-label"></span><span class="switch-handle"></span></label>
</div>
</div>
<div class="row form-group">
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Notifiation horaire</label><small class="form-text text-muted"> L'utilisateur avec ce poste doit t-il recevoir des notifiation pour tous les changements a l'horaire.</small></div>
<div class="col col-md-3" style="margin: auto;">
<label for="disabled-input" class=" form-control-label"></label>
<label class="switch switch-3d switch-primary mr-3" style="margin-left: 3rem;"><input id="schedule_notify" name="schedule_notify" class="switch-input" type="checkbox"><span class="switch-label"></span><span class="switch-handle"></span></label>
</div>
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Consultation messages</label><small class="form-text text-muted"> L'utilisateur avec ce poste peut t'il consulter les messages</small></div>
<div class="col col-md-3" style="margin: auto;">
<label for="disabled-input" class=" form-control-label"></label>
<label class="switch switch-3d switch-primary mr-3" style="margin-left: 3rem;"><input id="message_see" name="message_see" class="switch-input" type="checkbox"><span class="switch-label"></span><span class="switch-handle"></span></label>
</div>
</div>
<div class="row form-group">
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Modification messages</label><small class="form-text text-muted"> L'utilisateur avec ce poste peut t'il ajouter, modifier et supprimer des messages</small></div>
<div class="col col-md-3" style="margin: auto;">
<label for="disabled-input" class=" form-control-label"></label>
<label class="switch switch-3d switch-primary mr-3" style="margin-left: 3rem;"><input id="message_edit" name="message_edit" class="switch-input" type="checkbox"><span class="switch-label"></span><span class="switch-handle"></span></label>
</div>
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Notifiation messages</label><small class="form-text text-muted"> L'utilisateur avec ce poste doit t-il recevoir des notifiation pour tous les changements en lien avec les messages.</small></div>
<div class="col col-md-3" style="margin: auto;">
<label for="disabled-input" class=" form-control-label"></label>
<label class="switch switch-3d switch-primary mr-3" style="margin-left: 3rem;"><input id="message_notify" name="message_notify" class="switch-input" type="checkbox"><span class="switch-label"></span><span class="switch-handle"></span></label>
</div>
</div>
<div class="row form-group">
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Modification article</label><small class="form-text text-muted"> L'utilisateur avec ce poste peut t'il ajouter, modifier et supprimer des articles</small></div>
<div class="col col-md-3" style="margin: auto;">
<label for="disabled-input" class=" form-control-label"></label>
<label class="switch switch-3d switch-primary mr-3" style="margin-left: 3rem;"><input id="paper_edit" name="paper_edit" class="switch-input" type="checkbox"><span class="switch-label"></span><span class="switch-handle"></span></label>
</div>
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Publication articles</label><small class="form-text text-muted"> L'utilisateur avec ce poste peux t-il autoriser la publication ou appouver des changements a un articles</small></div>
<div class="col col-md-3" style="margin: auto;">
<label for="disabled-input" class=" form-control-label"></label>
<label class="switch switch-3d switch-primary mr-3" style="margin-left: 3rem;"><input id="paper_publish" name="paper_publish" class="switch-input" type="checkbox"><span class="switch-label"></span><span class="switch-handle"></span></label>
</div>
</div>
<div class="row form-group">
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Notifiation articles</label><small class="form-text text-muted"> L'utilisateur avec ce poste doit t-il recevoir des notifiation pour tous les changements en lien avec les articles.</small></div>
<div class="col col-md-3" style="margin: auto;">
<label for="disabled-input" class=" form-control-label"></label>
<label class="switch switch-3d switch-primary mr-3" style="margin-left: 3rem;"><input id="paper_notify" name="paper_notify" class="switch-input" type="checkbox"><span class="switch-label"></span><span class="switch-handle"></span></label>
</div>
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Consultation inventaire</label><small class="form-text text-muted"> L'utilisateur avec ce poste peut t'il consulter l'inventaire</small></div>
<div class="col col-md-3" style="margin: auto;">
<label for="disabled-input" class=" form-control-label"></label>
<label class="switch switch-3d switch-primary mr-3" style="margin-left: 3rem;"><input id="inventory_see" name="inventory_see" class="switch-input" type="checkbox"><span class="switch-label"></span><span class="switch-handle"></span></label>
</div>
</div>
<div class="row form-group">
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Modification inventaire</label><small class="form-text text-muted"> L'utilisateur avec ce poste peut t'il ajouter, modifier et supprimer l'inventaire</small></div>
<div class="col col-md-3" style="margin: auto;">
<label for="disabled-input" class=" form-control-label"></label>
<label class="switch switch-3d switch-primary mr-3" style="margin-left: 3rem;"><input id="inventory_edit" name="inventory_edit" class="switch-input" type="checkbox"><span class="switch-label"></span><span class="switch-handle"></span></label>
</div>
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Notifiation inventaire</label><small class="form-text text-muted"> L'utilisateur avec ce poste doit t-il recevoir des notifiation pour tous les changements en lien avec les articles.</small></div>
<div class="col col-md-3" style="margin: auto;">
<label for="disabled-input" class=" form-control-label"></label>
<label class="switch switch-3d switch-primary mr-3" style="margin-left: 3rem;"><input id="inventory_notify" name="inventory_notify" class="switch-input" type="checkbox"><span class="switch-label"></span><span class="switch-handle"></span></label>
</div>
</div>
<div class="row form-group">
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Modification utilisateur</label><small class="form-text text-muted"> L'utilisateur avec ce poste peut t'il ajouter, modifier et supprimer des utilisateurs</small></div>
<div class="col col-md-3" style="margin: auto;">
<label for="disabled-input" class=" form-control-label"></label>
<label class="switch switch-3d switch-primary mr-3" style="margin-left: 3rem;"><input id="user_edit" name="user_edit" class="switch-input" type="checkbox"><span class="switch-label"></span><span class="switch-handle"></span></label>
</div>
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Notifiation utilisateur</label><small class="form-text text-muted"> L'utilisateur avec ce poste doit t-il recevoir des notifiation pour tous les changements en lien avec les utilisateurs.</small></div>
<div class="col col-md-3" style="margin: auto;">
<label for="disabled-input" class=" form-control-label"></label>
<label class="switch switch-3d switch-primary mr-3" style="margin-left: 3rem;"><input id="user_notify" name="user_notify" class="switch-input" type="checkbox"><span class="switch-label"></span><span class="switch-handle"></span></label>
</div>
</div> </div>
</div> </div>
<div class="card-footer"> <div class="col-md-12">
<button type="submit" class="btn btn-primary btn-sm"> <div class="form-group">
<i class="fa fa-dot-circle-o"></i> Submit <label>Description</label>
</button> <textarea id="desc" name="desc"></textarea>
</div> <small class="form-text text-muted">Description du poste</small>
</div> </div>
</form> </div>
</div> <hr>
</div> <div class="col-md-12">
</div> <h3>Permissions du poste</h3>
@endsection <p>
Choisissez quels permissions doivent être associé avec ce poste.
</p>
<div id="accordion" role="tablist">
@foreach(\App\Permission::allToArray() as $key => $cat)
<div class="card card-collapse">
<div class="card-header" role="tab" id="headingOne">
<h5 class="mb-0">
<a class="text-capitalize" data-toggle="collapse" href="#coll-{{$key}}" @if ($loop->first) aria-expanded="true" @endif aria-controls="collapseOne">
{{$key}}
<i class="material-icons">keyboard_arrow_down</i>
</a>
</h5>
</div>
@section('breadcrumb') <div id="coll-{{$key}}" class="collapse @if ($loop->first) show @endif" role="tabpanel" aria-labelledby="headingOne" data-parent="#accordion">
<div class="breadcrumbs"> <div class="card-body">
<div class="col-sm-4"> <div class="row">
<div class="page-header float-left"> @foreach($cat as $r)
<div class="page-title"> <div class="col text-center">
<h1>{{ trans('admin/dashboard.page_title')}}</h1> <input class="d-none" type="text" id="{{$r['ckey']}}" name="{{$r['ckey']}}">
</div> <h5>{{$r['communName']}}</h5>
</div> <div class="btn-group">
</div> <button type="button" id="{{$r['ckey']}}-close" class="btn btn-just-icon btn-outline-danger" onclick="switchPermissionSwitch('{{$r['ckey']}}','close')"><i class="fa fa-close"></i></button>
<div class="col-sm-8"> <button type="button" id="{{$r['ckey']}}-slash" class="btn btn-just-icon btn-warning" onclick="switchPermissionSwitch('{{$r['ckey']}}','slash')"><i class="fa fa-slash"></i></button>
<div class="page-header float-right"> <button type="button" id="{{$r['ckey']}}-plus" class="btn btn-just-icon btn-outline-success" onclick="switchPermissionSwitch('{{$r['ckey']}}','plus')"><i class="fa fa-plus"></i></button>
<div class="page-title"> </div>
<ol class="breadcrumb text-right"> <p>
<li class="active">{{ trans('admin/dashboard.breadcrumb')}}</li> <small>{{$r['desc']}}</small>
</ol> </p>
</div> </div>
@endforeach
</div>
</div>
</div>
</div>
@endforeach
</div>
</div>
<div class="col-md-12 mt-5">
<button type="submit" class="btn btn-primary">Sauvegarder</button>
</div>
</div>
</form>
</div> </div>
</div> </div>
</div> </div>
@endsection @endsection
@section('custom_scripts') @section('custom_scripts')
<script src="/js/permissions.js"></script>
<script src="https://cloud.tinymce.com/stable/tinymce.min.js?apiKey=r82pabvd9arn3fjb1e2fsolf2xpixuv4hwfwart4cf1fb7mx"></script> <script>
<script> $('#desc').trumbowyg({
tinymce.init({ lang: 'fr'
selector: '#desc',
branding: false,
menubar: 'edit view format'
}); });
</script> </script>
@endsection
@endsection

View File

@@ -1,167 +1,87 @@
@extends('layouts.admin.main') @extends('layouts.admin.main')
@section('content') @section('content')
<div class="col-md-12"> <div class="col-md-12">
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header card-header-primary">
<strong class="card-title">Modification du poste : {{$job->name}}<a href="#"><i class="fa fa-question-circle" aria-hidden="true"></i> <h4>Configuration du poste {{$job->name}}</h4>
</a></strong> </div>
</div> <div class="card-body mt-5">
<div class="card-body"> <form method="post" action="">
<form> @csrf
<div class="tab-content pl-3 p-1" id="myTabContent">
<div id="{{$job->name}}" role="tabpanel" aria-labelledby="{{$job->name}}-tab"> <div class="row">
<div class="row form-group"> <div class="col-md-12">
<div class="col-12"><textarea name="{{$job->id}}_desc" name="{{$job->id}}_desc" rows="9" class="form-control"></textarea> <div class="form-group">
<small class="form-text text-muted">Description du poste</small></div> <label>Nom</label>
<input class="form-control" type="text" name="name" value="{{$job->name}}">
<small class="form-text text-muted">Nom du poste</small>
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label>Description</label>
<textarea id="desc" name="desc">{!! $job->desc !!}</textarea>
<small class="form-text text-muted">Description du poste</small>
</div>
</div> </div>
<hr> <hr>
<div class="row form-group"> <div class="col-md-12">
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Niveau d'accès</label></div> <h3>Permissions du poste</h3>
<div class="col col-md-3"> <p>
<select name="{{$job->id}}_event_type" name="{{$job->id}}_event_type" class="form-control"> Choisissez quels permissions doivent être associé avec ce poste.
@switch($job->acces_level) </p>
@case(1) <div id="accordion" role="tablist">
<option value="1">Staff</option> @foreach(\App\Permission::allToArray() as $key => $cat)
@break <div class="card card-collapse">
@case(2) <div class="card-header" role="tab" id="headingOne">
<option value="2">Officer</option> <h5 class="mb-0">
@break <a class="text-capitalize" data-toggle="collapse" href="#coll-{{$key}}" @if ($loop->first) aria-expanded="true" @endif aria-controls="collapseOne">
@default {{$key}}
<option value="0">Cadet</option> <i class="material-icons">keyboard_arrow_down</i>
@endswitch </a>
<option value="0">Cadet</option> </h5>
<option value="1">Staff</option> </div>
<option value="2">Officer</option>
</select>
</div>
</div>
<div class="row form-group">
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Horaire détaillé</label><small class="form-text text-muted">|| {{$job->schedule_see}} || L'utilisateur avec ce poste peut t'il consulter les détails de l'horaire</small></div>
<div class="col col-md-3" style="margin: auto;">
<label for="disabled-input" class=" form-control-label"></label>
<label class="switch switch-3d switch-primary mr-3" style="margin-left: 3rem;"><input name="{{$job->id}}_schedule_see" name="{{$job->id}}_schedule_see" class="switch-input" @if($job->schedule_see == "1") checked="true" @endif type="checkbox"><span class="switch-label"></span><span class="switch-handle"></span></label>
</div>
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Modification horaire</label><small class="form-text text-muted">|| {{$job->schedule_edit}} || L'utilisateur avec ce poste peut t'il ajouter, modifier et supprimer des événements a l'horaire</small></div>
<div class="col col-md-3" style="margin: auto;">
<label for="disabled-input" class=" form-control-label"></label>
<label class="switch switch-3d switch-primary mr-3" style="margin-left: 3rem;"><input name="{{$job->id}}_schedule_edit" name="{{$job->id}}_schedule_edit" class="switch-input" @if($job->schedule_edit == "1") checked="true" @endif type="checkbox"><span class="switch-label"></span><span class="switch-handle"></span></label>
</div>
</div>
<div class="row form-group">
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Notifiation horaire</label><small class="form-text text-muted">|| {{$job->schedule_notify}} || L'utilisateur avec ce poste doit t-il recevoir des notifiation pour tous les changements a l'horaire.</small></div>
<div class="col col-md-3" style="margin: auto;">
<label for="disabled-input" class=" form-control-label"></label>
<label class="switch switch-3d switch-primary mr-3" style="margin-left: 3rem;"><input name="{{$job->id}}_schedule_notify" name="{{$job->id}}_schedule_notify" class="switch-input" @if($job->schedule_notify == "1") checked="true" @endif type="checkbox"><span class="switch-label"></span><span class="switch-handle"></span></label>
</div>
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Consultation messages</label><small class="form-text text-muted">|| {{$job->message_see}} || L'utilisateur avec ce poste peut t'il consulter les messages</small></div>
<div class="col col-md-3" style="margin: auto;">
<label for="disabled-input" class=" form-control-label"></label>
<label class="switch switch-3d switch-primary mr-3" style="margin-left: 3rem;"><input name="{{$job->id}}_message_see" name="{{$job->id}}_message_see" class="switch-input" @if($job->message_see == "1") checked="true" @endif type="checkbox"><span class="switch-label"></span><span class="switch-handle"></span></label>
</div>
</div>
<div class="row form-group">
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Modification messages</label><small class="form-text text-muted"> L'utilisateur avec ce poste peut t'il ajouter, modifier et supprimer des messages</small></div>
<div class="col col-md-3" style="margin: auto;">
<label for="disabled-input" class=" form-control-label"></label>
<label class="switch switch-3d switch-primary mr-3" style="margin-left: 3rem;"><input name="{{$job->id}}_message_edit" name="{{$job->id}}_message_edit" class="switch-input" @if($job->message_edit == "1") checked="true" @endif type="checkbox"><span class="switch-label"></span><span class="switch-handle"></span></label>
</div>
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Notifiation messages</label><small class="form-text text-muted"> L'utilisateur avec ce poste doit t-il recevoir des notifiation pour tous les changements en lien avec les messages.</small></div>
<div class="col col-md-3" style="margin: auto;">
<label for="disabled-input" class=" form-control-label"></label>
<label class="switch switch-3d switch-primary mr-3" style="margin-left: 3rem;"><input name="{{$job->id}}_message_notify" name="{{$job->id}}_message_notify" class="switch-input" @if($job->message_notify == "1") checked="true" @endif type="checkbox"><span class="switch-label"></span><span class="switch-handle"></span></label>
</div>
</div>
<div class="row form-group">
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Modification article</label><small class="form-text text-muted"> L'utilisateur avec ce poste peut t'il ajouter, modifier et supprimer des articles</small></div>
<div class="col col-md-3" style="margin: auto;">
<label for="disabled-input" class=" form-control-label"></label>
<label class="switch switch-3d switch-primary mr-3" style="margin-left: 3rem;"><input name="{{$job->id}}_paper_edit" name="{{$job->id}}_paper_edit" class="switch-input" @if($job->paper_edit == "1") checked="true" @endif type="checkbox"><span class="switch-label"></span><span class="switch-handle"></span></label>
</div>
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Publication articles</label><small class="form-text text-muted"> L'utilisateur avec ce poste peux t-il autoriser la publication ou appouver des changements a un articles</small></div>
<div class="col col-md-3" style="margin: auto;">
<label for="disabled-input" class=" form-control-label"></label>
<label class="switch switch-3d switch-primary mr-3" style="margin-left: 3rem;"><input name="{{$job->id}}_paper_publish" name="{{$job->id}}_paper_publish" class="switch-input" @if($job->paper_publish == "1") checked="true" @endif type="checkbox"><span class="switch-label"></span><span class="switch-handle"></span></label>
</div>
</div>
<div class="row form-group">
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Notifiation articles</label><small class="form-text text-muted"> L'utilisateur avec ce poste doit t-il recevoir des notifiation pour tous les changements en lien avec les articles.</small></div>
<div class="col col-md-3" style="margin: auto;">
<label for="disabled-input" class=" form-control-label"></label>
<label class="switch switch-3d switch-primary mr-3" style="margin-left: 3rem;"><input name="{{$job->id}}_paper_notify" name="{{$job->id}}_paper_notify" class="switch-input" @if($job->paper_notify == "1") checked="true" @endif type="checkbox"><span class="switch-label"></span><span class="switch-handle"></span></label>
</div>
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Consultation inventaire</label><small class="form-text text-muted"> L'utilisateur avec ce poste peut t'il consulter l'inventaire</small></div>
<div class="col col-md-3" style="margin: auto;">
<label for="disabled-input" class=" form-control-label"></label>
<label class="switch switch-3d switch-primary mr-3" style="margin-left: 3rem;"><input name="{{$job->id}}_inventory_see" name="{{$job->id}}_inventory_see" class="switch-input" @if($job->inventory_see == "1") checked="true" @endif type="checkbox"><span class="switch-label"></span><span class="switch-handle"></span></label>
</div>
</div>
<div class="row form-group">
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Modification inventaire</label><small class="form-text text-muted"> L'utilisateur avec ce poste peut t'il ajouter, modifier et supprimer l'inventaire</small></div>
<div class="col col-md-3" style="margin: auto;">
<label for="disabled-input" class=" form-control-label"></label>
<label class="switch switch-3d switch-primary mr-3" style="margin-left: 3rem;"><input name="{{$job->id}}_inventory_edit" name="{{$job->id}}_inventory_edit" class="switch-input" @if($job->inventory_edit == "1") checked="true" @endif type="checkbox"><span class="switch-label"></span><span class="switch-handle"></span></label>
</div>
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Notifiation inventaire</label><small class="form-text text-muted"> L'utilisateur avec ce poste doit t-il recevoir des notifiation pour tous les changements en lien avec les articles.</small></div>
<div class="col col-md-3" style="margin: auto;">
<label for="disabled-input" class=" form-control-label"></label>
<label class="switch switch-3d switch-primary mr-3" style="margin-left: 3rem;"><input name="{{$job->id}}_inventory_notify" name="{{$job->id}}_inventory_notify" class="switch-input" @if($job->inventory_notify == "1") checked="true" @endif type="checkbox"><span class="switch-label"></span><span class="switch-handle"></span></label>
</div>
</div>
<div class="row form-group">
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Modification utilisateur</label><small class="form-text text-muted"> L'utilisateur avec ce poste peut t'il ajouter, modifier et supprimer des utilisateurs</small></div>
<div class="col col-md-3" style="margin: auto;">
<label for="disabled-input" class=" form-control-label"></label>
<label class="switch switch-3d switch-primary mr-3" style="margin-left: 3rem;"><input name="{{$job->id}}_user_edit" name="{{$job->id}}_user_edit" class="switch-input" @if($job->user_edit == "1") checked="true" @endif type="checkbox"><span class="switch-label"></span><span class="switch-handle"></span></label>
</div>
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Notifiation utilisateur</label><small class="form-text text-muted"> L'utilisateur avec ce poste doit t-il recevoir des notifiation pour tous les changements en lien avec les utilisateurs.</small></div>
<div class="col col-md-3" style="margin: auto;">
<label for="disabled-input" class=" form-control-label"></label>
<label class="switch switch-3d switch-primary mr-3" style="margin-left: 3rem;"><input name="{{$job->id}}_user_notify" name="{{$job->id}}_user_notify" class="switch-input" @if($job->user_notify == "1") checked="true" @endif type="checkbox"><span class="switch-label"></span><span class="switch-handle"></span></label>
</div>
</div>
</div>
<div class="card-footer">
<button type="submit" class="btn btn-primary btn-sm">
<i class="fa fa-dot-circle-o"></i> Submit
</button>
</div>
</div>
</form>
</div>
</div>
</div>
@endsection
@section('breadcrumb') <div id="coll-{{$key}}" class="collapse @if ($loop->first) show @endif" role="tabpanel" aria-labelledby="headingOne" data-parent="#accordion">
<div class="breadcrumbs"> <div class="card-body">
<div class="col-sm-4"> <div class="row">
<div class="page-header float-left"> @foreach($cat as $r)
<div class="page-title"> <div class="col text-center">
<h1>{{ trans('admin/dashboard.page_title')}}</h1> <input class="d-none" type="text" id="{{$r['ckey']}}" name="{{$r['ckey']}}" value="{{$job->p($r['ckey'])}}">
</div> <h5>{{$r['communName']}}</h5>
</div> <div class="btn-group">
</div> <button type="button" id="{{$r['ckey']}}-close" class="btn btn-just-icon @if($job->p($r['ckey']) != -1) btn-outline-danger @else btn-danger @endif" onclick="switchPermissionSwitch('{{$r['ckey']}}','close')"><i class="fa fa-close"></i></button>
<div class="col-sm-8"> <button type="button" id="{{$r['ckey']}}-slash" class="btn btn-just-icon @if($job->p($r['ckey']) == 0) btn-warning @else btn-outline-warning @endif" onclick="switchPermissionSwitch('{{$r['ckey']}}','slash')"><i class="fa fa-slash"></i></button>
<div class="page-header float-right"> <button type="button" id="{{$r['ckey']}}-plus" class="btn btn-just-icon @if($job->p($r['ckey']) != 1) btn-outline-success @else btn-success @endif" onclick="switchPermissionSwitch('{{$r['ckey']}}','plus')"><i class="fa fa-plus"></i></button>
<div class="page-title"> </div>
<ol class="breadcrumb text-right"> <p>
<li class="active">{{ trans('admin/dashboard.breadcrumb')}}</li> <small>{{$r['desc']}}</small>
</ol> </p>
</div> </div>
@endforeach
</div>
</div>
</div>
</div>
@endforeach
</div>
</div>
<div class="col-md-12 mt-5">
<button type="submit" class="btn btn-primary">Sauvegarder</button>
</div>
</div>
</form>
</div> </div>
</div> </div>
</div> </div>
@endsection @endsection
@section('custom_scripts') @section('custom_scripts')
<script src="https://cloud.tinymce.com/stable/tinymce.min.js?apiKey=r82pabvd9arn3fjb1e2fsolf2xpixuv4hwfwart4cf1fb7mx"></script> <script src="/js/permissions.js"></script>
<script> <script>
tinymce.init({ $('#desc').trumbowyg({
selector: '#<?php echo $job->id?>_desc', lang: 'fr'
branding: false, });
menubar: 'edit view format' </script>
}); @endsection
</script>
@endsection

View File

@@ -107,7 +107,7 @@
<div class="form-group"> <div class="form-group">
<label for="job">Poste</label> <label for="job">Poste</label>
<select class="form-control" name="job" id="job" required> <select class="form-control" name="job" id="job" required>
<option value={{$user->job}}>{{\App\Job::find($user->job)->name}}</option> <option value={{$user->job->id}}>{{$user->job->name}}</option>
@foreach ($JobsList as $job) @foreach ($JobsList as $job)
<option value="{{$job->id}}">{{$job->name}}</option> <option value="{{$job->id}}">{{$job->name}}</option>
@endforeach @endforeach

View File

@@ -51,6 +51,12 @@ Route::middleware('auth:api')->group(function () {
Route::post('/config/general/save', 'ConfigController@update')->middleware('perm:config_edit'); Route::post('/config/general/save', 'ConfigController@update')->middleware('perm:config_edit');
Route::post('/config/activity/delete', 'ComplementaryActivityController@destroy')->middleware('perm:config_delete'); Route::post('/config/activity/delete', 'ComplementaryActivityController@destroy')->middleware('perm:config_delete');
/** Rank Route */
Route::post('/config/rank/delete','RankController@destroy')->middleware('perm:config_edit');
/** Job Route */
Route::post('/config/job/delete','JobController@destroy')->middleware('perm:config_edit');
Route::get('/user/perm/{id}', function($id) { Route::get('/user/perm/{id}', function($id) {
$user = \App\User::find($id); $user = \App\User::find($id);
return $user->getPerm("schedule_edit"); return $user->getPerm("schedule_edit");