<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/',['as'=>'login','uses'=>'HomeController@index']);

Route::get('/testtry',function(){

    return view('testing');
});

//Testing Jer
Route::get('test', function () {
    // event(new App\Events\StatusLiked('KOK LANAS','KOK KELI'));
    // return "Event has been try je sent!";

    $actionId = 'score_update';
    $actionData = array('team1_score' => 46);
    event(new App\Events\ActionEvent($actionId, $actionData));

    // event(new App\Events\ActionEvent('1234','test'));

    return "event test je";
});

// Route::get('resitbiasa', function () {
    


    
// });

Route::get('logs', '\Rap2hpoutre\LaravelLogViewer\LogViewerController@index');

Route::get('/welcome',function(){

    return view('print.resittebus');
});


// Auth::routes();

Route::post('logout', ['as' => 'logout', 'uses' => 'Auth\LoginController@logout']);

// Route::get('register', 'Auth\RegisterController@register');
// Route::post('register', 'Auth\RegisterController@store');
Route::get('login', 'Auth\LoginController@login')->name('login');
Route::post('login', 'Auth\LoginController@authenticate');
// Route::get('logout', 'Auth\LoginController@logout')->name('logout');

Route::get('/', 'HomeController@index')->name('home');
Route::get('/home', 'HomeController@index')->name('home');

//Teller
Route::get('/pelanggan','CustomersController@index')->middleware('auth','teller');
Route::get('/customer_info',['as'=>'customer_info','uses'=>'CustomersController@info'])->middleware('auth','teller');
Route::get('/gadaian',['as'=>'gadaian','uses'=>'GadaianController@index'])->middleware('auth','teller');
Route::get('/daftar_marhun',['as'=>'daftar_marhun','uses'=>'MarhunController@index'])->middleware('auth','teller');
Route::get('/penebusan/{norujukan}',['as'=>'penebusan','uses' => 'PenebusanController@index'])->middleware('auth','teller');
Route::get('/lelongan/{norujukan}',['as'=>'lelongan','uses' => 'LelongController@index'])->middleware('auth','teller');
Route::get('/aliran_tunai','AliranTunaiController@index')->middleware('auth','teller');
Route::get('/aliran_tunai/laporanserahan}',['as'=>'laporan.serahanteller','uses' => 'AliranTunaiController@LaporanSerahan'])->middleware('auth','teller');
Route::put('/aliran_tunai/Gadaian',['as'=>'alirantunai.gadai','uses' => 'AliranTunaiController@alirantunaiGadai'])->middleware('auth','teller');
Route::put('/aliran_tunai/Tebusan',['as'=>'alirantunai.tebus','uses' => 'AliranTunaiController@alirantunaiTebus'])->middleware('auth','teller');
Route::put('/aliran_tunai/advansur',['as'=>'alirantunai.advansur','uses' => 'AliranTunaiController@alirantunaiUpahBknTawarruq'])->middleware('auth','teller');
Route::get('/harga_emas','HargaEmasController@index')->middleware('auth','teller');
Route::get('/profile',['as'=>'profile','uses'=>'UserController@index'])->middleware('auth');
Route::get('/customer/search',['as'=>'customer.search','uses'=>'CustomersController@search'])->middleware('auth','teller');
Route::post('/customer/store',['as'=>'customer.store','uses'=>'CustomersController@store'])->middleware('auth','teller');
Route::post('/gadai/store',['as'=>'gadai.store','uses'=>'GadaianController@store'])->middleware('auth','teller');
Route::get('/gadai/batal',['as'=>'gadai.batal','uses'=>'GadaianController@batal'])->middleware('auth','teller');
Route::get('/customer/otp',['as'=>'customer.otp','uses'=>'CustomersController@getOTP'])->middleware('auth','teller');
Route::get('/getwakil',['as'=>'wakil.search','uses'=>'PenebusanController@getWakil'])->middleware('auth','teller');
Route::get('/cari',['as'=>'wakil.caricustomer','uses'=>'CustomersController@cari'])->middleware('auth','teller');
Route::post('/createwakil',['as'=>'wakil.create','uses'=>'PenebusanController@createWakil'])->middleware('auth','teller');
Route::get('/firstwakil',['as'=>'wakil.first','uses'=>'PenebusanController@getfirstWakil'])->middleware('auth','teller');
Route::get('/history',['as'=>'gadai.history','uses'=>'GadaianController@history'])->middleware('auth','teller');

//Kemaskini Upah
Route::get('/kemaskiniupah',['as'=>'kemaskini.upah','uses'=>'AliranTunaiController@kemaskiniupah'])->middleware('auth','teller');

//Kemaskini Aliran Tunai
Route::get('/periksaalirantunai',['as'=>'periksa.alirantunai','uses'=>'AliranTunaiController@periksaAliranTunai'])->middleware('auth','teller');
Route::get('/kemaskinialirantunai',['as'=>'kemaskini.alirantunai','uses'=>'AliranTunaiController@kemaskiniAliranTunai'])->middleware('auth','teller');


//MAINTENANCE
Route::get('/tebuspenuh',['as'=>'tebus.penuh','uses'=>'PenebusanController@tebuspenuh'])->middleware('auth','teller');
Route::get('/tebusseparuh',['as'=>'tebus.separuh','uses'=>'PenebusanController@tebusseparuh'])->middleware('auth','teller');
Route::get('/tambahpinjaman',['as'=>'tambah.pinjaman','uses'=>'PenebusanController@tambahpinjaman'])->middleware('auth','teller');
Route::get('/bayaransurans',['as'=>'bayaran.ansurans','uses'=>'PenebusanController@bayaransurans'])->middleware('auth','teller');
Route::get('/bayaransuranstawarruq',['as'=>'bayaran.ansuranstawarruq','uses'=>'PenebusanController@bayaransuransTawarruq'])->middleware('auth','teller');

//Penilai
Route::get('/gadaiansemasa',['as'=>'gadaian.semasa','uses'=>'GadaianController@gadaiansemasa'])->middleware('auth','penilai');
Route::post('/gadaiancetak',['as'=>'gadaian.cetak','uses'=>'GadaianController@cetakSAG'])->middleware('auth','penilai');
Route::post('/serahmarhun',['as'=>'marhun.serah','uses'=>'GadaianController@serahMarhun'])->middleware('auth','penilai');
Route::post('/printsag',['as'=>'printsag','uses'=>'GadaianController@printSAG'])->middleware('auth','penilai');

//Khazanah
Route::get('/menu','KhazanahController@menu')->middleware('auth','khazanah');
Route::get('/pendahuluanserahan','KhazanahController@pendahuluanserahandaftar')->middleware('auth','khazanah');
Route::get('/khazanahgadaian',['as'=>'khazanah.gadaian','uses'=>'KhazanahController@gadaian'])->middleware('auth','khazanah');
Route::get('/khazanahtebus',['as'=>'khazanah.tebus','uses'=>'KhazanahController@tebus'])->middleware('auth','khazanah');
Route::get('/kelulusan','KhazanahController@kelulusan')->middleware('auth','khazanah');
Route::get('/kelulusanrekodlepas',['as'=>'khazanah.rekodlepas','uses'=>'KhazanahController@kelulusanrekodlepas'])->middleware('auth','khazanah');
Route::get('/pendahuluan',['as'=>'khazanah.pendahulu','uses'=>'KhazanahController@pendahuluan'])->middleware('auth','khazanah');
Route::get('/serahan',['as'=>'khazanah.serahan','uses'=>'KhazanahController@serahan'])->middleware('auth','khazanah');
Route::get('/laporanscanbarcode',['as'=>'laporanscanbarcode','uses'=>'KhazanahController@LaporanSemakBarcode'])->middleware('auth','khazanah');
Route::get('/laporan',['as'=>'laporan','uses'=>'KhazanahController@laporan'])->middleware('auth','khazanah');
Route::get('/laporan/gadaian',['as'=>'laporan.gadaian','uses'=>'KhazanahController@laporanGadaian'])->middleware('auth','khazanah');
Route::post('laporan/gadaian/cetak',['as'=>'gadaian.laporancetak','uses'=>'KhazanahController@cetakLaporanGadai'])->middleware('auth','khazanah');
Route::get('/laporan/tebus',['as'=>'laporan.tebus','uses'=>'KhazanahController@laporanPenebusan'])->middleware('auth','khazanah');
Route::post('laporan/tebus/cetak',['as'=>'tebus.laporancetak','uses'=>'KhazanahController@cetakLaporanPenebusan'])->middleware('auth','khazanah');
Route::get('/khazanah/pelanggan',['as'=>'khazanah.pelanggan','uses'=>'KhazanahController@index'])->middleware('auth','khazanah');
Route::get('/khazanah/customer_info',['as'=>'khazanah.customer_info','uses'=>'KhazanahController@info'])->middleware('auth','khazanah');
Route::post('/khazanah/pendahuluanserahanHQ',['as'=>'khazanah.pendahuluanserahanHQ','uses'=>'KhazanahController@pendahuluanserahanHQ'])->middleware('auth','khazanah');

Route::post('/kakitangan/harian',['as'=>'kakitangan.harian','uses'=>'KakitanganController@kakitanganHarian'])->middleware('auth','khazanah');
Route::get('/lelong',['as'=>'lelong','uses'=>'LelongController@lelong']);

//Request Teller Batal Route
Route::get('/requestbatal',['as'=>'request.pembatalan','uses'=>'KhazanahController@RequestPembatalan'])->middleware('auth','khazanah');

//Added Yang Baru 
Route::post('/barcodescannedtebus',['as'=>'barcodetebus.scanned','uses'=>'KhazanahController@barcodescannedtebus'])->middleware('auth','khazanah');
Route::get('/pendahuluanserah/{id}',['as'=>'pendahuluan.serah','uses'=>'KhazanahController@pendahuluanserah'])->middleware('auth','khazanah');
Route::get('/khazanahserahan/{id}',['as'=>'khazanah.serah','uses'=>'KhazanahController@khazanahserahan'])->middleware('auth','khazanah');
Route::post('/kemaskinipendahuluan', ['as' =>'khazanah.kemaskiniPendahuluan','uses'=>'KhazanahController@kemaskiniPendahuluan'])->middleware('auth','khazanah');
Route::post('/kemaskiniserahan',['as'=>'khazanah.KemaskiniSerahan','uses'=>'KhazanahController@KemaskiniSerahan'])->middleware('auth','khazanah');
Route::get('/kakitangan',['as'=>'khazanah.kakitangan','uses'=>'KhazanahController@kakitangan'])->middleware('auth','khazanah');
Route::get('/dashboard',['as'=>'khazanah.dashboard','uses'=>'KhazanahController@dashboard'])->middleware('auth','khazanah');
Route::get('/capaian',['as'=>'khazanah.capaian','uses'=>'KhazanahController@capaian'])->middleware('auth','khazanah');
Route::get('/alirantunai',['as'=>'khazanah.alirantunai','uses'=>'KhazanahController@alirantunai'])->middleware('auth','khazanah');
Route::get('/pelangganan',['as'=>'khazanah.pelanggan','uses'=>'KhazanahController@pelanggan'])->middleware('auth','khazanah');
Route::get('/unjuran',['as'=>'khazanah.unjuran','uses'=>'KhazanahController@unjuran'])->middleware('auth','khazanah');
Route::get('/panjar',['as'=>'khazanah.panjar','uses'=>'KhazanahController@panjar'])->middleware('auth','khazanah');
Route::get('/getkelulusan',['as'=>'khazanah.getkelulusan','uses'=>'KhazanahController@getkelulusan'])->middleware('auth','teller');
Route::post('/createkelulusan',['as'=>'khazanah.createkelulusan','uses'=>'KhazanahController@createkelulusan'])->middleware('auth','teller');
Route::put('/updatekelulusan',['as'=>'khazanah.updatekelulusan','uses'=>'KhazanahController@updatekelulusan'])->middleware('auth','khazanah');
Route::get('/mintasemulakelulusan',['as'=>'khazanah.getmintasemulakelulusan','uses'=>'KhazanahController@mintakatalaluansemula'])->middleware('auth','khazanah');
Route::get('/mintasemulakelulusan/operasi',['as'=>'operasi.getmintasemulakelulusan','uses'=>'OperasiController@mintakatalaluansemula'])->middleware('auth','operasi');
Route::post('/createpanjar',['as'=>'khazanah.createpanjar','uses'=>'KhazanahController@createpanjar'])->middleware('auth','khazanah');
Route::get('/gadaian/edit/{norujukan}',['as'=>'gadaian.edit','uses'=>'GadaianController@edit'])->middleware('auth','teller');
Route::post('/gadai/edit/store',['as'=>'gadai.editstore','uses'=>'GadaianController@editstore'])->middleware('auth','teller');
Route::put('/gadai/edit/deletemarhun',['as'=>'gadai.editmarhun','uses'=>'GadaianController@editmarhun'])->middleware('auth','teller');
Route::get('/gadai/edit/editmarhun',['as'=>'gadai.ubahmarhun','uses'=>'GadaianController@ubahmarhun'])->middleware('auth','teller');

//Ubah dan Hapus
Route::get('/getkelulu',['as'=>'teller.getkelulusan','uses'=>'GadaianController@getkelulusan'])->middleware('auth','teller');
Route::post('/createkelulu',['as'=>'teller.createkelulusan','uses'=>'GadaianController@createkelulusan'])->middleware('auth');
Route::put('/updatekelulu',['as'=>'teller.updatekelulusan','uses'=>'GadaianController@updatekelulusan'])->middleware('auth','khazanah');


//Tukaran Harga Emas Semasa
Route::get('/gethargaemassemasa',['as'=>'tukaran.hargaemas','uses'=>'PenebusanController@tukaranhargaemas']);

//Tuntut Baki
Route::put('/simpantuntutbaki',['as'=>'lelong.tuntutbaki','uses'=>'LelongController@transaksituntutbaki'])->middleware('auth','teller');

//Laporan Baru
Route::get('/laporan/lelongan',['as'=>'laporan.lelongan','uses'=>'KhazanahController@laporanLelongan'])->middleware('auth','khazanah');
Route::post('laporan/lelongan/cetak',['as'=>'lelongan.laporancetak','uses'=>'KhazanahController@cetaklaporanLelongan'])->middleware('auth','khazanah');
Route::get('/laporan/ansuran',['as'=>'laporan.ansuran','uses'=>'KhazanahController@laporanAnsuran'])->middleware('auth','khazanah');
Route::post('laporan/ansuran/cetak',['as'=>'ansuran.laporancetak','uses'=>'KhazanahController@cetakLaporanAnsuran'])->middleware('auth','khazanah');
Route::get('/laporan/pelangganbaru',['as'=>'laporan.pelangganbaru','uses'=>'KhazanahController@laporanPelangganBaru'])->middleware('auth','khazanah');
Route::post('laporan/pelangganbaru/cetak',['as'=>'pelangganbaru.laporancetak','uses'=>'KhazanahController@cetakLaporanPelangganBaru'])->middleware('auth','khazanah');
Route::get('/laporan/stokaudit',['as'=>'laporan.stokaudit','uses'=>'KhazanahController@laporanStokAudit'])->middleware('auth','khazanah');
Route::get('laporan/stokaudit/cetak',['as'=>'stokaudit.laporancetak','uses'=>'KhazanahController@cetakLaporanStokAudit'])->middleware('auth','khazanah');
Route::get('/laporan/kawalanstok',['as'=>'laporan.kawalanstok','uses'=>'KhazanahController@laporanKawalanStok'])->middleware('auth','khazanah');
Route::post('laporan/kawalanstok/cetak',['as'=>'kawalanstok.laporancetak','uses'=>'KhazanahController@cetakLaporanKawalanStok'])->middleware('auth','khazanah');
Route::get('/laporan/batalsuratgadai',['as'=>'laporan.batalsuratgadai','uses'=>'KhazanahController@laporanBatalSuratGadai'])->middleware('auth','khazanah');
Route::post('laporan/batalsuratgadai/cetak',['as'=>'batalsuratgadai.laporancetak','uses'=>'KhazanahController@cetakLaporanBatalSuratGadai'])->middleware('auth','khazanah');
Route::get('/laporan/marhunharian',['as'=>'laporan.marhunharian','uses'=>'KhazanahController@laporanMarhunHarian'])->middleware('auth','khazanah');
Route::post('laporan/marhunharian/cetak',['as'=>'marhunharian.laporancetak','uses'=>'KhazanahController@cetakLaporanMarhunHarian'])->middleware('auth','khazanah');
Route::get('/laporan/petibesi',['as'=>'laporan.petibesi','uses'=>'KhazanahController@laporanPetiBesi'])->middleware('auth','khazanah');
Route::post('laporan/petibesi/cetak',['as'=>'petibesi.laporancetak','uses'=>'KhazanahController@cetakLaporanPetiBesi'])->middleware('auth','khazanah');
Route::get('/laporan/marhunterkumpul',['as'=>'laporan.marhunterkumpul','uses'=>'KhazanahController@laporanMarhunTerkumpul'])->middleware('auth','khazanah');
Route::post('laporan/marhunterkumpul/cetak',['as'=>'marhunterkumpul.laporancetak','uses'=>'KhazanahController@cetakLaporanMarhunTerkumpul'])->middleware('auth','khazanah');
Route::get('laporan/ringkasanharian/',['as'=>'laporan.ringkasanharian','uses'=>'KhazanahController@laporanRingkasanHarian'])->middleware('auth','khazanah');
Route::get('laporan/ringkasanharian/cetak',['as'=>'ringkasanharian.laporancetak','uses'=>'KhazanahController@cetakLaporanRingkasanHarian'])->middleware('auth','khazanah');
Route::get('laporan/ringkasanterkumpul/cetak',['as'=>'ringkasanterkumpul.laporancetak','uses'=>'KhazanahController@cetakLaporanRingkasanTerkumpul'])->middleware('auth','khazanah');
Route::get('/laporan/agingbulanan', [ 'as'=>'laporan.agingbulanan', 'uses'=>'KhazanahController@laporanAging_Bulanan'])->middleware('auth','khazanah');
Route::post('/laporan/agingbulanan/cetak', ['as'=>'agingbulan.cetaklaporan', 'uses'=>'KhazanahController@cetaklaporang_Aging'])->middleware('auth','khazanah');
Route::get('/laporan/perbelanjaan', [ 'as'=>'laporan.perbelanjaan', 'uses'=>'KhazanahController@laporan_Perbelanjaan'])->middleware('auth','khazanah');
Route::post('/laporan/perbelanjaan/cetak', ['as'=>'perbelanjaan.cetaklaporan', 'uses'=>'KhazanahController@cetaklaporan_Perbelanjaan'])->middleware('auth','khazanah');
Route::get('/laporan/perbelanjaan/cetak/{baucer}', ['as'=>'perbelanjaan.cetaklaporanbaucer', 'uses'=>'KhazanahController@cetaklaporan_Perbelanjaan_Baucer'])->middleware('auth','khazanah');
// Route::get('/laporan/agingbulanan', [ 'as'=>'laporan.agingbulanan', 'uses'=>'KhazanahController@laporanAging_Bulanan'])->middleware('auth','khazanah');
// Route::post('/laporan/agingbulanan/cetak', ['as'=>'agingbulan.cetaklaporan', 'uses'=>'KhazanahController@cetaklaporang_Aging'])->middleware('auth','khazanah');


Route::get('/laporan/komoditi',['as'=>'laporan.komoditi','uses'=>'KomuditiController@cetakRekodKomoditi']);

//Resit Ansurans
Route::get('/resit/{id}',['as'=>'resit.ansuran','uses'=>'GadaianController@resit'])->middleware('auth','teller');
Route::get('/resitansurans/{id}',['as'=>'resit.ansurans','uses'=>'GadaianController@resitansurans'])->middleware('auth','teller');
Route::get('/resitbelumansurans/{id}',['as'=>'resit.belumansurans','uses'=>'GadaianController@resitbelumansurans'])->middleware('auth','teller');
Route::get('/resit/tebus/{id}',['as'=>'resit.tebus','uses'=>'GadaianController@resittebus'])->middleware('auth','teller');
Route::get('/resit/advansur/{id}',['as'=>'resit.advansur','uses'=>'GadaianController@resitadvansur'])->middleware('auth','teller');
Route::get('/resit/tebusseparuh/{id}',['as'=>'resit.tebusseparuh','uses'=>'GadaianController@resittebusseparuh'])->middleware('auth','teller');
Route::get('/resit/belumtebus/{id}',['as'=>'resit.belumtebus','uses'=>'GadaianController@resitbelumtebus'])->middleware('auth','teller');
Route::get('/resit/tambahpinjam/{id}',['as'=>'resit.tambahpinjam','uses'=>'GadaianController@resittambahpinjam'])->middleware('auth','teller');
Route::get('/resit/tuntutbaki/{id}',['as'=>'resit.tuntutbaki','uses'=>'LelongController@resittuntutbaki'])->middleware('auth','teller');


Route::post('/barcodescanned',['as'=>'barcode.scanned','uses'=>'KhazanahController@barcodescanned'])->middleware('auth','khazanah');

//Operasi
Route::get('/operasi/kelulusan','OperasiController@kelulusan')->name('operasi.kelulusan')->middleware('auth','operasi');
Route::post('/operasi/createkelulusan',['as'=>'operasi.createkelulusan','uses'=>'OperasiController@createkelulusan'])->middleware('auth','teller');
Route::get('/operasi/getkelulusan',['as'=>'operasi.getkelulusan','uses'=>'OperasiController@getkelulusan'])->middleware('auth','teller');
Route::put('/operasi/updatekelulusan',['as'=>'operasi.updatekelulusan','uses'=>'OperasiController@updatekelulusan'])->middleware('auth','operasi');
Route::get('/daftar/kakitangan',['as'=>'daftar.kakitangan','uses'=>'KakitanganController@daftarKakitangan'])->middleware('auth','operasi');
Route::post('/daftar/kakitangan/baru',['as'=>'kakitangan.baru','uses'=>'KakitanganController@registerStaff'])->middleware('auth','operasi');
Route::get('/operasi/parameter','OperasiController@parameter')->name('parameter')->middleware('auth','operasi');
Route::get('/operasi/hargaemas',['as'=>'operasi.hargaemas','uses'=>'OperasiController@hargaemas'])->middleware('auth','operasi');
Route::post('/operasi/hargaemas/update',['as'=>'hargaemas.update','uses'=>'OperasiController@updatehargaemas'])->middleware('auth','operasi');
Route::post('/operasi/hargaemas',['as'=>'hargaemas.create','uses'=>'OperasiController@createhargaemas'])->middleware('auth','operasi');

Route::get('/komoditi',['as'=>'komuditi','uses'=>'KomuditiController@index']);
Route::get('/komoditi/rekod',['as'=>'rekod.komoditi','uses'=>'KomuditiController@rekodKomoditi']);
Route::get('/komoditi/rekod/print',['as'=>'komoditi.rekod.print','uses'=>'KomuditiController@printRekodTransaksi']);





Route::get('/laporan/stokauditbersih', ['as'=>'laporan.stokauditbersih', 'uses'=>'KhazanahController@stokAuditBersih'])->middleware('auth','khazanah');
Route::post('/laporan/stokauditbersih_cetak',['as' =>'stokauditbersih.cetakstokauditbersih', 'uses'=>'KhazanahController@cetakStok_AuditBersih'])->middleware('auth','khazanah');


Route::get('/laporan/stokauditdetails', ['as'=>'laporan.stokauditdetails','uses'=>'KhazanahController@stokAuditDetails'])->middleware('auth','khazanah');
Route::post('laporan/stokauditdetails_cetak',['as'=>'stokauditdetails.stokauditdetails_cetak', 'uses'=>'KhazanahController@cetak_stokAuditDetails'])->middleware('auth', 'khazanah');








Route::get('/laporan/datalejeram',['as' =>'laporan.datalejer_am', 'uses'=>'KhazanahController@data_lejer_am'])->middleware('auth', 'khazanah');
route::post('/cetaklejer_am',['as'=>'cetak.lejer_am', 'uses'=>'KhazanahController@cetak_lejer_am'])->middleware('auth', 'khazanah');

Route::get('laporan/dataimbangduga',['as'=> 'laporan.imbangduga' , 'uses'=>'KhazanahController@laporanImbangduga' ])->middleware('auth','khazanah');
Route::post('/laporan/imbangduga',['as' =>'imbangduga.cetak', 'uses'=>'KhazanahController@cetakImbangDuga'])->middleware('auth', 'khazanah');
