diff --git a/package.json b/package.json
index 04b75a0b0..39d49519b 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "salix-front",
- "version": "24.50.0",
+ "version": "24.52.0",
"description": "Salix frontend",
"productName": "Salix",
"author": "Verdnatura",
@@ -64,4 +64,4 @@
"vite": "^5.1.4",
"vitest": "^0.31.1"
}
-}
\ No newline at end of file
+}
diff --git a/src/components/common/VnSelect.vue b/src/components/common/VnSelect.vue
index cd8716194..e116be32a 100644
--- a/src/components/common/VnSelect.vue
+++ b/src/components/common/VnSelect.vue
@@ -8,7 +8,14 @@ import dataByOrder from 'src/utils/dataByOrder';
const emit = defineEmits(['update:modelValue', 'update:options', 'remove']);
const $attrs = useAttrs();
const { t } = useI18n();
-const { isRequired, requiredFieldRule } = useRequired($attrs);
+
+const isRequired = computed(() => {
+ return useRequired($attrs).isRequired;
+});
+const requiredFieldRule = computed(() => {
+ return useRequired($attrs).requiredFieldRule;
+});
+
const $props = defineProps({
modelValue: {
type: [String, Number, Object],
diff --git a/src/components/ui/VnLinkPhone.vue b/src/components/ui/VnLinkPhone.vue
index 4068498cd..c5d5df394 100644
--- a/src/components/ui/VnLinkPhone.vue
+++ b/src/components/ui/VnLinkPhone.vue
@@ -1,23 +1,28 @@
{{ capitalize(type).replace('-', '') }}
diff --git a/src/composables/useRequired.js b/src/composables/useRequired.js
index e650c91f5..d211b96b4 100644
--- a/src/composables/useRequired.js
+++ b/src/composables/useRequired.js
@@ -2,8 +2,14 @@ import { useValidator } from 'src/composables/useValidator';
export function useRequired($attrs) {
const { validations } = useValidator();
-
- const isRequired = Object.keys($attrs).includes('required');
+ const hasRequired = Object.keys($attrs).includes('required');
+ let isRequired = false;
+ if (hasRequired) {
+ const required = $attrs['required'];
+ if (typeof required === 'boolean') {
+ isRequired = required;
+ }
+ }
const requiredFieldRule = (val) => validations().required(isRequired, val);
return {
diff --git a/src/filters/parsePhone.js b/src/filters/parsePhone.js
index 696f55007..6cb1bea17 100644
--- a/src/filters/parsePhone.js
+++ b/src/filters/parsePhone.js
@@ -1,12 +1,18 @@
-export default function (phone, prefix = 34) {
- if (phone.startsWith('+')) {
- return `${phone.slice(1)}`;
- }
- if (phone.startsWith('00')) {
- return `${phone.slice(2)}`;
- }
- if (phone.startsWith(prefix) && phone.length === prefix.length + 9) {
- return `${prefix}${phone.slice(prefix.length)}`;
+import axios from 'axios';
+
+export default async function parsePhone(phone, country) {
+ if (!phone) return;
+ if (phone.startsWith('+')) return `${phone.slice(1)}`;
+ if (phone.startsWith('00')) return `${phone.slice(2)}`;
+
+ let prefix;
+ try {
+ prefix = (await axios.get(`Prefixes/${country.toLowerCase()}`)).data?.prefix;
+ } catch (e) {
+ prefix = (await axios.get('PbxConfigs/findOne')).data?.defaultPrefix;
}
+ prefix = prefix.replace(/^0+/, '');
+
+ if (phone.startsWith(prefix)) return phone;
return `${prefix}${phone}`;
}
diff --git a/src/pages/Customer/Card/CustomerFiscalData.vue b/src/pages/Customer/Card/CustomerFiscalData.vue
index 24d8d1e5d..673c7dda9 100644
--- a/src/pages/Customer/Card/CustomerFiscalData.vue
+++ b/src/pages/Customer/Card/CustomerFiscalData.vue
@@ -67,6 +67,7 @@ function handleLocation(data, location) {
option-label="vat"
option-value="id"
v-model="data.sageTaxTypeFk"
+ data-cy="sageTaxTypeFk"
:required="data.isTaxDataChecked"
/>
diff --git a/src/pages/Customer/Card/CustomerSummary.vue b/src/pages/Customer/Card/CustomerSummary.vue
index 4fa7b9bdc..2cad13115 100644
--- a/src/pages/Customer/Card/CustomerSummary.vue
+++ b/src/pages/Customer/Card/CustomerSummary.vue
@@ -95,6 +95,7 @@ const sumRisk = ({ clientRisks }) => {
:phone-number="entity.mobile"
:channel="entity.country?.saySimpleCountry?.channel"
class="q-ml-xs"
+ :country="entity.country?.code"
/>
diff --git a/src/pages/Customer/Card/CustomerWebAccess.vue b/src/pages/Customer/Card/CustomerWebAccess.vue
index eec127fde..ea901c65a 100644
--- a/src/pages/Customer/Card/CustomerWebAccess.vue
+++ b/src/pages/Customer/Card/CustomerWebAccess.vue
@@ -42,13 +42,13 @@ async function hasCustomerRole() {
>
-
+
diff --git a/src/pages/Customer/components/CustomerAddressCreate.vue b/src/pages/Customer/components/CustomerAddressCreate.vue
index f4a188243..bc4d6a128 100644
--- a/src/pages/Customer/components/CustomerAddressCreate.vue
+++ b/src/pages/Customer/components/CustomerAddressCreate.vue
@@ -18,8 +18,6 @@ const router = useRouter();
const formInitialData = reactive({ isDefaultAddress: false });
-const urlCreate = ref('');
-
const agencyModes = ref([]);
const incoterms = ref([]);
const customsAgents = ref([]);
@@ -40,13 +38,18 @@ function handleLocation(data, location) {
data.countryFk = countryFk;
}
-function onAgentCreated(requestResponse, data) {
- customsAgents.value.push(requestResponse);
- data.customsAgentFk = requestResponse.id;
+function onAgentCreated({ id, fiscalName }, data) {
+ customsAgents.value.push({ id, fiscalName });
+ data.customsAgentFk = id;
}
+ (customsAgents = data)"
+ auto-load
+ url="CustomsAgents"
+ />
(agencyModes = data)"
auto-load
@@ -57,7 +60,7 @@ function onAgentCreated(requestResponse, data) {
@@ -141,8 +144,7 @@ function onAgentCreated(requestResponse, data) {
- onAgentCreated(requestResponse, data)
+ (requestResponse) => onAgentCreated(requestResponse, data)
"
/>
diff --git a/src/pages/InvoiceOut/locale/es.yml b/src/pages/InvoiceOut/locale/es.yml
index bf5126641..106168a5d 100644
--- a/src/pages/InvoiceOut/locale/es.yml
+++ b/src/pages/InvoiceOut/locale/es.yml
@@ -11,7 +11,7 @@ invoiceOutList:
ref: Referencia
issued: Fecha emisión
created: F. creación
- dueDate: F. máxima
+ dueDate: Fecha vencimiento
invoiceOutSerial: Serial
ticket: Ticket
taxArea: Area
diff --git a/src/pages/Item/Card/ItemTags.vue b/src/pages/Item/Card/ItemTags.vue
index f4ab90d93..a077c72c6 100644
--- a/src/pages/Item/Card/ItemTags.vue
+++ b/src/pages/Item/Card/ItemTags.vue
@@ -138,6 +138,7 @@ const insertTag = (rows) => {
:required="false"
:rules="validate('itemTag.tagFk')"
:use-like="false"
+ sort-by="value"
/>
@@ -110,7 +83,7 @@ onMounted(async () => {
:label="t('order.form.addressFk')"
v-model="data.addressId"
url="addresses"
- :fields="['id', 'nickname', 'defaultAddressFk', 'street', 'city']"
+ :fields="['id', 'nickname', 'street', 'city']"
sort-by="id"
option-value="id"
option-label="street"
diff --git a/src/pages/Order/OrderList.vue b/src/pages/Order/OrderList.vue
index c47a9b2ec..dfeb0f6e2 100644
--- a/src/pages/Order/OrderList.vue
+++ b/src/pages/Order/OrderList.vue
@@ -1,7 +1,7 @@