Commit 65128518 by Juliper

no message

parent 571fff5a
...@@ -22,6 +22,14 @@ class CustomerController extends Controller ...@@ -22,6 +22,14 @@ class CustomerController extends Controller
public function cancelPemesanan($id){ public function cancelPemesanan($id){
$dataTrsaksi = Transaksi::find($id);
$dataTrsaksi->delete();
DB::table('daftar_book')->where('id_transaksi', '=', $id)->delete();
return redirect('customerHistory');
} }
public function sendFeedback(Request $request, $id){ public function sendFeedback(Request $request, $id){
...@@ -330,15 +338,25 @@ class CustomerController extends Controller ...@@ -330,15 +338,25 @@ class CustomerController extends Controller
$trans->total_pembayaran = $request['jumlah_kamar'] * $dataHomestay[0]->harga; $trans->total_pembayaran = $request['jumlah_kamar'] * $dataHomestay[0]->harga;
$trans->status = 0; $trans->status = 0;
$trans->save();
$dataTrans = DB::table('transaksi')
->select('transaksi.id')
->where('transaksi.tanggal_mulai','=',$request['tanggal'])
->where('transaksi.tanggal_berakhir','=',$baru)
->get();
//Insert Table Daftar Booking //Insert Table Daftar Booking
$lb->homestay = $request['id']; $lb->homestay = $request['id'];
$lb->id_transaksi = $dataTrans[0]->id;
$lb->nama_pemesan = $dataPelanggan[0]->nama; $lb->nama_pemesan = $dataPelanggan[0]->nama;
$lb->jumlah_kamar = $request['jumlah_kamar']; $lb->jumlah_kamar = $request['jumlah_kamar'];
$lb->tanggal_mulai = $request['tanggal'] ; $lb->tanggal_mulai = $request['tanggal'] ;
$lb->tanggal_berakhir = $baru; $lb->tanggal_berakhir = $baru;
//Save //Save
$trans->save();
$lb->save(); $lb->save();
return redirect()->action('CustomerController@detailhomestay', ['id' => $request['id']]); return redirect()->action('CustomerController@detailhomestay', ['id' => $request['id']]);
......
...@@ -38,7 +38,11 @@ ...@@ -38,7 +38,11 @@
<a href="{{url('buktipembayaran/'.$a->id)}}">Upload Bukti</a> <a href="{{url('buktipembayaran/'.$a->id)}}">Upload Bukti</a>
</td> </td>
<td> <td>
<button type="button" class="btn btn-danger" > Cancel </button> <form action="{{url('batalkanPemesanan/'.$a->id)}}" method="POST">
{{csrf_field()}}
<input type="hidden" name="_method" value="DELETE">
<button type="submit" class="btn btn-danger">Hapus</button>
</form>
</td> </td>
</tr> </tr>
@endforeach @endforeach
......
...@@ -96,7 +96,7 @@ Route::get('reqFasilitas','OwnerController@requestFasilitas'); ...@@ -96,7 +96,7 @@ Route::get('reqFasilitas','OwnerController@requestFasilitas');
Route::post('reqFasilitas','OwnerController@storeRequest'); Route::post('reqFasilitas','OwnerController@storeRequest');
Route::get('updateHomestay','OwnerController@update'); Route::get('updateHomestay','OwnerController@update');
Route::put('updateHomestay/{id}','OwnerController@updateHomestay'); Route::put('updateHomestay/{id}','OwnerController@updateHomestay');
Route::delete('batalkanPemesanan/{id}','CutomerController@cancelPemesanan'); Route::delete('batalkanPemesanan/{id}','CustomerController@cancelPemesanan');
/*Route::get('UpdateHomestay', function(){ /*Route::get('UpdateHomestay', function(){
......
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