Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vat number to db to all address tables #2106

Open
wants to merge 3 commits into
base: 1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/core/reference/addresses.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Lunar\Models\Address
|`first_name`||
|`last_name`||
|`company_name`|nullable|
|`vat_number`|nullable|
|`line_one`||
|`line_two`|nullable|
|`line_three`|nullable|
Expand Down
1 change: 1 addition & 0 deletions docs/core/reference/carts.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ $shippingAddress = [
'first_name' => null,
'last_name' => null,
'company_name' => null,
'vat_number' => null,
'line_one' => null,
'line_two' => null,
'line_three' => null,
Expand Down
4 changes: 2 additions & 2 deletions docs/core/reference/customers.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Lunar\Models\Customer
|`first_name`||
|`last_name`||
|`company_name`|nullable|
|`vat_no`|nullable|
|`vat_number`|nullable|
|`account_ref`|nullable|
|`attribute_data`|JSON|
|`meta`|JSON|
Expand All @@ -32,7 +32,7 @@ Lunar\Models\Customer::create([
'first_name' => 'Tony',
'last_name' => 'Stark',
'company_name' => 'Stark Enterprises',
'vat_no' => null,
'vat_number' => null,
'meta' => [
'account_no' => 'TNYSTRK1234'
],
Expand Down
1 change: 1 addition & 0 deletions docs/core/reference/orders.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ If you are using the `createOrder` method on a cart, this is all handled for you
'first_name' => 'Jacob',
'last_name' => null,
'company_name' => null,
'vat_number' => null,
'line_one' => '123 Foo Street',
'line_two' => null,
'line_three' => null,
Expand Down
1 change: 1 addition & 0 deletions docs/core/reference/payments.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ If you are using the `createOrder` method on a cart, this is all handled for you
'first_name' => 'Jacob',
'last_name' => null,
'company_name' => null,
'vat_number' => null,
'line_one' => '123 Foo Street',
'line_two' => null,
'line_three' => null,
Expand Down
6 changes: 6 additions & 0 deletions packages/admin/resources/lang/en/address.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
'company_name' => [
'label' => 'Company Name',
],
'vat_number' => [
'label' => 'VAT Number',
],
'line_one' => [
'label' => 'Address',
],
Expand Down Expand Up @@ -61,6 +64,9 @@
'company_name' => [
'label' => 'Company Name',
],
'vat_number' => [
'label' => 'VAT Number',
],
'line_one' => [
'label' => 'Line One',
],
Expand Down
8 changes: 4 additions & 4 deletions packages/admin/resources/lang/en/customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
'company_name' => [
'label' => 'Company Name',
],
'vat_no' => [
'label' => 'VAT No.',
'vat_number' => [
'label' => 'VAT Number',
],
'account_reference' => [
'label' => 'Account Reference',
Expand Down Expand Up @@ -52,8 +52,8 @@
'account_ref' => [
'label' => 'Account Reference',
],
'vat_no' => [
'label' => 'VAT No.',
'vat_number' => [
'label' => 'VAT Number',
],
'customer_groups' => [
'label' => 'Customer Groups',
Expand Down
3 changes: 3 additions & 0 deletions packages/admin/resources/lang/en/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@
'company_name' => [
'label' => 'Company Name',
],
'vat_number' => [
'label' => 'VAT Number',
],
'contact_phone' => [
'label' => 'Phone',
],
Expand Down
6 changes: 6 additions & 0 deletions packages/admin/resources/lang/es/address.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
'company_name' => [
'label' => 'Nombre de la empresa',
],
'vat_number' => [
'label' => 'Número de IVA',
],
'line_one' => [
'label' => 'Dirección',
],
Expand Down Expand Up @@ -61,6 +64,9 @@
'company_name' => [
'label' => 'Nombre de la empresa',
],
'vat_number' => [
'label' => 'Número de IVA',
],
'line_one' => [
'label' => 'Línea Uno',
],
Expand Down
4 changes: 2 additions & 2 deletions packages/admin/resources/lang/es/customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
'company_name' => [
'label' => 'Nombre de la Empresa',
],
'vat_no' => [
'vat_number' => [
'label' => 'NIF',
],
'account_reference' => [
Expand Down Expand Up @@ -52,7 +52,7 @@
'account_ref' => [
'label' => 'Referencia de Cuenta',
],
'vat_no' => [
'vat_number' => [
'label' => 'NIF',
],
'customer_groups' => [
Expand Down
3 changes: 3 additions & 0 deletions packages/admin/resources/lang/es/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@
'company_name' => [
'label' => 'Nombre de la Empresa',
],
'vat_number' => [
'label' => 'Número de IVA',
],
'contact_phone' => [
'label' => 'Teléfono',
],
Expand Down
6 changes: 6 additions & 0 deletions packages/admin/resources/lang/fr/address.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
'company_name' => [
'label' => 'Nom de l\'entreprise',
],
'vat_number' => [
'label' => 'Numéro de TVA',
],
'line_one' => [
'label' => 'Adresse',
],
Expand Down Expand Up @@ -61,6 +64,9 @@
'company_name' => [
'label' => 'Nom de l\'entreprise',
],
'vat_number' => [
'label' => 'Numéro de TVA',
],
'line_one' => [
'label' => 'Adresse ligne 1',
],
Expand Down
4 changes: 2 additions & 2 deletions packages/admin/resources/lang/fr/customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
'company_name' => [
'label' => 'Nom de la société',
],
'vat_no' => [
'vat_number' => [
'label' => 'Numéro de TVA',
],
'account_reference' => [
Expand Down Expand Up @@ -52,7 +52,7 @@
'account_ref' => [
'label' => 'Référence de compte',
],
'vat_no' => [
'vat_number' => [
'label' => 'Numéro de TVA',
],
'customer_groups' => [
Expand Down
3 changes: 3 additions & 0 deletions packages/admin/resources/lang/fr/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@
'company_name' => [
'label' => 'Nom de l\'entreprise',
],
'vat_number' => [
'label' => 'Numéro de TVA',
],
'contact_phone' => [
'label' => 'Téléphone',
],
Expand Down
6 changes: 6 additions & 0 deletions packages/admin/resources/lang/nl/address.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
'company_name' => [
'label' => 'Bedrijfsnaam',
],
'vat_number' => [
'label' => 'BTW-nummer',
],
'line_one' => [
'label' => 'Adres',
],
Expand Down Expand Up @@ -61,6 +64,9 @@
'company_name' => [
'label' => 'Bedrijfsnaam',
],
'vat_number' => [
'label' => 'BTW-nummer',
],
'line_one' => [
'label' => 'Adresregel Een',
],
Expand Down
4 changes: 2 additions & 2 deletions packages/admin/resources/lang/nl/customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
'company_name' => [
'label' => 'Bedrijfsnaam',
],
'vat_no' => [
'vat_number' => [
'label' => 'BTW Nr.',
],
'account_reference' => [
Expand Down Expand Up @@ -52,7 +52,7 @@
'account_ref' => [
'label' => 'Account Referentie',
],
'vat_no' => [
'vat_number' => [
'label' => 'BTW Nr.',
],
'customer_groups' => [
Expand Down
3 changes: 3 additions & 0 deletions packages/admin/resources/lang/nl/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@
'company_name' => [
'label' => 'Bedrijfsnaam',
],
'vat_number' => [
'label' => 'BTW-nummer',
],
'contact_phone' => [
'label' => 'Telefoon',
],
Expand Down
10 changes: 8 additions & 2 deletions packages/admin/resources/views/pdf/order.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@
@if($record->billingAddress->company_name)
{{ $record->billingAddress->company_name }}<br>
@endif
@if($record->billingAddress->vat_number)
{{ $record->billingAddress->vat_number }}<br>
@endif
{{ $record->billingAddress->line_one }}
@if($record->billingAddress->line_two)
<br>{{ $record->billingAddress->line_two }}<br>
Expand All @@ -106,8 +109,8 @@
{{ $record->billingAddress->state }}<br>
{{ $record->billingAddress->postcode }}<br>
{{ $record->billingAddress->country->name }}<br>
@if($record->customer?->vat_no)
<p>VAT No.: {{ $record->customer?->vat_no }}</p>
@if($record->customer?->vat_number)
<p>VAT Number: {{ $record->customer?->vat_number }}</p>
@endif
</td>

Expand All @@ -117,6 +120,9 @@
@if($record->shippingAddress->company_name)
{{ $record->shippingAddress->company_name }}<br>
@endif
@if($record->shippingAddress->vat_number)
{{ $record->shippingAddress->vat_number }}<br>
@endif
{{ $record->shippingAddress->line_one }}
@if($record->shippingAddress->line_two)
<br>{{ $record->shippingAddress->line_two }}<br>
Expand Down
10 changes: 5 additions & 5 deletions packages/admin/src/Filament/Resources/CustomerResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ protected static function getAccountRefFormComponent(): Component

protected static function getVatNoFormComponent(): Component
{
return Forms\Components\TextInput::make('vat_no')
->label(__('lunarpanel::customer.form.vat_no.label'))
return Forms\Components\TextInput::make('vat_number')
->label(__('lunarpanel::customer.form.vat_number.label'))
->nullable()
->maxLength(255);
}
Expand Down Expand Up @@ -184,8 +184,8 @@ protected static function getDefaultTable(Table $table): Table
->label(__('lunarpanel::customer.table.company_name.label'))
->sortable()
->searchable(),
Tables\Columns\TextColumn::make('vat_no')
->label(__('lunarpanel::customer.table.vat_no.label'))
Tables\Columns\TextColumn::make('vat_number')
->label(__('lunarpanel::customer.table.vat_number.label'))
->sortable(),
Tables\Columns\TextColumn::make('account_ref')
->label(__('lunarpanel::customer.table.account_reference.label'))
Expand Down Expand Up @@ -236,7 +236,7 @@ public static function getGloballySearchableAttributes(): array
'last_name',
'company_name',
'account_ref',
'vat_no',
'vat_number',
'users.name',
'users.email',
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ public function getDefaultTable(Table $table): Table
Tables\Columns\TextColumn::make('company_name')->label(
__('lunarpanel::address.table.company_name.label')
),
Tables\Columns\TextColumn::make('vat_number')->label(
__('lunarpanel::address.table.vat_number.label')
),
Tables\Columns\TextColumn::make('line_one')->label(
__('lunarpanel::address.table.line_one.label')
)->description(function (Model $record) {
Expand Down Expand Up @@ -76,6 +79,7 @@ public function getDefaultTable(Table $table): Table
'first_name' => $record->first_name,
'last_name' => $record->last_name,
'company_name' => $record->company_name,
'vat_number' => $record->vat_number,
'line_one' => $record->line_one,
'line_two' => $record->line_two,
'line_three' => $record->line_three,
Expand All @@ -100,6 +104,9 @@ public function getDefaultTable(Table $table): Table
Forms\Components\TextInput::make('company_name')->label(
__('lunarpanel::address.form.company_name.label')
),
Forms\Components\TextInput::make('vat_number')->label(
__('lunarpanel::address.form.vat_number.label')
),
Forms\Components\Group::make()->schema([
Forms\Components\TextInput::make('line_one')->label(
__('lunarpanel::address.form.line_one.label')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ public static function getAddressEditSchema(): array
->label(__('lunarpanel::order.form.address.company_name.label'))
->autocomplete(false)
->maxLength(255),
Forms\Components\TextInput::make('vat_number')
->label(__('lunarpanel::order.form.address.vat_number.label'))
->autocomplete(false)
->maxLength(255),
Forms\Components\Grid::make()
->schema([
Forms\Components\TextInput::make('contact_phone')
Expand Down Expand Up @@ -138,6 +142,7 @@ public static function getOrderAddressInfolistSchema(string $type): Infolists\Co
if ($address?->id ?? false) {
return collect([
'company_name' => $address->company_name,
'vat_number' => $address->vat_number,
'fullName' => $address->fullName,
'line_one' => $address->line_one,
'line_two' => $address->line_two,
Expand Down
1 change: 1 addition & 0 deletions packages/core/database/factories/AddressFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public function definition(): array
'first_name' => $this->faker->firstName,
'last_name' => $this->faker->lastName,
'company_name' => $this->faker->boolean ? $this->faker->company : null,
'vat_number' => $this->faker->boolean ? $this->faker->regexify('[A-Z]{2}[0-9]{8}') : null,
'line_one' => $this->faker->streetName,
'line_two' => $this->faker->boolean ? $this->faker->secondaryAddress : null,
'line_three' => $this->faker->boolean ? $this->faker->buildingNumber : null,
Expand Down
1 change: 1 addition & 0 deletions packages/core/database/factories/CartAddressFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public function definition(): array
'first_name' => $this->faker->firstName,
'last_name' => $this->faker->lastName,
'company_name' => $this->faker->boolean ? $this->faker->company : null,
'vat_number' => $this->faker->boolean ? $this->faker->regexify('[A-Z]{2}[0-9]{8}') : null,
'line_one' => $this->faker->streetName,
'line_two' => $this->faker->boolean ? $this->faker->secondaryAddress : null,
'line_three' => $this->faker->boolean ? $this->faker->buildingNumber : null,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/database/factories/CustomerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function definition(): array
'first_name' => $this->faker->firstName,
'last_name' => $this->faker->lastName,
'company_name' => $this->faker->boolean ? $this->faker->company : null,
'vat_no' => $this->faker->boolean ? Str::random() : null,
'vat_number' => $this->faker->boolean ? Str::random() : null,
'meta' => $this->faker->boolean ? ['account_no' => Str::random()] : null,
];
}
Expand Down
1 change: 1 addition & 0 deletions packages/core/database/factories/OrderAddressFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public function definition(): array
'first_name' => $this->faker->firstName,
'last_name' => $this->faker->lastName,
'company_name' => $this->faker->boolean ? $this->faker->company : null,
'vat_number' => $this->faker->boolean ? $this->faker->regexify('[A-Z]{2}[0-9]{8}') : null,
'line_one' => $this->faker->streetName,
'line_two' => $this->faker->boolean ? 'Suite '.$this->faker->numerify() : null,
'line_three' => $this->faker->boolean ? $this->faker->buildingNumber : null,
Expand Down
Loading