Add all files
This commit is contained in:
101
themes/default/views/products/checkout.blade.php
Normal file
101
themes/default/views/products/checkout.blade.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<div class="flex flex-col md:grid md:grid-cols-4 gap-6">
|
||||
<div class="flex flex-col gap-4 w-full col-span-3">
|
||||
<h1 class="text-3xl font-bold">{{ $product->name }}</h1>
|
||||
<div class="flex flex-row w-full gap-4">
|
||||
@if ($product->image)
|
||||
<img src="{{ Storage::url($product->image) }}" alt="{{ $product->name }}" class="max-w-40 h-fit">
|
||||
@endif
|
||||
<div class="max-h-28 overflow-y-auto w-full">
|
||||
<article class="prose dark:prose-invert prose-sm">
|
||||
{!! $product->description !!}
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
@if ($product->availablePlans()->count() > 1)
|
||||
<x-form.select wire:model.live="plan_id" class="text-white bg-primary-800 px-2.5 py-2.5 rounded-md w-full"
|
||||
name="plan_id" label="Select a plan">
|
||||
@foreach ($product->availablePlans() as $availablePlan)
|
||||
<option value="{{ $availablePlan->id }}">
|
||||
{{ $availablePlan->name }} -
|
||||
{{ $availablePlan->price() }}
|
||||
@if ($availablePlan->price()->has_setup_fee)
|
||||
+ {{ $availablePlan->price()->formatted->setup_fee }} {{ __('product.setup_fee') }}
|
||||
@endif
|
||||
</option>
|
||||
@endforeach
|
||||
</x-form.select>
|
||||
@endif
|
||||
|
||||
@foreach ($product->configOptions as $configOption)
|
||||
@php
|
||||
$showPriceTag = $configOption->children->filter(fn ($value) => !$value->price(billing_period: $plan->billing_period, billing_unit: $plan->billing_unit)->is_free)->count() > 0;
|
||||
@endphp
|
||||
<x-form.configoption :config="$configOption" :name="'configOptions.' . $configOption->id" :showPriceTag="$showPriceTag" :plan="$plan">
|
||||
@if ($configOption->type == 'select')
|
||||
@foreach ($configOption->children as $configOptionValue)
|
||||
<option value="{{ $configOptionValue->id }}">
|
||||
{{ $configOptionValue->name }}
|
||||
{{ ($showPriceTag && $configOptionValue->price(billing_period: $plan->billing_period, billing_unit: $plan->billing_unit)->available) ? ' - ' . $configOptionValue->price(billing_period: $plan->billing_period, billing_unit: $plan->billing_unit) : '' }}
|
||||
</option>
|
||||
@endforeach
|
||||
@elseif($configOption->type == 'radio')
|
||||
@foreach ($configOption->children as $configOptionValue)
|
||||
<div class="flex items-center gap-2">
|
||||
<input type="radio" id="{{ $configOptionValue->id }}" name="{{ $configOption->id }}"
|
||||
wire:model.live="configOptions.{{ $configOption->id }}"
|
||||
value="{{ $configOptionValue->id }}" />
|
||||
<label for="{{ $configOptionValue->id }}">
|
||||
{{ $configOptionValue->name }}
|
||||
{{ ($showPriceTag && $configOptionValue->price(billing_period: $plan->billing_period, billing_unit: $plan->billing_unit)->available) ? ' - ' . $configOptionValue->price(billing_period: $plan->billing_period, billing_unit: $plan->billing_unit) : '' }}
|
||||
</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@endif
|
||||
</x-form.configoption>
|
||||
@endforeach
|
||||
@foreach ($this->getCheckoutConfig() as $configOption)
|
||||
@php $configOption = (object) $configOption; @endphp
|
||||
<x-form.configoption :config="$configOption" :name="'checkoutConfig.' . $configOption->name">
|
||||
@if ($configOption->type == 'select')
|
||||
@foreach ($configOption->options as $configOptionValue => $configOptionValueName)
|
||||
<option value="{{ $configOptionValue }}">
|
||||
{{ $configOptionValueName }}
|
||||
</option>
|
||||
@endforeach
|
||||
@elseif($configOption->type == 'radio')
|
||||
@foreach ($configOption->options as $configOptionValue => $configOptionValueName)
|
||||
<div class="flex items-center gap-2">
|
||||
<input type="radio" id="{{ $configOptionValue }}" name="{{ $configOption->name }}"
|
||||
wire:model.live="checkoutConfig.{{ $configOption->name }}"
|
||||
value="{{ $configOptionValue }}" />
|
||||
<label for="{{ $configOptionValue }}">
|
||||
{{ $configOptionValueName }}
|
||||
</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@endif
|
||||
</x-form.configoption>
|
||||
@endforeach
|
||||
</div>
|
||||
<div class="flex flex-col gap-2 w-full col-span-1 bg-background-secondary p-3 rounded-md h-fit">
|
||||
<h2 class="text-2xl font-semibold mb-2">
|
||||
{{ __('product.order_summary') }}
|
||||
</h2>
|
||||
<div class="text- font-semibold flex justify-between">
|
||||
<h4>{{ __('product.total_today') }}:</h4> {{ $total }}
|
||||
</div>
|
||||
@if ($total->setup_fee && $plan->type == 'recurring')
|
||||
<div class="text- font-semibold flex justify-between ">
|
||||
<h4>{{ __('product.then_after_x', ['time' => $plan->billing_period . ' ' . trans_choice(__('services.billing_cycles.' . $plan->billing_unit), $plan->billing_period)]) }}:
|
||||
</h4> {{ $total->format($total->price - $total->setup_fee) }}
|
||||
</div>
|
||||
@endif
|
||||
@if (($product->stock > 0 || !$product->stock) && $product->price()->available)
|
||||
<div>
|
||||
<x-button.primary wire:click="checkout" wire:loading.attr="disabled">
|
||||
{{ __('product.checkout') }}
|
||||
</x-button.primary>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user