mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-19 03:04:05 +00:00
Merge pull request #166 from mchev/customer_tax_id
Include a Tax ID field in both customer creation and invoices
This commit is contained in:
@@ -49,8 +49,10 @@ class CustomerRequest extends FormRequest
|
|||||||
'prefix' => [
|
'prefix' => [
|
||||||
'nullable',
|
'nullable',
|
||||||
],
|
],
|
||||||
|
'tax_id' => [
|
||||||
|
'nullable',
|
||||||
|
],
|
||||||
'enable_portal' => [
|
'enable_portal' => [
|
||||||
|
|
||||||
'boolean',
|
'boolean',
|
||||||
],
|
],
|
||||||
'currency_id' => [
|
'currency_id' => [
|
||||||
@@ -133,6 +135,7 @@ class CustomerRequest extends FormRequest
|
|||||||
'password',
|
'password',
|
||||||
'phone',
|
'phone',
|
||||||
'prefix',
|
'prefix',
|
||||||
|
'tax_id',
|
||||||
'company_name',
|
'company_name',
|
||||||
'contact_name',
|
'contact_name',
|
||||||
'website',
|
'website',
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ class CustomerResource extends JsonResource
|
|||||||
'formatted_created_at' => $this->formattedCreatedAt,
|
'formatted_created_at' => $this->formattedCreatedAt,
|
||||||
'avatar' => $this->avatar,
|
'avatar' => $this->avatar,
|
||||||
'prefix' => $this->prefix,
|
'prefix' => $this->prefix,
|
||||||
|
'tax_id' => $this->tax_id,
|
||||||
'billing' => $this->when($this->billingAddress()->exists(), function () {
|
'billing' => $this->when($this->billingAddress()->exists(), function () {
|
||||||
return new AddressResource($this->billingAddress);
|
return new AddressResource($this->billingAddress);
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ class CustomerResource extends JsonResource
|
|||||||
'due_amount' => $this->due_amount,
|
'due_amount' => $this->due_amount,
|
||||||
'base_due_amount' => $this->base_due_amount,
|
'base_due_amount' => $this->base_due_amount,
|
||||||
'prefix' => $this->prefix,
|
'prefix' => $this->prefix,
|
||||||
|
'tax_id' => $this->tax_id,
|
||||||
'billing' => $this->when($this->billingAddress()->exists(), function () {
|
'billing' => $this->when($this->billingAddress()->exists(), function () {
|
||||||
return new AddressResource($this->billingAddress);
|
return new AddressResource($this->billingAddress);
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -145,6 +145,7 @@ trait GeneratesPdfTrait
|
|||||||
'{CONTACT_EMAIL}' => $customer->email,
|
'{CONTACT_EMAIL}' => $customer->email,
|
||||||
'{CONTACT_PHONE}' => $customer->phone,
|
'{CONTACT_PHONE}' => $customer->phone,
|
||||||
'{CONTACT_WEBSITE}' => $customer->website,
|
'{CONTACT_WEBSITE}' => $customer->website,
|
||||||
|
'{CONTACT_TAX_ID}' => __('pdf_tax_id').': '.$customer->tax_id,
|
||||||
];
|
];
|
||||||
|
|
||||||
$customFields = $this->fields;
|
$customFields = $this->fields;
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('customers', function (Blueprint $table) {
|
||||||
|
$table->string('tax_id')->nullable()->after('github_id');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('customers', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('tax_id');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -172,6 +172,7 @@
|
|||||||
"customers": {
|
"customers": {
|
||||||
"title": "Customers",
|
"title": "Customers",
|
||||||
"prefix": "Prefix",
|
"prefix": "Prefix",
|
||||||
|
"tax_id": "Tax ID",
|
||||||
"add_customer": "Add Customer",
|
"add_customer": "Add Customer",
|
||||||
"contacts_list": "Customer List",
|
"contacts_list": "Customer List",
|
||||||
"name": "Name",
|
"name": "Name",
|
||||||
|
|||||||
@@ -116,6 +116,15 @@
|
|||||||
/>
|
/>
|
||||||
</BaseInputGroup>
|
</BaseInputGroup>
|
||||||
</BaseInputGrid>
|
</BaseInputGrid>
|
||||||
|
|
||||||
|
<BaseInputGroup :label="$t('customers.tax_id')">
|
||||||
|
<BaseInput
|
||||||
|
v-model="customerStore.currentCustomer.tax_id"
|
||||||
|
type="text"
|
||||||
|
class="mt-1 md:mt-0"
|
||||||
|
/>
|
||||||
|
</BaseInputGroup>
|
||||||
|
|
||||||
</BaseInputGrid>
|
</BaseInputGrid>
|
||||||
</BaseTab>
|
</BaseTab>
|
||||||
|
|
||||||
|
|||||||
@@ -157,6 +157,24 @@
|
|||||||
@input="v$.currentCustomer.prefix.$touch()"
|
@input="v$.currentCustomer.prefix.$touch()"
|
||||||
/>
|
/>
|
||||||
</BaseInputGroup>
|
</BaseInputGroup>
|
||||||
|
|
||||||
|
<BaseInputGroup
|
||||||
|
:label="$t('customers.tax_id')"
|
||||||
|
:error="
|
||||||
|
v$.currentCustomer.tax_id.$error &&
|
||||||
|
v$.currentCustomer.tax_id.$errors[0].$message
|
||||||
|
"
|
||||||
|
:content-loading="isFetchingInitialData"
|
||||||
|
>
|
||||||
|
<BaseInput
|
||||||
|
v-model="customerStore.currentCustomer.tax_id"
|
||||||
|
:content-loading="isFetchingInitialData"
|
||||||
|
type="text"
|
||||||
|
name="tax_id"
|
||||||
|
:invalid="v$.currentCustomer.tax_id.$error"
|
||||||
|
@input="v$.currentCustomer.tax_id.$touch()"
|
||||||
|
/>
|
||||||
|
</BaseInputGroup>
|
||||||
</BaseInputGrid>
|
</BaseInputGrid>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -645,6 +663,9 @@ const rules = computed(() => {
|
|||||||
minLength(3)
|
minLength(3)
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
tax_id: {
|
||||||
|
required: helpers.withMessage(t('validation.required'), required),
|
||||||
|
},
|
||||||
currency_id: {
|
currency_id: {
|
||||||
required: helpers.withMessage(t('validation.required'), required),
|
required: helpers.withMessage(t('validation.required'), required),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -180,6 +180,7 @@ async function getFields() {
|
|||||||
{ label: 'Email', value: 'CONTACT_EMAIL' },
|
{ label: 'Email', value: 'CONTACT_EMAIL' },
|
||||||
{ label: 'Phone', value: 'CONTACT_PHONE' },
|
{ label: 'Phone', value: 'CONTACT_PHONE' },
|
||||||
{ label: 'Website', value: 'CONTACT_WEBSITE' },
|
{ label: 'Website', value: 'CONTACT_WEBSITE' },
|
||||||
|
{ label: 'Tax ID', value: 'CONTACT_TAX_ID' },
|
||||||
...customerFields.value.map((i) => ({
|
...customerFields.value.map((i) => ({
|
||||||
label: i.label,
|
label: i.label,
|
||||||
value: i.slug,
|
value: i.slug,
|
||||||
|
|||||||
5
resources/scripts/main.js
vendored
5
resources/scripts/main.js
vendored
@@ -14,11 +14,10 @@ import.meta.glob([
|
|||||||
|
|
||||||
window.pinia = pinia
|
window.pinia = pinia
|
||||||
window.Vuelidate = Vuelidate
|
window.Vuelidate = Vuelidate
|
||||||
|
import InvoiceShelf from './InvoiceShelf.js'
|
||||||
import InvoiceShelf from './InvoiceShelf'
|
|
||||||
|
|
||||||
window.Vue = Vue
|
window.Vue = Vue
|
||||||
window.router = router
|
window.router = router
|
||||||
window.VueRouter = VueRouter
|
window.VueRouter = VueRouter
|
||||||
|
|
||||||
window.InvoiceShelf = new InvoiceShelf()
|
window.InvoiceShelf = new InvoiceShelf()
|
||||||
9
vite.config.js
vendored
9
vite.config.js
vendored
@@ -32,11 +32,8 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
laravel({
|
laravel([
|
||||||
input: [
|
'resources/scripts/main.js'
|
||||||
'resources/scripts/main.js',
|
])
|
||||||
],
|
|
||||||
refresh: true,
|
|
||||||
})
|
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user