V2 -> V3 Plugin - custom view not picking up styling

In v2 my custom view rendered fine - picking up the TW classes In v3 it's not rendering correctly. It appears that it's not picking up any additional TW classes. The blade is now extending <x-filament-panels::page> instead of <x-filament::page> Not sure what I'm missing to get the additional TW classes pulled in The view
<?php

namespace Blackpig\FilamentOffice\Resources\InvoiceResource\Pages;

use Filament\Actions\Action;
use Barryvdh\DomPDF\Facade\Pdf;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Mail;
use Filament\Notifications\Notification;
use Filament\Resources\Pages\ViewRecord;
use Blackpig\FilamentOffice\Mail\MailInvoice;
use Blackpig\FilamentOffice\Settings\OfficeSettings;
use Blackpig\FilamentOffice\Resources\InvoiceResource;

class ViewInvoice extends ViewRecord
{
protected static string $resource = InvoiceResource::class;

protected static string $view = 'filament-office::resources.invoice.view';

protected function getActions(): array
{
$actions = [
Action::make('close')
->label('Close')
->url($this->previousUrl ?? static::getResource()::getUrl())
->color('secondary'),

Action::make('pdf')
->label('Download')
->action('downloadPdf')
->color('secondary')
->icon(''),
];

if ($this->record->customer->hasEmail()) {
$actions[] = Action::make('send')
->label('Send To Customer')
->action('sendToCustomer')
->color('secondary');
}

return $actions;
}

public function downloadPdf()
{
$locale = $this->record->customer->preferred_language;
App::setLocale($locale);

$data = $this->getPdfData();
$pdf = Pdf::loadView('filament-office::resources.invoice.pdf', $data);

return response()->streamDownload(fn () => print($pdf->output()), "{$this->record->formatted_number}.pdf");
}

public function sendToCustomer()
{
$invoice = $this->record;
$locale = $invoice->customer->preferred_language;
App::setLocale($locale);

$data = $this->getPdfData();

$pdf = PDF::loadView('filament-office::resources.invoice.pdf', $data)
->setWarnings(false);

$data['site_url'] = config('app.url');

Mail::to($invoice->customer->email)
->send(new MailInvoice($data, $pdf));

Notification::make()
->title('Innvoice sent to ' . $invoice->customer->email )
->success()
->send();
}

protected function getPdfData(): array
{
return $data = [
'invoice' => $this->record,
'settings' => app(OfficeSettings::class)
];
}
}
<?php

namespace Blackpig\FilamentOffice\Resources\InvoiceResource\Pages;

use Filament\Actions\Action;
use Barryvdh\DomPDF\Facade\Pdf;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Mail;
use Filament\Notifications\Notification;
use Filament\Resources\Pages\ViewRecord;
use Blackpig\FilamentOffice\Mail\MailInvoice;
use Blackpig\FilamentOffice\Settings\OfficeSettings;
use Blackpig\FilamentOffice\Resources\InvoiceResource;

class ViewInvoice extends ViewRecord
{
protected static string $resource = InvoiceResource::class;

protected static string $view = 'filament-office::resources.invoice.view';

protected function getActions(): array
{
$actions = [
Action::make('close')
->label('Close')
->url($this->previousUrl ?? static::getResource()::getUrl())
->color('secondary'),

Action::make('pdf')
->label('Download')
->action('downloadPdf')
->color('secondary')
->icon(''),
];

if ($this->record->customer->hasEmail()) {
$actions[] = Action::make('send')
->label('Send To Customer')
->action('sendToCustomer')
->color('secondary');
}

return $actions;
}

public function downloadPdf()
{
$locale = $this->record->customer->preferred_language;
App::setLocale($locale);

$data = $this->getPdfData();
$pdf = Pdf::loadView('filament-office::resources.invoice.pdf', $data);

return response()->streamDownload(fn () => print($pdf->output()), "{$this->record->formatted_number}.pdf");
}

public function sendToCustomer()
{
$invoice = $this->record;
$locale = $invoice->customer->preferred_language;
App::setLocale($locale);

$data = $this->getPdfData();

$pdf = PDF::loadView('filament-office::resources.invoice.pdf', $data)
->setWarnings(false);

$data['site_url'] = config('app.url');

Mail::to($invoice->customer->email)
->send(new MailInvoice($data, $pdf));

Notification::make()
->title('Innvoice sent to ' . $invoice->customer->email )
->success()
->send();
}

protected function getPdfData(): array
{
return $data = [
'invoice' => $this->record,
'settings' => app(OfficeSettings::class)
];
}
}
2 Replies
Blackpig
BlackpigOP12mo ago
Thanks - I'd read that and tried adding in the plugin resource/blade path to the tailwind config content block but it made no difference. ok - finally managed it, lots of pain because it was a very early v2 app - still using webpack/mix not vite
Want results from more Discord servers?
Add your server