1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-21 08:51:34 +02:00
invoiceninja/resources/views/partials/upgrade_modal.blade.php

143 lines
5.4 KiB
PHP
Raw Normal View History

2016-10-16 15:38:04 +02:00
{!! Former::open('settings/change_plan')->addClass('upgrade-form') !!}
<span style="display:none">
{!! Former::text('plan') !!}
</span>
<div id="upgrade-modal" class="container" style="">
<div class="row">
<div class="col-md-10 text-right">
2016-10-18 16:55:07 +02:00
<a href="#"><i class="fa fa-close" onclick="hideUpgradeModal()" title="{{ trans('texts.close') }}"></i></a>
2016-10-16 15:38:04 +02:00
</div>
</div>
<div class="row">
<div class="col-md-12 text-center">
<h1>{{ trans('texts.upgrade_for_features') }}</h1>
<h4 onclick="updateUpgradePrices()">
<label for="plan_term_month" class="radio-inline">
<input value="month" id="plan_term_month" type="radio" name="plan_term" checked>Monthly</label>
<label for="plan_term_year" class="radio-inline">
<input value="year" id="plan_term_year" type="radio" name="plan_term">Annually</label>
</h4>
2016-12-14 15:19:16 +01:00
@if (Auth::user()->account->company->hasActivePromo())
<h4>{{ Auth::user()->account->company->present()->promoMessage }}</h4><br/>
@endif
2016-10-16 15:38:04 +02:00
</div>
<div class="col-md-4 col-md-offset-2 text-center">
<h2>{{ trans('texts.pro_upgrade_title') }}</h2>
<p class="subhead">{{ trans('texts.pay_annually_discount') }}</p>
<img width="65" src="{{ asset('images/pro_plan/border.png') }}"/>
2016-12-14 15:19:16 +01:00
<h3>$<span id="upgrade_pro_price">{{ PLAN_PRICE_PRO_MONTHLY }}</span> <span class="upgrade_frequency">/ {{ trans('texts.plan_term_month') }}</span></h3>
2016-10-16 15:38:04 +02:00
<select style="visibility:hidden">
</select>
<p>&nbsp;</p>
2016-10-16 15:38:04 +02:00
<ul>
<li>{{ trans('texts.pro_upgrade_feature1') }}</li>
<li>{{ trans('texts.pro_upgrade_feature2') }}</li>
<li>{{ trans('texts.much_more') }}</li>
</ul>
{!! Button::success(trans('texts.go_ninja_pro'))->withAttributes(['onclick' => 'submitUpgradeForm("pro")'])->large() !!}
</div>
<div class="col-md-4 columns text-center">
<h2>{{ trans('texts.plan_enterprise') }}</h2>
<p class="subhead">{{ trans('texts.pay_annually_discount') }}</p>
<img width="65" src="{{ asset('images/pro_plan/border.png') }}"/>
2016-12-14 15:19:16 +01:00
<h3>$<span id="upgrade_enterprise_price">{{ PLAN_PRICE_ENTERPRISE_MONTHLY_2 }}</span> <span class="upgrade_frequency">/ {{ trans('texts.plan_term_month') }}</span></h3>
2016-10-16 15:38:04 +02:00
<select name="num_users" id="upgrade_num_users" onchange="updateUpgradePrices()">
<option value="2">1 to 2 {{ trans('texts.users') }}</option>
<option value="5">3 to 5 {{ trans('texts.users') }}</option>
<option value="10">6 to 10 {{ trans('texts.users') }}</option>
2017-01-01 19:43:46 +01:00
<option value="20">11 to 20 {{ trans('texts.users') }}</option>
2016-10-16 15:38:04 +02:00
</select>
<p>&nbsp;</p>
2016-10-16 15:38:04 +02:00
<ul>
<li>{{ trans('texts.enterprise_upgrade_feature1') }}</li>
<li>{{ trans('texts.enterprise_upgrade_feature2') }}</li>
<li>{{ trans('texts.much_more') }}</li>
</ul>
{!! Button::success(trans('texts.go_enterprise'))->withAttributes(['onclick' => 'submitUpgradeForm("enterprise")'])->large() !!}
</div>
</div>
</div>
{!! Former::close() !!}
<script type="text/javascript">
function showUpgradeModal() {
@if ( ! Auth::check() || ! Auth::user()->confirmed)
swal("{!! trans('texts.confirmation_required') !!}");
return;
@endif
2016-10-18 17:01:33 +02:00
$(window).scrollTop(0);
$('#upgrade-modal').fadeIn();
2016-10-16 15:38:04 +02:00
}
function hideUpgradeModal() {
$('#upgrade-modal').fadeOut();
}
function updateUpgradePrices() {
var planTerm = $('input[name=plan_term]:checked').val();
var numUsers = $('#upgrade_num_users').val();
if (planTerm == 'month') {
var proPrice = {{ PLAN_PRICE_PRO_MONTHLY }};
if (numUsers == 2) {
var enterprisePrice = {{ PLAN_PRICE_ENTERPRISE_MONTHLY_2 }};
} else if (numUsers == 5) {
var enterprisePrice = {{ PLAN_PRICE_ENTERPRISE_MONTHLY_5 }};
} else if (numUsers == 10) {
var enterprisePrice = {{ PLAN_PRICE_ENTERPRISE_MONTHLY_10 }};
2017-01-01 19:43:46 +01:00
} else if (numUsers == 20) {
var enterprisePrice = {{ PLAN_PRICE_ENTERPRISE_MONTHLY_20 }};
2016-10-16 15:38:04 +02:00
}
var label = "{{ trans('texts.freq_monthly') }}";
} else {
var proPrice = {{ PLAN_PRICE_PRO_MONTHLY * 10 }};
if (numUsers == 2) {
var enterprisePrice = {{ PLAN_PRICE_ENTERPRISE_MONTHLY_2 * 10 }};
} else if (numUsers == 5) {
var enterprisePrice = {{ PLAN_PRICE_ENTERPRISE_MONTHLY_5 * 10 }};
} else if (numUsers == 10) {
var enterprisePrice = {{ PLAN_PRICE_ENTERPRISE_MONTHLY_10 * 10 }};
2017-01-01 19:43:46 +01:00
} else if (numUsers == 20) {
var enterprisePrice = {{ PLAN_PRICE_ENTERPRISE_MONTHLY_20 * 10 }};
2016-10-16 15:38:04 +02:00
}
var label = "{{ trans('texts.freq_annually') }}";
}
2016-12-14 15:19:16 +01:00
@if (Auth::user()->account->company->hasActivePromo())
proPrice = proPrice - (proPrice * {{ Auth::user()->account->company->discount }});
enterprisePrice = enterprisePrice - (enterprisePrice * {{ Auth::user()->account->company->discount }});
@endif
2017-07-11 16:37:42 +02:00
if (proPrice % 1) {
proPrice = proPrice.toFixed(2);
}
if (enterprisePrice % 1) {
enterprisePrice = enterprisePrice.toFixed(2);
}
2016-10-16 15:38:04 +02:00
$('#upgrade_pro_price').text(proPrice);
$('#upgrade_enterprise_price').text(enterprisePrice);
$('span.upgrade_frequency').text(label);
}
function submitUpgradeForm(plan) {
$('#plan').val(plan);
$('.upgrade-form').submit();
}
$(function() {
2016-12-14 15:19:16 +01:00
@if (Auth::user()->account->company->hasActivePromo())
updateUpgradePrices();
@endif
2016-10-16 15:38:04 +02:00
$(document).keyup(function(e) {
if (e.keyCode == 27) { // escape key maps to keycode `27`
hideUpgradeModal();
}
});
})
</script>