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
8262df37
Commit
8262df37
authored
Jul 05, 2024
by
Triyah Fatmawati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Store Registrasi Kelompok
parent
8c72dafd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
62 deletions
+81
-62
app/Http/Controllers/RegistrasiController.php
+69
-53
resources/views/invoice.blade.php
+12
-9
No files found.
app/Http/Controllers/RegistrasiController.php
View file @
8262df37
...
...
@@ -132,6 +132,8 @@ public function preview(Request $request){
if
(
!
is_null
(
$request
->
data_registrasi
)){
$registrasi
=
json_decode
(
decrypt
(
$request
->
data_registrasi
),
true
);
$registrasi
[
'kode_registrasi'
]
=
$kode_registrasi
;
$registrasi
[
'urutan'
]
=
$urutan
;
}
else
{
$registrasi
=
[
...
...
@@ -215,7 +217,7 @@ public function preview(Request $request){
catch
(
Exception
$e
){
Log
::
error
(
$e
);
DB
::
rollBack
();
dd
(
$e
);
return
redirect
()
->
back
()
->
with
(
'error'
,
'Data failed to save'
);
}
...
...
@@ -223,7 +225,7 @@ public function preview(Request $request){
public
function
store
(
Request
$request
)
{
DB
::
beginTransaction
();
// dd($request);
try
{
$registrasi
=
json_decode
(
$request
->
registrasi
,
true
);
$kegiatanpeserta
=
json_decode
(
$request
->
kegiatanpeserta
,
true
);
...
...
@@ -232,22 +234,30 @@ public function store(Request $request) {
$anggota
=
json_decode
(
$request
->
anggota
,
true
);
$tglRegistrasi
=
$request
->
tglRegistrasi
;
// $totalHargas = $request->totalHarga;
$registrasi
=
Registrasi
::
query
()
->
create
(
$registrasi
);
$id_registrasi
=
$registrasi
->
id
;
$jumlahKeg
=
count
(
$kegiatanpeserta
);
//anggota
foreach
(
$anggota
as
$key
=>
$item
){
$anggota
[
$key
][
'id'
]
=
Str
::
uuid
()
->
toString
();
$anggota
[
$key
][
'id_registrasi'
]
=
$id_registrasi
;
$anggota
[
$key
][
'created_at'
]
=
Carbon
::
now
()
->
toDateTimeString
();
$anggota
[
$key
][
'updated_at'
]
=
Carbon
::
now
()
->
toDateTimeString
();
}
// Anggota::query()->insert($anggota);
// $registrasi = Registrasi::query()->create($registrasi);
// $id_registrasi = $registrasi->id;
$id_registrasi
=
'$registrasi->id'
;
$jumlahKeg
=
count
(
$kegiatanpeserta
);
// dd($anggota, $kegiatanpeserta);
Anggota
::
query
()
->
insert
(
$anggota
);
//inisial harga
$konvensi
=
Kegiatan
::
find
(
$konaspi
[
'id'
]);
$konv
=
$konvensi
->
toArray
();
$totalHarga
=
(
int
)
$konvensi
->
harga
;
$jumlahPeserta
=
count
(
$anggota
);
$totalHarga
=
((
int
)
$konvensi
->
harga
)
*
$jumlahPeserta
;
// dd($kegiatanpeserta, $totalHarga, $anggota, $registrasi['kode_registrasi']);
foreach
(
$kegiatanpeserta
as
$keg
){
// dd($kegiatanpeserta, $keg, $jumlahPeserta);
$arrayKeg
=
$keg
;
if
(
isset
(
$arrayKeg
[
'anggota'
][
'key'
])){
...
...
@@ -262,10 +272,10 @@ public function store(Request $request) {
'id_kegiatan'
=>
$keg
[
'id_kegiatan'
],
'id_konferensi'
=>
$keg
[
'id_konferensi'
],
'id_anggota'
=>
$idPeserta
// 'id_anggota' =>
];
dd
(
$kegpeserta
);
// KegiatanPeserta::query()->create($kegpeserta);
// dd($kegpeserta, $kegiatanpeserta);
KegiatanPeserta
::
query
()
->
create
(
$kegpeserta
);
// dd($kegpeserta, $kegiatanpeserta);
if
(
$keg
[
'id_kegiatan'
]
!=
'498633a9-082c-4a4a-9dbd-e20b678ec15e'
){
$konferensi
=
Konferensi
::
query
()
->
where
(
'id'
,
$keg
[
'id_konferensi'
])
->
first
();
...
...
@@ -278,39 +288,42 @@ public function store(Request $request) {
'hargakon'
=>
$konferensi
->
harga
,
'namakeg'
=>
$kegkonaspi
->
nama
];
// dd($kegPeserta);
}
else
{
$kegPeserta
=
null
;
}
}
dd
(
''
);
// dd($kegPeserta
);
$multipartData
=
[
'noid'
=>
$registrasi
[
'kode_registrasi'
],
'nama'
=>
$registrasi
[
'nama'
],
'tagihan'
=>
$totalHarga
];
// dd($kegPeserta, $multipartData);
$registrasi
->
save
();
$generatedVa
=
$this
->
generateVa
(
$multipartData
);
$arrResponse
=
json_decode
(
$generatedVa
,
true
);
$registrasi
->
status_va
=
$arrResponse
[
'BTNresponse'
];
$registrasi
->
tagihan
=
$totalHarga
;
$registrasi
->
nomor_va
=
$arrResponse
[
'BTNVirtualAccount'
];
// ditutup sementara
// $generatedVa = $this->generateVa($multipartData);
// $arrResponse = json_decode($generatedVa, true);
// $registrasi['status_va'] = $arrResponse['BTNresponse'];
$registrasi
[
'status_va'
]
=
'status_vA'
;
$registrasi
[
'tagihan'
]
=
$totalHarga
;
// $registrasi['nomor_va'] = $arrResponse['BTNVirtualAccount'];
$registrasi
[
'nomor_va'
]
=
$registrasi
[
'kode_registrasi'
];
$registrasi
->
save
();
// ditutup sementara
// if($arrResponse['BTNresponse'] != 'Request has been processed successfully'){
// DB::rollBack();
// Log::error('---');
// Log::error($multipartData);
// Log::error($arrResponse['BTNresponse']);
// Log::error('---');
if
(
$arrResponse
[
'BTNresponse'
]
!=
'Request has been processed successfully'
){
DB
::
rollBack
();
Log
::
error
(
'---'
);
Log
::
error
(
$multipartData
);
Log
::
error
(
$arrResponse
[
'BTNresponse'
]);
Log
::
error
(
'---'
);
return
redirect
()
->
route
(
'user.create'
)
->
with
(
'error'
,
'Data failed to save'
);
}
// return redirect()->route('user.create')
// ->with('error', 'Data failed to save');
// }
DB
::
commit
();
...
...
@@ -320,9 +333,11 @@ public function store(Request $request) {
'konaspi'
=>
$konv
,
'hargaKonferensi'
=>
$kegPeserta
,
'totalHarga'
=>
$totalHarga
,
'jumlah_peserta'
=>
$jumlahPeserta
,
'kegiatanpeserta'
=>
$kegiatanpeserta
];
SendMail
::
dispatch
(
$data
,
'email.invoice'
,
$data
[
'registrasi'
]
->
email
,
'registrasi'
,
'email_regis_sent_at'
);
SendMail
::
dispatch
(
$data
,
'email.invoice'
,
$data
[
'registrasi'
]
[
'email'
]
,
'registrasi'
,
'email_regis_sent_at'
);
return
view
(
'invoice'
,
$data
)
->
with
(
'success'
,
'Data saved successfully'
);
...
...
@@ -337,27 +352,28 @@ public function store(Request $request) {
->
with
(
'error'
,
'Data failed to save'
);
}
}
private
function
generateVa
(
$multipartData
)
{
$client
=
new
Client
();
$options
=
[
'form_params'
=>
[
// 'credential' => '$2a$08$xSX/XuObiJ3GoJWhjDTyXepT64o1ze.A/.OVYB15uzKW3V7pxgZ6O',
'credential'
=>
'$1$OkLGZt6i$FzuqzUwZ8nNS/xbzyPN/R/'
,
'noid'
=>
$multipartData
[
'noid'
],
'nama'
=>
$multipartData
[
'nama'
],
'tagihan'
=>
$multipartData
[
'tagihan'
],
'flag'
=>
'F'
,
'expired_date'
=>
'2024-08-01T23:59:59+07:00'
,
'deskripsi'
=>
'pembayaran konaspi'
]
];
$response
=
$client
->
request
(
'POST'
,
'https://neosidata.unesa.ac.id/btn_v2/create'
,
$options
);
return
$response
->
getBody
()
->
getContents
();
}
// ditutup sementara
// private function generateVa($multipartData)
// {
// $client = new Client();
// $options = [
// 'form_params' => [
// // 'credential' => '$2a$08$xSX/XuObiJ3GoJWhjDTyXepT64o1ze.A/.OVYB15uzKW3V7pxgZ6O',
// 'credential' => '$1$OkLGZt6i$FzuqzUwZ8nNS/xbzyPN/R/',
// 'noid' => $multipartData['noid'],
// 'nama' => $multipartData['nama'],
// 'tagihan' => $multipartData['tagihan'],
// 'flag' => 'F',
// 'expired_date' => '2024-08-01T23:59:59+07:00',
// 'deskripsi' => 'pembayaran konaspi'
// ]
// ];
// $response = $client->request('POST', 'https://neosidata.unesa.ac.id/btn_v2/create', $options);
// return $response->getBody()->getContents();
// }
private
function
getDataUniv
(){
$client
=
new
Client
();
...
...
resources/views/invoice.blade.php
View file @
8262df37
...
...
@@ -81,18 +81,21 @@
Convention
</td>
<td class="
text
-
center
">Rp
{
{$konaspi['harga']}
}
</td>
<td class="
text
-
center
">
1
</td>
<td class="
text
-
right
">Rp
{
{
$konaspi['harga']
}
}
</td>
<td class="
text
-
center
">
{{
$jumlah_peserta
}}
</td>
<td class="
text
-
right
">Rp {{
$totalHarga
}}</td>
</tr>
@if (isset(
$
hargaKonferensi
))
@foreach (
$
hargaKonferensi
as
$kon
)
@php
@if (isset(
$
kegiatanpeserta
))
@foreach (
$
kegiatanpeserta
as
$kon
)
{{--
@php
$subtotal
=
$subtotal
+
$kon['hargakon']
;
@endphp
@endphp
--}}
<tr>
<td>
{
{$no}
}
</td>
<td>
{
{$kon['namakeg']}
}
<br> Konferensi : <b>
{
{$kon['namakon']}
}
</b>
{
{$kon['nama_kegiatan']}
}
<br> Konferensi : <b>
{
{$kon['nama_konferensi']}
}
</b>
@isset(
$kon['anggota']['nama']
)
<br>Anggota : <b>{{
$kon['anggota']['nama']
}}</b>
@endisset
</td>
{{-- <td class="
text
-
center
">Rp
{
{$kon['hargakon']}
}
</td> --}}
<td class="
text
-
center
">-</td>
...
...
@@ -129,13 +132,13 @@
<div class="
invoice
-
detail
-
item
">
<div class="
invoice
-
detail
-
name
">Subtotal</div>
{{-- <div class="
invoice
-
detail
-
value
">Rp
{
{$subtotal}
}
</div> --}}
<div class="
invoice
-
detail
-
value
">Rp
{
{$
initialh
arga}
}
</div>
<div class="
invoice
-
detail
-
value
">Rp
{
{$
totalH
arga}
}
</div>
</div>
<hr class="
mt
-
2
mb
-
2
">
<div class="
invoice
-
detail
-
item
">
<div class="
invoice
-
detail
-
name
">Total</div>
{{-- <div class="
invoice
-
detail
-
value
invoice
-
detail
-
value
-
lg
">Rp
{
{$subtotal}
}
</div> --}}
<div class="
invoice
-
detail
-
value
invoice
-
detail
-
value
-
lg
">Rp
{
{$
initialh
arga}
}
</div>
<div class="
invoice
-
detail
-
value
invoice
-
detail
-
value
-
lg
">Rp
{
{$
totalH
arga}
}
</div>
</div>
</div>
</div>
...
...
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