feat(transmittal): replace PDF export with Excel export and add logo

- Remove PDF export functionality from TransmittalResource and CreateTransmittal page
- Add new TransmittalExcelExport class for formatted Excel exports with company logo
- Update export jobs to generate unique filenames per user and refresh user data
- Replace PDF export action with Excel export in table actions
- Comment out logo in PDF view template as it's no longer used
- Fix import alias for Excel export action in GeneralLedger
This commit is contained in:
Jp
2026-02-19 03:11:17 +08:00
parent b95f23f223
commit 6eeedbeeb0
7 changed files with 176 additions and 78 deletions

View File

@@ -3,51 +3,12 @@
namespace App\Filament\Resources\Transmittals\Pages;
use App\Filament\Resources\Transmittals\TransmittalResource;
use Filament\Actions\Action;
use Filament\Resources\Pages\CreateRecord;
use Throwable;
class CreateTransmittal extends CreateRecord
{
protected static string $resource = TransmittalResource::class;
public bool $willExport = false;
/**
* @throws Throwable
*/
public function createAndExport(): void
{
$this->willExport = true;
$this->create();
}
public function afterCreate()
{
if ($this->willExport) {
TransmittalResource::exportTransmittal([$this->record->id]);
}
}
public function getCreatedNotificationMessage(): ?string
{
if ($this->willExport) {
return 'Transmittal Was Created Successfully!, Check your notification for file download link';
}
return 'Transmittal Was Created Successfully!';
}
protected function getFormActions(): array
{
return [
$this->getCreateFormAction(),
$this->getCreateAnotherFormAction(),
Action::make('Create and Export')->action('createAndExport')->color('success'),
$this->getCancelFormAction(),
];
}
protected function getRedirectUrl(): string
{
return $this->previousUrl ?? $this->getResource()::getUrl('index');