Commit e5736e04 by Triyah Fatmawati

Ubah dari request jadi get data DB

parent c72cba66
...@@ -155,7 +155,9 @@ public function store(Request $request) { ...@@ -155,7 +155,9 @@ public function store(Request $request) {
$jumlahKeg = count($kegiatanpeserta); $jumlahKeg = count($kegiatanpeserta);
//inisial harga //inisial harga
$totalHarga = (int) $konaspi['harga']; $konvensi = Kegiatan::find($konaspi['id']);
$konv = $konvensi->toArray();
$totalHarga = (int) $konvensi->harga;
foreach($kegiatanpeserta as $keg){ foreach($kegiatanpeserta as $keg){
$kegpeserta = [ $kegpeserta = [
...@@ -167,7 +169,18 @@ public function store(Request $request) { ...@@ -167,7 +169,18 @@ public function store(Request $request) {
if($keg['id_kegiatan'] != '498633a9-082c-4a4a-9dbd-e20b678ec15e'){ if($keg['id_kegiatan'] != '498633a9-082c-4a4a-9dbd-e20b678ec15e'){
$konferensi = Konferensi::query()->where('id', $keg['id_konferensi'])->first(); $konferensi = Konferensi::query()->where('id', $keg['id_konferensi'])->first();
$kegkonaspi = Kegiatan::find($keg['id_kegiatan']);
$totalHarga += (int) $konferensi->harga; $totalHarga += (int) $konferensi->harga;
$kegPeserta[] = [
'idkon' => $konferensi->id,
'namakon' => $konferensi->nama,
'hargakon' => $konferensi->harga,
'namakeg' => $kegkonaspi->nama
];
}
else{
$kegPeserta = null;
} }
} }
...@@ -197,15 +210,12 @@ public function store(Request $request) { ...@@ -197,15 +210,12 @@ public function store(Request $request) {
DB::commit(); DB::commit();
// return redirect()->route('user.create')->with('success', 'Data saved successfully');
$data = [ $data = [
'registrasi' => $registrasi, 'registrasi' => $registrasi,
'kegiatanpeserta' => $kegiatanpeserta,
'tglRegistrasi' => $tglRegistrasi, 'tglRegistrasi' => $tglRegistrasi,
'konaspi' => $konaspi, 'konaspi' => $konv,
'hargaKonferensi' => $hargaKonferensi, 'hargaKonferensi' => $kegPeserta,
'totalHarga' => $totalHarga 'totalHarga' => $totalHarga,
]; ];
SendMail::dispatch($data, 'email.invoice', $data['registrasi']->email, 'registrasi', 'email_regis_sent_at'); SendMail::dispatch($data, 'email.invoice', $data['registrasi']->email, 'registrasi', 'email_regis_sent_at');
......
...@@ -139,15 +139,15 @@ ...@@ -139,15 +139,15 @@
<button class="btn btn-danger btn-icon icon-left"><i class="fas fa-times"></i> Cancel</button> <button class="btn btn-danger btn-icon icon-left"><i class="fas fa-times"></i> Cancel</button>
</div> --}} </div> --}}
{{-- <button class="btn btn-warning btn-icon icon-left"><i class="fas fa-print"></i> Cetak</button> --}} {{-- <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="registrasi" name="registrasi" value="{{ json_encode($registrasi) }}">
<input type="hidden" id="kegiatanpeserta" name="kegiatanpeserta" value="{{ json_encode($kegiatanpeserta) }}"> <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="tglRegistrasi" name="tglRegistrasi" value="{{ json_encode($tglRegistrasi) }}">
<input type="hidden" id="konaspi" name="konaspi" value="{{ json_encode($konaspi) }}"> <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="hargaKonferensi" name="hargaKonferensi" value="{{ json_encode($hargaKonferensi) }}">
<input type="hidden" id="totalHarga" name="totalHarga" value="{{ json_encode($totalHarga) }}"> <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 type="submit" class="btn btn-primary btn-icon icon-left"><i class="fas fa-credit-card"></i> Bayar</button> --}}
<a href="{{route('user.create')}}" class="btn btn-primary btn-icon icon-left"><i class="fas fa-credit-card"></i> Bayar</a> {{-- <a href="{{route('user.create')}}" class="btn btn-primary btn-icon icon-left"><i class="fas fa-credit-card"></i> Bayar</a> --}}
<button class="btn btn-danger btn-icon icon-left"><i class="fas fa-times"></i> Cancel</button> <button class="btn btn-danger btn-icon icon-left"><i class="fas fa-times"></i> Close</button>
</div> </div>
</div> </div>
</div> </div>
......
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