Merge Invoice and Bill into Document
This commit is contained in:
31
app/Http/ViewComposers/DocumentType.php
Normal file
31
app/Http/ViewComposers/DocumentType.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\ViewComposers;
|
||||
|
||||
use App\Http\Controllers\Portal\Invoices as PortalInvoices;
|
||||
use App\Http\Controllers\Purchases\Bills;
|
||||
use App\Http\Controllers\Sales\Invoices;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class DocumentType
|
||||
{
|
||||
|
||||
/**
|
||||
* Bind data to the view.
|
||||
*
|
||||
* @param View $view
|
||||
* @return void
|
||||
*/
|
||||
public function compose(View $view)
|
||||
{
|
||||
if (!empty(request()->route())) {
|
||||
$route = request()->route();
|
||||
|
||||
/** @var Invoices|Bills|PortalInvoices $controller */
|
||||
$controller = $route->getController();
|
||||
|
||||
$view->with(['type' => $controller->type ?? '']);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -20,19 +20,19 @@ class InvoiceText
|
||||
$text_items = setting('invoice.item_name', 'general.items');
|
||||
|
||||
if ($text_items == 'custom') {
|
||||
$text_items = setting('invoice.item_input');
|
||||
$text_items = setting('invoice.item_name_input');
|
||||
}
|
||||
|
||||
$text_quantity = setting('invoice.quantity_name', 'invoices.quantity');
|
||||
|
||||
if ($text_quantity == 'custom') {
|
||||
$text_quantity = setting('invoice.quantity_input');
|
||||
$text_quantity = setting('invoice.quantity_name_input');
|
||||
}
|
||||
|
||||
$text_price = setting('invoice.price_name', 'invoices.price');
|
||||
|
||||
if ($text_price == 'custom') {
|
||||
$text_price = setting('invoice.price_input');
|
||||
$text_price = setting('invoice.price_name_input');
|
||||
}
|
||||
|
||||
$text_override['items'] = $text_items;
|
||||
|
Reference in New Issue
Block a user