|
10 | 10 | try { |
11 | 11 | const headers = @include('layouts.components.header_bearer_api_gabungan'); |
12 | 12 | var create_url = new URL({{ json_encode(config('app.databaseGabunganUrl')) }} + '/api/v1/bantuan/cetak'); |
13 | | -
|
| 13 | + |
14 | 14 | create_url.searchParams.set('kode_kecamatan', {{ json_encode(session('kecamatan.kode_kecamatan') ?? '') }}); |
15 | 15 | create_url.searchParams.set('config_desa', {{ json_encode(session('desa.id') ?? '') }}); |
16 | | -
|
| 16 | + |
17 | 17 | @foreach ($filter as $key => $value) |
18 | | - create_url.searchParams.append('filter[{{ $key }}]', {{ json_encode($value) }}); |
19 | | - @endforeach |
20 | | -
|
| 18 | + create_url.searchParams.append('filter[{{ $key }}]', {{ json_encode($value) }}); @endforeach |
| 19 | + |
21 | 20 | const response = await fetch(create_url.href, { |
22 | 21 | method: 'GET', |
23 | 22 | headers: headers |
24 | 23 | }); |
25 | | -
|
| 24 | + |
26 | 25 | if (!response.ok) throw new Error('Gagal mengambil data'); |
27 | | -
|
| 26 | + |
28 | 27 | const result = await response.json(); |
29 | 28 | this.data = result.data; |
30 | | -
|
| 29 | + |
31 | 30 | await $nextTick(); |
32 | 31 | window.print(); |
33 | 32 | } catch (error) { |
|
40 | 39 | <thead> |
41 | 40 | <tr class="border thick"> |
42 | 41 | <th class="padat">No</th> |
| 42 | + <th class="padat">Nama {{ config('app.sebutanDesa') }}</th> |
43 | 43 | <th class="padat">Nama Program</th> |
44 | 44 | <th class="padat">Asal Dana</th> |
45 | 45 | <th class="padat">Jumlah Peserta</th> |
|
52 | 52 | <template x-for="(value, index) in data"> |
53 | 53 | <tr> |
54 | 54 | <td class="padat" x-text="index+1"></td> |
| 55 | + <td x-text="value.attributes.nama_desa"></td> |
55 | 56 | <td x-text="value.attributes.nama"></td> |
56 | 57 | <td x-text="value.attributes.asaldana"></td> |
57 | 58 | <td x-text="value.attributes.jumlah_peserta"></td> |
|
0 commit comments