<?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::resource('/employees','EmployeeController');
Route::get('/employees/export', 'EmployeeController@export')->name('export');
Route::post('/employees/import', 'EmployeeController@import')->name('import');


#PayfrequencyController
Route::resource('/payfrequency', 'PayfrequencyController');
#EmergencyController
Route::resource('/employees/create/emergency','EmergencyController');
Route::resource('/employees/create/dependants','DependantController');



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');


