|
118 | 118 | }
|
119 | 119 | </style>
|
120 | 120 | @endPushOnce
|
| 121 | +@php |
| 122 | + $years = $invoice->fiscalYears; |
| 123 | + $fiscal = $years->where('year', $year)->first() ?? $years->latest()->first(); |
| 124 | +@endphp |
121 | 125 |
|
122 | 126 | @section('content')
|
123 | 127 | <!-- start page title -->
|
|
130 | 134 | <button class="btn btn-primary waves-effect waves-light m-2 d-print-none d-block" id="cmd">Print</button>
|
131 | 135 | </div>
|
132 | 136 | <div>
|
133 |
| - <div class="row"> |
134 |
| - @isset($basic->header_image) |
135 |
| - <div class="d-flex border my-5 justify-content-center"> |
136 |
| - <img style="object-fit: cover; max-width:1240px;height:250px;" |
137 |
| - src="{{ asset('storage/' . app('setting')->basic->header_image) }}" alt=""> |
| 137 | + <div class="row"> |
| 138 | + @isset($basic->header_image) |
| 139 | + <div class="d-flex border my-5 justify-content-center"> |
| 140 | + <img style="object-fit: cover; max-width:1240px;height:250px;" |
| 141 | + src="{{ asset('storage/' . app('setting')->basic->header_image) }}" alt=""> |
| 142 | + </div> |
| 143 | + @else |
| 144 | + <div class="p-5 text-center"> |
| 145 | + No Header Image found |
| 146 | + </div> |
| 147 | + @endisset |
138 | 148 | </div>
|
139 |
| - @else |
140 |
| - <div class="p-5 text-center"> |
141 |
| - No Header Image found |
142 |
| - </div> |
143 |
| - @endisset |
144 |
| - </div> |
145 | 149 | <div class="row table-col">
|
146 | 150 | <div class="col-sm-4 col-md-3 table-cell">
|
147 | 151 | <div class="pe-2 mb-2">
|
|
163 | 167 | <div class="mb-3">
|
164 | 168 | <label for="issue-date" class="mb-0 d-block">Date of Issue</label>
|
165 | 169 | <div class="d-flex align-items-center">
|
166 |
| - {{ Carbon\Carbon::parse($invoice->fiscalYears()->where('year', $year)->first()->pivot->issue_date)->format('F d, Y') }} |
| 170 | + {{ Carbon\Carbon::parse($fiscal->pivot->issue_date)->format('F d, Y') }} |
167 | 171 | </div>
|
168 | 172 | </div>
|
169 | 173 | <div class="mb-3">
|
170 | 174 | <label for="issue-date" class="mb-0 d-block">Due Date</label>
|
171 | 175 | <div class="d-flex align-items-center">
|
172 |
| - {{ Carbon\Carbon::parse($invoice->fiscalYears()->where('year', $year)->first()->pivot->due_date)->format('F d, Y') }} |
| 176 | + {{ Carbon\Carbon::parse($fiscal->pivot->due_date)->format('F d, Y') }} |
173 | 177 | </div>
|
174 | 178 | </div>
|
175 | 179 | </div>
|
|
188 | 192 | <div class="d-flex justify-content-end mb-2">
|
189 | 193 | <p class="mb-0">Amount Due (USD) <br>
|
190 | 194 | <span class="fs-1 fw-bold text-black"
|
191 |
| - id="amount-due-vue">{{ $invoice->fiscalYears()->where('year', $year)->first()->pivot->due ?? '' }}Tk</span> |
| 195 | + id="amount-due-vue">{{ $fiscal->pivot->due ?? '' }}Tk</span> |
192 | 196 | </p>
|
193 | 197 | </div>
|
194 | 198 | <div class="fw-bold d-flex justify-content-end">
|
195 | 199 | <h4> Year: {{ $year }}</h4>
|
196 | 200 | </div>
|
197 | 201 | @php
|
198 | 202 | $color = 'dark';
|
199 |
| - switch ($invoice->fiscalYears()->where('year', $year)->first()->pivot->status) { |
| 203 | + switch ($fiscal->pivot->status) { |
200 | 204 | case 'sent':
|
201 | 205 | $color = '#1abc9c';
|
202 | 206 | break;
|
|
218 | 222 | <div style="font-weight: 600;margin-bottom:.5rem; text-align:end;">
|
219 | 223 | <span style="margin-right:1rem; ">Status:</span>
|
220 | 224 | <span
|
221 |
| - style="background: {{ $color }};padding:0.3rem 0.6rem; border-radius:0.3rem;color:white;">{{ str($invoice->fiscalYears()->where('year', $year)->first()->pivot->status)->title() }}</span> |
| 225 | + style="background: {{ $color }};padding:0.3rem 0.6rem; border-radius:0.3rem;color:white;">{{ str($fiscal->pivot->status)->title() }}</span> |
222 | 226 | </d>
|
223 | 227 | </div>
|
224 | 228 | </div>
|
|
276 | 280 | <div style="font-weight: 600;display:table-row">
|
277 | 281 | <div style="margin-right: 1rem;display:table-cell">Sub Total:</div>
|
278 | 282 | <div style="display:table-cell;text-align:end;">
|
279 |
| - {{ $invoice->fiscalYears()->where('year', $year)->first()->pivot->sub_total }} |
| 283 | + {{ $fiscal->pivot->sub_total }} |
280 | 284 | Tk</div>
|
281 | 285 | </h3>
|
282 | 286 | </div>
|
|
287 | 291 | <div style="margin-right: 1rem;display:table-cell">Discount:</div>
|
288 | 292 | <div style="display:table-cell;text-align:end;color:#1abc9c;">
|
289 | 293 | -
|
290 |
| - {{ $invoice->fiscalYears()->where('year', $year)->first()->pivot->discount }} |
| 294 | + {{ $fiscal->pivot->discount }} |
291 | 295 | Tk</div>
|
292 | 296 | </h3>
|
293 | 297 | </div>
|
|
330 | 334 | <div style="font-weight: 600;display:table-row">
|
331 | 335 | <div style="margin-right: 1rem;display:table-cell">Total:</div>
|
332 | 336 | <div style="display:table-cell;text-align:end;">
|
333 |
| - {{ $invoice->fiscalYears()->where('year', $year)->first()->pivot->demand }} |
| 337 | + {{ $fiscal->pivot->demand }} |
334 | 338 | Tk</div>
|
335 | 339 | </h3>
|
336 | 340 | </div>
|
|
369 | 373 | <div style="display:table-cell;width:50%;">Demand</div>
|
370 | 374 | <div style="display:table-cell;text-align:end;">:</div>
|
371 | 375 | <div style="display:table-cell;text-align:end;">
|
372 |
| - {{ $invoice->fiscalYears()->where('year', $year)->first()->pivot->demand }} |
| 376 | + {{ $fiscal->pivot->demand }} |
373 | 377 | Tk</div>
|
374 | 378 | </h3>
|
375 | 379 | </div>
|
|
379 | 383 | <div style="display:table-cell;width:50%;">Paid</div>
|
380 | 384 | <div style="display:table-cell;text-align:end;">:</div>
|
381 | 385 | <div style="display:table-cell;text-align:end;color:#1abc9c;">
|
382 |
| - - {{ $invoice->fiscalYears()->where('year', $year)->first()->pivot->paid }} |
| 386 | + - {{ $fiscal->pivot->paid }} |
383 | 387 | Tk</div>
|
384 | 388 | </h3>
|
385 | 389 | </div>
|
|
389 | 393 | <div style="display:table-cell;width:50%;">Due</div>
|
390 | 394 | <div style="display:table-cell;text-align:end;">:</div>
|
391 | 395 | <div style="display:table-cell;text-align:end;">
|
392 |
| - {{ $invoice->fiscalYears()->where('year', $year)->first()->pivot->due }} |
| 396 | + {{ $fiscal->pivot->due }} |
393 | 397 | Tk</div>
|
394 | 398 | </h3>
|
395 | 399 | </div>
|
|
414 | 418 | </div>
|
415 | 419 | <div class="row">
|
416 | 420 | @isset(app('setting')->basic->footer_image)
|
417 |
| - <div class="d-flex border my-2 justify-content-center"> |
418 |
| - <img style="object-fit: cover; max-width:1240px;height:250px;" |
419 |
| - src="{{ asset('storage/' . app('setting')->basic->footer_image) }}" alt=""> |
420 |
| - </div> |
421 |
| - |
| 421 | + <div class="d-flex border my-2 justify-content-center"> |
| 422 | + <img style="object-fit: cover; max-width:1240px;height:250px;" |
| 423 | + src="{{ asset('storage/' . app('setting')->basic->footer_image) }}" alt=""> |
| 424 | + </div> |
422 | 425 | @else
|
423 |
| - <div class="p-5 text-center"> |
424 |
| - No Footer Image found |
425 |
| - </div> |
| 426 | + <div class="p-5 text-center"> |
| 427 | + No Footer Image found |
| 428 | + </div> |
426 | 429 | @endisset
|
427 | 430 | </div>
|
428 | 431 |
|
|
0 commit comments