mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-21 10:49:10 -04:00
3.2.4
This commit is contained in:
@@ -119,11 +119,18 @@ class JobController extends Controller
|
|||||||
/**
|
/**
|
||||||
* 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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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");
|
||||||
|
|||||||
Reference in New Issue
Block a user