diff --git a/app/Http/Requests/CustomerRequest.php b/app/Http/Requests/CustomerRequest.php
index 58c58acd..d44ab492 100644
--- a/app/Http/Requests/CustomerRequest.php
+++ b/app/Http/Requests/CustomerRequest.php
@@ -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',
diff --git a/app/Http/Resources/Customer/CustomerResource.php b/app/Http/Resources/Customer/CustomerResource.php
index fe458620..72671de8 100644
--- a/app/Http/Resources/Customer/CustomerResource.php
+++ b/app/Http/Resources/Customer/CustomerResource.php
@@ -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);
}),
diff --git a/app/Http/Resources/CustomerResource.php b/app/Http/Resources/CustomerResource.php
index 0430051b..b3f06da7 100644
--- a/app/Http/Resources/CustomerResource.php
+++ b/app/Http/Resources/CustomerResource.php
@@ -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);
}),
diff --git a/app/Traits/GeneratesPdfTrait.php b/app/Traits/GeneratesPdfTrait.php
index 2de90f8a..eb900e73 100644
--- a/app/Traits/GeneratesPdfTrait.php
+++ b/app/Traits/GeneratesPdfTrait.php
@@ -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;
diff --git a/database/migrations/2024_10_04_093723_add_tax_id_field_to_customers_table.php b/database/migrations/2024_10_04_093723_add_tax_id_field_to_customers_table.php
new file mode 100644
index 00000000..3a462b81
--- /dev/null
+++ b/database/migrations/2024_10_04_093723_add_tax_id_field_to_customers_table.php
@@ -0,0 +1,28 @@
+string('tax_id')->nullable()->after('github_id');
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::table('customers', function (Blueprint $table) {
+ $table->dropColumn('tax_id');
+ });
+ }
+};
diff --git a/lang/en.json b/lang/en.json
index 24e72e11..90a5bab0 100644
--- a/lang/en.json
+++ b/lang/en.json
@@ -172,6 +172,7 @@
"customers": {
"title": "Customers",
"prefix": "Prefix",
+ "tax_id": "Tax ID",
"add_customer": "Add Customer",
"contacts_list": "Customer List",
"name": "Name",
diff --git a/resources/scripts/admin/components/modal-components/CustomerModal.vue b/resources/scripts/admin/components/modal-components/CustomerModal.vue
index 14dbcf86..04e1c441 100644
--- a/resources/scripts/admin/components/modal-components/CustomerModal.vue
+++ b/resources/scripts/admin/components/modal-components/CustomerModal.vue
@@ -116,6 +116,15 @@
/>
+
+
+
+
+
diff --git a/resources/scripts/admin/views/customers/Create.vue b/resources/scripts/admin/views/customers/Create.vue
index 8978f23e..77fa3f12 100644
--- a/resources/scripts/admin/views/customers/Create.vue
+++ b/resources/scripts/admin/views/customers/Create.vue
@@ -157,6 +157,24 @@
@input="v$.currentCustomer.prefix.$touch()"
/>
+
+
+
+
@@ -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),
},
diff --git a/resources/scripts/components/base/BaseCustomInput.vue b/resources/scripts/components/base/BaseCustomInput.vue
index 3b35de80..e149ba10 100644
--- a/resources/scripts/components/base/BaseCustomInput.vue
+++ b/resources/scripts/components/base/BaseCustomInput.vue
@@ -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,
diff --git a/resources/scripts/main.js b/resources/scripts/main.js
index e76e1629..ea02b1ad 100644
--- a/resources/scripts/main.js
+++ b/resources/scripts/main.js
@@ -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()
\ No newline at end of file
diff --git a/vite.config.js b/vite.config.js
index 8028526e..9a02b863 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -32,11 +32,8 @@ export default defineConfig({
},
},
}),
- laravel({
- input: [
- 'resources/scripts/main.js',
- ],
- refresh: true,
- })
+ laravel([
+ 'resources/scripts/main.js'
+ ])
]
});