Fixes for billing portal purchase v2
This commit is contained in:
parent
a7f986d36f
commit
e7823ccc43
|
|
@ -11,27 +11,28 @@
|
|||
|
||||
namespace App\Livewire;
|
||||
|
||||
use App\DataMapper\ClientSettings;
|
||||
use App\Factory\ClientFactory;
|
||||
use App\Jobs\Mail\NinjaMailerJob;
|
||||
use App\Jobs\Mail\NinjaMailerObject;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Mail\Subscription\OtpCode;
|
||||
use App\Models\Client;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\RecurringInvoice;
|
||||
use App\Models\Subscription;
|
||||
use App\Repositories\ClientContactRepository;
|
||||
use App\Repositories\ClientRepository;
|
||||
use App\Utils\Number;
|
||||
use App\Models\Client;
|
||||
use App\Models\Invoice;
|
||||
use Livewire\Component;
|
||||
use App\Libraries\MultiDB;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\Subscription;
|
||||
use App\Models\ClientContact;
|
||||
use InvalidArgumentException;
|
||||
use App\Factory\ClientFactory;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Models\RecurringInvoice;
|
||||
use App\Jobs\Mail\NinjaMailerJob;
|
||||
use Livewire\Attributes\Computed;
|
||||
use App\DataMapper\ClientSettings;
|
||||
use App\Mail\Subscription\OtpCode;
|
||||
use App\Jobs\Mail\NinjaMailerObject;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Str;
|
||||
use InvalidArgumentException;
|
||||
use App\Repositories\ClientRepository;
|
||||
use App\Repositories\ClientContactRepository;
|
||||
use Laracasts\Presenter\Exceptions\PresenterException;
|
||||
use Livewire\Component;
|
||||
|
||||
class BillingPortalPurchasev2 extends Component
|
||||
{
|
||||
|
|
@ -50,19 +51,9 @@ class BillingPortalPurchasev2 extends Component
|
|||
*/
|
||||
public $email;
|
||||
|
||||
/**
|
||||
* Instance of subscription.
|
||||
*
|
||||
* @var \App\Models\Subscription
|
||||
*/
|
||||
public $subscription;
|
||||
|
||||
public $subscription_id;
|
||||
|
||||
/**
|
||||
* Instance of client contact.
|
||||
*
|
||||
* @var null|ClientContact
|
||||
*/
|
||||
public $contact;
|
||||
|
||||
/**
|
||||
* Id for CompanyGateway record.
|
||||
|
|
@ -90,15 +81,6 @@ class BillingPortalPurchasev2 extends Component
|
|||
* @var array
|
||||
*/
|
||||
public $methods = [];
|
||||
|
||||
/**
|
||||
* Instance of \App\Models\Invoice
|
||||
*
|
||||
* @var Invoice
|
||||
*/
|
||||
|
||||
public \App\Models\Invoice $invoice;
|
||||
|
||||
/**
|
||||
* Coupon model for user input
|
||||
*
|
||||
|
|
@ -123,14 +105,6 @@ class BillingPortalPurchasev2 extends Component
|
|||
*/
|
||||
public $request_data = [];
|
||||
|
||||
/**
|
||||
* Instance of company.
|
||||
*
|
||||
* @var \App\Models\Company
|
||||
*/
|
||||
public $company;
|
||||
|
||||
|
||||
/**
|
||||
* Instance of company.
|
||||
*
|
||||
|
|
@ -172,17 +146,27 @@ class BillingPortalPurchasev2 extends Component
|
|||
public ?string $client_city;
|
||||
public ?string $client_postal_code;
|
||||
|
||||
#[Computed]
|
||||
public function subscription()
|
||||
{
|
||||
return Subscription::query()->with('company')->find($this->subscription_id);
|
||||
}
|
||||
|
||||
#[Computed]
|
||||
public function contact()
|
||||
{
|
||||
return auth()->guard('contact')->user();
|
||||
}
|
||||
|
||||
public function mount()
|
||||
{
|
||||
MultiDB::setDb($this->db);
|
||||
|
||||
$this->subscription = Subscription::query()->with('company')->find($this->subscription);
|
||||
|
||||
$this->company = $this->subscription->company;
|
||||
/** @var \App\Models\Subscription $subscription */
|
||||
$subscription = $this->subscription();
|
||||
|
||||
if (auth()->guard('contact')->check()) {
|
||||
$this->email = auth()->guard('contact')->user()->email;
|
||||
$this->contact = auth()->guard('contact')->user();
|
||||
$this->authenticated = true;
|
||||
$this->payment_started = true;
|
||||
} else {
|
||||
|
|
@ -198,13 +182,13 @@ class BillingPortalPurchasev2 extends Component
|
|||
|
||||
$this->data = [];
|
||||
|
||||
$this->price = $this->subscription->price; // ?
|
||||
$this->price = $subscription->price; // ?
|
||||
$this->float_amount_total = $this->price;
|
||||
|
||||
$this->recurring_products = $this->subscription->service()->recurring_products();
|
||||
$this->products = $this->subscription->service()->products();
|
||||
$this->optional_recurring_products = $this->subscription->service()->optional_recurring_products();
|
||||
$this->optional_products = $this->subscription->service()->optional_products();
|
||||
$this->products = $subscription->service()->products();
|
||||
$this->recurring_products = $subscription->service()->recurring_products();
|
||||
$this->optional_recurring_products = $subscription->service()->optional_recurring_products();
|
||||
$this->optional_products = $subscription->service()->optional_products();
|
||||
|
||||
$this->bundle = collect();
|
||||
|
||||
|
|
@ -213,8 +197,8 @@ class BillingPortalPurchasev2 extends Component
|
|||
if (request()->query('coupon')) {
|
||||
$this->coupon = request()->query('coupon');
|
||||
$this->handleCoupon();
|
||||
} elseif (isset($this->subscription->promo_code) && strlen($this->subscription->promo_code) == 0 && $this->subscription->promo_discount > 0) {
|
||||
$this->price = $this->subscription->promo_price;
|
||||
} elseif (isset($subscription->promo_code) && strlen($subscription->promo_code ?? '') == 0 && $subscription->promo_discount > 0) {
|
||||
$this->price = $subscription->promo_price;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -229,6 +213,8 @@ class BillingPortalPurchasev2 extends Component
|
|||
$this->resetErrorBag('login');
|
||||
$this->resetValidation('login');
|
||||
|
||||
$subscription = $this->subscription();
|
||||
|
||||
$code = Cache::get("subscriptions:otp:{$this->email}");
|
||||
|
||||
if ($user_code != $code) {
|
||||
|
|
@ -238,14 +224,13 @@ class BillingPortalPurchasev2 extends Component
|
|||
}
|
||||
|
||||
$contact = ClientContact::where('email', $this->email)
|
||||
->where('company_id', $this->subscription->company_id)
|
||||
->where('company_id', $subscription->company_id)
|
||||
->first();
|
||||
|
||||
if ($contact) {
|
||||
Auth::guard('contact')->loginUsingId($contact->id, true);
|
||||
$this->contact = $contact;
|
||||
|
||||
} else {
|
||||
// $this->createClientContact();
|
||||
$this->createBlankClient();
|
||||
}
|
||||
|
||||
|
|
@ -277,13 +262,15 @@ class BillingPortalPurchasev2 extends Component
|
|||
|
||||
private function emailOtpCode($code)
|
||||
{
|
||||
$subscription = $this->subscription();
|
||||
|
||||
$cc = new ClientContact();
|
||||
$cc->email = $this->email;
|
||||
|
||||
$nmo = new NinjaMailerObject();
|
||||
$nmo->mailable = new OtpCode($this->subscription->company, $this->contact, $code);
|
||||
$nmo->company = $this->subscription->company;
|
||||
$nmo->settings = $this->subscription->company->settings;
|
||||
$nmo->mailable = new OtpCode($subscription->company, $cc, $code);
|
||||
$nmo->company = $subscription->company;
|
||||
$nmo->settings = $subscription->company->settings;
|
||||
$nmo->to_user = $cc;
|
||||
NinjaMailerJob::dispatch($nmo);
|
||||
}
|
||||
|
|
@ -293,10 +280,13 @@ class BillingPortalPurchasev2 extends Component
|
|||
*/
|
||||
public function handleCoupon()
|
||||
{
|
||||
|
||||
$subscription = $this->subscription();
|
||||
|
||||
$this->resetErrorBag('coupon');
|
||||
$this->resetValidation('coupon');
|
||||
|
||||
if ($this->coupon == $this->subscription->promo_code) {
|
||||
if ($this->coupon == $subscription->promo_code) {
|
||||
$this->valid_coupon = true;
|
||||
$this->buildBundle();
|
||||
} else {
|
||||
|
|
@ -315,6 +305,7 @@ class BillingPortalPurchasev2 extends Component
|
|||
public function buildBundle()
|
||||
{
|
||||
$this->bundle = collect();
|
||||
$subscription = $this->subscription();
|
||||
|
||||
$data = $this->data;
|
||||
|
||||
|
|
@ -328,7 +319,7 @@ class BillingPortalPurchasev2 extends Component
|
|||
'product_key' => $p->product_key,
|
||||
'unit_cost' => $p->price,
|
||||
'product' => substr(strip_tags($p->markdownNotes()), 0, 50),
|
||||
'price' => Number::formatMoney($total, $this->subscription->company).' / '. RecurringInvoice::frequencyForKey($this->subscription->frequency_id),
|
||||
'price' => Number::formatMoney($total, $subscription->company).' / '. RecurringInvoice::frequencyForKey($subscription->frequency_id),
|
||||
'total' => $total,
|
||||
'qty' => $qty,
|
||||
'is_recurring' => true,
|
||||
|
|
@ -346,7 +337,7 @@ class BillingPortalPurchasev2 extends Component
|
|||
'product_key' => $p->product_key,
|
||||
'unit_cost' => $p->price,
|
||||
'product' => substr(strip_tags($p->markdownNotes()), 0, 50),
|
||||
'price' => Number::formatMoney($total, $this->subscription->company),
|
||||
'price' => Number::formatMoney($total, $subscription->company),
|
||||
'total' => $total,
|
||||
'qty' => $qty,
|
||||
'is_recurring' => false
|
||||
|
|
@ -369,7 +360,7 @@ class BillingPortalPurchasev2 extends Component
|
|||
'product_key' => $p->product_key,
|
||||
'unit_cost' => $p->price,
|
||||
'product' => substr(strip_tags($p->markdownNotes()), 0, 50),
|
||||
'price' => Number::formatMoney($total, $this->subscription->company).' / '. RecurringInvoice::frequencyForKey($this->subscription->frequency_id),
|
||||
'price' => Number::formatMoney($total, $subscription->company).' / '. RecurringInvoice::frequencyForKey($subscription->frequency_id),
|
||||
'total' => $total,
|
||||
'qty' => $qty,
|
||||
'is_recurring' => true
|
||||
|
|
@ -392,7 +383,7 @@ class BillingPortalPurchasev2 extends Component
|
|||
'product_key' => $p->product_key,
|
||||
'unit_cost' => $p->price,
|
||||
'product' => substr(strip_tags($p->markdownNotes()), 0, 50),
|
||||
'price' => Number::formatMoney($total, $this->subscription->company),
|
||||
'price' => Number::formatMoney($total, $subscription->company),
|
||||
'total' => $total,
|
||||
'qty' => $qty,
|
||||
'is_recurring' => false
|
||||
|
|
@ -401,63 +392,31 @@ class BillingPortalPurchasev2 extends Component
|
|||
}
|
||||
}
|
||||
|
||||
$this->sub_total = Number::formatMoney($this->bundle->sum('total'), $this->subscription->company);
|
||||
$this->recurring_total = Number::formatMoney($this->bundle->where('is_recurring', true)->sum('total'), $this->subscription->company);
|
||||
$this->non_recurring_total = Number::formatMoney($this->bundle->where('is_recurring', false)->sum('total'), $this->subscription->company);
|
||||
$this->sub_total = Number::formatMoney($this->bundle->sum('total'), $subscription->company);
|
||||
$this->recurring_total = Number::formatMoney($this->bundle->where('is_recurring', true)->sum('total'), $subscription->company);
|
||||
$this->non_recurring_total = Number::formatMoney($this->bundle->where('is_recurring', false)->sum('total'), $subscription->company);
|
||||
$this->total = $this->sub_total;
|
||||
|
||||
if ($this->valid_coupon) {
|
||||
if ($this->subscription->is_amount_discount) {
|
||||
$discount = $this->subscription->promo_discount;
|
||||
if ($this->subscription()->is_amount_discount) {
|
||||
$discount = $subscription->promo_discount;
|
||||
} else {
|
||||
$discount = round($this->bundle->sum('total') * ($this->subscription->promo_discount / 100), 2);
|
||||
$discount = round($this->bundle->sum('total') * ($subscription->promo_discount / 100), 2);
|
||||
}
|
||||
|
||||
$this->discount = Number::formatMoney($discount, $this->subscription->company);
|
||||
$this->discount = Number::formatMoney($discount, $subscription->company);
|
||||
|
||||
$this->total = Number::formatMoney(($this->bundle->sum('total') - $discount), $this->subscription->company);
|
||||
$this->total = Number::formatMoney(($this->bundle->sum('total') - $discount), $subscription->company);
|
||||
|
||||
$this->float_amount_total = ($this->bundle->sum('total') - $discount);
|
||||
} else {
|
||||
$this->float_amount_total = $this->bundle->sum('total');
|
||||
$this->total = Number::formatMoney($this->float_amount_total, $this->subscription->company);
|
||||
$this->total = Number::formatMoney($this->float_amount_total, $subscription->company);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this
|
||||
* @throws PresenterException
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
// private function createClientContact()
|
||||
// {
|
||||
// $company = $this->subscription->company;
|
||||
// $user = $this->subscription->user;
|
||||
// $user->setCompany($company);
|
||||
|
||||
// $client_repo = new ClientRepository(new ClientContactRepository());
|
||||
// $data = [
|
||||
// 'name' => '',
|
||||
// 'group_settings_id' => $this->subscription->group_id,
|
||||
// 'contacts' => [
|
||||
// ['email' => $this->email],
|
||||
// ],
|
||||
// 'client_hash' => Str::random(40),
|
||||
// 'settings' => ClientSettings::defaults(),
|
||||
// ];
|
||||
|
||||
// $client = $client_repo->save($data, ClientFactory::create($company->id, $user->id));
|
||||
|
||||
// $this->contact = $client->fresh()->contacts()->first();
|
||||
|
||||
// Auth::guard('contact')->loginUsingId($this->contact->id, true);
|
||||
|
||||
// return $this;
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* @param mixed $propertyName
|
||||
*
|
||||
|
|
@ -481,13 +440,14 @@ class BillingPortalPurchasev2 extends Component
|
|||
*/
|
||||
protected function getPaymentMethods(): self
|
||||
{
|
||||
$contact = $this->contact();
|
||||
|
||||
if ($this->float_amount_total == 0) {
|
||||
$this->methods = [];
|
||||
}
|
||||
|
||||
if ($this->contact && $this->float_amount_total >= 0) {
|
||||
$this->methods = $this->contact->client->service()->getPaymentMethods($this->float_amount_total);
|
||||
if ($contact && $this->float_amount_total >= 0) {
|
||||
$this->methods = $contact->client->service()->getPaymentMethods($this->float_amount_total);
|
||||
}
|
||||
|
||||
foreach($this->methods as $method) {
|
||||
|
|
@ -505,11 +465,13 @@ class BillingPortalPurchasev2 extends Component
|
|||
protected function rff()
|
||||
{
|
||||
|
||||
$this->contact_first_name = $this->contact->first_name;
|
||||
$this->contact_last_name = $this->contact->last_name;
|
||||
$this->contact_email = $this->contact->email;
|
||||
$this->client_city = $this->contact->client->city;
|
||||
$this->client_postal_code = $this->contact->client->postal_code;
|
||||
$contact = $this->contact();
|
||||
|
||||
$this->contact_first_name = $contact->first_name;
|
||||
$this->contact_last_name = $contact->last_name;
|
||||
$this->contact_email = $contact->email;
|
||||
$this->client_city = $contact->client->city;
|
||||
$this->client_postal_code = $contact->client->postal_code;
|
||||
|
||||
if(
|
||||
strlen($this->contact_first_name ?? '') == 0 ||
|
||||
|
|
@ -535,15 +497,17 @@ class BillingPortalPurchasev2 extends Component
|
|||
'contact_email' => ['required', 'email'],
|
||||
]);
|
||||
|
||||
$contact = $this->contact();
|
||||
|
||||
$this->check_rff = false;
|
||||
|
||||
$this->contact->first_name = $validated['contact_first_name'];
|
||||
$this->contact->last_name = $validated['contact_last_name'];
|
||||
$this->contact->email = $validated['contact_email'];
|
||||
$this->contact->client->postal_code = $validated['client_postal_code'];
|
||||
$this->contact->client->city = $validated['client_city'];
|
||||
$contact->first_name = $validated['contact_first_name'];
|
||||
$contact->last_name = $validated['contact_last_name'];
|
||||
$contact->email = $validated['contact_email'];
|
||||
$contact->client->postal_code = $validated['client_postal_code'];
|
||||
$contact->client->city = $validated['client_city'];
|
||||
|
||||
$this->contact->pushQuietly();
|
||||
$contact->pushQuietly();
|
||||
|
||||
$this->refreshComponent();
|
||||
|
||||
|
|
@ -582,7 +546,10 @@ class BillingPortalPurchasev2 extends Component
|
|||
*/
|
||||
public function handleBeforePaymentEvents(): self
|
||||
{
|
||||
$eligibility_check = $this->subscription->service()->isEligible($this->contact);
|
||||
$subscription = $this->subscription();
|
||||
$contact = $this->contact();
|
||||
|
||||
$eligibility_check = $subscription->service()->isEligible($contact);
|
||||
|
||||
if (is_array($eligibility_check) && $eligibility_check['message'] != 'Success') {
|
||||
$this->is_eligible = false;
|
||||
|
|
@ -592,33 +559,33 @@ class BillingPortalPurchasev2 extends Component
|
|||
}
|
||||
|
||||
$data = [
|
||||
'client_id' => $this->contact->client->hashed_id,
|
||||
'client_id' => $contact->client->hashed_id,
|
||||
'date' => now()->format('Y-m-d'),
|
||||
'invitations' => [[
|
||||
'key' => '',
|
||||
'client_contact_id' => $this->contact->hashed_id,
|
||||
'client_contact_id' => $contact->hashed_id,
|
||||
]],
|
||||
'user_input_promo_code' => $this->coupon,
|
||||
'coupon' => empty($this->subscription->promo_code) ? '' : $this->coupon,
|
||||
'coupon' => empty($subscription->promo_code) ? '' : $this->coupon,
|
||||
];
|
||||
|
||||
$this->invoice = $this->subscription
|
||||
$invoice = $this->subscription()
|
||||
->service()
|
||||
->createInvoiceV2($this->bundle, $this->contact->client_id, $this->valid_coupon)
|
||||
->createInvoiceV2($this->bundle, $contact->client_id, $this->valid_coupon)
|
||||
->service()
|
||||
->markSent()
|
||||
->fillDefaults()
|
||||
->adjustInventory()
|
||||
->save();
|
||||
|
||||
$this->payable_amount = $this->invoice->partial > 0 ? \App\Utils\Number::formatValue($this->invoice->partial, $this->invoice->client->currency()) : \App\Utils\Number::formatValue($this->invoice->balance, $this->invoice->client->currency());
|
||||
$this->invoice_hashed_id = $this->invoice->hashed_id;
|
||||
$this->payable_amount = $invoice->partial > 0 ? \App\Utils\Number::formatValue($invoice->partial, $invoice->client->currency()) : \App\Utils\Number::formatValue($invoice->balance, $invoice->client->currency());
|
||||
$this->invoice_hashed_id = $invoice->hashed_id;
|
||||
|
||||
Cache::put($this->hash, [
|
||||
'subscription_id' => $this->subscription->hashed_id,
|
||||
'email' => $this->email ?? $this->contact->email,
|
||||
'client_id' => $this->contact->client->hashed_id,
|
||||
'invoice_id' => $this->invoice->hashed_id,
|
||||
'subscription_id' => $this->subscription()->hashed_id,
|
||||
'email' => $this->email ?? $contact->email,
|
||||
'client_id' => $contact->client->hashed_id,
|
||||
'invoice_id' => $invoice->hashed_id,
|
||||
'context' => 'purchase',
|
||||
'campaign' => $this->campaign,
|
||||
'bundle' => $this->bundle,
|
||||
|
|
@ -635,11 +602,13 @@ class BillingPortalPurchasev2 extends Component
|
|||
*/
|
||||
public function handleTrial()
|
||||
{
|
||||
return $this->subscription->service()->startTrial([
|
||||
'email' => $this->email ?? $this->contact->email,
|
||||
$contact = $this->contact();
|
||||
|
||||
return $this->subscription()->service()->startTrial([
|
||||
'email' => $this->email ?? $contact->email,
|
||||
'quantity' => $this->quantity,
|
||||
'contact_id' => $this->contact->hashed_id,
|
||||
'client_id' => $this->contact->client->hashed_id,
|
||||
'contact_id' => $contact->hashed_id,
|
||||
'client_id' => $contact->client->hashed_id,
|
||||
'bundle' => $this->bundle,
|
||||
]);
|
||||
}
|
||||
|
|
@ -652,7 +621,10 @@ class BillingPortalPurchasev2 extends Component
|
|||
*/
|
||||
public function handlePaymentNotRequired()
|
||||
{
|
||||
$eligibility_check = $this->subscription->service()->isEligible($this->contact);
|
||||
$subscription = $this->subscription();
|
||||
$contact = $this->contact();
|
||||
|
||||
$eligibility_check = $subscription->service()->isEligible($contact);
|
||||
|
||||
if (is_array($eligibility_check) && $eligibility_check['message'] != 'Success') {
|
||||
$this->is_eligible = false;
|
||||
|
|
@ -660,9 +632,9 @@ class BillingPortalPurchasev2 extends Component
|
|||
return $this;
|
||||
}
|
||||
|
||||
$invoice = $this->subscription
|
||||
$invoice = $this->subscription()
|
||||
->service()
|
||||
->createInvoiceV2($this->bundle, $this->contact->client_id, $this->valid_coupon)
|
||||
->createInvoiceV2($this->bundle, $contact->client_id, $this->valid_coupon)
|
||||
->service()
|
||||
->fillDefaults()
|
||||
->adjustInventory()
|
||||
|
|
@ -674,9 +646,9 @@ class BillingPortalPurchasev2 extends Component
|
|||
->markPaid()
|
||||
->save();
|
||||
|
||||
return $this->subscription
|
||||
return $subscription
|
||||
->service()
|
||||
->handleNoPaymentFlow($invoice, $this->bundle, $this->contact);
|
||||
->handleNoPaymentFlow($invoice, $this->bundle, $contact);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -720,8 +692,10 @@ class BillingPortalPurchasev2 extends Component
|
|||
*/
|
||||
protected function createBlankClient()
|
||||
{
|
||||
$company = $this->subscription->company;
|
||||
$user = $this->subscription->user;
|
||||
$subscription = $this->subscription();
|
||||
|
||||
$company = $subscription->company;
|
||||
$user = $subscription->user;
|
||||
$user->setCompany($company);
|
||||
|
||||
$client_repo = new ClientRepository(new ClientContactRepository());
|
||||
|
|
@ -757,20 +731,20 @@ class BillingPortalPurchasev2 extends Component
|
|||
if ($currency) {
|
||||
$data['settings']->currency_id = $currency->id;
|
||||
}
|
||||
} elseif ($this->subscription->group_settings && property_exists($this->subscription->group_settings->settings, 'currency_id')) {
|
||||
} elseif ($subscription->group_settings && property_exists($subscription->group_settings->settings, 'currency_id')) {
|
||||
|
||||
/** @var \Illuminate\Support\Collection<\App\Models\Currency> */
|
||||
$currencies = app('currencies');
|
||||
|
||||
$currency = $currencies->first(function ($item) {
|
||||
return $item->id == $this->subscription->group_settings->settings->currency_id;
|
||||
$currency = $currencies->first(function ($item) use($subscription) {
|
||||
return $item->id == $subscription->group_settings->settings->currency_id;
|
||||
});
|
||||
|
||||
if ($currency) {
|
||||
$data['settings']->currency_id = $currency->id;
|
||||
}
|
||||
}else {
|
||||
$data['settings']->currency_id = $this->subscription->company->getSetting('currency_id');
|
||||
$data['settings']->currency_id = $subscription->company->getSetting('currency_id');
|
||||
}
|
||||
|
||||
if (array_key_exists('locale', $this->request_data)) {
|
||||
|
|
@ -790,8 +764,7 @@ class BillingPortalPurchasev2 extends Component
|
|||
|
||||
$client = $client_repo->save($data, ClientFactory::create($company->id, $user->id));
|
||||
$contact = $client->fresh()->contacts->first();
|
||||
$this->contact = $contact;
|
||||
|
||||
|
||||
Auth::guard('contact')->loginUsingId($contact->id, true);
|
||||
|
||||
return $contact;
|
||||
|
|
@ -811,7 +784,7 @@ class BillingPortalPurchasev2 extends Component
|
|||
$this->email = $this->request_data['email'];
|
||||
}
|
||||
|
||||
if ($this->contact instanceof ClientContact) {
|
||||
if ($this->contact() instanceof ClientContact) {
|
||||
$this->getPaymentMethods();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -124,8 +124,6 @@ class InvoicePay extends Component
|
|||
#[On('payable-amount')]
|
||||
public function payableAmount($payable_amount)
|
||||
{
|
||||
// $this->setContext('payable_invoices.0.amount', Number::parseFloat($payable_amount)); // $this->context['payable_invoices'][0]['amount'] = Number::parseFloat($payable_amount); //TODO DB: check parseFloat()
|
||||
|
||||
$this->setContext('amount', $payable_amount);
|
||||
$this->under_over_payment = false;
|
||||
}
|
||||
|
|
@ -240,11 +238,7 @@ class InvoicePay extends Component
|
|||
$this->setContext('db', $this->db); // $this->context['db'] = $this->db;
|
||||
$this->setContext('invitation_id', $this->invitation_id);
|
||||
|
||||
if(is_array($this->invoices))
|
||||
$this->invoices = Invoice::find($this->transformKeys($this->invoices));
|
||||
elseif ($this->invoices instanceof \Illuminate\Support\Collection) {
|
||||
$this->invoices = Invoice::find($this->invoices->pluck('id'));
|
||||
}
|
||||
$this->invoices = Invoice::find($this->transformKeys($this->invoices));
|
||||
|
||||
$invoices = $this->invoices->filter(function ($i) {
|
||||
$i = $i->service()
|
||||
|
|
|
|||
|
|
@ -25,14 +25,15 @@ class InvoiceSummary extends Component
|
|||
|
||||
public $amount;
|
||||
|
||||
public $gateway_fee;
|
||||
|
||||
public function mount()
|
||||
{
|
||||
//@TODO for a single invoice - show all details, for multi-invoices, only show the summaries
|
||||
// $this->invoices = $this->getContext()['invoices']; // $this->context['invitation']->invoice;
|
||||
|
||||
|
||||
$contact = $this->getContext()['contact'];
|
||||
$this->invoices = $this->getContext()['payable_invoices'];
|
||||
$this->amount = Number::formatMoney($this->getContext()['amount'], $contact->client);
|
||||
$this->gateway_fee = isset($this->getContext()['gateway_fee']) ? Number::formatMoney($this->getContext()['gateway_fee'], $contact->client) : false;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -43,10 +44,19 @@ class InvoiceSummary extends Component
|
|||
$contact = $this->getContext()['contact'];
|
||||
$this->invoices = $this->getContext()['payable_invoices'];
|
||||
$this->amount = Number::formatMoney($this->getContext()['amount'], $contact->client);
|
||||
$this->gateway_fee = isset($this->getContext()['gateway_fee']) ? Number::formatMoney($this->getContext()['gateway_fee'], $contact->client) : false;
|
||||
|
||||
// $this->invoices = $this->getContext()['invoices'];
|
||||
}
|
||||
|
||||
#[On('payment-view-rendered')]
|
||||
public function handlePaymentViewRendered()
|
||||
{
|
||||
|
||||
$contact = $this->getContext()['contact'];
|
||||
$this->amount = Number::formatMoney($this->getContext()['amount'], $contact->client);
|
||||
$this->gateway_fee = isset($this->getContext()['gateway_fee']) ? Number::formatMoney($this->getContext()['gateway_fee'], $contact->client) : false;
|
||||
|
||||
}
|
||||
|
||||
public function downloadDocument($invoice_hashed_id)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class PaymentMethod extends Component
|
|||
{
|
||||
use WithSecureContext;
|
||||
|
||||
public $invoice;
|
||||
// public $invoice;
|
||||
|
||||
public $variables;
|
||||
|
||||
|
|
|
|||
|
|
@ -58,6 +58,19 @@ class ProcessPayment extends Component
|
|||
throw new PaymentFailed($responder_data['error'], 400);
|
||||
}
|
||||
|
||||
if(isset($responder_data['payload']['total']['fee_total']))
|
||||
{
|
||||
|
||||
$gateway_fee = data_get($responder_data, 'payload.total.fee_total', false);
|
||||
$amount = data_get($responder_data, 'payload.total.amount_with_fee', 0);
|
||||
|
||||
$this->setContext('amount', $amount);
|
||||
$this->setContext('gateway_fee', $gateway_fee);
|
||||
|
||||
$this->dispatch('payment-view-rendered');
|
||||
}
|
||||
|
||||
|
||||
if(isset($responder_data['component']) && $responder_data['component'] == 'CreditPaymentComponent'){
|
||||
$this->payment_view = $responder_data['view'];
|
||||
$this->payment_data_payload = $responder_data['payload'];
|
||||
|
|
|
|||
|
|
@ -12,11 +12,12 @@
|
|||
|
||||
namespace App\Livewire\Flow2;
|
||||
|
||||
use Livewire\Component;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\CompanyGateway;
|
||||
use Livewire\Attributes\Computed;
|
||||
use App\Services\Client\RFFService;
|
||||
use App\Utils\Traits\WithSecureContext;
|
||||
use Livewire\Component;
|
||||
|
||||
class RequiredFields extends Component
|
||||
{
|
||||
|
|
@ -44,7 +45,7 @@ class RequiredFields extends Component
|
|||
public ?string $client_custom_value3;
|
||||
public ?string $client_custom_value4;
|
||||
|
||||
public $contact;
|
||||
// public $contact;
|
||||
|
||||
/** @var array<int, string> */
|
||||
public array $fields = [];
|
||||
|
|
@ -101,11 +102,6 @@ class RequiredFields extends Component
|
|||
else
|
||||
$this->is_loading = false;
|
||||
|
||||
// }
|
||||
|
||||
// if ($rff->unfilled_fields > 0) {
|
||||
// $this->is_loading = false;
|
||||
// }
|
||||
}
|
||||
|
||||
public function handleSubmit(array $data)
|
||||
|
|
|
|||
|
|
@ -12,23 +12,27 @@
|
|||
|
||||
namespace App\Livewire\Flow2;
|
||||
|
||||
use App\Utils\Traits\WithSecureContext;
|
||||
use Livewire\Component;
|
||||
use Livewire\Attributes\Computed;
|
||||
use App\Utils\Traits\WithSecureContext;
|
||||
|
||||
class Terms extends Component
|
||||
{
|
||||
use WithSecureContext;
|
||||
|
||||
public $invoice;
|
||||
|
||||
public $variables;
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$this->invoice = $this->getContext()['invoices']->first();
|
||||
$this->variables = $this->getContext()['variables'];
|
||||
}
|
||||
|
||||
#[Computed()]
|
||||
public function invoice()
|
||||
{
|
||||
return $this->getContext()['invoices']->first();
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return render('components.livewire.terms');
|
||||
|
|
|
|||
|
|
@ -44,14 +44,8 @@ class RequiredClientInfo extends Component
|
|||
*/
|
||||
public $fields = [];
|
||||
|
||||
/**
|
||||
* @var ClientContact
|
||||
*/
|
||||
public $contact_id;
|
||||
|
||||
/**
|
||||
* @var \App\Models\Client
|
||||
*/
|
||||
public $client_id;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2075,7 +2075,6 @@ $lang = array(
|
|||
'create_expense_category' => 'Create category',
|
||||
'pro_plan_reports' => ':link to enable reports by joining the Pro Plan',
|
||||
'mark_ready' => 'Mark Ready',
|
||||
|
||||
'limits' => 'Limits',
|
||||
'fees' => 'Fees',
|
||||
'fee' => 'Fee',
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
@section('meta_title', ctrans('texts.purchase'))
|
||||
|
||||
@section('body')
|
||||
@livewire('billing-portal-purchasev2', ['subscription' => $subscription->id, 'db' => $subscription->company->db, 'hash' => $hash, 'request_data' => $request_data, 'campaign' => request()->query('campaign') ?? null])
|
||||
@livewire('billing-portal-purchasev2', ['subscription_id' => $subscription->id, 'db' => $subscription->company->db, 'hash' => $hash, 'request_data' => $request_data, 'campaign' => request()->query('campaign') ?? null])
|
||||
@stop
|
||||
|
||||
@push('footer')
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
<div class="col-span-8 bg-gray-50 flex flex-col max-h-100px items-center min-h-screen">
|
||||
<div class="w-full p-4 md:max-w-3xl">
|
||||
<div class="w-full mb-4">
|
||||
<img class="object-scale-down" style="max-height: 100px;"src="{{ $subscription->company->present()->logo }}" alt="{{ $subscription->company->present()->name }}">
|
||||
<img class="object-scale-down" style="max-height: 100px;"src="{{ $this->subscription->company->present()->logo }}" alt="{{ $this->subscription->company->present()->name }}">
|
||||
<h1 id="billing-page-company-logo" class="text-3xl font-bold tracking-wide mt-6 border-b-2">
|
||||
{{ $subscription->name }}
|
||||
{{ $this->subscription->name }}
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
|
@ -21,18 +21,18 @@
|
|||
<input type="hidden" name="action" value="payment">
|
||||
<input type="hidden" name="company_gateway_id" value="{{ $company_gateway_id }}"/>
|
||||
<input type="hidden" name="payment_method_id" value="{{ $payment_method_id }}"/>
|
||||
<input type="hidden" name="contact_first_name" value="{{ $contact ? $contact->first_name : '' }}">
|
||||
<input type="hidden" name="contact_last_name" value="{{ $contact ? $contact->last_name : '' }}">
|
||||
<input type="hidden" name="contact_email" value="{{ $contact ? $contact->email : '' }}">
|
||||
<input type="hidden" name="client_city" value="{{ $contact ? $contact->client->city : '' }}">
|
||||
<input type="hidden" name="client_postal_code" value="{{ $contact ? $contact->client->postal_code : '' }}">
|
||||
<input type="hidden" name="contact_first_name" value="{{ $this->contact ? $this->contact->first_name : '' }}">
|
||||
<input type="hidden" name="contact_last_name" value="{{ $this->contact ? $this->contact->last_name : '' }}">
|
||||
<input type="hidden" name="contact_email" value="{{ $this->contact ? $this->contact->email : '' }}">
|
||||
<input type="hidden" name="client_city" value="{{ $this->contact ? $this->contact->client->city : '' }}">
|
||||
<input type="hidden" name="client_postal_code" value="{{ $this->contact ? $this->contact->client->postal_code : '' }}">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<form wire:submit="submit">
|
||||
<!-- Recurring Plan Products-->
|
||||
<ul role="list" class="-my-6 divide-y divide-gray-200">
|
||||
@if(!empty($subscription->recurring_product_ids))
|
||||
@if(!empty($this->subscription->recurring_product_ids))
|
||||
@foreach($recurring_products as $index => $product)
|
||||
<li class="flex py-6">
|
||||
@if(filter_var($product->product_image, FILTER_VALIDATE_URL))
|
||||
|
|
@ -48,34 +48,34 @@
|
|||
{!! $product->markdownNotes() !!}
|
||||
</article>
|
||||
</h3>
|
||||
<p class="ml-0">{{ \App\Utils\Number::formatMoney($product->price, $subscription->company) }} / {{ App\Models\RecurringInvoice::frequencyForKey($subscription->frequency_id) }}</p>
|
||||
<p class="ml-0">{{ \App\Utils\Number::formatMoney($product->price, $this->subscription->company) }} / {{ App\Models\RecurringInvoice::frequencyForKey($this->subscription->frequency_id) }}</p>
|
||||
</div>
|
||||
<p class="mt-1 text-sm text-gray-500"></p>
|
||||
</div>
|
||||
<div class="flex justify-between text-sm mt-1">
|
||||
@if($subscription->per_seat_enabled)
|
||||
@if($this->subscription->per_seat_enabled)
|
||||
<p class="text-gray-500 w-3/4"></p>
|
||||
<div class="flex place-content-end">
|
||||
@if($subscription->use_inventory_management && $product->in_stock_quantity == 0)
|
||||
@if($this->subscription->use_inventory_management && $product->in_stock_quantity == 0)
|
||||
<p class="text-sm font-light text-red-500 text-right mr-2 mt-2">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 wire:model.live.debounce.300ms="data.{{ $index }}.recurring_qty" class="rounded-md border-gray-300 shadow-sm sm:text-sm"
|
||||
@if($subscription->use_inventory_management && $product->in_stock_quantity == 0)
|
||||
@if($this->subscription->use_inventory_management && $product->in_stock_quantity == 0)
|
||||
disabled
|
||||
@endif
|
||||
>
|
||||
<option value="1" selected="selected">1</option>
|
||||
|
||||
@if($subscription->max_seats_limit > 1)
|
||||
@if($this->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++)
|
||||
@for ($i = 2; $i <= ($this->subscription->use_inventory_management ? min($this->subscription->max_seats_limit,$product->in_stock_quantity) : $this->subscription->max_seats_limit); $i++)
|
||||
<option value="{{$i}}">{{$i}}</option>
|
||||
@endfor
|
||||
}
|
||||
@else
|
||||
@for ($i = 2; $i <= $subscription->maxQuantity($product); $i++)
|
||||
@for ($i = 2; $i <= $this->subscription->maxQuantity($product); $i++)
|
||||
<option value="{{$i}}">{{$i}}</option>
|
||||
@endfor
|
||||
@endif
|
||||
|
|
@ -94,7 +94,7 @@
|
|||
@endforeach
|
||||
@endif
|
||||
<!-- One Time Plan Products-->
|
||||
@if(!empty($subscription->product_ids))
|
||||
@if(!empty($this->subscription->product_ids))
|
||||
@foreach($products as $product)
|
||||
<li class="flex py-6">
|
||||
@if(filter_var($product->product_image, FILTER_VALIDATE_URL))
|
||||
|
|
@ -110,7 +110,7 @@
|
|||
{!! $product->markdownNotes() !!}
|
||||
</article>
|
||||
</h3>
|
||||
<p class="ml-0">{{ \App\Utils\Number::formatMoney($product->price, $subscription->company) }}</p>
|
||||
<p class="ml-0">{{ \App\Utils\Number::formatMoney($product->price, $this->subscription->company) }}</p>
|
||||
</div>
|
||||
<p class="mt-1 text-sm text-gray-500"></p>
|
||||
</div>
|
||||
|
|
@ -126,7 +126,7 @@
|
|||
</ul>
|
||||
</div>
|
||||
|
||||
@if(!empty($subscription->optional_recurring_product_ids) || !empty($subscription->optional_product_ids))
|
||||
@if(!empty($this->subscription->optional_recurring_product_ids) || !empty($this->subscription->optional_product_ids))
|
||||
<div class="w-full p-4 md:max-w-3xl">
|
||||
<h2 class="text-2xl font-normal text-left border-b-2">{{ ctrans('texts.optional_products') }}</h2>
|
||||
</div>
|
||||
|
|
@ -135,7 +135,7 @@
|
|||
|
||||
<!-- Optional Recurring Products-->
|
||||
<ul role="list" class="-my-6 divide-y divide-gray-200">
|
||||
@if(!empty($subscription->optional_recurring_product_ids))
|
||||
@if(!empty($this->subscription->optional_recurring_product_ids))
|
||||
@foreach($optional_recurring_products as $index => $product)
|
||||
<li class="flex py-6">
|
||||
@if(filter_var($product->product_image, FILTER_VALIDATE_URL))
|
||||
|
|
@ -151,25 +151,25 @@
|
|||
{!! $product->markdownNotes() !!}
|
||||
</article>
|
||||
</h3>
|
||||
<p class="ml-0">{{ \App\Utils\Number::formatMoney($product->price, $subscription->company) }} / {{ App\Models\RecurringInvoice::frequencyForKey($subscription->frequency_id) }}</p>
|
||||
<p class="ml-0">{{ \App\Utils\Number::formatMoney($product->price, $this->subscription->company) }} / {{ App\Models\RecurringInvoice::frequencyForKey($this->subscription->frequency_id) }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-between text-sm mt-1">
|
||||
@if(is_numeric($product->max_quantity))
|
||||
<p class="text-gray-500 w-3/4"></p>
|
||||
<div class="flex place-content-end">
|
||||
@if($subscription->use_inventory_management && $product->in_stock_quantity == 0)
|
||||
@if($this->subscription->use_inventory_management && $product->in_stock_quantity == 0)
|
||||
<p class="w-full text-sm font-light text-red-500 text-right mr-2 mt-2">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 wire:model.live.debounce.300ms="data.{{ $index }}.optional_recurring_qty" class="rounded-md border-gray-300 shadow-sm sm:text-sm"
|
||||
@if($subscription->use_inventory_management && $product->in_stock_quantity == 0)
|
||||
@if($this->subscription->use_inventory_management && $product->in_stock_quantity == 0)
|
||||
disabled
|
||||
@endif
|
||||
>
|
||||
<option value="0" selected="selected">0</option>
|
||||
@for ($i = 1; $i <= $subscription->maxQuantity($product); $i++)
|
||||
@for ($i = 1; $i <= $this->subscription->maxQuantity($product); $i++)
|
||||
<option value="{{$i}}">{{$i}}</option>
|
||||
@endfor
|
||||
</select>
|
||||
|
|
@ -180,7 +180,7 @@
|
|||
</li>
|
||||
@endforeach
|
||||
@endif
|
||||
@if(!empty($subscription->optional_product_ids))
|
||||
@if(!empty($this->subscription->optional_product_ids))
|
||||
@foreach($optional_products as $index => $product)
|
||||
<li class="flex py-6">
|
||||
@if(filter_var($product->product_image, FILTER_VALIDATE_URL))
|
||||
|
|
@ -196,7 +196,7 @@
|
|||
{!! $product->markdownNotes() !!}
|
||||
</article>
|
||||
</h3>
|
||||
<p class="ml-0">{{ \App\Utils\Number::formatMoney($product->price, $subscription->company) }}</p>
|
||||
<p class="ml-0">{{ \App\Utils\Number::formatMoney($product->price, $this->subscription->company) }}</p>
|
||||
</div>
|
||||
<p class="mt-1 text-sm text-gray-500"></p>
|
||||
</div>
|
||||
|
|
@ -204,14 +204,14 @@
|
|||
@if(is_numeric($product->max_quantity))
|
||||
<p class="text-gray-500 w-3/4"></p>
|
||||
<div class="flex place-content-end">
|
||||
@if($subscription->use_inventory_management && $product->in_stock_quantity == 0)
|
||||
@if($this->subscription->use_inventory_management && $product->in_stock_quantity == 0)
|
||||
<p class="w-full text-sm font-light text-red-500 text-right mr-2 mt-2">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 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->maxQuantity($product); $i++)
|
||||
@for ($i = 1; $i <= $this->subscription->maxQuantity($product); $i++)
|
||||
<option value="{{$i}}">{{$i}}</option>
|
||||
@endfor
|
||||
</select>
|
||||
|
|
@ -248,7 +248,7 @@
|
|||
</div>
|
||||
@endforeach
|
||||
|
||||
@if(!empty($subscription->promo_code) && !$subscription->trial_enabled)
|
||||
@if(!empty($this->subscription->promo_code) && !$this->subscription->trial_enabled)
|
||||
<form wire:submit="handleCoupon" class="">
|
||||
@csrf
|
||||
<div class="mt-4">
|
||||
|
|
@ -315,7 +315,7 @@
|
|||
{{ session('message') }}
|
||||
@endcomponent
|
||||
@endif
|
||||
@if($subscription->trial_enabled)
|
||||
@if($this->subscription->trial_enabled)
|
||||
<form wire:submit="handleTrial" class="mt-8">
|
||||
@csrf
|
||||
<button class="relative -ml-px inline-flex items-center space-x-2 rounded border border-gray-300 bg-gray-50 px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-100 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500">
|
||||
|
|
@ -335,22 +335,22 @@
|
|||
<form wire:submit="handleRff">
|
||||
@csrf
|
||||
|
||||
@if(strlen($contact->first_name ?? '') === 0)
|
||||
<div class="col-auto mt-3 flex items-center space-x-0 @if($contact->first_name) !== 0) hidden @endif">
|
||||
@if(strlen($this->contact->first_name ?? '') === 0)
|
||||
<div class="col-auto mt-3 flex items-center space-x-0 @if($this->contact->first_name) !== 0) hidden @endif">
|
||||
<label for="first_name" class="w-1/4 text-sm font-medium text-white whitespace-nowrap text-left">{{ ctrans('texts.first_name') }}</label>
|
||||
<input id="first_name" class="w-3/4 rounded-md border-gray-300 pl-2 focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm text-gray-700" wire:model="contact_first_name" />
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if(strlen($contact->last_name ?? '') === 0)
|
||||
<div class="col-auto mt-3 flex items-center space-x-0 @if($contact->last_name) !== 0) hidden @endif">
|
||||
@if(strlen($this->contact->last_name ?? '') === 0)
|
||||
<div class="col-auto mt-3 flex items-center space-x-0 @if($this->contact->last_name) !== 0) hidden @endif">
|
||||
<label for="last_name" class="w-1/4 text-sm font-medium text-white whitespace-nowrap text-left">{{ ctrans('texts.last_name') }}</label>
|
||||
<input id="last_name" class="w-3/4 rounded-md border-gray-300 focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm text-gray-700" wire:model="contact_last_name" />
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if(strlen($contact->email ?? '') === 0)
|
||||
<div class="col-auto mt-3 flex items-center space-x-0 @if($contact->email) !== 0) hidden @endif">
|
||||
@if(strlen($this->contact->email ?? '') === 0)
|
||||
<div class="col-auto mt-3 flex items-center space-x-0 @if($this->contact->email) !== 0) hidden @endif">
|
||||
<label for="email" class="w-1/4 text-sm font-medium text-white whitespace-nowrap text-left">{{ ctrans('texts.email') }}</label>
|
||||
<input id="email" class="w-3/4 rounded-md border-gray-300 focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm text-gray-700" wire:model="contact_email" />
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
<h2 class="text-xl text-center py-0 px-4">{{ ctrans('texts.terms') }}</h2>
|
||||
<div class="mt-0 h-64 overflow-y-auto">
|
||||
<div class="py-0">
|
||||
<p class="text-sm leading-6 font-medium text-gray-500">{{ ctrans('texts.invoice') }} {{ $invoice->number }}:</p>
|
||||
@if($variables && $invoice->terms)
|
||||
<h5 data-ref="entity-terms">{!! $invoice->parseHtmlVariables('terms', $variables) !!}</h5>
|
||||
@elseif($invoice->terms)
|
||||
<h5 data-ref="entity-terms" class="text-sm leading-5 text-gray-900">{!! $invoice->terms !!}</h5>
|
||||
<p class="text-sm leading-6 font-medium text-gray-500">{{ ctrans('texts.invoice') }} {{ $this->invoice->number }}:</p>
|
||||
@if($variables && $this->invoice->terms)
|
||||
<h5 data-ref="entity-terms">{!! $this->invoice->parseHtmlVariables('terms', $variables) !!}</h5>
|
||||
@elseif($this->invoice->terms)
|
||||
<h5 data-ref="entity-terms" class="text-sm leading-5 text-gray-900">{!! $this->invoice->terms !!}</h5>
|
||||
@else
|
||||
<i class="text-sm leading-5 text-gray-500">{{ ctrans('texts.not_specified') }}</i>
|
||||
@endif
|
||||
|
|
|
|||
|
|
@ -53,6 +53,19 @@
|
|||
</div>
|
||||
@endforeach
|
||||
|
||||
@if($gateway_fee)
|
||||
<button class="mb-4 w-full items-start gap-2 rounded-lg border p-3 text-left text-sm transition-all hover:bg-gray-100">
|
||||
<dl class="grid gap-3">
|
||||
|
||||
<div class="flex items-center justify-between">
|
||||
<dt class="font-semibold text-muted-foreground">{{ ctrans('texts.gateway_fees') }}</dt>
|
||||
<dd>{{ $gateway_fee }}</dd>
|
||||
</div>
|
||||
|
||||
</dl>
|
||||
</button>
|
||||
@endif
|
||||
|
||||
<button class="mb-4 w-full items-start gap-2 rounded-lg border p-3 text-left text-sm transition-all hover:bg-gray-100">
|
||||
<dl class="grid gap-3">
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<div x-data="{ fields: @entangle('fields'), contact: @entangle('contact') }"
|
||||
<div x-data="{ fields: @entangle('fields') }"
|
||||
class="rounded-lg border bg-card text-card-foreground shadow-sm overflow-hidden px-4 py-5 bg-white sm:gap-4 sm:px-6">
|
||||
|
||||
<p class="font-semibold tracking-tight group flex items-center gap-2 text-lg mb-3">
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
@section('body')
|
||||
|
||||
@livewire('flow2.invoice-pay', ['invoices' => $invoices, 'invitation_id' => $invitation->id, 'db' => $db, 'variables' => $variables])
|
||||
@livewire('flow2.invoice-pay', ['invoices' => $invoices->pluck('hashed_id')->toArray(), 'invitation_id' => $invitation->id, 'db' => $db, 'variables' => $variables])
|
||||
|
||||
@endsection
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue