Commit 226a4f92 by PratiwiOkuli

Perbaikan pada Admin, perbaikan pada Admin data request

parent e37389a9
......@@ -9,9 +9,8 @@ use App\RequestBarang;
use App\DataRequest;
use App\Http\Requests;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Auth;
class CustomerController extends Controller
{
......@@ -76,17 +75,20 @@ class CustomerController extends Controller
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);
$request_barangs = new RequestBarang();
$request_barangs->user_id = $request->user_id;
$request_barangs->username = $request->username;
$request_barangs->nama_barang = $request->nama_barang;
$request_barangs->kategori = $request->kategori;
$request_barangs->harga =$request->harga;
$request_barangs->jumlah = $request->jumlah;
$harga = $request->harga;
$jumlah = $request->jumlah;
$total_harga = $harga * $jumlah;
$request_barangs->total_harga = $total_harga;
$request_barangs->status_request = $request->status_request;
$request_barangs->status_pengantaran = $request->status_pengantaran;
$request_barangs->save();
return redirect('RequestBarang');
}
......@@ -105,6 +107,7 @@ class CustomerController extends Controller
//----------------------------Histori Transaksi----------------------//
public function HistoryTransaksi()
{
return view('adminlte::customer.HistoryTransaksi.index');
$request_barangs = RequestBarang::all();
return view('adminlte::customer.HistoryTransaksi.index')->with('request_barangs', $request_barangs);
}
}
\ No newline at end of file
......@@ -7,6 +7,9 @@ use Illuminate\Http\Request;
use App\Http\Requests;
use App\Barang;
use App\RequestBarang;
use App\DataRequest;
class InventoriController extends Controller
{
......@@ -78,10 +81,82 @@ class InventoriController extends Controller
return redirect('ListBarang');
}
public function ListRequest()
{
$request_barangs = RequestBarang::all();
return view('adminlte::inventori.ListRequest.index', compact('request_barangs'));
}
public function ListRequest()
public function editRequest($id)
{
$request_barangs = RequestBarang::where('id', $id)->first();
return view('adminlte::inventori.ListRequest.edit')->with('request_barangs', $request_barangs);
}
//----------------------------Data Request----------------------//
public function DataRequest()
{
$data_requests = DataRequest::all();
return view('adminlte::inventori.DataRequest.index', compact('data_requests'));
}
public function createDataRequest()
{
return view('adminlte::inventori.DataRequest.createDataRequest');
}
public function storeDataRequest(Request $request)
{
$this->validate($request, [
'nama_barang' => 'required',
'kategori' => 'required',
'harga' => 'required',
]);
$data_requests = new DataRequest();
$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 editDataRequest($id)
{
return view('adminlte::inventori.ListRequest.index');
$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
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\User;
use App\Transaksi;
class KasirController extends Controller
{
public function ListCustomer()
{
return view('adminlte::kasir.ListCustomer.index');
$users = User::where('status', 'like', 'customer')->get();
return view('adminlte::kasir.ListCustomer.index', compact('users'));
}
public function ListTransaksi()
{
$transaksis = Transaksi::all();
return view('adminlte::kasir.ListTransaksi.index', compact('transaksis'));
}
public function addSaldo($id)
{
$users = User::where('id', $id)->first();
return view('adminlte::kasir.ListCustomer.addSaldo')->with('users', $users);
}
public function saldo(Request $request,$id){
$data = User::find($id);
$data->saldo = $data->saldo+$request['saldo'];
$data->update();
return redirect('ListCustomer');
}
public function KonfirmasiBarang($id){
DB::table('request_barangs')->where('id', $id)->update(['status_request'=> 1]);
return redirect()->back();
}
}
\ No newline at end of file
......@@ -8,7 +8,7 @@ class RequestBarang extends Model
{
protected $table = 'request_barangs';
protected $fillable = [
'username', 'nama_barang', 'kategori','jumlah','harga','total_harga','status_request','status_pengantaran',
'username', 'nama_barang', 'kategori','jumlah','harga','total_harga','user_id','status_request','status_pengantaran',
];
public function user(){
......
......@@ -15,7 +15,7 @@ class User extends Authenticatable
* @var array
*/
protected $fillable = [
'name','email','username', 'status', 'password','saldo',
'name','email','username', 'status', 'password','saldo'
];
/**
......
......@@ -49,7 +49,7 @@
<span class="glyphicon glyphicon-log-in form-control-feedback"></span>
</div>
<div class="form-group has-feedback">
<input type="int" class="form-control" placeholder="0" name="saldo" readonly/>
<input type="hidden" class="form-control" placeholder="0" name="saldo" readonly/>
<span class="glyphicon glyphicon-log-in form-control-feedback"></span>
</div>
<div class="form-group has-feedback">
......
......@@ -49,15 +49,12 @@
<span class="glyphicon glyphicon-log-in form-control-feedback"></span>
</div>
<div class="form-group has-feedback">
<input type="int" class="form-control" placeholder="0" ame="saldo"readonly/>
<input type="hidden" class="form-control" placeholder="0" ame="saldo"readonly/>
<span class="glyphicon glyphicon-log-in form-control-feedback"></span>
</div>
<div class="form-group has-feedback">
<select name="status" class="form-control">
<option value="user">User</option>
<option value="admin">Admin</option>
<option value="kasir">Kasir</option>
<option value="inventori">Inventori</option>
</select>
</div>
<div class="row">
......
......@@ -9,14 +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">
<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>Status Request</th>
</tr>
</thead>
</div>
</div>
</div>
</div>
<tbody>
@foreach($request_barangs 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>
</tr>
@endforeach
</tbody>
</table>
@endsection
......@@ -23,8 +23,9 @@
</div>
<div class="form-group">
<label class="col-md-4 control-label">Username</label>
<div class="col-lg-8">
<input name="user_id" class="form-control" type="hidden" value="{{$user->username}}" readonly>
<input name="username" class="form-control" type="text" value="{{$user->username}}" readonly>
</div>
</div>
......
......@@ -8,8 +8,6 @@
Dashboard User SI UD-Anthoni
@endsection
@section('main-content')
<div class="container-fluid spark-screen">
<div class="row">
......
@extends('adminlte::layouts.app')
@section('htmlheader_title')
Create
@endsection
@section('contentheader_title')
Page Create List Barang
@endsection
@section('main-content')
<div class="container">
<div class="col-md-8 col-md-offset-2">
<div class="panel-body">
<form class="form-horizontal" action="{{ url('storeDataRequest') }}" method="POST">
{!! csrf_field() !!}
<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_barang" value="{{ old('nama_barang') }}" >
@if ($errors->has('nama_barang'))
<span class="help-block">
<strong>{{ $errors->first('nama_barang') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group{{ $errors->has('kategori') ? ' has-error' : '' }}">
<label for="title" class="col-md-4 control-label">Kategori</label>
<div class="col-md-6">
<select name="kategori" class="form-control">
<option value="makanan">Makanan</option>
<option value="minuman">Minuman</option>
<option value="alat tulis">Alat Tulis</option>
<option value="alat mandi">Alat Mandi</option>
</select>
@if ($errors->has('kategori'))
<span class="help-block">
<strong>{{ $errors->first('kategori') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group{{ $errors->has('harga') ? ' has-error' : '' }}">
<label for="title" class="col-md-4 control-label">Harga</label>
<div class="col-md-6">
<input type="text" class="form-control" name="harga" value="{{ old('harga') }}" >
@if ($errors->has('harga'))
<span class="help-block">
<strong>{{ $errors->first('harga') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<button type="submit" class="btn btn-primary">
Tambah
</button>
</div>
</div>
</form>
</div>
</div>
</div>
@endsection
\ No newline at end of file
@extends('adminlte::layouts.app')
@section('htmlheader_title')
Edit
@endsection
@section('contentheader_title')
Page Edit Request
@endsection
@section('main-content')
<div class="container">
<div class="col-md-8 col-md-offset-2">
<div class="panel-body">
<form class="form-horizontal" action="{{ url('updateDataRequest', $data_requests->id) }}" method="POST">
{!! csrf_field() !!}
<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_barang" value="{{ $data_requests->nama_barang}}" >
@if ($errors->has('nama_barang'))
<span class="help-block">
<strong>{{ $errors->first('nama_barang') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group{{ $errors->has('kategori') ? ' has-error' : '' }}">
<label for="title" class="col-md-4 control-label" value="{{ $data_requests->kategori }}">Kategori</label>
<div class="col-md-6">
<select name="kategori" class="form-control">
<option value="makanan">Makanan</option>
<option value="minuman">Minuman</option>
<option value="alat tulis">Alat Tulis</option>
<option value="alat mandi">Alat Mandi</option>
</select>
@if ($errors->has('kategori'))
<span class="help-block">
<strong>{{ $errors->first('kategori') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group{{ $errors->has('harga') ? ' has-error' : '' }}">
<label for="title" class="col-md-4 control-label">harga</label>
<div class="col-md-6">
<input type="text" class="form-control" name="harga" value="{{ $data_requests->harga }}" >
@if ($errors->has('harga'))
<span class="help-block">
<strong>{{ $errors->first('harga') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-primary">
Simpan
</button>
</div>
</div>
</form>
</div>
</div>
</div>
@endsection
\ No newline at end of file
@extends('adminlte::layouts.app')
@section('htmlheader_title')
{{ trans('adminlte_lang::message.home') }}
@endsection
@section('contentheader_title')
<center>Data Request</center>
@endsection
@section('main-content')
<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('/editDataRequest', $dataRequest->id) }}" type="submit" button type="button" class="btn btn-warning">Edit</a>
<a href="{{ url('/deleteDataRequest', $dataRequest->id) }}" class="btn btn-warning">Delete</a>
</td>
</tr>
@endforeach
</tbody>
</table>
<a href="{{ url('/createDataRequest') }}" button type="button" class="btn btn-info">Create</a></button>
@endsection
......@@ -5,28 +5,39 @@
@endsection
@section('contentheader_title')
<center>List Request</center>
<center>Request Barang</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 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>
<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>Status Request</th>
<th>Action</th>
</tr>
</thead>
<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>
<tbody>
@foreach($request_barangs 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>
<a href="{{ url('/KonfirmasiBarang', $requestBarang->id) }}" type="submit" button type="button" class="btn btn-warning">Konfirmasi</a>
</td>
</tr>
@endforeach
</tbody>
</table>
@endsection
@extends('adminlte::layouts.app')
@section('htmlheader_title')
{{ trans('adminlte_lang::message.home') }}
@endsection
@section('contentheader_title')
<center>Add Saldo</center>
@endsection
@section('main-content')
<div class="container">
<div class="col-md-8 col-md-offset-2">
<div class="panel-body">
<form class="form-horizontal" action="{{ url('/saldo', $users->id) }}" method="POST">
<input type="hidden" name="_method" value="put">
{!! csrf_field() !!}
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
<label for="title" class="col-md-4 control-label">Name</label>
<div class="col-md-6">
<input type="text" class="form-control" name="name" value="{{ $users->name}}" readonly>
@if ($errors->has('name'))
<span class="help-block">
<strong>{{ $errors->first('name') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group{{ $errors->has('saldo') ? ' has-error' : '' }}">
<label for="title" class="col-md-4 control-label">Saldo</label>
<div class="col-md-6">
<input type="number" class="form-control" name="saldo" value="{{ $users->saldo}}" readonly>
@if ($errors->has('saldo'))
<span class="help-block">
<strong>{{ $errors->first('saldo') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group">
<label for="title" class="col-md-4 control-label">Add Saldo</label>
<div class="col-md-6">
<input type="number" class="form-control" name="saldo" min="50000" class="form-control" required >
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-primary">
Simpan
</button>
</div>
</div>
</form>
</div>
</div>
</div>
@endsection
......@@ -9,24 +9,28 @@
@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>
<table class="table table-striped">
<thead>
<tr>
<th>Nama</th>
<th>Email</th>
<th>username</th>
<th>Saldo</th>
</tr>
</thead>
<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>
<tbody>
@foreach($users as $user)
<tr>
<td>{{$user->name}}</td>
<td>{{$user->email}}</td>
<td>{{$user->username}}</td>
<td>{{$user->saldo}}</td>
<td>
<a href="{{ url('/addSaldo', $user->id) }}" type="submit" button type="button" class="btn btn-warning">Add Saldo</a>
</tr>
@endforeach
</tbody>
</table>
@endsection
......@@ -5,19 +5,20 @@
@endsection
@section('contentheader_title')
<center>Laporan Transaksi</center>
<center>List Customer</center>
@endsection
@section('main-content')
<table class="table table-striped">
<table class="table table-striped">
<thead>
<tr>
<th>Username/th>
<th>Username</th>
<th>Nama Barang</th>
<th>Kategori</th>
<th>Jumlah</th>
<th>Total Harga</th>
<th>Status Pengantaran</th>
<!-- <th>Status Pengantaran</th> -->
<th>Action</th>
</tr>
</thead>
......@@ -29,11 +30,12 @@
<td>{{$transaksi->kategori}}</td>
<td>{{$transaksi->jumlah}}</td>
<td>{{$transaksi->total_harga}}</td>
<!-- <td>{{$transaksi->status_pengantaran}}</td> -->
<td>
<a href="{{ url('/konfirmasiAntar', $transaksi->id) }}" type="submit" button type="button" class="btn btn-warning">Konfirmasi</a>
<td>
<a href="{{ url('/konfirmasi', $transaksi->id) }}" type="submit" button type="button" class="btn btn-warning">Konfirmasi</a>
</tr>
@endforeach
</tbody>
</table>
@endsection
......@@ -35,7 +35,7 @@
@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>
<!-- <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>
......
......@@ -58,8 +58,6 @@ 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');
});
......@@ -95,5 +93,7 @@ Route::group(['middleware' => ['web','auth','inventori']], function () {
Route::group(['middleware' => ['web','auth','kasir']], function () {
Route::get('/ListCustomer', 'KasirController@ListCustomer');
});
\ No newline at end of file
Route::get('/ListTransaksi', 'KasirController@ListTransaksi');
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