mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Ability to toggle auto_bill_enabled on client side
This commit is contained in:
parent
cca78a9d38
commit
eb34cd81b1
34
app/Http/Livewire/RecurringInvoices/UpdateAutoBilling.php
Normal file
34
app/Http/Livewire/RecurringInvoices/UpdateAutoBilling.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Http\Livewire\RecurringInvoices;
|
||||||
|
|
||||||
|
use Livewire\Component;
|
||||||
|
|
||||||
|
class UpdateAutoBilling extends Component
|
||||||
|
{
|
||||||
|
/** @var \App\Models\RecurringInvoice */
|
||||||
|
public $invoice;
|
||||||
|
|
||||||
|
public function updateAutoBilling(): void
|
||||||
|
{
|
||||||
|
if ($this->invoice->auto_bill === 'optin' || $this->invoice->auto_bill === 'optout') {
|
||||||
|
$this->invoice->auto_bill_enabled = !$this->invoice->auto_bill_enabled;
|
||||||
|
$this->invoice->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function render()
|
||||||
|
{
|
||||||
|
return render('components.livewire.recurring-invoices-switch-autobilling');
|
||||||
|
}
|
||||||
|
}
|
2
public/css/app.css
vendored
2
public/css/app.css
vendored
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"/js/app.js": "/js/app.js?id=696e8203d5e8e7cf5ff5",
|
"/js/app.js": "/js/app.js?id=696e8203d5e8e7cf5ff5",
|
||||||
"/css/app.css": "/css/app.css?id=aa13f34cf031c931b1c8",
|
"/css/app.css": "/css/app.css?id=d9b987796d537e68bee7",
|
||||||
"/js/clients/invoices/action-selectors.js": "/js/clients/invoices/action-selectors.js?id=a09bb529b8e1826f13b4",
|
"/js/clients/invoices/action-selectors.js": "/js/clients/invoices/action-selectors.js?id=a09bb529b8e1826f13b4",
|
||||||
"/js/clients/invoices/payment.js": "/js/clients/invoices/payment.js?id=8ce8955ba775ea5f47d1",
|
"/js/clients/invoices/payment.js": "/js/clients/invoices/payment.js?id=8ce8955ba775ea5f47d1",
|
||||||
"/js/clients/linkify-urls.js": "/js/clients/linkify-urls.js?id=0dc8c34010d09195d2f7",
|
"/js/clients/linkify-urls.js": "/js/clients/linkify-urls.js?id=0dc8c34010d09195d2f7",
|
||||||
|
@ -4271,6 +4271,7 @@ $LANG = array(
|
|||||||
'default_payment_method_label' => 'Default Payment Method',
|
'default_payment_method_label' => 'Default Payment Method',
|
||||||
'default_payment_method' => 'Make this your preferred way of paying.',
|
'default_payment_method' => 'Make this your preferred way of paying.',
|
||||||
'already_default_payment_method' => 'This is your preferred way of paying.',
|
'already_default_payment_method' => 'This is your preferred way of paying.',
|
||||||
|
'auto_bill_disabled' => 'Auto Bill Disabled',
|
||||||
);
|
);
|
||||||
|
|
||||||
return $LANG;
|
return $LANG;
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
<label class="flex items-center cursor-pointer">
|
||||||
|
<input type="checkbox" class="form-checkbox mr-2"
|
||||||
|
wire:change="updateAutoBilling" {{ $invoice->auto_bill_enabled ? 'checked' : '' }}>
|
||||||
|
|
||||||
|
<span class="text-sm leading-5 font-medium text-gray-900">
|
||||||
|
{{ $invoice->auto_bill_enabled ? ctrans('texts.auto_bill_enabled') : ctrans('texts.auto_bill_disabled') }}
|
||||||
|
</span>
|
||||||
|
</label>
|
@ -59,6 +59,21 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@if($invoice->auto_bill === 'optin' || $invoice->auto_bill === 'optout')
|
||||||
|
<div class="bg-white shadow overflow-hidden lg:rounded-lg mt-4">
|
||||||
|
<div class="flex flex-col md:flex-row items-start justify-between px-4 py-5 sm:p-6">
|
||||||
|
<div>
|
||||||
|
<h3 class="text-lg leading-6 font-medium text-gray-900">Auto Bill</h3>
|
||||||
|
<p class="mt-1 max-w-2xl text-sm leading-5 text-gray-500">Change your update bill preferences.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex mt-4 space-x-2">
|
||||||
|
@livewire('recurring-invoices.update-auto-billing', ['invoice' => $invoice])
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
@if(is_null($invoice->subscription_id) || optional($invoice->subscription)->allow_cancellation)
|
@if(is_null($invoice->subscription_id) || optional($invoice->subscription)->allow_cancellation)
|
||||||
<div class="bg-white shadow sm:rounded-lg mt-4">
|
<div class="bg-white shadow sm:rounded-lg mt-4">
|
||||||
<div class="px-4 py-5 sm:p-6">
|
<div class="px-4 py-5 sm:p-6">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user