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

Added new upgrade modal

This commit is contained in:
Hillel Coren 2016-10-16 09:38:04 -04:00
parent b36ea06303
commit 7c0eea08cd
23 changed files with 280 additions and 21 deletions

View File

@ -167,6 +167,10 @@ class AccountController extends BaseController
$term = Input::get('plan_term'); $term = Input::get('plan_term');
$numUsers = Input::get('num_users'); $numUsers = Input::get('num_users');
if ($plan != PLAN_ENTERPRISE) {
$numUsers = 1;
}
$planDetails = $account->getPlanDetails(false, false); $planDetails = $account->getPlanDetails(false, false);
$newPlan = [ $newPlan = [
@ -195,7 +199,9 @@ class AccountController extends BaseController
} }
} }
$hasPaid = false;
if (!empty($planDetails['paid']) && $plan != PLAN_FREE) { if (!empty($planDetails['paid']) && $plan != PLAN_FREE) {
$hasPaid = true;
$time_used = $planDetails['paid']->diff(date_create()); $time_used = $planDetails['paid']->diff(date_create());
$days_used = $time_used->days; $days_used = $time_used->days;
@ -211,7 +217,11 @@ class AccountController extends BaseController
if ($newPlan['price'] > $credit) { if ($newPlan['price'] > $credit) {
$invitation = $this->accountRepo->enablePlan($newPlan, $credit); $invitation = $this->accountRepo->enablePlan($newPlan, $credit);
return Redirect::to('view/' . $invitation->invitation_key); if ($hasPaid) {
return Redirect::to('view/' . $invitation->invitation_key);
} else {
return Redirect::to('payment/' . $invitation->invitation_key);
}
} else { } else {
if ($plan != PLAN_FREE) { if ($plan != PLAN_FREE) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -13,6 +13,7 @@
/* Toggle Styles */ /* Toggle Styles */
#wrapper { #wrapper {
padding-top: 56px;
padding-left: 0; padding-left: 0;
padding-right: 0; padding-right: 0;
-webkit-transition: all 0.5s ease; -webkit-transition: all 0.5s ease;

View File

@ -1,5 +1,4 @@
body { body {
padding-top: 56px;
font-family: 'Roboto', sans-serif; font-family: 'Roboto', sans-serif;
font-size: 15px; font-size: 15px;
} }
@ -571,12 +570,14 @@ table.invoice-table th:last-child {
/* Animate col width changes */ /* Animate col width changes */
/*
body { body {
-webkit-transition: all 0.5s ease; -webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease; -moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease; -o-transition: all 0.5s ease;
transition: all 0.5s ease; transition: all 0.5s ease;
} }
*/
div.discount-group span { div.discount-group span {
padding: 0px; padding: 0px;

View File

@ -2149,6 +2149,17 @@ $LANG = array(
'translate_app' => 'Help improve our translations with :link', 'translate_app' => 'Help improve our translations with :link',
'expense_category' => 'Expense Category', 'expense_category' => 'Expense Category',
'go_ninja_pro' => 'Go Ninja Pro!',
'go_enterprise' => 'Go Enterprise!',
'upgrade_for_features' => 'Upgrade For More Features',
'pay_annually_discount' => 'Pay annually for 10 months + 2 free!',
'pro_upgrade_title' => 'Ninja Pro',
'pro_upgrade_feature1' => 'YourBrand.InvoiceNinja.com',
'pro_upgrade_feature2' => 'Customize every aspect of your invoice!',
'enterprise_upgrade_feature1' => 'Set permissions for multiple-users',
'enterprise_upgrade_feature2' => 'Attach 3rd party files to invoices & expenses',
'much_more' => 'Much More!',
); );
return $LANG; return $LANG;

View File

@ -1,7 +1,7 @@
@if (!Utils::isPro() && isset($advanced) && $advanced) @if (!Utils::isPro() && isset($advanced) && $advanced)
<div class="alert alert-warning" style="font-size:larger;"> <div class="alert alert-warning" style="font-size:larger;">
<center> <center>
{!! trans('texts.pro_plan_advanced_settings', ['link'=>link_to('/settings/account_management?upgrade=true', trans('texts.pro_plan_remove_logo_link'))]) !!} {!! trans('texts.pro_plan_advanced_settings', ['link'=>'<a href="javascript:showUpgradeModal()">' . trans('texts.pro_plan_remove_logo_link') . '</a>']) !!}
</center> </center>
</div> </div>
@endif @endif

View File

@ -369,6 +369,8 @@
@section('body') @section('body')
@include('partials.upgrade_modal')
<nav class="navbar navbar-default navbar-fixed-top" role="navigation" style="height:60px;"> <nav class="navbar navbar-default navbar-fixed-top" role="navigation" style="height:60px;">
<div class="navbar-header"> <div class="navbar-header">
@ -398,7 +400,7 @@
@if (!Auth::user()->registered) @if (!Auth::user()->registered)
{!! Button::success(trans('texts.sign_up'))->withAttributes(array('id' => 'signUpButton', 'data-toggle'=>'modal', 'data-target'=>'#signUpModal', 'style' => 'max-width:100px;;overflow:hidden'))->small() !!} &nbsp; {!! Button::success(trans('texts.sign_up'))->withAttributes(array('id' => 'signUpButton', 'data-toggle'=>'modal', 'data-target'=>'#signUpModal', 'style' => 'max-width:100px;;overflow:hidden'))->small() !!} &nbsp;
@elseif (Utils::isNinjaProd() && (!Auth::user()->isPro() || Auth::user()->isTrial())) @elseif (Utils::isNinjaProd() && (!Auth::user()->isPro() || Auth::user()->isTrial()))
{!! Button::success(trans('texts.plan_upgrade'))->asLinkTo(url('/settings/account_management?upgrade=true'))->withAttributes(array('style' => 'max-width:100px;overflow:hidden'))->small() !!} &nbsp; {!! Button::success(trans('texts.plan_upgrade'))->withAttributes(array('onclick' => 'showUpgradeModal()', 'style' => 'max-width:100px;overflow:hidden'))->small() !!} &nbsp;
@endif @endif
@endif @endif
@ -595,7 +597,7 @@
@if (Auth::check() && Auth::user()->isTrial()) @if (Auth::check() && Auth::user()->isTrial())
{!! trans(Auth::user()->account->getCountTrialDaysLeft() == 0 ? 'texts.trial_footer_last_day' : 'texts.trial_footer', [ {!! trans(Auth::user()->account->getCountTrialDaysLeft() == 0 ? 'texts.trial_footer_last_day' : 'texts.trial_footer', [
'count' => Auth::user()->account->getCountTrialDaysLeft(), 'count' => Auth::user()->account->getCountTrialDaysLeft(),
'link' => link_to('/settings/account_management?upgrade=true', trans('texts.click_here')) 'link' => '<a href="javascript:showUpgradeModal()">' . trans('texts.click_here') . '</a>'
]) !!} ]) !!}
@endif @endif
@else @else

View File

@ -566,7 +566,7 @@
@if (!Auth::user()->account->isPro()) @if (!Auth::user()->account->isPro())
<div style="font-size:larger"> <div style="font-size:larger">
{!! trans('texts.pro_plan_remove_logo', ['link'=>link_to('/settings/account_management?upgrade=true', trans('texts.pro_plan_remove_logo_link'))]) !!} {!! trans('texts.pro_plan_remove_logo', ['link'=>'<a href="javascript:showUpgradeModal()">' . trans('texts.pro_plan_remove_logo_link') . '</a>']) !!}
</div> </div>
@endif @endif

View File

@ -48,7 +48,7 @@
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('texts.cancel') }}</button> <button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('texts.cancel') }}</button>
@if (Utils::isNinjaProd()) @if (Utils::isNinjaProd())
<a class="btn btn-primary" href="{{ url('/settings/account_management?upgrade=true') }}">{{ trans('texts.go_pro') }}</a> <a class="btn btn-primary" href="javascript:showUpgradeModal()">{{ trans('texts.go_pro') }}</a>
@else @else
<button type="button" class="btn btn-primary" onclick="buyProduct('{{ INVOICE_DESIGNS_AFFILIATE_KEY }}', '{{ PRODUCT_INVOICE_DESIGNS }}')">{{ trans('texts.buy') }}</button> <button type="button" class="btn btn-primary" onclick="buyProduct('{{ INVOICE_DESIGNS_AFFILIATE_KEY }}', '{{ PRODUCT_INVOICE_DESIGNS }}')">{{ trans('texts.buy') }}</button>
@endif @endif

View File

@ -0,0 +1,233 @@
<style>
#upgrade-modal {
display: none;
position: absolute;
z-index: 999999;
#background-color: rgba(76,76,76,.99);
background-color: rgba(0,0,0,.9);
text-align: center;
width: 100%;
height: 100%;
}
#upgrade-modal h1 {
font-family: 'roboto-thin', 'roboto', Helvetica, arial, sans-serif;
font-size: 28px!important;
padding: 0 0 25px 0;
margin: 0!important;
color: #fff;
padding-top: 20px;
padding-bottom: 40px;
font-weight: 800;
}
#upgrade-modal h2 {
font-family: 'roboto-thin', 'roboto', Helvetica, arial, sans-serif;
color: #36c157;
font-size: 34px;
line-height: 15px;
padding-bottom: 4px;
margin: 0;
font-weight: 100;
}
#upgrade-modal h3 {
font-family: 'roboto-thin', 'roboto', Helvetica, arial, sans-serif;
margin: 20px 0 25px 0;
font-size: 75px;
padding: 0 0 8px 0;
color: #fff;
font-weight: 100;
}
#upgrade-modal h3 span.upgrade_frequency {
font-size: 17px;
text-transform: uppercase;
letter-spacing: 2px;
vertical-align: super;
}
#upgrade-modal ul {
list-style: none;
color: #fff;
padding: 20px 0;
}
#upgrade-modal .col-md-4 {
padding:75px 20px;
border-right: 0;
}
#upgrade-modal .col-md-offset-2 {
border-top: 1px solid #343333;
border-right: 1px solid #343333;
}
#upgrade-modal .columns {
border-top: 1px solid #343333;
}
#upgrade-modal ul {
border-top: 1px solid #343333;
}
#upgrade-modal ul li {
font-size: 17px;
line-height: 35px;
font-weight: 400;
}
#upgrade-modal p.subhead {
font-size: 15px;
margin: 5px 0 5px 0;
padding-top: 10px;
padding-bottom: 10px;
font-weight: 400;
color: #fff;
}
#upgrade-modal .btn {
width: 260px;
padding: 16px 0 16px 0;
}
#upgrade-modal i.fa-close {
cursor: pointer;
color: #fff;
font-size: 26px !important;
padding-top: 30px;
}
#upgrade-modal label.radio-inline {
padding: 0px 30px 30px 30px;
font-size: 22px;
color: #fff;
vertical-align: middle;
}
#upgrade-modal select {
vertical-align: top;
width: 140px;
}
</style>
{!! 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">
<a href="#"><i class="fa fa-close" onclick="hideUpgradeModal()"></i></a>
</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>
</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') }}"/>
<h3>$<span id="upgrade_pro_price">8</span> <span class="upgrade_frequency">/ {{ trans('texts.plan_term_month') }}</span></h3>
<select style="visibility:hidden">
</select>
<p>&bnsp;</p>
<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') }}"/>
<h3>$<span id="upgrade_enterprise_price">12</span> <span class="upgrade_frequency">/ {{ trans('texts.plan_term_month') }}</span></h3>
<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>
</select>
<p>&bnsp;</p>
<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 (Request::is('settings/account_management'))
showChangePlan();
@else
$(window).scrollTop(0);
$('#upgrade-modal').fadeIn();
@endif
}
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 }};
}
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 }};
}
var label = "{{ trans('texts.freq_annually') }}";
}
$('#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() {
$(document).keyup(function(e) {
if (e.keyCode == 27) { // escape key maps to keycode `27`
hideUpgradeModal();
}
});
})
</script>