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.

document-totals.blade.php 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. @php
  2. use App\Enums\Accounting\DocumentDiscountMethod;
  3. use App\Utilities\Currency\CurrencyAccessor;
  4. use App\View\Models\DocumentTotalViewModel;
  5. $data = $this->form->getRawState();
  6. $type = $getType();
  7. $viewModel = new DocumentTotalViewModel($data, $type);
  8. extract($viewModel->buildViewData(), EXTR_SKIP);
  9. @endphp
  10. <div class="totals-summary w-full lg:pl-[4rem] lg:pr-[6rem] py-8 lg:py-0">
  11. <table class="w-full text-right table-fixed hidden lg:table">
  12. <colgroup>
  13. <col class="w-[30%]"> {{-- Items --}}
  14. <col class="w-[10%]"> {{-- Quantity --}}
  15. <col class="w-[10%]"> {{-- Price --}}
  16. <col class="w-[15%]">
  17. <col class="w-[15%]"> {{-- Adjustments --}}
  18. <col class="w-[10%]"> {{-- Amount --}}
  19. </colgroup>
  20. <tbody>
  21. @if($subtotal)
  22. <tr>
  23. <td colspan="4"></td>
  24. <td class="text-sm p-2 font-semibold text-gray-950 dark:text-white">Subtotal:</td>
  25. <td class="text-sm p-2">{{ $subtotal }}</td>
  26. </tr>
  27. @endif
  28. @if($taxTotal)
  29. <tr>
  30. <td colspan="4"></td>
  31. <td class="text-sm p-2">Tax:</td>
  32. <td class="text-sm p-2">{{ $taxTotal }}</td>
  33. </tr>
  34. @endif
  35. @if($isPerDocumentDiscount)
  36. <tr>
  37. <td colspan="3" class="text-sm p-2">Discount:</td>
  38. <td colspan="2" class="text-sm p-2">
  39. <div class="flex justify-between space-x-2">
  40. @foreach($getChildComponentContainer()->getComponents() as $component)
  41. <div class="flex-1 text-left">{{ $component }}</div>
  42. @endforeach
  43. </div>
  44. </td>
  45. <td class="text-sm p-2">({{ $discountTotal }})</td>
  46. </tr>
  47. @elseif($discountTotal)
  48. <tr>
  49. <td colspan="4"></td>
  50. <td class="text-sm p-2">Discount:</td>
  51. <td class="text-sm p-2">({{ $discountTotal }})</td>
  52. </tr>
  53. @endif
  54. <tr>
  55. <td colspan="4"></td>
  56. <td class="text-sm p-2 font-semibold text-gray-950 dark:text-white">{{ $amountDue ? 'Total' : 'Grand Total' }}:</td>
  57. <td class="text-sm p-2">{{ $grandTotal }}</td>
  58. </tr>
  59. @if($amountDue)
  60. <tr>
  61. <td colspan="4"></td>
  62. <td class="text-sm p-2 font-semibold text-gray-950 dark:text-white border-t-4 border-double">Amount Due
  63. ({{ $currencyCode }}):
  64. </td>
  65. <td class="text-sm p-2 border-t-4 border-double">{{ $amountDue }}</td>
  66. </tr>
  67. @endif
  68. @if($conversionMessage)
  69. <tr>
  70. <td colspan="6" class="text-sm p-2 text-gray-600">
  71. {{ $conversionMessage }}
  72. </td>
  73. </tr>
  74. @endif
  75. </tbody>
  76. </table>
  77. <!-- Mobile View -->
  78. <div class="block lg:hidden">
  79. <div class="flex flex-col space-y-6">
  80. @if($subtotal)
  81. <div class="flex justify-between items-center">
  82. <span class="text-sm font-semibold text-gray-950 dark:text-white">Subtotal:</span>
  83. <span class="text-sm">{{ $subtotal }}</span>
  84. </div>
  85. @endif
  86. @if($taxTotal)
  87. <div class="flex justify-between items-center">
  88. <span class="text-sm">Tax:</span>
  89. <span class="text-sm">{{ $taxTotal }}</span>
  90. </div>
  91. @endif
  92. @if($isPerDocumentDiscount)
  93. <div class="flex flex-col space-y-2">
  94. <span class="text-sm">Discount:</span>
  95. <div class="flex justify-between space-x-2">
  96. @foreach($getChildComponentContainer()->getComponents() as $component)
  97. <div class="w-1/2">{{ $component }}</div>
  98. @endforeach
  99. </div>
  100. </div>
  101. @elseif($discountTotal)
  102. <div class="flex justify-between items-center">
  103. <span class="text-sm">Discount:</span>
  104. <span class="text-sm">({{ $discountTotal }})</span>
  105. </div>
  106. @endif
  107. <div class="flex justify-between items-center">
  108. <span class="text-sm font-semibold text-gray-950 dark:text-white">{{ $amountDue ? 'Total' : 'Grand Total' }}:</span>
  109. <span class="text-sm">{{ $grandTotal }}</span>
  110. </div>
  111. @if($amountDue)
  112. <div class="flex justify-between items-center">
  113. <span
  114. class="text-sm font-semibold text-gray-950 dark:text-white">Amount Due ({{ $currencyCode }}):</span>
  115. <span class="text-sm">{{ $amountDue }}</span>
  116. </div>
  117. @endif
  118. @if($conversionMessage)
  119. <div class="text-sm text-gray-600">
  120. {{ $conversionMessage }}
  121. </div>
  122. @endif
  123. </div>
  124. </div>
  125. </div>