|
1 | 1 | <div
|
2 | 2 | class="text-sm"
|
3 |
| - x-init=" |
4 |
| - if (localStorage.getItem('theme') === 'light') { |
5 |
| - $refs.variables.classList.add('theme-light'); |
6 |
| - } else { |
7 |
| - $refs.variables.classList.add('theme-dark'); |
8 |
| - } |
| 3 | + x-data="{ |
| 4 | + activeTab: null, |
| 5 | + highlighted: false, |
9 | 6 |
|
10 |
| - hljs.highlightAll()"> |
11 |
| - <div> |
12 |
| - <p class="font-bold mb-1">Sender</p> |
13 |
| - @if ($log->sender->name) |
14 |
| - <p>{{ $log->sender->name }} <{{ $log->sender->email }}></p> |
15 |
| - @else |
16 |
| - <p>{{ $log->sender->email }}</p> |
17 |
| - @endif |
18 |
| - </div> |
| 7 | + init() { |
| 8 | + this.setTab('data'); |
19 | 9 |
|
20 |
| - <div class="mt-4"> |
21 |
| - <p class="font-bold mb-1">Recipient</p> |
22 |
| - <p>{{ $log->recipient }}</p> |
23 |
| - </div> |
| 10 | + if (localStorage.getItem('theme') === 'light') { |
| 11 | + document.getElementById('log-variables').classList.add('theme-light'); |
| 12 | + } else { |
| 13 | + document.getElementById('log-variables').classList.add('theme-dark'); |
| 14 | + } |
| 15 | + }, |
| 16 | + setTab(tabName) { |
| 17 | + this.activeTab = tabName; |
24 | 18 |
|
25 |
| - <div class="mt-4"> |
26 |
| - <p class="font-bold mb-1">Subject</p> |
27 |
| - <p>{{ $log->subject }}</p> |
28 |
| - </div> |
| 19 | + if (tabName === 'data' && !this.highlighted) { |
| 20 | + this.highlighted = true; |
| 21 | + hljs.highlightAll(); |
| 22 | + } |
| 23 | + }, |
| 24 | + }" |
| 25 | + x-init="init()"> |
| 26 | + <x-filament::tabs class="mb-6" style="width: fit-content"> |
| 27 | + <x-filament::tabs.item |
| 28 | + icon="heroicon-o-at-symbol" |
| 29 | + alpine-active="activeTab === 'data'" |
| 30 | + x-on:click="setTab('data')"> |
| 31 | + Data |
| 32 | + </x-filament::tabs.item> |
29 | 33 |
|
30 |
| - <div class="mt-4"> |
31 |
| - <p class="font-bold mb-1">Cc</p> |
32 |
| - @forelse (($log->cc ?: []) as $cc) |
33 |
| - @if ($cc->name) |
34 |
| - <p>{{ $cc->name }} <{{ $cc->email }}></p> |
35 |
| - @else |
36 |
| - <p>{{ $cc->email }}</p> |
37 |
| - @endif |
38 |
| - @empty |
39 |
| - <p class="italic opacity-80 text-xs">No data available</p> |
40 |
| - @endforelse |
41 |
| - </div> |
| 34 | + <x-filament::tabs.item |
| 35 | + icon="heroicon-o-paper-clip" |
| 36 | + alpine-active="activeTab === 'attachments'" |
| 37 | + x-on:click="setTab('attachments')"> |
| 38 | + Attachments ({{ count($log->attachments) }}) |
| 39 | + </x-filament::tabs.item> |
42 | 40 |
|
43 |
| - <div class="mt-4"> |
44 |
| - <p class="font-bold mb-1">Bcc</p> |
45 |
| - @forelse (($log->bcc ?: []) as $bcc) |
46 |
| - @if ($bcc->name) |
47 |
| - <p>{{ $bcc->name }} <{{ $bcc->email }}></p> |
| 41 | + <x-filament::tabs.item |
| 42 | + icon="heroicon-o-rss" |
| 43 | + alpine-active="activeTab === 'events'" |
| 44 | + x-on:click="setTab('events')"> |
| 45 | + Events ({{ count($log->events) }}) |
| 46 | + </x-filament::tabs.item> |
| 47 | + </x-filament::tabs> |
| 48 | + |
| 49 | + <!-- Data --> |
| 50 | + <x-filament::section x-show="activeTab === 'data'"> |
| 51 | + <div> |
| 52 | + <p class="font-bold mb-1">Sender</p> |
| 53 | + @if ($log->sender->name) |
| 54 | + <p>{{ $log->sender->name }} <{{ $log->sender->email }}></p> |
48 | 55 | @else
|
49 |
| - <p>{{ $bcc->email }}</p> |
| 56 | + <p>{{ $log->sender->email }}</p> |
50 | 57 | @endif
|
51 |
| - @empty |
52 |
| - <p class="italic opacity-80 text-xs">No data available</p> |
53 |
| - @endforelse |
54 |
| - </div> |
| 58 | + </div> |
55 | 59 |
|
56 |
| - <div class="mt-4"> |
57 |
| - <p class="font-bold mb-1">Template</p> |
58 |
| - {!! $template !!} |
59 |
| - </div> |
| 60 | + <div class="mt-4"> |
| 61 | + <p class="font-bold mb-1">Recipient</p> |
| 62 | + <p>{{ $log->recipient }}</p> |
| 63 | + </div> |
60 | 64 |
|
61 |
| - <div class="mt-4"> |
62 |
| - <p class="font-bold mb-1">Attachments</p> |
63 |
| - <table class="w-full table-auto border-collapse text-left rtl:text-right divide-y dark:divide-gray-700 text-sm rounded-lg overflow-hidden"> |
64 |
| - <thead> |
65 |
| - <tr class="bg-gray-50 dark:bg-gray-500/10"> |
66 |
| - <th> |
67 |
| - <span class="p-0 flex items-center w-full px-4 py-2 whitespace-nowrap space-x-1 rtl:space-x-reverse font-medium text-gray-600 dark:text-gray-300 cursor-default"> |
68 |
| - Name |
69 |
| - </span> |
70 |
| - </th> |
71 |
| - <th> |
72 |
| - <span class="p-0 flex items-center w-full px-4 py-2 whitespace-nowrap space-x-1 rtl:space-x-reverse font-medium text-gray-600 dark:text-gray-300 cursor-default"> |
73 |
| - Size |
74 |
| - </span> |
75 |
| - </th> |
76 |
| - <th> |
77 |
| - <span class="p-0 flex items-center w-full px-4 py-2 whitespace-nowrap space-x-1 rtl:space-x-reverse font-medium text-gray-600 dark:text-gray-300 cursor-default"> |
78 |
| - Disk |
79 |
| - </span> |
80 |
| - </th> |
81 |
| - <th class="w-5"></th> |
82 |
| - </tr> |
83 |
| - </thead> |
84 |
| - <tbody class="divide-y whitespace-nowrap dark:divide-gray-700"> |
85 |
| - @forelse ($log->attachments as $attachment) |
86 |
| - <tr class="dark:bg-gray-700/50 odd:bg-white even:bg-gray-50 even:dark:bg-gray-700/80"> |
87 |
| - <td class="px-4 py-2 dark:text-white"> |
88 |
| - {{ $attachment->name }} |
89 |
| - </td> |
90 |
| - <td class="px-4 py-2 dark:text-white"> |
91 |
| - {{ $attachment->readableSize() }} |
92 |
| - </td> |
93 |
| - <td class="px-4 py-2 dark:text-white"> |
94 |
| - {{ $attachment->disk ?: '-' }} |
95 |
| - </td> |
96 |
| - <td class="px-4 py-2"> |
97 |
| - @if ($attachment->canBeDownloaded()) |
98 |
| - <a |
99 |
| - href="{{ URL::route('download.attachment', $attachment) }}" |
100 |
| - class="font-medium text-primary-500 hover:text-primary-400" |
101 |
| - target="_blank" |
102 |
| - download> |
103 |
| - Download |
104 |
| - </a> |
105 |
| - @endif |
106 |
| - </td> |
107 |
| - </tr> |
108 |
| - @empty |
109 |
| - <tr class="dark:bg-gray-700/50 odd:bg-white even:bg-gray-50 even:dark:bg-gray-700/80"> |
110 |
| - <td class="px-4 py-2 italic text-xs opacity-80" colspan="4">No attachment available</td> |
| 65 | + <div class="mt-4"> |
| 66 | + <p class="font-bold mb-1">Subject</p> |
| 67 | + <p>{{ $log->subject }}</p> |
| 68 | + </div> |
| 69 | + |
| 70 | + <div class="mt-4"> |
| 71 | + <p class="font-bold mb-1">Cc</p> |
| 72 | + @forelse (($log->cc ?: []) as $cc) |
| 73 | + @if ($cc->name) |
| 74 | + <p>{{ $cc->name }} <{{ $cc->email }}></p> |
| 75 | + @else |
| 76 | + <p>{{ $cc->email }}</p> |
| 77 | + @endif |
| 78 | + @empty |
| 79 | + <p class="italic opacity-80 text-xs">No data available</p> |
| 80 | + @endforelse |
| 81 | + </div> |
| 82 | + |
| 83 | + <div class="mt-4"> |
| 84 | + <p class="font-bold mb-1">Bcc</p> |
| 85 | + @forelse (($log->bcc ?: []) as $bcc) |
| 86 | + @if ($bcc->name) |
| 87 | + <p>{{ $bcc->name }} <{{ $bcc->email }}></p> |
| 88 | + @else |
| 89 | + <p>{{ $bcc->email }}</p> |
| 90 | + @endif |
| 91 | + @empty |
| 92 | + <p class="italic opacity-80 text-xs">No data available</p> |
| 93 | + @endforelse |
| 94 | + </div> |
| 95 | + |
| 96 | + <div class="mt-4"> |
| 97 | + <p class="font-bold mb-1">Template</p> |
| 98 | + {!! $template !!} |
| 99 | + </div> |
| 100 | + |
| 101 | + <div class="mt-4"> |
| 102 | + <p class="font-bold mb-1">Variables</p> |
| 103 | + <pre wire:ignore id="log-variables" class="hljs w-full rounded p-3 shadow-sm focus:border-primary-600 focus:ring-1 focus:ring-inset focus:ring-primary-600 disabled:opacity-70 border border-gray-300/50 dark:border-gray-600/50"><code class="language-json">{!! $variables !!}</code></pre> |
| 104 | + </div> |
| 105 | + </x-filament::section> |
| 106 | + |
| 107 | + <!-- Attachments --> |
| 108 | + <x-filament::section x-show="activeTab === 'attachments'"> |
| 109 | + @if (count($log->attachments) === 0) |
| 110 | + <p class="italic text-xs opacity-80">No attachment available</p> |
| 111 | + @else |
| 112 | + <table class="w-full table-auto border-collapse text-left rtl:text-right divide-y dark:divide-gray-700 text-sm rounded-lg overflow-hidden"> |
| 113 | + <thead> |
| 114 | + <tr> |
| 115 | + <th> |
| 116 | + <span class="p-0 flex items-center w-full px-4 py-2 whitespace-nowrap space-x-1 rtl:space-x-reverse font-bold cursor-default"> |
| 117 | + Name |
| 118 | + </span> |
| 119 | + </th> |
| 120 | + <th> |
| 121 | + <span class="p-0 flex items-center w-full px-4 py-2 whitespace-nowrap space-x-1 rtl:space-x-reverse font-bold cursor-default"> |
| 122 | + Size |
| 123 | + </span> |
| 124 | + </th> |
| 125 | + <th> |
| 126 | + <span class="p-0 flex items-center w-full px-4 py-2 whitespace-nowrap space-x-1 rtl:space-x-reverse font-bold cursor-default"> |
| 127 | + Disk |
| 128 | + </span> |
| 129 | + </th> |
| 130 | + <th class="w-5"></th> |
111 | 131 | </tr>
|
112 |
| - @endforelse |
113 |
| - </tbody> |
114 |
| - </table> |
115 |
| - </div> |
| 132 | + </thead> |
| 133 | + <tbody class="divide-y whitespace-nowrap dark:divide-gray-700"> |
| 134 | + @foreach ($log->attachments as $attachment) |
| 135 | + <tr> |
| 136 | + <td class="px-4 py-2 dark:text-white"> |
| 137 | + {{ $attachment->name }} |
| 138 | + </td> |
| 139 | + <td class="px-4 py-2 dark:text-white"> |
| 140 | + {{ $attachment->readableSize() }} |
| 141 | + </td> |
| 142 | + <td class="px-4 py-2 dark:text-white"> |
| 143 | + {{ $attachment->disk ?: '-' }} |
| 144 | + </td> |
| 145 | + <td class="px-4 py-2"> |
| 146 | + @if ($attachment->canBeDownloaded()) |
| 147 | + <a |
| 148 | + href="{{ URL::route('download.attachment', $attachment) }}" |
| 149 | + class="font-medium text-primary-500 hover:text-primary-400" |
| 150 | + target="_blank" |
| 151 | + download> |
| 152 | + Download |
| 153 | + </a> |
| 154 | + @endif |
| 155 | + </td> |
| 156 | + </tr> |
| 157 | + @endforeach |
| 158 | + </tbody> |
| 159 | + </table> |
| 160 | + @endif |
| 161 | + </x-filament::section> |
116 | 162 |
|
117 |
| - <div class="mt-4"> |
118 |
| - <p class="font-bold mb-1">Variables</p> |
119 |
| - <pre wire:ignore x-ref="variables" class="hljs w-full rounded p-3 shadow-sm focus:border-primary-600 focus:ring-1 focus:ring-inset focus:ring-primary-600 disabled:opacity-70 border border-gray-300/50 dark:border-gray-600/50"><code class="language-json">{!! $variables !!}</code></pre> |
120 |
| - </div> |
| 163 | + <!-- Events --> |
| 164 | + <x-filament::section x-show="activeTab === 'events'"> |
| 165 | + @if (count($log->events) === 0) |
| 166 | + <p class="italic text-xs opacity-80">No events available</p> |
| 167 | + @else |
| 168 | + <table class="w-full table-auto border-collapse text-left rtl:text-right divide-y dark:divide-gray-700 text-sm rounded-lg overflow-hidden"> |
| 169 | + <thead> |
| 170 | + <tr> |
| 171 | + <th> |
| 172 | + <span class="p-0 flex items-center w-full px-4 py-2 whitespace-nowrap space-x-1 rtl:space-x-reverse font-bold cursor-default"> |
| 173 | + Name |
| 174 | + </span> |
| 175 | + </th> |
| 176 | + <th> |
| 177 | + <span class="p-0 flex items-center w-full px-4 py-2 whitespace-nowrap space-x-1 rtl:space-x-reverse font-bold cursor-default"> |
| 178 | + Date |
| 179 | + </span> |
| 180 | + </th> |
| 181 | + </tr> |
| 182 | + </thead> |
| 183 | + <tbody class="divide-y whitespace-nowrap dark:divide-gray-700"> |
| 184 | + @foreach ($log->events as $event) |
| 185 | + <tr> |
| 186 | + <td class="px-4 py-2 dark:text-white" style="width: 60%"> |
| 187 | + {{ $event->name }} |
| 188 | + </td> |
| 189 | + <td class="px-4 py-2 dark:text-white"> |
| 190 | + {{ $event->created_at->toDateTimeString() }} |
| 191 | + </td> |
| 192 | + </tr> |
| 193 | + @endforeach |
| 194 | + </tbody> |
| 195 | + </table> |
| 196 | + @endif |
| 197 | + </x-filament::section> |
121 | 198 | </div>
|
122 | 199 |
|
123 | 200 | @assets
|
|
0 commit comments