<?php
use App\Http\Controllers\LanguageController;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Auth;
/*
|--------------------------------------------------------------------------
| 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 redirect(route('login'));
});

Route::get('/config-clear', function() {
   Artisan::call('config:cache');

   return "Cleared!";

});

Auth::routes(['verify' => true]);

// dashboard Routes
//Route::get('/','DashboardController@dashboardEcommerce');
Route::middleware('auth')->group( function () {
    Route::get('/home', 'HomeController@index')->name('home');

    //User
    Route::resource('user', 'UserController', ['except' => ['destroy']]);
    Route::get('user/aktivasi/{id}', ['as' => 'user.aktivasi', 'uses' => 'UserController@aktivasi']);
    Route::get('user/deaktivasi/{id}', ['as' => 'user.deaktivasi', 'uses' => 'UserController@deaktivasi']);
    Route::get('user/destroy/{id}', ['as' => 'user.destroy', 'uses' => 'UserController@destroy']);

    //roles
    Route::resource('role', 'RoleController', ['except' => ['destroy']]);
    Route::get('role/destroy/{id}', ['as' => 'role.destroy', 'uses' => 'RoleController@destroy']);
    
    //profil
    Route::get('profil', ['as' => 'profil.index', 'uses' => 'ProfilController@index']);
    Route::put('profil', ['as' => 'profil.update', 'uses' => 'ProfilController@update']);

    //akun
    Route::get('akun', ['as' => 'akun.index', 'uses' => 'AkunController@index']);
    Route::put('akun', ['as' => 'akun.update', 'uses' => 'AkunController@update']);

    //notification
    Route::get('/markAsRead',function(){
        auth()->user()->unreadNotifications->markAsRead();
    });


    Route::middleware('profil')->group( function () {
        //sktm
        Route::resource('sktm', 'SktmController', ['except' => ['destroy']]);
        Route::get('sktm/ktp/{id}', 'SktmController@ktp')->name('sktmktp.get');
        Route::get('sktm/kk/{id}', 'SktmController@kk')->name('sktmkk.get');
        Route::get('sktm/accstaff/{id}', ['as' => 'sktm.accstaff', 'uses' => 'SktmController@accstaff']);
        Route::get('sktm/acclurah/{id}', ['as' => 'sktm.acclurah', 'uses' => 'SktmController@acclurah']);
        Route::get('sktm/acccetak/{id}', ['as' => 'sktm.acccetak', 'uses' => 'SktmController@acccetak']);
        Route::get('sktm/surat/{id}', ['as' => 'sktm.surat', 'uses' => 'SktmController@surat']);
        Route::get('sktm/destroy/{id}', ['as' => 'sktm.destroy', 'uses' => 'SktmController@destroy']);

        //skdu
        Route::resource('skdu', 'SkduController', ['except' => ['destroy']]);
        Route::get('skdu/ktp/{id}', 'SkduController@ktp')->name('skduktp.get');
        Route::get('skdu/kk/{id}', 'SkduController@kk')->name('skdukk.get');
        Route::get('skdu/fotousaha/{id}', 'SkduController@fotousaha')->name('skdufotousaha.get');
        Route::get('skdu/accstaff/{id}', ['as' => 'skdu.accstaff', 'uses' => 'SkduController@accstaff']);
        Route::get('skdu/acclurah/{id}', ['as' => 'skdu.acclurah', 'uses' => 'SkduController@acclurah']);
        Route::get('skdu/acccetak/{id}', ['as' => 'skdu.acccetak', 'uses' => 'SkduController@acccetak']);
        Route::get('skdu/surat/{id}', ['as' => 'skdu.surat', 'uses' => 'SkduController@surat']);
        Route::get('skdu/destroy/{id}', ['as' => 'skdu.destroy', 'uses' => 'SkduController@destroy']);

        //skd
        Route::resource('skd', 'SkdController', ['except' => ['destroy']]);
        Route::get('skd/ktp/{id}', 'SkdController@ktp')->name('skdktp.get');
        Route::get('skd/kk/{id}', 'SkdController@kk')->name('skdkk.get');
        Route::get('skd/accstaff/{id}', ['as' => 'skd.accstaff', 'uses' => 'SkdController@accstaff']);
        Route::get('skd/acclurah/{id}', ['as' => 'skd.acclurah', 'uses' => 'SkdController@acclurah']);
        Route::get('skd/acccetak/{id}', ['as' => 'skd.acccetak', 'uses' => 'SkdController@acccetak']);
        Route::get('skd/surat/{id}', ['as' => 'skd.surat', 'uses' => 'SkdController@surat']);
        Route::get('skd/destroy/{id}', ['as' => 'skd.destroy', 'uses' => 'SkdController@destroy']);

        //spk
        Route::resource('spk', 'SpkController', ['except' => ['destroy']]);
        Route::get('spk/ktp/{id}', 'SpkController@ktp')->name('spkktp.get');
        Route::get('spk/kk/{id}', 'SpkController@kk')->name('spkkk.get');
        Route::get('spk/accstaff/{id}', ['as' => 'spk.accstaff', 'uses' => 'SpkController@accstaff']);
        Route::get('spk/acclurah/{id}', ['as' => 'spk.acclurah', 'uses' => 'SpkController@acclurah']);
        Route::get('spk/acccetak/{id}', ['as' => 'spk.acccetak', 'uses' => 'SpkController@acccetak']);
        Route::get('spk/surat/{id}', ['as' => 'spk.surat', 'uses' => 'SpkController@surat']);
        Route::get('spk/destroy/{id}', ['as' => 'spk.destroy', 'uses' => 'SpkController@destroy']);

        //skbpm
        Route::resource('skbpm', 'SkbpmController', ['except' => ['destroy']]);
        Route::get('skbpm/ktp/{id}', 'SkbpmController@ktp')->name('skbpmktp.get');
        Route::get('skbpm/kk/{id}', 'SkbpmController@kk')->name('skbpmkk.get');
        Route::get('skbpm/accstaff/{id}', ['as' => 'skbpm.accstaff', 'uses' => 'SkbpmController@accstaff']);
        Route::get('skbpm/acclurah/{id}', ['as' => 'skbpm.acclurah', 'uses' => 'SkbpmController@acclurah']);
        Route::get('skbpm/acccetak/{id}', ['as' => 'skbpm.acccetak', 'uses' => 'SkbpmController@acccetak']);
        Route::get('skbpm/surat/{id}', ['as' => 'skbpm.surat', 'uses' => 'SkbpmController@surat']);
        Route::get('skbpm/destroy/{id}', ['as' => 'skbpm.destroy', 'uses' => 'SkbpmController@destroy']);

        //skpd
        Route::resource('skpd', 'SkpdController', ['except' => ['destroy']]);
        Route::get('skpd/ktp/{id}', 'SkpdController@ktp')->name('skpdktp.get');
        Route::get('skpd/kk/{id}', 'SkpdController@kk')->name('skpdkk.get');
        Route::get('skpd/accstaff/{id}', ['as' => 'skpd.accstaff', 'uses' => 'SkpdController@accstaff']);
        Route::get('skpd/acclurah/{id}', ['as' => 'skpd.acclurah', 'uses' => 'SkpdController@acclurah']);
        Route::get('skpd/acccetak/{id}', ['as' => 'skpd.acccetak', 'uses' => 'SkpdController@acccetak']);
        Route::get('skpd/surat/{id}', ['as' => 'skpd.surat', 'uses' => 'SkpdController@surat']);
        Route::get('skpd/destroy/{id}', ['as' => 'skpd.destroy', 'uses' => 'SkpdController@destroy']);

        //skl
        Route::resource('skl', 'SklController', ['except' => ['destroy']]);
        Route::get('skl/ktp/{id}', 'SklController@ktp')->name('sklktp.get');
        Route::get('skl/kk/{id}', 'SklController@kk')->name('sklkk.get');
        Route::get('skl/accstaff/{id}', ['as' => 'skl.accstaff', 'uses' => 'SklController@accstaff']);
        Route::get('skl/acclurah/{id}', ['as' => 'skl.acclurah', 'uses' => 'SklController@acclurah']);
        Route::get('skl/acccetak/{id}', ['as' => 'skl.acccetak', 'uses' => 'SklController@acccetak']);
        Route::get('skl/surat/{id}', ['as' => 'skl.surat', 'uses' => 'SklController@surat']);
        Route::get('skl/destroy/{id}', ['as' => 'skl.destroy', 'uses' => 'SklController@destroy']);

        //skkp
        Route::resource('skkp', 'SkkpController', ['except' => ['destroy']]);
        Route::get('skkp/ktp/{id}', 'SkkpController@ktp')->name('skkpktp.get');
        Route::get('skkp/kk/{id}', 'SkkpController@kk')->name('skkpkk.get');
        Route::get('skkp/accstaff/{id}', ['as' => 'skkp.accstaff', 'uses' => 'SkkpController@accstaff']);
        Route::get('skkp/acclurah/{id}', ['as' => 'skkp.acclurah', 'uses' => 'SkkpController@acclurah']);
        Route::get('skkp/acccetak/{id}', ['as' => 'skkp.acccetak', 'uses' => 'SkkpController@acccetak']);
        Route::get('skkp/surat/{id}', ['as' => 'skkp.surat', 'uses' => 'SkkpController@surat']);
        Route::get('skkp/destroy/{id}', ['as' => 'skkp.destroy', 'uses' => 'SkkpController@destroy']);

        //skmb
        Route::resource('skmb', 'SkmbController', ['except' => ['destroy']]);
        Route::get('skmb/ktp/{id}', 'SkmbController@ktp')->name('skmbktp.get');
        Route::get('skmb/kk/{id}', 'SkmbController@kk')->name('skmbkk.get');
        Route::get('skmb/accstaff/{id}', ['as' => 'skmb.accstaff', 'uses' => 'SkmbController@accstaff']);
        Route::get('skmb/acclurah/{id}', ['as' => 'skmb.acclurah', 'uses' => 'SkmbController@acclurah']);
        Route::get('skmb/acccetak/{id}', ['as' => 'skmb.acccetak', 'uses' => 'SkmbController@acccetak']);
        Route::get('skmb/surat/{id}', ['as' => 'skmb.surat', 'uses' => 'SkmbController@surat']);
        Route::get('skmb/destroy/{id}', ['as' => 'skmb.destroy', 'uses' => 'SkmbController@destroy']);

        //skjd
        Route::resource('skjd', 'SkjdController', ['except' => ['destroy']]);
        Route::get('skjd/ktp/{id}', 'SkjdController@ktp')->name('skjdktp.get');
        Route::get('skjd/kk/{id}', 'SkjdController@kk')->name('skjdkk.get');
        Route::get('skjd/accstaff/{id}', ['as' => 'skjd.accstaff', 'uses' => 'SkjdController@accstaff']);
        Route::get('skjd/acclurah/{id}', ['as' => 'skjd.acclurah', 'uses' => 'SkjdController@acclurah']);
        Route::get('skjd/acccetak/{id}', ['as' => 'skjd.acccetak', 'uses' => 'SkjdController@acccetak']);
        Route::get('skjd/surat/{id}', ['as' => 'skjd.surat', 'uses' => 'SkjdController@surat']);
        Route::get('skjd/destroy/{id}', ['as' => 'skjd.destroy', 'uses' => 'SkjdController@destroy']);
    });
    // locale Route
    //Route::get('lang/{locale}',[LanguageController::class,'swap']);

    //Laravolt
    Route::get('provinces', 'DependantDropdownController@provinces')->name('provinces');
    Route::get('cities', 'DependantDropdownController@cities')->name('cities');
    Route::get('districts', 'DependantDropdownController@districts')->name('districts');
    Route::get('villages', 'DependantDropdownController@villages')->name('villages');

});

