1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Hide purge/delete buttons on Ninja accounts

This commit is contained in:
Hillel Coren 2017-07-02 20:44:56 +03:00
parent 9a21f754d5
commit 23a19be9e9
2 changed files with 77 additions and 67 deletions

View File

@ -967,6 +967,14 @@ class Account extends Eloquent
return strpos($this->account_key, 'zg4ylmzDkdkPOT8yoKQw9LTWaoZJx7') === 0;
}
/**
* @return bool
*/
public function isNinjaOrLicenseAccount()
{
return $this->isNinjaAccount() || $this->account_key == NINJA_LICENSE_ACCOUNT_KEY;
}
/**
* @param $plan
*/

View File

@ -226,84 +226,86 @@
{!! Former::close() !!}
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.delete_data') !!}</h3>
</div>
<div class="panel-body">
{!! Former::open('settings/purge_data')->addClass('purge-data') !!}
{!! Former::actions(
Button::danger(trans('texts.purge_data'))
->withAttributes(['onclick' => 'showPurgeConfirm()'])
->appendIcon(Icon::create('trash'))
->large()
) !!}
<div class="form-group">
<div class="col-lg-8 col-sm-8 col-lg-offset-4 col-sm-offset-4">
<span class="help-block">{{ trans('texts.purge_data_help')}}</span>
</div>
@if (! Auth::user()->account->isNinjaOrLicenseAccount())
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.delete_data') !!}</h3>
</div>
<br/>
<div class="modal fade" id="confirmPurgeModal" tabindex="-1" role="dialog" aria-labelledby="confirmPurgeModalLabel" aria-hidden="true">
<div class="modal-dialog" style="min-width:150px">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="confirmPurgeModalLabel">{!! trans('texts.purge_data') !!}</h4>
</div>
<div class="container" style="width: 100%; padding-bottom: 0px !important">
<div class="panel panel-default">
<div class="panel-body">
<p><b>{{ trans('texts.purge_data_message') }}</b></p>
<br/>
</div>
</div>
</div>
<div class="modal-footer" style="margin-top: 2px">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('texts.go_back') }}</button>
<button type="button" class="btn btn-danger" onclick="confirmPurge()">{{ trans('texts.purge_data') }}</button>
<div class="panel-body">
{!! Former::open('settings/purge_data')->addClass('purge-data') !!}
{!! Former::actions(
Button::danger(trans('texts.purge_data'))
->withAttributes(['onclick' => 'showPurgeConfirm()'])
->appendIcon(Icon::create('trash'))
->large()
) !!}
<div class="form-group">
<div class="col-lg-8 col-sm-8 col-lg-offset-4 col-sm-offset-4">
<span class="help-block">{{ trans('texts.purge_data_help')}}</span>
</div>
</div>
<br/>
<div class="modal fade" id="confirmPurgeModal" tabindex="-1" role="dialog" aria-labelledby="confirmPurgeModalLabel" aria-hidden="true">
<div class="modal-dialog" style="min-width:150px">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="confirmPurgeModalLabel">{!! trans('texts.purge_data') !!}</h4>
</div>
<div class="container" style="width: 100%; padding-bottom: 0px !important">
<div class="panel panel-default">
<div class="panel-body">
<p><b>{{ trans('texts.purge_data_message') }}</b></p>
<br/>
</div>
</div>
</div>
<div class="modal-footer" style="margin-top: 2px">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('texts.go_back') }}</button>
<button type="button" class="btn btn-danger" onclick="confirmPurge()">{{ trans('texts.purge_data') }}</button>
</div>
</div>
</div>
</div>
</div>
{!! Former::close() !!}
{!! Former::close() !!}
{!! Former::open('settings/cancel_account')->addClass('cancel-account') !!}
{!! Former::actions( Button::danger(trans('texts.cancel_account'))->large()->withAttributes(['onclick' => 'showCancelConfirm()'])->appendIcon(Icon::create('trash'))) !!}
<div class="form-group">
<div class="col-lg-8 col-sm-8 col-lg-offset-4 col-sm-offset-4">
<span class="help-block">{{ trans('texts.cancel_account_help')}}</span>
{!! Former::open('settings/cancel_account')->addClass('cancel-account') !!}
{!! Former::actions( Button::danger(trans('texts.cancel_account'))->large()->withAttributes(['onclick' => 'showCancelConfirm()'])->appendIcon(Icon::create('trash'))) !!}
<div class="form-group">
<div class="col-lg-8 col-sm-8 col-lg-offset-4 col-sm-offset-4">
<span class="help-block">{{ trans('texts.cancel_account_help')}}</span>
</div>
</div>
</div>
<div class="modal fade" id="confirmCancelModal" tabindex="-1" role="dialog" aria-labelledby="confirmCancelModalLabel" aria-hidden="true">
<div class="modal-dialog" style="min-width:150px">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="confirmCancelModalLabel">{!! trans('texts.cancel_account') !!}</h4>
</div>
<div class="container" style="width: 100%; padding-bottom: 0px !important">
<div class="panel panel-default">
<div class="panel-body">
<p><b>{{ trans('texts.cancel_account_message') }}</b></p><br/>
<p>{!! Former::textarea('reason')
->placeholder(trans('texts.reason_for_canceling'))
->raw()
->rows(4) !!}</p>
<br/>
</div>
</div>
</div>
<div class="modal-footer" style="margin-top: 2px">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('texts.go_back') }}</button>
<button type="button" class="btn btn-danger" onclick="confirmCancel()">{{ trans('texts.cancel_account') }}</button>
<div class="modal fade" id="confirmCancelModal" tabindex="-1" role="dialog" aria-labelledby="confirmCancelModalLabel" aria-hidden="true">
<div class="modal-dialog" style="min-width:150px">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="confirmCancelModalLabel">{!! trans('texts.cancel_account') !!}</h4>
</div>
<div class="container" style="width: 100%; padding-bottom: 0px !important">
<div class="panel panel-default">
<div class="panel-body">
<p><b>{{ trans('texts.cancel_account_message') }}</b></p><br/>
<p>{!! Former::textarea('reason')
->placeholder(trans('texts.reason_for_canceling'))
->raw()
->rows(4) !!}</p>
<br/>
</div>
</div>
</div>
<div class="modal-footer" style="margin-top: 2px">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('texts.go_back') }}</button>
<button type="button" class="btn btn-danger" onclick="confirmCancel()">{{ trans('texts.cancel_account') }}</button>
</div>
</div>
</div>
</div>
{!! Former::close() !!}
</div>
{!! Former::close() !!}
</div>
</div>
@endif
</div>
</div>