Skip to content

Commit 301d426

Browse files
committed
Criação de Resouce de Ticket ,Relationship Manager, Resouce de Produtos , Resource de Fabricante
1 parent e2cf466 commit 301d426

27 files changed

+1069
-61
lines changed
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
namespace App\Enums\Products;
4+
5+
use Filament\Support\Contracts\HasLabel;
6+
7+
enum CategoryProductEnum: string implements HasLabel
8+
{
9+
//
10+
11+
12+
case HARD_DISK = 'hard_disk';
13+
case MEMORY = 'memory';
14+
case PROCESSATOR = 'processator';
15+
case SSD = 'ssd';
16+
case VIDEO_CARD = 'video_card';
17+
case HEADPHONES = 'headphones';
18+
19+
20+
21+
//
22+
23+
public function getLabel(): ?string
24+
{
25+
26+
return match ($this) {
27+
self::HARD_DISK => 'HD',
28+
self::MEMORY => 'Memória',
29+
self::PROCESSATOR => 'Processador',
30+
self::SSD => 'SSD',
31+
self::VIDEO_CARD => 'Placa de Vídeo',
32+
self::HEADPHONES => 'Fones',
33+
};
34+
}
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
namespace App\Enums\Products;
4+
5+
use Filament\Support\Contracts\HasLabel;
6+
7+
enum ManufacturerProductEnum: string implements HasLabel
8+
9+
{
10+
//
11+
12+
13+
case ACER = 'acer';
14+
case KINGSTON = 'kingston';
15+
case WESTEN_DIGITAL = 'westendigital';
16+
case GIGABYTE = 'gigabyte';
17+
case NVIDIA = 'nvidia';
18+
case ASUS = 'asus';
19+
case SAMSUNG = 'samsung';
20+
case INTEL = 'intel';
21+
//
22+
23+
public function getLabel(): ?string
24+
{
25+
26+
return match ($this) {
27+
self::ACER => 'Acer',
28+
self::KINGSTON => 'Kingston',
29+
self::WESTEN_DIGITAL => 'Westen Digital',
30+
self::GIGABYTE => 'Gigabyte',
31+
self::NVIDIA => 'Nvidia',
32+
self::ASUS => 'Asus',
33+
self::SAMSUNG => 'Samsung',
34+
self::INTEL => 'Intel',
35+
};
36+
}
37+
}
+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
3+
namespace App\Enums\Tickets;
4+
5+
use Filament\Support\Contracts\HasColor;
6+
use Filament\Support\Contracts\HasLabel;
7+
8+
enum CategoryTicketEnum: string implements HasColor,HasLabel
9+
{
10+
11+
case SOFTWARE = 'software';
12+
case NOTEBOOK = 'notebook';
13+
case DESKTOP = 'desktop';
14+
case MOBILE_PHONE = 'mobile_phone';
15+
case NETWORK = 'network';
16+
17+
18+
//
19+
20+
public function getLabel(): ?string
21+
{
22+
23+
return match ($this) {
24+
self::SOFTWARE => 'Sistemas',
25+
self::NOTEBOOK => 'Notebook',
26+
self::DESKTOP => 'Computador',
27+
self::MOBILE_PHONE => 'Celular',
28+
self::NETWORK => 'Redes',
29+
};
30+
}
31+
32+
public function getColor(): ?string
33+
{
34+
return match ($this) {
35+
self::SOFTWARE => 'primary',
36+
self::NOTEBOOK => 'info',
37+
self::DESKTOP => 'warning',
38+
self::MOBILE_PHONE => 'danger',
39+
self::NETWORK => 'success',
40+
41+
42+
};
43+
}
44+
}
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
namespace App\Enums\Tickets;
4+
5+
use Filament\Support\Contracts\HasColor;
6+
use Filament\Support\Contracts\HasLabel;
7+
8+
enum PriorityTicketEnum: string implements HasColor,HasLabel
9+
{
10+
11+
case VERY_LOW = 'very_low';
12+
case LOW = 'low';
13+
case MEDIUM = 'medium';
14+
case HIGH = 'high';
15+
case URGENT = 'urgent';
16+
//
17+
18+
public function getLabel(): ?string
19+
{
20+
21+
return match ($this) {
22+
self::VERY_LOW => 'Muito Baixo',
23+
self::LOW => 'Baixo',
24+
self::MEDIUM => 'Medio',
25+
self::HIGH => 'Alto',
26+
self::URGENT => 'Urgente',
27+
};
28+
}
29+
30+
public function getColor(): ?string
31+
{
32+
return match ($this) {
33+
self::VERY_LOW => 'success',
34+
self::LOW => 'primary',
35+
self::MEDIUM => 'warning',
36+
self::HIGH => 'danger',
37+
self::URGENT => 'danger',
38+
};
39+
}
40+
}
+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
3+
namespace App\Enums\Tickets;
4+
5+
use Filament\Support\Contracts\HasColor;
6+
use Filament\Support\Contracts\HasLabel;
7+
8+
enum StatusTicketEnum: string implements HasLabel,HasColor
9+
10+
{
11+
12+
case OPEN = 'open';
13+
case INPROGRESS = 'in_progress';
14+
case PENDING = 'pending';
15+
case CANCELED= 'canceled';
16+
case RESOLVED = 'resolved';
17+
//
18+
19+
public function getLabel(): ?string
20+
{
21+
22+
return match ($this) {
23+
self::OPEN => 'Aberto',
24+
self::INPROGRESS => 'Em Progresso',
25+
self::PENDING => 'Pendente',
26+
self::CANCELED => 'Cancelado',
27+
self::RESOLVED => 'Resolvido',
28+
};
29+
}
30+
31+
public function getColor(): ?string
32+
{
33+
return match ($this) {
34+
self::OPEN => 'primary',
35+
self::INPROGRESS => 'warning',
36+
self::PENDING => 'secondary',
37+
self::CANCELED => 'danger',
38+
self::RESOLVED => 'success',
39+
};
40+
}
41+
}
42+
43+
44+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?php
2+
3+
namespace App\Filament\Admin\Resources;
4+
5+
use App\Filament\Admin\Resources\ManufacturerResource\Pages;
6+
use App\Filament\Admin\Resources\ManufacturerResource\RelationManagers;
7+
use App\Models\Manufacturer;
8+
use Filament\Forms;
9+
use Filament\Forms\Form;
10+
use Filament\Resources\Resource;
11+
use Filament\Tables;
12+
use Filament\Tables\Table;
13+
use Illuminate\Database\Eloquent\Builder;
14+
use Illuminate\Database\Eloquent\SoftDeletingScope;
15+
16+
class ManufacturerResource extends Resource
17+
{
18+
protected static ?string $model = Manufacturer::class;
19+
20+
protected static ?string $navigationIcon = 'fas-building-columns';
21+
protected static ?string $navigationGroup = 'Produtos';
22+
protected static ?string $navigationLabel = 'Fabricantes';
23+
protected static ?string $modelLabel = 'Fabricante';
24+
protected static ?string $modelLabelPlural = "Fabricantes";
25+
protected static ?int $navigationSort = 1;
26+
27+
public static function form(Form $form): Form
28+
{
29+
return $form
30+
->schema([
31+
Forms\Components\TextInput::make('name')
32+
->required()
33+
->maxLength(255),
34+
]);
35+
}
36+
37+
public static function table(Table $table): Table
38+
{
39+
return $table
40+
->columns([
41+
Tables\Columns\TextColumn::make('name')
42+
->searchable(),
43+
Tables\Columns\TextColumn::make('created_at')
44+
->dateTime()
45+
->sortable()
46+
->toggleable(isToggledHiddenByDefault: true),
47+
Tables\Columns\TextColumn::make('updated_at')
48+
->dateTime()
49+
->sortable()
50+
->toggleable(isToggledHiddenByDefault: true),
51+
])
52+
->filters([
53+
//
54+
])
55+
->actions([
56+
Tables\Actions\EditAction::make(),
57+
Tables\Actions\DeleteAction::make(),
58+
])
59+
->bulkActions([
60+
Tables\Actions\BulkActionGroup::make([
61+
Tables\Actions\DeleteBulkAction::make(),
62+
]),
63+
]);
64+
}
65+
66+
public static function getPages(): array
67+
{
68+
return [
69+
'index' => Pages\ManageManufacturers::route('/'),
70+
];
71+
}
72+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
namespace App\Filament\Admin\Resources\ManufacturerResource\Pages;
4+
5+
use App\Filament\Admin\Resources\ManufacturerResource;
6+
use Filament\Actions;
7+
use Filament\Resources\Pages\ManageRecords;
8+
9+
class ManageManufacturers extends ManageRecords
10+
{
11+
protected static string $resource = ManufacturerResource::class;
12+
13+
protected function getHeaderActions(): array
14+
{
15+
return [
16+
Actions\CreateAction::make(),
17+
];
18+
}
19+
}

0 commit comments

Comments
 (0)