Updates for translations for Stripe

This commit is contained in:
David Bomba 2022-12-02 06:59:16 +11:00
parent 043178fbdb
commit 986ed9016a
5 changed files with 100 additions and 42 deletions

View File

@ -183,7 +183,7 @@ class MigrationController extends BaseController
$company->expenses()->forceDelete();
$company->bank_transaction_rules()->forceDelete();
$company->bank_transactions()->forceDelete();
$company->bank_integrations()->forceDelete();
// $company->bank_integrations()->forceDelete();
$company->all_activities()->forceDelete();

View File

@ -39,14 +39,6 @@ class BillingPortalPurchasev2 extends Component
*/
public $hash;
/**
* Top level text on the left side of billing page.
*
* @var string
*/
public $heading_text;
/**
* E-mail address model for user input.
*
@ -80,9 +72,13 @@ class BillingPortalPurchasev2 extends Component
*
* @var \string[][]
*/
protected $rules = [
'email' => ['required', 'email'],
];
// protected $rules = [
// 'email' => ['required', 'email'],
// 'data' => ['required', 'array'],
// 'data.*.recurring_qty' => ['required', 'between:100,1000'],
// 'data.*.optional_recurring_qty' => ['required', 'between:100,1000'],
// 'data.*.optional_qty' => ['required', 'between:100,1000'],
// ];
/**
* Id for CompanyGateway record.
@ -120,6 +116,8 @@ class BillingPortalPurchasev2 extends Component
'payment_required' => true,
];
public $data = [];
/**
* List of payment methods fetched from client.
*
@ -187,6 +185,8 @@ class BillingPortalPurchasev2 extends Component
$this->quantity = 1;
$this->data = [];
$this->price = $this->subscription->price;
if (request()->query('coupon')) {
@ -198,6 +198,44 @@ class BillingPortalPurchasev2 extends Component
}
}
public function updatingData()
{
nlog('updating');
// nlog($this->data);
}
public function updatedData()
{
nlog('updated');
nlog($this->data);
$validatedData = $this->validate();
nlog( $validatedData );
}
public function updated($propertyName)
{
nlog("validating {$propertyName}");
$this->errors = $this->validateOnly($propertyName);
nlog($this->errors);
$validatedData = $this->validate();
nlog( $validatedData );
}
public function rules()
{
$rules = [
'email' => ['required', 'email'],
'data' => ['required', 'array'],
'data.*.recurring_qty' => ['required', 'between:100,1000'],
'data.*.optional_recurring_qty' => ['required', 'between:100,1000'],
'data.*.optional_qty' => ['required', 'between:100,1000'],
];
return $rules;
}
/**
* Handle user authentication
*
@ -265,9 +303,6 @@ class BillingPortalPurchasev2 extends Component
}
}
// nlog($this->subscription->group_settings->settings);
// nlog($this->subscription->group_settings->settings->currency_id);
if(array_key_exists('currency_id', $this->request_data)) {
$currency = Cache::get('currencies')->filter(function ($item){
@ -525,4 +560,11 @@ class BillingPortalPurchasev2 extends Component
return render('components.livewire.billing-portal-purchasev2');
}
public function changeData()
{
nlog($this->data);
}
}

View File

@ -175,7 +175,7 @@ class ACH
if ($invoice) {
$description = ctrans('texts.stripe_paymenttext', ['invoicenumber' => $invoice->number, 'amount' => Number::formatMoney($amount, $this->stripe->client), 'client' => $this->stripe->client->present()->name()]);
} else {
$description = ctrans('text.stripe_paymenttext_without_invoice', ['amount' => Number::formatMoney($amount, $this->stripe->client), 'client' => $this->stripe->client->present()->name()]);
$description = ctrans('texts.stripe_paymenttext_without_invoice', ['amount' => Number::formatMoney($amount, $this->stripe->client), 'client' => $this->stripe->client->present()->name()]);
}
@ -213,7 +213,7 @@ class ACH
if ($invoice) {
$description = ctrans('texts.stripe_paymenttext', ['invoicenumber' => $invoice->number, 'amount' => Number::formatMoney($amount, $this->stripe->client), 'client' => $this->stripe->client->present()->name()]);
} else {
$description = ctrans('text.stripe_paymenttext_without_invoice', ['amount' => Number::formatMoney($amount, $this->stripe->client), 'client' => $this->stripe->client->present()->name()]);
$description = ctrans('texts.stripe_paymenttext_without_invoice', ['amount' => Number::formatMoney($amount, $this->stripe->client), 'client' => $this->stripe->client->present()->name()]);
}
if (substr($cgt->token, 0, 2) === 'pm') {
@ -457,7 +457,7 @@ class ACH
if ($invoice) {
$description = ctrans('texts.stripe_paymenttext', ['invoicenumber' => $invoice->number, 'amount' => Number::formatMoney($amount, $this->stripe->client), 'client' => $this->stripe->client->present()->name()]);
} else {
$description = ctrans('text.stripe_paymenttext_without_invoice', ['amount' => Number::formatMoney($amount, $this->stripe->client), 'client' => $this->stripe->client->present()->name()]);
$description = ctrans('texts.stripe_paymenttext_without_invoice', ['amount' => Number::formatMoney($amount, $this->stripe->client), 'client' => $this->stripe->client->present()->name()]);
}
if (substr($source->token, 0, 2) === 'pm') {

View File

@ -65,7 +65,7 @@ class Charge
if ($invoice) {
$description = ctrans('texts.stripe_paymenttext', ['invoicenumber' => $invoice->number, 'amount' => Number::formatMoney($amount, $this->stripe->client), 'client' => $this->stripe->client->present()->name()]);
} else {
$description = ctrans('text.stripe_paymenttext_without_invoice', ['amount' => Number::formatMoney($amount, $this->stripe->client), 'client' => $this->stripe->client->present()->name()]);
$description = ctrans('texts.stripe_paymenttext_without_invoice', ['amount' => Number::formatMoney($amount, $this->stripe->client), 'client' => $this->stripe->client->present()->name()]);
}
$this->stripe->init();

View File

@ -1,7 +1,3 @@
<style type="text/css">
</style>
<div class="grid grid-cols-12">
<div class="col-span-8 bg-gray-50 flex flex-col max-h-100px items-center h-screen">
<div class="w-full p-4 md:max-w-3xl">
@ -14,7 +10,7 @@
<!-- Recurring Plan Products-->
<ul role="list" class="-my-6 divide-y divide-gray-200">
@if(!empty($subscription->recurring_product_ids))
@foreach($subscription->service()->recurring_products() as $product)
@foreach($subscription->service()->recurring_products() as $index => $product)
<li class="flex py-6">
@if(false)
<div class="h-24 w-24 flex-shrink-0 overflow-hidden rounded-md border border-gray-200">
@ -25,19 +21,34 @@
<div>
<div class="flex justify-between text-base font-medium text-gray-900">
<h3>
<a href="#">{!! nl2br($product->notes) !!}</a>
{!! nl2br($product->notes) !!}
</h3>
<p class="ml-0">{{ \App\Utils\Number::formatMoney($product->price, $subscription->company) }} / {{ App\Models\RecurringInvoice::frequencyForKey($subscription->frequency_id) }}</p>
</div>
<p class="mt-1 text-sm text-gray-500"></p>
</div>
<div class="flex flex-1 items-end justify-between text-sm">
<p class="text-gray-500"></p>
<div class="flex">
<p></p>
</div>
<div class="flex content-end text-sm mt-1">
@if($subscription->per_seat_enabled)
<p class="text-gray-500 w-full"></p>
<div class="flex place-content-end">
<p class="text-sm font-light text-gray-700 text-right mr-2 mt-2">{{ ctrans('texts.qty') }}</p>
<input wire:model="data.{{ $index }}.recurring_qty" type="text" class="w-1/4 rounded-md border-gray-300 shadow-sm sm:text-sm text-center" placeholder="0"/>
</div>
@endif
</div>
{{ isset($data[$index]['recurring_qty']) ? $data[$index]['recurring_qty'] : 'merp' }}
@if($errors)
@foreach($errors as $error)
{{ $error }}
@endforeach
@endif
@error('data.{{$index}}.recurring_qty')
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative" role="alert">
<span class="block sm:inline">{{ $message }} </span>
<span class="absolute top-0 bottom-0 right-0 px-4 py-3">
</div>
@enderror
</div>
</li>
@endforeach
@ -55,7 +66,7 @@
<div>
<div class="flex justify-between text-base font-medium text-gray-900">
<h3>
<a href="#">{!! nl2br($product->notes) !!}</a>
{!! nl2br($product->notes) !!}
</h3>
<p class="ml-0">{{ \App\Utils\Number::formatMoney($product->price, $subscription->company) }}</p>
</div>
@ -82,7 +93,7 @@
<!-- Optional Recurring Products-->
<ul role="list" class="-my-6 divide-y divide-gray-200">
@if(!empty($subscription->optional_recurring_product_ids))
@foreach($subscription->service()->optional_recurring_products() as $product)
@foreach($subscription->service()->optional_recurring_products() as $index => $product)
<li class="flex py-6">
@if(false)
<div class="h-24 w-24 flex-shrink-0 overflow-hidden rounded-md border border-gray-200 mr-2">
@ -101,16 +112,21 @@
<p class="text-gray-500 w-full"></p>
<div class="flex place-content-end">
<p class="text-sm font-light text-gray-700 text-right mr-2 mt-2">{{ ctrans('texts.qty') }}</p>
<input type="text" name="optional_recurring_qty" class="w-1/4 rounded-md border-gray-300 shadow-sm sm:text-sm text-center" placeholder="0">
<input wire:model="data.{{ $index }}.optional_recurring_qty" type="text" class="w-1/4 rounded-md border-gray-300 shadow-sm sm:text-sm text-center" placeholder="0"/>
</div>
</div>
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative" role="alert">
<span class="block sm:inline">{{ isset($data[$index]['optional_recurring_qty']) ? $data[$index]['optional_recurring_qty'] : '' }}</span>
<span class="absolute top-0 bottom-0 right-0 px-4 py-3">
</div>
</div>
</li>
@endforeach
@endif
@if(!empty($subscription->optional_product_ids))
@foreach($subscription->service()->optional_products() as $product)
@foreach($subscription->service()->optional_products() as $index => $product)
<li class="flex py-6">
@if(false)
<div class="h-24 w-24 flex-shrink-0 overflow-hidden rounded-md border border-gray-200 mr-2">
@ -129,9 +145,12 @@
<p class="text-gray-500 w-full"></p>
<div class="flex place-content-end">
<p class="text-sm font-light text-gray-700 text-right mr-2 mt-2">{{ ctrans('texts.qty') }}</p>
<input type="text" name="optional_recurring_qty" class="w-1/4 rounded-md border-gray-300 shadow-sm sm:text-sm text-center" placeholder="0">
<input type="text" wire:model="data.{{ $index }}.optional_qty" class="w-1/4 rounded-md border-gray-300 shadow-sm sm:text-sm text-center" placeholder="0">
</div>
</div>
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative" role="alert">
<span class="block sm:inline">{{ isset($data[$index]['optional_qty']) ? $data[$index]['optional_qty'] : '' }}</span>
<span class="absolute top-0 bottom-0 right-0 px-4 py-3">
</div>
</div>
</li>
@ -192,7 +211,4 @@
</div>
</div>
</div>
</div>
</div>