fixed for square

This commit is contained in:
David Bomba 2024-10-10 12:41:55 +11:00
parent 1ed28fb1d6
commit 124904ce5e
14 changed files with 118 additions and 77 deletions

View File

@ -101,7 +101,7 @@ class Register extends Component
$this->register_fields = [...collect($this->subscription->company->client_registration_fields ?? [])->toArray()];
$first_gateway = collect($this->subscription->company->company_gateways)
$first_gateway = collect($this->subscription->company->company_gateways()->withoutTrashed()->get())
->sortBy('sort_order')
->first();

View File

@ -202,11 +202,7 @@ class RegisterOrLogin extends Component
$this->register_fields = [...collect($this->subscription->company->client_registration_fields ?? [])->toArray()];
// if ($this->subscription->company->settings->client_portal_terms || $this->subscription->company->settings->client_portal_privacy_policy) {
// $this->register_fields[] = ['key' => 'terms', 'required' => true, 'visible' => 'true'];
// }
$first_gateway = collect($this->subscription->company->company_gateways)
$first_gateway = collect($this->subscription->company->company_gateways()->withoutTrashed()->get())
->sortBy('sort_order')
->first();

View File

@ -201,4 +201,23 @@ class Subscription extends BaseModel
return null;
}
}
/**
* Calculates the maximum product quantity available
*
* @param mixed $product
* @return int
*/
public function maxQuantity(mixed $product): int
{
$max_quantity = data_get($product, 'max_quantity', 0);
$in_stock_quantity = data_get($product, 'in_stock_quantity', 0);
$max_limit = 100;
if(!$this->use_inventory_management)
return $max_quantity != 0 ? $max_quantity : $max_limit;
return $max_quantity !=0 ? $max_quantity : min($max_limit, $in_stock_quantity);
}
}

View File

@ -264,7 +264,7 @@ class CreditCard implements LivewireMethodInterface
return 'gateways.powerboard.credit_card.pay_livewire';
}
public function tokenBilling($request, $cgt, $client_present = false)
public function tokenBilling($cgt, $client_present = false)
{
$payload = [
@ -352,7 +352,7 @@ class CreditCard implements LivewireMethodInterface
->where('token', $request->token)
->first();
return $this->tokenBilling($request, $cgt, true);
return $this->tokenBilling($cgt, true);
}
elseif($request->browser_details)

View File

@ -175,6 +175,15 @@ class CBAPowerBoardPaymentDriver extends BaseDriver
public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash)
{
$this->init();
$this->setPaymentMethod($cgt->gateway_type_id);
$this->setPaymentHash($payment_hash);
$this->setClient($cgt->client);
return $this->payment_method->tokenBilling($cgt, false);
}
public function importCustomers()

File diff suppressed because one or more lines are too long

View File

@ -372,7 +372,7 @@
"src": "resources/js/setup/setup.js"
},
"resources/sass/app.scss": {
"file": "assets/app-6dd57ed5.css",
"file": "assets/app-ee6f3b1c.css",
"isEntry": true,
"src": "resources/sass/app.scss"
}

View File

@ -1,10 +1,10 @@
<div>
<livewire:billing-portal.cart.recurring-products
<livewire:billing-portal.cart.one-time-products
:subscription="$subscription"
:context="$context"
/>
<livewire:billing-portal.cart.one-time-products
<livewire:billing-portal.cart.recurring-products
:subscription="$subscription"
:context="$context"
/>
@ -18,6 +18,8 @@
:context="$context"
/>
<div class="mt-10"></div>
<livewire:billing-portal.cart.optional-one-time-products
:subscription="$subscription"
:context="$context"

View File

@ -29,7 +29,6 @@
<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
@ -37,12 +36,11 @@
@endif
<select id="{{ $product['hashed_id'] }}" wire:change="quantity($event.target.id, $event.target.value)" class="rounded-md border-gray-300 shadow-sm sm:text-sm" {{ $subscription->use_inventory_management && $product['in_stock_quantity'] < 1 ? 'disabled' : '' }}>
<option {{ $entry['quantity'] == '0' ? 'selected' : '' }} value="0" selected="selected">0</option>
@for ($i = 1; $i <= ($subscription->use_inventory_management ? min($product['in_stock_quantity'], min(100,$product['max_quantity'])) : min(100,$product['max_quantity'])); $i++)
<option value="1" selected="selected">1</option>
@for ($i = 2; $i <= $subscription->maxQuantity($product); $i++)
<option {{ $entry['quantity'] == $i ? 'selected' : '' }} value="{{ $i }}">{{ $i }}</option>
@endfor
</select>
@endif
</div>
</div>
</div>

View File

@ -37,7 +37,7 @@
<select id="{{ $product['hashed_id'] }}" wire:change="quantity($event.target.id, $event.target.value)" class="rounded-md border-gray-300 shadow-sm sm:text-sm" {{ $subscription->use_inventory_management && $product['in_stock_quantity'] < 1 ? 'disabled' : '' }}>
<option {{ $entry['quantity'] == '0' ? 'selected' : '' }} value="0" selected="selected">0</option>
@for ($i = 1; $i <= ($subscription->use_inventory_management ? min($product['in_stock_quantity'], min(100,$product['max_quantity'])) : min(100,$product['max_quantity'])); $i++)
@for ($i = 1; $i <= $subscription->maxQuantity($product); $i++)
<option {{ $entry['quantity'] == $i ? 'selected' : '' }} value="{{ $i }}">{{ $i }}</option>
@endfor
</select>

View File

@ -38,7 +38,7 @@
<select id="{{ $product['hashed_id'] }}" wire:change="quantity($event.target.id, $event.target.value)" class="rounded-md border-gray-300 shadow-sm sm:text-sm" {{ $subscription->use_inventory_management && $product['in_stock_quantity'] < 1 ? 'disabled' : '' }}>
<option {{ $entry['quantity'] == '0' ? 'selected' : '' }} value="0" selected="selected">0</option>
@for ($i = 1; $i <= ($subscription->use_inventory_management ? min($product['in_stock_quantity'], min(100,$product['max_quantity'])) : min(100,$product['max_quantity'])); $i++)
@for ($i = 1; $i <= $subscription->maxQuantity($product); $i++)
<option {{ $entry['quantity'] == $i ? 'selected' : '' }} value="{{ $i }}">{{ $i }}</option>
@endfor
</select>

View File

@ -2,30 +2,53 @@
<span class="text-gray-300">/</span>
<div x-show="{{ $property }}" class="fixed bottom-0 inset-x-0 px-4 pb-4 sm:inset-0 sm:flex sm:items-center sm:justify-center z-10">
<div x-show="{{ $property }}" x-transition:enter="ease-out duration-300" x-transition:enter-start="opacity-0" x-transition:enter-end="opacity-100" x-transition:leave="ease-in duration-200" x-transition:leave-start="opacity-100" x-transition:leave-end="opacity-0" class="fixed inset-0 transition-opacity">
<div class="absolute inset-0 bg-gray-500 opacity-75"></div>
</div>
<div x-show="{{ $property }}" class="fixed inset-0 overflow-y-auto z-50" aria-labelledby="modal-title" role="dialog" aria-modal="true">
<div class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
<div x-show="{{ $property }}"
x-transition:enter="ease-out duration-300"
x-transition:enter-start="opacity-0"
x-transition:enter-end="opacity-100"
x-transition:leave="ease-in duration-200"
x-transition:leave-start="opacity-100"
x-transition:leave-end="opacity-0"
class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity"
aria-hidden="true"></div>
<div x-show="{{ $property }}" x-transition:enter="ease-out duration-300" x-transition:enter-start="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" x-transition:enter-end="opacity-100 translate-y-0 sm:scale-100" x-transition:leave="ease-in duration-200" x-transition:leave-start="opacity-100 translate-y-0 sm:scale-100" x-transition:leave-end="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" class="relative bg-white rounded-lg px-4 pt-5 pb-4 overflow-hidden shadow-xl transform transition-all sm:max-w-lg sm:w-full sm:p-6" role="dialog" aria-modal="true" aria-labelledby="modal-headline">
<div class="hidden sm:block absolute top-0 right-0 pt-4 pr-4">
<button @click="{{ $property }} = false" type="button" class="text-gray-400 hover:text-gray-500 focus:outline-none focus:text-gray-500 transition ease-in-out duration-150" aria-label="Close">
<svg class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">&#8203;</span>
<div x-show="{{ $property }}"
x-transition:enter="ease-out duration-300"
x-transition:enter-start="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
x-transition:enter-end="opacity-100 translate-y-0 sm:scale-100"
x-transition:leave="ease-in duration-200"
x-transition:leave-start="opacity-100 translate-y-0 sm:scale-100"
x-transition:leave-end="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-4xl sm:w-full"
style="width: 90%; max-height: 90vh;">
<div class="absolute top-0 right-0 pt-4 pr-4">
<button @click="{{ $property }} = false" type="button" class="bg-white rounded-md text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
<span class="sr-only">Close</span>
<svg class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
<div class="sm:flex sm:items-start">
<div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left">
<div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left w-full">
<h3 class="text-lg leading-6 font-medium text-gray-900" id="modal-headline">
{{ $title }}
</h3>
<div class="mt-2">
<p class="text-sm leading-5 text-gray-500 h-64 overflow-y-scroll">
{{ $content }}
<div class="mt-2" style="max-height: calc(90vh - 200px); overflow-y: auto;">
<p class="text-sm leading-5 text-gray-500 whitespace-pre-line">
{!! nl2br(e($content)) !!}
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -75,7 +75,7 @@
@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++)
@for ($i = 2; $i <= $subscription->maxQuantity($product); $i++)
<option value="{{$i}}">{{$i}}</option>
@endfor
@endif
@ -169,7 +169,7 @@
@endif
>
<option value="0" selected="selected">0</option>
@for ($i = 1; $i <= ($subscription->use_inventory_management ? min($product->in_stock_quantity, max(100,$product->max_quantity)) : max(100,$product->max_quantity)); $i++)
@for ($i = 1; $i <= $subscription->maxQuantity($product); $i++)
<option value="{{$i}}">{{$i}}</option>
@endfor
</select>
@ -211,7 +211,7 @@
@endif
<select wire:model.live.debounce.300ms="data.{{ $index }}.optional_qty" class="rounded-md border-gray-300 shadow-sm sm:text-sm">
<option value="0" selected="selected">0</option>
@for ($i = 1; $i <= ($subscription->use_inventory_management ? min($product->in_stock_quantity, min(100,$product->max_quantity)) : min(100,$product->max_quantity)); $i++)
@for ($i = 1; $i <= $subscription->maxQuantity($product); $i++)
<option value="{{$i}}">{{$i}}</option>
@endfor
</select>
@ -289,10 +289,6 @@
@if($discount)
<!-- <div class="flex font-semibold justify-between py-1 text-sm uppercase">
<span>{{ ctrans('texts.subtotal') }}</span>
<span>{{ $sub_total }}</span>
</div> -->
<div class="flex font-semibold justify-between py-1 text-sm uppercase">
<span>{{ ctrans('texts.discount') }}</span>
<span>{{ $discount }}</span>

View File

@ -57,35 +57,34 @@
@component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.pay_with')])
<div class="flex flex-col" id="loader">
<div class="loader ease-linear rounded-full border-4 border-t-4 border-gray-200 h-12 w-12 mb-4"></div>
<div class="loader ease-linear rounded-full border-4 border-t-4 border-gray-200 h-12 w-12 mb-4" id="loader"></div>
</div>
<ul class="list-none hover:list-disc " id="payment-list">
<ul class="list-none space-y-2" id="payment-list">
@if (count($tokens) > 0)
@foreach($tokens as $token)
<li class="py-2 hover:text-blue hover:bg-blue-600">
<label class="mr-4">
<li class="py-2 hover:bg-gray-100 rounded transition-colors duration-150">
<label class="flex items-center cursor-pointer px-2">
<input
type="radio"
data-token="{{ $token->token }}"
name="payment-type"
class="form-check-input text-indigo-600 rounded-full cursor-pointer toggle-payment-with-token toggle-payment-with-token"
/>
<span class="ml-1 cursor-pointer">**** {{ $token->meta?->last4 }} - {{ $token->meta?->exp_month ?? 'xx' }}/{{ $token->meta?->exp_year ?? 'xx' }}</span>
class="form-radio text-indigo-600 rounded-full cursor-pointer toggle-payment-with-token"/>
<span class="ml-2 cursor-pointer">**** {{ $token->meta?->last4 }} - {{ $token->meta?->exp_month ?? 'xx' }}/{{ $token->meta?->exp_year ?? 'xx' }}</span>
</label>
</li>
@endforeach
@endisset
<li class="py-2 hover:text-blue hover:bg-blue-600">
<label>
<li class="py-2 hover:bg-gray-100 rounded transition-colors duration-150">
<label class="flex items-center cursor-pointer px-2">
<input
type="radio"
id="toggle-payment-with-credit-card"
class="form-check-input text-indigo-600 rounded-full cursor-pointer"
class="form-radio text-indigo-600 rounded-full cursor-pointer"
name="payment-type"
checked/>
<span class="ml-1 cursor-pointer">{{ __('texts.new_card') }}</span>
<span class="ml-2 cursor-pointer">{{ __('texts.new_card') }}</span>
</label>
</li>
</ul>