<?php


use Illuminate\Support\Facades\Route;

Route::group(['namespace' => 'Gisplus\Package\EstatechVendor\Controllers','middleware' => ['web']], function () {
   
Route::get('vendormodule', 'VendorController@vendorDashboard')->name('vendormodule')->middleware('auth');
    
    
Route::get('vendors', 'VendorController@index')->name('vendors')->middleware('auth');

Route::post('vendorcommit', [
    'uses' => 'VendorController@storeVendor',
    'as' => 'vendor.store'
])->middleware('auth');

Route::post('vendorupdate', [
    'uses' => 'VendorController@updateVendor',
    'as' => 'vendor.update'
])->middleware('auth');

Route::get('/vendortrash/{id}', [
    'uses' => 'VendorController@removeVendor',
    'as' => 'vendor.trash'
])->middleware('auth');

Route::get('/vendorinfo/{vendor}', 'VendorController@getVendorInfo')->middleware('auth');

Route::match(['get','post'],'vendoropeningbalance', [
    'uses' => 'VendorController@updateVendorOpeningBalance',
    'as' => 'vendoropeningbalance'
])->middleware('auth');

// INVOICE ROUTES

Route::get('invoices', 'InvoiceController@index')->name('invoices')->middleware('auth');

Route::get('invoicecommit', 'InvoiceController@showStoreInvoice')->name('invoicecommit')->middleware('auth');

Route::post('invoicecommit', [
    'uses' => 'InvoiceController@storeInvoice',
    'as' => 'invoice.store'
])->middleware('auth');


Route::get('invoiceupdate/{id}', 'InvoiceController@showUpdateInvoice')->name('invoiceupdate')->middleware('auth');

Route::post('invoiceupdate', [
    'uses' => 'InvoiceController@updateInvoice',
    'as' => 'invoice.update'
])->middleware('auth');

Route::get('invoicetrash/{id}', [
    'uses' => 'InvoiceController@removeInvoice',
    'as' => 'invoice.trash'
])->middleware('auth');

Route::get('invoicepayments', [
    'uses' => 'InvoiceController@showPendingInvoicePayments',
    'as' => 'invoicepayments'
])->middleware('auth');

Route::get('printinvoice/{id}', [
    'uses' => 'InvoiceController@printInvoice',
    'as' => 'document.print_invoice'
])->middleware('auth'); 

Route::match(['get', 'post'],'vendorreport',[
    'uses'  =>  "InvoiceController@vendorReport",
    'as'    =>  "vendorreport",
    ])->middleware('auth');

Route::match(['get'],'showpayinvoice/{type}/{id}',[
    'uses'  =>  "InvoiceController@showPayInvoice",
    'as'    =>  "showpayinvoice",
    ])->middleware('auth');

Route::match(['get', 'post'],'payinvoicevendor',[
    'uses'  =>  "InvoiceController@payVendorPayment",
    'as'    =>  "payinvoice.vendor",
    ])->middleware('auth');


});