Make navigating subscriptions easier

This commit is contained in:
David Bomba 2021-06-27 19:20:56 +10:00
parent 1de22ed901
commit 021761d33d
4 changed files with 27 additions and 0 deletions

View File

@ -77,6 +77,9 @@ class CreateAccount
$sp794f3f->save();
if(Ninja::isHosted())
$sp794f3f->startTrial();
$sp035a66 = CreateCompany::dispatchNow($this->request, $sp794f3f);
$sp035a66->load('account');
$sp794f3f->default_company_id = $sp035a66->id;

View File

@ -227,6 +227,21 @@ class Account extends BaseModel
return $plan_details && $plan_details['trial'];
}
public function startTrial($plan)
{
if (! Ninja::isNinja()) {
return;
}
if ($this->trial_started && $this->trial_started != '0000-00-00') {
return;
}
$this->trial_plan = $plan;
$this->trial_started = now();
$this->save();
}
public function getPlanDetails($include_inactive = false, $include_trial = true)
{
$plan = $this->plan;

View File

@ -36,6 +36,7 @@ class ActivityTransformer extends EntityTransformer
'id' => (string) $this->encodePrimaryKey($activity->id),
'activity_type_id' => (string) $activity->activity_type_id,
'client_id' => $activity->client_id ? (string) $this->encodePrimaryKey($activity->client_id) : '',
'recurring_invoice_id' => $activity->recurring_invoice_id ? (string) $this->encodePrimaryKey($activity->recurring_invoice_id) : '',
'company_id' => $activity->company_id ? (string) $this->encodePrimaryKey($activity->company_id) : '',
'user_id' => (string) $this->encodePrimaryKey($activity->user_id),
'invoice_id' => $activity->invoice_id ? (string) $this->encodePrimaryKey($activity->invoice_id) : '',

View File

@ -40,6 +40,8 @@
{{ ctrans('texts.date') }}
</p>
</th>
<th class="px-6 py-3 border-b border-gray-200 bg-primary text-left text-xs leading-4 font-medium text-white uppercase tracking-wider">
</th>
</tr>
</thead>
<tbody>
@ -63,6 +65,12 @@
<td class="px-6 py-4 whitespace-no-wrap text-sm leading-5 text-gray-500">
{{ $recurring_invoice->formatDate($recurring_invoice->date, $recurring_invoice->client->date_format()) }}
</td>
<td class="px-6 py-4 whitespace-no-wrap text-sm leading-5 text-gray-500">
<a href="{{ route('client.recurring_invoice.show', $recurring_invoice->hashed_id) }}"
class="button-link text-primary">
{{ ctrans('texts.view') }}
</a>
</td>
</tr>
@empty
<tr class="bg-white group hover:bg-gray-100">