<?php

use App\Http\Controllers\ProfileController;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\UserController;

/*
|--------------------------------------------------------------------------
| 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('home');
});


Auth::routes();

Route::group(['middleware' => ['auth']], function () {
    Route::get('/home', function () {
        return view('home');
    });
    Route::get('/insert', function () {
        return view('insert'); 
    });

    Route::get('/myaccount', function () {
        return view('myaccount');
    })->name('myaccount');

    Route::get('/user/{id}/object','App\Http\Controllers\UserController@object')->name('user-object-assign');
    Route::post('/user/{id}/object/create','App\Http\Controllers\UserController@object_update')->name('object-assign-form');

    Route::get('/download-file/{file}', [App\Http\Controllers\TempFileController::class, 'show'])->name('downloadFile');

    Route::resource('/user','App\Http\Controllers\UserController');
    Route::resource('/report','App\Http\Controllers\ReportController');
    Route::post('/import-report',[App\Http\Controllers\ReportController::class, 'import'])->name('import-report');
    Route::get('/export-report',[App\Http\Controllers\ReportController::class, 'export'])->name('export-report');


    Route::post('/account-update',[ProfileController::class,'account_update'])->name('account-update');
    Route::post('/password-update',[ProfileController::class,'password_update'])->name('password-update');


});

