Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pa21617d4ti08
Project
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jhon
pa21617d4ti08
Commits
edd3b7c7
Commit
edd3b7c7
authored
7 years ago
by
jhon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pembelian dan Request Barang
parent
f2274a90
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
252 additions
and
71 deletions
+252
-71
Customer.php
app/Customer.php
+0
-12
CustomerController.php
app/Http/Controllers/CustomerController.php
+57
-36
Pembelian.php
app/Pembelian.php
+7
-3
Transaksi.php
app/Transaksi.php
+0
-12
createPembelian.blade.php
...or/adminlte/customer/BeliBarang/createPembelian.blade.php
+112
-0
index.blade.php
...views/vendor/adminlte/customer/BeliBarang/index.blade.php
+22
-3
index.blade.php
...vendor/adminlte/customer/HistoryPembelian/index.blade.php
+40
-0
index.blade.php
...s/vendor/adminlte/customer/HistoryRequest/index.blade.php
+3
-3
sidebar.blade.php
.../views/vendor/adminlte/layouts/partials/sidebar.blade.php
+2
-1
web.php
routes/web.php
+9
-1
No files found.
app/Customer.php
deleted
100644 → 0
View file @
f2274a90
<?php
namespace
App
;
use
Illuminate\Database\Eloquent\Model
;
class
Customer
extends
Model
{
protected
$fillable
=
[
'name'
,
'email'
,
'username'
,
'password'
,
'saldo'
,
];
}
This diff is collapsed.
Click to expand it.
app/Http/Controllers/CustomerController.php
View file @
edd3b7c7
...
...
@@ -3,14 +3,20 @@
namespace
App\Http\Controllers
;
use
App\User
;
use
App\Barang
;
use
App\Pembelian
;
use
App\RequestBarang
;
use
App\DataRequest
;
use
App\Http\Requests
;
use
Illuminate\Http\Request
;
use
DB
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Auth
;
use
Illuminate\Support\Facades\Input
;
use
App\User
;
class
CustomerController
extends
Controller
{
...
...
@@ -23,36 +29,43 @@ class CustomerController extends Controller
$barangs
=
Barang
::
all
();
return
view
(
'adminlte::customer.BeliBarang.index'
,
compact
(
'barangs'
));
}
public
function
create
(
)
public
function
create
Pembelian
(
$id
)
{
return
view
(
'adminlte::inventori.BeliBarang.create'
);
$barangs
=
Barang
::
where
(
'id'
,
$id
)
->
first
();
return
view
(
'adminlte::customer.BeliBarang.createPembelian'
)
->
with
(
'barangs'
,
$barangs
);
}
public
function
s
tore
(
Request
$request
)
public
function
s
avePembelian
(
Request
$request
)
{
$this
->
validate
(
$request
,
[
'nama'
=>
'required'
,
'jumlah'
=>
'required'
,
'harga'
=>
'required'
,
'deskripsi'
=>
'required'
,
'kategori'
=>
'required'
,
'gambar'
=>
'required'
,
]);
$barangs
=
new
Barang
();
$barangs
->
nama
=
$request
[
'nama'
];
$barangs
->
jumlah
=
$request
[
'jumlah'
];
$barangs
->
harga
=
$request
[
'harga'
];
$barangs
->
deskripsi
=
$request
[
'deskripsi'
];
$barangs
->
kategori
=
$request
[
'kategori'
];
$barangs
->
gambar
=
$request
[
'gambar'
];
$barangs
->
save
();
$pembelians
=
new
Pembelian
();
$pembelians
->
user_id
=
$request
->
user_id
;
$pembelians
->
username
=
$request
->
username
;
$pembelians
->
nama_barang
=
$request
->
nama_barang
;
$pembelians
->
kategori
=
$request
->
kategori
;
$pembelians
->
harga
=
$request
->
harga
;
$pembelians
->
jumlah
=
$request
->
jumlah
;
$harga
=
$request
->
harga
;
$jumlah
=
$request
->
jumlah
;
$total_harga
=
$harga
*
$jumlah
;
$pembelians
->
total_harga
=
$total_harga
;
$pembelians
->
status_pengantaran
=
$request
->
status_pengantaran
;
$pembelians
->
save
();
return
redirect
(
'BeliBarang'
);
}
public
function
cariBarang
(){
$key
=
Input
::
get
(
'search'
);
if
(
isset
(
$key
)){
$this
->
data
[
'barangs'
]
=
Barang
::
where
(
'nama_barang'
,
'like'
,
'%'
.
$key
.
'%'
)
->
orderBy
(
'id'
,
'desc'
)
->
paginate
(
10
);
}
else
{
$this
->
data
[
'barangs'
]
=
Barang
::
orderBy
(
'id'
,
'desc'
)
->
paginate
(
10
);
}
return
view
(
'adminlte::customer.BeliBarang.index'
,
$this
->
data
);
}
//----------------------------Data Request----------------------//
...
...
@@ -63,16 +76,13 @@ class CustomerController extends Controller
return
view
(
'adminlte::customer.RequestBarang.index'
,
compact
(
'data_requests'
));
}
public
function
createRequest
(
$id
)
{
$data_requests
=
DataRequest
::
where
(
'id'
,
$id
)
->
first
();
// dd($data_requests);
return
view
(
'adminlte::customer.RequestBarang.createRequest'
)
->
with
(
'data_requests'
,
$data_requests
);
}
public
function
saveRequest
(
Request
$request
)
{
$request_barangs
=
new
RequestBarang
();
...
...
@@ -96,18 +106,28 @@ class CustomerController extends Controller
//----------------------------Check Saldo----------------------------//
public
function
CheckSaldo
()
{
$users
=
User
::
all
();
return
view
(
'adminlte::customer.CheckSaldo.index'
);
}
//----------------------------Histori Transaksi----------------------//
public
function
HistoryTransaksi
()
public
function
HistoryRequest
()
{
$username
=
Auth
::
user
()
->
username
;
$user
=
DB
::
table
(
'users'
)
->
where
(
'username'
,
$username
)
->
first
();
$id
=
$user
->
id
;
$this
->
data
[
'request_barang'
]
=
DB
::
table
(
'request_barangs'
)
->
where
(
'user_id'
,
'='
,
$id
)
->
get
();
return
view
(
'adminlte::customer.HistoryRequest.index'
,
$this
->
data
);
}
public
function
HistoryPembelian
()
{
$request_barangs
=
RequestBarang
::
all
();
return
view
(
'adminlte::customer.HistoryTransaksi.index'
)
->
with
(
'request_barangs'
,
$request_barangs
);
$username
=
Auth
::
user
()
->
username
;
$user
=
DB
::
table
(
'users'
)
->
where
(
'username'
,
$username
)
->
first
();
$id
=
$user
->
id
;
$this
->
data
[
'pembelian'
]
=
DB
::
table
(
'pembelians'
)
->
where
(
'user_id'
,
'='
,
$id
)
->
get
();
// dd($this->data);
return
view
(
'adminlte::customer.HistoryPembelian.index'
,
$this
->
data
);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
app/Pe
tugas
.php
→
app/Pe
mbelian
.php
View file @
edd3b7c7
...
...
@@ -4,10 +4,14 @@ namespace App;
use
Illuminate\Database\Eloquent\Model
;
class
Pe
tugas
extends
Model
class
Pe
mbelian
extends
Model
{
protected
$table
=
'pe
tugas
s'
;
protected
$table
=
'pe
mbelian
s'
;
protected
$fillable
=
[
'
name'
,
'email'
,
'username'
,
'password
'
,
'
username'
,
'nama_barang'
,
'kategori'
,
'jumlah'
,
'total_harga'
,
'user_id'
,
'status_pengantaran
'
,
];
public
function
user
(){
return
$this
->
belongsTo
(
User
::
class
);
}
}
This diff is collapsed.
Click to expand it.
app/Transaksi.php
deleted
100644 → 0
View file @
f2274a90
<?php
namespace
App
;
use
Illuminate\Database\Eloquent\Model
;
class
Transaksi
extends
Model
{
protected
$fillable
=
[
'username'
,
'nama_barang'
,
'kategori'
,
'jumlah'
,
'total_harga'
,
'status_pengantaran'
,
];
}
This diff is collapsed.
Click to expand it.
resources/views/vendor/adminlte/customer/BeliBarang/createPembelian.blade.php
0 → 100644
View file @
edd3b7c7
@
extends
(
'adminlte::layouts.app'
)
@
section
(
'htmlheader_title'
)
Create
@
endsection
@
section
(
'contentheader_title'
)
Page
Request
Barang
@
endsection
@
section
(
'main-content'
)
<
div
class
="
container
">
<div class="
row
">
<!-- edit form column -->
<form class="
form
-
horizontal
" role="
form
" method="
POST
" action="
{{
url
(
'/savePembelian'
)}}
" >
{!! csrf_field() !!}
<div class="
col
-
md
-
9
personal
-
info
">
<div class="
form
-
group
">
<label class="
col
-
md
-
4
control
-
label
">User ID</label>
<div class="
col
-
lg
-
6
">
<input name="
user_id
" class="
form
-
control
" type="
integer
" value="
{{
$user
->
id
}}
" readonly>
</div>
</div>
<div class="
form
-
group
">
<label class="
col
-
md
-
4
control
-
label
">Username</label>
<div class="
col
-
lg
-
6
">
<input name="
username
" class="
form
-
control
" type="
text
" value="
{{
$user
->
username
}}
" readonly>
</div>
</div>
<div class="
form
-
group
">
<label class="
col
-
md
-
4
control
-
label
">Nama Barang</label>
<div class="
col
-
md
-
6
">
<input name="
nama_barang
" class="
form
-
control
" type="
text
" value="
{{
$barangs
->
nama_barang
}}
" readonly>
</div>
</div>
<div class="
form
-
group
">
<label class="
col
-
md
-
4
control
-
label
">Kategori</label>
<div class="
col
-
md
-
6
">
<input name="
kategori
" class="
form
-
control
" type="
text
" value="
{{
$barangs
->
kategori
}}
" readonly>
</div>
</div>
<div class="
form
-
group
">
<label class="
col
-
md
-
4
control
-
label
">Harga</label>
<div class="
col
-
md
-
6
">
<input name="
harga
" class="
form
-
control
" type="
integer
" value="
{{
$barangs
->
harga
}}
" readonly>
</div>
</div>
<div class="
form
-
group
{{
$errors
->
has
(
'jumlah'
)
?
' has-error'
:
''
}}
">
<label for="
title
" class="
col
-
md
-
4
control
-
label
">Jumlah</label>
<div class="
col
-
md
-
6
">
<input type="
number
" onkeyup="
Harga
(
this
.
value
)
" min="
1
" class="
form
-
control
" name="
jumlah
" value="
{{
old
(
'jumlah'
)
}}
" required>
@if (
$errors->has
('jumlah'))
<span class="
help
-
block
">
<strong>{{
$errors->first
('jumlah') }}</strong>
</span>
@endif
</div>
</div>
<div class="
form
-
group
{{
$errors
->
has
(
'total_harga'
)
?
' has-error'
:
''
}}
">
<label class="
col
-
md
-
4
control
-
label
">Total Harga</label>
<div class="
col
-
md
-
6
">
<span class="
form
-
control
" id="
total_harga
" name="
total_harga
" value="
{{
old
(
'total_harga'
)
}}
"></span>
</div>
</div>
<div class="
form
-
group
{{
$errors
->
has
(
'status_pengantaran'
)
?
' has-error'
:
''
}}
">
<label for="
title
" class="
col
-
md
-
4
control
-
label
">Status Pengantaran</label>
<div class="
col
-
md
-
6
">
<select name="
status_pengantaran
" class="
form
-
control
">
<option value="
Belum
">Belum</option>
</select>
@if (
$errors->has
('status_pengantaran'))
<span class="
help
-
block
">
<strong>{{
$errors->first
('status_pengantaran') }}</strong>
</span>
@endif
</div>
</div>
</div>
<div class="
col
-
md
-
9
">
<div class="
form
-
group
">
<label class="
col
-
md
-
3
control
-
label
"></label>
<div class="
col
-
md
-
8
">
<input type="
submit
" class="
btn
btn
-
primary
" value="
Save
Changes
">
<span></span>
</div>
</div>
</div>
</form>
</div>
</div>
<script>function Harga(str)
{
document.getElementById("
total_harga
").innerHTML = str*
{
{$barangs->harga}
}
;
return;
}
</script>
@endsection
This diff is collapsed.
Click to expand it.
resources/views/vendor/adminlte/customer/BeliBarang/index.blade.php
View file @
edd3b7c7
...
...
@@ -5,10 +5,29 @@
@
endsection
@
section
(
'contentheader_title'
)
<
form
action
=
"
{
{url('/cariBarang')}
}
"
>
<
div
class
="
form
-
group
">
<label style="
margin
:
20
px
20
px
0
;
font
-
size
:
15
px
">Search by Username</label>
<input type="
text
" name="
search
" placeholder="
Nama
Barang
" id="
search
" class="
form
-
control
" style="
font
-
size
:
15
px
;
color
:
white
;
background
-
color
:
rgba
(
0
,
0
,
0
,
0.4
)
"/>
</div>
</form>
<!-- <form action="
{{
url
(
'/customer/menu'
)}}
">
<div class="
form
-
group
">
<label style="
margin
:
20
px
20
px
0
;
font
-
size
:
15
px
">Search by Nama Menu</label>
<input type="
text
" name="
search
" placeholder="
Nama
Menu
" id="
search
" class="
form
-
control
" style="
font
-
size
:
15
px
;
color
:
white
;
background
-
color
:
rgba
(
0
,
0
,
0
,
0.4
)
"/>
</div>
<button type="
submit
" id="
button
-
filter
" class="
btn
btn
-
danger
pull
-
right
" style="
margin
-
right
:
20
px
">
<i class="
fa
fa
-
search
"></i> Search
</button>
</form> -->
<center>Beli Barang</center>
@endsection
@section('main-content')
<table class="
table
table
-
striped
">
<thead>
<tr>
...
...
@@ -24,13 +43,13 @@
<tbody>
@foreach(
$barangs
as
$barang
)
<tr>
<td>
{
{$barang->nama}
}
</td>
<td>
{
{$barang->
jumlah
}
}
</td>
<td>
{
{$barang->nama
_barang
}
}
</td>
<td>
{
{$barang->
stock
}
}
</td>
<td>
{
{$barang->harga}
}
</td>
<td>
{
{$barang->kategori}
}
</td>
<td>
{
{$barang->gambar}
}
</td>
<td>
<a href="
{{
url
(
'/
beli
'
,
$barang
->
id
)
}}
" type="
submit
" button type="
button
" class="
btn
btn
-
warning
">Beli</a>
<a href="
{{
url
(
'/
createPembelian
'
,
$barang
->
id
)
}}
" type="
submit
" button type="
button
" class="
btn
btn
-
warning
">Beli</a>
<!-- <a href="
{{
url
(
'/delete'
,
$barang
->
id
)
}}
" <onclick="
return
confirm
(
'Yakin mau hapus data ini sob?'
)
" class="
btn
btn
-
warning
">Delete</a> -->
</tr>
@endforeach
...
...
This diff is collapsed.
Click to expand it.
resources/views/vendor/adminlte/customer/HistoryPembelian/index.blade.php
0 → 100644
View file @
edd3b7c7
@
extends
(
'adminlte::layouts.app'
)
@
section
(
'htmlheader_title'
)
{{
trans
(
'adminlte_lang::message.home'
)
}}
@
endsection
@
section
(
'contentheader_title'
)
<
center
>
Histori
Transaksi
</
center
>
@
endsection
@
section
(
'main-content'
)
<
table
class
="
table
table
-
striped
">
<thead>
<tr>
<th>Username</th>
<th>Nama Barang</th>
<th>Kategori</th>
<th>Harga</th>
<th>Jumlah</th>
<th>Total Harga</th>
<th>Pengantaran</th>
</tr>
</thead>
<tbody>
@foreach(
$pembelian
as
$pembelians
)
<tr>
<td>
{
{$pembelians->username}
}
</td>
<td>
{
{$pembelians->nama_barang}
}
</td>
<td>
{
{$pembelians->kategori}
}
</td>
<td>
{
{$pembelians->harga}
}
</td>
<td>
{
{$pembelians->jumlah}
}
</td>
<td>
{
{$pembelians->total_harga}
}
</td>
<td>
{
{$pembelians->status_pengantaran}
}
</td>
</tr>
@endforeach
</tbody>
</table>
@endsection
This diff is collapsed.
Click to expand it.
resources/views/vendor/adminlte/customer/History
Transaksi
/index.blade.php
→
resources/views/vendor/adminlte/customer/History
Request
/index.blade.php
View file @
edd3b7c7
...
...
@@ -14,24 +14,24 @@
<tr>
<th>Username</th>
<th>Nama Barang</th>
<th>Kategori</th>
<th>Harga</th>
<th>Jumlah</th>
<th>Total Harga</th>
<th>Status Request</th>
<th>Pengantaran</th>
</tr>
</thead>
<tbody>
@foreach(
$request_barang
s
as
$requestBarang
)
@foreach(
$request_barang
as
$requestBarang
)
<tr>
<td>
{
{$requestBarang->username}
}
</td>
<td>
{
{$requestBarang->nama_barang}
}
</td>
<td>
{
{$requestBarang->kategori}
}
</td>
<td>
{
{$requestBarang->harga}
}
</td>
<td>
{
{$requestBarang->jumlah}
}
</td>
<td>
{
{$requestBarang->total_harga}
}
</td>
<td>
{
{$requestBarang->status_request}
}
</td>
<td>
{
{$requestBarang->status_pengantaran}
}
</td>
</tr>
@endforeach
</tbody>
...
...
This diff is collapsed.
Click to expand it.
resources/views/vendor/adminlte/layouts/partials/sidebar.blade.php
View file @
edd3b7c7
...
...
@@ -40,7 +40,8 @@
<li><a
href=
"{{ url('/BeliBarang') }}"
><i
class=
'fa fa-link'
></i>
<span>
Beli Barang
</span></a></li>
<li><a
href=
"{{ url('/RequestBarang') }}"
><i
class=
'fa fa-link'
></i>
<span>
Request Barang
</span></a></li>
<li><a
href=
"{{ url('/CheckSaldo') }}"
><i
class=
'fa fa-link'
></i>
<span>
Check Saldo
</span></a></li>
<li><a
href=
"{{ url('/HistoryTransaksi') }}"
><i
class=
'fa fa-link'
></i>
<span>
History Transaksi
</span></a></li>
<li><a
href=
"{{ url('/HistoryPembelian') }}"
><i
class=
'fa fa-link'
></i>
<span>
History Pembelian
</span></a></li>
<li><a
href=
"{{ url('/HistoryRequest') }}"
><i
class=
'fa fa-link'
></i>
<span>
History Request
</span></a></li>
@elseif(Auth::user()->status=="inventori")
...
...
This diff is collapsed.
Click to expand it.
routes/web.php
View file @
edd3b7c7
...
...
@@ -51,6 +51,11 @@ Route::group(['middleware' => ['web','auth','admin']], function () {
Route
::
group
([
'middleware'
=>
[
'web'
,
'auth'
,
'customer'
]],
function
()
{
Route
::
get
(
'/BeliBarang'
,
'CustomerController@BeliBarang'
);
Route
::
get
(
'/createPembelian/{id}'
,
'CustomerController@createPembelian'
);
Route
::
post
(
'/storePembelian'
,
'CustomerController@storePembelian'
);
Route
::
post
(
'/savePembelian'
,
'CustomerController@savePembelian'
);
Route
::
get
(
'/cariBarang'
,
'CustomerController@cariBarang'
);
Route
::
get
(
'/CheckSaldo'
,
'CustomerController@CheckSaldo'
);
...
...
@@ -58,7 +63,10 @@ Route::group(['middleware' => ['web','auth','customer']], function () {
Route
::
get
(
'/createRequest/{id}'
,
'CustomerController@createRequest'
);
Route
::
post
(
'/storeRequest'
,
'CustomerController@storeRequest'
);
Route
::
post
(
'/saveRequest'
,
'CustomerController@saveRequest'
);
Route
::
get
(
'/HistoryTransaksi'
,
'CustomerController@HistoryTransaksi'
);
Route
::
get
(
'/HistoryPembelian'
,
'CustomerController@HistoryPembelian'
);
Route
::
get
(
'/HistoryRequest'
,
'CustomerController@HistoryRequest'
);
});
...
...
This diff is collapsed.
Click to expand it.
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