Add Printers and Printertypes modules with CRUD functionality, migrations, and UI components.

This commit is contained in:
2026-01-24 11:23:37 +01:00
parent 563b0e750e
commit fd61f14ffe
25 changed files with 1017 additions and 4 deletions
+46
View File
@@ -0,0 +1,46 @@
<?php
namespace App\Livewire\Printer;
use Livewire\Attributes\Validate;
use Livewire\Component;
use App\Models\Printer as Model;
use Livewire\Attributes\title;
#[title('Create Printertype')]
class CreatePrinter extends Component
{
public Model $printer ;
public string $name = '';
public string $description = '';
public int $printertype_id = 0;
#[Validate('required')]
public function save(){
$this->validate([
'name' => ['required', 'string', 'max:255'],
'description' => ['nullable', 'string', 'max:255'],
'printertype_id' => ['required', 'integer'],
]);
$printer = new Model();
$printer->name = $this->name;
$printer->description = $this->description;
$printer->printertype_id = $this->printertype_id;
$printer->save();
return $this->redirectRoute('printers.show', $printer->id, navigate: true);
}
public function cancel(){
return $this->redirectRoute('printers.index', navigate: true);
}
public function render()
{
return view('livewire.printer.create', [
]);
}
}
+52
View File
@@ -0,0 +1,52 @@
<?php
namespace App\Livewire\Printer;
use Livewire\Attributes\Validate;
use Livewire\Component;
use App\Models\Printer as Model;
use Livewire\Attributes\title;
#[title('Edit Printer')]
class EditPrinter extends Component
{
public Model $printer ;
public string $name = '';
public string $description = '';
public int $printertype_id = 0;
#[Validate('required')]
public function save(){
$this->validate([
'name' => ['required', 'string', 'max:255'],
'description' => ['nullable', 'string', 'max:255'],
'printertype_id' => ['required', 'integer'],
]);
$this->printertype->update([
'name' => $this->name,
'description' => $this->description,
'printertype_id' => $this->printertype_id,
]);
return $this->redirectRoute('printers.show', $this->printer->id, navigate: true);
}
public function cancel(){
return $this->redirectRoute('printers.index', navigate: true);
}
public function mount(Model $printer){
$this->printer = $printer;
$this->name = $printer->name;
$this->description = $printer->description;
$this->printertype_id = $printer->printertype_id;
}
public function render()
{
return view('livewire.printer.create', [
]);
}
}
+44
View File
@@ -0,0 +1,44 @@
<?php
namespace App\Livewire\Printer;
use Illuminate\Support\Facades\Auth;
use Livewire\Component;
use App\Models\Printer as Model;
use App\Models\Manufacturer as Manufacturer;
use Livewire\WithPagination;
use Livewire\Attributes\title;
#[title('Printer')]
class Printer extends Component
{
use WithPagination;
public Model $printer ;
public $search = '';
public function create(){
return $this->redirectRoute('printers.create', navigate: true);
}
public function show($id){
return $this->redirectRoute('printers.show', $id);
}
public function edit($id){
return $this->redirectRoute('printers.edit', $id);
}
public function delete($id){
@Auth::check();
Model::destroy($id);
}
public function render()
{
return view('livewire.printer.index', [
'printers' => Model::search('name', $this->search)->paginate(25)
]);
}
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace App\Livewire\Printer;
use Livewire\Component;
use App\Models\Printer as Model;
use Livewire\Attributes\title;
#[title('Show Printer')]
class ShowPrinter extends Component
{
public Model $printer ;
public function back(){
return redirect()->route('printers.index');
}
public function edit($id){
return redirect()->route('printers.edit', $id);
}
public function render()
{
return view('livewire.printer.show', [
]);
}
}
@@ -0,0 +1,58 @@
<?php
namespace App\Livewire\Printertype;
use Livewire\Attributes\Validate;
use Livewire\Component;
use App\Models\Printertype as Model;
use Livewire\Attributes\title;
#[title('Create Printertype')]
class CreatePrintertype extends Component
{
public Model $printertype ;
public string $name = '';
public string $description = '';
public int $manufacturer_id = 0;
public int $temp_max = 0;
public int $bed_size_x = 0;
public int $bed_size_y = 0;
public float $price = 0;
#[Validate('required')]
public function save(){
$this->validate([
'name' => ['required', 'string', 'max:255'],
'description' => ['nullable', 'string', 'max:255'],
'manufacturer_id' => ['required', 'integer'],
'temp_max' => ['required', 'integer'],
'bed_size_x' => ['nullable', 'numeric'],
'bed_size_y' => ['nullable', 'numeric'],
'price' => ['nullable', 'numeric']
]);
$printertype = new Model();
$printertype->name = $this->name;
$printertype->description = $this->description;
$printertype->manufacturer_id = $this->manufacturer_id;
$printertype->temp_max = $this->temp_max;
$printertype->bed_size_x = $this->bed_size_x;
$printertype->bed_size_y = $this->bed_size_y;
$printertype->price = $this->price;
$printertype->save();
return $this->redirectRoute('printertypes.show', $printertype->id, navigate: true);
}
public function cancel(){
return $this->redirectRoute('printertypes.index', navigate: true);
}
public function render()
{
return view('livewire.printertype.create', [
]);
}
}
@@ -0,0 +1,68 @@
<?php
namespace App\Livewire\Printertype;
use Livewire\Attributes\Validate;
use Livewire\Component;
use App\Models\Printertype as Model;
use Livewire\Attributes\title;
#[title('Edit Printertype')]
class EditPrintertype extends Component
{
public Model $printertype ;
public string $name = '';
public string $description = '';
public int $manufacturer_id = 0;
public int $temp_max = 0;
public int $bed_size_x = 0;
public int $bed_size_y = 0;
public float $price = 0;
#[Validate('required')]
public function save(){
$this->validate([
'name' => ['required', 'string', 'max:255'],
'description' => ['nullable', 'string', 'max:255'],
'manufacturer_id' => ['required', 'integer'],
'temp_max' => ['required', 'integer'],
'bed_size_x' => ['nullable', 'numeric'],
'bed_size_y' => ['nullable', 'numeric'],
'price' => ['nullable', 'numeric']
]);
$this->printertype->update([
'name' => $this->name,
'description' => $this->description,
'manufacturer_id' => $this->manufacturer_id,
'temp_max' => $this->temp_max,
'bed_size_x' => $this->bed_size_x,
'bed_size_y' => $this->bed_size_y,
'price' => $this->price
]);
return $this->redirectRoute('printertypes.show', $this->printertype->id, navigate: true);
}
public function cancel(){
return $this->redirectRoute('printertypes.index', navigate: true);
}
public function mount(Model $printertype){
$this->printertype = $printertype;
$this->name = $printertype->name;
$this->description = $printertype->description;
$this->manufacturer_id = $printertype->manufacturer_id;
$this->temp_max = $printertype->temp_max;
$this->bed_size_x = $printertype->bed_size_x;
$this->bed_size_y = $printertype->bed_size_y;
$this->price = $printertype->price;
}
public function render()
{
return view('livewire.printertype.create', [
]);
}
}
+44
View File
@@ -0,0 +1,44 @@
<?php
namespace App\Livewire\Printertype;
use Illuminate\Support\Facades\Auth;
use Livewire\Component;
use App\Models\Printertype as Model;
use App\Models\Manufacturer as Manufacturer;
use Livewire\WithPagination;
use Livewire\Attributes\title;
#[title('Printertypes')]
class Printertype extends Component
{
use WithPagination;
public Model $printertype ;
public $search = '';
public function create(){
return $this->redirectRoute('printertypes.create', navigate: true);
}
public function show($id){
return $this->redirectRoute('printertypes.show', $id);
}
public function edit($id){
return $this->redirectRoute('printertypes.edit', $id);
}
public function delete($id){
@Auth::check();
Model::destroy($id);
}
public function render()
{
return view('livewire.printertype.index', [
'printertypes' => Model::search('name', $this->search)->paginate(25)
]);
}
}
@@ -0,0 +1,29 @@
<?php
namespace App\Livewire\Printertype;
use Livewire\Component;
use App\Models\Printertype as Model;
use Livewire\Attributes\title;
#[title('Show Printertype')]
class ShowPrintertype extends Component
{
public Model $printertype ;
public function back(){
return redirect()->route('printertypes.index');
}
public function edit($id){
return redirect()->route('printertypes.edit', $id);
}
public function render()
{
return view('livewire.printertype.show', [
]);
}
}
+1 -1
View File
@@ -38,7 +38,7 @@ class EditSparepart extends Component
}
public function mount(Model $sparepart){
$this->filament = $sparepart;
$this->sparepart = $sparepart;
$this->name = $sparepart->name;
$this->description = $sparepart->description;
$this->manufacturer_id = $sparepart->manufacturer_id;
+1 -1
View File
@@ -6,7 +6,7 @@ use Livewire\Component;
use App\Models\Sparepart as Model;
use Livewire\Attributes\title;
#[title('Show Filament')]
#[title('Show Sparepart')]
class ShowSparepart extends Component
{
+1 -1
View File
@@ -9,7 +9,7 @@ use App\Models\Manufacturer as Manufacturer;
use Livewire\WithPagination;
use Livewire\Attributes\title;
#[title('Filaments')]
#[title('Spareparts')]
class Sparepart extends Component
{
use WithPagination;
+21
View File
@@ -0,0 +1,21 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Printer extends Model
{
// Printer Model
protected $table = 'printers';
protected $primaryKey = 'id';
protected $fillable = [
'name',
'description',
'printertype_id'
];
public function printertype()
{
return $this->belongsTo(Printertype::class);
}
}
+25
View File
@@ -0,0 +1,25 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Printertype extends Model
{
// Printertype Model
protected $table = 'printertypes';
protected $primaryKey = 'id';
protected $fillable = [
'name',
'description',
'bed_size_x',
'bed_size_y',
'temp_min',
'temp_max',
'price',
];
public function manufacturer()
{
return $this->belongsTo(Manufacturer::class);
}
}
@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('printertypes', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('description')->nullable();
$table->foreignId('manufacturer_id')->constrained('manufacturers')->onUpdate('cascade')->onDelete('cascade');
$table->string('temp_max')->nullable();
$table->decimal('bed_size_x', 5, 2)->default(0);
$table->decimal('bed_size_y', 5, 2)->default(0);
$table->decimal('price', 10, 2)->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('printertypes');
}
};
@@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('printers', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('description')->nullable();
$table->foreignId('printertype_id')->constrained('printertypes')->onUpdate('cascade')->onDelete('cascade');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('printers');
}
};
+17 -1
View File
@@ -9,12 +9,21 @@
<flux:navbar.item wire:navigate icon="home" href="{{ route('dashboard') }}">
Dashboard
</flux:navbar.item>
<flux:navbar.item wire:navigate icon="calculator" href="{{ route('filaments.index') }}">
Calculator
</flux:navbar.item>
<flux:navbar.item wire:navigate icon="shopping-bag" href="{{ route('orders.index') }}">
Orders
</flux:navbar.item>
<flux:navbar.item wire:navigate icon="document-text" href="{{ route('filaments.index') }}">
Customers
</flux:navbar.item>
<flux:navbar.item wire:navigate icon="stop-circle" href="{{ route('filaments.index') }}">
Filaments
</flux:navbar.item>
<flux:navbar.item wire:navigate icon="printer" href="{{ route('printers.index') }}">
Printers
</flux:navbar.item>
<flux:navbar.item wire:navigate icon="wrench-screwdriver" href="{{ route('spareparts.index') }}">
SpareParts
</flux:navbar.item>
@@ -36,9 +45,16 @@
<flux:navmenu.item wire:navigate icon="archive-box" href="{{ route('manufacturer.index') }}">
Manufacturers
</flux:navmenu.item>
<flux:navmenu.item wire:navigate icon="beaker" href="{{ route('printertypes.index') }}">
PrinterTypes
</flux:navmenu.item>
<flux:navmenu.item wire:navigate icon="calculator" href="{{ route('manufacturer.index') }}">
Calculation Presets
</flux:navmenu.item>
<flux:menu.separator />
<flux:navmenu.item wire:navigate icon="swatch" href="{{ route('color.index') }}">Colors
</flux:navmenu.item>
<flux:navmenu.item wire:navigate icon="beaker" href="{{ route('type.index') }}">Types
<flux:navmenu.item wire:navigate icon="beaker" href="{{ route('type.index') }}">Materials
</flux:navmenu.item>
<flux:navmenu.item wire:navigate icon="clipboard" href="{{ route('buildplate.index') }}">
BuildPlates
@@ -0,0 +1,49 @@
<section>
<form wire:submit="save">
<x-header>
{{ __('Create Printer') }}
<x-slot name="headerright">
<flux:button type="submit" variant="primary" class="bg-selective hover:bg-selective-600 text-gray-950 hover:cursor-pointer transition-all ease-in-out" icon="check">Save</flux:button>
<flux:button wire:click="cancel" variant="primary" class=" bg-red-700 shadow hover:bg-red-800 hover:cursor-pointer transition-all ease-in-out" icon="x-mark">Cancel</flux:button>
</x-slot>
</x-header>
<div class="container m-auto my-8 bg-elephant-950 border border-elephant-900 rounded-lg shadow p-6 text-gray-50">
<div>
<div class="px-4 sm:px-0">
<h3 class="text-base/7 font-semibold text-white">Printer Information</h3>
<p class="mt-1 max-w-2xl text-sm/6 text-gray-200">Printer details.</p>
</div>
<div class="mt-6 border-t border-white/10">
<dl class="divide-y divide-white/10">
<div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 items-center">
<dt class="text-sm/6 font-medium text-gray-100">Name</dt>
<dd class="mt-1 text-sm/6 text-gray-200 sm:col-span-2 sm:mt-0">
<flux:input wire:model="name" type="text" class="mt-1 block w-full"/>
</dd>
</div>
<div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 items-center">
<dt class="text-sm/6 font-medium text-gray-100">Description</dt>
<dd class="mt-1 text-sm/6 text-gray-200 sm:col-span-2 sm:mt-0">
<flux:textarea wire:model="description" type="text" class="mt-1 block w-full"/>
</dd>
</div>
<div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 items-center">
<dt class="text-sm/6 font-medium text-gray-100">Printertype</dt>
<dd class="mt-1 text-sm/6 text-gray-200 sm:col-span-2 sm:mt-0">
<flux:select wire:model="printertype_id" class="mt-1 block w-full">
<flux:select.option default value="">Select Printertype</flux:select.option>
@foreach(\App\Models\Printertype::all() as $printertype)
<flux:select.option key="{{ $printertype->id }}" value="{{$printertype->id}}">{{$printertype->name}}</flux:select.option>
@endforeach
</flux:select>
</dd>
</div>
</dl>
</div>
</div>
</div>
</form>
</section>
@@ -0,0 +1,49 @@
<section>
<form wire:submit="save">
<x-header>
{{ __('Edit Printer') }}
<x-slot name="headerright">
<flux:button type="submit" variant="primary" class="bg-selective hover:bg-selective-600 text-gray-950 hover:cursor-pointer transition-all ease-in-out" icon="check">Save</flux:button>
<flux:button wire:click="cancel" variant="primary" class=" bg-red-700 shadow hover:bg-red-800 hover:cursor-pointer transition-all ease-in-out" icon="x-mark">Cancel</flux:button>
</x-slot>
</x-header>
<div class="container m-auto my-8 bg-elephant-950 border border-elephant-900 rounded-lg shadow p-6 text-gray-50">
<div>
<div class="px-4 sm:px-0">
<h3 class="text-base/7 font-semibold text-white">Printer Information</h3>
<p class="mt-1 max-w-2xl text-sm/6 text-gray-200">Printer details.</p>
</div>
<div class="mt-6 border-t border-white/10">
<dl class="divide-y divide-white/10">
<div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 items-center">
<dt class="text-sm/6 font-medium text-gray-100">Name</dt>
<dd class="mt-1 text-sm/6 text-gray-200 sm:col-span-2 sm:mt-0">
<flux:input wire:model="name" type="text" class="mt-1 block w-full"/>
</dd>
</div>
<div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 items-center">
<dt class="text-sm/6 font-medium text-gray-100">Description</dt>
<dd class="mt-1 text-sm/6 text-gray-200 sm:col-span-2 sm:mt-0">
<flux:textarea wire:model="description" type="text" class="mt-1 block w-full"/>
</dd>
</div>
<div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 items-center">
<dt class="text-sm/6 font-medium text-gray-100">Printertype</dt>
<dd class="mt-1 text-sm/6 text-gray-200 sm:col-span-2 sm:mt-0">
<flux:select wire:model="printertype_id" class="mt-1 block w-full">
<flux:select.option default value="">Select Printertype</flux:select.option>
@foreach(\App\Models\Printertype::all() as $printertype)
<flux:select.option key="{{ $printertype->id }}" value="{{$printertype->id}}">{{$printertype->name}}</flux:select.option>
@endforeach
</flux:select>
</dd>
</div>
</dl>
</div>
</div>
</div>
</form>
</section>
@@ -0,0 +1,54 @@
<section>
<x-header>
{{ __('Printer') }}
<x-slot name="headerleft">
<input type="text" placeholder="Search..." wire:model.live="search" class="bg-black/10 border-white/20 rounded text-gray-50 placeholder:text-gray-200 focus:border-white/50 focus:ring-white/50" />
</x-slot>
<x-slot name="headerright">
<flux:button wire:click="create" variant="primary" class="bg-selective hover:bg-selective-600 text-gray-950 transition ease-in-out hover:cursor-pointer">Create Printer</flux:button>
</x-slot>
</x-header>
<div class="container m-auto my-8 bg-elephant border border-elephant-900 rounded-lg shadow p-6 text-gray-50">
</div>
<div class="container m-auto my-8 bg-elephant border border-elephant-900 rounded-lg shadow p-6 text-gray-50">
<x-table>
<x-slot name="tableheader">
<x-table.header class="w-[50px]">ID</x-table.header>
<x-table.header>Name</x-table.header>
<x-table.header>Printertype</x-table.header>
<x-table.header class="w-[150px]">Actions</x-table.header>
</x-slot>
@foreach ($printers as $printer)
<tr wire:key="{{ $printer->id }}" class="text-gray-200 border-b border-white/50 hover:bg-white/10 transition duration-150 ease-in-out">
<x-table.item><p class="p-4 px-3 pl-6">{{ $printer->id }}</p></x-table.item>
<x-table.item><p class="p-4 px-3 font-bold">{{ $printer->name }}</p></x-table.item>
<x-table.item><p class="p-4 px-3">
@if ($printer->printertype_id !== 0)
<a href="{{ route('printertypes.show', $printer->printertype_id) }}" class="flex items-center gap-2">
{{ App\Models\Printertype::find($printer->printertype_id)->name }}
<flux:icon name="arrow-right" variant="mini"></flux:icon>
</a>
@endif
</p></x-table.item>
<x-table.item>
<div class="flex flex-row gap-4 justify-end pr-8">
<flux:button variant="primary" class="text-gray-200 bg-transparent shadow-none hover:bg-cornflower hover:shadow hover:text-gray-950 hover:cursor-pointer" wire:click="show({{ $printer->id }})" icon="magnifying-glass"></flux:button>
<flux:button variant="primary" class="text-gray-200 bg-transparent shadow-none hover:bg-gold-drop hover:shadow hover:text-gray-950 hover:cursor-pointer" wire:click="edit({{ $printer->id }})" icon="pencil"></flux:button>
<flux:button variant="primary" class="text-gray-200 bg-transparent shadow-none hover:bg-red-700 hover:shadow hover:cursor-pointer" wire:click="delete({{ $printer->id }})" icon="trash"></flux:button>
</div>
</x-table.item>
</tr>
@endforeach
<x-slot name="pagination">
{{ $printers->links() }}
</x-slot>
</x-table>
</div>
</section>
@@ -0,0 +1,47 @@
<section>
<form wire:submit="save">
<x-header>
{{ __('Show Printer') }}
<x-slot name="headerright">
<flux:button wire:click="back" variant="primary" class="bg-transparent shadow-none text-gray-50 hover:bg-black/10 hover:cursor-pointer transition-all ease-in-out" icon="arrow-left">Back</flux:button>
<flux:button wire:click="edit({{ $printer->id }})" variant="primary" class="bg-selective text-gray-950 shadow-none hover:bg-selective-600 hover:cursor-pointer transition-all ease-in-out" icon="check">Edit</flux:button>
</x-slot>
</x-header>
<div class="container m-auto my-8 bg-elephant-950 border border-elephant-900 rounded-lg shadow p-6 text-gray-50">
<div>
<div class="px-4 sm:px-0">
<h3 class="text-base/7 font-semibold text-white">Filament Information</h3>
<p class="mt-1 max-w-2xl text-sm/6 text-gray-200">Filament details.</p>
</div>
<div class="mt-6 border-t border-white/10">
<dl class="divide-y divide-white/10">
<div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 items-center">
<dt class="text-sm/6 font-medium text-gray-100">Name</dt>
<dd class="mt-1 text-sm/6 text-gray-200 sm:col-span-2 sm:mt-0">
{{ $printer->name }}
</dd>
</div>
<div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 items-center">
<dt class="text-sm/6 font-medium text-gray-100">Description</dt>
<dd class="mt-1 text-sm/6 text-gray-200 sm:col-span-2 sm:mt-0">
{{ $printer->description }}
</dd>
</div>
<div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 items-center">
<dt class="text-sm/6 font-medium text-gray-100">Manufacturer</dt>
<dd class="mt-1 text-sm/6 text-gray-200 sm:col-span-2 sm:mt-0">
<a href="{{ route('printertypes.show', $printer->printertype_id) }}" class="flex items-center gap-2 hover:cursor-pointer" wire:navigate>
<div>{{ App\Models\Printertype::find($printer->printertype_id)->name }}</div>
<flux:icon name="arrow-right" class="w-4 h-4"></flux:icon>
</a>
</dd>
</div>
</dl>
</div>
</div>
</div>
</form>
</section>
@@ -0,0 +1,85 @@
<section>
<form wire:submit="save">
<x-header>
{{ __('Create Printertype') }}
<x-slot name="headerright">
<flux:button type="submit" variant="primary" class="bg-selective hover:bg-selective-600 text-gray-950 hover:cursor-pointer transition-all ease-in-out" icon="check">Save</flux:button>
<flux:button wire:click="cancel" variant="primary" class=" bg-red-700 shadow hover:bg-red-800 hover:cursor-pointer transition-all ease-in-out" icon="x-mark">Cancel</flux:button>
</x-slot>
</x-header>
<div class="container m-auto my-8 bg-elephant-950 border border-elephant-900 rounded-lg shadow p-6 text-gray-50">
<div>
<div class="px-4 sm:px-0">
<h3 class="text-base/7 font-semibold text-white">Printertype Information</h3>
<p class="mt-1 max-w-2xl text-sm/6 text-gray-200">Printertype details.</p>
</div>
<div class="mt-6 border-t border-white/10">
<dl class="divide-y divide-white/10">
<div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 items-center">
<dt class="text-sm/6 font-medium text-gray-100">Name</dt>
<dd class="mt-1 text-sm/6 text-gray-200 sm:col-span-2 sm:mt-0">
<flux:input wire:model="name" type="text" class="mt-1 block w-full"/>
</dd>
</div>
<div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 items-center">
<dt class="text-sm/6 font-medium text-gray-100">Description</dt>
<dd class="mt-1 text-sm/6 text-gray-200 sm:col-span-2 sm:mt-0">
<flux:textarea wire:model="description" type="text" class="mt-1 block w-full"/>
</dd>
</div>
<div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 items-center">
<dt class="text-sm/6 font-medium text-gray-100">Manufacturer</dt>
<dd class="mt-1 text-sm/6 text-gray-200 sm:col-span-2 sm:mt-0">
<flux:select wire:model="manufacturer_id" class="mt-1 block w-full">
<flux:select.option default value="">Select Manufacturer</flux:select.option>
@foreach(\App\Models\Manufacturer::all() as $manufacturer)
<flux:select.option key="{{ $manufacturer->id }}" value="{{$manufacturer->id}}">{{$manufacturer->name}}</flux:select.option>
@endforeach
</flux:select>
</dd>
</div>
<div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 items-center">
<dt class="text-sm/6 font-medium text-gray-100">Max Tempertaure</dt>
<dd class="mt-1 text-sm/6 text-gray-200 sm:col-span-2 sm:mt-0">
<flux:input.group>
<flux:input wire:model="temp_max" type="text" class="mt-1 block w-full"/>
<flux:input.group.suffix>°C</flux:input.group.suffix>
</flux:input.group>
</dd>
</div>
<div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 items-center">
<dt class="text-sm/6 font-medium text-gray-100">Printbed Size X</dt>
<dd class="mt-1 text-sm/6 text-gray-200 sm:col-span-2 sm:mt-0">
<flux:input.group>
<flux:input wire:model="bed_size_x" type="text" class="mt-1 block w-full"/>
<flux:input.group.suffix>cm</flux:input.group.suffix>
</flux:input.group>
</dd>
</div>
<div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 items-center">
<dt class="text-sm/6 font-medium text-gray-100">Printbed Size Y</dt>
<dd class="mt-1 text-sm/6 text-gray-200 sm:col-span-2 sm:mt-0">
<flux:input.group>
<flux:input wire:model="bed_size_y" type="text" class="mt-1 block w-full"/>
<flux:input.group.suffix>cm</flux:input.group.suffix>
</flux:input.group>
</dd>
</div>
<div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 items-center">
<dt class="text-sm/6 font-medium text-gray-100">Price</dt>
<dd class="mt-1 text-sm/6 text-gray-200 sm:col-span-2 sm:mt-0">
<flux:input.group>
<flux:input wire:model="price" type="text" class="mt-1 block w-full"/>
<flux:input.group.suffix></flux:input.group.suffix>
</flux:input.group>
</dd>
</div>
</dl>
</div>
</div>
</div>
</form>
</section>
@@ -0,0 +1,85 @@
<section>
<form wire:submit="save">
<x-header>
{{ __('Edit Printertype') }}
<x-slot name="headerright">
<flux:button type="submit" variant="primary" class="bg-selective hover:bg-selective-600 text-gray-950 hover:cursor-pointer transition-all ease-in-out" icon="check">Save</flux:button>
<flux:button wire:click="cancel" variant="primary" class=" bg-red-700 shadow hover:bg-red-800 hover:cursor-pointer transition-all ease-in-out" icon="x-mark">Cancel</flux:button>
</x-slot>
</x-header>
<div class="container m-auto my-8 bg-elephant-950 border border-elephant-900 rounded-lg shadow p-6 text-gray-50">
<div>
<div class="px-4 sm:px-0">
<h3 class="text-base/7 font-semibold text-white">Printertype Information</h3>
<p class="mt-1 max-w-2xl text-sm/6 text-gray-200">Printertype details.</p>
</div>
<div class="mt-6 border-t border-white/10">
<dl class="divide-y divide-white/10">
<div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 items-center">
<dt class="text-sm/6 font-medium text-gray-100">Name</dt>
<dd class="mt-1 text-sm/6 text-gray-200 sm:col-span-2 sm:mt-0">
<flux:input wire:model="name" type="text" class="mt-1 block w-full"/>
</dd>
</div>
<div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 items-center">
<dt class="text-sm/6 font-medium text-gray-100">Description</dt>
<dd class="mt-1 text-sm/6 text-gray-200 sm:col-span-2 sm:mt-0">
<flux:textarea wire:model="description" type="text" class="mt-1 block w-full"/>
</dd>
</div>
<div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 items-center">
<dt class="text-sm/6 font-medium text-gray-100">Manufacturer</dt>
<dd class="mt-1 text-sm/6 text-gray-200 sm:col-span-2 sm:mt-0">
<flux:select wire:model="manufacturer_id" class="mt-1 block w-full">
<flux:select.option default value="">Select Manufacturer</flux:select.option>
@foreach(\App\Models\Manufacturer::all() as $manufacturer)
<flux:select.option key="{{ $manufacturer->id }}" value="{{$manufacturer->id}}">{{$manufacturer->name}}</flux:select.option>
@endforeach
</flux:select>
</dd>
</div>
<div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 items-center">
<dt class="text-sm/6 font-medium text-gray-100">Max Temperature</dt>
<dd class="mt-1 text-sm/6 text-gray-200 sm:col-span-2 sm:mt-0">
<flux:input.group>
<flux:input wire:model="temp_max" type="text" class="block w-full"/>
<flux:input.group.suffix>°C</flux:input.group.suffix>
</flux:input.group>
</dd>
</div>
<div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 items-center">
<dt class="text-sm/6 font-medium text-gray-100">Printbed Size X</dt>
<dd class="mt-1 text-sm/6 text-gray-200 sm:col-span-2 sm:mt-0">
<flux:input.group>
<flux:input wire:model="bed_size_x" type="text" class="block w-full"/>
<flux:input.group.suffix>cm</flux:input.group.suffix>
</flux:input.group>
</dd>
</div>
<div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 items-center">
<dt class="text-sm/6 font-medium text-gray-100">Printbed Size Y</dt>
<dd class="mt-1 text-sm/6 text-gray-200 sm:col-span-2 sm:mt-0">
<flux:input.group>
<flux:input wire:model="bed_size_y" type="text" class="block w-full"/>
<flux:input.group.suffix>mm</flux:input.group.suffix>
</flux:input.group>
</dd>
</div>
<div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 items-center">
<dt class="text-sm/6 font-medium text-gray-100">Price</dt>
<dd class="mt-1 text-sm/6 text-gray-200 sm:col-span-2 sm:mt-0">
<flux:input.group>
<flux:input wire:model="price" type="text" class="block w-full"/>
<flux:input.group.suffix></flux:input.group.suffix>
</flux:input.group>
</dd>
</div>
</dl>
</div>
</div>
</div>
</form>
</section>
@@ -0,0 +1,62 @@
<section>
<x-header>
{{ __('Printertype') }}
<x-slot name="headerleft">
<input type="text" placeholder="Search..." wire:model.live="search" class="bg-black/10 border-white/20 rounded text-gray-50 placeholder:text-gray-200 focus:border-white/50 focus:ring-white/50" />
</x-slot>
<x-slot name="headerright">
<flux:button wire:click="create" variant="primary" class="bg-selective hover:bg-selective-600 text-gray-950 transition ease-in-out hover:cursor-pointer">Create Printertype</flux:button>
</x-slot>
</x-header>
<div class="container m-auto my-8 bg-elephant border border-elephant-900 rounded-lg shadow p-6 text-gray-50">
</div>
<div class="container m-auto my-8 bg-elephant border border-elephant-900 rounded-lg shadow p-6 text-gray-50">
<x-table>
<x-slot name="tableheader">
<x-table.header class="w-[50px]">ID</x-table.header>
<x-table.header>Name</x-table.header>
<x-table.header>Manufacturer</x-table.header>
<x-table.header>Temp Max</x-table.header>
<x-table.header>Bed Size X</x-table.header>
<x-table.header>Bed Size Y</x-table.header>
<x-table.header>Price</x-table.header>
<x-table.header class="w-[150px]">Actions</x-table.header>
</x-slot>
@foreach ($printertypes as $printertype)
<tr wire:key="{{ $printertype->id }}" class="text-gray-200 border-b border-white/50 hover:bg-white/10 transition duration-150 ease-in-out">
<x-table.item><p class="p-4 px-3 pl-6">{{ $printertype->id }}</p></x-table.item>
<x-table.item><p class="p-4 px-3 font-bold">{{ $printertype->name }}</p></x-table.item>
<x-table.item><p class="p-4 px-3">
@if ($printertype->manufacturer_id !== 0)
<a href="{{ route('manufacturer.show', $printertype->manufacturer_id) }}" class="flex items-center gap-2">
{{ App\Models\Manufacturer::find($printertype->manufacturer_id)->name }}
<flux:icon name="arrow-right" variant="mini"></flux:icon>
</a>
@endif
</p></x-table.item>
<x-table.item><p class="p-4 px-3">{{ $printertype->temp_max }}°C</p></x-table.item>
<x-table.item><p class="p-4 px-3">{{ $printertype->bed_size_x }}cm</p></x-table.item>
<x-table.item><p class="p-4 px-3">{{ $printertype->bed_size_y }}cm</p></x-table.item>
<x-table.item><p class="p-4 px-3">{{ $printertype->price }}</p></x-table.item>
<x-table.item>
<div class="flex flex-row gap-4 justify-end pr-8">
<flux:button variant="primary" class="text-gray-200 bg-transparent shadow-none hover:bg-cornflower hover:shadow hover:text-gray-950 hover:cursor-pointer" wire:click="show({{ $printertype->id }})" icon="magnifying-glass"></flux:button>
<flux:button variant="primary" class="text-gray-200 bg-transparent shadow-none hover:bg-gold-drop hover:shadow hover:text-gray-950 hover:cursor-pointer" wire:click="edit({{ $printertype->id }})" icon="pencil"></flux:button>
<flux:button variant="primary" class="text-gray-200 bg-transparent shadow-none hover:bg-red-700 hover:shadow hover:cursor-pointer" wire:click="delete({{ $printertype->id }})" icon="trash"></flux:button>
</div>
</x-table.item>
</tr>
@endforeach
<x-slot name="pagination">
{{ $printertypes->links() }}
</x-slot>
</x-table>
</div>
</section>
@@ -0,0 +1,71 @@
<section>
<form wire:submit="save">
<x-header>
{{ __('Show Printertype') }}
<x-slot name="headerright">
<flux:button wire:click="back" variant="primary" class="bg-transparent shadow-none text-gray-50 hover:bg-black/10 hover:cursor-pointer transition-all ease-in-out" icon="arrow-left">Back</flux:button>
<flux:button wire:click="edit({{ $printertype->id }})" variant="primary" class="bg-selective text-gray-950 shadow-none hover:bg-selective-600 hover:cursor-pointer transition-all ease-in-out" icon="check">Edit</flux:button>
</x-slot>
</x-header>
<div class="container m-auto my-8 bg-elephant-950 border border-elephant-900 rounded-lg shadow p-6 text-gray-50">
<div>
<div class="px-4 sm:px-0">
<h3 class="text-base/7 font-semibold text-white">Filament Information</h3>
<p class="mt-1 max-w-2xl text-sm/6 text-gray-200">Filament details.</p>
</div>
<div class="mt-6 border-t border-white/10">
<dl class="divide-y divide-white/10">
<div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 items-center">
<dt class="text-sm/6 font-medium text-gray-100">Name</dt>
<dd class="mt-1 text-sm/6 text-gray-200 sm:col-span-2 sm:mt-0">
{{ $printertype->name }}
</dd>
</div>
<div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 items-center">
<dt class="text-sm/6 font-medium text-gray-100">Description</dt>
<dd class="mt-1 text-sm/6 text-gray-200 sm:col-span-2 sm:mt-0">
{{ $printertype->description }}
</dd>
</div>
<div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 items-center">
<dt class="text-sm/6 font-medium text-gray-100">Manufacturer</dt>
<dd class="mt-1 text-sm/6 text-gray-200 sm:col-span-2 sm:mt-0">
<a href="{{ route('manufacturer.show', $printertype->manufacturer_id) }}" class="flex items-center gap-2 hover:cursor-pointer" wire:navigate>
<div>{{ App\Models\Manufacturer::find($printertype->manufacturer_id)->name }}</div>
<flux:icon name="arrow-right" class="w-4 h-4"></flux:icon>
</a>
</dd>
</div>
<div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 items-center">
<dt class="text-sm/6 font-medium text-gray-100">Max Temperature</dt>
<dd class="mt-1 text-sm/6 text-gray-200 sm:col-span-2 sm:mt-0">
{{ $printertype->temp_max }}°C
</dd>
</div>
<div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 items-center">
<dt class="text-sm/6 font-medium text-gray-100">Printbed Size X</dt>
<dd class="mt-1 text-sm/6 text-gray-200 sm:col-span-2 sm:mt-0">
{{ $printertype->bed_size_x }}cm
</dd>
</div>
<div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 items-center">
<dt class="text-sm/6 font-medium text-gray-100">Printbetd Size Y</dt>
<dd class="mt-1 text-sm/6 text-gray-200 sm:col-span-2 sm:mt-0">
{{ $printertype->bed_size_y }}cm
</dd>
</div>
<div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 items-center">
<dt class="text-sm/6 font-medium text-gray-100">Price</dt>
<dd class="mt-1 text-sm/6 text-gray-200 sm:col-span-2 sm:mt-0">
{{ $printertype->price }}
</dd>
</div>
</dl>
</div>
</div>
</div>
</form>
</section>
+15
View File
@@ -11,6 +11,9 @@ use App\Livewire\Orders\Orders;
use App\Livewire\Settings\Settings;
use App\Livewire\Type\EditType;
use App\Livewire\Type\Type;
use App\Livewire\Printertype\Printertype;
use App\Livewire\Printer\Printer;
use Illuminate\Support\Facades\Route;
Route::get('/', function () {
@@ -62,6 +65,18 @@ Route::middleware([
Route::get('manufacturer/{manufacturer}/edit', \App\Livewire\Manufacturer\EditManufacturer::class)->name('manufacturer.edit');
Route::get('manufacturer/{manufacturer}', \App\Livewire\Manufacturer\ShowManufacturer::class)->name('manufacturer.show');
// Printertypes
Route::get('printertypes', Printertype::class)->name('printertypes.index');
Route::get('printertypes/create', \App\Livewire\Printertype\CreatePrintertype::class)->name('printertypes.create');
Route::get('printertypes/{printertype}/edit', \App\Livewire\Printertype\EditPrintertype::class)->name('printertypes.edit');
Route::get('printertypes/{printertype}', \App\Livewire\Printertype\ShowPrintertype::class)->name('printertypes.show');
// Printertypes
Route::get('printers', Printer::class)->name('printers.index');
Route::get('printers/create', \App\Livewire\Printer\CreatePrinter::class)->name('printers.create');
Route::get('printers/{printer}/edit', \App\Livewire\Printer\EditPrinter::class)->name('printers.edit');
Route::get('printers/{printer}', \App\Livewire\Printer\ShowPrinter::class)->name('printers.show');
// Extruders
Route::get('extruder', Extruder::class)->name('extruder.index');
Route::get('extruder/create', \App\Livewire\Extruder\CreateExtruder::class)->name('extruder.create');