Merge branch 'master' of https://github.com/sebathefox/skolehjem-webapp into master
This commit is contained in:
commit
dccc084dee
|
@ -315,9 +315,9 @@ class EventController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
public function nameCheck(Request $request){
|
public function nameCheck(Request $request){
|
||||||
$events = DB::table('events')->where('name', '=',$request->nameCheck)->get();
|
$event = Event::query()->where('name', 'LIKE',$request->nameCheck)->get();
|
||||||
if(count($events) > 0){
|
if(count($event) > 0 && $request->nameCheck !== NULL){
|
||||||
return "Det er allerede en event med det navn";
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,5 +173,12 @@ class rolesController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function nameCheck(Request $request){
|
||||||
|
$roles = Role::query()->where('name', 'LIKE',$request->nameCheck)->get();
|
||||||
|
if(count($roles) > 0 && $request->nameCheck !== NULL){
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,4 +153,14 @@ class WashingMachineController extends Controller
|
||||||
|
|
||||||
return redirect()->route("washing-machines.index");
|
return redirect()->route("washing-machines.index");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function nameCheck(Request $request){
|
||||||
|
$washing = Role::query()->where('name', 'LIKE',$request->nameCheck)->get();
|
||||||
|
if(count($washing) > 0 && $request->nameCheck !== NULL){
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,8 @@
|
||||||
url: '{{route('events.nameCheck')}}',
|
url: '{{route('events.nameCheck')}}',
|
||||||
data: {'nameCheck':$value},
|
data: {'nameCheck':$value},
|
||||||
success:function (data) {
|
success:function (data) {
|
||||||
if(data){
|
console.log(data);
|
||||||
|
if(data === false){
|
||||||
$("#error").show(100);
|
$("#error").show(100);
|
||||||
$("#error").css('color', 'red');
|
$("#error").css('color', 'red');
|
||||||
$("#disable").prop('disabled', true);
|
$("#disable").prop('disabled', true);
|
||||||
|
|
|
@ -10,14 +10,15 @@
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@section("content")
|
@section("content")
|
||||||
<h1>Opret Rolle:</h1>
|
<h1 id="errormesseages" >Opret Rolle:</h1>
|
||||||
<form method="post" action="{{ route("roles.store") }}">
|
<form method="post" action="{{ route("roles.store") }}">
|
||||||
@csrf
|
@csrf
|
||||||
<label for="name">Navn:</label>
|
<label for="name">Navn:</label>
|
||||||
|
<label hidden id="error" for="errormesseages">Role navnet findes allerede</label>
|
||||||
<input type="text" name="name" id="name" placeholder="Admin" required>
|
<input type="text" name="name" id="name" placeholder="Admin" required>
|
||||||
<label for="name">Beskrivelse:</label>
|
<label for="name">Beskrivelse:</label>
|
||||||
<input type="text" name="description" id="description" placeholder="Admin rollen bruges til administratorene" required>
|
<input type="text" name="description" id="description" placeholder="Admin rollen bruges til administratorene" required>
|
||||||
<input type="submit" class="btn btn-dark text-white" value="Opret">
|
<input type="submit" id="disable" class="btn btn-dark text-white" value="Opret">
|
||||||
</form>
|
</form>
|
||||||
@endsection
|
@endsection
|
||||||
@section("scripts")
|
@section("scripts")
|
||||||
|
@ -30,5 +31,58 @@
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
$value = $('#name').val();
|
||||||
|
$.ajax({
|
||||||
|
type: 'get',
|
||||||
|
url: '{{route('roles.nameCheck')}}',
|
||||||
|
data: {'nameCheck':$value},
|
||||||
|
success:function (data) {
|
||||||
|
if(data){
|
||||||
|
$("#error").show(100);
|
||||||
|
$("#error").css('color', 'red');
|
||||||
|
$("#disable").prop('disabled', true);
|
||||||
|
$('#disable').css('cursor','not-allowed');
|
||||||
|
}else{
|
||||||
|
$("#error").hide();
|
||||||
|
$("#disable").prop('disabled', false);
|
||||||
|
$('#disable').css('cursor','pointer');
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
error:function (data) {
|
||||||
|
console.log(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#name').on('keyup', function () {
|
||||||
|
$value = $(this).val();
|
||||||
|
$.ajax({
|
||||||
|
type: 'get',
|
||||||
|
url: '{{route('roles.nameCheck')}}',
|
||||||
|
data: {'nameCheck':$value},
|
||||||
|
success:function (data) {
|
||||||
|
if(data){
|
||||||
|
$("#error").show(100);
|
||||||
|
$("#error").css('color', 'red');
|
||||||
|
$("#disable").prop('disabled', true);
|
||||||
|
$('#disable').css('cursor','not-allowed');
|
||||||
|
}else{
|
||||||
|
$("#error").hide();
|
||||||
|
$("#disable").prop('disabled', false);
|
||||||
|
$('#disable').css('cursor','pointer');
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
error:function (data) {
|
||||||
|
console.log(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
|
@ -55,8 +55,10 @@ Route::get("/darkmode", "UserController@setDarkMode")->name("users.setDarkMode")
|
||||||
//Convert to PDF
|
//Convert to PDF
|
||||||
Route::get("/pdf/{menuPlan}", "MenuPlanController@genPDF")->name("pdf.genPDF")->hasParameter("Id");
|
Route::get("/pdf/{menuPlan}", "MenuPlanController@genPDF")->name("pdf.genPDF")->hasParameter("Id");
|
||||||
|
|
||||||
//admin Check
|
//Check name adminpanle
|
||||||
Route::get("/namecheck", "EventController@nameCheck")->name("events.nameCheck");
|
Route::get("/eventCheck", "EventController@nameCheck")->name("events.nameCheck");
|
||||||
|
Route::get("/roleCheck", "RolesController@nameCheck")->name("roles.nameCheck");
|
||||||
|
Route::get("/washingCheck", "WashingMachineController@nameCheck")->name("washing-machines.nameCheck");
|
||||||
|
|
||||||
|
|
||||||
Route::resource("contacts", "ContactController");
|
Route::resource("contacts", "ContactController");
|
||||||
|
|
Loading…
Reference in New Issue