<?php
Route::get('/', function () {
    return redirect('/homepage');
});


Route::get('/homepage', 'App\Http\Controllers\UsersOutController@homepage');
Route::get('/aboutus', 'App\Http\Controllers\UsersOutController@aboutus');
Route::get('/vision-mission', 'App\Http\Controllers\UsersOutController@visionMission');
Route::get('/whychooseus', 'App\Http\Controllers\UsersOutController@whychooseus');
Route::get('/services', 'App\Http\Controllers\UsersOutController@services');
Route::get('/track-order', 'App\Http\Controllers\UsersOutController@track_order');
Route::post('/track-order', 'App\Http\Controllers\UsersOutController@track_order');
Route::get('/company', 'App\Http\Controllers\UsersOutController@company');
Route::get('/product', 'App\Http\Controllers\UsersOutController@product');
Route::get('/guidelines', 'App\Http\Controllers\UsersOutController@guidelines');
Route::get('/documents-required', 'App\Http\Controllers\UsersOutController@documents_required');
Route::get('/subsidy-scheme', 'App\Http\Controllers\UsersOutController@subsidy_scheme');
Route::get('/contactus', 'App\Http\Controllers\UsersOutController@contactus');
Route::get('/realestate', 'App\Http\Controllers\UsersOutController@realestate');
Route::post('/contactus_form', 'App\Http\Controllers\UsersOutController@contactus_form');
Route::post('/grievance_form', 'App\Http\Controllers\UsersOutController@grievance_form');
Route::post('get-cities-by-state','App\Http\Controllers\UsersOutController@getCity');
Route::get('/f/gallery', 'App\Http\Controllers\UsersOutController@galleryFront')->name('gallery.frontpage');
Route::get('/f/gallery/image', 'App\Http\Controllers\UsersOutController@galleryImgFront')->name('gallery.image.frontpage');

//Route::get('users/cleardb', 'App\Http\Controllers\UsersOutController@cleardb');

// Authentication Routes...
Auth::routes([]);
Route::post('logout', 'App\Http\Controllers\Auth\LoginController@logout')->name('auth.logout');

Route::group(['middleware' => 'auth'], function () {
    Route::get('/home', 'App\Http\Controllers\HomeController@index');
    Route::get('/businessdashboard', 'App\Http\Controllers\HomeController@businessDashboard');
    ///Leads
    Route::get('/addLead', 'App\Http\Controllers\LeadController@index');
    Route::post('/doAddLead', 'App\Http\Controllers\LeadController@doAddLead');

    Route::get('/editLead/{id}', 'App\Http\Controllers\LeadController@editLead');
    Route::post('/doEditLead/{id}', 'App\Http\Controllers\LeadController@doEditLead');
    Route::get('/deleteLead/{id}', 'App\Http\Controllers\LeadController@deleteLead');

    Route::get('/bookMySolar', 'App\Http\Controllers\LeadController@bookMySolar');
    Route::post('/doBookMySolar', 'App\Http\Controllers\LeadController@doBookMySolar');

    Route::get('/myLeadsList/{type}', 'App\Http\Controllers\LeadController@myLeadsList');
    Route::get('/myLeadsListAnyData/{type}', 'App\Http\Controllers\LeadController@myLeadsListAnyData');
    

    //Route::post('roles_mass_destroy', ['uses' => 'App\Http\Controllers\RolesController@massDestroy', 'as' => 'roles.mass_destroy']);
    Route::get('users/downlines', 'App\Http\Controllers\UsersController@getDownlines');
    Route::get('users/getDownlinesAnyData', 'App\Http\Controllers\UsersController@getDownlinesAnyData');
    Route::get('users/direct', 'App\Http\Controllers\UsersController@getDirect');
    Route::get('users/getDirectAnyData', 'App\Http\Controllers\UsersController@getDirectAnyData');
    
    //BILL UPLOAD
    //Route::get('users/billSentReport', 'App\Http\Controllers\UsersController@billSentReport');
    Route::get('users/billSentReportOnly', 'App\Http\Controllers\UsersController@billSentReportOnly');
    Route::get('users/billSentReport/{type}', 'App\Http\Controllers\UsersController@billSentReport');
    Route::get('users/billSentReportAnyData', 'App\Http\Controllers\UsersController@billSentReportAnyData');
    //Route::post('users/upload_bill', ['uses' => 'App\Http\Controllers\UsersController@upload_bill']);

    Route::get('users/billSentReportSolar', 'App\Http\Controllers\UsersController@billSentReportSolar');
    Route::get('users/billSentReportSolarAnyData', 'App\Http\Controllers\UsersController@billSentReportSolarAnyData');


    //Profile
    Route::get('profile', 'App\Http\Controllers\ProfileController@index');
    Route::get('profileEdit', 'App\Http\Controllers\ProfileController@edit');
    Route::get('/pwd/edit', 'App\Http\Controllers\ProfileController@editPwd');
    Route::get('/trxpwd/edit', 'App\Http\Controllers\ProfileController@editTrxPwd');
    Route::put('profile', 'App\Http\Controllers\ProfileController@update');
    Route::resource('user_actions', 'App\Http\Controllers\UserActionsController');
    //Route::resource('settings', 'SettingsController');
    //Incomes
    Route::get('incomes/viewall', ['uses' => 'App\Http\Controllers\IncomesController@viewAll']);
    Route::get('incomes/viewAllAnyData', ['uses' => 'App\Http\Controllers\IncomesController@viewAllAnyData']);
    Route::get('incomes/solrefwallet', ['uses' => 'App\Http\Controllers\IncomesController@solrefwallet']);
    Route::get('incomes/solrefwalletAnyData', ['uses' => 'App\Http\Controllers\IncomesController@solrefwalletAnyData']);



});


Route::group(['prefix'=>'admin', 'middleware' => 'auth'], function () {
    Route::get('/home', 'App\Http\Controllers\HomeController@index');
    //Request & Complaints
    Route::get('users/urequests', 'App\Http\Controllers\admin\UsersController@urequests');
    Route::get('users/getUrequest', 'App\Http\Controllers\admin\UsersController@getUrequest');
    Route::get('users/urequestsreply/{id}', 'App\Http\Controllers\admin\UsersController@urequestsreply');
    Route::post('users/sendUreqreply', 'App\Http\Controllers\admin\UsersController@sendUreqreply');
    Route::get('users/complaints', 'App\Http\Controllers\admin\UsersController@complaints');
    Route::get('users/getComplaint', 'App\Http\Controllers\admin\UsersController@getComplaint');
    Route::get('users/complaintsreply/{id}', 'App\Http\Controllers\admin\UsersController@complaintsreply');
    Route::post('users/sendcomplaintreply', 'App\Http\Controllers\admin\UsersController@sendcomplaintreply');

    //Leads
    Route::get('leadsList/{type}', 'App\Http\Controllers\admin\AdminToolsController@leadsList');
    Route::get('leadsListAnyData/{type}', 'App\Http\Controllers\admin\AdminToolsController@leadsListAnyData');
    Route::get('updateLeadStatus/{id}', 'App\Http\Controllers\admin\AdminToolsController@updateLeadStatus');
    Route::post('doUpdateLeadStatus/{id}', 'App\Http\Controllers\admin\AdminToolsController@doUpdateLeadStatus');
    Route::get('viewLeadStatus/{id}', 'App\Http\Controllers\admin\AdminToolsController@viewLeadStatus');

    Route::get('/siteVisits', 'App\Http\Controllers\admin\AdminToolsController@siteVisits');
    Route::get('/siteVisitsAnyData', 'App\Http\Controllers\admin\AdminToolsController@siteVisitsAnyData');


    //Approve Bills
    Route::get('users/activationRcvd', 'App\Http\Controllers\admin\UsersController@donationRcvd');
    Route::get('users/donationRcvdAnyData', 'App\Http\Controllers\admin\UsersController@donationRcvdAnyData');
    Route::get('users/donationRcvdAuto', 'App\Http\Controllers\admin\UsersController@donationRcvdAuto');
    Route::get('users/donationAutoRcvdAnyData', 'App\Http\Controllers\admin\UsersController@donationAutoRcvdAnyData');
    Route::get('users/approveBill/{id}', 'App\Http\Controllers\admin\UsersController@approveBill');
    Route::post('users/doProcessBills/{id}', 'App\Http\Controllers\admin\UsersController@doProcessBills');
    Route::get('user/addEvFranchise/{id}', 'App\Http\Controllers\admin\UsersController@addEvFranchise');    
    Route::post('user/doAddEvFranchise/{id}', 'App\Http\Controllers\admin\UsersController@doAddEvFranchise');
    Route::get('user/removeEvFranchise/{id}', 'App\Http\Controllers\admin\UsersController@removeEvFranchise');
    Route::get('user/billSentPaymentAnyData/{id}', 'App\Http\Controllers\admin\UsersController@billSentPaymentAnyData');



    Route::get('addnews', 'App\Http\Controllers\admin\AdminToolsController@addnews');
    Route::post('addnews', 'App\Http\Controllers\admin\AdminToolsController@addnews_create');
    Route::put('addnews/{id}', 'App\Http\Controllers\admin\AdminToolsController@addnews_update');
    Route::get('addnews/{id}', 'App\Http\Controllers\admin\AdminToolsController@addnews_update');
    Route::get('deletenews/{id}', ['uses' => 'App\Http\Controllers\admin\AdminToolsController@news_delete', 'as' => 'admin.news.destroy']);
    
    Route::get('addgallery', 'App\Http\Controllers\admin\AdminToolsController@addgallery');
    Route::post('addgallery', 'App\Http\Controllers\admin\AdminToolsController@addgallery_create');
    Route::put('addgallery/{id}', 'App\Http\Controllers\admin\AdminToolsController@addgallery_update');
    Route::get('addgallery/{id}', 'App\Http\Controllers\admin\AdminToolsController@addgallery_update');
    Route::get('deletegallery/{id}', ['uses' => 'App\Http\Controllers\admin\AdminToolsController@gallery_delete', 'as' => 'admin.gallery.destroy']);

    Route::get('addgalleryimg', 'App\Http\Controllers\admin\AdminToolsController@addgalleryImg');
    Route::post('addgalleryimg', 'App\Http\Controllers\admin\AdminToolsController@addgalleryImg_create');
    Route::put('addgalleryimg/{id}', 'App\Http\Controllers\admin\AdminToolsController@addgalleryImg_update');
    Route::get('addgalleryimg/{id}', 'App\Http\Controllers\admin\AdminToolsController@addgalleryImg_update');
    Route::get('deletegalleryimg/{id}', ['uses' => 'App\Http\Controllers\admin\AdminToolsController@galleryImg_delete', 'as' => 'admin.galleryImg.destroy']);




});
Route::get('/clear-cache', function () {
   Artisan::call('cache:clear');
   Artisan::call('config:clear');
   Artisan::call('route:clear');

   return "Cache cleared successfully";
});

