Commit f85a06ec by Juliper

no message

parent 7bb7ca8f
......@@ -47,11 +47,13 @@ class AdminController extends Controller
->with('dataP',$dataP)->with('countP',$dataP->count());
}
public function listhomestay(){
$data = DB::table('homestay')
->get();
public function listhomestay()
{
$data = DB::table('homestay')
->get();
return view('adminlte::layouts.admin.listhomestay')->with('data',$data);
return view('adminlte::layouts.admin.listhomestay')->with('data', $data);
}
public function cariPesanan(Request $request){
$dataHomestay = Homestay::where('nama_homestay',$request['nama_homestay'])->get();
......
......@@ -37,7 +37,7 @@ class GuestController extends Controller
//{id}/{tm}/{lm}/{ts}/{jt}/{jk}
public function homestay($id,$tm,$lm,$ts,$jt,$jk){
public function homestay($id,$tm,$lm,$ts,$jt,$jk,$th){
$data = DB::table('homestay')
->join('pemilikhomestay','homestay.id_pemilik','=','pemilikhomestay.id')
......@@ -52,7 +52,7 @@ class GuestController extends Controller
->get();
return view('adminlte::layouts.pages.detilSHomestay')->with('data',$data[0])->with('tm',$tm)->with('lm',$lm)->with('ts',$ts)->with('jt',$jt)->with('jk',$jk)->with('dataKamar',$dataKamar);
return view('adminlte::layouts.pages.detilSHomestay')->with('data',$data[0])->with('tm',$tm)->with('lm',$lm)->with('ts',$ts)->with('jt',$jt)->with('jk',$jk)->with('dataKamar',$dataKamar)->with('th',$th);
}
public function cari(Request $request){
......@@ -69,6 +69,8 @@ class GuestController extends Controller
//$book_start[] = null;
$dataHomestay[] = null;
$i = 0;
$exbed = 0;
$biaya = 0;
//Melakukan Looping pengecekan Homestay yang avilable
......@@ -92,24 +94,43 @@ class GuestController extends Controller
$dataCurrent[$j] = $db->id;
$counter +=1;
$j++;
echo 'beririsan';
// echo 'beririsan';
}
else if(($tm[2] < $ldbm[2] && $tm[2] <= $ldbs[2] ) && ($ts[2] >= $ldbm[2] && $ts[2]<= $ldbs[2])){
$dataCurrent[$j] = $db->id;
$counter +=1;
$j++;
echo 'beririsan sebagian batas atas';
// echo 'beririsan sebagian batas atas';
//dd('beririsan sebagian batas atas');
}else if(($tm[2] >= $ldbm[2] && $tm[2] <= $ldbs[2] ) && ($ts[2] >= $ldbm[2] && $ts[2] > $ldbs[2])){
$dataCurrent[$j] = $db->id;
$counter +=1;
$j++;
echo 'beririsan sebagian batas bawah';
// echo 'beririsan sebagian batas bawah';
//dd('beririsan sebagian batas bawah');
}
}
}else if($tm[1] < $ts[1]){
dd('jangan dulu');
if(($tm[2] >= $ldbm[2] && $tm[2] <= $ldbs[2] ) && ($ts[2] >= $ldbm[2] && $ts[2]<= $ldbs[2]) ){
//dd('beriirisan total');
$dataCurrent[$j] = $db->id;
$counter +=1;
$j++;
// echo 'beririsan';
}
else if(($tm[2] < $ldbm[2] && $tm[2] <= $ldbs[2] ) && ($ts[2] >= $ldbm[2] && $ts[2]<= $ldbs[2])){
$dataCurrent[$j] = $db->id;
$counter +=1;
$j++;
//echo 'beririsan sebagian batas atas';
//dd('beririsan sebagian batas atas');
}else if(($tm[2] >= $ldbm[2] && $tm[2] <= $ldbs[2] ) && ($ts[2] >= $ldbm[2] && $ts[2] > $ldbs[2])){
$dataCurrent[$j] = $db->id;
$counter +=1;
$j++;
// echo 'beririsan sebagian batas bawah';
//dd('beririsan sebagian batas bawah');
}
}
}
......@@ -154,13 +175,44 @@ class GuestController extends Controller
$dataHomestay[$i] = DB::table('homestay')
->where('homestay.id','=',$a->id)
->get();
//dd($request['jumlah_tamu']);
if($request['jumlah_Tamu'] <= $request['jumlah_kamar'] * 2){
$exbed = 0;
$biaya = ($request['jumlah_kamar'] * 150000) * $request['jumlah_hari'];
// echo 'masuk di if nya';
// echo '<br>';
}else{
$temp = (($request['jumlah_kamar']*2)*2);
$temp -= $request['jumlah_Tamu'];
$biaya = ($request['jumlah_kamar'] * 150000) * $request['jumlah_hari'];
if($temp == 0 ){
$exbed = $request['jumlah_kamar'];
}elseif ($temp >0 && $temp <=2){
$exbed = $request['jumlah_kamar'] - 1;
}elseif ($temp > 2 && $temp<=4){
$exbed = $request['jumlah_kamar'] - 2;
}elseif ($temp > 4 && $temp < 6){
$exbed = $request['jumlah_kamar'] - 3;
}
// echo 'masuk di else';
// echo '<br>';
}
}
//echo $exbed;
//echo ' ';
// echo $biaya + ($exbed*50000);
//echo $request['jumlah_kamar'];
//echo '<br>';
}
}
$i++;
}
//dd($dataHomestay);
//dd($exbed, $biaya+($exbed*50000),$dataHomestay,$dataCurrent,$currentKamar);
if($dataHomestay == null){
dd('salah');
......@@ -171,6 +223,7 @@ class GuestController extends Controller
dd('salah');
}
$totalHarga = ($biaya) + ($exbed*50000);
//dd('benar');
return view('searchhomestay')->with('data',$dataHomestay)
......@@ -178,7 +231,8 @@ class GuestController extends Controller
->with('lm',$jumlah_hari)
->with('ts',$tanggal_selesai)
->with('jt',$jumlah_Tamu)
->with('jk',$jumlah_kamar);
->with('jk',$jumlah_kamar)
->with('th',$totalHarga);
//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']);
}
......
......@@ -22,12 +22,12 @@
<div class="col-md-4 col-sm-4 details-grid details-grid-2 agileits w3layouts ">
<div class="details-grid2 agileits w3layouts">
<div class="details-grid-image agileits w3layouts" >
<a href ="{{url('homestay/'.$a[0]->id.'/'.$tm.'/'.$lm.'/'.$ts.'/'.$jt.'/'.$jk)}}" ><img src="/img/{{$a[0]->gambar}}" alt="Agileits W3layouts" ></a>
<a href ="{{url('homestay/'.$a[0]->id.'/'.$tm.'/'.$lm.'/'.$ts.'/'.$jt.'/'.$jk.'/'.$th)}}" ><img src="/img/{{$a[0]->gambar}}" alt="Agileits W3layouts" ></a>
</div>
<div class="details-grid-info agileits w3layouts">
<a href ="{{url('homestay/'.$a[0]->id.'/'.$tm.'/'.$lm.'/'.$ts.'/'.$jt.'/'.$jk)}}" ><h4>{{$a[0]->nama_homestay}}</h4></a>
<a href ="{{url('homestay/'.$a[0]->id.'/'.$tm.'/'.$lm.'/'.$ts.'/'.$jt.'/'.$jk.'/'.$th)}}" ><h4>{{$a[0]->nama_homestay}}</h4></a>
</div>
<div class="clearfix"></div>
<div class="clearfix"><h5>RP.{{$a[0]->harga}}</h5></div>
</div>
</div>
@endforeach
......
......@@ -93,7 +93,8 @@ Route::group(['middleware' => 'owner'], function () {
Route::get('pesanan/{id}','OwnerController@pesanan');
Route::resource('pdf','PDFController@showPDF');
});
Route::get('homestay/{id}/{tm}/{lm}/{ts}/{jt}/{jk}','GuestController@homestay');
Route::get('homestay/{id}/{tm}/{lm}/{ts}/{jt}/{jk}/{th}','GuestController@homestay');
Route::get('cari','GuestController@cari');
Route::get('detailhomestay/{id}','GuestController@detailhomestay');
Route::get('daftar','GuestController@register');
......
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