mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 22:07:33 -05:00 
			
		
		
		
	Add quantity to subscriptions
This commit is contained in:
		
							parent
							
								
									3e5e915acc
								
							
						
					
					
						commit
						9359c84013
					
				@ -144,7 +144,7 @@ class BillingPortalPurchase extends Component
 | 
			
		||||
     *
 | 
			
		||||
     * @var int
 | 
			
		||||
     */
 | 
			
		||||
    public $quantity = 1;
 | 
			
		||||
    public $quantity;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * First-hit request data (queries, locales...).
 | 
			
		||||
@ -183,6 +183,8 @@ class BillingPortalPurchase extends Component
 | 
			
		||||
    {
 | 
			
		||||
        MultiDB::setDb($this->company->db);
 | 
			
		||||
 | 
			
		||||
        $this->quantity = 1;
 | 
			
		||||
 | 
			
		||||
        $this->price = $this->subscription->price;
 | 
			
		||||
 | 
			
		||||
        if (request()->query('coupon')) {
 | 
			
		||||
@ -433,13 +435,14 @@ class BillingPortalPurchase extends Component
 | 
			
		||||
 | 
			
		||||
        if ($option == 'increment') {
 | 
			
		||||
            $this->quantity++;
 | 
			
		||||
            return $this->price = (int)$this->price + $this->subscription->product->price;
 | 
			
		||||
            $this->price = $this->subscription->promo_price * $this->quantity;
 | 
			
		||||
            return $this->quantity;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
            $this->quantity--;
 | 
			
		||||
        $this->price = (int)$this->price - $this->subscription->product->price;
 | 
			
		||||
            $this->price = $this->subscription->promo_price * $this->quantity;
 | 
			
		||||
 | 
			
		||||
        return 0;
 | 
			
		||||
            return $this->quantity;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function handleCoupon()
 | 
			
		||||
 | 
			
		||||
@ -51,6 +51,29 @@
 | 
			
		||||
                </div>
 | 
			
		||||
            @endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            @if($subscription->per_seat_enabled && $subscription->max_seats_limit > 1)
 | 
			
		||||
                <div class="flex mt-4 space-x-4 items-center">
 | 
			
		||||
                    <span class="text-sm mx-2">{{ ctrans('texts.qty') }}:</span>
 | 
			
		||||
                    <button wire:click="updateQuantity('decrement')" class="bg-gray-100 border rounded p-1">
 | 
			
		||||
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none"
 | 
			
		||||
                             stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
 | 
			
		||||
                             class="feather feather-minus">
 | 
			
		||||
                            <line x1="5" y1="12" x2="19" y2="12"></line>
 | 
			
		||||
                        </svg>
 | 
			
		||||
                    </button>
 | 
			
		||||
                    <div class="px-2">{{ $quantity }}</div>
 | 
			
		||||
                    <button wire:click="updateQuantity('increment')" class="bg-gray-100 border rounded p-1">
 | 
			
		||||
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none"
 | 
			
		||||
                             stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
 | 
			
		||||
                             class="feather feather-plus">
 | 
			
		||||
                            <line x1="12" y1="5" x2="12" y2="19"></line>
 | 
			
		||||
                            <line x1="5" y1="12" x2="19" y2="12"></line>
 | 
			
		||||
                        </svg>
 | 
			
		||||
                    </button>
 | 
			
		||||
                </div>
 | 
			
		||||
            @endif
 | 
			
		||||
 | 
			
		||||
            <div class="relative mt-8">
 | 
			
		||||
                <div class="absolute inset-0 flex items-center">
 | 
			
		||||
                    <div class="w-full border-t border-gray-300"></div>
 | 
			
		||||
 | 
			
		||||
@ -12,7 +12,7 @@
 | 
			
		||||
 | 
			
		||||
@section('body')
 | 
			
		||||
 | 
			
		||||
    @if($purchase_order->company->getSetting('vendor_portal_enable_uploads') || true)
 | 
			
		||||
    @if($purchase_order->company->getSetting('vendor_portal_enable_uploads'))
 | 
			
		||||
        @component('portal.ninja2020.purchase_orders.includes.upload', ['purchase_order' => $purchase_order]) @endcomponent
 | 
			
		||||
    @endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user