Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
NuwanJ committed Jul 14, 2024
1 parent d8fa24f commit 4f8fe61
Show file tree
Hide file tree
Showing 10 changed files with 1,380 additions and 1,360 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/Backend/ComponentItemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function store(Request $request)
$type = new ComponentItem($data);
$type->save();

return redirect()->route('admin.component.items.edit.location', $type)->with('Success', 'Component was created !');
return redirect()->route('admin.component.items.index', $type)->with('Success', 'Component was created !');
} catch (\Exception $ex) {
return abort(500);
}
Expand Down
7 changes: 2 additions & 5 deletions app/Http/Controllers/Backend/EquipmentItemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@
namespace App\Http\Controllers\Backend;

use App\Http\Controllers\Controller;
use App\Models\ComponentItem;
use App\Models\EquipmentItem;
use App\Models\EquipmentType;
use App\Models\ItemLocations;
use App\Models\Locations;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Storage;
use Intervention\Image\Facades\Image;
use Torann\GeoIP\Location;

class EquipmentItemController extends Controller
{
Expand Down Expand Up @@ -79,9 +76,9 @@ public function store(Request $request)
// Update checkbox condition
$type->isElectrical = ($request->isElectrical != null);

// save first, otherwise the id is not there
// save first, otherwise the id is not there
$type->save();
return redirect()->route('admin.equipment.items.edit.location', $type)->with('Success', 'Equipment was created !');
return redirect()->route('backend.equipment.items.index', $type)->with('Success', 'Equipment was created !');
} catch (\Exception $ex) {
return abort(500);
}
Expand Down
5 changes: 2 additions & 3 deletions app/Http/Livewire/Backend/LocationsToggler.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace App\Http\Livewire;

use App\Models\EquipmentItem;
use App\Models\ItemLocations;
use Livewire\Component;

Expand Down Expand Up @@ -33,7 +32,7 @@ public function addLocation()
}

// Function to show the X, Y, Z input boxes once the user ticks the checkbox
public function showXYZ()
public function showXYZ()
{
$this->emit('showXYZ');
}
Expand All @@ -46,6 +45,6 @@ public function mount()
public function render()
{
$this->isAvailableInLocation = ItemLocations::where('item_id', $this->itemModel->inventoryCode())->where('location_id', $this->locationID)->exists();
return view('livewire.locations-toggler' , ['id'=> $this->locationID, 'location' => $this->locationTitle]);
return view('livewire.locations-toggler', ['id' => $this->locationID, 'location' => $this->locationTitle]);
}
}
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"treeware/plant": true
"treeware/plant": true,
"php-http/discovery": true
}
},
"minimum-stability": "dev",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
@endif
<p> Change locations for <b>{{ $componentItem->title }}</b></p>
<ul>
<ul class="list-unstyled pl-4">
@foreach ($locations as $i => $loc)
@include('backend.partials.location-hierarchy-for-edit-location', [
'location' => $loc,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
@endif
<p> Change locations for <b>{{ $consumableItem->title }}</b></p>

<ul>
<ul class="list-unstyled pl-4">
@foreach ($locations as $i => $loc)
@include('backend.partials.location-hierarchy-for-edit-location', [
'location' => $loc,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
@endif
<p> Change locations for <b>{{ $equipmentItem->title }}</b></p>

<ul>
<ul class="list-unstyled pl-4">
@foreach ($locations as $i => $loc)
@include('backend.partials.location-hierarchy-for-edit-location', [
'location' => $loc,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<li>
@livewire('locations-toggler', ['locationID' => $location->id, 'locationTitle'=> $location->location, 'itemModel' =>
$itemModel])
@livewire('locations-toggler', ['locationID' => $location->id, 'locationTitle' => $location->location, 'itemModel' => $itemModel])
</li>
@if ($location->getChildrenLocations()->count() > 0)
<ul>
@foreach($location->getChildrenLocations() as $i => $loc)
@include('backend.partials.location-hierarchy-for-edit-location', ['location' => $loc, 'itemModel' => $itemModel])
<ul class="list-unstyled pl-4">
@foreach ($location->getChildrenLocations() as $i => $loc)
@include('backend.partials.location-hierarchy-for-edit-location', [
'location' => $loc,
'itemModel' => $itemModel,
])
@endforeach
</ul>
@endif
@endif
10 changes: 6 additions & 4 deletions resources/views/livewire/locations-toggler.blade.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<div class="container pb-1">
<div class="pb-1">
<div class="row d-flex">
<div class="col d-flex">
<input id="{{ $id }}" class="form-check-input" style="width: 20px; height: 20px;"
<input class="me-2" id="{{ $id }}" class="form-check-input" style="width: 20px; height: 20px;"
wire:model="isAvailableInLocation" wire:click="addLocation" type="checkbox">
<label class="form-check-label align-self-center ms-1 for="{{ $id }}">
{{ $location }}
</label>
</div>
<div class="" style="width: 90px;">
{{-- This is not fully implemented --}}
{{-- ----------------------------- --}}
{{-- <div class="" style="width: 90px;">
<input class="form-control form-control-sm" placeholder="X" type="number" id="X" name="X"
data-bs-toggle="tooltip" data-bs-placement="top" title="Relative coordinate through X axis">
</div>
Expand All @@ -19,6 +21,6 @@
<div class="" style="width: 90px;">
<input class="form-control form-control-sm" placeholder="Z" type="number" id="Z" name="Z"
data-bs-toggle="tooltip" data-bs-placement="top" title="Relative coordinate through Z axis">
</div>
</div> --}}
</div>
</div>
Loading

0 comments on commit 4f8fe61

Please sign in to comment.