files not previewed when form is pre-filled with data
I have a form which has the following schema
and there is a button that when I clicked some data is pre-filled on this form. Here is how that is done.
and here is the data shown before getting filled into the form (shown on the picture).
protected function getEditBillItemFormSchema(): array
{
return [
Forms\Components\Card::make([
// Input::medicalBillType('type', $this->bill_items->pluck('type')->toArray())->reactive()->disabled(),
Forms\Components\TextInput::make('type')->disabled(),
Input::decimalInput('fee')->required(),
Forms\Components\DatePicker::make('date_of_care')
->visible(fn (\Closure $get) => $get('type') === 'physication')
->required(),
Forms\Components\Textarea::make('description')->rows(2)->cols(20)
->nullable()->maxLength(250)->columnSpanFull(),
FileUpload::make('attachments')->multiple()->directory(fn (\Closure $get) => $get('type'))->columnSpanFull(),
// Input::fileUpload('attachments')->directory(fn (\Closure $get) => $get('type'))->columnSpanFull(),
])->columns(2),
];
}protected function getEditBillItemFormSchema(): array
{
return [
Forms\Components\Card::make([
// Input::medicalBillType('type', $this->bill_items->pluck('type')->toArray())->reactive()->disabled(),
Forms\Components\TextInput::make('type')->disabled(),
Input::decimalInput('fee')->required(),
Forms\Components\DatePicker::make('date_of_care')
->visible(fn (\Closure $get) => $get('type') === 'physication')
->required(),
Forms\Components\Textarea::make('description')->rows(2)->cols(20)
->nullable()->maxLength(250)->columnSpanFull(),
FileUpload::make('attachments')->multiple()->directory(fn (\Closure $get) => $get('type'))->columnSpanFull(),
// Input::fileUpload('attachments')->directory(fn (\Closure $get) => $get('type'))->columnSpanFull(),
])->columns(2),
];
}and there is a button that when I clicked some data is pre-filled on this form. Here is how that is done.
public function editBillItem($index)
{
$this->currentEditIndex = $index;
$this->editData = $this->bill_items[$index];
$this->editBillItemForm->fill([
'type' => $this->editData['type'],
'fee' => $this->editData['fee'],
'date_of_care' => $this->editData['date_of_care'] ?? '',
'description' => $this->editData['description'],
'attachments' => $this->editData['attachments'],
]);
}public function editBillItem($index)
{
$this->currentEditIndex = $index;
$this->editData = $this->bill_items[$index];
$this->editBillItemForm->fill([
'type' => $this->editData['type'],
'fee' => $this->editData['fee'],
'date_of_care' => $this->editData['date_of_care'] ?? '',
'description' => $this->editData['description'],
'attachments' => $this->editData['attachments'],
]);
}and here is the data shown before getting filled into the form (shown on the picture).
