Commit ffc69484 by Juliper

no message

parent 4789f46f
...@@ -35,6 +35,63 @@ class GuestController extends Controller ...@@ -35,6 +35,63 @@ class GuestController extends Controller
return view('welcome'); return view('welcome');
} }
public function cari(Request $request){
$data = Homestay::all();
//$a = null;
//$book_start[] = null;
$i = 0;
foreach ($data as $a){
$book_start = DB::table('daftar_book')
->select('daftar_book.*')
->where('daftar_book.tanggal_mulai','=',$request['tanggal_mulai'])
->get();
$book_finish = DB::table('daftar_book')
->select('daftar_book.*')
->where('daftar_book.tanggal_berakhir','=',$request['tanggal_selesai'])
->get();
if($book_start->count() > 0){
dd($book_start);
//dd($book_start[0]->jumlah_kamar);
}else{
if($book_finish->count() > 0){
}else{
if($request['jumlah_Tamu'] > $request['jumlah_kamar'] * 2){
dd('ngak bisa');
}else{
$dataHomestay[$i] = DB::table('homestay')
->where('homestay.id','=',$a->id)
->get();
}
}
}
$i++;
}
// $j=0;
// //dd($dataHomestay[1][0]->nama_homestay);//,$dataHomestay[1]->nama_homestay,$dataHomestay[2]->nama_homestay);
// foreach ($dataHomestay as $b){
// echo $b[0]->nama_homestay;
// //echo $j;
//// if($j==1){
//// dd($b[0]);
//// }
// echo '<br>';
// $j++;
// }
return view('searchhomestay')->with('data',$dataHomestay);
//dd($i,$book_start[0],$book_start[1],$book_start[2],$book_finish[0],$book_finish[1],$book_finish[2]);
//dd($request['tanggal_mulai'],$request['jumlah_hari'],$request['tanggal_selesai'],$request['jumlah_Tamu'],$request['jumlah_kamar']);
}
//Menyimpan data Pelanggan disaat melakukan Pendaftaran //Menyimpan data Pelanggan disaat melakukan Pendaftaran
public function registerStore(Request $data){ public function registerStore(Request $data){
......
...@@ -9,7 +9,7 @@ class Room extends Model ...@@ -9,7 +9,7 @@ class Room extends Model
protected $table = "kamar"; protected $table = "kamar";
protected $fillable = [ protected $fillable = [
'idHomestay', 'jumlah_bed', 'fasilitas','nomor_kamar','id_transaksi' 'idHomestay', 'jumlah_bed', 'fasilitas','nomor_kamar','id_transaksi','tamu_per_kamar',
]; ];
public $timestamps = false; public $timestamps = false;
......
...@@ -26,37 +26,34 @@ ...@@ -26,37 +26,34 @@
<div class="col-md-12 col-sm-12 agileits w3layouts contact-grid contact-grid-2" style="background-color: #f3f3f3; <div class="col-md-12 col-sm-12 agileits w3layouts contact-grid contact-grid-2" style="background-color: #f3f3f3;
padding-top: 28px; padding-bottom: 28px; padding-top: 28px; padding-bottom: 28px;
"> ">
<form action="{{url('book')}}" method="post"> <form action="{{url('cari')}}">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<div class="col-md-2 col-sm-2 agileits w3layouts contact-grid contact-grid-2 "></div> <div class="col-md-2 col-sm-2 agileits w3layouts contact-grid contact-grid-2 "></div>
<div class="col-md-2 col-sm-2 agileits w3layouts contact-grid contact-grid-2 "> <div class="col-md-2 col-sm-2 agileits w3layouts contact-grid contact-grid-2 ">
<label>Tanggal Check-in:</label> <label>Tanggal Check-in:</label>
<input class="date agileits w3layouts" id="datepicker1" name="tanggal" type="text" value="Tanggal Check in" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = '';}"> <input class="date agileits w3layouts" id="datepicker1" name="tanggal_mulai" type="text" required value="Tanggal Check in" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = '';}">
</div> </div>
<div class="col-md-2 col-sm-2 agileits w3layouts contact-grid contact-grid-2 "> <div class="col-md-2 col-sm-2 agileits w3layouts contact-grid contact-grid-2 ">
<label>Durasi</label> <label>Durasi</label>
<input type="text" class="text wow agileits w3layouts " name="jumlah_hari" placeholder="Lama Menginap" style="background-color: white; color: black"> <input type="number" min="1" class="text wow agileits w3layouts " name="jumlah_hari" required onchange="updateDate(this)" placeholder="Lama Menginap" style="background-color: white; color: black">
</div> </div>
<div class="col-md-2 col-sm-2 agileits w3layouts contact-grid contact-grid-2 "> <div class="col-md-2 col-sm-2 agileits w3layouts contact-grid contact-grid-2 ">
<label>Tanggal Check-out:</label> <label>Tanggal Check-out:</label>
<input class="date agileits w3layouts" id="datepicker1" name="tanggal" type="text" value="Tanggal Check Out" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = '';}"> <input class="date agileits w3layouts" id="datepicker2" name="tanggal_selesai" type="text" value="Tanggal Check Out" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = '';}">
</div> </div>
<div class="col-md-1 col-sm-2 agileits w3layouts contact-grid contact-grid-2 "> <div class="col-md-1 col-sm-2 agileits w3layouts contact-grid contact-grid-2 ">
<label>Tamu :</label> <label>Tamu :</label>
<input type="number" min="0" class="text wow agileits w3layouts " name="jumlah_Tamu" placeholder="" style="background-color: white; color: black"> <input type="number" min="1" class="text wow agileits w3layouts " required name="jumlah_Tamu" placeholder="" style="background-color: white; color: black">
</div> </div>
<div class="col-md-1 col-sm-2 agileits w3layouts contact-grid contact-grid-2 "> <div class="col-md-1 col-sm-2 agileits w3layouts contact-grid contact-grid-2 ">
<label>Kamar : </label> <label>Kamar : </label>
<input type="number" min="0" class="text wow agileits w3layouts " name="jumlah_kamar" placeholder="" style="background-color: white; color: black"> <input type="number" min="1" class="text wow agileits w3layouts " required name="jumlah_kamar" placeholder="" style="background-color: white; color: black">
</div><br>
<div class="col-md-3 agileits w3layouts contact-grid contact-grid-2 ">
<div class="book" >
<a href="/searchhomestay" class="cari"> Cari </a>
</div> </div>
<div class="book">
<input type="submit" class="more_btn wow agileits w3layouts " value="Cari">
</div> </div>
</form> </form>
</div> </div>
<br> <br>
...@@ -185,4 +182,28 @@ ...@@ -185,4 +182,28 @@
</div> </div>
</div> </div>
<!-- //Lokasi --> <!-- //Lokasi -->
<script>
function updateDate(object) {
//$('#tanggal_selesai').datepicker({
// dateFormat: "yy-mm-dd",
//});
//alert(object.value);
//var tanggal_mulai = $('#datepicker1').datepicker('getDate');
//tanggal_mulai.setDate(tanggal_mulai.getDate()+parseInt(object.value));
//$('#tanggal_selesai').datepicker('setDate',tanggal_mulai);
//alert(tanggal_mulai);
var date1 = $('#datepicker1').datepicker('getDate');
var date = new Date( Date.parse( date1 ) );
date.setDate( date.getDate() + parseInt(object.value) );
var newDate = date.toDateString();
newDate = new Date( Date.parse( newDate ) );
$('#datepicker2').datepicker("setDate",newDate);
}
</script>
@endsection @endsection
...@@ -32,31 +32,6 @@ ...@@ -32,31 +32,6 @@
</div> </div>
@endif @endif
</div> </div>
<br><br>
<div class="col-md-12 col-sm-12 agileits w3layouts contact-grid contact-grid-2">
<form action="{{url('book')}}" method="post">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="hidden" name="id" value="{{$data->id}}">
<div class="col-md-2 col-sm-2 agileits w3layouts contact-grid contact-grid-2 "></div>
<div class="col-md-3 col-sm-3 agileits w3layouts contact-grid contact-grid-2 ">
<input class="date agileits w3layouts" id="datepicker1" name="tanggal" type="text" value=" Tanggal Check in" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = '';}">
</div>
<div class="col-md-2 col-sm-2 agileits w3layouts contact-grid contact-grid-2 ">
<input type="number" min="1" class="text wow agileits w3layouts " name="jumlah_hari" placeholder="Lama Menginap" onchange="updateDate(this)" style="background-color: white; color: black">
</div>
<div class="col-md-2 col-sm-2 agileits w3layouts contact-grid contact-grid-2 ">
<input type="number" min="1" class="text wow agileits w3layouts " name="jumlah_kamar" placeholder="Jumlah Kamar" style="background-color: white; color: black">
</div>
<div class="col-md-2 col-sm-2 agileits w3layouts contact-grid contact-grid-2 ">
<input type="text" id="datepicker2" class="text wow agileits w3layouts " name="tanggal_selesai" readonly placeholder="Tanggal Berakhir" style="background-color: white; color: black">
</div>
<div class="book">
<input type="submit" class="more_btn wow agileits w3layouts " value="Book Now">
</div>
</form>
</div>
</div>
<!-- Informations --> <!-- Informations -->
<div class="cuisines agileits w3layouts"> <div class="cuisines agileits w3layouts">
<div class="container"> <div class="container">
...@@ -91,11 +66,6 @@ ...@@ -91,11 +66,6 @@
<td>{{$data->no_rekening}}</td> <td>{{$data->no_rekening}}</td>
</tr> </tr>
<tr> <tr>
<td> Avilable Room </td>
<td>:</td>
<td style="color: #1dc8d9;font-size:30px;">{{$avilable}}</td>
</tr>
<tr>
<td> Harga </td> <td> Harga </td>
<td>:</td> <td>:</td>
<td>Rp 150.000 / hari</td> <td>Rp 150.000 / hari</td>
......
...@@ -22,12 +22,12 @@ ...@@ -22,12 +22,12 @@
<div class="col-md-4 col-sm-4 details-grid details-grid-2 agileits w3layouts "> <div class="col-md-4 col-sm-4 details-grid details-grid-2 agileits w3layouts ">
<div class="details-grid2 agileits w3layouts"> <div class="details-grid2 agileits w3layouts">
<div class="details-grid-image agileits w3layouts" > <div class="details-grid-image agileits w3layouts" >
<img src="/img/{{$a->gambar}}" alt="Agileits W3layouts" > <img src="/img/{{$a[0]->gambar}}" alt="Agileits W3layouts" >
</div> </div>
<div class="details-grid-info agileits w3layouts"> <div class="details-grid-info agileits w3layouts">
<h4>{{$a->nama_homestay}}</h4> <h4>{{$a[0]->nama_homestay}}</h4>
</div> </div>
<a href ="{{url('detailhomestay/'.$a->id)}}" ><button class="btn btn-primary agileits w3layouts " data-toggle="modal" > LIHAT <span class="glyphicon agileits w3layouts glyphicon-arrow-right" aria-hidden="true"></span></button> </a> <a href ="{{url('detailhomestay/'.$a[0]->id)}}" ><button class="btn btn-primary agileits w3layouts " data-toggle="modal" > LIHAT <span class="glyphicon agileits w3layouts glyphicon-arrow-right" aria-hidden="true"></span></button> </a>
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
</div> </div>
......
<?php <?php
use App\Homestay; use App\Homestay;
use Illuminate\Http\Request;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Web Routes | Web Routes
...@@ -16,7 +17,10 @@ Route::get('/', function () { ...@@ -16,7 +17,10 @@ Route::get('/', function () {
return view('index')->with('data',$data); return view('index')->with('data',$data);
}); });
Route::get('/searchhomestay', function () { Route::get('test', function (Request $request) {
dd($request);
$data = Homestay::all(); $data = Homestay::all();
return view('searchhomestay')->with('data',$data); return view('searchhomestay')->with('data',$data);
}); });
...@@ -88,6 +92,7 @@ Route::group(['middleware' => 'owner'], function () { ...@@ -88,6 +92,7 @@ Route::group(['middleware' => 'owner'], function () {
}); });
Route::get('cari','GuestController@cari');
Route::get('detailhomestay/{id}','GuestController@detailhomestay'); Route::get('detailhomestay/{id}','GuestController@detailhomestay');
Route::get('daftar','GuestController@register'); Route::get('daftar','GuestController@register');
Route::post('daftar','GuestController@registerStore'); Route::post('daftar','GuestController@registerStore');
......
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