Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

report-pdf.blade.php 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <title>{{ $report->getTitle() }}</title>
  7. <style>
  8. @page {
  9. size: A4;
  10. margin: 8.5mm 8.5mm 30mm 8.5mm;
  11. }
  12. .header {
  13. color: #374151;
  14. }
  15. .table-class th,
  16. .table-class td {
  17. text-align: right;
  18. color: #374151;
  19. }
  20. /* Align the first column header and data to the left */
  21. .table-class th:first-child, .table-class td:first-child,
  22. .table-class th:nth-child(2), .table-class td:nth-child(2) {
  23. text-align: left;
  24. }
  25. .header {
  26. margin-bottom: 1rem; /* Space between header and table */
  27. }
  28. /* Ensure category name is left-aligned */
  29. .category-name-cell {
  30. text-align: left;
  31. }
  32. .header .title,
  33. .header .company-name,
  34. .header .date-range {
  35. margin-bottom: 0.125rem; /* Uniform space between header elements */
  36. }
  37. .title { font-size: 1.5rem; }
  38. .company-name { font-size: 1.125rem; font-weight: 600; }
  39. .date-range { font-size: 0.875rem; }
  40. .table-class {
  41. width: 100%;
  42. border-collapse: collapse;
  43. }
  44. .table-class th,
  45. .table-class td {
  46. padding: 0.75rem;
  47. font-size: 0.75rem;
  48. line-height: 1rem;
  49. border-bottom: 1px solid #d1d5db; /* Gray border for all rows */
  50. }
  51. .category-row > td {
  52. background-color: #f3f4f6; /* Gray background for category names */
  53. font-weight: 600;
  54. }
  55. .table-body tr { background-color: #ffffff; /* White background for other rows */ }
  56. .spacer-row > td { height: 0.75rem; }
  57. .table-footer-row > td {
  58. font-weight: 600;
  59. background-color: #ffffff; /* White background for footer */
  60. }
  61. </style>
  62. </head>
  63. <body>
  64. <div class="header">
  65. <div class="title">{{ $report->getTitle() }}</div>
  66. <div class="company-name">{{ $company->name }}</div>
  67. <div class="date-range">Date Range: {{ $startDate }} to {{ $endDate }}</div>
  68. </div>
  69. <table class="table-class">
  70. <thead class="table-head" style="display: table-row-group;">
  71. <tr>
  72. @foreach($report->getHeaders() as $header)
  73. <th>{{ $header }}</th>
  74. @endforeach
  75. </tr>
  76. </thead>
  77. <tbody>
  78. @foreach($report->getData() as $row)
  79. @if (count($row) === 2 && empty($row[0]))
  80. <tr class="category-row">
  81. <td></td>
  82. <td class="category-name-cell">{{ $row[1] }}</td>
  83. @for ($i = 2; $i < count($report->getHeaders()); $i++)
  84. <td></td>
  85. @endfor
  86. </tr>
  87. @elseif (count($row) > 2)
  88. <tr>
  89. @foreach ($row as $cell)
  90. <td>{{ $cell }}</td>
  91. @endforeach
  92. </tr>
  93. @elseif ($row[0] === '')
  94. <tr class="spacer-row">
  95. <td colspan="{{ count($report->getHeaders()) }}"></td>
  96. </tr>
  97. @endif
  98. @endforeach
  99. </tbody>
  100. <tfoot>
  101. <tr class="table-footer-row">
  102. @foreach ($report->getOverallTotals() as $total)
  103. <td>{{ $total }}</td>
  104. @endforeach
  105. </tr>
  106. </tfoot>
  107. </table>
  108. </body>
  109. </html>