Invoice customization added
This commit is contained in:
parent
906196cd36
commit
4eaf2692aa
@ -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]);
|
||||
}
|
||||
|
||||
}
|
@ -67,6 +67,10 @@ class FormServiceProvider extends ServiceProvider
|
||||
'page', 'model' => null,
|
||||
]);
|
||||
|
||||
Form::component('invoice_text', 'partials.form.invoice_text', [
|
||||
'name', 'text', 'icon', 'values', 'selected' => null, 'attributes' => ['required' => 'required'], 'input_name', 'input_value', 'col' => 'col-md-6',
|
||||
]);
|
||||
|
||||
Form::component('dateRange', 'partials.form.date_range', [
|
||||
'name', 'text', 'icon', 'attributes' => ['required' => 'required'], 'value' => null, 'col' => 'col-md-6',
|
||||
]);
|
||||
|
@ -53,6 +53,11 @@ class ViewComposerServiceProvider extends ServiceProvider
|
||||
View::composer(
|
||||
['incomes.invoices.invoice', 'expenses.bills.bill'], 'App\Http\ViewComposers\Logo'
|
||||
);
|
||||
|
||||
// Add Invoice Text
|
||||
View::composer(
|
||||
['incomes.invoices.*'], 'App\Http\ViewComposers\InvoiceText'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -33,6 +33,16 @@ return [
|
||||
'digit' => 'Number Digit',
|
||||
'next' => 'Next Number',
|
||||
'logo' => 'Logo',
|
||||
'custom' => 'Custom',
|
||||
'item_name' => 'Item Name',
|
||||
'item' => 'Item (Default)',
|
||||
'product' => 'Product',
|
||||
'service' => 'Service',
|
||||
'price_name' => 'Price Name',
|
||||
'price' => 'Price (Default)',
|
||||
'rate' => 'Rate',
|
||||
'quantity_name' => 'Quantity Name',
|
||||
'quantity' => 'Quantity (Default)',
|
||||
],
|
||||
'default' => [
|
||||
'tab' => 'Defaults',
|
||||
|
@ -33,7 +33,7 @@
|
||||
{{ Form::textGroup('order_number', trans('invoices.order_number'), 'shopping-cart', []) }}
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
{!! Form::label('items', trans_choice('general.items', 2), ['class' => 'control-label']) !!}
|
||||
{!! Form::label('items', trans_choice($text_override['items'], 2), ['class' => 'control-label']) !!}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered" id="items">
|
||||
<thead>
|
||||
@ -45,10 +45,10 @@
|
||||
<th width="40%" class="text-left">{{ trans('general.name') }}</th>
|
||||
@stack('name_th_end')
|
||||
@stack('quantity_th_start')
|
||||
<th width="5%" class="text-center">{{ trans('invoices.quantity') }}</th>
|
||||
<th width="5%" class="text-center">{{ trans($text_override['quantity']) }}</th>
|
||||
@stack('quantity_th_end')
|
||||
@stack('price_th_start')
|
||||
<th width="10%" class="text-right">{{ trans('invoices.price') }}</th>
|
||||
<th width="10%" class="text-right">{{ trans($text_override['price']) }}</th>
|
||||
@stack('price_th_end')
|
||||
@stack('taxes_th_start')
|
||||
<th width="15%" class="text-right">{{ trans_choice('general.taxes', 1) }}</th>
|
||||
|
@ -21,7 +21,7 @@
|
||||
{{ Form::textGroup('order_number', trans('invoices.order_number'), 'shopping-cart',[]) }}
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
{!! Form::label('items', trans_choice('general.items', 2), ['class' => 'control-label']) !!}
|
||||
{!! Form::label('items', trans_choice($text_override['items'], 2), ['class' => 'control-label']) !!}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered" id="items">
|
||||
<thead>
|
||||
@ -33,10 +33,10 @@
|
||||
<th width="40%" class="text-left">{{ trans('general.name') }}</th>
|
||||
@stack('name_th_end')
|
||||
@stack('quantity_th_start')
|
||||
<th width="5%" class="text-center">{{ trans('invoices.quantity') }}</th>
|
||||
<th width="5%" class="text-center">{{ trans($text_override['quantity']) }}</th>
|
||||
@stack('quantity_th_end')
|
||||
@stack('price_th_start')
|
||||
<th width="10%" class="text-right">{{ trans('invoices.price') }}</th>
|
||||
<th width="10%" class="text-right">{{ trans($text_override['price']) }}</th>
|
||||
@stack('price_th_end')
|
||||
@stack('taxes_th_start')
|
||||
<th width="15%" class="text-right">{{ trans_choice('general.taxes', 1) }}</th>
|
||||
|
@ -72,9 +72,9 @@
|
||||
<table class="lines">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="item">{{ trans_choice('general.items', 1) }}</th>
|
||||
<th class="quantity">{{ trans('invoices.quantity') }}</th>
|
||||
<th class="price">{{ trans('invoices.price') }}</th>
|
||||
<th class="item">{{ trans_choice($text_override['items'], 2) }}</th>
|
||||
<th class="quantity">{{ trans($text_override['quantity']) }}</th>
|
||||
<th class="price">{{ trans($text_override['price']) }}</th>
|
||||
<th class="total">{{ trans('invoices.total') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -98,9 +98,9 @@
|
||||
<table class="table table-striped">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>{{ trans_choice('general.items', 1) }}</th>
|
||||
<th class="text-center">{{ trans('invoices.quantity') }}</th>
|
||||
<th class="text-right">{{ trans('invoices.price') }}</th>
|
||||
<th>{{ trans_choice($text_override['items'], 2) }}</th>
|
||||
<th class="text-center">{{ trans($text_override['quantity']) }}</th>
|
||||
<th class="text-right">{{ trans($text_override['price']) }}</th>
|
||||
<th class="text-right">{{ trans('invoices.total') }}</th>
|
||||
</tr>
|
||||
@foreach($invoice->items as $item)
|
||||
|
20
resources/views/partials/form/invoice_text.blade.php
Normal file
20
resources/views/partials/form/invoice_text.blade.php
Normal file
@ -0,0 +1,20 @@
|
||||
@stack($name . '_input_start')
|
||||
|
||||
<div class="{{ $col }} input-group-invoice_text">
|
||||
<div class="form-group col-sm-10 {{ isset($attributes['required']) ? 'required' : '' }} {{ $errors->has($name) ? 'has-error' : ''}}">
|
||||
{!! Form::label($name, $text, ['class' => 'control-label']) !!}
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon"><i class="fa fa-{{ $icon }}"></i></div>
|
||||
{!! Form::select($name, $values, $selected, array_merge(['class' => 'form-control', 'placeholder' => trans('general.form.select.field', ['field' => $text])], $attributes)) !!}
|
||||
</div>
|
||||
{!! $errors->first($name, '<p class="help-block">:message</p>') !!}
|
||||
</div>
|
||||
|
||||
<div class="form-group col-sm-2 {{ $errors->has('invoice_text_text') ? 'has-error' : '' }}">
|
||||
{!! Form::label($input_name, trans('settings.invoice.custom'), ['class' => 'control-label']) !!}
|
||||
{!! Form::text($input_name, $input_value, ['class' => 'form-control']) !!}
|
||||
{!! $errors->first($input_name, '<p class="help-block">:message</p>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@stack($name . '_input_end')
|
@ -58,6 +58,12 @@
|
||||
|
||||
{{ Form::textGroup('invoice_number_next', trans('settings.invoice.next'), 'chevron-right', []) }}
|
||||
|
||||
{{ Form::invoice_text('invoice_item', trans('settings.invoice.item_name'), 'font', $item_names, null, [], 'invoice_item_input', null) }}
|
||||
|
||||
{{ Form::invoice_text('invoice_price', trans('settings.invoice.price_name'), 'font', $price_names, null, [], 'invoice_price_input', null) }}
|
||||
|
||||
{{ Form::invoice_text('invoice_quantity', trans('settings.invoice.quantity_name'), 'font', $quantity_names, null, [], 'invoice_quantity_input', null) }}
|
||||
|
||||
{{ Form::fileGroup('invoice_logo', trans('settings.invoice.logo')) }}
|
||||
</div>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user