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
7934d8fe
Commit
7934d8fe
authored
Mar 12, 2024
by
Triyah Fatmawati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add preview sebelum daftar
parent
bd469041
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
110 additions
and
63 deletions
+110
-63
app/Http/Controllers/Controller.php
+16
-0
app/Http/Controllers/RegistrasiController.php
+59
-34
composer.lock
+1
-1
resources/views/form_kegiatan.blade.php
+4
-4
resources/views/form_registrasi.blade.php
+5
-7
resources/views/invoice.blade.php
+24
-16
routes/web.php
+1
-1
No files found.
app/Http/Controllers/Controller.php
View file @
7934d8fe
...
...
@@ -5,8 +5,24 @@
use
Illuminate\Foundation\Auth\Access\AuthorizesRequests
;
use
Illuminate\Foundation\Validation\ValidatesRequests
;
use
Illuminate\Routing\Controller
as
BaseController
;
use
RealRashid\SweetAlert\Facades\Alert
;
class
Controller
extends
BaseController
{
use
AuthorizesRequests
,
ValidatesRequests
;
public
function
__construct
()
{
$this
->
middleware
(
function
(
$request
,
$next
){
if
(
session
(
'success'
))
{
Alert
::
success
(
session
(
'success'
));
}
if
(
session
(
'error'
))
{
Alert
::
error
(
session
(
'error'
));
}
return
$next
(
$request
);
});
}
}
app/Http/Controllers/RegistrasiController.php
View file @
7934d8fe
...
...
@@ -14,18 +14,19 @@
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\Log
;
use
RealRashid\SweetAlert\Facades\Alert
;
class
RegistrasiController
extends
Controller
{
public
function
create
(){
$kegiatan
=
Kegiatan
::
get
();
$kegiatan
=
Kegiatan
::
orderBy
(
'id'
)
->
get
();
$konferensi
=
Konferensi
::
get
();
$date
=
Date
(
'Y-m-d'
);
$lastKode
=
Registrasi
::
query
()
->
whereDate
(
'created_at'
,
$date
)
->
max
(
'kode_registrasi'
);
$nourut
=
sprintf
(
"%05s"
,
((
int
)
substr
(
$lastKode
,
-
5
))
+
1
);
$tgldaftar
=
Carbon
::
now
()
->
format
(
'd-m-Y'
);
$komponen
=
explode
(
'-'
,
$tgldaftar
);
$kode_registrasi
=
$komponen
[
0
]
.
$komponen
[
1
]
.
$nourut
;
//
$lastKode = Registrasi::query()->whereDate('created_at', $date)->max('kode_registrasi');
//
$nourut = sprintf("%05s", ((int) substr($lastKode, -5))+1);
//
$tgldaftar = Carbon::now()->format('d-m-Y');
//
$komponen = explode('-', $tgldaftar);
//
$kode_registrasi = $komponen[0].$komponen[1].$nourut;
$data
=
[
'kegiatan'
=>
$kegiatan
,
...
...
@@ -36,7 +37,7 @@ public function create(){
return
view
(
'form_registrasi'
,
$data
);
}
public
function
store
(
Request
$request
)
{
public
function
preview
(
Request
$request
)
{
$rules
=
[
'nama'
=>
'required|string'
,
'email'
=>
'required|email:rfc,dns'
,
...
...
@@ -73,11 +74,8 @@ public function store(Request $request) {
];
$tglRegistrasi
=
Carbon
::
now
()
->
format
(
'Y-m-d h:i:s'
);
// $kegiatan = Kegiatan::find($request->kegiatan);
// $konferensi = Konferensi::find($request->konferensi);
$konaspi
=
Kegiatan
::
query
()
->
where
(
'id'
,
'498633a9-082c-4a4a-9dbd-e20b678ec15e'
)
->
first
();
$registrasi
=
Registrasi
::
query
()
->
create
(
$registrasi
);
$id_registrasi
=
$registrasi
->
id
;
//inisial harga
$totalHarga
=
(
int
)
$konaspi
->
harga
;
...
...
@@ -93,7 +91,6 @@ public function store(Request $request) {
}
$kegiatanpeserta
[]
=
[
'id_registrasi'
=>
$id_registrasi
,
'id_kegiatan'
=>
$kegiatan
[
$i
][
'id'
],
'id_konferensi'
=>
$daftarKonferensi
[
$i
],
'nama_kegiatan'
=>
$kegiatan
[
$i
][
'nama'
],
...
...
@@ -111,30 +108,68 @@ public function store(Request $request) {
$totalHarga
+=
(
int
)
$konferensi
->
harga
;
$i
++
;
}
foreach
(
$kegiatanpeserta
as
$keg
){
KegiatanPeserta
::
query
()
->
create
(
$keg
);
}
}
else
{
$hargaKonferensi
=
null
;
$kegiatanpeserta
=
[
'id_registrasi'
=>
$id_registrasi
,
$kegiatanpeserta
[]
=
[
'id_kegiatan'
=>
$request
->
kegiatan0
[
0
],
'id_konferensi'
=>
null
,
];
KegiatanPeserta
::
query
()
->
create
(
$kegiatanpeserta
);
}
$data
=
[
'registrasi'
=>
$registrasi
,
'kegiatanpeserta'
=>
$kegiatanpeserta
,
'tglRegistrasi'
=>
$tglRegistrasi
,
'konaspi'
=>
$konaspi
,
'hargaKonferensi'
=>
$hargaKonferensi
,
'totalHarga'
=>
$totalHarga
];
return
view
(
'invoice'
,
$data
)
->
with
(
'success'
,
'Data saved successfully'
);
}
catch
(
Exception
$e
){
Log
::
error
(
$e
);
DB
::
rollBack
();
return
redirect
()
->
back
()
->
with
(
'error'
,
'Data failed to save'
);
}
}
public
function
store
(
Request
$request
)
{
DB
::
beginTransaction
();
try
{
$registrasi
=
json_decode
(
$request
->
registrasi
,
true
);
$kegiatanpeserta
=
json_decode
(
$request
->
kegiatanpeserta
,
true
);
$konaspi
=
json_decode
(
$request
->
konaspi
,
true
);
$hargaKonferensi
=
json_decode
(
$request
->
hargaKonferensi
,
true
);
$tglRegistrasi
=
$request
->
tglRegistrasi
;
$totalHarga
=
$request
->
totalHarga
;
$registrasi
=
Registrasi
::
query
()
->
create
(
$registrasi
);
$id_registrasi
=
$registrasi
->
id
;
$jumlahKeg
=
count
(
$kegiatanpeserta
);
foreach
(
$kegiatanpeserta
as
$keg
){
$kegpeserta
=
[
'id_registrasi'
=>
$id_registrasi
,
'id_kegiatan'
=>
$keg
[
'id_kegiatan'
],
'id_konferensi'
=>
$keg
[
'id_konferensi'
],
];
KegiatanPeserta
::
query
()
->
create
(
$kegpeserta
);
}
$multipartData
=
[
'noid'
=>
$
kode_registrasi
,
'nama'
=>
$re
quest
->
nama
,
'noid'
=>
$
registrasi
[
'kode_registrasi'
]
,
'nama'
=>
$re
gistrasi
[
'nama'
]
,
'tagihan'
=>
$totalHarga
];
$generatedVa
=
$this
->
generateVa
(
$multipartData
);
$arrResponse
=
json_decode
(
$generatedVa
,
true
);
$registrasi
->
status_va
=
$arrResponse
[
'BTNresponse'
];
$registrasi
->
tagihan
=
$totalHarga
;
...
...
@@ -153,24 +188,14 @@ public function store(Request $request) {
DB
::
commit
();
// return redirect()->back()
// ->with('success', 'Data saved successfully');
$data
=
[
'registrasi'
=>
$registrasi
,
'tglRegistrasi'
=>
$tglRegistrasi
,
'konaspi'
=>
$konaspi
,
'hargaKonferensi'
=>
$hargaKonferensi
];
return
view
(
'invoice'
,
$data
)
->
with
(
'success'
,
'Data saved successfully'
);
return
redirect
()
->
route
(
'user.create'
)
->
with
(
'success'
,
'Data saved successfully'
);
}
catch
(
Exception
$e
){
Log
::
error
(
$e
);
DB
::
rollBack
();
return
redirect
()
->
back
(
)
return
redirect
()
->
route
(
'user.create'
)
->
with
(
'error'
,
'Data failed to save'
);
}
}
...
...
composer.lock
View file @
7934d8fe
...
...
@@ -8812,5 +8812,5 @@
"php": "^8.1"
},
"platform-dev": [],
"plugin-api-version": "2.
3
.0"
"plugin-api-version": "2.
6
.0"
}
resources/views/form_kegiatan.blade.php
View file @
7934d8fe
...
...
@@ -11,14 +11,14 @@
@if ($i != 0)
@if ($keg->id != "498633a9-082c-4a4a-9dbd-e20b678ec15e")
<div
class=
"form-check"
>
<input
class=
"form-check-input"
type=
"radio"
id=
"nama-kegiatan-{{ $i }}-{{ $j }}"
name=
"kegiatan{{ $i }}[]"
value=
"{{ $keg->id }}"
onChange=
"cekKegiatan('nama-kegiatan-{{ $i }}-{{ $j }}')"
>
<label
class=
"form-check-label"
for=
"
{{ $keg->nama
}}"
>
{{ $keg->nama }}
</label>
<input
class=
"form-check-input"
type=
"radio"
id=
"nama-kegiatan-{{ $i }}-{{ $j }}"
name=
"kegiatan{{ $i }}[]"
value=
"{{ $keg->id }}"
onChange=
"cekKegiatan('nama-kegiatan-{{ $i }}-{{ $j }}')"
required
>
<label
class=
"form-check-label"
for=
"
nama-kegiatan-{{ $i }}-{{ $j
}}"
>
{{ $keg->nama }}
</label>
</div>
@endif
@else
<div
class=
"form-check"
>
<input
class=
"form-check-input"
type=
"radio"
id=
"nama-kegiatan-{{ $i }}-{{ $j }}"
name=
"kegiatan{{ $i }}[]"
value=
"{{ $keg->id }}"
onChange=
"cekKegiatan('nama-kegiatan-{{ $i }}-{{ $j }}')"
>
<label
class=
"form-check-label"
for=
"
{{ $keg->nama
}}"
>
{{ $keg->nama }}
</label>
<input
class=
"form-check-input"
type=
"radio"
id=
"nama-kegiatan-{{ $i }}-{{ $j }}"
name=
"kegiatan{{ $i }}[]"
value=
"{{ $keg->id }}"
onChange=
"cekKegiatan('nama-kegiatan-{{ $i }}-{{ $j }}')"
required
>
<label
class=
"form-check-label"
for=
"
nama-kegiatan-{{ $i }}-{{ $j
}}"
>
{{ $keg->nama }}
</label>
</div>
@endif
@endforeach
...
...
resources/views/form_registrasi.blade.php
View file @
7934d8fe
...
...
@@ -8,7 +8,7 @@
</div>
</div>
<form class="
needs
-
validation
" novalidate="" method="
POST
" action="
{{
route
(
'user.
store
'
)}}
" enctype="
multipart
/
form
-
data
">
<form class="
needs
-
validation
" novalidate="" method="
POST
" action="
{{
route
(
'user.
preview
'
)}}
" enctype="
multipart
/
form
-
data
">
<div class="
section
-
body
">
@csrf
<div class="
row
">
...
...
@@ -120,14 +120,14 @@
</div>
<hr>
<div class="
card
">
<div class="
card
-
body
">
{{--
<div class="
form
-
group
" @if (
$errors->has
('kode_registrasi')) has-error @endif>
{{--
<div class="
card
-
body
">
<div class="
form
-
group
" @if (
$errors->has
('kode_registrasi')) has-error @endif>
<label>Kode Registrasi</label>
<input type="
text
" id="
kode_registrasi
" name="
kode_registrasi
" class="
form
-
control
number
" required="
true
" placeholder="" value="
{{
$kode_registrasi
}}
">
@if (
$errors->has
('kode_registrasi'))
<label id="
login
-
error
" class="
error
" for="
kode_registrasi
" style="
color
:
red
">
{
{$errors->first('kode_registrasi')}
}
</label>
@endif
</div>
--}}
</div>
<div class="
form
-
group
" @if (
$errors->has
('biaya')) has-error @endif>
<label>Biaya Pendaftaran</label>
<input type="
text
" id="
biaya
" name="
biaya
" class="
form
-
control
number
" required="
true
" placeholder="" value="
{{
old
(
'biaya'
)}}
" disabled>
...
...
@@ -135,7 +135,7 @@
<label id="
login
-
error
" class="
error
" for="
biaya
" style="
color
:
red
">
{
{$errors->first('biaya')}
}
</label>
@endif
</div>
</div>
</div>
--}}
</div>
</div>
</div>
...
...
@@ -197,8 +197,6 @@ function hapusKegiatan(id){
$('#'+id).remove();
}
function cekHarga(){
console.log('masuk');
}
</script>
@endpush
resources/views/invoice.blade.php
View file @
7934d8fe
@
extends
(
'layouts.app'
)
@
section
(
'title'
,
'
Tabel Data
'
)
@
section
(
'title'
,
'
Invoice
'
)
@
section
(
'content'
)
<
section
class
="
section
">
<div class="
section
-
header
">
...
...
@@ -10,9 +10,9 @@
<div class="
breadcrumb
-
item
active
">Invoice</div>
</div>
</div>
<form novalidate="" method="
POST
" action="
{{
route
(
'user.store'
)}}
" enctype="
multipart
/
form
-
data
">
@csrf
<div class="
section
-
body
">
{{-- @foreach (
$pengajuan
as
$tr
) --}}
<div class="
invoice
">
<div class="
invoice
-
print
">
<div class="
row
">
...
...
@@ -22,7 +22,7 @@
<div class="
invoice
-
number
">No. Transaksi #
{
{$registrasi['kode_registrasi']}
}
</div>
</div>
<hr>
<div class="
row
">
<div class="
row
" style="
font
-
size
:
12
pt
">
<div class="
col
-
md
-
6
">
<address>
<strong>Identitas:</strong><br>
...
...
@@ -38,11 +38,11 @@
</address>
</div>
</div>
<div class="
row
">
<div class="
row
" style="
font
-
size
:
12
pt
">
<div class="
col
-
md
-
6
">
<address>
<strong>Metode Pembayaran:</strong><br>
Virtual Account :
<br>
Virtual Account :
{
{$registrasi['kode_registrasi']}
}
<br>
{{--
{
{$registrasi['email']}
}
--}}
</address>
</div>
...
...
@@ -57,7 +57,7 @@
</div>
<div class="
row
mt
-
4
">
<div class="
col
-
md
-
12
">
<div class="
col
-
md
-
12
" style="
font
-
size
:
12
pt
">
<div class="
section
-
title
">Rincian</div>
<p class="
section
-
lead
">Rincian registrasi sudah tidak bisa diubah</p>
<div class="
table
-
responsive
">
...
...
@@ -108,14 +108,14 @@
</div>
<div class="
row
mt
-
4
">
<div class="
col
-
lg
-
8
">
<div class="
section
-
title
">Payment Method
</div>
<p class="
section
-
lead
">The payment method that we provide is to make it easier for you to pay invoices.
</p>
<div class="
d
-
flex
">
<div class="
section
-
title
">Metode Pembayaran
</div>
<p class="
section
-
lead
" style="
font
-
size
:
12
pt
">Setelah menekan tombol bayar, maka data akan tersimpan dan lakukan pembayaran tagihan menggunakan <b>Nomor Virtual Account</b> yang tertera pada <b>Invoice</b> ini
</p>
{{--
<div class="
d
-
flex
">
<div class="
mr
-
2
bg
-
visa
" data-width="
61
" data-height="
38
"></div>
<div class="
mr
-
2
bg
-
jcb
" data-width="
61
" data-height="
38
"></div>
<div class="
mr
-
2
bg
-
mastercard
" data-width="
61
" data-height="
38
"></div>
<div class="
bg
-
paypal
" data-width="
61
" data-height="
38
"></div>
</div>
</div> --}}
</div>
<div class="
col
-
lg
-
4
text
-
right
">
<div class="
invoice
-
detail
-
item
">
...
...
@@ -134,15 +134,23 @@
</div>
<hr>
<div class="
text
-
md
-
right
">
<div class="
float
-
lg
-
left
mb
-
lg
-
0
mb
-
3
">
{{--
<div class="
float
-
lg
-
left
mb
-
lg
-
0
mb
-
3
">
<button class="
btn
btn
-
primary
btn
-
icon
icon
-
left
"><i class="
fas
fa
-
credit
-
card
"></i> Bayar</button>
<button class="
btn
btn
-
danger
btn
-
icon
icon
-
left
"><i class="
fas
fa
-
times
"></i> Cancel</button>
</div>
<button class="
btn
btn
-
warning
btn
-
icon
icon
-
left
"><i class="
fas
fa
-
print
"></i> Cetak</button>
</div> --}}
{{-- <button class="
btn
btn
-
warning
btn
-
icon
icon
-
left
"><i class="
fas
fa
-
print
"></i> Cetak</button> --}}
<input type="
hidden
" id="
registrasi
" name="
registrasi
" value="
{{
json_encode
(
$registrasi
)
}}
">
<input type="
hidden
" id="
kegiatanpeserta
" name="
kegiatanpeserta
" value="
{{
json_encode
(
$kegiatanpeserta
)
}}
">
<input type="
hidden
" id="
tglRegistrasi
" name="
tglRegistrasi
" value="
{{
json_encode
(
$tglRegistrasi
)
}}
">
<input type="
hidden
" id="
konaspi
" name="
konaspi
" value="
{{
json_encode
(
$konaspi
)
}}
">
<input type="
hidden
" id="
hargaKonferensi
" name="
hargaKonferensi
" value="
{{
json_encode
(
$hargaKonferensi
)
}}
">
<input type="
hidden
" id="
totalHarga
" name="
totalHarga
" value="
{{
json_encode
(
$totalHarga
)
}}
">
<button type="
submit
" class="
btn
btn
-
primary
btn
-
icon
icon
-
left
"><i class="
fas
fa
-
credit
-
card
"></i> Bayar</button>
<button class="
btn
btn
-
danger
btn
-
icon
icon
-
left
"><i class="
fas
fa
-
times
"></i> Cancel</button>
</div>
</div>
{{-- @endforeach --}}
</div>
</section>
</form>
</section>
@endsection
routes/web.php
View file @
7934d8fe
...
...
@@ -17,7 +17,7 @@
Route
::
get
(
'/'
,
[
RegistrasiController
::
class
,
'create'
])
->
name
(
'user.create'
);
Route
::
post
(
'/store'
,
[
RegistrasiController
::
class
,
'store'
])
->
name
(
'user.store'
);
Route
::
get
(
'/cekHarga'
,
[
RegistrasiController
::
class
,
'cekHarga'
])
->
name
(
'user.cekharga
'
);
Route
::
post
(
'/preview'
,
[
RegistrasiController
::
class
,
'preview'
])
->
name
(
'user.preview
'
);
Route
::
get
(
'/home'
,
[
AdminController
::
class
,
'index'
])
->
name
(
'admin.home'
);
...
...
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