<?php
use core\Router;

$router = new Router();
// Home
$router->get('/', 'HomeController@index');
$router->post('/usermessageread', 'HomeController@setMessageRead');
// Fim Home

// Processo de Login
$router->get('/login', 'LoginController@signin');
$router->post('/login', 'LoginController@signinAction');
$router->get('/logout', 'LoginController@logout');
// Fim Processo de Login

// Processo de esqueci minha senha
$router->get('/forgot', 'LoginController@forgot');
$router->get('/forgotlink', 'LoginController@forgotLink');

$router->post('/forgot', 'LoginController@forgotAction');
$router->post('/updatepassword', 'LoginController@update');
// Fim Processo de esqueci minha senha

// Dashboard
$router->get('/dashboard', 'DashboardController@index');
// Fim Dashboard

// Clientes
$router->get('/clients', 'ClientsController@index');
$router->get('/addclient', 'ClientsController@add');
$router->get('/editclient', 'ClientsController@edit');

$router->post('/clients', 'ClientsController@index');
$router->post('/saveclient', 'ClientsController@addAction');
$router->post('/updateclient', 'ClientsController@editAction');

// Busca em clientes via ajax
$router->post('/searchclient', 'ClientsController@searchClients');
$router->post('/searchclientby', 'ClientsController@searchClientsBy');
$router->post('/getclient', 'ClientsController@getFullClient');
// Fim Clientes

// Fazendas
$router->get('/farms', 'FarmsController@index');
$router->get('/addfarms', 'FarmsController@add');
$router->get('/editfarms', 'FarmsController@edit');
$router->get('/updatestatus', 'FarmsController@updateStatus');

$router->post('/verifyexistsfarm', 'UtilsController@verifyExistsFarm');
$router->post('/addfarms', 'FarmsController@addAction');
$router->post('/editfarms', 'FarmsController@editAction');
$router->post('/deleteattfarm', 'FarmsController@deleteAtt');

// Busca em fazendas via ajax
$router->post('/getfarmsclient', 'FarmsController@getFarmsClient');
$router->post('/getfarminfo', 'FarmsController@getFarmInfo');
// Fim Fazendas

// Produtos
$router->get('/products', 'ProductsController@index');
$router->get('/addproducts', 'ProductsController@add');
$router->get('/editproduct', 'ProductsController@edit');

$router->post('/products', 'ProductsController@index');
$router->post('/saveproduct', 'ProductsController@addAction');
$router->post('/updateproduct', 'ProductsController@editAction');
$router->post('/getinfoproduct', 'ProductsController@getOtherInformations');
$router->post('/getproductsprovider', 'ProductsController@productsFromProvider');
$router->post('/productsproviderwithstock', 'ProductsController@productsProviderWStock');
// Buscar produtos por texto Pesquisa
$router->post('/searchproduct', 'ProductsController@searchProducts');
// Fim Produtos

// Vendedores
$router->get('/salesman', 'SalesmanController@index');
$router->get('/addsalesman', 'SalesmanController@add');
$router->get('/editsalesman', 'SalesmanController@edit');

$router->post('/salesman', 'SalesmanController@index');
$router->post('/savesalesman', 'SalesmanController@addAction');
$router->post('/updatesalesman', 'SalesmanController@editAction');
$router->post('/savecomissionsalesman', 'SalesmanController@saveValueComission');
$router->post('/showcomissionsalesman', 'SalesmanController@getComission');
$router->post('/getsalesmancomissionpercentage', 'SalesmanController@getComissionPercentage');

// Busca em vendedores por texto via ajax
$router->post('/searchsalesman', 'SalesmanController@searchSalesman');
// Fim Vendedores

// Fornecedores
$router->get('/providers', 'ProvidersController@index');
$router->get('/providerservice', 'ProvidersController@providerService');
$router->get('/addprovider', 'ProvidersController@add');
$router->get('/editprovider', 'ProvidersController@edit');

$router->post('/providers', 'ProvidersController@index');
$router->post('/providerservice', 'ProvidersController@providerService');
$router->post('/saveprovider', 'ProvidersController@addAction');
$router->post('/updateprovider', 'ProvidersController@editAction');

// Busca em fornecedores por texto via ajax
$router->post('/searchprovider', 'ProvidersController@searchProviders');
$router->post('/getproviderinfo', 'ProvidersController@getProviderInfo');
// Fim Fornecedores

// Transportadoras
$router->get('/shippingcompany', 'ShippingcompanyController@index');
$router->get('/addshippingcompany', 'ShippingcompanyController@add');
$router->get('/editshippingcompany', 'ShippingcompanyController@edit');

$router->post('/shippingcompany', 'ShippingcompanyController@index');
$router->post('/saveshippingcompany', 'ShippingcompanyController@addAction');
$router->post('/updateshippingcompany', 'ShippingcompanyController@editAction');
// Fim Transportadoras

// Permissões
$router->get('/permissions', 'PermissionsController@index');
$router->get('/addgroup', 'PermissionsController@add');
$router->get('/editgroup', 'PermissionsController@edit');
$router->get('/deletegroup', 'PermissionsController@delete');

$router->post('/savegroup', 'PermissionsController@addAction');
$router->post('/updategroup', 'PermissionsController@editAction');
// Fim Permissões

// Usuários
$router->get('/users', 'UsersController@index');
$router->get('/adduser', 'UsersController@add');
$router->get('/edituser', 'UsersController@edit');
$router->get('/deleteuser', 'UsersController@delete');

$router->post('/users', 'UsersController@index');
$router->post('/saveuser', 'UsersController@addAction');
$router->post('/updateuser', 'UsersController@editAction');
// Fim Usuários

// Compras
$router->get('/purchases', 'PurchasesController@index');
$router->get('/addpurchase', 'PurchasesController@add');
$router->get('/viewpurchase', 'PurchasesController@viewPurchase');
$router->get('/deletepurchase', 'PurchasesController@delete');

$router->post('/purchases', 'PurchasesController@index');
$router->post('/savepurchase', 'PurchasesController@savePurchase');
$router->post('/addproductinpurchase', 'PurchasesController@addItem');
$router->post('/removeproductpurchase', 'PurchasesController@removeItem');
$router->post('/getadvancepurchase', 'PurchasesController@getAdvancePurchase');
$router->post('/verifynotepurchase', 'PurchasesController@verifyExistsNote');
$router->post('/verifynotedate', 'PurchasesController@verifyDateNote');
// Fim Compras

// Pedidos
$router->get('/requests', 'RequestsController@index');
$router->get('/reqwithstock', 'RequestsController@addWithStock');
$router->get('/reqnostock', 'RequestsController@addNoStock');
$router->get('/requestsedit', 'RequestsController@edit');
$router->get('/requestsview', 'RequestsController@view');

$router->get('/printout', 'RequestsController@printOutRequest');


$router->post('/requests', 'RequestsController@index');
$router->post('/addproductinrequest', 'RequestsController@insertProductInRequest');
$router->post('/saverequest', 'RequestsController@saveRequest');
$router->post('/updatenoterequest', 'RequestsController@updateRequest');

// Buscar valor total do item
$router->post('/getvalueitem', 'RequestsController@totalValueItem');
// Buscar valor de custo por unidade
$router->post('/getcoustperunity', 'RequestsController@getCoustPerUnity');
// Buscar valor total de custo
$router->post('/gettotalcoust', 'RequestsController@getTotalCoust');
// Buscar resultado estimado
$router->post('/getresultestimate', 'RequestsController@getResultEstimate');
// Buscar comissão do vendedor
$router->post('/getcomissionsalesman', 'RequestsController@getComisionSalesman');
// Remover item do pedido
$router->post('/removeitem', 'RequestsController@removeItem');
// Verificar data de pagamento
$router->post('/verifydate', 'RequestsController@verifyDate');
// Cancelar pedido
$router->post('/cancelrequest', 'RequestsController@cancelRequest');
// Margem de lucro produto
$router->post('/getprofitvalue', 'RequestsController@calculateProfitValue');
// Fim Pedidos

// Entregas
$router->get('/deliveryitem', 'DeliveriesController@deliveryItem');

$router->post('/initdelivery', 'DeliveriesController@initDelivery');
$router->post('/getdeliveryinfo', 'DeliveriesController@getDeliveryInfo');
$router->post('/createnewcharge', 'DeliveriesController@createNewCharge');
$router->post('/verifydeliverydate', 'DeliveriesController@verifyDeliveryDate');
$router->post('/updatedeliveryinfo', 'DeliveriesController@updateDeliveryInfo');
$router->post('/setdeliverycomplete', 'DeliveriesController@setDeliveryComplete');
$router->post('/setdeliveriecanceled', 'DeliveriesController@cancelDeliverieItem');
$router->post('/verifyshippinginvoice', 'DeliveriesController@verifyShippingInvoice');
$router->post('/getupdatedvaluedelivery', 'DeliveriesController@getUpdatedValueDelivery');
$router->post('/zerobalance', 'DeliveriesController@zeroBalance');
// Fim Entregas

// Contas a pagar
$router->get('/billstopay', 'BillstopayController@index');
$router->get('/billstopayadd', 'BillstopayController@add');
$router->get('/billstopayedit', 'BillstopayController@edit');

$router->post('/billstopay', 'BillstopayController@index');
$router->post('/savebillstopay', 'BillstopayController@addAction');
$router->post('/updatebillstopay', 'BillstopayController@editAction');
$router->post('/verifydates', 'BillstopayController@verifyDate');
$router->post('/getvaluetopay', 'BillstopayController@getValueToPay');
$router->post('/deleteattbtp', 'BillstopayController@deleteAtt');
$router->post('/updatestatusbtp', 'BillstopayController@updateStatus');
$router->post('/setbtppaidout', 'BillstopayController@setAccountsPaidOut');
$router->post('/getvalueselected', 'BillstopayController@totalAccountsSelected');

$router->post('/updatebtptype', 'BillstopayController@updateBtpType');
$router->post('/savebtptype', 'BillstopayController@saveBtpType');
// Fim Contas a pagar

// Contas a receber
$router->get('/billstoreceiver', 'BillstoreceiverController@index');
$router->get('/billstoreceiveradd', 'BillstoreceiverController@add');
$router->get('/billstoreceiveredit', 'BillstoreceiverController@edit');

$router->post('/billstoreceiver', 'BillstoreceiverController@index');
$router->post('/savebillstoreceiver', 'BillstoreceiverController@addAction');
$router->post('/updatebillstoreceiver', 'BillstoreceiverController@editAction');
$router->post('/deleteattbtr', 'BillstoreceiverController@deleteAtt');
$router->post('/updatestatusbtr', 'BillstoreceiverController@updateStatus');
$router->post('/setbtrpaidout', 'BillstoreceiverController@setAccountsPaidOut');
$router->post('/getvalueselectedbtr', 'BillstoreceiverController@totalAccountsSelected');

$router->post('/updatebtrtype', 'BillstoreceiverController@updateBtrType');
$router->post('/savebtrtype', 'BillstoreceiverController@saveBtrType');
// Fim Contas a receber

// Relatórios
	// Clientes
$router->get('/reports', 'ReportsController@index');
$router->get('/reportclients', 'ReportsController@clients');
$router->get('/reportclipdf', 'ReportsController@clientsToPdf');
$router->get('/reportcliexcel', 'ReportsController@clientsToCsv');

$router->post('/reportclients', 'ReportsController@clients');

	// Fazendas
$router->get('/reportfarms', 'ReportsController@farms');
$router->get('/reportfarmspdf', 'ReportsController@farmsToPdf');
$router->get('/reportfarmscsv', 'ReportsController@farmsToCsv');

$router->post('/reportfarms', 'ReportsController@farms');


	// Foenecedor/Produtos
$router->get('/reportprovidersproducts', 'ReportsController@providersAndProducts');
$router->get('/productspdf', 'ReportsController@productsForProviderPdf');
$router->get('/productscsv', 'ReportsController@productsToCsv');

$router->post('/reportprovidersproducts', 'ReportsController@providersAndProducts');

	// Compras
$router->get('/reportpurchases', 'ReportsController@purchases');
$router->get('/reportpurchasespdf', 'ReportsController@purchasesPdf');
$router->get('/reportpurchasescsv', 'ReportsController@purchasesCsv');

$router->post('/reportpurchases', 'ReportsController@purchases');

	// Aniversariantes
$router->get('/reportbirthdays', 'ReportsController@birthdays');
$router->get('/reportbirthdayspdf', 'ReportsController@birthdaysPdf');
$router->get('/reportbirthdayscsv', 'ReportsController@birthdaysCsv');

$router->post('/reportbirthdays', 'ReportsController@birthdays');

	// Pedidos
$router->get('/reportrequests', 'ReportsController@requests');
$router->get('/reportrequestspdf', 'ReportsController@requestsPdf');
$router->get('/reportrequestscsv', 'ReportsController@requestsCsv');

$router->post('/reportrequests', 'ReportsController@requests');

	// Entregas
$router->get('/reportdeliveries', 'ReportsController@deliveries');
$router->get('/reportdeliveriespdf', 'ReportsController@deliveriesPdf');
$router->get('/reportdeliveriescsv', 'ReportsController@deliveriesCsv');

$router->post('/reportdeliveries', 'ReportsController@deliveries');

	// Contas a Pagar
$router->get('/reportbillstopay', 'ReportsController@billsToPay');
$router->get('/reportbillstopaypdf', 'ReportsController@billsToPayPdf');
$router->get('/reportbillstopaycsv', 'ReportsController@billsToPayCsv');

$router->post('/reportbillstopay', 'ReportsController@billsToPay');

	// Contas a Receber
$router->get('/reportbillstoreceiver', 'ReportsController@billsToReceiver');
$router->get('/reportbillstoreceiverpdf', 'ReportsController@billsToReceiverPdf');
$router->get('/reportbillstoreceivercsv', 'ReportsController@billsToReceiverCsv');

$router->post('/reportbillstoreceiver', 'ReportsController@billsToReceiver');
// Fim Relatórios

// CRM
$router->get('/crm', 'InteractionsController@index');
$router->get('/inititeration', 'InteractionsController@start');
$router->get('/viewinteraction', 'InteractionsController@view');

$router->post('/crm', 'InteractionsController@index');
$router->post('/saveinteration', 'InteractionsController@save');
$router->post('/verifyinterationdate', 'InteractionsController@verifyDate');
$router->post('/getrequestvinculation', 'InteractionsController@searchRequest');
$router->post('/getprospectionlist', 'InteractionsController@getClientsProspections');
$router->post('/getlastbyclient', 'InteractionsController@getLastConversationsByClient');
$router->post('/saveinterationinedit', 'InteractionsController@saveInEdit');
$router->post('/getlastbyconversation', 'InteractionsController@getLastInConversations');

// CRM ADMINISTRATIVO
$router->get('/crmadm', 'InteractionsController@crm');

$router->post('/crmadm', 'InteractionsController@crm');
$router->post('/crmadmclearform', 'InteractionsController@clearFilter');
// FIM CRM ADMINISTRATIVO

// Configurações
$router->get('/configuration', 'SetingsController@index');
$router->get('/reportconfig', 'SetingsController@reports');
$router->get('/btpconfig', 'SetingsController@btp');
$router->get('/btptype', 'SetingsController@btpType'); // Alteração e Adição de tipo de contas a pagar
$router->get('/btrtype', 'SetingsController@btrType'); // Alteração e Adição de tipo de contas a receber

$router->post('/reportsave', 'SetingsController@reportsAction');
// Fim Configurações


// Requisições Ajax
$router->post('/getcitylist', 'UtilsController@getCityList');
// Verificar se existe cliente cadastrado
$router->post('/verifyexists', 'UtilsController@verifyExists');
// Verificar se existe vendedor cadastrado
$router->post('/verifyexistssalesman', 'UtilsController@verifySalesman');
// Ativar ou Inativar Fazendas/Clietes
$router->post('/activeinactive', 'UtilsController@ClientsAndFarmsStatus');
// Ativar ou Inativar Produtos
$router->post('/activeinactiveprod', 'UtilsController@updateStatusProduct');
// Ativar ou Inativar Vendedores
$router->post('/activeinactivesalesman', 'SalesmanController@updateStatus');
// Ativar ou Inativar Fornecedores
$router->post('/activeinactiveprovider', 'ProvidersController@updateStatus');
// Ativar ou Inativar Transportadoras
$router->post('/activeinactiveshipping', 'ShippingcompanyController@updateStatus');
// Valor total com quantidade e valor
$router->post('/totalvalue', 'UtilsController@getValueTotal');
// Comparação entre duas datas com o delimitador
$router->post('/verifycomparedate', 'UtilsController@compareDate');
// Lista de Fornecedores
$router->post('/getlistprovider', 'UtilsController@getProviderList');