Commit f85a06ec by Juliper

no message

parent 7bb7ca8f
...@@ -47,11 +47,13 @@ class AdminController extends Controller ...@@ -47,11 +47,13 @@ class AdminController extends Controller
->with('dataP',$dataP)->with('countP',$dataP->count()); ->with('dataP',$dataP)->with('countP',$dataP->count());
} }
public function listhomestay(){ public function listhomestay()
$data = DB::table('homestay') {
->get(); $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){ public function cariPesanan(Request $request){
$dataHomestay = Homestay::where('nama_homestay',$request['nama_homestay'])->get(); $dataHomestay = Homestay::where('nama_homestay',$request['nama_homestay'])->get();
......
...@@ -37,7 +37,7 @@ class GuestController extends Controller ...@@ -37,7 +37,7 @@ class GuestController extends Controller
//{id}/{tm}/{lm}/{ts}/{jt}/{jk} //{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') $data = DB::table('homestay')
->join('pemilikhomestay','homestay.id_pemilik','=','pemilikhomestay.id') ->join('pemilikhomestay','homestay.id_pemilik','=','pemilikhomestay.id')
...@@ -52,7 +52,7 @@ class GuestController extends Controller ...@@ -52,7 +52,7 @@ class GuestController extends Controller
->get(); ->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){ public function cari(Request $request){
...@@ -69,6 +69,8 @@ class GuestController extends Controller ...@@ -69,6 +69,8 @@ class GuestController extends Controller
//$book_start[] = null; //$book_start[] = null;
$dataHomestay[] = null; $dataHomestay[] = null;
$i = 0; $i = 0;
$exbed = 0;
$biaya = 0;
//Melakukan Looping pengecekan Homestay yang avilable //Melakukan Looping pengecekan Homestay yang avilable
...@@ -92,24 +94,43 @@ class GuestController extends Controller ...@@ -92,24 +94,43 @@ class GuestController extends Controller
$dataCurrent[$j] = $db->id; $dataCurrent[$j] = $db->id;
$counter +=1; $counter +=1;
$j++; $j++;
echo 'beririsan'; // echo 'beririsan';
} }
else if(($tm[2] < $ldbm[2] && $tm[2] <= $ldbs[2] ) && ($ts[2] >= $ldbm[2] && $ts[2]<= $ldbs[2])){ else if(($tm[2] < $ldbm[2] && $tm[2] <= $ldbs[2] ) && ($ts[2] >= $ldbm[2] && $ts[2]<= $ldbs[2])){
$dataCurrent[$j] = $db->id; $dataCurrent[$j] = $db->id;
$counter +=1; $counter +=1;
$j++; $j++;
echo 'beririsan sebagian batas atas'; // echo 'beririsan sebagian batas atas';
//dd('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])){ }else if(($tm[2] >= $ldbm[2] && $tm[2] <= $ldbs[2] ) && ($ts[2] >= $ldbm[2] && $ts[2] > $ldbs[2])){
$dataCurrent[$j] = $db->id; $dataCurrent[$j] = $db->id;
$counter +=1; $counter +=1;
$j++; $j++;
echo 'beririsan sebagian batas bawah'; // echo 'beririsan sebagian batas bawah';
//dd('beririsan sebagian batas bawah'); //dd('beririsan sebagian batas bawah');
} }
} }
}else if($tm[1] < $ts[1]){ }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 ...@@ -154,13 +175,44 @@ class GuestController extends Controller
$dataHomestay[$i] = DB::table('homestay') $dataHomestay[$i] = DB::table('homestay')
->where('homestay.id','=',$a->id) ->where('homestay.id','=',$a->id)
->get(); ->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++; $i++;
} }
//dd($dataHomestay); //dd($exbed, $biaya+($exbed*50000),$dataHomestay,$dataCurrent,$currentKamar);
if($dataHomestay == null){ if($dataHomestay == null){
dd('salah'); dd('salah');
...@@ -171,6 +223,7 @@ class GuestController extends Controller ...@@ -171,6 +223,7 @@ class GuestController extends Controller
dd('salah'); dd('salah');
} }
$totalHarga = ($biaya) + ($exbed*50000);
//dd('benar'); //dd('benar');
return view('searchhomestay')->with('data',$dataHomestay) return view('searchhomestay')->with('data',$dataHomestay)
...@@ -178,7 +231,8 @@ class GuestController extends Controller ...@@ -178,7 +231,8 @@ class GuestController extends Controller
->with('lm',$jumlah_hari) ->with('lm',$jumlah_hari)
->with('ts',$tanggal_selesai) ->with('ts',$tanggal_selesai)
->with('jt',$jumlah_Tamu) ->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($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']); //dd($request['tanggal_mulai'],$request['jumlah_hari'],$request['tanggal_selesai'],$request['jumlah_Tamu'],$request['jumlah_kamar']);
} }
......
...@@ -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" >
<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>
<div class="details-grid-info agileits w3layouts"> <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>
<div class="clearfix"></div> <div class="clearfix"><h5>RP.{{$a[0]->harga}}</h5></div>
</div> </div>
</div> </div>
@endforeach @endforeach
......
...@@ -93,7 +93,8 @@ Route::group(['middleware' => 'owner'], function () { ...@@ -93,7 +93,8 @@ Route::group(['middleware' => 'owner'], function () {
Route::get('pesanan/{id}','OwnerController@pesanan'); Route::get('pesanan/{id}','OwnerController@pesanan');
Route::resource('pdf','PDFController@showPDF'); 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('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');
......
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