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
1998f752
Commit
1998f752
authored
Mar 08, 2024
by
Triyah Fatmawati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Perbaikan insert data
parent
b77dc531
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
122 additions
and
66 deletions
+122
-66
app/Http/Controllers/RegistrasiController.php
+51
-34
resources/views/form_kegiatan.blade.php
+25
-10
resources/views/form_registrasi.blade.php
+15
-4
resources/views/invoice.blade.php
+30
-18
routes/web.php
+1
-0
No files found.
app/Http/Controllers/RegistrasiController.php
View file @
1998f752
...
...
@@ -18,23 +18,19 @@
class
RegistrasiController
extends
Controller
{
public
function
create
(){
// $jumlahPendaftar = Registrasi::count();
// $nourut = sprintf("%05s", $jumlahPendaftar+1);
// $koderegistrasi = 'REG-'.$komponen[0].$komponen[1].$komponen[2].$nourut;
$kegiatan
=
Kegiatan
::
get
();
$konferensi
=
Konferensi
::
get
();
$date
=
Date
(
'Y-m-d'
);
$lastKode
=
Registrasi
::
query
()
->
whereDate
(
'created_at'
,
$date
)
->
max
(
'kode_registrasi'
);
$nourut
=
sprintf
(
"%05s"
,
substr
(
$lastKode
,
-
5
)
+
1
);
$nourut
=
sprintf
(
"%05s"
,
((
int
)
substr
(
$lastKode
,
-
5
)
)
+
1
);
$tgldaftar
=
Carbon
::
now
()
->
format
(
'd-m-Y'
);
$komponen
=
explode
(
'-'
,
$tgldaftar
);
$kode
registrasi
=
'-'
;
$kode
_registrasi
=
$komponen
[
0
]
.
$komponen
[
1
]
.
$nourut
;
$data
=
[
'kegiatan'
=>
$kegiatan
,
'konferensi'
=>
$konferensi
,
'kode_registrasi'
=>
$kode
registrasi
// 'kode_registrasi' => $kode_
registrasi
];
return
view
(
'form_registrasi'
,
$data
);
...
...
@@ -50,7 +46,6 @@ public function store(Request $request) {
'alamat'
=>
'required|string'
,
'kodepos'
=>
'required|string'
,
'kota'
=>
'required|string'
,
'kode_registrasi'
=>
'required'
];
$request
->
validate
(
$rules
,
ValidationRule
::
getErrorMessage
(
$rules
));
...
...
@@ -60,7 +55,7 @@ public function store(Request $request) {
try
{
$date
=
Date
(
'Y-m-d'
);
$lastKode
=
Registrasi
::
query
()
->
whereDate
(
'created_at'
,
$date
)
->
max
(
'kode_registrasi'
);
$nourut
=
sprintf
(
"%05s"
,
substr
(
$lastKode
,
-
5
)
+
1
);
$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
;
...
...
@@ -84,30 +79,51 @@ public function store(Request $request) {
$registrasi
=
Registrasi
::
query
()
->
create
(
$registrasi
);
$id_registrasi
=
$registrasi
->
id
;
//inisial harga
// dd($konaspi);
$totalHarga
=
(
int
)
$konaspi
->
harga
;
foreach
(
$request
->
konferensi
as
$kon
){
if
(
$request
->
konferensi
[
0
]
!=
null
||
$request
->
kegiatan0
[
0
]
!=
"498633a9-082c-4a4a-9dbd-e20b678ec15e"
){
$i
=
0
;
$daftarKonferensi
[]
=
$kon
;
$konferensi
=
Konferensi
::
query
()
->
where
(
'id'
,
$kon
)
->
first
();
foreach
(
$request
->
input
(
'kegiatan'
.
$i
)
as
$keg
){
$daftarKegiatan
[]
=
$keg
;
$kegiatan
[]
=
Kegiatan
::
select
(
'nama'
,
'harga'
)
->
where
(
'id'
,
$keg
)
->
first
();
foreach
(
$request
->
konferensi
as
$kon
){
$daftarKonferensi
[]
=
$kon
;
$konferensi
=
Konferensi
::
query
()
->
where
(
'id'
,
$kon
)
->
first
();
foreach
(
$request
->
input
(
'kegiatan'
.
$i
)
as
$keg
){
$daftarKegiatan
[]
=
$keg
;
$kegiatan
[]
=
Kegiatan
::
select
(
'id'
,
'nama'
,
'harga'
)
->
where
(
'id'
,
$keg
)
->
first
();
}
$kegiatanpeserta
[]
=
[
'id_registrasi'
=>
$id_registrasi
,
'id_kegiatan'
=>
$kegiatan
[
$i
][
'id'
],
'id_konferensi'
=>
$daftarKonferensi
[
$i
],
'nama_kegiatan'
=>
$kegiatan
[
$i
][
'nama'
],
'nama_konferensi'
=>
$konferensi
->
nama
,
'harga'
=>
$kegiatan
[
$i
][
'harga'
]
];
$hargaKonferensi
[]
=
[
'idkon'
=>
$konferensi
->
id
,
'namakon'
=>
$konferensi
->
nama
,
'hargakon'
=>
$konferensi
->
harga
,
'namakeg'
=>
$kegiatan
[
$i
][
'nama'
]
];
$totalHarga
+=
(
int
)
$konferensi
->
harga
;
$i
++
;
}
$kegiatanpeserta
[]
=
[
foreach
(
$kegiatanpeserta
as
$keg
){
KegiatanPeserta
::
query
()
->
create
(
$keg
);
}
}
else
{
$hargaKonferensi
=
null
;
$kegiatanpeserta
=
[
'id_registrasi'
=>
$id_registrasi
,
'id_kegiatan'
=>
$kon
,
'id_konferensi'
=>
$daftarKonferensi
[
$i
],
'nama_kegiatan'
=>
$kegiatan
[
$i
][
'nama'
],
'nama_konferensi'
=>
$konferensi
->
nama
,
'harga'
=>
$kegiatan
[
$i
][
'harga'
]
'id_kegiatan'
=>
$request
->
kegiatan0
[
0
],
'id_konferensi'
=>
null
,
];
$totalHarga
+=
(
int
)
$konferensi
->
harga
;
$i
++
;
KegiatanPeserta
::
query
()
->
create
(
$kegiatanpeserta
);
}
$multipartData
=
[
...
...
@@ -135,17 +151,19 @@ public function store(Request $request) {
->
with
(
'error'
,
'Data failed to save'
);
}
foreach
(
$kegiatanpeserta
as
$keg
){
KegiatanPeserta
::
query
()
->
create
(
$keg
);
}
DB
::
commit
();
// return redirect()->back()
// ->with('success', 'Data saved successfully');
// dd($kegiatanpeserta);
return
view
(
'invoice'
,
compact
(
'registrasi'
,
'tglRegistrasi'
,
'kegiatanpeserta'
))
->
with
(
'success'
,
'Data saved successfully'
);
$data
=
[
'registrasi'
=>
$registrasi
,
'tglRegistrasi'
=>
$tglRegistrasi
,
'konaspi'
=>
$konaspi
,
'hargaKonferensi'
=>
$hargaKonferensi
];
return
view
(
'invoice'
,
$data
)
->
with
(
'success'
,
'Data saved successfully'
);
}
catch
(
Exception
$e
){
...
...
@@ -155,7 +173,6 @@ public function store(Request $request) {
return
redirect
()
->
back
()
->
with
(
'error'
,
'Data failed to save'
);
}
}
private
function
generateVa
(
$multipartData
)
...
...
resources/views/form_kegiatan.blade.php
View file @
1998f752
<div
class=
"col-md-12"
id=
"kegiatan-{{ $i }}"
>
<div
class=
"card"
>
<div
class=
"card-body"
>
<div
class=
"form-group"
id =
"list-kegiatan"
@
if
($
errors-
>
has('
thematic_workshop
')) has-error @endif>
<div
class=
"form-group"
id =
"list-kegiatan"
@
if
($
errors-
>
has('
nama-kegiatan-
')) has-error @endif>
<label>
Kegiatan
</label>
<label>
Untuk kegiatan konferensi bisa memilih lebih dari satu
</label>
@foreach ($kegiatan as $j=>$keg)
<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>
</div>
@php
$idkeg = $keg->id;
@endphp
@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>
</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>
</div>
@endif
@endforeach
</div>
<div
class=
"form-group"
id=
"grup-konferensi"
@
if
($
errors-
>
has('
profil
')) has-error @endif>
<div
class=
"form-group"
id=
"grup-konferensi"
@
if
($
errors-
>
has('
konferensi
')) has-error @endif>
<label>
Konferensi
</label>
<select
class=
"form-control"
id=
"konferensi"
name=
"konferensi[]"
required=
"true"
placeholder=
""
>
<select
class=
"form-control"
id=
"konferensi"
name=
"konferensi[]"
placeholder=
""
>
<option
value=
""
selected
>
- Pilih -
</option>
@foreach ($konferensi as $kon)
<option
onchange=
"cek(this.value)"
value=
"{{ $kon->id }}"
>
{{ $kon->nama }}
</option>
...
...
@@ -22,9 +35,11 @@
<label
id=
"login-error"
class=
"error"
for=
"konferensi"
style=
"color: red"
>
{{$errors->first('konferensi')}}
</label>
@endif
</div>
<div
class=
"col-md-4 float-right"
>
<button
class=
"btn btn-danger"
type=
"button"
onclick=
"hapusKegiatan('kegiatan-{{ $i }}')"
>
Hapus
</button>
</div>
@if ($i != 0)
<div
class=
"col-md-4 float-right"
>
<button
class=
"btn btn-danger"
type=
"button"
onclick=
"hapusKegiatan('kegiatan-{{ $i }}')"
>
Hapus
</button>
</div>
@endif
</div>
</div>
</div>
resources/views/form_registrasi.blade.php
View file @
1998f752
...
...
@@ -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
">
...
...
@@ -116,17 +116,18 @@
]) }}
</div>
<div>
<button type="
button
" class="
btn
btn
-
primary
" onclick="
tambahKegiatan
()
">Tambah kegiatan</button>
<button type="
button
" class="
btn
btn
-
primary
" onclick="
tambahKegiatan
()
"
name="
tambah
-
kegiatan
" id="
tambah
-
kegiatan
"
>Tambah kegiatan</button>
</div>
<hr>
<div class="
card
">
<div class="
card
-
body
">
<div class="
form
-
group
" @if (
$errors->has
('kode_registrasi')) has-error @endif>
{{--
<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>
...
...
@@ -153,8 +154,14 @@ function cekKegiatan(id){
var value = document.getElementById(id).value;
if(value == '498633a9-082c-4a4a-9dbd-e20b678ec15e'){
$('#grup-konferensi').hide();
$('#tambah-kegiatan').hide();
var konferensi = document.getElementById("
konferensi
");
konferensi.required = false;
} else {
$('#grup-konferensi').show();
$('#tambah-kegiatan').show();
var konferensi = document.getElementById("
konferensi
");
konferensi.required = true;
}
}
...
...
@@ -189,5 +196,9 @@ function tambahKegiatan(){
function hapusKegiatan(id){
$('#'+id).remove();
}
function cekHarga(){
console.log('masuk');
}
</script>
@endpush
resources/views/invoice.blade.php
View file @
1998f752
...
...
@@ -42,8 +42,8 @@
<div class="
col
-
md
-
6
">
<address>
<strong>Metode Pembayaran:</strong><br>
Vi
sa ending **** 4242
<br>
{
{
$registrasi['email']
}
}
Vi
rtual Account :
<br>
{{
--
{
{$registrasi['email']}
}
--
}}
</address>
</div>
<div class="
col
-
md
-
6
text
-
md
-
right
">
...
...
@@ -70,28 +70,40 @@
<th class="
text
-
right
">Total Harga</th>
</tr>
@php
$no
= 1;
$subtotal
= 0;
$no
= 2;
$initialharga
=
$konaspi->harga
;
$subtotal
=
$initialharga
;
$i
= 0;
@endphp
@foreach (
$kegiatanpeserta
as
$keg
)
@php
$subtotal
=
$subtotal
+
$keg['harga']
;
@endphp
<tr>
<td>1</td>
<td>
{
{$keg['nama_kegiatan']}
}
<br> Konferensi : <b>
{
{$keg['nama_konferensi']}
}
</b>
Convention
</td>
<td class="
text
-
center
">Rp
{
{$k
eg['harga']
}
}
</td>
<td class="
text
-
center
">Rp
{
{$k
onaspi->harga
}
}
</td>
<td class="
text
-
center
">1</td>
<td class="
text
-
right
">Rp
{
{$k
eg['harga']
}
}
</td>
<td class="
text
-
right
">Rp
{
{$k
onaspi->harga
}
}
</td>
</tr>
@php
$i
++;
$no
++;
@endphp
@endforeach
@if (isset(
$hargaKonferensi
))
@foreach (
$hargaKonferensi
as
$kon
)
@php
$subtotal
=
$subtotal
+
$kon['hargakon']
;
@endphp
<tr>
<td>
{
{$no}
}
</td>
<td>
{
{$kon['namakeg']}
}
<br> Konferensi : <b>
{
{$kon['namakon']}
}
</b>
</td>
<td class="
text
-
center
">Rp
{
{$kon['hargakon']}
}
</td>
<td class="
text
-
center
">1</td>
<td class="
text
-
right
">Rp
{
{$kon['hargakon']}
}
</td>
</tr>
@php
$i
++;
$no
++;
@endphp
@endforeach
@endif
</table>
</div>
<div class="
row
mt
-
4
">
...
...
@@ -123,10 +135,10 @@
<hr>
<div class="
text
-
md
-
right
">
<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>
Process Payment
</button>
<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>
Print
</button>
<button class="
btn
btn
-
warning
btn
-
icon
icon
-
left
"><i class="
fas
fa
-
print
"></i>
Cetak
</button>
</div>
</div>
{{-- @endforeach --}}
...
...
routes/web.php
View file @
1998f752
...
...
@@ -17,6 +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
::
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