mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-09 20:52:56 +01:00
Cleaning up the routes.php file
This commit is contained in:
parent
616df18b06
commit
b7f09685d0
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
|
/app/config/staging
|
||||||
/bootstrap/compiled.php
|
/bootstrap/compiled.php
|
||||||
/vendor
|
/vendor
|
||||||
composer.phar
|
composer.phar
|
||||||
|
@ -65,7 +65,7 @@ return array(
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'key' => 'Zwa83ZM8ZYjEAfHWXl7SvYwVdV9X*oU1',
|
'key' => 'a2jfy6HtBEdNtJnRSOC7vIM3UVhxZ1BB',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -4,8 +4,12 @@ class AccountController extends \BaseController {
|
|||||||
|
|
||||||
public function getStarted()
|
public function getStarted()
|
||||||
{
|
{
|
||||||
$user = false;
|
if (Auth::check())
|
||||||
|
{
|
||||||
|
return Redirect::to('invoices/create');
|
||||||
|
}
|
||||||
|
|
||||||
|
$user = false;
|
||||||
$guestKey = Input::get('guest_key');
|
$guestKey = Input::get('guest_key');
|
||||||
|
|
||||||
if ($guestKey)
|
if ($guestKey)
|
||||||
@ -128,7 +132,7 @@ class AccountController extends \BaseController {
|
|||||||
$contacts = DB::table('contacts')->whereIn('client_id', function($query){
|
$contacts = DB::table('contacts')->whereIn('client_id', function($query){
|
||||||
$query->select('client_id')->from('clients')->where('account_id','=',Auth::user()->account_id);
|
$query->select('client_id')->from('clients')->where('account_id','=',Auth::user()->account_id);
|
||||||
})->get();
|
})->get();
|
||||||
AccountController::exportData($output, toArray($contacts));
|
AccountController::exportData($output, Utils::toArray($contacts));
|
||||||
|
|
||||||
$invoices = Invoice::where('account_id','=',Auth::user()->account_id)->get();
|
$invoices = Invoice::where('account_id','=',Auth::user()->account_id)->get();
|
||||||
AccountController::exportData($output, $invoices->toArray());
|
AccountController::exportData($output, $invoices->toArray());
|
||||||
@ -136,7 +140,7 @@ class AccountController extends \BaseController {
|
|||||||
$invoiceItems = DB::table('invoice_items')->whereIn('invoice_id', function($query){
|
$invoiceItems = DB::table('invoice_items')->whereIn('invoice_id', function($query){
|
||||||
$query->select('invoice_id')->from('invoices')->where('account_id','=',Auth::user()->account_id);
|
$query->select('invoice_id')->from('invoices')->where('account_id','=',Auth::user()->account_id);
|
||||||
})->get();
|
})->get();
|
||||||
AccountController::exportData($output, toArray($invoiceItems));
|
AccountController::exportData($output, Utils::toArray($invoiceItems));
|
||||||
|
|
||||||
$payments = Payment::where('account_id','=',Auth::user()->account_id)->get();
|
$payments = Payment::where('account_id','=',Auth::user()->account_id)->get();
|
||||||
AccountController::exportData($output, $payments->toArray());
|
AccountController::exportData($output, $payments->toArray());
|
||||||
@ -251,7 +255,7 @@ class AccountController extends \BaseController {
|
|||||||
$client->contacts()->save($contact);
|
$client->contacts()->save($contact);
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = pluralize('Successfully created ? client', $count);
|
$message = Utils::pluralize('Successfully created ? client', $count);
|
||||||
Session::flash('message', $message);
|
Session::flash('message', $message);
|
||||||
return Redirect::to('clients');
|
return Redirect::to('clients');
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ class ActivityController extends \BaseController {
|
|||||||
$clientId = Client::getPrivateId($clientPublicId);
|
$clientId = Client::getPrivateId($clientPublicId);
|
||||||
|
|
||||||
return Datatable::collection(Activity::scope()->where('client_id','=',$clientId)->get())
|
return Datatable::collection(Activity::scope()->where('client_id','=',$clientId)->get())
|
||||||
->addColumn('date', function($model) { return timestampToDateString($model->created_at); })
|
->addColumn('date', function($model) { return Utils::timestampToDateString($model->created_at); })
|
||||||
->addColumn('message', function($model) { return $model->message; })
|
->addColumn('message', function($model) { return $model->message; })
|
||||||
->addColumn('balance', function($model) { return '$' . $model->balance; })
|
->addColumn('balance', function($model) { return '$' . $model->balance; })
|
||||||
->orderColumns('date')
|
->orderColumns('date')
|
||||||
|
@ -26,17 +26,17 @@ class ClientController extends \BaseController {
|
|||||||
->where('clients.account_id', '=', Auth::user()->account_id)
|
->where('clients.account_id', '=', Auth::user()->account_id)
|
||||||
->where('clients.deleted_at', '=', null)
|
->where('clients.deleted_at', '=', null)
|
||||||
->where('contacts.is_primary', '=', true)
|
->where('contacts.is_primary', '=', true)
|
||||||
->select('clients.public_id','clients.name','contacts.first_name','contacts.last_name','clients.balance','clients.last_login','clients.created_at','contacts.phone','contacts.email');
|
->select('clients.public_id','clients.name','contacts.first_name','contacts.last_name','clients.balance','clients.last_login','clients.created_at','clients.work_phone','contacts.email');
|
||||||
|
|
||||||
return Datatable::query($query)
|
return Datatable::query($query)
|
||||||
->addColumn('checkbox', function($model) { return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '">'; })
|
->addColumn('checkbox', function($model) { return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '">'; })
|
||||||
->addColumn('name', function($model) { return link_to('clients/' . $model->public_id, $model->name); })
|
->addColumn('name', function($model) { return link_to('clients/' . $model->public_id, $model->name); })
|
||||||
->addColumn('first_name', function($model) { return $model->first_name . ' ' . $model->last_name; })
|
->addColumn('first_name', function($model) { return $model->first_name . ' ' . $model->last_name; })
|
||||||
->addColumn('balance', function($model) { return '$' . $model->balance; })
|
->addColumn('balance', function($model) { return '$' . $model->balance; })
|
||||||
->addColumn('last_login', function($model) { return timestampToDateString($model->last_login); })
|
->addColumn('last_login', function($model) { return Utils::timestampToDateString($model->last_login); })
|
||||||
->addColumn('created_at', function($model) { return timestampToDateString($model->created_at); })
|
->addColumn('created_at', function($model) { return Utils::timestampToDateString($model->created_at); })
|
||||||
->addColumn('email', function($model) { return $model->email ? HTML::mailto($model->email, $model->email) : ''; })
|
->addColumn('email', function($model) { return $model->email ? HTML::mailto($model->email, $model->email) : ''; })
|
||||||
->addColumn('phone', function($model) { return $model->phone; })
|
->addColumn('work_phone', function($model) { return Utils::formatPhoneNumber($model->work_phone); })
|
||||||
->addColumn('dropdown', function($model)
|
->addColumn('dropdown', function($model)
|
||||||
{
|
{
|
||||||
return '<div class="btn-group tr-action" style="visibility:hidden;">
|
return '<div class="btn-group tr-action" style="visibility:hidden;">
|
||||||
@ -92,7 +92,7 @@ class ClientController extends \BaseController {
|
|||||||
public function show($publicId)
|
public function show($publicId)
|
||||||
{
|
{
|
||||||
$client = Client::scope($publicId)->with('contacts')->firstOrFail();
|
$client = Client::scope($publicId)->with('contacts')->firstOrFail();
|
||||||
trackViewed($client->name, ENTITY_CLIENT);
|
Utils::trackViewed($client->name, ENTITY_CLIENT);
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'client' => $client,
|
'client' => $client,
|
||||||
@ -216,7 +216,7 @@ class ClientController extends \BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = pluralize('Successfully '.$action.'d ? client', count($ids));
|
$message = Utils::pluralize('Successfully '.$action.'d ? client', count($ids));
|
||||||
Session::flash('message', $message);
|
Session::flash('message', $message);
|
||||||
|
|
||||||
return Redirect::to('clients');
|
return Redirect::to('clients');
|
||||||
|
@ -36,7 +36,7 @@ class CreditController extends \BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $table->addColumn('amount', function($model){ return '$' . money_format('%i', $model->amount); })
|
return $table->addColumn('amount', function($model){ return '$' . money_format('%i', $model->amount); })
|
||||||
->addColumn('credit_date', function($model) { return timestampToDateString($model->credit_date); })
|
->addColumn('credit_date', function($model) { return Utils::timestampToDateString($model->credit_date); })
|
||||||
->addColumn('dropdown', function($model)
|
->addColumn('dropdown', function($model)
|
||||||
{
|
{
|
||||||
return '<div class="btn-group tr-action" style="visibility:hidden;">
|
return '<div class="btn-group tr-action" style="visibility:hidden;">
|
||||||
@ -113,7 +113,7 @@ class CreditController extends \BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$credit->client_id = Input::get('client');
|
$credit->client_id = Input::get('client');
|
||||||
$credit->credit_date = toSqlDate(Input::get('credit_date'));
|
$credit->credit_date = Utils::toSqlDate(Input::get('credit_date'));
|
||||||
$credit->amount = floatval(Input::get('amount'));
|
$credit->amount = floatval(Input::get('amount'));
|
||||||
$credit->save();
|
$credit->save();
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ class CreditController extends \BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = pluralize('Successfully '.$action.'d ? credit', count($ids));
|
$message = Utils::pluralize('Successfully '.$action.'d ? credit', count($ids));
|
||||||
Session::flash('message', $message);
|
Session::flash('message', $message);
|
||||||
|
|
||||||
return Redirect::to('credits');
|
return Redirect::to('credits');
|
||||||
|
@ -43,8 +43,8 @@ class InvoiceController extends \BaseController {
|
|||||||
|
|
||||||
return $table->addColumn('total', function($model){ return '$' . money_format('%i', $model->total); })
|
return $table->addColumn('total', function($model){ return '$' . money_format('%i', $model->total); })
|
||||||
->addColumn('balance', function($model) { return '$' . money_format('%i', $model->balance); })
|
->addColumn('balance', function($model) { return '$' . money_format('%i', $model->balance); })
|
||||||
->addColumn('invoice_date', function($model) { return fromSqlDate($model->invoice_date); })
|
->addColumn('invoice_date', function($model) { return Utils::fromSqlDate($model->invoice_date); })
|
||||||
->addColumn('due_date', function($model) { return fromSqlDate($model->due_date); })
|
->addColumn('due_date', function($model) { return Utils::fromSqlDate($model->due_date); })
|
||||||
->addColumn('invoice_status_name', function($model) { return $model->invoice_status_name; })
|
->addColumn('invoice_status_name', function($model) { return $model->invoice_status_name; })
|
||||||
->addColumn('dropdown', function($model)
|
->addColumn('dropdown', function($model)
|
||||||
{
|
{
|
||||||
@ -237,7 +237,7 @@ class InvoiceController extends \BaseController {
|
|||||||
public function edit($publicId)
|
public function edit($publicId)
|
||||||
{
|
{
|
||||||
$invoice = Invoice::scope($publicId)->with('account.country', 'client', 'invoice_items')->firstOrFail();
|
$invoice = Invoice::scope($publicId)->with('account.country', 'client', 'invoice_items')->firstOrFail();
|
||||||
trackViewed($invoice->invoice_number . ' - ' . $invoice->client->name, ENTITY_INVOICE);
|
Utils::trackViewed($invoice->invoice_number . ' - ' . $invoice->client->name, ENTITY_INVOICE);
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'account' => $invoice->account,
|
'account' => $invoice->account,
|
||||||
@ -352,8 +352,8 @@ class InvoiceController extends \BaseController {
|
|||||||
|
|
||||||
$invoice->invoice_number = trim(Input::get('invoice_number'));
|
$invoice->invoice_number = trim(Input::get('invoice_number'));
|
||||||
$invoice->discount = 0;
|
$invoice->discount = 0;
|
||||||
$invoice->invoice_date = toSqlDate(Input::get('invoice_date'));
|
$invoice->invoice_date = Utils::toSqlDate(Input::get('invoice_date'));
|
||||||
$invoice->due_date = toSqlDate(Input::get('due_date'));
|
$invoice->due_date = Utils::toSqlDate(Input::get('due_date'));
|
||||||
$invoice->notes = Input::get('notes');
|
$invoice->notes = Input::get('notes');
|
||||||
|
|
||||||
$client->invoices()->save($invoice);
|
$client->invoices()->save($invoice);
|
||||||
@ -493,7 +493,7 @@ class InvoiceController extends \BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = pluralize('Successfully '.$action.'d ? invoice', count($ids));
|
$message = Utils::pluralize('Successfully '.$action.'d ? invoice', count($ids));
|
||||||
Session::flash('message', $message);
|
Session::flash('message', $message);
|
||||||
|
|
||||||
return Redirect::to('invoices');
|
return Redirect::to('invoices');
|
||||||
|
@ -38,7 +38,7 @@ class PaymentController extends \BaseController
|
|||||||
|
|
||||||
return $table->addColumn('invoice_number', function($model) { return $model->invoice_public_id ? link_to('invoices/' . $model->invoice_public_id . '/edit', $model->invoice_invoice_number) : ''; })
|
return $table->addColumn('invoice_number', function($model) { return $model->invoice_public_id ? link_to('invoices/' . $model->invoice_public_id . '/edit', $model->invoice_invoice_number) : ''; })
|
||||||
->addColumn('amount', function($model) { return '$' . $model->amount; })
|
->addColumn('amount', function($model) { return '$' . $model->amount; })
|
||||||
->addColumn('payment_date', function($model) { return timestampToDateString($model->payment_date); })
|
->addColumn('payment_date', function($model) { return Utils::timestampToDateString($model->payment_date); })
|
||||||
->addColumn('dropdown', function($model)
|
->addColumn('dropdown', function($model)
|
||||||
{
|
{
|
||||||
return '<div class="btn-group tr-action" style="visibility:hidden;">
|
return '<div class="btn-group tr-action" style="visibility:hidden;">
|
||||||
@ -122,7 +122,7 @@ class PaymentController extends \BaseController
|
|||||||
|
|
||||||
$payment->client_id = Input::get('client');
|
$payment->client_id = Input::get('client');
|
||||||
$payment->invoice_id = $invoiceId;
|
$payment->invoice_id = $invoiceId;
|
||||||
$payment->payment_date = toSqlDate(Input::get('payment_date'));
|
$payment->payment_date = Utils::toSqlDate(Input::get('payment_date'));
|
||||||
$payment->amount = floatval(Input::get('amount'));
|
$payment->amount = floatval(Input::get('amount'));
|
||||||
$payment->save();
|
$payment->save();
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ class PaymentController extends \BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = pluralize('Successfully '.$action.'d ? payment', count($ids));
|
$message = Utils::pluralize('Successfully '.$action.'d ? payment', count($ids));
|
||||||
Session::flash('message', $message);
|
Session::flash('message', $message);
|
||||||
|
|
||||||
return Redirect::to('payments');
|
return Redirect::to('payments');
|
||||||
|
@ -74,7 +74,7 @@ class UserController extends BaseController {
|
|||||||
{
|
{
|
||||||
if( Confide::user() )
|
if( Confide::user() )
|
||||||
{
|
{
|
||||||
return Redirect::to('/');
|
return Redirect::to('/clients');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -173,6 +173,14 @@ class UserController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
public function do_forgot_password()
|
public function do_forgot_password()
|
||||||
{
|
{
|
||||||
|
Confide::forgotPassword( Input::get( 'email' ) );
|
||||||
|
|
||||||
|
$notice_msg = Lang::get('confide::confide.alerts.password_forgot');
|
||||||
|
return Redirect::action('UserController@login')
|
||||||
|
->with( 'notice', $notice_msg );
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
if( Confide::forgotPassword( Input::get( 'email' ) ) )
|
if( Confide::forgotPassword( Input::get( 'email' ) ) )
|
||||||
{
|
{
|
||||||
$notice_msg = Lang::get('confide::confide.alerts.password_forgot');
|
$notice_msg = Lang::get('confide::confide.alerts.password_forgot');
|
||||||
@ -186,6 +194,7 @@ class UserController extends BaseController {
|
|||||||
->withInput()
|
->withInput()
|
||||||
->with( 'error', $error_msg );
|
->with( 'error', $error_msg );
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
152
app/libraries/utils.php
Executable file
152
app/libraries/utils.php
Executable file
@ -0,0 +1,152 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Utils
|
||||||
|
{
|
||||||
|
public static function formatPhoneNumber($phoneNumber)
|
||||||
|
{
|
||||||
|
$phoneNumber = preg_replace('/[^0-9]/','',$phoneNumber);
|
||||||
|
|
||||||
|
if (!$phoneNumber) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(strlen($phoneNumber) > 10) {
|
||||||
|
$countryCode = substr($phoneNumber, 0, strlen($phoneNumber)-10);
|
||||||
|
$areaCode = substr($phoneNumber, -10, 3);
|
||||||
|
$nextThree = substr($phoneNumber, -7, 3);
|
||||||
|
$lastFour = substr($phoneNumber, -4, 4);
|
||||||
|
|
||||||
|
$phoneNumber = '+'.$countryCode.' ('.$areaCode.') '.$nextThree.'-'.$lastFour;
|
||||||
|
}
|
||||||
|
else if(strlen($phoneNumber) == 10) {
|
||||||
|
$areaCode = substr($phoneNumber, 0, 3);
|
||||||
|
$nextThree = substr($phoneNumber, 3, 3);
|
||||||
|
$lastFour = substr($phoneNumber, 6, 4);
|
||||||
|
|
||||||
|
$phoneNumber = '('.$areaCode.') '.$nextThree.'-'.$lastFour;
|
||||||
|
}
|
||||||
|
else if(strlen($phoneNumber) == 7) {
|
||||||
|
$nextThree = substr($phoneNumber, 0, 3);
|
||||||
|
$lastFour = substr($phoneNumber, 3, 4);
|
||||||
|
|
||||||
|
$phoneNumber = $nextThree.'-'.$lastFour;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $phoneNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
function pluralize($string, $count)
|
||||||
|
{
|
||||||
|
$string = str_replace('?', $count, $string);
|
||||||
|
return $count == 1 ? $string : $string . 's';
|
||||||
|
}
|
||||||
|
|
||||||
|
function toArray($data)
|
||||||
|
{
|
||||||
|
return json_decode(json_encode((array) $data), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function toSpaceCase($camelStr)
|
||||||
|
{
|
||||||
|
return preg_replace('/([a-z])([A-Z])/s','$1 $2', $camelStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
function timestampToDateTimeString($timestamp) {
|
||||||
|
$tz = Session::get('tz');
|
||||||
|
if (!$tz) {
|
||||||
|
$tz = 'US/Eastern';
|
||||||
|
}
|
||||||
|
$date = new Carbon($timestamp);
|
||||||
|
$date->tz = $tz;
|
||||||
|
if ($date->year < 1900) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $date->format('l M jS, Y g:ia');
|
||||||
|
}
|
||||||
|
|
||||||
|
function timestampToDateString($timestamp) {
|
||||||
|
$tz = Session::get('tz');
|
||||||
|
if (!$tz) {
|
||||||
|
$tz = 'US/Eastern';
|
||||||
|
}
|
||||||
|
$date = new Carbon($timestamp);
|
||||||
|
$date->tz = $tz;
|
||||||
|
if ($date->year < 1900) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return $date->toFormattedDateString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
function toDateString($date)
|
||||||
|
{
|
||||||
|
if ($date->year < 1900) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
$tz = Session::get('tz');
|
||||||
|
if (!$tz) {
|
||||||
|
$tz = 'US/Eastern';
|
||||||
|
}
|
||||||
|
$date->tz = $tz;
|
||||||
|
return $date->toFormattedDateString();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
function toSqlDate($date)
|
||||||
|
{
|
||||||
|
if (!$date)
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return DateTime::createFromFormat('m/d/Y', $date);
|
||||||
|
}
|
||||||
|
|
||||||
|
function fromSqlDate($date)
|
||||||
|
{
|
||||||
|
if (!$date || $date == '0000-00-00')
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return DateTime::createFromFormat('Y-m-d', $date)->format('m/d/Y');
|
||||||
|
}
|
||||||
|
|
||||||
|
function trackViewed($name, $type)
|
||||||
|
{
|
||||||
|
$url = Request::url();
|
||||||
|
$viewed = Session::get(RECENTLY_VIEWED);
|
||||||
|
|
||||||
|
if (!$viewed)
|
||||||
|
{
|
||||||
|
$viewed = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$object = new stdClass;
|
||||||
|
$object->url = $url;
|
||||||
|
$object->name = ucwords($type) . ': ' . $name;
|
||||||
|
|
||||||
|
for ($i=0; $i<count($viewed); $i++)
|
||||||
|
{
|
||||||
|
$item = $viewed[$i];
|
||||||
|
|
||||||
|
if ($object->url == $item->url)
|
||||||
|
{
|
||||||
|
array_splice($viewed, $i, 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
array_unshift($viewed, $object);
|
||||||
|
|
||||||
|
if (count($viewed) > RECENTLY_VIEWED_LIMIT)
|
||||||
|
{
|
||||||
|
array_pop($viewed);
|
||||||
|
}
|
||||||
|
|
||||||
|
Session::put(RECENTLY_VIEWED, $viewed);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -86,7 +86,7 @@ class Client extends EntityModel
|
|||||||
|
|
||||||
if ($this->work_phone)
|
if ($this->work_phone)
|
||||||
{
|
{
|
||||||
$str .= '<i class="fa fa-phone" style="width: 20px"></i>' . $this->work_phone;
|
$str .= '<i class="fa fa-phone" style="width: 20px"></i>' . Utils::formatPhoneNumber($this->work_phone);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $str;
|
return $str;
|
||||||
|
@ -63,7 +63,7 @@ class Contact extends EntityModel
|
|||||||
|
|
||||||
if ($this->phone)
|
if ($this->phone)
|
||||||
{
|
{
|
||||||
$str .= '<i class="fa fa-phone" style="width: 20px"></i>' . $this->phone;
|
$str .= '<i class="fa fa-phone" style="width: 20px"></i>' . Utils::formatPhoneNumber($this->phone);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($str)
|
if ($str)
|
||||||
|
@ -4,7 +4,7 @@ use Illuminate\Auth\UserInterface;
|
|||||||
use Illuminate\Auth\Reminders\RemindableInterface;
|
use Illuminate\Auth\Reminders\RemindableInterface;
|
||||||
use Zizaco\Confide\ConfideUser;
|
use Zizaco\Confide\ConfideUser;
|
||||||
|
|
||||||
class User extends ConfideUser implements UserInterface, RemindableInterface, iPerson
|
class User extends ConfideUser implements UserInterface, RemindableInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $softDelete = true;
|
protected $softDelete = true;
|
||||||
|
155
app/routes.php
155
app/routes.php
@ -39,7 +39,7 @@ Route::filter('auth', function()
|
|||||||
{
|
{
|
||||||
if (!Auth::check())
|
if (!Auth::check())
|
||||||
{
|
{
|
||||||
return Redirect::to('/');
|
return Redirect::to('/login');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -105,142 +105,6 @@ HTML::macro('image_data', function($imagePath) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function pluralize($string, $count)
|
|
||||||
{
|
|
||||||
$string = str_replace('?', $count, $string);
|
|
||||||
return $count == 1 ? $string : $string . 's';
|
|
||||||
}
|
|
||||||
|
|
||||||
function toArray($data)
|
|
||||||
{
|
|
||||||
return json_decode(json_encode((array) $data), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
function toSpaceCase($camelStr)
|
|
||||||
{
|
|
||||||
return preg_replace('/([a-z])([A-Z])/s','$1 $2', $camelStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
function timestampToDateTimeString($timestamp) {
|
|
||||||
$tz = Session::get('tz');
|
|
||||||
if (!$tz) {
|
|
||||||
$tz = 'US/Eastern';
|
|
||||||
}
|
|
||||||
$date = new Carbon($timestamp);
|
|
||||||
$date->tz = $tz;
|
|
||||||
if ($date->year < 1900) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $date->format('l M jS, Y g:ia');
|
|
||||||
}
|
|
||||||
|
|
||||||
function timestampToDateString($timestamp) {
|
|
||||||
$tz = Session::get('tz');
|
|
||||||
if (!$tz) {
|
|
||||||
$tz = 'US/Eastern';
|
|
||||||
}
|
|
||||||
$date = new Carbon($timestamp);
|
|
||||||
$date->tz = $tz;
|
|
||||||
if ($date->year < 1900) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
return $date->toFormattedDateString();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function toDateString($date)
|
|
||||||
{
|
|
||||||
if ($date->year < 1900) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
$tz = Session::get('tz');
|
|
||||||
if (!$tz) {
|
|
||||||
$tz = 'US/Eastern';
|
|
||||||
}
|
|
||||||
$date->tz = $tz;
|
|
||||||
return $date->toFormattedDateString();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function toDateTimeString($date)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function toSqlDate($date)
|
|
||||||
{
|
|
||||||
if (!$date)
|
|
||||||
{
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return DateTime::createFromFormat('m/d/Y', $date);
|
|
||||||
}
|
|
||||||
|
|
||||||
function fromSqlDate($date)
|
|
||||||
{
|
|
||||||
if (!$date || $date == '0000-00-00')
|
|
||||||
{
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return DateTime::createFromFormat('Y-m-d', $date)->format('m/d/Y');
|
|
||||||
}
|
|
||||||
|
|
||||||
function fromSqlTimestamp($date)
|
|
||||||
{
|
|
||||||
if (!$date || $date == '0000-00-00 00:00:00')
|
|
||||||
{
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return DateTime::createFromFormat('Y-m-d H:i:s', $date)->format('m/d/Y h:ia');
|
|
||||||
}
|
|
||||||
|
|
||||||
function processedRequest($url)
|
|
||||||
{
|
|
||||||
//Session::put(Input::get('_token'), $url);
|
|
||||||
//Session::put('_token', md5(microtime()));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function trackViewed($name, $type)
|
|
||||||
{
|
|
||||||
$url = Request::url();
|
|
||||||
$viewed = Session::get(RECENTLY_VIEWED);
|
|
||||||
|
|
||||||
if (!$viewed)
|
|
||||||
{
|
|
||||||
$viewed = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
$object = new stdClass;
|
|
||||||
$object->url = $url;
|
|
||||||
$object->name = ucwords($type) . ': ' . $name;
|
|
||||||
|
|
||||||
for ($i=0; $i<count($viewed); $i++)
|
|
||||||
{
|
|
||||||
$item = $viewed[$i];
|
|
||||||
|
|
||||||
if ($object->url == $item->url)
|
|
||||||
{
|
|
||||||
array_splice($viewed, $i, 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
array_unshift($viewed, $object);
|
|
||||||
|
|
||||||
if (count($viewed) > RECENTLY_VIEWED_LIMIT)
|
|
||||||
{
|
|
||||||
array_pop($viewed);
|
|
||||||
}
|
|
||||||
|
|
||||||
Session::put(RECENTLY_VIEWED, $viewed);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
define("ENV_DEVELOPMENT", "local");
|
define("ENV_DEVELOPMENT", "local");
|
||||||
define("ENV_STAGING", "staging");
|
define("ENV_STAGING", "staging");
|
||||||
@ -264,23 +128,8 @@ define("ACCOUNT_EXPORT", "export");
|
|||||||
define("DEFAULT_INVOICE_NUMBER", "0001");
|
define("DEFAULT_INVOICE_NUMBER", "0001");
|
||||||
define("RECENTLY_VIEWED_LIMIT", 8);
|
define("RECENTLY_VIEWED_LIMIT", 8);
|
||||||
|
|
||||||
|
|
||||||
define('INVOICE_STATUS_DRAFT', 1);
|
define('INVOICE_STATUS_DRAFT', 1);
|
||||||
define('INVOICE_STATUS_SENT', 2);
|
define('INVOICE_STATUS_SENT', 2);
|
||||||
define('INVOICE_STATUS_VIEWED', 3);
|
define('INVOICE_STATUS_VIEWED', 3);
|
||||||
define('INVOICE_STATUS_PARTIAL', 4);
|
define('INVOICE_STATUS_PARTIAL', 4);
|
||||||
define('INVOICE_STATUS_PAID', 5);
|
define('INVOICE_STATUS_PAID', 5);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
interface iPerson
|
|
||||||
{
|
|
||||||
//public function getFullName();
|
|
||||||
//public function getPersonType();
|
|
||||||
}
|
|
||||||
|
|
||||||
interface iEntity
|
|
||||||
{
|
|
||||||
//public function getName();
|
|
||||||
//public function getEntityType();
|
|
||||||
}
|
|
@ -28,9 +28,9 @@
|
|||||||
@if ($field == 'solutionType' || $field == 'landingPage')
|
@if ($field == 'solutionType' || $field == 'landingPage')
|
||||||
{{-- do nothing --}}
|
{{-- do nothing --}}
|
||||||
@elseif ($field == 'testMode' || $field == 'developerMode')
|
@elseif ($field == 'testMode' || $field == 'developerMode')
|
||||||
{{ Former::checkbox($gateway->id.'_'.$field)->label(toSpaceCase($field))->text('Enable') }}
|
{{ Former::checkbox($gateway->id.'_'.$field)->label(Utils::toSpaceCase($field))->text('Enable') }}
|
||||||
@else
|
@else
|
||||||
{{ Former::text($gateway->id.'_'.$field)->label(toSpaceCase($field)) }}
|
{{ Former::text($gateway->id.'_'.$field)->label(Utils::toSpaceCase($field)) }}
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@endforeach
|
@endforeach
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
<h2>{{ $client->name }}</h2>
|
<h2>{{ $client->name }}</h2>
|
||||||
@if ($client->last_login > 0)
|
@if ($client->last_login > 0)
|
||||||
<h3 style="margin-top:0px"><small>
|
<h3 style="margin-top:0px"><small>
|
||||||
Last logged in {{ timestampToDateTimeString($client->last_login); }}
|
Last logged in {{ Utils::timestampToDateTimeString($client->last_login); }}
|
||||||
</small></h3>
|
</small></h3>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
@if (!Auth::check() || Auth::user()->showGreyBackground())
|
@if (!Auth::check() || Auth::user()->showGreyBackground())
|
||||||
body {
|
body {
|
||||||
background-color: #EEEEEE;
|
background-color: #F6F6F6;
|
||||||
}
|
}
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<p> </p>
|
<p> </p>
|
||||||
|
|
||||||
{{ Former::open($url)->method($method)->addClass('main_form')->rules(array(
|
{{ Former::open($url)->method($method)->addClass('main_form')->rules(array(
|
||||||
'invoice_number' => 'required',
|
'invoice_number' => 'required',
|
||||||
'invoice_date' => 'required',
|
'invoice_date' => 'required',
|
||||||
'product_key' => 'max:14',
|
'product_key' => 'max:14',
|
||||||
)); }}
|
)); }}
|
||||||
@ -15,8 +15,8 @@
|
|||||||
@if ($invoice)
|
@if ($invoice)
|
||||||
{{ Former::populate($invoice); }}
|
{{ Former::populate($invoice); }}
|
||||||
{{ Former::populateField('id', $invoice->public_id); }}
|
{{ Former::populateField('id', $invoice->public_id); }}
|
||||||
{{ Former::populateField('invoice_date', fromSqlDate($invoice->invoice_date)); }}
|
{{ Former::populateField('invoice_date', Utils::fromSqlDate($invoice->invoice_date)); }}
|
||||||
{{ Former::populateField('due_date', fromSqlDate($invoice->due_date)); }}
|
{{ Former::populateField('due_date', Utils::fromSqlDate($invoice->due_date)); }}
|
||||||
@else
|
@else
|
||||||
{{ Former::populateField('invoice_number', $invoiceNumber) }}
|
{{ Former::populateField('invoice_number', $invoiceNumber) }}
|
||||||
{{ Former::populateField('invoice_date', date('m/d/Y')) }}
|
{{ Former::populateField('invoice_date', date('m/d/Y')) }}
|
||||||
|
@ -0,0 +1,76 @@
|
|||||||
|
@extends('master')
|
||||||
|
|
||||||
|
@section('head')
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
body {
|
||||||
|
padding-top: 40px;
|
||||||
|
padding-bottom: 40px;
|
||||||
|
background-color: #eee !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-signin {
|
||||||
|
max-width: 330px;
|
||||||
|
padding: 15px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
.form-signin .form-signin-heading,
|
||||||
|
.form-signin .checkbox {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
.form-signin .checkbox {
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
.form-signin .form-control {
|
||||||
|
position: relative;
|
||||||
|
font-size: 16px;
|
||||||
|
height: auto;
|
||||||
|
padding: 10px;
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.form-signin .form-control:focus {
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
.form-signin input[type="text"] {
|
||||||
|
margin-bottom: -1px;
|
||||||
|
border-bottom-left-radius: 0;
|
||||||
|
border-bottom-right-radius: 0;
|
||||||
|
}
|
||||||
|
.form-signin input[type="password"] {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
border-top-left-radius: 0;
|
||||||
|
border-top-right-radius: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
@stop
|
||||||
|
|
||||||
|
@section('body')
|
||||||
|
<div class="container">
|
||||||
|
|
||||||
|
{{ Former::open('forgot_password')->addClass('form-signin') }}
|
||||||
|
<h2 class="form-signin-heading">Passord Recovery</h2>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
{{ Form::text('email', Input::old('email'), array('placeholder' => 'Email address')) }}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>{{ Button::primary_submit('Send email', array('class' => 'btn-lg'))->block() }}</p>
|
||||||
|
|
||||||
|
<!-- if there are login errors, show them here -->
|
||||||
|
@if ( Session::get('error') )
|
||||||
|
<div class="alert alert-error">{{{ Session::get('error') }}}</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if ( Session::get('notice') )
|
||||||
|
<div class="alert">{{{ Session::get('notice') }}}</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
|
||||||
|
{{ Former::close() }}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@stop
|
@ -1,20 +1,6 @@
|
|||||||
<!DOCTYPE html>
|
@extends('master')
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<meta name="description" content="">
|
|
||||||
<meta name="author" content="">
|
|
||||||
<link rel="shortcut icon" href="../../docs-assets/ico/favicon.png">
|
|
||||||
|
|
||||||
<title></title>
|
@section('head')
|
||||||
|
|
||||||
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
|
||||||
<!--[if lt IE 9]>
|
|
||||||
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
|
|
||||||
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
|
|
||||||
<![endif]-->
|
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
body {
|
body {
|
||||||
@ -59,18 +45,12 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.js" type="text/javascript"></script>
|
@stop
|
||||||
|
|
||||||
{{ Basset::show('bootstrapper.css') }}
|
|
||||||
{{ Basset::show('bootstrapper.js') }}
|
|
||||||
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
|
|
||||||
|
@section('body')
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
||||||
{{ Form::open(array('url' => 'login', 'class' => 'form-signin')) }}
|
{{ Former::open('login')->addClass('form-signin') }}
|
||||||
<h2 class="form-signin-heading">Please sign in</h2>
|
<h2 class="form-signin-heading">Please sign in</h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@ -85,8 +65,8 @@
|
|||||||
|
|
||||||
<p>{{ Button::primary_submit('Sign In', array('class' => 'btn-lg'))->block() }}</p>
|
<p>{{ Button::primary_submit('Sign In', array('class' => 'btn-lg'))->block() }}</p>
|
||||||
|
|
||||||
{{ link_to('user/forgot_password', 'Recover your password') }}
|
{{ link_to('forgot_password', 'Recover your password') }}
|
||||||
|
|
||||||
<!-- if there are login errors, show them here -->
|
<!-- if there are login errors, show them here -->
|
||||||
@if ( Session::get('error') )
|
@if ( Session::get('error') )
|
||||||
<div class="alert alert-error">{{{ Session::get('error') }}}</div>
|
<div class="alert alert-error">{{{ Session::get('error') }}}</div>
|
||||||
@ -97,12 +77,8 @@
|
|||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
|
||||||
{{ Form::close() }}
|
{{ Former::close() }}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</body>
|
@stop
|
||||||
</html>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -29,6 +29,7 @@ $app->redirectIfTrailingSlash();
|
|||||||
$env = $app->detectEnvironment(array(
|
$env = $app->detectEnvironment(array(
|
||||||
|
|
||||||
'local' => array('precise64'),
|
'local' => array('precise64'),
|
||||||
|
'staging' => array('host107.hostmonster.com')
|
||||||
|
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -22,7 +22,8 @@
|
|||||||
"app/models",
|
"app/models",
|
||||||
"app/database/migrations",
|
"app/database/migrations",
|
||||||
"app/database/seeds",
|
"app/database/seeds",
|
||||||
"app/tests/TestCase.php"
|
"app/tests/TestCase.php",
|
||||||
|
"app/libraries"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
1
public/js/bootstrap-combobox.js
vendored
1
public/js/bootstrap-combobox.js
vendored
@ -93,6 +93,7 @@
|
|||||||
this.$element.attr('class', this.$source.attr('class'));
|
this.$element.attr('class', this.$source.attr('class'));
|
||||||
this.$element.attr('tabindex', this.$source.attr('tabindex'));
|
this.$element.attr('tabindex', this.$source.attr('tabindex'));
|
||||||
this.$source.removeAttr('tabindex');
|
this.$source.removeAttr('tabindex');
|
||||||
|
this.$source.removeAttr('required');
|
||||||
}
|
}
|
||||||
|
|
||||||
, select: function () {
|
, select: function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user