diff --git a/app/Http/Controllers/ColorController.php b/app/Http/Controllers/ColorController.php
deleted file mode 100644
index dcdaea7..0000000
--- a/app/Http/Controllers/ColorController.php
+++ /dev/null
@@ -1,91 +0,0 @@
-validate([
- 'name' => 'required|string|max:255',
- 'hex' => 'required|string|max:255'
- ]);
-
- $color = new Color();
- $color->name = $request->name;
- $color->hex = $request->hex;
- $color->save();
-
- return redirect()->route('colors.index');
- }
-
- /**
- * Display the specified resource.
- */
- public function show(string $id)
- {
- // show single color
- $color = Color::find($id);
- return view('colors.show', compact('color'));
- }
-
- /**
- * Show the form for editing the specified resource.
- */
- public function edit(string $id)
- {
- // edit color
- $color = Color::find($id);
- return view('colors.edit', compact('color'));
- }
-
- /**
- * Update the specified resource in storage.
- */
- public function update(Request $request, string $id)
- {
- // update color
- $color = Color::find($id);
- $color->name = $request->name;
- $color->hex = $request->hex;
- $color->save();
- return redirect()->route('colors.show', $color->id);
- }
-
- /**
- * Remove the specified resource from storage.
- */
- public function destroy(string $id)
- {
- // delete color
- $color = Color::find($id);
- $color->delete();
- return redirect()->route('colors.index');
- }
-}
diff --git a/app/Http/Controllers/FilamentController.php b/app/Http/Controllers/FilamentController.php
deleted file mode 100644
index 5ea5c3b..0000000
--- a/app/Http/Controllers/FilamentController.php
+++ /dev/null
@@ -1,143 +0,0 @@
- $filaments, 'manufacturers' => $manufacturers]);
- }
-
- /**
- * Show the form for creating a new resource.
- */
- public function create()
- {
- // create a new filament
- $manufacturers = Manufacturer::all();
- $types = FilamentType::all();
- $colors = Color::all();
- return view('filaments.create', compact('manufacturers', 'types', 'colors'));
- }
-
- /**
- * Store a newly created resource in storage.
- */
- public function store(Request $request)
- {
- // store a new filament
- $request->validate([
- 'name' => 'required|string|max:255',
- 'description' => 'nullable|string',
- 'color_id' => 'required|exists:colors,id',
- 'type_id' => 'required|exists:filament_types,id',
- 'manufacturer_id' => 'required|exists:manufacturers,id',
- 'weight' => 'required|numeric',
- 'price' => 'nullable|decimal:2',
- 'diameter' => 'required|decimal:2',
- 'stock' => 'required|integer'
- ]);
-
- $filament = new Filament();
- $filament->name = $request->name;
- $filament->description = $request->description;
- $filament->color_id = $request->color_id;
- $filament->type_id = $request->type_id;
- $filament->manufacturer_id = $request->manufacturer_id;
- $filament->weight = $request->weight;
- $filament->price = $request->price;
- $filament->diameter = $request->diameter;
- $filament->stock = $request->stock;
- $filament->save();
-
- ManufacturerController::refresh();
- return redirect()->route('filaments.index')->with('success', 'Filament created successfully.');
- }
-
- /**
- * Display the specified resource.
- */
- public function show(string $id)
- {
- // show a specific filament
- $filament = Filament::find($id);
- $manufacturer = Manufacturer::find($filament->manufacturer_id);
- $type = FilamentType::find($filament->type_id);
- $color = Color::find($filament->color_id);
- return view('filaments.show', compact('filament', 'manufacturer', 'type', 'color'));
- }
-
- /**
- * Show the form for editing the specified resource.
- */
- public function edit(string $id)
- {
- // edit a specific filament
- $filament = Filament::find($id);
- $manufacturers = Manufacturer::all();
- $types = FilamentType::all();
- $colors = Color::all();
- return view('filaments.edit', compact('filament', 'manufacturers', 'types', 'colors'));
- }
-
- /**
- * Update the specified resource in storage.
- */
- public function update(Request $request, string $id)
- {
- // update a specific filament
- $request->validate([
- 'name' => 'required|string|max:255',
- 'description' => 'nullable|string',
- 'color_id' => 'required|exists:colors,id',
- 'type_id' => 'required|exists:filament_types,id',
- 'manufacturer_id' => 'required|exists:manufacturers,id',
- 'weight' => 'required|numeric',
- 'price' => 'nullable|decimal:2',
- 'diameter' => 'required|decimal:2',
- 'stock' => 'required|integer'
- ]);
-
- $filament = Filament::find($id);
- $filament->name = $request->name;
- $filament->description = $request->description;
- $filament->color_id = $request->color_id;
- $filament->type_id = $request->type_id;
- $filament->manufacturer_id = $request->manufacturer_id;
- $filament->weight = $request->weight;
- $filament->price = $request->price;
- $filament->diameter = $request->diameter;
- $filament->stock = $request->stock;
- $filament->save();
-
- ManufacturerController::refresh();
-
- return redirect()->route('filaments.show', $filament->id)->with('success', 'Filament updated successfully.');
- }
-
- /**
- * Remove the specified resource from storage.
- */
- public function destroy(string $id)
- {
- // delete a specific filament
- $filament = Filament::find($id);
- $filament->delete();
-
- ManufacturerController::refresh();
- return redirect()->route('filaments.index')->with('success', 'Filament deleted successfully.');
- }
-}
diff --git a/app/Http/Controllers/FilamentTypeController.php b/app/Http/Controllers/FilamentTypeController.php
deleted file mode 100644
index 1b458ef..0000000
--- a/app/Http/Controllers/FilamentTypeController.php
+++ /dev/null
@@ -1,87 +0,0 @@
-name = $request->name;
- $type->description = $request->description;
- $type->save();
- return redirect()->route('types.index');
- }
-
- /**
- * Display the specified resource.
- */
- public function show(string $id)
- {
- // Show Single Type
- $type = FilamentType::find($id);
-
-
- return view('types.show', compact('type'));
- }
-
- /**
- * Show the form for editing the specified resource.
- */
- public function edit(string $id)
- {
- //
- $type = FilamentType::find($id);
- return view('types.edit', compact('type'));
- }
-
- /**
- * Update the specified resource in storage.
- */
- public function update(Request $request, string $id)
- {
- // Store updated type
- $type = FilamentType::find($id);
- $type->name = $request->name;
- $type->description = $request->description;
- $type->save();
- return redirect()->route('types.show', $type->id);
- }
-
- /**
- * Remove the specified resource from storage.
- */
- public function destroy(string $id)
- {
- // Delete Type
- $type = FilamentType::find($id);
- $type->delete();
- return redirect()->route('types.index')->with('success','Type deleted successfully.');
-
- }
-}
diff --git a/app/Http/Controllers/ManufacturerController.php b/app/Http/Controllers/ManufacturerController.php
deleted file mode 100644
index c8da5fc..0000000
--- a/app/Http/Controllers/ManufacturerController.php
+++ /dev/null
@@ -1,106 +0,0 @@
-sortBy('name');
- return view('manufacturers.index', compact('manufacturers'));
- }
-
- public static function refresh()
- {
- foreach (Manufacturer::all() as $manufacturer) {
- $manufacturer->filament_count = Filament::all()->where('manufacturer_id', $manufacturer->id)->count();
- $manufacturer->save();
- }
- return redirect()->route('manufacturers.index')->with('success', 'Manufacturer count refreshed successfully.');
- }
-
- /**
- * Show the form for creating a new resource.
- */
- public function create()
- {
- // create a new manufacturer
- return view('manufacturers.create');
- }
-
- /**
- * Store a newly created resource in storage.
- */
- public function store(Request $request)
- {
- // store a new manufacturer
- $request->validate([
- 'name' => 'required|string|max:255'
- ]);
-
- $manufacturer = new Manufacturer();
- $manufacturer->name = $request->name;
- $manufacturer->description = $request->description;
- $manufacturer->website = $request->website;
- $manufacturer->save();
-
- return redirect()->route('manufacturers.index')->with('success', 'Manufacturer created successfully.');
- }
-
- /**
- * Display the specified resource.
- */
- public function show(string $id)
- {
- // show a specific manufacturer
- $manufacturer = Manufacturer::find($id);
- return view('manufacturers.show', compact('manufacturer'));
- }
-
- /**
- * Show the form for editing the specified resource.
- */
- public function edit(string $id)
- {
- // edit a specific manufacturer
- $manufacturer = Manufacturer::find($id);
- return view('manufacturers.edit', compact('manufacturer'));
- }
-
- /**
- * Update the specified resource in storage.
- */
- public function update(Request $request, string $id)
- {
- // update a specific manufacturer
- $request->validate([
- 'name' => 'required|string|max:255'
- ]);
-
- $manufacturer = Manufacturer::find($id);
- $manufacturer->name = $request->name;
- $manufacturer->description = $request->description;
- $manufacturer->website = $request->website;
- $manufacturer->save();
- return redirect()->route('manufacturers.show', $manufacturer->id)->with('success', 'Manufacturer updated successfully.');
- }
-
- /**
- * Remove the specified resource from storage.
- */
- public function destroy(string $id)
- {
- // delete a specific manufacturer
- $manufacturer = Manufacturer::find($id);
- $manufacturer->delete();
- return redirect()->route('manufacturers.index')->with('success', 'Manufacturer deleted successfully.');
- }
-}
diff --git a/app/Livewire/Filament/Filament.php b/app/Livewire/Filament/Filament.php
index 926d68d..225ed4d 100644
--- a/app/Livewire/Filament/Filament.php
+++ b/app/Livewire/Filament/Filament.php
@@ -27,19 +27,21 @@ class Filament extends Component
public $type_id = '';
public $manufacturer_id = '';
public $weight = '1000';
+ public $finish = 'Basic';
public $price = '0';
public $stock = '0';
-
+
public $search = '';
public $editid = '';
public $deleteid = '';
+
public function create() {
@Auth::check();
// Validate
- $this->validate();
+ $this->validate();
$filament = new Model();
$filament->name = $this->name;
@@ -47,8 +49,9 @@ class Filament extends Component
$filament->diameter = $this->diameter;
$filament->color_id = $this->color_id;
$filament->filament_type_id = $this->type_id;
- $filament->manufacturer_id = $this->manufacturer_id;
+ $filament->manufacturer_id = $this->manufacturer_id;
$filament->weight = $this->weight;
+ $filament->finish = $this->finish;
$filament->price = $this->price;
$filament->stock = $this->stock;
$filament->save();
@@ -75,28 +78,30 @@ class Filament extends Component
$this->type_id = $filament->filament_type_id;
$this->manufacturer_id = $filament->manufacturer_id;
$this->weight = $filament->weight;
+ $filament->finish = $this->finish;
$this->price = $filament->price;
$this->stock = $filament->stock;
-
+
Flux::modal('editModal')->show();
}
public function save($editid) {
@Auth::check();
-
+
$filament = Model::findOrFail($editid);
$filament->name = $this->name;
$filament->description = $this->description;
$filament->diameter = $this->diameter;
$filament->color_id = $this->color_id;
$filament->filament_type_id = $this->type_id;
- $filament->manufacturer_id = $this->manufacturer_id;
+ $filament->manufacturer_id = $this->manufacturer_id;
$filament->weight = $this->weight;
+ $filament->finish = $this->finish;
$filament->price = $this->price;
$filament->stock = $this->stock;
$filament->save();
$this->resetInputFields();
-
+
Flux::modal('editModal')->close();
}
@@ -114,6 +119,7 @@ class Filament extends Component
$this->type_id = $filament->filament_type_id;
$this->manufacturer_id = $filament->manufacturer_id;
$this->weight = $filament->weight;
+ $this->finish = $filament->finish;
$this->price = $filament->price;
$this->stock = $filament->stock;
@@ -136,7 +142,7 @@ class Filament extends Component
Flux::modals()->close();
}
public function resetInputFields() {
- $this->reset(['name', 'description', 'diameter', 'color_id', 'type_id', 'manufacturer_id', 'weight', 'price', 'stock', 'deleteid', 'editid']);
+ $this->reset(['name', 'description', 'diameter', 'color_id', 'type_id', 'manufacturer_id', 'weight', 'price', 'finish', 'deleteid', 'editid']);
}
public function render()
{
diff --git a/app/Livewire/Filament/Manufacturer.php b/app/Livewire/Filament/Manufacturer.php
index c948e3d..ebdd6ca 100644
--- a/app/Livewire/Filament/Manufacturer.php
+++ b/app/Livewire/Filament/Manufacturer.php
@@ -9,6 +9,7 @@ use Livewire\Attributes\title;
use Livewire\Attributes\Validate;
use Flux\Flux;
use Illuminate\Support\Facades\Auth;
+use App\Models\Filament;
#[title('Manufacturer List')]
class Manufacturer extends Component{
@@ -30,7 +31,7 @@ class Manufacturer extends Component{
// Validate
- $this->validate();
+ $this->validate();
$manufacturer = new Model();
$manufacturer->name = $this->name;
@@ -55,12 +56,12 @@ class Manufacturer extends Component{
$this->name = $manufacturer->name;
$this->description = $manufacturer->description;
$this->website = $manufacturer->website;
-
+
Flux::modal('editModal')->show();
}
public function save($editid) {
@Auth::check();
-
+
$manufacturer = Model::findOrFail($editid);
$manufacturer->name = $this->name;
$manufacturer->description = $this->description;
@@ -68,7 +69,7 @@ class Manufacturer extends Component{
$manufacturer->save();
$this->resetInputFields();
-
+
Flux::modal('editModal')->close();
}
public function deleteModal($manufacturerid) {
@@ -105,6 +106,7 @@ class Manufacturer extends Component{
public function render()
{
+
return view('livewire.filament.manufacturer', [
'manufacturers' => Model::search('name', $this->search)->paginate(10)
]);
diff --git a/resources/css/app.css b/resources/css/app.css
index b702ade..19e51c1 100644
--- a/resources/css/app.css
+++ b/resources/css/app.css
@@ -42,6 +42,18 @@
--color-pumpkin-900: #7e2610;
--color-pumpkin-950: #440f06;
+ --color-olivine-50: #f3f7ee;
+ --color-olivine-100: #e4edda;
+ --color-olivine-200: #ccdeb8;
+ --color-olivine-300: #a1c181;
+ --color-olivine-400: #8cb16a;
+ --color-olivine-500: #6f964c;
+ --color-olivine-600: #55763a;
+ --color-olivine-700: #435b30;
+ --color-olivine-800: #384a2a;
+ --color-olivine-900: #324027;
+ --color-olivine-950: #182211;
+
--color-nuke-50: oklch(0.99 0.0358 117.24);
--color-nuke-100: oklch(0.97 0.0779 120.18);
--color-nuke-200: oklch(0.95 0.1412 121.89);
diff --git a/resources/views/colors/create.blade.php b/resources/views/colors/create.blade.php
deleted file mode 100644
index 18f95cb..0000000
--- a/resources/views/colors/create.blade.php
+++ /dev/null
@@ -1,36 +0,0 @@
-
| merge(['class' => 'py-4 px-3 first:pl-6 last:pr-6 text-jet']) }}> + | merge(['class' => 'py-4 px-3 first:pl-6 last:pr-6 text-jet-50']) }}> {{ $slot }} | diff --git a/resources/views/filaments/create.blade.php b/resources/views/filaments/create.blade.php deleted file mode 100644 index 2977ef4..0000000 --- a/resources/views/filaments/create.blade.php +++ /dev/null @@ -1,80 +0,0 @@ -
|---|
| Name | -Color | -Weight | -Diameter | -Price | -Stock | -Edit | -Delete | -
|---|---|---|---|---|---|---|---|
| {{ $filament->name }} | -{{ $filament->color->name }} | -{{ $filament->weight }} g | -{{ $filament->diameter }} mm | -@isset($filament->price) {{ $filament->price }} |
- {{ $filament->stock }} | -
{{ $buildplate->name }}
{{ $buildplate->description }}
{{ App\Models\Manufacturer::find($buildplate->manufacturer_id)->name }}
{{ $color->name }}
{{ $color->name }}
{{ $color->hex }}
{{ $color->hex }}
{{ $filament->name }}
{{ $filament->id }}
{{ $filament->name }}
{{ $filament->description }}
{{ App\Models\Color::find($filament->color_id)->name }}
+{{ App\Models\Color::find($filament->color_id)->name }}
{{ App\Models\Manufacturer::find($filament->manufacturer_id)->name }}
{{ App\Models\FilamentType::find($filament->filament_type_id)->name }}
{{ $filament->finish }}
{{ $filament->diameter }} mm
{{ $filament->weight }} g
{{ $filament->price }}€
{{ $filament->stock }}
{{ $manufacturer->name }}
{{ $manufacturer->description }}
{{ $manufacturer->filament_count }}
{{ $type->name }}
{{ $type->description }}
{{ $type->amount }}
| Name | -Filaments | -Website | -Stock | -Edit | -Delete | -
|---|---|---|---|---|---|
| {{ $manufacturer->name }} | -{{ $manufacturer->filament_count }} | -{{ $manufacturer->website }} @isset($manufacturer->website) |
- - |