mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-21 21:44:40 +03:00
Merge branch 'feat/vat-validator' into chore/all-my-stuffs
# Conflicts: # package.json # pnpm-lock.yaml # src/tools/index.ts
This commit is contained in:
commit
4c424fcddb
5 files changed
+81
No files matched your search
@@ -174,6 +174,7 @@
|
|||||||
"jsonpath": "^1.1.1",
|
"jsonpath": "^1.1.1",
|
||||||
"jsonar-mod": "^1.9.0",
|
"jsonar-mod": "^1.9.0",
|
||||||
"jsstack.js": "^2.0.0",
|
"jsstack.js": "^2.0.0",
|
||||||
|
"jsvat-next": "^3.0.4",
|
||||||
"jwt-decode": "^3.1.2",
|
"jwt-decode": "^3.1.2",
|
||||||
"korean-unpacker": "^1.0.3",
|
"korean-unpacker": "^1.0.3",
|
||||||
"libphonenumber-js": "^1.10.28",
|
"libphonenumber-js": "^1.10.28",
|
||||||
|
|||||||
Generated
+8
@@ -344,6 +344,9 @@ dependencies:
|
|||||||
jsstack.js:
|
jsstack.js:
|
||||||
specifier: ^2.0.0
|
specifier: ^2.0.0
|
||||||
version: 2.0.0
|
version: 2.0.0
|
||||||
|
jsvat-next:
|
||||||
|
specifier: ^3.0.4
|
||||||
|
version: 3.0.4
|
||||||
jwt-decode:
|
jwt-decode:
|
||||||
specifier: ^3.1.2
|
specifier: ^3.1.2
|
||||||
version: 3.1.2
|
version: 3.1.2
|
||||||
@@ -10690,6 +10693,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-Wr3ismkSUpz6rU3gGKFbFHHllKpvHu0oRipmPedm7qofCsGFP3+9LjptUEivJY5tCcLtHcFr8b1HsFWH/8pP2w==}
|
resolution: {integrity: sha512-Wr3ismkSUpz6rU3gGKFbFHHllKpvHu0oRipmPedm7qofCsGFP3+9LjptUEivJY5tCcLtHcFr8b1HsFWH/8pP2w==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/jsvat-next@3.0.4:
|
||||||
|
resolution: {integrity: sha512-Q9wV2xfBG8yaD4WkskQMLKWXy9vbU5GUABp9tIPldjp7eyLCGK4BLyIYxUP+lXr1E6pIbI0HlSBocF5YSqZduw==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/jwt-decode@3.1.2:
|
/jwt-decode@3.1.2:
|
||||||
resolution: {integrity: sha512-UfpWE/VZn0iP50d8cz9NrZLM9lSWhcJ+0Gt/nm4by88UL+J1SiKN8/5dkjMmbEzwL2CAe+67GsegCbIKtbp75A==}
|
resolution: {integrity: sha512-UfpWE/VZn0iP50d8cz9NrZLM9lSWhcJ+0Gt/nm4by88UL+J1SiKN8/5dkjMmbEzwL2CAe+67GsegCbIKtbp75A==}
|
||||||
dev: false
|
dev: false
|
||||||
@@ -15639,6 +15646,7 @@ packages:
|
|||||||
|
|
||||||
/yamljs@0.3.0:
|
/yamljs@0.3.0:
|
||||||
resolution: {integrity: sha512-C/FsVVhht4iPQYXOInoxUM/1ELSf9EsgKH34FofQOp6hwCPrW4vG4w5++TED3xRUo8gD7l0P1J1dLlDYzODsTQ==}
|
resolution: {integrity: sha512-C/FsVVhht4iPQYXOInoxUM/1ELSf9EsgKH34FofQOp6hwCPrW4vG4w5++TED3xRUo8gD7l0P1J1dLlDYzODsTQ==}
|
||||||
|
hasBin: true
|
||||||
dependencies:
|
dependencies:
|
||||||
argparse: 1.0.10
|
argparse: 1.0.10
|
||||||
glob: 7.2.3
|
glob: 7.2.3
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ import { tool as stacktracePrettier } from './stacktrace-prettier';
|
|||||||
import { tool as dataTransferRateConverter } from './data-transfer-rate-converter';
|
import { tool as dataTransferRateConverter } from './data-transfer-rate-converter';
|
||||||
import { tool as dataStorageUnitConverter } from './data-storage-unit-converter';
|
import { tool as dataStorageUnitConverter } from './data-storage-unit-converter';
|
||||||
import { tool as unicodeSearch } from './unicode-search';
|
import { tool as unicodeSearch } from './unicode-search';
|
||||||
|
import { tool as vatValidator } from './vat-validator';
|
||||||
|
|
||||||
import { tool as cssXpathConverter } from './css-xpath-converter';
|
import { tool as cssXpathConverter } from './css-xpath-converter';
|
||||||
import { tool as cssSelectorsMemo } from './css-selectors-memo';
|
import { tool as cssSelectorsMemo } from './css-selectors-memo';
|
||||||
@@ -436,6 +437,7 @@ export const toolsByCategory: ToolCategory[] = [
|
|||||||
phoneParserAndFormatter,
|
phoneParserAndFormatter,
|
||||||
ibanValidatorAndParser,
|
ibanValidatorAndParser,
|
||||||
luhnValidator,
|
luhnValidator,
|
||||||
|
vatValidator,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import { ReceiptTax } from '@vicons/tabler';
|
||||||
|
import { defineTool } from '../tool';
|
||||||
|
|
||||||
|
export const tool = defineTool({
|
||||||
|
name: 'VAT Numbers Validator',
|
||||||
|
path: '/vat-validator',
|
||||||
|
description: 'Validate VAT Numbers',
|
||||||
|
keywords: ['vat', 'validator'],
|
||||||
|
component: () => import('./vat-validator.vue'),
|
||||||
|
icon: ReceiptTax,
|
||||||
|
createdAt: new Date('2024-08-15'),
|
||||||
|
});
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { checkVAT, countries } from 'jsvat-next';
|
||||||
|
import type { CKeyValueListItems } from '@/ui/c-key-value-list/c-key-value-list.types';
|
||||||
|
|
||||||
|
const rawVATNumber = ref('BE0411905847');
|
||||||
|
const vatInfos = computed<{ isValid: boolean; infos: CKeyValueListItems }>(() => {
|
||||||
|
const vat = checkVAT(rawVATNumber.value, countries);
|
||||||
|
if (vat == null) {
|
||||||
|
return { isValid: false, infos: [] };
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
isValid: vat.isValid,
|
||||||
|
infos: [
|
||||||
|
{
|
||||||
|
label: 'Is VAT Number valid ?',
|
||||||
|
value: vat.isValid,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Is VAT Number valid format ?',
|
||||||
|
value: vat.isValidFormat,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Cleaned VAT Number',
|
||||||
|
value: vat.value,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Country (name)',
|
||||||
|
value: vat.country?.name || 'Unknown',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Country (ISO2)',
|
||||||
|
value: vat.country?.isoCode?.short || 'unk',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Country (ISO3)',
|
||||||
|
value: vat.country?.isoCode?.long || 'unk',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Country (ISO Num)',
|
||||||
|
value: vat.country?.isoCode?.numeric || 0,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<c-input-text v-model:value="rawVATNumber" placeholder="Enter a VAT number to check for validity..." test-id="vat-input" mb-2 />
|
||||||
|
<n-alert v-if="!vatInfos.isValid" type="error" mb-2>
|
||||||
|
Invalid VAT Number.
|
||||||
|
</n-alert>
|
||||||
|
|
||||||
|
<c-card v-if="vatInfos.infos.length > 0" title="VAT Number Infos">
|
||||||
|
<c-key-value-list :items="vatInfos.infos" data-test-id="vat-info" />
|
||||||
|
</c-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
Reference in new issue
Block a user