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
f4473869
Commit
f4473869
authored
Feb 04, 2024
by
Triyah Fatmawati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
penyesuaian banyak kegiatan
parent
e018b413
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
97 additions
and
15 deletions
+97
-15
app/Http/Controllers/RegistrasiController.php
+35
-9
app/Models/Kegiatan.php
+4
-0
app/Models/KegiatanPeserta.php
+36
-0
app/Models/Konferensi.php
+4
-0
app/Models/Registrasi.php
+4
-0
resources/views/invoice.blade.php
+14
-6
No files found.
app/Http/Controllers/RegistrasiController.php
View file @
f4473869
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
use
App\Http\Support\ValidationRule
;
use
App\Http\Support\ValidationRule
;
use
App\Models\Kegiatan
;
use
App\Models\Kegiatan
;
use
App\Models\KegiatanPeserta
;
use
App\Models\Konferensi
;
use
App\Models\Konferensi
;
use
App\Models\Registrasi
;
use
App\Models\Registrasi
;
use
Carbon\Carbon
;
use
Carbon\Carbon
;
...
@@ -35,6 +36,7 @@ public function create(){
...
@@ -35,6 +36,7 @@ public function create(){
}
}
public
function
store
(
Request
$request
)
{
public
function
store
(
Request
$request
)
{
// dd($request);
$rules
=
[
$rules
=
[
'nama'
=>
'required|string'
,
'nama'
=>
'required|string'
,
'email'
=>
'required|email:rfc,dns'
,
'email'
=>
'required|email:rfc,dns'
,
...
@@ -44,8 +46,6 @@ public function store(Request $request) {
...
@@ -44,8 +46,6 @@ public function store(Request $request) {
'alamat'
=>
'required|string'
,
'alamat'
=>
'required|string'
,
'kodepos'
=>
'required|string'
,
'kodepos'
=>
'required|string'
,
'kota'
=>
'required|string'
,
'kota'
=>
'required|string'
,
'konferensi'
=>
'required'
,
'kegiatan'
=>
'required'
,
'kode_registrasi'
=>
'required'
'kode_registrasi'
=>
'required'
];
];
...
@@ -63,25 +63,51 @@ public function store(Request $request) {
...
@@ -63,25 +63,51 @@ public function store(Request $request) {
'alamat'
=>
strip_tags
(
$request
->
alamat
),
'alamat'
=>
strip_tags
(
$request
->
alamat
),
'kode_pos'
=>
strip_tags
(
$request
->
kodepos
),
'kode_pos'
=>
strip_tags
(
$request
->
kodepos
),
'kota'
=>
strip_tags
(
$request
->
kota
),
'kota'
=>
strip_tags
(
$request
->
kota
),
'id_konferensi'
=>
$request
->
konferensi
,
'id_kegiatan'
=>
$request
->
kegiatan
,
'kode_registrasi'
=>
strip_tags
(
$request
->
kode_registrasi
)
'kode_registrasi'
=>
strip_tags
(
$request
->
kode_registrasi
)
];
];
$tglRegistrasi
=
Carbon
::
now
()
->
format
(
'Y-m-d h:i:s'
);
$tglRegistrasi
=
Carbon
::
now
()
->
format
(
'Y-m-d h:i:s'
);
$kegiatan
=
Kegiatan
::
find
(
$request
->
kegiatan
);
//
$kegiatan = Kegiatan::find($request->kegiatan);
$konferensi
=
Konferensi
::
find
(
$request
->
konferensi
);
//
$konferensi = Konferensi::find($request->konferensi);
Registrasi
::
query
()
->
create
(
$registrasi
);
$id_registrasi
=
Registrasi
::
query
()
->
create
(
$registrasi
)
->
id
;
foreach
(
$request
->
konferensi
as
$kon
){
$i
=
0
;
$daftarKonferensi
[]
=
$kon
;
$konferensi
=
Konferensi
::
select
(
'nama'
)
->
where
(
'id'
,
$kon
)
->
first
();
foreach
(
$request
->
input
(
'kegiatan'
.
$i
)
as
$keg
){
$daftarKegiatan
[]
=
$keg
;
$kegiatan
[]
=
Kegiatan
::
select
(
'nama'
,
'harga'
)
->
where
(
'id'
,
$keg
)
->
first
();
}
$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'
]
];
$i
++
;
}
foreach
(
$kegiatanpeserta
as
$keg
){
KegiatanPeserta
::
query
()
->
create
(
$keg
);
}
DB
::
commit
();
DB
::
commit
();
// return redirect()->back()
// return redirect()->back()
// ->with('success', 'Data saved successfully');
// ->with('success', 'Data saved successfully');
// dd($kegiatanpeserta);
return
view
(
'invoice'
,
compact
(
'registrasi'
,
'tglRegistrasi'
,
'kegiatan
'
,
'konferensi
'
))
->
with
(
'success'
,
'Data saved successfully'
);
return
view
(
'invoice'
,
compact
(
'registrasi'
,
'tglRegistrasi'
,
'kegiatan
peserta
'
))
->
with
(
'success'
,
'Data saved successfully'
);
}
}
catch
(
Exception
$e
){
catch
(
Exception
$e
){
dd
(
$e
);
Log
::
error
(
$e
);
Log
::
error
(
$e
);
DB
::
rollBack
();
DB
::
rollBack
();
...
...
app/Models/Kegiatan.php
View file @
f4473869
...
@@ -24,4 +24,8 @@ class Kegiatan extends Model
...
@@ -24,4 +24,8 @@ class Kegiatan extends Model
public
function
rKegiatan
()
{
public
function
rKegiatan
()
{
return
$this
->
belongsToMany
(
Registrasi
::
class
,
'id_kegiatan'
,
'id'
);
return
$this
->
belongsToMany
(
Registrasi
::
class
,
'id_kegiatan'
,
'id'
);
}
}
public
function
pkKegiatanPeserta
()
{
return
$this
->
hasMany
(
KegiatanPeserta
::
class
,
'id_kegiatan'
,
'id'
);
}
}
}
app/Models/KegiatanPeserta.php
0 → 100644
View file @
f4473869
<?php
namespace
App\Models
;
use
App\Traits\Uuid
;
use
Illuminate\Database\Eloquent\Factories\HasFactory
;
use
Illuminate\Database\Eloquent\Model
;
class
KegiatanPeserta
extends
Model
{
use
HasFactory
;
use
Uuid
;
public
$incrementing
=
false
;
protected
$table
=
'kegiatan_peserta'
;
protected
$keyType
=
'string'
;
protected
$fillable
=
[
'id'
,
'id_registrasi'
,
'id_kegiatan'
,
'id_konferensi'
];
public
function
rRegistrasi
()
{
return
$this
->
belongsTo
(
Registrasi
::
class
,
'id_registrasi'
,
'id'
);
}
public
function
rKegiatanPeserta
()
{
return
$this
->
belongsTo
(
Kegiatan
::
class
,
'id_kegiatan'
,
'id'
);
}
public
function
rKonferensiPeserta
()
{
return
$this
->
belongsTo
(
Konferensi
::
class
,
'id_konferensi'
,
'id'
);
}
}
app/Models/Konferensi.php
View file @
f4473869
...
@@ -23,4 +23,8 @@ class Konferensi extends Model
...
@@ -23,4 +23,8 @@ class Konferensi extends Model
public
function
rKonferensi
()
{
public
function
rKonferensi
()
{
return
$this
->
belongsToMany
(
Registrasi
::
class
,
'id_konferensi'
,
'id'
);
return
$this
->
belongsToMany
(
Registrasi
::
class
,
'id_konferensi'
,
'id'
);
}
}
public
function
pkKonferensiPeserta
()
{
return
$this
->
hasMany
(
Konferensi
::
class
,
'id_konferensi'
,
'id'
);
}
}
}
app/Models/Registrasi.php
View file @
f4473869
...
@@ -38,4 +38,8 @@ public function pkKegiatan(){
...
@@ -38,4 +38,8 @@ public function pkKegiatan(){
public
function
pkKonferensi
()
{
public
function
pkKonferensi
()
{
return
$this
->
hasOne
(
Konferensi
::
class
,
'id'
,
'id_konferensi'
);
return
$this
->
hasOne
(
Konferensi
::
class
,
'id'
,
'id_konferensi'
);
}
}
public
function
pkRegistrasiPeserta
()
{
return
$this
->
hasMany
(
KegiatanPeserta
::
class
,
'id_registrasi'
,
'id'
);
}
}
}
resources/views/invoice.blade.php
View file @
f4473869
...
@@ -72,17 +72,25 @@
...
@@ -72,17 +72,25 @@
@php
@php
$no
= 1;
$no
= 1;
$subtotal
= 0;
$subtotal
= 0;
$i
= 0;
@endphp
@foreach (
$kegiatanpeserta
as
$keg
)
@php
$subtotal
=
$subtotal
+
$keg['harga']
;
@endphp
@endphp
{{-- @foreach (
$biaya
as
$tarif
) --}}
<tr>
<tr>
<td>1</td>
<td>1</td>
<td>
<td>
{
{$keg
iatan->nama}
}
<br> Konferensi : <b>
{
{$konferensi->nama
}
}
</b>
{
{$keg
['nama_kegiatan']}
}
<br> Konferensi : <b>
{
{$keg['nama_konferensi']
}
}
</b>
</td>
</td>
<td class="
text
-
center
">Rp
{
{$keg
iatan->harga
}
}
</td>
<td class="
text
-
center
">Rp
{
{$keg
['harga']
}
}
</td>
<td class="
text
-
center
">1</td>
<td class="
text
-
center
">1</td>
<td class="
text
-
right
">Rp
{
{$keg
iatan->harga
}
}
</td>
<td class="
text
-
right
">Rp
{
{$keg
['harga']
}
}
</td>
</tr>
</tr>
@php
$i
++;
@endphp
@endforeach
</table>
</table>
</div>
</div>
<div class="
row
mt
-
4
">
<div class="
row
mt
-
4
">
...
@@ -99,12 +107,12 @@
...
@@ -99,12 +107,12 @@
<div class="
col
-
lg
-
4
text
-
right
">
<div class="
col
-
lg
-
4
text
-
right
">
<div class="
invoice
-
detail
-
item
">
<div class="
invoice
-
detail
-
item
">
<div class="
invoice
-
detail
-
name
">Subtotal</div>
<div class="
invoice
-
detail
-
name
">Subtotal</div>
<div class="
invoice
-
detail
-
value
">Rp
{
{$
kegiatan->harga
}
}
</div>
<div class="
invoice
-
detail
-
value
">Rp
{
{$
subtotal
}
}
</div>
</div>
</div>
<hr class="
mt
-
2
mb
-
2
">
<hr class="
mt
-
2
mb
-
2
">
<div class="
invoice
-
detail
-
item
">
<div class="
invoice
-
detail
-
item
">
<div class="
invoice
-
detail
-
name
">Total</div>
<div class="
invoice
-
detail
-
name
">Total</div>
<div class="
invoice
-
detail
-
value
invoice
-
detail
-
value
-
lg
">Rp
{
{$
kegiatan->harga
}
}
</div>
<div class="
invoice
-
detail
-
value
invoice
-
detail
-
value
-
lg
">Rp
{
{$
subtotal
}
}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
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