Invoice customization added
This commit is contained in:
@ -67,6 +67,24 @@ class Settings extends Controller
|
||||
'space' => trans('settings.localisation.date.space'),
|
||||
];
|
||||
|
||||
$item_names = [
|
||||
'settings.invoice.item' => trans('settings.invoice.item'),
|
||||
'settings.invoice.product' => trans('settings.invoice.product'),
|
||||
'settings.invoice.service' => trans('settings.invoice.service'),
|
||||
'custom' => trans('settings.invoice.custom'),
|
||||
];
|
||||
|
||||
$price_names = [
|
||||
'settings.invoice.price' => trans('settings.invoice.price'),
|
||||
'settings.invoice.rate' => trans('settings.invoice.rate'),
|
||||
'custom' => trans('settings.invoice.custom'),
|
||||
];
|
||||
|
||||
$quantity_names = [
|
||||
'settings.invoice.quantity' => trans('settings.invoice.quantity'),
|
||||
'custom' => trans('settings.invoice.custom'),
|
||||
];
|
||||
|
||||
$email_protocols = [
|
||||
'mail' => trans('settings.email.php'),
|
||||
'smtp' => trans('settings.email.smtp.name'),
|
||||
@ -88,6 +106,9 @@ class Settings extends Controller
|
||||
'payment_methods',
|
||||
'date_formats',
|
||||
'date_separators',
|
||||
'item_names',
|
||||
'price_names',
|
||||
'quantity_names',
|
||||
'email_protocols',
|
||||
'percent_positions'
|
||||
));
|
||||
|
49
app/Http/ViewComposers/InvoiceText.php
Normal file
49
app/Http/ViewComposers/InvoiceText.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\ViewComposers;
|
||||
|
||||
use Illuminate\View\View;
|
||||
|
||||
class InvoiceText
|
||||
{
|
||||
|
||||
/**
|
||||
* Bind data to the view.
|
||||
*
|
||||
* @param View $view
|
||||
* @return void
|
||||
*/
|
||||
public function compose(View $view)
|
||||
{
|
||||
$text_override = [
|
||||
'items' => trans_choice('general.items', 2),
|
||||
'quantity' => trans('invoices.quantity'),
|
||||
'price' => trans('invoices.price'),
|
||||
];
|
||||
|
||||
$text_items = setting('general.invoice_item');
|
||||
|
||||
if ($text_items == 'custom') {
|
||||
$text_items = setting('general.invoice_item_input');
|
||||
}
|
||||
|
||||
$text_quantity = setting('general.invoice_quantity');
|
||||
|
||||
if ($text_quantity == 'custom') {
|
||||
$text_quantity = setting('general.invoice_quantity_input');
|
||||
}
|
||||
|
||||
$text_price = setting('general.invoice_price');
|
||||
|
||||
if ($text_price == 'custom') {
|
||||
$text_price = setting('general.invoice_price_input');
|
||||
}
|
||||
|
||||
$text_override['items'] = $text_items;
|
||||
$text_override['quantity'] = $text_quantity;
|
||||
$text_override['price'] = $text_price;
|
||||
|
||||
$view->with(['text_override' => $text_override]);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user