From 60b310bc0c780c775744b8bf90802eebecb2e66e Mon Sep 17 00:00:00 2001 From: 1Day Date: Mon, 13 Dec 2021 13:28:01 +0100 Subject: [PATCH] multilanguage support --- .../Controllers/Admin/PaymentController.php | 1 + config/app.php | 2 +- resources/lang/de.json | 29 ++ resources/lang/vendor/invoices/de/invoice.php | 38 -- resources/lang/vendor/invoices/en/invoice.php | 38 -- resources/lang/vendor/invoices/nl/invoice.php | 38 -- .../invoices/templates/controlpanel.blade.php | 390 ++++++++++++++++++ 7 files changed, 421 insertions(+), 115 deletions(-) create mode 100644 resources/lang/de.json delete mode 100644 resources/lang/vendor/invoices/de/invoice.php delete mode 100644 resources/lang/vendor/invoices/en/invoice.php delete mode 100644 resources/lang/vendor/invoices/nl/invoice.php create mode 100644 resources/views/vendor/invoices/templates/controlpanel.blade.php diff --git a/app/Http/Controllers/Admin/PaymentController.php b/app/Http/Controllers/Admin/PaymentController.php index 53c07fce..6d48de09 100644 --- a/app/Http/Controllers/Admin/PaymentController.php +++ b/app/Http/Controllers/Admin/PaymentController.php @@ -224,6 +224,7 @@ class PaymentController extends Controller ->pricePerUnit($paypalProduct->price); $invoice = Invoice::make() + ->template('controlpanel') ->buyer($customer) ->seller($seller) ->discountByPercent(0) diff --git a/config/app.php b/config/app.php index 334ff5b2..7ca6180b 100644 --- a/config/app.php +++ b/config/app.php @@ -81,7 +81,7 @@ return [ | */ - 'locale' => 'en', + 'locale' => env('LOCALE', 'en'), /* |-------------------------------------------------------------------------- diff --git a/resources/lang/de.json b/resources/lang/de.json new file mode 100644 index 00000000..3db436c0 --- /dev/null +++ b/resources/lang/de.json @@ -0,0 +1,29 @@ +{ + "Invoice": "Rechnung", + "Serial No.": "Rechnungsnr.", + "Invoice date": "Rechnungsdatum", + "Seller": "Verkäufer", + "Buyer": "Käufer", + "Address": "Adresse", + "Code": "Code", + "VAT code": "Steuerid", + "Phone": "Telefon", + "Description": "Beschreibung", + "Units": "Einheiten", + "Qty": "Menge", + "Price": "Preis", + "Discount": "Rabatt", + "Tax": "Steuer", + "Sub total": "Zwischensumme", + "Total discount": "Gesamtrabatt", + "Taxable amount": "Steuerbetrag", + "Total taxes": "Steuerngesamt", + "Tax rate": "Steuerrate", + "Total amount": "Gesamtbetrag", + "Please pay until": "Zahlbar bis", + "Amount in words": "Betrag in Worten", + "Notes": "Notizen", + "Shipping": "Lieferbedingung", + "Paid": "Bezahlt", + "Due:": "Fällig" +} diff --git a/resources/lang/vendor/invoices/de/invoice.php b/resources/lang/vendor/invoices/de/invoice.php deleted file mode 100644 index 51c42ba3..00000000 --- a/resources/lang/vendor/invoices/de/invoice.php +++ /dev/null @@ -1,38 +0,0 @@ - 'Rechnung', - 'serial' => 'Rechnung Nr.', - 'date' => 'Rechnungsdatum', - 'seller' => 'Verkäufer', - 'buyer' => 'Käufer', - 'address' => 'Adresse', - 'code' => 'Code', - 'vat' => 'Umsatzsteuer ID', - 'phone' => 'Telefon', - 'description' => 'Beschreibung', - 'units' => 'Einheit', - 'quantity' => 'Menge', - 'price' => 'Preis', - 'discount' => 'Rabatt', - 'tax' => 'Steuer', - 'sub_total' => 'Zwischensumme', - 'total_discount' => 'Gesamtrabatt', - 'taxable_amount' => 'Steuerwert', - 'total_taxes' => 'Gesamtsteuer', - 'tax_rate' => 'Steuerrate', - 'total_amount' => 'Gesamtpreis', - 'pay_until' => 'Zahlbar bis', - 'amount_in_words' => 'Betrag in Worten', - 'amount_in_words_format' => '%s %s und %s %s', - 'notes' => 'Notizen', - 'shipping' => 'Lieferbedingung', - 'paid' => 'Bezahlt', - 'due' => 'fällig', -]; diff --git a/resources/lang/vendor/invoices/en/invoice.php b/resources/lang/vendor/invoices/en/invoice.php deleted file mode 100644 index 5bd30fe4..00000000 --- a/resources/lang/vendor/invoices/en/invoice.php +++ /dev/null @@ -1,38 +0,0 @@ - 'Invoice', - 'serial' => 'Serial No.', - 'date' => 'Invoice date', - 'seller' => 'Seller', - 'buyer' => 'Buyer', - 'address' => 'Address', - 'code' => 'Code', - 'vat' => 'VAT code', - 'phone' => 'Phone', - 'description' => 'Description', - 'units' => 'Units', - 'quantity' => 'Qty', - 'price' => 'Price', - 'discount' => 'Discount', - 'tax' => 'Tax', - 'sub_total' => 'Sub total', - 'total_discount' => 'Total discount', - 'taxable_amount' => 'Taxable amount', - 'total_taxes' => 'Total taxes', - 'tax_rate' => 'Tax rate', - 'total_amount' => 'Total amount', - 'pay_until' => 'Please pay until', - 'amount_in_words' => 'Amount in words', - 'amount_in_words_format' => '%s %s and %s %s', - 'notes' => 'Notes', - 'shipping' => 'Shipping', - 'paid' => 'Paid', - 'due' => 'Due', -]; diff --git a/resources/lang/vendor/invoices/nl/invoice.php b/resources/lang/vendor/invoices/nl/invoice.php deleted file mode 100644 index 1e171c47..00000000 --- a/resources/lang/vendor/invoices/nl/invoice.php +++ /dev/null @@ -1,38 +0,0 @@ - 'Factuur', - 'serial' => 'Factuurnummer', - 'date' => 'Factuurdatum', - 'seller' => 'Leverancier', - 'buyer' => 'Afnemer', - 'address' => 'Adres', - 'code' => 'Code', - 'vat' => 'Btw-identificatienummer', - 'phone' => 'Telefoonnummer', - 'description' => 'Omschrijving', - 'units' => 'Eenheid', - 'quantity' => 'Aantal', - 'price' => 'Prijs', - 'discount' => 'Korting', - 'tax' => 'Belasting', - 'sub_total' => 'Subtotaal', - 'total_discount' => 'Totale korting', - 'taxable_amount' => 'Belastbaar bedrag', - 'total_taxes' => 'Totaal belastingen', - 'tax_rate' => 'Belastingtarief', - 'total_amount' => 'Totaalbedrag', - 'pay_until' => 'Gelieve te betalen voor', - 'amount_in_words' => 'Totaalbedrag in woorden', - 'amount_in_words_format' => '%s %s en %s %s', - 'notes' => 'Opmerkingen', - 'shipping' => 'Verzending', - 'paid' => 'Betaald', - 'due' => 'Openstaand', -]; diff --git a/resources/views/vendor/invoices/templates/controlpanel.blade.php b/resources/views/vendor/invoices/templates/controlpanel.blade.php new file mode 100644 index 00000000..39e98a10 --- /dev/null +++ b/resources/views/vendor/invoices/templates/controlpanel.blade.php @@ -0,0 +1,390 @@ + + + + {{ $invoice->name }} + + + + + + + {{-- Header --}} + @if($invoice->logo) + logo + @endif + + + + + + + + + +
+

+ {{ $invoice->name }} {{$invoice->getSerialNumber()}} +

+
+ @if($invoice->status) +

+ {{ $invoice->status }} +

+ @endif +

{{ __('Serial No.') }} {{ $invoice->getSerialNumber() }}

+

{{ __('Invoice date') }}: {{ $invoice->getDate() }}

+
+ + {{-- Seller - Buyer --}} + + + + + + + + + + + + + + + +
+ {{ __('Seller') }} + + {{ __('Buyer') }} +
+ @if($invoice->seller->name) +

+ {{ $invoice->seller->name }} +

+ @endif + + @if($invoice->seller->address) +

+ {{ __('Adress') }}: {{ $invoice->seller->address }} +

+ @endif + + @if($invoice->seller->code) +

+ {{ __('Code') }}: {{ $invoice->seller->code }} +

+ @endif + + @if($invoice->seller->vat) +

+ {{ __('VAT Code') }}: {{ $invoice->seller->vat }} +

+ @endif + + @if($invoice->seller->phone) +

+ {{ __('Phone') }}: {{ $invoice->seller->phone }} +

+ @endif + + @foreach($invoice->seller->custom_fields as $key => $value) +

+ {{ ucfirst($key) }}: {{ $value }} +

+ @endforeach +
+ @if($invoice->buyer->name) +

+ {{ $invoice->buyer->name }} +

+ @endif + + @if($invoice->buyer->address) +

+ {{ __('Adress') }}: {{ $invoice->buyer->address }} +

+ @endif + + @if($invoice->buyer->code) +

+ {{ __('Code') }}: {{ $invoice->buyer->code }} +

+ @endif + + @if($invoice->buyer->vat) +

+ {{ __('VAT Code') }}: {{ $invoice->buyer->vat }} +

+ @endif + + @if($invoice->buyer->phone) +

+ {{ __('Phone') }}: {{ $invoice->buyer->phone }} +

+ @endif + + @foreach($invoice->buyer->custom_fields as $key => $value) +

+ {{ ucfirst($key) }}: {{ $value }} +

+ @endforeach +
+ + {{-- Table --}} + + + + + @if($invoice->hasItemUnits) + + @endif + + + @if($invoice->hasItemDiscount) + + @endif + @if($invoice->hasItemTax) + + @endif + + + + + {{-- Items --}} + @foreach($invoice->items as $item) + + + @if($invoice->hasItemUnits) + + @endif + + + @if($invoice->hasItemDiscount) + + @endif + @if($invoice->hasItemTax) + + @endif + + + + @endforeach + {{-- Summary --}} + @if($invoice->hasItemOrInvoiceDiscount()) + + + + + + @endif + @if($invoice->taxable_amount) + + + + + + @endif + @if($invoice->tax_rate) + + + + + + @endif + @if($invoice->hasItemOrInvoiceTax()) + + + + + + @endif + @if($invoice->shipping_amount) + + + + + + @endif + + + + + + +
{{ __('Description') }}{{ __('Units') }}{{ __('Quantity') }}{{ __('Price') }}{{ __('Discount') }}{{ __('Tax') }}{{ __('Subtotal') }}
+ {{ $item->title }} + + @if($item->description) +

{{ $item->description }}

+ @endif +
{{ $item->units }}{{ $item->quantity }} + {{ $invoice->formatCurrency($item->price_per_unit) }} + + {{ $invoice->formatCurrency($item->discount) }} + + {{ $invoice->formatCurrency($item->tax) }} + + {{ $invoice->formatCurrency($item->sub_total_price) }} +
{{ __('Total Discount') }} + {{ $invoice->formatCurrency($invoice->total_discount) }} +
{{ __('Taxable amount') }} + {{ $invoice->formatCurrency($invoice->taxable_amount) }} +
{{ __('Tax rate') }} + {{ $invoice->tax_rate }}% +
{{ __('Total taxes') }} + {{ $invoice->formatCurrency($invoice->total_taxes) }} +
{{ __('Shipping') }} + {{ $invoice->formatCurrency($invoice->shipping_amount) }} +
{{ __('Total amount') }} + {{ $invoice->formatCurrency($invoice->total_amount) }} +
+ + @if($invoice->notes) +

+ {{ trans('Notes') }}: {!! $invoice->notes !!} +

+ @endif + +

+ {{ trans('Amount in words') }}: {{ $invoice->getTotalAmountInWords() }} +

+

+ {{ trans('Please pay until') }}: {{ $invoice->getPayUntilDate() }} +

+ + + +