Commit f2274a90 by jhon

perbaikan List Barang

parent eea96b68
...@@ -7,6 +7,6 @@ use Illuminate\Database\Eloquent\Model; ...@@ -7,6 +7,6 @@ use Illuminate\Database\Eloquent\Model;
class Barang extends Model class Barang extends Model
{ {
protected $fillable = [ protected $fillable = [
'nama', 'jumlah', 'harga','deskripsi','kategori','gambar', 'nama', 'stock', 'harga','deskripsi','kategori','gambar',
]; ];
} }
...@@ -3,19 +3,11 @@ ...@@ -3,19 +3,11 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Http\Requests; use App\Http\Requests;
use App\Barang; use App\Barang;
use App\RequestBarang; use App\RequestBarang;
use App\DataRequest; use App\DataRequest;
use App\RequestBarang;
use App\DataRequest;
class InventoriController extends Controller class InventoriController extends Controller
{ {
public function ListBarang() public function ListBarang()
...@@ -32,16 +24,16 @@ class InventoriController extends Controller ...@@ -32,16 +24,16 @@ class InventoriController extends Controller
public function store(Request $request) public function store(Request $request)
{ {
$this->validate($request, [ $this->validate($request, [
'nama' => 'required', 'nama_barang' => 'required',
'jumlah' => 'required', 'stock' => 'required',
'harga' => 'required', 'harga' => 'required',
'kategori' => 'required', 'kategori' => 'required',
'gambar' => 'required', 'gambar' => 'required',
]); ]);
$barangs = new Barang(); $barangs = new Barang();
$barangs->nama = $request['nama']; $barangs->nama_barang = $request['nama_barang'];
$barangs->jumlah = $request['jumlah']; $barangs->stock = $request['stock'];
$barangs->harga = $request['harga']; $barangs->harga = $request['harga'];
$barangs->kategori = $request['kategori']; $barangs->kategori = $request['kategori'];
$barangs->gambar = $request['gambar']; $barangs->gambar = $request['gambar'];
...@@ -60,16 +52,16 @@ class InventoriController extends Controller ...@@ -60,16 +52,16 @@ class InventoriController extends Controller
public function update(Request $request, $id) public function update(Request $request, $id)
{ {
$this->validate($request, [ $this->validate($request, [
'nama' => 'required', 'nama_barang' => 'required',
'jumlah' => 'required', 'stock' => 'required',
'harga' => 'required', 'harga' => 'required',
'kategori' => 'required', 'kategori' => 'required',
'gambar' => 'required', 'gambar' => 'required',
]); ]);
$barangs = Barang::findOrFail($id); $barangs = Barang::findOrFail($id);
$barangs->nama = $request->nama; $barangs->nama_barang = $request->nama_barang;
$barangs->jumlah = $request->jumlah; $barangs->stock = $request->stock;
$barangs->harga = $request->harga; $barangs->harga = $request->harga;
$barangs->kategori = $request->kategori; $barangs->kategori = $request->kategori;
$barangs->gambar = $request->gambar; $barangs->gambar = $request->gambar;
...@@ -86,14 +78,6 @@ class InventoriController extends Controller ...@@ -86,14 +78,6 @@ class InventoriController extends Controller
return redirect('ListBarang'); return redirect('ListBarang');
} }
public function ListRequest()
{
$request_barangs = RequestBarang::all();
return view('adminlte::inventori.ListRequest.index', compact('request_barangs'));
}
<<<<<<< HEAD
//----------------------------List Request----------------------// //----------------------------List Request----------------------//
public function ListRequest() public function ListRequest()
...@@ -105,10 +89,6 @@ class InventoriController extends Controller ...@@ -105,10 +89,6 @@ class InventoriController extends Controller
public function editRequest($id) public function editRequest($id)
{ {
=======
public function editRequest($id)
{
>>>>>>> 226a4f92be2de6ce884543bf9425346660a5031f
$request_barangs = RequestBarang::where('id', $id)->first(); $request_barangs = RequestBarang::where('id', $id)->first();
return view('adminlte::inventori.ListRequest.edit')->with('request_barangs', $request_barangs); return view('adminlte::inventori.ListRequest.edit')->with('request_barangs', $request_barangs);
} }
...@@ -142,42 +122,6 @@ class InventoriController extends Controller ...@@ -142,42 +122,6 @@ class InventoriController extends Controller
$data_requests->harga = $request['harga']; $data_requests->harga = $request['harga'];
$data_requests->save(); $data_requests->save();
return redirect('DataRequest'); return redirect('DataRequest');
<<<<<<< HEAD
}
public function editDataRequest($id)
{
$data_requests = DataRequest::where('id', $id)->first();
return view('adminlte::inventori.DataRequest.editDataRequest')->with('data_requests', $data_requests);
}
public function updateDataRequest(Request $request, $id)
{
$this->validate($request, [
'nama_barang' => 'required',
'kategori' => 'required',
'harga' => 'required',
]);
$data_requests = DataRequest::findOrFail($id);
$data_requests->nama_barang = $request->nama_barang;
$data_requests->kategori = $request->kategori;
$data_requests->harga = $request->harga;
$data_requests->save();
return redirect('DataRequest');
}
public function destroyDataRequest($id)
{
$data_requests = DataRequest::find($id);
$data_requests->delete();
return redirect('DataRequest');
=======
>>>>>>> 226a4f92be2de6ce884543bf9425346660a5031f
} }
...@@ -212,6 +156,5 @@ class InventoriController extends Controller ...@@ -212,6 +156,5 @@ class InventoriController extends Controller
$data_requests->delete(); $data_requests->delete();
return redirect('DataRequest'); return redirect('DataRequest');
} }
} }
\ No newline at end of file
...@@ -3,6 +3,7 @@ namespace App\Http\Controllers; ...@@ -3,6 +3,7 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Http\Requests; use App\Http\Requests;
use Illuminate\Support\Facades\Input;
use App\User; use App\User;
use App\Transaksi; use App\Transaksi;
...@@ -35,9 +36,22 @@ class KasirController extends Controller ...@@ -35,9 +36,22 @@ class KasirController extends Controller
return redirect('ListCustomer'); return redirect('ListCustomer');
} }
public function cariCustomer(){
$key = Input::get('search');
if(isset($key)){
$this->data['users'] = User::where('email','like','%'.$key.'%')->orderBy('id','desc')->paginate(10);
}else{
$this->data['users'] = User::orderBy('id','desc')->paginate(10);
}
return view('adminlte::kasir.ListCustomer.index',$this->data);
}
public function KonfirmasiBarang($id){ public function KonfirmasiBarang($id){
DB::table('request_barangs')->where('id', $id)->update(['status_request'=> 1]); DB::table('request_barangs')->where('id', $id)->update(['status_request'=> 1]);
return redirect()->back(); return redirect()->back();
} }
} }
\ No newline at end of file
...@@ -14,25 +14,25 @@ ...@@ -14,25 +14,25 @@
<div class="panel-body"> <div class="panel-body">
<form class="form-horizontal" action="{{ url('store') }}" method="POST"> <form class="form-horizontal" action="{{ url('store') }}" method="POST">
{!! csrf_field() !!} {!! csrf_field() !!}
<div class="form-group{{ $errors->has('nama') ? ' has-error' : '' }}"> <div class="form-group{{ $errors->has('nama_barang') ? ' has-error' : '' }}">
<label for="title" class="col-md-4 control-label">Nama</label> <label for="title" class="col-md-4 control-label">Nama Barang</label>
<div class="col-md-6"> <div class="col-md-6">
<input type="text" class="form-control" name="nama" value="{{ old('nama') }}" > <input type="text" class="form-control" name="nama_barang" value="{{ old('nama_barang') }}" >
@if ($errors->has('nama')) @if ($errors->has('nama_barang'))
<span class="help-block"> <span class="help-block">
<strong>{{ $errors->first('nama') }}</strong> <strong>{{ $errors->first('nama_barang') }}</strong>
</span> </span>
@endif @endif
</div> </div>
</div> </div>
<div class="form-group{{ $errors->has('jumlah') ? ' has-error' : '' }}"> <div class="form-group{{ $errors->has('stock') ? ' has-error' : '' }}">
<label for="title" class="col-md-4 control-label">Jumlah</label> <label for="title" class="col-md-4 control-label">Stock</label>
<div class="col-md-6"> <div class="col-md-6">
<input type="text" class="form-control" name="jumlah" value="{{ old('jumlah') }}" > <input type="text" class="form-control" name="stock" value="{{ old('stock') }}" >
@if ($errors->has('jumlah')) @if ($errors->has('stock'))
<span class="help-block"> <span class="help-block">
<strong>{{ $errors->first('jumlah') }}</strong> <strong>{{ $errors->first('stock') }}</strong>
</span> </span>
@endif @endif
</div> </div>
......
...@@ -14,13 +14,13 @@ ...@@ -14,13 +14,13 @@
<div class="panel-body"> <div class="panel-body">
<form class="form-horizontal" action="{{ url('update', $barangs->id) }}" method="POST"> <form class="form-horizontal" action="{{ url('update', $barangs->id) }}" method="POST">
{!! csrf_field() !!} {!! csrf_field() !!}
<div class="form-group{{ $errors->has('nama') ? ' has-error' : '' }}"> <div class="form-group{{ $errors->has('nama_barang') ? ' has-error' : '' }}">
<label for="title" class="col-md-4 control-label">Nama</label> <label for="title" class="col-md-4 control-label">Nama</label>
<div class="col-md-6"> <div class="col-md-6">
<input type="text" class="form-control" name="nama" value="{{ $barangs->nama}}" > <input type="text" class="form-control" name="nama_barang" value="{{ $barangs->nama_barang}}" >
@if ($errors->has('nama')) @if ($errors->has('nama_barang'))
<span class="help-block"> <span class="help-block">
<strong>{{ $errors->first('nama') }}</strong> <strong>{{ $errors->first('nama_barang') }}</strong>
</span> </span>
@endif @endif
</div> </div>
...@@ -28,12 +28,12 @@ ...@@ -28,12 +28,12 @@
<div class="form-group{{ $errors->has('jumlah') ? ' has-error' : '' }}"> <div class="form-group{{ $errors->has('jumlah') ? ' has-error' : '' }}">
<label for="title" class="col-md-4 control-label">Jumlah</label> <label for="title" class="col-md-4 control-label">Stock</label>
<div class="col-md-6"> <div class="col-md-6">
<input type="text" class="form-control" name="jumlah" value="{{ $barangs->jumlah}}" > <input type="text" class="form-control" name="stock" value="{{ $barangs->stock}}" >
@if ($errors->has('jumlah')) @if ($errors->has('stock'))
<span class="help-block"> <span class="help-block">
<strong>{{ $errors->first('jumlah') }}</strong> <strong>{{ $errors->first('stock') }}</strong>
</span> </span>
@endif @endif
</div> </div>
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
</div> </div>
</div> </div>
<div class="form-group{{ $errors->has('image') ? ' has-error' : '' }}"> <div class="form-group{{ $errors->has('gambar') ? ' has-error' : '' }}">
<label for="title" class="col-md-4 control-label">Gambar</label> <label for="title" class="col-md-4 control-label">Gambar</label>
<div class="col-md-6"> <div class="col-md-6">
<input type="file" class="inputimages" name="gambar" value="{{ $barangs->gambar }}" > <input type="file" class="inputimages" name="gambar" value="{{ $barangs->gambar }}" >
......
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
<tbody> <tbody>
@foreach($barangs as $barang) @foreach($barangs as $barang)
<tr> <tr>
<td>{{$barang->nama}}</td> <td>{{$barang->nama_barang}}</td>
<td>{{$barang->jumlah}}</td> <td>{{$barang->stock}}</td>
<td>{{$barang->harga}}</td> <td>{{$barang->harga}}</td>
<td>{{$barang->kategori}}</td> <td>{{$barang->kategori}}</td>
<td><img src="{{ asset('image/'. $barang->gambar) }}" style="height: 150px; width: 200px; "> </td> <td><img src="{{ asset('image/'. $barang->gambar) }}" style="height: 150px; width: 200px; "> </td>
......
...@@ -5,6 +5,12 @@ ...@@ -5,6 +5,12 @@
@endsection @endsection
@section('contentheader_title') @section('contentheader_title')
<form action="{{url('/cariCustomer')}}">
<div class="form-group">
<label style="margin: 20px 20px 0;font-size: 15px">Search by Email Username</label>
<input type="text" name="search" placeholder="Email Customer" id="search" class="form-control" style="font-size: 15px;color:white;background-color:rgba(0,0,0,0.4)"/>
</div>
</form>
<center>List Customer</center> <center>List Customer</center>
@endsection @endsection
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
@if(Auth::user()->status=="admin") @if(Auth::user()->status=="admin")
<li><a href="{{ url('listPetugas') }}"><i class='fa fa-link'></i> <span>Daftar Pegawai</span></a></li> <li><a href="{{ url('listPetugas') }}"><i class='fa fa-link'></i> <span>Daftar Pegawai</span></a></li>
<!-- <li><a href="{{ url('laporanTransaksi') }}"><i class='fa fa-link'></i> <span>Laporan Transaksi</span></a></li> -->
@elseif(Auth::user()->status=="customer") @elseif(Auth::user()->status=="customer")
<li><a href="{{ url('/BeliBarang') }}"><i class='fa fa-link'></i> <span>Beli Barang</span></a></li> <li><a href="{{ url('/BeliBarang') }}"><i class='fa fa-link'></i> <span>Beli Barang</span></a></li>
......
...@@ -94,6 +94,7 @@ Route::group(['middleware' => ['web','auth','inventori']], function () { ...@@ -94,6 +94,7 @@ Route::group(['middleware' => ['web','auth','inventori']], function () {
Route::group(['middleware' => ['web','auth','kasir']], function () { Route::group(['middleware' => ['web','auth','kasir']], function () {
Route::get('/ListCustomer', 'KasirController@ListCustomer'); Route::get('/ListCustomer', 'KasirController@ListCustomer');
Route::get('/ListTransaksi', 'KasirController@ListTransaksi'); Route::get('/ListTransaksi', 'KasirController@ListTransaksi');
Route::get('/cariCustomer','KasirController@cariCustomer');
Route::get('/addSaldo/{id}','KasirController@addSaldo'); Route::get('/addSaldo/{id}','KasirController@addSaldo');
Route::put('/saldo/{id}','KasirController@saldo'); Route::put('/saldo/{id}','KasirController@saldo');
}); });
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