<?php

/*
|--------------------------------------------------------------------------
| 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('/', function () {
    return view('welcome');
});

Route::group(['middleware' => ['web','auth']], function(){
    Route::get('/home', 'HomeController@index');
    Route::get('/', function () {

        if (Auth::user()->status=='admin'){
            return view('adminlte::admin.index');
        }else if(Auth::user()->status=='customer'){
            return view('adminlte::customer.index');
        }else if(Auth::user()->status=='kasir'){
            return view('adminlte::kasir.index');
        }else if(Auth::user()->status=='inventori'){
            return view('adminlte::inventori.index');
        }
    });
});



Route::group(['middleware' => ['web','auth','admin']], function () {
    Route::get('/laporanTransaksi', 'AdminController@laporanTransaksi');
    Route::get('/listPetugas', 'AdminController@listPetugas');
    // Route::get('/pegawai', 'OrderController@index');
    // Route::get('/create', 'OrderController@create');
    // Route::post('/store', 'OrderController@store');
    // Route::get('/edit/{id}', 'OrderController@edit');
    // Route::post('/update/{id}', 'OrderController@update');
    // Route::get('/delete/{id}', 'OrderController@destroy');
    // Route::get('/allTransaksi', 'TransaksiController@allTransaksi');
});

Route::group(['middleware' => ['web','auth','customer']], function () {
    Route::get('/BeliBarang', 'CustomerController@BeliBarang');
    Route::get('/RequestBarang', 'CustomerController@RequestBarang');
    // Route::get('/pegawai', 'OrderController@index');
    // Route::get('/create', 'OrderController@create');
    // Route::post('/store', 'OrderController@store');
    // Route::get('/edit/{id}', 'OrderController@edit');
    // Route::post('/update/{id}', 'OrderController@update');
    // Route::get('/delete/{id}', 'OrderController@destroy');
    // Route::get('/allTransaksi', 'TransaksiController@allTransaksi');
});

Route::group(['middleware' => ['web','auth','inventori']], function () {
    Route::get('/ListBarang', 'InventoriController@ListBarang');
    Route::get('/create', 'InventoriController@create');
    Route::post('/store', 'InventoriController@store');
    Route::get('/edit/{id}', 'InventoriController@edit');
    Route::post('/update/{id}', 'InventoriController@update');
    Route::get('/delete/{id}', 'InventoriController@destroy');
    
    Route::get('/ListRequest', 'InventoriController@ListRequest');
});

Route::group(['middleware' => ['web','auth','kasir']], function () {
    Route::get('/ListCustomer', 'KasirController@ListCustomer');
    // Route::get('/pegawai', 'OrderController@index');
    // Route::get('/create', 'OrderController@create');
    // Route::post('/store', 'OrderController@store');
    // Route::get('/edit/{id}', 'OrderController@edit');
    // Route::post('/update/{id}', 'OrderController@update');
    // Route::get('/delete/{id}', 'OrderController@destroy');
    // Route::get('/allTransaksi', 'TransaksiController@allTransaksi');
});