mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 17:44:32 -04:00
Merge pull request #1998 from dicarlosystems/1994-allow-toggle-custom-modules-in-settings
Adds toggle custom modules on/off, fixes nav issue for disabled modules
This commit is contained in:
commit
df57974c1b
@ -30,6 +30,7 @@ use App\Ninja\Repositories\ReferralRepository;
|
|||||||
use App\Services\AuthService;
|
use App\Services\AuthService;
|
||||||
use App\Services\PaymentService;
|
use App\Services\PaymentService;
|
||||||
use App\Services\TemplateService;
|
use App\Services\TemplateService;
|
||||||
|
use Nwidart\Modules\Facades\Module;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Cache;
|
use Cache;
|
||||||
use File;
|
use File;
|
||||||
@ -758,6 +759,20 @@ class AccountController extends BaseController
|
|||||||
$account = $user->account;
|
$account = $user->account;
|
||||||
$modules = Input::get('modules');
|
$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->force_pdfjs = Input::get('force_pdfjs') ? true : false;
|
||||||
$user->save();
|
$user->save();
|
||||||
|
|
||||||
|
@ -189,6 +189,14 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
@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>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
@ -392,7 +392,7 @@
|
|||||||
@endif
|
@endif
|
||||||
@endforeach
|
@endforeach
|
||||||
@if ( ! Utils::isNinjaProd())
|
@if ( ! Utils::isNinjaProd())
|
||||||
@foreach (Module::all() as $module)
|
@foreach (Module::collections() as $module)
|
||||||
@include('partials.navigation_option', [
|
@include('partials.navigation_option', [
|
||||||
'option' => $module->getAlias(),
|
'option' => $module->getAlias(),
|
||||||
'icon' => $module->get('icon', 'th-large'),
|
'icon' => $module->get('icon', 'th-large'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user