<?php


//Route::get('/command', function () {
//    \Artisan::call('config:cache');
//
//    /* php artisan migrate */
//    \Artisan::call('key:generate');
//    dd("Done");
//});
/*
|--------------------------------------------------------------------------
| 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!
|item-list/show
*/
//Language Controller
Route::get('/en', 'LanguageController@en')->name('en');
Route::get('/km', 'LanguageController@km')->name('km');

Route::GET('/realty/find-district-code/{procode}', 'FindLocationController@district');
Route::GET('/realty/find-commune-code/{procode}', 'FindLocationController@commune');
Route::GET('/realty/find-village-code/{procode}', 'FindLocationController@village');



Route::GET('/api/branches', 'APIs\BranchController@index');

Auth::routes();
// Route::resource('/','FrontEnd\HomeController');
// Route::GET('/item-list/{id}','FrontEnd\FItemController@index')->name('item-list.index');
// Route::GET('item-list/load-more-data/{id}','FrontEnd\FItemController@load_data_ajax')->name('item-list.laodmore');
// Route::GET('/item-list/show/{id}','FrontEnd\FItemController@item_detail')->name('item-list.detail');

// Route::GET('/about-us.html', 'FrontEnd\HomeController@page_about_us')->name('page_about_us');
// Route::GET('/contact-us.html', 'FrontEnd\HomeController@page_contact_us')->name('page_contact_us');
// Route::GET('/faq.html', 'FrontEnd\HomeController@page_faq')->name('page_faq');

// Route::get('ajax-pagination','FrontEnd\ItemListController@ajaxPagination')->name('ajax.pagination');




Route::namespace('FrontEnd')->group(function () {
	route::get('/', 'HomeController@index')->name('home');
	route::get('contact-us', 'FContactController@index')->name('contact');
	route::get('about-us', 'FAboutController@index')->name('about');
	route::get('item-list/{id}', 'FItemController@item_list')->name('item.index');
	route::get('item-category-list/{id}', 'FItemController@item_category_list')->name('item-category.list');
	route::get('item-detail/{id}', 'FItemController@item_detail')->name('item.detail');
});
//*************************************************************************************//
//*********************************** Log Ativity **************************************//
//*************************************************************************************//
Route::get('/log-activity', 'LogActivityController@log_activity')->name('log.activity');
Route::get('/log_activity_datatable', 'LogActivityController@log_activity_datatable')->name('log.activity_datatable');

/*************************************Payment Policy**********************************/

route::get("/setting-payment-policy-index","Administrator\PaymentPolicyController@index")->name("payment-policy.index");
route::post("/setting-payment-policy-store","Administrator\PaymentPolicyController@store")->name("payment-policy.store");
route::post('/setting-payment-policy-update','Administrator\PaymentPolicyController@update')->name("payment-policy.update");
route::get('/setting-payment-policy-delete','Administrator\PaymentPolicyController@delete')->name("payment-policy.delete");

/*************************************Payment Policy Detail**********************************/
route::get('/setting-payment-policy-create','Administrator\PaymentPolicyDetailController@create')->name('payment-policy-detail.create');
route::post('/get-sub-category-item-for-payment-policy','Administrator\PaymentPolicyDetailController@get_sub_category')->name('payment_policy.get_sub_category');
route::get("/setting-payment-policy-index-detail","Administrator\PaymentPolicyDetailController@index")->name("payment-policy-detail.index");
route::post("/setting-payment-policy-store-detail","Administrator\PaymentPolicyDetailController@store")->name("payment-policy-detail.store");
route::patch('/setting-payment-policy-update-detail/{id}','Administrator\PaymentPolicyDetailController@update')->name("payment-policy-detail.update");
route::get('/setting-payment-policy-delete-detail','Administrator\PaymentPolicyDetailController@delete')->name("payment-policy-detail.delete");
route::get('/setting-payment-policy-create/{id}','Administrator\PaymentPolicyDetailController@edit')->name('payment-policy-detail.edit');
/*************************************Promotion**********************************/
 #####################################Ceremony##################################
 route::get('/ceremony-index-list',"Administrator\PromotionController@ceremony_list")->name("promotion.ceremony_list");
 route::post('/ceremony-store',"Administrator\PromotionController@ceremony_store")->name("promotion.ceremony_store");
 route::post('/ceremony-update',"Administrator\PromotionController@ceremony_update")->name("promotion.ceremony_update");
 route::get('/ceremony-delete',"Administrator\PromotionController@ceremony_delete")->name("promotion.ceremony_delete");

  #####################################Product##################################
  route::get('/product-index-list',"Administrator\PromotionController@product_promotion_list")->name("promotion.product_promotion_list");
  route::post('/product-promotion-stroe',"Administrator\PromotionController@product_promotion_store")->name("promotion.product_promotion_store");
  route::post('/product-promotion-update',"Administrator\PromotionController@product_promotion_update")->name("promotion.product_promotion_update");
  route::post('/product-promotion-increase-finish-date',"Administrator\PromotionController@promotion_update_finish_date")->name("promotion.promotion_update_finish_date");
  route::post('/product-promotion-close',"Administrator\PromotionController@promotion_close")->name("promotion.promotion_close");
  route::get('/product-promotion-delete',"Administrator\PromotionController@product_promotion_delete")->name("promotion.product_promotion_delete");

 ####################################Promotion###################################
 route::get('/promotion-index-list',"Administrator\PromotionController@promotion_list")->name("promotion.promotion_list");
 route::post('/promotion-store',"Administrator\PromotionController@promotion_store")->name("promotion.promotion_store");
 route::get('/promotion-detail/{id}',"Administrator\PromotionController@promotion_detail")->name("promotion.promotion_detail");
 route::get('/promotion-edit-get-info/{id}',"Administrator\PromotionController@promotion_edit_info")->name("promotion.promotion_edit_info");
 route::post('/promotion-update',"Administrator\PromotionController@promotion_update")->name("promotion.promotion_update");
 route::get('/promotion-delete',"Administrator\PromotionController@promotion_delete")->name("promotion.promotion_delete");
 route::get('/promotion-detail-get-info/{id}',"Administrator\PromotionController@promotion_detail_get_info")->name("promotion.promotion_detail_get_info");
 route::post('/promotion-detail-update',"Administrator\PromotionController@promotion_detail_update")->name("promotion.promotion_detail_update");
 route::get('/promotion-detail-delete',"Administrator\PromotionController@promotion_detail_delete")->name("promotion.promotion_detail_delete");
 route::post('/promotion-add-new-product',"Administrator\PromotionController@promotion_add_new_product")->name("promotion.promotion_add_new_product");
 route::match(['get','post'],'/promotion-report',"Administrator\PromotionController@promotion_report")->name("promotion.promotion_report");

/*route::get("/setting-payment-promotion-index","Administrator\PromotionController@index")->name("payment-promotion.index");
route::get("/setting-edit-promotion/{id}","Administrator\PromotionController@edit")->name("payment-promotion.edit");
route::post("/setting-payment-store","Administrator\PromotionController@store")->name("payment-promotion.store");
route::post('/setting-payment-promotion-update','Administrator\PromotionController@update')->name("payment-promotion.update");
route::get('/setting-payment-promotion-delete','Administrator\PromotionController@delete')->name("payment-promotion.delete");
route::get('/setting-payment-promotion-close','Administrator\PromotionController@close_promotion')->name("payment-promotion.close_promotion");*/

/*************************************Payment Policy**********************************/

route::get("/setting-bank-loan-procedure-index","Administrator\BankLoanProcedures@index")->name("bank-loan-procedure.index");
route::post("/setting-bank-loan-procedure-store","Administrator\BankLoanProcedures@store")->name("bank-loan-procedure.store");
route::post('/setting-bank-loan-procedure-update','Administrator\BankLoanProcedures@update')->name("bank-loan-procedure.update");
//*************************************************************************************//
//*********************************** agency-level **************************************//
//*************************************************************************************//
Route::resource('/agency-level', 'AgencyLevelController');
Route::post('/update-level-agency', 'AgencyLevelController@update_agency_level')->name('agency-level.update_agency_level');

//*************************************************************************************//
//*********************************** agency-group **************************************//
//*************************************************************************************//
Route::resource('/agency-group', 'AgencyGroupController');

//*************************************************************************************//
//*********************************** agency-type **************************************//
//*************************************************************************************//
Route::resource('/agency-type', 'AgencyTypeController');



//*************************************************************************************//
//*********************************** agency-close-sale **************************************//
//*************************************************************************************//
Route::resource('/agency-close-sale', 'AgencyCloseSaleController');

//*************************************************************************************//
//*********************************** set-commission-company **************************************//
//**********************************************************************************q***//
Route::resource('/admin-commission', 'SetCommissionCompanyController');

/* block accounting*/
////////////////////////////////////////////////////////////////////////////////////////////////
Route::group(['middleware' => 	'Administrator', ['auth'], 'prefix' => 'accounting', 'namespace' => 'Administrator'], function () {

	//**************************************************************2***********************//
	//*********************************** Journal Accounting ****************************//
	//*************************************************************************************//
	Route::resource('journal', 'JournalController');
	Route::match(['get', 'post'], '/get-journal', 'JournalController@get_journal')->name('datatable.get-journal');
	Route::POST('search/account-code', 'JournalController@query_account_code')->name('search-account-code');

    Route::get('/print/voucher/{voucher?}', 'JournalController@print_voucher')->name('voucher.print');
    Route::POST('/journal-confirm-delete', 'JournalController@journal_confirm_delete')->name('journal_confirm_delete');
	//*************************************************************************************//
	//*********************************** Accounting Report ****************************//
	//*************************************************************************************//

	//*********************************** Ledger *******************************************//
	//*************************************************************************************//
	Route::POST('/send-fund-to-any-agency','FundsTransactionController@sendfund')->name('send-fund-to-any-agency');
	Route::GET('/find-account-fund-by-number/{account_number}','FundsTransactionController@accountfundinfo')->name('find-account-fund-by-number');

    Route::get('/ledger/{id?}/{start?}/{end?}', 'AccountingReportsController@ledger')->name('accounting-report.ledger');
    Route::get('accounting-report/cash-flow','AccountingReportsController@cash_flow')->name('accounting-report.cash-flow');
    Route::match(['get','post'],'accounting-report/cash-flow-list','AccountingReportsController@cash_flow_list')->name('accounting-report.cash-flow-list');
    Route::match(['get', 'post'], '/get-accounting-report/ledger', 'AccountingReportsController@get_ledger')->name('get-accounting-report.ledger');
    //*********************************** Trial Balance *******************************************//
    //*************************************************************************************//
    Route::get('/get-accounting-report/trail-balance', 'AccountingReportsController@trial_balance')->name('accounting-report.trail-balance');
    Route::match(['get', 'post'], '/get-accounting-report/get-trail-balance', 'AccountingReportsController@get_trial_balance')->name('accounting-report.get-trail-balance');
    Route::POST('print-accounting-report/trial-balance', 'AccountingReportsController@print_trial_balance')->name('print.trial-balance');


    //*********************************** Balance Sheet *******************************************//
    //********************************************************************************************//
    Route::match(['get', 'post'],'get-accounting-report/balance-sheet-all', 'AccountingReportsController@balance_sheet_sum')->name('accounting-report.balance-sheet-all');

    //*********************************** Balance Sheet *******************************************//
    //********************************************************************************************//
    Route::get('/get-accounting-report/balance-sheet', 'AccountingReportsController@balance_sheet')->name('accounting-report.balance-sheet');
    Route::match(['get', 'post'], '/get-accounting-report/get-balance-sheet', 'AccountingReportsController@get_balance_sheet')->name('accounting-report.get-balance-sheet');
    Route::POST('/print-accounting-report/balance-sheet', 'AccountingReportsController@print_balance_sheet')->name('print.balance-sheet');
    //*********************************** Income Statement *******************************************//
    //*************************************************************************************************************//
    Route::get('/accounting-report/income-statement', 'AccountingReportsController@income_statement')->name('accounting-report.income-statement');
    Route::match(['get', 'post'], '/accounting-report/get-income-statement', 'AccountingReportsController@get_income_statement')->name('accounting-report.get-income-statement');
    Route::POST('/print-accounting-report/income-statement', 'AccountingReportsController@print_income_statement')->name('print.income-statement');
    //  Run Audit
    Route::post('/accounting-run-audit','AccountingReportsController@run_trial_balance')->name('run_trial_balance');
});
////////////////////////////////////////////////////////////////////////////////////////////
/* block accounting*/


Route::group(['middleware' => 	'Administrator', ['auth'], 'namespace' => 'Administrator'], function () {
	Route::GET('/', 'DashboardSuperAdminController@index')->name('dashboard.super-admin');
	Route::GET('/operational-data', 'DashboardSuperAdminController@operationalData')->name('operational-data');
});

/*Administrator can access to agency than relate to fund action (sokrann)*/
Route::group(['middleware' => 	'Administrator', ['auth'], 'prefix' => 'realty', 'namespace' => 'Administrator'], function () {
	Route::get('zero', 'ZeroValueController@zero');
	/**************************************** Report Funds Transation************************************************/

	Route::GET('/report-fundstransation', 'ReportFundTransation@report_fundstransation')->name('report_funds_transation');

	/*************************************************End*************************************************************/

	/************************************************Add Fund*********************************************************/

	Route::GET('/add-funds-admin/{id?}', 'ReportFundTransation@add_funds')->name('admin.transaction.add_funds');

	Route::POST('/add-funds-store-admin/', 'ReportFundTransation@add_funds_store')->name('admin.transaction.add_funds_store');

	/*************************************************End************************************************************/

	/************************************************Withdraw Fund***************************************************/

	Route::GET('/withdraw-funds-admin/{id?}', 'ReportFundTransation@withdraw_funds')->name('admin.transaction.withdraw_funds');

	Route::POST('/withdraw-funds-store-admin/', 'ReportFundTransation@withdraw_funds_store')->name('admin.transaction.withdraw_funds_store');

	/*************************************************End************************************************************/

	/************************************************Withdraw Fund***************************************************/

	Route::GET('/send-funds-admin/{id?}', 'ReportFundTransation@send_funds')->name('admin.transaction.send_funds');

	Route::GET('/admin-funds-account-name', 'ReportFundTransation@get_accountname')->name('admin.fund_account_name');

	Route::POST('/send-funds-store-admin/', 'ReportFundTransation@send_funds_store')->name('admin.transaction.send_funds_store');

	Route::GET('/get-agency-bank-acc/{id}', 'ReportFundTransation@getBankAccount')->name('get-agency-bank-acc');
	Route::GET('/get-agency-fund-balance', 'ReportFundTransation@get_agency_fund_balance')->name('get_agency_fund_balance');
	/*************************************************End************************************************************/
});
/*End*/

Route::group(['middleware' => 	'Administrator', ['auth'], 'prefix' => 'realty', 'namespace' => 'Administrator'], function () {

	Route::POST('/bar-chart', 'DashboardSuperAdminController@search')->name('bar-chart');
	/***************************Manage Inventory Stock**************************************/
	Route::resource('/inventory_stock', 'InventoryStockController');
	Route::match(['get', 'patch'], 'inventory-stock/{id}', 'InventoryStockController@show')->name('inventory-stock.show');
	Route::get('/inventory-stock-list', 'InventoryStockController@list')->name('inventory-list');
	Route::GET('/get-edit-inventory-stock-item', 'InventoryStockController@get_edit')->name('edit.inventory-stock');
	Route::POST('update-inventory-stock/store-update', 'InventoryStockController@update_store')->name('update-inventory-stock.update');
	Route::get('/inventory-get-data', 'InventoryStockController@get_data')->name("inventory_stock.get_data");
	Route::get('/inventory_stock_edit/{id}', 'InventoryStockController@edit_inv');
	Route::post('/inventory_stock_update-inv', 'InventoryStockController@update_inventory')->name("inventory_stock_update");
	Route::post('/inventory_stock_delete-inv', 'InventoryStockController@destroy_inventory')->name("inventory_stock_delete");
	Route::GET('/view-inventory/{id}', 'InventoryStockController@view_inventory')->name('get-inventory-stock-item');
	Route::DELETE('/remove-from-remove-cart-inventory', 'InventoryStockController@inventory_cart_removal')->name('remove-from-remove-cart-inventory');
	Route::GET('/add-to-remove-cart-inventory/{id}', 'InventoryStockController@inventory_cart_adding')->name('add-to-remove-cart-inventory');
	Route::GET('/filter-agency-to-assign/{inv_id}/{id?}', 'InventoryStockController@filter_agency')->name('filter-agency-to-assign');
	Route::GET('/get_search_data', 'InventoryStockController@get_search_data')->name('get_search_data');
	///////////////////////////assign////////////////////////////////////////////////////////////
	Route::GET('/assign-inven-to-agency', 'InventoryStockController@assign_stock')->name('assign-inven-to-agency');
	Route::GET('/assign-inven-to-agency/create', 'InventoryStockController@create_assign_stock')->name('assign-inven-to-agency.create');
	Route::GET('/assign-inven-to-agency/edit/{id}', 'InventoryStockController@edit_assign')->name('assign-inven-to-agency.edit');
	Route::GET('filter-agency-to-edit-assign/{inv}/{id?}', 'InventoryStockController@filter_agency_to_edit')->name('filter-agency-to-edit-assign');
	Route::PATCH('/assign-inventory-update/{id}', 'InventoryStockController@update_assign')->name('assign-inventory.update');
	Route::POST('/assign-inven-store', 'InventoryStockController@assign_store')->name('assign-inventory.store');
	Route::GET('/item-in-inventory/{id}', 'InventoryStockController@stock_in_inventory')->name('item-in-inventory');
	Route::GET('/inventories-stock/assign-list', 'InventoryStockController@inven_assign_list')->name('assign-list-inventory');
	Route::GET('/table-detail-inventory/{id}', 'InventoryStockController@detail_url')->name('table-detail-inventory');
	Route::GET('/filter-agency-by-group-based-inventory/{inv}/{id?}', 'InventoryStockController@filter_agencyGroup')->name('filter-agency-by-group-based-inventory');
	Route::GET('filter-edit-agency-by-group-based-inventory/{inv}/{id?}', 'InventoryStockController@filter_agency_edit')->name('filter-edit-agency-by-group-based-inventory');
	Route::GET('/get-agent-info/{id}', 'InventoryStockController@agent_info')->name('get-agent-info');
	Route::POST('/filter-agency-by-team', 'InventoryStockController@filterByTeam')->name('filter-agency-by-team');
	Route::POST('/filter-agency-by-team-edit', 'InventoryStockController@filterByTeamEdit')->name('filter-agency-by-team-edit');
	/**********************************End**************************************************/
	//*************************************************************************************//
	//*********************************** POS ********************************************//
	//*************************************************************************************//
	Route::resource('/pos', 'POSController');
	Route::post('/pos-get-promotion','POSController@get_promotion_by_deposit_date')->name("get_promotion_by_deposit_date");
	Route::match(['get', 'post'], 'create-pos/{project?}/{category?}/{inventory?}/{item?}', 'POSController@create_pos')->name('create-pos');
	Route::get('/get-cart-session', 'POSController@get_cart')->name('get-session-cart');
	Route::get('/get-cart-transfer-session', 'ItemController@get_cart')->name('get-session-cart-transfer');
	Route::post('/pos-search', 'POSController@filter')->name('pos-filter');
	Route::POST('/pos-filter-by-name', 'POSController@search')->name('pos-filter-by-name');
	Route::get('/pos-add-to-cart/{id}', 'POSController@add_to_cart')->name('add-to-cart');
	Route::DELETE('/pos-remove-cart', 'POSController@remove')->name('pos-remove-cart');
	Route::GET('/remove-cart-edit/{id}', 'EditPOSController@edit')->name('remove-from-cart-edit');
	Route::GET('/add-to-cart-edit/{id}', 'EditPOSController@show')->name('add-to-cart-edit');
	Route::GET('/get-session-cart-edit', 'EditPOSController@index')->name('get-session-cart-edit');
	Route::get('/get-new-client', 'POSController@new_client')->name('pos-get-new-client');
	Route::POST('/add-new-client', 'POSController@add_client')->name('add-new-client');
	Route::get('block-time/list', 'POSController@time_list')->name('block-time.index');
	Route::get('block-time/get-list', 'POSController@get_time_list')->name('block-time.get');
	Route::POST('block-time/store', 'POSController@store_time')->name('block-time.store');
	Route::match(['patch', 'put'], 'block-time/update/{id}', 'POSController@update_time')->name('block-time.update');
	Route::get('remove-block-time/{id}', 'POSController@delete_time')->name('remove-block-time');
    Route::GET('/get-promotion', 'POSController@get_promotion_')->name('items.get_promotion_');
    Route::GET('/get-promotion-detail', 'POSController@get_promotion_detail')->name('items.get_promotion_detail');
    Route::GET('/get-promotion-detail-all', 'POSController@get_promotion_detail_all')->name('items.get_promotion_detail_all');

	Route::POST('/block-item-stock', 'POSController@block_item')->name('block.item-stock');
	Route::POST('/unblock-item-stock', 'POSController@unblock_item')->name('unblock.item-stock');
	Route::get('/blocked-item-stock/list', 'POSController@blocked_item')->name('blocked-item-list');
	Route::GET('/move-to-cart/{id}', 'POSController@moveToCart')->name('move-to-cart');

	route::get('/get_promotion/{id}','POSController@get_promotion')->name('get_promotion');


	route::get('/get-policy-detail/{type}','POSController@get_policy_detail')->name('get_policy_detail');

	//*************************************************************************************//
	//*********************************** Journal Accounting ****************************//
	//*************************************************************************************//
	Route::resource('journal', 'JournalController');
	Route::match(['get', 'post'], '/get-journal', 'JournalController@get_journal')->name('datatable.get-journal');
	Route::POST('search/account-code', 'JournalController@query_account_code')->name('search-account-code');
 	Route::POST('/journal-confirm-delete', 'JournalController@journal_confirm_delete')->name('journal_confirm_delete');

	//*************************************************************************************//
	//*********************************** Branch ********************************************//
	//*************************************************************************************//
	Route::resource('/branches', 'BranchController');
	Route::GET('/assign-branch/{id}', 'BranchController@assign_branch')->name('assign.branch');
	Route::POST('/store-branch', 'BranchController@store_branch')->name('store.branch');

	Route::resource('/bank-info', 'BankInfoController');

	Route::resource('/discount', 'DiscountController');
	//*************************************************************************************//
	//************************************* Backup ****************************************//
	//*************************************************************************************//
	Route::get('backup', 'BackupController@index');
	Route::get('backup/create', 'BackupController@create')->name('laravel.backup');

	// Route::get('backup/download/{file_name}', 'BackupController@download');
	// Route::get('backup/delete/{file_name}', 'BackupController@delete');


	//*************************************************************************************//
	//*********************************** Profile Super Admin **************************************//
	//*************************************************************************************//
	Route::GET('/super-admin-account', 'SuperAdminAccountController@index')->name('account.super-admin');
	Route::POST('/super-admin-profile/image-upload', 'SuperAdminAccountController@change_profile_images')->name('administrator.change.profile_images');
	Route::POST('/super-admin-profile/change-password', 'SuperAdminAccountController@change_password')->name('administrator.change.change_password');


	Route::resource('/roles', 'RoleController');
	Route::resource('branch-role', 'BranchRoleController');
	Route::GET('/datable_roles_list', 'RoleController@datable_roles_list')->name('datatable.get_roles');

	Route::resource('/users', 'UserController');
	Route::GET('/datatable_get_users', 'UserController@datatable_get_users')->name('datatable.get_users');
	// Route::POST('/realty/users/delete-users','UserController@delete_users');
	Route::GET('/users-chart', 'UserController@org_chart')->name('users.chart');
	Route::resource('/positions', 'PositionController');
	Route::get('/users-allowance/block-item/{id}', 'UserController@block_allowance')->name('users-allowance.block-item');


	//*************************************************************************************//
	//*********************************** Categories **************************************//
	//*************************************************************************************//
	Route::resource('/categories', 'CategoryController');
	Route::GET('/datatable_get_categories', 'CategoryController@datatable_get_categories')->name('datatable.get_categories');
	Route::POST('/categories-delete', 'CategoryController@destroy')->name('categories.delete');



	//*************************************************************************************//
	//*********************************** Sub Categories **************************************//
	//*************************************************************************************//
	Route::resource('/sub-categories', 'SubCategoryController');
	Route::GET('/datatable_get_sub_categories', 'SubCategoryController@datatable_get_sub_categories')->name('datatable.get_sub_categories');
	Route::GET('/sub-categories-delete/{id}', 'SubCategoryController@destroy')->name('sup_categories.delete');


	//*************************************************************************************//
	//*********************************** Item Group **************************************//
	//*************************************************************************************//
	Route::resource('/item-group', 'ItemGroupController');
	Route::GET('/datatable_get_item_group', 'ItemGroupController@datatable_get_item_group')->name('datatable.get_item_group');
	Route::POST('/item-group-delete', 'ItemGroupController@destroy')->name('item-group.delete');


	//*************************************************************************************//
	//*********************************** Item Zone **************************************//
	//*************************************************************************************//
	Route::resource('/item-zone', 'ItemZoneController');
	Route::GET('/datatable_get_item_zone', 'ItemZoneController@datatable_get_item_zone')->name('datatable.get_item_zone');
	Route::POST('/item-zone-delete', 'ItemZoneController@destroy')->name('item-zone.delete');



	// *********************************************************************************************
	// **********************************  Client  ***************************************
	Route::resource('/clients', 'ClientControler');
	Route::GET('/datatable_get_report_client', 'ClientControler@datatable_get_report_client')->name('datatable.get_report_client');
	Route::GET('/clients-prefix-address', 'ClientControler@client_prefixaddress');
	Route::GET('/clients-delete/{id}', 'ClientControler@destroy')->name('clients.delete');
	Route::GET('/view-client', 'ClientControler@view_client')->name('view.client');

	// *********************************************************************************************
	// **********************************  Client  ***************************************
	Route::resource('/clients-relationship', 'ClientRelationshipController');
	Route::GET('client-relationship/delete/{id}', 'ClientRelationshipController@destroy')->name('client-relationship.delete');
	Route::GET('/datatable-get-client-relationship', 'ClientRelationshipController@datatable_get_client_relationship')->name('datatable.get_client_relationship');
	Route::GET('/get-sale-client-relationship/{sale_id}','ClientRelationshipController@get_sale_client_relationship')->name('get_sale_client_relationship');
	Route::POST('/post-sale-client-relationship','ClientRelationshipController@post_sale_client_relationship')->name('post_sale_client_relationship');


	// *********************************************************************************************
	// **********************************  Supplier  ***************************************
	// Route::resource('/suppliers','SuppliersControler');
	// Route::GET('/datatable_get_report_supplier','SuppliersControler@datatable_get_report_supplier')->name('datatable.get_report_supplier');
	// Route::GET('/supplier-prefix-address','SuppliersControler@supplier_prefixaddress');

	// Supplier New Route
	Route::resource('supplier', 'SupplierController');
	Route::GET('/datatable_get_product_supplier', 'SupplierController@datatable_get_product_supplier')->name('datatable.get_product_supplier');


	//*************************************************************************************//
	//*********************************** Projct ******************************************//
	//*************************************************************************************//
	Route::resource('/projects', 'ProjectController');
	Route::GET('/datatable_get_projects', 'ProjectController@datatable_get_projects')->name('datatable.get_projects');
	Route::POST('/projects-delete', 'ProjectController@destroy')->name('projects.delete');


	//*************************************************************************************//
	//*********************************** Item ********************************************//
	//*************************************************************************************//
	Route::resource('/items', 'ItemController');
	Route::POST('/item-create-project','ItemController@create_project')->name("items.create_new_project");
	Route::POST('/item-create-category','ItemController@create_category')->name("items.create_category");
	Route::POST('/item-create-sub-category','ItemController@create_sub_category')->name("items.create_sub_category");
	Route::POST('/item-create-item_group','ItemController@create_item_group')->name("items.create_item_group");
	Route::POST('/item-create-item_zone','ItemController@create_item_zone')->name("items.create_item_zone");
	Route::GET('/form-create-condo','ItemController@create_condo')->name("items.create_condo");
	Route::POST('/save-create-condo','ItemController@save_create_condo')->name("items.save_create_condo");
	Route::POST('/get-zone-and-group-item','ItemController@itemproperty')->name('get-zone-and-group-item');
	Route::POST('/items-delete', 'ItemController@items_delete')->name('items_delete');
	Route::GET('/datatable_get_items', 'ItemController@datatable_get_items')->name('datatable.get_items');
	Route::GET('/items-booking/{id}', 'ItemController@items_booking')->name('items.booking');
	Route::POST('/items-booking-store', 'ItemController@items_booking_store')->name('items.booking_store');
	Route::GET('/items-prefix-code', 'ItemController@items_prefixcode')->name('items.prefixcode');
	Route::GET('/items-prefix-code-start', 'ItemController@items_prefixcode_start');
	Route::GET('/edit-multiple', 'ItemController@edit_multi')->name('items.edit-multiple');
	Route::POST('/update-multiple', 'ItemController@update_multi')->name('items.update-multiple');
	Route::GET('/get-commission/{id}', 'ItemController@ajax_get_project_commission');
	Route::GET('/edit-multiple-commission', 'ItemController@edit_multi_commission')->name('items.edit-multiple-commission');
	Route::POST('/edit_multi_commission_item', 'ItemController@update_commission')->name('items.update_commission');
	Route::GET('/get-commission-item/{id}{gid}{cat_code}{zoneid}', 'ItemController@edit_multi_commission_item');
	Route::GET('/items-get-group-house-code', 'ItemController@get_group_house_item')->name('items.get_group_house_item');

	Route::GET('/items-get-zone-house-code', 'ItemController@get_zone_house_item')->name('items.get_zone_house_item');

	Route::GET('/items-get-group-update-code', 'ItemController@get_group_update_item')->name('items.get_group_update_item');
	Route::GET('/items-get-group-code', 'LandItemController@get_group_item')->name('items.get_group_item');
	Route::GET('/items-get-sub-cat-item-name', 'LandItemController@get_sub_cat_item_name')->name('items.get_sub_cat_item_name');
	Route::GET('/get-commission-item-info/{id}', 'ItemController@edit_multi_commission_item_info');

	Route::GET('/updated-price-item-list', 'ItemController@updatedPriceList')->name('updated-price-item-list');
	Route::GET('/updated-commission-item-list', 'ItemController@updatedCommList')->name('updated-commission-item-list');

	Route::POST('/filter-item-properties', 'ItemController@filterItem')->name('filter-item-properties');
	Route::POST('filter-item-by-array-id', 'ItemController@filterByid')->name('filter-item-by-array-id');
	// Route::GET('/projects-delete/{id}','ProjectController@destroy')->name('projects.delete');
	///////////////////////////////////////////////// item land////////////////////////////////
	////////////////////////////////////////////////////////////////////////////////////////////

	// Route::get('/items-land','ItemController@create_land')->name('items-land.create');
	Route::resource('/items-land', 'LandItemController');

	//    transfer item
	Route::get('transfer-card-item/{id}', 'ItemController@add_transfer_cart')->name('add-to-cart-transfer');
	Route::DELETE('remove-transfer-card-item', 'ItemController@remove_transfer_cart')->name('transfer-remove-cart');
	Route::POST('transfer-filter-by-name', 'ItemController@filter_transfer')->name('transfer-item-filter-by-name');
	Route::POST('transfer-item', 'ItemController@tranfer')->name('transfer-item');
	Route::get('transfer_item', 'ItemController@transfer_item')->name('transfer_item');
	Route::get('get_item_by_project_id/{project_id}', 'ItemController@get_item_by_project_id');
	Route::post('transfer_item/store', 'ItemController@transfer_item_store')->name('transfer_item_store');
	Route::match(['get', 'post'], 'transfer-stock-to-inventory/{project_id?}/{item_name?}', 'ItemController@create_transfer')->name('transfer-stock-to-inventory');
	Route::get('transfer-inventory-stock', 'ItemController@start_transfer')->name('transfer-inventory-stock');
	Route::POST('store-transfer-inventory', 'ItemController@store_transfer')->name('store-transfer-inventory');
	Route::POST('filter-item-by-affect-properties', 'ItemController@affect_item')->name('filter-item-by-affect-properties');
	Route::GET('/filter-item-by-inventory/{id}', 'ItemController@filter_by_inventory')->name('filter-item-by-inventory');
	Route::GET('/search-items-by-arrayid/{id}', 'ItemController@search_arrayitem')->name('search-items-by-arrayid');

	Route::POST('filter-item-by-category', 'ItemController@filterByCategoryOrProject')->name('filter-item-by-category');
	Route::POST('filter-item-by-group', 'ItemController@filterByGrouporZone')->name('filter-item-by-group');
	//*************************************************************************************//
	//*********************************** Deposit *****************************************//
	//*************************************************************************************//
	Route::get('/report-stockin', 'ReportStockController@report_stockin')->name('report.stockin');
	Route::match(['GET', 'POST'], '/datatable-report-stockin', 'ReportStockController@datatable_get_stock_item');
	Route::POST('/report-stockin-print', 'ReportStockController@report_stockin_print');
	Route::get('/report-sale', 'ReportStockController@report_sale')->name('report.sale');
	Route::match(['GET', 'POST'], '/datatable-report-sale', 'ReportStockController@datatable_get_sale');
	Route::POST('/report-sale-print', 'ReportStockController@report_sale_print');

	//*************************************************************************************//
	//*********************************** Deposit *****************************************//
	//*************************************************************************************//
	Route::GET('/items-deposit/{status?}', 'SuperAdminDepositController@index')->name('items-deposit.index');
	Route::match(['GET','POST'],'/sale-promotion-list', 'SuperAdminDepositController@sale_promotion_list')->name('sale_promotion_list');
	Route::POST('/sale-promotion-give-to-client', 'SuperAdminDepositController@sale_promotion_give_to_client')->name('sale_promotion_give_to_client');

	Route::POST('/items-deposit-delete-pos', 'SuperAdminDepositController@delete_pos')->name('items-deposit.delete_pos');

	Route::GET('/show-contract-deposit/{sale_id}','SuperAdminDepositController@show_contract')->name('deposit.show_contract');
	Route::POST('/get_deposit_info','SuperAdminDepositController@get_deposit_info')->name("datatable.get_deposit_info");
	Route::GET('/items-deposit-show/{status?}', 'SuperAdminDepositController@show')->name('items-deposit-show.show');
	Route::GET('/datatable-get-client-deposit', 'SuperAdminDepositController@datatable_get_client_deposit')->name('datatable.get_client_deposit');
	Route::GET('/client-contract', 'SuperAdminDepositController@client_contract')->name('client-contract.client_contract');
	Route::match(['get','post'],'/datatable-get-client-contract', 'SuperAdminDepositController@datatable_get_client_contract')->name('datatable.get_client_contract');
	Route::get('/get-detail-deposit/{id}', 'SuperAdminDepositController@get_detail_client_deposit');
	Route::GET('/datatable_get__contract_detail/{id}', 'SuperAdminDepositController@datatable_get__contract_detail')->name('datatable.get_contract_detail');
	Route::GET('/report-booking', 'SuperAdminDepositController@report_booking')->name('report_booking.index');
	Route::match(['GET', 'POST'], '/datatable_get_report_booking', 'SuperAdminDepositController@datatable_get_report_booking')->name('datatable.get_report_booking');
	Route::POST('/report-view-deposit-print', 'SuperAdminDepositController@report_view_deposit_print');
	Route::GET('/view-client-installment/{id}', 'InstallmentController@view_client_installment')->name('view-client-installment.schedule');
	Route::GET('/view-client-contract/{id}', 'InstallmentController@pre_contract')->name('view-client-installment.contract');
	Route::GET('print-preview-schedule/{id}', 'InstallmentController@schedulePreview')->name('print-preview-schedule');
	Route::GET('/cancel-deposit', 'SuperAdminDepositController@index_cancellation')->name('cancel-deposit.index_cancellation');
	Route::match(['GET', 'POST'], '/datatable_get_cancel_deposit', 'SuperAdminDepositController@datatable_get_cancel_deposit')->name('datatable.get_cancel_deposit');
	Route::POST('/report-cancel-deposit-print', 'SuperAdminDepositController@report_cancel_deposit_print');

	Route::GET('/report-add-deposit', 'SuperAdminDepositController@report_add_deposit')->name('report_add_deposit.add_deposit');
	Route::match(['GET', 'POST'], '/datatable_get_report_add_deposit', 'SuperAdminDepositController@datatable_get_report_add_deposit')->name('datatable.get_report_add_deposit');
	Route::POST('/report-add-deposit-print', 'SuperAdminDepositController@report_add_deposit_print');

	Route::GET('/report-collect-deposit', 'SuperAdminDepositController@report_collect_deposit')->name('report_collect_deposit.index_collect_dposit');
	Route::match(['GET', 'POST'], '/datatable-get-report-collect-deposit', 'SuperAdminDepositController@datatable_get_report_collect_deposit')->name('datatable.get_report_collect_deposit');
	Route::GET('/report-collect-deposit-print', 'SuperAdminDepositController@update_multiple_collect_deposit')->name('multiple.report-collect-deposit-print');
	Route::GET('/report-collect-deposit-print', 'SuperAdminDepositController@update_multiple_collect_deposit')->name('multiple.report-collect-deposit-print');
	Route::POST('/print-deposit/store', 'SuperAdminDepositController@store_print')->name('print-deposit.store');

	Route::GET('/report-collect-deposit-to-print', 'SuperAdminDepositController@report_collect_deposit_to_print')->name('report_deposit_to_print.index_dposit_to_print');
	Route::match(['GET', 'POST'], '/datatable-get-report-deposit-to-print', 'SuperAdminDepositController@datatable_get_report_deposit_to_print')->name('datatable.get_report_deposit_to_print');
	Route::GET('/report-deposit-print/{code}', 'SuperAdminDepositController@collect_deposit_print')->name('collect.collect-deposit-print');
	Route::post('/delete-deposit-print', 'SuperAdminDepositController@delete_deposit_print')->name('delete_delete_deposit_print');
	// Route::GET('/report-client','SuperAdminDepositController@report_client')->name('report_client.index');
	// Route::GET('/datatable_get_report_client','SuperAdminDepositController@datatable_get_report_client')->name('datatable.get_report_client');

	Route::post('/pay-deposit-schedule', 'SuperAdminDepositController@pay_deposit')->name('deposit.pay_deposit');
	Route::post('/delete-deposit-schedule', 'SuperAdminDepositController@delete_deposit_schedule')->name('deposit.delete_deposit_schedule');

	// *********************************************************************************************
	// **********************************  Request Latter  ***************************************

    Route::GET('/request-show-latter1','RequestLatterController@request_show_latter1')->name('request.show_latter1');
    Route::GET('/request-show-latter2','RequestLatterController@request_show_latter2')->name('request.show_latter2');
    Route::GET('/request-show-latter3','RequestLatterController@request_show_latter3')->name('request.show_latter3');
    Route::GET('/request-show-latter4','RequestLatterController@request_show_latter4')->name('request.show_latter4');

	// *********************************************************************************************
	// **********************************  Property Feature  ***************************************

	Route::resource('/accessories', 'AccessoriesController');
	Route::GET('/datatable_get_accessories', 'AccessoriesController@datatable_get_accessories')->name('datatable.get_accessories');
	Route::POST('/accessories-delete/{id}', 'AccessoriesController@delete_accessories')->name('accessories.delete');

	// *********************************************************************************************

	// Change Status
	Route::POST('/change-status-position/{id}', 'ChangeStatusController@change_status_position')->name('change-status.position');


	//***********************************************//
	//************ Multiple Update Status *********************//
	//***********************************************//
	Route::POST('/withdraw-proccess-pay', 'MultipleUpdateStatusController@withdraw_proccess_pay')->name('multiple.withdraw-proccess-pay');
	Route::delete('/register-approved-rejected', 'MultipleUpdateStatusController@register_approved_rjected')->name('multiple.register-approved-rejected');



	//***********************************************//
	//************Subordinate*********************//
	//***********************************************//
	//	Route::resource('/subordinate','SubordinateController');

	//***********************************************//
	//************Subordinate*********************//
	//***********************************************//
	// Route::resource('/super-admin-agency-group', 'SuperAdminAgencyGroup');


	Route::resource('/super-admin-agency', 'SuperAdminAgency');
	Route::GET('/super-admin-agencies-list', 'SuperAdminAgency@agencies_list')->name('agencies.list');
	Route::GET('/super-admin-agencies-group-list', 'SuperAdminAgency@agencies_group_list')->name('agencies-group.list');
	// Route::GET('/super_amdin_datatable_get_agencies_list','SuperAdminAgency@datatable_agencies_list')->name('super_admin_datatable_agencies.list');
	Route::POST('/realty/super-admin/agencies-list/{id}', 'SuperAdminAgency@delete_agency');
	Route::GET('/realty/super-admin/agencies-view/{id}', 'SuperAdminAgency@popup_view_agency');
	Route::POST('/get-agent-type', 'SuperAdminAgency@get_agent_type')->name('get_agent_type');
	Route::POST('/get-agent-sponsor-type', 'SuperAdminAgency@get_agent_sponsor_type')->name('get_agent_sponsor_type');
	Route::POST('/get-bank-agency', 'SuperAdminAgency@get_bank_agency')->name('get_bank_agency');


	//***********************************************//
	//************Request Deposit*********************//
	//***********************************************//
	Route::GET('/account-funds-requested-deposite/{status?}', 'FundsTransactionController@account_funds_requested_deposite')->name('account-funds-requested.deposite');
	Route::POST('/funds-requested-deposite-print', 'FundsTransactionController@funds_requested_deposite_print');
	Route::match(['GET', 'POST'], '/datatable_get_funds_request_add', 'FundsTransactionController@datatable_get_funds_request_add');
	Route::get('/get-agency-account-fund-info/{id}', 'FundsTransactionController@AgencyFundAccount')->name('get-agency-account-fund-info');
	Route::POST('add-deposit-manually-to-agency', 'FundsTransactionController@addFundManually')->name('add-deposit-manually-to-agency');
	Route::POST('/approve-funds-request-add/{id}/{amount}/{to_account}', 'FundsTransactionController@approve_funds_request_add');
	Route::POST('/reject-funds-request-add/{id}', 'FundsTransactionController@reject_funds_request_add');
	Route::POST('/withdraw-fund-manually-from-agency', 'FundsTransactionController@withdrawMannually')->name('withdraw-fund-manually-from-agency');
	/**
	 *	Display view request withdraw
	 */

	Route::GET('/withdraw-funds-requested/{status?}', 'FundsTransactionController@request_withdraw_view')->name('funds.request_withdraw_view');
	Route::POST('/withdraw-funds-requested-print', 'FundsTransactionController@request_withdraw_print');
	Route::match(['get', 'post'], '/datatable_get_funds_request_withdrawal', 'FundsTransactionController@datatable_get_funds_request_withdrawal');
	Route::POST('/withdraw-approve', 'FundsTransactionController@withdraw_approve_pay')->name('withdraw.approve');
	Route::POST('/withdraw-reject', 'FundsTransactionController@withdraw_reject');
	Route::POST('/query-similar-account-number', 'FundsTransactionController@query_accountNumber')->name('query-similar-account-number');

	//***********************************************//
	//************Register Funds*********************//
	//***********************************************//
	Route::GET('/account-funds-register/{status?}', 'FundsTransactionController@account_funds_request')->name('register.funds');
	Route::GET('/datatable_get_funds_request_account', 'FundsTransactionController@datatable_get_funds_request_account')->name('datatable.get_funds_request_account');
	Route::POST('approve-funds-register/{id}', 'FundsTransactionController@approve_funds_register');
	Route::POST('reject-funds-register/{id}', 'FundsTransactionController@reject_funds_register');

	//***********************************************//
	//************history*********************//
	//***********************************************//
	Route::GET('/history-fundstransation', 'FundsTransactionController@history_fundstransation')->name('funds.history');
	Route::match(['get', 'post'], '/datatable_get_history_funds', 'FundsTransactionController@datatable_get_history_funds')->name('datatable.get_histroy_funds');
	Route::POST('/history-funds-print', 'FundsTransactionController@history_funds_print');

	/**
	 *	Report Commission ReportCommissionController
	 */
	Route::resource('/reports-commission', 'ReportCommissionController');
	Route::match(['get', 'post'], '/datatable_get_reports_commission', 'ReportCommissionController@datatable_get_report_commission');
	Route::POST('/reports-commission-report-print', 'ReportCommissionController@report_commission_print');
	/**
	 *	Account Type & Account Chart
	 */
    Route::resource('/account-type', 'AccountTypeController');
	Route::GET('/account-type', 'AccountTypeController@account_type')->name('account.type');
	Route::resource('/account-chart', 'AccountChartController');
	Route::GET('/datatable_get_account_chart', 'AccountChartController@datatable_get_account_chart')->name('datatable.datatable_get_account_chart');
    Route::get('get-account-code/{id}', 'AccountChartController@get_acc_code')->name('get-account-code');
	/**
	 *	Account Type
	 */
	Route::resource('/libility', 'LibilityController');
	Route::GET('/datatable_get_libility', 'LibilityController@datatable_get_libility')->name('datatable.datatable_get_libility');
	Route::GET('/libility-report', 'LibilityController@report')->name('libility.report');
	Route::POST('/libility-report-print', 'LibilityController@report_print');
	Route::match(['GET', 'POST'], 'datatable-libility-report', 'LibilityController@datatable_libility_report');
	/**
	 *	withdraw condition
	 */
	Route::resource('commission-condition', 'CommissionConditionController');
	Route::get('/get-commission-condition', 'CommissionConditionController@get_data')->name('get-commission-condition');
	Route::get('/condition-status/update/{id}', 'CommissionConditionController@update_status')->name('update-condition-status');
	/**
	 *	withdraw condition one
	 */
	Route::get('commission-condition-one', 'CommissionConditionController@index_one_condition')->name('commission-condition-one');
	Route::post('add-commission-condition-one', 'CommissionConditionController@store_one_condition')->name('add-commission-condition-one');
	Route::get('edit-commission-condition-one/{id}', 'CommissionConditionController@update_one_condition')->name('edit-commission-condition-one');
	Route::get('/get-commission-condition-one', 'CommissionConditionController@get_data_one_condition')->name('get-commission-condition-one');
	Route::get('/condition-status/update/{id}', 'CommissionConditionController@update_status')->name('update-condition-status');
	/**
	 *	Capital Controller
	 */

	Route::resource('/accouting-capital', 'CapitalController');
	// Capital List
	Route::GET('/accounting-capital', 'CapitalController@get_capital_list')
		->name('datatable.get_capital_list');
	/**
	 *	Income  Controller
	 */
	Route::resource('/accouting-income', 'IncomeController');
	// Capital List
	Route::GET('/accounting-income', 'IncomeController@get_income_list')
		->name('datatable.get_income_list');
	/**
	 *	Expense Controller
	 */
	Route::resource('/accouting-expense', 'ExpenseController');
	// Capital List
	Route::GET('/accounting-expense', 'ExpenseController@get_expense_list')
		->name('datatable.get_expense_list');
	/**
	 *	Withdrawal Controller
	 */
	Route::resource('/accouting-withdrawal', 'WithdrawalController');
	Route::GET('/accounting-withdrawal', 'WithdrawalController@get_withdrawal_list')
		->name('datatable.get_withdrawal_list');

	////////////////////// Withdrawal Funds /////////////////////
	Route::resource('/accouting-withdrawal-funds', 'WithdrawalFundsController');
	Route::match(['get', 'post'], '/accounting-withdrawal-fund', 'WithdrawalFundsController@get_withdrawal_funds')->name('datatable.get_withdrawal_fund');

	Route::POST('/account-withdrawal-print', 'WithdrawalFundsController@account_withdrawal_print');
	Route::POST('/withdraw-proccess', 'WithdrawalFundsController@withdraw_proccess');


	/**
	 *	IncomeStatement Controller
	 */

	Route::resource('/accouting-income-statement', 'IncomeStatementController');
	Route::POST('/accouting-income-statement-search', 'IncomeStatementController@filter_income_statement');

	/**
	 *	Account Payable
	 */
	Route::resource('/accounting-payable', 'AccountPayableController');
	Route::GET('/datatable_get_payable', 'AccountPayableController@datatable_get_payable')->name('datatable.datatable_get_payable');
	Route::get('account-payable-record/{id}', 'AccountPayableController@ajax_get_payable');
	Route::post('/ajax-account-payable', 'AccountPayableController@refund')->name('submit_ajax_refund');
	Route::GET('/report-account-payable', 'AccountPayableController@report')->name('report_account_payable');
	Route::POST('/report-account-payable-print', 'AccountPayableController@report_print');
	Route::match(['get', 'post'], '/get-report-account-payable', 'AccountPayableController@get_report');

	/**
	 *	MENG Note Receivable In Accounting
	 */
	Route::resource('/accounting-note-receivable', 'ReceivableNoteController');
	Route::match(['get', 'post'], '/report-note-receivable-accounting', 'ReceivableNoteController@get_report');
	Route::match(['get', 'post'], '/report-note-payable-branch-accounting', 'ReceivableNoteController@get_report_branch');
	Route::POST('/report-note-receivable-print', 'ReceivableNoteController@report_receivable_note_print');
	Route::POST('/report-note-payable-branch-print', 'ReceivableNoteController@report_payable_note_branch_print');
	Route::GET('/accounting-payable-note-branch', 'ReceivableNoteController@payable_note_branch')->name('accounting_payable_note_branch');


	Route::GET('/report-receivable-note-branch', 'OperationController@report_receivable_note_branch')->name('report-receivable-note-branch');
	Route::match(['get', 'post'], '/get-report-receivable-note-branch', 'OperationController@get_report_receivable_note_branch');
	Route::POST('/get-report-receivable-note-branch-print', 'OperationController@get_report_receivable_note_branch_print');
	Route::match(['get','post'],'sale-report-by-agent','OperationController@salereport')->name('sale-report-by-agent');
	/**
	 *	Add Shared Commission
	 */
	Route::POST('add-shared-commission/store', 'OperationController@store_shared_commission')->name('add-shared-commission.store');
	Route::POST('agency-withdrawal-commission', 'OperationController@store_withdrawal_commission')->name('agency-withdrawal-commission');
	Route::get('get-commission-info/{id}', 'OperationController@get_commission_info')->name('get-commission-info');
	Route::get('commission-info/{sale_id}', 'OperationController@commission_info')->name('commission-info');
	Route::POST('/update-commission-list', 'OperationController@updateCommissionList')->name('update-commission-list');
	Route::POST('/print-panding-client-payment', 'OperationController@printPandingPayment')->name('print-panding-client-payment');
	/**
	 *	Capital Controller
	 */
	Route::GET('/report-accouting-capital', 'CapitalController@report')
		->name('report_accounting_capital');
	// Capital List
	Route::match(['GET', 'POST'], '/report-accounting-capital', 'CapitalController@get_report_capital_list');
	Route::POST('/report-print-accounting-capital', 'CapitalController@get_report_capital_list_print');
	/**
	 *	Income Controller
	 */
	Route::GET('/report-accouting-income', 'IncomeController@report')
		->name('report_accounting_income');
	Route::POST('/report-accounting-income-print', 'IncomeController@report_print');
	// Capital List
	Route::match(['GET', 'POST'], '/report-accounting-income', 'IncomeController@get_report_income_list');
	/**
	 *	Expense Controller
	 */
	Route::GET('/report-accouting-expense', 'ExpenseController@report')->name('report_accounting_expense');
	Route::POST('/report-accouting-expense-print', 'ExpenseController@report_print');
	// Capital List
	Route::match(['GET', 'POST'], '/report-accounting-expense', 'ExpenseController@get_report_expense_list');
	/**
	 *	Withdrawal Controller
	 */
	Route::GET('/report-accouting-withdrawal', 'WithdrawalController@report')->name('report_accounting_withdrawal');
	Route::POST('/report-accouting-withdrawal-print', 'WithdrawalController@report_print');
	// Capital List
	Route::match(['GET', 'POST'], '/report-accounting-withdrawal', 'WithdrawalController@get_report_withdrawal_list');
	/**
	 *	Cash On Hand Controller
	 */
	Route::GET('/report-account-cash-on-hand', 'CashOnHandController@report')->name('report_accounting_cash_on_hand');
	Route::POST('/report-account-cash-on-hand-print', 'CashOnHandController@report_print');
	// Cash On Hand List
	Route::match(['get', 'post'], '/report-accounting-cash-on-hand', 'CashOnHandController@get_report_cash_on_hand_list')->name('report-cash-on-hand.accounting');


	/**
	 *	Cash flow report
	 */
	Route::GET('/report-account-cash-flow', 'CashOnHandController@report_cash_flow')->name('report_accounting_cash_flow');
	// Cash flow List
	Route::match(['get', 'post'], '/report-accounting-cash-flow-lish', 'CashOnHandController@get_report_cash_flow_list');

	Route::POST('/report-account-cash-flow-print', 'CashOnHandController@report_cash_flow_print');

	/**
	 *	report arrear
	 */
	Route::GET('/report-arrear', 'ReportArrearController@report_arrear')->name('report_arrear_index');
	// Cash flow List
	Route::match(['get', 'post'], '/report-arrear-lish', 'ReportArrearController@get_report_arrear_list')->name('report-arrear-lish');

	Route::POST('/report-arrear-print', 'ReportArrearController@report_arrear_print');

	/**
	 *	MENG Report Operation
	 */
	Route::get('/report-commission-list', 'OperationController@report_commis')->name('report_commission_index');
	Route::get('/get-report-commission-list', 'OperationController@get_report_commis')->name('get-report_commission_index');

	Route::get('/report-com-network-list', 'OperationController@report_com_network_index')->name('report_commission_network_index');
	Route::get('/get-report-com-network-list', 'OperationController@get_report_com_network_index')->name('get-report_commission_network_index');
	Route::get('/get-view-com-network-detail/{id}', 'OperationController@get_view_commission_network_detail')->name('get-view_commission_network_detail');
	Route::get('/get-view-com-group-detail/{id}', 'OperationController@get_view_commission_group_detail')->name('get-view_commission_group_detail');
	/**
	 *	Report All Payment to Collect
	 */

	Route::GET('/index-report-deposit',"OperationController@report_deposit")->name('deposit_report.report_deposit');
	Route::GET('/get-data-report-deposit','OperationController@get_data_report_deposit')->name('deposit_report.get_data_report_deposit');
	Route::POST('/print-report-deposit','OperationController@print_report_deposit')->name('deposit_report.print_report_deposit');

	Route::GET('/all-payment-to-collect', 'OperationController@all_payment_to_collect')->name('all_payment_to_collection');
	Route::match(['get', 'post'], '/report-all-payment-to-collect', 'OperationController@report_all_payment_to_collect')->name('report-all-payment-to-collection');
	Route::POST('/report-all-payment-to-collection-print', 'OperationController@report_all_payment_to_collection_print');
	/**
	 *	Report Payment Collection
	 */
	Route::GET('/payment-collection', 'OperationController@payment_collection')->name('payment_operation_collection');
	Route::match(['get', 'post'], '/report-payment-collection', 'OperationController@report_collection')->name('report-payment-collection');
	Route::POST('/report-payment-collection-print', 'OperationController@report_collection_print');
	/**
	 *	Report Payment Collected
	 */
	Route::GET('/payment-collected', 'OperationController@payment_collected')->name('payment_operation_collected');
	Route::match(['get', 'post'], '/report-payment-collected', 'OperationController@report_collected')->name('payment_operation_collected_list');
	Route::POST('/report-payment-collected-print', 'OperationController@report_collected_print');
	/**
	 *	Report Payment Completed
	 */
	Route::GET('/payment-completed', 'OperationController@payment_completed')->name('payment_operation_completed');
	Route::match(['get', 'post'], '/report-payment-completed', 'OperationController@report_completed')->name('report-payment-completed');
	Route::POST('/report-payment-completed-print', 'OperationController@report_completed_print');
	/**
	 *	Report Client Payment
	 */
	Route::GET('/payment-client', 'OperationController@payment_client')->name('payment_operation_client');
	Route::match(['get', 'post'], '/report-payment-client', 'OperationController@report_client_payment')->name('report-payment-client');
	Route::POST('/report-payment-client-print', 'OperationController@report_client_payment_print');

	/**
	 *	Report Sale transfer ownership
	 */
	Route::GET('/payment-client-transfer-ownership', 'OperationController@payment_client_transfer_ownership')->name('payment_client_transfer_ownership');
	Route::match(['get', 'post'], '/report-payment_client_transfer_ownership', 'OperationController@report_payment_client_transfer_ownership')->name('report-payment_client_transfer_ownership');
	Route::POST('/report-payment_client_transfer_ownership-print', 'OperationController@report_payment_client_transfer_ownership_print');
	/**
	 *	Report Payment Cancellation
	 */
	Route::get('/payment-canceled', 'OperationController@payment_cancellation')->name('payment_operation_cancellation');
	Route::match(['get', 'post'], '/get-payment-canceled', 'OperationController@get_payment_cancellation')->name('get_payment_operation_cancellation');

	/**
	 *	Agency Commission
	 */

	Route::get('share-commission-detail/{id}', 'OperationController@commission_detail')->name('shared-commission-detail');
	Route::get('get-shared-commission-detail', 'OperationController@get_commission_detail')->name('get-commission-detail');
	/**
	 *	Schedule
	 */
	Route::GET('/schedule-client-payment/{id}', 'ReportClientPaymentController@schedule')->name('schedule-client-payment.schedule');
	Route::GET('/contract-client-payment/{id}', 'ReportClientPaymentController@contract')->name('contract-client-payment.contract');
	Route::GET('/contract-client-payment-step/{id}', 'ReportClientPaymentController@contract_step')->name('contract-client-payment-step.contract');

	/**
	 *	Installment
	 */
	Route::GET('/making-client-installment/{client_id?}/{sale_id?}', 'InstallmentController@create')->name('making-clients.installment');
	Route::GET('/get-client-installment/info/{id}', 'InstallmentController@client_info')->name('get-client-installment.info');
	Route::GET('/get-installment-details/{sale_id}/{client_id}', 'InstallmentController@show')->name('installment.show');
	Route::GET('get-payment-policy-info/{id}','InstallmentController@get_payment_policy_detail')->name('installment.get_payment_policy_detail');
	/**
	 *	Reschedule
	 */
	Route::resource('/reschedule-client-payment', 'RescheduleController');
	Route::GET('/client-reschedule-payment/{loan_id?}/{sale_id?}', 'RescheduleController@create')->name('client_payment_reschedule');
	Route::POST('/approve-client-reschedule-payment', 'RescheduleController@approve_reschedule')->name('approve_reschedule');
	Route::GET('/get-payment-policy-detail/{id}',"RescheduleController@get_payment_policy_detail")->name('get_payment_policy_detail');
	/**
	 *	Cancel
	 */
	Route::resource('bank-agency', 'BankAgencyController');
	Route::resource('bank-account', 'BankAccountController');
	//	Approve Client Payment accounting report
	Route::get('report-approve-payment', 'JournalAccountingReport@report_approve_client_payment')->name('report_approve_payment');
	Route::POST('print-approve-client-payment', 'JournalAccountingReport@printApprovePayment')->name('print-approve-client-payment');
	Route::match(['GET', 'POST'], '/get-report-approve-payment', 'JournalAccountingReport@get_report_payment');
	Route::match(['GET', 'POST'], '/get-report-approve-client-payment', 'JournalAccountingReport@approve_list')->name('approve-client-payments-list');
	Route::POST('run-audit/payment', 'JournalAccountingReport@audit_clientpayment')->name('run-audit.payment');
	//  end
	Route::GET('/client-deposit-cancel/{sale_id}', 'InstallmentController@cancel')->name('client-deposit.cancel');
	Route::POST('/client-deposit-view', 'InstallmentController@UpdateClient')->name('client-deposit.update_client');
	Route::PATCH('/installlment/update/{id}', 'InstallmentController@update_installment')->name('installment.update');
	/**
	 *	MENG Store Installment
	 */
	Route::resource('/payment-installment', 'InstallmentController');
	Route::post('/approve-instalment', 'InstallmentController@approve_store_instalment')->name('instalment.approve_store_instalment');

	Route::get('/get-installment-info/{id}', 'InstallmentController@get_installment_info')->name('get-installment-info');
	//request cancel payment
	Route::get('/request-cancel-payment/{loan_id}', 'ClientPaymentController@request_cancel')->name('request-cancel-payment');
	Route::get('/reject-cancel-payment/{loan_id}', 'ClientPaymentController@reject_cancel')->name('reject-cancel-payment');
	Route::get('/approve-cancel-payment/{loan_id}', 'ClientPaymentController@approve_cancel')->name('approve-cancel-payment');
	Route::get('/change-item/{id?}','ClientPaymentController@change_item')->name('change_item');
	Route::get('/add-change-item-to-cart','ClientPaymentController@get_item_for_change')->name('get_item_for_change');
	Route::post('/add-change-item-to-cart','ClientPaymentController@change_item_add_to_cart')->name('change_item_add_to_cart');
	Route::post('/remove-change-item-to-cart','ClientPaymentController@change_item_remove_to_cart')->name('change_item_remove_to_cart');
	Route::post('/loan-transfer-ownership','ClientPaymentController@transfer_ownership')->name('transfer_ownership');
	Route::post('/set-date-loan-transfer-ownership','ClientPaymentController@set_date_transfer_ownership')->name('set_date_transfer_ownership');
	/**
	 *	Operation Client Payment
	 */
	Route::GET('/clearcache', function () {
		$exitCode = Artisan::call('cache:clear');
		return redirect()->back()->with('success', 'Cached Clear');
	});
	Route::GET('/commission-info/detail/{sale_id}', 'ClientPaymentController@commission_detail')->name('commission-info.detail');
	Route::resource('/client-payment-list', 'ClientPaymentController');
	Route::resource('/sale-list', 'SaleController');
	Route::GET('/client-payment-list-company/{id}', 'ClientPaymentController@get_index_company')->name('datatable.index_company_list');
	Route::GET('/get-client-payment-list-company', 'ClientPaymentController@get_index_company_list')->name('datatable.get_index_company_list');
	Route::GET('/get-client-payment-list', 'ClientPaymentController@get_client_payment_list')->name('datatable.get_client_payment_list');
	Route::GET('/get-view-cancel-client-payment/{loan_id}', 'ClientPaymentController@get_view_cancel_client_payment')->name('datatable.get_view_cancel_client_payment');
	Route::GET('/get-client-purchase-list', 'ClientPaymentController@get_client_purchase_list')->name('datatable.get_client_purchase_list');
	Route::GET('/get-client-purchase-prince-invoice/{id}', 'ClientPaymentController@client_purchase_list_print_invoice')->name('get_client_purchase_prince_invooice');
	Route::GET('/datatable-client-payment/{id}', 'ClientPaymentController@get_client_payment_process')->name('datatable.get_client_payment_process');
	//get commission for add commssion to agent
	Route::GET('/get-commission-by-agent-network', 'ClientPaymentController@get_commission')->name('get_commission_network');
	Route::POST('/get-commission-by-agent-network-condition', 'ClientPaymentController@get_commission_condition')->name('get_commission_network_condition');
	Route::GET('/delete-client-payment/loan-process/{id}', 'ClientPaymentController@delete_loan_process')->name('delete-client-payment.loan-process');
	Route::resource('payoff-loan','PayoffController');
	/**
	 *	Ajax Get Data
	 */
	Route::get('payment-loan-process/{id}', 'ClientPaymentController@ajax_get_payment_process');
	/**
	 *	Ajax Get Data
	 */
	/**
	 *	Maintenance House
	 */
    Route::resource('/maintenance-list', 'MaintenanceController');
    Route::GET('/get-client-maintenance-list', 'MaintenanceController@get_client_maintenance_list')->name('get_client_maintenance_list');
    Route::GET('/client-maintenance-generate/{loan_id?}/{sale_id?}', 'MaintenanceController@client_maintenance_generate')->name('client_maintenance_generate');
    Route::GET('/contract-maintenance-client-payment/{id}', 'MaintenanceController@contract_maintenance')->name('contract-maintenance-client-payment');
    Route::GET('/client-maintenance-payment/{id}', 'MaintenanceController@get_client_maintenance_process')->name('get_client_maintenance_process');
    Route::get('payment-maintenance-process/{id}', 'MaintenanceController@ajax_get_payment_process');
    Route::post('/payment-operation-maintenance', 'MaintenanceController@payment')->name('submit_payment_maintenance');
	Route::GET('/get-client-maintenance-payment-prince-invoice/{id}', 'MaintenanceController@client_maintenance_payment_print_invoice')->name('client_maintenance_payment_print_invoice');
	
	Route::GET('/contract-maintenance-client-free/{id}', 'MaintenanceController@contract_maintenance_fee')->name('contract-maintenance-client-fee');
    /**
	 *	Ajax Get Data
	 */
	/**
	 *	Ajax Get Data deposit and save deposit
	 */
	Route::get('get-deposit/{id}', 'SuperAdminDepositController@ajax_get_deposit');
	Route::get('approve-deposit/{id}', 'SuperAdminDepositController@ajax_get_deposit_approve');
	Route::post('/insert-deposit', 'SuperAdminDepositController@insert_deposit')->name('submit_deposit_data');
	Route::POST('/insert-deposite-downpayment', 'SuperAdminDepositController@store_deposit')->name('submit_deposit_on_downpayment');
	Route::post('/approve-insert-deposit', 'SuperAdminDepositController@approve_insert_deposit')->name('approve_submit_deposit_data');
	Route::post('/reject-insert-deposit', 'SuperAdminDepositController@reject_insert_deposit')->name('reject_submit_deposit_data');


	/**
	 *	Ajax Get Data deposit
	 */
	Route::get('available-commission-receivable/{id}', 'ReceivableNoteController@get_available_commission_by_project');
	/**
	 *	Payment
	 */
	Route::post('/payment-operation-pay', 'ClientPaymentController@payment')->name('submit_payment_data');
	/**
	 *	Cancel deposit
	 */
	Route::post('/client-cancel-deposit', 'InstallmentController@agree_cancel')->name('client_agree_cancel_deposit');

	// approve cancel deposit
	Route::post('/approve-client-cancel-deposit', 'InstallmentController@approve_agree_cancel')->name('approve_agree_cancel');

	//reject approve cancel deposit

	Route::post('/reject-client-cancel-deposit', 'InstallmentController@reject_agree_cancel')->name('reject_agree_cancel');

	/**
	 *	Approve deposit
	 */
	Route::post('/approve-deposit', 'InstallmentController@agree_approve')->name('admin_approve_deposit');
	/**
	 *	Get loan record where id
	 */
	Route::get('/get-loan-info-record/{id}', 'ClientPaymentController@get_loan_info_record');
	/**
	 *	Pay off
	 */
	Route::post('/client-payment-payoff', 'ClientPaymentController@client_payment_payoff')->name('set_client_payment_payoff');
	//get down payment
	Route::GET('/get-deposite/{id}', 'ClientPaymentController@get_downpayment')->name('get-down-payment');

	// reject and approve deposite on down payment
	Route::get('/approve-deposite/down-payment/{id}', 'ClientPaymentController@approve_deposite')->name('downpayment.approve-deposite');
	Route::get('/reject-deposite/down-payment/{id}', 'ClientPaymentController@reject_deposite')->name('downpayment.reject-deposite');
	// request to add commission to agent
	Route::POST('/request-add-commission/to-agent', 'ClientPaymentController@add_agent_commission')->name('add_agent_commission');
	Route::GET('/query-commission-amount/{id}', 'ClientPaymentController@get_commission_amount')->name('get_commission_amount');
	// reject and approve commission
	Route::POST('/approve-request-commission-agent', 'ClientPaymentController@approve_commission')->name('approve-request-commission.agent');
	Route::POST('/reject-request-commission-agent', 'ClientPaymentController@reject_commission')->name('reject-request-commission.agent');
	Route::GET('/report-reject-payment', 'ClientPaymentController@rejectClientPayment')->name('report_reject_payment');
	Route::GET('/print-rejected-client-payment', 'ClientPaymentController@printrejectedClientPayment')->name('print-rejected-client-payment');

    Route::POST('/change-client','ClientPaymentController@change_client')->name('add_change_client');
    Route::GET('/get-data-loan-with-bank','ClientPaymentController@get_data_client_loan_bank')->name('get_data_client_loan_bank');
    Route::POST('/get-follow-up-with-bank','ClientPaymentController@get_follow_up')->name('get_follow_up');
    Route::POST("/follow-up-change-status",'ClientPaymentController@save_follow_up_status')->name('save_follow_up_status');
    Route::GET("/follow-up-document",function (){
        $file= public_path(). "/images/upload/image.jpg";
        $type = \File::extension("image.jpg");
        $headers = array(
            'Content-Type: application/'.$type,
        );
        return \Response::download($file, 'my-filename'.'.'.$type,$headers);
    })->name('getDownload');
    Route::POST('/post-upload-image','ClientPaymentController@save_upload_image')->name("save_upload_image");
    Route::GET('/show-upload-image/{id}','ClientPaymentController@show_upload_image')->name("show_upload_image");

	Route::GET('/reschedule-payment-check-no-payment-approve-cash/{id}','ClientPaymentController@check_nonepayment_approve_cash')->name('reschedule.check_nonepayment_approve_cash');
	/**
	 *
	 *	External
	 *
	 */
	//	client payment pending
	Route::get('/client-payment-pending', 'ClientPaymentController@client_payment_index')->name('client_payment_pending');
	Route::get('/datatable-client-payment-pending', 'ClientPaymentController@client_payment_pending')->name('datatable_client_payment_pending');
	Route::get('/get-payment-pending-ajax', 'ClientPaymentController@get_payment_pending_ajax')->name('get_payment_pending_ajax');
	Route::post('/approve-payment', 'ClientPaymentController@approve_client_payment')->name('approve_client_payment');
	Route::resource('/agency-team', 'AgencyTeamController');
	Route::POST('reject-client-payment', 'ClientPaymentController@rejectPayment')->name('reject_client_payment');

    Route::get('/approve-booking-pending', 'ClientPaymentController@approve_booking_pending')->name('approve_booking_pending');
    Route::get('/datatable-client-payment-booking', 'ClientPaymentController@client_payment_booking')->name('datatable_client_payment_booking');
    Route::post('/approve-payment-booking', 'ClientPaymentController@approve_client_payment_booking')->name('approve_client_payment_booking');

    Route::get('/approve-deposit-pending', 'ClientPaymentController@approve_deposit_pending')->name('approve_deposit_pending');
    Route::get('/datatable-client-payment-deposit', 'ClientPaymentController@client_payment_deposit')->name('datatable_client_payment_deposit');
    Route::post('/approve-payment-deposit', 'ClientPaymentController@approve_client_payment_deposit')->name('approve_client_payment_deposit');
    //  end
	Route::resource('external-deposit-list', 'ExternalDepositController');
	Route::GET('/request-cancel-deposit/{id}','ExternalDepositController@cancelrequest')->name('request-cancel-deposit');
	Route::POST('/pos-filter-by-name-edit', 'ExternalDepositController@search')->name('pos-filter-by-name-edit');
	Route::get('get-exteranl-deposit-list-datatable', 'ExternalDepositController@datatable_get_external_deposit')->name('datatable.get_external_deposit');
	Route::get('view-deposit-info/{id?}/edit', 'ExternalDepositController@view_deposit_info')->name("deposit.view_deposit_info");
	Route::post('edit-deposit-info/{id}', 'ExternalDepositController@update_info')->name("deposit.update_info");
	Route::post('deposit-delete', 'ExternalDepositController@delete_deposit')->name("deposit.delete_deposit");
	Route::get('view-approve-edit-pos/{id}', 'ExternalDepositController@view_before_update_deposit_info')->name('deposit.view_before_update_deposit_info');
	Route::PATCH('approve-edit-pos/{id}', 'ExternalDepositController@approve_update_info')->name('deposit.approve_update_info');
	Route::post('approve-delete-pos', 'ExternalDepositController@approve_delete_deposit')->name('deposit.approve_delete_deposit');
	Route::post('reject-edit-deposit', 'ExternalDepositController@reject_update_info')->name('deposit.reject_update_info');
	Route::post('reject-delete-deposit', 'ExternalDepositController@reject_delete_info')->name('deposit.reject_delete_info');
	Route::POST('reject-client-installment', 'ExternalDepositController@reject_installment')->name('instalment.reject_store_installment');

	Route::resource('external-client-list', 'ExternalClientController');
	Route::match(['GET', 'POST'], '/get-exteranl-client-list-datatable', 'ExternalClientController@get_external_client_list')->name('datatable.get_external_client_list');
	Route::POST('/report-client-list-print', 'ExternalClientController@report_client_list_print');
	
	Route::resource('external-payment-list', 'ExternalPaymentController');
	Route::get('get-exteranl-payment-list-datatable', 'ExternalPaymentController@datatable_get_external_payment')->name('datatable.get_external_payment');


	Route::GET('external-admin-commission', 'ExternalAdminCommissionController@index')->name('external-admin-commission.index');
	Route::match(['GET', 'POST'], '/get-exteranl-commission-list-datatable', 'ExternalAdminCommissionController@datatable_get_external_commission')->name('datatable.get_external_commission');
	Route::POST('/report-commission-po-print', 'ExternalAdminCommissionController@report_commision_po_print');

	Route::GET('external-commission-project-owner-history', 'ExternalAdminCommissionController@commission_project_owner_history')->name('commission_project_owner_history');
	Route::match(['GET', 'POST'], '/get-commission-project-owner-history-datatable', 'ExternalAdminCommissionController@datatable_get_commission_project_owner_history')->name('datatable_get_commission_project_owner_history');
	Route::POST('/report-commission-po-history-print', 'ExternalAdminCommissionController@report_commission_project_owner_history_print');
	/**
	 * Ajax query client name
	 */
	Route::get('get-search-client-name', 'ExternalPaymentController@get_client_name');


	/**
	 * Report First Payment + Deposit >= 50%
	 */
	Route::GET('report-first-payment-plus-deposit', 'ExternalAdminCommissionController@index_fd')->name('index-firstpayment-deposit');
	Route::match(['GET', 'POST'], '/get-report-first-payment-plus-deposit', 'ExternalAdminCommissionController@datatable_get_first_payment_plus_deposit')->name('datatable.get_first_payment_plus_deposit');
	Route::POST('/report-first-payment-plus-deposit-print', 'ExternalAdminCommissionController@report_first_payment_plus_deposit_print');

	/**
	 * Saren NSO Cash in bank
	 */
	Route::resource('/report_accounting_cash_in_bank', 'CashInBankController');
	Route::match(['get', 'post'], '/datatable-cash-in-bank', 'CashInBankController@get_report_cash_in_bank_list')->name('datatable.cash_in_bank');
	Route::POST('/cash-in-bank-print', 'CashInBankController@get_report_cash_in_bank_print');
	/**
	 * Saren NSO Accounting payable note
	 */
	Route::resource('/payable-note', 'PayableNoteController');
	Route::GET('/get-payable-note', 'PayableNoteController@datatable_get_payable_note')->name('datatable.get_payable_note');
	Route::GET('/get-payable-note-print', 'PayableNoteController@payable_note_print')->name('payable_note_print');
	Route::GET('/get-payable-note-po', 'PayableNoteController@payable_note_po')->name('payable_note_po');
	Route::match(['get', 'post'], '/get-payable-note-po-data', 'PayableNoteController@payable_note_po_data')->name('payable_note_po_data');
	Route::POST('/get-payable-note-print-po', 'PayableNoteController@payable_note_po_print')->name('payable_note_po_print');
	/**
	 *	Meng, Agency commission rate
	 */
	Route::resource('/agency-commission-rate', 'CommissionRateController');
	Route::GET('/agency-commission-rate-list', 'CommissionRateController@get_commission_list')->name('datatable.get_commission_list');
});

//Agent
Route::group(['middleware' => 'Agencies', ['auth'], 'prefix' => 'realty', 'namespace' => 'Agencies'], function () {

	//*************************************************************************************//
	//*********************************** Profile Super Admin **************************************//
	//*************************************************************************************//
	Route::GET('/admin-account', 'AdminAccountController@index')->name('account.admin');
	Route::POST('/admin-profile/image-upload', 'AdminAccountController@change_profile_images')->name('change.profile_images');
	Route::POST('/admin-profile/change-password', 'AdminAccountController@change_password')->name('change.change_password');
	Route::POST('/admin-profile/agency-bank', 'AdminAccountController@angecy_bank_store')->name('agency-bank.store');

	//*************************************************************************************//
	//*********************************** POS Agency ********************************************//
	//*************************************************************************************//
	Route::resource('/pos-agency', 'POSAgencyController');
	Route::match(['get', 'post'], 'create-pos-agency/{project?}/{category?}/{item?}', 'POSAgencyController@create_pos')->name('create-pos-agency');
	Route::get('/get-cart-session-agency', 'POSAgencyController@get_cart')->name('get-session-cart-agency');
	Route::post('/pos-search-agency', 'POSAgencyController@filter')->name('pos-filter');
	Route::POST('/pos-filter-by-name-agency', 'POSAgencyController@search')->name('pos-filter-by-name-agency');
	Route::POST('/pos-get-item-blocked-agency', 'POSAgencyController@search_item_blocked')->name('pos-get-item-blocked-agency');
	Route::get('/pos-add-to-cart-agency/{id}', 'POSAgencyController@add_to_cart')->name('add-to-cart-agency');
	Route::DELETE('/pos-remove-cart-agency', 'POSAgencyController@remove')->name('pos-remove-cart-agency');

	Route::get('/get-new-client-agency', 'POSAgencyController@new_client')->name('pos-get-new-client-agency');
	Route::POST('/add-new-client-agency', 'POSAgencyController@add_client')->name('add-new-client-agency');
	Route::get('block-time-agency/list', 'POSAgencyController@time_list')->name('block-time-agency.index');
	Route::get('block-time-agency/get-list', 'POSAgencyController@get_time_list')->name('block-time-agency.get');
	Route::POST('block-time-agency/store', 'POSAgencyController@store_time')->name('block-time-agency.store');
	Route::match(['patch', 'put'], 'block-time-agency/update/{id}', 'POSAgencyController@update_time')->name('block-time-agency.update');
	Route::get('remove-block-time-agency/{id}', 'POSAgencyController@delete_time')->name('remove-block-time-agency');

	Route::POST('/block-item-stock-agency', 'POSAgencyController@block_item')->name('block.item-stock-agency');
	Route::POST('/unblock-item-stock-agency', 'POSAgencyController@unblock_item')->name('unblock.item-stock-agency');
	Route::get('/blocked-item-stock-agency/list', 'POSAgencyController@blocked_item')->name('blocked-item-list-agency');
	//  get fund info
	Route::get('get-agency-fund-info', 'POSAgencyController@get_agency_fund')->name('agency.fund-info');
	Route::GET('/move-to-cart-agency/{id}', 'POSAgencyController@moveToCart')->name('move-to-cart-agency');
	Route::GET('/dashboard-admin', 'DashboardAdminController@index')->name('dashboard-agencies.index');
	/**
	 * Funds
	 */

	Route::resource('/funds-register', 'FundsRegisterController');

	Route::POST('/funds-change-password', 'FundsRegisterController@change_password')->name('funds.change_password');
	Route::GET('/send-funds', 'FundsTransactionController@send_funds')->name('transaction.send_funds');
	Route::GET('/add-funds', 'FundsTransactionController@add_funds')->name('transaction.add_funds');
	Route::POST('/send-funds-store', 'FundsTransactionController@send_funds_store')->name('transaction.send_funds_store');
	Route::POST('/add-funds-store', 'FundsTransactionController@add_funds_store')->name('transaction.add_funds_store');
	Route::GET('/get-agency-account-number-by-bank/{id}', 'FundsTransactionController@getBankAccount')->name('get-agency-account-number-by-bank');
	/**
	 *
	 *	Display Add Funds Requested
	 *
	 */
	Route::GET('/add-funds-requested', 'FundsTransactionController@add_funds_request')->name('requested.add_funds');
	/**
	 *
	 *	Request Withdraw Funds
	 *
	 */
	Route::GET('/withdraw-funds', 'FundsTransactionController@withdraw_funds')->name('transaction.withdraw_funds');
	/**
	 *	Withdraw Funds Store Record
	 */
	Route::POST('/withdraw-funds-store', 'FundsTransactionController@withdraw_funds_store')->name('transaction.withdraw_funds_store');

	/**
	 * Ajax query account name
	 */
	Route::get('funds-account-name', 'FundsTransactionController@get_accountname');
	/**
	 * Funds Transaction
	 */
	Route::resource('/funds-transaction', 'FundsTransactionController');
	Route::POST('/funds-transaction-print', 'FundsTransactionController@funds_transaction_print');
	/**
	 *		Get all funds transaction for agency
	 */
	Route::GET('/datatable_get_funds_transactions', 'FundsTransactionController@datatable_get_funds_transactions')->name('datatable.get_funds_transactions');

	//*************************************************************************************//
	//*********************************** Booking ********************************************//
	//*************************************************************************************//
	Route::resource('/booking', 'BookingController');
	Route::GET('/datatable_get_booking', 'BookingController@datatable_get_booking')->name('datatable.get_booking');
	Route::GET('/datatable_get_booking_detail/{id}', 'BookingController@datatable_get__detail_booking')->name('datatable.get_booking_detail');


	//***********************************************//
	//************Subordinate*********************//
	//***********************************************//
	Route::resource('/admin-agency', 'AdminAgency');
	Route::GET('/admin-agencies-list', 'AdminAgency@agencies_list')->name('admin-agencies.list');
	Route::GET('/admin-agencies-chart', 'AdminAgency@agencies_chart')->name('admin-agencies.chart');
	Route::GET('/amdin_datatable_get_agencies_list', 'AdminAgency@datatable_agencies_list')->name('admin_datatable_agencies.list');
	Route::POST('/realty/admin/agencies-list/{id}', 'AdminAgency@admin_delete_agency');
	Route::GET('/realty/admin/agencies-view/{id}', 'AdminAgency@popup_view_agency');
	Route::POST('/get-agency-type', 'AdminAgency@get_agency_type')->name('get_agency_type');
	// Route::GET('/admin-agency/view-chart/{id}','AdminAgency@view_chart')->name('admin-agency.view_chart');

	/**
	 *	Report Client Booking Cancelled Contracted Commission
	 */
	Route::resource('/report-booked', 'ReportBookingController');
	Route::get('/pdf-client-deposite/{id}', 'ReportBookingController@pdf_client_deposite')->name('pdf.client-deposite');
	Route::GET('/datatable_get_report_booked', 'ReportBookingController@datatable_get_report_booked')->name('datatable.get_report_booked');

	Route::GET('/report-contracted', 'ReportBookingController@report_contracted')->name('report_contracted');
	Route::GET('/datatable_get_report_contracted', 'ReportBookingController@datatable_get_report_contracted')->name('datatable.get_report_contracted');
	Route::get('/get-detail-client-deposit/{id}', 'ReportBookingController@get_detail_client_deposit');

	/**
	 *	Report Client Booking ReportClientBookingController
	 */
	Route::resource('/report-client-booked', 'ReportClientBookingController');
	Route::GET('/datatable_get_report_client_booked', 'ReportClientBookingController@datatable_get_report_client_booked')->name('datatable.get_report_client_booked');

	/**
	 *	Report Commission ReportCommissionController
	 */
	Route::resource('/report-commission', 'ReportCommissionController');
	Route::GET('/datatable_get_report_commission', 'ReportCommissionController@datatable_get_report_commission')->name('datatable.get_report_commission');
});

//++++++++++++++++++++++++++Human Resource +++++++++++++++++++++++++++++
Route::group(['middleware' => 'Staff', ['auth'], 'namespace' => 'HR'], function () {
	include 'hr.php';

	route::resource('hr-dashboard', 'HrDashboardController');
	route::resource('hr-company-structure', 'HrCompanyController');
	route::resource('hr-asset-type', 'HrAssetTypeController');
	route::resource('hr-attendance', 'HrAttendanceController');
	route::resource('hr-benefit', 'HrBenefitController');
	route::resource('hr-candidate', 'HrCandidateController');
	route::resource('hr-employee', 'HrEmployeeController');
	route::resource('hr-employment-status', 'HrEmploymentStatusController');
	route::resource('hr-exp-level', 'HrJobExpLevelController');
	route::resource('hr-job', 'HrJobController');
	route::resource('hr-job-function', 'HrJobFunctionController');
	route::resource('hr-job-post', 'HrJobPostController');
	route::resource('hr-leave-request', 'HrLeaveRequestController');
	route::resource('hr-leave-type', 'HrLeaveTypeController');
	route::resource('hr-overtime-request', 'HrOvertimeRequestController');
	route::resource('hr-travel-request', 'HrTravelRequestController');
	route::resource('hr-work-day', 'HrWorkdayController');
	route::resource('hr-job-benefit', 'HrJobBenefitController');
	route::resource('hr-job-education-level', 'HrJobEducationLevelController');
	route::resource('hr-job-employment-type', 'HrJobEmploymentTypeController');
	Route::resource('hr-generate-salary', 'HrGenSalaryController');
	Route::resource('hr-employee-benefit', 'HrEmployeeBenefitController');
	Route::resource('hr-exchange-rate', 'ExchangeRateController');
	Route::resource('hr-holiday', 'HrHolidayController');

	route::GET('hr-get-company-structure', 'HrCompanyController@get_company_structure')->name('datatable.hr-get-company-structure');
	route::GET('hr-get-job', 'HrJobController@get_job')->name('datatable.hr-get-job');
	route::GET('hr-get-employment-status', 'HrEmploymentStatusController@get_employment_type')->name('datatable.hr-get-employment-status');
	route::GET('hr-get-leave-type', 'HrLeaveTypeController@get_leave_type')->name('datatable.hr-get-leave-type');
	route::GET('hr-get-leave', 'HrLeaveRequestController@get_leave')->name('datatable.hr-get-leave');
	route::GET('hr-get-leave-staff', 'HrLeaveRequestController@get_leave_staff')->name('datatable.hr-get-leave-staff');
	route::GET('hr-get-overtime', 'HrOvertimeRequestController@get_overtime')->name('datatable.hr-get-overtime');
	route::GET('hr-get-attendance', 'HrAttendanceController@get_attendance')->name('datatable.hr-get-attendance');
	route::GET('hr-get-employee', 'HrEmployeeController@get_employee')->name('datatable.hr-get-employee');
	route::GET('hr-get-travel-request', 'HrTravelRequestController@get_travel_request')->name('datatable.hr-get-travel-request');
	route::GET('hr-get-workday', 'HrWorkdayController@get_workday')->name('datatable.hr-get-workday');
	route::GET('hr-get-job-benefit', 'HrJobBenefitController@get_benefit')->name('datatable.hr-get-job-benefit');
	route::GET('hr-get-job-education-level', 'HrJobEducationLevelController@get_education_level')->name('datatable.hr-get-job-education-level');
	route::GET('hr-get-job-function', 'HrJobFunctionController@get_function')->name('datatable.hr-get-job-function');
	route::GET('hr-get-exp-level', 'HrJobExpLevelController@get_exp_level')->name('datatable.hr-get-exp-level');
	route::GET('hr-get-employment-type', 'HrJobEmploymentTypeController@get_employment_type')->name('datatable.hr-get-employment-type');
	route::GET('hr-get-candidate', 'HrCandidateController@get_candidate')->name('datatable.hr-get-candidate');
	route::GET('hr-get-job-post', 'HrJobPostController@get_job_post')->name('datatable.hr-get-job-post');
	route::GET('hr-leave-staff', 'HrLeaveRequestController@staff_leave')->name('hr-leave-staff');
	route::GET('hr-gen-salary', 'HrGenSalaryController@get_gen_salary')->name('datatable.hr-gen-salary');
	route::GET('hr-get-employee-benefit', 'HrEmployeeBenefitController@get_employee_benefit')->name('datatable.hr-get-employee-benefit');

	route::POST('hr-employee-change-status', 'HrEmployeeController@change_status')->name('hr.employee-change-status');
	route::POST('leave-change-status', 'HrLeaveRequestController@staff_leave_status')->name('hr.leave-change-status');
	route::POST('overtime-change-status', 'HrOvertimeRequestController@overtime_status')->name('hr.overtime-change-status');
	route::POST('travel-change-status', 'HrTravelRequestController@travel_status')->name('hr.travel-change-status');
	route::POST('hr-leave-request-next', 'HrLeaveRequestController@next')->name('hr-leave-request.next');
	route::POST('hr-leave-request-next', 'HrLeaveRequestController@next')->name('hr-leave-request.next');
	route::POST('delete-candidate', 'HrCandidateController@delete_candidate')->name('hr.delete-candidate');

	route::GET('view-travel', 'HrTravelRequestController@view_modal')->name('hr.travel-view');
	route::GET('view-leave', 'HrLeaveRequestController@view_modal')->name('leave.view');
	route::GET('view-overtime', 'HrOvertimeRequestController@view_overtime')->name('hr.overtime');
	route::GET('view-candidate', 'HrCandidateController@view_candidate')->name('hr.view-candidate');
	route::GET('view-job-post', 'HrJobPostController@view_job_post')->name('hr.view-job-post');

	Route::GET('hr-generate-payroll', 'HrGenSalaryController@generate_payroll')->name('hr.generate-payroll');
	Route::GET('hr-generate-salary-destroy/{id}', 'HrGenSalaryController@destroy')->name('hr-generate-salary.destroy');
});

Route::group(['middleware' => 'Staff', ['auth'], 'namespace' => 'Administrator'], function () {
	//Route::GET('/', 'DashboardAdministratorController@index')->name('dashboard.administrator');

	Route::resource('/department', 'DepartmentController');
	Route::GET('/group-orgchart', 'DepartmentController@orgchart')->name('orgchart');

	Route::GET('/datatable-department', 'DepartmentController@datable_department')->name('datatable_department');
	Route::GET('/delete-department', 'DepartmentController@delete_department')->name('department.delete_department');

	Route::resource('/user-group', 'UserGroupController');
	Route::GET('/datatable-user-group', 'UserGroupController@datable_user_group')->name('datatable_user_group');
	Route::GET('/delete-user-group', 'UserGroupController@delete_user_group')->name('user-group.delete_user_group');

	Route::GET('/setup-user/{id}', 'UserController@setup_user')->name('user.setup-user');
	Route::GET('/datatable-user', 'UserController@datatable_user')->name('user.datatable-user');
	Route::GET('/get-user', 'UserController@get_leader')->name('user.get-leader');
	Route::GET('/setup-user-delete', 'UserController@delete_setup_group')->name('user.delete_setup_group');

	Route::POST('/setup-user-store', 'UserController@setup_user_store')->name('user.setup-user-store');
	Route::GET('/staff-chart', 'UserController@staff_chart')->name('staff-chart');
	/*
        |--------------------------------------------------------------------------
        | Web Routes
        |--------------------------------------------------------------------------
        |
        |  Sale Target
        */
});

Route::group(['middleware' => 'Staff', ['auth'], 'namespace' => 'CRM'], function () {
	Route::resource('/lead', 'LeadController');
	Route::resource('/call-log', 'CallLogController');
	Route::resource('/appointment', 'AppointmentController');
	Route::resource('/meeting', 'MeetingController');
	Route::resource('/lead-source', 'LeadSourceController');
	Route::resource('/agent-task', 'TaskController');
	Route::GET('/crm-dashboard', 'LeadController@dashboard')->name('crm-dashboard');
	Route::GET('/datatable-crm-lead', 'LeadController@datable_lead')->name('datatable_crm_lead');
	Route::GET('/convert-lead{id}', 'LeadController@convert_lead')->name('lead.convert-lead');
	Route::GET('/convert-lead-to-agent/{id}', 'LeadController@convert_lead_to_agent')->name('lead.convert-lead-to-agent');
	Route::POST('/save-customer', 'LeadController@save_customer')->name('lead.save-customer');
	Route::POST('/save-agent', 'LeadController@save_agent')->name('lead.save-agent');
	Route::GET('/datatable-crm-call-log', 'CallLogController@datable_lead_call_log')->name('datatable_crm_call_log');
	Route::GET('/datatable-crm-meeting', 'MeetingController@datable_meeting')->name('datatable_meeting');
	Route::GET('/datatable-crm-appointment', 'AppointmentController@datable_lead_appointment')->name('datatable_appointment');
	Route::GET('/datatable-crm-lead-sources', 'LeadSourceController@datable_lead_source')->name('datatable_lead_source');

	Route::GET('/lead-report', 'LeadController@lead_report')->name('lead.lead-report');
	Route::GET('/datatable-lead-report', 'LeadController@datatable_lead_report')->name('datatable.lead-report');

	Route::GET('/task-report', 'TaskController@task_report')->name('lead.task-report');
	Route::GET('/datatable-task-report', 'TaskController@datatable_task_report')->name('datatable.task-report');

	Route::GET('/view-task-report', 'TaskController@view_task_report')->name('view-task-report');
	Route::GET('/delete-appointment', 'AppointmentController@delete_appointment')->name('appointment.delete_appointment');
	Route::GET('/delete-lead', 'LeadController@delete_lead')->name('lead.delete_lead');
	Route::GET('/delete-call-log', 'CallLogController@delete_call_log')->name('call-log.delete_call_log');
	Route::GET('/delete-meeting', 'MeetingController@delete_meeting')->name('meeting.delete_meeting');

	Route::GET('/agent-task/create/{lead}', 'TaskController@create')->name('agent-task.create');
});

Route::group(['middleware' => 'Agencies', ['auth'], 'namespace' => 'CRMAgency'], function () {
	Route::resource('/lead-agency', 'LeadAgentController');
	Route::resource('/call-log-agency', 'CallLogAgentController');
	Route::resource('/appointment-agency', 'AppointmentAgentController');
	Route::resource('/meeting-agency', 'MeetingAgentController');
	Route::resource('/lead-source-agency', 'LeadSourceAgentController');
	Route::resource('/agent-task-agency', 'TaskAgentController');
	Route::GET('/crm-dashboard-agency', 'LeadAgentController@dashboard')->name('crm-dashboard');
	Route::GET('/datatable-crm-lead-agency', 'LeadAgentController@datable_lead')->name('datatable_crm_lead_agency');
	Route::GET('/convert-lead-agency/{id}', 'LeadAgentController@convert_lead')->name('lead-agency.convert-lead');
	Route::GET('/convert-lead-to-agent-agency/{id}', 'LeadAgentController@convert_lead_to_agent')->name('lead-agency.convert-lead-to-agent-agency');
	Route::POST('/save-customer-agency', 'LeadAgentController@save_customer')->name('lead-agency.save-customer');
	Route::POST('/save-agent-agency', 'LeadAgentController@save_agent')->name('lead.save-agent-agency');
	Route::GET('/datatable-crm-call-log-agency', 'CallLogAgentController@datable_lead_call_log')->name('datatable_crm_call_log_agency');
	Route::GET('/datatable-crm-meeting-agency', 'MeetingAgentController@datable_meeting')->name('datatable_meeting_agency');
	Route::GET('/datatable-crm-appointment-agency', 'AppointmentAgentController@datable_lead_appointment')->name('datatable_appointment_agency');
	Route::GET('/datatable-crm-lead-sources-agency', 'LeadSourceAgentController@datable_lead_source')->name('datatable_lead_source_agency');

	Route::GET('/lead-report-agency', 'LeadAgentController@lead_report')->name('lead-agency.lead-report');
	// Route::GET('/datatable-lead-report-agency', 'LeadAgentController@datatable_lead_report')->name('datatable.lead-report');

	Route::GET('/task-report-agency', 'TaskAgentController@task_report')->name('lead-agency.task-report');
	// Route::GET('/datatable-task-report-agency', 'TaskAgentController@datatable_task_report')->name('datatable.task-report');

	Route::GET('/view-task-report-agency', 'TaskAgentController@view_task_report')->name('view-task-report');
	Route::GET('/delete-appointment-agency', 'AppointmentAgentController@delete_appointment')->name('appointment.delete_appointment');
	Route::GET('/delete-lead-agency', 'LeadAgentController@delete_lead')->name('lead.delete_lead');
	Route::GET('/delete-call-log-agency', 'CallLogAgentController@delete_call_log')->name('call-log.delete_call_log');
	Route::GET('/delete-meeting-agency', 'MeetingAgentController@delete_meeting')->name('meeting.delete_meeting');

	Route::GET('/agent-task-agency/create/{lead}', 'TaskAgentController@create')->name('agent-task-agency.create');
});


Route::GET('/log-out-user', function () {
	Auth::logout();
	return redirect('/login');
})->name('logout-user');
Auth::routes();
