<?php

Route::get('/', 'Auth\LoginController@showLoginForm')->name('login');

Route::group(['prefix' => 'auth'], function () {
    Route::post('/login', 'Auth\LoginController@login')->name('auth.login');

    Route::get('/registration/{email}/{hash}', 'Account\ShowRegistrationFormController@show')->name('auth.registration');

    Route::post('/registration/create', 'Account\RegisterAccountController@register')->name('auth.registration.create');

    Route::get('password/forgot', function () {
        return view('pages.authentication.password.forgot');
    })->name('password.forgot');
    Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
    Route::get('password/reset/{token}', function ($token){
        return view('pages.authentication.password.change',['token' => $token]);
    })->name('password.reset');
    Route::post('password/update', 'Auth\ResetPasswordController@reset')->name('password.update');

    Route::get('/logout', 'Auth\LoginController@logout')->name('auth.logout');
});


Route::group(['middleware' => ['secure', 'clearcache']], function (): void {

    Route::get('/profile', function(){
        return view('pages.accounts.profile');
    })->name('user.profile');

    Route::get('/test', 'TestController@index')->name('test');

    Route::get('/accounts', function(){
        return view('pages.accounts.index');
    })->name('accounts.list');

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

    Route::get('/companies/list', function(){
        return view('pages.companies.list');
    })->name('companies.list');

	Route::get('/company/{companyId}/profile', function($companyId){
        return view('pages.companies.profile', ['companyId' => $companyId]);
    })->name('companies.profile');

	Route::get('/warehouses/list', function(){
        return view('pages.warehouses.list');
    })->name('warehouses.list');

    Route::get('/warehouse/{warehouseId}/profile', function($warehouseId){
        return view('pages.warehouses.profile', ['warehouseId' => $warehouseId]);
    })->name('warehouses.profile');

    Route::get('/order/{orderId}/profile', function($orderId){
        return view('pages.orders.profile', ['orderId' => $orderId]);
    })->name('order.profile');

    Route::get('/order', function(){
        return view('pages.orders.index');
    })->name('order');

    Route::get('/order/{warehouseId}/receive_note', function($warehouseId){
        return view('pages.orders.receive_note', ['warehouseId' => $warehouseId]);
    })->name('order.bulk.receive_note');

    Route::get('/{orderId}/qr/{type}/download', 'Orders\OrderController@download')->name('order.download.qr');
    Route::get('/{orderId}/qr/{type}/print', 'Orders\OrderController@print')->name('order.print.qr');
    Route::get('order/cleanup', 'Orders\OrderController@cleanup')->name('order.cleanup');

});


