mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-07 13:41:23 +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' => [
|
||||
'nullable',
|
||||
],
|
||||
'tax_id' => [
|
||||
'nullable',
|
||||
],
|
||||
'enable_portal' => [
|
||||
|
||||
'boolean',
|
||||
],
|
||||
'currency_id' => [
|
||||
@@ -133,6 +135,7 @@ class CustomerRequest extends FormRequest
|
||||
'password',
|
||||
'phone',
|
||||
'prefix',
|
||||
'tax_id',
|
||||
'company_name',
|
||||
'contact_name',
|
||||
'website',
|
||||
|
||||
@@ -30,6 +30,7 @@ class CustomerResource extends JsonResource
|
||||
'formatted_created_at' => $this->formattedCreatedAt,
|
||||
'avatar' => $this->avatar,
|
||||
'prefix' => $this->prefix,
|
||||
'tax_id' => $this->tax_id,
|
||||
'billing' => $this->when($this->billingAddress()->exists(), function () {
|
||||
return new AddressResource($this->billingAddress);
|
||||
}),
|
||||
|
||||
@@ -35,6 +35,7 @@ class CustomerResource extends JsonResource
|
||||
'due_amount' => $this->due_amount,
|
||||
'base_due_amount' => $this->base_due_amount,
|
||||
'prefix' => $this->prefix,
|
||||
'tax_id' => $this->tax_id,
|
||||
'billing' => $this->when($this->billingAddress()->exists(), function () {
|
||||
return new AddressResource($this->billingAddress);
|
||||
}),
|
||||
|
||||
@@ -145,6 +145,7 @@ trait GeneratesPdfTrait
|
||||
'{CONTACT_EMAIL}' => $customer->email,
|
||||
'{CONTACT_PHONE}' => $customer->phone,
|
||||
'{CONTACT_WEBSITE}' => $customer->website,
|
||||
'{CONTACT_TAX_ID}' => __('pdf_tax_id').': '.$customer->tax_id,
|
||||
];
|
||||
|
||||
$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": {
|
||||
"title": "Customers",
|
||||
"prefix": "Prefix",
|
||||
"tax_id": "Tax ID",
|
||||
"add_customer": "Add Customer",
|
||||
"contacts_list": "Customer List",
|
||||
"name": "Name",
|
||||
|
||||
@@ -116,6 +116,15 @@
|
||||
/>
|
||||
</BaseInputGroup>
|
||||
</BaseInputGrid>
|
||||
|
||||
<BaseInputGroup :label="$t('customers.tax_id')">
|
||||
<BaseInput
|
||||
v-model="customerStore.currentCustomer.tax_id"
|
||||
type="text"
|
||||
class="mt-1 md:mt-0"
|
||||
/>
|
||||
</BaseInputGroup>
|
||||
|
||||
</BaseInputGrid>
|
||||
</BaseTab>
|
||||
|
||||
|
||||
@@ -157,6 +157,24 @@
|
||||
@input="v$.currentCustomer.prefix.$touch()"
|
||||
/>
|
||||
</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>
|
||||
</div>
|
||||
|
||||
@@ -645,6 +663,9 @@ const rules = computed(() => {
|
||||
minLength(3)
|
||||
),
|
||||
},
|
||||
tax_id: {
|
||||
required: helpers.withMessage(t('validation.required'), required),
|
||||
},
|
||||
currency_id: {
|
||||
required: helpers.withMessage(t('validation.required'), required),
|
||||
},
|
||||
|
||||
@@ -180,6 +180,7 @@ async function getFields() {
|
||||
{ label: 'Email', value: 'CONTACT_EMAIL' },
|
||||
{ label: 'Phone', value: 'CONTACT_PHONE' },
|
||||
{ label: 'Website', value: 'CONTACT_WEBSITE' },
|
||||
{ label: 'Tax ID', value: 'CONTACT_TAX_ID' },
|
||||
...customerFields.value.map((i) => ({
|
||||
label: i.label,
|
||||
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.Vuelidate = Vuelidate
|
||||
|
||||
import InvoiceShelf from './InvoiceShelf'
|
||||
import InvoiceShelf from './InvoiceShelf.js'
|
||||
|
||||
window.Vue = Vue
|
||||
window.router = router
|
||||
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({
|
||||
input: [
|
||||
'resources/scripts/main.js',
|
||||
],
|
||||
refresh: true,
|
||||
})
|
||||
laravel([
|
||||
'resources/scripts/main.js'
|
||||
])
|
||||
]
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user