|
2 | 2 |
|
3 | 3 | namespace Moox\Bpmn\Resources\Bpmns\Schemas; |
4 | 4 |
|
5 | | -use Filament\Schemas\Schema; |
| 5 | +use Filament\Forms\Components\MarkdownEditor; |
6 | 6 | use Filament\Forms\Components\Select; |
7 | | -use Filament\Forms\Components\Toggle; |
8 | | -use Illuminate\Support\Facades\Storage; |
9 | 7 | use Filament\Forms\Components\TextInput; |
10 | | -use Filament\Schemas\Components\Section; |
| 8 | +use Filament\Forms\Components\Toggle; |
11 | 9 | use Filament\Schemas\Components\Fieldset; |
| 10 | +use Filament\Schemas\Components\Section; |
| 11 | +use Filament\Schemas\Schema; |
| 12 | +use Illuminate\Support\Facades\Storage; |
12 | 13 | use Moox\Bpmn\Forms\Components\BpmnViewer; |
13 | | -use Filament\Forms\Components\MarkdownEditor; |
14 | 14 |
|
15 | 15 | class BpmnForm |
16 | 16 | { |
17 | 17 | public static function configure(Schema $schema): Schema |
18 | 18 | { |
19 | 19 | return $schema |
20 | 20 | ->components([ |
21 | | - Section::make('Bpmn Details') |
22 | | - ->columnSpanFull() |
23 | | - ->columns(2) |
24 | | - ->schema([ |
25 | | - TextInput::make('title') |
26 | | - ->label('BPMN Title') |
27 | | - ->maxLength(60) |
28 | | - ->required() |
29 | | - ->columnSpanFull(), |
30 | | - |
31 | | - Select::make('bpmn_file') |
32 | | - ->label('BPMN File') |
33 | | - ->options(fn () => |
34 | | - collect(Storage::disk('public')->allFiles('media')) |
35 | | - ->filter(fn ($file) => str_ends_with($file, '.bpmn')) |
36 | | - ->mapWithKeys(fn ($file) => [ |
37 | | - $file => basename($file), |
38 | | - ]) |
39 | | - ->toArray() |
40 | | - ) |
41 | | - ->searchable() |
42 | | - ->reactive() |
43 | | - ->required(), |
44 | | - |
45 | | - |
46 | | - |
47 | | - BpmnViewer::make('bpmn_xml') |
48 | | - ->label('BPMN Process') |
49 | | - ->fileIntegration() // ✅ tells JS the state is raw XML |
50 | | - ->mode('full') |
51 | | - ->reactive() |
52 | | - ->columnSpanFull(), |
53 | | - |
54 | | - |
55 | | - |
| 21 | + Section::make('Bpmn Details') |
| 22 | + ->columnSpanFull() |
| 23 | + ->columns(2) |
| 24 | + ->schema([ |
| 25 | + TextInput::make('title') |
| 26 | + ->label('BPMN Title') |
| 27 | + ->maxLength(60) |
| 28 | + ->required() |
| 29 | + ->columnSpanFull(), |
56 | 30 |
|
| 31 | + Select::make('bpmn_file') |
| 32 | + ->label('BPMN File') |
| 33 | + ->options(fn () => collect(Storage::disk('public')->allFiles('media')) |
| 34 | + ->filter(fn ($file) => str_ends_with($file, '.bpmn')) |
| 35 | + ->mapWithKeys(fn ($file) => [ |
| 36 | + $file => basename($file), |
| 37 | + ]) |
| 38 | + ->toArray() |
| 39 | + ) |
| 40 | + ->searchable() |
| 41 | + ->reactive() |
| 42 | + ->required(), |
57 | 43 |
|
58 | | - MarkdownEditor::make('description') |
59 | | - ->label('BPMN Description') |
60 | | - ->required() |
61 | | - ->columnSpanFull(), |
| 44 | + BpmnViewer::make('bpmn_xml') |
| 45 | + ->label('BPMN Process') |
| 46 | + ->fileIntegration() // ✅ tells JS the state is raw XML |
| 47 | + ->mode('full') |
| 48 | + ->reactive() |
| 49 | + ->columnSpanFull(), |
62 | 50 |
|
63 | | - Fieldset::make('Status') |
64 | | - ->columns(2) |
65 | | - ->schema([ |
66 | | - Select::make('status') |
67 | | - ->options([ |
68 | | - 'draft' => 'Draft', |
69 | | - 'published' => 'Published', |
70 | | - 'archived' => 'Archived', |
71 | | - 'on_hold' => 'On Hold', |
72 | | - ]) |
73 | | - ->required() |
74 | | - ->columnSpan(1), |
| 51 | + MarkdownEditor::make('description') |
| 52 | + ->label('BPMN Description') |
| 53 | + ->required() |
| 54 | + ->columnSpanFull(), |
75 | 55 |
|
76 | | - Toggle::make('is_published') |
77 | | - ->default(true) |
78 | | - ->columnSpan(1), |
79 | | - ]) |
80 | | - ->columnSpanFull(), |
| 56 | + Fieldset::make('Status') |
| 57 | + ->columns(2) |
| 58 | + ->schema([ |
| 59 | + Select::make('status') |
| 60 | + ->options([ |
| 61 | + 'draft' => 'Draft', |
| 62 | + 'published' => 'Published', |
| 63 | + 'archived' => 'Archived', |
| 64 | + 'on_hold' => 'On Hold', |
| 65 | + ]) |
| 66 | + ->required() |
| 67 | + ->columnSpan(1), |
81 | 68 |
|
82 | | - ]) |
83 | | - ]); |
| 69 | + Toggle::make('is_published') |
| 70 | + ->default(true) |
| 71 | + ->columnSpan(1), |
| 72 | + ]) |
| 73 | + ->columnSpanFull(), |
84 | 74 |
|
| 75 | + ]), |
| 76 | + ]); |
85 | 77 | } |
86 | 78 | } |
0 commit comments