2013-11-26 13:45:07 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Application Routes
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
| Here is where you can register all of the routes for an application.
|
|
|
|
| It's a breeze. Simply tell Laravel the URIs it should respond to
|
|
|
|
| and give it the Closure to execute when that URI is requested.
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2013-12-05 21:25:20 +01:00
|
|
|
//dd(DB::getQueryLog());
|
2013-12-04 17:20:14 +01:00
|
|
|
//dd(Client::getPrivateId(1));
|
2013-12-10 18:18:35 +01:00
|
|
|
//dd(new DateTime());
|
2013-11-28 13:15:34 +01:00
|
|
|
|
2013-11-26 13:45:07 +01:00
|
|
|
Route::get('/', 'HomeController@showWelcome');
|
|
|
|
Route::post('get_started', 'AccountController@getStarted');
|
|
|
|
|
|
|
|
Route::get('view/{invoice_key}', 'InvoiceController@view');
|
|
|
|
Route::get('payment/{invoice_key}', 'InvoiceController@show_payment');
|
|
|
|
Route::get('complete', 'InvoiceController@do_payment');
|
|
|
|
|
2013-12-04 17:20:14 +01:00
|
|
|
Route::post('signup/validate', 'AccountController@checkEmail');
|
|
|
|
Route::post('signup/submit', 'AccountController@submitSignup');
|
2013-11-26 13:45:07 +01:00
|
|
|
|
2013-12-07 19:45:00 +01:00
|
|
|
// Confide routes
|
|
|
|
Route::get('login', 'UserController@login');
|
|
|
|
Route::post('login', 'UserController@do_login');
|
|
|
|
//Route::get( 'user/confirm/{code}', 'UserController@confirm');
|
|
|
|
Route::get('forgot_password', 'UserController@forgot_password');
|
|
|
|
Route::post('forgot_password', 'UserController@do_forgot_password');
|
|
|
|
//Route::get('user/reset_password/{token}', 'UserController@reset_password');
|
|
|
|
//Route::post('user/reset_password', 'UserController@do_reset_password');
|
|
|
|
Route::get('logout', 'UserController@logout');
|
|
|
|
|
|
|
|
|
2013-11-26 13:45:07 +01:00
|
|
|
Route::filter('auth', function()
|
|
|
|
{
|
2013-11-28 17:40:13 +01:00
|
|
|
if (!Auth::check())
|
2013-11-26 13:45:07 +01:00
|
|
|
{
|
2013-12-09 10:38:49 +01:00
|
|
|
return Redirect::to('/');
|
2013-11-26 13:45:07 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2013-12-03 18:32:33 +01:00
|
|
|
Route::group(array('before' => 'auth'), function()
|
2013-11-26 13:45:07 +01:00
|
|
|
{
|
2013-12-01 21:58:25 +01:00
|
|
|
Route::get('home', function() { return View::make('header'); });
|
2013-11-26 13:45:07 +01:00
|
|
|
Route::get('account/{section?}', 'AccountController@showSection');
|
|
|
|
Route::post('account/{section?}', 'AccountController@doSection');
|
2013-12-05 16:23:24 +01:00
|
|
|
Route::post('user/setTheme', 'UserController@setTheme');
|
|
|
|
|
2013-11-26 13:45:07 +01:00
|
|
|
Route::resource('clients', 'ClientController');
|
|
|
|
Route::get('api/clients', array('as'=>'api.clients', 'uses'=>'ClientController@getDatatable'));
|
2013-12-01 21:58:25 +01:00
|
|
|
Route::get('api/activities/{client_id?}', array('as'=>'api.activities', 'uses'=>'ActivityController@getDatatable'));
|
2013-12-01 08:33:17 +01:00
|
|
|
Route::post('clients/bulk', 'ClientController@bulk');
|
2013-11-26 13:45:07 +01:00
|
|
|
|
|
|
|
Route::resource('invoices', 'InvoiceController');
|
2013-11-29 13:09:21 +01:00
|
|
|
Route::get('api/invoices/{client_id?}', array('as'=>'api.invoices', 'uses'=>'InvoiceController@getDatatable'));
|
2013-12-09 10:38:49 +01:00
|
|
|
Route::get('invoices/create/{client_id?}', 'InvoiceController@create');
|
2013-12-01 08:33:17 +01:00
|
|
|
Route::post('invoices/bulk', 'InvoiceController@bulk');
|
2013-11-26 13:45:07 +01:00
|
|
|
|
2013-12-05 21:25:20 +01:00
|
|
|
Route::get('payments/{id}/edit', function() { return View::make('header'); });
|
2013-12-04 17:20:14 +01:00
|
|
|
Route::resource('payments', 'PaymentController');
|
2013-12-09 10:38:49 +01:00
|
|
|
Route::get('payments/create/{client_id?}', 'PaymentController@create');
|
2013-11-29 13:09:21 +01:00
|
|
|
Route::get('api/payments/{client_id?}', array('as'=>'api.payments', 'uses'=>'PaymentController@getDatatable'));
|
2013-12-01 08:33:17 +01:00
|
|
|
Route::post('payments/bulk', 'PaymentController@bulk');
|
2013-12-05 21:25:20 +01:00
|
|
|
|
|
|
|
Route::get('credits/{id}/edit', function() { return View::make('header'); });
|
2013-12-04 17:20:14 +01:00
|
|
|
Route::resource('credits', 'CreditController');
|
2013-12-09 10:38:49 +01:00
|
|
|
Route::get('credits/create/{client_id?}', 'CreditController@create');
|
2013-12-01 21:58:25 +01:00
|
|
|
Route::get('api/credits/{client_id?}', array('as'=>'api.credits', 'uses'=>'CreditController@getDatatable'));
|
2013-12-05 16:23:24 +01:00
|
|
|
Route::post('credits/bulk', 'PaymentController@bulk');
|
2013-12-05 21:25:20 +01:00
|
|
|
|
2013-12-01 21:58:25 +01:00
|
|
|
Route::get('reports', function() { return View::make('header'); });
|
2013-11-26 13:45:07 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-11-29 13:09:21 +01:00
|
|
|
HTML::macro('nav_link', function($url, $text, $url2 = '', $extra = '') {
|
2013-11-26 13:45:07 +01:00
|
|
|
$class = ( Request::is($url) || Request::is($url.'/*') || Request::is($url2) ) ? ' class="active"' : '';
|
2013-11-29 13:09:21 +01:00
|
|
|
return '<li'.$class.'><a href="'.URL::to($url).'" '.$extra.'>'.$text.'</a></li>';
|
|
|
|
});
|
|
|
|
|
|
|
|
HTML::macro('tab_link', function($url, $text, $active = false) {
|
|
|
|
$class = $active ? ' class="active"' : '';
|
|
|
|
return '<li'.$class.'><a href="'.URL::to($url).'" data-toggle="tab">'.$text.'</a></li>';
|
2013-11-26 13:45:07 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
HTML::macro('menu_link', function($type) {
|
|
|
|
$types = $type.'s';
|
|
|
|
$Type = ucfirst($type);
|
|
|
|
$Types = ucfirst($types);
|
|
|
|
$class = ( Request::is($types) || Request::is($types.'/*')) ? ' active' : '';
|
|
|
|
return '<li class="dropdown '.$class.'">
|
|
|
|
<a href="'.URL::to($types).'" class="dropdown-toggle">'.$Types.'</a>
|
|
|
|
<ul class="dropdown-menu" id="menu1">
|
|
|
|
<!-- <li><a href="'.URL::to($types).'">List '.$Types.'</a></li> -->
|
|
|
|
<li><a href="'.URL::to($types.'/create').'">New '.$Type.'</a></li>
|
|
|
|
</ul>
|
|
|
|
</li>';
|
|
|
|
});
|
|
|
|
|
|
|
|
HTML::macro('image_data', function($imagePath) {
|
|
|
|
return 'data:image/jpeg;base64,' . base64_encode(file_get_contents($imagePath));
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2013-11-29 13:09:21 +01:00
|
|
|
|
2013-11-27 08:38:37 +01:00
|
|
|
define("ENV_DEVELOPMENT", "local");
|
|
|
|
define("ENV_STAGING", "staging");
|
|
|
|
define("ENV_PRODUCTION", "production");
|
|
|
|
|
2013-11-29 13:09:21 +01:00
|
|
|
define("RECENTLY_VIEWED", "RECENTLY_VIEWED");
|
2013-12-01 08:33:17 +01:00
|
|
|
define("ENTITY_CLIENT", "client");
|
|
|
|
define("ENTITY_INVOICE", "invoice");
|
|
|
|
define("ENTITY_PAYMENT", "payment");
|
2013-12-01 21:58:25 +01:00
|
|
|
define("ENTITY_CREDIT", "credit");
|
|
|
|
|
|
|
|
define("PERSON_CONTACT", "contact");
|
|
|
|
define("PERSON_USER", "user");
|
2013-11-29 13:09:21 +01:00
|
|
|
|
2013-11-26 13:45:07 +01:00
|
|
|
define("ACCOUNT_DETAILS", "details");
|
|
|
|
define("ACCOUNT_SETTINGS", "settings");
|
|
|
|
define("ACCOUNT_IMPORT", "import");
|
|
|
|
define("ACCOUNT_MAP", "import_map");
|
2013-12-01 13:22:08 +01:00
|
|
|
define("ACCOUNT_EXPORT", "export");
|
|
|
|
|
2013-12-01 21:58:25 +01:00
|
|
|
define("DEFAULT_INVOICE_NUMBER", "0001");
|
|
|
|
define("RECENTLY_VIEWED_LIMIT", 8);
|
|
|
|
|
2013-12-07 19:45:00 +01:00
|
|
|
define('INVOICE_STATUS_DRAFT', 1);
|
|
|
|
define('INVOICE_STATUS_SENT', 2);
|
|
|
|
define('INVOICE_STATUS_VIEWED', 3);
|
|
|
|
define('INVOICE_STATUS_PARTIAL', 4);
|
2013-12-09 10:38:49 +01:00
|
|
|
define('INVOICE_STATUS_PAID', 5);
|
|
|
|
|
|
|
|
define('FREQUENCY_WEEKLY', 1);
|
|
|
|
define('FREQUENCY_TWO_WEEKS', 2);
|
|
|
|
define('FREQUENCY_FOUR_WEEKS', 3);
|
|
|
|
define('FREQUENCY_MONTHLY', 4);
|
|
|
|
define('FREQUENCY_THREE_MONTHS', 5);
|
|
|
|
define('FREQUENCY_SIX_MONTHS', 6);
|
2013-12-10 18:18:35 +01:00
|
|
|
define('FREQUENCY_ANNUALLY', 7);
|