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-preview.blade.php 8.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. @php
  2. $document = \App\DTO\DocumentDTO::fromModel($getRecord());
  3. @endphp
  4. <div {{ $attributes }}>
  5. <x-company.invoice.container class="modern-template-container">
  6. <!-- Colored Header with Logo -->
  7. <x-company.invoice.header class="bg-gray-800 h-24">
  8. <!-- Logo -->
  9. <div class="w-2/3">
  10. @if($document->logo && $document->showLogo)
  11. <x-company.invoice.logo class="ml-8" :src="$document->logo"/>
  12. @endif
  13. </div>
  14. <!-- Ribbon Container -->
  15. <div class="w-1/3 absolute right-0 top-0 p-3 h-32 flex flex-col justify-end rounded-bl-sm"
  16. style="background: {{ $document->accentColor }};">
  17. @if($document->header)
  18. <h1 class="text-4xl font-bold text-white text-center uppercase">{{ $document->header }}</h1>
  19. @endif
  20. </div>
  21. </x-company.invoice.header>
  22. <!-- Company Details -->
  23. <x-company.invoice.metadata class="modern-template-metadata space-y-8">
  24. <div class="text-sm">
  25. <h2 class="text-lg font-semibold">{{ $document->company->name }}</h2>
  26. @if($document->company->address && $document->company->city && $document->company->state && $document->company->zipCode)
  27. <p>{{ $document->company->address }}</p>
  28. <p>{{ $document->company->city }}, {{ $document->company->state }} {{ $document->company->zipCode }}</p>
  29. <p>{{ $document->company->country }}</p>
  30. @endif
  31. </div>
  32. <div class="flex justify-between items-end">
  33. <!-- Billing Details -->
  34. <div class="text-sm tracking-tight">
  35. <h3 class="text-gray-600 dark:text-gray-400 font-medium tracking-tight mb-1">BILL TO</h3>
  36. <p class="text-base font-bold"
  37. style="color: {{ $document->accentColor }}">{{ $document->client->name }}</p>
  38. @if($document->client->addressLine1)
  39. <p>{{ $document->client->addressLine1 }}</p>
  40. @if($document->client->addressLine2)
  41. <p>{{ $document->client->addressLine2 }}</p>
  42. @endif
  43. <p>
  44. {{ $document->client->city }}{{ $document->client->state ? ', ' . $document->client->state: '' }}
  45. {{ $document->client->postalCode }}
  46. </p>
  47. @if($document->client->country)
  48. <p>{{ $document->client->country }}</p>
  49. @endif
  50. @endif
  51. </div>
  52. <div class="text-sm tracking-tight">
  53. <table class="min-w-full">
  54. <tbody>
  55. <tr>
  56. <td class="font-semibold text-right pr-2">{{ $document->label->number }}:</td>
  57. <td class="text-left pl-2">{{ $document->number }}</td>
  58. </tr>
  59. @if($document->referenceNumber)
  60. <tr>
  61. <td class="font-semibold text-right pr-2">{{ $document->label->referenceNumber }}:</td>
  62. <td class="text-left pl-2">{{ $document->referenceNumber }}</td>
  63. </tr>
  64. @endif
  65. <tr>
  66. <td class="font-semibold text-right pr-2">{{ $document->label->date }}:</td>
  67. <td class="text-left pl-2">{{ $document->date }}</td>
  68. </tr>
  69. <tr>
  70. <td class="font-semibold text-right pr-2">{{ $document->label->dueDate }}:</td>
  71. <td class="text-left pl-2">{{ $document->dueDate }}</td>
  72. </tr>
  73. </tbody>
  74. </table>
  75. </div>
  76. </div>
  77. </x-company.invoice.metadata>
  78. <!-- Line Items Table -->
  79. <x-company.invoice.line-items class="modern-template-line-items">
  80. <table class="w-full text-left table-fixed">
  81. <thead class="text-sm leading-relaxed">
  82. <tr class="text-gray-600 dark:text-gray-400">
  83. <th class="text-left pl-6 w-[45%] py-4">Items</th>
  84. <th class="text-center w-[15%] py-4">Quantity</th>
  85. <th class="text-right w-[20%] py-4">Price</th>
  86. <th class="text-right pr-6 w-[20%] py-4">Amount</th>
  87. </tr>
  88. </thead>
  89. <tbody class="text-sm tracking-tight border-y-2">
  90. @foreach($document->lineItems as $index => $item)
  91. <tr @class(['bg-gray-100 dark:bg-gray-800' => $index % 2 === 0])>
  92. <td class="text-left pl-6 font-semibold py-3">
  93. {{ $item->name }}
  94. @if($item->description)
  95. <div class="text-gray-600 font-normal line-clamp-2 mt-1">{{ $item->description }}</div>
  96. @endif
  97. </td>
  98. <td class="text-center py-3">{{ $item->quantity }}</td>
  99. <td class="text-right py-3">{{ $item->unitPrice }}</td>
  100. <td class="text-right pr-6 py-3">{{ $item->subtotal }}</td>
  101. </tr>
  102. @endforeach
  103. </tbody>
  104. <tfoot class="text-sm tracking-tight">
  105. <tr>
  106. <td class="pl-6 py-2" colspan="2"></td>
  107. <td class="text-right font-semibold py-2">Subtotal:</td>
  108. <td class="text-right pr-6 py-2">{{ $document->subtotal }}</td>
  109. </tr>
  110. @if($document->discount)
  111. <tr class="text-success-800 dark:text-success-600">
  112. <td class="pl-6 py-2" colspan="2"></td>
  113. <td class="text-right py-2">Discount:</td>
  114. <td class="text-right pr-6 py-2">
  115. ({{ $document->discount }})
  116. </td>
  117. </tr>
  118. @endif
  119. @if($document->tax)
  120. <tr>
  121. <td class="pl-6 py-2" colspan="2"></td>
  122. <td class="text-right py-2">Tax:</td>
  123. <td class="text-right pr-6 py-2">{{ $document->tax }}</td>
  124. </tr>
  125. @endif
  126. <tr>
  127. <td class="pl-6 py-2" colspan="2"></td>
  128. <td class="text-right font-semibold border-t py-2">Total:</td>
  129. <td class="text-right border-t pr-6 py-2">{{ $document->total }}</td>
  130. </tr>
  131. @if($document->amountDue)
  132. <tr>
  133. <td class="pl-6 py-2" colspan="2"></td>
  134. <td class="text-right font-semibold border-t-4 border-double py-2">{{ $document->label->amountDue }}
  135. ({{ $document->currencyCode }}):
  136. </td>
  137. <td class="text-right border-t-4 border-double pr-6 py-2">{{ $document->amountDue }}</td>
  138. </tr>
  139. @endif
  140. </tfoot>
  141. </table>
  142. </x-company.invoice.line-items>
  143. <!-- Footer Notes -->
  144. <x-company.invoice.footer class="modern-template-footer tracking-tight">
  145. <h4 class="font-semibold px-6 text-sm" style="color: {{ $document->accentColor }}">
  146. Terms & Conditions
  147. </h4>
  148. <span class="border-t-2 my-2 border-gray-300 block w-full"></span>
  149. <div class="flex justify-between space-x-4 px-6 text-sm">
  150. <p class="w-1/2 break-words line-clamp-4">{{ $document->terms }}</p>
  151. <p class="w-1/2 break-words line-clamp-4">{{ $document->footer }}</p>
  152. </div>
  153. </x-company.invoice.footer>
  154. </x-company.invoice.container>
  155. </div>