mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-09 20:52:56 +01:00
Adds toggle custom modules on/off, fixes nav issue for disabled modules
Fixes #1994, related to #1992
This commit is contained in:
parent
3fc533bdb7
commit
d7d628f3ca
@ -30,6 +30,7 @@ use App\Ninja\Repositories\ReferralRepository;
|
||||
use App\Services\AuthService;
|
||||
use App\Services\PaymentService;
|
||||
use App\Services\TemplateService;
|
||||
use Nwidart\Modules\Facades\Module;
|
||||
use Auth;
|
||||
use Cache;
|
||||
use File;
|
||||
@ -758,6 +759,20 @@ class AccountController extends BaseController
|
||||
$account = $user->account;
|
||||
$modules = Input::get('modules');
|
||||
|
||||
// get all custom modules, including disabled
|
||||
$custom_modules = collect(Input::get('custom_modules'))->each(function ($item, $key) {
|
||||
$module = Module::find($item);
|
||||
if ($module && $module->disabled()) {
|
||||
$module->enable();
|
||||
}
|
||||
});
|
||||
|
||||
(Module::toCollection()->diff($custom_modules))->each(function ($item, $key) {
|
||||
if ($item->enabled()) {
|
||||
$item->disable();
|
||||
}
|
||||
});
|
||||
|
||||
$user->force_pdfjs = Input::get('force_pdfjs') ? true : false;
|
||||
$user->save();
|
||||
|
||||
|
@ -189,6 +189,14 @@
|
||||
</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@foreach (Module::all() as $value)
|
||||
{{ ($value->boot()) }}
|
||||
<div class="checkbox">
|
||||
<label for="custom_modules_{{ $value }}">
|
||||
<input name="custom_modules[]" id="custom_modules_{{ $value }}" type="checkbox" {{ $value->enabled() ? 'checked="checked"' : '' }} value="{{ $value }}">{{ mtrans($value, $value->getLowerName()) }}
|
||||
</label>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
@ -392,7 +392,7 @@
|
||||
@endif
|
||||
@endforeach
|
||||
@if ( ! Utils::isNinjaProd())
|
||||
@foreach (Module::all() as $module)
|
||||
@foreach (Module::collections() as $module)
|
||||
@include('partials.navigation_option', [
|
||||
'option' => $module->getAlias(),
|
||||
'icon' => $module->get('icon', 'th-large'),
|
||||
|
Loading…
Reference in New Issue
Block a user