Cleaning up the templates

This commit is contained in:
Hillel Coren 2013-12-07 20:45:00 +02:00
parent 9053be4976
commit 616df18b06
30 changed files with 519 additions and 307 deletions

View File

@ -47,9 +47,9 @@ return array(
| |
| |
*/ */
'login_form' => 'login', 'login_form' => 'users.login',
'signup_form' => 'confide::signup', 'signup_form' => 'confide::signup',
'forgot_password_form' => 'confide::forgot_password', 'forgot_password_form' => 'users.forgot_password',
'reset_password_form' => 'confide::reset_password', 'reset_password_form' => 'confide::reset_password',
/* /*

View File

@ -31,6 +31,8 @@ class AccountController extends \BaseController {
$user = new User; $user = new User;
$user->password = $random; $user->password = $random;
$account->users()->save($user); $account->users()->save($user);
Session::forget(RECENTLY_VIEWED);
} }
Auth::login($user, true); Auth::login($user, true);
@ -188,6 +190,7 @@ class AccountController extends \BaseController {
foreach ($row as $index => $value) foreach ($row as $index => $value)
{ {
$field = $map[$index]; $field = $map[$index];
$value = trim($value);
if ($field == Client::$fieldName) if ($field == Client::$fieldName)
{ {
@ -387,7 +390,7 @@ class AccountController extends \BaseController {
$config = new stdClass; $config = new stdClass;
foreach ($fields as $field => $details) foreach ($fields as $field => $details)
{ {
$config->$field = Input::get($gateway->id.'_'.$field); $config->$field = trim(Input::get($gateway->id.'_'.$field));
} }
$accountGateway->config = json_encode($config); $accountGateway->config = json_encode($config);
@ -417,21 +420,21 @@ class AccountController extends \BaseController {
else else
{ {
$account = Account::findOrFail(Auth::user()->account_id); $account = Account::findOrFail(Auth::user()->account_id);
$account->name = Input::get('name'); $account->name = trim(Input::get('name'));
$account->address1 = Input::get('address1'); $account->address1 = trim(Input::get('address1'));
$account->address2 = Input::get('address2'); $account->address2 = trim(Input::get('address2'));
$account->city = Input::get('city'); $account->city = trim(Input::get('city'));
$account->state = Input::get('state'); $account->state = trim(Input::get('state'));
$account->postal_code = Input::get('postal_code'); $account->postal_code = trim(Input::get('postal_code'));
$account->country_id = Input::get('country_id') ? Input::get('country_id') : null; $account->country_id = Input::get('country_id') ? Input::get('country_id') : null;
$account->timezone_id = Input::get('timezone_id') ? Input::get('timezone_id') : null; $account->timezone_id = Input::get('timezone_id') ? Input::get('timezone_id') : null;
$account->save(); $account->save();
$user = $account->users()->first(); $user = $account->users()->first();
$user->first_name = Input::get('first_name'); $user->first_name = trim(Input::get('first_name'));
$user->last_name = Input::get('last_name'); $user->last_name = trim(Input::get('last_name'));
$user->email = Input::get('email'); $user->email = trim(Input::get('email'));
$user->phone = Input::get('phone'); $user->phone = trim(Input::get('phone'));
$user->save(); $user->save();
if (Input::get('timezone_id')) { if (Input::get('timezone_id')) {
@ -480,10 +483,10 @@ class AccountController extends \BaseController {
} }
$user = Auth::user(); $user = Auth::user();
$user->first_name = Input::get('first_name'); $user->first_name = trim(Input::get('first_name'));
$user->last_name = Input::get('last_name'); $user->last_name = trim(Input::get('last_name'));
$user->email = Input::get('email'); $user->email = trim(Input::get('email'));
$user->password = Input::get('password'); $user->password = trim(Input::get('password'));
$user->registered = true; $user->registered = true;
$user->save(); $user->save();

View File

@ -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); trackViewed($client->name, ENTITY_CLIENT);
$data = array( $data = array(
'client' => $client, 'client' => $client,
@ -149,14 +149,14 @@ class ClientController extends \BaseController {
$client = Client::createNew(); $client = Client::createNew();
} }
$client->name = Input::get('name'); $client->name = trim(Input::get('name'));
$client->work_phone = Input::get('work_phone'); $client->work_phone = trim(Input::get('work_phone'));
$client->address1 = Input::get('address1'); $client->address1 = trim(Input::get('address1'));
$client->address2 = Input::get('address2'); $client->address2 = trim(Input::get('address2'));
$client->city = Input::get('city'); $client->city = trim(Input::get('city'));
$client->state = Input::get('state'); $client->state = trim(Input::get('state'));
$client->notes = Input::get('notes'); $client->notes = trim(Input::get('notes'));
$client->postal_code = Input::get('postal_code'); $client->postal_code = trim(Input::get('postal_code'));
if (Input::get('country_id')) { if (Input::get('country_id')) {
$client->country_id = Input::get('country_id'); $client->country_id = Input::get('country_id');
} }
@ -177,10 +177,10 @@ class ClientController extends \BaseController {
$record = Contact::createNew(); $record = Contact::createNew();
} }
$record->email = $contact->email; $record->email = trim($contact->email);
$record->first_name = $contact->first_name; $record->first_name = trim($contact->first_name);
$record->last_name = $contact->last_name; $record->last_name = trim($contact->last_name);
$record->phone = $contact->phone; $record->phone = trim($contact->phone);
$record->is_primary = $isPrimary; $record->is_primary = $isPrimary;
$isPrimary = false; $isPrimary = false;

View File

@ -114,7 +114,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 = toSqlDate(Input::get('credit_date'));
$credit->amount = Input::get('amount'); $credit->amount = floatval(Input::get('amount'));
$credit->save(); $credit->save();
$message = $publicId ? 'Successfully updated credit' : 'Successfully created credit'; $message = $publicId ? 'Successfully updated credit' : 'Successfully created credit';

View File

@ -6,6 +6,6 @@ class HomeController extends BaseController {
public function showWelcome() public function showWelcome()
{ {
return View::make('home.index'); return View::make('splash');
} }
} }

View File

@ -73,6 +73,11 @@ class InvoiceController extends \BaseController {
$user = $invitation->user; $user = $invitation->user;
$invoice = $invitation->invoice; $invoice = $invitation->invoice;
if ($invoice->invoice_status_id < INVOICE_STATUS_VIEWED) {
$invoice->invoice_status_id = INVOICE_STATUS_VIEWED;
$invoice->save();
}
$now = Carbon::now()->toDateTimeString(); $now = Carbon::now()->toDateTimeString();
$invitation->viewed_date = $now; $invitation->viewed_date = $now;
@ -84,7 +89,12 @@ class InvoiceController extends \BaseController {
Activity::viewInvoice($invitation); Activity::viewInvoice($invitation);
return View::make('invoices.view')->with('invoice', $invoice); $data = array(
'invoice' => $invoice,
'invitation' => $invitation
);
return View::make('invoices.view', $data);
} }
private function createGateway($accountGateway) private function createGateway($accountGateway)
@ -121,7 +131,7 @@ class InvoiceController extends \BaseController {
$card = new CreditCard($data); $card = new CreditCard($data);
return [ return [
'amount' => $invoice->getTotal(), 'amount' => $invoice->total,
'card' => $card, 'card' => $card,
'currency' => 'USD', 'currency' => 'USD',
'returnUrl' => URL::to('complete'), 'returnUrl' => URL::to('complete'),
@ -131,7 +141,8 @@ class InvoiceController extends \BaseController {
public function show_payment($invitationKey) public function show_payment($invitationKey)
{ {
$invoice = Invoice::with('invoice_items', 'client.account.account_gateways.gateway')->where('invitation_key', '=', $invitationKey)->firstOrFail(); $invitation = Invitation::with('invoice.invoice_items', 'invoice.client.account.account_gateways.gateway')->where('invitation_key', '=', $invitationKey)->firstOrFail();
$invoice = $invitation->invoice;
$accountGateway = $invoice->client->account->account_gateways[0]; $accountGateway = $invoice->client->account->account_gateways[0];
$gateway = InvoiceController::createGateway($accountGateway); $gateway = InvoiceController::createGateway($accountGateway);
@ -147,13 +158,17 @@ class InvoiceController extends \BaseController {
exit('Sorry, there was an error processing your payment. Please try again later.'); exit('Sorry, there was an error processing your payment. Please try again later.');
} }
$payment = new Payment; $payment = Payment::createNew();
$payment->invitation_id = $invitation->id;
$payment->invoice_id = $invoice->id; $payment->invoice_id = $invoice->id;
$payment->account_id = $invoice->account_id; $payment->amount = $invoice->total;
$payment->contact_id = 0; // TODO_FIX $payment->client_id = $invoice->client_id;
//$payment->contact_id = 0; // TODO_FIX
$payment->transaction_reference = $ref; $payment->transaction_reference = $ref;
$payment->save(); $payment->save();
$invoice->balance = floatval($invoice->total) - floatval($paymount->amount);
if ($response->isSuccessful()) if ($response->isSuccessful())
{ {
@ -180,7 +195,7 @@ class InvoiceController extends \BaseController {
$payerId = Request::query('PayerID'); $payerId = Request::query('PayerID');
$token = Request::query('token'); $token = Request::query('token');
$payment = Payment::with('invoice.invoice_items')->where('transaction_reference','=',$token)->firstOrFail(); $payment = Payment::with('invitation', 'invoice.invoice_items')->where('transaction_reference','=',$token)->firstOrFail();
$invoice = Invoice::with('client.account.account_gateways.gateway')->where('id', '=', $payment->invoice_id)->firstOrFail(); $invoice = Invoice::with('client.account.account_gateways.gateway')->where('id', '=', $payment->invoice_id)->firstOrFail();
$accountGateway = $invoice->client->account->account_gateways[0]; $accountGateway = $invoice->client->account->account_gateways[0];
$gateway = InvoiceController::createGateway($accountGateway); $gateway = InvoiceController::createGateway($accountGateway);
@ -195,11 +210,17 @@ class InvoiceController extends \BaseController {
{ {
$payment->payer_id = $payerId; $payment->payer_id = $payerId;
$payment->transaction_reference = $ref; $payment->transaction_reference = $ref;
$payment->amount = $payment->invoice->getTotal();
$payment->save(); $payment->save();
if ($payment->amount >= $invoice->amount) {
$invoice->invoice_status_id = INVOICE_STATUS_PAID;
} else {
$invoice->invoice_status_id = INVOICE_STATUS_PARTIAL;
}
$invoice->save();
Session::flash('message', 'Successfully applied payment'); Session::flash('message', 'Successfully applied payment');
return Redirect::to('view/' . $payment->invoice->key); return Redirect::to('view/' . $payment->invitation->invitation_key);
} }
else else
{ {
@ -216,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); trackViewed($invoice->invoice_number . ' - ' . $invoice->client->name, ENTITY_INVOICE);
$data = array( $data = array(
'account' => $invoice->account, 'account' => $invoice->account,
@ -295,13 +316,13 @@ class InvoiceController extends \BaseController {
if ($clientPublicId == "-1") if ($clientPublicId == "-1")
{ {
$client = Client::createNew(); $client = Client::createNew();
$client->name = Input::get('name'); $client->name = trim(Input::get('name'));
$client->work_phone = Input::get('work_phone'); $client->work_phone = trim(Input::get('work_phone'));
$client->address1 = Input::get('address1'); $client->address1 = trim(Input::get('address1'));
$client->address2 = Input::get('address2'); $client->address2 = trim(Input::get('address2'));
$client->city = Input::get('city'); $client->city = trim(Input::get('city'));
$client->state = Input::get('state'); $client->state = trim(Input::get('state'));
$client->postal_code = Input::get('postal_code'); $client->postal_code = trim(Input::get('postal_code'));
if (Input::get('country_id')) { if (Input::get('country_id')) {
$client->country_id = Input::get('country_id'); $client->country_id = Input::get('country_id');
} }
@ -310,10 +331,10 @@ class InvoiceController extends \BaseController {
$contact = Contact::createNew(); $contact = Contact::createNew();
$contact->is_primary = true; $contact->is_primary = true;
$contact->first_name = Input::get('first_name'); $contact->first_name = trim(Input::get('first_name'));
$contact->last_name = Input::get('last_name'); $contact->last_name = trim(Input::get('last_name'));
$contact->phone = Input::get('phone'); $contact->phone = trim(Input::get('phone'));
$contact->email = Input::get('email'); $contact->email = trim(Input::get('email'));
$client->contacts()->save($contact); $client->contacts()->save($contact);
} }
else else
@ -329,14 +350,17 @@ class InvoiceController extends \BaseController {
$invoice = Invoice::createNew(); $invoice = Invoice::createNew();
} }
$invoice->invoice_number = 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 = toSqlDate(Input::get('invoice_date'));
$invoice->due_date = toSqlDate(Input::get('due_date')); $invoice->due_date = toSqlDate(Input::get('due_date'));
$invoice->notes = Input::get('notes'); $invoice->notes = Input::get('notes');
$client->invoices()->save($invoice); $client->invoices()->save($invoice);
$items = json_decode(Input::get('items')); $items = json_decode(Input::get('items'));
$total = 0;
foreach ($items as $item) foreach ($items as $item)
{ {
if (!isset($item->cost)) { if (!isset($item->cost)) {
@ -346,6 +370,22 @@ class InvoiceController extends \BaseController {
$item->qty = 0; $item->qty = 0;
} }
$total += intval($item->qty) * floatval($item->cost);
}
if ($action == 'email' && $invoice->invoice_status_id == INVOICE_STATUS_DRAFT)
{
$invoice->invoice_status_id = INVOICE_STATUS_SENT;
$client->balance = $invoice->client->balance + $invoice->total;
$client->save();
}
$invoice->total = $total;
$invoice->save();
foreach ($items as $item)
{
if (!$item->cost && !$item->qty && !$item->product_key && !$item->notes) if (!$item->cost && !$item->qty && !$item->product_key && !$item->notes)
{ {
continue; continue;
@ -353,12 +393,12 @@ class InvoiceController extends \BaseController {
if ($item->product_key) if ($item->product_key)
{ {
$product = Product::findProductByKey($item->product_key); $product = Product::findProductByKey(trim($item->product_key));
if (!$product) if (!$product)
{ {
$product = Product::createNew(); $product = Product::createNew();
$product->product_key = $item->product_key; $product->product_key = trim($item->product_key);
} }
/* /*
@ -372,14 +412,17 @@ class InvoiceController extends \BaseController {
$invoiceItem = InvoiceItem::createNew(); $invoiceItem = InvoiceItem::createNew();
$invoiceItem->product_id = isset($product) ? $product->id : null; $invoiceItem->product_id = isset($product) ? $product->id : null;
$invoiceItem->product_key = $item->product_key; $invoiceItem->product_key = trim($item->product_key);
$invoiceItem->notes = $item->notes; $invoiceItem->notes = trim($item->notes);
$invoiceItem->cost = $item->cost; $invoiceItem->cost = floatval($item->cost);
$invoiceItem->qty = $item->qty; $invoiceItem->qty = intval($item->qty);
$invoice->invoice_items()->save($invoiceItem); $invoice->invoice_items()->save($invoiceItem);
} }
/*
*/
if ($action == 'email') if ($action == 'email')
{ {
$data = array('link' => URL::to('view') . '/' . $invoice->invoice_key); $data = array('link' => URL::to('view') . '/' . $invoice->invoice_key);

View File

@ -123,7 +123,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 = toSqlDate(Input::get('payment_date'));
$payment->amount = Input::get('amount'); $payment->amount = floatval(Input::get('amount'));
$payment->save(); $payment->save();
$message = $publicId ? 'Successfully updated payment' : 'Successfully created payment'; $message = $publicId ? 'Successfully updated payment' : 'Successfully created payment';

View File

@ -74,8 +74,6 @@ class UserController extends BaseController {
{ {
if( Confide::user() ) if( Confide::user() )
{ {
// If user is logged, redirect to internal
// page, change it to '/admin', '/dashboard' or something
return Redirect::to('/'); return Redirect::to('/');
} }
else else
@ -94,7 +92,7 @@ class UserController extends BaseController {
'email' => Input::get( 'email' ), // May be the username too 'email' => Input::get( 'email' ), // May be the username too
'username' => Input::get( 'email' ), // so we have to pass both 'username' => Input::get( 'email' ), // so we have to pass both
'password' => Input::get( 'password' ), 'password' => Input::get( 'password' ),
'remember' => Input::get( 'remember' ), 'remember' => true,
); );
// If you wish to only allow login from confirmed users, call logAttempt // If you wish to only allow login from confirmed users, call logAttempt
@ -103,11 +101,15 @@ class UserController extends BaseController {
// Get the value from the config file instead of changing the controller // Get the value from the config file instead of changing the controller
if ( Confide::logAttempt( $input, Config::get('confide::signup_confirm') ) ) if ( Confide::logAttempt( $input, Config::get('confide::signup_confirm') ) )
{ {
$account = Account::findOrFail(Auth::user()->account_id);
$account->last_login = Carbon::now()->toDateTimeString();
$account->save();
// Redirect the user to the URL they were trying to access before // Redirect the user to the URL they were trying to access before
// caught by the authentication filter IE Redirect::guest('user/login'). // caught by the authentication filter IE Redirect::guest('user/login').
// Otherwise fallback to '/' // Otherwise fallback to '/'
// Fix pull #145 // Fix pull #145
return Redirect::intended('/'); // change it to '/admin', '/dashboard' or something return Redirect::intended('/clients'); // change it to '/admin', '/dashboard' or something
} }
else else
{ {
@ -118,18 +120,20 @@ class UserController extends BaseController {
{ {
$err_msg = Lang::get('confide::confide.alerts.too_many_attempts'); $err_msg = Lang::get('confide::confide.alerts.too_many_attempts');
} }
/*
elseif( $user->checkUserExists( $input ) and ! $user->isConfirmed( $input ) ) elseif( $user->checkUserExists( $input ) and ! $user->isConfirmed( $input ) )
{ {
$err_msg = Lang::get('confide::confide.alerts.not_confirmed'); $err_msg = Lang::get('confide::confide.alerts.not_confirmed');
} }
*/
else else
{ {
$err_msg = Lang::get('confide::confide.alerts.wrong_credentials'); $err_msg = Lang::get('confide::confide.alerts.wrong_credentials');
} }
return Redirect::action('UserController@login') return Redirect::action('UserController@login')
->withInput(Input::except('password')) ->withInput(Input::except('password'))
->with( 'error', $err_msg ); ->with( 'error', $err_msg );
} }
} }

View File

@ -293,6 +293,7 @@ class ConfideSetupUsersTable extends Migration {
$t->unsignedInteger('account_id'); $t->unsignedInteger('account_id');
$t->unsignedInteger('client_id'); $t->unsignedInteger('client_id');
$t->unsignedInteger('contact_id')->nullable(); $t->unsignedInteger('contact_id')->nullable();
$t->unsignedInteger('invitation_id')->nullable();
$t->unsignedInteger('user_id')->nullable(); $t->unsignedInteger('user_id')->nullable();
$t->timestamps(); $t->timestamps();
$t->softDeletes(); $t->softDeletes();

View File

@ -40,7 +40,7 @@ class Activity extends Eloquent
$activity = Activity::getBlank(); $activity = Activity::getBlank();
$activity->client_id = $client->id; $activity->client_id = $client->id;
$activity->activity_type_id = ACTIVITY_TYPE_CREATE_CLIENT; $activity->activity_type_id = ACTIVITY_TYPE_CREATE_CLIENT;
$activity->message = Auth::user()->getFullName() . ' created client ' . link_to('clients/'.$client->id, $client->name); $activity->message = Auth::user()->getFullName() . ' created client ' . link_to('clients/'.$client->public_id, $client->name);
$activity->save(); $activity->save();
} }
@ -60,7 +60,7 @@ class Activity extends Eloquent
$activity->invoice_id = $invoice->id; $activity->invoice_id = $invoice->id;
$activity->client_id = $invoice->client_id; $activity->client_id = $invoice->client_id;
$activity->activity_type_id = ACTIVITY_TYPE_CREATE_INVOICE; $activity->activity_type_id = ACTIVITY_TYPE_CREATE_INVOICE;
$activity->message = Auth::user()->getFullName() . ' created invoice ' . link_to('invoices/'.$invoice->id, $invoice->invoice_number); $activity->message = Auth::user()->getFullName() . ' created invoice ' . link_to('invoices/'.$invoice->public_id, $invoice->invoice_number);
$activity->save(); $activity->save();
} }
@ -81,7 +81,7 @@ class Activity extends Eloquent
$activity->invoice_id = $invitation->invoice_id; $activity->invoice_id = $invitation->invoice_id;
$activity->contact_id = $invitation->contact_id; $activity->contact_id = $invitation->contact_id;
$activity->activity_type_id = ACTIVITY_TYPE_EMAIL_INVOICE; $activity->activity_type_id = ACTIVITY_TYPE_EMAIL_INVOICE;
//$activity->message = Auth::user()->getFullName() . ' emailed invoice ' . $invitation->invoice->number . ' to ' . $contact->getFullName(); $activity->message = Auth::user()->getFullName() . ' emailed invoice ' . link_to('invoices/'.$invitation->invoice->public_id, $invitation->invoice->invoice_number) . ' to ' . $invitation->contact->getFullName();
$activity->save(); $activity->save();
} }
@ -127,7 +127,7 @@ class Activity extends Eloquent
$activity->invoice_id = $invoice->id; $activity->invoice_id = $invoice->id;
$activity->client_id = $invoice->client_id; $activity->client_id = $invoice->client_id;
$activity->activity_type_id = ACTIVITY_TYPE_ARCHIVE_PAYMENT; $activity->activity_type_id = ACTIVITY_TYPE_ARCHIVE_PAYMENT;
$activity->message = Auth::user()->getFullName() . ' archived payment ' . $invoice->number; $activity->message = Auth::user()->getFullName() . ' archived payment';
$activity->save(); $activity->save();
} }
@ -141,7 +141,7 @@ class Activity extends Eloquent
$activity->contact_id = $invitation->contact_id; $activity->contact_id = $invitation->contact_id;
$activity->invoice_id = $invitation->invoice_id; $activity->invoice_id = $invitation->invoice_id;
$activity->activity_type_id = ACTIVITY_TYPE_VIEW_INVOICE; $activity->activity_type_id = ACTIVITY_TYPE_VIEW_INVOICE;
//$activity->message = $contact->getFullName() . ' viewed invoice ' . $invoice->number; $activity->message = $invitation->contact->getFullName() . ' viewed invoice ' . link_to('invoices/'.$invitation->invoice->public_id, $invitation->invoice->invoice_number);
$activity->save(); $activity->save();
} }
} }

View File

@ -24,6 +24,11 @@ class Client extends EntityModel
return $this->hasMany('Invoice'); return $this->hasMany('Invoice');
} }
public function payments()
{
return $this->hasMany('Payment');
}
public function contacts() public function contacts()
{ {
return $this->hasMany('Contact'); return $this->hasMany('Contact');

View File

@ -7,6 +7,11 @@ class Payment extends EntityModel
return $this->belongsTo('Invoice'); return $this->belongsTo('Invoice');
} }
public function invitation()
{
return $this->belongsTo('Invitation');
}
public function client() public function client()
{ {
return $this->belongsTo('Client'); return $this->belongsTo('Client');

View File

@ -84,4 +84,9 @@ class User extends ConfideUser implements UserInterface, RemindableInterface, iP
return $fullName; return $fullName;
} }
} }
public function showGreyBackground()
{
return !$this->theme_id || in_array($this->theme_id, [2, 3, 5, 6, 7, 8, 10, 11, 12]);
}
} }

View File

@ -24,6 +24,17 @@ Route::get('complete', 'InvoiceController@do_payment');
Route::post('signup/validate', 'AccountController@checkEmail'); Route::post('signup/validate', 'AccountController@checkEmail');
Route::post('signup/submit', 'AccountController@submitSignup'); Route::post('signup/submit', 'AccountController@submitSignup');
// 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');
Route::filter('auth', function() Route::filter('auth', function()
{ {
if (!Auth::check()) if (!Auth::check())
@ -62,18 +73,6 @@ Route::group(array('before' => 'auth'), function()
Route::get('reports', function() { return View::make('header'); }); Route::get('reports', function() { return View::make('header'); });
}); });
// Confide routes
//Route::get( 'user/create', 'UserController@create');
//Route::post('user', 'UserController@store');
Route::get('login', 'UserController@login');
Route::post('login', 'UserController@do_login');
//Route::get( 'user/confirm/{code}', 'UserController@confirm');
//Route::get( 'user/forgot_password', 'UserController@forgot_password');
//Route::post('user/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');
@ -132,7 +131,8 @@ function timestampToDateTimeString($timestamp) {
if ($date->year < 1900) { if ($date->year < 1900) {
return ''; return '';
} }
return $date->toFormattedDateTimeString();
return $date->format('l M jS, Y g:ia');
} }
function timestampToDateString($timestamp) { function timestampToDateString($timestamp) {
@ -206,7 +206,7 @@ function processedRequest($url)
function trackViewed($name) function trackViewed($name, $type)
{ {
$url = Request::url(); $url = Request::url();
$viewed = Session::get(RECENTLY_VIEWED); $viewed = Session::get(RECENTLY_VIEWED);
@ -218,7 +218,7 @@ function trackViewed($name)
$object = new stdClass; $object = new stdClass;
$object->url = $url; $object->url = $url;
$object->name = $name; $object->name = ucwords($type) . ': ' . $name;
for ($i=0; $i<count($viewed); $i++) for ($i=0; $i<count($viewed); $i++)
{ {
@ -261,11 +261,18 @@ define("ACCOUNT_IMPORT", "import");
define("ACCOUNT_MAP", "import_map"); define("ACCOUNT_MAP", "import_map");
define("ACCOUNT_EXPORT", "export"); 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_SENT', 2);
define('INVOICE_STATUS_VIEWED', 3);
define('INVOICE_STATUS_PARTIAL', 4);
define('INVOICE_STATUS_PAID', 5);
interface iPerson interface iPerson
{ {
//public function getFullName(); //public function getFullName();

View File

@ -1,40 +1,17 @@
<!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="">
<meta name="csrf-token" content="<?= csrf_token() ?>">
<title>Invoice Ninja {{ isset($title) ? $title : '' }}</title>
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]> @section('head')
<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> <meta name="csrf-token" content="<?= csrf_token() ?>">
<![endif]-->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.js" type="text/javascript"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<!--
<script src="{{ asset('js/typeahead.js') }}" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="{{ asset('css/typeahead.js-bootstrap.css') }}"/>
-->
@if (Auth::check() && Auth::user()->theme_id) @if (Auth::check() && Auth::user()->theme_id)
<link rel="stylesheet" type="text/css" href="{{ asset('css/themes/'.Auth::user()->theme->name.'.min.css') }}"/> <link rel="stylesheet" type="text/css" href="{{ asset('css/themes/'.Auth::user()->theme->name.'.min.css') }}"/>
@else @else
<link rel="stylesheet" type="text/css" href="{{ asset('css/bootstrap.css') }}"/> <link rel="stylesheet" type="text/css" href="{{ asset('css/bootstrap.css') }}"/>
@endif @endif
<script src="{{ asset('js/bootstrap.js') }}" type="text/javascript"></script> <script src="{{ asset('js/bootstrap.js') }}" type="text/javascript"></script>
<!-- <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap-theme.min.css"> -->
{{-- Basset::show('bootstrapper.css') --}}
{{-- Basset::show('bootstrapper.js') --}}
<script src="{{ asset('js/bootstrap-combobox.js') }}" type="text/javascript"></script> <script src="{{ asset('js/bootstrap-combobox.js') }}" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="{{ asset('css/bootstrap-combobox.css') }}"/> <link rel="stylesheet" type="text/css" href="{{ asset('css/bootstrap-combobox.css') }}"/>
@ -56,6 +33,11 @@
<style type="text/css"> <style type="text/css">
@if (!Auth::check() || Auth::user()->showGreyBackground())
body {
background-color: #EEEEEE;
}
@endif
body > div.container { body > div.container {
min-height: 600px; min-height: 600px;
@ -188,9 +170,11 @@
border-style: none !important; border-style: none !important;
} }
/*
table.invoice-table tbody tr:hover { table.invoice-table tbody tr:hover {
background-color: #FFFFFF !important; background-color: #FFFFFF !important;
} }
*/
.invoice-table td { .invoice-table td {
padding: 2px !important; padding: 2px !important;
@ -217,27 +201,14 @@
</style> </style>
</head> @stop
<body> @section('body')
@if (App::environment() != ENV_DEVELOPMENT)
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-46031341-1', 'sketch-out.com');
ga('send', 'pageview');
</script>
@endif
<div class="container"> <div class="container">
<p/> <p/>
<div> <div>
<span style="font-size:30px">Invoice Ninja</span> <a href="{{ URL::to('/') }}" style="font-size:30px;color:black">Invoice Ninja</a>
<div style="float:right"> <div style="float:right">
@if (Auth::check() && Auth::user()->registered) @if (Auth::check() && Auth::user()->registered)
{{ Auth::user()->email }} &nbsp; {{ Auth::user()->email }} &nbsp;
@ -521,4 +492,5 @@
}); });
</script> </script>
</html>
@stop

View File

@ -24,7 +24,7 @@
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
{{ Former::select('client')->addOption('', '')->fromQuery($clients, 'name', 'public_id')->select($client ? $client->public_id : '') {{ Former::select('client')->addOption('', '')->fromQuery($clients, 'name', 'public_id')->select($client ? $client->public_id : '')->addGroupClass('client_select')
->help('<a style="cursor:pointer" data-toggle="modal" id="modalLink" onclick="showCreateNew()">Create new client</a>') }} ->help('<a style="cursor:pointer" data-toggle="modal" id="modalLink" onclick="showCreateNew()">Create new client</a>') }}
{{ Former::textarea('notes') }} {{ Former::textarea('notes') }}
</div> </div>
@ -77,7 +77,7 @@
<input data-bind="value: tax, valueUpdate: 'afterkeydown'"/> <input data-bind="value: tax, valueUpdate: 'afterkeydown'"/>
</td> </td>
--> -->
<td style="width:100px;background-color: #FFFFFF;text-align: right;padding-top:9px !important"> <td style="width:100px;text-align: right;padding-top:9px !important">
<span data-bind="text: total"></span> <span data-bind="text: total"></span>
</td> </td>
<td style="width:20px; cursor:pointer" class="hide-border"> <td style="width:20px; cursor:pointer" class="hide-border">
@ -116,11 +116,14 @@
<p>&nbsp;</p> <p>&nbsp;</p>
<div class="form-actions"> <div class="form-actions">
@if ($invoice) <div style="display:none">
<div style="display:none"> {{ Former::text('action') }}
{{ Former::text('action') }} @if ($invoice)
{{ Former::text('id') }} {{ Former::text('id') }}
</div> @endif
</div>
@if ($invoice)
{{ DropdownButton::normal('Download PDF', {{ DropdownButton::normal('Download PDF',
Navigation::links( Navigation::links(
array( array(
@ -174,7 +177,7 @@
{{ Former::text('city') }} {{ Former::text('city') }}
{{ Former::text('state') }} {{ Former::text('state') }}
{{ Former::text('postal_code') }} {{ Former::text('postal_code') }}
{{ Former::select('country_id')->addOption('','')->label('Country') {{ Former::select('country_id')->addOption('','')->label('Country')->addGroupClass('country_select')
->fromQuery($countries, 'name', 'id')->select($client ? $client->country_id : '') }} ->fromQuery($countries, 'name', 'id')->select($client ? $client->country_id : '') }}
</div> </div>
</div> </div>
@ -242,17 +245,17 @@
var $input = $('select#client'); var $input = $('select#client');
$input.combobox(); $input.combobox();
$('.combobox-container input.form-control').attr('name', 'client_combobox').on('change', function(e) { $('.client_select input.form-control').on('change', function(e) {
refreshPDF(); refreshPDF();
}).on('keydown', function() { }).on('keydown', function() {
$('#modalLink').text('Create new client'); $('#modalLink').text('Create new client');
}); });
enableHoverClick($('.combobox-container input.form-control'), $('.combobox-container input[name=client]'), '{{ URL::to('clients') }}'); //enableHoverClick($('.combobox-container input.form-control'), $('.combobox-container input[name=client]'), '{{ URL::to('clients') }}');
@if ($client) @if ($client)
$('input#invoice_number').focus(); $('input#invoice_number').focus();
@else @else
$('[name="client_combobox"]').focus(); //$('[name="client_combobox"]').focus();
@endif @endif
/* /*
@ -277,7 +280,8 @@
}); });
function showCreateNew() { function showCreateNew() {
if ($('.combobox-container input[name=client]').val() != '-1') { console.log('showCreateNew: %s', $('input[name=client]').val());
if ($('input[name=client]').val() != '-1') {
$('#myModal input').val(''); $('#myModal input').val('');
$('#myModal #country_id').val(''); $('#myModal #country_id').val('');
$('#nameError').css( "display", "none" ); $('#nameError').css( "display", "none" );
@ -327,9 +331,6 @@
name: "{{ $account->country ? $account->country->name : '' }}" name: "{{ $account->country ? $account->country->name : '' }}"
} }
}, },
client: {
name: $('[name="client_combobox"]').val()
},
@if (file_exists($account->getLogoPath())) @if (file_exists($account->getLogoPath()))
image: "{{ HTML::image_data($account->getLogoPath()) }}", image: "{{ HTML::image_data($account->getLogoPath()) }}",
imageWidth: {{ $account->getLogoWidth() }}, imageWidth: {{ $account->getLogoWidth() }},
@ -338,6 +339,26 @@
invoice_items: [] invoice_items: []
}; };
var clientId = $('input[name=client]').val();
console.log('clientId: %s', clientId);
console.log('mapped: %s', clientMap[clientId]);
if (clientId == '-1') {
var client = {
name: $('#name').val(),
address1: $('#address1').val(),
address2: $('#address2').val(),
city: $('#city').val(),
state: $('#state').val(),
postal_code: $('#postal_code').val(),
country: {
name: $('.country_select input[type=text]').val()
}
};
} else if (clientMap.hasOwnProperty(clientId)) {
var client = clientMap[clientId];
}
invoice.client = client;
for(var i=0; i<model.items().length; i++) { for(var i=0; i<model.items().length; i++) {
var item = model.items()[i]; var item = model.items()[i];
invoice.invoice_items.push({ invoice.invoice_items.push({
@ -352,6 +373,12 @@
} }
function refreshPDF() { function refreshPDF() {
setTimeout(function() {
_refreshPDF();
}, 100);
}
function _refreshPDF() {
var invoice = createInvoiceModel(); var invoice = createInvoiceModel();
var doc = generatePDF(invoice); var doc = generatePDF(invoice);
var string = doc.output('datauristring'); var string = doc.output('datauristring');
@ -388,12 +415,11 @@
if (!name) { if (!name) {
if (!name) $('#nameError').css( "display", "inline" ); if (!name) $('#nameError').css( "display", "inline" );
} else { } else {
$('.combobox-container input[name=client]').val('-1'); $('input[name=client]').val('-1');
$('.combobox-container input.form-control').val(name); $('.client_select input.form-control').val(name);
$('.combobox-container').addClass('combobox-selected'); $('.client_select').addClass('combobox-selected');
$('#nameError').css( "display", "none" ); $('#nameError').css( "display", "none" );
//$('#client_name').val('');
$('#modalLink').text('Edit client details'); $('#modalLink').text('Edit client details');
$('#myModal').modal('hide'); $('#myModal').modal('hide');
$('input#invoice_number').focus(); $('input#invoice_number').focus();
@ -571,6 +597,13 @@
} }
var products = {{ $products }}; var products = {{ $products }};
var clients = {{ $clients }};
var clientMap = {};
for (var i=0; i<clients.length; i++) {
var client = clients[i];
clientMap[client.public_id] = client;
}
window.model = new InvoiceModel(); window.model = new InvoiceModel();
ko.applyBindings(model); ko.applyBindings(model);

View File

@ -3,7 +3,7 @@
@section('content') @section('content')
@if ($invoice->client->account->isGatewayConfigured()) @if ($invoice->client->account->isGatewayConfigured())
{{ Button::primary_link(URL::to('payment/' . $invoice->invoice_key), 'Pay Now', array('class' => 'btn-lg pull-right')) }} {{ Button::primary_link(URL::to('payment/' . $invitation->invitation_key), 'Pay Now', array('class' => 'btn-lg pull-right')) }}
<div class="clearfix"></div><p>&nbsp;</p> <div class="clearfix"></div><p>&nbsp;</p>
@endif @endif

View File

@ -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('content')
<!-- 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,9 @@
} }
</style> </style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.js" type="text/javascript"></script>
{{ Basset::show('bootstrapper.css') }}
{{ Basset::show('bootstrapper.js') }}
</head>
<body>
<div class="container"> <div class="container">
{{ Form::open(array('url' => 'login', 'class' => 'form-signin')) }} {{ Form::open(array('url' => 'user/login', 'class' => 'form-signin')) }}
<h2 class="form-signin-heading">Please sign in</h2> <h2 class="form-signin-heading">Please sign in</h2>
<p> <p>
@ -85,6 +62,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') }}
<!-- 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>
@ -99,8 +78,5 @@
</div> </div>
</body> @stop
</html>

View File

@ -7,7 +7,7 @@
<meta name="description" content=""> <meta name="description" content="">
<meta name="author" content=""> <meta name="author" content="">
<title>Invoice Ninja</title> <title>Invoice Ninja {{ isset($title) ? $title : '' }}</title>
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]> <!--[if lt IE 9]>
@ -15,9 +15,11 @@
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]--> <![endif]-->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.js" type="text/javascript"></script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.js" type="text/javascript"></script>
{{-- Basset::show('bootstrapper.css') --}} <link rel="stylesheet" type="text/css" href="{{ asset('css/bootstrap.css') }}"/>
{{-- Basset::show('bootstrapper.js') --}}
<link rel="stylesheet" type="text/css" href="{{ asset('css/bootstrap.css') }}"/>
@yield('head')
</head> </head>
<body> <body>
@ -34,99 +36,8 @@
</script> </script>
@endif @endif
<div class="navbar navbar-inverse navbar-fixed-top"> @yield('body')
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Invoice Ninja</a>
</div>
<!--
<div class="navbar-collapse collapse">
{{ Form::open(array('url' => 'login', 'class' => 'navbar-form navbar-right')) }}
<div class="form-group">
{{ Form::text('email', Input::old('email'), array('placeholder' => 'Email')) }}
</div>
<div class="form-group">
{{ Form::password('password', array('placeholder' => 'Password')) }}
</div>
<button type="submit" class="btn btn-success">Sign in</button>
{{ Form::close() }}
-->
</div><!--/.navbar-collapse -->
</div>
</div>
<!-- Main jumbotron for a primary marketing message or call to action -->
<div class="jumbotron">
<div class="container">
<h1>Hello, world!</h1>
<p>This is a template for a simple marketing or informational website. It includes a large callout called a jumbotron and three supporting pieces of content. Use it as a starting point to create something more unique.</p>
<p>
{{ Form::open(array('url' => 'get_started')) }}
{{ Form::hidden('guest_key') }}
{{ Button::lg_primary_submit('Get Started &raquo;') }}
{{ Form::close() }}
</p>
</div>
</div>
<div class="container">
<!-- Example row of columns -->
<div class="row">
<div class="col-md-4">
<h2>Heading</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
<p><a class="btn btn-default" href="#" role="button">View details &raquo;</a></p>
</div>
<div class="col-md-4">
<h2>Heading</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
<p><a class="btn btn-default" href="#" role="button">View details &raquo;</a></p>
</div>
<div class="col-md-4">
<h2>Heading</h2>
<p>Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
<p><a class="btn btn-default" href="#" role="button">View details &raquo;</a></p>
</div>
</div>
<hr>
<footer>
<p>&copy; Company 2013</p>
</footer>
</div> <!-- /container -->
</body> </body>
<script type="text/javascript">
$(function() {
function isStorageSupported() {
try {
return 'localStorage' in window && window['localStorage'] !== null;
} catch (e) {
return false;
}
}
if (isStorageSupported()) {
@if (Session::get('clearGuestKey'))
localStorage.setItem('guest_key', '');
@else
$('[name="guest_key"]').val(localStorage.getItem('guest_key'));
@endif
}
});
</script>
</html> </html>

View File

@ -109,7 +109,6 @@
$input.combobox(); $input.combobox();
var $input = $('select#invoice').on('change', function(e) { var $input = $('select#invoice').on('change', function(e) {
console.log('invoice change');
$clientCombobox = $('select#client'); $clientCombobox = $('select#client');
var invoiceId = $('input[name=invoice]').val(); var invoiceId = $('input[name=invoice]').val();
if (invoiceId) { if (invoiceId) {

95
app/views/splash.blade.php Executable file
View File

@ -0,0 +1,95 @@
@extends('master')
@section('body')
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Invoice Ninja</a>
</div>
<div class="navbar-collapse collapse">
{{ Form::open(array('url' => 'login', 'class' => 'navbar-form navbar-right')) }}
<div class="form-group">
{{ Form::text('email', Input::old('email'), array('placeholder' => 'Email')) }}
</div>
<div class="form-group">
{{ Form::password('password', array('placeholder' => 'Password')) }}
</div>
<button type="submit" class="btn btn-success">Sign in</button>
{{ Form::close() }}
</div><!--/.navbar-collapse -->
</div>
</div>
<!-- Main jumbotron for a primary marketing message or call to action -->
<div class="jumbotron">
<div class="container">
<h1>Hello, world!</h1>
<p>This is a template for a simple marketing or informational website. It includes a large callout called a jumbotron and three supporting pieces of content. Use it as a starting point to create something more unique.</p>
<p>
{{ Form::open(array('url' => 'get_started')) }}
{{ Form::hidden('guest_key') }}
{{ Button::lg_primary_submit('Get Started &raquo;') }}
{{ Form::close() }}
</p>
</div>
</div>
<div class="container">
<!-- Example row of columns -->
<div class="row">
<div class="col-md-4">
<h2>Heading</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
<p><a class="btn btn-default" href="#" role="button">View details &raquo;</a></p>
</div>
<div class="col-md-4">
<h2>Heading</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
<p><a class="btn btn-default" href="#" role="button">View details &raquo;</a></p>
</div>
<div class="col-md-4">
<h2>Heading</h2>
<p>Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
<p><a class="btn btn-default" href="#" role="button">View details &raquo;</a></p>
</div>
</div>
<hr>
<footer>
<p>&copy; Company 2013</p>
</footer>
<script type="text/javascript">
$(function() {
function isStorageSupported() {
try {
return 'localStorage' in window && window['localStorage'] !== null;
} catch (e) {
return false;
}
}
if (isStorageSupported()) {
@if (Session::get('clearGuestKey'))
localStorage.setItem('guest_key', '');
@else
$('[name="guest_key"]').val(localStorage.getItem('guest_key'));
@endif
}
});
</script>
</div>
@stop

View File

108
app/views/users/login.blade.php Executable file
View File

@ -0,0 +1,108 @@
<!DOCTYPE html>
<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>
<!-- 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">
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>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.js" type="text/javascript"></script>
{{ Basset::show('bootstrapper.css') }}
{{ Basset::show('bootstrapper.js') }}
</head>
<body>
<div class="container">
{{ Form::open(array('url' => 'login', 'class' => 'form-signin')) }}
<h2 class="form-signin-heading">Please sign in</h2>
<p>
{{ $errors->first('email') }}
{{ $errors->first('password') }}
</p>
<p>
{{ Form::text('email', Input::old('email'), array('placeholder' => 'Email address')) }}
{{ Form::password('password', array('placeholder' => 'Password')) }}
</p>
<p>{{ Button::primary_submit('Sign In', array('class' => 'btn-lg'))->block() }}</p>
{{ link_to('user/forgot_password', 'Recover your password') }}
<!-- 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
{{ Form::close() }}
</div>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,5 @@
function generatePDF(invoice) { function generatePDF(invoice) {
var clientName = invoice.client.name;
var invoiceNumber = invoice.invoice_number; var invoiceNumber = invoice.invoice_number;
var issuedOn = invoice.invoice_date; var issuedOn = invoice.invoice_date;
var amount = '$0.00'; var amount = '$0.00';
@ -37,7 +36,25 @@ function generatePDF(invoice) {
var issuedOnX = headerRight - (doc.getStringUnitWidth(issuedOn) * doc.internal.getFontSize()); var issuedOnX = headerRight - (doc.getStringUnitWidth(issuedOn) * doc.internal.getFontSize());
doc.setFontType("normal"); doc.setFontType("normal");
doc.text(marginLeft, headerTop, clientName); if (invoice.client) {
var y = headerTop;
doc.text(marginLeft, y, invoice.client.name);
y += rowHeight;
doc.text(marginLeft, y, invoice.client.address1);
if (invoice.client.address2) {
y += rowHeight;
doc.text(marginLeft, y, invoice.client.address2);
}
if (invoice.client.city || invoice.client.state || invoice.client.postal_code) {
y += rowHeight;
doc.text(marginLeft, y, invoice.client.city + ', ' + invoice.client.state + ' ' + invoice.client.postal_code);
}
if (invoice.client.country) {
y += rowHeight;
doc.text(marginLeft, y, invoice.client.country.name);
}
}
doc.text(headerLeft, headerTop, 'Invoice #'); doc.text(headerLeft, headerTop, 'Invoice #');
doc.text(invoiceNumberX, headerTop, invoiceNumber); doc.text(invoiceNumberX, headerTop, invoiceNumber);
doc.text(headerLeft, headerTop + rowHeight, 'Invoice Date'); doc.text(headerLeft, headerTop + rowHeight, 'Invoice Date');
@ -134,16 +151,20 @@ function generatePDF(invoice) {
doc.text(tableLeft, y, invoice.account.country ? invoice.account.country.name : ''); doc.text(tableLeft, y, invoice.account.country ? invoice.account.country.name : '');
var clientX = headerRight - (doc.getStringUnitWidth(invoice.client.name) * doc.internal.getFontSize()); if (invoice.client) {
var clientX = headerRight - (doc.getStringUnitWidth(invoice.client.name) * doc.internal.getFontSize());
}
var numberX = headerRight - (doc.getStringUnitWidth(invoice.invoice_number) * doc.internal.getFontSize()); var numberX = headerRight - (doc.getStringUnitWidth(invoice.invoice_number) * doc.internal.getFontSize());
var dateX = headerRight - (doc.getStringUnitWidth(issuedOn) * doc.internal.getFontSize()); var dateX = headerRight - (doc.getStringUnitWidth(issuedOn) * doc.internal.getFontSize());
var totalX = headerRight - (doc.getStringUnitWidth(total) * doc.internal.getFontSize()); var totalX = headerRight - (doc.getStringUnitWidth(total) * doc.internal.getFontSize());
y = 720; y = 720;
doc.setFontType("bold"); if (invoice.client) {
doc.text(headerLeft, y, 'Client'); doc.setFontType("bold");
doc.setFontType("normal"); doc.text(headerLeft, y, 'Client');
doc.text(clientX, y, invoice.client.name); doc.setFontType("normal");
doc.text(clientX, y, invoice.client.name);
}
y += 16; y += 16;
doc.setFontType("bold"); doc.setFontType("bold");
@ -189,9 +210,6 @@ function formatMoney(num) {
/* Set the defaults for DataTables initialisation */ /* Set the defaults for DataTables initialisation */
$.extend( true, $.fn.dataTable.defaults, { $.extend( true, $.fn.dataTable.defaults, {
"sDom": "t<'row-fluid'<'span6'i><'span6'p>>", "sDom": "t<'row-fluid'<'span6'i><'span6'p>>",