Working on subscriptions

This commit is contained in:
David Bomba 2023-03-01 13:42:31 +11:00
parent c7923d706a
commit f67959fb06
3 changed files with 15 additions and 2 deletions

View File

@ -23,6 +23,8 @@ class SubscriptionPurchaseController extends Controller
{
public function index(Subscription $subscription, Request $request)
{
App::setLocale($subscription->company->locale());
/* Make sure the contact is logged into the correct company for this subscription */
if (auth()->guard('contact')->user() && auth()->guard('contact')->user()->company_id != $subscription->company_id) {
auth()->guard('contact')->logout();
@ -42,6 +44,9 @@ class SubscriptionPurchaseController extends Controller
public function upgrade(Subscription $subscription, Request $request)
{
App::setLocale($subscription->company->locale());
/* Make sure the contact is logged into the correct company for this subscription */
if (auth()->guard('contact')->user() && auth()->guard('contact')->user()->company_id != $subscription->company_id) {
auth()->guard('contact')->logout();

View File

@ -39,9 +39,9 @@ class SubscriptionsTable extends Component
->where('company_id', $this->company->id)
->whereNotNull('subscription_id')
->where('is_deleted', false)
->where('status_id', RecurringInvoice::STATUS_ACTIVE)
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc')
->whereIn('status_id', [RecurringInvoice::STATUS_ACTIVE, RecurringInvoice::STATUS_PAUSED])
->withTrashed()
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc')
->paginate($this->per_page);
return render('components.livewire.subscriptions-table', [

View File

@ -15,6 +15,11 @@
<table class="min-w-full shadow rounded border border-gray-200 mt-4 credits-table">
<thead>
<tr>
<th class="px-6 py-3 text-xs font-medium leading-4 tracking-wider text-left text-white uppercase border-b border-gray-200 bg-primary">
<p role="button" wire:click="sortBy('status_id')" class="cursor-pointer">
{{ ctrans('texts.status') }}
</p>
</th>
<th class="px-6 py-3 text-xs font-medium leading-4 tracking-wider text-left text-white uppercase border-b border-gray-200 bg-primary">
<p role="button" wire:click="sortBy('number')" class="cursor-pointer">
{{ ctrans('texts.subscription') }}
@ -47,6 +52,9 @@
<tbody>
@forelse($recurring_invoices as $recurring_invoice)
<tr class="bg-white group hover:bg-gray-100">
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
{!! $recurring_invoice->badgeForStatus($recurring_invoice->status_id) !!}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
{{ $recurring_invoice->subscription->name }}
</td>