Commit f2274a90 by jhon

perbaikan List Barang

parent eea96b68
......@@ -7,6 +7,6 @@ use Illuminate\Database\Eloquent\Model;
class Barang extends Model
{
protected $fillable = [
'nama', 'jumlah', 'harga','deskripsi','kategori','gambar',
'nama', 'stock', 'harga','deskripsi','kategori','gambar',
];
}
......@@ -3,19 +3,11 @@
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Barang;
use App\RequestBarang;
use App\DataRequest;
use App\RequestBarang;
use App\DataRequest;
class InventoriController extends Controller
{
public function ListBarang()
......@@ -32,16 +24,16 @@ class InventoriController extends Controller
public function store(Request $request)
{
$this->validate($request, [
'nama' => 'required',
'jumlah' => 'required',
'nama_barang' => 'required',
'stock' => 'required',
'harga' => 'required',
'kategori' => 'required',
'gambar' => 'required',
]);
$barangs = new Barang();
$barangs->nama = $request['nama'];
$barangs->jumlah = $request['jumlah'];
$barangs->nama_barang = $request['nama_barang'];
$barangs->stock = $request['stock'];
$barangs->harga = $request['harga'];
$barangs->kategori = $request['kategori'];
$barangs->gambar = $request['gambar'];
......@@ -60,16 +52,16 @@ class InventoriController extends Controller
public function update(Request $request, $id)
{
$this->validate($request, [
'nama' => 'required',
'jumlah' => 'required',
'nama_barang' => 'required',
'stock' => 'required',
'harga' => 'required',
'kategori' => 'required',
'gambar' => 'required',
]);
$barangs = Barang::findOrFail($id);
$barangs->nama = $request->nama;
$barangs->jumlah = $request->jumlah;
$barangs->nama_barang = $request->nama_barang;
$barangs->stock = $request->stock;
$barangs->harga = $request->harga;
$barangs->kategori = $request->kategori;
$barangs->gambar = $request->gambar;
......@@ -86,14 +78,6 @@ class InventoriController extends Controller
return redirect('ListBarang');
}
public function ListRequest()
{
$request_barangs = RequestBarang::all();
return view('adminlte::inventori.ListRequest.index', compact('request_barangs'));
}
<<<<<<< HEAD
//----------------------------List Request----------------------//
public function ListRequest()
......@@ -105,10 +89,6 @@ class InventoriController extends Controller
public function editRequest($id)
{
=======
public function editRequest($id)
{
>>>>>>> 226a4f92be2de6ce884543bf9425346660a5031f
$request_barangs = RequestBarang::where('id', $id)->first();
return view('adminlte::inventori.ListRequest.edit')->with('request_barangs', $request_barangs);
}
......@@ -142,7 +122,6 @@ class InventoriController extends Controller
$data_requests->harga = $request['harga'];
$data_requests->save();
return redirect('DataRequest');
<<<<<<< HEAD
}
......@@ -176,42 +155,6 @@ class InventoriController extends Controller
$data_requests = DataRequest::find($id);
$data_requests->delete();
return redirect('DataRequest');
=======
>>>>>>> 226a4f92be2de6ce884543bf9425346660a5031f
}
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');
}
}
\ No newline at end of file
......@@ -3,6 +3,7 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use Illuminate\Support\Facades\Input;
use App\User;
use App\Transaksi;
......@@ -36,8 +37,21 @@ class KasirController extends Controller
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){
DB::table('request_barangs')->where('id', $id)->update(['status_request'=> 1]);
return redirect()->back();
}
}
\ No newline at end of file
......@@ -14,25 +14,25 @@
<div class="panel-body">
<form class="form-horizontal" action="{{ url('store') }}" method="POST">
{!! csrf_field() !!}
<div class="form-group{{ $errors->has('nama') ? ' has-error' : '' }}">
<label for="title" class="col-md-4 control-label">Nama</label>
<div class="form-group{{ $errors->has('nama_barang') ? ' has-error' : '' }}">
<label for="title" class="col-md-4 control-label">Nama Barang</label>
<div class="col-md-6">
<input type="text" class="form-control" name="nama" value="{{ old('nama') }}" >
@if ($errors->has('nama'))
<input type="text" class="form-control" name="nama_barang" value="{{ old('nama_barang') }}" >
@if ($errors->has('nama_barang'))
<span class="help-block">
<strong>{{ $errors->first('nama') }}</strong>
<strong>{{ $errors->first('nama_barang') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group{{ $errors->has('jumlah') ? ' has-error' : '' }}">
<label for="title" class="col-md-4 control-label">Jumlah</label>
<div class="form-group{{ $errors->has('stock') ? ' has-error' : '' }}">
<label for="title" class="col-md-4 control-label">Stock</label>
<div class="col-md-6">
<input type="text" class="form-control" name="jumlah" value="{{ old('jumlah') }}" >
@if ($errors->has('jumlah'))
<input type="text" class="form-control" name="stock" value="{{ old('stock') }}" >
@if ($errors->has('stock'))
<span class="help-block">
<strong>{{ $errors->first('jumlah') }}</strong>
<strong>{{ $errors->first('stock') }}</strong>
</span>
@endif
</div>
......
......@@ -14,13 +14,13 @@
<div class="panel-body">
<form class="form-horizontal" action="{{ url('update', $barangs->id) }}" method="POST">
{!! 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>
<div class="col-md-6">
<input type="text" class="form-control" name="nama" value="{{ $barangs->nama}}" >
@if ($errors->has('nama'))
<input type="text" class="form-control" name="nama_barang" value="{{ $barangs->nama_barang}}" >
@if ($errors->has('nama_barang'))
<span class="help-block">
<strong>{{ $errors->first('nama') }}</strong>
<strong>{{ $errors->first('nama_barang') }}</strong>
</span>
@endif
</div>
......@@ -28,12 +28,12 @@
<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">
<input type="text" class="form-control" name="jumlah" value="{{ $barangs->jumlah}}" >
@if ($errors->has('jumlah'))
<input type="text" class="form-control" name="stock" value="{{ $barangs->stock}}" >
@if ($errors->has('stock'))
<span class="help-block">
<strong>{{ $errors->first('jumlah') }}</strong>
<strong>{{ $errors->first('stock') }}</strong>
</span>
@endif
</div>
......@@ -70,7 +70,7 @@
</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>
<div class="col-md-6">
<input type="file" class="inputimages" name="gambar" value="{{ $barangs->gambar }}" >
......
......@@ -24,8 +24,8 @@
<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><img src="{{ asset('image/'. $barang->gambar) }}" style="height: 150px; width: 200px; "> </td>
......
......@@ -5,6 +5,12 @@
@endsection
@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>
@endsection
......
......@@ -35,7 +35,6 @@
@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('laporanTransaksi') }}"><i class='fa fa-link'></i> <span>Laporan Transaksi</span></a></li> -->
@elseif(Auth::user()->status=="customer")
<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 () {
Route::group(['middleware' => ['web','auth','kasir']], function () {
Route::get('/ListCustomer', 'KasirController@ListCustomer');
Route::get('/ListTransaksi', 'KasirController@ListTransaksi');
Route::get('/cariCustomer','KasirController@cariCustomer');
Route::get('/addSaldo/{id}','KasirController@addSaldo');
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