Merge branch 'master' of https://github.com/sebathefox/skolehjem-webapp into master
This commit is contained in:
commit
4a72493f9b
|
@ -61,7 +61,7 @@ class LocationController extends Controller
|
|||
|
||||
// If there already is a washing machine with that name, then don't add it
|
||||
if (count($locations) > 0)
|
||||
return redirect()->route("locations.store")->with('NameExists', '<p><b>Der findes allerede en lokation med det navn!</b></p>');
|
||||
return redirect()->route("locations.index");
|
||||
else { // Else - Add it
|
||||
$location->save();
|
||||
$locations = Location::query()->paginate($request->input("limit", 20));
|
||||
|
@ -111,7 +111,7 @@ class LocationController extends Controller
|
|||
|
||||
// If there already is a washing machine with that name, then don't change it
|
||||
if (count($allMachines) > 0)
|
||||
return redirect()->route("locations.store")->with('NameExists', '<p><b>Der findes allerede en lokation med det navn!</b></p>');
|
||||
return redirect()->route("locations.index");
|
||||
else { // Else - Change the name
|
||||
$location->update($data);
|
||||
$location->save();
|
||||
|
@ -124,11 +124,28 @@ class LocationController extends Controller
|
|||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Location $location
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Location $location)
|
||||
public function destroy($id)
|
||||
{
|
||||
$locations = Location::find($id);
|
||||
$locations->delete();
|
||||
|
||||
return redirect()->route("locations.index");
|
||||
}
|
||||
|
||||
public function nameCheck(Request $request){
|
||||
$locations = Location::query()->where('name', 'LIKE',$request->nameCheck)->get();
|
||||
if(count($locations) > 0 && $request->nameCheck !== NULL){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
public function nameCheckUpdate(Request $request){
|
||||
$locations = Location::query()->where('name', 'LIKE',$request->nameCheck)->where('id', '!=', $request->id)->get();
|
||||
if(count($locations) > 0 && $request->nameCheck !== NULL){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,8 +60,11 @@ class MenuPlanController extends Controller
|
|||
public function store(Request $request)
|
||||
{
|
||||
$requestMenuPlanCreate = $request->validate([
|
||||
"week" => "required|max:2",
|
||||
"menu" => "required",
|
||||
"week" => "required|max:255",
|
||||
"monday" => "required|max:255",
|
||||
"tuesday" => "required|max:255",
|
||||
"wednesday" => "required|max:255",
|
||||
"thursday" => "required|max:255",
|
||||
]);
|
||||
|
||||
$menuPlan = new MenuPlan($requestMenuPlanCreate);
|
||||
|
@ -74,12 +77,25 @@ class MenuPlanController extends Controller
|
|||
$menuPlan->save();
|
||||
$menuPlans = MenuPlan::query()->paginate($request->input("limit", 20));
|
||||
|
||||
$menuArray = [];
|
||||
|
||||
if($request->newsoption == true){
|
||||
$news = new News();
|
||||
|
||||
$news->name = "Ny menuplan";
|
||||
$news->subname = "Uge " . $menuPlan->week;
|
||||
$news->content = $menuPlan->menu;
|
||||
$news->content =
|
||||
'<h2 class="ql-align-center"><strong>Mandag:</strong></h2>'.
|
||||
'<p class="ql-align-center">'.$menuPlan->monday.'</p><p class="ql-align-center"><br></p>'.
|
||||
|
||||
'<h2 class="ql-align-center"><strong>Tirsdag:</strong></h2>'.
|
||||
'<p class="ql-align-center">'.$menuPlan->tuesday.'</p><p class="ql-align-center"><br></p>'.
|
||||
|
||||
'<h2 class="ql-align-center"><strong>Onsdag:</strong></h2>'.
|
||||
'<p class="ql-align-center">'.$menuPlan->wednesday.'</p><p class="ql-align-center"><br></p>'.
|
||||
|
||||
'<h2 class="ql-align-center"><strong>Torsdag:</strong></h2>'.
|
||||
'<p class="ql-align-center">'.$menuPlan->thursday.'</p>';
|
||||
$news->type_id = '2';
|
||||
$news->arrangement_id = $menuPlan->id;
|
||||
|
||||
|
@ -148,7 +164,18 @@ class MenuPlanController extends Controller
|
|||
$news->subname = "Uge " . $menuplan->week;
|
||||
$news->arrangement_id = $menuplan->id;
|
||||
$news->type_id = '2';
|
||||
$news->content = $menuplan->menu;
|
||||
$news->content =
|
||||
'<h2 class="ql-align-center"><strong>Mandag:</strong></h2>'.
|
||||
'<p class="ql-align-center">'.$menuplan->monday.'</p><p class="ql-align-center"><br></p>'.
|
||||
|
||||
'<h2 class="ql-align-center"><strong>Tirsdag:</strong></h2>'.
|
||||
'<p class="ql-align-center">'.$menuplan->tuesday.'</p><p class="ql-align-center"><br></p>'.
|
||||
|
||||
'<h2 class="ql-align-center"><strong>Onsdag:</strong></h2>'.
|
||||
'<p class="ql-align-center">'.$menuplan->wednesday.'</p><p class="ql-align-center"><br></p>'.
|
||||
|
||||
'<h2 class="ql-align-center"><strong>Torsdag:</strong></h2>'.
|
||||
'<p class="ql-align-center">'.$menuplan->thursday.'</p>';
|
||||
|
||||
|
||||
NewsController::storeAndGet($news);
|
||||
|
@ -193,7 +220,17 @@ class MenuPlanController extends Controller
|
|||
'<h1 style="font-size: 28px; text-align: center; color: white;">Uge '. $menuPlan->week. '</h1>'.
|
||||
'</div>'.
|
||||
'<div style="text-align: center">'.
|
||||
$menuPlan->menu.
|
||||
'<h2 class="ql-align-center"><strong>Mandag:</strong></h2>'.
|
||||
'<p class="ql-align-center">'.$menuPlan->monday.'</p><p class="ql-align-center"><br></p>'.
|
||||
|
||||
'<h2 class="ql-align-center"><strong>Tirsdag:</strong></h2>'.
|
||||
'<p class="ql-align-center">'.$menuPlan->tuesday.'</p><p class="ql-align-center"><br></p>'.
|
||||
|
||||
'<h2 class="ql-align-center"><strong>Onsdag:</strong></h2>'.
|
||||
'<p class="ql-align-center">'.$menuPlan->wednesday.'</p><p class="ql-align-center"><br></p>'.
|
||||
|
||||
'<h2 class="ql-align-center"><strong>Torsdag:</strong></h2>'.
|
||||
'<p class="ql-align-center">'.$menuPlan->thursday.'</p>';
|
||||
'</div>'.
|
||||
'</body>'.
|
||||
'</html>';
|
||||
|
|
|
@ -71,7 +71,7 @@ class UserController extends Controller
|
|||
"name_last" => "required|max:255",
|
||||
"email" => "required",
|
||||
"password" => "required|max:60",
|
||||
"phone" => "required",
|
||||
"phone" => "required|max:8|min:8",
|
||||
]);
|
||||
|
||||
$allUsersEmail = User::query()->where('email', '=', $request->email)->get();
|
||||
|
|
|
@ -70,7 +70,7 @@ class WashingMachineController extends Controller
|
|||
|
||||
// If there already is a washing machine with that name, then don't add it
|
||||
if (count($allMachines) > 0)
|
||||
return redirect()->route("washing-machines.store")->with('WashingNameExists', '<p><b>Der findes allerede en vaskemaskine med det navn!</b></p>');
|
||||
return redirect()->route("washing-machines.store");
|
||||
else { // Else - Add it
|
||||
$machine->save();
|
||||
$machines = WashingMachine::query()->paginate($request->input("limit", 20));
|
||||
|
@ -127,7 +127,7 @@ class WashingMachineController extends Controller
|
|||
|
||||
// If there already is a washing machine with that name, then don't change it
|
||||
if (count($allMachines) > 0)
|
||||
return redirect()->route("washing-machines.store")->with('WashingNameExists', '<p><b>Der findes allerede en vaskemaskine med det navn!</b></p>');
|
||||
return redirect()->route("washing-machines.store");
|
||||
else { // Else - Change the name
|
||||
$machine->update($data);
|
||||
$machine->save();
|
||||
|
@ -153,4 +153,18 @@ class WashingMachineController extends Controller
|
|||
|
||||
return redirect()->route("washing-machines.index");
|
||||
}
|
||||
|
||||
public function nameCheck(Request $request){
|
||||
$washing = WashingMachine::query()->where('name', 'LIKE',$request->nameCheck)->where('location_id', '=', $request->location)->get();
|
||||
if(count($washing) > 0 && $request->nameCheck !== NULL){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
public function nameCheckUpdate(Request $request){
|
||||
$washing = WashingMachine::query()->where('name', 'LIKE',$request->nameCheck)->where('location_id', '=', $request->location)->where('id', '!=', $request->id)->get();
|
||||
if(count($washing) > 0 && $request->nameCheck !== NULL){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,6 @@ class MenuPlan extends Model
|
|||
{
|
||||
//protected variable which contains name of database field(s) to be filled.
|
||||
protected $fillable = [
|
||||
'week', 'menu'
|
||||
'week', 'monday', "tuesday", 'wednesday', 'thursday'
|
||||
];
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ class CreateUsersTable extends Migration
|
|||
$table->string('email')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->integer("phone")->unique();
|
||||
$table->string("phone", 8)->unique();
|
||||
$table->rememberToken();
|
||||
$table->foreignId("resource_id")->nullable()->constrained("resources", "id");
|
||||
$table->boolean("wants_emails")->default(true);
|
||||
|
|
|
@ -17,9 +17,11 @@ class CreateMenuPlans extends Migration
|
|||
{
|
||||
Schema::create('menu_plans', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('week', 2);
|
||||
$table->longText('menu');
|
||||
$table->unique('week');
|
||||
$table->integer('week')->unique();
|
||||
$table->string('monday', 255);
|
||||
$table->string('tuesday', 255);
|
||||
$table->string('wednesday', 255);
|
||||
$table->string('thursday', 255);
|
||||
$table->timestamps();
|
||||
//$table->text('description');
|
||||
});
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
<tr>
|
||||
<th class="text-white text-center" style="background-color: orange;">Nyeste brugere</th>
|
||||
</tr>
|
||||
@for($i = 0; $i < 5 && $i < count(\App\User::query()->orderByDesc("id")->get()); $i++)
|
||||
@for($i = 0; $i < 10 && $i < count(\App\User::query()->orderByDesc("id")->get()); $i++)
|
||||
<tr>
|
||||
<td>{{ ucfirst(strtolower(\App\User::query()->orderByDesc("id")->get()[$i]->name_first)) . ' ' . ucfirst(strtolower(\App\User::query()->orderByDesc("id")->get()[$i]->name_last)) }}</td>
|
||||
</tr>
|
||||
|
@ -83,10 +83,21 @@
|
|||
@if(\App\Event::query()->orderByDesc("date")->first() !== null)
|
||||
<div class="event_card">
|
||||
@if(\App\Event::query()->orderByDesc("date")->first()->resource_id !== null)
|
||||
<div class="header" style="background-size: cover; background-image: url('{{ asset(\App\Resource::query()->where("id", "=", \App\Event::query()->orderByDesc("date")->first()->resource_id)->first()->filename) }}');">
|
||||
<h3 style="text-shadow: 2px 2px 2px #00788A;" class="text-white text-center">{{ \App\Event::query()->orderByDesc("date")->first()->name }}</h3>
|
||||
<p style="text-shadow: 2px 2px 2px #00788A"; class="text-white text-center mt-0">{{__('msg.af')}}: {{ \App\Event::query()->orderByDesc("date")->first()->accountable }}</p>
|
||||
<p style="text-shadow: 2px 2px 2px #00788A"; class="text-white text-center mt-0">{{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime(\App\Event::query()->orderByDesc("date")->first()->date))->format('d/m/Y \k\l\. H:i') }}</p>
|
||||
<div class="header" style="padding-top: 0">
|
||||
<table class="tbl mt-0">
|
||||
<tr>
|
||||
<td><label>Event navn</label></td>
|
||||
<td>{{ \App\Event::query()->orderByDesc("date")->first()->name }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label>Event ansvarlig</label></td>
|
||||
<td>{{__('msg.af')}}: {{ \App\Event::query()->orderByDesc("date")->first()->accountable }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label>Tidspunkt</label></td>
|
||||
<td>{{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime(\App\Event::query()->orderByDesc("date")->first()->date))->format('d/m/Y \k\l\. H:i') }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
@else
|
||||
<div class="header">
|
||||
|
@ -97,10 +108,14 @@
|
|||
@endif
|
||||
|
||||
<div class="container" style="margin-top: 8px;">
|
||||
{!! \App\Helpers::closetags(substr(\App\Event::query()->orderByDesc("date")->first()->description, 0, 300) )!!}
|
||||
<table style="border: 1px solid lightgrey; width: 100%;">
|
||||
<tr>
|
||||
<td> {!! \App\Helpers::closetags(substr(\App\Event::query()->orderByDesc("date")->first()->description, 0, 300) )!!}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name="event_id" value="{{ \App\Event::query()->orderByDesc("date")->first()->id }}">
|
||||
<div class="row" style="justify-content: space-between; margin-top: 16px;">
|
||||
<a style="margin: 0; padding: 0; font-weight: 700;" class="sde-blue text-center" href="{{route("events.accountsignups", ["event" => \App\Event::query()->orderByDesc("date")->first()->id ])}}">{{__('msg.sedeltagere')}}</a>
|
||||
<a style="margin: 0; padding: 0; font-weight: 700;" class="sde-blue text-center" href="{{route("events.signups", ["event" => \App\Event::query()->orderByDesc("date")->first()->id ])}}">{{__('msg.sedeltagere')}}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -122,7 +137,7 @@
|
|||
<th class="text-white text-center" style="background-color: deepskyblue;">Seneste Vejledninger</th>
|
||||
</tr>
|
||||
@if(count(\App\Guide::all()) > 0)
|
||||
@for($i = 0; $i < 5 && $i < count(\App\Guide::query()->orderByDesc("id")->get()); $i++)
|
||||
@for($i = 0; $i < 10 && $i < count(\App\Guide::query()->orderByDesc("id")->get()); $i++)
|
||||
<tr>
|
||||
<td>{{ ucfirst(strtolower(\App\Guide::query()->orderByDesc("id")->get()[$i]->name)) }}</td>
|
||||
</tr>
|
||||
|
@ -145,14 +160,28 @@
|
|||
</div>
|
||||
<table class="tbl mt-1">
|
||||
<tr>
|
||||
<th class="text-white text-center" style="background-color: lightseagreen;">Ugens Menuplan</th>
|
||||
<th class="text-white text-center" style="background-color: lightseagreen; border-right: unset;">Ugens Menuplan</th>
|
||||
<th class="text-white text-center" style="background-color: lightseagreen; border-left: unset;"></th> <!--Maybe fix ?-->
|
||||
</tr>
|
||||
</table>
|
||||
@if(\App\MenuPlan::query()->where("week", "=", date('W'))->first() !== null)
|
||||
{!! \App\MenuPlan::query()->where("week", "=", date('W'))->first()->menu !!}
|
||||
{{-- \App\MenuPlan::query()->where("week", "=", date('W'))->first() --}}
|
||||
<tr>
|
||||
<td><label>Mandag </label></td>
|
||||
<td>{{ \App\MenuPlan::query()->where("week", "=", date('W'))->first()->monday }}</td>
|
||||
</tr>
|
||||
<td><label>Tirsdag</label></td>
|
||||
<td>{{ \App\MenuPlan::query()->where("week", "=", date('W'))->first()->tuesday }}</td>
|
||||
</tr>
|
||||
<td><label>Onsdag</label></td>
|
||||
<td>{{ \App\MenuPlan::query()->where("week", "=", date('W'))->first()->wednesday }}</td>
|
||||
</tr>
|
||||
<td><label>Torsdag</label></td>
|
||||
<td>{{ \App\MenuPlan::query()->where("week", "=", date('W'))->first()->thursday }}</td>
|
||||
</tr>
|
||||
@else
|
||||
</table>
|
||||
<p class="text-center">Der er ingen menuplan for denne uge</p>
|
||||
@endif
|
||||
|
||||
</table>
|
||||
</div>
|
||||
@endsection
|
||||
|
|
|
@ -10,12 +10,13 @@
|
|||
@endsection
|
||||
|
||||
@section("content")
|
||||
<h1>Opret Lokation</h1>
|
||||
<h1 id="errormesseages" >Opret Lokation</h1>
|
||||
<form method="post" action="{{ route("locations.store") }}">
|
||||
@csrf
|
||||
<label for="name">Lokationsnavn:</label>
|
||||
<label hidden id="error" for="errormesseages">Lokation findes allerede</label>
|
||||
<input type="text" name="name" id="name" placeholder="Bygning A" 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>
|
||||
@endsection
|
||||
@section("scripts")
|
||||
|
@ -28,5 +29,57 @@
|
|||
}
|
||||
);
|
||||
});
|
||||
|
||||
//Dont delete me, if the user reloads the pages with text in the text-box this code runs.
|
||||
$(document).ready(function () {
|
||||
$value = $('#name').val();
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '{{route('locations.nameCheck')}}',
|
||||
data: {'nameCheck':$value},
|
||||
success:function (data) {
|
||||
console.log(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('locations.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>
|
||||
@endsection
|
||||
|
|
|
@ -15,8 +15,9 @@
|
|||
@csrf
|
||||
@method("put")
|
||||
<label for="name">Lokationsnavn:</label>
|
||||
<label hidden id="error" for="errormesseages">Lokation findes allerede</label>
|
||||
<input type="text" name="name" id="name" value="{{ $location->name }}" required>
|
||||
<input type="submit" class="btn btn-dark text-white" value="Rediger">
|
||||
<input type="submit" id="disable" class="btn btn-dark text-white" value="Rediger">
|
||||
</form>
|
||||
@endsection
|
||||
@section("scripts")
|
||||
|
@ -29,5 +30,57 @@
|
|||
}
|
||||
);
|
||||
});
|
||||
|
||||
//Dont delete me, if the user reloads the pages with text in the text-box this code runs.
|
||||
$(document).ready(function () {
|
||||
$value = $('#name').val();
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '{{route('locations.nameCheckUpdate')}}',
|
||||
data: {'nameCheck':$value, 'id':{{$location->id}}},
|
||||
success:function (data) {
|
||||
console.log(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('locations.nameCheckUpdate')}}',
|
||||
data: {'nameCheck':$value, 'id':{{$location->id}}},
|
||||
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>
|
||||
@endsection
|
||||
|
|
|
@ -29,20 +29,14 @@
|
|||
<label for="week">Uge nr.</label>
|
||||
<label hidden id="error" for="errormesseages">Menuplan findes allerede</label>
|
||||
<input type="number" name="week" id="week" min="1" max="53" placeholder="1" required>
|
||||
<div id="editor">
|
||||
<h2 class="ql-align-center"><strong>Mandag:</strong></h2>
|
||||
<p class="ql-align-center">{Mandag}</p>
|
||||
<p class="ql-align-center"><br></p>
|
||||
<h2 class="ql-align-center"><strong>Tirsdag:</strong></h2>
|
||||
<p class="ql-align-center">{Tirsdag}</p>
|
||||
<p class="ql-align-center"><br></p>
|
||||
<h2 class="ql-align-center"><strong>Onsdag:</strong></h2>
|
||||
<p class="ql-align-center">{Onsdag}</p>
|
||||
<p class="ql-align-center"><br></p>
|
||||
<h2 class="ql-align-center"><strong>Torsdag:</strong></h2>
|
||||
<p class="ql-align-center">{Torsdag}</p>
|
||||
</div>
|
||||
<textarea name="menu" class="d-none" id="hiddenArea"></textarea>
|
||||
<label for="monday">Mandag:</label>
|
||||
<input type="text" name="monday" id="monday" placeholder="Hawaii Pizza" required>
|
||||
<label for="tuesday">Tirsdag:</label>
|
||||
<input type="text" name="tuesday" id="tuesday" placeholder="Pasta Bolognese" required>
|
||||
<label for="wednesday">Onsdag:</label>
|
||||
<input type="text" name="wednesday" id="wednesday" placeholder="Pandekager" required>
|
||||
<label for="thursday">Torsdag:</label>
|
||||
<input type="text" name="thursday" id="thursday" placeholder="Bøf med løg" required>
|
||||
<label class="toggle">
|
||||
<input class="toggle__input" id="isNews" type="checkbox" name="newsoption" onclick="change()">
|
||||
<span class="toggle__label">
|
||||
|
@ -56,34 +50,6 @@
|
|||
|
||||
<input type="submit" id="disable" class="btn btn-dark text-white" value="Opret Menuplan">
|
||||
</form>
|
||||
|
||||
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
|
||||
<script>
|
||||
var container = document.getElementById("editor");
|
||||
var fullEditor = new Quill(container, {
|
||||
modules: {
|
||||
'toolbar': [
|
||||
[ 'bold', 'italic', 'underline', 'strike' ],
|
||||
[{ 'color': [] }],
|
||||
[{ 'script': 'super' }, { 'script': 'sub' }],
|
||||
[{ 'header': '1' }, { 'header': '2' }, 'blockquote' ],
|
||||
[{ 'list': 'ordered' }, { 'list': 'bullet'}, { 'indent': '-1' }, { 'indent': '+1' }],
|
||||
[ {'direction': 'rtl'}, { 'align': [] }],
|
||||
[ 'link' ],
|
||||
[ 'clean' ]
|
||||
],
|
||||
},
|
||||
theme: 'snow'
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
var form = document.querySelector('form');
|
||||
form.onsubmit = function() {
|
||||
var myEditor = document.getElementById('editor');
|
||||
var html = myEditor.children[0].innerHTML;
|
||||
document.getElementById('hiddenArea').innerText = html;
|
||||
}
|
||||
</script>
|
||||
@endsection
|
||||
@section("scripts")
|
||||
<script>
|
||||
|
|
|
@ -30,8 +30,14 @@
|
|||
<label for="mandag">Uge:</label>
|
||||
<label hidden id="error" for="errormesseages">Menuplan findes allerede</label>
|
||||
<input type="number" name="week" id="week" min="1" max="53" value="{{ $menuplan->week }}" required>
|
||||
<div id="editor">{!! $menuplan->menu !!}</div>
|
||||
<textarea name="menu" class="d-none" id="hiddenArea"></textarea>
|
||||
<label for="monday">Mandag:</label>
|
||||
<input type="text" name="monday" id="monday" placeholder="Hawaii Pizza" required value="{{ $menuplan->monday }}">
|
||||
<label for="tuesday">Tirsdag:</label>
|
||||
<input type="text" name="tuesday" id="tuesday" placeholder="Pasta Bolognese" required value="{{ $menuplan->tuesday }}">
|
||||
<label for="wednesday">Onsdag:</label>
|
||||
<input type="text" name="wednesday" id="wednesday" placeholder="Pandekager" required value="{{ $menuplan->wednesday }}">
|
||||
<label for="thursday">Torsdag:</label>
|
||||
<input type="text" name="thursday" id="thursday" placeholder="Bøf med løg" required value="{{ $menuplan->thursday }}">
|
||||
<label class="toggle">
|
||||
<input class="toggle__input" type="checkbox" name="newsoption">
|
||||
<span class="toggle__label">
|
||||
|
@ -40,34 +46,6 @@
|
|||
</label>
|
||||
<input id="disable" type="submit" class="btn btn-dark text-white" value="Rediger Menuplan">
|
||||
</form>
|
||||
|
||||
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
|
||||
<script>
|
||||
var container = document.getElementById("editor");
|
||||
var fullEditor = new Quill(container, {
|
||||
modules: {
|
||||
'toolbar': [
|
||||
[ 'bold', 'italic', 'underline', 'strike' ],
|
||||
[{ 'color': [] }],
|
||||
[{ 'script': 'super' }, { 'script': 'sub' }],
|
||||
[{ 'header': '1' }, { 'header': '2' }, 'blockquote' ],
|
||||
[{ 'list': 'ordered' }, { 'list': 'bullet'}, { 'indent': '-1' }, { 'indent': '+1' }],
|
||||
[ {'direction': 'rtl'}, { 'align': [] }],
|
||||
[ 'link' ],
|
||||
[ 'clean' ]
|
||||
],
|
||||
},
|
||||
theme: 'snow'
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
var form = document.querySelector('form');
|
||||
form.onsubmit = function() {
|
||||
var myEditor = document.getElementById('editor');
|
||||
var html = myEditor.children[0].innerHTML;
|
||||
document.getElementById('hiddenArea').innerText = html;
|
||||
}
|
||||
</script>
|
||||
@endsection
|
||||
@section("scripts")
|
||||
<script>
|
||||
|
|
|
@ -10,10 +10,11 @@
|
|||
@endsection
|
||||
|
||||
@section("content")
|
||||
<h1>Opret Vaskemaskine:</h1>
|
||||
<h1 id="errormesseages" >Opret Vaskemaskine:</h1>
|
||||
<form method="post" action="{{ route("washing-machines.store") }}">
|
||||
@csrf
|
||||
<label for="name_first">Vaskemaskine Navn:</label>
|
||||
<label hidden id="error" for="errormesseages">Vaskemaskinen med den lokation findes allerede</label>
|
||||
<input type="text" name="name" id="name" max="60" placeholder="Vaskemaskine nr. 1" required>
|
||||
<label for="location_id">Lokation:</label>
|
||||
<select name="location_id" id="location_id" class="mb-2" required>
|
||||
|
@ -26,7 +27,7 @@
|
|||
<option disabled> Der er ingen lokationer oprettet!</option>
|
||||
@endif
|
||||
</select>
|
||||
<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>
|
||||
@endsection
|
||||
@section("scripts")
|
||||
|
@ -39,5 +40,82 @@
|
|||
}
|
||||
);
|
||||
});
|
||||
|
||||
//Dont delete me, if the user reloads the pages with text in the text-box this code runs.
|
||||
$(document).ready(function () {
|
||||
$value = $('#name').val();
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '{{route('washing-machines.nameCheck')}}',
|
||||
data: {'nameCheck':$value, 'location': $('#location_id').val()},
|
||||
success:function (data) {
|
||||
console.log(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('washing-machines.nameCheck')}}',
|
||||
data: {'nameCheck':$value, 'location': $('#location_id').val()},
|
||||
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);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$('#location_id').on('change', function () {
|
||||
$value = $('#name').val();
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '{{route('washing-machines.nameCheck')}}',
|
||||
data: {'nameCheck':$value, 'location': $('#location_id').val()},
|
||||
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>
|
||||
@endsection
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
@csrf
|
||||
@method("put")
|
||||
<label for="name_first">Vaskemaskine Navn:</label>
|
||||
<label hidden id="error" for="errormesseages">Vaskemaskinen med den lokation findes allerede</label>
|
||||
<input type="text" name="name" id="name" max="60" value="{{$machine->name}}" required>
|
||||
<select class="w-100" name="location_id" id="location_id" class="mb-2" required>
|
||||
<option disabled> -- Vælg Lokation -- </option>
|
||||
|
@ -25,7 +26,7 @@
|
|||
<option {{ $selected }} value="{{ $location->id }}">{{ $location->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<input type="submit" class="btn btn-dark text-white" value="Rediger">
|
||||
<input type="submit" id="disable" class="btn btn-dark text-white" value="Rediger">
|
||||
</form>
|
||||
@endsection
|
||||
@section("scripts")
|
||||
|
@ -38,5 +39,82 @@
|
|||
}
|
||||
);
|
||||
});
|
||||
|
||||
//Dont delete me, if the user reloads the pages with text in the text-box this code runs.
|
||||
$(document).ready(function () {
|
||||
$value = $('#name').val();
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '{{route('washing-machines.nameCheckUpdate')}}',
|
||||
data: {'nameCheck':$value, 'location': $('#location_id').val(), 'id': {{$machine->id}}},
|
||||
success:function (data) {
|
||||
console.log(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('washing-machines.nameCheckUpdate')}}',
|
||||
data: {'nameCheck':$value, 'location': $('#location_id').val(), 'id': {{$machine->id}}},
|
||||
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);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$('#location_id').on('change', function () {
|
||||
$value = $('#name').val();
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '{{route('washing-machines.nameCheckUpdate')}}',
|
||||
data: {'nameCheck':$value, 'location': $('#location_id').val(), 'id': {{$machine->id}}},
|
||||
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>
|
||||
@endsection
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
<div class="row align-items-center">
|
||||
<a class="btn btn-inline btn-sde-blue mb-0" href="{{ route('washing-machines.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Vaskemaskine</a>
|
||||
</div>
|
||||
{!! session()->get('WashingNameExists') !!}
|
||||
<table class="tbl mt-2">
|
||||
<tr>
|
||||
<th>Navn</th>
|
||||
|
|
|
@ -18,7 +18,17 @@
|
|||
<span class="text-center text-white bold">{{ __('msg.ugestor') }}: {{$menuplan->week}}</span>
|
||||
@endif
|
||||
<div class="col w-100 mt-1">
|
||||
{!! $menuplan->menu !!}
|
||||
{!! '<h2 class="ql-align-center"><strong>Mandag:</strong></h2>'.
|
||||
'<p class="ql-align-center">'.$menuplan->monday.'</p><p class="ql-align-center"></p>'.
|
||||
|
||||
'<h2 class="ql-align-center"><strong>Tirsdag:</strong></h2>'.
|
||||
'<p class="ql-align-center">'.$menuplan->tuesday.'</p><p class="ql-align-center"></p>'.
|
||||
|
||||
'<h2 class="ql-align-center"><strong>Onsdag:</strong></h2>'.
|
||||
'<p class="ql-align-center">'.$menuplan->wednesday.'</p><p class="ql-align-center"></p>'.
|
||||
|
||||
'<h2 class="ql-align-center"><strong>Torsdag:</strong></h2>'.
|
||||
'<p class="ql-align-center">'.$menuplan->thursday.'</p>' !!}
|
||||
</div>
|
||||
@endif
|
||||
@endforeach
|
||||
|
|
|
@ -62,6 +62,9 @@ Route::get("/usersCheck", "UserController@nameCheck")->name("users.nameCheck");
|
|||
Route::get("/guidesCheck", "GuideController@nameCheck")->name("guides.nameCheck");
|
||||
Route::get("/newsCheck", "NewsController@nameCheck")->name("news.nameCheck");
|
||||
Route::get("/menuplanCheck", "MenuPlanController@nameCheck")->name("menuplans.nameCheck");
|
||||
Route::get("/locationsCheck", "LocationController@nameCheck")->name("locations.nameCheck");
|
||||
Route::get("/washingCheck", "WashingMachineController@nameCheck")->name("washing-machines.nameCheck");
|
||||
|
||||
|
||||
//Check name update adminpanel
|
||||
Route::get("/eventCheckUpdate", "EventController@nameCheckUpdate")->name("events.nameCheckUpdate");
|
||||
|
@ -69,6 +72,8 @@ Route::get("/roleCheckUpdate", "RolesController@nameCheckUpdate")->name("roles.n
|
|||
Route::get("/guidesCheckUpdate", "GuideController@nameCheckUpdate")->name("guides.nameCheckUpdate");
|
||||
Route::get("/newsCheckUpdate", "NewsController@nameCheckUpdate")->name("news.nameCheckUpdate");
|
||||
Route::get("/menuplanCheckUpdate", "MenuPlanController@nameCheckUpdate")->name("menuplans.nameCheckUpdate");
|
||||
Route::get("/locationsCheckUpdate", "LocationController@nameCheckUpdate")->name("locations.nameCheckUpdate");
|
||||
Route::get("/washingCheckUpdate", "WashingMachineController@nameCheckUpdate")->name("washing-machines.nameCheckUpdate");
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue