Merge branch 'master' into Hotfix-OpenFilesInsteadOfDownloading
gitea/salix-front/pipeline/pr-master There was a failure building this commit Details

This commit is contained in:
Jon Elias 2025-05-15 12:57:51 +00:00
commit 7b2b6a81eb
6 changed files with 60 additions and 6 deletions

View File

@ -1,7 +1,7 @@
<script setup> <script setup>
import { ref, onMounted, onUnmounted, computed } from 'vue'; import { ref, onMounted, onUnmounted, computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router'; import { useRoute } from 'vue-router';
import axios from 'axios'; import axios from 'axios';
import { date } from 'quasar'; import { date } from 'quasar';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
@ -21,7 +21,6 @@ const stateStore = useStateStore();
const validationsStore = useValidator(); const validationsStore = useValidator();
const { models } = validationsStore; const { models } = validationsStore;
const route = useRoute(); const route = useRoute();
const router = useRouter();
const { t } = useI18n(); const { t } = useI18n();
const props = defineProps({ const props = defineProps({
model: { model: {
@ -273,7 +272,7 @@ onUnmounted(() => {
:data-key :data-key
:url="dataKey + 's'" :url="dataKey + 's'"
:user-filter="filter" :user-filter="filter"
:filter="{ where: { and: [{ originFk: route.params.id }] } }" :filter="{ where: { originFk: $route.params.id } }"
:skeleton="false" :skeleton="false"
auto-load auto-load
@on-fetch="setLogTree" @on-fetch="setLogTree"

View File

@ -47,7 +47,9 @@ export function useValidator() {
return !validator.isEmpty(value ? String(value) : '') || message; return !validator.isEmpty(value ? String(value) : '') || message;
}, },
required: (required, value) => { required: (required, value) => {
return required ? !!value || t('globals.fieldRequired') : null; return required
? value === 0 || !!value || t('globals.fieldRequired')
: null;
}, },
length: (value) => { length: (value) => {
const options = { const options = {

View File

@ -179,6 +179,11 @@ function handleLocation(data, location) {
data.provinceFk = provinceFk; data.provinceFk = provinceFk;
data.countryFk = countryFk; data.countryFk = countryFk;
} }
function onAgentCreated({ id, fiscalName }, data) {
customsAgents.value.push({ id, fiscalName });
data.customsAgentFk = id;
}
</script> </script>
<template> <template>
@ -292,9 +297,14 @@ function handleLocation(data, location) {
option-value="id" option-value="id"
v-model="data.customsAgentFk" v-model="data.customsAgentFk"
:tooltip="t('New customs agent')" :tooltip="t('New customs agent')"
:acls="[{ model: 'CustomsAgent', props: '*', accessType: 'WRITE' }]"
> >
<template #form> <template #form>
<CustomerNewCustomsAgent /> <CustomerNewCustomsAgent
@on-data-saved="
(requestResponse) => onAgentCreated(requestResponse, data)
"
/>
</template> </template>
</VnSelectDialog> </VnSelectDialog>
</VnRow> </VnRow>

View File

@ -16,6 +16,7 @@ const onDataSaved = (dataSaved) => {
<template> <template>
<FormModelPopup <FormModelPopup
:form-initial-data="{}"
:title="t('New customs agent')" :title="t('New customs agent')"
@on-data-saved="onDataSaved($event)" @on-data-saved="onDataSaved($event)"
model="customer" model="customer"

View File

@ -46,6 +46,28 @@ const { openConfirmationModal } = useVnConfirm();
:summary="$props.summary" :summary="$props.summary"
:to-module="{ name: 'WorkerDepartment' }" :to-module="{ name: 'WorkerDepartment' }"
data-key="Department" data-key="Department"
:filter="{
include: [
{
relation: 'client',
scope: {
fields: ['id', 'name'],
},
},
{
relation: 'worker',
scope: {
fields: ['id', 'name'],
include: {
relation: 'user',
scope: {
fields: ['id', 'name'],
},
},
},
},
],
}"
> >
<template #menu="{}"> <template #menu="{}">
<QItem <QItem

View File

@ -7,7 +7,27 @@ describe('Client credits', () => {
timeout: 5000, timeout: 5000,
}); });
}); });
it('Should load layout', () => {
it('Should put a new credit', () => {
cy.get('.q-page').should('be.visible'); cy.get('.q-page').should('be.visible');
cy.dataCy('vnTableCreateBtn').click();
cy.dataCy('Credit_input').type('100');
cy.dataCy('FormModelPopup_save').click();
cy.checkNotification('Data saved');
});
it('Should put a new credit with value 0 to close the client card', () => {
cy.get('.q-page').should('be.visible');
cy.dataCy('vnTableCreateBtn').click();
cy.dataCy('Credit_input').type('0');
cy.dataCy('FormModelPopup_save').click();
cy.checkNotification('Data saved');
});
it('Should not create the credit if there is no value in the input', () => {
cy.get('.q-page').should('be.visible');
cy.dataCy('vnTableCreateBtn').click();
cy.dataCy('FormModelPopup_save').click();
cy.get('.q-notification__message').should('not.exist');
}); });
}); });