jelmerkeij
jelmerkeij
FFilament
Created by jelmerkeij on 3/12/2024 in #❓┊help
FileUpload: Uploading (large files) directly to S3
No luck with this. The only thing I can find is to do what I already did: publish the livewire config and set the disk for temporary_file_upload, but this sets it for all uploads. I doubt that it's even possible to have this set per FileUploadComponent.
8 replies
FFilament
Created by jelmerkeij on 3/12/2024 in #❓┊help
FileUpload: Uploading (large files) directly to S3
I did not but I'm hoping to find out soon 🙂
8 replies
FFilament
Created by jelmerkeij on 3/12/2024 in #❓┊help
FileUpload: Uploading (large files) directly to S3
Any suggestions on if this is good practice or are there better alternatives to adjust the "temporary_file_upload disk" specifically for a single FileUpload component? Or might this not be the right place to ask this question?
8 replies
FFilament
Created by jelmerkeij on 3/12/2024 in #❓┊help
FileUpload: Uploading (large files) directly to S3
I got this working by publishing the livewire config: php artisan vendor:publish --tag=livewire:config Than in the published config/livewire.php under the array key temporary_file_upload=>disk I set it to the s3 disk. Now the temp files are directly uploaded to S3. Is this good practice or are there better alternatives to adjust the "temporary_file_upload disk" specifically for a single FileUpload component?
8 replies
FFilament
Created by Felix on 1/8/2024 in #❓┊help
filament Table main content goes under the footer.
I was trying to work out the exact same thing. You need to put the content in the view in a <tr> for it to make it work. (Source: https://v2.filamentphp.com/tricks/custom-table-footer-displays-above-content - it's a v2 URL but still relevant)
4 replies
FFilament
Created by jelmerkeij on 1/5/2024 in #❓┊help
Custom Field does not submit data
Thanks again for your help @Lara Zeus . It seems that the setup() function in the ProductPrices does the trick. I think it needs to be setup as an array. And it works when setting it up in the same way that CheckboxList() does. Final working code of the custom field:
class ProductPrices extends Field {

protected string $view = 'forms.components.product-prices';

protected array|Arrayable|string|Closure|null $currencies = null;

protected function setUp(): void
{
parent::setUp();

$this->default([]);

$this->afterStateHydrated(static function (ProductPrices $component, $state) {
if (is_array($state)) {
return;
}

$component->state([]);
});
}

public function currencies( array|Arrayable|string|Closure|null $currencies ): static {
$this->currencies = $currencies;

return $this;
}

public function getCurrencies(): Collection {
return $this->evaluate( $this->currencies ) ?? new Collection();
}
}
class ProductPrices extends Field {

protected string $view = 'forms.components.product-prices';

protected array|Arrayable|string|Closure|null $currencies = null;

protected function setUp(): void
{
parent::setUp();

$this->default([]);

$this->afterStateHydrated(static function (ProductPrices $component, $state) {
if (is_array($state)) {
return;
}

$component->state([]);
});
}

public function currencies( array|Arrayable|string|Closure|null $currencies ): static {
$this->currencies = $currencies;

return $this;
}

public function getCurrencies(): Collection {
return $this->evaluate( $this->currencies ) ?? new Collection();
}
}
11 replies
FFilament
Created by jelmerkeij on 1/5/2024 in #❓┊help
Custom Field does not submit data
Thanks, I will look into this and report back if I get it working. If anybody knows which trait is needed then please let me know!
11 replies
FFilament
Created by jelmerkeij on 1/5/2024 in #❓┊help
Custom Field does not submit data
(also tried adding a column pricesTest to the db)
11 replies
FFilament
Created by jelmerkeij on 1/5/2024 in #❓┊help
Custom Field does not submit data
Thank you for taking the time to reply. pricesTest isn't a real property on my Product model but for the sake of trying to work it out this doesn't make any difference when added:
class Product extends Model
{
use SoftDeletes;

public $pricesTest = [];

public $casts = [
'pricesTest' => 'array',
];

protected $fillable = [
'product_number',
'name',
...
'pricesTest',
];
...
}
class Product extends Model
{
use SoftDeletes;

public $pricesTest = [];

public $casts = [
'pricesTest' => 'array',
];

protected $fillable = [
'product_number',
'name',
...
'pricesTest',
];
...
}
I would expect the dd() data in mutateFormDataBeforeSave() to show the data from the form and not necessarily the model attributes. But it still comes up as null in mutateFormDataBeforeSave().
11 replies
FFilament
Created by JimKarvo on 10/18/2023 in #❓┊help
Passing data between Wizard steps
Hi @JimKarvo I have tackled a similar problem like this today. In my case I'm using a wizard and in the first step you select a contact person. Depending on the client to which the contact person belongs you get a discount percentage when creating a quote. The quote lines are in a repeater and I need to prefill the discount percentage every time a quote line is added. I've introduced "global" variables within the main component to keep it from re-querying the database everytime. Not sure if this is a good practice but maybe this will point you in the right direction: https://gist.github.com/Jelmerkeij/1880137623bbfdcf5d605aa1b9244e67 (I put the code in my QuoteResource.php)
4 replies
FFilament
Created by jelmerkeij on 12/14/2023 in #❓┊help
How to add extraAttributes (class) to Section container?
Thanks, that's an interesting approach. But I think this will not get me to the level of just the div <div style="--col-span-default: 1 / -1;" class="col-[--col-span-default]"> . It has no hook classes. I need a way to get to the parent (container?) of the section. I think...
4 replies
FFilament
Created by jelmerkeij on 8/9/2023 in #❓┊help
How to set state 'is loading' or 'blocked' in modal form
Ok thanks. Is there any example on how to listen for the event I'll be emitting on a modal? I can't seem to find this in the docs.
9 replies
FFilament
Created by jelmerkeij on 8/9/2023 in #❓┊help
How to set state 'is loading' or 'blocked' in modal form
Yes, the form 'field' component 'Of upload een...' and the field below it
<x-dynamic-component :component="$getFieldWrapperView()" :field="$field">

<div
x-data="{ state: $wire.entangle('{{ $getStatePath() }}') }"
x-init="document.dispatchEvent(new CustomEvent('initLargeFileUploader'));"
class="mb-3" id="large-file-upload"
data-upload-url="{{ $getUploadUrl() }}"
data-csrf="{{ csrf_token() }}"
>

{{-- Input field that has the filename --}}
<input type="hidden" class="field-file-id" x-model="state" @large-file-upload-completed.window.camel="state = $event.detail.filename">

<div class="mb-3">
{{__('labels.current_file')}}: <span class="original-filename font-bold" x-text="state"></span>
</div>

<div style="display: none;" class="progress-bar mb-5 h-2 rounded-full bg-gray-200">
<div class="progress h-2 rounded-full bg-red-500" style="width: 0%"></div>
</div>
<div class="status" style="display: none;">
{{__('labels.states.uploading')}}... (<span class="percentage">0</span>%)
</div>
<a class="button-browse-file hover:bg-blue-200 p-2 cursor-pointer opacity-70 filament-button filament-button-size-md inline-flex rounded-lg border transition-colors outline-none">{{ __('labels.actions.or_upload_new_file') }}...</a>


</div>

</x-dynamic-component>
<x-dynamic-component :component="$getFieldWrapperView()" :field="$field">

<div
x-data="{ state: $wire.entangle('{{ $getStatePath() }}') }"
x-init="document.dispatchEvent(new CustomEvent('initLargeFileUploader'));"
class="mb-3" id="large-file-upload"
data-upload-url="{{ $getUploadUrl() }}"
data-csrf="{{ csrf_token() }}"
>

{{-- Input field that has the filename --}}
<input type="hidden" class="field-file-id" x-model="state" @large-file-upload-completed.window.camel="state = $event.detail.filename">

<div class="mb-3">
{{__('labels.current_file')}}: <span class="original-filename font-bold" x-text="state"></span>
</div>

<div style="display: none;" class="progress-bar mb-5 h-2 rounded-full bg-gray-200">
<div class="progress h-2 rounded-full bg-red-500" style="width: 0%"></div>
</div>
<div class="status" style="display: none;">
{{__('labels.states.uploading')}}... (<span class="percentage">0</span>%)
</div>
<a class="button-browse-file hover:bg-blue-200 p-2 cursor-pointer opacity-70 filament-button filament-button-size-md inline-flex rounded-lg border transition-colors outline-none">{{ __('labels.actions.or_upload_new_file') }}...</a>


</div>

</x-dynamic-component>
9 replies
FFilament
Created by jelmerkeij on 8/9/2023 in #❓┊help
How to set state 'is loading' or 'blocked' in modal form
In panel
9 replies
FFilament
Created by Daniel Plomp on 8/9/2023 in #❓┊help
Change Title of RelationManager
In the specific RelationManager itself of course.
3 replies
FFilament
Created by Daniel Plomp on 8/9/2023 in #❓┊help
Change Title of RelationManager
Hi Daniel, try this:
/**
* @param Model $ownerRecord
* @param string $pageClass
*
* @return string
*/
public static function getTitle( Model $ownerRecord, string $pageClass ): string {
return __('strings.models.communications.plural');
}
/**
* @param Model $ownerRecord
* @param string $pageClass
*
* @return string
*/
public static function getTitle( Model $ownerRecord, string $pageClass ): string {
return __('strings.models.communications.plural');
}
3 replies
FFilament
Created by jelmerkeij on 8/4/2023 in #❓┊help
Livewire component has 'undefined variable' after updating Livewire?
I've created a Github issue for this: https://github.com/filamentphp/filament/issues/7509
6 replies
FFilament
Created by jelmerkeij on 8/4/2023 in #❓┊help
Livewire component has 'undefined variable' after updating Livewire?
Putting this in composer.json seems to revert back to a working version:
"require": {
...
"filament/filament": "v3.0.6",
...
}
"require": {
...
"filament/filament": "v3.0.6",
...
}
6 replies
FFilament
Created by jelmerkeij on 6/16/2023 in #❓┊help
Set column action on condition
Thanks this works, although on the rows that do not have an action they still visually appear as a link (orange and lighter orange on hover). I think this is because all these classes appear on filament-tables-text-column : filament-tables-text-column px-4 py-3 text-primary-600 transition hover:text-primary-500 hover:underline focus:text-primary-500 focus:underline Is there any way to remove those when the row does not have the action attached?
18 replies
FFilament
Created by jelmerkeij on 6/16/2023 in #❓┊help
Set column action on condition
ok thanks I will try it in a few minutes
18 replies