You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CompanyDetails.php 3.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. namespace App\Http\Livewire;
  3. use App\Abstracts\Forms\EditFormRecord;
  4. use App\Models\Company;
  5. use Filament\Forms\ComponentContainer;
  6. use Filament\Forms\Components\FileUpload;
  7. use Filament\Forms\Components\Group;
  8. use Filament\Forms\Components\Section;
  9. use Filament\Forms\Components\TextInput;
  10. use Illuminate\Contracts\View\View;
  11. use Illuminate\Database\Eloquent\Model;
  12. /**
  13. * @property ComponentContainer $form
  14. */
  15. class CompanyDetails extends EditFormRecord
  16. {
  17. public Company $company;
  18. protected function getFormModel(): Model|string|null
  19. {
  20. return $this->company;
  21. }
  22. protected function getFormSchema(): array
  23. {
  24. return [
  25. Section::make('General')
  26. ->schema([
  27. Group::make()
  28. ->schema([
  29. TextInput::make('email')
  30. ->label('Email')
  31. ->email()
  32. ->nullable(),
  33. TextInput::make('phone')
  34. ->label('Phone')
  35. ->tel()
  36. ->maxLength(20),
  37. ])->columns(1),
  38. Group::make()
  39. ->schema([
  40. FileUpload::make('logo')
  41. ->label('Logo')
  42. ->disk('public')
  43. ->directory('logos/company')
  44. ->imageResizeMode('cover')
  45. ->imagePreviewHeight('150')
  46. ->imageCropAspectRatio('2:1')
  47. ->panelAspectRatio('2:1')
  48. ->reactive()
  49. ->enableOpen()
  50. ->preserveFilenames()
  51. ->visibility('public')
  52. ->image(),
  53. ])->columns(1),
  54. ])->columns(),
  55. Section::make('Address')
  56. ->schema([
  57. TextInput::make('address')
  58. ->label('Address')
  59. ->maxLength(100)
  60. ->columnSpanFull()
  61. ->nullable(),
  62. TextInput::make('country')
  63. ->label('Country')
  64. ->nullable(),
  65. TextInput::make('state')
  66. ->label('Province/State')
  67. ->nullable(),
  68. TextInput::make('city')
  69. ->label('Town/City')
  70. ->maxLength(100)
  71. ->nullable(),
  72. TextInput::make('zip_code')
  73. ->label('Postal/Zip Code')
  74. ->maxLength(100)
  75. ->nullable(),
  76. ])->columns(),
  77. ];
  78. }
  79. public function render(): View
  80. {
  81. return view('livewire.company-details');
  82. }
  83. }