Marco Mapelli
Marco Mapelli
Explore posts from servers
FFilament
Created by Marco Mapelli on 6/10/2024 in #❓┊help
Pagination and modal with tabs
The problem is that when I click on a tab, the pagination of the page is reset. Is it possible to prevent the pagination from resetting?
3 replies
FFilament
Created by Marco Mapelli on 4/22/2024 in #❓┊help
Action in footer table
I solved it this way: In listResource:
protected function getShowroomAction(): Action
{
return
Action::make('showroom')
->label(__('b2brstoys.showroom.torna_a_showroom'))
->color('success')
->url(fn (): string => ShowroommarcheResource::getUrl())
;
}
protected function getShowroomAction(): Action
{
return
Action::make('showroom')
->label(__('b2brstoys.showroom.torna_a_showroom'))
->color('success')
->url(fn (): string => ShowroommarcheResource::getUrl())
;
}
In Resource:
public static function table(Table $table): Table
{
return $table
->searchPlaceholder(__('b2brstoys.showroom.local_search'))
->contentFooter(function () {
return view(view: 'filament.cliente.resources.showroom-resource.pages.showroom_footer');
})
...
public static function table(Table $table): Table
{
return $table
->searchPlaceholder(__('b2brstoys.showroom.local_search'))
->contentFooter(function () {
return view(view: 'filament.cliente.resources.showroom-resource.pages.showroom_footer');
})
...
In view:
<nav class="fi-pagination grid grid-cols-[1fr_auto_1fr] items-center gap-x-3 fi-ta-pagination px-3 py-3 sm:px-6">
<span></span>
<div class="col-start-2 justify-self-center">
{{ $this->getShowroomAction() }}
</div>
<span></span>
</nav>
<nav class="fi-pagination grid grid-cols-[1fr_auto_1fr] items-center gap-x-3 fi-ta-pagination px-3 py-3 sm:px-6">
<span></span>
<div class="col-start-2 justify-self-center">
{{ $this->getShowroomAction() }}
</div>
<span></span>
</nav>
3 replies
FFilament
Created by Marco Mapelli on 4/5/2024 in #❓┊help
HELP getGlobalSearchResults
No description
7 replies
FFilament
Created by Marco Mapelli on 4/5/2024 in #❓┊help
HELP getGlobalSearchResults
This
public static function getGlobalSearchResults(string $searchQuery): Collection
{
$risultato = Pfc::with('articoli')
->where('codice', 'like', "%{$searchQuery}%")
->orWhereHas('pfcArticoli',
function($internalQuery) use ($searchQuery){
$internalQuery->join('articoli', 'articoli.id', '=', 'pfc_articolo.articolo_id')
->where('descrizione', 'like', "%{$searchQuery}%");
})
->get()
->map(function (Model $record): ?GlobalSearchResult {
$url = static::getGlobalSearchResultUrl($record);

if (blank($url)) {
return null;
}

return new GlobalSearchResult(
title: static::getGlobalSearchResultTitle($record),
url: $url,
details: static::getGlobalSearchResultDetails($record),
actions: static::getGlobalSearchResultActions($record),
);
})
->filter();
// dd($risultato);
// dd(parent::getGlobalSearchResults($searchQuery));
return $risultato;
}
public static function getGlobalSearchResults(string $searchQuery): Collection
{
$risultato = Pfc::with('articoli')
->where('codice', 'like', "%{$searchQuery}%")
->orWhereHas('pfcArticoli',
function($internalQuery) use ($searchQuery){
$internalQuery->join('articoli', 'articoli.id', '=', 'pfc_articolo.articolo_id')
->where('descrizione', 'like', "%{$searchQuery}%");
})
->get()
->map(function (Model $record): ?GlobalSearchResult {
$url = static::getGlobalSearchResultUrl($record);

if (blank($url)) {
return null;
}

return new GlobalSearchResult(
title: static::getGlobalSearchResultTitle($record),
url: $url,
details: static::getGlobalSearchResultDetails($record),
actions: static::getGlobalSearchResultActions($record),
);
})
->filter();
// dd($risultato);
// dd(parent::getGlobalSearchResults($searchQuery));
return $risultato;
}
error App\Filament\Resources\PfcResource::getGlobalSearchResults(): Return value must be of type Illuminate\Database\Eloquent\Collection, Illuminate\Support\Collection returned
7 replies
FFilament
Created by Marco Mapelli on 4/5/2024 in #❓┊help
HELP getGlobalSearchResults
No, I've already gone through all the documentation, but the result remains the same, even when using getGloballySearchableAttributes, getGlobalSearchResultDetails.
7 replies
FFilament
Created by Marco Mapelli on 2/6/2024 in #❓┊help
Enum color in DB
If I save the cache value I shouldn’t have slowdowns because it goes to read every time in the db, right?
6 replies
FFilament
Created by vermelen37 on 12/21/2023 in #❓┊help
Summarize Sum (quantity * price)
Placeholder::make('Cliente')
->hiddenLabel()
->content(function (OrdineTestata $record) {
$testo_html = '';
$righi = $record->righiordine;
$righiok = $righi->sum(function ($righi) {
return $righi->quantity * $righi->price;
});
$testo_html .= '<div><strong>Total: </strong>'.number_format($righiok, 2, ',', '.').' €</div>';
return new HtmlString($testo_html);
})
->columnSpan(1),
])
->columnSpan(1)
->columns(2),
Placeholder::make('Cliente')
->hiddenLabel()
->content(function (OrdineTestata $record) {
$testo_html = '';
$righi = $record->righiordine;
$righiok = $righi->sum(function ($righi) {
return $righi->quantity * $righi->price;
});
$testo_html .= '<div><strong>Total: </strong>'.number_format($righiok, 2, ',', '.').' €</div>';
return new HtmlString($testo_html);
})
->columnSpan(1),
])
->columnSpan(1)
->columns(2),
5 replies
FFilament
Created by Marco Mapelli on 12/13/2023 in #❓┊help
TextInput numeric with step
It is possible to set minValue(48) and step(96): if the value is 96 and i add a step the result = 192 and now is 144
3 replies
FFilament
Created by Oumaima on 8/26/2023 in #❓┊help
Image Carrousel
Is it possible to open the carousel in a modal window from a table image? And How?
25 replies
FFilament
Created by Marco Mapelli on 12/4/2023 in #❓┊help
Active Tab in modal
I can not. Opening a tabs in a modal window I can not put by default the first tab.
3 replies
FFilament
Created by Marco Mapelli on 11/16/2023 in #❓┊help
Resize section aside heading and description
return $form
->schema([
Section::make('Heading')
->description('')
->aside()
->schema([
Forms\Components\Radio::make('tipo')
->options(ContrattoTipo::class)
->label('TIPO')
->default(ContrattoTipo::Contratto)
->required()
->columnSpanFull()
->columns(2),
])
->columns(5),
...
return $form
->schema([
Section::make('Heading')
->description('')
->aside()
->schema([
Forms\Components\Radio::make('tipo')
->options(ContrattoTipo::class)
->label('TIPO')
->default(ContrattoTipo::Contratto)
->required()
->columnSpanFull()
->columns(2),
])
->columns(5),
...
7 replies
FFilament
Created by Marco Mapelli on 11/15/2023 in #❓┊help
disable field dynamically but save it in db
Perfect !!
Forms\Components\Toggle::make('is_contraente')
->default($is_contraente)
->disabled($is_contraente_disabled)
->dehydrated(),
Forms\Components\Toggle::make('is_contraente')
->default($is_contraente)
->disabled($is_contraente_disabled)
->dehydrated(),
Thanks
7 replies
FFilament
Created by Marco Mapelli on 11/15/2023 in #❓┊help
disable field dynamically but save it in db
Ok, but with ->dehydrated() ??
7 replies
FFilament
Created by Marco Mapelli on 9/20/2023 in #❓┊help
Logo in login page and after logged in
Perfect, thanks.
@guest
<img
src="{{ asset('images/logo.png') }}"
alt="Logo"
class="fi-logo h-20"
/>
@endguest
@auth
<img
src="{{ asset('images/logo.png') }}"
alt="Logo"
class="fi-logo h-10"
/>
@endauth
@guest
<img
src="{{ asset('images/logo.png') }}"
alt="Logo"
class="fi-logo h-20"
/>
@endguest
@auth
<img
src="{{ asset('images/logo.png') }}"
alt="Logo"
class="fi-logo h-10"
/>
@endauth
7 replies
FFilament
Created by Marco Mapelli on 9/20/2023 in #❓┊help
Logo in login page and after logged in
No description
7 replies
FFilament
Created by Marco Mapelli on 9/15/2023 in #❓┊help
Customize Record Title
Perfect !! Thanks
12 replies
FFilament
Created by Marco Mapelli on 9/15/2023 in #❓┊help
Customize Record Title
Filament v2
12 replies
FFilament
Created by Marco Mapelli on 9/15/2023 in #❓┊help
Customize Record Title
It doesn’t work. I always have "View [id]"
12 replies