Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
konaspi2024
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Siti Aisah
konaspi2024
Commits
43c47728
Commit
43c47728
authored
Aug 13, 2024
by
Triyah Fatmawati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add regenerate VA
parent
fb680512
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
3 deletions
+59
-3
app/Http/Controllers/RegistrasiController.php
+55
-0
resources/views/admin/peserta/index.blade.php
+3
-3
routes/web.php
+1
-0
No files found.
app/Http/Controllers/RegistrasiController.php
View file @
43c47728
...
...
@@ -385,6 +385,61 @@ public function store(Request $request) {
}
}
public
function
regenerateVa
(
$id
){
$registrasi
=
Registrasi
::
query
()
->
find
(
$id
);
if
(
!
is_null
(
$registrasi
->
tanggal_bayar
)){
return
redirect
()
->
route
(
'admin.index_peserta'
)
->
with
(
'error'
,
'Tagihan telah dibayar!'
);
}
else
{
DB
::
beginTransaction
();
try
{
$namanya
=
str_replace
([
"'"
,
"."
,
","
,
"-"
],
''
,
$registrasi
->
nama
);
$nama
=
Str
::
substr
(
$namanya
,
0
,
30
);
$multipartData
=
[
'noid'
=>
$registrasi
->
kode_registrasi
,
'nama'
=>
$nama
,
'tagihan'
=>
$registrasi
->
tagihan
];
$generatedVa
=
$this
->
generateVa
(
$multipartData
);
$arrResponse
=
json_decode
(
$generatedVa
,
true
);
$registrasi
[
'status_va'
]
=
$arrResponse
[
'BTNresponse'
];
$registrasi
[
'nomor_va'
]
=
$arrResponse
[
'BTNVirtualAccount'
];
$registrasi
[
'updated_at'
]
=
Carbon
::
now
()
->
toDateTimeString
();
$registrasi
->
save
();
if
(
$arrResponse
[
'BTNresponse'
]
!=
'Request has been processed successfully'
){
DB
::
rollBack
();
Log
::
error
(
'---'
);
Log
::
error
(
$multipartData
);
Log
::
error
(
$arrResponse
[
'BTNresponse'
]);
Log
::
error
(
'---'
);
return
redirect
()
->
route
(
'admin.index_peserta'
)
->
with
(
'error'
,
'VA gagal di-regenerate'
);
}
DB
::
commit
();
return
redirect
()
->
route
(
'admin.index_peserta'
)
->
with
(
'success'
,
'VA berhasil di-regenerate'
);
}
catch
(
Exception
$e
){
Log
::
error
(
$e
);
DB
::
rollBack
();
return
redirect
()
->
route
(
'admin.index_peserta'
)
->
with
(
'error'
,
'VA gagal di-regenerate'
);
}
}
}
private
function
generateVa
(
$multipartData
)
{
$client
=
new
Client
();
...
...
resources/views/admin/peserta/index.blade.php
View file @
43c47728
...
...
@@ -58,7 +58,7 @@
@endforeach
</td>
<td>
{{-- <button type="
button
" class="
btn
btn
-
info
" data-toggle="
modal
" data-target="
#update-modal{{$p->id}}"><i class="fa fa-check" aria-hidden="true"></i></button> --}}
<a href="
{{
route
(
'regenerateVa'
,
[
'id'
=>
$p
->
id
])}}
" type="
button
" class="
btn
btn
-
warning
"><i class="
fa
fa
-
refresh
" aria-hidden="
true
"></i> Re-Generate VA</a>
<button type="
button
" class="
btn
btn
-
primary
" data-toggle="
modal
" data-target="
#detail-modal{{$p->id}}"><i class="fa fa-search" aria-hidden="true"></i></button>
{{
--
<
button
type
=
"button"
class
="
btn
btn
-
danger
" data-toggle="
modal
" data-target="
#delete-modal{{$p->id}}"><i class="fa fa-trash" aria-hidden="true"></i></button> --}}
...
...
@@ -126,12 +126,12 @@
<div class="
col
-
6
mt
-
2
form
-
group
">
<label for="
nomor_registrasi
">Nomor Registrasi</label>
<input type="
text
" class="
form
-
control
" id="
nomor_registrasi
" name="
nomor_registrasi
" value="
{{
$p
->
kode_registrasi
}}
">
</div>
<div class="
col
-
6
mt
-
2
form
-
group
">
<label for="
nik
">NIK</label>
<input type="
number
" class="
form
-
control
" id="
nik
" name="
nik
" value="
{{
$p
->
nik
}}
">
</div>
</div>
<div class="
row
">
...
...
routes/web.php
View file @
43c47728
...
...
@@ -18,6 +18,7 @@
Route
::
get
(
'/individu'
,
[
RegistrasiController
::
class
,
'create'
])
->
name
(
'user.create'
);
Route
::
get
(
'/kelompok'
,
[
RegistrasiController
::
class
,
'group_create'
])
->
name
(
'group.create'
);
Route
::
get
(
'/regenerateVa/{id}'
,
[
RegistrasiController
::
class
,
'regenerateVa'
])
->
name
(
'regenerateVa'
);
// Route::get('/', function(Request $request){
// return view('penutupan');
// });
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment