v1.3.4 - Small fixes

This commit is contained in:
frederikpyt 2020-09-22 09:07:36 +02:00
parent cc3d78200a
commit 505ed3710b
9 changed files with 73 additions and 9 deletions

View File

@ -154,6 +154,76 @@ class WashingMachineController extends Controller
return redirect()->route("washing-machines.index"); return redirect()->route("washing-machines.index");
} }
public function search(Request $request)
{
if ($request->ajax()) {
$output = "<tr>" .
"<th>Navn</th>" .
"<th>Lokation</th>" .
"<th style=\"width: 1em;\"><img class=\"w-100\" src=" . asset('/images/icons/pencil.svg') . " alt=\"Update\"></th>" .
"<th style=\"width: 1em;\"><img class=\"w-100\" src=" . asset('/images/icons/trashcan.svg') . " alt=\"Delete\"></th>" .
"</tr>";
if ($request->option !== 'all') {
$machines = DB::table('washing_machines')
->join('locations', 'washing_machines.location_id', '=', 'locations.id')
->select(DB::raw('washing_machines.name as washing_name, locations.name as location_name, washing_machines.id as id'))
->where('locations.id', '=', $request->option)
->get();
if (count($machines) !== 0) {
foreach ($machines as $machine) {
$output .= '<tr>' .
'<td>' . $machine->washing_name . '</td>' .
'<td>' . $machine->location_name . '</td>' .
'<td><a href="' . route("washing-machines.edit", ["washing_machine" => $machine->id]) . '"><img class="w-100" src="' . asset('/images/icons/pencil-dark.svg') . '" alt="Update"></a></td>' .
'<td><form method="post" action="' . route("washing-machines.destroy", ["washing_machine" => $machine->id]) . '" class="w-100 nostyle">' .
csrf_field() .
method_field("delete") .
'<button class="w-100 nostyle" onclick="return confirm(\'Are you sure you want to delete?\');" type="submit"><img class="w-100 cursor-pointer" src="' . asset('/images/icons/trashcan-dark.svg') . '" alt="Delete"></button>' .
'</form>' .
'</td>' .
'</tr>';
}
} else {
$output .= '<tr>' .
'<td>Det er ikke blivet oprettet nogen vaskmaskine på denne lokation endnu</td>' .
'<td></td>' .
'<td></td>' .
'<td></td>' .
'</tr>';
}
} elseif ($request->option === "all") {
$machines = WashingMachine::all();
if (count($machines) !== 0) {
foreach ($machines as $machine) {
$output .= '<tr>' .
'<td>' . $machine->name . '</td>' .
'<td>' . Location::query()->where("id", "=", $machine->location_id)->first()->name . '</td>' .
'<td><a href="' . route("washing-machines.edit", ["washing_machine" => $machine->id]) . '"><img class="w-100" src="' . asset('/images/icons/pencil-dark.svg') . '" alt="Update"></a></td>' .
'<td><form method="post" action="' . route('washing-machines.destroy', ['washing_machine' => $machine->id]) . '" class="w-100 nostyle">' .
csrf_field() .
method_field("delete") .
'<button class="w-100 nostyle" onclick="return confirm(' . "'Are you sure you want to delete?'" . ');" type="submit"><img class="w-100 cursor-pointer" src="' . asset('/images/icons/trashcan-dark.svg') . '" alt="Delete"></button>' .
'</form>' .
'</td>' .
'</tr>';
}
} else {
$output .= '<tr>' .
'<td>Det er ikke blivet oprettet nogen vaskmaskine på denne lokation endnu</td>' .
'<td></td>' .
'<td></td>' .
'<td></td>' .
'</tr>';
}
}
return Response($output);
}
}
//Used for checking if the currently typed washingmachine name is unique. Create version //Used for checking if the currently typed washingmachine name is unique. Create version
public function nameCheck(Request $request){ public function nameCheck(Request $request){
$washing = WashingMachine::query()->where('name', 'LIKE',$request->nameCheck)->where('location_id', '=', $request->location)->get(); $washing = WashingMachine::query()->where('name', 'LIKE',$request->nameCheck)->where('location_id', '=', $request->location)->get();

View File

@ -81,6 +81,4 @@
@endforeach @endforeach
</table> </table>
</div> </div>
{{ $guides->links() }}
@endsection @endsection

View File

@ -45,6 +45,4 @@
</tr> </tr>
@endforeach @endforeach
</table> </table>
{{ $locations->links() }}
@endsection @endsection

View File

@ -20,7 +20,6 @@
<a class="btn text-center btn-sde-blue mt-1" href="tel:+45{{ $contact->phone }}">{{__('msg.ring')}}</a> <a class="btn text-center btn-sde-blue mt-1" href="tel:+45{{ $contact->phone }}">{{__('msg.ring')}}</a>
@endif @endif
@endforeach @endforeach
{{ $contacts->links() }}
@else @else
<p class="text-center">{{__('msg.dereringenkontakter')}}!</p> <p class="text-center">{{__('msg.dereringenkontakter')}}!</p>
@endif @endif

View File

@ -117,7 +117,6 @@
</div> </div>
</div> </div>
@endforeach @endforeach
{{ $events->links() }}
@else @else
<p class="text-center" style="margin-bottom: auto">{{__('msg.dereringenaktiviteter')}}!</p> <p class="text-center" style="margin-bottom: auto">{{__('msg.dereringenaktiviteter')}}!</p>
@endif @endif

View File

@ -55,7 +55,6 @@
</div> </div>
</div> </div>
@endforeach @endforeach
{{ $guides->links() }}
@else @else
<p style="margin: 0 18px; margin-bottom: auto; text-align: center">{{__('msg.dereringenvejledninger')}}.</p> <p style="margin: 0 18px; margin-bottom: auto; text-align: center">{{__('msg.dereringenvejledninger')}}.</p>
@endif @endif

View File

@ -37,5 +37,4 @@
<p class="text-center">{{__('msg.dereringenmenuplanerdenneuge')}}!</p> <p class="text-center">{{__('msg.dereringenmenuplanerdenneuge')}}!</p>
@endif @endif
</main> </main>
{{ $menuPlans->links() }}
@endsection @endsection

View File

@ -33,7 +33,6 @@
@if(count($reservations) < 1 || $washingreservations == 0) @if(count($reservations) < 1 || $washingreservations == 0)
<p style="margin: 0 18px;">{{__('msg.duharingenreservationer')}}.</p> <p style="margin: 0 18px;">{{__('msg.duharingenreservationer')}}.</p>
@else @else
{{ $reservations->links() }}
@endif @endif
<a href="{{ route("washing-reservations.create") }}" class="btn btn-sde-blue mt-auto mb-1">{{__('msg.reservervaskemaskine')}}</a> <a href="{{ route("washing-reservations.create") }}" class="btn btn-sde-blue mt-auto mb-1">{{__('msg.reservervaskemaskine')}}</a>
</main> </main>

View File

@ -44,6 +44,9 @@ Route::post("/feedbacks/store", "FeedbackController@storeajax")->name("feedbacks
Route::get("/signup", "UserController@signup")->name("users.signup"); Route::get("/signup", "UserController@signup")->name("users.signup");
Route::post("/signupStore", "UserController@signupStore")->name("users.signupStore"); Route::post("/signupStore", "UserController@signupStore")->name("users.signupStore");
//Search
Route::get("/machineapi", "WashingMachineController@search")->name("washing-machines.search");
//Cookies //Cookies
Route::get("/languages", "UserController@setLanguages")->name("users.setLanguages"); Route::get("/languages", "UserController@setLanguages")->name("users.setLanguages");
Route::get("/darkmode", "UserController@setDarkMode")->name("users.setDarkMode"); Route::get("/darkmode", "UserController@setDarkMode")->name("users.setDarkMode");