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

Add promotion message in footer

This commit is contained in:
Hillel Coren 2017-12-01 11:48:13 +02:00
parent e70f1fea5d
commit f263239cdb
5 changed files with 26 additions and 1 deletions

View File

@ -1118,6 +1118,14 @@ class Account extends Eloquent
return ! empty($plan_details);
}
/**
* @return mixed
*/
public function hasActivePromo()
{
return $this->company->hasActivePromo();
}
/**
* @param null $plan_details
*

View File

@ -194,6 +194,10 @@ class Company extends Eloquent
public function applyFreeYear()
{
if ($this->plan_started && $this->plan_started != '0000-00-00') {
return;
}
$this->plan = PLAN_PRO;
$this->plan_term = PLAN_TERM_YEARLY;
$this->plan_price = PLAN_PRICE_PRO_MONTHLY;

View File

@ -134,6 +134,14 @@ class User extends Authenticatable
return $this->account->isPro();
}
/**
* @return mixed
*/
public function hasActivePromo()
{
return $this->account->hasActivePromo();
}
/**
* @param $feature
*

View File

@ -2597,6 +2597,7 @@ $LANG = array(
'send_client_reminders' => 'Send email reminders',
'can_view_tasks' => 'Tasks are visible in the portal',
'is_not_sent_reminders' => 'Reminders are not sent',
'promotion_footer' => 'Your promotion will expire soon, :link to upgrade now.',
);

View File

@ -472,7 +472,11 @@
<div class="col-md-12">
@if (Utils::isNinjaProd())
@if (Auth::check() && Auth::user()->isTrial())
@if (Auth::check() && Auth::user()->hasActivePromo())
{!! trans('texts.promotion_footer', [
'link' => '<a href="javascript:showUpgradeModal()">' . trans('texts.click_here') . '</a>'
]) !!}
@elseif (Auth::check() && Auth::user()->isTrial())
{!! trans(Auth::user()->account->getCountTrialDaysLeft() == 0 ? 'texts.trial_footer_last_day' : 'texts.trial_footer', [
'count' => Auth::user()->account->getCountTrialDaysLeft(),
'link' => '<a href="javascript:showUpgradeModal()">' . trans('texts.click_here') . '</a>'