mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merge pull request #8324 from turbo124/v5-develop
Fixes for displaying negative numbers
This commit is contained in:
commit
4481520471
@ -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();
|
||||
|
@ -271,6 +271,10 @@ class BillingPortalPurchasev2 extends Component
|
||||
*/
|
||||
public function handleCoupon()
|
||||
{
|
||||
|
||||
$this->resetErrorBag('coupon');
|
||||
$this->resetValidation('coupon');
|
||||
|
||||
if ($this->coupon == $this->subscription->promo_code) {
|
||||
$this->valid_coupon = true;
|
||||
$this->buildBundle();
|
||||
@ -278,6 +282,9 @@ class BillingPortalPurchasev2 extends Component
|
||||
$this->discount = 0;
|
||||
$this->valid_coupon = false;
|
||||
$this->buildBundle();
|
||||
$errors = $this->getErrorBag();
|
||||
$errors->add('coupon', ctrans('texts.invalid_coupon'));
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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', [
|
||||
|
@ -13,7 +13,6 @@
|
||||
namespace App\Services\PdfMaker;
|
||||
|
||||
use App\Models\Credit;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Quote;
|
||||
use App\Services\PdfMaker\Designs\Utilities\BaseDesign;
|
||||
use App\Services\PdfMaker\Designs\Utilities\DesignHelpers;
|
||||
|
@ -202,6 +202,8 @@ class Number
|
||||
{
|
||||
$currency = $entity->currency();
|
||||
|
||||
$_value = $value;
|
||||
|
||||
$thousand = $currency->thousand_separator;
|
||||
$decimal = $currency->decimal_separator;
|
||||
$precision = $currency->precision;
|
||||
@ -247,6 +249,12 @@ class Number
|
||||
} elseif ($swapSymbol) {
|
||||
return "{$value} ".trim($symbol);
|
||||
} elseif ($entity->getSetting('show_currency_code') === false) {
|
||||
|
||||
if ($_value < 0) {
|
||||
$value = substr($value, 1);
|
||||
$symbol = "-{$symbol}";
|
||||
}
|
||||
|
||||
return "{$symbol}{$value}";
|
||||
} else {
|
||||
return self::formatValue($value, $currency);
|
||||
|
@ -5010,6 +5010,7 @@ $LANG = array(
|
||||
'change_plan_description' => 'Upgrade or downgrade your current plan.',
|
||||
'add_company_logo' => 'Add Logo',
|
||||
'add_stripe' => 'Add Stripe',
|
||||
'invalid_coupon' => 'Invalid Coupon',
|
||||
);
|
||||
|
||||
|
||||
|
@ -253,6 +253,14 @@
|
||||
<span>{{ ctrans('texts.apply') }}</span>
|
||||
</button>
|
||||
</div>
|
||||
@if($errors && $errors->has('coupon'))
|
||||
@error("coupon")
|
||||
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative" role="alert">
|
||||
<span class="block sm:inline text-sm">{{ $message }} </span>
|
||||
<span class="absolute top-0 bottom-0 right-0 px-4 py-3">
|
||||
</div>
|
||||
@enderror
|
||||
@endif
|
||||
</div>
|
||||
</form>
|
||||
@endif
|
||||
@ -347,7 +355,6 @@
|
||||
<span class="absolute top-0 bottom-0 right-0 px-4 py-3">
|
||||
</div>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
</form>
|
||||
@endif
|
||||
|
@ -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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user