<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
| enchilada
| 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('/contacts', function () {
    return view('contacts');
});
use Spatie\Activitylog\Models\Activity;
0204040805
browser.pipe.aria.microsoft.com

Auth::routes();

Route::get('/home', 'HomeController@index')->name('home');
*/
// Route::post('testjs', 'UtilityController@showPage');

// Route::get('mno_test', 'UtilityController@processMnoWorldwideFile');
Route::get('loggingtest', 'UtilityController@loggingTest');

Route::get('loadcodes', 'UtilityController@loadShortCodes');
Route::get('migrate_senders', 'UtilityController@migrateSenderids');
Route::get('/testlog', function () {
		$rando = uniqid();
		activity()->log('Look mum, I logged something like this : ' . $rando);
		$lastActivity = Activity::all()->last(); //returns the last logged activity
		dump($lastActivity->description);
		//$lastActivity->description; //returns 'Look mum, I logged something';

});

Route::get('/testfile', function () {
		$file = public_path('documents/general_files/senderid_sample_file.xlsx');

        $extension = pathinfo($file, PATHINFO_EXTENSION);
        $full_file = $file; //. $extension; 
        
        
        $headers = ['Content-Type' => 'application/vnd.ms-excel']; 
        return \Response::download($full_file, 'Sender ID Sample Upload File', $headers);

});

//Route::post('ipstore', 'NetworkOperatorsController@ipStore');

Route::get('testemail', 'UtilityController@EmailTest');
//Route::get('testmno', 'ContractRenewalReminderController@getMnos');
//Route::get('ntfy', 'UtilityController@ntfyTest');
//Route::get('client-renewal', 'ClientContractRenewalAlertsController@getClientDetails');
//insertOnboardingProgress


Route::get('dumpprogress', 'UtilityController@insertOnboardingProgress');
Route::get('paperless', 'UtilityController@paperlessTest');
Route::get('paperless_getparams/{name}', 'UtilityController@getPaperlessAttributes');

Route::get('underconstruction', 'UtilityController@underconstruction');



Route::get('testmap', 'UtilityController@maptest');

Route::get('login', 'LoginController@getLoginPage');

Route::post('login', 'LoginController@handleLogin');
Route::post('otplogin', 'LoginController@handleLoginOtp');

Route::get('showotp', 'LoginController@showOtpPage');
Route::get('resendotp', 'LoginController@resendOtp');
Route::get('logout', 'LoginController@handle_logout');


Route::post('account/register', 'LoginController@registerAccount');


Route::get('ussd/dashboard', 'UssdDashboardController@index');


Route::group(['middleware' => ['checklogin', 'checkcurrentlylogged']], function(){
	//Route::get('/', 'MeetingReportsController@showDetails');

	Route::get('dashboard/get_events', 'DashboardController@getEvents');
	Route::get('dashboard/getquotes', 'DashboardController@getQuotes');
	Route::get('dashboard/getmnoexpiry', 'DashboardController@getMnosContracts');
	Route::get('dashboard/getclientexpiry', 'DashboardController@getClientContracts');
	
	Route::get('/', 'DashboardController@index');

	//Route::get('dashboard', 'MeetingReportsController@showDetails');
	Route::get('dashboard', 'DashboardController@index');
	Route::get('reportdetails/{id}', 'MeetingReportsController@showDetails');

	Route::post('mnos/getCountryNetworks', 'NetworkOperatorsController@getCountryNetworks');
	Route::get('mnos/all', 'NetworkOperatorsController@getMnosJson');
	Route::post('mnos/ip_store', 'NetworkOperatorsController@ipStore');
	Route::post('mnos/finance_store', 'NetworkOperatorsController@financeStore');
	Route::post('mnos/finance_update', 'NetworkOperatorsController@financeUpdate');

	
	Route::get('mnos/get_payment/{id}', 'NetworkOperatorsController@getSinglePayment');
	Route::get('mnos/downloadfile/{id}', 'NetworkOperatorsController@getMnoFile');
	Route::post('mnos/notes_update', 'NetworkOperatorsController@notesUpdate');
	Route::post('mnos/notes_store', 'NetworkOperatorsController@notesStore');
	Route::resource('mnos', 'NetworkOperatorsController');

	Route::resource('services', 'ServicesController');

	Route::get('generaldocuments/list/{category}', 'GeneralDocumentsController@listcategory');
	Route::get('generaldocuments/list/json/{category}', 'GeneralDocumentsController@getDocumentsCategoryJson');

	Route::get('generaldocuments/download/{id}', 'GeneralDocumentsController@getDocument');
	Route::get('generaldocuments/all', 'GeneralDocumentsController@getDocumentsJson');

	Route::resource('generaldocuments', 'GeneralDocumentsController');

	Route::get('smscode/create', 'ShortCodesController@create');
	Route::get('smsshortcodes/all', 'ShortCodesController@getShortCodesJson');
	Route::get('smsshortcodes', 'ShortCodesController@smsindex');

	Route::get('ussdshortcodes/all', 'ShortCodesController@getUssdShortCodesJson');
	Route::get('ussdshortcodes', 'ShortCodesController@ussdindex');

	Route::get('voiceshortcodes/all', 'ShortCodesController@getVoiceShortCodesJson');
	Route::get('voiceshortcodes', 'ShortCodesController@voiceindex');


	Route::get('senderids/downloadsample', 'SenderIdController@getSampleFile');
	Route::get('senderids/uploadreportdownload/{name}', 'SenderIdController@getUploadReport');
	Route::get('senderids/upload', 'SenderIdController@showuploadform');
	Route::post('senderids/uploadstore', 'SenderIdController@uploadstore');
	Route::get('senderids/all', 'SenderIdController@getSenderIdsJson');
	Route::get('senderids/get-mno-list/{directMno}', 'SenderIdController@getMNOList');
	Route::post('senderids/direct_store', 'SenderIdController@direct_store');
	Route::resource('senderids', 'SenderIdController');

	Route::get('staffmembers/profile/{staff_member_id}', 'StaffMembersController@profile');
	Route::get('staffmembers/index', 'StaffMembersController@index');
	Route::get('staffmembers/all', 'StaffMembersController@getstaffMemberssJson');
	Route::resource('staffmembers', 'StaffMembersController');



	Route::get('clients/downloadfile/{id}', 'ClientsController@getClientFile');
	Route::get('clients/onboarding/{id}', 'ClientsController@showOnboardingForm');
	Route::post('clients/shortcode_store', 'ClientsController@shortcodeStore');
	Route::post('clients/notes_update', 'ClientsController@notesUpdate');
	Route::post('clients/notes_store', 'ClientsController@notesStore');
	Route::post('clients/finance_store', 'ClientsController@financeStore');
	Route::post('clients/support_fees_store', 'ClientsController@supportFeesStore');


	Route::post('clients/finance_update', 'ClientsController@financeUpdate');
	Route::post('clients/shortcode_update', 'ClientsController@shortCodeUpdate');

	Route::get('clients/get_payment/{id}', 'ClientsController@getPayment');
	Route::get('clients/get_shortcode/{id}', 'ClientsController@getShortCodeDetails');
	Route::get('clients/get_note/{id}', 'ClientsController@getSingleNote');
	Route::get('clients/create-notes', 'ClientsController@createNotes');
	Route::get('clients/shortcodes/{type}', 'ClientsController@getShortCodes');

	Route::get('clients/readonly/{id}', 'ClientsController@showReadonly');
	
	

	Route::get('inactive-clients', 'ClientsController@indexInactive');
	Route::get('inactive-clients/all', 'ClientsController@getInactiveClientJson');
	Route::post('inactive-clients/raw', 'ClientsController@getInactiveClientJsonRawJs');

	Route::get('clients/all', 'ClientsController@getClientJson');
	Route::post('clients/raw', 'ClientsController@getClientJsonRawJs');
	Route::get('clients/indexrawjs', 'ClientsController@indexRawJs');
	Route::get('clients/indextabulator', 'ClientsController@indexTabulator');
	Route::get('clients/servicesedit/{id}', 'ClientsController@editservice')->name('clients.editservice');
	Route::get('clients/services/{id}', 'ClientsController@showservices')->name('clients.services');
	Route::resource('clients', 'ClientsController');

	Route::get('reports/overview', 'ReportsController@overview');
	Route::get('reports/clientsbyservice/all', 'ReportsController@getClientsByServiceJson');
	Route::get('reports/clientsbyservice', 'ReportsController@getClientsByService');

	Route::get('reports/useractivities', 'ReportsController@getUserActivities');
	Route::get('reports/useractivities/all', 'ReportsController@getUserActivitiesJson');

	Route::get('reports/expiredmnocontracts', 'ReportsController@getMnosContracts');
	Route::get('reports/expiredmnocontracts/all', 'ReportsController@getMnosContractsJson');

	Route::get('reports/expiredclientscontracts', 'ReportsController@getClientContracts');
	Route::get('reports/expiredclientscontracts/all', 'ReportsController@getClientContractsJson');

	
	

	Route::get('reports/recentclients', 'ReportsController@getRecentClients');
	Route::get('reports/recentclients/all', 'ReportsController@getRecentClientsJson');
	Route::get('reports/search', 'MeetingReportsController@search');
	Route::post('reports/samcomment', 'MeetingReportsController@store_sam_comment');
	Route::resource('reports', 'MeetingReportsController');

	Route::resource('systemusers', 'SystemUsersController');

	Route::get('infrastructure/createdirect/{id}', 'ClickInfrastructureController@create_direct');
	Route::get('infrastructure/editdirect/{id}', 'ClickInfrastructureController@edit_direct');

	Route::post('infrastructure/storedirect', 'ClickInfrastructureController@store_direct');
	Route::post('infrastructure/updatedirect', 'ClickInfrastructureController@update_direct');

	Route::get('infrastructure/revealpassword/{id}', 'ClickInfrastructureController@reveal_password');
	Route::post('infrastructure/updateserver', 'ClickInfrastructureController@updateserver');

	Route::post('infrastructure/storeserver', 'ClickInfrastructureController@storeserver');
	Route::get('infrastructure/all', 'ClickInfrastructureController@getServerListJson');

	Route::get('infrastructure/create', 'ClickInfrastructureController@create');

	Route::post('infrastructure/vpn/raw', 'VpnController@getVpnListJsonRawJs');
	Route::get('infrastructure/vpn/get_phases/{id}', 'VpnController@getPhaseOneTwo');
	Route::get('infrastructure/vpn/edit/{id}', 'VpnController@edit');
	Route::get('infrastructure/vpn', 'VpnController@index');
	Route::get('infrastructure/vpn-create', 'VpnController@create');
	Route::post('infrastructure/storevpn', 'VpnController@store');
	Route::get('infrastructure/get-vpn-partner-list/{type}', 'VpnController@getMNOandClient');
	Route::get('infrastructure/server-list', 'ClickInfrastructureController@server_list');
	Route::get('infrastructure/editserver-list/{id}', 'ClickInfrastructureController@edit_server');


	Route::get('officelocations/download/{id}', 'OfficeLocationsController@getDocument');
	Route::post('officelocations/filesupdate', 'OfficeLocationsController@filesUpdate');
	Route::post('officelocations/filestore', 'OfficeLocationsController@fileStore');
	Route::get('officelocations/createfiles/{id}', 'OfficeLocationsController@createfiles');
	Route::get('officelocations/allfiles', 'OfficeLocationsController@getBranchFilesJson');
	Route::get('officelocations/editfile/{id}', 'OfficeLocationsController@show_edit_files_form');
	Route::get('officelocations/showfiles/{id}', 'OfficeLocationsController@showfiles');

	Route::resource('officelocations', 'OfficeLocationsController');

	Route::get('infrastructure/domains', 'ClickInfrastructureController@domains');
	Route::get('infrastructure/servers', 'ClickInfrastructureController@servers');

	Route::get('infrastructure/create', 'ClickInfrastructureController@create');

	Route::resource('ussdclients', 'UssdClientsPaymentsController');

	Route::get('clickapps/shortcodes', 'ClickAppsController@getShortCodes');

	Route::resource('clickapps', 'ClickAppsController');

	Route::get('clientpaymentreports/all', 'ClientPaymentReportsController@getClientPaymentsJson');
	Route::get('clientpaymentreports', 'ClientPaymentReportsController@index');

	Route::get('mnopaymentreports/all', 'MnoPaymentsController@getMnoPaymentsJson');
	Route::get('mnopaymentreports', 'MnoPaymentsController@index');



	Route::resource('marketreport', 'MarketerReportController');

	Route::get('finance', 'Finance\DashboardController@index');

	Route::get('systemcreds/all', 'SystemCredentialsController@getCredListJson');
	Route::resource('systemcreds', 'SystemCredentialsController')->except(['destroy']);

});
