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
76735a02
Commit
76735a02
authored
Feb 04, 2024
by
Muhammad Iskandar Java
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinamis kegiatan
parent
7f9aef4d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
34 deletions
+75
-34
app/Http/Controllers/RegistrasiController.php
+9
-0
resources/views/form_kegiatan.blade.php
+28
-0
resources/views/form_registrasi.blade.php
+36
-34
routes/web.php
+2
-0
No files found.
app/Http/Controllers/RegistrasiController.php
View file @
76735a02
...
...
@@ -88,4 +88,13 @@ public function store(Request $request) {
}
}
public
function
addFormKegiatan
(
Request
$request
)
{
$data
[
'kegiatan'
]
=
Kegiatan
::
get
();
$data
[
'konferensi'
]
=
Konferensi
::
get
();
$data
[
'i'
]
=
$request
->
i
;
return
view
(
'form_kegiatan'
,
$data
);
}
}
resources/views/form_kegiatan.blade.php
0 → 100644
View file @
76735a02
<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>
<label>
Kegiatan
</label>
@foreach ($kegiatan as $keg)
<div
class=
"form-check"
>
<input
class=
"form-check-input"
type=
"radio"
id=
"kegiatan"
name=
"kegiatan{{ $i }}[]"
value=
"{{ $keg->id }}"
>
<label
class=
"form-check-label"
for=
"{{ $keg->nama }}"
>
{{ $keg->nama }}
</label>
</div>
@endforeach
</div>
<div
class=
"form-group"
id=
"grup-konferensi"
@
if
($
errors-
>
has('profil')) has-error @endif>
<label>
Konferensi
</label>
<select
class=
"form-control"
id=
"konferensi"
name=
"konferensi[]"
required=
"true"
placeholder=
""
>
<option
value=
""
selected
>
- Pilih -
</option>
@foreach ($konferensi as $kon)
<option
onchange=
"cek(this.value)"
value=
"{{ $kon->id }}"
>
{{ $kon->nama }}
</option>
@endforeach
</select>
@if ($errors->has('konferensi'))
<label
id=
"login-error"
class=
"error"
for=
"konferensi"
style=
"color: red"
>
{{$errors->first('konferensi')}}
</label>
@endif
</div>
</div>
<button
class=
"btn btn-danger"
type=
"button"
onclick=
"hapusKegiatan('kegiatan-{{ $i }}')"
>
hapus
</button>
</div>
</div>
resources/views/form_registrasi.blade.php
View file @
76735a02
...
...
@@ -108,40 +108,15 @@
</div>
</div>
<div class="
col
-
12
col
-
md
-
4
col
-
lg
-
4
">
<div class="
card
">
<div class="
card
-
body
">
<div class="
form
-
group
" id = "
list
-
kegiatan
" @if (
$errors->has
('thematic_workshop')) has-error @endif>
<label>Kegiatan</label>
@foreach (
$kegiatan
as
$keg
)
<div class="
form
-
check
">
<input class="
form
-
check
-
input
" type="
radio
" id="
kegiatan
" name="
kegiatan
" value="
{{
$keg
->
id
}}
">
<label class="
form
-
check
-
label
" for="
{{
$keg
->
nama
}}
">{{
$keg->nama
}}</label>
</div>
@endforeach
{{-- <select class="
form
-
control
" id="
kegiatan
" name="
kegiatan
" required="
true
" placeholder="
kegiatan
">
<option value="" selected>- pilih -</option>
@foreach (
$kegiatan
as
$keg
)
<option value="
{{
$keg
->
id
}}
">{{
$keg->nama
}}</option>
@endforeach
</select>
@if (
$errors->has
('kegiatan'))
<label id="
login
-
error
" class="
error
" for="
kegiatan
" style="
color
:
red
">
{
{$errors->first('kegiatan')}
}
</label>
@endif --}}
</div>
<div class="
form
-
group
" id="
grup
-
konferensi
" @if (
$errors->has
('profil')) has-error @endif>
<label>Konferensi</label>
<select class="
form
-
control
" id="
konferensi
" name="
konferensi
" required="
true
" placeholder="">
<option value="" selected>- Pilih -</option>
@foreach (
$konferensi
as
$kon
)
<option onchange="
cek
(
this
.
value
)
" value="
{{
$kon
->
id
}}
">{{
$kon->nama
}}</option>
@endforeach
</select>
@if (
$errors->has
('konferensi'))
<label id="
login
-
error
" class="
error
" for="
konferensi
" style="
color
:
red
">
{
{$errors->first('konferensi')}
}
</label>
@endif
</div>
</div>
<div class="
row
" id="
parent
-
kegiatan
">
{{ view('form_kegiatan', [
'kegiatan' =>
$kegiatan
,
'konferensi' =>
$konferensi
,
'i' => 0
]) }}
</div>
<div>
<button type="
button
" class="
btn
btn
-
primary
" onclick="
tambahKegiatan
()
">Tambah kegiatan</button>
</div>
<div class="
card
">
<div class="
card
-
body
">
...
...
@@ -194,4 +169,31 @@ function cek(var){
}
}
</script>
<script>
var i = 1;
function tambahKegiatan(){
let token = '{{ csrf_token() }}';
if (i === undefined) {
i = 1;
}
var request = $.ajax({
url: '{{ route('registrasi.form-kegiatan.add') }}',
type:'POST',
dataType: 'html',
data: {_token:token, i:i},
success: function (result) {
$('#parent-kegiatan').append(result);
}
});
i++;
}
function hapusKegiatan(id){
$('#'+id).remove();
}
</script>
@endpush
routes/web.php
View file @
76735a02
...
...
@@ -38,3 +38,5 @@
Route
::
get
(
'/peserta'
,
[
AdminController
::
class
,
'index_peserta'
])
->
name
(
'admin.index_peserta'
);
Route
::
get
(
'/download_peserta'
,
[
AdminController
::
class
,
'download_peserta'
])
->
name
(
'admin.download_peserta'
);
Route
::
get
(
'/delete_peserta/{id}'
,
[
AdminController
::
class
,
'delete_peserta'
])
->
name
(
'admin.delete_peserta'
);
Route
::
post
(
'/add-kegiatan'
,
[
RegistrasiController
::
class
,
'addFormKegiatan'
])
->
name
(
'registrasi.form-kegiatan.add'
);
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