Commit e1f85c35 by Juliper

back to owner

parent 5f547409
...@@ -4,6 +4,7 @@ namespace App\Http\Controllers; ...@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use App\RequestFasilitas; use App\RequestFasilitas;
use App\RequestHomestay; use App\RequestHomestay;
use App\Room;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\User; use App\User;
use App\Owner; use App\Owner;
...@@ -18,16 +19,35 @@ class OwnerController extends Controller ...@@ -18,16 +19,35 @@ class OwnerController extends Controller
return view('adminlte::layouts.owner.home'); return view('adminlte::layouts.owner.home');
} }
public function updateRoom(Request $request, $id){
$dataKamar = Room::find($id);
$dataKamar->jumlah_bed = $request['jumlah_bed'];
$dataKamar->fasilitas = $request['fasilitas'];
if($request->file('foto')==null){
$dataKamar->foto = $dataKamar->foto;
}else{
$file = $request->file('foto');
$fileName = $file->getClientOriginalName();
$request->file('foto')->move("img/",$fileName);
$dataKamar->gambar = $fileName;
}
$dataKamar->update();
return redirect('daftarKamar');
}
public function editRoom($id){
$dataKamar = Room::find($id);
return view('adminlte::layouts.owner.EditRoom')->with('data',$dataKamar);
}
public function daftarKamar(){ public function daftarKamar(){
/*$dataTrans = DB::table('homestay') $dataPemilik = DB::table('pemilikhomestay')
->join('transaksi','homestay.id','=','transaksi.id_homestay')
->join('pemilikhomestay','homestay.idPemilik','=','pemilikhomestay.id')
->select('transaksi.*','pemilikhomestay.nama','pemilikhomestay.noRekening')
->where('transaksi.id_pelanggan','=',$data[0]->id)
->get();
*/
$pem = DB::table('pemilikhomestay')
->select('pemilikhomestay.*') ->select('pemilikhomestay.*')
->where('pemilikhomestay.id_Akun','=',Auth::user()->id) ->where('pemilikhomestay.id_Akun','=',Auth::user()->id)
->get(); ->get();
...@@ -35,11 +55,11 @@ class OwnerController extends Controller ...@@ -35,11 +55,11 @@ class OwnerController extends Controller
$data = DB::table('homestay') $data = DB::table('homestay')
->join('pemilikhomestay','homestay.idPemilik','pemilikhomestay.id') ->join('pemilikhomestay','homestay.idPemilik','pemilikhomestay.id')
->join('kamar','homestay.id','=','kamar.idHomestay') ->join('kamar','homestay.id','=','kamar.idHomestay')
->select('kamar.*','homestay.*','pemilikhomestay.*') ->select('kamar.*')
->where('pemilikhomestay.id','=',$pem[0]->id) ->where('pemilikhomestay.id','=',$dataPemilik[0]->id)
->get(); ->get();
//dd($data);
dd("masuk gan",Auth::user()->id,$data,$pem); return view('adminlte::layouts.owner.listRoom')->with('data',$data)->with('count',$data->count());
} }
public function listTransaction(){ public function listTransaction(){
......
...@@ -26,13 +26,13 @@ ...@@ -26,13 +26,13 @@
</div> </div>
@endif @endif
<form action="" method="post" enctype="multipart/form-data"> <form action="{{url('editRoom/'.$data->id)}}" method="post" enctype="multipart/form-data">
<input type="hidden" name="_method" value="PUT"> <input type="hidden" name="_method" value="PUT">
<!-- {{csrf_field()}} --> {{csrf_field()}}
<!-- <label>Nama</label> <label>Jumlah Bed</label>
<input type="text" name="nama" value="" id="nama" class="form-control"> --> <input class="form-control" value="{{$data->jumlah_bed}}" name="jumlah_bed">
<label>Fasilitas</label> <label>Fasilitas</label>
<textarea name="fasilitas" value="" id="fasilitas" class="form-control" style="height:200px;"></textarea> <textarea name="fasilitas" value="{{$data->fasilitas}}" id="fasilitas" class="form-control" style="height:200px;"></textarea>
<label>Foto</label> <label>Foto</label>
<input type="file" value="Browse" name="foto" id="picture" > <input type="file" value="Browse" name="foto" id="picture" >
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
@section('main-content') @section('main-content')
<div class="container-fluid spark-screen"> <div class="container-fluid spark-screen">
<div class="row"> <div class="row">
<div class="col-md-10 col-md-offset-1"> <div class="col-md-12">
<div class="panel panel-default"> <div class="panel panel-default">
<div id="app"> <div id="app">
...@@ -41,18 +41,22 @@ ...@@ -41,18 +41,22 @@
<th>No Kamar</th> <th>No Kamar</th>
<th>Jumlah Bed</th> <th>Jumlah Bed</th>
<td>Detail</td> <td>Detail</td>
<td>Edit</td> <td>Foto</td>
<td>Delete</td> <td colspan="2">Aksi</td>
</tr> </tr>
@foreach($data as $a) @foreach($data as $a)
<tr> <tr>
<td>{{$a->nomor_kamar}}</td> <td>{{$a->nomor_kamar}}</td>
<td>{{$a->jumlah_bed}}</td> <td>{{$a->jumlah_bed}}</td>
<td> <td>{{$a->fasilitas}}</td>
<a href="{{url('room/'.$a->id)}}" class="btn btn-primary"><i class="glyphicon glyphicon-eye-open"></i></a> <td>@if($a->gambar == null)
<img alt="Belum ada foto">
@else
<img src="/img/{{$a->gambar}}">
@endif
</td> </td>
<td> <td>
<a href="{{url('room/'.$a->id.'/edit')}}" class="btn btn-primary"><i class="glyphicon glyphicon-edit"></i></a> <a href="{{url('editRoom/'.$a->id)}}" class="btn btn-primary"><i class="glyphicon glyphicon-edit"></i></a>
</td> </td>
<td> <td>
<form action="{{url('room/'.$a->id)}}" method="POST"> <form action="{{url('room/'.$a->id)}}" method="POST">
...@@ -62,8 +66,6 @@ ...@@ -62,8 +66,6 @@
</form> </form>
</td> </td>
</tr> </tr>
@endforeach @endforeach
</table> </table>
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
<li><a href="{{url('listowner')}}"><i class='fa fa-list'></i> <span>Melihat Daftar Owner</span></a></li> <li><a href="{{url('listowner')}}"><i class='fa fa-list'></i> <span>Melihat Daftar Owner</span></a></li>
@elseif(Auth::user()->role=="Owner") @elseif(Auth::user()->role=="Owner")
<li><a href="{{url('EditRoom')}}"><i class='fa fa-list'></i> <span>Edit Room</span></a></li>
<li><a href="{{url('pesanan')}}"><i class='fa fa-list'></i> <span>Daftar Pesanan</span></a></li> <li><a href="{{url('pesanan')}}"><i class='fa fa-list'></i> <span>Daftar Pesanan</span></a></li>
<li><a href="{{url('reqFasilitas')}}"><i class='fa fa-list'></i> <span>Request Fasilitas</span></a></li> <li><a href="{{url('reqFasilitas')}}"><i class='fa fa-list'></i> <span>Request Fasilitas</span></a></li>
<li><a href="#"><i class='fa fa-list'></i> <span>Add Book Manual</span></a></li> <li><a href="#"><i class='fa fa-list'></i> <span>Add Book Manual</span></a></li>
......
...@@ -47,9 +47,9 @@ Route::group(['middleware' => 'auth'], function () { ...@@ -47,9 +47,9 @@ Route::group(['middleware' => 'auth'], function () {
}); });
Route::get('EditRoom', function(){ /*Route::get('EditRoom', function(){
return view('adminlte::layouts.owner.EditRoom'); return view('adminlte::layouts.owner.EditRoom');
}); });*/
Route::get('AddBook', function(){ Route::get('AddBook', function(){
return view('adminlte::layouts.owner.AddBookManual'); return view('adminlte::layouts.owner.AddBookManual');
}); });
...@@ -57,7 +57,8 @@ Route::get('DataPemesanan', function(){ ...@@ -57,7 +57,8 @@ Route::get('DataPemesanan', function(){
return view('adminlte::layouts.admin.dataPemesanan'); return view('adminlte::layouts.admin.dataPemesanan');
}); });
Route::put('editRoom/{id}','OwnerController@updateRoom');
Route::get('editRoom/{id}','OwnerController@editRoom');
Route::get('daftarKamar','OwnerController@daftarKamar'); Route::get('daftarKamar','OwnerController@daftarKamar');
Route::get('pesanan','OwnerController@listTransaction'); Route::get('pesanan','OwnerController@listTransaction');
Route::put('upload/{id}','CustomerController@upload'); Route::put('upload/{id}','CustomerController@upload');
......
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