<?php


use Illuminate\Support\Facades\Route;

Route::group(['namespace' => 'Gisplus\Package\Crm\Controllers','middleware' => ['web']], function() {
   
    // Route::get('crm', [

    //     'uses' => 'CrmDashboardController@index',
    //     'as' =>     'crm.dashboard'

    // ]);
Route::get('crmdashboard', 'CrmDashboardController@index')->name('crm')->middleware('auth');


    Route::match(['get','post'],'leads', [

        'uses' => 'LeadController@index',
        'as' =>     'lead.leads'

    ]);
   Route::post('leadcommit',[

    'uses' => 'LeadController@storeLead',
    'as' =>     'lead.store'
   ]);
 

    Route::get('customerlist/{id}',
        'LeadController@getCustomer'
    );

    Route::get('referrallist/{id}',
    'LeadController@getReferral'
    );

    Route::get('updatelead/{id}',[

        'uses'  =>  'LeadController@updateLeadModal',
        'as'    =>  'update.lead.modal'
    ]);
    
    Route::post('updatelead',[

        'uses'  =>  'LeadController@updateLead',
        'as'    =>  'update.lead'
    ]);
    Route::get('/leadtrash/{id}', [
        'uses' => 'LeadController@removelead',
        'as' => 'lead.trash'
    ]);
    Route::get('/viewlead/{id}', [

        'uses' => 'LeadController@viewLead',
        'as' =>     'lead.view'

    ]);
  //TASKS ROUTES

    Route::get('tasks/{id}', [

        'uses' => 'TaskController@index',
        'as' =>     'task.tasks'

    ]);
    Route::post('taskcommit', [

        'uses' => 'TaskController@storeTask',
        'as' =>     'task.store'

    ]);
    Route::get('updatetask/{id}',[

        'uses'  =>  'TaskController@updateTaskModal',
        'as'    =>  'update.task.modal'
    ]);
    Route::post('taskupdate', [

        'uses' => 'TaskController@updateTask',
        'as' =>     'task.update'

    ]);

    Route::get('/tasktrash/{id}', [
        'uses' => 'TaskController@removeTask',
        'as' => 'task.trash'
    ]);

    // VISIT ROUTES
    Route::get('visits/{id}', [

        'uses' => 'VisitController@index',
        'as' =>     'visit.visits'

    ]);
    Route::post('visitcommit', [

        'uses'  => 'VisitController@storeVisit',
        'as'    =>     'visit.store'

    ]);
    Route::get('updatevisit/{id}',[

        'uses'  =>  'VisitController@updateVisitModal',
        'as'    =>  'update.visit.modal'
    ]);
    Route::post('visitupdate', [

        'uses'  => 'VisitController@updatevisit',
        'as'    =>     'visit.update'

    ]);

    Route::get('/visittrash/{id}', [
        'uses'  => 'VisitController@removeVisit',
        'as'    => 'visit.trash'
    ]);

    //LEAD TRANSFER

       Route::post('leadtransfercommit',[

        'uses'  => 'LeadTransferController@storeLeadTransfer',
        'as'    =>     'leadtransfer.store'
       ]);
       Route::get('updateleadtransfer/{id}',[

        'uses'  =>  'LeadTransferController@updateLeadTransferModal',
        'as'    =>  'update.leadtransfer.modal'
    ]);
    Route::post('leadtransferupdate', [

        'uses' => 'LeadTransferController@updateLeadTransfer',
        'as' =>     'leadtransfer.update'

    ]);
    Route::get('leadvisitlist/{id}','TaskController@getVisitorDescription'
);

        //BUSINESS REFERRAL ROUTES
        Route::get('businessreferrals', [

            'uses' => 'BusinessReferralController@index',
            'as' =>     'referral.referrals'
    
        ]);
        Route::post('referralcommit',[

        'uses' => 'BusinessReferralController@storeBusinessReferral',
        'as' =>     'referral.store'
        ]);

        Route::get('updatebusinessreferral/{id}',[

        'uses'  =>  'BusinessReferralController@updateBusinessReferralModal',
        'as'    =>  'update.referral.modal'
    ]);
        Route::post('updatebusinessreferral',[

            'uses'  =>  'BusinessReferralController@updateBusinessReferral',
            'as'    =>  'business_referral.update'
        ]);
        Route::get('/businessreferraltrash/{id}', [
            'uses' => 'BusinessReferralController@removeBusinessReferral',
            'as' => 'businessreferral.trash'
        ]);

        //REFERRAL ROUTES

        Route::post('updatereferral',[

            'uses'  =>  'ReferralHistoryController@updateReferralHistory',
            'as'    =>  'leadreferral.update'
        ]);
        Route::get('updateleadreferral/{id}',[

            'uses'  =>  'ReferralHistoryController@updateReferralHistoryModal',
            'as'    =>  'update.leadreferral.modal'
        ]);

        //TRANSFER LEADS
        // Route::get('transferleads', [

        //     'uses' => 'LeadTransferController@index',
        //     'as' =>     'transferleads.show'
    
        // ]);

});
?>
