From bbf576118b7550ba6dda95d22c6b598378a0c5bd Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Sat, 17 Nov 2018 20:58:06 +0800 Subject: [PATCH 1/3] Add tax_id entry on agency profile --- app/Http/Controllers/Users/AgencyController.php | 2 ++ resources/lang/de/agency.php | 1 + resources/lang/en/agency.php | 1 + resources/lang/id/agency.php | 1 + resources/views/users/agency/edit.blade.php | 7 +++++-- resources/views/users/agency/show.blade.php | 1 + tests/Feature/AgencyProfileTest.php | 5 +++++ 7 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Users/AgencyController.php b/app/Http/Controllers/Users/AgencyController.php index e9716e0..bacdbc3 100644 --- a/app/Http/Controllers/Users/AgencyController.php +++ b/app/Http/Controllers/Users/AgencyController.php @@ -47,6 +47,7 @@ class AgencyController extends Controller 'address' => 'required|string|max:255', 'city' => 'required|string|max:100', 'phone' => 'required|string|max:255', + 'tax_id' => 'nullable|string|max:255', ]); Option::set('agency_name', request('name')); @@ -56,6 +57,7 @@ class AgencyController extends Controller Option::set('agency_address', request('address')); Option::set('agency_city', request('city')); Option::set('agency_phone', request('phone')); + Option::set('agency_tax_id', request('tax_id')); flash(__('agency.updated'), 'success'); diff --git a/resources/lang/de/agency.php b/resources/lang/de/agency.php index 00cd3e6..0905ac7 100644 --- a/resources/lang/de/agency.php +++ b/resources/lang/de/agency.php @@ -22,4 +22,5 @@ return [ 'address' => 'Agentur Adresse', 'phone' => 'Agentur Telefon', 'logo' => 'Agentur Logo', + 'tax_id' => 'Tax ID Number', ]; diff --git a/resources/lang/en/agency.php b/resources/lang/en/agency.php index bf75f59..e875da0 100644 --- a/resources/lang/en/agency.php +++ b/resources/lang/en/agency.php @@ -22,4 +22,5 @@ return [ 'address' => 'Agency Address', 'phone' => 'Agency Phone', 'logo' => 'Agency Logo', + 'tax_id' => 'Tax ID Number', ]; diff --git a/resources/lang/id/agency.php b/resources/lang/id/agency.php index e33cc41..319543d 100644 --- a/resources/lang/id/agency.php +++ b/resources/lang/id/agency.php @@ -22,4 +22,5 @@ return [ 'address' => 'Alamat Agensi', 'phone' => 'Telp. Agensi', 'logo' => 'Logo Agensi', + 'tax_id' => 'NPWP', ]; diff --git a/resources/views/users/agency/edit.blade.php b/resources/views/users/agency/edit.blade.php index 805be35..5b430b2 100644 --- a/resources/views/users/agency/edit.blade.php +++ b/resources/views/users/agency/edit.blade.php @@ -21,8 +21,11 @@
{!! FormField::text('phone', ['value' => Option::get('agency_phone')]) !!}
{!! FormField::textarea('address', ['value' => Option::get('agency_address')]) !!} - {!! FormField::text('city', ['value' => Option::get('agency_city')]) !!} - {!! FormField::text('website', ['value' => Option::get('agency_website')]) !!} +
+
{!! FormField::text('city', ['value' => Option::get('agency_city')]) !!}
+
{!! FormField::text('website', ['value' => Option::get('agency_website')]) !!}
+
+ {!! FormField::text('tax_id', ['label' => __('agency.tax_id'), 'value' => Option::get('agency_tax_id')]) !!} {{ Form::close() }}
diff --git a/resources/views/users/agency/show.blade.php b/resources/views/users/agency/show.blade.php index 25e375e..9507913 100644 --- a/resources/views/users/agency/show.blade.php +++ b/resources/views/users/agency/show.blade.php @@ -28,6 +28,7 @@ {{ trans('address.address') }}{!! nl2br(Option::get('agency_address')) !!} {{ trans('address.city') }}{{ Option::get('agency_city') }} {{ trans('contact.website') }}{{ Option::get('agency_website') }} + {{ trans('agency.tax_id') }}{{ Option::get('agency_tax_id') }}
diff --git a/tests/Feature/AgencyProfileTest.php b/tests/Feature/AgencyProfileTest.php index 56c9854..df87083 100644 --- a/tests/Feature/AgencyProfileTest.php +++ b/tests/Feature/AgencyProfileTest.php @@ -36,6 +36,7 @@ class AgencyProfileTest extends TestCase 'phone' => '081234567890', 'city' => 'Jakarta', 'website' => 'https://example.com', + 'tax_id' => '14.817.xxx.x-xxx.000', ]); $this->see(trans('agency.updated')); @@ -69,6 +70,10 @@ class AgencyProfileTest extends TestCase 'key' => 'agency_tagline', 'value' => 'Tagline agensi saya', ]); + $this->seeInDatabase('site_options', [ + 'key' => 'agency_tax_id', + 'value' => '14.817.xxx.x-xxx.000', + ]); } /** @test */ From 61ce6ba4813373e003b24609803adf23e11b0276 Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Sat, 17 Nov 2018 21:08:34 +0800 Subject: [PATCH 2/3] Add tax_id on invoice print out --- resources/views/invoices/pdf.blade.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/resources/views/invoices/pdf.blade.php b/resources/views/invoices/pdf.blade.php index c1eefc1..1510e40 100755 --- a/resources/views/invoices/pdf.blade.php +++ b/resources/views/invoices/pdf.blade.php @@ -86,8 +86,12 @@ @if ($invoice->due_date) -

{{ trans('invoice.due_date') }}

-

{{ dateId($invoice->due_date) }}

+

{{ trans('invoice.due_date') }}

+

{{ dateId($invoice->due_date) }}

+ @endif + @if ($taxId = Option::get('agency_tax_id')) +

{{ __('agency.tax_id') }}

+

{{ $taxId }}

@endif From f886b645b6637efe2e67ebdee82ed5a8032537ec Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Sat, 17 Nov 2018 21:09:13 +0800 Subject: [PATCH 3/3] Change trans() to __() helper function --- resources/views/invoices/pdf.blade.php | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/resources/views/invoices/pdf.blade.php b/resources/views/invoices/pdf.blade.php index 1510e40..c830812 100755 --- a/resources/views/invoices/pdf.blade.php +++ b/resources/views/invoices/pdf.blade.php @@ -59,14 +59,14 @@ -

{{ trans('invoice.invoice') }}

-
{{ trans('invoice.number') }} : INV-{{ $invoice->number }}
-
{{ trans('app.date') }} : {{ dateId($invoice->date) }}
+

{{ __('invoice.invoice') }}

+
{{ __('invoice.number') }} : INV-{{ $invoice->number }}
+
{{ __('app.date') }} : {{ dateId($invoice->date) }}
-

{{ trans('app.to') }} :

+

{{ __('app.to') }} :

@php $customer = $invoice->project->customer; @endphp @@ -75,7 +75,7 @@

{!! nl2br($customer->address) !!}

@endif @if ($customer->phone) -

{{ trans('contact.phone') }} : {{ $customer->phone }}

+

{{ __('contact.phone') }} : {{ $customer->phone }}

@endif @if ($customer->website)

{{ $customer->website }}

@@ -86,7 +86,7 @@ @if ($invoice->due_date) -

{{ trans('invoice.due_date') }}

+

{{ __('invoice.due_date') }}

{{ dateId($invoice->due_date) }}

@endif @if ($taxId = Option::get('agency_tax_id')) @@ -95,15 +95,15 @@ @endif - {{ trans('invoice.items') }} : + {{ __('invoice.items') }} : - - - + + + @@ -134,7 +134,7 @@ @endif - + @@ -142,7 +142,7 @@ - + @@ -162,9 +162,9 @@ @foreach ($bankAccounts as $key => $bankAccount) @php $bankAccount = (object) $bankAccount; @endphp
{{ trans('app.table_no') }}{{ trans('invoice.item_description') }}{{ trans('invoice.item_amount') }}{{ __('app.table_no') }}{{ __('invoice.item_description') }}{{ __('invoice.item_amount') }}
{{ trans('app.total') }}{{ __('app.total') }} {{ formatRp($invoice->amount) }}
{{ trans('payment.words_amount') }} : {{ __('payment.words_amount') }} : {{ ucwords(Terbilang::make($invoice->amount)) }} {{ Option::get('money_sign_in_word', 'Rupiah') }}
- - - + + +
{{ trans('bank_account.name') }}: {{ $bankAccount->name }}
{{ trans('bank_account.number') }}: {{ $bankAccount->number }}
{{ trans('bank_account.account_name') }}: {{ $bankAccount->account_name }}
{{ __('bank_account.name') }}: {{ $bankAccount->name }}
{{ __('bank_account.number') }}: {{ $bankAccount->number }}
{{ __('bank_account.account_name') }}: {{ $bankAccount->account_name }}
@if ($key == count($bankAccounts))
@endif @endforeach