v0.10.14g - Fixed images error on washing machines
This commit is contained in:
parent
abcc484e7c
commit
f33b2bb45c
|
@ -165,82 +165,4 @@ class LocationController extends Controller
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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/trashcan-dark.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') {
|
|
||||||
$locations = 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, locations.id as id'))
|
|
||||||
->where('locations.id', '=', $request->option)
|
|
||||||
->get();
|
|
||||||
|
|
||||||
if(count($locations) !== 0){
|
|
||||||
foreach ($locations as $key => $location){
|
|
||||||
$output.='<tr>'.
|
|
||||||
'<td>' . $location->washing_name . '</td>'.
|
|
||||||
'<td>' . $location->location_name . '</td>'.
|
|
||||||
'<td><form method="post" action="' .route("locations.destroy", [ "location" => $location->id ]). '" class="w-100 nostyle">'.
|
|
||||||
'<td><form method="post" action="' .route("locations.edit", [ "location" => $location->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 i nu</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 i nu</td>'.
|
|
||||||
'<td></td>'.
|
|
||||||
'<td></td>'.
|
|
||||||
'<td></td>'.
|
|
||||||
'</tr>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return Response($output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
|
|
||||||
use App\WashingMachine;
|
use App\WashingMachine;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\View\View;
|
use Illuminate\View\View;
|
||||||
|
|
||||||
class WashingMachineController extends Controller
|
class WashingMachineController extends Controller
|
||||||
|
@ -167,4 +168,78 @@ class WashingMachineController extends Controller
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 i nu</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 i nu</td>'.
|
||||||
|
'<td></td>'.
|
||||||
|
'<td></td>'.
|
||||||
|
'<td></td>'.
|
||||||
|
'</tr>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return Response($output);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
console.log($value);
|
console.log($value);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'get',
|
type: 'get',
|
||||||
url: '{{route('locations.search')}}',
|
url: '{{route('washing-machines.search')}}',
|
||||||
data: {'option':$value},
|
data: {'option':$value},
|
||||||
success:function (data) {
|
success:function (data) {
|
||||||
console.log($value);
|
console.log($value);
|
||||||
|
|
|
@ -49,7 +49,7 @@ Route::get("/rolesapi", "RolesController@search")->name("roles.search");
|
||||||
Route::get("/userapi", "UserController@search")->name("users.search");
|
Route::get("/userapi", "UserController@search")->name("users.search");
|
||||||
Route::get("/vaskeapi", "WashingReservationController@search")->name("washing-reservations.search");
|
Route::get("/vaskeapi", "WashingReservationController@search")->name("washing-reservations.search");
|
||||||
Route::get("/risrosapi", "FeedbackController@search")->name("feedbacks.search");
|
Route::get("/risrosapi", "FeedbackController@search")->name("feedbacks.search");
|
||||||
Route::get("/locationapi", "LocationController@search")->name("locations.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");
|
||||||
|
|
Loading…
Reference in New Issue