Commit 7cc7e5c2 by Juliper

no message

parent 6cf23924
......@@ -28,6 +28,7 @@ class AdminController extends Controller
return view('adminlte::home');
}
//Mengakses Daftar Pemesanan
public function listPesanan(){
$data = DB::table('homestay')
......@@ -35,11 +36,10 @@ class AdminController extends Controller
->select('daftar_book.*','homestay.namaHomestay','homestay.owner')
->get();
//dd($data);
return view('adminlte::layouts.admin.dataPemesanan')->with('data',$data);
}
//Mengakses Daftar Owner
public function listOwner(){
$count = User::all()->where('role',"Owner")->count();
......@@ -49,11 +49,13 @@ class AdminController extends Controller
return view('adminlte::layouts.admin.listOwner')->with('data',$data)->with('count',$count);
}
//Menambah owner
public function create()
{
return view('adminlte::layouts.admin.addOwner');
}
//Meyimpan Data Owner
public function store(Request $request)
{
......@@ -89,16 +91,14 @@ class AdminController extends Controller
$owner->noTelepon = '--';
$owner->noRekening = '--';
$owner->foto = 'gravatar.png';
//dd($user);
$user->save();
$owner->save();
//dd("berhasil agan");
return redirect(url('admin/create'))->with('info', 'User berhasil ditambah ');
}
//Menampilkan Daftar RequestHomestay
public function RequestHomestay(){
$data = DB::table('pemilikhomestay')
......@@ -108,11 +108,11 @@ class AdminController extends Controller
$count = $data->count();
//dd($data[0]->nama,"berhasil",$count);
return view('adminlte::layouts.admin.listPengajuan')->with('data',$data)
->with('count',$count);
}
//Melakuan Aksi Untuk memproses Permintaan Admin
public function UpdateRequestFasilitass($id){
//$data = DB::table('requestfasilitas')->where('id', $id)->first();
$RF = RequestFasilitas::find($id);
......@@ -135,6 +135,7 @@ class AdminController extends Controller
return redirect('requestFasilitas');
}
//Mengakses Daftar Request Fasilitas
public function RequestFasilitas(){
$data = DB::table('pemilikhomestay')
......@@ -147,9 +148,8 @@ class AdminController extends Controller
return view('adminlte::layouts.admin.listRequestFasilitas')->with('data',$data)->with('count',$count);
}
//Penyetujuan Pengajuan Homestay
public function AccPengajuanHomestay($id){
//dd("masuk gan");
$RH = RequestHomestay::find($id);
$RH->status = 1;
......@@ -159,8 +159,6 @@ class AdminController extends Controller
->where('pemilikhomestay.id','=',$RH->idPemilikHomestay)
->get();
//dd($data[0]->nama,$data[0]->alamat);
$hs = new Homestay();
$hs->idPemilik = $RH->idPemilikHomestay;
$hs->namaHomestay = $RH->namaHomestay;
......@@ -170,7 +168,6 @@ class AdminController extends Controller
$hs->harga = 150000;
$hs->status='----';
$hs->save();
$idHts = DB::table('homestay')
......@@ -178,8 +175,6 @@ class AdminController extends Controller
->where('homestay.owner','=',$data[0]->nama)
->get();
//dd("sampai sini dulu",$idHts);
for ($i = 1;$i<=$RH->jumlahKamar;$i++){
$km = new Room();
$km->idHomestay = $idHts[0]->id;
......@@ -190,10 +185,5 @@ class AdminController extends Controller
$RH->update();
return redirect('requestHomestay');
}
public function destroy($id)
{
//
}
}
......@@ -25,10 +25,10 @@ class CustomerController extends Controller
{
public function __construct(){
//$this->middleware('auth');
$this->middleware('customer');
}
//Pembatalan Pemesanan/Pembookingan Homestay
public function cancelPemesanan($id){
$dataTrsaksi = Transaksi::find($id);
......@@ -37,10 +37,10 @@ class CustomerController extends Controller
DB::table('daftar_book')->where('id_transaksi', '=', $id)->delete();
return redirect('customerHistory');
}
//Pemberian/Pengiriman Feedback
public function sendFeedback(Request $request, $id){
if(Auth::guest()){
dd("maaf nggak bisa banf");
......@@ -56,23 +56,19 @@ class CustomerController extends Controller
->where('homestay.id','=',$id)
->get();
//dd($dataPelanggan,$dataPemilik);
$feed = new Feedback();
$feed->id_pemilikHomestay = $dataPemilik[0]->idPemilik;
$feed->idPelanggan = $dataPelanggan[0]->id;
$feed->feedback = $request['feedback'];
$feed->save();
return redirect()->action('CustomerController@detailhomestay', ['id' => $id]);
//return redirect('detailhomestay/{id}',$id);
}
//Upload Bukti Pembayaran
public function upload(Request $request,$id)
{
//dd("masuk agan");
$data = Transaksi::find($id);
if($request->file('bukti_pembayaran')==null){
......@@ -84,27 +80,25 @@ class CustomerController extends Controller
$data->bukti_pembayaran = $fileName;
}
//$cus->update();
$data->update();
return redirect('customerHistory');
}
//Mengakses Halaman untuk mengupload Bukti Pembayaran
public function bukti($id){
$data = Transaksi::find($id);
return view('adminlte::layouts.customers.Upload')->with('data',$data);
}
//Mengakses Halaman daftar Pemesanan Pelanggan
public function history(){
$data = DB::table('pelanggan')
->select('pelanggan.*')
->where('pelanggan.id_Akun','=',Auth::user()->id)
->get();
$dataTrans = DB::table('homestay')
->join('transaksi','homestay.id','=','transaksi.id_homestay')
->join('pemilikhomestay','homestay.idPemilik','=','pemilikhomestay.id')
......@@ -112,26 +106,20 @@ class CustomerController extends Controller
->where('transaksi.id_pelanggan','=',$data[0]->id)
->get();
// dd($dataTrans);
return view('adminlte::layouts.customers.History')->with('data',$dataTrans);
}
//Mengakses Profile Pelanggan
public function profile(){
//dd("masuk agan");
//dd(Auth::user()->id);
$data = DB::table('pelanggan')
->select('pelanggan.*')
->where('pelanggan.id_Akun','=',Auth::user()->id)
->get();
//$data2 = User::find(Auth::user()->id);
//dd($data[0]);
return view('adminlte::layouts.customers.profiles')->with('data',$data[0]);
}
//Menyimpan data Pelanggan disaat melakukan Pendaftaran
public function registerStore(Request $data){
$user = new User();
$user->name = $data['name'];
......@@ -156,18 +144,17 @@ class CustomerController extends Controller
$cus->save();
//$this->guard()->login($user);
return redirect('login');
}
//Mengakses Halaman untuk mengedit/mengubah profile
public function editProfile($id){
$data = Customer::find($id);
//dd($data);
return view('adminlte::layouts.customers.editprofiles')->with('data',$data);
}
//update Profile
public function updateProfile(Request $request,$id){
$cus = Customer::find($id);
$dataUs = User::find(Auth::user()->id);
......@@ -198,6 +185,7 @@ class CustomerController extends Controller
return redirect('customerProfile');
}
//Melakukan Pembookingan Homestay
public function booking(Request $request){
$this->validate($request,[
'tanggal' => 'required',
......@@ -230,8 +218,6 @@ class CustomerController extends Controller
->where('homestay.id','=',$request['id'])
->get();
//dd("masuk dis ");
$homestayJumlahKamar = DB::table('homestay')->select('homestay.jumlahKamar')->where('homestay.id','=',$request['id'])->get();
$dataBookingMulai = DB::table('daftar_book')
......@@ -261,24 +247,17 @@ class CustomerController extends Controller
}else{
dd('nggak boleh');
}
}else{
//dd('masuk aja gan');
}
}
//dd('dataBooking',$dataBooking,'dataHomestay',$dataHomestay);
$dataPelanggan = DB::table('users')
->join('pelanggan','users.id','=','pelanggan.id_Akun')
->select('pelanggan.id','pelanggan.nama')
->where('users.id','=',Auth::user()->id)
->get();
//dd($dataHomestay,$dataPelanggan);
$time = explode('-', $request['tanggal']);
//dd($time[1]+2);
if ($time[1]==2){
$time[2] += $request['jumlah_hari'];
if ($time[2]>28){
......@@ -309,12 +288,8 @@ class CustomerController extends Controller
$time[2] -=1;
}
}
$baru = join('-',$time);
//dd($request['tanggal'],$baru,$request['jumlah_hari']);
//Insert Table Transaksi
$trans = new Transaksi();
$trans->id_pelanggan = $dataPelanggan[0]->id;
$trans->id_homestay = $request['id'];
......@@ -332,9 +307,7 @@ class CustomerController extends Controller
->where('transaksi.tanggal_mulai','=',$request['tanggal'])
->where('transaksi.tanggal_berakhir','=',$baru)
->get();
//Insert Table Daftar Booking
$lb->homestay = $request['id'];
$lb->id_transaksi = $dataTrans[0]->id;
......@@ -344,7 +317,6 @@ class CustomerController extends Controller
$lb->tanggal_berakhir = $baru;
//Save
$lb->save();
Nexmo::message()->send([
......@@ -353,9 +325,7 @@ class CustomerController extends Controller
'text' => 'Hi ini hanya sebuah test no more'
]);
return redirect('customerHistory');
}
......
......@@ -24,6 +24,7 @@ class HomeController extends Controller
public function __construct()
{
$this->middleware('auth');
$this->middleware('owner');
}
/**
......
......@@ -27,12 +27,11 @@ class OwnerController extends Controller
return view('adminlte::layouts.owner.home');
}
//Menyimpan Data untuk di update
public function updateProfil(Request $request,$id){
$owner = Owner::where('id',$id)->first();
$user = User::where('name',$owner->nama)->first();
//dd("masuk agan",$id,$request['picture'],$request['nama']);
if($request['nama']==""){
$user->name = $owner->nama;
}else{
......@@ -57,19 +56,17 @@ class OwnerController extends Controller
$user->update();
$owner->update();
//$data = DB::table('pemilikhomestay')->where('nama', $request['nama'])->first();
//dd('succes Gan');
return redirect('profile');
}
//Mengakses Halaman untuk Melakukan edit Profile
public function profileEdit($id){
$data = Owner::find($id);//all()->where('id_Owner',$id);
//dd($data);
$data = Owner::find($id);
return view('adminlte::layouts.owner.updateProfil')->with('data',$data);
}
//Mengakses Halaman profile
public function profile(){
$users = User::find(Auth::user()->id);
......@@ -78,6 +75,7 @@ class OwnerController extends Controller
return view('adminlte::layouts.owner.profil')->with('data',$data);
}
//Mengakses Halaman daftar Feedback
public function feddback(){
$dataPemilik = DB::table('pemilikhomestay')
->select('pemilikhomestay.id')
......@@ -90,12 +88,11 @@ class OwnerController extends Controller
->where('feedback.id_pemilikHomestay','=',$dataPemilik[0]->id)
->get();
//dd($dataFeedback);
return view('adminlte::layouts.owner.listfeedback')->with('data',$dataFeedback);
}
//Menyimpan Data Update Homestay
public function updateHomestay(Request $request,$id){
$this->validate($request,[
'namaUpdate' => 'required|string',
'alamatUpdate' => 'required|string',
......@@ -134,8 +131,8 @@ class OwnerController extends Controller
return redirect('updateHomestay');
}
//Mengakses Halaman Update Homestay
public function update(){
$dataPemilik = DB::table('pemilikhomestay')
->select('pemilikhomestay.id')
->where('pemilikhomestay.id_Akun','=',Auth::user()->id)
......@@ -146,11 +143,10 @@ class OwnerController extends Controller
->where('homestay.idPemilik','=',$dataPemilik[0]->id)
->get();
//dd($dataPemilik[0]->id,$dataHomestay[0]);
return view('adminlte::layouts.owner.UpdateHomestay')->with('data',$dataHomestay[0]);
}
//Melakukan Konfirmasi Pemesanan
public function konfirmasiPemesanan(Request $request,$id){
$data = Transaksi::find($id);
......@@ -168,9 +164,8 @@ class OwnerController extends Controller
return redirect('pesanan');
}
//Mengakses Daftar Booking Homestay
public function listOfBook(){
$dataPemilik = DB::table('pemilikhomestay')
->select('pemilikhomestay.id')
->where('pemilikhomestay.id_Akun','=',Auth::user()->id)
......@@ -187,12 +182,11 @@ class OwnerController extends Controller
->select('daftar_book.*')
->where('daftar_book.homestay','=',$dataHomestay[0]->id)
->get();
//dd('mas',$dataPemilik,$dataHomestay);
//dd('sampai disini dulu');
return view('adminlte::layouts.owner.ListBooking')->with('data',$dataListOfBook)->with('count',$dataListOfBook->count());
}
//Melakukan Penambahan Boking secara Manual
public function addBookManual(Request $request){
$lb = new ListBook();
......@@ -238,8 +232,8 @@ class OwnerController extends Controller
}
//Melakukan Update Kamar
public function updateRoom(Request $request, $id){
$this->validate($request,[
'jumlah_bed' => 'required|numeric',
],[
......@@ -266,12 +260,14 @@ class OwnerController extends Controller
return redirect('daftarKamar')->with('message', 'Update Kamar Sukses!');
}
//Mengakses Halaman Edit Room
public function editRoom($id){
$dataKamar = Room::find($id);
return view('adminlte::layouts.owner.EditRoom')->with('data',$dataKamar);
}
//Mengakses Halaman Daftar Kamar
public function daftarKamar(){
$dataPemilik = DB::table('pemilikhomestay')
......@@ -289,6 +285,7 @@ class OwnerController extends Controller
return view('adminlte::layouts.owner.listRoom')->with('data',$data)->with('count',$data->count());
}
//Mengakses Halaman Daftar Transaksi
public function listTransaction(){
$dataPel = DB::table('pemilikhomestay')
......@@ -307,12 +304,13 @@ class OwnerController extends Controller
return view('adminlte::layouts.owner.listPesanan')->with('data',$data)->with('count',$data->count());
}
//Mengakses Halaman untuk melakukan Request Fasilitas
public function requestFasilitas(){
return view('adminlte::layouts.owner.RequestFasilitas')->with('message', 'Request Fasilitas Berhasil Dikirim!');
}
//Menyimpan Data Request Fasilitas
public function storeRequest(Request $request){
$this->validate($request,[
'namaRequestFasilitas' => 'required|string',
'deskripsi' => 'required|string',
......@@ -352,10 +350,12 @@ class OwnerController extends Controller
}
//Mengakses Halaman untuk melakukan Pengajuan
public function pengajuan(){
return view('adminlte::layouts.owner.PengajuanHomestay');
}
//Menyimpan Data Pengajuan
public function storePengajuan(Request $request){
$this->validate($request,[
......@@ -385,6 +385,7 @@ class OwnerController extends Controller
dd($request['namaHomestay'],$request['jumlahKamar']);
}
//Melihat Daftar Pengajuan Homestay
public function listPengajuan(){
$idPemilik = DB::table('users')
......@@ -392,7 +393,7 @@ class OwnerController extends Controller
->select('pemilikhomestay.id')
->where('users.id', '=', Auth::user()->id)
->get();
//dd($idPemilik);
$data = DB::table('pengajuan_homestay')
->join('pemilikhomestay','pengajuan_homestay.idPemilikHomestay','=','pemilikhomestay.id')
->select('pemilikhomestay.nama','pengajuan_homestay.*')
......@@ -404,6 +405,7 @@ class OwnerController extends Controller
return view('adminlte::layouts.owner.ListPengajuanHomestay')->with('data',$data)->with('count',$count);
}
//Melihat Daftar Pengajuan Fasilitas
public function listPengajuanFasilitas(){
$idPemilik = DB::table('users')
->join('pemilikhomestay','users.id','=','pemilikhomestay.id_Akun')
......@@ -422,24 +424,4 @@ class OwnerController extends Controller
return view('adminlte::layouts.owner.ListPengajuanFasilitas')->with('data',$data)->with('count',$count);
}
// //coba chart
// public function chartjs()
// {
// $viewer = View::select(DB::raw("SUM(numberofview) as count"))
// ->orderBy("created_at")
// ->groupBy(DB::raw("year(created_at)"))
// ->get()->toArray();
// $viewer = array_column($viewer, 'count');
//
// $click = Click::select(DB::raw("SUM(numberofclick) as count"))
// ->orderBy("created_at")
// ->groupBy(DB::raw("year(created_at)"))
// ->get()->toArray();
// $click = array_column($click, 'count');
//
// return view('chartjs')
// ->with('viewer',json_encode($viewer,JSON_NUMERIC_CHECK))
// ->with('click',json_encode($click,JSON_NUMERIC_CHECK));
// }
}
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