From a8fe77258171a9294dc263abfc69a8608bb8eb37 Mon Sep 17 00:00:00 2001 From: Sevan Nerse Date: Sun, 10 May 2020 08:13:27 +0300 Subject: [PATCH 1/2] items of invoices and bills moved to partials path --- .../partials/documents/item/print.blade.php | 22 +++++++++++++ .../partials/documents/item/show.blade.php | 28 +++++++++++++++++ .../views/purchases/bills/print.blade.php | 25 ++------------- .../views/purchases/bills/show.blade.php | 31 ++----------------- .../sales/invoices/print_classic.blade.php | 25 ++------------- .../sales/invoices/print_default.blade.php | 25 ++------------- .../sales/invoices/print_modern.blade.php | 25 ++------------- resources/views/sales/invoices/show.blade.php | 31 ++----------------- 8 files changed, 62 insertions(+), 150 deletions(-) create mode 100644 resources/views/partials/documents/item/print.blade.php create mode 100644 resources/views/partials/documents/item/show.blade.php diff --git a/resources/views/partials/documents/item/print.blade.php b/resources/views/partials/documents/item/print.blade.php new file mode 100644 index 000000000..493901f6a --- /dev/null +++ b/resources/views/partials/documents/item/print.blade.php @@ -0,0 +1,22 @@ + + @stack('name_td_start') + + {{ $item->name }} + @if (!empty($item->item->description)) +
{!! \Illuminate\Support\Str::limit($item->item->description, 500) !!} + @endif + + @stack('name_td_end') + + @stack('quantity_td_start') + {{ $item->quantity }} + @stack('quantity_td_end') + + @stack('price_td_start') + @money($item->price, $invoice->currency_code, true) + @stack('price_td_end') + + @stack('total_td_start') + @money($item->total, $invoice->currency_code, true) + @stack('total_td_end') + \ No newline at end of file diff --git a/resources/views/partials/documents/item/show.blade.php b/resources/views/partials/documents/item/show.blade.php new file mode 100644 index 000000000..5d78417c9 --- /dev/null +++ b/resources/views/partials/documents/item/show.blade.php @@ -0,0 +1,28 @@ + + @stack('name_td_start') + + {{ $item->name }} + @if (!empty($item->item->description)) +
{!! \Illuminate\Support\Str::limit($item->item->description, 500) !!} + @endif + + @stack('name_td_end') + + @stack('quantity_td_start') + {{ $item->quantity }} + @stack('quantity_td_end') + + @stack('price_td_start') + @money($item->price, $invoice->currency_code, true) + @stack('price_td_end') + + @if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both'])) + @stack('discount_td_start') + {{ $item->discount }} + @stack('discount_td_end') + @endif + + @stack('total_td_start') + @money($item->total, $invoice->currency_code, true) + @stack('total_td_end') + \ No newline at end of file diff --git a/resources/views/purchases/bills/print.blade.php b/resources/views/purchases/bills/print.blade.php index 330e0f86b..ba18f40a8 100644 --- a/resources/views/purchases/bills/print.blade.php +++ b/resources/views/purchases/bills/print.blade.php @@ -128,29 +128,8 @@ - @foreach($bill->items as $bill_item) - - @stack('name_td_start') - - {{ $bill_item->name }} - @if (!empty($bill_item->item->description)) -
{!! \Illuminate\Support\Str::limit($bill_item->item->description, 500) !!} - @endif - - @stack('name_td_end') - - @stack('quantity_td_start') - {{ $bill_item->quantity }} - @stack('quantity_td_end') - - @stack('price_td_start') - @money($bill_item->price, $bill->currency_code, true) - @stack('price_td_end') - - @stack('total_td_start') - @money($bill_item->total, $bill->currency_code, true) - @stack('total_td_end') - + @foreach($bill->items as $item) + @include('partials.documents.item.print') @endforeach diff --git a/resources/views/purchases/bills/show.blade.php b/resources/views/purchases/bills/show.blade.php index 322e17203..69a1c25eb 100644 --- a/resources/views/purchases/bills/show.blade.php +++ b/resources/views/purchases/bills/show.blade.php @@ -349,35 +349,8 @@ {{ trans('bills.total') }} @stack('total_th_end') - @foreach($bill->items as $bill_item) - - @stack('name_td_start') - - {{ $bill_item->name }} - @if (!empty($bill_item->item->description)) -
{!! \Illuminate\Support\Str::limit($bill_item->item->description, 500) !!} - @endif - - @stack('name_td_end') - - @stack('quantity_td_start') - {{ $bill_item->quantity }} - @stack('quantity_td_end') - - @stack('price_td_start') - @money($bill_item->price, $bill->currency_code, true) - @stack('price_td_end') - - @if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both'])) - @stack('discount_td_start') - {{ $bill_item->discount }} - @stack('discount_td_end') - @endif - - @stack('total_td_start') - @money($bill_item->total, $bill->currency_code, true) - @stack('total_td_end') - + @foreach($bill->items as $item) + @include('partials.documents.item.show') @endforeach diff --git a/resources/views/sales/invoices/print_classic.blade.php b/resources/views/sales/invoices/print_classic.blade.php index 83cca35a7..5c8306903 100644 --- a/resources/views/sales/invoices/print_classic.blade.php +++ b/resources/views/sales/invoices/print_classic.blade.php @@ -145,29 +145,8 @@ - @foreach($invoice->items as $invoice_item) - - @stack('name_td_start') - - {{ $invoice_item->name }} - @if (!empty($invoice_item->item->description)) -
{!! \Illuminate\Support\Str::limit($invoice_item->item->description, 500) !!} - @endif - - @stack('name_td_end') - - @stack('quantity_td_start') - {{ $invoice_item->quantity }} - @stack('quantity_td_end') - - @stack('price_td_start') - @money($invoice_item->price, $invoice->currency_code, true) - @stack('price_td_end') - - @stack('total_td_start') - @money($invoice_item->total, $invoice->currency_code, true) - @stack('total_td_end') - + @foreach($invoice->items as $item) + @include('partials.documents.item.print') @endforeach diff --git a/resources/views/sales/invoices/print_default.blade.php b/resources/views/sales/invoices/print_default.blade.php index 0fcf537eb..444b13004 100644 --- a/resources/views/sales/invoices/print_default.blade.php +++ b/resources/views/sales/invoices/print_default.blade.php @@ -132,29 +132,8 @@ - @foreach($invoice->items as $invoice_item) - - @stack('name_td_start') - - {{ $invoice_item->name }} - @if (!empty($invoice_item->item->description)) -
{!! \Illuminate\Support\Str::limit($invoice_item->item->description, 500) !!} - @endif - - @stack('name_td_end') - - @stack('quantity_td_start') - {{ $invoice_item->quantity }} - @stack('quantity_td_end') - - @stack('price_td_start') - @money($invoice_item->price, $invoice->currency_code, true) - @stack('price_td_end') - - @stack('total_td_start') - @money($invoice_item->total, $invoice->currency_code, true) - @stack('total_td_end') - + @foreach($invoice->items as $item) + @include('partials.documents.item.print') @endforeach diff --git a/resources/views/sales/invoices/print_modern.blade.php b/resources/views/sales/invoices/print_modern.blade.php index dade8bec3..cfb7b0ec5 100644 --- a/resources/views/sales/invoices/print_modern.blade.php +++ b/resources/views/sales/invoices/print_modern.blade.php @@ -114,29 +114,8 @@ - @foreach($invoice->items as $invoice_item) - - @stack('name_td_start') - - {{ $invoice_item->name }} - @if (!empty($invoice_item->item->description)) -
{!! \Illuminate\Support\Str::limit($invoice_item->item->description, 500) !!} - @endif - - @stack('name_td_end') - - @stack('quantity_td_start') - {{ $invoice_item->quantity }} - @stack('quantity_td_end') - - @stack('price_td_start') - @money($invoice_item->price, $invoice->currency_code, true) - @stack('price_td_end') - - @stack('total_td_start') - @money($invoice_item->total, $invoice->currency_code, true) - @stack('total_td_end') - + @foreach($invoice->items as $item) + @include('partials.documents.item.print') @endforeach diff --git a/resources/views/sales/invoices/show.blade.php b/resources/views/sales/invoices/show.blade.php index f11cbae79..5a566e315 100644 --- a/resources/views/sales/invoices/show.blade.php +++ b/resources/views/sales/invoices/show.blade.php @@ -366,35 +366,8 @@ {{ trans('invoices.total') }} @stack('total_th_end') - @foreach($invoice->items as $invoice_item) - - @stack('name_td_start') - - {{ $invoice_item->name }} - @if (!empty($invoice_item->item->description)) -
{!! \Illuminate\Support\Str::limit($invoice_item->item->description, 500) !!} - @endif - - @stack('name_td_end') - - @stack('quantity_td_start') - {{ $invoice_item->quantity }} - @stack('quantity_td_end') - - @stack('price_td_start') - @money($invoice_item->price, $invoice->currency_code, true) - @stack('price_td_end') - - @if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both'])) - @stack('discount_td_start') - {{ $invoice_item->discount }} - @stack('discount_td_end') - @endif - - @stack('total_td_start') - @money($invoice_item->total, $invoice->currency_code, true) - @stack('total_td_end') - + @foreach($invoice->items as $item) + @include('partials.documents.item.show') @endforeach From f916d6a2006a1714118d2f928ae2e1520a3837f1 Mon Sep 17 00:00:00 2001 From: Sevan Nerse Date: Sun, 10 May 2020 08:49:36 +0300 Subject: [PATCH 2/2] minor change in items of invoices and bills moved to partials path --- resources/views/partials/documents/item/print.blade.php | 4 ++-- resources/views/partials/documents/item/show.blade.php | 4 ++-- resources/views/purchases/bills/print.blade.php | 2 +- resources/views/purchases/bills/show.blade.php | 2 +- resources/views/sales/invoices/print_classic.blade.php | 2 +- resources/views/sales/invoices/print_default.blade.php | 2 +- resources/views/sales/invoices/print_modern.blade.php | 2 +- resources/views/sales/invoices/show.blade.php | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/resources/views/partials/documents/item/print.blade.php b/resources/views/partials/documents/item/print.blade.php index 493901f6a..326a2ec1c 100644 --- a/resources/views/partials/documents/item/print.blade.php +++ b/resources/views/partials/documents/item/print.blade.php @@ -13,10 +13,10 @@ @stack('quantity_td_end') @stack('price_td_start') - @money($item->price, $invoice->currency_code, true) + @money($item->price, $document->currency_code, true) @stack('price_td_end') @stack('total_td_start') - @money($item->total, $invoice->currency_code, true) + @money($item->total, $document->currency_code, true) @stack('total_td_end') \ No newline at end of file diff --git a/resources/views/partials/documents/item/show.blade.php b/resources/views/partials/documents/item/show.blade.php index 5d78417c9..3da8c29f9 100644 --- a/resources/views/partials/documents/item/show.blade.php +++ b/resources/views/partials/documents/item/show.blade.php @@ -13,7 +13,7 @@ @stack('quantity_td_end') @stack('price_td_start') - @money($item->price, $invoice->currency_code, true) + @money($item->price, $document->currency_code, true) @stack('price_td_end') @if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both'])) @@ -23,6 +23,6 @@ @endif @stack('total_td_start') - @money($item->total, $invoice->currency_code, true) + @money($item->total, $document->currency_code, true) @stack('total_td_end') \ No newline at end of file diff --git a/resources/views/purchases/bills/print.blade.php b/resources/views/purchases/bills/print.blade.php index ba18f40a8..d4467f16d 100644 --- a/resources/views/purchases/bills/print.blade.php +++ b/resources/views/purchases/bills/print.blade.php @@ -129,7 +129,7 @@ @foreach($bill->items as $item) - @include('partials.documents.item.print') + @include('partials.documents.item.print', ['document' => $bill]) @endforeach diff --git a/resources/views/purchases/bills/show.blade.php b/resources/views/purchases/bills/show.blade.php index 69a1c25eb..9aa7006d8 100644 --- a/resources/views/purchases/bills/show.blade.php +++ b/resources/views/purchases/bills/show.blade.php @@ -350,7 +350,7 @@ @stack('total_th_end') @foreach($bill->items as $item) - @include('partials.documents.item.show') + @include('partials.documents.item.show', ['document' => $bill]) @endforeach diff --git a/resources/views/sales/invoices/print_classic.blade.php b/resources/views/sales/invoices/print_classic.blade.php index 5c8306903..052c9d6a2 100644 --- a/resources/views/sales/invoices/print_classic.blade.php +++ b/resources/views/sales/invoices/print_classic.blade.php @@ -146,7 +146,7 @@ @foreach($invoice->items as $item) - @include('partials.documents.item.print') + @include('partials.documents.item.print', ['document' => $invoice]) @endforeach diff --git a/resources/views/sales/invoices/print_default.blade.php b/resources/views/sales/invoices/print_default.blade.php index 444b13004..5431ec817 100644 --- a/resources/views/sales/invoices/print_default.blade.php +++ b/resources/views/sales/invoices/print_default.blade.php @@ -133,7 +133,7 @@ @foreach($invoice->items as $item) - @include('partials.documents.item.print') + @include('partials.documents.item.print', ['document' => $invoice]) @endforeach diff --git a/resources/views/sales/invoices/print_modern.blade.php b/resources/views/sales/invoices/print_modern.blade.php index cfb7b0ec5..d8a65626c 100644 --- a/resources/views/sales/invoices/print_modern.blade.php +++ b/resources/views/sales/invoices/print_modern.blade.php @@ -115,7 +115,7 @@ @foreach($invoice->items as $item) - @include('partials.documents.item.print') + @include('partials.documents.item.print', ['document' => $invoice]) @endforeach diff --git a/resources/views/sales/invoices/show.blade.php b/resources/views/sales/invoices/show.blade.php index 5a566e315..ebecd242c 100644 --- a/resources/views/sales/invoices/show.blade.php +++ b/resources/views/sales/invoices/show.blade.php @@ -367,7 +367,7 @@ @stack('total_th_end') @foreach($invoice->items as $item) - @include('partials.documents.item.show') + @include('partials.documents.item.show', ['document' => $invoice]) @endforeach