<?php

use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Auth;
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('/clear-all', function() {
    Artisan::call('cache:clear');
    Artisan::call('view:clear');
    Artisan::call('clear-compiled');
    Artisan::call('config:cache');
    Artisan::call('config:clear');
    return "All is cleared";
});

Route::get('/', function () {
    return view('welcome');
});


Route::get('/dashboard', function () {
    return view('dashboard');
});

Route::get('/explore', function () {
    return view('application.explore');
});

Route::get('/landing', function () {
    return view('landing');
});

Route::get('/Q', function () {
    return view('Q');
});
Route::get('/fixemail', function () {
    return view('fixemail');
});



Auth::routes();

//Route::get('/email-verification/{id}', [App\Http\Controllers\RegisterController::class,'email_verification'])->name('/email-verification');

Route::get('/login', [App\Http\Controllers\Auth\LoginController::class,'showLoginForm'])->name('login');
Route::post('/student-login', [App\Http\Controllers\Auth\LoginController::class,'login'])->name('student-login');
Route::get('register', [App\Http\Controllers\Auth\RegisterController::class,'showRegistrationForm'])->name('register');
Route::post('student-register', [App\Http\Controllers\Auth\RegisterController::class,'create'])->name('student-register');
Route::get('/verify/{token}', [App\Http\Controllers\Auth\RegisterController::class,'email_verification'])->name('email-verification');

Route::get('q-apply/{hash}', [App\Http\Controllers\HomeController::class,'student_q_form']);
Route::get('register/{hash}', [App\Http\Controllers\HomeController::class,'q_apply_register_form']);
Route::get('applicant/password/reset', [App\Http\Controllers\HomeController::class,'reset_password']);

Route::group(['middleware' => ['auth']], function() {

Route::get('/home', [App\Http\Controllers\StudentHomeController::class,'index']);
Route::get('/application', [App\Http\Controllers\StudentHomeController::class,'application']);
Route::get('/profile', [App\Http\Controllers\StudentHomeController::class,'profile'])->name('profile');
Route::post('std-logout', [App\Http\Controllers\StudentHomeController::class,'logout'])->name('std-logout');
Route::get('/save-as-complete', [App\Http\Controllers\StudentHomeController::class,'save_as_complete'])->name('save-as-complete');
Route::post('/institution_save', [App\Http\Controllers\StudentHomeController::class,'institution_save'])->name('institution-save');
Route::post('/work_save', [App\Http\Controllers\StudentHomeController::class,'work_save'])->name('work-save');
Route::post('/score_save', [App\Http\Controllers\StudentHomeController::class,'score_save'])->name('score-save');
Route::get('/education-remove/{id}', [App\Http\Controllers\StudentHomeController::class,'education_remove'])->name('education-remove');
Route::get('/work-remove/{id}', [App\Http\Controllers\StudentHomeController::class,'work_remove'])->name('work-remove');
Route::get('/score-remove/{id}', [App\Http\Controllers\StudentHomeController::class,'score_remove'])->name('score-remove');
Route::get('/proposal-remove/{id}', [App\Http\Controllers\StudentHomeController::class,'proposal_remove'])->name('proposal-remove');
Route::post('/institution-update/{id}', [App\Http\Controllers\StudentHomeController::class,'institution_update'])->name('institution-update');
Route::post('/work-update/{id}', [App\Http\Controllers\StudentHomeController::class,'work_update'])->name('work-update');
Route::post('/score-update/{id}', [App\Http\Controllers\StudentHomeController::class,'score_update'])->name('score-update');
Route::post('/proposal_save', [App\Http\Controllers\StudentHomeController::class,'proposal_save'])->name('proposal-save');
Route::post('/proposal-update/{id}', [App\Http\Controllers\StudentHomeController::class,'proposal_update'])->name('proposal-update');
Route::post('/home/proposal-media-upload', [App\Http\Controllers\StudentHomeController::class,'proposal_media_upload'])->name('proposal_media_upload');
Route::get('/change_work_experience/{status}', [App\Http\Controllers\StudentHomeController::class,'change_work_experience'])->name('change_work_experience');
Route::get('/change_test_score/{status}', [App\Http\Controllers\StudentHomeController::class,'change_test_score'])->name('change_test_score');
Route::get('/home/search', [App\Http\Controllers\StudentHomeController::class,'ref_search'])->name('ref-search');

});


// Teacher
Route::get('register-v2/{hash}', [App\Http\Controllers\HomeController::class,'invited_register_form']);
Route::get('register-v2', [App\Http\Controllers\TeacherAuth\RegisterController::class,'showRegistrationForm']);
Route::post('register-v2/teacher-register-v2', [App\Http\Controllers\TeacherAuth\RegisterController::class,'create'])->name('teacher-register-v2');
Route::get('/login-v2', [App\Http\Controllers\TeacherAuth\LoginController::class,'showLoginForm']);
Route::post('/teacher-login', [App\Http\Controllers\TeacherAuth\LoginController::class,'login'])->name('teacher-login');
Route::post('teacher-logout', [App\Http\Controllers\TeacherAuth\LoginController::class,'logout'])->name('teacher-logout');

Route::group(['middleware' => ['teacher'], 'prefix' => 'supervisor'], function() {
    Route::get('dashboard', [App\Http\Controllers\TeacherHomeController::class,'dashboard'])->name('dashboard');
    Route::get('application/{hash}', [App\Http\Controllers\TeacherHomeController::class,'student_proposal_details']);
    Route::get('application', [App\Http\Controllers\TeacherHomeController::class,'applications']);
    Route::get('/application-list/search', [App\Http\Controllers\TeacherHomeController::class,'search']);
    Route::get('wishlist', [App\Http\Controllers\TeacherHomeController::class,'wishlist'])->name('wishlist');
    Route::get('explore', [App\Http\Controllers\TeacherHomeController::class,'explore'])->name('explore');
    Route::get('my-account', [App\Http\Controllers\TeacherHomeController::class,'my_account']); 

});


//Admin
Route::get('/admin-login', [App\Http\Controllers\AdminAuth\LoginController::class,'showLoginForm']);
Route::post('/create-login', [App\Http\Controllers\AdminAuth\LoginController::class,'login'])->name('create-login');
Route::post('admin-logout', [App\Http\Controllers\AdminAuth\LoginController::class,'logout'])->name('admin-logout');
Route::group(['middleware' => ['admin']], function() {
    Route::get('/admin/dashboard', [App\Http\Controllers\Admin\AdminController::class,'dashboard']);
    Route::get('/admin/dashboard/load_country_list/{text}', [App\Http\Controllers\Admin\AdminController::class,'load_country_list']);
    Route::get(
        'destination-wise-university',
        [App\Http\Controllers\Admin\AdminController::class,'destination_wise_university']
    )->name('destination-wise-university');

});



Route::get(
    'modal/{name}',
     'ModalController@get'
    )->name('modal-get');
Route::post(
    'modal/{name}',
     'ModalController@post'
     )->name('modal-post');

Route::get(
	'ajax/{name}',
	'AjaxController@get'
)->name('ajax-get');

Route::post(
	'ajax/{name}',
	'AjaxController@post'
)->name('ajax-post');

Route::get(
    'sub-content/{name}', [App\Http\Controllers\Admin\SubContentController::class, 'get']
)->name('sub-content');





