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
8c72dafd
Commit
8c72dafd
authored
Jul 01, 2024
by
Muhammad Iskandar Java
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add anggota
parent
7a5e1c7e
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
330 additions
and
124 deletions
+330
-124
app/Http/Controllers/RegistrasiController.php
+99
-40
app/Models/Anggota.php
+24
-0
app/Models/KegiatanPeserta.php
+2
-1
resources/views/form_kegiatan.blade.php
+20
-3
resources/views/form_kegiatan_kelompok.blade.php
+145
-75
resources/views/preview.blade.php
+12
-5
resources/views/row_anggota.blade.php
+28
-0
No files found.
app/Http/Controllers/RegistrasiController.php
View file @
8c72dafd
...
...
@@ -4,6 +4,7 @@
use
App\Http\Support\ValidationRule
;
use
App\Jobs\SendMail
;
use
App\Models\Anggota
;
use
App\Models\Kegiatan
;
use
App\Models\KegiatanPeserta
;
use
App\Models\Konferensi
;
...
...
@@ -17,6 +18,7 @@
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\Log
;
use
RealRashid\SweetAlert\Facades\Alert
;
use
Str
;
class
RegistrasiController
extends
Controller
{
...
...
@@ -70,18 +72,6 @@ public function group_create(){
}
public
function
group_kegiatan
(
Request
$request
){
$kegiatan
=
Kegiatan
::
orderBy
(
'id'
)
->
get
();
$konferensi
=
Konferensi
::
get
();
$data
=
[
'kegiatan'
=>
$kegiatan
,
'konferensi'
=>
$konferensi
];
return
view
(
'form_kegiatan_kelompok'
,
$data
);
}
public
function
preview
(
Request
$request
){
$rules
=
[
'nama'
=>
'required|string'
,
'email'
=>
'required|email:rfc,dns'
,
...
...
@@ -91,10 +81,40 @@ public function preview(Request $request){
'alamat'
=>
'required|string'
,
'kodepos'
=>
'required|string'
,
'kota'
=>
'required|string'
,
'nik'
=>
'required|unique:registrasi,nik'
];
$request
->
validate
(
$rules
,
ValidationRule
::
getErrorMessage
(
$rules
));
$kegiatan
=
Kegiatan
::
orderBy
(
'id'
)
->
get
();
$konferensi
=
Konferensi
::
get
();
$data
=
[
'kegiatan'
=>
$kegiatan
,
'konferensi'
=>
$konferensi
,
'data_registrasi'
=>
$request
->
except
(
'_token'
),
];
return
view
(
'form_kegiatan_kelompok'
,
$data
);
}
public
function
preview
(
Request
$request
){
//cek jika kelompok atau tidak
if
(
is_null
(
$request
->
data_registrasi
)){
$rules
=
[
'nama'
=>
'required|string'
,
'email'
=>
'required|email:rfc,dns'
,
'telepon'
=>
'required|numeric'
,
'instansi'
=>
'required|string'
,
'jabatan'
=>
'required|string'
,
'alamat'
=>
'required|string'
,
'kodepos'
=>
'required|string'
,
'kota'
=>
'required|string'
,
];
$request
->
validate
(
$rules
,
ValidationRule
::
getErrorMessage
(
$rules
));
}
DB
::
beginTransaction
();
try
{
...
...
@@ -110,19 +130,24 @@ public function preview(Request $request){
$nourut
=
sprintf
(
"%05s"
,
$urutan
);
$kode_registrasi
=
$nourut
;
$registrasi
=
[
'nama'
=>
strip_tags
(
$request
->
nama
),
'email'
=>
strip_tags
(
$request
->
email
),
'telepon'
=>
strip_tags
(
$request
->
telepon
),
'instansi'
=>
strip_tags
(
$request
->
instansi
),
'jabatan'
=>
strip_tags
(
$request
->
jabatan
),
'alamat'
=>
strip_tags
(
$request
->
alamat
),
'kode_pos'
=>
strip_tags
(
$request
->
kodepos
),
'kota'
=>
strip_tags
(
$request
->
kota
),
'kode_registrasi'
=>
strip_tags
(
$kode_registrasi
),
'urutan'
=>
$urutan
,
'nik'
=>
strip_tags
(
$request
->
nik
)
];
if
(
!
is_null
(
$request
->
data_registrasi
)){
$registrasi
=
json_decode
(
decrypt
(
$request
->
data_registrasi
),
true
);
}
else
{
$registrasi
=
[
'nama'
=>
strip_tags
(
$request
->
nama
),
'email'
=>
strip_tags
(
$request
->
email
),
'telepon'
=>
strip_tags
(
$request
->
telepon
),
'instansi'
=>
strip_tags
(
$request
->
instansi
),
'jabatan'
=>
strip_tags
(
$request
->
jabatan
),
'alamat'
=>
strip_tags
(
$request
->
alamat
),
'kode_pos'
=>
strip_tags
(
$request
->
kodepos
),
'kota'
=>
strip_tags
(
$request
->
kota
),
'kode_registrasi'
=>
strip_tags
(
$kode_registrasi
),
'urutan'
=>
$urutan
,
'nik'
=>
strip_tags
(
$request
->
nik
)
];
}
$tglRegistrasi
=
Carbon
::
now
()
->
format
(
'Y-m-d h:i:s'
);
$konaspi
=
Kegiatan
::
query
()
->
where
(
'id'
,
'498633a9-082c-4a4a-9dbd-e20b678ec15e'
)
->
first
();
...
...
@@ -130,15 +155,19 @@ public function preview(Request $request){
//inisial harga
$totalHarga
=
(
int
)
$konaspi
->
harga
;
if
(
$request
->
konferensi
[
0
]
!=
null
||
$request
->
kegiatan
0
[
0
]
!=
"498633a9-082c-4a4a-9dbd-e20b678ec15e"
){
if
(
$request
->
konferensi
[
0
]
!=
null
||
$request
->
kegiatan
[
0
]
!=
"498633a9-082c-4a4a-9dbd-e20b678ec15e"
){
$i
=
0
;
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
();
$daftarKegiatan
[]
=
$request
->
kegiatan
[
$i
];
$kegiatan
[]
=
Kegiatan
::
select
(
'id'
,
'nama'
,
'harga'
)
->
where
(
'id'
,
$request
->
kegiatan
[
$i
])
->
first
();
$indexAnggota
=
isset
(
$request
->
kegiatan_anggota
[
$i
])
?
$request
->
kegiatan_anggota
[
$i
]
:
null
;
$kegiatanAnggota
=
!
is_null
(
$indexAnggota
)
?
$request
->
anggota
[
$indexAnggota
]
:
[];
if
(
!
empty
(
$kegiatanAnggota
)){
$kegiatanAnggota
[
'key'
]
=
$request
->
kegiatan_anggota
[
$i
];
}
$kegiatanpeserta
[]
=
[
...
...
@@ -146,14 +175,16 @@ public function preview(Request $request){
'id_konferensi'
=>
$daftarKonferensi
[
$i
],
'nama_kegiatan'
=>
$kegiatan
[
$i
][
'nama'
],
'nama_konferensi'
=>
$konferensi
->
nama
,
'harga'
=>
$kegiatan
[
$i
][
'harga'
]
'harga'
=>
$kegiatan
[
$i
][
'harga'
],
'anggota'
=>
$kegiatanAnggota
];
$hargaKonferensi
[]
=
[
'idkon'
=>
$konferensi
->
id
,
'namakon'
=>
$konferensi
->
nama
,
'hargakon'
=>
$konferensi
->
harga
,
'namakeg'
=>
$kegiatan
[
$i
][
'nama'
]
'namakeg'
=>
$kegiatan
[
$i
][
'nama'
],
'anggota'
=>
$kegiatanAnggota
];
// $totalHarga += (int) $konferensi->harga;
...
...
@@ -174,7 +205,8 @@ public function preview(Request $request){
'tglRegistrasi'
=>
$tglRegistrasi
,
'konaspi'
=>
$konaspi
,
'hargaKonferensi'
=>
$hargaKonferensi
,
'totalHarga'
=>
$totalHarga
'totalHarga'
=>
$totalHarga
,
'anggota'
=>
$request
->
anggota
??
[],
];
return
view
(
'preview'
,
$data
)
->
with
(
'success'
,
'Data saved successfully'
);
...
...
@@ -183,8 +215,8 @@ public function preview(Request $request){
catch
(
Exception
$e
){
Log
::
error
(
$e
);
DB
::
rollBack
();
return
redirect
()
->
route
(
'user.create'
)
dd
(
$e
);
return
redirect
()
->
back
(
)
->
with
(
'error'
,
'Data failed to save'
);
}
}
...
...
@@ -197,11 +229,17 @@ public function store(Request $request) {
$kegiatanpeserta
=
json_decode
(
$request
->
kegiatanpeserta
,
true
);
$konaspi
=
json_decode
(
$request
->
konaspi
,
true
);
$hargaKonferensi
=
json_decode
(
$request
->
hargaKonferensi
,
true
);
$anggota
=
json_decode
(
$request
->
anggota
,
true
);
$tglRegistrasi
=
$request
->
tglRegistrasi
;
// $totalHargas = $request->totalHarga;
foreach
(
$anggota
as
$key
=>
$item
){
$anggota
[
$key
][
'id'
]
=
Str
::
uuid
()
->
toString
();
}
// Anggota::query()->insert($anggota);
$registrasi
=
Registrasi
::
query
()
->
create
(
$registrasi
);
$id_registrasi
=
$registrasi
->
id
;
// $registrasi = Registrasi::query()->create($registrasi);
// $id_registrasi = $registrasi->id;
$id_registrasi
=
'$registrasi->id'
;
$jumlahKeg
=
count
(
$kegiatanpeserta
);
//inisial harga
...
...
@@ -210,12 +248,24 @@ public function store(Request $request) {
$totalHarga
=
(
int
)
$konvensi
->
harga
;
foreach
(
$kegiatanpeserta
as
$keg
){
$arrayKeg
=
$keg
;
if
(
isset
(
$arrayKeg
[
'anggota'
][
'key'
])){
$idPeserta
=
isset
(
$anggota
[
$arrayKeg
[
'anggota'
][
'key'
]][
'id'
])
?
$anggota
[
$keg
[
'anggota'
][
'key'
]][
'id'
]
:
null
;
}
else
{
$idPeserta
=
null
;
}
$kegpeserta
=
[
'id_registrasi'
=>
$id_registrasi
,
'id_kegiatan'
=>
$keg
[
'id_kegiatan'
],
'id_konferensi'
=>
$keg
[
'id_konferensi'
],
'id_anggota'
=>
$idPeserta
// 'id_anggota' =>
];
KegiatanPeserta
::
query
()
->
create
(
$kegpeserta
);
dd
(
$kegpeserta
);
// KegiatanPeserta::query()->create($kegpeserta);
if
(
$keg
[
'id_kegiatan'
]
!=
'498633a9-082c-4a4a-9dbd-e20b678ec15e'
){
$konferensi
=
Konferensi
::
query
()
->
where
(
'id'
,
$keg
[
'id_konferensi'
])
->
first
();
...
...
@@ -233,7 +283,7 @@ public function store(Request $request) {
$kegPeserta
=
null
;
}
}
dd
(
''
);
$multipartData
=
[
'noid'
=>
$registrasi
[
'kode_registrasi'
],
'nama'
=>
$registrasi
[
'nama'
],
...
...
@@ -281,6 +331,8 @@ public function store(Request $request) {
Log
::
error
(
$e
);
DB
::
rollBack
();
dd
(
$e
);
return
redirect
()
->
route
(
'user.create'
)
->
with
(
'error'
,
'Data failed to save'
);
}
...
...
@@ -319,16 +371,23 @@ public function addFormKegiatan(Request $request)
$data
[
'kegiatan'
]
=
Kegiatan
::
get
();
$data
[
'konferensi'
]
=
Konferensi
::
get
();
$data
[
'i'
]
=
$request
->
i
;
$data
[
'anggota'
]
=
$request
->
anggota
;
$data
[
'list_anggota'
]
=
$request
->
list_anggota
;
return
view
(
'form_kegiatan'
,
$data
);
}
public
function
addFormAnggota
(
Request
$request
)
{
$data
[
'i'
]
=
$request
->
i
;
$data
[
'item'
]
=
[
'nama'
=>
$request
->
nama
,
'email'
=>
$request
->
email
,
'nik'
=>
$request
->
nik
,
'telepon'
=>
$request
->
telepon
,
];
return
view
(
'
form_anggota_kelompok
'
,
$data
);
return
view
(
'
row_anggota
'
,
$data
);
}
public
function
getDataRegis
(
$va
)
...
...
app/Models/Anggota.php
0 → 100644
View file @
8c72dafd
<?php
namespace
App\Models
;
use
Illuminate\Database\Eloquent\Factories\HasFactory
;
use
Illuminate\Database\Eloquent\Model
;
class
Anggota
extends
Model
{
use
HasFactory
;
public
$incrementing
=
false
;
protected
$table
=
'anggota'
;
protected
$keyType
=
'string'
;
protected
$fillable
=
[
'id'
,
'id_registrasi'
,
'nama'
,
'email'
,
'telepon'
,
'nik'
];
}
app/Models/KegiatanPeserta.php
View file @
8c72dafd
...
...
@@ -19,7 +19,8 @@ class KegiatanPeserta extends Model
'id'
,
'id_registrasi'
,
'id_kegiatan'
,
'id_konferensi'
'id_konferensi'
,
'id_anggota'
];
public
function
rRegistrasi
()
{
...
...
resources/views/form_kegiatan.blade.php
View file @
8c72dafd
...
...
@@ -11,13 +11,13 @@
@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 }}')"
required
>
<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 }}')"
required
>
<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
...
...
@@ -25,7 +25,7 @@
</div>
<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[]"
placeholder=
""
>
<select
class=
"form-control"
id=
"konferensi"
name=
"konferensi[
{{ $i }}
]"
placeholder=
""
>
<option
value=
""
selected
>
- Pilih -
</option>
@foreach ($konferensi as $kon)
<option
onchange=
"cek(this.value)"
value=
"{{ $kon->id }}"
>
{{ $kon->nama }}
</option>
...
...
@@ -35,6 +35,23 @@
<label
id=
"login-error"
class=
"error"
for=
"konferensi"
style=
"color: red"
>
{{$errors->first('konferensi')}}
</label>
@endif
</div>
@if (isset($anggota))
<label>
Anggota
</label>
<select
class=
"form-control anggota-select"
id=
""
name=
"kegiatan_anggota[{{ $i }}]"
placeholder=
""
>
<option
value=
""
selected
>
- Pilih -
</option>
@foreach (json_decode($list_anggota, true) as $key => $item)
<option
value=
"{{ $key }}"
>
{{ $item['nama'] }}
:
{{ $item['email'] }}
</option>
@endforeach
</select>
@if ($errors->has('anggota'))
<label
id=
"login-error"
class=
"error"
for=
"konferensi"
style=
"color: red"
>
{{$errors->first('konferensi')}}
</label>
@endif
@endif
<br>
@if ($i != 0)
<div
class=
"col-md-4 float-right"
>
<button
class=
"btn btn-danger"
type=
"button"
onclick=
"hapusKegiatan('kegiatan-{{ $i }}')"
>
Hapus
</button>
...
...
resources/views/form_kegiatan_kelompok.blade.php
View file @
8c72dafd
...
...
@@ -8,85 +8,111 @@
</div>
</div>
<form class="
needs
-
validation
" novalidate="" method="
POST
" action="
{{
route
(
'user.preview'
)}}
" enctype="
multipart
/
form
-
data
">
<div class="
section
-
body
">
@csrf
<div class="
row
">
<div class="
col
-
12
col
-
md
-
8
col
-
lg
-
8
">
<div class="
card
">
<div class="
card
-
body
" id="
parent
-
anggota
">
<div class="
row
">
<div class="
col
-
6
form
-
group
" @if (
$errors->has
('nama')) has-error @endif>
<label>Nama</label>
<input type="
text
" id="
nama
" name="
nama
" class="
form
-
control
" required="" placeholder="" value="
{{
old
(
'nama'
)}}
">
@if (
$errors->has
('nama'))
<label id="
login
-
error
" class="
error
" for="
nama
" style="
color
:
red
">
{
{$errors->first('nama')}
}
</label>
@endif
</div>
<div class="
col
-
6
form
-
group
" @if (
$errors->has
('nik')) has-error @endif>
<label>NIK</label>
<input type="
text
" id="
nik
" name="
nik
" class="
form
-
control
" required="" placeholder="" value="
{{
old
(
'nik'
)}}
">
@if (
$errors->has
('nik'))
<label id="
login
-
error
" class="
error
" for="
nik
" style="
color
:
red
">
{
{$errors->first('nik')}
}
</label>
@endif
</div>
</div>
<form class="
needs
-
validation
" novalidate="" method="
POST
" action="
{{
route
(
'user.preview'
)}}
" enctype="
multipart
/
form
-
data
">
@csrf
<div class="
row
">
<div class="
col
-
12
col
-
md
-
8
col
-
lg
-
8
">
<div class="
card
">
<div class="
card
-
body
">
<div class="
row
">
<div class="
col
-
6
form
-
group
" @if (
$errors->has
('email')) has-error @endif>
<label>E-mail</label>
<div class="
input
-
group
">
<div class="
input
-
group
-
prepend
">
<div class="
input
-
group
-
text
">
<i class="
fas
fa
-
envelope
"></i>
<div class="
col
-
6
form
-
group
" @if (
$errors->has
('nama')) has-error @endif>
<label>Nama</label>
<input type="
text
" id="
nama_anggota
" class="
form
-
control
" placeholder="" value="
{{
old
(
'nama'
)}}
">
@if (
$errors->has
('nama'))
<label id="
login
-
error
" class="
error
" for="
nama
" style="
color
:
red
">
{
{$errors->first('nama')}
}
</label>
@endif
</div>
<div class="
col
-
6
form
-
group
" @if (
$errors->has
('nik')) has-error @endif>
<label>NIK</label>
<input type="
text
" id="
nik_anggota
" class="
form
-
control
" placeholder="" value="
{{
old
(
'nik'
)}}
">
@if (
$errors->has
('nik'))
<label id="
login
-
error
" class="
error
" for="
nik
" style="
color
:
red
">
{
{$errors->first('nik')}
}
</label>
@endif
</div>
</div>
<div class="
row
">
<div class="
col
-
6
form
-
group
" @if (
$errors->has
('email')) has-error @endif>
<label>E-mail</label>
<div class="
input
-
group
">
<div class="
input
-
group
-
prepend
">
<div class="
input
-
group
-
text
">
<i class="
fas
fa
-
envelope
"></i>
</div>
</div>
<input type="
email
" id="
email_anggota
" class="
form
-
control
email
" placeholder="" value="
{{
old
(
'email'
)}}
">
</div>
<input type="
email
" id="
email
" name="
email
" class="
form
-
control
email
" required="" placeholder="" value="
{{
old
(
'email'
)}}
">
@if (
$errors->has
('email'))
<label id="
login
-
error
" class="
error
" for="
nama_depan
" style="
color
:
red
">
{
{$errors->first('email')}
}
</label>
@endif
</div>
@if (
$errors->has
('email'))
<label id="
login
-
error
" class="
error
" for="
nama_depan
" style="
color
:
red
">
{
{$errors->first('email')}
}
</label>
@endif
</div>
<div class="
col
-
6
form
-
group
" @if (
$errors->has
('telepon')) has-error @endif>
<label>Telepon</label>
<div class="
input
-
group
">
<div class="
input
-
group
-
prepend
">
<div class="
input
-
group
-
text
">
<i class="
fas
fa
-
phone
"></i>
<div class="
col
-
6
form
-
group
" @if (
$errors->has
('telepon')) has-error @endif>
<label>Telepon</label>
<div class="
input
-
group
">
<div class="
input
-
group
-
prepend
">
<div class="
input
-
group
-
text
">
<i class="
fas
fa
-
phone
"></i>
</div>
</div>
<input type="
number
" id="
telepon_anggota
" class="
form
-
control
number
" placeholder="" value="
{{
old
(
'telepon'
)}}
">
</div>
<input type="
number
" id="
telepon
" name="
telepon
" class="
form
-
control
number
" required="
true
" placeholder="" value="
{{
old
(
'telepon'
)}}
">
@if (
$errors->has
('telepon'))
<label id="
login
-
error
" class="
error
" for="
telepon
" style="
color
:
red
">
{
{$errors->first('telepon')}
}
</label>
@endif
</div>
@if (
$errors->has
('telepon'))
<label id="
login
-
error
" class="
error
" for="
telepon
" style="
color
:
red
">
{
{$errors->first('telepon')}
}
</label>
@endif
</div>
</div>
</div>
<div>
<button type="
button
" class="
btn
btn
-
primary
" onclick="
tambahAnggota
()
" name="
tambah
-
anggota
" id="
tambah
-
anggota
">Tambah Anggota</button>
</div>
<br>
<h5>Anggota</h5>
<span class="
badge
badge
-
warning
"><i class="
fa
fa
-
info
"></i> Setiap anggota yang ditambahkan akan terdaftar sebagai peserta konvensi</span>
<br>
<br>
<div class="
card
">
<div class="
card
-
body
">
<table class="
table
table
-
responsive
">
<thead>
<tr>
<th>No.</th>
<th>Nama</th>
<th>Email</th>
<th>Nik</th>
<th>Telepon</th>
<th></th>
</tr>
</thead>
<tbody id="
parent
-
anggota
">
{!! view('row_anggota', [
'i' => 1,
'item' =>
$data_registrasi
]) !!}
</tbody>
</table>
</div>
</div>
</div>
<div class="
col
-
12
col
-
md
-
4
col
-
lg
-
4
">
<input type="
hidden
" name="
data_registrasi
" value="
{{
encrypt
(
json_encode
(
$data_registrasi
,
true
))
}}
">
<p class="
alert
alert
-
info
"><i class="
fa
fa
-
info
"></i> Klik tambah konferensi jika ingin mengikuti konferensi dan pilih konferensi yang diinginkan untuk setiap anggota</p>
<br>
<br>
<div class="
row
" id="
parent
-
kegiatan
">
</div>
<div>
<button type="
button
" class="
btn
btn
-
primary
" onclick="
tambah
Anggota
()
" name="
tambah
-
anggota
" id="
tambah
-
anggota
">Tambah Anggota
</button>
<button type="
button
" class="
btn
btn
-
primary
" onclick="
tambah
Kegiatan
()
" name="
tambah
-
kegiatan
" id="
tambah
-
kegiatan
">Tambah Konferensi
</button>
</div>
</div>
<div class="
col
-
12
col
-
md
-
4
col
-
lg
-
4
">
<div class="
row
" id="
parent
-
kegiatan
">
{{ view('form_kegiatan', [
'kegiatan' =>
$kegiatan
,
'konferensi' =>
$konferensi
,
'i' => 0
]) }}
<hr>
</div>
<div>
<button type="
button
" class="
btn
btn
-
primary
" onclick="
tambahKegiatan
()
" name="
tambah
-
kegiatan
" id="
tambah
-
kegiatan
">Tambah kegiatan</button>
</div>
<hr>
</div>
</div>
<div class="
card
-
footer
text
-
right
">
<button class="
btn
btn
-
primary
mr
-
1
" type="
submit
">Daftar</button>
<button class="
btn
btn
-
secondary
" type="
reset
">Reset</button>
</div>
<div class="
card
-
footer
text
-
right
">
<button class="
btn
btn
-
primary
mr
-
1
" type="
submit
">Daftar</button>
</div>
</form>
</div>
</form>
</section>
@endsection
...
...
@@ -118,19 +144,29 @@ function cekKegiatan(id){
</
script
>
<
script
>
var
i
=
1
;
let
anggota
=
{};
anggota
[
1
]
=
{
nama
:
'{{ $data_registrasi['
nama
'] }}'
,
nik
:
'{{ $data_registrasi['
nik
'] }}'
,
email
:
'{{ $data_registrasi['
email
'] }}'
,
telepon
:
'{{ $data_registrasi['
telepon
'] }}'
};
var
i
=
0
;
function
tambahKegiatan
(){
let
token
=
'{{ csrf_token() }}'
;
if
(
i
===
undefined
)
{
i
=
1
;
}
let
list_anggota
=
JSON
.
stringify
(
anggota
);
var
request
=
$
.
ajax
({
url
:
'{{ route('
registrasi
.
form
-
kegiatan
.
add
') }}'
,
type
:
'POST'
,
dataType
:
'html'
,
data
:
{
_token
:
token
,
i
:
i
},
data
:
{
_token
:
token
,
i
:
i
,
anggota
:
true
,
list_anggota
:
list_anggota
},
success
:
function
(
result
)
{
$
(
'#parent-kegiatan'
)
.
append
(
result
);
},
...
...
@@ -146,32 +182,66 @@ function tambahKegiatan(){
function
hapusKegiatan
(
id
){
$
(
'#'
+
id
)
.
remove
();
}
</
script
>
<
script
>
var
i
=
1
;
function
tambahAnggota
(){
let
token
=
'{{ csrf_token() }}'
;
var
iA
=
2
;
if
(
i
===
undefined
)
{
i
=
1
;
}
function
tambahAnggota
()
{
let
token
=
'{{ csrf_token() }}'
;
var
request
=
$
.
ajax
({
url
:
'{{ route('
registrasi
.
form
-
anggota
.
add
') }}'
,
type
:
'POST'
,
dataType
:
'html'
,
data
:
{
_token
:
token
,
i
:
i
},
data
:
{
_token
:
token
,
i
:
iA
,
nama
:
$
(
'#nama_anggota'
)
.
val
(),
nik
:
$
(
'#nik_anggota'
)
.
val
(),
email
:
$
(
'#email_anggota'
)
.
val
(),
telepon
:
$
(
'#telepon_anggota'
)
.
val
(),
},
success
:
function
(
result
)
{
$
(
'#parent-anggota'
)
.
append
(
result
);
anggota
[
iA
]
=
{
nama
:
$
(
'#nama_anggota'
)
.
val
(),
nik
:
$
(
'#nik_anggota'
)
.
val
(),
email
:
$
(
'#email_anggota'
)
.
val
(),
telepon
:
$
(
'#telepon_anggota'
)
.
val
(),
};
addOptionToSelects
(
iA
,
$
(
'#nama_anggota'
)
.
val
()
+
' : '
+
$
(
'#email_anggota'
)
.
val
());
$
(
'#nama_anggota'
)
.
val
(
''
);
$
(
'#nik_anggota'
)
.
val
(
''
);
$
(
'#email_anggota'
)
.
val
(
''
);
$
(
'#telepon_anggota'
)
.
val
(
''
);
console
.
log
(
anggota
);
iA
++
;
},
error
:
function
(
error
)
{
alert
(
'periksa koneksi anda'
);
}
});
}
i
++
;
function
addOptionToSelects
(
key
,
name
)
{
$
(
'.anggota-select'
)
.
each
(
function
()
{
$
(
this
)
.
append
(
new
Option
(
name
,
key
));
});
}
function
hapusAnggota
(
id
)
{
$
(
'#anggota-'
+
id
)
.
remove
();
delete
anggota
[
id
];
$
(
'.anggota-select'
)
.
each
(
function
()
{
$
(
this
)
.
find
(
'option[value='
+
id
+
']'
)
.
remove
();
});
}
function
hapusKegiatan
(
id
){
...
...
resources/views/preview.blade.php
View file @
8c72dafd
...
...
@@ -73,6 +73,7 @@
$initialharga
=
$konaspi->harga
;
$subtotal
=
$initialharga
;
$i
= 0;
$jumlahAnggota
= count(
$anggota
) > 0 ? count(
$anggota
) : 1;
@endphp
<tr>
<td>1</td>
...
...
@@ -80,8 +81,8 @@
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
">
{{
$jumlahAnggota
}}
</td>
<td class="
text
-
right
">Rp {{$konaspi->harga
*
$jumlahAnggota
}}</td>
</tr>
@if (isset(
$hargaKonferensi
))
@foreach (
$hargaKonferensi
as
$kon
)
...
...
@@ -91,7 +92,12 @@
<tr>
<td>
{
{$no}
}
</td>
<td>
{
{$kon['namakeg']}
}
<br> Konferensi : <b>
{
{$kon['namakon']}
}
</b>
{
{$kon['namakeg']}
}
<br>Konferensi : <b>
{
{$kon['namakon']}
}
</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>
...
...
@@ -122,13 +128,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
{
{$konaspi->harga}
}
</div>
<div class="
invoice
-
detail
-
value
">Rp {{$konaspi->harga
*
$jumlahAnggota
}}</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
{
{$konaspi->harga}
}
</div>
<div class="
invoice
-
detail
-
value
invoice
-
detail
-
value
-
lg
">Rp {{$konaspi->harga
*
$jumlahAnggota
}}</div>
</div>
</div>
</div>
...
...
@@ -148,6 +154,7 @@
<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
)
}}
">
<input type="
hidden
" id="
totalHarga
" name="
anggota
" value="
{{
json_encode
(
$anggota
)
}}
">
<button type="
submit
" class="
btn
btn
-
primary
btn
-
icon
icon
-
left
"><i class="
fas
fa
-
credit
-
card
"></i> Daftar</button>
<button class="
btn
btn
-
danger
btn
-
icon
icon
-
left
"><i class="
fas
fa
-
times
"></i> Cancel</button>
</div>
...
...
resources/views/row_anggota.blade.php
0 → 100644
View file @
8c72dafd
<tr
id=
"anggota-{{ $i }}"
>
<td>
{{ $i }}
</td>
<td>
{{ $item['nama'] }}
<input
type=
"hidden"
name=
"anggota[{{ $i }}][nama]"
value=
"{{ $item['nama'] }}"
required
/>
</td>
<td>
{{ $item['email'] }}
<input
type=
"hidden"
name=
"anggota[{{ $i }}][email]"
value=
"{{ $item['email'] }}"
required
/>
</td>
<td>
{{ $item['nik'] }}
<input
type=
"hidden"
name=
"anggota[{{ $i }}][nik]"
value=
"{{ $item['nik'] }}"
required
/>
</td>
<td>
{{ $item['telepon'] }}
<input
type=
"hidden"
name=
"anggota[{{ $i }}][telepon]"
value=
"{{ $item['telepon'] }}"
required
/>
</td>
<td>
@if ($i > 1)
<div
class=
"col-md-4 float-right"
>
<button
class=
"btn btn-danger"
type=
"button"
onclick=
"hapusAnggota('{{ $i }}')"
>
Hapus
</button>
</div>
@endif
</td>
</tr>
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