1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-16 16:13:20 +01:00
invoiceninja/resources/views/accounts/management.blade.php

409 lines
17 KiB
PHP
Raw Normal View History

@extends('header')
2016-06-05 20:05:11 +02:00
@section('content')
@parent
@include('accounts.nav', ['selected' => ACCOUNT_MANAGEMENT])
<div class="row">
<div class="col-md-12">
2016-04-17 00:34:39 +02:00
{!! Former::open('settings/change_plan')->addClass('change-plan') !!}
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.plan_status') !!}</h3>
</div>
<div class="panel-body">
@if (Auth::user()->primaryAccount()->id != Auth::user()->account->id)
<center style="font-size:16px;color:#888888;">
{{ trans('texts.switch_to_primary', ['name' => Auth::user()->primaryAccount()->getDisplayName()]) }}
</center>
@else
2016-04-17 00:34:39 +02:00
<div class="form-group">
<label class="col-sm-4 control-label">{{ trans('texts.plan') }}</label>
2016-04-17 00:34:39 +02:00
<div class="col-sm-8">
<p class="form-control-static">
@if ($planDetails && $planDetails['active'])
{{ trans('texts.plan_'.$planDetails['plan']) }}
@if ($planDetails['trial'])
({{ trans('texts.plan_trial') }})
@elseif ($planDetails['expires'])
({{ trans('texts.plan_term_'.$planDetails['term'].'ly') }})
@endif
@if ($planDetails['plan'] == PLAN_ENTERPRISE)
{{ trans('texts.min_to_max_users', ['min' => Utils::getMinNumUsers($planDetails['num_users']), 'max' => $planDetails['num_users']])}}
@endif
2017-06-13 20:53:54 +02:00
@if ($portalLink)
- {{ link_to($portalLink, trans('texts.view_client_portal'), ['target' => '_blank']) }}
@endif
@elseif(Utils::isNinjaProd())
{{ trans('texts.plan_free') }}
2016-04-17 00:34:39 +02:00
@else
{{ trans('texts.plan_free_self_hosted') }}
2016-04-17 00:34:39 +02:00
@endif
</p>
</div>
</div>
@if ($planDetails && $planDetails['active'])
2016-04-17 04:28:11 +02:00
<div class="form-group">
<label class="col-sm-4 control-label">
{{ trans('texts.renews') }}
2016-04-17 04:28:11 +02:00
</label>
<div class="col-sm-8">
<p class="form-control-static">
@if ($planDetails['expires'] === false)
{{ trans('texts.never') }}
@else
{{ Utils::dateToString($planDetails['expires']) }}
@endif
2016-04-17 04:28:11 +02:00
</p>
</div>
</div>
@if ($account->company->hasActiveDiscount())
{!! Former::plaintext('discount')
->value($account->company->present()->discountMessage) !!}
@endif
@if (Utils::isNinjaProd() && Auth::user()->confirmed)
{!! Former::actions( Button::info(trans('texts.plan_change'))->large()->withAttributes(['onclick' => 'showChangePlan()'])->appendIcon(Icon::create('edit'))) !!}
@endif
@else
@if ($planDetails)
<div class="form-group">
<label class="col-sm-4 control-label">
@if ($planDetails['trial'])
{{ trans('texts.trial_expired', ['plan'=>trans('texts.plan_'.$planDetails['plan'])]) }}
@else
{{ trans('texts.plan_expired', ['plan'=>trans('texts.plan_'.$planDetails['plan'])]) }}
@endif
</label>
<div class="col-sm-8">
<p class="form-control-static">
{{ Utils::dateToString($planDetails['expires']) }}
</p>
</div>
</div>
@endif
@if (Utils::isNinjaProd())
@if (Auth::user()->confirmed)
{!! Former::actions( Button::success(trans('texts.plan_upgrade'))->large()->withAttributes(['onclick' => 'showChangePlan()'])->appendIcon(Icon::create('plus-sign'))) !!}
@endif
@elseif (!$account->hasFeature(FEATURE_WHITE_LABEL))
{!! Former::actions( Button::success(trans('texts.white_label_button'))->large()->withAttributes(['onclick' => 'loadImages("#whiteLabelModal");$("#whiteLabelModal").modal("show");'])->appendIcon(Icon::create('plus-sign'))) !!}
@endif
@endif
2016-04-17 00:34:39 +02:00
@endif
2017-08-22 19:57:53 +02:00
@if (Auth::user()->created_at->diffInMonths() >= 3)
2018-02-20 22:20:38 +01:00
{!! Former::plaintext(' ')->help(trans('texts.review_app_help', ['link' => link_to('http://www.capterra.com/p/145215/Invoice-Ninja', trans('texts.writing_a_review'), ['target' => '_blank'])])) !!}
2017-08-22 19:57:53 +02:00
@endif
</div>
2016-04-17 00:34:39 +02:00
</div>
@if (Utils::isNinjaProd())
2016-04-17 00:34:39 +02:00
<div class="modal fade" id="changePlanModel" tabindex="-1" role="dialog" aria-labelledby="changePlanModelLabel" 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="changePlanModelLabel">
@if ($planDetails && $planDetails['active'])
{!! trans('texts.plan_change') !!}
@else
{!! trans('texts.plan_upgrade') !!}
@endif
</h4>
</div>
2017-02-18 22:20:03 +01:00
<div class="container" style="width: 100%; padding-bottom: 0px !important">
2017-03-26 10:45:17 +02:00
<div class="panel panel-default">
2017-02-18 22:20:03 +01:00
<div class="panel-body">
2016-07-11 19:08:43 +02:00
2016-04-17 00:34:39 +02:00
@if ($planDetails && $planDetails['active'])
2016-07-11 19:08:43 +02:00
{!! Former::select('plan')
->onchange('onPlanChange()')
->addOption(trans('texts.plan_free'), PLAN_FREE)
->addOption(trans('texts.plan_pro'), PLAN_PRO)
->addOption(trans('texts.plan_enterprise'), PLAN_ENTERPRISE) !!}
2016-04-17 00:34:39 +02:00
@else
2016-07-11 19:08:43 +02:00
{!! Former::select('plan')
->onchange('onPlanChange()')
->addOption(trans('texts.plan_pro'), PLAN_PRO)
->addOption(trans('texts.plan_enterprise'), PLAN_ENTERPRISE) !!}
2016-04-17 00:34:39 +02:00
@endif
2016-07-11 19:08:43 +02:00
<div id="numUsersDiv">
{!! Former::select('num_users')
->label(trans('texts.users'))
->addOption('1 to 2', 2)
->addOption('3 to 5', 5)
2017-01-01 19:43:46 +01:00
->addOption('6 to 10', 10)
->addOption('11 to 20', 20) !!}
2016-07-11 19:08:43 +02:00
</div>
2016-04-17 00:34:39 +02:00
{!! Former::select('plan_term')
2016-05-10 20:17:46 +02:00
->addOption(trans('texts.plan_term_monthly'), PLAN_TERM_MONTHLY)
2016-07-04 10:22:10 +02:00
->addOption(trans('texts.plan_term_yearly'), PLAN_TERM_YEARLY)
->inlineHelp(trans('texts.enterprise_plan_features', ['link' => link_to(NINJA_WEB_URL . '/plans-pricing', trans('texts.click_here'), ['target' => '_blank'])])) !!}
2016-07-11 19:08:43 +02:00
2016-12-14 15:19:16 +01:00
{!! Former::plaintext(' ')
->inlineHelp($account->company->present()->promoMessage) !!}
2017-02-18 22:20:03 +01:00
</div>
</div>
2016-04-17 00:34:39 +02:00
</div>
2017-03-26 10:45:17 +02:00
<div class="modal-footer">
2016-07-15 10:24:08 +02:00
@if (Utils::isPro())
<div class="pull-left" style="padding-top: 8px;color:#888888">
{{ trans('texts.changes_take_effect_immediately') }}
</div>
@endif
2016-04-17 00:34:39 +02:00
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('texts.go_back') }}</button>
@if ($planDetails && $planDetails['active'])
2016-06-28 20:22:16 +02:00
<button type="button" class="btn btn-primary" id="changePlanButton" onclick="confirmChangePlan()">{{ trans('texts.plan_change') }}</button>
2016-04-17 00:34:39 +02:00
@else
2016-06-28 20:22:16 +02:00
<button type="button" class="btn btn-success" id="changePlanButton" onclick="confirmChangePlan()">{{ trans('texts.plan_upgrade') }}</button>
2016-06-05 20:05:11 +02:00
@endif
2016-04-17 00:34:39 +02:00
</div>
</div>
</div>
</div>
@endif
{!! Former::close() !!}
2016-10-27 10:57:51 +02:00
{!! Former::open('settings/account_management') !!}
{!! Former::populateField('live_preview', intval($account->live_preview)) !!}
{!! Former::populateField('force_pdfjs', intval(Auth::user()->force_pdfjs)) !!}
2016-10-27 10:57:51 +02:00
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.modules') !!}</h3>
</div>
<div class="panel-body">
<div class="form-group">
<label for="modules" class="control-label col-lg-4 col-sm-4"></label>
<div class="col-lg-8 col-sm-8">
@foreach (\App\Models\Account::$modules as $entityType => $value)
<div class="checkbox">
<label for="modules_{{ $value}}">
2017-11-30 12:57:39 +01:00
<input name="modules[]" id="modules_{{ $value}}" type="checkbox" {{ Auth::user()->account->isModuleEnabled($entityType) ? 'checked="checked"' : '' }} value="{{ $value }}">{{ trans("texts.module_{$entityType}") }}
2016-10-27 10:57:51 +02:00
</label>
</div>
@endforeach
</div>
</div>
<div class="form-group">
<label for="modules" class="control-label col-lg-4 col-sm-4"></label>
<div class="col-lg-8 col-sm-8">
{!! Button::success(trans('texts.save'))->submit()->large()->appendIcon(Icon::create('floppy-disk')) !!}
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.pdf_settings') !!}</h3>
</div>
<div class="panel-body">
{!! Former::checkbox('live_preview')
->text(trans('texts.enable'))
2017-04-09 15:17:49 +02:00
->help(trans('texts.live_preview_help') . '<br/>' . trans('texts.recommend_on'))
->value(1) !!}
{!! Former::checkbox('force_pdfjs')
->text(trans('texts.enable'))
->value(1)
->help(trans('texts.force_pdfjs_help', [
'chrome_link' => link_to(CHROME_PDF_HELP_URL, 'Chrome', ['target' => '_blank']),
'firefox_link' => link_to(FIREFOX_PDF_HELP_URL, 'Firefox', ['target' => '_blank']),
2017-04-09 15:17:49 +02:00
]) . '<br/>' . trans('texts.recommend_off')) !!}
<div class="form-group">
<label for="modules" class="control-label col-lg-4 col-sm-4"></label>
<div class="col-lg-8 col-sm-8">
{!! Button::success(trans('texts.save'))->submit()->large()->appendIcon(Icon::create('floppy-disk')) !!}
</div>
</div>
</div>
</div>
2016-10-27 10:57:51 +02:00
{!! Former::close() !!}
@if (! Auth::user()->account->isNinjaOrLicenseAccount())
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.delete_data') !!}</h3>
2017-03-28 16:51:31 +02:00
</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>
</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>
2017-09-03 17:36:40 +02:00
<button type="button" class="btn btn-danger" id="purgeButton" onclick="confirmPurge()">{{ trans('texts.purge_data') }}</button>
</div>
2017-03-28 16:51:31 +02:00
</div>
</div>
</div>
{!! Former::close() !!}
2017-12-06 13:01:59 +01:00
@if (! $account->hasMultipleAccounts() || $account->getPrimaryAccount()->id != $account->id)
{!! Former::open('settings/cancel_account')->addClass('cancel-account') !!}
{!! Former::actions( Button::danger($account->hasMultipleAccounts() ? trans('texts.delete_company') : 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">{{ $account->hasMultipleAccounts() ? trans('texts.delete_company_help') : trans('texts.cancel_account_help') }}</span>
</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">{{ $account->hasMultipleAccounts() ? trans('texts.delete_company') : 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>{{ $account->hasMultipleAccounts() ? trans('texts.delete_company_message') : trans('texts.cancel_account_message') }}</b></p><br/>
2017-12-06 13:01:59 +01:00
@if ($account->getPrimaryAccount()->id == $account->id)
<p>{!! Former::textarea('reason')
->placeholder(trans('texts.reason_for_canceling'))
->raw()
->rows(4) !!}</p>
@endif
<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" id="deleteButton" onclick="confirmCancel()">{{ $account->hasMultipleAccounts() ? trans('texts.delete_company') : trans('texts.cancel_account') }}</button>
</div>
</div>
2017-03-28 16:51:31 +02:00
</div>
</div>
@elseif ($account->hasMultipleAccounts())
<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.unable_to_delete_primary') }}</span>
</div>
</div>
@endif
{!! Former::close() !!}
2017-03-28 16:51:31 +02:00
</div>
</div>
@endif
2017-03-28 16:51:31 +02:00
</div>
</div>
<script type="text/javascript">
2016-10-18 17:01:33 +02:00
// show plan popupl when clicking 'Upgrade' in navbar
function showUpgradeModal() {
showChangePlan();
}
2016-04-17 00:34:39 +02:00
function showChangePlan() {
2016-06-05 20:05:11 +02:00
$('#changePlanModel').modal('show');
2016-04-17 00:34:39 +02:00
}
function confirmChangePlan() {
$('form.change-plan').submit();
}
2017-03-28 16:51:31 +02:00
function showCancelConfirm() {
2016-06-05 20:05:11 +02:00
$('#confirmCancelModal').modal('show');
2016-04-17 00:34:39 +02:00
}
2017-03-28 16:51:31 +02:00
function showPurgeConfirm() {
$('#confirmPurgeModal').modal('show');
}
2016-04-17 00:34:39 +02:00
function confirmCancel() {
2017-09-03 17:36:40 +02:00
$('#deleteButton').prop('disabled', true);
2016-04-17 00:34:39 +02:00
$('form.cancel-account').submit();
2016-06-05 20:05:11 +02:00
}
2017-03-28 16:51:31 +02:00
function confirmPurge() {
2017-09-03 17:36:40 +02:00
$('#purgeButton').prop('disabled', true);
2017-03-28 16:51:31 +02:00
$('form.purge-data').submit();
}
2016-07-11 19:08:43 +02:00
function onPlanChange() {
if ($('#plan').val() == '{{ PLAN_ENTERPRISE }}') {
$('#numUsersDiv').show();
} else {
$('#numUsersDiv').hide();
}
}
2016-04-17 00:34:39 +02:00
jQuery(document).ready(function($){
function updatePlanModal() {
var plan = $('#plan').val();
2016-07-11 19:08:43 +02:00
var numUsers = $('#num_users').val();
2016-04-17 00:34:39 +02:00
$('#plan_term').closest('.form-group').toggle(plan!='free');
2016-06-05 20:05:11 +02:00
2016-04-17 00:34:39 +02:00
if(plan=='{{PLAN_PRO}}'){
2016-12-15 12:16:19 +01:00
$('#plan_term option[value=month]').text({!! json_encode(trans('texts.plan_price_monthly', ['price'=>PLAN_PRICE_PRO_MONTHLY])) !!});
$('#plan_term option[value=year]').text({!! json_encode(trans('texts.plan_price_yearly', ['price'=>PLAN_PRICE_PRO_MONTHLY * 10])) !!});
2016-04-17 00:34:39 +02:00
} else if(plan=='{{PLAN_ENTERPRISE}}') {
2016-07-11 19:08:43 +02:00
if (numUsers == 2) {
2016-12-15 12:16:19 +01:00
$('#plan_term option[value=month]').text({!! json_encode(trans('texts.plan_price_monthly', ['price'=>PLAN_PRICE_ENTERPRISE_MONTHLY_2])) !!});
$('#plan_term option[value=year]').text({!! json_encode(trans('texts.plan_price_yearly', ['price'=>PLAN_PRICE_ENTERPRISE_MONTHLY_2 * 10])) !!});
2016-07-11 19:08:43 +02:00
} else if (numUsers == 5) {
2016-12-15 12:16:19 +01:00
$('#plan_term option[value=month]').text({!! json_encode(trans('texts.plan_price_monthly', ['price'=>PLAN_PRICE_ENTERPRISE_MONTHLY_5])) !!});
$('#plan_term option[value=year]').text({!! json_encode(trans('texts.plan_price_yearly', ['price'=>PLAN_PRICE_ENTERPRISE_MONTHLY_5 * 10])) !!});
2017-01-01 19:43:46 +01:00
} else if (numUsers == 10) {
2016-12-15 12:16:19 +01:00
$('#plan_term option[value=month]').text({!! json_encode(trans('texts.plan_price_monthly', ['price'=>PLAN_PRICE_ENTERPRISE_MONTHLY_10])) !!});
$('#plan_term option[value=year]').text({!! json_encode(trans('texts.plan_price_yearly', ['price'=>PLAN_PRICE_ENTERPRISE_MONTHLY_10 * 10])) !!});
2017-01-01 19:43:46 +01:00
} else {
$('#plan_term option[value=month]').text({!! json_encode(trans('texts.plan_price_monthly', ['price'=>PLAN_PRICE_ENTERPRISE_MONTHLY_20])) !!});
$('#plan_term option[value=year]').text({!! json_encode(trans('texts.plan_price_yearly', ['price'=>PLAN_PRICE_ENTERPRISE_MONTHLY_20 * 10])) !!});
}
2016-04-17 00:34:39 +02:00
}
}
2016-07-11 19:08:43 +02:00
$('#plan_term, #plan, #num_users').change(updatePlanModal);
2016-04-17 00:34:39 +02:00
updatePlanModal();
2016-07-11 19:08:43 +02:00
onPlanChange();
2016-06-05 20:05:11 +02:00
if(window.location.hash) {
var hash = window.location.hash;
$(hash).modal('toggle');
}
2016-06-05 20:05:11 +02:00
@if (Request::input('upgrade'))
showChangePlan();
@endif
});
</script>
2016-06-05 20:05:11 +02:00
@stop