From f574a79fe6e1feef40c54f96a7944df0593362f1 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Thu, 12 Nov 2015 22:36:28 +0200 Subject: [PATCH] Improved data export --- app/Console/Commands/SendRenewalInvoices.php | 15 +- app/Http/Controllers/AccountApiController.php | 2 +- .../Controllers/ImportExportController.php | 149 ++++ app/Http/routes.php | 36 +- app/Models/Account.php | 19 + app/Models/Client.php | 5 + app/Models/Contact.php | 5 + app/Models/Credit.php | 10 +- app/Models/Payment.php | 14 + app/Models/Task.php | 9 + app/Ninja/Presenters/ClientPresenter.php | 28 + app/Ninja/Presenters/CreditPresenter.php | 35 + app/Ninja/Presenters/InvoicePresenter.php | 53 ++ app/Ninja/Presenters/PaymentPresenter.php | 35 + app/Ninja/Presenters/TaskPresenter.php | 18 + app/Ninja/Repositories/AccountRepository.php | 8 + app/Ninja/Transformers/QuoteTransformer.php | 2 +- composer.json | 5 +- composer.lock | 340 ++++++--- config/app.php | 431 +++++------ config/excel.php | 683 ++++++++++++++++++ readme.md | 3 +- resources/lang/en/texts.php | 4 + .../views/accounts/import_export.blade.php | 30 +- resources/views/export.blade.php | 43 ++ resources/views/export/clients.blade.php | 45 ++ resources/views/export/contacts.blade.php | 25 + resources/views/export/credits.blade.php | 23 + resources/views/export/invoices.blade.php | 55 ++ resources/views/export/payments.blade.php | 27 + resources/views/export/tasks.blade.php | 23 + 31 files changed, 1851 insertions(+), 329 deletions(-) create mode 100644 app/Http/Controllers/ImportExportController.php create mode 100644 app/Ninja/Presenters/ClientPresenter.php create mode 100644 app/Ninja/Presenters/CreditPresenter.php create mode 100644 app/Ninja/Presenters/PaymentPresenter.php create mode 100644 app/Ninja/Presenters/TaskPresenter.php create mode 100644 config/excel.php create mode 100644 resources/views/export.blade.php create mode 100644 resources/views/export/clients.blade.php create mode 100644 resources/views/export/contacts.blade.php create mode 100644 resources/views/export/credits.blade.php create mode 100644 resources/views/export/invoices.blade.php create mode 100644 resources/views/export/payments.blade.php create mode 100644 resources/views/export/tasks.blade.php diff --git a/app/Console/Commands/SendRenewalInvoices.php b/app/Console/Commands/SendRenewalInvoices.php index 658784a303..1e8ea1b49e 100644 --- a/app/Console/Commands/SendRenewalInvoices.php +++ b/app/Console/Commands/SendRenewalInvoices.php @@ -28,12 +28,24 @@ class SendRenewalInvoices extends Command { $this->info(date('Y-m-d').' Running SendRenewalInvoices...'); $today = new DateTime(); + $sentTo = []; // get all accounts with pro plans expiring in 10 days - $accounts = Account::whereRaw('datediff(curdate(), pro_plan_paid) = 355')->get(); + $accounts = Account::whereRaw('datediff(curdate(), pro_plan_paid) = 355') + ->orderBy('id') + ->get(); $this->info(count($accounts).' accounts found'); foreach ($accounts as $account) { + // don't send multiple invoices to multi-company users + if ($userAccountId = $this->accountRepo->getUserAccountId($account)) { + if (isset($sentTo[$userAccountId])) { + continue; + } else { + $sentTo[$userAccountId] = true; + } + } + $client = $this->accountRepo->getNinjaClient($account); $invitation = $this->accountRepo->createNinjaInvoice($client); @@ -43,6 +55,7 @@ class SendRenewalInvoices extends Command $invoice->save(); $this->mailer->sendInvoice($invoice); + $this->info("Sent invoice to {$client->getDisplayName()}"); } $this->info('Done'); diff --git a/app/Http/Controllers/AccountApiController.php b/app/Http/Controllers/AccountApiController.php index 982a1a55f5..704ec79b3d 100644 --- a/app/Http/Controllers/AccountApiController.php +++ b/app/Http/Controllers/AccountApiController.php @@ -62,7 +62,7 @@ class AccountApiController extends BaseAPIController public function show() { $account = Auth::user()->account; - $account->load('clients.getInvoices.invoice_items', 'users'); + $account->loadAllData(); $account = $this->createItem($account, new AccountTransformer); $response = [ diff --git a/app/Http/Controllers/ImportExportController.php b/app/Http/Controllers/ImportExportController.php new file mode 100644 index 0000000000..490106ca6e --- /dev/null +++ b/app/Http/Controllers/ImportExportController.php @@ -0,0 +1,149 @@ +input('format'); + $date = date('Y-m-d'); + $fileName = "invoice-ninja-{$date}"; + + if ($format === 'JSON') { + return $this->returnJSON($request, $fileName); + } elseif ($format === 'CSV') { + return $this->returnCSV($request, $fileName); + } else { + return $this->returnXLS($request, $fileName); + } + } + + private function returnJSON($request, $fileName) + { + $output = fopen('php://output', 'w') or Utils::fatalError(); + header('Content-Type:application/json'); + header("Content-Disposition:attachment;filename={$fileName}.json"); + + $manager = new Manager(); + $manager->setSerializer(new ArraySerializer()); + + $account = Auth::user()->account; + $account->loadAllData(); + + $resource = new Item($account, new AccountTransformer); + $data = $manager->createData($resource)->toArray(); + + return response()->json($data); + } + + + private function returnCSV($request, $fileName) + { + $data = $this->getData($request); + + return Excel::create($fileName, function($excel) use ($data) { + $excel->sheet('', function($sheet) use ($data) { + $sheet->loadView('export', $data); + }); + })->download('csv'); + } + + private function returnXLS($request, $fileName) + { + $user = Auth::user(); + $data = $this->getData($request); + + return Excel::create($fileName, function($excel) use ($user, $data) { + + $excel->setTitle($data['title']) + ->setCreator($user->getDisplayName()) + ->setLastModifiedBy($user->getDisplayName()) + ->setDescription('') + ->setSubject('') + ->setKeywords('') + ->setCategory('') + ->setManager('') + ->setCompany($user->account->getDisplayName()); + + foreach ($data as $key => $val) { + if ($key === 'account' || $key === 'title' || $key === 'multiUser') { + continue; + } + $label = trans("texts.{$key}"); + $excel->sheet($label, function($sheet) use ($key, $data) { + if ($key === 'quotes') { + $key = 'invoices'; + $data['entityType'] = ENTITY_QUOTE; + } + $sheet->loadView("export.{$key}", $data); + }); + } + })->download('xls'); + } + + private function getData($request) + { + $account = Auth::user()->account; + + $data = [ + 'account' => $account, + 'title' => 'Invoice Ninja v' . NINJA_VERSION . ' - ' . $account->formatDateTime($account->getDateTime()), + 'multiUser' => $account->users->count() > 1 + ]; + + if ($request->input(ENTITY_CLIENT)) { + $data['clients'] = Client::scope() + ->with('user', 'contacts', 'country') + ->get(); + + $data['contacts'] = Contact::scope() + ->with('user', 'client.contacts') + ->get(); + + $data['credits'] = Credit::scope() + ->with('user', 'client.contacts') + ->get(); + } + + if ($request->input(ENTITY_TASK)) { + $data['tasks'] = Task::scope() + ->with('user', 'client.contacts') + ->get(); + } + + if ($request->input(ENTITY_INVOICE)) { + $data['invoices'] = Invoice::scope() + ->with('user', 'client.contacts', 'invoice_status') + ->where('is_quote', '=', false) + ->where('is_recurring', '=', false) + ->get(); + + $data['quotes'] = Invoice::scope() + ->with('user', 'client.contacts', 'invoice_status') + ->where('is_quote', '=', true) + ->where('is_recurring', '=', false) + ->get(); + } + + if ($request->input(ENTITY_PAYMENT)) { + $data['payments'] = Payment::scope() + ->with('user', 'client.contacts', 'payment_type', 'invoice', 'account_gateway.gateway') + ->get(); + } + + return $data; + } +} \ No newline at end of file diff --git a/app/Http/routes.php b/app/Http/routes.php index 89268cced4..522110b371 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -131,6 +131,7 @@ Route::group(['middleware' => 'auth'], function() { Route::post('user/setTheme', 'UserController@setTheme'); Route::post('remove_logo', 'AccountController@removeLogo'); Route::post('account/go_pro', 'AccountController@enableProPlan'); + Route::post('/export', 'ImportExportController@doExport'); Route::resource('gateways', 'AccountGatewayController'); Route::get('api/gateways', array('as'=>'api.gateways', 'uses'=>'AccountGatewayController@getDatatable')); @@ -505,29 +506,26 @@ if (!defined('CONTACT_EMAIL')) { /* // Log all SQL queries to laravel.log -Event::listen('illuminate.query', function($query, $bindings, $time, $name) -{ - $data = compact('bindings', 'time', 'name'); +if (Utils::isNinjaDev()) { + Event::listen('illuminate.query', function($query, $bindings, $time, $name) { + $data = compact('bindings', 'time', 'name'); - // Format binding data for sql insertion - foreach ($bindings as $i => $binding) - { - if ($binding instanceof \DateTime) - { - $bindings[$i] = $binding->format('\'Y-m-d H:i:s\''); + // Format binding data for sql insertion + foreach ($bindings as $i => $binding) { + if ($binding instanceof \DateTime) { + $bindings[$i] = $binding->format('\'Y-m-d H:i:s\''); + } elseif (is_string($binding)) { + $bindings[$i] = "'$binding'"; + } } - else if (is_string($binding)) - { - $bindings[$i] = "'$binding'"; - } - } - // Insert bindings into query - $query = str_replace(array('%', '?'), array('%%', '%s'), $query); - $query = vsprintf($query, $bindings); + // Insert bindings into query + $query = str_replace(array('%', '?'), array('%%', '%s'), $query); + $query = vsprintf($query, $bindings); - Log::info($query, $data); -}); + Log::info($query, $data); + }); +} */ /* diff --git a/app/Models/Account.php b/app/Models/Account.php index 46ef59d71f..958f395ab7 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -202,6 +202,20 @@ class Account extends Eloquent return $date->format($this->getCustomDateFormat()); } + public function formatDateTime($date) + { + if (!$date) { + return null; + } + + return $date->format($this->getCustomDateTimeFormat()); + } + + public function getCustomDateTimeFormat() + { + return $this->datetime_format ? $this->datetime_format->format : DEFAULT_DATETIME_FORMAT; + } + public function getGatewayByType($type = PAYMENT_TYPE_ANY) { foreach ($this->account_gateways as $gateway) { @@ -423,6 +437,11 @@ class Account extends Eloquent $this->save(); } + public function loadAllData() + { + $this->load('clients.getInvoices.invoice_items', 'clients.getQuotes.invoice_items', 'users', 'clients.contacts'); + } + public function loadLocalizationSettings($client = false) { $this->load('timezone', 'date_format', 'datetime_format', 'language'); diff --git a/app/Models/Client.php b/app/Models/Client.php index 9552b62609..389fad2505 100644 --- a/app/Models/Client.php +++ b/app/Models/Client.php @@ -5,11 +5,16 @@ use DB; use Carbon; use App\Events\ClientWasCreated; use App\Events\ClientWasUpdated; +use Laracasts\Presenter\PresentableTrait; use Illuminate\Database\Eloquent\SoftDeletes; class Client extends EntityModel { + use PresentableTrait; use SoftDeletes; + + protected $presenter = 'App\Ninja\Presenters\ClientPresenter'; + protected $dates = ['deleted_at']; protected $fillable = [ diff --git a/app/Models/Contact.php b/app/Models/Contact.php index cc5f6d2796..90203d522e 100644 --- a/app/Models/Contact.php +++ b/app/Models/Contact.php @@ -27,6 +27,11 @@ class Contact extends EntityModel return $this->belongsTo('App\Models\Account'); } + public function user() + { + return $this->belongsTo('App\Models\User'); + } + public function client() { return $this->belongsTo('App\Models\Client'); diff --git a/app/Models/Credit.php b/app/Models/Credit.php index a89e9e9252..c46095e80e 100644 --- a/app/Models/Credit.php +++ b/app/Models/Credit.php @@ -2,18 +2,26 @@ use Illuminate\Database\Eloquent\SoftDeletes; use App\Events\CreditWasCreated; - +use Laracasts\Presenter\PresentableTrait; class Credit extends EntityModel { use SoftDeletes; + use PresentableTrait; + protected $dates = ['deleted_at']; + protected $presenter = 'App\Ninja\Presenters\CreditPresenter'; public function account() { return $this->belongsTo('App\Models\Account'); } + public function user() + { + return $this->belongsTo('App\Models\User'); + } + public function invoice() { return $this->belongsTo('App\Models\Invoice')->withTrashed(); diff --git a/app/Models/Payment.php b/app/Models/Payment.php index d0a1ae466b..76b8738b51 100644 --- a/app/Models/Payment.php +++ b/app/Models/Payment.php @@ -2,11 +2,15 @@ use Illuminate\Database\Eloquent\SoftDeletes; use App\Events\PaymentWasCreated; +use Laracasts\Presenter\PresentableTrait; class Payment extends EntityModel { + use PresentableTrait; use SoftDeletes; + protected $dates = ['deleted_at']; + protected $presenter = 'App\Ninja\Presenters\PaymentPresenter'; public function invoice() { @@ -38,6 +42,16 @@ class Payment extends EntityModel return $this->belongsTo('App\Models\Contact'); } + public function account_gateway() + { + return $this->belongsTo('App\Models\AccountGateway'); + } + + public function payment_type() + { + return $this->belongsTo('App\Models\PaymentType'); + } + public function getRoute() { return "/payments/{$this->public_id}/edit"; diff --git a/app/Models/Task.php b/app/Models/Task.php index fbdd00c46f..17b667558c 100644 --- a/app/Models/Task.php +++ b/app/Models/Task.php @@ -3,10 +3,14 @@ use DB; use Utils; use Illuminate\Database\Eloquent\SoftDeletes; +use Laracasts\Presenter\PresentableTrait; class Task extends EntityModel { use SoftDeletes; + use PresentableTrait; + + protected $presenter = 'App\Ninja\Presenters\TaskPresenter'; public function account() { @@ -18,6 +22,11 @@ class Task extends EntityModel return $this->belongsTo('App\Models\Invoice'); } + public function user() + { + return $this->belongsTo('App\Models\User'); + } + public function client() { return $this->belongsTo('App\Models\Client')->withTrashed(); diff --git a/app/Ninja/Presenters/ClientPresenter.php b/app/Ninja/Presenters/ClientPresenter.php new file mode 100644 index 0000000000..b1dfdaf915 --- /dev/null +++ b/app/Ninja/Presenters/ClientPresenter.php @@ -0,0 +1,28 @@ +entity->balance; + $currencyId = $this->entity->currency_id; + + return Utils::formatMoney($amount, $currencyId); + } + + public function paid_to_date() + { + $amount = $this->entity->paid_to_date; + $currencyId = $this->entity->currency_id; + + return Utils::formatMoney($amount, $currencyId); + } + + public function country() + { + return $this->entity->country ? $this->entity->country->name : ''; + } +} \ No newline at end of file diff --git a/app/Ninja/Presenters/CreditPresenter.php b/app/Ninja/Presenters/CreditPresenter.php new file mode 100644 index 0000000000..3c58bf9246 --- /dev/null +++ b/app/Ninja/Presenters/CreditPresenter.php @@ -0,0 +1,35 @@ +entity->client ? $this->entity->client->getDisplayName() : ''; + } + + public function credit_date() + { + return Utils::fromSqlDate($this->entity->credit_date); + } + + public function amount() + { + $amount = $this->entity->amount; + $currencyId = $this->entity->client->currency_id; + + return Utils::formatMoney($amount, $currencyId); + } + + public function balance() + { + $amount = $this->entity->balance; + $currencyId = $this->entity->client->currency_id; + + return Utils::formatMoney($amount, $currencyId); + } + + +} \ No newline at end of file diff --git a/app/Ninja/Presenters/InvoicePresenter.php b/app/Ninja/Presenters/InvoicePresenter.php index 5f3cd32270..dff59c241b 100644 --- a/app/Ninja/Presenters/InvoicePresenter.php +++ b/app/Ninja/Presenters/InvoicePresenter.php @@ -5,6 +5,16 @@ use Laracasts\Presenter\Presenter; class InvoicePresenter extends Presenter { + public function client() + { + return $this->entity->client ? $this->entity->client->getDisplayName() : ''; + } + + public function user() + { + return $this->entity->user->getDisplayName(); + } + public function balance_due() { $amount = $this->entity->getRequestedAmount(); @@ -13,4 +23,47 @@ class InvoicePresenter extends Presenter { return Utils::formatMoney($amount, $currencyId); } + public function status() + { + $status = $this->entity->invoice_status ? $this->entity->invoice_status->name : 'draft'; + $status = strtolower($status); + return trans("texts.status_{$status}"); + } + + public function balance() + { + $amount = $this->entity->balance; + $currencyId = $this->entity->client->currency_id; + + return Utils::formatMoney($amount, $currencyId); + } + + public function amount() + { + $amount = $this->entity->amount; + $currencyId = $this->entity->client->currency_id; + + return Utils::formatMoney($amount, $currencyId); + } + + public function discount() + { + if ($this->entity->is_amount_discount) { + $currencyId = $this->entity->client->currency_id; + return Utils::formatMoney($this->entity->discount, $currencyId); + } else { + return $this->entity->discount . '%'; + } + } + + public function invoice_date() + { + return Utils::fromSqlDate($this->entity->invoice_date); + } + + public function due_date() + { + return Utils::fromSqlDate($this->entity->due_date); + } + } \ No newline at end of file diff --git a/app/Ninja/Presenters/PaymentPresenter.php b/app/Ninja/Presenters/PaymentPresenter.php new file mode 100644 index 0000000000..e30e329c14 --- /dev/null +++ b/app/Ninja/Presenters/PaymentPresenter.php @@ -0,0 +1,35 @@ +entity->client ? $this->entity->client->getDisplayName() : ''; + } + + public function payment_date() + { + return Utils::fromSqlDate($this->entity->payment_date); + } + + public function amount() + { + $amount = $this->entity->amount; + $currencyId = $this->entity->client->currency_id; + + return Utils::formatMoney($amount, $currencyId); + } + + public function method() + { + if ($this->entity->account_gateway) { + return $this->entity->account_gateway->gateway->name; + } elseif ($this->entity->payment_type) { + return $this->entity->payment_type->name; + } + } + +} \ No newline at end of file diff --git a/app/Ninja/Presenters/TaskPresenter.php b/app/Ninja/Presenters/TaskPresenter.php new file mode 100644 index 0000000000..53dcaf3f2e --- /dev/null +++ b/app/Ninja/Presenters/TaskPresenter.php @@ -0,0 +1,18 @@ +entity->client ? $this->entity->client->getDisplayName() : ''; + } + + public function user() + { + return $this->entity->user->getDisplayName(); + } + +} \ No newline at end of file diff --git a/app/Ninja/Repositories/AccountRepository.php b/app/Ninja/Repositories/AccountRepository.php index 49c5eacc95..4448ea2087 100644 --- a/app/Ninja/Repositories/AccountRepository.php +++ b/app/Ninja/Repositories/AccountRepository.php @@ -508,4 +508,12 @@ class AccountRepository $token->save(); } } + + public function getUserAccountId($account) + { + $user = $account->users()->first(); + $userAccount = $this->findUserAccounts($user->id); + + return $userAccount ? $userAccount->id : false; + } } diff --git a/app/Ninja/Transformers/QuoteTransformer.php b/app/Ninja/Transformers/QuoteTransformer.php index dbb2f669fe..6cbab0b3ca 100644 --- a/app/Ninja/Transformers/QuoteTransformer.php +++ b/app/Ninja/Transformers/QuoteTransformer.php @@ -11,7 +11,7 @@ class QuoteTransformer extends EntityTransformer public function includeInvoiceItems($invoice) { - return $this->collection($invoice->invoice_items, new InvoiceItemTransformer); + return $this->collection($invoice->invoice_items, new InvoiceItemTransformer($this->account)); } public function transform(Invoice $invoice) diff --git a/composer.json b/composer.json index 476b304de7..85579d8c9b 100644 --- a/composer.json +++ b/composer.json @@ -36,7 +36,7 @@ "omnipay/bitpay": "dev-master", "guzzlehttp/guzzle": "~5.0", "laravelcollective/html": "~5.0", - "wildbit/laravel-postmark-provider": "dev-master", + "wildbit/laravel-postmark-provider": "1.0", "Dwolla/omnipay-dwolla": "dev-master", "laravel/socialite": "~2.0", "simshaun/recurr": "dev-master", @@ -60,7 +60,8 @@ "labs7in0/omnipay-wechat": "dev-master", "collizo4sky/omnipay-wepay": "~1.0", "laracasts/presenter": "dev-master", - "jlapp/swaggervel": "master-dev" + "jlapp/swaggervel": "master-dev", + "maatwebsite/excel": "~2.0" }, "require-dev": { "phpunit/phpunit": "~4.0", diff --git a/composer.lock b/composer.lock index 28684ccaf3..e532d0739d 100644 --- a/composer.lock +++ b/composer.lock @@ -1,11 +1,10 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "fb15622e77287d516219e55ebb01ea3e", - "content-hash": "25cba035ae6f43a8c06493812b4e4d4d", + "hash": "b6c2660a613f4e94f13f226ec19c66eb", "packages": [ { "name": "agmscode/omnipay-agms", @@ -506,7 +505,7 @@ }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Chumper/Datatable/zipball/b44834db3d4e560d4368c1a04248b9e6a422ccff", + "url": "https://api.github.com/repos/Chumper/Datatable/zipball/7fa47cb5469f07c620fb69dee94b8e1a96943ee2", "reference": "7fa47cb", "shasum": "" }, @@ -518,7 +517,7 @@ }, "require-dev": { "mockery/mockery": "dev-master", - "orchestra/testbench": "3.1.*", + "orchestra/testbench": "2.1.*", "phpunit/phpunit": "3.7.*" }, "type": "library", @@ -547,7 +546,7 @@ "jquery", "laravel" ], - "time": "2015-10-26 01:21:31" + "time": "2015-04-20 09:21:21" }, { "name": "classpreloader/classpreloader", @@ -3243,6 +3242,73 @@ ], "time": "2015-10-07 09:33:48" }, + { + "name": "maatwebsite/excel", + "version": "v2.0.10", + "source": { + "type": "git", + "url": "https://github.com/Maatwebsite/Laravel-Excel.git", + "reference": "be63dcef4394a4bbeaf524e7fe89340b7dab6b7a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Maatwebsite/Laravel-Excel/zipball/be63dcef4394a4bbeaf524e7fe89340b7dab6b7a", + "reference": "be63dcef4394a4bbeaf524e7fe89340b7dab6b7a", + "shasum": "" + }, + "require": { + "illuminate/cache": "5.0.*|5.1.*", + "illuminate/config": "5.0.*|5.1.*", + "illuminate/filesystem": "5.0.*|5.1.*", + "illuminate/support": "5.0.*|5.1.*", + "nesbot/carbon": "~1.0", + "php": ">=5.4", + "phpoffice/phpexcel": "1.8.*", + "tijsverkoyen/css-to-inline-styles": "~1.5" + }, + "require-dev": { + "mockery/mockery": "~0.9", + "orchestra/testbench": "3.0.*", + "phpseclib/phpseclib": "~1.0", + "phpunit/phpunit": "~4.0" + }, + "suggest": { + "illuminate/http": "5.0.*|5.1.*", + "illuminate/routing": "5.0.*|5.1.*", + "illuminate/view": "5.0.*|5.1.*" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/Maatwebsite/Excel", + "tests/TestCase.php" + ], + "psr-0": { + "Maatwebsite\\Excel\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL" + ], + "authors": [ + { + "name": "Maatwebsite.nl", + "email": "patrick@maatwebsite.nl" + } + ], + "description": "An eloquent way of importing and exporting Excel and CSV in Laravel 4 with the power of PHPExcel", + "keywords": [ + "PHPExcel", + "batch", + "csv", + "excel", + "export", + "import", + "laravel" + ], + "time": "2015-10-26 11:52:19" + }, { "name": "maximebf/debugbar", "version": "v1.10.5", @@ -5520,6 +5586,63 @@ ], "time": "2015-02-03 12:10:50" }, + { + "name": "phpoffice/phpexcel", + "version": "1.8.1", + "source": { + "type": "git", + "url": "https://github.com/PHPOffice/PHPExcel.git", + "reference": "372c7cbb695a6f6f1e62649381aeaa37e7e70b32" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPOffice/PHPExcel/zipball/372c7cbb695a6f6f1e62649381aeaa37e7e70b32", + "reference": "372c7cbb695a6f6f1e62649381aeaa37e7e70b32", + "shasum": "" + }, + "require": { + "ext-xml": "*", + "ext-xmlwriter": "*", + "php": ">=5.2.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "PHPExcel": "Classes/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL" + ], + "authors": [ + { + "name": "Maarten Balliauw", + "homepage": "http://blog.maartenballiauw.be" + }, + { + "name": "Mark Baker" + }, + { + "name": "Franck Lefevre", + "homepage": "http://blog.rootslabs.net" + }, + { + "name": "Erik Tilt" + } + ], + "description": "PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine", + "homepage": "http://phpexcel.codeplex.com", + "keywords": [ + "OpenXML", + "excel", + "php", + "spreadsheet", + "xls", + "xlsx" + ], + "time": "2015-05-01 07:00:55" + }, { "name": "psr/http-message", "version": "1.0", @@ -5998,12 +6121,12 @@ "target-dir": "Symfony/Component/Console", "source": { "type": "git", - "url": "https://github.com/symfony/console.git", + "url": "https://github.com/symfony/Console.git", "reference": "0e5e18ae09d3f5c06367759be940e9ed3f568359" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/0e5e18ae09d3f5c06367759be940e9ed3f568359", + "url": "https://api.github.com/repos/symfony/Console/zipball/0e5e18ae09d3f5c06367759be940e9ed3f568359", "reference": "0e5e18ae09d3f5c06367759be940e9ed3f568359", "shasum": "" }, @@ -6050,18 +6173,68 @@ "homepage": "https://symfony.com", "time": "2015-07-26 09:08:40" }, + { + "name": "symfony/css-selector", + "version": "v2.7.6", + "source": { + "type": "git", + "url": "https://github.com/symfony/css-selector.git", + "reference": "e1b865b26be4a56d22a8dee398375044a80c865b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/e1b865b26be4a56d22a8dee398375044a80c865b", + "reference": "e1b865b26be4a56d22a8dee398375044a80c865b", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\CssSelector\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jean-François Simon", + "email": "jeanfrancois.simon@sensiolabs.com" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony CssSelector Component", + "homepage": "https://symfony.com", + "time": "2015-10-11 09:39:48" + }, { "name": "symfony/debug", "version": "v2.6.11", "target-dir": "Symfony/Component/Debug", "source": { "type": "git", - "url": "https://github.com/symfony/debug.git", + "url": "https://github.com/symfony/Debug.git", "reference": "fca5696e0c9787722baa8f2ad6940dfd7a6a6941" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/fca5696e0c9787722baa8f2ad6940dfd7a6a6941", + "url": "https://api.github.com/repos/symfony/Debug/zipball/fca5696e0c9787722baa8f2ad6940dfd7a6a6941", "reference": "fca5696e0c9787722baa8f2ad6940dfd7a6a6941", "shasum": "" }, @@ -6270,12 +6443,12 @@ "target-dir": "Symfony/Component/HttpFoundation", "source": { "type": "git", - "url": "https://github.com/symfony/http-foundation.git", + "url": "https://github.com/symfony/HttpFoundation.git", "reference": "e8fd1b73ac1c3de1f76c73801ddf1a8ecb1c1c9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/e8fd1b73ac1c3de1f76c73801ddf1a8ecb1c1c9c", + "url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/e8fd1b73ac1c3de1f76c73801ddf1a8ecb1c1c9c", "reference": "e8fd1b73ac1c3de1f76c73801ddf1a8ecb1c1c9c", "shasum": "" }, @@ -6324,12 +6497,12 @@ "target-dir": "Symfony/Component/HttpKernel", "source": { "type": "git", - "url": "https://github.com/symfony/http-kernel.git", + "url": "https://github.com/symfony/HttpKernel.git", "reference": "a3f0ed713255c0400a2db38b3ed01989ef4b7322" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/a3f0ed713255c0400a2db38b3ed01989ef4b7322", + "url": "https://api.github.com/repos/symfony/HttpKernel/zipball/a3f0ed713255c0400a2db38b3ed01989ef4b7322", "reference": "a3f0ed713255c0400a2db38b3ed01989ef4b7322", "shasum": "" }, @@ -6698,6 +6871,53 @@ ], "time": "2015-07-01 10:03:42" }, + { + "name": "tijsverkoyen/css-to-inline-styles", + "version": "1.5.4", + "source": { + "type": "git", + "url": "https://github.com/tijsverkoyen/CssToInlineStyles.git", + "reference": "3065b197f54c83392a4e0ba355678a5080dd9ee2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/3065b197f54c83392a4e0ba355678a5080dd9ee2", + "reference": "3065b197f54c83392a4e0ba355678a5080dd9ee2", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "symfony/css-selector": "~2.1" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5.x-dev" + } + }, + "autoload": { + "psr-4": { + "TijsVerkoyen\\CssToInlineStyles\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD" + ], + "authors": [ + { + "name": "Tijs Verkoyen", + "email": "css_to_inline_styles@verkoyen.eu", + "role": "Developer" + } + ], + "description": "CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.", + "homepage": "https://github.com/tijsverkoyen/CssToInlineStyles", + "time": "2015-04-01 14:40:03" + }, { "name": "true/punycode", "version": "v2.0.1", @@ -6943,16 +7163,16 @@ }, { "name": "wildbit/laravel-postmark-provider", - "version": "dev-master", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/wildbit/laravel-postmark-provider.git", - "reference": "3cab780369d206e1c7eaae3f576ca7f0c4f5edc6" + "reference": "f5ca5ef198320ae6eb36b8556d75152eddecd9ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wildbit/laravel-postmark-provider/zipball/3cab780369d206e1c7eaae3f576ca7f0c4f5edc6", - "reference": "3cab780369d206e1c7eaae3f576ca7f0c4f5edc6", + "url": "https://api.github.com/repos/wildbit/laravel-postmark-provider/zipball/f5ca5ef198320ae6eb36b8556d75152eddecd9ed", + "reference": "f5ca5ef198320ae6eb36b8556d75152eddecd9ed", "shasum": "" }, "require": { @@ -6969,8 +7189,7 @@ "license": [ "MIT" ], - "description": "An officially supported mail provider to send mail from Laravel through Postmark, see instructions for integrating it here: https://github.com/wildbit/laravel-postmark-provider/blob/master/README.md", - "time": "2015-03-19 13:32:47" + "time": "2015-03-19 13:19:51" }, { "name": "wildbit/swiftmailer-postmark", @@ -7121,16 +7340,16 @@ }, { "name": "codeception/codeception", - "version": "2.1.3", + "version": "2.1.4", "source": { "type": "git", "url": "https://github.com/Codeception/Codeception.git", - "reference": "cd810cb78a869408602e17271f9b7368b09a7ca8" + "reference": "6a812e8a0d1b1db939a29b4dc14cb398b21b6112" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Codeception/Codeception/zipball/cd810cb78a869408602e17271f9b7368b09a7ca8", - "reference": "cd810cb78a869408602e17271f9b7368b09a7ca8", + "url": "https://api.github.com/repos/Codeception/Codeception/zipball/6a812e8a0d1b1db939a29b4dc14cb398b21b6112", + "reference": "6a812e8a0d1b1db939a29b4dc14cb398b21b6112", "shasum": "" }, "require": { @@ -7197,7 +7416,7 @@ "functional testing", "unit testing" ], - "time": "2015-10-02 09:38:59" + "time": "2015-11-12 03:57:06" }, { "name": "doctrine/instantiator", @@ -7255,16 +7474,16 @@ }, { "name": "facebook/webdriver", - "version": "1.0.3", + "version": "1.0.4", "source": { "type": "git", "url": "https://github.com/facebook/php-webdriver.git", - "reference": "d843e33fd19b49db5ac9daaef2610079daab0bad" + "reference": "a6e209a309bf7cd71acf15476f40b11a25d5a79d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/facebook/php-webdriver/zipball/d843e33fd19b49db5ac9daaef2610079daab0bad", - "reference": "d843e33fd19b49db5ac9daaef2610079daab0bad", + "url": "https://api.github.com/repos/facebook/php-webdriver/zipball/a6e209a309bf7cd71acf15476f40b11a25d5a79d", + "reference": "a6e209a309bf7cd71acf15476f40b11a25d5a79d", "shasum": "" }, "require": { @@ -7294,7 +7513,7 @@ "selenium", "webdriver" ], - "time": "2015-11-01 20:09:34" + "time": "2015-11-03 22:17:22" }, { "name": "fzaninotto/faker", @@ -7761,16 +7980,16 @@ }, { "name": "phpunit/phpunit", - "version": "4.8.16", + "version": "4.8.18", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "625f8c345606ed0f3a141dfb88f4116f0e22978e" + "reference": "fa33d4ad96481b91df343d83e8c8aabed6b1dfd3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/625f8c345606ed0f3a141dfb88f4116f0e22978e", - "reference": "625f8c345606ed0f3a141dfb88f4116f0e22978e", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fa33d4ad96481b91df343d83e8c8aabed6b1dfd3", + "reference": "fa33d4ad96481b91df343d83e8c8aabed6b1dfd3", "shasum": "" }, "require": { @@ -7829,7 +8048,7 @@ "testing", "xunit" ], - "time": "2015-10-23 06:48:33" + "time": "2015-11-11 11:32:49" }, { "name": "phpunit/phpunit-mock-objects", @@ -8312,56 +8531,6 @@ "homepage": "https://symfony.com", "time": "2015-10-23 14:47:27" }, - { - "name": "symfony/css-selector", - "version": "v2.7.6", - "source": { - "type": "git", - "url": "https://github.com/symfony/css-selector.git", - "reference": "e1b865b26be4a56d22a8dee398375044a80c865b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/e1b865b26be4a56d22a8dee398375044a80c865b", - "reference": "e1b865b26be4a56d22a8dee398375044a80c865b", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\CssSelector\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jean-François Simon", - "email": "jeanfrancois.simon@sensiolabs.com" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony CssSelector Component", - "homepage": "https://symfony.com", - "time": "2015-10-11 09:39:48" - }, { "name": "symfony/dom-crawler", "version": "v2.7.6", @@ -8472,7 +8641,6 @@ "alfaproject/omnipay-neteller": 20, "alfaproject/omnipay-skrill": 20, "omnipay/bitpay": 20, - "wildbit/laravel-postmark-provider": 20, "dwolla/omnipay-dwolla": 20, "simshaun/recurr": 20, "meebio/omnipay-creditcall": 20, diff --git a/config/app.php b/config/app.php index 4aa26f9194..a7e071e628 100644 --- a/config/app.php +++ b/config/app.php @@ -4,248 +4,249 @@ use App\Libraries\Utils; return [ - /* - |-------------------------------------------------------------------------- - | Application Debug Mode - |-------------------------------------------------------------------------- - | - | When your application is in debug mode, detailed error messages with - | stack traces will be shown on every error that occurs within your - | application. If disabled, a simple generic error page is shown. - | - */ + /* + |-------------------------------------------------------------------------- + | Application Debug Mode + |-------------------------------------------------------------------------- + | + | When your application is in debug mode, detailed error messages with + | stack traces will be shown on every error that occurs within your + | application. If disabled, a simple generic error page is shown. + | + */ - 'debug' => env('APP_DEBUG', ''), + 'debug' => env('APP_DEBUG', ''), - /* - |-------------------------------------------------------------------------- - | Application URL - |-------------------------------------------------------------------------- - | - | This URL is used by the console to properly generate URLs when using - | the Artisan command line tool. You should set this to the root of - | your application so that it is used when running Artisan tasks. - | - */ + /* + |-------------------------------------------------------------------------- + | Application URL + |-------------------------------------------------------------------------- + | + | This URL is used by the console to properly generate URLs when using + | the Artisan command line tool. You should set this to the root of + | your application so that it is used when running Artisan tasks. + | + */ - 'url' => env('APP_URL', ''), + 'url' => env('APP_URL', ''), - /* - |-------------------------------------------------------------------------- - | Application Timezone - |-------------------------------------------------------------------------- - | - | Here you may specify the default timezone for your application, which - | will be used by the PHP date and date-time functions. We have gone - | ahead and set this to a sensible default for you out of the box. - | - */ + /* + |-------------------------------------------------------------------------- + | Application Timezone + |-------------------------------------------------------------------------- + | + | Here you may specify the default timezone for your application, which + | will be used by the PHP date and date-time functions. We have gone + | ahead and set this to a sensible default for you out of the box. + | + */ - 'timezone' => env('APP_TIMEZONE', 'UTC'), + 'timezone' => env('APP_TIMEZONE', 'UTC'), - /* - |-------------------------------------------------------------------------- - | Application Locale Configuration - |-------------------------------------------------------------------------- - | - | The application locale determines the default locale that will be used - | by the translation service provider. You are free to set this value - | to any of the locales which will be supported by the application. - | - */ + /* + |-------------------------------------------------------------------------- + | Application Locale Configuration + |-------------------------------------------------------------------------- + | + | The application locale determines the default locale that will be used + | by the translation service provider. You are free to set this value + | to any of the locales which will be supported by the application. + | + */ - 'locale' => env('APP_LOCALE', 'en'), + 'locale' => env('APP_LOCALE', 'en'), - /* - |-------------------------------------------------------------------------- - | Application Fallback Locale - |-------------------------------------------------------------------------- - | - | The fallback locale determines the locale to use when the current one - | is not available. You may change the value to correspond to any of - | the language folders that are provided through your application. - | - */ + /* + |-------------------------------------------------------------------------- + | Application Fallback Locale + |-------------------------------------------------------------------------- + | + | The fallback locale determines the locale to use when the current one + | is not available. You may change the value to correspond to any of + | the language folders that are provided through your application. + | + */ - 'fallback_locale' => 'en', + 'fallback_locale' => 'en', - /* - |-------------------------------------------------------------------------- - | Encryption Key - |-------------------------------------------------------------------------- - | - | This key is used by the Illuminate encrypter service and should be set - | to a random, 32 character string, otherwise these encrypted strings - | will not be safe. Please do this before deploying an application! - | - */ + /* + |-------------------------------------------------------------------------- + | Encryption Key + |-------------------------------------------------------------------------- + | + | This key is used by the Illuminate encrypter service and should be set + | to a random, 32 character string, otherwise these encrypted strings + | will not be safe. Please do this before deploying an application! + | + */ - 'key' => env('APP_KEY', ''), + 'key' => env('APP_KEY', ''), - 'cipher' => env('APP_CIPHER', MCRYPT_RIJNDAEL_128), + 'cipher' => env('APP_CIPHER', MCRYPT_RIJNDAEL_128), - /* - |-------------------------------------------------------------------------- - | Logging Configuration - |-------------------------------------------------------------------------- - | - | Here you may configure the log settings for your application. Out of - | the box, Laravel uses the Monolog PHP logging library. This gives - | you a variety of powerful log handlers / formatters to utilize. - | - | Available Settings: "single", "daily", "syslog", "errorlog" - | - */ + /* + |-------------------------------------------------------------------------- + | Logging Configuration + |-------------------------------------------------------------------------- + | + | Here you may configure the log settings for your application. Out of + | the box, Laravel uses the Monolog PHP logging library. This gives + | you a variety of powerful log handlers / formatters to utilize. + | + | Available Settings: "single", "daily", "syslog", "errorlog" + | + */ - 'log' => env('LOG', 'single'), + 'log' => env('LOG', 'single'), - /* - |-------------------------------------------------------------------------- - | Autoloaded Service Providers - |-------------------------------------------------------------------------- - | - | The service providers listed here will be automatically loaded on the - | request to your application. Feel free to add your own services to - | this array to grant expanded functionality to your applications. - | - */ + /* + |-------------------------------------------------------------------------- + | Autoloaded Service Providers + |-------------------------------------------------------------------------- + | + | The service providers listed here will be automatically loaded on the + | request to your application. Feel free to add your own services to + | this array to grant expanded functionality to your applications. + | + */ - 'providers' => [ + 'providers' => [ - /* - * Laravel Framework Service Providers... - */ - 'Illuminate\Foundation\Providers\ArtisanServiceProvider', - 'Illuminate\Auth\AuthServiceProvider', - 'Illuminate\Bus\BusServiceProvider', - 'Illuminate\Cache\CacheServiceProvider', - 'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider', - 'Illuminate\Routing\ControllerServiceProvider', - 'Illuminate\Cookie\CookieServiceProvider', - 'Illuminate\Database\DatabaseServiceProvider', - 'Illuminate\Encryption\EncryptionServiceProvider', - 'Illuminate\Filesystem\FilesystemServiceProvider', - 'Illuminate\Foundation\Providers\FoundationServiceProvider', - 'Illuminate\Hashing\HashServiceProvider', - (isset($_ENV['POSTMARK_API_TOKEN']) ? 'Postmark\Adapters\LaravelMailProvider' : 'Illuminate\Mail\MailServiceProvider'), + /* + * Laravel Framework Service Providers... + */ + 'Illuminate\Foundation\Providers\ArtisanServiceProvider', + 'Illuminate\Auth\AuthServiceProvider', + 'Illuminate\Bus\BusServiceProvider', + 'Illuminate\Cache\CacheServiceProvider', + 'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider', + 'Illuminate\Routing\ControllerServiceProvider', + 'Illuminate\Cookie\CookieServiceProvider', + 'Illuminate\Database\DatabaseServiceProvider', + 'Illuminate\Encryption\EncryptionServiceProvider', + 'Illuminate\Filesystem\FilesystemServiceProvider', + 'Illuminate\Foundation\Providers\FoundationServiceProvider', + 'Illuminate\Hashing\HashServiceProvider', + (isset($_ENV['POSTMARK_API_TOKEN']) ? 'Postmark\Adapters\LaravelMailProvider' : 'Illuminate\Mail\MailServiceProvider'), 'Illuminate\Pagination\PaginationServiceProvider', - 'Illuminate\Pipeline\PipelineServiceProvider', - 'Illuminate\Queue\QueueServiceProvider', - 'Illuminate\Redis\RedisServiceProvider', - 'Illuminate\Auth\Passwords\PasswordResetServiceProvider', - 'Illuminate\Session\SessionServiceProvider', - 'Illuminate\Translation\TranslationServiceProvider', - 'Illuminate\Validation\ValidationServiceProvider', - 'Illuminate\View\ViewServiceProvider', + 'Illuminate\Pipeline\PipelineServiceProvider', + 'Illuminate\Queue\QueueServiceProvider', + 'Illuminate\Redis\RedisServiceProvider', + 'Illuminate\Auth\Passwords\PasswordResetServiceProvider', + 'Illuminate\Session\SessionServiceProvider', + 'Illuminate\Translation\TranslationServiceProvider', + 'Illuminate\Validation\ValidationServiceProvider', + 'Illuminate\View\ViewServiceProvider', - /* - * Additional Providers - */ - 'Bootstrapper\BootstrapperL5ServiceProvider', - 'Former\FormerServiceProvider', - 'Barryvdh\Debugbar\ServiceProvider', - 'Chumper\Datatable\DatatableServiceProvider', - 'Intervention\Image\ImageServiceProvider', - 'Webpatser\Countries\CountriesServiceProvider', - 'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider', - 'Illuminate\Html\HtmlServiceProvider', + /* + * Additional Providers + */ + 'Bootstrapper\BootstrapperL5ServiceProvider', + 'Former\FormerServiceProvider', + 'Barryvdh\Debugbar\ServiceProvider', + 'Chumper\Datatable\DatatableServiceProvider', + 'Intervention\Image\ImageServiceProvider', + 'Webpatser\Countries\CountriesServiceProvider', + 'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider', + 'Illuminate\Html\HtmlServiceProvider', 'Laravel\Socialite\SocialiteServiceProvider', 'Jlapp\Swaggervel\SwaggervelServiceProvider', + 'Maatwebsite\Excel\ExcelServiceProvider', - /* - * Application Service Providers... - */ - 'App\Providers\AppServiceProvider', - 'App\Providers\BusServiceProvider', - 'App\Providers\ConfigServiceProvider', - 'App\Providers\EventServiceProvider', - 'App\Providers\RouteServiceProvider', - ], + /* + * Application Service Providers... + */ + 'App\Providers\AppServiceProvider', + 'App\Providers\BusServiceProvider', + 'App\Providers\ConfigServiceProvider', + 'App\Providers\EventServiceProvider', + 'App\Providers\RouteServiceProvider', + ], - /* - |-------------------------------------------------------------------------- - | Class Aliases - |-------------------------------------------------------------------------- - | - | This array of class aliases will be registered when this application - | is started. However, feel free to register as many as you wish as - | the aliases are "lazy" loaded so they don't hinder performance. - | - */ + /* + |-------------------------------------------------------------------------- + | Class Aliases + |-------------------------------------------------------------------------- + | + | This array of class aliases will be registered when this application + | is started. However, feel free to register as many as you wish as + | the aliases are "lazy" loaded so they don't hinder performance. + | + */ - 'aliases' => [ + 'aliases' => [ - 'App' => 'Illuminate\Support\Facades\App', - 'Artisan' => 'Illuminate\Support\Facades\Artisan', - 'Auth' => 'Illuminate\Support\Facades\Auth', - 'Blade' => 'Illuminate\Support\Facades\Blade', - 'Cache' => 'Illuminate\Support\Facades\Cache', - 'ClassLoader' => 'Illuminate\Support\ClassLoader', - 'Config' => 'Illuminate\Support\Facades\Config', - 'Controller' => 'Illuminate\Routing\Controller', - 'Cookie' => 'Illuminate\Support\Facades\Cookie', - 'Crypt' => 'Illuminate\Support\Facades\Crypt', - 'DB' => 'Illuminate\Support\Facades\DB', - 'Eloquent' => 'Illuminate\Database\Eloquent\Model', - 'Event' => 'Illuminate\Support\Facades\Event', - 'File' => 'Illuminate\Support\Facades\File', - 'Hash' => 'Illuminate\Support\Facades\Hash', - 'Input' => 'Illuminate\Support\Facades\Input', - 'Lang' => 'Illuminate\Support\Facades\Lang', - 'Log' => 'Illuminate\Support\Facades\Log', - 'Mail' => 'Illuminate\Support\Facades\Mail', - 'Password' => 'Illuminate\Support\Facades\Password', - 'Queue' => 'Illuminate\Support\Facades\Queue', - 'Redirect' => 'Illuminate\Support\Facades\Redirect', - 'Redis' => 'Illuminate\Support\Facades\Redis', - 'Request' => 'Illuminate\Support\Facades\Request', - 'Response' => 'Illuminate\Support\Facades\Response', - 'Route' => 'Illuminate\Support\Facades\Route', - 'Schema' => 'Illuminate\Support\Facades\Schema', - 'Seeder' => 'Illuminate\Database\Seeder', - 'Session' => 'Illuminate\Support\Facades\Session', - 'Str' => 'Illuminate\Support\Str', - 'URL' => 'Illuminate\Support\Facades\URL', - 'Validator' => 'Illuminate\Support\Facades\Validator', - 'View' => 'Illuminate\Support\Facades\View', + 'App' => 'Illuminate\Support\Facades\App', + 'Artisan' => 'Illuminate\Support\Facades\Artisan', + 'Auth' => 'Illuminate\Support\Facades\Auth', + 'Blade' => 'Illuminate\Support\Facades\Blade', + 'Cache' => 'Illuminate\Support\Facades\Cache', + 'ClassLoader' => 'Illuminate\Support\ClassLoader', + 'Config' => 'Illuminate\Support\Facades\Config', + 'Controller' => 'Illuminate\Routing\Controller', + 'Cookie' => 'Illuminate\Support\Facades\Cookie', + 'Crypt' => 'Illuminate\Support\Facades\Crypt', + 'DB' => 'Illuminate\Support\Facades\DB', + 'Eloquent' => 'Illuminate\Database\Eloquent\Model', + 'Event' => 'Illuminate\Support\Facades\Event', + 'File' => 'Illuminate\Support\Facades\File', + 'Hash' => 'Illuminate\Support\Facades\Hash', + 'Input' => 'Illuminate\Support\Facades\Input', + 'Lang' => 'Illuminate\Support\Facades\Lang', + 'Log' => 'Illuminate\Support\Facades\Log', + 'Mail' => 'Illuminate\Support\Facades\Mail', + 'Password' => 'Illuminate\Support\Facades\Password', + 'Queue' => 'Illuminate\Support\Facades\Queue', + 'Redirect' => 'Illuminate\Support\Facades\Redirect', + 'Redis' => 'Illuminate\Support\Facades\Redis', + 'Request' => 'Illuminate\Support\Facades\Request', + 'Response' => 'Illuminate\Support\Facades\Response', + 'Route' => 'Illuminate\Support\Facades\Route', + 'Schema' => 'Illuminate\Support\Facades\Schema', + 'Seeder' => 'Illuminate\Database\Seeder', + 'Session' => 'Illuminate\Support\Facades\Session', + 'Str' => 'Illuminate\Support\Str', + 'URL' => 'Illuminate\Support\Facades\URL', + 'Validator' => 'Illuminate\Support\Facades\Validator', + 'View' => 'Illuminate\Support\Facades\View', - - // Added Class Aliases - 'Utils' => 'App\Libraries\Utils', - 'Form' => 'Collective\Html\FormFacade', - 'HTML' => 'Collective\Html\HtmlFacade', - 'SSH' => 'Illuminate\Support\Facades\SSH', - 'Alert' => 'Bootstrapper\Facades\Alert', - 'Badge' => 'Bootstrapper\Facades\Badge', - 'Breadcrumb' => 'Bootstrapper\Facades\Breadcrumb', - 'Button' => 'Bootstrapper\Facades\Button', - 'ButtonGroup' => 'Bootstrapper\Facades\ButtonGroup', - 'ButtonToolbar' => 'Bootstrapper\Facades\ButtonToolbar', - 'Carousel' => 'Bootstrapper\Facades\Carousel', - 'DropdownButton' => 'Bootstrapper\Facades\DropdownButton', - 'Helpers' => 'Bootstrapper\Facades\Helpers', - 'Icon' => 'Bootstrapper\Facades\Icon', - 'Label' => 'Bootstrapper\Facades\Label', - 'MediaObject' => 'Bootstrapper\Facades\MediaObject', - 'Navbar' => 'Bootstrapper\Facades\Navbar', - 'Navigation' => 'Bootstrapper\Facades\Navigation', - 'Paginator' => 'Bootstrapper\Facades\Paginator', - 'Progress' => 'Bootstrapper\Facades\Progress', - 'Tabbable' => 'Bootstrapper\Facades\Tabbable', - 'Table' => 'Bootstrapper\Facades\Table', - 'Thumbnail' => 'Bootstrapper\Facades\Thumbnail', - 'Typeahead' => 'Bootstrapper\Facades\Typeahead', - 'Typography' => 'Bootstrapper\Facades\Typography', - 'Former' => 'Former\Facades\Former', - 'Datatable' => 'Chumper\Datatable\Facades\DatatableFacade', - 'Omnipay' => 'Omnipay\Omnipay', - 'CreditCard' => 'Omnipay\Common\CreditCard', - 'Image' => 'Intervention\Image\Facades\Image', - 'Countries' => 'Webpatser\Countries\CountriesFacade', - 'Carbon' => 'Carbon\Carbon', - 'Rocketeer' => 'Rocketeer\Facades\Rocketeer', + // Added Class Aliases + 'Utils' => 'App\Libraries\Utils', + 'Form' => 'Collective\Html\FormFacade', + 'HTML' => 'Collective\Html\HtmlFacade', + 'SSH' => 'Illuminate\Support\Facades\SSH', + 'Alert' => 'Bootstrapper\Facades\Alert', + 'Badge' => 'Bootstrapper\Facades\Badge', + 'Breadcrumb' => 'Bootstrapper\Facades\Breadcrumb', + 'Button' => 'Bootstrapper\Facades\Button', + 'ButtonGroup' => 'Bootstrapper\Facades\ButtonGroup', + 'ButtonToolbar' => 'Bootstrapper\Facades\ButtonToolbar', + 'Carousel' => 'Bootstrapper\Facades\Carousel', + 'DropdownButton' => 'Bootstrapper\Facades\DropdownButton', + 'Helpers' => 'Bootstrapper\Facades\Helpers', + 'Icon' => 'Bootstrapper\Facades\Icon', + 'Label' => 'Bootstrapper\Facades\Label', + 'MediaObject' => 'Bootstrapper\Facades\MediaObject', + 'Navbar' => 'Bootstrapper\Facades\Navbar', + 'Navigation' => 'Bootstrapper\Facades\Navigation', + 'Paginator' => 'Bootstrapper\Facades\Paginator', + 'Progress' => 'Bootstrapper\Facades\Progress', + 'Tabbable' => 'Bootstrapper\Facades\Tabbable', + 'Table' => 'Bootstrapper\Facades\Table', + 'Thumbnail' => 'Bootstrapper\Facades\Thumbnail', + 'Typeahead' => 'Bootstrapper\Facades\Typeahead', + 'Typography' => 'Bootstrapper\Facades\Typography', + 'Former' => 'Former\Facades\Former', + 'Datatable' => 'Chumper\Datatable\Facades\DatatableFacade', + 'Omnipay' => 'Omnipay\Omnipay', + 'CreditCard' => 'Omnipay\Common\CreditCard', + 'Image' => 'Intervention\Image\Facades\Image', + 'Countries' => 'Webpatser\Countries\CountriesFacade', + 'Carbon' => 'Carbon\Carbon', + 'Rocketeer' => 'Rocketeer\Facades\Rocketeer', 'Socialite' => 'Laravel\Socialite\Facades\Socialite', + 'Excel' => 'Maatwebsite\Excel\Facades\Excel', - ], + ], ]; diff --git a/config/excel.php b/config/excel.php new file mode 100644 index 0000000000..7acea7bc07 --- /dev/null +++ b/config/excel.php @@ -0,0 +1,683 @@ + array( + + /* + |-------------------------------------------------------------------------- + | Enable/Disable cell caching + |-------------------------------------------------------------------------- + */ + 'enable' => true, + + /* + |-------------------------------------------------------------------------- + | Caching driver + |-------------------------------------------------------------------------- + | + | Set the caching driver + | + | Available methods: + | memory|gzip|serialized|igbinary|discISAM|apc|memcache|temp|wincache|sqlite|sqlite3 + | + */ + 'driver' => 'memory', + + /* + |-------------------------------------------------------------------------- + | Cache settings + |-------------------------------------------------------------------------- + */ + 'settings' => array( + + 'memoryCacheSize' => '32MB', + 'cacheTime' => 600 + + ), + + /* + |-------------------------------------------------------------------------- + | Memcache settings + |-------------------------------------------------------------------------- + */ + 'memcache' => array( + + 'host' => 'localhost', + 'port' => 11211, + + ), + + /* + |-------------------------------------------------------------------------- + | Cache dir (for discISAM) + |-------------------------------------------------------------------------- + */ + + 'dir' => storage_path('cache') + ), + + 'properties' => array( + 'creator' => 'Maatwebsite', + 'lastModifiedBy' => 'Maatwebsite', + 'title' => 'Spreadsheet', + 'description' => 'Default spreadsheet export', + 'subject' => 'Spreadsheet export', + 'keywords' => 'maatwebsite, excel, export', + 'category' => 'Excel', + 'manager' => 'Maatwebsite', + 'company' => 'Maatwebsite', + ), + + /* + |-------------------------------------------------------------------------- + | Sheets settings + |-------------------------------------------------------------------------- + */ + 'sheets' => array( + + /* + |-------------------------------------------------------------------------- + | Default page setup + |-------------------------------------------------------------------------- + */ + 'pageSetup' => array( + 'orientation' => 'portrait', + 'paperSize' => '9', + 'scale' => '100', + 'fitToPage' => false, + 'fitToHeight' => true, + 'fitToWidth' => true, + 'columnsToRepeatAtLeft' => array('', ''), + 'rowsToRepeatAtTop' => array(0, 0), + 'horizontalCentered' => false, + 'verticalCentered' => false, + 'printArea' => null, + 'firstPageNumber' => null, + ), + ), + + /* + |-------------------------------------------------------------------------- + | Creator + |-------------------------------------------------------------------------- + | + | The default creator of a new Excel file + | + */ + + 'creator' => 'Maatwebsite', + + 'csv' => array( + /* + |-------------------------------------------------------------------------- + | Delimiter + |-------------------------------------------------------------------------- + | + | The default delimiter which will be used to read out a CSV file + | + */ + + 'delimiter' => ',', + + /* + |-------------------------------------------------------------------------- + | Enclosure + |-------------------------------------------------------------------------- + */ + + 'enclosure' => '"', + + /* + |-------------------------------------------------------------------------- + | Line endings + |-------------------------------------------------------------------------- + */ + + 'line_ending' => "\r\n" + ), + + 'export' => array( + + /* + |-------------------------------------------------------------------------- + | Autosize columns + |-------------------------------------------------------------------------- + | + | Disable/enable column autosize or set the autosizing for + | an array of columns ( array('A', 'B') ) + | + */ + 'autosize' => true, + + /* + |-------------------------------------------------------------------------- + | Autosize method + |-------------------------------------------------------------------------- + | + | --> PHPExcel_Shared_Font::AUTOSIZE_METHOD_APPROX + | The default is based on an estimate, which does its calculation based + | on the number of characters in the cell value (applying any calculation + | and format mask, and allowing for wordwrap and rotation) and with an + | "arbitrary" adjustment based on the font (Arial, Calibri or Verdana, + | defaulting to Calibri if any other font is used) and a proportional + | adjustment for the font size. + | + | --> PHPExcel_Shared_Font::AUTOSIZE_METHOD_EXACT + | The second method is more accurate, based on actual style formatting as + | well (bold, italic, etc), and is calculated by generating a gd2 imagettf + | bounding box and using its dimensions to determine the size; but this + | method is significantly slower, and its accuracy is still dependent on + | having the appropriate fonts installed. + | + */ + 'autosize-method' => PHPExcel_Shared_Font::AUTOSIZE_METHOD_APPROX, + + /* + |-------------------------------------------------------------------------- + | Auto generate table heading + |-------------------------------------------------------------------------- + | + | If set to true, the array indices (or model attribute names) + | will automatically be used as first row (table heading) + | + */ + 'generate_heading_by_indices' => true, + + /* + |-------------------------------------------------------------------------- + | Auto set alignment on merged cells + |-------------------------------------------------------------------------- + */ + 'merged_cell_alignment' => 'left', + + /* + |-------------------------------------------------------------------------- + | Pre-calculate formulas during export + |-------------------------------------------------------------------------- + */ + 'calculate' => false, + + /* + |-------------------------------------------------------------------------- + | Include Charts during export + |-------------------------------------------------------------------------- + */ + 'includeCharts' => false, + + /* + |-------------------------------------------------------------------------- + | Default sheet settings + |-------------------------------------------------------------------------- + */ + 'sheets' => array( + + /* + |-------------------------------------------------------------------------- + | Default page margin + |-------------------------------------------------------------------------- + | + | 1) When set to false, default margins will be used + | 2) It's possible to enter a single margin which will + | be used for all margins. + | 3) Alternatively you can pass an array with 4 margins + | Default order: array(top, right, bottom, left) + | + */ + 'page_margin' => false, + + /* + |-------------------------------------------------------------------------- + | Value in source array that stands for blank cell + |-------------------------------------------------------------------------- + */ + 'nullValue' => null, + + /* + |-------------------------------------------------------------------------- + | Insert array starting from this cell address as the top left coordinate + |-------------------------------------------------------------------------- + */ + 'startCell' => 'A1', + + /* + |-------------------------------------------------------------------------- + | Apply strict comparison when testing for null values in the array + |-------------------------------------------------------------------------- + */ + 'strictNullComparison' => false + ), + + /* + |-------------------------------------------------------------------------- + | Store settings + |-------------------------------------------------------------------------- + */ + + 'store' => array( + + /* + |-------------------------------------------------------------------------- + | Path + |-------------------------------------------------------------------------- + | + | The path we want to save excel file to + | + */ + 'path' => storage_path('exports'), + + /* + |-------------------------------------------------------------------------- + | Return info + |-------------------------------------------------------------------------- + | + | Whether we want to return information about the stored file or not + | + */ + 'returnInfo' => false + + ), + + /* + |-------------------------------------------------------------------------- + | PDF Settings + |-------------------------------------------------------------------------- + */ + 'pdf' => array( + + /* + |-------------------------------------------------------------------------- + | PDF Drivers + |-------------------------------------------------------------------------- + | Supported: DomPDF, tcPDF, mPDF + */ + 'driver' => 'DomPDF', + + /* + |-------------------------------------------------------------------------- + | PDF Driver settings + |-------------------------------------------------------------------------- + */ + 'drivers' => array( + + /* + |-------------------------------------------------------------------------- + | DomPDF settings + |-------------------------------------------------------------------------- + */ + 'DomPDF' => array( + 'path' => base_path('vendor/dompdf/dompdf/') + ), + + /* + |-------------------------------------------------------------------------- + | tcPDF settings + |-------------------------------------------------------------------------- + */ + 'tcPDF' => array( + 'path' => base_path('vendor/tecnick.com/tcpdf/') + ), + + /* + |-------------------------------------------------------------------------- + | mPDF settings + |-------------------------------------------------------------------------- + */ + 'mPDF' => array( + 'path' => base_path('vendor/mpdf/mpdf/') + ), + ) + ) + ), + + 'filters' => array( + /* + |-------------------------------------------------------------------------- + | Register read filters + |-------------------------------------------------------------------------- + */ + + 'registered' => array( + 'chunk' => 'Maatwebsite\Excel\Filters\ChunkReadFilter' + ), + + /* + |-------------------------------------------------------------------------- + | Enable certain filters for every file read + |-------------------------------------------------------------------------- + */ + + 'enabled' => array() + ), + + 'import' => array( + + /* + |-------------------------------------------------------------------------- + | Has heading + |-------------------------------------------------------------------------- + | + | The sheet has a heading (first) row which we can use as attribute names + | + | Options: true|false|slugged|slugged_with_count|ascii|numeric|hashed|trans|original + | + */ + + 'heading' => 'slugged', + + /* + |-------------------------------------------------------------------------- + | First Row with data or heading of data + |-------------------------------------------------------------------------- + | + | If the heading row is not the first row, or the data doesn't start + | on the first row, here you can change the start row. + | + */ + + 'startRow' => 1, + + /* + |-------------------------------------------------------------------------- + | Cell name word separator + |-------------------------------------------------------------------------- + | + | The default separator which is used for the cell names + | Note: only applies to 'heading' settings 'true' && 'slugged' + | + */ + + 'separator' => '_', + + /* + |-------------------------------------------------------------------------- + | Include Charts during import + |-------------------------------------------------------------------------- + */ + + 'includeCharts' => false, + + /* + |-------------------------------------------------------------------------- + | Sheet heading conversion + |-------------------------------------------------------------------------- + | + | Convert headings to ASCII + | Note: only applies to 'heading' settings 'true' && 'slugged' + | + */ + + 'to_ascii' => true, + + /* + |-------------------------------------------------------------------------- + | Import encoding + |-------------------------------------------------------------------------- + */ + + 'encoding' => array( + + 'input' => 'UTF-8', + 'output' => 'UTF-8' + + ), + + /* + |-------------------------------------------------------------------------- + | Calculate + |-------------------------------------------------------------------------- + | + | By default cells with formulas will be calculated. + | + */ + + 'calculate' => true, + + /* + |-------------------------------------------------------------------------- + | Ignore empty cells + |-------------------------------------------------------------------------- + | + | By default empty cells are not ignored + | + */ + + 'ignoreEmpty' => false, + + /* + |-------------------------------------------------------------------------- + | Force sheet collection + |-------------------------------------------------------------------------- + | + | For a sheet collection even when there is only 1 sheets. + | When set to false and only 1 sheet found, the parsed file will return + | a row collection instead of a sheet collection. + | When set to true, it will return a sheet collection instead. + | + */ + 'force_sheets_collection' => false, + + /* + |-------------------------------------------------------------------------- + | Date format + |-------------------------------------------------------------------------- + | + | The format dates will be parsed to + | + */ + + 'dates' => array( + + /* + |-------------------------------------------------------------------------- + | Enable/disable date formatting + |-------------------------------------------------------------------------- + */ + 'enabled' => true, + + /* + |-------------------------------------------------------------------------- + | Default date format + |-------------------------------------------------------------------------- + | + | If set to false, a carbon object will return + | + */ + 'format' => false, + + /* + |-------------------------------------------------------------------------- + | Date columns + |-------------------------------------------------------------------------- + */ + 'columns' => array() + ), + + /* + |-------------------------------------------------------------------------- + | Import sheets by config + |-------------------------------------------------------------------------- + */ + 'sheets' => array( + + /* + |-------------------------------------------------------------------------- + | Example sheet + |-------------------------------------------------------------------------- + | + | Example sheet "test" will grab the firstname at cell A2 + | + */ + + 'test' => array( + + 'firstname' => 'A2' + + ) + + ) + ), + + 'views' => array( + + /* + |-------------------------------------------------------------------------- + | Styles + |-------------------------------------------------------------------------- + | + | The default styles which will be used when parsing a view + | + */ + + 'styles' => array( + + /* + |-------------------------------------------------------------------------- + | Table headings + |-------------------------------------------------------------------------- + */ + 'th' => array( + 'font' => array( + 'bold' => true, + 'size' => 12, + ) + ), + + /* + |-------------------------------------------------------------------------- + | Strong tags + |-------------------------------------------------------------------------- + */ + 'strong' => array( + 'font' => array( + 'bold' => true, + 'size' => 12, + ) + ), + + /* + |-------------------------------------------------------------------------- + | Bold tags + |-------------------------------------------------------------------------- + */ + 'b' => array( + 'font' => array( + 'bold' => true, + 'size' => 12, + ) + ), + + /* + |-------------------------------------------------------------------------- + | Italic tags + |-------------------------------------------------------------------------- + */ + 'i' => array( + 'font' => array( + 'italic' => true, + 'size' => 12, + ) + ), + + /* + |-------------------------------------------------------------------------- + | Heading 1 + |-------------------------------------------------------------------------- + */ + 'h1' => array( + 'font' => array( + 'bold' => true, + 'size' => 24, + ) + ), + + /* + |-------------------------------------------------------------------------- + | Heading 2 + |-------------------------------------------------------------------------- + */ + 'h2' => array( + 'font' => array( + 'bold' => true, + 'size' => 18, + ) + ), + + /* + |-------------------------------------------------------------------------- + | Heading 2 + |-------------------------------------------------------------------------- + */ + 'h3' => array( + 'font' => array( + 'bold' => true, + 'size' => 13.5, + ) + ), + + /* + |-------------------------------------------------------------------------- + | Heading 4 + |-------------------------------------------------------------------------- + */ + 'h4' => array( + 'font' => array( + 'bold' => true, + 'size' => 12, + ) + ), + + /* + |-------------------------------------------------------------------------- + | Heading 5 + |-------------------------------------------------------------------------- + */ + 'h5' => array( + 'font' => array( + 'bold' => true, + 'size' => 10, + ) + ), + + /* + |-------------------------------------------------------------------------- + | Heading 6 + |-------------------------------------------------------------------------- + */ + 'h6' => array( + 'font' => array( + 'bold' => true, + 'size' => 7.5, + ) + ), + + /* + |-------------------------------------------------------------------------- + | Hyperlinks + |-------------------------------------------------------------------------- + */ + 'a' => array( + 'font' => array( + 'underline' => true, + 'color' => array('argb' => 'FF0000FF'), + ) + ), + + /* + |-------------------------------------------------------------------------- + | Horizontal rules + |-------------------------------------------------------------------------- + */ + 'hr' => array( + 'borders' => array( + 'bottom' => array( + 'style' => 'thin', + 'color' => array('FF000000') + ), + ) + ) + ) + + ) + +); diff --git a/readme.md b/readme.md index c1317bc42c..20580dd778 100644 --- a/readme.md +++ b/readme.md @@ -79,4 +79,5 @@ If you'd like to use our code to sell your own invoicing app email us for detail * [lokesh/lightbox2](https://github.com/lokesh/lightbox2/) - The original lightbox script * [josdejong/jsoneditor](https://github.com/josdejong/jsoneditor/) - A web-based tool to view, edit and format JSON * [simshaun/recurr](https://github.com/simshaun/recurr) - PHP library for working with recurrence rules -* [quilljs/quill](https://github.com/quilljs/quill/) - A cross browser rich text editor with an API \ No newline at end of file +* [quilljs/quill](https://github.com/quilljs/quill/) - A cross browser rich text editor with an API +* [Maatwebsite/Laravel-Excel](https://github.com/Maatwebsite/Laravel-Excel) - An eloquent way of importing and exporting Excel and CSV files for Laravel \ No newline at end of file diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index c528f6f986..0cd003ad4d 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -913,5 +913,9 @@ return array( 'after' => 'After', 'reset_terms_help' => 'Reset to the default account terms', 'reset_footer_help' => 'Reset to the default account footer', + 'export_data' => 'Export Data', + 'user' => 'User', + 'country' => 'Country', + 'include' => 'Include', ); diff --git a/resources/views/accounts/import_export.blade.php b/resources/views/accounts/import_export.blade.php index dc9a73c455..a621fc4b0e 100644 --- a/resources/views/accounts/import_export.blade.php +++ b/resources/views/accounts/import_export.blade.php @@ -18,12 +18,29 @@ {!! Former::close() !!} -{!! Former::open('settings/' . ACCOUNT_EXPORT) !!} +{!! Former::open('/export') !!}
-

{!! trans('texts.export_clients') !!}

+

{!! trans('texts.export_data') !!}

+ {!! Former::select('format') + ->onchange('setEntityTypesVisible()') + ->addOption('CSV', 'CSV') + ->addOption('XLS', 'XLS') + ->addOption('JSON', 'JSON') + ->style('max-width: 200px') !!} + + {!! Former::checkbox('entity_types') + ->label('include') + ->addGroupClass('entity-types') + ->checkboxes([ + trans('texts.clients') => array('name' => ENTITY_CLIENT, 'value' => 1), + trans('texts.tasks') => array('name' => ENTITY_TASK, 'value' => 1), + trans('texts.invoices') => array('name' => ENTITY_INVOICE, 'value' => 1), + trans('texts.payments') => array('name' => ENTITY_PAYMENT, 'value' => 1), + ])->check(ENTITY_CLIENT)->check(ENTITY_TASK)->check(ENTITY_INVOICE)->check(ENTITY_PAYMENT) !!} + {!! Former::actions( Button::primary(trans('texts.download'))->submit()->large()->appendIcon(Icon::create('download-alt'))) !!}
@@ -75,6 +92,15 @@ $('form.cancel-account').submit(); } + function setEntityTypesVisible() { + var selector = '.entity-types input[type=checkbox]'; + if ($('#format').val() === 'JSON') { + $(selector).attr('disabled', true); + } else { + $(selector).removeAttr('disabled'); + } + } + @stop \ No newline at end of file diff --git a/resources/views/export.blade.php b/resources/views/export.blade.php new file mode 100644 index 0000000000..f2fa8dbbe7 --- /dev/null +++ b/resources/views/export.blade.php @@ -0,0 +1,43 @@ + + + + {{ $title }} + + + + @if (isset($clients) && $clients && count($clients)) + {{ strtoupper(trans('texts.clients')) }} + @include('export.clients') + @endif + + @if (isset($contacts) && $contacts && count($contacts)) + {{ strtoupper(trans('texts.contacts')) }} + @include('export.contacts') + @endif + + @if (isset($credits) && $credits && count($credits)) + {{ strtoupper(trans('texts.credits')) }} + @include('export.credits') + @endif + + @if (isset($tasks) && $tasks && count($tasks)) + {{ strtoupper(trans('texts.tasks')) }} + @include('export.tasks') + @endif + + @if (isset($invoices) && $invoices && count($invoices)) + {{ strtoupper(trans('texts.invoices')) }} + @include('export.invoices') + @endif + + @if (isset($quotes) && $quotes && count($quotes)) + {{ strtoupper(trans('texts.quotes')) }} + @include('export.invoices', ['entityType' => ENTITY_QUOTE]) + @endif + + @if (isset($payments) && $payments && count($payments)) + {{ strtoupper(trans('texts.payments')) }} + @include('export.payments') + @endif + + \ No newline at end of file diff --git a/resources/views/export/clients.blade.php b/resources/views/export/clients.blade.php new file mode 100644 index 0000000000..226d00e8c6 --- /dev/null +++ b/resources/views/export/clients.blade.php @@ -0,0 +1,45 @@ + + {{ trans('texts.name') }} + @if ($multiUser) + {{ trans('texts.user') }} + @endif + {{ trans('texts.balance') }} + {{ trans('texts.paid_to_date') }} + {{ trans('texts.address1') }} + {{ trans('texts.address2') }} + {{ trans('texts.city') }} + {{ trans('texts.state') }} + {{ trans('texts.postal_code') }} + {{ trans('texts.country') }} + @if ($account->custom_client_label1) + {{ $account->custom_client_label1 }} + @endif + @if ($account->custom_client_label2) + {{ $account->custom_client_label2 }} + @endif + + +@foreach ($clients as $client) + + {{ $client->getDisplayName() }} + @if ($multiUser) + {{ $client->user->getDisplayName() }} + @endif + {{ $client->present()->balance }} + {{ $client->present()->paid_to_date }} + {{ $client->address1 }} + {{ $client->address2 }} + {{ $client->city }} + {{ $client->state }} + {{ $client->postal_code }} + {{ $client->present()->country }} + @if ($account->custom_client_label1) + {{ $client->custom_value1 }} + @endif + @if ($account->custom_client_label2) + {{ $client->custom_value2 }} + @endif + +@endforeach + + \ No newline at end of file diff --git a/resources/views/export/contacts.blade.php b/resources/views/export/contacts.blade.php new file mode 100644 index 0000000000..30c7305cc1 --- /dev/null +++ b/resources/views/export/contacts.blade.php @@ -0,0 +1,25 @@ + + {{ trans('texts.client') }} + @if ($multiUser) + {{ trans('texts.user') }} + @endif + {{ trans('texts.first_name') }} + {{ trans('texts.last_name') }} + {{ trans('texts.email') }} + {{ trans('texts.phone') }} + + +@foreach ($contacts as $contact) + + {{ $contact->client->getDisplayName() }} + @if ($multiUser) + {{ $contact->user->getDisplayName() }} + @endif + {{ $contact->first_name }} + {{ $contact->last_name }} + {{ $contact->email }} + {{ $contact->phone }} + +@endforeach + + \ No newline at end of file diff --git a/resources/views/export/credits.blade.php b/resources/views/export/credits.blade.php new file mode 100644 index 0000000000..85fa24ba79 --- /dev/null +++ b/resources/views/export/credits.blade.php @@ -0,0 +1,23 @@ + + {{ trans('texts.name') }} + @if ($multiUser) + {{ trans('texts.user') }} + @endif + {{ trans('texts.amount') }} + {{ trans('texts.balance') }} + {{ trans('texts.credit_date') }} + + +@foreach ($credits as $credit) + + {{ $credit->client->getDisplayName() }} + @if ($multiUser) + {{ $credit->user->getDisplayName() }} + @endif + {{ $credit->present()->amount }} + {{ $credit->present()->balance }} + {{ $credit->present()->credit_date }} + +@endforeach + + \ No newline at end of file diff --git a/resources/views/export/invoices.blade.php b/resources/views/export/invoices.blade.php new file mode 100644 index 0000000000..78af6fa9da --- /dev/null +++ b/resources/views/export/invoices.blade.php @@ -0,0 +1,55 @@ + + {{ trans('texts.client') }} + @if ($multiUser) + {{ trans('texts.user') }} + @endif + {{ trans(isset($entityType) && $entityType == ENTITY_QUOTE ? 'texts.quote_number' : 'texts.invoice_number') }} + {{ trans('texts.balance') }} + {{ trans('texts.amount') }} + {{ trans('texts.po_number') }} + {{ trans('texts.status') }} + {{ trans(isset($entityType) && $entityType == ENTITY_QUOTE ? 'texts.quote_date' : 'texts.invoice_date') }} + {{ trans('texts.due_date') }} + @if ($account->custom_invoice_label1) + {{ $account->custom_invoice_label1 }} + @endif + @if ($account->custom_invoice_label2) + {{ $account->custom_invoice_label2 }} + @endif + @if ($account->custom_invoice_text_label1) + {{ $account->custom_invoice_text_label1 }} + @endif + @if ($account->custom_invoice_text_label2) + {{ $account->custom_invoice_text_label2 }} + @endif + + +@foreach ($invoices as $invoice) + + {{ $invoice->present()->client }} + @if ($multiUser) + {{ $invoice->present()->user }} + @endif + {{ $invoice->invoice_number }} + {{ $invoice->present()->balance }} + {{ $invoice->present()->amount }} + {{ $invoice->po_number }} + {{ $invoice->present()->status }} + {{ $invoice->present()->invoice_date }} + {{ $invoice->present()->due_date }} + @if ($account->custom_invoice_label1) + {{ $invoice->custom_value1 }} + @endif + @if ($account->custom_invoice_label2) + {{ $invoice->custom_value2 }} + @endif + @if ($account->custom_invoice_label1) + {{ $invoice->custom_text_value1 }} + @endif + @if ($account->custom_invoice_label2) + {{ $invoice->custom_text_value2 }} + @endif + +@endforeach + + \ No newline at end of file diff --git a/resources/views/export/payments.blade.php b/resources/views/export/payments.blade.php new file mode 100644 index 0000000000..84a07deaa4 --- /dev/null +++ b/resources/views/export/payments.blade.php @@ -0,0 +1,27 @@ + + {{ trans('texts.client') }} + @if ($multiUser) + {{ trans('texts.user') }} + @endif + {{ trans('texts.invoice_number') }} + {{ trans('texts.amount') }} + {{ trans('texts.payment_date') }} + {{ trans('texts.method') }} + {{ trans('texts.transaction_reference') }} + + +@foreach ($payments as $payment) + + {{ $payment->present()->client }} + @if ($multiUser) + {{ $payment->user->getDisplayName() }} + @endif + {{ $payment->invoice->invoice_number }} + {{ $payment->present()->amount }} + {{ $payment->present()->payment_date }} + {{ $payment->present()->method }} + {{ $payment->transaction_reference }} + +@endforeach + + \ No newline at end of file diff --git a/resources/views/export/tasks.blade.php b/resources/views/export/tasks.blade.php new file mode 100644 index 0000000000..1c8e58e54c --- /dev/null +++ b/resources/views/export/tasks.blade.php @@ -0,0 +1,23 @@ + + {{ trans('texts.client') }} + @if ($multiUser) + {{ trans('texts.user') }} + @endif + {{ trans('texts.start_date') }} + {{ trans('texts.duration') }} + {{ trans('texts.description') }} + + +@foreach ($tasks as $task) + + {{ $task->present()->client }} + @if ($multiUser) + {{ $task->present()->user }} + @endif + {{ $task->getStartTime() }} + {{ $task->getDuration() }} + {{ $task->description }} + +@endforeach + + \ No newline at end of file