diff --git a/.gitignore b/.gitignore
index 0ff666ab56..7cc6a79c6d 100755
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
/app/config/staging
/app/config/development
+/app/storage/
/public/logo
/bootstrap/compiled.php
/vendor
diff --git a/app/controllers/ActivityController.php b/app/controllers/ActivityController.php
index 04713f2106..38c6192393 100755
--- a/app/controllers/ActivityController.php
+++ b/app/controllers/ActivityController.php
@@ -7,7 +7,7 @@ class ActivityController extends \BaseController {
$clientId = Client::getPrivateId($clientPublicId);
return Datatable::collection(Activity::scope()->where('client_id','=',$clientId)->get())
- ->addColumn('date', function($model) { return Utils::timestampToDateString($model->created_at); })
+ ->addColumn('date', function($model) { return Utils::timestampToDateTimeString($model->created_at); })
->addColumn('message', function($model) { return $model->message; })
->addColumn('balance', function($model) { return '$' . $model->balance; })
->orderColumns('date')
diff --git a/app/controllers/ClientController.php b/app/controllers/ClientController.php
index 4853145135..f3bd68a401 100755
--- a/app/controllers/ClientController.php
+++ b/app/controllers/ClientController.php
@@ -15,12 +15,12 @@ class ClientController extends \BaseController {
return View::make('list', array(
'entityType'=>ENTITY_CLIENT,
'title' => '- Clients',
- 'columns'=>['checkbox', 'Client', 'Contact', 'Balance', 'Last Login', 'Date Created', 'Email', 'Phone', 'Action']
+ 'columns'=>['checkbox', 'Client', 'Contact', 'Date Created', 'Email', 'Phone', 'Last Login', 'Balance', 'Action']
));
}
public function getDatatable()
- {
+ {
$query = DB::table('clients')
->join('contacts', 'contacts.client_id', '=', 'clients.id')
->where('clients.account_id', '=', Auth::user()->account_id)
@@ -28,15 +28,30 @@ class ClientController extends \BaseController {
->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','clients.work_phone','contacts.email');
+ $filter = Input::get('sSearch');
+ if ($filter)
+ {
+ $query->where(function($query) use ($filter)
+ {
+ $query->where('clients.name', 'like', '%'.$filter.'%')
+ ->orWhere('contacts.first_name', 'like', '%'.$filter.'%')
+ ->orWhere('contacts.last_name', 'like', '%'.$filter.'%')
+ ->orWhere('contacts.email', 'like', '%'.$filter.'%');
+ });
+ }
+
+ //$query->get();
+ //dd(DB::getQueryLog());
+
return Datatable::query($query)
->addColumn('checkbox', function($model) { return ''; })
->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('balance', function($model) { return '$' . $model->balance; })
- ->addColumn('last_login', function($model) { return Utils::timestampToDateString($model->last_login); })
->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('work_phone', function($model) { return Utils::formatPhoneNumber($model->work_phone); })
+ ->addColumn('last_login', function($model) { return Utils::timestampToDateString($model->last_login); })
+ ->addColumn('balance', function($model) { return '$' . $model->balance; })
->addColumn('dropdown', function($model)
{
return '
@@ -71,6 +86,8 @@ class ClientController extends \BaseController {
'method' => 'POST',
'url' => 'clients',
'title' => '- New Client',
+ 'clientSizes' => ClientSize::orderBy('id')->get(),
+ 'clientIndustries' => ClientIndustry::orderBy('name')->get(),
'countries' => Country::orderBy('name')->get());
return View::make('clients.edit', $data);
@@ -94,13 +111,13 @@ class ClientController extends \BaseController {
*/
public function show($publicId)
{
- $client = Client::scope($publicId)->with('contacts')->firstOrFail();
+ $client = Client::scope($publicId)->with('contacts', 'client_size', 'client_industry')->firstOrFail();
Utils::trackViewed($client->name, ENTITY_CLIENT);
$data = array(
'client' => $client,
'title' => '- ' . $client->name,
- 'hasRecurringInvoices' => Invoice::scope()->where('frequency_id', '>', '0')->count() > 0
+ 'hasRecurringInvoices' => Invoice::scope()->where('frequency_id', '>', '0')->whereClientId($client->id)->count() > 0
);
return View::make('clients.show', $data);
@@ -120,6 +137,8 @@ class ClientController extends \BaseController {
'method' => 'PUT',
'url' => 'clients/' . $publicId,
'title' => '- ' . $client->name,
+ 'clientSizes' => ClientSize::orderBy('id')->get(),
+ 'clientIndustries' => ClientIndustry::orderBy('name')->get(),
'countries' => Country::orderBy('name')->get());
return View::make('clients.edit', $data);
}
@@ -161,10 +180,11 @@ class ClientController extends \BaseController {
$client->city = trim(Input::get('city'));
$client->state = trim(Input::get('state'));
$client->notes = trim(Input::get('notes'));
- $client->postal_code = trim(Input::get('postal_code'));
- if (Input::get('country_id')) {
- $client->country_id = Input::get('country_id');
- }
+ $client->postal_code = trim(Input::get('postal_code'));
+ $client->country_id = Input::get('country_id') ? Input::get('country_id') : null;
+ $client->client_size_id = Input::get('client_size_id') ? Input::get('client_size_id') : null;
+ $client->client_industry_id = Input::get('client_industry_id') ? Input::get('client_industry_id') : null;
+
$client->save();
$data = json_decode(Input::get('data'));
@@ -201,7 +221,12 @@ class ClientController extends \BaseController {
}
}
- Session::flash('message', 'Successfully updated client');
+ if ($publicId) {
+ Session::flash('message', 'Successfully updated client');
+ } else {
+ Session::flash('message', 'Successfully created client');
+ }
+
return Redirect::to('clients/' . $client->public_id);
}
diff --git a/app/controllers/CreditController.php b/app/controllers/CreditController.php
index 02c2af3657..1cf908dffa 100755
--- a/app/controllers/CreditController.php
+++ b/app/controllers/CreditController.php
@@ -12,7 +12,7 @@ class CreditController extends \BaseController {
return View::make('list', array(
'entityType'=>ENTITY_CREDIT,
'title' => '- Credits',
- 'columns'=>['checkbox', 'Client', 'Amount', 'Credit Date', 'Action']
+ 'columns'=>['checkbox', 'Client', 'Credit Amount', 'Credit Date', 'Action']
));
}
@@ -28,6 +28,15 @@ class CreditController extends \BaseController {
$query->where('clients.public_id', '=', $clientPublicId);
}
+ $filter = Input::get('sSearch');
+ if ($filter)
+ {
+ $query->where(function($query) use ($filter)
+ {
+ $query->where('clients.name', 'like', '%'.$filter.'%');
+ });
+ }
+
$table = Datatable::query($query);
if (!$clientPublicId) {
diff --git a/app/controllers/InvoiceController.php b/app/controllers/InvoiceController.php
index 8e55799d0a..90dd83b4de 100755
--- a/app/controllers/InvoiceController.php
+++ b/app/controllers/InvoiceController.php
@@ -18,13 +18,13 @@ class InvoiceController extends \BaseController {
$data = [
'title' => '- Invoices',
'entityType'=>ENTITY_INVOICE,
- 'columns'=>['checkbox', 'Invoice Number', 'Client', 'Total', 'Amount Due', 'Invoice Date', 'Due Date', 'Status', 'Action']
+ 'columns'=>['checkbox', 'Invoice Number', 'Client', 'Invoice Date', 'Invoice Total', 'Balance Due', 'Due Date', 'Status', 'Action']
];
if (Invoice::scope()->where('frequency_id', '>', '0')->count() > 0)
{
$data['secEntityType'] = ENTITY_RECURRING_INVOICE;
- $data['secColumns'] = ['checkbox', 'Client', 'Total', 'Frequency', 'Start Date', 'End Date', 'Action'];
+ $data['secColumns'] = ['checkbox', 'Frequency', 'Client', 'Start Date', 'End Date', 'Invoice Total', 'Action'];
}
return View::make('list', $data);
@@ -44,6 +44,17 @@ class InvoiceController extends \BaseController {
$query->where('clients.public_id', '=', $clientPublicId);
}
+ $filter = Input::get('sSearch');
+ if ($filter)
+ {
+ $query->where(function($query) use ($filter)
+ {
+ $query->where('clients.name', 'like', '%'.$filter.'%')
+ ->orWhere('invoices.invoice_number', 'like', '%'.$filter.'%')
+ ->orWhere('invoice_statuses.name', 'like', '%'.$filter.'%');
+ });
+ }
+
$table = Datatable::query($query);
if (!$clientPublicId) {
@@ -56,9 +67,9 @@ class InvoiceController extends \BaseController {
$table->addColumn('client', function($model) { return link_to('clients/' . $model->client_public_id, $model->client_name); });
}
- return $table->addColumn('total', function($model) { return '$' . money_format('%i', $model->total); })
+ return $table->addColumn('invoice_date', function($model) { return Utils::fromSqlDate($model->invoice_date); })
+ ->addColumn('total', function($model) { return '$' . money_format('%i', $model->total); })
->addColumn('balance', function($model) { return '$' . money_format('%i', $model->balance); })
- ->addColumn('invoice_date', function($model) { return Utils::fromSqlDate($model->invoice_date); })
->addColumn('due_date', function($model) { return Utils::fromSqlDate($model->due_date); })
->addColumn('invoice_status_name', function($model) { return $model->invoice_status_name; })
->addColumn('dropdown', function($model)
@@ -93,20 +104,31 @@ class InvoiceController extends \BaseController {
$query->where('clients.public_id', '=', $clientPublicId);
}
+ $filter = Input::get('sSearch');
+ if ($filter)
+ {
+ $query->where(function($query) use ($filter)
+ {
+ $query->where('clients.name', 'like', '%'.$filter.'%')
+ ->orWhere('invoices.invoice_number', 'like', '%'.$filter.'%');
+ });
+ }
+
$table = Datatable::query($query);
if (!$clientPublicId) {
$table->addColumn('checkbox', function($model) { return '
'; });
}
+ $table->addColumn('frequency', function($model) { return link_to('invoices/' . $model->public_id, $model->frequency); });
+
if (!$clientPublicId) {
$table->addColumn('client', function($model) { return link_to('clients/' . $model->client_public_id, $model->client_name); });
}
- return $table->addColumn('total', function($model) { return '$' . money_format('%i', $model->total); })
- ->addColumn('frequency', function($model) { return $model->frequency; })
- ->addColumn('start_date', function($model) { return Utils::fromSqlDate($model->start_date); })
+ return $table->addColumn('start_date', function($model) { return Utils::fromSqlDate($model->start_date); })
->addColumn('end_date', function($model) { return Utils::fromSqlDate($model->end_date); })
+ ->addColumn('total', function($model) { return '$' . money_format('%i', $model->total); })
->addColumn('dropdown', function($model)
{
return '
@@ -340,7 +362,7 @@ class InvoiceController extends \BaseController {
'account' => Auth::user()->account,
'products' => Product::scope()->get(array('product_key','notes','cost','qty')),
'countries' => Country::orderBy('name')->get(),
- 'clients' => Client::scope()->orderBy('name')->get(),
+ 'clients' => Client::scope()->with('contacts')->orderBy('name')->get(),
'frequencies' => array(
1 => 'Weekly',
2 => 'Two weeks',
@@ -371,7 +393,7 @@ class InvoiceController extends \BaseController {
{
return InvoiceController::bulk();
}
-
+
$rules = array(
'client' => 'required',
);
@@ -388,33 +410,33 @@ class InvoiceController extends \BaseController {
if ($clientPublicId == "-1")
{
$client = Client::createNew();
- $client->name = trim(Input::get('name'));
- $client->work_phone = trim(Input::get('work_phone'));
- $client->address1 = trim(Input::get('address1'));
- $client->address2 = trim(Input::get('address2'));
- $client->city = trim(Input::get('city'));
- $client->state = trim(Input::get('state'));
- $client->postal_code = trim(Input::get('postal_code'));
- if (Input::get('country_id')) {
- $client->country_id = Input::get('country_id');
- }
- $client->save();
- $clientId = $client->id;
-
$contact = Contact::createNew();
- $contact->is_primary = true;
- $contact->first_name = trim(Input::get('first_name'));
- $contact->last_name = trim(Input::get('last_name'));
- $contact->phone = trim(Input::get('phone'));
- $contact->email = trim(Input::get('email'));
- $client->contacts()->save($contact);
+ $contact->is_primary = true;
}
else
{
$client = Client::scope($clientPublicId)->with('contacts')->firstOrFail();
- $contact = $client->contacts()->first();
+ $contact = $client->contacts()->where('is_primary', '=', true)->firstOrFail();
}
+ $client->name = trim(Input::get('name'));
+ $client->work_phone = trim(Input::get('work_phone'));
+ $client->address1 = trim(Input::get('address1'));
+ $client->address2 = trim(Input::get('address2'));
+ $client->city = trim(Input::get('city'));
+ $client->state = trim(Input::get('state'));
+ $client->postal_code = trim(Input::get('postal_code'));
+ if (Input::get('country_id')) {
+ $client->country_id = Input::get('country_id');
+ }
+ $client->save();
+
+ $contact->first_name = trim(Input::get('first_name'));
+ $contact->last_name = trim(Input::get('last_name'));
+ $contact->phone = trim(Input::get('phone'));
+ $contact->email = trim(Input::get('email'));
+ $client->contacts()->save($contact);
+
if ($publicId) {
$invoice = Invoice::scope($publicId)->firstOrFail();
$invoice->invoice_items()->forceDelete();
@@ -423,7 +445,7 @@ class InvoiceController extends \BaseController {
}
$invoice->client_id = $client->id;
- $invoice->discount = 0;
+ $invoice->discount = Input::get('discount');
$invoice->invoice_number = trim(Input::get('invoice_number'));
$invoice->invoice_date = Utils::toSqlDate(Input::get('invoice_date'));
$invoice->due_date = Utils::toSqlDate(Input::get('due_date'));
@@ -432,7 +454,8 @@ class InvoiceController extends \BaseController {
$invoice->start_date = Utils::toSqlDate(Input::get('start_date'));
$invoice->end_date = Utils::toSqlDate(Input::get('end_date'));
$invoice->notes = Input::get('notes');
-
+ $invoice->po_number = Input::get('po_number');
+
$client->invoices()->save($invoice);
$items = json_decode(Input::get('items'));
@@ -500,7 +523,11 @@ class InvoiceController extends \BaseController {
/*
*/
- if ($action == 'email')
+ if ($action == 'clone')
+ {
+ return InvoiceController::cloneInvoice($publicId);
+ }
+ else if ($action == 'email')
{
$this->mailer->sendInvoice($invoice, $contact);
@@ -561,4 +588,37 @@ class InvoiceController extends \BaseController {
return Redirect::to('invoices');
}
+
+ public static function cloneInvoice($publicId)
+ {
+ $invoice = Invoice::with('invoice_items')->scope($publicId)->firstOrFail();
+
+ $clone = Invoice::createNew();
+ foreach (['client_id', 'discount', 'invoice_date', 'due_date', 'frequency_id', 'start_date', 'end_date', 'notes'] as $field)
+ {
+ $clone->$field = $invoice->$field;
+ }
+
+ if (!$clone->isRecurring())
+ {
+ $clone->invoice_number = Auth::user()->account->getNextInvoiceNumber();
+ }
+
+ $clone->save();
+
+ foreach ($invoice->invoice_items as $item)
+ {
+ $cloneItem = InvoiceItem::createNew();
+
+ foreach (['product_id', 'product_key', 'notes', 'cost', 'qty'] as $field)
+ {
+ $cloneItem->$field = $item->$field;
+ }
+
+ $clone->invoice_items()->save($cloneItem);
+ }
+
+ Session::flash('message', 'Successfully cloned invoice');
+ return Redirect::to('invoices/' . $clone->public_id);
+ }
}
\ No newline at end of file
diff --git a/app/controllers/PaymentController.php b/app/controllers/PaymentController.php
index d93312f13b..3d12fab5d5 100755
--- a/app/controllers/PaymentController.php
+++ b/app/controllers/PaymentController.php
@@ -7,7 +7,7 @@ class PaymentController extends \BaseController
return View::make('list', array(
'entityType'=>ENTITY_PAYMENT,
'title' => '- Payments',
- 'columns'=>['checkbox', 'Transaction Reference', 'Client', 'Invoice', 'Amount', 'Payment Date', 'Action']
+ 'columns'=>['checkbox', 'Transaction Reference', 'Client', 'Invoice', 'Payment Amount', 'Payment Date', 'Action']
));
}
@@ -24,6 +24,15 @@ class PaymentController extends \BaseController
$query->where('clients.public_id', '=', $clientPublicId);
}
+ $filter = Input::get('sSearch');
+ if ($filter)
+ {
+ $query->where(function($query) use ($filter)
+ {
+ $query->where('clients.name', 'like', '%'.$filter.'%');
+ });
+ }
+
$table = Datatable::query($query);
if (!$clientPublicId) {
diff --git a/app/database/migrations/2013_11_05_180133_confide_setup_users_table.php b/app/database/migrations/2013_11_05_180133_confide_setup_users_table.php
index 1a49df1462..e2e375f581 100755
--- a/app/database/migrations/2013_11_05_180133_confide_setup_users_table.php
+++ b/app/database/migrations/2013_11_05_180133_confide_setup_users_table.php
@@ -23,6 +23,8 @@ class ConfideSetupUsersTable extends Migration {
Schema::dropIfExists('invoices');
Schema::dropIfExists('password_reminders');
Schema::dropIfExists('clients');
+ Schema::dropIfExists('client_sizes');
+ Schema::dropIfExists('client_industries');
Schema::dropIfExists('users');
Schema::dropIfExists('accounts');
Schema::dropIfExists('invoice_statuses');
@@ -85,7 +87,6 @@ class ConfideSetupUsersTable extends Migration {
$t->foreign('timezone_id')->references('id')->on('timezones');
$t->foreign('country_id')->references('id')->on('countries');
});
-
Schema::create('gateways', function($t)
{
@@ -115,7 +116,7 @@ class ConfideSetupUsersTable extends Migration {
Schema::create('users', function($t)
{
$t->increments('id');
- $t->unsignedInteger('account_id');
+ $t->unsignedInteger('account_id')->index();
$t->timestamps();
$t->softDeletes();
@@ -144,11 +145,23 @@ class ConfideSetupUsersTable extends Migration {
$t->string('token');
});
+ Schema::create('client_sizes', function($t)
+ {
+ $t->increments('id');
+ $t->string('name');
+ });
+
+ Schema::create('client_industries', function($t)
+ {
+ $t->increments('id');
+ $t->string('name');
+ });
+
Schema::create('clients', function($t)
{
$t->increments('id');
$t->unsignedInteger('user_id');
- $t->unsignedInteger('account_id');
+ $t->unsignedInteger('account_id')->index();
$t->timestamps();
$t->softDeletes();
@@ -163,12 +176,17 @@ class ConfideSetupUsersTable extends Migration {
$t->text('notes');
$t->decimal('balance', 10, 2);
$t->timestamp('last_login');
+ $t->string('website');
+ $t->unsignedInteger('client_industry_id')->nullable();
+ $t->unsignedInteger('client_size_id')->nullable();
$t->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
$t->foreign('user_id')->references('id')->on('users');
$t->foreign('country_id')->references('id')->on('countries');
+ $t->foreign('client_industry_id')->references('id')->on('client_industries');
+ $t->foreign('client_size_id')->references('id')->on('client_sizes');
- $t->unsignedInteger('public_id');
+ $t->unsignedInteger('public_id')->index();
$t->unique( array('account_id','public_id') );
});
@@ -177,7 +195,7 @@ class ConfideSetupUsersTable extends Migration {
$t->increments('id');
$t->unsignedInteger('account_id');
$t->unsignedInteger('user_id');
- $t->unsignedInteger('client_id');
+ $t->unsignedInteger('client_id')->index();
$t->timestamps();
$t->softDeletes();
@@ -210,15 +228,16 @@ class ConfideSetupUsersTable extends Migration {
Schema::create('invoices', function($t)
{
$t->increments('id');
- $t->unsignedInteger('client_id');
+ $t->unsignedInteger('client_id')->index();
$t->unsignedInteger('user_id');
- $t->unsignedInteger('account_id');
+ $t->unsignedInteger('account_id')->index();
$t->unsignedInteger('invoice_status_id')->default(1);
$t->timestamps();
$t->softDeletes();
$t->string('invoice_number');
$t->float('discount');
+ $t->string('po_number');
$t->date('invoice_date');
$t->date('due_date')->nullable();
$t->text('notes');
@@ -227,7 +246,7 @@ class ConfideSetupUsersTable extends Migration {
$t->date('start_date')->nullable();
$t->date('end_date')->nullable();
$t->date('last_sent_date')->nullable();
- $t->unsignedInteger('recurring_invoice_id')->nullable();
+ $t->unsignedInteger('recurring_invoice_id')->index()->nullable();
$t->decimal('total', 10, 2);
@@ -239,7 +258,7 @@ class ConfideSetupUsersTable extends Migration {
$t->foreign('invoice_status_id')->references('id')->on('invoice_statuses');
$t->foreign('recurring_invoice_id')->references('id')->on('invoices');
- $t->unsignedInteger('public_id');
+ $t->unsignedInteger('public_id')->index();
$t->unique( array('account_id','public_id') );
});
@@ -250,8 +269,8 @@ class ConfideSetupUsersTable extends Migration {
$t->unsignedInteger('account_id');
$t->unsignedInteger('user_id');
$t->unsignedInteger('contact_id');
- $t->unsignedInteger('invoice_id');
- $t->string('invitation_key')->unique();
+ $t->unsignedInteger('invoice_id')->index();
+ $t->string('invitation_key')->index()->unique();
$t->timestamps();
$t->softDeletes();
@@ -261,14 +280,14 @@ class ConfideSetupUsersTable extends Migration {
$t->foreign('contact_id')->references('id')->on('contacts')->onDelete('cascade');
$t->foreign('invoice_id')->references('id')->on('invoices')->onDelete('cascade');
- $t->unsignedInteger('public_id');
+ $t->unsignedInteger('public_id')->index();
$t->unique( array('account_id','public_id') );
});
Schema::create('products', function($t)
{
$t->increments('id');
- $t->unsignedInteger('account_id');
+ $t->unsignedInteger('account_id')->index();
$t->unsignedInteger('user_id');
$t->timestamps();
$t->softDeletes();
@@ -291,7 +310,7 @@ class ConfideSetupUsersTable extends Migration {
$t->increments('id');
$t->unsignedInteger('account_id');
$t->unsignedInteger('user_id');
- $t->unsignedInteger('invoice_id');
+ $t->unsignedInteger('invoice_id')->index();
$t->unsignedInteger('product_id')->nullable();
$t->timestamps();
$t->softDeletes();
@@ -313,8 +332,8 @@ class ConfideSetupUsersTable extends Migration {
{
$t->increments('id');
$t->unsignedInteger('invoice_id')->nullable();
- $t->unsignedInteger('account_id');
- $t->unsignedInteger('client_id');
+ $t->unsignedInteger('account_id')->index();
+ $t->unsignedInteger('client_id')->index();
$t->unsignedInteger('contact_id')->nullable();
$t->unsignedInteger('invitation_id')->nullable();
$t->unsignedInteger('user_id')->nullable();
@@ -332,16 +351,16 @@ class ConfideSetupUsersTable extends Migration {
$t->foreign('contact_id')->references('id')->on('contacts');
$t->foreign('user_id')->references('id')->on('users');
- $t->unsignedInteger('public_id');
+ $t->unsignedInteger('public_id')->index();
$t->unique( array('account_id','public_id') );
});
Schema::create('credits', function($t)
{
$t->increments('id');
- $t->unsignedInteger('account_id');
+ $t->unsignedInteger('account_id')->index();
$t->unsignedInteger('user_id');
- $t->unsignedInteger('client_id')->nullable();
+ $t->unsignedInteger('client_id')->index()->nullable();
$t->unsignedInteger('contact_id')->nullable();
$t->timestamps();
$t->softDeletes();
@@ -355,7 +374,7 @@ class ConfideSetupUsersTable extends Migration {
$t->foreign('contact_id')->references('id')->on('contacts');
$t->foreign('user_id')->references('id')->on('users');
- $t->unsignedInteger('public_id');
+ $t->unsignedInteger('public_id')->index();
$t->unique( array('account_id','public_id') );
});
@@ -403,6 +422,8 @@ class ConfideSetupUsersTable extends Migration {
Schema::dropIfExists('invoices');
Schema::dropIfExists('password_reminders');
Schema::dropIfExists('clients');
+ Schema::dropIfExists('client_sizes');
+ Schema::dropIfExists('client_industries');
Schema::dropIfExists('users');
Schema::dropIfExists('accounts');
Schema::dropIfExists('invoice_statuses');
diff --git a/app/database/seeds/ConstantsSeeder.php b/app/database/seeds/ConstantsSeeder.php
index 569afae272..171badd4db 100755
--- a/app/database/seeds/ConstantsSeeder.php
+++ b/app/database/seeds/ConstantsSeeder.php
@@ -58,6 +58,17 @@ class ConstantsSeeder extends Seeder
Frequency::create(array('name' => 'Six months'));
Frequency::create(array('name' => 'Annually'));
+ ClientIndustry::create(array('name' => 'Accounting'));
+ ClientIndustry::create(array('name' => 'Travel'));
+ ClientIndustry::create(array('name' => 'Engineering'));
+ ClientIndustry::create(array('name' => 'Marketing'));
+
+ ClientSize::create(array('name' => '1 - 10'));
+ ClientSize::create(array('name' => '11 - 50'));
+ ClientSize::create(array('name' => '51 - 100'));
+ ClientSize::create(array('name' => '101 - 500'));
+ ClientSize::create(array('name' => '500+'));
+
$gateways = [
array('name'=>'Authorize.Net AIM', 'provider'=>'AuthorizeNet_AIM'),
array('name'=>'Authorize.Net SIM', 'provider'=>'AuthorizeNet_SIM'),
diff --git a/app/libraries/utils.php b/app/libraries/utils.php
index 90f73f0faa..c97b079eb0 100755
--- a/app/libraries/utils.php
+++ b/app/libraries/utils.php
@@ -62,7 +62,7 @@ class Utils
return '';
}
- return $date->format('l M jS, Y g:ia');
+ return $date->format('D M jS, Y g:ia');
}
public static function timestampToDateString($timestamp) {
@@ -212,4 +212,5 @@ class Utils
{
return ucwords(str_replace('_', ' ', $entityType));
}
+
}
\ No newline at end of file
diff --git a/app/models/Client.php b/app/models/Client.php
index 75c83db1d7..7908831fce 100755
--- a/app/models/Client.php
+++ b/app/models/Client.php
@@ -39,6 +39,16 @@ class Client extends EntityModel
return $this->belongsTo('Country');
}
+ public function client_size()
+ {
+ return $this->belongsTo('ClientSize');
+ }
+
+ public function client_industry()
+ {
+ return $this->belongsTo('ClientIndustry');
+ }
+
public function getName()
{
return $this->name;
@@ -104,6 +114,23 @@ class Client extends EntityModel
return $str;
}
+ public function getIndustry()
+ {
+ $str = '';
+
+ if ($this->client_industry)
+ {
+ $str .= $this->client_industry->name . ' ';
+ }
+
+ if ($this->client_size)
+ {
+ $str .= $this->client_size->name;
+ }
+
+ return $str;
+ }
+
public function getDateCreated()
{
if ($this->created_at == '0000-00-00 00:00:00')
diff --git a/app/models/ClientIndustry.php b/app/models/ClientIndustry.php
new file mode 100755
index 0000000000..caffc42b01
--- /dev/null
+++ b/app/models/ClientIndustry.php
@@ -0,0 +1,6 @@
+label('Phone') }}
- {{ Former::textarea('notes') }}
-
+
{{ Former::legend('Address') }}
{{ Former::text('address1')->label('Street') }}
@@ -61,9 +60,15 @@
-
+ {{ Former::legend('Additional Info') }}
+ {{ Former::select('client_size_id')->addOption('','')->label('Size')
+ ->fromQuery($clientSizes, 'name', 'id')->select($client ? $client->client_size_id : '') }}
+ {{ Former::select('client_industry_id')->addOption('','')->label('Industry')
+ ->fromQuery($clientIndustries, 'name', 'id')->select($client ? $client->client_industry_id : '') }}
+ {{ Former::textarea('notes') }}
+
diff --git a/app/views/clients/show.blade.php b/app/views/clients/show.blade.php
index df0e70eef5..1c35e43729 100755
--- a/app/views/clients/show.blade.php
+++ b/app/views/clients/show.blade.php
@@ -49,6 +49,7 @@