You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

account-transactions.blade.php 6.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. @php
  2. use App\Models\Accounting\Bill;
  3. use App\Filament\Company\Resources\Accounting\TransactionResource;
  4. use App\Filament\Company\Resources\Purchases\BillResource\Pages\ViewBill;
  5. use App\Filament\Company\Resources\Sales\InvoiceResource\Pages\ViewInvoice;
  6. $iconPosition = \Filament\Support\Enums\IconPosition::After;
  7. @endphp
  8. <table class="w-full table-auto min-w-[50rem] divide-y divide-gray-200 dark:divide-white/5">
  9. <x-company.tables.header :headers="$report->getHeaders()" :alignmentClass="[$report, 'getAlignmentClass']"/>
  10. @foreach($report->getCategories() as $categoryIndex => $category)
  11. <tbody class="divide-y divide-gray-200 dark:divide-white/5">
  12. <!-- Category Header -->
  13. <tr class="bg-gray-50 dark:bg-white/5">
  14. <x-filament-tables::cell tag="th" colspan="{{ count($report->getHeaders()) }}" class="text-left">
  15. <div class="px-3 py-3.5">
  16. @foreach ($category->header as $headerRow)
  17. <div
  18. class="text-sm {{ $loop->first ? 'font-semibold text-gray-950 dark:text-white' : 'font-normal text-gray-500 dark:text-white/50' }}">
  19. @foreach ($headerRow as $headerValue)
  20. @if (!empty($headerValue))
  21. {{ $headerValue }}
  22. @endif
  23. @endforeach
  24. </div>
  25. @endforeach
  26. </div>
  27. </x-filament-tables::cell>
  28. </tr>
  29. <!-- Transactions Data -->
  30. @foreach($category->data as $dataIndex => $transaction)
  31. <tr
  32. @class([
  33. 'bg-gray-50 dark:bg-white/5' => $loop->first || $loop->last || $loop->remaining === 1,
  34. ])
  35. >
  36. @foreach($transaction as $cellIndex => $cell)
  37. <x-filament-tables::cell
  38. @class([
  39. $report->getAlignmentClass($cellIndex),
  40. 'whitespace-normal' => $cellIndex === 1,
  41. ])
  42. >
  43. <div
  44. @class([
  45. 'px-3 py-4 text-sm leading-6 text-gray-950 dark:text-white',
  46. 'font-semibold' => $loop->parent->first || $loop->parent->last || $loop->parent->remaining === 1,
  47. ])
  48. >
  49. @if(is_array($cell) && isset($cell['description']))
  50. @if(isset($cell['id']) && $cell['tableAction'])
  51. @if($cell['tableAction']['type'] === 'transaction')
  52. <x-filament::link
  53. :href="TransactionResource::getUrl(parameters: [
  54. 'tableAction' => $cell['tableAction']['action'],
  55. 'tableActionRecord' => $cell['tableAction']['id'],
  56. ])"
  57. target="_blank"
  58. color="primary"
  59. icon="heroicon-o-arrow-top-right-on-square"
  60. :icon-position="$iconPosition"
  61. icon-size="w-4 h-4 min-w-4 min-h-4"
  62. >
  63. {{ $cell['description'] }}
  64. </x-filament::link>
  65. @elseif($cell['tableAction']['type'] === 'view_transaction')
  66. <x-filament::link
  67. :href="$cell['tableAction']['url']"
  68. target="_blank"
  69. color="primary"
  70. icon="heroicon-o-arrow-top-right-on-square"
  71. :icon-position="$iconPosition"
  72. icon-size="w-4 h-4 min-w-4 min-h-4"
  73. >
  74. {{ $cell['description'] }}
  75. </x-filament::link>
  76. @else
  77. <x-filament::link
  78. :href="$cell['tableAction']['model'] === Bill::class
  79. ? ViewBill::getUrl(['record' => $cell['tableAction']['id']])
  80. : ViewInvoice::getUrl(['record' => $cell['tableAction']['id']])"
  81. target="_blank"
  82. color="primary"
  83. icon="heroicon-o-arrow-top-right-on-square"
  84. :icon-position="$iconPosition"
  85. icon-size="w-4 h-4 min-w-4 min-h-4"
  86. >
  87. {{ $cell['description'] }}
  88. </x-filament::link>
  89. @endif
  90. @else
  91. {{ $cell['description'] }}
  92. @endif
  93. @else
  94. {{ $cell }}
  95. @endif
  96. </div>
  97. </x-filament-tables::cell>
  98. @endforeach
  99. </tr>
  100. @endforeach
  101. <!-- Spacer Row -->
  102. @unless($loop->last)
  103. <tr>
  104. <td colspan="{{ count($report->getHeaders()) }}">
  105. <div class="min-h-12"></div>
  106. </td>
  107. </tr>
  108. @endunless
  109. </tbody>
  110. @endforeach
  111. </table>