Commit 6ceb642d by Palti Sinaga

1

parents 1da81d7c ffc69484
......@@ -70,6 +70,8 @@ class LoginController extends Controller
->withErrors($validator)
->withInput();
}
}else{
return redirect('login')->with('message','Password atau Username Salah');
}
}
}
......
......@@ -77,6 +77,12 @@ class CustomerController extends Controller
->where('homestay.id','=',$dataTransaksi[0]->id_homestay)
->get();
$dataPemilik = DB::table('homestay')
->join('pemilikhomestay','homestay.id_pemilik','pemilikhomestay.id')
->select('pemilikhomestay.no_telepon')
->where('homestay.id','=',$dataTransaksi[0]->id_homestay)
->get();
$homestayJumlahKamar = DB::table('homestay')
->select('homestay.jumlah_kamar')
->where('homestay.id','=',$dataTransaksi[0]->id_homestay)
......@@ -87,11 +93,17 @@ class CustomerController extends Controller
->where('daftar_book.tanggal_mulai','=',$request['tanggal'])
->get();
//dd($dataBookingMulai,$request['tanggal']);
$tanggal_baru = explode('-', $request['tanggal']);
//$tanggal_baru = explode('-',request(['tanggal']));
$tanggal_baru[2] +=$request['lama_menginap'];
$tanggal = join('-',$tanggal_baru);
//dd($tanggal);
$dataBookingBerakhir = DB::table('daftar_book')
->select('daftar_book.*')
->where('daftar_book.tanggal_berakhir','=',$tanggal)
......@@ -161,28 +173,24 @@ class CustomerController extends Controller
$transaksi->tanggal_mulai = $request['tanggal'];
$transaksi->tanggal_berakhir = $baru;
$transaksi->jumlah_kamar = $request['jumlah_kamar'];
$transaksi->total_pembayaran = $request['jumlah_kamar'] * $dataHomestay[0]->harga ;
//dd($transaksi->total_pembayaran,$dataHomestay[0]->harga);
$dafBook = ListBook::where('id_transaksi',$id)->get();
/*DB::table('daftar_book')
$df = DB::table('daftar_book')
->where('daftar_book.id_transaksi','=',$id)
->get();*/
$lb = ListBook::find($dafBook[0]->id);
//dd($lb);
->get();
$dafBook = ListBook::find($df[0]->id);
$lb->jumlah_kamar = $request['jumlah_kamar'];
$lb->tanggal_mulai = $request['tanggal'];
$lb->tanggal_berakhir = $baru;
$dafBook->jumlah_kamar = $request['jumlah_kamar'];
$dafBook->tanggal_mulai = $request['tanggal'];
$dafBook->tanggal_berakhir = $baru;
//dd($dafBook[0]);
$transaksi->update();
$lb->update();
$dafBook->update();
return redirect('customerHistory');
}
......@@ -370,16 +378,16 @@ class CustomerController extends Controller
->where('daftar_book.tanggal_berakhir','=',$request['tanggal'])
->get();
//dd($dataHomestay[0]->jumlah_kamar,$request['jumlah_kamar']);
if($dataHomestay[0]->jumlah_kamar < $request['jumlah_kamar']){
return redirect('detailhomestay/',$dataHomestay[0]->id)->with('message','Maaf Jumalh kamar tidak sesuai');
}else{
if($dataBookingMulai->count() > 0){
$currentJumlahKamar = $homestayJumlahKamar[0]->jumlah_kamar - $dataBookingMulai[0]->jumlah_kamar;
if($currentJumlahKamar < $request['jumlah_kamar']){
return redirect()->action('GuestController@detailhomestay',['id'=>$request['id']])->with('message', 'Maaf Anda Tidak Bisa Melakukan Pembookingan di karenakan kamar yang tersisa tidak sesuai dengan permintaan anda!');
}
}else{
if($dataBookingBerakhir->count() > 0){
$currentJumlahKamar2 = $homestayJumlahKamar[0]->jumlah_kamar - $dataBookingBerakhir[0]->jumlah_kamar;
......@@ -456,16 +464,15 @@ class CustomerController extends Controller
//Save
$lb->save();
$text = "Ada Pesanan Kamari dari Sdr/i : ";
$text = "Ada Pesanan Kamar dari Sdr/i : ";
$pesan = $text . ' ' .$dataPelanggan[0]->nama;
//$pesan = $text + $dataPelanggan[0]->nama;
//$pesan +=" dengan jumlah kamar"+ ;
$newPesan = $pesan . ' '. "Silahkan Cek Sistem Informasi";
Nexmo::message()->send([
/*Nexmo::message()->send([
'to' => $dataPemilik[0]->no_telepon,
'from' => 'ASDASD',
'text' => $pesan
]);
'text' => $newPesan
]);*/
return redirect('customerHistory');
}
......
......@@ -35,6 +35,63 @@ class GuestController extends Controller
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
public function registerStore(Request $data){
......
......@@ -161,8 +161,10 @@ class OwnerController extends Controller
$updateHomestay->alamat = $request['alamatUpdate'];
$updateHomestay->harga = $request['hargaUpdate'];
if ($updateHomestay->fasilitas == null){
$updateHomestay->fasilitas = $updateHomestay->fasilitas;
$updateHomestay->fasilitas = $request['fasilitasUpdate'];
}else{
$updateHomestay->fasilitas = $request['fasilitasUpdate'];
}
......
......@@ -18,7 +18,6 @@ class Customer
{
if(Auth::check()){
if(Auth::user()->role !='Customer'){
dd('masuk');
if(Auth::user()->role == 'Owner'){
return redirect('owner');
}elseif(Auth::user()->role=='DinasPariwisata'){
......
......@@ -9,7 +9,7 @@ class Room extends Model
protected $table = "kamar";
protected $fillable = [
'idHomestay', 'jumlah_bed', 'fasilitas','nomor_kamar','id_transaksi'
'idHomestay', 'jumlah_bed', 'fasilitas','nomor_kamar','id_transaksi','tamu_per_kamar',
];
public $timestamps = false;
......
This diff is collapsed. Click to expand it.
img/e3.JPG

17.9 KB

img/gallery-1.jpg

37.7 KB | W: | H:

img/gallery-1.jpg

169 KB | W: | H:

img/gallery-1.jpg
img/gallery-1.jpg
img/gallery-1.jpg
img/gallery-1.jpg
  • 2-up
  • Swipe
  • Onion skin
......@@ -14904,6 +14904,7 @@ $.widget( "ui.tooltip", {
if ( element.data( "ui-tooltip-title" ) ) {
element.attr( "title", element.data( "ui-tooltip-title" ) );
element.removeData( "ui-tooltip-title" );
element.removeData( "ui-tooltip-title" );
}
});
}
......
......@@ -27,6 +27,11 @@
</div>
@endif
@if(session()->has('message'))
<div class="alert alert-info">
{{session()->get('message')}}
</div>
@endif
<div class="login-box-body" >
<!-- <p class="login-box-msg"> {{ trans('adminlte_lang::message.siginsession') }} </p> -->
......
......@@ -7,7 +7,7 @@
@section('main-content')
<div class="box box-warning">
<div class="box-header with-border">
<h3 class="box-title"> LIST PEMILIK HOMESTAY </h3>
<h3 class="box-title"> DAFTAR PEMILIK HOMESTAY </h3>
@if (count($errors) > 0)
<div class="alert alert-danger">
<strong>Whoops!</strong> {{ trans('adminlte_lang::message.someproblems') }}<br><br>
......
......@@ -49,9 +49,9 @@
</form>
</td>
@elseif($a->status==1)
<td colspan="3"><h4>Di Terima</h4></td>
<td colspan="3"><h4>Diterima</h4></td>
@elseif($a->status==2)
<td colspan="3"><h4>Di Tolak</h4></td>
<td colspan="3"><h4>Ditolak</h4></td>
@elseif($a->status=3)
<td colspan="3"><h4>Telah Dibatalkan</h4></td>
@endif
......
......@@ -35,6 +35,7 @@
<tr>
<th>Nama Pelanggan</th>
<th>Nomor Telepon</th>
<th>Alamat</th>
<th>Tanggal Mulai</th>
<th>Tanggal Berakhir</th>
<th>Lama Menginap</th>
......@@ -48,6 +49,7 @@
<tr>
<td>{{$a->nama}}</td>
<td>{{$a->no_telepon}}</td>
<td>{{$a->alamat}}</td>
<td>{{$a->tanggal_mulai}}</td>
<td>{{$a->tanggal_berakhir}}</td>
<td>{{$a->lama_menginap}} Hari</td>
......
......@@ -26,37 +26,34 @@
<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;
">
<form action="{{url('book')}}" method="post">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<form action="{{url('cari')}}">
<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 ">
<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 class="col-md-2 col-sm-2 agileits w3layouts contact-grid contact-grid-2 ">
<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 class="col-md-2 col-sm-2 agileits w3layouts contact-grid contact-grid-2 ">
<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 class="col-md-1 col-sm-2 agileits w3layouts contact-grid contact-grid-2 ">
<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 class="col-md-1 col-sm-2 agileits w3layouts contact-grid contact-grid-2 ">
<label>Kamar : </label>
<input type="number" min="0" class="text wow agileits w3layouts " 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>
<input type="number" min="1" class="text wow agileits w3layouts " required name="jumlah_kamar" placeholder="" style="background-color: white; color: black">
</div>
<div class="book">
<input type="submit" class="more_btn wow agileits w3layouts " value="Cari">
</div>
</form>
</div>
<br>
......@@ -185,4 +182,28 @@
</div>
</div>
<!-- //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
......@@ -32,53 +32,6 @@
</div>
@endif
</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="text" class="text wow agileits w3layouts " name="jumlah_hari" placeholder="Lama Menginap" 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="0" class="text wow agileits w3layouts " name="jumlah_kamar" placeholder="Jumlah Kamar" 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>
<!-- Booking -->
<div class="details agilets w3layouts" style="margin-bottom:0px; margin-top:0px;">
<h2 > Daftar Pesanan di {{$data->nama_homestay}}</h2>
<div class="container">
<table class="table table-hover " style="background-color: white; margin-top:20px;">
<thead>
<tr>
<th style="color:white;"> Tanggal Mulai </th>
<th style="color:white;"> Tanggal Berakhir </th>
<th style="color:white;"> Jumlah Kamar</th>
</tr>
</thead>
<tbody>
@foreach($daftarBook as $a)
<tr>
<td>{{$a->tanggal_mulai}}</td>
<td>{{$a->tanggal_berakhir}}</td>
<td>{{$a->jumlah_kamar}}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
<!-- Informations -->
<div class="cuisines agileits w3layouts">
<div class="container">
......@@ -113,11 +66,6 @@
<td>{{$data->no_rekening}}</td>
</tr>
<tr>
<td> Avilable Room </td>
<td>:</td>
<td style="color: #1dc8d9;font-size:30px;">{{$avilable}}</td>
</tr>
<tr>
<td> Harga </td>
<td>:</td>
<td>Rp 150.000 / hari</td>
......@@ -168,6 +116,28 @@
</div>
</div>
</div>
<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>
<!-- //Kritik & Saran -->
<div class="cuisines agileits w3layouts">
......
......@@ -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" >
<img src="/img/{{$a->gambar}}" alt="Agileits W3layouts" >
<img src="/img/{{$a[0]->gambar}}" alt="Agileits W3layouts" >
</div>
<div class="details-grid-info agileits w3layouts">
<h4>{{$a->nama_homestay}}</h4>
<h4>{{$a[0]->nama_homestay}}</h4>
</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>
</div>
......
......@@ -88,9 +88,11 @@
<!-- Menu Footer-->
<li class="user-footer">
@if(Auth::user()->role != "DinasPariwisata")
<div class="pull-left">
<a href="{{ url('profile') }}" class="btn btn-default btn-flat">{{ trans('adminlte_lang::message.profile') }}</a>
</div>
@endif
<div class="pull-right">
<a href="{{ url('/logout') }}" class="btn btn-default btn-flat"
onclick="event.preventDefault();
......
<?php
use App\Homestay;
use Illuminate\Http\Request;
/*
|--------------------------------------------------------------------------
| Web Routes
......@@ -16,7 +17,10 @@ Route::get('/', function () {
return view('index')->with('data',$data);
});
Route::get('/searchhomestay', function () {
Route::get('test', function (Request $request) {
dd($request);
$data = Homestay::all();
return view('searchhomestay')->with('data',$data);
});
......@@ -88,6 +92,7 @@ Route::group(['middleware' => 'owner'], function () {
Route::get('detailpesanan/{id}','OwnerController@detailpesanan');
});
Route::get('cari','GuestController@cari');
Route::get('detailhomestay/{id}','GuestController@detailhomestay');
Route::get('daftar','GuestController@register');
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