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

Route::get('/', function () {
    return view('index');
});

Route::get('/convert-password/{action}/', ['uses' => 'Auth\AdminController@encryptPassword']);
Route::get('/store-claim/pdf', ['uses' => 'DS\DealerController@exportDealerJson']);
Route::get('/convert-total-claim-float', ['uses' => 'DS\DealerController@update_total_claim']);

Route::get('/login/dashboard/staff', 'Auth\StaffLoginController@showFormStaff');
Route::post('/login-dashboard-staff', 'Auth\StaffLoginController@requestLoginStaff');
Route::get('/dashboard/logout/staff', 'Auth\StaffLoginController@requestlogout');

Route::post('password/post_expired', 'Auth\AdminController@postExpired')->name('password.post_expired');


Route::get('/login/dashboard/admin', 'Auth\AdminController@showFormAdmin');
Route::post('/login-dashboard-admin', 'Auth\AdminController@requestLoginAdmin');
Route::get('/dashboard/logout/admin', 'Auth\AdminController@requestlogout');

Route::get('/test/email/{subscriber_id}', 'Form\ResidentialController@sendInvoice1');
Route::get('/resend-email/{subscriber_id}', 'Form\ResidentialController@resendEmail');

Route::get('/store/dealer/claim', 'DS\DealerClaimController@getDealerCompany');
Route::get('/store/dealer/claim2', 'DS\DealerClaimController@getDealerCompany2');
Route::get('/get/dealer/claim/special', 'DS\DealerClaimController@updateIncentives');

// Application Form Residential
Route::get('/residential/{package}/application-form/address', 'Form\ResidentialController@viewFormAddress')->name('residential');
Route::post('/residential/{package}/application-form/information', 'Form\ResidentialController@viewFormApplication')->name('application');
Route::post('/residential/{package}/application-form/service_package', 'Form\ResidentialController@viewFormPackage')->name('package');
Route::post('/residential/{package}/application-form/upload_preview', 'Form\ResidentialController@viewFormPreview')->name('preview');
Route::post('/residential/application-form/store', 'Form\ResidentialController@storeFormData')->name('storeFormR');

Route::get('/residential/{package}/application-form/address/{dealer_id}', 'Form\ResidentialController@viewFormAddressD')->name('dresidential');
Route::post('/residential/{package}/application-form/information/{dealer_id}', 'Form\ResidentialController@viewFormApplicationD')->name('dapplication');
Route::post('/residential/{package}/application-form/service_package/{dealer_id}', 'Form\ResidentialController@viewFormPackageD')->name('dpackage');
Route::post('/residential/{package}/application-form/upload_preview/{dealer_id}', 'Form\ResidentialController@viewFormPreviewD')->name('dpreview');
Route::post('/residential/application-form/store/{dealer_id}', 'Form\ResidentialController@storeFormDataD')->name('dstoreFormRD');

Route::get('/check-template-email/{subscriber_id}','Form\ResidentialController@checkEmailTemplate');
Route::get('/check-template-emailB/{subscriber_id}','Form\BusinessController@checkEmailTemplate');

Route::get('/application-form/verify-email/{subscriber_id}', 'Form\ResidentialController@verifyEmail');
Route::get('/residential/application-form/success-submit', 'Form\ResidentialController@successSubmit');
Route::get('/business/application-form/success-submit', 'Form\BusinessController@successSubmit');
Route::get('/residential/application-form/success-verified', 'Form\ResidentialController@successVerified');
Route::get('/business/application-form/success-verified', 'Form\BusinessController@successVerified');

// Application Form Business
Route::get('/business/{package}/application-form/address', 'Form\BusinessController@viewFormAddress')->name('businessForm');
Route::post('/business/{package}/application-form/information', 'Form\BusinessController@viewFormApplication')->name('applicationB');
Route::post('/business/{package}/application-form/service_package', 'Form\BusinessController@viewFormPackage')->name('packageB');
Route::post('/business/{package}/application-form/upload_preview', 'Form\BusinessController@viewFormPreview')->name('previewB');
Route::post('/business/application-form/store', 'Form\BusinessController@storeFormData')->name('storeFormB');

Route::get('/business/{package}/application-form/address/{dealer_id}', 'Form\BusinessController@viewFormAddressD')->name('businessFormBD');
Route::post('/business/{package}/application-form/information/{dealer_id}', 'Form\BusinessController@viewFormApplicationD')->name('applicationBD');
Route::post('/business/{package}/application-form/service_package/{dealer_id}', 'Form\BusinessController@viewFormPackageD')->name('packageBD');
Route::post('/business/{package}/application-form/upload_preview/{dealer_id}', 'Form\BusinessController@viewFormPreviewD')->name('previewBD');
Route::post('/business/application-form/store/{dealer_id}', 'Form\BusinessController@storeFormDataD')->name('storeFormBD');

/***
/* Customer Service
***/
Route::group(['middleware' => 'csAuth'], function () {

	Route::get('/customer-service', ['uses' => 'CustomerService\CalendarController@index', 'as' => 'csHome']);
	Route::post('/customer-service/get-all-calendar', ['uses' => 'CustomerService\CalendarController@getAllCalendar', 'as' => 'gALLCalendar']);
	Route::post('/customer-service/get-company-color', ['uses' => 'CustomerService\CalendarController@getCompanyColor', 'as' => 'gCompanyColor']);

	Route::get('/customer-service/new/customer/list', ['uses' => 'CustomerService\CustomerController@viewCustomer', 'as' => 'gALLNewCustomer']);
	Route::get('/customer-service/get-all-new-customer/{type}/{building}/{dealer}', ['uses' => 'CustomerService\CustomerController@getAllNewCustomer', 'as' => 'filterCustomer']);
	Route::get('/customer-service/get-all-new-customerss/{type}/{building}/{dealer}', ['uses' => 'CustomerService\CustomerController@getAllNewCustomerss', 'as' => 'filterCustomerss']);
	Route::post('/customer-service/delete-new-customer', ['uses' => 'CustomerService\CustomerController@deleteFormCustomer', 'as' => 'deleteNewCustomer']);
	Route::get('/customer-service/edit/customer/{subscriber_id}', ['uses' => 'CustomerService\CustomerController@editSubscriber', 'as' => 'editCustomerDetail']);
	Route::post('/customer-service/update-customer-detail', ['uses' => 'CustomerService\CustomerController@updateCustomerDetail', 'as' => 'updateCustomerDetail']);

	// All PDF //
	Route::get('/customer-service/customer/pdf/{s_id}', ['uses' => 'CustomerService\CustomerController@redirectPDF', 'as' => 'reCustomerRPDF']);
	Route::get('/customer-service/residential/generate-pdf/{subscriber_id}', ['uses' => 'CustomerService\CustomerController@generateRPDF', 'as' => 'vCustomerRPDF']);
	Route::get('/customer-service/business/generate-pdf/{subscriber_id}', ['uses' => 'CustomerService\CustomerController@generateBPDF', 'as' => 'vCustomerBPDF']);
	Route::get('/customer-service/work-order/generate-pdf/{wo}', ['uses' => 'CustomerService\WorkOrderController@generateWorkOrderPDF', 'as' => 'vWorkOrderPDF']);
	Route::get('/customer-service/docket/generate-pdf/{do}', ['uses' => 'CustomerService\DocketController@generateDocketPDF', 'as' => 'vDocketPDF']);

	Route::get('/customer-service/subscriber/list', ['uses' => 'CustomerService\CustomerController@viewSubscriber', 'as' => 'vAllSubcribers']);
	Route::get('/customer-service/get-all-rectification/{type}/{building}/{dealer}', ['uses' => 'CustomerService\CustomerController@getAllRectification', 'as' => 'gRectification']);
	Route::get('/customer-service/get-all-residential/{type}/{building}/{dealer}', ['uses' => 'CustomerService\CustomerController@getAllResidential', 'as' => 'gResidential']);
	Route::get('/customer-service/get-all-business/{type}/{building}/{dealer}', ['uses' => 'CustomerService\CustomerController@getAllBusiness', 'as' => 'gBusiness']);

	Route::get('/customer-service/work-order/list', ['uses' => 'CustomerService\WorkOrderController@viewWorkOrder', 'as' => 'vWorkOrder']);
	Route::get('/customer-service/get-all-pending-contractor/{year}/{month}/{day}', ['uses' => 'CustomerService\WorkOrderController@getAllPendingContractor', 'as' => 'gPCWorkOrder']);
	Route::get('/customer-service/get-all-pending-non/{year}/{month}/{day}', ['uses' => 'CustomerService\WorkOrderController@getAllPendingNonPrelaid', 'as' => 'gPNWorkOrder']);
	Route::get('/customer-service/get-all-success-non/{year}/{month}/{day}', ['uses' => 'CustomerService\WorkOrderController@getAllSuccessNonPrelaid', 'as' => 'gSNWorkOrder']);
	Route::get('/customer-service/get-all-pending-installer/{year}/{month}/{day}', ['uses' => 'CustomerService\WorkOrderController@getAllPendingInstaller', 'as' => 'gPIWorkOrder']);
	Route::get('/customer-service/get-all-reschedule/{year}/{month}/{day}', ['uses' => 'CustomerService\WorkOrderController@getAllReschedule', 'as' => 'gReWorkOrder']);
	Route::get('/customer-service/get-all-suspend/{year}/{month}/{day}', ['uses' => 'CustomerService\WorkOrderController@getAllSuspend', 'as' => 'gSusWorkOrder']);
	Route::get('/customer-service/get-all-completed/{year}/{month}/{day}', ['uses' => 'CustomerService\WorkOrderController@getAllCompleted', 'as' => 'gComWorkOrder']);
	Route::get('/customer-service/get-all-cancelled/{year}/{month}/{day}', ['uses' => 'CustomerService\WorkOrderController@getAllCancelled', 'as' => 'gCannWorkOrder']);

	Route::get('/customer-service/work-order/edit/{wo}', ['uses' => 'CustomerService\WorkOrderController@viewEditWorkOrder','as' => 'viewCustomerWoFormR']);
	Route::post('/customer-service/update-work-order-detail', ['uses' => 'CustomerService\WorkOrderController@updateWorkOrder', 'as' => 'updateWorkOrderDetail']);
	Route::get('/customer-service/work-order/add/schedule/{status}/{wo}/{subscriber_id}', ['uses' => 'CustomerService\WorkOrderController@viewAddNewSchedule', 'as' => 'vWorkOrderSchedule']);
	Route::get('/customer-service/work-order/reschedule/{wo}', ['uses' => 'CustomerService\WorkOrderController@viewRescheduleCalendar', 'as' => 'vWorkOrderReschedule']);
	Route::post('/customer-service/work-order/reschedule', ['uses' => 'CustomerService\WorkOrderController@rescheduleWorkOrder', 'as' => 'rescheduleWorkOrder']);
	Route::post('/customer-service/work-order/add-schedule', ['uses' => 'CustomerService\WorkOrderController@addSchedule', 'as' => 'addWorkOrderSchedule']);
	Route::post('/customer-service/work-order/remove-schedule', ['uses' => 'CustomerService\WorkOrderController@cancelCreateWorkOrder', 'as' => 'removeWorkOrderSchedule']);
	Route::post('/customer-service/work-order/confirm/schedule', ['uses' => 'CustomerService\WorkOrderController@checkExistingWorkOrder', 'as' => 'confirmSchedule']);
	Route::get('/customer-service/work-order/confirm/{wo}', ['uses' => 'CustomerService\WorkOrderController@confirmWorkOrder', 'as' => 'confirmWorkOrderSchedule']);
	Route::post('/customer-service/work-order/update/reschedule', ['uses' => 'CustomerService\WorkOrderController@updateWorkOrderReschedule', 'as' => 'confirmWorkOrderReschedule']);
	Route::post('/customer-service/delete-work-order', ['uses' => 'CustomerService\WorkOrderController@deleteWorkOrder', 'as' => 'deleteWorkOrder']);

	Route::get('/customer-service/docket/list', ['uses' => 'CustomerService\DocketController@viewDocket', 'as' => 'vDocket']);
	Route::get('/customer-service/get-all-docket/{year}/{month}/{day}', ['uses' => 'CustomerService\DocketController@getCustomerDocket', 'as' => 'gDocket']);
	Route::get('/customer-service/docket/filter/{year}/{month}', ['uses' => 'CustomerService\DocketController@filterCustomerDocket','as' => 'filterCustomerDocket']);

	Route::get('/customer-service/team/contractor/list', ['uses' => 'CustomerService\TeamController@viewCustomerTeam', 'as' => 'viewCustomerTeam']);
	Route::get('/customer-service/team/get-contractor-list', ['uses' => 'CustomerService\TeamController@getCustomerContractor', 'as' => 'getCustomerContractor']);
	Route::get('/customer-service/team/contractor/add', ['uses' => 'CustomerService\TeamController@viewCustomerContractorForm', 'as' => 'viewCustomerContractorForm']);
	Route::post('/customer-service/team/add-contractor', ['uses' => 'CustomerService\TeamController@requestAddContractor', 'as' => 'addContractor']);
	Route::get('/customer-service/team/contractor/edit/{contractor}', ['uses' => 'CustomerService\TeamController@editContractor', 'as' => 'viewEditContractor']);
	Route::post('/customer-service/team/edit-contractor', ['uses' => 'CustomerService\TeamController@requestEditContractor', 'as' => 'editContractor']);
	Route::post('/customer-service/team/delete-contractor',  ['uses' => 'CustomerService\TeamController@requestDeleteContractor', 'as' => 'deleteContractor']);

	Route::get('/customer-service/coverage/residential',  ['uses' => 'CustomerService\CoverageController@viewCoverageR', 'as' => 'viewCoverageR']);
	Route::get('/customer-service/coverage/business',  ['uses' => 'CustomerService\CoverageController@viewCoverageB', 'as' => 'viewCoverageR']);
	Route::get('/customer-service/coverage/get-coverage-listR', ['uses' => 'CustomerService\CoverageController@getCoverageR', 'as' => 'getCoverageR']);
	Route::get('/customer-service/coverage/get-coverage-listB', ['uses' => 'CustomerService\CoverageController@getCoverageB', 'as' => 'getCoverageB']);
	Route::get('/customer-service/coverage/add/new', ['uses' => 'CustomerService\CoverageController@viewCoverageForm','as' => 'viewCoverageForm']);
	Route::post('/customer-service/coverage/add-coverage',  ['uses' => 'CustomerService\CoverageController@addCoverage','as' => 'addCoverage']);
	Route::get('/customer-service/coverage/business/edit/{id}', ['uses' => 'CustomerService\CoverageController@editCoverage','as' => 'editCoverageB']);
	Route::get('/customer-service/coverage/residential/edit/{id}', ['uses' => 'CustomerService\CoverageController@editCoverage','as' => 'editCoverageR']);
	Route::post('/customer-service/coverage/update-coverage', ['uses' => 'CustomerService\CoverageController@updateCoverage','as' => 'updateCoverage']);
	Route::post('/customer-service/coverage/delete-coverage', ['uses' => 'CustomerService\CoverageController@deleteCoverage', 'as' => 'deleteCoverage']);

	Route::get('/customer-service/team/vendor/list', ['uses' => 'CustomerService\TeamController@viewCustomerVendor', 'as' => 'viewCustomerVendor']);
	Route::get('/customer-service/team/get-vendor-list', ['uses' => 'CustomerService\TeamController@getCustomerVendor', 'as' => 'getCustomerVendor']);
	Route::get('/customer-service/team/vendor/add',  ['uses' => 'CustomerService\TeamController@viewCustomerVendorForm', 'as' => 'viewCustomerVendorForm']);
	Route::post('/customer-service/team/add-vendor',  ['uses' => 'CustomerService\TeamController@requesAddVendor', 'as' => 'addVendor']);
	Route::get('/customer-service/team/vendor/edit/{vendor}',  ['uses' => 'CustomerService\TeamController@editVendor', 'as' => 'viewEditVendor']);
	Route::post('/customer-service/team/edit-vendor',  ['uses' => 'CustomerService\TeamController@requesEditVendor', 'as' => 'editVendor']);
	Route::post('/customer-service/team/delete-vendor',  ['uses' => 'CustomerService\TeamController@requestDeleteVendor', 'as' => 'deleteVendor']);

	Route::get('/customer-service/residential/create/work-order',  ['uses' => 'CustomerService\WorkOrderController@viewCreateWorkOrderR', 'as' => 'createWorkOrderR']);
	Route::get('/customer-service/business/create/work-order',  ['uses' => 'CustomerService\WorkOrderController@viewCreateWorkOrderB', 'as' => 'createWorkOrderB']);
	Route::post('/customer-service/business/create-rectification',  ['uses' => 'CustomerService\WorkOrderController@createRectification', 'as' => 'createRectification']);
	Route::post('/customer-service/submit-form-secured-developement',  ['uses' => 'CustomerService\WorkOrderController@createSecuredDevelopement', 'as' => 'createSecuredDevelopement']);

	Route::get('/customer-service/update-email-status/{f_id}',  ['uses' => 'Form\FormController@updateStatus', 'as' => 'updateEmailStatusCS']);
	Route::get('/customer-service/profile',  ['uses' => 'CustomerService\ProfileController@viewProfile', 'as' => 'csProfile']);
	Route::post('/customer-service/update-profile-picture',  ['uses' => 'CustomerService\ProfileController@updateProfilePicture', 'as' => 'csProfileImg']);
	
	Route::get('/CustomerService/customer/get-customer-list', 'DS\CustomerService\CustomerController@getCustomerList')->name('getCustomerList');

	Route::get('/CustomerService/wo/get-wo-list', 'DS\CustomerService\CustomerController@getCustomerWo')->name('getCustomerWo');
	Route::get('/CustomerService/wo/country-json', 'DS\CustomerService\CustomerController@getCountry')->name('getCountry');
	Route::get('/CustomerService/wo/building-json', 'DS\CustomerService\CustomerController@getBuilding')->name('getBuilding');
	Route::get('/CustomerService/wo/filter/{year}/{month}/{status}', 'DS\CustomerService\CustomerController@filterCustomerWo')->name('filterCustomerWo');
	Route::post('/CustomerService/wo/delete-wo', 'DS\CustomerService\CustomerController@deleteCustomerWo')->name('deleteCustomerWo');

	Route::get('/customer-service/get-data-claim','Api\ClaimedController@get_data_claim');
	Route::get('/customer-service/get-data-form','Api\FormController@get_data_form');
});

/** Access Authorized (Contractor) **/
Route::group(['middleware' => 'contractorAuth'], function() {

	Route::get('/contractor', ['uses' => 'Contractor\CalendarController@viewContractorDashboard','as'=>'conHome']);
	Route::post('/contractor/get-all-calendar', ['uses' => 'Contractor\CalendarController@getAllCalendar', 'as' => 'gALLCalendar']);

	Route::get('/contractor/work-order/list', ['uses' => 'Contractor\WorkOrderController@viewContractorWork','as'=>'vContractorWork']);
	Route::get('/contractor/get-all-pending-contractor/{year}/{month}/{day}', ['uses' => 'Contractor\WorkOrderController@getAllPendingContractor', 'as' => 'gPCWorkOrder']);
	Route::get('/contractor/get-all-pending-non/{year}/{month}/{day}', ['uses' => 'Contractor\WorkOrderController@getAllPendingNonPrelaid', 'as' => 'gPNWorkOrder']);
	Route::get('/contractor/get-all-pending-installer/{year}/{month}/{day}', ['uses' => 'Contractor\WorkOrderController@getAllPendingInstaller', 'as' => 'gPIWorkOrder']);
	Route::get('/contractor/get-all-completed/{year}/{month}/{day}', ['uses' => 'Contractor\WorkOrderController@getAllCompleted', 'as' => 'gComWorkOrder']);

	Route::get('/contractor/work-order/edit/{wo}', ['uses' => 'Contractor\WorkOrderController@editContractorWork','as' => 'editContractorWork']);

	// Web API
	Route::get('/contractor/wo/filter/{year}/{month}/{status}', ['uses' => 'Contractor\ContractorController@filterContractorWork','as'=>'filterContractorWork']);
	Route::get('/contractor/work-order/generate-pdf/{wo}', ['uses' => 'Contractor\WorkOrderController@generateWorkOrderPDF', 'as' => 'vWorkOrderPDF']);
	Route::post('/contractor/update-work-order-detail', ['uses' => 'Contractor\WorkOrderController@updateWorkOrder', 'as' => 'updateWorkOrderDetailC']);
	Route::post('/contractor/update-customer-detail', ['uses' => 'Contractor\WorkOrderController@updateCustomerDetail', 'as' => 'updateCustomerDetailC']);

	Route::get('/contractor/work-order/reschedule/{wo}', ['uses' => 'Contractor\WorkOrderController@viewRescheduleCalendar', 'as' => 'vWorkOrderRescheduleC']);
	Route::post('/contractor/work-order/reschedule', ['uses' => 'Contractor\WorkOrderController@rescheduleWorkOrder', 'as' => 'rescheduleWorkOrderC']);
	Route::post('/contractor/work-order/update/reschedule', ['uses' => 'Contractor\WorkOrderController@updateWorkOrderReschedule', 'as' => 'confirmWorkOrderRescheduleC']);
	Route::get('/contractor/update-status-work-order/{wo}', ['uses' => 'Contractor\WorkOrderController@updateStatusWorkOrder', 'as' => 'updateStatusWorkOrderC']);

	Route::get('/contractor/docket/list', ['uses' => 'Contractor\DocketController@viewContractorDocket','as'=>'vContractorDocket']);
	Route::get('/contractor/docket/generate-pdf/{do}', ['uses' => 'Contractor\DocketController@generateDocketPDF', 'as' => 'vcDocketPDF']);
	// Web API
	Route::get('/contractor/docket/get-docket-list/{year}/{month}/{day}', ['uses' => 'Contractor\DocketController@getContractorDocket','as'=>'getContractorDocket']);
	Route::get('/contractor/docket/filter/{year}/{month}', ['uses' => 'Contractor\ContractorController@filterContractorDocket','as'=>'filterContractorDocket']);

	Route::get('/contractor/team/list', ['uses' => 'Contractor\ContractorController@viewContractorTeam','as'=>'vContractorTeam']);
	Route::get('/contractor/team/edit/{i_id}', ['uses' => 'Contractor\ContractorController@viewEditContractorTeam','as'=>'vEditContractorTeam']);
	// Web API
	Route::get('/contractor/team/get-team-list', ['uses' => 'Contractor\ContractorController@getContractorTeam','as'=>'getContractorTeam']);
	Route::get('/contractor/team/add-new-installer', ['uses' => 'Contractor\ContractorController@addContractorTeam','as'=>'addInstaller']);
	Route::post('/contractor/team/request-add-team', ['uses' => 'Contractor\ContractorController@requestAddContractorTeam','as'=>'requestAddContractorTeam']);
	Route::post('/contractor/team/delete-installer', ['uses' => 'Contractor\ContractorController@deleteInstaller','as'=>'deleteInstaller']);
	Route::post('/contractor/team/request-edit-installer', ['uses' => 'Contractor\ContractorController@requestEditInstaller','as'=>'requestEditInstallerTeam']);
});

Route::get('/dbOld/convert-laravel', ['uses' => 'DS\TestController@convertStaffDb']);

/** Access Auhtorized (Marketing - Admin) **/
Route::group(['middleware' => 'marketAuth'], function () 
{
	//All route related to Dashboard
	Route::get('/marketing', ['uses' => 'DS\MarketingController@dashboard', 'as' => 'dashboard']);

	//All route related to Company(Dealer)
	Route::get('/marketing/dealer', ['uses' => 'DS\MarketingController@index', 'as' => 'mHome']);
	Route::get('/marketing/get-dealer-list', ['uses' => 'DS\MarketingController@marketindex', 'as' => 'dealerlist']);
	Route::get('/marketing/dealer/add', ['uses' => 'DS\MarketingController@showDealerForm', 'as' => 'addDealerForm']);
	Route::post('/marketing/dealer/add-new-company', ['uses' => 'DS\MarketingController@requestAddCompany', 'as' => 'addCompany']);
	Route::post('/marketing/dealer/delete-company', ['uses' => 'DS\MarketingController@deleteCompany', 'as' => 'deleteCompany']);
	Route::get('/marketing/dealer/edit/{company_id}', ['uses' => 'DS\MarketingController@editCompany', 'as' => 'editCompany']);
	Route::post('/marketing/dealer/update-company', ['uses' => 'DS\MarketingController@updateCompany', 'as' => 'updateCompany']);

	//All route related to agent
	Route::get('/marketing/agent/list', ['uses' => 'DS\MarketingController@agentList', 'as' => 'agentList']);
	Route::get('/marketing/get-agent-list', ['uses' => 'DS\MarketingController@getAgentList', 'as' => 'getAgentList']);	
	Route::get('/marketing/agent/add', ['uses' => 'DS\MarketingController@showAgentForm', 'as' => 'agentFormMarketing']);
	Route::post('/marketing/agent/request-add-agent', ['uses' => 'DS\MarketingController@requestAddAgent', 'as' => 'requestAddAgentMarketing']);
	Route::post('/marketing/agent/delete-agent', ['uses' => 'DS\MarketingController@deleteAgent', 'as' => 'deleteAgent']);
	Route::post('/marketing/agent/get-company-name', ['uses' => 'DS\MarketingController@getCompanyName', 'as' => 'getCompanyName']);
	Route::get('/marketing/agent/edit/{agent_id}', ['uses' => 'DS\MarketingController@editAgent', 'as' => 'editAgent']);
	Route::post('/marketing/agent/update-agent', ['uses' => 'DS\MarketingController@updateAgent', 'as' => 'updateAgent']);

	Route::get('/marketing/agent/claim-all/{agent_id}', ['uses' => 'DS\MarketingController@mClaimAll', 'as' => 'mClaimAll']);
	Route::get('/marketing/download/claim/{company}/{year}/{month}/{app}/pdf', ['uses' => 'DS\MarketingController@exportPDFClaim', 'as' => 'mexportPDFC']);
	Route::get('/marketing/agent/get-claim-list/{company}', ['uses' => 'DS\MarketingController@mClaimListAll', 'as' => 'mClaimList']);
	Route::get('/marketing/agent/filter/{company}/{year}/{month}/{app}', ['uses' => 'DS\MarketingController@filterclaim', 'as' => 'filterclaim']);
	Route::post('/marketing/agent/request-claim', ['uses' => 'DS\MarketingController@requestClaim', 'as' => 'requestClaim']);
	Route::post('/marketing/agent/update-claimdate', ['uses' => 'DS\MarketingController@updateClaimDate', 'as' => 'updateClaimDate']);

	//All route related to commission
	Route::get('/marketing/commission/residential/list', ['uses' => 'DS\MarketingController@commissionListR', 'as' => 'commissionListR']);
	Route::get('/marketing/commission/business/list', ['uses' => 'DS\MarketingController@commissionListB', 'as' => 'commissionListB']);
	Route::get('/marketing/commission/residential/add', ['uses' => 'DS\MarketingController@commissionFormR', 'as' => 'commissionFormR']);
	Route::get('/marketing/commission/business/add', ['uses' => 'DS\MarketingController@commissionFormB', 'as' => 'commissionFormB']);
	Route::get('/marketing/get-commission-listR24', ['uses' => 'DS\MarketingController@getCommissionListR24', 'as' => 'getCommissionListR']);
	Route::get('/marketing/get-commission-listR12', ['uses' => 'DS\MarketingController@getCommissionListR12', 'as' => 'getCommissionListR12']);
	Route::get('/marketing/get-commission-listB24-low', ['uses' => 'DS\MarketingController@getCommissionListB24Low', 'as' => 'getCommissionListB24Low']);
	Route::get('/marketing/get-commission-listB24-high', ['uses' => 'DS\MarketingController@getCommissionListB24High', 'as' => 'getCommissionListB24High']);
	Route::get('/marketing/get-commission-listB12-low', ['uses' => 'DS\MarketingController@getCommissionListB12Low', 'as' => 'getCommissionListB12Low']);
	Route::get('/marketing/get-commission-listB12-high', ['uses' => 'DS\MarketingController@getCommissionListB12High', 'as' => 'getCommissionListB12High']);
	Route::post('/marketing/request-add-commissionR', ['uses' => 'DS\MarketingController@requestAddCommissionR', 'as' => 'requestAddCommissionR']);
	Route::post('/marketing/request-add-commissionB', ['uses' => 'DS\MarketingController@requestAddCommissionB', 'as' => 'requestAddCommissionB']);
	Route::post('/marketing/commission/delete-commission', ['uses' => 'DS\MarketingController@deleteCommission', 'as' => 'deleteCommissionR']);
	Route::get('/marketing/commission/edit-commissionR/{commission_id}', ['uses' => 'DS\MarketingController@editCommissionR', 'as' => 'editCommissionR']);
	Route::post('/marketing/commission/update-commissionR', ['uses' => 'DS\MarketingController@updateCommissionR', 'as' => 'updateCommissionR']);
	Route::get('/marketing/commission/edit-commissionB/{commission_id}', ['uses' => 'DS\MarketingController@editCommissionB', 'as' => 'editCommissionB']);
	Route::post('/marketing/commission/update-commissionB', ['uses' => 'DS\MarketingController@updateCommissionB', 'as' => 'updateCommissionB']);

	Route::get('/marketing/docket/list', ['uses' => 'DS\MarketingController@docketList', 'as' => 'docketList']);
	Route::get('/marketing/docket/get-docket-list', ['uses' => 'DS\MarketingController@getDocketList', 'as' => 'getDocketList']);
	Route::get('/marketing/docket/filter/{year}/{month}', ['uses' => 'DS\MarketingController@filterDocket', 'as' => 'filterDocket']);
	Route::get('/marketing/docket/generate-pdf/{do}', ['uses' => 'DS\MarketingController@generateDocketPDF', 'as' => 'maDocketPDF']);

	Route::get('/marketing/work-order/list', ['uses' => 'DS\MarketingController@woList', 'as' => 'woList']);
	Route::get('/marketing/work-order/get-wo-list', ['uses' => 'DS\MarketingController@getWoList', 'as' => 'getWoList']);
	Route::get('/marketing/work-order/filter/{year}/{month}/{status}', ['uses' => 'DS\MarketingController@filterWo', 'as' => 'filterWo']);
	Route::get('/marketing/work-order/generate-pdf/{wo}', ['uses' => 'DS\MarketingController@generateWorkOrderPDF', 'as' => 'maWorkOrderPDF']);

	//For test, utilities and checking purpose
	Route::get('/marketing/checkmongodb', ['uses' => 'DS\MarketingController@checktry', 'as' => 'layan']);
	Route::get('/marketing/convert/company-to-laravel', ['uses' => 'DS\MarketingController@companylara', 'as' => 'companyToLaravel']);
	Route::get('/marketing/convert/commission-to-laravel', ['uses' => 'DS\MarketingController@commissionlara', 'as' => 'commissionToLaravel']);
	Route::get('/marketing/convert/claim-to-laravel', ['uses' => 'DS\MarketingController@claimtolara', 'as' => 'claimtolara']);
	Route::get('/marketing/addnew/add-total', ['uses' => 'DS\MarketingController@claimaddtotal', 'as' => 'claimaddtotal']);
	Route::get('/marketing/convert/docket-to-laravel', ['uses'=> 'DS\MarketingController@docketToLaravel', 'as' => 'docketToLaravel']);
	Route::get('/marketing/convert/work-to-laravel', ['uses'=> 'DS\MarketingController@woToLaravel', 'as' => 'woToLaravel']);
});

/** Access Auhtorized (Dealer) **/
Route::group(['middleware' => 'dsAuth'], function () {

	Route::get('/dealer', ['uses' => 'DS\DealerController@viewList', 'as' => 'dHome']);
	Route::get('/dealer/get-agent-list', ['uses' => 'DS\DealerController@gAgentList', 'as' => 'gAList']);

	Route::get('/dealer/subscription/form/list', ['uses' => 'DS\DealerController@viewAppList', 'as' => 'AppList']);
	Route::get('/dealer/get-application-list1', ['uses' => 'DS\DealerController@gApplicationList1', 'as' => 'gAppList1']);
	Route::get('/dealer/get-application-list2', ['uses' => 'DS\DealerController@gApplicationList2', 'as' => 'gAppList2']);
	Route::get('/dealer/get-application-list3/{year}/{month}', ['uses' => 'DS\DealerController@gApplicationList3', 'as' => 'gAppList3']);
	Route::get('/dealer/history/{id}', ['uses' => 'DS\DealerController@getOrderHistory', 'as' => 'gHistoryList']);

	Route::get('/dealer/claim/all', ['uses' => 'DS\DealerController@claimAll', 'as' => 'claimAll']);
	Route::get('/dealer/download/claim/{company}/{year}/{month}/{app}/pdf', ['uses' => 'DS\DealerController@exportPDF', 'as' => 'exportPDF']);
	Route::get('/dealer/claim-all/{company}/{year}/{month}/{app}', ['uses' => 'DS\DealerController@getClaimRB', 'as' => 'gClaimResidentialBusiness']);

	Route::get('/dealer/agent/add', ['uses' => 'DS\DealerController@showAgentForm', 'as' => 'addAgentForm']);
	Route::post('/dealer/add-agent', ['uses' => 'DS\DealerController@requestAddAgent', 'as' => 'addAgent']);
	Route::get('/dealer/agent/edit-agent/{agent_id}', ['uses' => 'DS\DealerController@editAgentDealer', 'as' => 'editAgentDealer']);

	Route::post('/dealer/update-agent', ['uses' => 'DS\DealerController@updateAgent', 'as' => 'updateAgentDealer']);
	Route::post('/dealer/delete-agent', ['uses' => 'DS\DealerController@deleteAgent', 'as' => 'deleteAgentDealer']);

	Route::get('/dealer/residential/form', ['uses' => 'DS\DealerController@showResidentialForm', 'as' => 'residentialForm']);
	Route::get('/dealer/business/form', ['uses' => 'DS\DealerController@showBusinessForm', 'as' => 'businessForm']);
});

/** Access Auhtorized (Agent) **/
Route::group(['middleware' => 'agentAuth'], function () {
	Route::get('/sales', ['uses' => 'DS\SalesController@viewAppList', 'as' => 'aHome']);

	Route::get('/sales/get-application-list1', ['uses' => 'DS\SalesController@gApplicationList1', 'as' => 'gAppListS1']);
	Route::get('/sales/get-application-list2', ['uses' => 'DS\SalesController@gApplicationList2', 'as' => 'gAppListS2']);
	Route::get('/sales/get-application-list3/{year}/{month}', ['uses' => 'DS\SalesController@gApplicationList3', 'as' => 'gAppListS3']);
	Route::get('/sales/history/{id}', ['uses' => 'DS\SalesController@getOrderHistory', 'as' => 'gHistorySList']);

	Route::get('/sales/Residential/Form', ['uses' => 'DS\SalesController@showResidentialForm', 'as' => 'residentialSForm']);
	Route::get('/sales/Business/Form', ['uses' => 'DS\SalesController@showBusinessForm', 'as' => 'businessSForm']);

	Route::get('/sales/profile',  ['uses' => 'DS\ProfileControllerA@viewProfile', 'as' => 'aProfile']);
	Route::post('/sales/update-profile-picture',  ['uses' => 'DS\ProfileControllerA@updateProfilePicture', 'as' => 'aProfileImg']);
	Route::post('/sales/update-fullname',  ['uses' => 'DS\ProfileControllerA@updateFullName', 'as' => 'aName']);
	Route::post('/sales/update-ic',  ['uses' => 'DS\ProfileControllerA@updateIdentity', 'as' => 'aName']);
	Route::post('/sales/update-phone',  ['uses' => 'DS\ProfileControllerA@updatePhone', 'as' => 'aName']);
	Route::post('/sales/update-password',  ['uses' => 'DS\ProfileControllerA@updatePassword', 'as' => 'aName']);

});

