mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-10-31 14:07:32 -04:00 
			
		
		
		
	Add RecurringProducts component and corresponding view
This commit is contained in:
		
							parent
							
								
									2faeb2eeaa
								
							
						
					
					
						commit
						c48167bfd7
					
				
							
								
								
									
										26
									
								
								app/Livewire/BillingPortal/Cart/RecurringProducts.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								app/Livewire/BillingPortal/Cart/RecurringProducts.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,26 @@ | |||||||
|  | <?php | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  | * Invoice Ninja (https://invoiceninja.com). | ||||||
|  | * | ||||||
|  | * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  | * | ||||||
|  | * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  | * | ||||||
|  | * @license https://www.elastic.co/licensing/elastic-license | ||||||
|  | */ | ||||||
|  | 
 | ||||||
|  | namespace App\Livewire\BillingPortal\Cart; | ||||||
|  | 
 | ||||||
|  | use App\Models\Subscription; | ||||||
|  | use Livewire\Component; | ||||||
|  | 
 | ||||||
|  | class RecurringProducts extends Component | ||||||
|  | { | ||||||
|  |     public Subscription $subscription; | ||||||
|  | 
 | ||||||
|  |     public function render(): \Illuminate\View\View | ||||||
|  |     { | ||||||
|  |         return view('billing-portal.v3.cart.recurring-products'); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,58 @@ | |||||||
|  | <div class="space-y-10"> | ||||||
|  |     @unless(empty($subscription->recurring_product_ids)) | ||||||
|  |         @foreach($subscription->service()->recurring_products() as $index => $product) | ||||||
|  |         <div> | ||||||
|  |             <div class="flex items-start justify-between space-x-4"> | ||||||
|  |                 <div class="flex flex-start"> | ||||||
|  |                     @if(filter_var($product->product_image, FILTER_VALIDATE_URL)) | ||||||
|  |                     <div | ||||||
|  |                         class="h-16 w-16 flex-shrink-0 overflow-hidden rounded-md border border-gray-200 mr-2" | ||||||
|  |                     > | ||||||
|  |                         <img | ||||||
|  |                             src="{{ $product->product_image }}" | ||||||
|  |                             alt="" | ||||||
|  |                             class="h-full w-full object-cover object-center border rounded-md" | ||||||
|  |                         /> | ||||||
|  |                     </div> | ||||||
|  |                     @endif | ||||||
|  | 
 | ||||||
|  |                     <div class="flex flex-col"> | ||||||
|  |                         <h2 class="text-lg font-medium">{{ $product->product_key }}</h2> | ||||||
|  |                         <p class="block text-sm">{{ \App\Utils\Number::formatMoney($product->price, $subscription->company) }} / <span class="lowercase">{{ App\Models\RecurringInvoice::frequencyForKey($subscription->frequency_id) }}</span></p> | ||||||
|  |                     </div> | ||||||
|  |                 </div> | ||||||
|  | 
 | ||||||
|  |                 <div class="flex flex-col-reverse space-y-3"> | ||||||
|  |                     <div class="flex"> | ||||||
|  |                         @if($subscription->per_seat_enabled) | ||||||
|  |                             @if($subscription->use_inventory_management && $product->in_stock_quantity == 0) | ||||||
|  |                                 <p class="text-sm font-light text-red-500 text-right mr-2 mt-2">{{ ctrans('texts.out_of_stock') }}</p> | ||||||
|  |                             @else | ||||||
|  |                                 <p class="text-sm font-light text-gray-700 text-right mr-2 mt-2">{{ ctrans('texts.qty') }}</p> | ||||||
|  |                             @endif | ||||||
|  |          | ||||||
|  |                             <select class="rounded-md border-gray-300 shadow-sm sm:text-sm" @if($subscription->use_inventory_management && $product->in_stock_quantity == 0) disabled @endif> | ||||||
|  |                                 <option value="1" selected="selected">1</option> | ||||||
|  |          | ||||||
|  |                                 @if($subscription->max_seats_limit > 1) | ||||||
|  |                                     @for ($i = 2; $i <= ($subscription->use_inventory_management ? min($subscription->max_seats_limit,$product->in_stock_quantity) : $subscription->max_seats_limit); $i++) | ||||||
|  |                                         <option value="{{ $i }}">{{ $i }}</option> | ||||||
|  |                                     @endfor | ||||||
|  |                                 @else | ||||||
|  |                                     @for ($i = 2; $i <= ($subscription->use_inventory_management ? min($product->in_stock_quantity, max(100,$product->max_quantity)) : max(100,$product->max_quantity)); $i++) | ||||||
|  |                                         <option value="{{ $i }}">{{ $i }}</option> | ||||||
|  |                                     @endfor | ||||||
|  |                                 @endif | ||||||
|  |                             </select> | ||||||
|  |                         @endif | ||||||
|  |                     </div> | ||||||
|  |                 </div> | ||||||
|  |             </div> | ||||||
|  | 
 | ||||||
|  |             <article class="prose my-3 text-sm"> | ||||||
|  |                 {!! $product->markdownNotes() !!} | ||||||
|  |             </article> | ||||||
|  |         </div> | ||||||
|  |         @endforeach  | ||||||
|  |     @endunless | ||||||
|  | </div> | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user