add anggota

parent 7a5e1c7e
<?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'
];
}
......@@ -19,7 +19,8 @@ class KegiatanPeserta extends Model
'id',
'id_registrasi',
'id_kegiatan',
'id_konferensi'
'id_konferensi',
'id_anggota'
];
public function rRegistrasi() {
......
......@@ -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>
......
......@@ -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>
......
<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>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment