mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Add validation to coupon code
This commit is contained in:
parent
f67959fb06
commit
8247ff41e4
@ -271,6 +271,10 @@ class BillingPortalPurchasev2 extends Component
|
|||||||
*/
|
*/
|
||||||
public function handleCoupon()
|
public function handleCoupon()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$this->resetErrorBag('coupon');
|
||||||
|
$this->resetValidation('coupon');
|
||||||
|
|
||||||
if ($this->coupon == $this->subscription->promo_code) {
|
if ($this->coupon == $this->subscription->promo_code) {
|
||||||
$this->valid_coupon = true;
|
$this->valid_coupon = true;
|
||||||
$this->buildBundle();
|
$this->buildBundle();
|
||||||
@ -278,6 +282,9 @@ class BillingPortalPurchasev2 extends Component
|
|||||||
$this->discount = 0;
|
$this->discount = 0;
|
||||||
$this->valid_coupon = false;
|
$this->valid_coupon = false;
|
||||||
$this->buildBundle();
|
$this->buildBundle();
|
||||||
|
$errors = $this->getErrorBag();
|
||||||
|
$errors->add('coupon', ctrans('texts.invalid_coupon'));
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5010,6 +5010,7 @@ $LANG = array(
|
|||||||
'change_plan_description' => 'Upgrade or downgrade your current plan.',
|
'change_plan_description' => 'Upgrade or downgrade your current plan.',
|
||||||
'add_company_logo' => 'Add Logo',
|
'add_company_logo' => 'Add Logo',
|
||||||
'add_stripe' => 'Add Stripe',
|
'add_stripe' => 'Add Stripe',
|
||||||
|
'invalid_coupon' => 'Invalid Coupon',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -253,6 +253,14 @@
|
|||||||
<span>{{ ctrans('texts.apply') }}</span>
|
<span>{{ ctrans('texts.apply') }}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@endif
|
@endif
|
||||||
@ -347,7 +355,6 @@
|
|||||||
<span class="absolute top-0 bottom-0 right-0 px-4 py-3">
|
<span class="absolute top-0 bottom-0 right-0 px-4 py-3">
|
||||||
</div>
|
</div>
|
||||||
@enderror
|
@enderror
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@endif
|
@endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user