<?php

use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
// Route::get('/data', 'ImportDataController@importVendorOpeningBalance');
Route::get('/plot-data', 'ImportDataController@importPlotData');


// DATATABLE (0)
Route::post('showbranchwisedata', [
    'uses' => 'DataTableController@showDataTableBranchWise',
    'as' => 'datatable.show'
])->middleware('auth');
// END DATATABLE ROUE
// HOME ROUTES (1)

// => 1.1
Auth::routes();

// => 1.2
Route::get('/', function () {

    // $query = "SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname='silver' AND state = 'idle' AND now() - query_start > '00:10:00'";

    // \DB::statement($query);

    return view('welcome');
});

// => 1.3
Route::get('/home', 'HomeController@index')->name('home')->middleware('auth');

// =================  END HOME ROUTES  =================


// USER ROUTES (2)

Route::post('dueinstallmentreport',[
    'uses'=>'ReportController@dueInstallmentReport',
    'as'=>'report.dueinstallment'
    ])->middleware('auth','permission:View Due Installment Report|All');




// => 2.1
Route::get('/profile', 'UserController@showProfile')->name('profile');

// =>2.2
Route::post('profileupdate', [
    'uses' => 'UserController@updateProfile',
    'as' => 'profile.update'
])->middleware('auth');

// =>2.3
Route::get('customers', [
    'uses' => 'UserController@viewAllCustomers',
    'as' => 'user.customers'
])->middleware('auth', 'permission:View Customer|All');

// =>2.3 (Customer Datatable)
Route::get('loadcustomers', [
    'uses' => 'UserController@showCustomerDatatable',
    'as' => 'loadcustomers'
])->middleware('auth', 'permission:View Customer|All');

// => 2.4
Route::post('customercommit', [
    'uses' => 'UserController@storeCustomer',
    'as' => 'customer.store'
])->middleware('auth', 'permission:Add Customer|All');

// => 2.5
Route::post('customerupdate', [
    'uses' => 'UserController@updateCustomer',
    'as' => 'customer.update'
])->middleware('auth', 'permission:Update Customer|All');

// =>2.6
Route::get('dealers', [
    'uses' => 'UserController@viewAllDealers',
    'as' => 'user.dealers'
])->middleware('auth', 'permission:View Dealer|All');

// => 2.7
Route::post('dealercommit', [
    'uses' => 'UserController@storeDealer',
    'as' => 'dealer.store'
])->middleware('auth', 'permission:Add Dealer|All');

// => 2.8
Route::post('dealerupdate', [
    'uses' => 'UserController@updateDealer',
    'as' => 'dealer.update'
])->middleware('auth', 'permission:Update Dealer|All');

// =>2.9
Route::get('employees', [
    'uses' => 'UserController@viewAllEmployees',
    'as' => 'user.employees'
])->middleware('auth', 'permission:View Employee|All');

// => 2.10
Route::post('employeecommit', [
    'uses' => 'UserController@storeEmployee',
    'as' => 'employee.commit'
])->middleware('auth', 'permission:Add Employee|All');

// => 2.11
Route::post('employeeupdate', [
    'uses' => 'UserController@updateEmployee',
    'as' => 'employee.update'
])->middleware('auth', 'permission:Update Employee|All');

// =>2.12
Route::get('userlist/{option}', [
    'uses' => 'UserController@getUserDropDown',
    'as' => 'user.list'
])->middleware('auth');

// => 2.13
Route::get('/usercnic/{cnic}', [
    'uses' => 'UserController@getUserCnic',
    'as' => 'user.cnic'
])->middleware('auth');

// => 2.4
Route::get('/usertrash/{id}', [
    'uses' => 'UserController@removeUser',
    'as' => 'user.trash'
])->middleware('auth');


Route::get('employeeassets/{id}', [
    'uses' => 'UserController@getEmployeeAssets',
    'as' => 'employee.assets'
])->middleware('auth', 'permission:All|View Employee Assets');
// => 34.2
Route::post('vendortype', [
    'uses' => 'UserController@storeVendorType',
    'as' => 'vendor_type.store'
])->middleware('auth');

//
Route::get('userbydesi/{option}', [
    'uses' => 'UserController@getUserByDesi',
    'as' => 'user.list_desi'
])->middleware('auth');

// =>2.15
Route::get('userlistwithroles/{option}', [
    'uses' => 'UserController@getUserRoleDropDown',
    'as' => 'user.role.list'
])->middleware('auth');

// => 2.16
Route::get('/getusertypes/{cnic}', 'UserController@getUserTypesByCnic')->middleware('auth');

// => 2.17
Route::post('usertypescommit', [
    'uses'   =>  'UserController@storeUserTypes',
    'as'     =>  'usertypes.store'
])->middleware('auth');

// => 2.18
Route::get('/assignrole', 'UserController@addRole')->middleware('auth');


// =================  END USER ROUTES  =================


// BRANCH ROUTE (3)

// => 3.1
Route::get('/branch', 'BranchController@index')->name('branch')->middleware('auth', 'permission:View Branch|All');

// => 3.2
Route::post('branchcommit', [
    'uses' => 'BranchController@storeBranch',
    'as' => 'branch.store'
])->middleware('auth', 'permission:Add Branch|All');

// => 3.3
Route::post('branchupdate', [
    'uses' => 'BranchController@updateBranch',
    'as' => 'branch.update'
])->middleware('auth', 'permission:Update Branch|All');

// => 3.4
Route::get('/branchtrash/{id}', [
    'uses' => 'BranchController@removeBranch',
    'as' => 'branch.trash'
])->middleware('auth');


// =================  END BRANCH ROUTES  =================






// BOOKING ROUTE (4)

// => 4.1

Route::get('/booking', 'BookingController@index')->name('booking')->middleware('auth', 'permission:View Booking|All');

Route::get('/datatable-bookings', 'BookingController@showDatatableBookings')->name('datatable-bookings')->middleware('auth', 'permission:View Booking|All');

// => 4.2

Route::get('/blockbookings', 'BookingController@viewBlockBooking')->name('blockbooking')->middleware('auth', 'permission:View Blocked Booking|All');


// => 4.3

Route::post('bookingcommit', [
    'uses' => 'BookingController@storeBooking',
    'as' => 'booking.store'
])->middleware('auth', 'permission:All|Make Booking');

// => 4.4

Route::post('bookingupdate', [
    'uses' => 'BookingController@updateBooking',
    'as' => 'booking.update'
])->middleware('auth', 'permission:All|Update Booking');

// => 4.5

Route::post('/bookingapprove', [
    'uses' => 'BookingController@approveBooking',
    'as' => 'booking.approve'
])->middleware('auth', 'permission:All|Approve Booking');

// => 4.6

Route::get('bookingdetail/{id}', [
    'uses' => 'BookingController@viewBooking',
    'as' => 'booking.details'
])->middleware('auth', 'permission:All|Booking Details');

// => 4.7


Route::get('cancelbookingdetail/{id}', [
    'uses' => 'BookingController@viewCancelBooking',
    'as' => 'bookingcancel.details'
])->middleware('auth', 'permission:All|Cancel Booking Details');



// => 4.8

Route::get('/bookingtrash/{id}', [
    'uses' => 'BookingController@removeBooking',
    'as' => 'booking.trash'
])->middleware('auth', 'permission:Delete Booking|All');

// => 4.9

Route::post('/bookingcancel', [
    'uses' => 'BookingController@cancelBooking',
    'as' => 'booking.cancel'
])->middleware('auth', 'permission:All|Cancel Booking Request');

// => 4.10

Route::get('/showcancelbooking{id}', [
    'uses' => 'BookingController@showCancelBooking',
    'as' => 'showcancelbooking'
])->middleware('auth');


// => 4.11

Route::get('/showapprovecancelbooking{id}', [
    'uses' => 'BookingController@showApproveCancelBooking',
    'as' => 'approvecancelbooking'
])->middleware('auth');

// => 4.12

Route::post('/approvecancelbooking', [
    'uses' => 'BookingController@approveCancelBooking',
    'as' => 'booking.cancel_approve'
])->middleware('auth', 'permission:All');


Route::get('removecancelbooking', [
    'uses' => 'CancelBookingController@removeCancelBooking',
    'as' => 'removecancelbooking'
])->middleware('auth', 'permission:All|Remove Cancel Booking');
// => 4.13

Route::get('/cancelledbooking', 'CancelBookingController@getAllCancelBookings')->name('cancel')->middleware('auth', 'permission:All|View Cancel Requests');

// => 4.14

Route::get('bookingtransfer/{id}', [
    'uses' => 'BookingController@transferBooking',
    'as' => 'booking.transfer'
])->middleware('auth', 'permission:All|Transfer Booking Request');

// => 4.15

Route::get('/marktag/{booking}/{value}/{column}', 'BookingController@markTag')->name('marktag')->middleware('auth', 'permission:All|Tag Booking');


// => 4.16

Route::get('reservebooking', [
    'uses' => 'BookingController@showReserveBooking',
    'as' => 'booking.reserve'
])->middleware('auth', 'permission:All|View Soft Booking');


// => 4.17

Route::get('bookingmature/{id}', [
    'uses' => 'BookingController@bookingMature',
    'as' => 'booking.mature'
])->middleware('auth', 'permission:All|Mature Soft Booking');

// => 4.18

Route::get('bookingbranch/{id}', [
    'uses' => 'BookingController@getBranchBookingDropDown',
    'as' => 'branch.bookingliist'
])->middleware('auth');

// => 4.19

Route::post('/softbookingupdate', [
    'uses' => 'BookingController@updateSoftBooking',
    'as' => 'softbooking.update'
])->middleware('auth', 'permission:All|Update Soft Booking');

// => 4.20
Route::get('/showdocuments/{id}', [
    'uses' => 'BookingController@showdocuments',
    'as' => 'showdocuments'
])->middleware('auth', 'permission:All|View Document');

// =================  END BOOKING ROUTES  =================


// PLOT ROUTE (5)

// => 5.1

Route::get('/plotlist/{category}/{type}/{project}', 'PlotController@getPlots')->middleware('auth');

// => 5.2

// Route::get('/plottypelist/{project}', 'PlotController@getPlotTypeByProject')->middleware('auth');

Route::get('/plottypelist/{project}', 'PlotController@getPlots')->middleware('auth');

// => 5.3

Route::get('/plotcategorylist/{type}/{project}', 'PlotController@getPlotCategory')->middleware('auth');


// => 5.4

Route::get('/plotsize/{plot}', 'PlotController@getPlotBySize')->middleware('auth');

// => 5.5

Route::get('plots', 'PlotController@index')->name('plots')->middleware('auth', 'permission:View Inventory|All');

Route::get('showdatatableplots', 'PlotController@showDatatablePlots')->name('showdatatableplots')->middleware('auth', 'permission:View Inventory|All');

// => 5.6

Route::post('inventoryupdate', [
    'uses' => 'PlotController@updateInventory',
    'as' => 'inventory.update'
])->middleware('auth', 'permission:Update Inventory|All');


// => 5.7
Route::post('inventorybulk', [
    'uses' => 'PlotController@updateBulkInventory',
    'as' => 'inventory.bulkupdate'
])->middleware('auth', 'permission:Update Inventory Bulk|All');

// => 5.8
Route::post('inventorycommit', [
    'uses' => 'PlotController@storeInventory',
    'as' => 'inventory.add'
])->middleware('auth', 'permission:Store Inventory|All');

// => 5.9
Route::get('/plottrash/{id}', [
    'uses' => 'PlotController@removePlot',
    'as' => 'plot.trash'
])->middleware('auth', 'permission:Remove Inventory|All');

// => 5.10
Route::get('projectwiseblocks/{project}', 'PlotController@getBranchWiseBlock')->middleware('auth');

// => 5.11
Route::get('/showplot/{plot}', 'PlotController@showPlot')->middleware('auth');



// =================  END PLOT ROUTES  =================


// NOMINEE ROUTE (6)

// => 6.1

Route::post('nomineecommit', [
    'uses' => 'NomineeController@storeNominee',
    'as' => 'nominee.store'
])->middleware('auth', 'permission:Add Nominee|All');

// => 6.2

Route::post('nomineeupdate', [
    'uses' => 'NomineeController@updateNominee',
    'as' => 'nominee.update'
])->middleware('auth', 'permission:Update Nominee|All');




// =================  END NOMINEE ROUTES  =================



// COMMISSION ROUTE (7)

// => 7.1
Route::post('commissioncommit', [
    'uses' => 'CommissionController@storeCommission',
    'as' => 'commission.store'
])->middleware('auth', 'permission:Add Side Payment|All');

// => 7.2
Route::post('commissionupdate', [
    'uses' => 'CommissionController@updateCommission',
    'as' => 'commission.update'
])->middleware('auth', 'permission:Update Side Payment|All');

// => 7.3
Route::get('/commissiontrash/{id}', [
    'uses' => 'CommissionController@removeCommission',
    'as' => 'commission.trash'
])->middleware('auth', 'permission:Remove Side Payment|All');

// => 7.4
Route::post('extrachargescommit', [
    'uses' => 'CommissionController@storeExtraCharges',
    'as' => 'extracharges.store'
])->middleware('auth', 'permission:Add Side Payment|All');

// => 7.5
Route::post('extrachargesupdate', [
    'uses' => 'CommissionController@updateExtraCharges',
    'as' => 'extracharges.update'
])->middleware('auth', 'permission:Update Side Payment|All');



// =================  END COMMISSION ROUTES  =================


// INSTALLMENT ROUTE (8)

// => 8.1

Route::post('installmentcommit', [
    'uses' => 'InstallmentController@storeInstallment',
    'as' => 'installment.store'
])->middleware('auth', 'permission:Add Plan|All');

Route::post('updateinstallmentmode', [
    'uses' => 'BookingController@updateInstallmentMode',
    'as' => 'updateinstallmentmode'
])->middleware('auth', 'permission:Add Plan|All');

// => 8.2

Route::post('onetimecommit', [
    'uses' => 'InstallmentController@storeOnetime',
    'as' => 'onetime.store'
])->middleware('auth', 'permission:Add Plan|All');

// => 8.3

Route::post('installmentupdate', [
    'uses' => 'InstallmentController@updateInstallment',
    'as' => 'installment.update'
])->middleware('auth', 'permission:Update Installment|All');

// => 8.4

Route::get('/installmenttrash/{id}', [
    'uses' => 'InstallmentController@removeInstallment',
    'as' => 'installment.trash'
])->middleware('auth', 'permission:Remove Installment|All');

// => 8.5
Route::post('installmentinterval', [
    'uses' => 'InstallmentController@intervalInstallment',
    'as' => 'installment.interval'
])->middleware('auth');


// => 8.6
Route::post('bulkinstallmentremove', [
    'uses' => 'InstallmentController@bulkInstallmentRemove',
    'as' => 'installment.bulkRemove'
])->middleware('auth', 'permission:Remove Installment|All');




// =================  END 	INSTALLMENT ROUTES  =================


// HEAD ROUTE (9)

// => 9.1

Route::get('/head', 'HeadController@index')->name('head')->middleware('auth', 'permission:View Head|All');

// => 9.2

Route::post('headcommit', [
    'uses' => 'HeadController@storeHead',
    'as' => 'head.store'
])->middleware('auth', 'permission:Add Head|All');

// => 9.3

Route::post('headupdate', [
    'uses' => 'HeadController@updateHead',
    'as' => 'head.update'
])->middleware('auth', 'permission:Update Head|All');

// => 9.4

Route::get('/headtrash/{id}', [
    'uses' => 'HeadController@removeHead',
    'as' => 'head.trash'
])->middleware('auth', 'permission:Remove Head|All');
// => 9.5
Route::post('/headnumbers', [
    'uses' => 'HeadController@generateNatureWiseCode',
    'as' => 'head.code'
])->middleware('auth');
// => 9.6

Route::post('/headshownaturewise', [
    'uses' => 'HeadController@showHeadNatureWise',
    'as' => 'head.shownaturewise'
])->middleware('auth');


// =================  END HEAD ROUTES  =================


// SUB HEAD ROUTE OR  ACCOUNTS (10)

// => 10.1

Route::get('/subhead/{id}', 'AccountController@index')->name('subhead')->middleware('auth', 'permission:View Subhead|All');

Route::get('/subheadtype/{id}', 'AccountController@getSubheadTypeDropDown')->name('subheadtype')->middleware('auth');


// => 10.2

Route::post('subheadcommit', [
    'uses' => 'AccountController@storeSubHead',
    'as' => 'subhead.store'
])->middleware('auth', 'permission:Add Subhead|All');

// => 10.3

Route::post('subheadupdate', [
    'uses' => 'AccountController@updateSubHead',
    'as' => 'subhead.update'
])->middleware('auth', 'permission:Update Subhead|All');

// => 10.4

Route::get('/subheadtrash/{id}', [
    'uses' => 'AccountController@removeSubHead',
    'as' => 'subhead.trash'
])->middleware('auth', 'permission:Remove Subhead|All');

// => 10.5a (FOR INVENTORY MODULE)

Route::get('/viewuserledger/{id}', [
    'uses' => 'AccountController@viewUserLedger',
    'as' => 'user.viewledger'
])->middleware('auth', 'permission:View Ledger|All');


// => 10.5

Route::get('/subheadviewledger/{id}', [
    'uses' => 'AccountController@viewLedger',
    'as' => 'subhead.viewledger'
])->middleware('auth', 'permission:View Ledger|All');

// => 10.6

Route::get('/showbookingledger/{id}', [
    'uses' => 'AccountController@showBookingLedger',
    'as' => 'showbookingledger'
])->middleware('auth', 'permission:Booking Ledger|All');

// => 10.7

Route::get('/showcancelbookingledger/{id}', [
    'uses' => 'AccountController@showCancelBookingLedger',
    'as' => 'showcancelbookingledger'
])->middleware('auth', 'permission:Cancel Booking Ledger|All');

//  => 10.8
Route::get('/showsubheadmodal/{id}', 'AccountController@showSubheadModal')->name('showsubheadmodal')->middleware('auth');

// => 10.9
Route::get('/showupdatesubheadmodal/{id}', 'AccountController@showUpdateSubheadModal')->name('showupdatesubheadmodal')->middleware('auth');

// ================= END SUBHEAD ROUTES  =================


// VOUCHER (11)

// => 11.1

Route::get('/voucher', 'VoucherController@index')->name('voucher')->middleware('auth', 'permission:View Voucher|All');

// => 11.2

Route::post('vouchercommit', [
    'uses' => 'VoucherController@storeVoucher',
    'as' => 'voucher.store'
])->middleware('auth', 'permission:Create Voucher|All');

Route::post('voucherfilters', [
    'uses' => 'VoucherController@voucherFilter',
    'as' => 'voucherfilters'
])->middleware('auth');

// => 11.3

Route::post('voucherupdate', [
    'uses' => 'VoucherController@updateVoucher',
    'as' => 'voucher.update'
])->middleware('auth', 'permission:Update Voucher|All');

// => 11.4

Route::get('/vouchertrash/{id}', [
    'uses' => 'VoucherController@removeVoucher',
    'as' => 'voucher.trash'
])->middleware('auth');

//=>11.5

Route::get('/vouchergeneral/{voucher_type}', [
    'uses' => 'VoucherController@viewGeneralVoucher',
    'as' => 'vouchergeneral'
])->middleware('auth');

// => 11.6

Route::get('/vouchersubheadlist/{id}', [
    'uses' => 'AccountController@getSubHeadDropdown',
    'as' => 'vouchersubhead.list'
])->middleware('auth');

// => 11.7

Route::get('/voucherdebit/{voucher_type}', [
    'uses' => 'VoucherController@viewDebitVoucher',
    'as' => 'voucherdebit'
])->middleware('auth');


// Route::get('/cancelledger',[
// 	'uses'=>'VoucherController@cancelLedger',
// 	'as'=>'ledger.cancel'
// 	])->middleware('auth');

// => 11.8

Route::get('/vouchercredit/{voucher_type}', [
    'uses' => 'VoucherController@viewCreditVoucher',
    'as' => 'vouchercredit'
])->middleware('auth');

// => 11.9

Route::get('/vouchergvsethtml/{id}/{type}', [
    'uses' => 'VoucherController@setGvVoucher',
    'as' => 'vouchergv.sethtml'
])->middleware('auth');

// => 11.10

Route::get('/vouchercrvsethtml/{id}/{type}', [
    'uses' => 'VoucherController@setCrvVoucher',
    'as' => 'vouchercrv.sethtml'
])->middleware('auth');

// => 11.11

Route::get('/voucherdbsethtml/{id}/{type}', [
    'uses' => 'VoucherController@setDbVoucher',
    'as' => 'voucherdb.sethtml'
])->middleware('auth');

// => 11.12

Route::get('/voucherinstallments/{id}', [
    'uses' => 'InstallmentController@getInstallments',
    'as' => 'voucher.installments'
])->middleware('auth');

// => 11.13

Route::get('/voucherinstallmentamount/{id}', [
    'uses' => 'InstallmentController@getInstallmentAmount',
    'as' => 'voucherinstallment.amount'
])->middleware('auth');

// => 11.14

Route::get('/vouchercommission/{id}', [
    'uses' => 'CommissionController@getComission',
    'as' => 'voucher.commission'
])->middleware('auth');

// => 11.15


Route::get('/vouchercommissionamount/{id}', [
    'uses' => 'CommissionController@getCommissionAmount',
    'as' => 'vouchercommission.amount'
])->middleware('auth');

// => 11.16

Route::get('/voucherapprove/{id}', [
    'uses' => 'VoucherController@approveVoucher',
    'as' => 'voucher.approve'
])->middleware('auth', 'permission:Approve Voucher|Reject Voucher|All');

// => 11.17

Route::post('/voucherstatus', [
    'uses' => 'VoucherController@updateVoucherStatus',
    'as' => 'voucher.status'
])->middleware('auth');

// => 11.18

Route::get('/voucherreversal/{id}', [
    'uses' => 'VoucherController@reversalVoucher',
    'as' => 'voucher.reversal'
])->middleware('auth', 'permission:Reverse Voucher|All');

// => 11.19

Route::get('/vouchershow/{id}', [
    'uses' => 'VoucherController@showVoucher',
    'as' => 'voucher.show'
])->middleware('auth');

Route::get('rejectvoucher', [
    'uses' => 'VoucherController@rejectVoucher',
    'as' => 'rejectvoucher'
])->middleware('auth', 'permission:Reject Voucher|All');




// => 11.20
Route::post('payinstallment', [
    'uses' => 'VoucherController@payInstallment',
    'as' => 'installment.payment'
])->middleware('auth', 'permission:Pay Installment|All');

// => 11.21
Route::post('paycommission', [
    'uses' => 'VoucherController@payCommission',
    'as' => 'commission.payment'
])->middleware('auth', 'permission:Pay Commission|All');

// => 11.22
Route::post('paypayment', [
    'uses' => 'VoucherController@payPayment',
    'as' => 'voucher.payment'
])->middleware('auth', 'permission:Create Voucher|All');

Route::get('pendingpaymentalgo', [
    'uses' => 'VoucherController@pendingPaymentVoucherAlgo',
    'as' => 'pendingpaymentalgo'
])->middleware('auth', 'permission:Create Voucher|All');


// 11.23
Route::post('approvemultiplevouchers', [
    'uses'  =>  'VoucherController@approveMultipleVouchers',
    'as'    =>  'approve.multiple.vouchers'
]);


Route::post('paymentoptionsubheads',[
    'uses'=>'AccountController@getPaymentOptionDropDown',
    'as'=>'paymentoptionsubheads'
    ])->middleware('auth');


// =================  END VOUCHER ROUTES  =================


//  DOCUMENTS  ROUTES

// => 12.1

Route::post('booking_documentcommit', [
    'uses' => 'DocumentController@storeDocument',
    'as' => 'document.store'
])->middleware('auth', 'permission:Upload Booking Document|All');

// => 12.2

Route::get('/documenttrash/{id}', [
    'uses' => 'DocumentController@removeDocument',
    'as' => 'document.trash'
])->middleware('auth', 'permission:Remove Booking Document|All');



// =================  END  DOCUMENTS ROUTES  =================


// TRANSFER ROUTE (13)

// => 13.1

Route::post('transfercommit', [
    'uses' => 'TransferController@storeTransfer',
    'as' => 'transfer.store'
])->middleware('auth');

// => 13.2

Route::get('/transferbooking', 'TransferController@transferedBooking')->name('transfer')->middleware('auth', 'permission:View Transfer Booking|All');

// => 13.3

Route::get('/transferapprove/{id}', [
    'uses' => 'TransferController@approveTransfer',
    'as' => 'transfer.approve'
])->middleware('auth', 'permission:Approve Transfer|All');

// => 13.4
Route::post('transferupdate', [
    'uses' => 'TransferController@updateTransfer',
    'as' => 'transfer.update'
])->middleware('auth', 'permission:Update Transfer|All');

// =================  END  TRANSFER ROUTES  =================


// SMS ROUTE (14)

// => 14.1

Route::post('smscommit', [
    'uses' => 'SmsController@pushSms',
    'as' => 'sms.push'
])->middleware('auth', 'permission:Push Sms|All');

// =================  END  SMS ROUTES  =================

// DOCUMENT ROUTE (15)

// => 15.1

Route::get('/reports', 'ReportController@index')->name('reports')->middleware('auth', 'permission:View Report|All');

Route::get('/employeeprofile/{id}', 'ReportController@employeeProfile')->name('employeeprofile')->middleware('auth', 'permission:Employee Profile Document|All');

Route::post('salaryslipreport', [
    'uses' => 'ReportController@salarySlipReport',
    'as' => 'report.salaryslip'
])->middleware('auth');

Route::get('bookingform/{id}', [
    'uses' => 'ReportController@bookingForm',
    'as' => 'document.bookingform'
])->middleware('auth', 'permission:View Booking Form|All');

Route::get('allreceipt/{id}', [
    'uses' => 'ReportController@showAllReceipt',
    'as' => 'document.allreceipt'
])->middleware('auth', 'permission:All Receipt Form|All');

// Route::get('allotmentform/{id}',[
// 	'uses'=>'ReportController@allotmentForm',
// 	'as'=>'document.allotmentform'
// 	])->middleware('auth','permission:View Allotment Form|All');

// => 15.2

Route::get('allotmentform/{id}', [
    'uses' => 'ReportController@allotmentForm',
    'as' => 'document.allotmentform'
])->middleware('auth', 'permission:View Allotment Form|All');

// => 15.3

Route::get('paymentform/{id}', [
    'uses' => 'ReportController@paymentForm',
    'as' => 'document.paymentform'
])->middleware('auth', 'permission:View Payment Plan|All');

// => 15.4

Route::get('customersummary/{id}', [
    'uses' => 'ReportController@customerSummary',
    'as' => 'document.customersummary'
])->middleware('auth', 'permission:View Customer Summary|All');

// => 15.5

Route::get('cancelform/{id}', [
    'uses' => 'ReportController@cancelBooking',
    'as' => 'document.cancelbooking'
])->middleware('auth', 'permission:View Cancel Form|All');

// => 15.6

Route::get('transferform/{id}', [
    'uses' => 'ReportController@transferBooking',
    'as' => 'document.transferform'
])->middleware('auth', 'permission:View Transfer Form|All');

// => 15.7


Route::get('transferhistory/{id}', [
    'uses' => 'ReportController@transferHistory',
    'as' => 'document.transferhistory'
])->middleware('auth', 'permission:View Transfer History|All');

// => 15.8

Route::get('paymentreceipt/{id}', [
    'uses' => 'ReportController@paymentReceipt',
    'as' => 'document.paymentreceipt'
])->middleware('auth', 'permission:View Booking Receipts|All');

// => 15.9

Route::get('nomineedetail/{id}', [
    'uses' => 'ReportController@nomineeDetail',
    'as' => 'document.nomineedetail'
])->middleware('auth', 'permission:View Nominee Detail|All');

// => 15.10


Route::get('nokdetail/{id}', [
    'uses' => 'ReportController@nokDetail',
    'as' => 'document.nokdetail'
])->middleware('auth', 'permission:View Nok Detail|All');

// => 15.11

Route::get('voucherpreview/{id}', [
    'uses' => 'ReportController@voucherPreview',
    'as' => 'document.voucherpreview'
])->middleware('auth', 'permission:Preview Voucher|All');

Route::get('voucherrejectpreview/{id}', [
    'uses' => 'ReportController@voucherRejectPreview',
    'as' => 'document.voucherrejectpreview'
])->middleware('auth', 'permission:Preview Voucher|All');

// => 15.12

Route::post('collection', [
    'uses' => 'ReportController@collectionReport',
    'as' => 'report.collection'
])->middleware('auth', 'permission:Collection Report|All');




// =================  END  DOCUMENT ROUTES  =================

// PERMISSION ROUTE (16)

// => 16.1


Route::get('rights', 'RightController@index');


// => 16.2
Route::post('rightupdate', [
    'uses' => 'RightController@updateRight',
    'as' => 'right.update'
])->middleware('auth');

Route::post('assignrightcommit', [
    'uses' => 'RightController@storeAssignRight',
    'as' => 'store.assign_right'
])->middleware('auth');

Route::get('showassignright/{id}', [
    'uses' => 'RightController@showAssignRight',
    'as' => 'show.assign_right'
])->middleware('auth');


// => 16.1
Route::get('permission', 'PermissionController@index');

// => 16.2
Route::match(['get', 'post'],'permissioncommit', [
    'uses' => 'PermissionController@storePermission',
    'as' => 'permission.store'
])->middleware('auth');

// => 16.3
Route::post('permissionupdate', [
    'uses' => 'PermissionController@updatePermission',
    'as' => 'permission.update'
])->middleware('auth');

// => 16.4

Route::get('showassignpermission/{id}', [
    'uses' => 'PermissionController@showAssignPermission',
    'as' => 'show.assign_permission'
])->middleware('auth', 'permission:Assign Permission|All');

// => 16.5

Route::get('permissionassign/{user}/{permission}', [
    'uses' => 'PermissionController@assignPermission',
    'as' => 'permission.assign'
])->middleware('auth');

// => 16.6

Route::post('assignpermissioncommit', [
    'uses' => 'PermissionController@storeAssignPermission',
    'as' => 'store.assign_permission'
])->middleware('auth');

// => 16.7

Route::get('modulepermission/{user}/{module}/{flag}', [
    'uses' => 'PermissionController@assignModulePermission',
    'as' => 'permission.module_assign'
])->middleware('auth');


// => 16.8
Route::get('showassignright/{id}', [
    'uses' => 'RightController@showAssignRight',
    'as' => 'show.assign_right'
])->middleware('auth');




// =================  END  PERMISSION ROUTES  =================



// REPORT ROUTE (17)

// => 17.1

Route::get('/reports', 'ReportController@index')->name('reports')->middleware('auth', 'permission:View Report|All');

// => 17.2

Route::post('/bookingreport', 'ReportController@bookingReport')->name('report.booking')->middleware('auth', 'permission:View Booking Report|All');

// => 17.3

Route::post('/incomereport', 'ReportController@incomeReport')->name('report.income')->middleware('auth', 'permission:View Income Report|All');

// => 17.4

Route::post('/expensereport', 'ReportController@expenseReport')->name('report.expense')->middleware('auth', 'permission:View Expense Report|All');

// => 17.5

Route::post('/accountreport', 'ReportController@accountReport')->name('report.account')->middleware('auth', 'permission:View Account Report|All');

// => 17.6

Route::post('/ledgerreport', 'ReportController@ledgerReport')->name('report.ledger')->middleware('auth', 'permission:View Ledger Report|All');

// => 17.7
Route::post('/inventoryreport', 'ReportController@inventoryReport')->name('report.inventory')->middleware('auth', 'permission:View Inventory Report|All');

// => 17.8
Route::post('/commissionreport', 'ReportController@commissionReport')->name('report.commission')->middleware('auth', 'permission:View Commission Report|All');

// => 17.9

Route::post('/installmentreport', 'ReportController@installmentReport')->name('report.installment')->middleware('auth', 'permission:View Aging Report|All');

// => 17.10
Route::post('/trialreport', 'ReportController@trialReport')->name('report.trial')->middleware('auth', 'permission:View Trial Report|All');

// => 17.111
Route::post('/profitloss', 'ReportController@profitLossReport')->name('report.profitloss')->middleware('auth', 'permission:View Profit Loss Report|All');

// => 17.12
Route::post('/balancesheet', 'ReportController@balanceSheetReport')->name('report.balancesheet')->middleware('auth', 'permission:View Balance Sheet Report|All');

// =================  END  REPORT ROUTES  =================

// Support System (18)

// => 18.1
Route::get('/support', 'SupportController@index')->middleware('auth');
// => 18.2
Route::post('supportcommit', [
    'uses' => 'SupportController@storeComplaint',
    'as' => 'support.store'
])->middleware('auth');
// => 18.3
Route::post('supportupdate', [
    'uses' => 'SupportController@updateComplaint',
    'as' => 'support.update'
])->middleware('auth');
// => 18.4
Route::get('supportdelete/{id}', [
    'uses' => 'SupportController@deleteComplaint',
    'as' => 'support.delete'
])->middleware('auth');
// => 18.5
Route::get('supportchat/{id}', [
    'uses' => 'SupportController@chatComplaint',
    'as' => 'support.chat'
])->middleware('auth');

// => 18.6
Route::get('getsupportcomments/{id}', [
    'uses' => 'SupportController@getComments',
    'as' => 'getsupport.comments'
])->middleware('auth');

// => 18.7
Route::get('supportcomment/{chat}/{client_comment}', [
    'uses' => 'SupportController@chatComment',
    'as' => 'support.comment'
])->middleware('auth');

// =================  END  SUPPORT ROUTES  =================

// CALL CENTER ROUTES (19)

// => 19.1
Route::get('/callcenter', 'CallCenterController@index')->name('callcenter')->middleware('auth', 'permission:View Call|All');

// => 19.2
Route::post('callcommit', [
    'uses' => 'CallCenterController@storeCall',
    'as' => 'call.store'
])->middleware('auth', 'permission:Add Call|All');

// => 19.3
Route::post('callupdate', [
    'uses' => 'CallCenterController@updateCall',
    'as' => 'call.update'
])->middleware('auth', 'permission:Update Call|All');

// => 19.4
Route::get('/calltrash/{id}', [
    'uses' => 'CallCenterController@removeCall',
    'as' => 'call.trash'
])->middleware('auth', 'permission:Remove Call|All');

// =================  END  CALL ROUTES  =================

// LOGS ROUTES (20)

// => 20.1

Route::get('/logs', 'HomeController@showLogs')->name('logs')->middleware('auth', 'permission:View Log|All');

// => 20.2
Route::get('/datewiselogs/{date}/{type}', [
    'uses' => 'HomeController@getDateWiseLogs',
    'as' => 'datewiselogs'
])->middleware('auth');

// =================  END LOG ROUTES  =================


// HR ROUTES (21)


// => 21.1
Route::get('/hr', 'Hr\HrController@index')->name('hr')->middleware('auth', 'permission:View HR|All');

// => 21.2
Route::get('/departments', 'Hr\DepartmentController@index')->name('departments')->middleware('auth', 'permission:View Department|All');

// => 21.3
Route::post('departmentcommit', [
    'uses' => 'Hr\DepartmentController@storeDepartment',
    'as' => 'department.store'
])->middleware('auth', 'permission:Add Department|All');

// => 21.4
Route::post('departmentupdate', [
    'uses' => 'Hr\DepartmentController@updateDepartment',
    'as' => 'department.update'
])->middleware('auth', 'permission:Update Department|All');

// => 21.5
Route::get('/departmenttrash/{id}', [
    'uses' => 'Hr\DepartmentController@removeDepartment',
    'as' => 'department.trash'
])->middleware('auth', 'permission:Remove Department|All');

// => 21.6
Route::post('assigndepartment', [
    'uses' => 'Hr\DepartmentController@assignDepartment',
    'as' => 'assign.department'
])->middleware('auth', 'permission:Assign Department|All');

// => 21.7
Route::get('/scales', 'Hr\ScaleController@index')->name('scales')->middleware('auth', 'permission:View Scale|All');

// => 21.8
Route::post('scalecommit', [
    'uses' => 'Hr\ScaleController@storeScale',
    'as' => 'scale.store'
])->middleware('auth', 'permission:Add Scale|All');

// => 21.9
Route::post('scaleupdate', [
    'uses' => 'Hr\ScaleController@updateScale',
    'as' => 'scale.update'
])->middleware('auth', 'permission:Update Scale|All');

// => 21.10
Route::get('/designation', 'Hr\DesignationController@index')->name('designation')->middleware('auth', 'permission:View Designation|All');

// => 21.11
Route::post('designationcommit', [
    'uses' => 'Hr\DesignationController@storeDesignation',
    'as' => 'designation.store'
])->middleware('auth', 'permission:Add Designation|All');

// => 21.12
Route::post('designationupdate', [
    'uses' => 'Hr\DesignationController@updateDesignation',
    'as' => 'designation.update'
])->middleware('auth', 'permission:Update Designation|All');

// => 21.13
Route::get('/allowance', 'Hr\AllowanceController@index')->name('allowance')->middleware('auth', 'permission:View Allowance|All');

// => 21.14
Route::post('allowancecommit', [
    'uses' => 'Hr\AllowanceController@storeAllowance',
    'as' => 'allowance.store'
])->middleware('auth', 'permission:Add Allowance|All');

// => 21.15
Route::post('allowanceupdate', [
    'uses' => 'Hr\AllowanceController@updateAllowance',
    'as' => 'allowance.update'
])->middleware('auth', 'permission:Update Allowance|All');


// => 21.16
Route::get('/viewassignallowance', 'Hr\AssignAllowanceController@index')->name('view.assign.allowance')->middleware('auth', 'permission:View Assigned Allowance|All');

// => 21.17
Route::post('/assignallowancecommit', 'Hr\AssignAllowanceController@storeAssignAllowance')->name('assignallowance.store')->middleware('auth', 'permission:Assign Allowance|All');

// => 21.18
Route::post('/assignallowanceupdate', 'Hr\AssignAllowanceController@updateAssignAllowance')->name('assignallowance.update')->middleware('auth', 'permission:Update Assign Allowance|All');


// CONTRACT (25)

// => 25.1
Route::get('/contract', 'Hr\ContractController@index')->name('contract')->middleware('auth', 'permission:View Contract|All');
// => 25.2
Route::post('contractcommit', [
    'uses' => 'Hr\ContractController@storeContract',
    'as' => 'contract.store'
])->middleware('auth', 'permission:Add Contract|All');
// => 25.3
Route::post('contractupdate', [
    'uses' => 'Hr\ContractController@updateContract',
    'as' => 'contract.update'
])->middleware('auth', 'permission:Update Contract|All');

Route::get('contractdetail/{id}', [
    'uses' => 'Hr\ContractDetailController@index',
    'as' => 'contract.details'
])->middleware('auth', 'permission:All|Contract Details');

Route::post('assetimageupload', [
    'uses' => 'Hr\ContractDetailController@uploadAssetImage',
    'as' => 'asset.imageupload'
])->middleware('auth');

Route::get('/removecontractdetail/{id}', [
    'uses' => 'Hr\ContractDetailController@removeContractDetail',
    'as' => 'contractdetail.trash'
])->middleware('auth', 'permission:Remove ContractDetail|All');

Route::get('getcontracts/{id}', [
    'uses' => 'Hr\ContractController@getContracts',
    'as' => 'contracts.list'
])->middleware('auth');

Route::post('allotcontract', [
    'uses' => 'Hr\ContractController@storeDetailByContract',
    'as' => 'allot.contract'
])->middleware('auth');


Route::post('/updatecontractdetail', [
    'uses' => 'Hr\ContractDetailController@updateContractDetail',
    'as' => 'contractdetail.update'
])->middleware('auth', 'permission:Update Contract Detail|All');

Route::get('getEmployeeDetail/{id}', [
    'uses' => 'Hr\ContractController@getEmployeeInfo',
    'as' => 'employee.info'
])->middleware('auth');


Route::get('contractassignment/{id}', [
    'uses' => 'Hr\ContractController@contractAssignment',
    'as' => 'contracts.assignment'
])->middleware('auth', 'permission:All|Assign Allowances/Assets');

// => 25.2
Route::post('allowanceassign', [
    'uses' => 'Hr\ContractController@assignAllowances',
    'as' => 'allowance.assign'
])->middleware('auth');


// => 25.2
Route::post('assetassign', [
    'uses' => 'Hr\ContractController@assignAssets',
    'as' => 'asset.assign'
])->middleware('auth');

// =============  END CONTRACT ROUTES  =============

// LOAN (26)

// => 26.1
Route::get('/loan', 'Hr\LoanController@index')->name('loan')->middleware('auth', 'permission:View Loan|All');

Route::post('loanvoucher', [
    'uses' => 'Hr\LoanController@createLoanVoucher',
    'as' => 'loan.voucher'
])->middleware('auth', 'permission:Approve Loan|All');
// => 26.2
Route::post('loancommit', [
    'uses' => 'Hr\LoanController@storeLoan',
    'as' => 'loan.store'
])->middleware('auth', 'permission:Add Loan|All');
// => 26.3
Route::post('loanupdate', [
    'uses' => 'Hr\LoanController@updateLoan',
    'as' => 'loan.update'
])->middleware('auth', 'permission:Update Loan|All');

Route::get('initializeloan/{id}', [
    'uses' => 'Hr\LoanController@initializeLoan',
    'as' => 'loan.initialize'
])->middleware('auth', 'permission:All|Manage Loan Installments');

Route::post('loandateupdate', [
    'uses' => 'Hr\LoanController@updateLoanDate',
    'as' => 'loandate.update'
])->middleware('auth', 'permission:All|Update Loan Date');
// =============  END LOAN ROUTES  =============


// LEAVE (25)

// => 25.1
Route::get('/leave', 'Hr\LeaveController@index')->name('leave')->middleware('auth', 'permission:View Leave|All');
// => 25.2
Route::post('leavecommit', [
    'uses' => 'Hr\LeaveController@storeLeave',
    'as' => 'leave.store'
])->middleware('auth', 'permission:Add Leave|All');
// => 25.3
Route::post('leaveupdate', [
    'uses' => 'Hr\LeaveController@updateLeave',
    'as' => 'leave.update'
])->middleware('auth', 'permission:Update Leave|All');

// =============  END LEAVE ROUTES  =============


// TAX (27)

// => 27.1
Route::get('/tax', 'Hr\TaxController@index')->name('tax')->middleware('auth', 'permission:View Tax|All');
// => 26.2
Route::post('taxcommit', [
    'uses' => 'Hr\TaxController@storeTax',
    'as' => 'tax.store'
])->middleware('auth', 'permission:Add Tax|All');
// => 26.3
Route::post('taxupdate', [
    'uses' => 'Hr\TaxController@updateTax',
    'as' => 'tax.update'
])->middleware('auth', 'permission:Update Tax|All');

// =============  END TAX ROUTES  =============

// PAYROLL (28)

Route::get('/minutesheet', 'Hr\MinuteSheetController@index')->name('minutesheet')->middleware('auth', 'permission:View MinuteSheet|All');

// => 25.2
Route::post('minutesheetcommit', [
    'uses' => 'Hr\MinuteSheetController@storeMinuteSheet',
    'as' => 'minute_sheet.store'
])->middleware('auth', 'permission:Generate MinuteSheet|All');

Route::post('minutesheetupdate', [
    'uses' => 'Hr\MinuteSheetController@updateMinuteSheet',
    'as' => 'minute_sheet.update'
])->middleware('auth', 'permission:Update Minute Sheet|All');

Route::get('minutesheetdetail/{id}', [
    'uses' => 'Hr\MinuteSheetController@viewMinuteSheetDetail',
    'as' => 'minute_sheet.details'
])->middleware('auth', 'permission:All|View MinuteSheet Details');

Route::get('minutesheetrefresh/{id}', [
    'uses' => 'Hr\MinuteSheetController@refreshMinuteSheet',
    'as' => 'minute_sheet.refresh'
])->middleware('auth', 'permission:All|Refresh MinuteSheet');

Route::get('minutesheetdownload/{id}', [
    'uses' => 'Hr\MinuteSheetController@downloadMinuteSheet',
    'as' => 'minute_sheet.download'
])->middleware('auth', 'permission:All|Download MinuteSheet');


Route::post('userPayrollDetails', [
    'uses' => 'Hr\PayrollDetailController@getUserPayRollDetails',
    'as' => 'user.payrolldetails'
])->middleware('auth', 'permission:Update Payroll Details|All');

// => 25.2
Route::post('payrolldeductioncommit', [
    'uses' => 'Hr\PayrollDetailController@storePayrollDeduction',
    'as' => 'payrolldeduction.store'
])->middleware('auth');

// => 25.2
Route::post('payrolldetailupdate', [
    'uses' => 'Hr\PayrollDetailController@updatePayrollDetail',
    'as' => 'payroll_detail.update'
])->middleware('auth');

// => 25.2
Route::post('payrollpost', [
    'uses' => 'Hr\PayrollController@postPayroll',
    'as' => 'payroll.post'
])->middleware('auth', 'permission:Post Payroll|All');



// =============  END PAYROLL ROUTES  =============

// DEDUCTION (25)

// => 25.1
Route::get('/deduction', 'Hr\DeductionController@index')->name('deduction')->middleware('auth', 'permission:View Deduction|All');
// => 25.2
Route::post('deductioncommit', [
    'uses' => 'Hr\DeductionController@storeDeduction',
    'as' => 'deduction.store'
])->middleware('auth', 'permission:Add Deduction|All');
// => 25.3
Route::post('deductionupdate', [
    'uses' => 'Hr\DeductionController@updateDeduction',
    'as' => 'deduction.update'
])->middleware('auth', 'permission:Update Deduction|All');

// => 23.4
Route::get('getdeduction/{id}', [
    'uses' => 'Hr\DeductionController@getDeduction',
    'as' => 'getdeduction'
])->middleware('auth');

// =============  END DEDUCTION ROUTES  =============


// SETTING (25)

// => 25.1
Route::get('/setting', 'Hr\SettingController@index')->name('setting')->middleware('auth', 'permission:View Setting|All');
// => 25.2
Route::post('settingcommit', [
    'uses' => 'Hr\SettingController@storeSetting',
    'as' => 'setting.store'
])->middleware('auth', 'permission:Add Setting|All');
// => 25.3
Route::post('settingupdate', [
    'uses' => 'Hr\SettingController@updateSetting',
    'as' => 'setting.update'
])->middleware('auth', 'permission:Update Setting|All');

// =============  END DEDUCTION ROUTES  =============


// => 21.13
Route::get('/asset', 'Hr\AssetController@index')->name('asset')->middleware('auth', 'permission:View Asset|All');

// => 21.14
Route::post('assetcommit', [
    'uses' => 'Hr\AssetController@storeAsset',
    'as' => 'asset.store'
])->middleware('auth', 'permission:Add Asset|All');

// => 21.15
Route::post('assetupdate', [
    'uses' => 'Hr\AssetController@updateAsset',
    'as' => 'asset.update'
])->middleware('auth', 'permission:Update Asset|All');






// =================  END HR ROUTES  =================



// LETTER ROUTES (22)

// => 22.1
Route::get('/letters', 'LetterController@index')->name('letters')->middleware('auth', 'permission:View Letter|All');


Route::post('/letterdata', 'LetterController@getLetterData')->name('letter.data')->middleware('auth');

Route::post('/letterpdf', 'LetterController@getLetterPdf')->name('letters.pdf')->middleware('auth');

Route::get('/branchbookings/{branch}', 'LetterController@getBranchBookings')->middleware('auth');


// =================  END LETTER ROUTES  =================

// BANK ROUTES (23)

// => 23.1
Route::get('/bank', 'BankController@index')->name('bank')->middleware('auth', 'permission:View Bank|All');

// => 23.2
Route::post('bankcommit', [
    'uses' => 'BankController@storeBank',
    'as' => 'bank.store'
])->middleware('auth', 'permission:Add Bank|All');

// => 23.3
Route::post('bankupdate', [
    'uses' => 'BankController@updateBank',
    'as' => 'bank.update'
])->middleware('auth', 'permission:Update Bank|All');

// => 23.4
Route::get('/banktrash/{id}', [
    'uses' => 'BankController@removeBank',
    'as' => 'bank.trash'
])->middleware('auth', 'permission:Remove Bank|All');

// =================  END Bank ROUTES  =================

// PAYMENT ROUTES (24)

// => 24.1
Route::get('/pendingpayment', 'PaymentController@index')->name('pending_payments')->middleware('auth', 'permission:View Pending Payment|All');

// => 24.2
Route::post('paymentcommit', [
    'uses' => 'PaymentController@payPayment',
    'as' => 'payment.pay'
])->middleware('auth', 'permission:Add Payment|All');

// => 24.3
Route::post('updatepayment', [
    'uses' => 'PaymentController@updatePayPayment',
    'as' => 'payment.update'
])->middleware('auth', 'permission:Update Payment|All');

// => 24.4
Route::get('/paymenttrash/{id}', [
    'uses' => 'PaymentController@removePayment',
    'as' => 'payment.trash'
])->middleware('auth', 'permission:Remove Payment|All');

// => 24.5
Route::get('/bookingpayment/{id}', [
    'uses' => 'PaymentController@getBookingPaymentDropdown',
    'as' => 'bookingpayment'
])->middleware('auth');

// => 24.6
Route::get('/getpayment/{id}', [
    'uses' => 'PaymentController@getPaymentById',
    'as' => 'getpayment'
])->middleware('auth');

Route::get('/showpaypaymentmodel/{type}/{generic_id}', [
    'uses' => 'PaymentController@showPayPaymentModel',
    'as' => 'showpaypaymentmodel'
])->middleware('auth');

Route::get('/showupdatepaypaymentmodel/{payment_id}', [
    'uses' => 'PaymentController@showUpdatePayPaymentModel',
    'as' => 'showupdatepaypaymentmodel'
])->middleware('auth');

// => 24.3
Route::post('genericpaymentlist', [
    'uses' => 'PaymentController@getGenericPaymentList',
    'as' => 'genericpaymentlist'
])->middleware('auth');

// => 24.3
Route::get('showpaymentvoucher/{id}/{type}', [
    'uses' => 'PaymentController@showPaymentVoucher',
    'as' => 'showpaymentvoucher'
])->middleware('auth');




// =================  END PAYMENT ROUTES  =================



// INVENTORY MODULE  ROUTES

// => 30.1

Route::get('/inventory', 'Inventory\InventoryController@index')->name('inventory')->middleware('auth', 'permission:All|View Process');

Route::get('/inventory_reports', 'Inventory\InventoryController@reports')->name('intreports')->middleware('auth', 'permission:All|View Intreports');


Route::GET('projectwise', [
    'uses' => 'Inventory\InventoryController@projectwise',
    'as' => 'projectwise.details'
])->middleware('auth', 'permission:All|Intreports');

Route::GET('payablereport', [
    'uses' => 'Inventory\InventoryController@inventoryPayable',
    'as' => 'report.payable'
])->middleware('auth', 'permission:All|Intreports');

//SUPPLIER/VENDOR ROUTES(31)
Route::get('qoutations/{id}', [
    'uses' => 'Inventory\BOQItemsController@qoutationlist',
    'as' => 'vendor.qoutations'
])->middleware('auth', 'permission:Qoutations|All');


Route::post('qoutationSubmit', [
    'uses' => 'Inventory\BOQItemsController@qoutationSubmit',
    'as' => 'qoutation.store'
])->middleware('auth', 'permission:Qoutations|All');
// => 31.1

Route::get('suppliers', [
    'uses' => 'UserController@viewAllSuppliers',
    'as' => 'user.suppliers'
])->middleware('auth', 'permission:View Contractor/Vendor|All');

// => 31.2
Route::post('suppliercommit', [
    'uses' => 'UserController@storeSupplier',
    'as' => 'supplier.store'
])->middleware('auth', 'permission:Add Supplier|All');

// => 31.3
Route::post('supplierupdate', [
    'uses' => 'UserController@updateSupplier',
    'as' => 'supplier.update'
])->middleware('auth', 'permission:Update Supplier|All');


// =================  END  SUPPLIER/VENDOR  ROUTES  =================





// CONTRACTOR ROUTES (32)


// => 32.1

// Route::get('contractors',[
// 	'uses'=>'UserController@viewAllContractors',
// 	'as'=>'user.contractors'
// 	])->middleware('auth','permission:View Contractor|All');

// => 32.2

Route::post('contractorcommit', [
    'uses' => 'UserController@storeContractor',
    'as' => 'contractor.store'
])->middleware('auth', 'permission:Add Contractor|All');

// => 32.3
Route::post('contractorupdate', [
    'uses' => 'UserController@updateContractor',
    'as' => 'contractor.update'
])->middleware('auth', 'permission:Update Contractor|All');

// =================  END CONTRACTOR ROUTES  =================

//PRODUCT ROUTES(33)

// => 33.1




// =================  END  PRODUCT  ROUTES  =================




//usertoprojects routes
Route::get('usertoprojects', [
    'uses' => 'Inventory\BOQItemsController@view',
    'as' => 'user.projects'
])->middleware('auth', 'permission:View UsertoProjects|All');


Route::get('get_usertoprojects/{id}', [
    'uses' => 'Inventory\BOQItemsController@getProjects',
    'as' => 'user.getprojects'
])->middleware('auth', 'permission:View UsertoProjects|All');

Route::post('usertoprojects_save', [
    'uses' => 'Inventory\BOQItemsController@save',
    'as' => 'usertoprojects.save'
])->middleware('auth', 'permission:View UsertoProjects|All');


//item ROUTES(34)
// => 34.1

Route::get('items', [
    'uses' => 'Inventory\ItemController@viewAllitems',
    'as' => 'item.items'
])->middleware('auth', 'permission:View Item|All');




// => 34.2
Route::post('inventorycategory', [
    'uses' => 'Inventory\ItemController@storeInventoryCategory',
    'as' => 'inventory_category.store'
])->middleware('auth');

Route::post('inventoryunit', [
    'uses' => 'Inventory\ItemController@storeInventoryUnit',
    'as' => 'inventory_unit.store'
])->middleware('auth');

// => 34.2
Route::post('servicecommit', [
    'uses' => 'Inventory\ItemController@storeService',
    'as' => 'service.store'
])->middleware('auth', 'permission:Add Service|All');

// => 34.3
Route::post('serviceupdate', [
    'uses' => 'Inventory\ItemController@updateService',
    'as' => 'service.update'
])->middleware('auth', 'permission:Update Service|All');


// => 34.3
Route::post('productcommit', [
    'uses' => 'Inventory\ItemController@storeProduct',
    'as' => 'product.store'
])->middleware('auth', 'permission:Add Product|All');

// => 33.4
Route::post('productupdate', [
    'uses' => 'Inventory\ItemController@updateProduct',
    'as' => 'product.update'
])->middleware('auth', 'permission:Update Product|All');


Route::GET('product_details/{id}', [
    'uses' => 'Inventory\ItemController@viewProductDetail',
    'as' => 'product.details'
])->middleware('auth', 'permission:Stock Details|All');


// =================  END  Items  ROUTES  =================

//BOQ ROUTES(35)

Route::get('create_purchase_requsition', [
    'uses' => 'Inventory\BillOfQuantityController@createboqrequsition',
    'as' => 'boq.createboqrequsition'
])->middleware('auth', 'permission:BOQ|All');

Route::post('createpurchasecommit', [
    'uses' => 'Inventory\BillOfQuantityController@storecreatepurchase',
    'as' => 'createpurchase.store'
])->middleware('auth');

// => 35.1

Route::get('boqaddform', [
    'uses' => 'Inventory\BillOfQuantityController@addBOQForm',
    'as' => 'boq.addform'
])->middleware('auth', 'permission:BOQ|All');

// => 35.2

Route::get('/getitemlist/{category}/{type}', [
    'uses' => 'Inventory\ItemController@getItemList',
    'as' => 'boq.items'
])->middleware('auth');

Route::get('/getitemid/{id}/{project}', [
    'uses' => 'Inventory\ItemController@getitemid',
    'as' => 'boq.getitemid'
])->middleware('auth');

// => 35.3

Route::get('/getitemcategorylist/{type}', [
    'uses' => 'Inventory\ItemController@getCategoryListByType',
    'as' => 'items.category'
])->middleware('auth');


Route::get('/getitemDetails/{id}', [
    'uses' => 'Inventory\ItemController@getitemDetailsajax',
    'as' => 'items.getitemDetails'
])->middleware('auth');

// => 35.4

Route::get('/getitemdata/{item}/{unit}', [
    'uses' => 'Inventory\ItemController@getItemDetails',
    'as' => 'items.details'
])->middleware('auth');

// => 35.5

Route::post('boqcommit', [
    'uses' => 'Inventory\BillOfQuantityController@storeBOQ',
    'as' => 'boq.store'
])->middleware('auth');

// => 35.6
Route::get('boqrequest-pr', [
    'uses' => 'Inventory\BillOfQuantityController@viewBOQRequests_pr',
    'as' => 'boq.requests_pr'
])->middleware('auth', 'permission:View PR|All');


Route::get('create-po', [
    'uses' => 'Inventory\BillOfQuantityController@createRequestpo',
    'as' => 'create.requests_po'
])->middleware('auth', 'permission:View PO|All');

// => 35.7
Route::get('/boqreject/{id}', [
    'uses' => 'Inventory\BillOfQuantityController@rejectBOQ',
    'as' => 'boq.reject'
])->middleware('auth', 'permission:Reject BOQ|All|Reject PR');

// => 35.8
Route::get('boqrequestdetail/{id}', [
    'uses' => 'Inventory\BillOfQuantityController@viewBOQRequestDetails',
    'as' => 'boqrequest.details'
])->middleware('auth', 'permission:Accept PR|All');

Route::get('porequestdetail/{id}', [
    'uses' => 'Inventory\BillOfQuantityController@viewPORequestDetails',
    'as' => 'porequest.details'
])->middleware('auth', 'permission:Accept PO|All');

// => 35.9
Route::POST('boqaccept', [
    'uses' => 'Inventory\BillOfQuantityController@acceptBOQ',
    'as' => 'boq.accept'
])->middleware('auth', 'permission:View BOQ Requests Accept|All');

Route::POST('boq_accept', [
    'uses' => 'Inventory\BillOfQuantityController@acceptBOQfirst',
    'as' => 'boq.acceptfirst'
])->middleware('auth', 'permission:View BOQ Requests Accept PR|All');

// => 35.10
Route::get('viewBOQDetails/{id}', [
    'uses' => 'Inventory\BillOfQuantityController@viewBOQDetails',
    'as' => 'boq.details'
])->middleware('auth', 'permission:BOQ Details|All');

// => 35.11
Route::get('boqrequest', [
    'uses' => 'Inventory\BillOfQuantityController@viewBOQRequests',
    'as' => 'boq.requests'
])->middleware('auth', 'permission:View BOQ Request|All');

// => 35.12
Route::GET('boqRequestAccept/{id}', [
    'uses' => 'Inventory\BillOfQuantityController@boqRequestAccept',
    'as' => 'boqrequest.accept'
])->middleware('auth', 'permission:Accept BOQ|All');


Route::GET('prPDF/{id}', [
    'uses' => 'Inventory\BillOfQuantityController@downloadPDFpr',
    'as' => 'downloadPDF.pr'
])->middleware('auth', 'permission:PR Document|All');

Route::get('/prdetail/{id}', [
    'uses' => 'Inventory\BillOfQuantityController@PRDetail',
    'as' => 'pr.detail'
])->middleware('auth', 'permission:PR Details|All');

Route::get('/po_request_detail/{id}', [
    'uses' => 'Inventory\BillOfQuantityController@PO_Detailrequest',
    'as' => 'porqe.detail'
])->middleware('auth', 'permission:PO Details|All');


Route::GET('/vendorupload', [
    'uses' => 'Inventory\BillOfQuantityController@vendorupload',
    'as' => 'vendorupload'
])->middleware('auth');

Route::POST('/vendoruploadsubmit', [
    'uses' => 'Inventory\BillOfQuantityController@vendoruploadsubmit',
    'as' => 'vendoruploadsubmit'
])->middleware('auth');
// =================  END  BOQ  ROUTES  =================



//PURCHASE ORDER ROUTES

//36.1

Route::get('purchaseorders', [
    'uses' => 'Inventory\PurchaseOrderController@viewAllPurchaseOrders',
    'as' => 'purchaseorders'
])->middleware('auth', 'permission:View PO|All');

// => 36.2
Route::get('/poreject/{id}', [
    'uses' => 'Inventory\PurchaseOrderController@rejectPO',
    'as' => 'po.reject'
])->middleware('auth', 'permission:Reject PO|All');


// => 36.3
Route::post('/poaccept', [
    'uses' => 'Inventory\PurchaseOrderController@acceptPO',
    'as' => 'po.accept'
])->middleware('auth', 'permission:Accept PO|All');

// => 36.4
Route::get('/podetail/{id}', [
    'uses' => 'Inventory\PurchaseOrderController@PODetail',
    'as' => 'po.detail'
])->middleware('auth', 'permission:PO Details|All');

Route::GET('poPDF/{id}', [
    'uses' => 'Inventory\PurchaseOrderController@downloadPDFpo',
    'as' => 'downloadPDF.po'
])->middleware('auth', 'permission:With Rate PO Document|All');
Route::GET('poratePDF/{id}', [
    'uses' => 'Inventory\PurchaseOrderController@downloadPDFporate',
    'as' => 'downloadPDF.porate'
])->middleware('auth', 'permission:Without Rate PO Document|All');

//================= END PURCHASE ORDER ROUTES ======================

//GRN ROUTES

Route::get('grn', [
    'uses' => 'Inventory\ReceivingNoteController@view',
    'as' => 'grn.view'
])->middleware('auth', 'permission:View GRN|All');

Route::GET('grn_generate', [
    'uses' => 'Inventory\ReceivingNoteController@generateGrn',
    'as' => 'grn.generate'
])->middleware('auth', 'permission:View GRN|All');

Route::POST('grn_commit', [
    'uses' => 'Inventory\ReceivingNoteController@commitGrn',
    'as' => 'grn.commit'
])->middleware('auth', 'permission:View GRN|All');

Route::get('/grndetail/{id}', [
    'uses' => 'Inventory\ReceivingNoteController@grnDetail',
    'as' => 'grn.detail'
])->middleware('auth', 'permission:GRN Details|All');
Route::get('/grnaccept/{id}', [
    'uses' => 'Inventory\ReceivingNoteController@grnAccept',
    'as' => 'mygrn.accept'
])->middleware('auth', 'permission:GRN Details|All');
Route::get('/grnreject/{id}', [
    'uses' => 'Inventory\ReceivingNoteController@grnReject',
    'as' => 'mygrn.reject'
])->middleware('auth', 'permission:GRN Details|All');

Route::get('/grninvoice/{id}', [
    'uses' => 'Inventory\ReceivingNoteController@showInvoiceModal',
    'as' => 'issueinvoice'
])->middleware('auth', 'permission:All|GRN Invoice');

Route::get('/getPOList/{type}', [
    'uses' => 'Inventory\ReceivingNoteController@getPOList',
    'as' => 'getPO.List'
])->middleware('auth');

Route::get('/getPOListvendor/{type}', [
    'uses' => 'Inventory\ReceivingNoteController@getPOListvendor',
    'as' => 'getPOListvendor.List'
])->middleware('auth');

Route::get('/getPOListproduct/{type}', [
    'uses' => 'Inventory\ReceivingNoteController@getPOListproduct',
    'as' => 'getPOListproduct.List'
])->middleware('auth');


// =================  END INVENTORY MODULE  ROUTES  =================


//GIN ROUTES

Route::get('gin', [
    'uses' => 'Inventory\IssueNoteController@view',
    'as' => 'gin.view'
])->middleware('auth', 'permission:View GIN|All');

Route::POST('gin_commit', [
    'uses' => 'Inventory\IssueNoteController@commitGin',
    'as' => 'commit.gin'
])->middleware('auth', 'permission:Add Product GIN|All');

Route::POST('gin_commit_service', [
    'uses' => 'Inventory\IssueNoteController@commitGinService',
    'as' => 'commit.gin_service'
])->middleware('auth', 'permission:Add Service GIN|All');

Route::GET('ginPDF/{id}', [
    'uses' => 'Inventory\IssueNoteController@downloadPDFgin',
    'as' => 'downloadPDF.gin'
])->middleware('auth', 'permission:GIN Document|All');

Route::GET('ginViewDetails/{id}', [
    'uses' => 'Inventory\IssueNoteController@viewdetailsGIN',
    'as' => 'viewdetail.gin'
])->middleware('auth', 'permission:GIN Document|All');

Route::GET('grnPDF/{id}', [
    'uses' => 'Inventory\ReceivingNoteController@downloadPDFgrn',
    'as' => 'downloadPDF.grn'
])->middleware('auth', 'permission:GRN Document|All');

Route::GET('grnViewDetails/{id}', [
    'uses' => 'Inventory\ReceivingNoteController@viewdetailsGRN',
    'as' => 'viewdetail.grn'
])->middleware('auth', 'permission:GRN Document|All');


// =================  END GIN MODULE  ROUTES  =================

//Stock ROUTES

Route::get('stock', [
    'uses' => 'Inventory\StockController@view',
    'as' => 'stock.view'
])->middleware('auth', 'permission:View Stock|All');

Route::GET('stock_detail/{id}', [
    'uses' => 'Inventory\StockController@stockDetail',
    'as' => 'stock.details'
])->middleware('auth', 'permission:Stock Details|All');

//INVENTORY PAYABLES

Route::get('/inventorypendingpayment', 'PaymentController@inventoryPendingPayments')->name('inventory_pendingpayment')->middleware('auth', 'permission:View Pending Payment|All');

Route::get('inventory_payables', [
    'uses' => 'Inventory\PayableController@view',
    'as' => 'payable.view'
])->middleware('auth', 'permission:All');

Route::POST('payable_commit', [
    'uses' => 'Inventory\PayableController@storePayable',
    'as' => 'payable.store'
])->middleware('auth', 'permission:Store Payable|All');

Route::post('paypayable', [
    'uses' => 'Inventory\PayableController@payPayable',
    'as' => 'pay.payable'
])->middleware('auth', 'permission:Pay Inventory Payable|All');

Route::POST('/commit_transfer', [
    'uses' => 'Inventory\StockController@transfer',
    'as' => 'commit.transfer'
])->middleware('auth');


// =================  END GIN MODULE  ROUTES  =================

//BILLS AND PAAYBLES ROUTE
// =>26.1

Route::get('/billandpayments', [
    'uses' => 'Bill\BillController@billandpayments',
    'as' => 'billandpayments'
])->middleware('auth');

// =>26.2

Route::POST('/commit_category', [
    'uses' => 'Bill\BillController@commit_category',
    'as' => 'commit_category'
])->middleware('auth');

// =>26.3
Route::GET('/bill_category/{id}', [
    'uses' => 'Bill\BillController@bill_category',
    'as' => 'bill_category'
])->middleware('auth');

// =>26.4

Route::POST('/commit_bill', [
    'uses' => 'Bill\BillController@commit_bill',
    'as' => 'commit_bill'
])->middleware('auth');

// =>26.5

Route::POST('/commit_subcategory', [
    'uses' => 'Bill\BillController@commitSubcategory',
    'as' => 'commit_subcategory'
])->middleware('auth');

// =>26.6
Route::GET('/show_bill_installments/{id}', [
    'uses' => 'Bill\BillController@show_bill_installments',
    'as' => 'show_bill_installments'
])->middleware('auth');


// =>26.5

Route::GET('/createrole/{role}', [
    'uses' => 'UserController@createRole',
    'as' => 'create.role'
])->middleware('auth');

			// =>26.5

// DASHBOARD
Route::post('bookingstats', [
    'uses' => 'DashboardController@getBookingStats',
    'as'   => 'bookingstats'
])->middleware('auth');

Route::post('otherbookingstats', [
    'uses' => 'DashboardController@getOtherBookingStats',
    'as'   => 'otherbookingstats'
])->middleware('auth');

Route::post('inventoryprogress', [
    'uses' => 'DashboardController@getInventoryProgress',
    'as'   => 'inventoryprogress'
])->middleware('auth');

Route::post('salespersonprogress', [
    'uses' => 'DashboardController@getSalesPersonProgress',
    'as'   => 'salespersonprogress'
])->middleware('auth');

Route::post('totaloverdue', [
    'uses' => 'DashboardController@getTotalOverDue',
    'as'   => 'totaloverdue'
])->middleware('auth');

Route::post('bookingwiseoverdue', [
    'uses' => 'DashboardController@getBookingOverDues',
    'as'   => 'bookingwiseoverdue'
])->middleware('auth');

Route::post('reminderoverdue', [
    'uses' => 'DashboardController@getFiveDayReminder',
    'as'   => 'reminderoverdue'
])->middleware('auth');
// END DASHBOARD

Route::get('/allblocklist/{project}', 'PlotController@getAllPlotBlockByProject')->middleware('auth');


//  VENDOR ROUTES
Route::get('vendorandpayment', 'VendorController@index')->name('vendorandpayment')->middleware('auth','permission:View Vendor and Payments|All');

Route::post('vendorandpaymentcommit',[
    'uses'=>'VendorController@storeVendor',
    'as'=>'vendorandpayment.store'
    ])->middleware('auth','permission:Add Vendor|All');

Route::post('vendorandpaymentupdate',[
    'uses'=>'VendorController@updateVendor',
    'as'=>'vendorandpayment.update'
    ])->middleware('auth','permission:Update Vendor|All');

Route::get('trashvendorandpayment/{id}', 'VendorController@removeVendor')->name('trashvendorandpayment')->middleware('auth','permission:Remove Vendor|All');

//  END ROUTES


//  VENDOR PAYMENT ROUTES
Route::get('vendorpayments', 'VendorPaymentController@index')->name('vendorpayments,View Vendor Payment|All')->middleware('auth');

Route::get('vendorpaymentbyvendor/{id}', 'VendorPaymentController@showVendorPaymentByVendor')->name('vendorpaymentbyvendor')->middleware('auth','permission:View Vendor Payment|All');

Route::post('vendorpaymentcommit',[
    'uses'=>'VendorPaymentController@storeVendorPayment',
    'as'=>'vendorpayment.store'
    ])->middleware('auth','permission:Create Vendor Payment|All');

Route::post('vendorpaymentupdate',[
    'uses'=>'VendorPaymentController@updateVendorPayment',
    'as'=>'vendorpayment.update'
    ])->middleware('auth','permission:Update Vendor Payment|All');

Route::get('trashvendorpayment/{id}', 'VendorPaymentController@removeVendorPayment')->name('trashvendorpayment')->middleware('auth','permission:Remove Vendor Payment|All');

Route::get('showvendorpaymentmodel/{id}', 'VendorPaymentController@showVendorPaymentUpdateModel')->name('showvendorpaymentmodel')->middleware('auth');


//  END ROUTES

Route::get('s3-import', function () {

    // BRANCHES

    // $column_name = 'logo';
	// $images_list = \App\Branch::whereNotIn($column_name,['/graphics/logo/user.png'])->selectRaw("id,".$column_name)->cursor();
	// \EF::downloadS3Data($images_list,$column_name);

    // $column_name = 'footer';
	// $images_list = \App\Branch::whereNotIn($column_name,['/graphics/logo/user.png'])->selectRaw("id,".$column_name)->cursor();
	// \EF::downloadS3Data($images_list,$column_name);
    
    // END BRANCHES

    // USERS
	$column_name = 'dp';
	$images_list = \App\User::whereNotIn($column_name,['/graphics/logo/user.png'])->selectRaw("id,".$column_name)->cursor();
	\EF::downloadS3Data($images_list,$column_name);
    // END USERS

    // DOCUMENTS
	$column_name = 'doc_file';
	$images_list = \App\Document::whereNotIn($column_name,['/graphics/logo/user.png'])->selectRaw("id,".$column_name)->cursor();
	\EF::downloadS3Data($images_list,$column_name);
    // END DOCUMENTS

    // TRANSFER

	// $column_name = 'seller_photo';
	// $images_list = \App\Transfer::whereNotIn($column_name,['/graphics/logo/user.png'])->selectRaw("id,".$column_name)->cursor();
	// \EF::downloadS3Data($images_list,$column_name);

    // $column_name = 'buyer_photo';
	// $images_list = \App\Transfer::whereNotIn($column_name,['/graphics/logo/user.png'])->selectRaw("id,".$column_name)->cursor();
	// \EF::downloadS3Data($images_list,$column_name);

    // $column_name = 'attorney_photo';
	// $images_list = \App\Transfer::whereNotIn($column_name,['/graphics/logo/user.png'])->selectRaw("id,".$column_name)->cursor();
	// \EF::downloadS3Data($images_list,$column_name);

    // $column_name = 'agent_photo';
	// $images_list = \App\Transfer::whereNotIn($column_name,['/graphics/logo/user.png'])->selectRaw("id,".$column_name)->cursor();
	// \EF::downloadS3Data($images_list,$column_name);

    // $column_name = 'witness_photo';
	// $images_list = \App\Transfer::whereNotIn($column_name,['/graphics/logo/user.png'])->selectRaw("id,".$column_name)->cursor();
	// \EF::downloadS3Data($images_list,$column_name);

    // $column_name = 'vedio';
	// $images_list = \App\Transfer::whereNotIn($column_name,['/graphics/logo/user.png'])->selectRaw("id,".$column_name)->cursor();
	// \EF::downloadS3Data($images_list,$column_name);
    
    // END TRANSFER

    // WITNESS TABLE

    // $column_name = 'photo';
	// $images_list = \App\Witness::whereNotIn($column_name,['/graphics/logo/user.png'])->selectRaw("id,".$column_name)->cursor();
	// \EF::downloadS3Data($images_list,$column_name);

    // END WITNESS TABLE
});

