|
76 | 76 | <tbody> |
77 | 77 | <tr> |
78 | 78 | <td class="p-0 align-top" width="33%"> |
79 | | - @php |
80 | | - $name = $invoice->seller->name; |
81 | | - $street = $invoice->seller->address->street; |
82 | | - $postal_code = $invoice->seller->address->postal_code; |
83 | | - $city = $invoice->seller->address->city; |
84 | | - $state = $invoice->seller->address->state; |
85 | | - $country = $invoice->seller->address->country; |
86 | | - $address_fields = $invoice->seller->address?->fields ?? []; |
87 | | - $email = $invoice->seller->email; |
88 | | - $phone = $invoice->seller->phone; |
89 | | - $tax_number = $invoice->seller->tax_number; |
90 | | - $fields = $invoice->seller->fields; |
91 | | - @endphp |
92 | | - |
93 | 79 | <p class="mb-1 pb-1 text-xs text-gray-500">{{ __('invoices::invoice.from') }}</p> |
94 | 80 |
|
95 | | - @if ($name) |
96 | | - <p class="pb-1 text-xs"><strong>{{ $name }}</strong></p> |
97 | | - @endif |
98 | | - @if ($street) |
99 | | - <p class="pb-1 text-xs">{{ $street }}</p> |
100 | | - @endif |
101 | | - @if ($postal_code || $city) |
102 | | - <p class="whitespace-nowrap pb-1 text-xs"> |
103 | | - {{ $postal_code }} |
104 | | - {{ $city }} |
105 | | - </p> |
| 81 | + @if ($invoice->seller->company) |
| 82 | + <p class="pb-1 text-xs"><strong>{{ $invoice->seller->company }}</strong></p> |
106 | 83 | @endif |
107 | | - @if ($state) |
108 | | - <p class="pb-1 text-xs">{{ $state }}</p> |
109 | | - @endif |
110 | | - @if ($country) |
111 | | - <p class="pb-1 text-xs">{{ $country }}</p> |
| 84 | + |
| 85 | + @if ($invoice->seller->name) |
| 86 | + <p class="pb-1 text-xs"><strong>{{ $invoice->seller->name }}</strong></p> |
112 | 87 | @endif |
113 | 88 |
|
114 | | - @foreach ($address_fields as $key => $value) |
115 | | - <p class="pb-1 text-xs"> |
116 | | - @if (is_string($key)) |
117 | | - {{ $key }} |
118 | | - @endif |
119 | | - {{ $value }} |
120 | | - </p> |
121 | | - @endforeach |
| 89 | + @if ($invoice->seller->address) |
| 90 | + @include('invoices::default.includes.address', [ |
| 91 | + 'address' => $invoice->seller->address, |
| 92 | + ]) |
| 93 | + @endif |
122 | 94 |
|
123 | | - @if ($email) |
124 | | - <p class="pb-1 text-xs">{{ $email }}</p> |
| 95 | + @if ($invoice->seller->email) |
| 96 | + <p class="pb-1 text-xs">{{ $invoice->seller->email }}</p> |
125 | 97 | @endif |
126 | | - @if ($phone) |
127 | | - <p class="pb-1 text-xs">{{ $phone }}</p> |
| 98 | + @if ($invoice->seller->phone) |
| 99 | + <p class="pb-1 text-xs">{{ $invoice->seller->phone }}</p> |
128 | 100 | @endif |
129 | | - @if ($tax_number) |
130 | | - <p class="pb-1 text-xs">{{ $tax_number }}</p> |
| 101 | + @if ($invoice->seller->tax_number) |
| 102 | + <p class="pb-1 text-xs">{{ $invoice->seller->tax_number }}</p> |
| 103 | + @endif |
| 104 | + |
| 105 | + @if ($invoice->seller->fields) |
| 106 | + @foreach ($invoice->seller->fields as $key => $value) |
| 107 | + <p class="pb-1 text-xs"> |
| 108 | + @if (is_string($key)) |
| 109 | + {{ $key }} |
| 110 | + @endif |
| 111 | + {{ $value }} |
| 112 | + </p> |
| 113 | + @endforeach |
131 | 114 | @endif |
132 | | - @foreach ($fields as $key => $value) |
133 | | - <p class="pb-1 text-xs"> |
134 | | - @if (is_string($key)) |
135 | | - {{ $key }} |
136 | | - @endif |
137 | | - {{ $value }} |
138 | | - </p> |
139 | | - @endforeach |
140 | 115 | </td> |
141 | 116 | <td class="p-0 align-top" width="33%"> |
142 | | - @php |
143 | | - $name = $invoice->buyer->name; |
144 | | - $street = $invoice->buyer->address?->street; |
145 | | - $postal_code = $invoice->buyer->address?->postal_code; |
146 | | - $city = $invoice->buyer->address?->city; |
147 | | - $state = $invoice->buyer->address?->state; |
148 | | - $country = $invoice->buyer->address?->country; |
149 | | - $address_fields = $invoice->buyer->address?->fields ?? []; |
150 | | - $email = $invoice->buyer->email; |
151 | | - $phone = $invoice->buyer->phone; |
152 | | - $tax_number = $invoice->buyer->tax_number; |
153 | | - $fields = $invoice->buyer->fields; |
154 | | - @endphp |
155 | 117 | <p class="mb-1 pb-1 text-xs text-gray-500">{{ __('invoices::invoice.to') }}</p> |
156 | 118 |
|
157 | | - @if ($name) |
158 | | - <p class="pb-1 text-xs"><strong>{{ $name }}</strong></p> |
| 119 | + @if ($invoice->buyer->company) |
| 120 | + <p class="pb-1 text-xs"><strong>{{ $invoice->buyer->company }}</strong></p> |
159 | 121 | @endif |
160 | | - @if ($street) |
161 | | - <p class="pb-1 text-xs">{{ $street }}</p> |
162 | | - @endif |
163 | | - @if ($postal_code || $city) |
164 | | - <p class="whitespace-nowrap pb-1 text-xs"> |
165 | | - {{ $postal_code }} |
166 | | - {{ $city }} |
167 | | - </p> |
168 | | - @endif |
169 | | - @if ($state) |
170 | | - <p class="pb-1 text-xs">{{ $state }}</p> |
171 | | - @endif |
172 | | - @if ($country) |
173 | | - <p class="pb-1 text-xs">{{ $country }}</p> |
| 122 | + |
| 123 | + @if ($invoice->buyer->name) |
| 124 | + <p class="pb-1 text-xs"><strong>{{ $invoice->buyer->name }}</strong></p> |
174 | 125 | @endif |
175 | 126 |
|
176 | | - @foreach ($address_fields as $key => $value) |
177 | | - <p class="pb-1 text-xs"> |
178 | | - @if (is_string($key)) |
179 | | - {{ $key }} |
180 | | - @endif |
181 | | - {{ $value }} |
182 | | - </p> |
183 | | - @endforeach |
| 127 | + @if ($invoice->buyer->address) |
| 128 | + @include('invoices::default.includes.address', [ |
| 129 | + 'address' => $invoice->buyer->address, |
| 130 | + ]) |
| 131 | + @endif |
184 | 132 |
|
185 | | - @if ($email) |
186 | | - <p class="pb-1 text-xs">{{ $email }}</p> |
| 133 | + @if ($invoice->buyer->email) |
| 134 | + <p class="pb-1 text-xs">{{ $invoice->buyer->email }}</p> |
187 | 135 | @endif |
188 | | - @if ($phone) |
189 | | - <p class="pb-1 text-xs">{{ $phone }}</p> |
| 136 | + @if ($invoice->buyer->phone) |
| 137 | + <p class="pb-1 text-xs">{{ $invoice->buyer->phone }}</p> |
190 | 138 | @endif |
191 | | - @if ($tax_number) |
192 | | - <p class="pb-1 text-xs">{{ $tax_number }}</p> |
| 139 | + @if ($invoice->buyer->tax_number) |
| 140 | + <p class="pb-1 text-xs">{{ $invoice->buyer->tax_number }}</p> |
193 | 141 | @endif |
194 | 142 |
|
195 | | - @foreach ($fields as $key => $value) |
196 | | - <p class="pb-1 text-xs"> |
197 | | - @if (is_string($key)) |
198 | | - {{ $key }} |
199 | | - @endif |
200 | | - {{ $value }} |
201 | | - </p> |
202 | | - @endforeach |
| 143 | + @if ($invoice->buyer->fields) |
| 144 | + @foreach ($invoice->buyer->fields as $key => $value) |
| 145 | + <p class="pb-1 text-xs"> |
| 146 | + @if (is_string($key)) |
| 147 | + {{ $key }} |
| 148 | + @endif |
| 149 | + {{ $value }} |
| 150 | + </p> |
| 151 | + @endforeach |
| 152 | + @endif |
203 | 153 | </td> |
204 | 154 |
|
205 | 155 | @if ($invoice->buyer->shipping_address) |
206 | 156 | <td class="p-0 align-top" width="33%"> |
207 | | - @php |
208 | | - $name = $invoice->buyer->shipping_address->name; |
209 | | - $street = $invoice->buyer->shipping_address->street; |
210 | | - $postal_code = $invoice->buyer->shipping_address->postal_code; |
211 | | - $city = $invoice->buyer->shipping_address->city; |
212 | | - $state = $invoice->buyer->shipping_address->state; |
213 | | - $country = $invoice->buyer->shipping_address->country; |
214 | | - $fields = $invoice->buyer->shipping_address->fields; |
215 | | - @endphp |
| 157 | + |
216 | 158 | <p class="mb-1 whitespace-nowrap pb-1 text-xs text-gray-500"> |
217 | 159 | {{ __('invoices::invoice.shipping_to') }} |
218 | 160 | </p> |
219 | 161 |
|
220 | | - @if ($name) |
221 | | - <p class="pb-1 text-xs"><strong>{{ $name }}</strong></p> |
| 162 | + @if ($invoice->buyer->shipping_address) |
| 163 | + @include('invoices::default.includes.address', [ |
| 164 | + 'address' => $invoice->buyer->shipping_address, |
| 165 | + ]) |
222 | 166 | @endif |
223 | | - @if ($street) |
224 | | - <p class="pb-1 text-xs">{{ $street }}</p> |
225 | | - @endif |
226 | | - @if ($postal_code || $city) |
227 | | - <p class="whitespace-nowrap pb-1 text-xs"> |
228 | | - {{ $postal_code }} |
229 | | - {{ $city }} |
230 | | - </p> |
231 | | - @endif |
232 | | - @if ($state) |
233 | | - <p class="pb-1 text-xs">{{ $state }}</p> |
234 | | - @endif |
235 | | - @if ($country) |
236 | | - <p class="pb-1 text-xs">{{ $country }}</p> |
237 | | - @endif |
238 | | - @foreach ($fields as $key => $value) |
239 | | - <p class="pb-1 text-xs"> |
240 | | - @if (is_string($key)) |
241 | | - {{ $key }} |
242 | | - @endif |
243 | | - {{ $value }} |
244 | | - </p> |
245 | | - @endforeach |
246 | 167 | </td> |
247 | 168 | @endif |
248 | 169 |
|
|
0 commit comments