Commit 5a06f618 by jhon

Customer -> tampilan Beli Barang, Request Barang, Check Saldo, Histori Transaksi

parent 42672a59
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class DataRequest extends Model
{
protected $table='data_requests';
protected $fillable = [
'nama_barang', 'kategori','harga',
];
}
<?php
namespace App\Http\Controllers;
use App\User;
use App\Barang;
use App\RequestBarang;
use App\DataRequest;
use App\Http\Requests;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class CustomerController extends Controller
{
//----------------------------Pembelian Barang----------------------//
public function BeliBarang()
{
return view('adminlte::customer.BeliBarang.index');
$barangs = Barang::all();
return view('adminlte::customer.BeliBarang.index', compact('barangs'));
}
public function create()
{
return view('adminlte::inventori.BeliBarang.create');
}
public function store(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();
return redirect('BeliBarang');
}
//----------------------------Data Request----------------------//
public function RequestBarang()
{
return view('adminlte::customer.RequestBarang.index');
$data_requests = DataRequest::all();
return view('adminlte::customer.RequestBarang.index', compact('data_requests'));
}
public function createRequest($id)
{
$data_requests = DataRequest::where('id', $id)->first();
return view('adminlte::customer.RequestBarang.createRequest')->with('data_requests', $data_requests);
}
public function saveRequest(Request $request)
{
$input = $request->all();
RequestBarang::create($input);
// $this->data['request_barang']=DB::table('request_barangs')->where('status','==',1)->get();
// $transaksi = new Transaksi();
// $transaksi->tempat = $request->tempat;
// $transaksi->kerusakan = $request->kerusakan;
// $transaksi->petugas = $request->petugas;
// $transaksi->schedule = $request->schedule;
// $transaksi->user_id = $request->user_id;
// $transaksi->save();
// return redirect('dataOrder',$this->data);
return redirect('RequestBarang');
}
//----------------------------Check Saldo----------------------------//
public function CheckSaldo()
{
$users = User::all();
return view('adminlte::customer.CheckSaldo.index');
}
//----------------------------Histori Transaksi----------------------//
public function HistoryTransaksi()
{
return view('adminlte::customer.HistoryTransaksi.index');
}
}
\ No newline at end of file
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class RequestBarang extends Model
{
protected $table = 'request_barangs';
protected $fillable = [
'username', 'nama_barang', 'kategori','jumlah','harga','total_harga','status_request','status_pengantaran',
];
public function user(){
return $this->belongsTo(User::class);
}
}
......@@ -9,24 +9,32 @@
@endsection
@section('main-content')
<div class="container-fluid spark-screen">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<!-- <div class="panel-heading">Home</div>
<div class="panel-body">
<label style="font-weight:bolder;color:black;font-size: 17px">List Pegawai</label><br>
Merupakan halaman list pegawai UD Antoni. Admin dapat melihat daftar pegawai dan melakukan penghapusan dan penambahan pegawai baru.
<br><br>
<label style="font-weight:bolder;color:black;font-size: 17px">Laporan Transaksi</label><br>
Merupakan halaman list transaksi dari layanan admin. User dapat melihat daftar member cafe dan melakukan penghapusan terhadap member.
</li>
{{ trans('adminlte_lang::message.logged') }}
</div> -->
</div>
</div>
</div>
</div>
<table class="table table-striped">
<thead>
<tr>
<th>Nama Barang</th>
<th>Stock</th>
<th>Harga</th>
<th>Kategori</th>
<th>Gambar</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@foreach($barangs as $barang)
<tr>
<td>{{$barang->nama}}</td>
<td>{{$barang->jumlah}}</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('/delete', $barang->id) }}" <onclick="return confirm('Yakin mau hapus data ini sob?')" class="btn btn-warning">Delete</a> -->
</tr>
@endforeach
</tbody>
</table>
<a href="{{ url('/create') }}" button type="button" class="btn btn-info">Create</a></button>
@endsection
@extends('adminlte::layouts.app')
@section('htmlheader_title')
{{ trans('adminlte_lang::message.home') }}
@endsection
@section('contentheader_title')
<center>Check Saldo</center>
@endsection
@section('main-content')
<div class="container-fluid spark-screen">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<p style="font-size: 15px">Saldo= Rp. {{$user->saldo}}</p>
</div>
</div>
</div>
@endsection
@extends('adminlte::layouts.app')
@section('htmlheader_title')
{{ trans('adminlte_lang::message.home') }}
@endsection
@section('contentheader_title')
<center>Histori Transaksi</center>
@endsection
@section('main-content')
<div class="container-fluid spark-screen">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
</div>
</div>
</div>
</div>
@endsection
@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('/saveRequest')}}" >
{!! csrf_field() !!}
<div class="col-md-9 personal-info">
<div class="form-group">
<div class="col-lg-8">
<input name="user_id" class="form-control" type="hidden" value="{{$user->id}}" readonly>
</div>
</div>
<div class="form-group">
<div class="col-lg-8">
<input name="user_id" class="form-control" type="hidden" 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="{{$data_requests->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="{{$data_requests->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="{{$data_requests->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">
<label class="col-md-4 control-label">Total Harga</label>
<div class="col-md-6">
<span class="form-control" id="total_harga"></span>
</div>
</div>
<div class="form-group{{ $errors->has('status_request') ? ' has-error' : '' }}">
<label for="title" class="col-md-4 control-label">Status Request</label>
<div class="col-md-6">
<select name="status_request" class="form-control">
<option value="Request">Request</option>
</select>
@if ($errors->has('status_request'))
<span class="help-block">
<strong>{{ $errors->first('status_request') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group{{ $errors->has('status_request') ? ' 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="Request">Request</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*{{$data_requests->harga}};
return;
}
</script>
@endsection
......@@ -9,24 +9,27 @@
@endsection
@section('main-content')
<div class="container-fluid spark-screen">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<!-- <div class="panel-heading">Home</div>
<div class="panel-body">
<label style="font-weight:bolder;color:black;font-size: 17px">List Pegawai</label><br>
Merupakan halaman list pegawai UD Antoni. Admin dapat melihat daftar pegawai dan melakukan penghapusan dan penambahan pegawai baru.
<br><br>
<label style="font-weight:bolder;color:black;font-size: 17px">Laporan Transaksi</label><br>
Merupakan halaman list transaksi dari layanan admin. User dapat melihat daftar member cafe dan melakukan penghapusan terhadap member.
</li>
{{ trans('adminlte_lang::message.logged') }}
</div> -->
</div>
</div>
</div>
</div>
<table class="table table-striped">
<thead>
<tr>
<th>Nama Barang</th>
<th>Kategori</th>
<th>Harga</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@foreach($data_requests as $dataRequest)
<tr>
<td>{{$dataRequest->nama_barang}}</td>
<td>{{$dataRequest->kategori}}</td>
<td>{{$dataRequest->harga}}</td>
<td>
<a href="{{ url('/createRequest', $dataRequest->id) }}" type="submit" button type="button" class="btn btn-warning">Request</a>
</td>
</tr>
@endforeach
</tbody>
</table>
@endsection
......@@ -32,32 +32,26 @@
<!-- Sidebar Menu -->
<ul class="sidebar-menu">
<li class="header">{{ trans('adminlte_lang::message.header') }}</li>
<!-- Optionally, you can add icons to the links -->
<!-- <li class="active"><a href="{{ url('home') }}"><i class='fa fa-link'></i> <span>{{ trans('adminlte_lang::message.home') }}</span></a></li>
<li><a href="#"><i class='fa fa-link'></i> <span>List Barang</span></a></li>
<li class="treeview">
<a href="#"><i class='fa fa-link'></i> <span>{{ trans('adminlte_lang::message.multilevel') }}</span> <i class="fa fa-angle-left pull-right"></i></a>
<ul class="treeview-menu">
<li><a href="#">{{ trans('adminlte_lang::message.linklevel2') }}</a></li>
<li><a href="#">{{ trans('adminlte_lang::message.linklevel2') }}</a></li>
</ul>
</li> -->
@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>
<li><a href="{{ url('/RequestBarang') }}"><i class='fa fa-link'></i> <span>Request 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>
@elseif(Auth::user()->status=="inventori")
<li><a href="{{ url('/ListBarang') }}"><i class='fa fa-link'></i> <span>List Barang</span></a></li>
<li><a href="{{ url('/ListRequest') }}"><i class='fa fa-link'></i> <span>List Request</span></a></li>
<li><a href="{{ url('/ListRequest') }}"><i class='fa fa-link'></i> <span>List Transaksi Request</span></a></li>
<li><a href="{{ url('/DataRequest') }}"><i class='fa fa-link'></i> <span>Data Request</span></a></li>
@elseif(Auth::user()->status=="kasir")
<li><a href="{{ url('/ListCustomer') }}"><i class='fa fa-link'></i> <span>List Customer</span></a></li>
<li><a href="{{ url('/ListTransaksi') }}"><i class='fa fa-link'></i> <span>List Transaksi</span></a></li>
@endif
......
......@@ -33,48 +33,61 @@ Route::group(['middleware' => ['web','auth']], function(){
Route::group(['middleware' => ['web','auth','admin']], function () {
Route::get('/laporanTransaksi', 'AdminController@laporanTransaksi');
Route::get('/listPetugas', 'AdminController@listPetugas');
// Route::get('/pegawai', 'OrderController@index');
// Route::get('/create', 'OrderController@create');
// Route::post('/store', 'OrderController@store');
// Route::get('/edit/{id}', 'OrderController@edit');
// Route::post('/update/{id}', 'OrderController@update');
// Route::get('/delete/{id}', 'OrderController@destroy');
// Route::get('/allTransaksi', 'TransaksiController@allTransaksi');
});
Route::group(['middleware' => ['web','auth','customer']], function () {
Route::get('/BeliBarang', 'CustomerController@BeliBarang');
Route::get('/CheckSaldo', 'CustomerController@CheckSaldo');
Route::get('/RequestBarang', 'CustomerController@RequestBarang');
// Route::get('/pegawai', 'OrderController@index');
// Route::get('/create', 'OrderController@create');
// Route::post('/store', 'OrderController@store');
// Route::get('/edit/{id}', 'OrderController@edit');
// Route::post('/update/{id}', 'OrderController@update');
// Route::get('/delete/{id}', 'OrderController@destroy');
// Route::get('/allTransaksi', 'TransaksiController@allTransaksi');
Route::get('/createRequest/{id}', 'CustomerController@createRequest');
Route::post('/storeRequest', 'CustomerController@storeRequest');
Route::post('/saveRequest', 'CustomerController@saveRequest');
Route::get('/HistoryTransaksi', 'CustomerController@HistoryTransaksi');
});
Route::group(['middleware' => ['web','auth','inventori']], function () {
Route::get('/ListBarang', 'InventoriController@ListBarang');
Route::get('/ListBarang', 'InventoriController@listBarang');
Route::get('/create', 'InventoriController@create');
Route::post('/store', 'InventoriController@store');
Route::get('/edit/{id}', 'InventoriController@edit');
Route::post('/update/{id}', 'InventoriController@update');
Route::get('/delete/{id}', 'InventoriController@destroy');
Route::get('/ListRequest', 'InventoriController@ListRequest');
Route::get('/editRequest/{id}', 'InventoriController@editRequest');
Route::post('/update/{id}', 'InventoriController@update');
Route::get('/delete/{id}', 'InventoriController@destroy');
Route::get('/DataRequest', 'InventoriController@DataRequest');
Route::get('/createDataRequest', 'InventoriController@createDataRequest');
Route::post('/storeDataRequest', 'InventoriController@storeDataRequest');
Route::get('/editDataRequest/{id}', 'InventoriController@editDataRequest');
Route::post('/updateDataRequest/{id}', 'InventoriController@updateDataRequest');
Route::get('/deleteDataRequest/{id}', 'InventoriController@destroyDataRequest');
});
Route::group(['middleware' => ['web','auth','kasir']], function () {
Route::get('/ListCustomer', 'KasirController@ListCustomer');
// Route::get('/pegawai', 'OrderController@index');
// Route::get('/create', 'OrderController@create');
// Route::post('/store', 'OrderController@store');
// Route::get('/edit/{id}', 'OrderController@edit');
// Route::post('/update/{id}', 'OrderController@update');
// Route::get('/delete/{id}', 'OrderController@destroy');
// Route::get('/allTransaksi', 'TransaksiController@allTransaksi');
});
\ No newline at end of file
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