diff --git a/.travis.yml b/.travis.yml
index ee09abcd0..7e9fc52bc 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -20,7 +20,7 @@ before_install:
before_script:
- cp .env.testing .env
- - composer install --no-interaction
+ - composer test --no-interaction
script:
- vendor/bin/phpunit
\ No newline at end of file
diff --git a/app/Console/Commands/ModuleInstall.php b/app/Console/Commands/ModuleInstall.php
index 6ae58108b..8774e2814 100644
--- a/app/Console/Commands/ModuleInstall.php
+++ b/app/Console/Commands/ModuleInstall.php
@@ -31,17 +31,21 @@ class ModuleInstall extends Command
*/
public function handle()
{
+ $alias = $this->argument('alias');
+ $company_id = $this->argument('company_id');
+
+ // Set company id
+ session(['company_id' => $company_id]);
+
$request = [
- 'company_id' => $this->argument('company_id'),
- 'alias' => strtolower($this->argument('alias')),
+ 'company_id' => $company_id,
+ 'alias' => strtolower($alias),
'status' => '1',
];
$model = Module::create($request);
- $module = $this->laravel['modules']->findByAlias($model->alias);
-
- $company_id = $this->argument('company_id');
+ $module = $this->laravel['modules']->findByAlias($alias);
// Add history
$data = [
@@ -61,7 +65,10 @@ class ModuleInstall extends Command
$this->call('migrate', ['--force' => true]);
// Trigger event
- event(new ModuleInstalled($model->alias, $company_id));
+ event(new ModuleInstalled($alias, $company_id));
+
+ // Unset company id
+ session()->forget('company_id');
$this->info('Module installed!');
}
diff --git a/app/Http/Controllers/Banking/Accounts.php b/app/Http/Controllers/Banking/Accounts.php
index 51765fe0c..63cfa052c 100644
--- a/app/Http/Controllers/Banking/Accounts.php
+++ b/app/Http/Controllers/Banking/Accounts.php
@@ -178,8 +178,6 @@ class Accounts extends Controller
$message = trans('messages.warning.disabled', ['name' => $account->name, 'text' => implode(', ', $relationships)]);
flash($message)->warning();
-
- return redirect()->route('accounts.index');
}
return redirect()->route('accounts.index');
diff --git a/app/Http/Controllers/Common/Companies.php b/app/Http/Controllers/Common/Companies.php
index 1c8efba9e..95892f98a 100644
--- a/app/Http/Controllers/Common/Companies.php
+++ b/app/Http/Controllers/Common/Companies.php
@@ -8,6 +8,7 @@ use App\Http\Requests\Common\Company as Request;
use App\Models\Common\Company;
use App\Models\Setting\Currency;
use App\Traits\Uploads;
+use App\Utilities\Overrider;
class Companies extends Controller
{
@@ -60,6 +61,8 @@ class Companies extends Controller
*/
public function store(Request $request)
{
+ $company_id = session('company_id');
+
setting()->forgetAll();
// Create company
@@ -86,6 +89,12 @@ class Companies extends Controller
setting()->setExtraColumns(['company_id' => $company->id]);
setting()->save();
+ setting()->forgetAll();
+
+ session(['company_id' => $company_id]);
+
+ Overrider::load('settings');
+
// Redirect
$message = trans('messages.success.added', ['type' => trans_choice('general.companies', 1)]);
@@ -129,6 +138,8 @@ class Companies extends Controller
*/
public function update(Company $company, Request $request)
{
+ $company_id = session('company_id');
+
// Check if user can update company
if (!$this->isUserCompany($company)) {
$message = trans('companies.error.not_user_company');
@@ -166,6 +177,12 @@ class Companies extends Controller
setting()->save();
+ setting()->forgetAll();
+
+ session(['company_id' => $company_id]);
+
+ Overrider::load('settings');
+
// Redirect
$message = trans('messages.success.updated', ['type' => trans_choice('general.companies', 1)]);
@@ -191,6 +208,7 @@ class Companies extends Controller
flash($message)->success();
return redirect()->route('companies.index');
+
}
/**
diff --git a/app/Http/Controllers/Customers/Invoices.php b/app/Http/Controllers/Customers/Invoices.php
index aff6c3b32..a53fb0041 100644
--- a/app/Http/Controllers/Customers/Invoices.php
+++ b/app/Http/Controllers/Customers/Invoices.php
@@ -184,7 +184,9 @@ class Invoices extends Controller
public function link(Invoice $invoice, Request $request)
{
- session(['company_id' => $invoice->company_id]);
+ if (empty($invoice)) {
+ redirect()->route('login');
+ }
$paid = 0;
diff --git a/app/Http/Controllers/Expenses/Bills.php b/app/Http/Controllers/Expenses/Bills.php
index 9fa40c25f..a327d79be 100644
--- a/app/Http/Controllers/Expenses/Bills.php
+++ b/app/Http/Controllers/Expenses/Bills.php
@@ -245,7 +245,7 @@ class Bills extends Controller
*/
public function destroy(Bill $bill)
{
- $this->deleteRelationships($bill, ['items', 'histories', 'payments', 'recurring', 'totals']);
+ $this->deleteRelationships($bill, ['items', 'itemTaxes', 'histories', 'payments', 'recurring', 'totals']);
$bill->delete();
$message = trans('messages.success.deleted', ['type' => trans_choice('general.bills', 1)]);
diff --git a/app/Http/Controllers/Incomes/Invoices.php b/app/Http/Controllers/Incomes/Invoices.php
index 6e3c66f14..83e1983f0 100644
--- a/app/Http/Controllers/Incomes/Invoices.php
+++ b/app/Http/Controllers/Incomes/Invoices.php
@@ -257,7 +257,7 @@ class Invoices extends Controller
*/
public function destroy(Invoice $invoice)
{
- $this->deleteRelationships($invoice, ['items', 'histories', 'payments', 'recurring', 'totals']);
+ $this->deleteRelationships($invoice, ['items', 'itemTaxes', 'histories', 'payments', 'recurring', 'totals']);
$invoice->delete();
$message = trans('messages.success.deleted', ['type' => trans_choice('general.invoices', 1)]);
diff --git a/app/Http/Controllers/Install/Updates.php b/app/Http/Controllers/Install/Updates.php
index c4b171ce4..54c10e896 100644
--- a/app/Http/Controllers/Install/Updates.php
+++ b/app/Http/Controllers/Install/Updates.php
@@ -83,7 +83,7 @@ class Updates extends Controller
public function update($alias, $version)
{
if ($alias == 'core') {
- $name = 'Akaunting v' . $version;
+ $name = 'Akaunting ' . $version;
$installed = version('short');
} else {
@@ -98,33 +98,6 @@ class Updates extends Controller
return view('install.updates.edit', compact('alias', 'name', 'installed', 'version'));
}
- /**
- * Final actions post update.
- *
- * @param $alias
- * @param $old
- * @param $new
- * @return Response
- */
- public function post($alias, $old, $new)
- {
- // Check if the file mirror was successful
- if (($alias == 'core') && (version('short') != $new)) {
- flash(trans('updates.error'))->error()->important();
-
- return redirect('install/updates');
- }
-
- // Clear cache after update
- Artisan::call('cache:clear');
-
- event(new UpdateFinished($alias, $old, $new));
-
- flash(trans('updates.success'))->success();
-
- return redirect('install/updates');
- }
-
/**
* Show the form for viewing the specified resource.
*
diff --git a/app/Http/Controllers/Modules/Item.php b/app/Http/Controllers/Modules/Item.php
index b5d64e6d6..488fa87a1 100644
--- a/app/Http/Controllers/Modules/Item.php
+++ b/app/Http/Controllers/Modules/Item.php
@@ -286,8 +286,6 @@ class Item extends Controller
* Final actions post update.
*
* @param $alias
- * @param $old
- * @param $new
* @return Response
*/
public function post($alias)
diff --git a/app/Http/Controllers/Reports/ProfitLoss.php b/app/Http/Controllers/Reports/ProfitLoss.php
index b05c13f5c..fa640b6af 100644
--- a/app/Http/Controllers/Reports/ProfitLoss.php
+++ b/app/Http/Controllers/Reports/ProfitLoss.php
@@ -169,7 +169,7 @@ class ProfitLoss extends Controller
private function setAmount(&$totals, &$compares, $items, $type, $date_field)
{
foreach ($items as $item) {
- if ($item['table'] == 'bill_payments' || $item['table'] == 'invoice_payments') {
+ if (($item['table'] == 'bill_payments') || ($item['table'] == 'invoice_payments')) {
$type_item = $item->$type;
$item->category_id = $type_item->category_id;
@@ -183,7 +183,7 @@ class ProfitLoss extends Controller
continue;
}
- $amount = $item->getConvertedAmount();
+ $amount = $item->getConvertedAmount(false, false);
// Forecasting
if ((($type == 'invoice') || ($type == 'bill')) && ($date_field == 'due_at')) {
diff --git a/app/Http/Controllers/Settings/Categories.php b/app/Http/Controllers/Settings/Categories.php
index d84baecb9..8284b6b15 100644
--- a/app/Http/Controllers/Settings/Categories.php
+++ b/app/Http/Controllers/Settings/Categories.php
@@ -178,8 +178,6 @@ class Categories extends Controller
$message = trans('messages.warning.disabled', ['name' => $category->name, 'text' => implode(', ', $relationships)]);
flash($message)->warning();
-
- return redirect()->route('categories.index');
}
return redirect()->route('categories.index');
diff --git a/app/Http/Controllers/Settings/Currencies.php b/app/Http/Controllers/Settings/Currencies.php
index 4620ff2f0..0045b922e 100644
--- a/app/Http/Controllers/Settings/Currencies.php
+++ b/app/Http/Controllers/Settings/Currencies.php
@@ -222,8 +222,6 @@ class Currencies extends Controller
$message = trans('messages.warning.disabled', ['name' => $currency->name, 'text' => implode(', ', $relationships)]);
flash($message)->warning();
-
- return redirect()->route('currencies.index');
}
return redirect()->route('currencies.index');
diff --git a/app/Http/Controllers/Settings/Taxes.php b/app/Http/Controllers/Settings/Taxes.php
index bf296fdd8..cea870792 100644
--- a/app/Http/Controllers/Settings/Taxes.php
+++ b/app/Http/Controllers/Settings/Taxes.php
@@ -167,8 +167,6 @@ class Taxes extends Controller
$message = trans('messages.warning.disabled', ['name' => $tax->name, 'text' => implode(', ', $relationships)]);
flash($message)->warning();
-
- return redirect()->route('taxes.index');
}
return redirect()->route('taxes.index');
diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php
index 8f21fcc23..596f625a2 100644
--- a/app/Http/Kernel.php
+++ b/app/Http/Kernel.php
@@ -73,6 +73,11 @@ class Kernel extends HttpKernel
'company.settings',
'company.currencies',
],
+
+ 'signed' => [
+ 'signed-url',
+ 'signed-url.company',
+ ]
];
/**
@@ -100,5 +105,6 @@ class Kernel extends HttpKernel
'company.currencies' => \App\Http\Middleware\LoadCurrencies::class,
'dateformat' => \App\Http\Middleware\DateFormat::class,
'money' => \App\Http\Middleware\Money::class,
+ 'signed-url.company' => \App\Http\Middleware\SignedUrlCompany::class,
];
}
diff --git a/app/Http/Middleware/ApiCompany.php b/app/Http/Middleware/ApiCompany.php
index b054ddd0d..f081ac07b 100644
--- a/app/Http/Middleware/ApiCompany.php
+++ b/app/Http/Middleware/ApiCompany.php
@@ -36,5 +36,4 @@ class ApiCompany
return $next($request);
}
-
-}
\ No newline at end of file
+}
diff --git a/app/Http/Middleware/SignedUrlCompany.php b/app/Http/Middleware/SignedUrlCompany.php
new file mode 100644
index 000000000..88dee5246
--- /dev/null
+++ b/app/Http/Middleware/SignedUrlCompany.php
@@ -0,0 +1,33 @@
+get('company_id');
+
+ if (empty($company_id)) {
+ return $next($request);
+ }
+
+ // Set company id
+ session(['company_id' => $company_id]);
+
+ // Set the company settings
+ setting()->setExtraColumns(['company_id' => $company_id]);
+ setting()->load(true);
+
+ return $next($request);
+ }
+}
diff --git a/app/Http/Requests/Wizard/Company.php b/app/Http/Requests/Wizard/Company.php
index 114f6877f..c2d708fc8 100644
--- a/app/Http/Requests/Wizard/Company.php
+++ b/app/Http/Requests/Wizard/Company.php
@@ -2,10 +2,25 @@
namespace App\Http\Requests\Wizard;
-use Illuminate\Foundation\Http\FormRequest;
+use App\Http\Requests\Request;
+use App\Traits\Modules as RemoteModules;
+use Illuminate\Validation\Factory as ValidationFactory;
-class Company extends FormRequest
+class Company extends Request
{
+ use RemoteModules;
+
+ public function __construct(ValidationFactory $validation)
+ {
+ $validation->extend(
+ 'check',
+ function ($attribute, $value, $parameters) {
+ return $this->checkToken($value);
+ },
+ trans('messages.error.invalid_token')
+ );
+ }
+
/**
* Determine if the user is authorized to make this request.
*
@@ -23,8 +38,14 @@ class Company extends FormRequest
*/
public function rules()
{
- return [
+ $rules = [
'company_logo' => 'mimes:' . setting('general.file_types') . '|between:0,' . setting('general.file_size') * 1024,
];
+
+ if (!setting('general.api_token', false)) {
+ $rules['api_token'] = 'required|string|check';
+ }
+
+ return $rules;
}
}
diff --git a/app/Http/ViewComposers/Modules.php b/app/Http/ViewComposers/Modules.php
index 1b02c939f..0f1ad2d9f 100644
--- a/app/Http/ViewComposers/Modules.php
+++ b/app/Http/ViewComposers/Modules.php
@@ -20,7 +20,7 @@ class Modules
public function compose(View $view)
{
if (setting('general.api_token')) {
- $categories = Cache::remember('modules.categories', Date::now()->addHour(6), function () {
+ $categories = Cache::remember('modules.categories.' . language()->getShortCode(), Date::now()->addHour(6), function () {
return collect($this->getCategories())->pluck('name', 'slug')
->prepend(trans('general.all_type', ['type' => trans_choice('general.categories', 2)]), '');
});
diff --git a/app/Jobs/Expense/CreateBillItem.php b/app/Jobs/Expense/CreateBillItem.php
index cc83823b3..9df227f78 100644
--- a/app/Jobs/Expense/CreateBillItem.php
+++ b/app/Jobs/Expense/CreateBillItem.php
@@ -77,7 +77,7 @@ class CreateBillItem
$tax = Tax::find($tax_id);
switch ($tax->type) {
- case 'included':
+ case 'inclusive':
$inclusives[] = $tax;
break;
case 'compound':
diff --git a/app/Models/Expense/Bill.php b/app/Models/Expense/Bill.php
index 3588f0402..aaf7cbe98 100644
--- a/app/Models/Expense/Bill.php
+++ b/app/Models/Expense/Bill.php
@@ -23,7 +23,7 @@ class Bill extends Model
*
* @var array
*/
- protected $appends = ['attachment', 'discount', 'paid'];
+ protected $appends = ['attachment', 'amount_without_tax', 'discount', 'paid'];
protected $dates = ['deleted_at', 'billed_at', 'due_at'];
@@ -201,6 +201,22 @@ class Bill extends Model
return $percent;
}
+ /**
+ * Get the amount without tax.
+ *
+ * @return string
+ */
+ public function getAmountWithoutTaxAttribute()
+ {
+ $amount = $this->amount;
+
+ $this->totals()->where('code', 'tax')->each(function ($tax) use(&$amount) {
+ $amount -= $tax->amount;
+ });
+
+ return $amount;
+ }
+
/**
* Get the paid amount.
*
diff --git a/app/Models/Income/Invoice.php b/app/Models/Income/Invoice.php
index e6e3d9c36..3e6810828 100644
--- a/app/Models/Income/Invoice.php
+++ b/app/Models/Income/Invoice.php
@@ -24,7 +24,7 @@ class Invoice extends Model
*
* @var array
*/
- protected $appends = ['attachment', 'discount', 'paid'];
+ protected $appends = ['attachment', 'amount_without_tax', 'discount', 'paid'];
protected $dates = ['deleted_at', 'invoiced_at', 'due_at'];
@@ -205,6 +205,22 @@ class Invoice extends Model
return $percent;
}
+ /**
+ * Get the amount without tax.
+ *
+ * @return string
+ */
+ public function getAmountWithoutTaxAttribute()
+ {
+ $amount = $this->amount;
+
+ $this->totals()->where('code', 'tax')->each(function ($tax) use(&$amount) {
+ $amount -= $tax->amount;
+ });
+
+ return $amount;
+ }
+
/**
* Get the paid amount.
*
diff --git a/app/Overrides/Akaunting/SignedUrl.php b/app/Overrides/Akaunting/SignedUrl.php
new file mode 100644
index 000000000..65464c747
--- /dev/null
+++ b/app/Overrides/Akaunting/SignedUrl.php
@@ -0,0 +1,54 @@
+signatureKey = config('signed-url.signatureKey');
+ $this->expiresParameter = config('signed-url.parameters.expires');
+ $this->signatureParameter = config('signed-url.parameters.signature');
+ }
+
+ /**
+ * Get a secure URL to a controller action.
+ *
+ * @param string $url
+ * @param \DateTime|int|null $expiration Defaults to the config value
+ *
+ * @return string
+ */
+ public function sign($url, $expiration = null)
+ {
+ $url .= '?company_id=' . session('company_id');
+
+ $expiration = $expiration ? $expiration : config('signed-url.default_expiration_time_in_days');
+
+ return parent::sign($url, $expiration);
+ }
+}
diff --git a/app/Traits/Currencies.php b/app/Traits/Currencies.php
index ae84cd911..6e8bbe69b 100644
--- a/app/Traits/Currencies.php
+++ b/app/Traits/Currencies.php
@@ -60,18 +60,24 @@ trait Currencies
return $money;
}
- public function getConvertedAmount($format = false)
+ public function getConvertedAmount($format = false, $with_tax = true)
{
- return $this->convert($this->amount, $this->currency_code, $this->currency_rate, $format);
+ $amount = $with_tax ? $this->amount : (isset($this->amount_without_tax) ? $this->amount_without_tax : $this->amount);
+
+ return $this->convert($amount, $this->currency_code, $this->currency_rate, $format);
}
- public function getReverseConvertedAmount($format = false)
+ public function getReverseConvertedAmount($format = false, $with_tax = true)
{
- return $this->reverseConvert($this->amount, $this->currency_code, $this->currency_rate, $format);
+ $amount = $with_tax ? $this->amount : (isset($this->amount_without_tax) ? $this->amount_without_tax : $this->amount);
+
+ return $this->reverseConvert($amount, $this->currency_code, $this->currency_rate, $format);
}
- public function getDynamicConvertedAmount($format = false)
+ public function getDynamicConvertedAmount($format = false, $with_tax = true)
{
- return $this->dynamicConvert($this->default_currency_code, $this->amount, $this->currency_code, $this->currency_rate, $format);
+ $amount = $with_tax ? $this->amount : (isset($this->amount_without_tax) ? $this->amount_without_tax : $this->amount);
+
+ return $this->dynamicConvert($this->default_currency_code, $amount, $this->currency_code, $this->currency_rate, $format);
}
}
\ No newline at end of file
diff --git a/app/Traits/Modules.php b/app/Traits/Modules.php
index 89df5c919..56681268c 100644
--- a/app/Traits/Modules.php
+++ b/app/Traits/Modules.php
@@ -3,15 +3,15 @@
namespace App\Traits;
use App\Utilities\Info;
+use App\Models\Module\Module as Model;
use Artisan;
+use Cache;
+use Date;
use File;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
use Module;
-use App\Models\Module\Module as MModule;
use ZipArchive;
-use Cache;
-use Date;
trait Modules
{
@@ -148,7 +148,7 @@ trait Modules
$installed = [];
$modules = Module::all();
- $installed_modules = MModule::where('company_id', '=', session('company_id'))->pluck('status', 'alias')->toArray();
+ $installed_modules = Model::where('company_id', '=', session('company_id'))->pluck('status', 'alias')->toArray();
foreach ($modules as $module) {
if (!array_key_exists($module->alias, $installed_modules)) {
@@ -528,6 +528,7 @@ trait Modules
'Accept' => 'application/json',
'Referer' => env('APP_URL'),
'Akaunting' => version('short'),
+ 'Language' => language()->getShortCode()
];
$data['http_errors'] = false;
diff --git a/app/Traits/SiteApi.php b/app/Traits/SiteApi.php
index 3a07eb060..173475683 100644
--- a/app/Traits/SiteApi.php
+++ b/app/Traits/SiteApi.php
@@ -18,7 +18,8 @@ trait SiteApi
'Authorization' => 'Bearer ' . setting('general.api_token'),
'Accept' => 'application/json',
'Referer' => env('APP_URL'),
- 'Akaunting' => version('short')
+ 'Akaunting' => version('short'),
+ 'Language' => language()->getShortCode()
);
$data['http_errors'] = false;
diff --git a/app/Utilities/Updater.php b/app/Utilities/Updater.php
index 2deddb51b..989d4d5f6 100644
--- a/app/Utilities/Updater.php
+++ b/app/Utilities/Updater.php
@@ -10,6 +10,7 @@ use Date;
use File;
use Module;
use ZipArchive;
+use Artisan;
use GuzzleHttp\Exception\RequestException;
class Updater
@@ -18,10 +19,7 @@ class Updater
public static function clear()
{
- Cache::forget('modules');
- Cache::forget('updates');
- Cache::forget('versions');
- Cache::forget('suggestions');
+ Artisan::call('cache:clear');
return true;
}
diff --git a/composer.json b/composer.json
index bc092a99f..03595dd51 100644
--- a/composer.json
+++ b/composer.json
@@ -81,6 +81,13 @@
"php artisan clear-compiled",
"php artisan optimize",
"composer dump-autoload"
+ ],
+ "test": [
+ "composer install --no-scripts",
+ "Illuminate\\Foundation\\ComposerScripts::postInstall",
+ "php artisan clear-compiled",
+ "php artisan optimize",
+ "composer dump-autoload"
]
},
"config": {
diff --git a/config/language.php b/config/language.php
index df777dbd2..48a2866ba 100644
--- a/config/language.php
+++ b/config/language.php
@@ -21,7 +21,17 @@ return [
| to url('/')
|
*/
- 'home' => true,
+ 'home' => false,
+
+ /*
+ |--------------------------------------------------------------------------
+ | Add Language Code
+ |--------------------------------------------------------------------------
+ |
+ | This option will add the language code to the redirected url
+ |
+ */
+ 'url' => false,
/*
|--------------------------------------------------------------------------
@@ -177,6 +187,6 @@ return [
['short' => 'tr', 'long' => 'tr-TR', 'english' => 'Turkish', 'native' => 'Türkçe'],
['short' => 'tw', 'long' => 'zh-TW', 'english' => 'Chinese (T)', 'native' => '繁體中文'],
['short' => 'uk', 'long' => 'uk-UA', 'english' => 'Ukrainian', 'native' => 'Українська'],
- ['short' => 'vn', 'long' => 'vi-VN', 'english' => 'Vietnamese', 'native' => 'Tiếng Việt'],
+ ['short' => 'vi', 'long' => 'vi-VN', 'english' => 'Vietnamese', 'native' => 'Tiếng Việt'],
],
];
diff --git a/database/seeds/CompanySeeder.php b/database/seeds/CompanySeeder.php
index bbcf49a85..83bbe8d3f 100644
--- a/database/seeds/CompanySeeder.php
+++ b/database/seeds/CompanySeeder.php
@@ -18,6 +18,5 @@ class CompanySeeder extends Seeder
$this->call(Database\Seeds\InvoiceStatuses::class);
$this->call(Database\Seeds\Modules::class);
$this->call(Database\Seeds\Settings::class);
- $this->call(Database\Seeds\Taxes::class);
}
}
diff --git a/database/seeds/Taxes.php b/database/seeds/Taxes.php
deleted file mode 100644
index dc3cd6a80..000000000
--- a/database/seeds/Taxes.php
+++ /dev/null
@@ -1,54 +0,0 @@
-create();
-
- Model::reguard();
- }
-
- private function create()
- {
- $company_id = $this->command->argument('company');
-
- $rows = [
- [
- 'company_id' => $company_id,
- 'name' => trans('demo.taxes_exempt'),
- 'rate' => '0',
- 'enabled' => '1'
- ],
- [
- 'company_id' => $company_id,
- 'name' => trans('demo.taxes_normal'),
- 'rate' => '5',
- 'enabled' => '1'
- ],
- [
- 'company_id' => $company_id,
- 'name' => trans('demo.taxes_sales'),
- 'rate' => '15',
- 'enabled' => '1'
- ],
- ];
-
- foreach ($rows as $row) {
- Tax::create($row);
- }
- }
-}
diff --git a/modules/OfflinePayment/Assets/.gitkeep b/modules/OfflinePayment/Assets/.gitkeep
deleted file mode 100644
index e69de29bb..000000000
diff --git a/modules/OfflinePayment/Config/.gitkeep b/modules/OfflinePayment/Config/.gitkeep
deleted file mode 100644
index e69de29bb..000000000
diff --git a/modules/OfflinePayment/Config/config.php b/modules/OfflinePayment/Config/config.php
deleted file mode 100644
index f580eb589..000000000
--- a/modules/OfflinePayment/Config/config.php
+++ /dev/null
@@ -1,7 +0,0 @@
- 'OfflinePayment',
-
-];
diff --git a/modules/OfflinePayment/Console/.gitkeep b/modules/OfflinePayment/Console/.gitkeep
deleted file mode 100644
index e69de29bb..000000000
diff --git a/modules/OfflinePayment/Database/Migrations/.gitkeep b/modules/OfflinePayment/Database/Migrations/.gitkeep
deleted file mode 100644
index e69de29bb..000000000
diff --git a/modules/OfflinePayment/Database/Seeders/.gitkeep b/modules/OfflinePayment/Database/Seeders/.gitkeep
deleted file mode 100644
index e69de29bb..000000000
diff --git a/modules/OfflinePayment/Entities/.gitkeep b/modules/OfflinePayment/Entities/.gitkeep
deleted file mode 100644
index e69de29bb..000000000
diff --git a/modules/OfflinePayment/Events/.gitkeep b/modules/OfflinePayment/Events/.gitkeep
deleted file mode 100644
index e69de29bb..000000000
diff --git a/modules/OfflinePayment/Events/Handlers/.gitkeep b/modules/OfflinePayment/Events/Handlers/.gitkeep
deleted file mode 100644
index e69de29bb..000000000
diff --git a/modules/OfflinePayment/Http/Controllers/.gitkeep b/modules/OfflinePayment/Http/Controllers/.gitkeep
deleted file mode 100644
index e69de29bb..000000000
diff --git a/modules/OfflinePayment/Http/Controllers/OfflinePayment.php b/modules/OfflinePayment/Http/Controllers/OfflinePayment.php
index 61218ae71..4074a37d8 100644
--- a/modules/OfflinePayment/Http/Controllers/OfflinePayment.php
+++ b/modules/OfflinePayment/Http/Controllers/OfflinePayment.php
@@ -4,7 +4,6 @@ namespace Modules\OfflinePayment\Http\Controllers;
use App\Events\InvoicePaid;
-use Illuminate\Http\Response;
use Illuminate\Routing\Controller;
use Illuminate\Http\Request;
@@ -16,11 +15,12 @@ use SignedUrl;
class OfflinePayment extends Controller
{
+
/**
* Show the form for editing the specified resource.
* @param Invoice
* @param PaymentRequest
- * @return Response
+ * @return JSON
*/
public function show(Invoice $invoice, PaymentRequest $request)
{
@@ -46,11 +46,12 @@ class OfflinePayment extends Controller
'html' => $html,
]);
}
+
/**
* Show the form for editing the specified resource.
* @param $invoice
* @param $request
- * @return Response
+ * @return JSON
*/
public function link(Invoice $invoice, PaymentRequest $request)
{
diff --git a/modules/OfflinePayment/Http/Controllers/Settings.php b/modules/OfflinePayment/Http/Controllers/Settings.php
index b0b14e110..9e5fca632 100644
--- a/modules/OfflinePayment/Http/Controllers/Settings.php
+++ b/modules/OfflinePayment/Http/Controllers/Settings.php
@@ -12,6 +12,7 @@ use Modules\OfflinePayment\Http\Requests\SettingDelete as DRequest;
class Settings extends Controller
{
+
/**
* Show the form for editing the specified resource.
*
@@ -66,7 +67,7 @@ class Settings extends Controller
Artisan::call('cache:clear');
- return redirect('apps/offlinepayment/settings');
+ return redirect()->route('offlinepayment.edit');
}
/**
diff --git a/modules/OfflinePayment/Http/Middleware/.gitkeep b/modules/OfflinePayment/Http/Middleware/.gitkeep
deleted file mode 100644
index e69de29bb..000000000
diff --git a/modules/OfflinePayment/Http/Requests/.gitkeep b/modules/OfflinePayment/Http/Requests/.gitkeep
deleted file mode 100644
index e69de29bb..000000000
diff --git a/modules/OfflinePayment/Http/routes.php b/modules/OfflinePayment/Http/routes.php
index c2c27f400..0dc0b97f7 100644
--- a/modules/OfflinePayment/Http/routes.php
+++ b/modules/OfflinePayment/Http/routes.php
@@ -1,18 +1,30 @@
['web', 'auth', 'language', 'adminmenu', 'permission:read-admin-panel'], 'prefix' => 'apps/offlinepayment', 'namespace' => 'Modules\OfflinePayment\Http\Controllers'], function () {
- Route::get('settings', 'Settings@edit');
- Route::post('settings', 'Settings@update');
- Route::post('settings/get', 'Settings@get');
- Route::post('settings/delete', 'Settings@delete');
+Route::group([
+ 'middleware' => 'admin',
+ 'prefix' => 'apps/offlinepayment',
+ 'namespace' => 'Modules\OfflinePayment\Http\Controllers'
+], function () {
+ Route::get('settings', 'Settings@edit')->name('offlinepayment.edit');
+ Route::post('settings', 'Settings@update')->name('offlinepayment.update');
+ Route::post('settings/get', 'Settings@get')->name('offlinepayment.get');
+ Route::post('settings/delete', 'Settings@delete')->name('offlinepayment.delete');
});
-Route::group(['middleware' => ['web', 'auth', 'language', 'customermenu', 'permission:read-customer-panel'], 'prefix' => 'customers', 'namespace' => 'Modules\OfflinePayment\Http\Controllers'], function () {
+Route::group([
+ 'middleware' => ['web', 'auth', 'language', 'customermenu', 'permission:read-customer-panel'],
+ 'prefix' => 'customers',
+ 'namespace' => 'Modules\OfflinePayment\Http\Controllers'
+], function () {
Route::get('invoices/{invoice}/offlinepayment', 'OfflinePayment@show');
Route::post('invoices/{invoice}/offlinepayment/confirm', 'OfflinePayment@confirm');
});
-Route::group(['middleware' => ['web', 'language'], 'prefix' => 'links', 'namespace' => 'Modules\OfflinePayment\Http\Controllers'], function () {
+Route::group([
+ 'middleware' => ['web', 'language'],
+ 'prefix' => 'links',
+ 'namespace' => 'Modules\OfflinePayment\Http\Controllers'
+], function () {
Route::group(['middleware' => 'signed-url'], function () {
Route::post('invoices/{invoice}/offlinepayment', 'OfflinePayment@link');
Route::post('invoices/{invoice}/offlinepayment/confirm', 'OfflinePayment@confirm');
diff --git a/modules/OfflinePayment/Jobs/.gitkeep b/modules/OfflinePayment/Jobs/.gitkeep
deleted file mode 100644
index e69de29bb..000000000
diff --git a/modules/OfflinePayment/Events/Handlers/OfflinePaymentAdminMenu.php b/modules/OfflinePayment/Listeners/AdminMenu.php
similarity index 73%
rename from modules/OfflinePayment/Events/Handlers/OfflinePaymentAdminMenu.php
rename to modules/OfflinePayment/Listeners/AdminMenu.php
index 3ad2fb310..69b049221 100644
--- a/modules/OfflinePayment/Events/Handlers/OfflinePaymentAdminMenu.php
+++ b/modules/OfflinePayment/Listeners/AdminMenu.php
@@ -1,12 +1,12 @@
user();
// Settings
if ($user->can(['read-settings-settings', 'read-settings-categories', 'read-settings-currencies', 'read-settings-taxes'])) {
// Add child to existing item
$item = $event->menu->whereTitle(trans_choice('general.settings', 2));
- $item->url('apps/offlinepayment/settings', trans('offlinepayment::offlinepayment.offlinepayment'), 4, ['icon' => 'fa fa-angle-double-right']);
+ $item->url('apps/offlinepayment/settings', trans('offlinepayment::general.title'), 4, ['icon' => 'fa fa-angle-double-right']);
}
}
}
diff --git a/modules/OfflinePayment/Events/Handlers/OfflinePaymentGateway.php b/modules/OfflinePayment/Listeners/Gateway.php
similarity index 79%
rename from modules/OfflinePayment/Events/Handlers/OfflinePaymentGateway.php
rename to modules/OfflinePayment/Listeners/Gateway.php
index eaf12a187..4c0b51511 100644
--- a/modules/OfflinePayment/Events/Handlers/OfflinePaymentGateway.php
+++ b/modules/OfflinePayment/Listeners/Gateway.php
@@ -1,10 +1,10 @@
registerTranslations();
- $this->registerConfig();
$this->registerViews();
- $this->registerFactories();
-
- $this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
-
- $this->app['events']->listen(AdminMenuCreated::class, OfflinePaymentAdminMenu::class);
- $this->app['events']->listen(PaymentGatewayListing::class, OfflinePaymentGateway::class);
+ $this->registerMigrations();
+ $this->registerEvents();
}
/**
@@ -48,21 +40,6 @@ class OfflinePaymentServiceProvider extends ServiceProvider
//
}
- /**
- * Register config.
- *
- * @return void
- */
- protected function registerConfig()
- {
- $this->publishes([
- __DIR__.'/../Config/config.php' => config_path('offlinepayment.php'),
- ], 'config');
- $this->mergeConfigFrom(
- __DIR__.'/../Config/config.php', 'offlinepayment'
- );
- }
-
/**
* Register views.
*
@@ -99,15 +76,15 @@ class OfflinePaymentServiceProvider extends ServiceProvider
}
}
- /**
- * Register an additional directory of factories.
- * @source https://github.com/sebastiaanluca/laravel-resource-flow/blob/develop/src/Modules/ModuleServiceProvider.php#L66
- */
- public function registerFactories()
+ public function registerMigrations()
{
- if (! app()->environment('production')) {
- app(Factory::class)->load(__DIR__ . '/Database/factories');
- }
+ $this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
+ }
+
+ public function registerEvents()
+ {
+ $this->app['events']->listen(AdminMenuCreated::class, AdminMenu::class);
+ $this->app['events']->listen(PaymentGatewayListing::class, Gateway::class);
}
/**
diff --git a/modules/OfflinePayment/Repositories/.gitkeep b/modules/OfflinePayment/Repositories/.gitkeep
deleted file mode 100644
index e69de29bb..000000000
diff --git a/modules/OfflinePayment/Resources/lang/.gitkeep b/modules/OfflinePayment/Resources/lang/.gitkeep
deleted file mode 100644
index e69de29bb..000000000
diff --git a/modules/OfflinePayment/Resources/lang/en-GB/general.php b/modules/OfflinePayment/Resources/lang/en-GB/general.php
new file mode 100644
index 000000000..1a159e418
--- /dev/null
+++ b/modules/OfflinePayment/Resources/lang/en-GB/general.php
@@ -0,0 +1,21 @@
+ 'Offline Payments',
+
+ 'add_new' => 'Add New',
+ 'edit' => 'Edit: :method',
+
+ 'form' => [
+ 'code' => 'Code',
+ 'customer' => 'Show to Customer',
+ 'order' => 'Order'
+ ],
+
+ 'payment_gateways' => 'Offline Payment Methods',
+
+ 'confirm' => 'Confirm',
+ 'loading' => 'Loading',
+
+];
diff --git a/modules/OfflinePayment/Resources/lang/en-GB/offlinepayment.php b/modules/OfflinePayment/Resources/lang/en-GB/offlinepayment.php
deleted file mode 100644
index 541a5c57c..000000000
--- a/modules/OfflinePayment/Resources/lang/en-GB/offlinepayment.php
+++ /dev/null
@@ -1,16 +0,0 @@
- 'Offline Payments',
- 'add_new' => 'Add New',
- 'edit' => 'Edit: :method',
- 'code' => 'Code',
- 'customer' => 'Show to Customer',
- 'order' => 'Order',
- 'payment_gateways' => 'Offline Payment Methods',
-
- 'confirm' => 'Confirm',
- 'loading' => 'Loading',
-
-];
diff --git a/modules/OfflinePayment/Resources/views/.gitkeep b/modules/OfflinePayment/Resources/views/.gitkeep
deleted file mode 100644
index e69de29bb..000000000
diff --git a/modules/OfflinePayment/Resources/views/confirm.blade.php b/modules/OfflinePayment/Resources/views/confirm.blade.php
index 7ab1f30bf..793869e38 100644
--- a/modules/OfflinePayment/Resources/views/confirm.blade.php
+++ b/modules/OfflinePayment/Resources/views/confirm.blade.php
@@ -4,4 +4,4 @@
{{ $gateway['description'] }}
-@endif
\ No newline at end of file
+@endif
diff --git a/modules/OfflinePayment/Resources/views/edit.blade.php b/modules/OfflinePayment/Resources/views/edit.blade.php
index c7dfd9be3..be5e0b6e2 100644
--- a/modules/OfflinePayment/Resources/views/edit.blade.php
+++ b/modules/OfflinePayment/Resources/views/edit.blade.php
@@ -1,29 +1,29 @@
@extends('layouts.admin')
-@section('title', trans('offlinepayment::offlinepayment.offlinepayment'))
+@section('title', trans('offlinepayment::general.title'))
@section('content')
- {!! Form::open(['url' => 'apps/offlinepayment/settings', 'files' => true, 'role' => 'form']) !!}
+ {!! Form::open(['route' => 'offlinepayment.update', 'files' => true, 'role' => 'form', 'class' => 'form-loading-button']) !!}
{{ Form::textGroup('name', trans('general.name'), 'id-card-o', ['required' => 'required'], null, 'col-md-12') }}
- {{ Form::textGroup('code', trans('offlinepayment::offlinepayment.code'), 'key', ['required' => 'required'], null, 'col-md-12') }}
+ {{ Form::textGroup('code', trans('offlinepayment::general.form.code'), 'key', ['required' => 'required'], null, 'col-md-12') }}
- {{ Form::radioGroup('customer', trans('offlinepayment::offlinepayment.customer'), '', ['required' => 'required'], 0, 'col-md-12') }}
+ {{ Form::radioGroup('customer', trans('offlinepayment::general.form.customer'), '', ['required' => 'required'], 0, 'col-md-12') }}
- {{ Form::textGroup('order', trans('offlinepayment::offlinepayment.order'), 'sort', [], null, 'col-md-12') }}
+ {{ Form::textGroup('order', trans('offlinepayment::general.form.order'), 'sort', [], null, 'col-md-12') }}
{{ Form::textareaGroup('description', trans('general.description')) }}
@@ -38,22 +38,25 @@
+
+
+
{{ trans('general.name') }}
- {{ trans('offlinepayment::offlinepayment.code') }}
- {{ trans('offlinepayment::offlinepayment.order') }}
+ {{ trans('offlinepayment::general.form.code') }}
+ {{ trans('offlinepayment::general.form.order') }}
{{ trans('general.actions') }}
@@ -86,13 +89,14 @@
@push('stylesheet')
@endpush
@@ -115,22 +123,25 @@
@endpush
diff --git a/resources/views/expenses/bills/create.blade.php b/resources/views/expenses/bills/create.blade.php
index e1d8a20f9..3e8657e7b 100644
--- a/resources/views/expenses/bills/create.blade.php
+++ b/resources/views/expenses/bills/create.blade.php
@@ -223,7 +223,7 @@
},
language: {
noResults: function () {
- return ' {{ trans('general.title.new', ['type' => trans_choice('general.tax_rates', 1)]) }} ';
+ return ' {{ trans('general.title.new', ['type' => trans_choice('general.tax_rates', 1)]) }} ';
}
}
});
diff --git a/resources/views/expenses/bills/edit.blade.php b/resources/views/expenses/bills/edit.blade.php
index 56caa5718..099f41e16 100644
--- a/resources/views/expenses/bills/edit.blade.php
+++ b/resources/views/expenses/bills/edit.blade.php
@@ -204,7 +204,7 @@
},
language: {
noResults: function () {
- return ' {{ trans('general.title.new', ['type' => trans_choice('general.tax_rates', 1)]) }} ';
+ return ' {{ trans('general.title.new', ['type' => trans_choice('general.tax_rates', 1)]) }} ';
}
}
});
@@ -314,7 +314,7 @@
},
language: {
noResults: function () {
- return ' {{ trans('general.title.new', ['type' => trans_choice('general.tax_rates', 1)]) }} ';
+ return ' {{ trans('general.title.new', ['type' => trans_choice('general.tax_rates', 1)]) }} ';
}
}
});
diff --git a/resources/views/expenses/bills/item.blade.php b/resources/views/expenses/bills/item.blade.php
index f4763923b..528c1d439 100644
--- a/resources/views/expenses/bills/item.blade.php
+++ b/resources/views/expenses/bills/item.blade.php
@@ -18,7 +18,7 @@
@stack('quantity_td_start')
has('item.' . $item_row . '.quantity') ? 'class="has-error"' : '' }}>
@stack('quantity_input_start')
-
+
{!! $errors->first('item.' . $item_row . '.quantity', ':message
') !!}
@stack('quantity_input_end')
diff --git a/resources/views/expenses/bills/show.blade.php b/resources/views/expenses/bills/show.blade.php
index 9b3168f2b..489feb93f 100644
--- a/resources/views/expenses/bills/show.blade.php
+++ b/resources/views/expenses/bills/show.blade.php
@@ -29,7 +29,7 @@
-
+
{{ trans_choice('general.statuses', 1) . ': ' . trans('bills.messages.status.created', ['date' => Date::parse($bill->created_at)->format($date_format)]) }}
@@ -44,7 +44,7 @@
-
+
@if ($bill->status->code == 'draft')
@@ -63,7 +63,7 @@
-
+
@if($bill->status->code != 'paid' && empty($bill->payments()->count()))
diff --git a/resources/views/incomes/invoices/create.blade.php b/resources/views/incomes/invoices/create.blade.php
index 86b0fda7c..c21119f06 100644
--- a/resources/views/incomes/invoices/create.blade.php
+++ b/resources/views/incomes/invoices/create.blade.php
@@ -223,7 +223,7 @@
},
language: {
noResults: function () {
- return '
{{ trans('general.title.new', ['type' => trans_choice('general.tax_rates', 1)]) }} ';
+ return '
{{ trans('general.title.new', ['type' => trans_choice('general.tax_rates', 1)]) }}';
}
}
});
@@ -306,7 +306,7 @@
},
language: {
noResults: function () {
- return '
{{ trans('general.title.new', ['type' => trans_choice('general.tax_rates', 1)]) }} ';
+ return '
{{ trans('general.title.new', ['type' => trans_choice('general.tax_rates', 1)]) }}';
}
}
});
@@ -403,6 +403,7 @@
$(document).on('click', '#cancel-discount', function(){
$('#discount').val('');
+
totalItem();
$('a[rel=popover]').trigger('click');
diff --git a/resources/views/incomes/invoices/edit.blade.php b/resources/views/incomes/invoices/edit.blade.php
index 0da09adeb..3f1489644 100644
--- a/resources/views/incomes/invoices/edit.blade.php
+++ b/resources/views/incomes/invoices/edit.blade.php
@@ -204,7 +204,7 @@
},
language: {
noResults: function () {
- return '
{{ trans('general.title.new', ['type' => trans_choice('general.tax_rates', 1)]) }} ';
+ return '
{{ trans('general.title.new', ['type' => trans_choice('general.tax_rates', 1)]) }}';
}
}
});
@@ -314,7 +314,7 @@
},
language: {
noResults: function () {
- return '
{{ trans('general.title.new', ['type' => trans_choice('general.tax_rates', 1)]) }} ';
+ return '
{{ trans('general.title.new', ['type' => trans_choice('general.tax_rates', 1)]) }}';
}
}
});
diff --git a/resources/views/incomes/invoices/item.blade.php b/resources/views/incomes/invoices/item.blade.php
index 8c9bf2970..2daa215f1 100644
--- a/resources/views/incomes/invoices/item.blade.php
+++ b/resources/views/incomes/invoices/item.blade.php
@@ -18,7 +18,7 @@
@stack('quantity_td_start')
has('item.' . $item_row . '.quantity') ? 'class="has-error"' : '' }}>
@stack('quantity_input_start')
-
+
{!! $errors->first('item.' . $item_row . '.quantity', ':message
') !!}
@stack('quantity_input_end')
diff --git a/resources/views/incomes/invoices/show.blade.php b/resources/views/incomes/invoices/show.blade.php
index 058d014ab..ca230a31f 100644
--- a/resources/views/incomes/invoices/show.blade.php
+++ b/resources/views/incomes/invoices/show.blade.php
@@ -29,7 +29,7 @@
-
+
{{ trans_choice('general.statuses', 1) . ': ' . trans('invoices.messages.status.created', ['date' => Date::parse($invoice->created_at)->format($date_format)]) }}
@@ -44,7 +44,7 @@
-
+
@if ($invoice->status->code != 'sent' && $invoice->status->code != 'partial')
@@ -74,7 +74,7 @@
-
+
@if($invoice->status->code != 'paid' && empty($invoice->payments()->count()))
diff --git a/resources/views/layouts/admin.blade.php b/resources/views/layouts/admin.blade.php
index d7e792cb8..29a46a36a 100644
--- a/resources/views/layouts/admin.blade.php
+++ b/resources/views/layouts/admin.blade.php
@@ -1,4 +1,4 @@
-
+
@include('partials.admin.head')
diff --git a/resources/views/layouts/auth.blade.php b/resources/views/layouts/auth.blade.php
index 764ba35ce..39d33605b 100644
--- a/resources/views/layouts/auth.blade.php
+++ b/resources/views/layouts/auth.blade.php
@@ -1,4 +1,4 @@
-
+
@include('partials.auth.head')
diff --git a/resources/views/layouts/bill.blade.php b/resources/views/layouts/bill.blade.php
index fdb27abf1..6d0794ada 100644
--- a/resources/views/layouts/bill.blade.php
+++ b/resources/views/layouts/bill.blade.php
@@ -1,4 +1,4 @@
-
+
@include('partials.bill.head')
diff --git a/resources/views/layouts/customer.blade.php b/resources/views/layouts/customer.blade.php
index 508f273f9..322e4c169 100644
--- a/resources/views/layouts/customer.blade.php
+++ b/resources/views/layouts/customer.blade.php
@@ -1,4 +1,4 @@
-
+
@include('partials.customer.head')
diff --git a/resources/views/layouts/invoice.blade.php b/resources/views/layouts/invoice.blade.php
index de9e5a0f9..1faa39b20 100644
--- a/resources/views/layouts/invoice.blade.php
+++ b/resources/views/layouts/invoice.blade.php
@@ -1,4 +1,4 @@
-
+
@include('partials.invoice.head')
diff --git a/resources/views/layouts/link.blade.php b/resources/views/layouts/link.blade.php
index b49a34515..b2e367c51 100644
--- a/resources/views/layouts/link.blade.php
+++ b/resources/views/layouts/link.blade.php
@@ -1,4 +1,4 @@
-
+
@include('partials.link.head')
diff --git a/resources/views/layouts/modules.blade.php b/resources/views/layouts/modules.blade.php
index 927d517a4..87566dbca 100644
--- a/resources/views/layouts/modules.blade.php
+++ b/resources/views/layouts/modules.blade.php
@@ -1,4 +1,4 @@
-
+
@include('partials.modules.head')
diff --git a/resources/views/layouts/print.blade.php b/resources/views/layouts/print.blade.php
index cbcb4ad4b..06685cd12 100644
--- a/resources/views/layouts/print.blade.php
+++ b/resources/views/layouts/print.blade.php
@@ -1,4 +1,4 @@
-
+
@include('partials.admin.head')
@push('css')
diff --git a/resources/views/layouts/wizard.blade.php b/resources/views/layouts/wizard.blade.php
index 278b51d48..49de44e7b 100644
--- a/resources/views/layouts/wizard.blade.php
+++ b/resources/views/layouts/wizard.blade.php
@@ -1,4 +1,4 @@
-
+
@include('partials.wizard.head')
diff --git a/resources/views/modules/home/index.blade.php b/resources/views/modules/home/index.blade.php
index 38db3756e..11d966195 100644
--- a/resources/views/modules/home/index.blade.php
+++ b/resources/views/modules/home/index.blade.php
@@ -11,6 +11,7 @@
@include('partials.modules.bar')
+ @if ($paid)
+ @endif
+ @if ($new)
+ @endif
+ @if ($free)
+ @endif
@endsection
\ No newline at end of file
diff --git a/resources/views/modules/item/show.blade.php b/resources/views/modules/item/show.blade.php
index c660f56a2..9c1bfb506 100644
--- a/resources/views/modules/item/show.blade.php
+++ b/resources/views/modules/item/show.blade.php
@@ -146,12 +146,14 @@
@if ($module->price == '0.0000')
{{ trans('modules.free') }}
@else
+ {!! $module->price_prefix !!}
@if (isset($module->special_price))
{{ $module->price }}
{{ $module->special_price }}
@else
{{ $module->price }}
@endif
+ {!! $module->price_suffix !!}
@endif
@@ -205,7 +207,7 @@
@if ($module->vendor_name)
- {{ trans_choice('general.vendors', 1) }}
+ {{ trans_choice('general.developers', 1) }}
{{ $module->vendor_name }}
@endif
diff --git a/resources/views/modules/token/create.blade.php b/resources/views/modules/token/create.blade.php
index 26fc269f3..08852d296 100644
--- a/resources/views/modules/token/create.blade.php
+++ b/resources/views/modules/token/create.blade.php
@@ -9,7 +9,7 @@
diff --git a/resources/views/partials/modules/reviews.blade.php b/resources/views/partials/modules/reviews.blade.php
index eaee484f3..2e125d8f5 100644
--- a/resources/views/partials/modules/reviews.blade.php
+++ b/resources/views/partials/modules/reviews.blade.php
@@ -1,60 +1,62 @@
@foreach($reviews->data as $review)
-
-
-
-
- {{ $review->author }}
-
- @for($i = 1; $i <= $review->rating; $i++)
-
- @endfor
- @for($i = $review->rating; $i < 5; $i++)
-
- @endfor
-
+
+
+
+
+ {{ $review->author }}
+
+ @for($i = 1; $i <= $review->rating; $i++)
+
+ @endfor
+ @for($i = $review->rating; $i < 5; $i++)
+
+ @endfor
- {{ \Carbon\Carbon::parse($review->created_at)->format('F d, Y') }}
-
-
-
- {!! nl2br($review->text) !!}
-
+
+
{{ Date::parse($review->created_at)->format($date_format) }}
+
+ {!! nl2br($review->text) !!}
+
+
@endforeach
@stack('pagination_start')
+
@php
$review_first_item = count($reviews->data) > 0 ? ($reviews->current_page - 1) * $reviews->per_page + 1 : null;
$review_last_item = count($reviews->data) > 0 ? $review_first_item + count($reviews->data) - 1 : null;
@endphp
+
@if ($review_first_item)
{{ trans('pagination.showing', ['first' => $review_first_item, 'last' => $review_last_item, 'total' => $reviews->total, 'type' => strtolower(trans('modules.tab.reviews'))]) }}
+
@@ -65,4 +67,4 @@
@endif
@stack('pagination_end')
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/resources/views/wizard/taxes/create.blade.php b/resources/views/wizard/taxes/create.blade.php
index 893cf5658..fb3039fa6 100644
--- a/resources/views/wizard/taxes/create.blade.php
+++ b/resources/views/wizard/taxes/create.blade.php
@@ -4,6 +4,7 @@
{{ Form::textGroup('rate', trans('currencies.rate'), 'money', ['required' => 'required'], null, '') }}
+ {{ Form::hidden('type', 'normal') }}
{{ Form::radioGroup('enabled', trans('general.enabled'), trans('general.yes'), trans('general.no'), [], 'col-md-12 tax-enabled-radio-group') }}
diff --git a/resources/views/wizard/taxes/edit.blade.php b/resources/views/wizard/taxes/edit.blade.php
index 21a5981c7..ac1e03f6f 100644
--- a/resources/views/wizard/taxes/edit.blade.php
+++ b/resources/views/wizard/taxes/edit.blade.php
@@ -4,6 +4,7 @@
{{ Form::textGroup('rate', trans('currencies.rate'), 'money', ['required' => 'required'], $item->rate, '') }}
+ {{ Form::hidden('type', 'normal') }}
{{ Form::radioGroup('enabled', trans('general.enabled'), trans('general.yes'), trans('general.no'), [], 'col-md-12') }}
diff --git a/routes/web.php b/routes/web.php
index eb2910458..737cbc61c 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -237,7 +237,7 @@ Route::group(['middleware' => 'language'], function () {
});
});
- Route::group(['middleware' => 'signed-url'], function () {
+ Route::group(['middleware' => 'signed'], function () {
Route::group(['prefix' => 'links'], function () {
Route::get('invoices/{invoice}', 'Customers\Invoices@link');
Route::get('invoices/{invoice}/print', 'Customers\Invoices@printInvoice');
diff --git a/storage/fonts/.gitignore b/storage/fonts/.gitignore
new file mode 100644
index 000000000..d6b7ef32c
--- /dev/null
+++ b/storage/fonts/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore
diff --git a/tests/Feature/Auth/LoginTest.php b/tests/Feature/Auth/LoginTest.php
new file mode 100644
index 000000000..89db499a5
--- /dev/null
+++ b/tests/Feature/Auth/LoginTest.php
@@ -0,0 +1,64 @@
+get(route('login'))
+ ->assertStatus(200)
+ ->assertSeeText(trans('auth.login_to'));
+ }
+
+ public function testItShouldLoginUser()
+ {
+ $this->post(route('login'), ['email' => $this->user->email, 'password' => $this->user->password])
+ ->assertStatus(302)
+ ->assertRedirect(url('/'));
+
+ $this->isAuthenticated($this->user->user);
+ }
+
+ public function testItShouldNotLoginUser()
+ {
+ $user = factory(User::class)->create([
+ 'password' => bcrypt($password = 'correct-password'),
+ ]);
+
+ $this->post(route('login'), ['email' => $user->email, 'password' != $user->password = $password])
+ ->assertStatus(302);
+
+ $this->dontSeeIsAuthenticated();
+ }
+
+ public function testItShouldLogoutUser()
+ {
+ $user = User::create($this->getLoginRequest());
+
+ $this->loginAs()
+ ->get(route('logout',$user->id))
+ ->assertStatus(302)
+ ->assertRedirect(route('login'));
+
+ $this->dontSeeIsAuthenticated();
+ }
+
+ private function getLoginRequest()
+ {
+ $password = $this->faker->password();
+ return[
+ 'name' => $this->faker->name,
+ 'email' => $this->faker->email,
+ 'password' => $password,
+ 'companies' => [session('company_id')],
+ 'roles' => Role::take(1)->pluck('id')->toArray(),
+ 'enabled' => $this->faker->boolean ? 1 : 0,
+ ];
+ }
+}
\ No newline at end of file
diff --git a/tests/Feature/Common/ItemsTest.php b/tests/Feature/Common/ItemsTest.php
index 5ff8188c9..83946c4a9 100644
--- a/tests/Feature/Common/ItemsTest.php
+++ b/tests/Feature/Common/ItemsTest.php
@@ -86,7 +86,7 @@ class ItemsTest extends FeatureTestCase
'sale_price' => $this->faker->randomFloat(2, 10, 20),
'quantity' => $this->faker->randomNumber(2),
'category_id' => $this->company->categories()->type('item')->first()->id,
- 'tax_id' => $this->company->taxes()->enabled()->first()->id,
+ 'tax_id' => '',
'enabled' => $this->faker->boolean ? 1 : 0
];
}