Nouman
Tab file field not enabled
I have a function defined to disable the whole tab and only get enabled when certain conditions are met but file upload field is not enabled while other fields are enabled:
Tabs\Tab::make('CAS')
->icon(function (Get $get) {
return self::getCas($get('id'));
})
->schema([
Forms\Components\Group::make()
->relationship('cas')
->schema([
Forms\Components\DatePicker::make('request_date')->label('Request Date'),
Forms\Components\DatePicker::make('receive_date')->label('Receive Date'),
SpatieMediaLibraryFileUpload::make('cas')
->collection('cas')
->openable()
->downloadable()
->label('')
->columnSpan('full')
->placeholder('Upload CAS Document')
->acceptedFileTypes(['application/pdf']),
])->columns(2),
])->disabled(function (Get $get) {
$interview = $get('interview');
if ((!$interview['schedule_date'] || !$interview['mock_interview_date']
|| !$interview['official_interview_date'] || !$interview['result_date'])) {
return true;
}
}),
Tabs\Tab::make('CAS')
->icon(function (Get $get) {
return self::getCas($get('id'));
})
->schema([
Forms\Components\Group::make()
->relationship('cas')
->schema([
Forms\Components\DatePicker::make('request_date')->label('Request Date'),
Forms\Components\DatePicker::make('receive_date')->label('Receive Date'),
SpatieMediaLibraryFileUpload::make('cas')
->collection('cas')
->openable()
->downloadable()
->label('')
->columnSpan('full')
->placeholder('Upload CAS Document')
->acceptedFileTypes(['application/pdf']),
])->columns(2),
])->disabled(function (Get $get) {
$interview = $get('interview');
if ((!$interview['schedule_date'] || !$interview['mock_interview_date']
|| !$interview['official_interview_date'] || !$interview['result_date'])) {
return true;
}
}),
12 replies