Hide/show coupon code field if promo code configured in billing tableclear

This commit is contained in:
Benjamin Beganović 2021-03-22 13:34:59 +01:00
parent 8839bfabd3
commit 8bc4896daa
2 changed files with 16 additions and 14 deletions

View File

@ -262,7 +262,7 @@ class BillingPortalPurchase extends Component
'client_contact_id' => $this->contact->hashed_id, 'client_contact_id' => $this->contact->hashed_id,
]], ]],
'user_input_promo_code' => $this->coupon, 'user_input_promo_code' => $this->coupon,
'coupon' => $this->coupon, 'coupon' => empty($this->billing_subscription->promo_code) ? '' : $this->coupon,
'quantity' => $this->quantity, 'quantity' => $this->quantity,
]; ];

View File

@ -139,22 +139,24 @@
</form> </form>
@endif @endif
<div class="relative mt-8"> @if(!empty($billing_subscription->promo_code))
<div class="absolute inset-0 flex items-center"> <div class="relative mt-8">
<div class="w-full border-t border-gray-300"></div> <div class="absolute inset-0 flex items-center">
<div class="w-full border-t border-gray-300"></div>
</div>
<div class="relative flex justify-center text-sm leading-5">
<span class="px-2 text-gray-700 bg-white">Have a coupon code?</span>
</div>
</div> </div>
<div class="relative flex justify-center text-sm leading-5"> <div class="flex items-center mt-4">
<span class="px-2 text-gray-700 bg-white">Have a coupon code?</span> <label class="w-full mr-2">
<input type="text" wire:model.lazy="coupon" class="input w-full m-0"/>
<small class="block text-gray-900 mt-2">{{ ctrans('texts.billing_coupon_notice') }}</small>
</label>
</div> </div>
</div> @endif
<div class="flex items-center mt-4">
<label class="w-full mr-2">
<input type="text" wire:model.lazy="coupon" class="input w-full m-0"/>
<small class="block text-gray-900 mt-2">{{ ctrans('texts.billing_coupon_notice') }}</small>
</label>
</div>
</div> </div>
</div> </div>
</div> </div>