<?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!
|
*/

#Dashboard
Route::get('/', 'DashboardController@index');
Route::get('/dashboard', 'DashboardController@index');

/**********************- To be shared by all 3 payroll items -********************/

Route::post('/allowances/employees/save_selected_employees', 'AllowancesController@save_selected_employees');
Route::post('/allowances/employees/filter_employees', 'AllowancesController@filter_employees');
Route::post('/allowances/employees/update_group_members', 'AllowancesController@update_group_members');
Route::post('/allowances/employees/delete_group', 'AllowancesController@delete_group');

/**********************- To be shared by all 3 payroll items -********************/

#Allowances
Route::get('/allowances/edit_group/{group_id}', 'AllowancesController@edit_group');
Route::get('/allowances/employees/{allowance}', 'AllowancesController@add_employees');
Route::resource('/allowances', 'AllowancesController');
Route::post('/allowances/destroy', 'AllowancesController@destroy');

#Range
Route::get('/ranges/edit/{range_id}', 'RangesController@edit');
Route::resource('/ranges', 'RangesController');
Route::post('/ranges/destroy', 'RangesController@destroy');

#Relief
Route::get('/relief/edit_group/{group_id}', 'ReliefController@edit_group');
Route::get('/relief/employees/{relief}', 'ReliefController@add_employees');
Route::resource('/relief', 'ReliefController');
Route::post('/relief/destroy', 'ReliefController@destroy');

#Deductions
Route::get('/deductions/edit_group/{group_id}', 'DeductionsController@edit_group');
Route::get('/deductions/employees/{deduction}', 'DeductionsController@add_employees');
Route::resource('/deductions', 'DeductionsController');
Route::post('/deductions/destroy', 'DeductionsController@destroy');

#Dashboard
Route::get('/dashboard', 'DashboardController@index');

#ProcessPayrollController
Route::post('/process_payroll/process', 'ProcessPayrollController@process_payroll');
Route::resource('/process_payroll', 'ProcessPayrollController');

#PayslipController
Route::get('/payslip', 'PayslipController@index');
Route::get('/payslip/view_payslip', 'PayslipController@view_payslip');

#EmployeesController
Route::get('/employees', 'EmployeesController@index');
Route::get('/employees/export', 'EmployeesController@export')->name('export');
Route::post('/employees/import', 'EmployeesController@import')->name('import');
Route::get('/employees/add', 'EmployeesController@form')->name('/employees/add');
Route::get('/payfrequency', 'PayfrequencyController@index');



Auth::routes();

Route::get('/home', 'HomeController@index')->name('home');
Route::get('admin/routes', 'HomeController@admin')->middleware('admin');
Route::get('manager/routes', 'HomeController@manager')->middleware('admin');


