Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

BaseReportTransformer.php 891B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace App\Transformers;
  3. use App\Contracts\ExportableReport;
  4. use App\DTO\ReportDTO;
  5. use Filament\Support\Enums\Alignment;
  6. abstract class BaseReportTransformer implements ExportableReport
  7. {
  8. protected ReportDTO $report;
  9. public function __construct(ReportDTO $report)
  10. {
  11. $this->report = $report;
  12. }
  13. public function getColumns(): array
  14. {
  15. return $this->report->fields;
  16. }
  17. public function getPdfView(): string
  18. {
  19. return 'components.company.reports.report-pdf';
  20. }
  21. public function getAlignmentClass(int $index): string
  22. {
  23. $column = $this->getColumns()[$index];
  24. if ($column->getAlignment() === Alignment::Right) {
  25. return 'text-right';
  26. }
  27. if ($column->getAlignment() === Alignment::Center) {
  28. return 'text-center';
  29. }
  30. return 'text-left';
  31. }
  32. }