Merge pull request '8267-devToTest' (!1036) from 8267-devToTest into test
gitea/salix-front/pipeline/head This commit looks good
Details
gitea/salix-front/pipeline/head This commit looks good
Details
Reviewed-on: #1036 Reviewed-by: Carlos Satorres <carlossa@verdnatura.es>
This commit is contained in:
commit
f045b37b55
|
@ -1,4 +1,7 @@
|
||||||
const { defineConfig } = require('cypress');
|
const { defineConfig } = require('cypress');
|
||||||
|
// https://docs.cypress.io/app/tooling/reporters
|
||||||
|
// https://docs.cypress.io/app/references/configuration
|
||||||
|
// https://www.npmjs.com/package/cypress-mochawesome-reporter
|
||||||
|
|
||||||
module.exports = defineConfig({
|
module.exports = defineConfig({
|
||||||
e2e: {
|
e2e: {
|
||||||
|
@ -16,6 +19,7 @@ module.exports = defineConfig({
|
||||||
reporterOptions: {
|
reporterOptions: {
|
||||||
charts: true,
|
charts: true,
|
||||||
reportPageTitle: 'Cypress Inline Reporter',
|
reportPageTitle: 'Cypress Inline Reporter',
|
||||||
|
reportFilename: '[status]_[datetime]-report',
|
||||||
embeddedScreenshots: true,
|
embeddedScreenshots: true,
|
||||||
reportDir: 'test/cypress/reports',
|
reportDir: 'test/cypress/reports',
|
||||||
inlineAssets: true,
|
inlineAssets: true,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "salix-front",
|
"name": "salix-front",
|
||||||
"version": "24.48.0",
|
"version": "24.50.0",
|
||||||
"description": "Salix frontend",
|
"description": "Salix frontend",
|
||||||
"productName": "Salix",
|
"productName": "Salix",
|
||||||
"author": "Verdnatura",
|
"author": "Verdnatura",
|
||||||
|
|
|
@ -1,155 +0,0 @@
|
||||||
<script setup>
|
|
||||||
import { reactive, ref, computed } from 'vue';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import { useRouter } from 'vue-router';
|
|
||||||
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
|
||||||
import FormModelPopup from './FormModelPopup.vue';
|
|
||||||
import VnInputDate from './common/VnInputDate.vue';
|
|
||||||
|
|
||||||
const emit = defineEmits(['onDataSaved']);
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
const router = useRouter();
|
|
||||||
|
|
||||||
const manualInvoiceFormData = reactive({
|
|
||||||
maxShipped: Date.vnNew(),
|
|
||||||
});
|
|
||||||
|
|
||||||
const formModelPopupRef = ref();
|
|
||||||
const invoiceOutSerialsOptions = ref([]);
|
|
||||||
const taxAreasOptions = ref([]);
|
|
||||||
const ticketsOptions = ref([]);
|
|
||||||
const clientsOptions = ref([]);
|
|
||||||
const isLoading = computed(() => formModelPopupRef.value?.isLoading);
|
|
||||||
|
|
||||||
const onDataSaved = async (formData, requestResponse) => {
|
|
||||||
emit('onDataSaved', formData, requestResponse);
|
|
||||||
if (requestResponse && requestResponse.id)
|
|
||||||
router.push({ name: 'InvoiceOutSummary', params: { id: requestResponse.id } });
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<FetchData
|
|
||||||
url="InvoiceOutSerials"
|
|
||||||
:filter="{ where: { code: { neq: 'R' } }, order: ['code'] }"
|
|
||||||
@on-fetch="(data) => (invoiceOutSerialsOptions = data)"
|
|
||||||
auto-load
|
|
||||||
/>
|
|
||||||
<FetchData
|
|
||||||
url="TaxAreas"
|
|
||||||
:filter="{ order: ['code'] }"
|
|
||||||
@on-fetch="(data) => (taxAreasOptions = data)"
|
|
||||||
auto-load
|
|
||||||
/>
|
|
||||||
<FormModelPopup
|
|
||||||
ref="formModelPopupRef"
|
|
||||||
:title="t('Create manual invoice')"
|
|
||||||
url-create="InvoiceOuts/createManualInvoice"
|
|
||||||
model="invoiceOut"
|
|
||||||
:form-initial-data="manualInvoiceFormData"
|
|
||||||
@on-data-saved="onDataSaved"
|
|
||||||
>
|
|
||||||
<template #form-inputs="{ data }">
|
|
||||||
<span v-if="isLoading" class="text-primary invoicing-text">
|
|
||||||
<QIcon name="warning" class="fill-icon q-mr-sm" size="md" />
|
|
||||||
{{ t('Invoicing in progress...') }}
|
|
||||||
</span>
|
|
||||||
<VnRow>
|
|
||||||
<VnSelect
|
|
||||||
:label="t('Ticket')"
|
|
||||||
:options="ticketsOptions"
|
|
||||||
hide-selected
|
|
||||||
option-label="id"
|
|
||||||
option-value="id"
|
|
||||||
v-model="data.ticketFk"
|
|
||||||
@update:model-value="data.clientFk = null"
|
|
||||||
url="Tickets"
|
|
||||||
:where="{ refFk: null }"
|
|
||||||
:fields="['id', 'nickname']"
|
|
||||||
:filter-options="{ order: 'shipped DESC' }"
|
|
||||||
>
|
|
||||||
<template #option="scope">
|
|
||||||
<QItem v-bind="scope.itemProps">
|
|
||||||
<QItemSection>
|
|
||||||
<QItemLabel> #{{ scope.opt?.id }} </QItemLabel>
|
|
||||||
<QItemLabel caption>{{ scope.opt?.nickname }}</QItemLabel>
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
</template>
|
|
||||||
</VnSelect>
|
|
||||||
<span class="row items-center" style="max-width: max-content">{{
|
|
||||||
t('Or')
|
|
||||||
}}</span>
|
|
||||||
<VnSelect
|
|
||||||
:label="t('Client')"
|
|
||||||
:options="clientsOptions"
|
|
||||||
hide-selected
|
|
||||||
option-label="name"
|
|
||||||
option-value="id"
|
|
||||||
v-model="data.clientFk"
|
|
||||||
@update:model-value="data.ticketFk = null"
|
|
||||||
url="Clients"
|
|
||||||
:fields="['id', 'name']"
|
|
||||||
:filter-options="{ order: 'name ASC' }"
|
|
||||||
/>
|
|
||||||
<VnInputDate :label="t('Max date')" v-model="data.maxShipped" />
|
|
||||||
</VnRow>
|
|
||||||
<VnRow>
|
|
||||||
<VnSelect
|
|
||||||
:label="t('Serial')"
|
|
||||||
:options="invoiceOutSerialsOptions"
|
|
||||||
hide-selected
|
|
||||||
option-label="description"
|
|
||||||
option-value="code"
|
|
||||||
v-model="data.serial"
|
|
||||||
/>
|
|
||||||
<VnSelect
|
|
||||||
:label="t('Area')"
|
|
||||||
:options="taxAreasOptions"
|
|
||||||
hide-selected
|
|
||||||
option-label="code"
|
|
||||||
option-value="code"
|
|
||||||
v-model="data.taxArea"
|
|
||||||
/>
|
|
||||||
</VnRow>
|
|
||||||
<VnRow>
|
|
||||||
<VnInput
|
|
||||||
:label="t('Reference')"
|
|
||||||
type="textarea"
|
|
||||||
v-model="data.reference"
|
|
||||||
fill-input
|
|
||||||
autogrow
|
|
||||||
/>
|
|
||||||
</VnRow>
|
|
||||||
</template>
|
|
||||||
</FormModelPopup>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.invoicing-text {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
color: $primary;
|
|
||||||
font-size: 24px;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<i18n>
|
|
||||||
es:
|
|
||||||
Create manual invoice: Crear factura manual
|
|
||||||
Ticket: Ticket
|
|
||||||
Client: Cliente
|
|
||||||
Max date: Fecha límite
|
|
||||||
Serial: Serie
|
|
||||||
Area: Area
|
|
||||||
Reference: Referencia
|
|
||||||
Or: O
|
|
||||||
Invoicing in progress...: Facturación en progreso...
|
|
||||||
</i18n>
|
|
|
@ -17,10 +17,6 @@ const $props = defineProps({
|
||||||
type: Number,
|
type: Number,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
provinces: {
|
|
||||||
type: Array,
|
|
||||||
default: () => [],
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
@ -44,19 +40,23 @@ const onDataSaved = (...args) => {
|
||||||
url-create="towns"
|
url-create="towns"
|
||||||
model="city"
|
model="city"
|
||||||
@on-data-saved="onDataSaved"
|
@on-data-saved="onDataSaved"
|
||||||
|
data-cy="newCityForm"
|
||||||
>
|
>
|
||||||
<template #form-inputs="{ data, validate }">
|
<template #form-inputs="{ data, validate }">
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('Names')"
|
:label="t('Name')"
|
||||||
v-model="data.name"
|
v-model="data.name"
|
||||||
:rules="validate('city.name')"
|
:rules="validate('city.name')"
|
||||||
|
required
|
||||||
|
data-cy="cityName"
|
||||||
/>
|
/>
|
||||||
<VnSelectProvince
|
<VnSelectProvince
|
||||||
:province-selected="$props.provinceSelected"
|
:province-selected="$props.provinceSelected"
|
||||||
:country-fk="$props.countryFk"
|
:country-fk="$props.countryFk"
|
||||||
v-model="data.provinceFk"
|
v-model="data.provinceFk"
|
||||||
:provinces="$props.provinces"
|
required
|
||||||
|
data-cy="provinceCity"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, ref, watch } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
@ -21,13 +21,15 @@ const postcodeFormData = reactive({
|
||||||
provinceFk: null,
|
provinceFk: null,
|
||||||
townFk: null,
|
townFk: null,
|
||||||
});
|
});
|
||||||
|
const townsFetchDataRef = ref(false);
|
||||||
|
const townFilter = ref({});
|
||||||
|
|
||||||
const townsFetchDataRef = ref(null);
|
const countriesRef = ref(false);
|
||||||
const provincesFetchDataRef = ref(null);
|
const provincesFetchDataRef = ref(false);
|
||||||
const countriesOptions = ref([]);
|
|
||||||
const provincesOptions = ref([]);
|
const provincesOptions = ref([]);
|
||||||
const townsOptions = ref([]);
|
const townsOptions = ref([]);
|
||||||
const town = ref({});
|
const town = ref({});
|
||||||
|
const countryFilter = ref({});
|
||||||
|
|
||||||
function onDataSaved(formData) {
|
function onDataSaved(formData) {
|
||||||
const newPostcode = {
|
const newPostcode = {
|
||||||
|
@ -39,13 +41,56 @@ function onDataSaved(formData) {
|
||||||
({ id }) => id === formData.provinceFk
|
({ id }) => id === formData.provinceFk
|
||||||
);
|
);
|
||||||
newPostcode.province = provinceObject?.name;
|
newPostcode.province = provinceObject?.name;
|
||||||
const countryObject = countriesOptions.value.find(
|
const countryObject = countriesRef.value.opts.find(
|
||||||
({ id }) => id === formData.countryFk
|
({ id }) => id === formData.countryFk
|
||||||
);
|
);
|
||||||
newPostcode.country = countryObject?.name;
|
newPostcode.country = countryObject?.name;
|
||||||
emit('onDataSaved', newPostcode);
|
emit('onDataSaved', newPostcode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function setCountry(countryFk, data) {
|
||||||
|
data.townFk = null;
|
||||||
|
data.provinceFk = null;
|
||||||
|
data.countryFk = countryFk;
|
||||||
|
await fetchTowns();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Province
|
||||||
|
|
||||||
|
async function handleProvinces(data) {
|
||||||
|
provincesOptions.value = data;
|
||||||
|
if (postcodeFormData.countryFk) {
|
||||||
|
await fetchTowns();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function setProvince(id, data) {
|
||||||
|
if (data.provinceFk === id) return;
|
||||||
|
const newProvince = provincesOptions.value.find((province) => province.id == id);
|
||||||
|
if (newProvince) data.countryFk = newProvince.countryFk;
|
||||||
|
postcodeFormData.provinceFk = id;
|
||||||
|
await fetchTowns();
|
||||||
|
}
|
||||||
|
async function onProvinceCreated(data) {
|
||||||
|
await provincesFetchDataRef.value.fetch({
|
||||||
|
where: { countryFk: postcodeFormData.countryFk },
|
||||||
|
});
|
||||||
|
postcodeFormData.provinceFk = data.id;
|
||||||
|
}
|
||||||
|
function provinceByCountry(countryFk = postcodeFormData.countryFk) {
|
||||||
|
return provincesOptions.value
|
||||||
|
.filter((province) => province.countryFk === countryFk)
|
||||||
|
.map(({ id }) => id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Town
|
||||||
|
async function handleTowns(data) {
|
||||||
|
townsOptions.value = data;
|
||||||
|
}
|
||||||
|
function setTown(newTown, data) {
|
||||||
|
town.value = newTown;
|
||||||
|
data.provinceFk = newTown?.provinceFk ?? newTown;
|
||||||
|
data.countryFk = newTown?.province?.countryFk ?? newTown;
|
||||||
|
}
|
||||||
async function onCityCreated(newTown, formData) {
|
async function onCityCreated(newTown, formData) {
|
||||||
await provincesFetchDataRef.value.fetch();
|
await provincesFetchDataRef.value.fetch();
|
||||||
newTown.province = provincesOptions.value.find(
|
newTown.province = provincesOptions.value.find(
|
||||||
|
@ -54,79 +99,28 @@ async function onCityCreated(newTown, formData) {
|
||||||
formData.townFk = newTown;
|
formData.townFk = newTown;
|
||||||
setTown(newTown, formData);
|
setTown(newTown, formData);
|
||||||
}
|
}
|
||||||
|
async function fetchTowns(countryFk = postcodeFormData.countryFk) {
|
||||||
function setTown(newTown, data) {
|
if (!countryFk) return;
|
||||||
if (!newTown) return;
|
const provinces = postcodeFormData.provinceFk
|
||||||
town.value = newTown;
|
? [postcodeFormData.provinceFk]
|
||||||
data.provinceFk = newTown.provinceFk;
|
: provinceByCountry();
|
||||||
data.countryFk = newTown.province.countryFk;
|
townFilter.value.where = {
|
||||||
}
|
|
||||||
|
|
||||||
async function setProvince(id, data) {
|
|
||||||
const newProvince = provincesOptions.value.find((province) => province.id == id);
|
|
||||||
if (!newProvince) return;
|
|
||||||
|
|
||||||
data.countryFk = newProvince.countryFk;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function onProvinceCreated(data) {
|
|
||||||
await provincesFetchDataRef.value.fetch({
|
|
||||||
where: { countryFk: postcodeFormData.countryFk },
|
|
||||||
});
|
|
||||||
postcodeFormData.provinceFk.value = data.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => [postcodeFormData.countryFk],
|
|
||||||
async (newCountryFk, oldValueFk) => {
|
|
||||||
if (Array.isArray(newCountryFk)) {
|
|
||||||
newCountryFk = newCountryFk[0];
|
|
||||||
}
|
|
||||||
if (Array.isArray(oldValueFk)) {
|
|
||||||
oldValueFk = oldValueFk[0];
|
|
||||||
}
|
|
||||||
if (!!oldValueFk && newCountryFk !== oldValueFk) {
|
|
||||||
postcodeFormData.provinceFk = null;
|
|
||||||
postcodeFormData.townFk = null;
|
|
||||||
}
|
|
||||||
if (oldValueFk !== newCountryFk) {
|
|
||||||
await provincesFetchDataRef.value.fetch({
|
|
||||||
where: {
|
|
||||||
countryFk: newCountryFk,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
await townsFetchDataRef.value.fetch({
|
|
||||||
where: {
|
|
||||||
provinceFk: {
|
provinceFk: {
|
||||||
inq: provincesOptions.value.map(({ id }) => id),
|
inq: provinces,
|
||||||
},
|
},
|
||||||
},
|
};
|
||||||
});
|
await townsFetchDataRef.value?.fetch();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
watch(
|
async function filterTowns(name) {
|
||||||
() => postcodeFormData.provinceFk,
|
if (name !== '') {
|
||||||
async (newProvinceFk, oldValueFk) => {
|
townFilter.value.where = {
|
||||||
if (Array.isArray(newProvinceFk)) {
|
name: {
|
||||||
newProvinceFk = newProvinceFk[0];
|
like: `%${name}%`,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
await townsFetchDataRef.value?.fetch();
|
||||||
}
|
}
|
||||||
if (newProvinceFk !== oldValueFk) {
|
|
||||||
await townsFetchDataRef.value.fetch({
|
|
||||||
where: { provinceFk: newProvinceFk },
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
async function handleProvinces(data) {
|
|
||||||
provincesOptions.value = data;
|
|
||||||
}
|
|
||||||
async function handleTowns(data) {
|
|
||||||
townsOptions.value = data;
|
|
||||||
}
|
|
||||||
async function handleCountries(data) {
|
|
||||||
countriesOptions.value = data;
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -143,6 +137,7 @@ async function handleCountries(data) {
|
||||||
ref="townsFetchDataRef"
|
ref="townsFetchDataRef"
|
||||||
:sort-by="['name ASC']"
|
:sort-by="['name ASC']"
|
||||||
:limit="30"
|
:limit="30"
|
||||||
|
:filter="townFilter"
|
||||||
@on-fetch="handleTowns"
|
@on-fetch="handleTowns"
|
||||||
auto-load
|
auto-load
|
||||||
url="Towns/location"
|
url="Towns/location"
|
||||||
|
@ -164,10 +159,13 @@ async function handleCountries(data) {
|
||||||
v-model="data.code"
|
v-model="data.code"
|
||||||
:rules="validate('postcode.code')"
|
:rules="validate('postcode.code')"
|
||||||
clearable
|
clearable
|
||||||
|
required
|
||||||
|
data-cy="locationPostcode"
|
||||||
/>
|
/>
|
||||||
<VnSelectDialog
|
<VnSelectDialog
|
||||||
:label="t('City')"
|
:label="t('City')"
|
||||||
@update:model-value="(value) => setTown(value, data)"
|
@update:model-value="(value) => setTown(value, data)"
|
||||||
|
@filter="filterTowns"
|
||||||
:tooltip="t('Create city')"
|
:tooltip="t('Create city')"
|
||||||
v-model="data.townFk"
|
v-model="data.townFk"
|
||||||
:options="townsOptions"
|
:options="townsOptions"
|
||||||
|
@ -176,7 +174,8 @@ async function handleCountries(data) {
|
||||||
:rules="validate('postcode.city')"
|
:rules="validate('postcode.city')"
|
||||||
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
||||||
:emit-value="false"
|
:emit-value="false"
|
||||||
:clearable="true"
|
required
|
||||||
|
data-cy="locationTown"
|
||||||
>
|
>
|
||||||
<template #option="{ itemProps, opt }">
|
<template #option="{ itemProps, opt }">
|
||||||
<QItem v-bind="itemProps">
|
<QItem v-bind="itemProps">
|
||||||
|
@ -193,7 +192,6 @@ async function handleCountries(data) {
|
||||||
<CreateNewCityForm
|
<CreateNewCityForm
|
||||||
:country-fk="data.countryFk"
|
:country-fk="data.countryFk"
|
||||||
:province-selected="data.provinceFk"
|
:province-selected="data.provinceFk"
|
||||||
:provinces="provincesOptions"
|
|
||||||
@on-data-saved="
|
@on-data-saved="
|
||||||
(_, requestResponse) =>
|
(_, requestResponse) =>
|
||||||
onCityCreated(requestResponse, data)
|
onCityCreated(requestResponse, data)
|
||||||
|
@ -208,20 +206,25 @@ async function handleCountries(data) {
|
||||||
:province-selected="data.provinceFk"
|
:province-selected="data.provinceFk"
|
||||||
@update:model-value="(value) => setProvince(value, data)"
|
@update:model-value="(value) => setProvince(value, data)"
|
||||||
v-model="data.provinceFk"
|
v-model="data.provinceFk"
|
||||||
:clearable="true"
|
|
||||||
:provinces="provincesOptions"
|
|
||||||
@on-province-created="onProvinceCreated"
|
@on-province-created="onProvinceCreated"
|
||||||
|
required
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
url="Countries"
|
ref="countriesRef"
|
||||||
|
:limit="30"
|
||||||
|
:filter="countryFilter"
|
||||||
:sort-by="['name ASC']"
|
:sort-by="['name ASC']"
|
||||||
|
auto-load
|
||||||
|
url="Countries"
|
||||||
|
required
|
||||||
:label="t('Country')"
|
:label="t('Country')"
|
||||||
@update:options="handleCountries"
|
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="name"
|
option-label="name"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
v-model="data.countryFk"
|
v-model="data.countryFk"
|
||||||
:rules="validate('postcode.countryFk')"
|
:rules="validate('postcode.countryFk')"
|
||||||
|
@update:model-value="(value) => setCountry(value, data)"
|
||||||
|
data-cy="locationCountry"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, ref } from 'vue';
|
import { computed, reactive, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
@ -21,34 +20,24 @@ const $props = defineProps({
|
||||||
type: Number,
|
type: Number,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
provinces: {
|
|
||||||
type: Array,
|
|
||||||
default: () => [],
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
const autonomiesOptions = ref([]);
|
const autonomiesRef = ref([]);
|
||||||
|
|
||||||
const onDataSaved = (dataSaved, requestResponse) => {
|
const onDataSaved = (dataSaved, requestResponse) => {
|
||||||
requestResponse.autonomy = autonomiesOptions.value.find(
|
requestResponse.autonomy = autonomiesRef.value.opts.find(
|
||||||
(autonomy) => autonomy.id == requestResponse.autonomyFk
|
(autonomy) => autonomy.id == requestResponse.autonomyFk
|
||||||
);
|
);
|
||||||
emit('onDataSaved', dataSaved, requestResponse);
|
emit('onDataSaved', dataSaved, requestResponse);
|
||||||
};
|
};
|
||||||
|
const where = computed(() => {
|
||||||
|
if (!$props.countryFk) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
return { countryFk: $props.countryFk };
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
|
||||||
@on-fetch="(data) => (autonomiesOptions = data)"
|
|
||||||
auto-load
|
|
||||||
:filter="{
|
|
||||||
where: {
|
|
||||||
countryFk: $props.countryFk,
|
|
||||||
},
|
|
||||||
}"
|
|
||||||
url="Autonomies/location"
|
|
||||||
:sort-by="['name ASC']"
|
|
||||||
:limit="30"
|
|
||||||
/>
|
|
||||||
<FormModelPopup
|
<FormModelPopup
|
||||||
:title="t('New province')"
|
:title="t('New province')"
|
||||||
:subtitle="t('Please, ensure you put the correct data!')"
|
:subtitle="t('Please, ensure you put the correct data!')"
|
||||||
|
@ -63,10 +52,19 @@ const onDataSaved = (dataSaved, requestResponse) => {
|
||||||
:label="t('Name')"
|
:label="t('Name')"
|
||||||
v-model="data.name"
|
v-model="data.name"
|
||||||
:rules="validate('province.name')"
|
:rules="validate('province.name')"
|
||||||
|
required
|
||||||
|
data-cy="provinceName"
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
data-cy="autonomyProvince"
|
||||||
|
required
|
||||||
|
ref="autonomiesRef"
|
||||||
|
auto-load
|
||||||
|
:where="where"
|
||||||
|
url="Autonomies/location"
|
||||||
|
:sort-by="['name ASC']"
|
||||||
|
:limit="30"
|
||||||
:label="t('Autonomy')"
|
:label="t('Autonomy')"
|
||||||
:options="autonomiesOptions"
|
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="name"
|
option-label="name"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
|
|
@ -373,6 +373,7 @@ watch(formUrl, async () => {
|
||||||
@click="onSubmit"
|
@click="onSubmit"
|
||||||
:disable="!hasChanges"
|
:disable="!hasChanges"
|
||||||
:title="t('globals.save')"
|
:title="t('globals.save')"
|
||||||
|
data-cy="crudModelDefaultSaveBtn"
|
||||||
/>
|
/>
|
||||||
<slot name="moreAfterActions" />
|
<slot name="moreAfterActions" />
|
||||||
</QBtnGroup>
|
</QBtnGroup>
|
||||||
|
|
|
@ -91,6 +91,10 @@ const $props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
maxWidth: {
|
||||||
|
type: [String, Boolean],
|
||||||
|
default: '800px',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const emit = defineEmits(['onFetch', 'onDataSaved']);
|
const emit = defineEmits(['onFetch', 'onDataSaved']);
|
||||||
const modelValue = computed(
|
const modelValue = computed(
|
||||||
|
@ -287,6 +291,7 @@ defineExpose({
|
||||||
@submit="save"
|
@submit="save"
|
||||||
@reset="reset"
|
@reset="reset"
|
||||||
class="q-pa-md"
|
class="q-pa-md"
|
||||||
|
:style="maxWidth ? 'max-width: ' + maxWidth : ''"
|
||||||
id="formModel"
|
id="formModel"
|
||||||
>
|
>
|
||||||
<QCard>
|
<QCard>
|
||||||
|
@ -376,7 +381,6 @@ defineExpose({
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
#formModel {
|
#formModel {
|
||||||
max-width: 800px;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
<script setup>
|
||||||
|
defineProps({ row: { type: Object, required: true } });
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<span>
|
||||||
|
<QIcon
|
||||||
|
v-if="row.isTaxDataChecked === 0"
|
||||||
|
name="vn:no036"
|
||||||
|
color="primary"
|
||||||
|
size="xs"
|
||||||
|
>
|
||||||
|
<QTooltip>{{ $t('salesTicketsTable.noVerifiedData') }}</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
<QIcon v-if="row.hasTicketRequest" name="vn:buyrequest" color="primary" size="xs">
|
||||||
|
<QTooltip>{{ $t('salesTicketsTable.purchaseRequest') }}</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
<QIcon v-if="row.itemShortage" name="vn:unavailable" color="primary" size="xs">
|
||||||
|
<QTooltip>{{ $t('salesTicketsTable.notVisible') }}</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
<QIcon v-if="row.isFreezed" name="vn:frozen" color="primary" size="xs">
|
||||||
|
<QTooltip>{{ $t('salesTicketsTable.clientFrozen') }}</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
<QIcon
|
||||||
|
v-if="row.risk"
|
||||||
|
name="vn:risk"
|
||||||
|
:color="row.hasHighRisk ? 'negative' : 'primary'"
|
||||||
|
size="xs"
|
||||||
|
>
|
||||||
|
<QTooltip>
|
||||||
|
{{ $t('salesTicketsTable.risk') }}: {{ row.risk - row.credit }}
|
||||||
|
</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
<QIcon v-if="row.hasComponentLack" name="vn:components" color="primary" size="xs">
|
||||||
|
<QTooltip>{{ $t('salesTicketsTable.componentLack') }}</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
<QIcon v-if="row.isTooLittle" name="vn:isTooLittle" color="primary" size="xs">
|
||||||
|
<QTooltip>{{ $t('salesTicketsTable.tooLittle') }}</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
</span>
|
||||||
|
</template>
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
import { ref, watch } from 'vue';
|
||||||
import { useValidator } from 'src/composables/useValidator';
|
import { useValidator } from 'src/composables/useValidator';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import VnSelectDialog from 'components/common/VnSelectDialog.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import CreateNewProvinceForm from './CreateNewProvinceForm.vue';
|
import CreateNewProvinceForm from './CreateNewProvinceForm.vue';
|
||||||
|
|
||||||
const emit = defineEmits(['onProvinceCreated']);
|
const emit = defineEmits(['onProvinceCreated', 'onProvinceFetched']);
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
countryFk: {
|
countryFk: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
@ -17,20 +17,23 @@ const $props = defineProps({
|
||||||
type: Number,
|
type: Number,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
provinces: {
|
|
||||||
type: Array,
|
|
||||||
default: () => [],
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
const provinceFk = defineModel({ type: Number, default: null });
|
const provinceFk = defineModel({ type: Number, default: null });
|
||||||
|
|
||||||
const { validate } = useValidator();
|
const { validate } = useValidator();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const filter = ref({
|
||||||
|
include: { relation: 'country' },
|
||||||
|
where: {
|
||||||
|
countryFk: $props.countryFk,
|
||||||
|
},
|
||||||
|
});
|
||||||
const provincesOptions = ref($props.provinces);
|
const provincesOptions = ref($props.provinces);
|
||||||
provinceFk.value = $props.provinceSelected;
|
|
||||||
const provincesFetchDataRef = ref();
|
const provincesFetchDataRef = ref();
|
||||||
|
provinceFk.value = $props.provinceSelected;
|
||||||
|
if (!$props.countryFk) {
|
||||||
|
filter.value.where = {};
|
||||||
|
}
|
||||||
async function onProvinceCreated(_, data) {
|
async function onProvinceCreated(_, data) {
|
||||||
await provincesFetchDataRef.value.fetch({ where: { countryFk: $props.countryFk } });
|
await provincesFetchDataRef.value.fetch({ where: { countryFk: $props.countryFk } });
|
||||||
provinceFk.value = data.id;
|
provinceFk.value = data.id;
|
||||||
|
@ -39,23 +42,31 @@ async function onProvinceCreated(_, data) {
|
||||||
async function handleProvinces(data) {
|
async function handleProvinces(data) {
|
||||||
provincesOptions.value = data;
|
provincesOptions.value = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => $props.countryFk,
|
||||||
|
async () => {
|
||||||
|
if ($props.countryFk) {
|
||||||
|
filter.value.where.countryFk = $props.countryFk;
|
||||||
|
} else filter.value.where = {};
|
||||||
|
await provincesFetchDataRef.value.fetch({});
|
||||||
|
emit('onProvinceFetched', provincesOptions.value);
|
||||||
|
}
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
ref="provincesFetchDataRef"
|
ref="provincesFetchDataRef"
|
||||||
:filter="{
|
:filter="filter"
|
||||||
include: { relation: 'country' },
|
|
||||||
where: {
|
|
||||||
countryFk: $props.countryFk,
|
|
||||||
},
|
|
||||||
}"
|
|
||||||
@on-fetch="handleProvinces"
|
@on-fetch="handleProvinces"
|
||||||
url="Provinces"
|
url="Provinces"
|
||||||
|
auto-load
|
||||||
/>
|
/>
|
||||||
<VnSelectDialog
|
<VnSelectDialog
|
||||||
|
data-cy="locationProvince"
|
||||||
:label="t('Province')"
|
:label="t('Province')"
|
||||||
:options="$props.provinces"
|
:options="provincesOptions"
|
||||||
:tooltip="t('Create province')"
|
:tooltip="t('Create province')"
|
||||||
hide-selected
|
hide-selected
|
||||||
v-model="provinceFk"
|
v-model="provinceFk"
|
||||||
|
|
|
@ -143,6 +143,10 @@ function alignRow() {
|
||||||
const showFilter = computed(
|
const showFilter = computed(
|
||||||
() => $props.column?.columnFilter !== false && $props.column.name != 'tableActions'
|
() => $props.column?.columnFilter !== false && $props.column.name != 'tableActions'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const onTabPressed = async () => {
|
||||||
|
if (model.value) enterEvent['keyup.enter']();
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
|
@ -157,6 +161,7 @@ const showFilter = computed(
|
||||||
v-model="model"
|
v-model="model"
|
||||||
:components="components"
|
:components="components"
|
||||||
component-prop="columnFilter"
|
component-prop="columnFilter"
|
||||||
|
@keydown.tab="onTabPressed"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -162,9 +162,7 @@ onMounted(() => {
|
||||||
: $props.defaultMode;
|
: $props.defaultMode;
|
||||||
stateStore.rightDrawer = quasar.screen.gt.xs;
|
stateStore.rightDrawer = quasar.screen.gt.xs;
|
||||||
columnsVisibilitySkipped.value = [
|
columnsVisibilitySkipped.value = [
|
||||||
...splittedColumns.value.columns
|
...splittedColumns.value.columns.filter((c) => !c.visible).map((c) => c.name),
|
||||||
.filter((c) => c.visible == false)
|
|
||||||
.map((c) => c.name),
|
|
||||||
...['tableActions'],
|
...['tableActions'],
|
||||||
];
|
];
|
||||||
createForm.value = $props.create;
|
createForm.value = $props.create;
|
||||||
|
@ -237,7 +235,7 @@ function splitColumns(columns) {
|
||||||
if (col.create) splittedColumns.value.create.push(col);
|
if (col.create) splittedColumns.value.create.push(col);
|
||||||
if (col.cardVisible) splittedColumns.value.cardVisible.push(col);
|
if (col.cardVisible) splittedColumns.value.cardVisible.push(col);
|
||||||
if ($props.isEditable && col.disable == null) col.disable = false;
|
if ($props.isEditable && col.disable == null) col.disable = false;
|
||||||
if ($props.useModel && col.columnFilter != false)
|
if ($props.useModel && col.columnFilter !== false)
|
||||||
col.columnFilter = { inWhere: true, ...col.columnFilter };
|
col.columnFilter = { inWhere: true, ...col.columnFilter };
|
||||||
splittedColumns.value.columns.push(col);
|
splittedColumns.value.columns.push(col);
|
||||||
}
|
}
|
||||||
|
@ -396,7 +394,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
||||||
:name="col.orderBy ?? col.name"
|
:name="col.orderBy ?? col.name"
|
||||||
:data-key="$attrs['data-key']"
|
:data-key="$attrs['data-key']"
|
||||||
:search-url="searchUrl"
|
:search-url="searchUrl"
|
||||||
:vertical="true"
|
:vertical="false"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<slot
|
<slot
|
||||||
|
@ -739,6 +737,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
||||||
fab
|
fab
|
||||||
icon="add"
|
icon="add"
|
||||||
shortcut="+"
|
shortcut="+"
|
||||||
|
data-cy="vnTableCreateBtn"
|
||||||
/>
|
/>
|
||||||
<QTooltip self="top right">
|
<QTooltip self="top right">
|
||||||
{{ createForm?.title }}
|
{{ createForm?.title }}
|
||||||
|
|
|
@ -1,20 +1,24 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, watch } from 'vue';
|
import { nextTick, ref, watch } from 'vue';
|
||||||
import { QInput } from 'quasar';
|
import { QInput } from 'quasar';
|
||||||
|
|
||||||
const props = defineProps({
|
const $props = defineProps({
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
|
insertable: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue', 'accountShortToStandard']);
|
const emit = defineEmits(['update:modelValue', 'accountShortToStandard']);
|
||||||
|
|
||||||
let internalValue = ref(props.modelValue);
|
let internalValue = ref($props.modelValue);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.modelValue,
|
() => $props.modelValue,
|
||||||
(newVal) => {
|
(newVal) => {
|
||||||
internalValue.value = newVal;
|
internalValue.value = newVal;
|
||||||
}
|
}
|
||||||
|
@ -28,8 +32,46 @@ watch(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const handleKeydown = (e) => {
|
||||||
|
if (e.key === 'Backspace') return;
|
||||||
|
if (e.key === '.') {
|
||||||
|
accountShortToStandard();
|
||||||
|
// TODO: Fix this setTimeout, with nextTick doesn't work
|
||||||
|
setTimeout(() => {
|
||||||
|
setCursorPosition(0, e.target);
|
||||||
|
}, 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($props.insertable && e.key.match(/[0-9]/)) {
|
||||||
|
handleInsertMode(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
function setCursorPosition(pos, el = vnInputRef.value) {
|
||||||
|
el.focus();
|
||||||
|
el.setSelectionRange(pos, pos);
|
||||||
|
}
|
||||||
|
const vnInputRef = ref(false);
|
||||||
|
const handleInsertMode = (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
const input = e.target;
|
||||||
|
const cursorPos = input.selectionStart;
|
||||||
|
const { maxlength } = vnInputRef.value;
|
||||||
|
let currentValue = internalValue.value;
|
||||||
|
if (!currentValue) currentValue = e.key;
|
||||||
|
const newValue = e.key;
|
||||||
|
if (newValue && !isNaN(newValue) && cursorPos < maxlength) {
|
||||||
|
internalValue.value =
|
||||||
|
currentValue.substring(0, cursorPos) +
|
||||||
|
newValue +
|
||||||
|
currentValue.substring(cursorPos + 1);
|
||||||
|
}
|
||||||
|
nextTick(() => {
|
||||||
|
input.setSelectionRange(cursorPos + 1, cursorPos + 1);
|
||||||
|
});
|
||||||
|
};
|
||||||
function accountShortToStandard() {
|
function accountShortToStandard() {
|
||||||
internalValue.value = internalValue.value.replace(
|
internalValue.value = internalValue.value?.replace(
|
||||||
'.',
|
'.',
|
||||||
'0'.repeat(11 - internalValue.value.length)
|
'0'.repeat(11 - internalValue.value.length)
|
||||||
);
|
);
|
||||||
|
@ -37,5 +79,5 @@ function accountShortToStandard() {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<q-input v-model="internalValue" />
|
<QInput @keydown="handleKeydown" ref="vnInputRef" v-model="internalValue" />
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref, useAttrs } from 'vue';
|
import { computed, ref, useAttrs, nextTick } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRequired } from 'src/composables/useRequired';
|
import { useRequired } from 'src/composables/useRequired';
|
||||||
|
|
||||||
|
@ -34,6 +34,14 @@ const $props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
insertable: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
maxlength: {
|
||||||
|
type: Number,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const vnInputRef = ref(null);
|
const vnInputRef = ref(null);
|
||||||
|
@ -69,6 +77,9 @@ const mixinRules = [
|
||||||
requiredFieldRule,
|
requiredFieldRule,
|
||||||
...($attrs.rules ?? []),
|
...($attrs.rules ?? []),
|
||||||
(val) => {
|
(val) => {
|
||||||
|
const { maxlength } = vnInputRef.value;
|
||||||
|
if (maxlength && +val.length > maxlength)
|
||||||
|
return t(`maxLength`, { value: maxlength });
|
||||||
const { min, max } = vnInputRef.value.$attrs;
|
const { min, max } = vnInputRef.value.$attrs;
|
||||||
if (!min) return null;
|
if (!min) return null;
|
||||||
if (min >= 0) if (Math.floor(val) < min) return t('inputMin', { value: min });
|
if (min >= 0) if (Math.floor(val) < min) return t('inputMin', { value: min });
|
||||||
|
@ -78,6 +89,33 @@ const mixinRules = [
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const handleKeydown = (e) => {
|
||||||
|
if (e.key === 'Backspace') return;
|
||||||
|
|
||||||
|
if ($props.insertable && e.key.match(/[0-9]/)) {
|
||||||
|
handleInsertMode(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleInsertMode = (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
const input = e.target;
|
||||||
|
const cursorPos = input.selectionStart;
|
||||||
|
const { maxlength } = vnInputRef.value;
|
||||||
|
let currentValue = value.value;
|
||||||
|
if (!currentValue) currentValue = e.key;
|
||||||
|
const newValue = e.key;
|
||||||
|
if (newValue && !isNaN(newValue) && cursorPos < maxlength) {
|
||||||
|
value.value =
|
||||||
|
currentValue.substring(0, cursorPos) +
|
||||||
|
newValue +
|
||||||
|
currentValue.substring(cursorPos + 1);
|
||||||
|
}
|
||||||
|
nextTick(() => {
|
||||||
|
input.setSelectionRange(cursorPos + 1, cursorPos + 1);
|
||||||
|
});
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -89,10 +127,12 @@ const mixinRules = [
|
||||||
:type="$attrs.type"
|
:type="$attrs.type"
|
||||||
:class="{ required: isRequired }"
|
:class="{ required: isRequired }"
|
||||||
@keyup.enter="emit('keyup.enter')"
|
@keyup.enter="emit('keyup.enter')"
|
||||||
|
@keydown="handleKeydown"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
:rules="mixinRules"
|
:rules="mixinRules"
|
||||||
:lazy-rules="true"
|
:lazy-rules="true"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
|
:data-cy="$attrs.dataCy ?? $attrs.label + '_input'"
|
||||||
>
|
>
|
||||||
<template v-if="$slots.prepend" #prepend>
|
<template v-if="$slots.prepend" #prepend>
|
||||||
<slot name="prepend" />
|
<slot name="prepend" />
|
||||||
|
@ -129,9 +169,11 @@ const mixinRules = [
|
||||||
<i18n>
|
<i18n>
|
||||||
en:
|
en:
|
||||||
inputMin: Must be more than {value}
|
inputMin: Must be more than {value}
|
||||||
|
maxLength: The value exceeds {value} characters
|
||||||
inputMax: Must be less than {value}
|
inputMax: Must be less than {value}
|
||||||
es:
|
es:
|
||||||
inputMin: Debe ser mayor a {value}
|
inputMin: Debe ser mayor a {value}
|
||||||
|
maxLength: El valor excede los {value} carácteres
|
||||||
inputMax: Debe ser menor a {value}
|
inputMax: Debe ser menor a {value}
|
||||||
</i18n>
|
</i18n>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, watch, computed, ref } from 'vue';
|
import { onMounted, watch, computed, ref, useAttrs } from 'vue';
|
||||||
import { date } from 'quasar';
|
import { date } from 'quasar';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useAttrs } from 'vue';
|
|
||||||
import VnDate from './VnDate.vue';
|
import VnDate from './VnDate.vue';
|
||||||
import { useRequired } from 'src/composables/useRequired';
|
import { useRequired } from 'src/composables/useRequired';
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,6 @@ const handleModelValue = (data) => {
|
||||||
:input-debounce="300"
|
:input-debounce="300"
|
||||||
:class="{ required: isRequired }"
|
:class="{ required: isRequired }"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
clearable
|
|
||||||
:emit-value="false"
|
:emit-value="false"
|
||||||
:tooltip="t('Create new location')"
|
:tooltip="t('Create new location')"
|
||||||
:rules="mixinRules"
|
:rules="mixinRules"
|
||||||
|
|
|
@ -2,5 +2,12 @@
|
||||||
const model = defineModel({ type: Boolean, required: true });
|
const model = defineModel({ type: Boolean, required: true });
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<QRadio v-model="model" v-bind="$attrs" dense :dark="true" class="q-mr-sm" />
|
<QRadio
|
||||||
|
v-model="model"
|
||||||
|
v-bind="$attrs"
|
||||||
|
dense
|
||||||
|
:dark="true"
|
||||||
|
class="q-mr-sm"
|
||||||
|
size="xs"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -145,8 +145,6 @@ onMounted(() => {
|
||||||
if ($props.focusOnMount) setTimeout(() => vnSelectRef.value.showPopup(), 300);
|
if ($props.focusOnMount) setTimeout(() => vnSelectRef.value.showPopup(), 300);
|
||||||
});
|
});
|
||||||
|
|
||||||
defineExpose({ opts: myOptions });
|
|
||||||
|
|
||||||
const arrayDataKey =
|
const arrayDataKey =
|
||||||
$props.dataKey ?? ($props.url?.length > 0 ? $props.url : $attrs.name ?? $attrs.label);
|
$props.dataKey ?? ($props.url?.length > 0 ? $props.url : $attrs.name ?? $attrs.label);
|
||||||
|
|
||||||
|
@ -266,6 +264,30 @@ async function onScroll({ to, direction, from, index }) {
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defineExpose({ opts: myOptions });
|
||||||
|
|
||||||
|
function handleKeyDown(event) {
|
||||||
|
if (event.key === 'Tab') {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
const inputValue = vnSelectRef.value?.inputValue;
|
||||||
|
|
||||||
|
if (inputValue) {
|
||||||
|
const matchingOption = myOptions.value.find(
|
||||||
|
(option) =>
|
||||||
|
option[optionLabel.value].toLowerCase() === inputValue.toLowerCase()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (matchingOption) {
|
||||||
|
emit('update:modelValue', matchingOption[optionValue.value]);
|
||||||
|
} else {
|
||||||
|
emit('update:modelValue', inputValue);
|
||||||
|
}
|
||||||
|
vnSelectRef.value?.hidePopup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -276,6 +298,7 @@ async function onScroll({ to, direction, from, index }) {
|
||||||
:option-value="optionValue"
|
:option-value="optionValue"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
@filter="filterHandler"
|
@filter="filterHandler"
|
||||||
|
@keydown="handleKeyDown"
|
||||||
:emit-value="nullishToTrue($attrs['emit-value'])"
|
:emit-value="nullishToTrue($attrs['emit-value'])"
|
||||||
:map-options="nullishToTrue($attrs['map-options'])"
|
:map-options="nullishToTrue($attrs['map-options'])"
|
||||||
:use-input="nullishToTrue($attrs['use-input'])"
|
:use-input="nullishToTrue($attrs['use-input'])"
|
||||||
|
@ -290,6 +313,7 @@ async function onScroll({ to, direction, from, index }) {
|
||||||
:input-debounce="useURL ? '300' : '0'"
|
:input-debounce="useURL ? '300' : '0'"
|
||||||
:loading="isLoading"
|
:loading="isLoading"
|
||||||
@virtual-scroll="onScroll"
|
@virtual-scroll="onScroll"
|
||||||
|
:data-cy="$attrs.dataCy ?? $attrs.label + '_select'"
|
||||||
>
|
>
|
||||||
<template #append>
|
<template #append>
|
||||||
<QIcon
|
<QIcon
|
||||||
|
|
|
@ -43,6 +43,7 @@ const isAllowedToCreate = computed(() => {
|
||||||
>
|
>
|
||||||
<template v-if="isAllowedToCreate" #append>
|
<template v-if="isAllowedToCreate" #append>
|
||||||
<QIcon
|
<QIcon
|
||||||
|
:data-cy="$attrs.dataCy ?? $attrs.label + '_icon'"
|
||||||
@click.stop.prevent="$refs.dialog.show()"
|
@click.stop.prevent="$refs.dialog.show()"
|
||||||
:name="actionIcon"
|
:name="actionIcon"
|
||||||
:size="actionIcon === 'add' ? 'xs' : 'sm'"
|
:size="actionIcon === 'add' ? 'xs' : 'sm'"
|
||||||
|
|
|
@ -86,7 +86,7 @@ async function send() {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QDialog ref="dialogRef">
|
<QDialog ref="dialogRef" data-cy="vnSmsDialog">
|
||||||
<QCard class="q-pa-sm">
|
<QCard class="q-pa-sm">
|
||||||
<QCardSection class="row items-center q-pb-none">
|
<QCardSection class="row items-center q-pb-none">
|
||||||
<span class="text-h6 text-grey">
|
<span class="text-h6 text-grey">
|
||||||
|
@ -161,6 +161,7 @@ async function send() {
|
||||||
:loading="isLoading"
|
:loading="isLoading"
|
||||||
color="primary"
|
color="primary"
|
||||||
unelevated
|
unelevated
|
||||||
|
data-cy="sendSmsBtn"
|
||||||
/>
|
/>
|
||||||
</QCardActions>
|
</QCardActions>
|
||||||
</QCard>
|
</QCard>
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { useColor } from 'src/composables/useColor';
|
||||||
import { getCssVar } from 'quasar';
|
import { getCssVar } from 'quasar';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
workerId: { type: Number, required: true },
|
workerId: { type: [Number, undefined], default: null },
|
||||||
description: { type: String, default: null },
|
description: { type: String, default: null },
|
||||||
title: { type: String, default: null },
|
title: { type: String, default: null },
|
||||||
color: { type: String, default: null },
|
color: { type: String, default: null },
|
||||||
|
@ -38,7 +38,13 @@ watch(src, () => (showLetter.value = false));
|
||||||
<template v-if="showLetter">
|
<template v-if="showLetter">
|
||||||
{{ title.charAt(0) }}
|
{{ title.charAt(0) }}
|
||||||
</template>
|
</template>
|
||||||
<QImg v-else :src="src" spinner-color="white" @error="showLetter = true" />
|
<QImg
|
||||||
|
v-else-if="workerId"
|
||||||
|
:src="src"
|
||||||
|
spinner-color="white"
|
||||||
|
@error="showLetter = true"
|
||||||
|
/>
|
||||||
|
<QIcon v-else name="mood" size="xs" />
|
||||||
</QAvatar>
|
</QAvatar>
|
||||||
<div class="description">
|
<div class="description">
|
||||||
<slot name="description" v-if="description">
|
<slot name="description" v-if="description">
|
||||||
|
|
|
@ -37,7 +37,7 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
hiddenTags: {
|
hiddenTags: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => ['filter', 'search', 'or', 'and'],
|
default: () => ['filter', 'or', 'and'],
|
||||||
},
|
},
|
||||||
customTags: {
|
customTags: {
|
||||||
type: Array,
|
type: Array,
|
||||||
|
@ -61,7 +61,6 @@ const emit = defineEmits([
|
||||||
'update:modelValue',
|
'update:modelValue',
|
||||||
'refresh',
|
'refresh',
|
||||||
'clear',
|
'clear',
|
||||||
'search',
|
|
||||||
'init',
|
'init',
|
||||||
'remove',
|
'remove',
|
||||||
'setUserParams',
|
'setUserParams',
|
||||||
|
@ -274,6 +273,7 @@ function sanitizer(params) {
|
||||||
:key="chip.label"
|
:key="chip.label"
|
||||||
:removable="!unremovableParams?.includes(chip.label)"
|
:removable="!unremovableParams?.includes(chip.label)"
|
||||||
@remove="remove(chip.label)"
|
@remove="remove(chip.label)"
|
||||||
|
data-cy="vnFilterPanelChip"
|
||||||
>
|
>
|
||||||
<slot name="tags" :tag="chip" :format-fn="formatValue">
|
<slot name="tags" :tag="chip" :format-fn="formatValue">
|
||||||
<div class="q-gutter-x-xs">
|
<div class="q-gutter-x-xs">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="vn-row q-gutter-md q-mb-md">
|
<div class="vn-row q-gutter-md">
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -18,6 +18,9 @@
|
||||||
&:not(.wrap) {
|
&:not(.wrap) {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
&[fixed] {
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -130,6 +130,7 @@ async function search() {
|
||||||
dense
|
dense
|
||||||
standout
|
standout
|
||||||
autofocus
|
autofocus
|
||||||
|
data-cy="vnSearchBar"
|
||||||
>
|
>
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<QIcon
|
<QIcon
|
||||||
|
|
|
@ -1,11 +1,24 @@
|
||||||
import { useSession } from 'src/composables/useSession';
|
import { useSession } from 'src/composables/useSession';
|
||||||
import { getUrl } from './getUrl';
|
import { getUrl } from './getUrl';
|
||||||
|
import axios from 'axios';
|
||||||
|
import { exportFile } from 'quasar';
|
||||||
|
|
||||||
const { getTokenMultimedia } = useSession();
|
const { getTokenMultimedia } = useSession();
|
||||||
const token = getTokenMultimedia();
|
const token = getTokenMultimedia();
|
||||||
|
|
||||||
export async function downloadFile(id, model = 'dms', urlPath = '/downloadFile', url) {
|
export async function downloadFile(id, model = 'dms', urlPath = '/downloadFile', url) {
|
||||||
let appUrl = await getUrl('', 'lilium');
|
const appUrl = (await getUrl('', 'lilium')).replace('/#/', '');
|
||||||
appUrl = appUrl.replace('/#/', '');
|
const response = await axios.get(
|
||||||
window.open(url ?? `${appUrl}/api/${model}/${id}${urlPath}?access_token=${token}`);
|
url ?? `${appUrl}/api/${model}/${id}${urlPath}?access_token=${token}`,
|
||||||
|
{ responseType: 'blob' }
|
||||||
|
);
|
||||||
|
|
||||||
|
const contentDisposition = response.headers['content-disposition'];
|
||||||
|
const matches = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(contentDisposition);
|
||||||
|
const filename =
|
||||||
|
matches != null && matches[1]
|
||||||
|
? matches[1].replace(/['"]/g, '')
|
||||||
|
: 'downloaded-file';
|
||||||
|
|
||||||
|
exportFile(filename, response.data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -241,7 +241,7 @@ input::-webkit-inner-spin-button {
|
||||||
th,
|
th,
|
||||||
td {
|
td {
|
||||||
padding: 1px 10px 1px 10px;
|
padding: 1px 10px 1px 10px;
|
||||||
max-width: 100px;
|
max-width: 130px;
|
||||||
div span {
|
div span {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
|
|
@ -298,6 +298,7 @@ globals:
|
||||||
clientsActionsMonitor: Clients and actions
|
clientsActionsMonitor: Clients and actions
|
||||||
serial: Serial
|
serial: Serial
|
||||||
medical: Mutual
|
medical: Mutual
|
||||||
|
pit: IRPF
|
||||||
RouteExtendedList: Router
|
RouteExtendedList: Router
|
||||||
wasteRecalc: Waste recaclulate
|
wasteRecalc: Waste recaclulate
|
||||||
operator: Operator
|
operator: Operator
|
||||||
|
@ -506,6 +507,7 @@ invoiceOut:
|
||||||
invoiceWithFutureDate: Exists an invoice with a future date
|
invoiceWithFutureDate: Exists an invoice with a future date
|
||||||
noTicketsToInvoice: There are not tickets to invoice
|
noTicketsToInvoice: There are not tickets to invoice
|
||||||
criticalInvoiceError: 'Critical invoicing error, process stopped'
|
criticalInvoiceError: 'Critical invoicing error, process stopped'
|
||||||
|
invalidSerialTypeForAll: The serial type must be global when invoicing all clients
|
||||||
table:
|
table:
|
||||||
addressId: Address id
|
addressId: Address id
|
||||||
streetAddress: Street
|
streetAddress: Street
|
||||||
|
@ -858,6 +860,7 @@ components:
|
||||||
downloadFile: Download file
|
downloadFile: Download file
|
||||||
openCard: View
|
openCard: View
|
||||||
openSummary: Summary
|
openSummary: Summary
|
||||||
|
viewSummary: Summary
|
||||||
cardDescriptor:
|
cardDescriptor:
|
||||||
mainList: Main list
|
mainList: Main list
|
||||||
summary: Summary
|
summary: Summary
|
||||||
|
|
|
@ -303,6 +303,7 @@ globals:
|
||||||
clientsActionsMonitor: Clientes y acciones
|
clientsActionsMonitor: Clientes y acciones
|
||||||
serial: Facturas por serie
|
serial: Facturas por serie
|
||||||
medical: Mutua
|
medical: Mutua
|
||||||
|
pit: IRPF
|
||||||
wasteRecalc: Recalcular mermas
|
wasteRecalc: Recalcular mermas
|
||||||
operator: Operario
|
operator: Operario
|
||||||
parking: Parking
|
parking: Parking
|
||||||
|
@ -509,6 +510,7 @@ invoiceOut:
|
||||||
invoiceWithFutureDate: Existe una factura con una fecha futura
|
invoiceWithFutureDate: Existe una factura con una fecha futura
|
||||||
noTicketsToInvoice: No existen tickets para facturar
|
noTicketsToInvoice: No existen tickets para facturar
|
||||||
criticalInvoiceError: Error crítico en la facturación proceso detenido
|
criticalInvoiceError: Error crítico en la facturación proceso detenido
|
||||||
|
invalidSerialTypeForAll: El tipo de serie debe ser global cuando se facturan todos los clientes
|
||||||
table:
|
table:
|
||||||
addressId: Id dirección
|
addressId: Id dirección
|
||||||
streetAddress: Dirección fiscal
|
streetAddress: Dirección fiscal
|
||||||
|
|
|
@ -100,7 +100,7 @@ async function remove() {
|
||||||
</QMenu>
|
</QMenu>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QSeparator />
|
<QSeparator />
|
||||||
<QItem @click="confirmRemove()" v-ripple clickable>
|
<QItem @click="confirmRemove()" v-ripple clickable data-cy="deleteClaim">
|
||||||
<QItemSection avatar>
|
<QItemSection avatar>
|
||||||
<QIcon name="delete" />
|
<QIcon name="delete" />
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
|
|
|
@ -169,7 +169,6 @@ function onBeforeSave(formData, originalData) {
|
||||||
url="Clients"
|
url="Clients"
|
||||||
:input-debounce="0"
|
:input-debounce="0"
|
||||||
:label="t('customer.basicData.previousClient')"
|
:label="t('customer.basicData.previousClient')"
|
||||||
:options="clients"
|
|
||||||
:rules="validate('client.transferorFk')"
|
:rules="validate('client.transferorFk')"
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
|
|
|
@ -12,6 +12,7 @@ import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
|
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
|
||||||
import { toDate } from 'src/filters';
|
import { toDate } from 'src/filters';
|
||||||
import CustomerFilter from './CustomerFilter.vue';
|
import CustomerFilter from './CustomerFilter.vue';
|
||||||
|
import VnAvatar from 'src/components/ui/VnAvatar.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
|
@ -12,6 +12,7 @@ import VnImg from 'src/components/ui/VnImg.vue';
|
||||||
|
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const tableRef = ref();
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
align: 'center',
|
align: 'center',
|
||||||
|
@ -234,7 +235,6 @@ const columns = [
|
||||||
format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.landing)),
|
format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.landing)),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const tableRef = ref();
|
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
stateStore.rightDrawer = true;
|
stateStore.rightDrawer = true;
|
||||||
|
|
|
@ -183,7 +183,7 @@ onMounted(async () => {
|
||||||
<i18n>
|
<i18n>
|
||||||
en:
|
en:
|
||||||
invoiceDate: Invoice date
|
invoiceDate: Invoice date
|
||||||
maxShipped: Max date
|
maxShipped: Max date ticket
|
||||||
allClients: All clients
|
allClients: All clients
|
||||||
oneClient: One client
|
oneClient: One client
|
||||||
company: Company
|
company: Company
|
||||||
|
@ -195,7 +195,7 @@ en:
|
||||||
|
|
||||||
es:
|
es:
|
||||||
invoiceDate: Fecha de factura
|
invoiceDate: Fecha de factura
|
||||||
maxShipped: Fecha límite
|
maxShipped: Fecha límite ticket
|
||||||
allClients: Todos los clientes
|
allClients: Todos los clientes
|
||||||
oneClient: Un solo cliente
|
oneClient: Un solo cliente
|
||||||
company: Empresa
|
company: Empresa
|
||||||
|
|
|
@ -6,15 +6,19 @@ import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
import { usePrintService } from 'composables/usePrintService';
|
import { usePrintService } from 'src/composables/usePrintService';
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
import InvoiceOutSummary from './Card/InvoiceOutSummary.vue';
|
import InvoiceOutSummary from './Card/InvoiceOutSummary.vue';
|
||||||
import { toCurrency, toDate } from 'src/filters/index';
|
import { toCurrency, toDate } from 'src/filters/index';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import { QBtn } from 'quasar';
|
import { QBtn } from 'quasar';
|
||||||
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
|
import axios from 'axios';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
import InvoiceOutFilter from './InvoiceOutFilter.vue';
|
import InvoiceOutFilter from './InvoiceOutFilter.vue';
|
||||||
|
import VnRow from 'src/components/ui/VnRow.vue';
|
||||||
|
import VnRadio from 'src/components/common/VnRadio.vue';
|
||||||
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
|
@ -26,19 +30,29 @@ const selectedRows = ref([]);
|
||||||
const hasSelectedCards = computed(() => selectedRows.value.length > 0);
|
const hasSelectedCards = computed(() => selectedRows.value.length > 0);
|
||||||
const MODEL = 'InvoiceOuts';
|
const MODEL = 'InvoiceOuts';
|
||||||
const { openReport } = usePrintService();
|
const { openReport } = usePrintService();
|
||||||
|
const addressOptions = ref([]);
|
||||||
|
const selectedOption = ref('ticket');
|
||||||
|
async function fetchClientAddress(id) {
|
||||||
|
const { data } = await axios.get(
|
||||||
|
`Clients/${id}/addresses?filter[order]=isActive DESC`
|
||||||
|
);
|
||||||
|
addressOptions.value = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
const exprBuilder = (_, value) => {
|
||||||
|
return {
|
||||||
|
or: [{ code: value }, { description: { like: `%${value}%` } }],
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'center',
|
align: 'center',
|
||||||
name: 'id',
|
name: 'id',
|
||||||
label: t('invoiceOutList.tableVisibleColumns.id'),
|
label: t('invoiceOutList.tableVisibleColumns.id'),
|
||||||
chip: {
|
chip: { condition: () => true },
|
||||||
condition: () => true,
|
|
||||||
},
|
|
||||||
isId: true,
|
isId: true,
|
||||||
columnFilter: {
|
columnFilter: { name: 'search' },
|
||||||
name: 'search',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -58,68 +72,51 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'Issued',
|
name: 'issued',
|
||||||
label: t('invoiceOutList.tableVisibleColumns.issued'),
|
label: t('invoiceOut.summary.issued'),
|
||||||
component: 'date',
|
component: 'date',
|
||||||
format: (row) => toDate(row.issued),
|
format: (row) => toDate(row.issued),
|
||||||
columnField: {
|
columnField: { component: null },
|
||||||
component: null,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'clientFk',
|
name: 'clientFk',
|
||||||
label: t('invoiceOutModule.customer'),
|
label: t('globals.client'),
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
component: 'select',
|
component: 'select',
|
||||||
attrs: {
|
attrs: { url: 'Clients', fields: ['id', 'name'] },
|
||||||
url: 'Clients',
|
columnField: { component: null },
|
||||||
fields: ['id', 'name'],
|
|
||||||
},
|
|
||||||
columnField: {
|
|
||||||
component: null,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'companyCode',
|
name: 'companyCode',
|
||||||
label: t('invoiceOutModule.company'),
|
label: t('globals.company'),
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
component: 'select',
|
component: 'select',
|
||||||
attrs: {
|
attrs: { url: 'Companies', optionLabel: 'code', optionValue: 'id' },
|
||||||
url: 'Companies',
|
columnField: { component: null },
|
||||||
optionLabel: 'code',
|
|
||||||
optionValue: 'id',
|
|
||||||
},
|
|
||||||
columnField: {
|
|
||||||
component: null,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'amount',
|
name: 'amount',
|
||||||
label: t('invoiceOutModule.amount'),
|
label: t('globals.amount'),
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
format: (row) => toCurrency(row.amount),
|
format: (row) => toCurrency(row.amount),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'created',
|
name: 'created',
|
||||||
label: t('invoiceOutList.tableVisibleColumns.created'),
|
label: t('globals.created'),
|
||||||
component: 'date',
|
component: 'date',
|
||||||
columnField: {
|
columnField: { component: null },
|
||||||
component: null,
|
|
||||||
},
|
|
||||||
format: (row) => toDate(row.created),
|
format: (row) => toDate(row.created),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'dued',
|
name: 'dued',
|
||||||
label: t('invoiceOutList.tableVisibleColumns.dueDate'),
|
label: t('invoiceOut.summary.dued'),
|
||||||
component: 'date',
|
component: 'date',
|
||||||
columnField: {
|
columnField: { component: null },
|
||||||
component: null,
|
|
||||||
},
|
|
||||||
format: (row) => toDate(row.dued),
|
format: (row) => toDate(row.dued),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -129,11 +126,12 @@ const columns = computed(() => [
|
||||||
{
|
{
|
||||||
title: t('components.smartCard.viewSummary'),
|
title: t('components.smartCard.viewSummary'),
|
||||||
icon: 'preview',
|
icon: 'preview',
|
||||||
|
isPrimary: true,
|
||||||
action: (row) => viewSummary(row.id, InvoiceOutSummary),
|
action: (row) => viewSummary(row.id, InvoiceOutSummary),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('DownloadPdf'),
|
title: t('globals.downloadPdf'),
|
||||||
icon: 'vn:ticket',
|
icon: 'cloud_download',
|
||||||
isPrimary: true,
|
isPrimary: true,
|
||||||
action: (row) => openPdf(row.id),
|
action: (row) => openPdf(row.id),
|
||||||
},
|
},
|
||||||
|
@ -172,7 +170,7 @@ watchEffect(selectedRows);
|
||||||
<template>
|
<template>
|
||||||
<VnSearchbar
|
<VnSearchbar
|
||||||
:info="t('youCanSearchByInvoiceReference')"
|
:info="t('youCanSearchByInvoiceReference')"
|
||||||
:label="t('searchInvoice')"
|
:label="t('Search invoice')"
|
||||||
data-key="invoiceOutList"
|
data-key="invoiceOutList"
|
||||||
/>
|
/>
|
||||||
<RightMenu>
|
<RightMenu>
|
||||||
|
@ -188,7 +186,7 @@ watchEffect(selectedRows);
|
||||||
@click="downloadPdf()"
|
@click="downloadPdf()"
|
||||||
:disable="!hasSelectedCards"
|
:disable="!hasSelectedCards"
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('globals.downloadPdf') }}</QTooltip>
|
<QTooltip>{{ t('downloadPdf') }}</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
</template>
|
</template>
|
||||||
</VnSubToolbar>
|
</VnSubToolbar>
|
||||||
|
@ -198,11 +196,9 @@ watchEffect(selectedRows);
|
||||||
:url="`${MODEL}/filter`"
|
:url="`${MODEL}/filter`"
|
||||||
:create="{
|
:create="{
|
||||||
urlCreate: 'InvoiceOuts/createManualInvoice',
|
urlCreate: 'InvoiceOuts/createManualInvoice',
|
||||||
title: t('Create manual invoice'),
|
title: t('createManualInvoice'),
|
||||||
onDataSaved: ({ id }) => tableRef.redirect(id),
|
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||||
formInitialData: {
|
formInitialData: { active: true },
|
||||||
active: true,
|
|
||||||
},
|
|
||||||
}"
|
}"
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
v-model:selected="selectedRows"
|
v-model:selected="selectedRows"
|
||||||
|
@ -222,45 +218,154 @@ watchEffect(selectedRows);
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<template #more-create-dialog="{ data }">
|
<template #more-create-dialog="{ data }">
|
||||||
<div class="flex no-wrap flex-center">
|
<div class="row q-col-gutter-xs">
|
||||||
<VnSelect
|
<div class="col-12">
|
||||||
url="Tickets"
|
<div class="q-col-gutter-xs">
|
||||||
|
<VnRow fixed>
|
||||||
|
<VnRadio
|
||||||
|
v-model="selectedOption"
|
||||||
|
val="ticket"
|
||||||
|
:label="t('globals.ticket')"
|
||||||
|
class="q-my-none q-mr-md"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<VnInput
|
||||||
|
v-show="selectedOption === 'ticket'"
|
||||||
v-model="data.ticketFk"
|
v-model="data.ticketFk"
|
||||||
:label="t('invoiceOutList.tableVisibleColumns.ticket')"
|
:label="t('globals.ticket')"
|
||||||
option-label="id"
|
style="flex: 1"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="row q-col-gutter-xs q-ml-none"
|
||||||
|
v-show="selectedOption !== 'ticket'"
|
||||||
|
>
|
||||||
|
<div class="col">
|
||||||
|
<VnSelect
|
||||||
|
v-model="data.clientFk"
|
||||||
|
:label="t('globals.client')"
|
||||||
|
url="Clients"
|
||||||
|
:options="customerOptions"
|
||||||
|
option-label="name"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
@update:model-value="fetchClientAddress"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel> #{{ scope.opt?.id }} </QItemLabel>
|
<QItemLabel>
|
||||||
<QItemLabel caption>{{ scope.opt?.nickname }}</QItemLabel>
|
#{{ scope.opt?.id }} -
|
||||||
|
{{ scope.opt?.name }}
|
||||||
|
</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
</template>
|
</template>
|
||||||
</VnSelect>
|
</VnSelect>
|
||||||
<span class="q-ml-md">O</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
url="Clients"
|
v-model="data.addressFk"
|
||||||
v-model="data.clientFk"
|
:label="t('ticket.summary.consignee')"
|
||||||
:label="t('invoiceOutModule.customer')"
|
:options="addressOptions"
|
||||||
:options="customerOptions"
|
option-label="nickname"
|
||||||
option-label="name"
|
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
v-if="
|
||||||
|
data.clientFk &&
|
||||||
|
selectedOption === 'consignatario'
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<template #option="scope">
|
||||||
|
<QItem v-bind="scope.itemProps">
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel
|
||||||
|
:class="{
|
||||||
|
'color-vn-label':
|
||||||
|
!scope.opt?.isActive,
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
{{
|
||||||
|
`${
|
||||||
|
!scope.opt?.isActive
|
||||||
|
? t('inactive')
|
||||||
|
: ''
|
||||||
|
} `
|
||||||
|
}}
|
||||||
|
<span>{{
|
||||||
|
scope.opt?.nickname
|
||||||
|
}}</span>
|
||||||
|
<span
|
||||||
|
v-if="
|
||||||
|
scope.opt?.province ||
|
||||||
|
scope.opt?.city ||
|
||||||
|
scope.opt?.street
|
||||||
|
"
|
||||||
|
>
|
||||||
|
, {{ scope.opt?.street }},
|
||||||
|
{{ scope.opt?.city }},
|
||||||
|
{{
|
||||||
|
scope.opt?.province?.name
|
||||||
|
}}
|
||||||
|
-
|
||||||
|
{{
|
||||||
|
scope.opt?.agencyMode
|
||||||
|
?.name
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
|
</QItemLabel>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnSelect>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow fixed>
|
||||||
|
<VnRadio
|
||||||
|
v-model="selectedOption"
|
||||||
|
val="cliente"
|
||||||
|
:label="t('globals.client')"
|
||||||
|
class="q-my-none q-mr-md"
|
||||||
/>
|
/>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow fixed>
|
||||||
|
<VnRadio
|
||||||
|
v-model="selectedOption"
|
||||||
|
val="consignatario"
|
||||||
|
:label="t('ticket.summary.consignee')"
|
||||||
|
class="q-my-none q-mr-md"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="full-width">
|
||||||
|
<VnRow class="row q-col-gutter-xs">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
url="InvoiceOutSerials"
|
url="InvoiceOutSerials"
|
||||||
v-model="data.serial"
|
v-model="data.serial"
|
||||||
:label="t('invoiceOutList.tableVisibleColumns.invoiceOutSerial')"
|
:label="t('invoiceIn.serial')"
|
||||||
:options="invoiceOutSerialsOptions"
|
:options="invoiceOutSerialsOptions"
|
||||||
option-label="description"
|
option-label="description"
|
||||||
option-value="code"
|
option-value="code"
|
||||||
/>
|
option-filter
|
||||||
|
:expr-builder="exprBuilder"
|
||||||
|
>
|
||||||
|
<template #option="scope">
|
||||||
|
<QItem v-bind="scope.itemProps">
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel>
|
||||||
|
{{ scope.opt?.code }} -
|
||||||
|
{{ scope.opt?.description }}
|
||||||
|
</QItemLabel>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnSelect>
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
:label="t('invoiceOutList.tableVisibleColumns.dueDate')"
|
:label="t('invoiceOut.summary.dued')"
|
||||||
v-model="data.maxShipped"
|
v-model="data.maxShipped"
|
||||||
/>
|
/>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow class="row q-col-gutter-xs">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
url="TaxAreas"
|
url="TaxAreas"
|
||||||
v-model="data.taxArea"
|
v-model="data.taxArea"
|
||||||
|
@ -269,27 +374,43 @@ watchEffect(selectedRows);
|
||||||
option-label="code"
|
option-label="code"
|
||||||
option-value="code"
|
option-value="code"
|
||||||
/>
|
/>
|
||||||
<QInput
|
<VnInput
|
||||||
v-model="data.reference"
|
v-model="data.reference"
|
||||||
:label="t('invoiceOutList.tableVisibleColumns.ref')"
|
:label="t('globals.reference')"
|
||||||
/>
|
/>
|
||||||
|
</VnRow>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</VnTable>
|
</VnTable>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
#formModel .vn-row {
|
||||||
|
min-height: 45px;
|
||||||
|
|
||||||
|
.q-radio {
|
||||||
|
align-self: flex-end;
|
||||||
|
flex: 0.3;
|
||||||
|
}
|
||||||
|
|
||||||
|
> .q-input,
|
||||||
|
> .q-select {
|
||||||
|
flex: 0.75;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
en:
|
en:
|
||||||
searchInvoice: Search issued invoice
|
invoiceId: Invoice ID
|
||||||
fileDenied: Browser denied file download...
|
|
||||||
fileAllowed: Successful download of CSV file
|
|
||||||
youCanSearchByInvoiceReference: You can search by invoice reference
|
youCanSearchByInvoiceReference: You can search by invoice reference
|
||||||
createInvoice: Make invoice
|
createManualInvoice: Create Manual Invoice
|
||||||
Create manual invoice: Create manual invoice
|
inactive: (Inactive)
|
||||||
|
|
||||||
es:
|
es:
|
||||||
searchInvoice: Buscar factura emitida
|
invoiceId: ID de factura
|
||||||
fileDenied: El navegador denegó la descarga de archivos...
|
|
||||||
fileAllowed: Descarga exitosa de archivo CSV
|
|
||||||
youCanSearchByInvoiceReference: Puedes buscar por referencia de la factura
|
youCanSearchByInvoiceReference: Puedes buscar por referencia de la factura
|
||||||
createInvoice: Crear factura
|
createManualInvoice: Crear factura manual
|
||||||
Create manual invoice: Crear factura manual
|
inactive: (Inactivo)
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -2,6 +2,7 @@ invoiceOutModule:
|
||||||
customer: Client
|
customer: Client
|
||||||
amount: Amount
|
amount: Amount
|
||||||
company: Company
|
company: Company
|
||||||
|
address: Address
|
||||||
invoiceOutList:
|
invoiceOutList:
|
||||||
tableVisibleColumns:
|
tableVisibleColumns:
|
||||||
id: ID
|
id: ID
|
||||||
|
|
|
@ -4,6 +4,7 @@ invoiceOutModule:
|
||||||
customer: Cliente
|
customer: Cliente
|
||||||
amount: Importe
|
amount: Importe
|
||||||
company: Empresa
|
company: Empresa
|
||||||
|
address: Consignatario
|
||||||
invoiceOutList:
|
invoiceOutList:
|
||||||
tableVisibleColumns:
|
tableVisibleColumns:
|
||||||
id: ID
|
id: ID
|
||||||
|
|
|
@ -15,6 +15,7 @@ import { toCurrency, dateRange, dashIfEmpty } from 'src/filters';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
import MonitorTicketSearchbar from './MonitorTicketSearchbar.vue';
|
import MonitorTicketSearchbar from './MonitorTicketSearchbar.vue';
|
||||||
import MonitorTicketFilter from './MonitorTicketFilter.vue';
|
import MonitorTicketFilter from './MonitorTicketFilter.vue';
|
||||||
|
import TicketProblems from 'src/components/TicketProblems.vue';
|
||||||
|
|
||||||
const DEFAULT_AUTO_REFRESH = 2 * 60 * 1000; // 2min in ms
|
const DEFAULT_AUTO_REFRESH = 2 * 60 * 1000; // 2min in ms
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -23,9 +24,15 @@ const tableRef = ref(null);
|
||||||
const provinceOpts = ref([]);
|
const provinceOpts = ref([]);
|
||||||
const stateOpts = ref([]);
|
const stateOpts = ref([]);
|
||||||
const zoneOpts = ref([]);
|
const zoneOpts = ref([]);
|
||||||
const visibleColumns = ref([]);
|
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
|
|
||||||
const [from, to] = dateRange(Date.vnNew());
|
const [from, to] = dateRange(Date.vnNew());
|
||||||
|
const stateColors = {
|
||||||
|
notice: 'info',
|
||||||
|
success: 'positive',
|
||||||
|
warning: 'warning',
|
||||||
|
alert: 'negative',
|
||||||
|
};
|
||||||
|
|
||||||
function exprBuilder(param, value) {
|
function exprBuilder(param, value) {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
|
@ -220,7 +227,7 @@ const columns = computed(() => [
|
||||||
{
|
{
|
||||||
title: t('salesTicketsTable.goToLines'),
|
title: t('salesTicketsTable.goToLines'),
|
||||||
icon: 'vn:lines',
|
icon: 'vn:lines',
|
||||||
color: 'priamry',
|
color: 'primary',
|
||||||
action: (row) => openTab(row.id),
|
action: (row) => openTab(row.id),
|
||||||
isPrimary: true,
|
isPrimary: true,
|
||||||
attrs: {
|
attrs: {
|
||||||
|
@ -231,7 +238,7 @@ const columns = computed(() => [
|
||||||
{
|
{
|
||||||
title: t('salesTicketsTable.preview'),
|
title: t('salesTicketsTable.preview'),
|
||||||
icon: 'preview',
|
icon: 'preview',
|
||||||
color: 'priamry',
|
color: 'primary',
|
||||||
action: (row) => viewSummary(row.id, TicketSummary),
|
action: (row) => viewSummary(row.id, TicketSummary),
|
||||||
isPrimary: true,
|
isPrimary: true,
|
||||||
attrs: {
|
attrs: {
|
||||||
|
@ -249,10 +256,10 @@ const getBadgeAttrs = (date) => {
|
||||||
let timeTicket = new Date(date);
|
let timeTicket = new Date(date);
|
||||||
timeTicket.setHours(0, 0, 0, 0);
|
timeTicket.setHours(0, 0, 0, 0);
|
||||||
|
|
||||||
let comparation = today - timeTicket;
|
let timeDiff = today - timeTicket;
|
||||||
|
|
||||||
if (comparation == 0) return { color: 'warning', 'text-color': 'black' };
|
if (timeDiff == 0) return { color: 'warning', 'text-color': 'black' };
|
||||||
if (comparation < 0) return { color: 'success', 'text-color': 'black' };
|
if (timeDiff < 0) return { color: 'success', 'text-color': 'black' };
|
||||||
return { color: 'transparent', 'text-color': 'white' };
|
return { color: 'transparent', 'text-color': 'white' };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -267,13 +274,6 @@ const autoRefreshHandler = (value) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const stateColors = {
|
|
||||||
notice: 'info',
|
|
||||||
success: 'positive',
|
|
||||||
warning: 'warning',
|
|
||||||
alert: 'negative',
|
|
||||||
};
|
|
||||||
|
|
||||||
const totalPriceColor = (ticket) => {
|
const totalPriceColor = (ticket) => {
|
||||||
const total = parseInt(ticket.totalWithVat);
|
const total = parseInt(ticket.totalWithVat);
|
||||||
if (total > 0 && total < 50) return 'warning';
|
if (total > 0 && total < 50) return 'warning';
|
||||||
|
@ -281,10 +281,10 @@ const totalPriceColor = (ticket) => {
|
||||||
|
|
||||||
const formatShippedDate = (date) => {
|
const formatShippedDate = (date) => {
|
||||||
if (!date) return '-';
|
if (!date) return '-';
|
||||||
const split1 = date.split('T');
|
const dateSplit = date.split('T');
|
||||||
const [year, month, day] = split1[0].split('-');
|
const [year, month, day] = dateSplit[0].split('-');
|
||||||
const _date = new Date(year, month - 1, day);
|
const newDate = new Date(year, month - 1, day);
|
||||||
return toDateFormat(_date);
|
return toDateFormat(newDate);
|
||||||
};
|
};
|
||||||
|
|
||||||
const openTab = (id) =>
|
const openTab = (id) =>
|
||||||
|
@ -332,7 +332,6 @@ const openTab = (id) =>
|
||||||
:expr-builder="exprBuilder"
|
:expr-builder="exprBuilder"
|
||||||
:offset="50"
|
:offset="50"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:visible-columns="visibleColumns"
|
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
default-mode="table"
|
default-mode="table"
|
||||||
auto-load
|
auto-load
|
||||||
|
@ -362,61 +361,7 @@ const openTab = (id) =>
|
||||||
</QCheckbox>
|
</QCheckbox>
|
||||||
</template>
|
</template>
|
||||||
<template #column-totalProblems="{ row }">
|
<template #column-totalProblems="{ row }">
|
||||||
<span>
|
<TicketProblems :row="row" />
|
||||||
<QIcon
|
|
||||||
v-if="row.isTaxDataChecked === 0"
|
|
||||||
name="vn:no036"
|
|
||||||
color="primary"
|
|
||||||
size="xs"
|
|
||||||
>
|
|
||||||
<QTooltip>{{ $t('salesTicketsTable.noVerifiedData') }}</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
<QIcon
|
|
||||||
v-if="row.hasTicketRequest"
|
|
||||||
name="vn:buyrequest"
|
|
||||||
color="primary"
|
|
||||||
size="xs"
|
|
||||||
>
|
|
||||||
<QTooltip>{{ $t('salesTicketsTable.purchaseRequest') }}</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
<QIcon
|
|
||||||
v-if="row.itemShortage"
|
|
||||||
name="vn:unavailable"
|
|
||||||
color="primary"
|
|
||||||
size="xs"
|
|
||||||
>
|
|
||||||
<QTooltip>{{ $t('salesTicketsTable.notVisible') }}</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
<QIcon v-if="row.isFreezed" name="vn:frozen" color="primary" size="xs">
|
|
||||||
<QTooltip>{{ $t('salesTicketsTable.clientFrozen') }}</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
<QIcon
|
|
||||||
v-if="row.risk"
|
|
||||||
name="vn:risk"
|
|
||||||
:color="row.hasHighRisk ? 'negative' : 'primary'"
|
|
||||||
size="xs"
|
|
||||||
>
|
|
||||||
<QTooltip
|
|
||||||
>{{ $t('salesTicketsTable.risk') }}: {{ row.risk }}</QTooltip
|
|
||||||
>
|
|
||||||
</QIcon>
|
|
||||||
<QIcon
|
|
||||||
v-if="row.hasComponentLack"
|
|
||||||
name="vn:components"
|
|
||||||
color="primary"
|
|
||||||
size="xs"
|
|
||||||
>
|
|
||||||
<QTooltip>{{ $t('salesTicketsTable.componentLack') }}</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
<QIcon
|
|
||||||
v-if="row.isTooLittle"
|
|
||||||
name="vn:isTooLittle"
|
|
||||||
color="primary"
|
|
||||||
size="xs"
|
|
||||||
>
|
|
||||||
<QTooltip>{{ $t('salesTicketsTable.tooLittle') }}</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
</span>
|
|
||||||
</template>
|
</template>
|
||||||
<template #column-id="{ row }">
|
<template #column-id="{ row }">
|
||||||
<span class="link" @click.stop.prevent>
|
<span class="link" @click.stop.prevent>
|
||||||
|
@ -471,7 +416,7 @@ const openTab = (id) =>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
</template>
|
</template>
|
||||||
<template #column-zoneFk="{ row }">
|
<template #column-zoneFk="{ row }">
|
||||||
<div @click.stop.prevent :title="row.zoneName">
|
<div v-if="row.zoneFk" @click.stop.prevent :title="row.zoneName">
|
||||||
<span class="link">{{ row.zoneName }}</span>
|
<span class="link">{{ row.zoneName }}</span>
|
||||||
<ZoneDescriptorProxy :id="row.zoneFk" />
|
<ZoneDescriptorProxy :id="row.zoneFk" />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -49,7 +49,7 @@ const getSelectedTagValues = async (tag) => {
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QForm @submit="applyTags()" class="all-pointer-events">
|
<QForm @submit="applyTags()" class="all-pointer-events">
|
||||||
<QCard class="q-pa-sm column q-pa-lg">
|
<QCard class="q-pa-sm column q-pa-lg" data-cy="catalogFilterValueDialog">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('params.tag')"
|
:label="t('params.tag')"
|
||||||
v-model="selectedTag"
|
v-model="selectedTag"
|
||||||
|
@ -63,6 +63,7 @@ const getSelectedTagValues = async (tag) => {
|
||||||
:emit-value="false"
|
:emit-value="false"
|
||||||
use-input
|
use-input
|
||||||
@update:model-value="getSelectedTagValues"
|
@update:model-value="getSelectedTagValues"
|
||||||
|
data-cy="catalogFilterValueDialogTagSelect"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
v-for="(value, index) in tagValues"
|
v-for="(value, index) in tagValues"
|
||||||
|
@ -93,6 +94,7 @@ const getSelectedTagValues = async (tag) => {
|
||||||
:disable="!value"
|
:disable="!value"
|
||||||
is-outlined
|
is-outlined
|
||||||
class="col"
|
class="col"
|
||||||
|
data-cy="catalogFilterValueDialogValueInput"
|
||||||
/>
|
/>
|
||||||
<QBtn
|
<QBtn
|
||||||
icon="delete"
|
icon="delete"
|
||||||
|
|
|
@ -98,7 +98,7 @@ watch(
|
||||||
/>
|
/>
|
||||||
</QScrollArea>
|
</QScrollArea>
|
||||||
</QDrawer>
|
</QDrawer>
|
||||||
<QPage class="column items-center q-pa-md">
|
<QPage class="column items-center q-pa-md" data-cy="orderCatalogPage">
|
||||||
<div class="full-width">
|
<div class="full-width">
|
||||||
<VnPaginate
|
<VnPaginate
|
||||||
:data-key="dataKey"
|
:data-key="dataKey"
|
||||||
|
@ -118,6 +118,7 @@ watch(
|
||||||
:item="row"
|
:item="row"
|
||||||
is-catalog
|
is-catalog
|
||||||
class="fill-icon"
|
class="fill-icon"
|
||||||
|
data-cy="orderCatalogItem"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -178,6 +178,7 @@ function addOrder(value, field, params) {
|
||||||
? resetCategory(params, searchFn)
|
? resetCategory(params, searchFn)
|
||||||
: removeTagGroupParam(params, searchFn, valIndex)
|
: removeTagGroupParam(params, searchFn, valIndex)
|
||||||
"
|
"
|
||||||
|
data-cy="catalogFilterCustomTag"
|
||||||
>
|
>
|
||||||
<strong v-if="customTag.label === 'categoryFk' && categoryList">
|
<strong v-if="customTag.label === 'categoryFk' && categoryList">
|
||||||
{{
|
{{
|
||||||
|
@ -211,6 +212,7 @@ function addOrder(value, field, params) {
|
||||||
:name="category.icon"
|
:name="category.icon"
|
||||||
class="category-icon"
|
class="category-icon"
|
||||||
@click="selectCategory(params, category, searchFn)"
|
@click="selectCategory(params, category, searchFn)"
|
||||||
|
data-cy="catalogFilterCategory"
|
||||||
>
|
>
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ t(category.name) }}
|
{{ t(category.name) }}
|
||||||
|
@ -234,6 +236,7 @@ function addOrder(value, field, params) {
|
||||||
sort-by="name ASC"
|
sort-by="name ASC"
|
||||||
:disable="!params.categoryFk"
|
:disable="!params.categoryFk"
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
|
data-cy="catalogFilterType"
|
||||||
>
|
>
|
||||||
<template #option="{ itemProps, opt }">
|
<template #option="{ itemProps, opt }">
|
||||||
<QItem v-bind="itemProps">
|
<QItem v-bind="itemProps">
|
||||||
|
@ -285,6 +288,7 @@ function addOrder(value, field, params) {
|
||||||
:is-clearable="false"
|
:is-clearable="false"
|
||||||
v-model="searchByTag"
|
v-model="searchByTag"
|
||||||
@keyup.enter="(val) => onSearchByTag(val, params)"
|
@keyup.enter="(val) => onSearchByTag(val, params)"
|
||||||
|
data-cy="catalogFilterValueInput"
|
||||||
>
|
>
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<QIcon name="search" />
|
<QIcon name="search" />
|
||||||
|
@ -297,6 +301,7 @@ function addOrder(value, field, params) {
|
||||||
color="primary"
|
color="primary"
|
||||||
size="md"
|
size="md"
|
||||||
dense
|
dense
|
||||||
|
data-cy="catalogFilterValueDialogBtn"
|
||||||
/>
|
/>
|
||||||
<QPopupProxy>
|
<QPopupProxy>
|
||||||
<CatalogFilterValueDialog
|
<CatalogFilterValueDialog
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { onMounted, ref } from 'vue';
|
import { reactive, onMounted, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useState } from 'composables/useState';
|
import { useState } from 'composables/useState';
|
||||||
|
@ -9,7 +9,6 @@ import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnSelect from 'components/common/VnSelect.vue';
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
import { useDialogPluginComponent } from 'quasar';
|
import { useDialogPluginComponent } from 'quasar';
|
||||||
import { reactive } from 'vue';
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const state = useState();
|
const state = useState();
|
||||||
|
@ -48,10 +47,6 @@ const fetchAgencyList = async (landed, addressFk) => {
|
||||||
agencyList.value = data;
|
agencyList.value = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
// const fetchOrderDetails = (order) => {
|
|
||||||
// fetchAddressList(order?.addressFk);
|
|
||||||
// fetchAgencyList(order?.landed, order?.addressFk);
|
|
||||||
// };
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
clientFk: {
|
clientFk: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
@ -63,39 +58,6 @@ const initialFormState = reactive({
|
||||||
addressId: null,
|
addressId: null,
|
||||||
clientFk: $props.clientFk,
|
clientFk: $props.clientFk,
|
||||||
});
|
});
|
||||||
// const orderMapper = (order) => {
|
|
||||||
// return {
|
|
||||||
// addressId: order.addressFk,
|
|
||||||
// agencyModeId: order.agencyModeFk,
|
|
||||||
// landed: new Date(order.landed).toISOString(),
|
|
||||||
// };
|
|
||||||
// };
|
|
||||||
// const orderFilter = {
|
|
||||||
// include: [
|
|
||||||
// { relation: 'agencyMode', scope: { fields: ['name'] } },
|
|
||||||
// {
|
|
||||||
// relation: 'address',
|
|
||||||
// scope: { fields: ['nickname'] },
|
|
||||||
// },
|
|
||||||
// { relation: 'rows', scope: { fields: ['id'] } },
|
|
||||||
// {
|
|
||||||
// relation: 'client',
|
|
||||||
// scope: {
|
|
||||||
// fields: [
|
|
||||||
// 'salesPersonFk',
|
|
||||||
// 'name',
|
|
||||||
// 'isActive',
|
|
||||||
// 'isFreezed',
|
|
||||||
// 'isTaxDataChecked',
|
|
||||||
// ],
|
|
||||||
// include: {
|
|
||||||
// relation: 'salesPersonUser',
|
|
||||||
// scope: { fields: ['id', 'name'] },
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// ],
|
|
||||||
// };
|
|
||||||
|
|
||||||
const onClientChange = async (clientId = $props.clientFk) => {
|
const onClientChange = async (clientId = $props.clientFk) => {
|
||||||
const { data } = await axios.get(`Clients/${clientId}`);
|
const { data } = await axios.get(`Clients/${clientId}`);
|
||||||
|
|
|
@ -9,6 +9,7 @@ import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnLocation from 'src/components/common/VnLocation.vue';
|
import VnLocation from 'src/components/common/VnLocation.vue';
|
||||||
|
import VnAccountNumber from 'src/components/common/VnAccountNumber.vue';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -100,10 +101,13 @@ function handleLocation(data, location) {
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnInput
|
<VnAccountNumber
|
||||||
v-model="data.account"
|
v-model="data.account"
|
||||||
:label="t('supplier.fiscalData.account')"
|
:label="t('supplier.fiscalData.account')"
|
||||||
clearable
|
clearable
|
||||||
|
data-cy="supplierFiscalDataAccount"
|
||||||
|
insertable
|
||||||
|
:maxlength="10"
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('supplier.fiscalData.sageTaxTypeFk')"
|
:label="t('supplier.fiscalData.sageTaxTypeFk')"
|
||||||
|
|
|
@ -33,6 +33,7 @@ const canEditZone = useAcl().hasAny([
|
||||||
const agencyFetchRef = ref();
|
const agencyFetchRef = ref();
|
||||||
const warehousesOptions = ref([]);
|
const warehousesOptions = ref([]);
|
||||||
const companiesOptions = ref([]);
|
const companiesOptions = ref([]);
|
||||||
|
const currenciesOptions = ref([]);
|
||||||
const agenciesOptions = ref([]);
|
const agenciesOptions = ref([]);
|
||||||
const zonesOptions = ref([]);
|
const zonesOptions = ref([]);
|
||||||
const addresses = ref([]);
|
const addresses = ref([]);
|
||||||
|
|
|
@ -130,6 +130,7 @@ function ticketFilter(ticket) {
|
||||||
<QBadge
|
<QBadge
|
||||||
text-color="black"
|
text-color="black"
|
||||||
:color="entity.ticketState.state.classColor"
|
:color="entity.ticketState.state.classColor"
|
||||||
|
data-cy="ticketDescriptorStateBadge"
|
||||||
>
|
>
|
||||||
{{ entity.ticketState.state.name }}
|
{{ entity.ticketState.state.name }}
|
||||||
</QBadge>
|
</QBadge>
|
||||||
|
@ -174,7 +175,7 @@ function ticketFilter(ticket) {
|
||||||
<QTooltip>{{ t('Client Frozen') }}</QTooltip>
|
<QTooltip>{{ t('Client Frozen') }}</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
<QIcon
|
<QIcon
|
||||||
v-if="entity.problem.includes('hasRisk')"
|
v-if="entity?.problem?.includes('hasRisk')"
|
||||||
name="vn:risk"
|
name="vn:risk"
|
||||||
size="xs"
|
size="xs"
|
||||||
color="primary"
|
color="primary"
|
||||||
|
|
|
@ -75,6 +75,7 @@ const cancel = () => {
|
||||||
dense
|
dense
|
||||||
style="width: 50%"
|
style="width: 50%"
|
||||||
@click="save()"
|
@click="save()"
|
||||||
|
data-cy="saveManaBtn"
|
||||||
>
|
>
|
||||||
{{ t('globals.save') }}
|
{{ t('globals.save') }}
|
||||||
</QBtn>
|
</QBtn>
|
||||||
|
|
|
@ -80,12 +80,14 @@ async function handleSave() {
|
||||||
option-value="id"
|
option-value="id"
|
||||||
v-model="row.observationTypeFk"
|
v-model="row.observationTypeFk"
|
||||||
:disable="!!row.id"
|
:disable="!!row.id"
|
||||||
|
data-cy="ticketNotesObservationType"
|
||||||
/>
|
/>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('basicData.description')"
|
:label="t('basicData.description')"
|
||||||
v-model="row.description"
|
v-model="row.description"
|
||||||
class="col"
|
class="col"
|
||||||
@keyup.enter="handleSave"
|
@keyup.enter="handleSave"
|
||||||
|
data-cy="ticketNotesDescription"
|
||||||
/>
|
/>
|
||||||
<QIcon
|
<QIcon
|
||||||
name="delete"
|
name="delete"
|
||||||
|
@ -93,6 +95,7 @@ async function handleSave() {
|
||||||
class="cursor-pointer"
|
class="cursor-pointer"
|
||||||
color="primary"
|
color="primary"
|
||||||
@click="handleDelete(row)"
|
@click="handleDelete(row)"
|
||||||
|
data-cy="ticketNotesRemoveNoteBtn"
|
||||||
>
|
>
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ t('ticketNotes.removeNote') }}
|
{{ t('ticketNotes.removeNote') }}
|
||||||
|
@ -107,6 +110,7 @@ async function handleSave() {
|
||||||
class="fill-icon-on-hover q-ml-md"
|
class="fill-icon-on-hover q-ml-md"
|
||||||
color="primary"
|
color="primary"
|
||||||
@click="ticketNotesCrudRef.insert()"
|
@click="ticketNotesCrudRef.insert()"
|
||||||
|
data-cy="ticketNotesAddNoteBtn"
|
||||||
>
|
>
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ t('ticketNotes.addNote') }}
|
{{ t('ticketNotes.addNote') }}
|
||||||
|
|
|
@ -555,6 +555,7 @@ watch(
|
||||||
color="primary"
|
color="primary"
|
||||||
:disable="!isTicketEditable || ticketState === 'OK'"
|
:disable="!isTicketEditable || ticketState === 'OK'"
|
||||||
@click="changeTicketState('OK')"
|
@click="changeTicketState('OK')"
|
||||||
|
data-cy="ticketSaleOkStateBtn"
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t(`Change ticket state to 'Ok'`) }}</QTooltip>
|
<QTooltip>{{ t(`Change ticket state to 'Ok'`) }}</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
|
@ -563,6 +564,7 @@ watch(
|
||||||
color="primary"
|
color="primary"
|
||||||
:label="t('ticketList.state')"
|
:label="t('ticketList.state')"
|
||||||
:disable="!isTicketEditable"
|
:disable="!isTicketEditable"
|
||||||
|
data-cy="ticketSaleStateDropdown"
|
||||||
>
|
>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:options="editableStatesOptions"
|
:options="editableStatesOptions"
|
||||||
|
@ -572,6 +574,7 @@ watch(
|
||||||
hide-dropdown-icon
|
hide-dropdown-icon
|
||||||
focus-on-mount
|
focus-on-mount
|
||||||
@update:model-value="changeTicketState"
|
@update:model-value="changeTicketState"
|
||||||
|
data-cy="ticketSaleStateSelect"
|
||||||
/>
|
/>
|
||||||
</QBtnDropdown>
|
</QBtnDropdown>
|
||||||
<TicketSaleMoreActions
|
<TicketSaleMoreActions
|
||||||
|
@ -604,6 +607,7 @@ watch(
|
||||||
icon="vn:splitline"
|
icon="vn:splitline"
|
||||||
:disable="!isTicketEditable || !hasSelectedRows"
|
:disable="!isTicketEditable || !hasSelectedRows"
|
||||||
@click="setTransferParams()"
|
@click="setTransferParams()"
|
||||||
|
data-cy="ticketSaleTransferBtn"
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('Transfer lines') }}</QTooltip>
|
<QTooltip>{{ t('Transfer lines') }}</QTooltip>
|
||||||
<TicketTransfer
|
<TicketTransfer
|
||||||
|
@ -683,7 +687,13 @@ watch(
|
||||||
{{ t('ticketSale.visible') }}: {{ row.visible || 0 }}
|
{{ t('ticketSale.visible') }}: {{ row.visible || 0 }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
<QIcon v-if="row.reserved" color="primary" name="vn:reserva" size="xs">
|
<QIcon
|
||||||
|
v-if="row.reserved"
|
||||||
|
color="primary"
|
||||||
|
name="vn:reserva"
|
||||||
|
size="xs"
|
||||||
|
data-cy="ticketSaleReservedIcon"
|
||||||
|
>
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ t('ticketSale.reserved') }}
|
{{ t('ticketSale.reserved') }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
|
@ -832,7 +842,14 @@ watch(
|
||||||
</VnTable>
|
</VnTable>
|
||||||
|
|
||||||
<QPageSticky :offset="[20, 20]" style="z-index: 2">
|
<QPageSticky :offset="[20, 20]" style="z-index: 2">
|
||||||
<QBtn @click="newOrderFromTicket()" color="primary" fab icon="add" shortcut="+" />
|
<QBtn
|
||||||
|
@click="newOrderFromTicket()"
|
||||||
|
color="primary"
|
||||||
|
fab
|
||||||
|
icon="add"
|
||||||
|
shortcut="+"
|
||||||
|
data-cy="ticketSaleAddToBasketBtn"
|
||||||
|
/>
|
||||||
<QTooltip class="text-no-wrap">
|
<QTooltip class="text-no-wrap">
|
||||||
{{ t('Add item to basket') }}
|
{{ t('Add item to basket') }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
|
|
|
@ -175,6 +175,7 @@ const createRefund = async (withWarehouse) => {
|
||||||
color="primary"
|
color="primary"
|
||||||
:label="t('ticketSale.more')"
|
:label="t('ticketSale.more')"
|
||||||
:disable="disable"
|
:disable="disable"
|
||||||
|
data-cy="ticketSaleMoreActionsDropdown"
|
||||||
>
|
>
|
||||||
<template #label>
|
<template #label>
|
||||||
<QTooltip>{{ t('Select lines to see the options') }}</QTooltip>
|
<QTooltip>{{ t('Select lines to see the options') }}</QTooltip>
|
||||||
|
@ -186,6 +187,7 @@ const createRefund = async (withWarehouse) => {
|
||||||
v-close-popup
|
v-close-popup
|
||||||
v-ripple
|
v-ripple
|
||||||
@click="showSmsDialog('productNotAvailable')"
|
@click="showSmsDialog('productNotAvailable')"
|
||||||
|
data-cy="sendShortageSMSItem"
|
||||||
>
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ t('Send shortage SMS') }}</QItemLabel>
|
<QItemLabel>{{ t('Send shortage SMS') }}</QItemLabel>
|
||||||
|
@ -197,12 +199,18 @@ const createRefund = async (withWarehouse) => {
|
||||||
v-close-popup
|
v-close-popup
|
||||||
v-ripple
|
v-ripple
|
||||||
@click="calculateSalePrice()"
|
@click="calculateSalePrice()"
|
||||||
|
data-cy="recalculatePriceItem"
|
||||||
>
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ t('Recalculate price') }}</QItemLabel>
|
<QItemLabel>{{ t('Recalculate price') }}</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem clickable v-ripple @click="emit('getMana')">
|
<QItem
|
||||||
|
clickable
|
||||||
|
v-ripple
|
||||||
|
@click="emit('getMana')"
|
||||||
|
data-cy="updateDiscountItem"
|
||||||
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ t('Update discount') }}</QItemLabel>
|
<QItemLabel>{{ t('Update discount') }}</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
|
@ -211,6 +219,7 @@ const createRefund = async (withWarehouse) => {
|
||||||
v-model.number="newDiscount"
|
v-model.number="newDiscount"
|
||||||
:label="t('ticketSale.discount')"
|
:label="t('ticketSale.discount')"
|
||||||
type="number"
|
type="number"
|
||||||
|
data-cy="ticketSaleDiscountInput"
|
||||||
/>
|
/>
|
||||||
</TicketEditManaProxy>
|
</TicketEditManaProxy>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
@ -220,6 +229,7 @@ const createRefund = async (withWarehouse) => {
|
||||||
v-close-popup
|
v-close-popup
|
||||||
v-ripple
|
v-ripple
|
||||||
@click="createClaim()"
|
@click="createClaim()"
|
||||||
|
data-cy="createClaimItem"
|
||||||
>
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ t('Add claim') }}</QItemLabel>
|
<QItemLabel>{{ t('Add claim') }}</QItemLabel>
|
||||||
|
@ -231,6 +241,7 @@ const createRefund = async (withWarehouse) => {
|
||||||
v-close-popup
|
v-close-popup
|
||||||
v-ripple
|
v-ripple
|
||||||
@click="setReserved(true)"
|
@click="setReserved(true)"
|
||||||
|
data-cy="markAsReservedItem"
|
||||||
>
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ t('Mark as reserved') }}</QItemLabel>
|
<QItemLabel>{{ t('Mark as reserved') }}</QItemLabel>
|
||||||
|
@ -242,12 +253,13 @@ const createRefund = async (withWarehouse) => {
|
||||||
v-close-popup
|
v-close-popup
|
||||||
v-ripple
|
v-ripple
|
||||||
@click="setReserved(false)"
|
@click="setReserved(false)"
|
||||||
|
data-cy="unmarkAsReservedItem"
|
||||||
>
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ t('Unmark as reserved') }}</QItemLabel>
|
<QItemLabel>{{ t('Unmark as reserved') }}</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem clickable v-ripple>
|
<QItem clickable v-ripple data-cy="ticketSaleRefundItem">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ t('Refund') }}</QItemLabel>
|
<QItemLabel>{{ t('Refund') }}</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
|
@ -256,12 +268,22 @@ const createRefund = async (withWarehouse) => {
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
<QMenu anchor="top end" self="top start" auto-close bordered>
|
<QMenu anchor="top end" self="top start" auto-close bordered>
|
||||||
<QList>
|
<QList>
|
||||||
<QItem v-ripple clickable @click="createRefund(true)">
|
<QItem
|
||||||
|
v-ripple
|
||||||
|
clickable
|
||||||
|
@click="createRefund(true)"
|
||||||
|
data-cy="ticketSaleRefundWithWarehouse"
|
||||||
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
{{ t('with warehouse') }}
|
{{ t('with warehouse') }}
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem v-ripple clickable @click="createRefund(false)">
|
<QItem
|
||||||
|
v-ripple
|
||||||
|
clickable
|
||||||
|
@click="createRefund(false)"
|
||||||
|
data-cy="ticketSaleRefundWithoutWarehouse"
|
||||||
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
{{ t('without warehouse') }}
|
{{ t('without warehouse') }}
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
|
|
|
@ -96,6 +96,7 @@ function toTicketUrl(section) {
|
||||||
ref="summaryRef"
|
ref="summaryRef"
|
||||||
:url="`Tickets/${entityId}/summary`"
|
:url="`Tickets/${entityId}/summary`"
|
||||||
data-key="TicketSummary"
|
data-key="TicketSummary"
|
||||||
|
data-cy="ticketSummary"
|
||||||
>
|
>
|
||||||
<template #header-left>
|
<template #header-left>
|
||||||
<VnToSummary
|
<VnToSummary
|
||||||
|
|
|
@ -91,7 +91,7 @@ onMounted(() => (_transfer.value = $props.transfer));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QPopupProxy ref="QPopupProxyRef">
|
<QPopupProxy ref="QPopupProxyRef" data-cy="ticketTransferPopup">
|
||||||
<QCard class="q-px-md" style="display: flex; width: 80vw">
|
<QCard class="q-px-md" style="display: flex; width: 80vw">
|
||||||
<QTable
|
<QTable
|
||||||
:rows="transfer.sales"
|
:rows="transfer.sales"
|
||||||
|
|
|
@ -57,6 +57,7 @@ defineExpose({ transferSales });
|
||||||
v-model.number="_transfer.ticketId"
|
v-model.number="_transfer.ticketId"
|
||||||
:label="t('Transfer to ticket')"
|
:label="t('Transfer to ticket')"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
|
data-cy="ticketTransferDestinationTicketInput"
|
||||||
>
|
>
|
||||||
<template #append>
|
<template #append>
|
||||||
<QBtn
|
<QBtn
|
||||||
|
@ -64,6 +65,7 @@ defineExpose({ transferSales });
|
||||||
color="primary"
|
color="primary"
|
||||||
@click="transferSales(_transfer.ticketId)"
|
@click="transferSales(_transfer.ticketId)"
|
||||||
style="width: 30px"
|
style="width: 30px"
|
||||||
|
data-cy="ticketTransferTransferBtn"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</VnInput>
|
</VnInput>
|
||||||
|
@ -72,6 +74,7 @@ defineExpose({ transferSales });
|
||||||
color="primary"
|
color="primary"
|
||||||
class="full-width q-my-lg"
|
class="full-width q-my-lg"
|
||||||
@click="transferSales()"
|
@click="transferSales()"
|
||||||
|
data-cy="ticketTransferNewTicketBtn"
|
||||||
/>
|
/>
|
||||||
</QForm>
|
</QForm>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -215,7 +215,7 @@ const requestComponentUpdate = async (ticket, isWithoutNegatives) => {
|
||||||
|
|
||||||
if (!newLanded) {
|
if (!newLanded) {
|
||||||
notify(t('advanceTickets.noDeliveryZone'), 'negative');
|
notify(t('advanceTickets.noDeliveryZone'), 'negative');
|
||||||
return;
|
throw new Error(t('advanceTickets.noDeliveryZone'));
|
||||||
}
|
}
|
||||||
|
|
||||||
ticket.landed = newLanded.landed;
|
ticket.landed = newLanded.landed;
|
||||||
|
@ -299,10 +299,10 @@ const splitTickets = async () => {
|
||||||
const { query, params } = await requestComponentUpdate(ticket, true);
|
const { query, params } = await requestComponentUpdate(ticket, true);
|
||||||
await axios.post(query, params);
|
await axios.post(query, params);
|
||||||
progressAdd(ticket.futureId);
|
progressAdd(ticket.futureId);
|
||||||
} catch (error) {
|
} catch (e) {
|
||||||
splitErrors.value.push({
|
splitErrors.value.push({
|
||||||
id: ticket.futureId,
|
id: ticket.futureId,
|
||||||
reason: error.response?.data?.error?.message,
|
reason: e.message || e.response?.data?.error?.message,
|
||||||
});
|
});
|
||||||
progressAdd(ticket.futureId);
|
progressAdd(ticket.futureId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorP
|
||||||
import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
|
import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
|
||||||
import { toTimeFormat } from 'src/filters/date';
|
import { toTimeFormat } from 'src/filters/date';
|
||||||
import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
|
import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
|
||||||
|
import TicketProblems from 'src/components/TicketProblems.vue';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
@ -455,6 +456,7 @@ function setReference(data) {
|
||||||
data-key="TicketList"
|
data-key="TicketList"
|
||||||
:label="t('Search ticket')"
|
:label="t('Search ticket')"
|
||||||
:info="t('You can search by ticket id or alias')"
|
:info="t('You can search by ticket id or alias')"
|
||||||
|
data-cy="ticketListSearchBar"
|
||||||
/>
|
/>
|
||||||
<RightMenu>
|
<RightMenu>
|
||||||
<template #right-panel>
|
<template #right-panel>
|
||||||
|
@ -482,68 +484,10 @@ function setReference(data) {
|
||||||
'row-key': 'id',
|
'row-key': 'id',
|
||||||
selection: 'multiple',
|
selection: 'multiple',
|
||||||
}"
|
}"
|
||||||
|
data-cy="ticketListTable"
|
||||||
>
|
>
|
||||||
<template #column-statusIcons="{ row }">
|
<template #column-statusIcons="{ row }">
|
||||||
<div class="q-gutter-x-xs">
|
<TicketProblems :row="row" />
|
||||||
<QIcon
|
|
||||||
v-if="row.isTaxDataChecked === 0"
|
|
||||||
color="primary"
|
|
||||||
name="vn:no036"
|
|
||||||
size="xs"
|
|
||||||
>
|
|
||||||
<QTooltip>
|
|
||||||
{{ t('No verified data') }}
|
|
||||||
</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
<QIcon
|
|
||||||
v-if="row.hasTicketRequest"
|
|
||||||
color="primary"
|
|
||||||
name="vn:buyrequest"
|
|
||||||
size="xs"
|
|
||||||
>
|
|
||||||
<QTooltip>
|
|
||||||
{{ t('Purchase request') }}
|
|
||||||
</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
<QIcon
|
|
||||||
v-if="row.itemShortage"
|
|
||||||
color="primary"
|
|
||||||
name="vn:unavailable"
|
|
||||||
size="xs"
|
|
||||||
>
|
|
||||||
<QTooltip>
|
|
||||||
{{ t('Not visible') }}
|
|
||||||
</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
<QIcon v-if="row.isFreezed" color="primary" name="vn:frozen" size="xs">
|
|
||||||
<QTooltip>
|
|
||||||
{{ t('Client frozen') }}
|
|
||||||
</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
<QIcon v-if="row.risk" color="primary" name="vn:risk" size="xs">
|
|
||||||
<QTooltip> {{ t('Risk') }}: {{ row.risk }} </QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
<QIcon
|
|
||||||
v-if="row.hasComponentLack"
|
|
||||||
color="primary"
|
|
||||||
name="vn:components"
|
|
||||||
size="xs"
|
|
||||||
>
|
|
||||||
<QTooltip>
|
|
||||||
{{ t('Component lack') }}
|
|
||||||
</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
<QIcon
|
|
||||||
v-if="row.hasRounding"
|
|
||||||
color="primary"
|
|
||||||
name="sync_problem"
|
|
||||||
size="xs"
|
|
||||||
>
|
|
||||||
<QTooltip>
|
|
||||||
{{ t('Rounding') }}
|
|
||||||
</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
<template #column-salesPersonFk="{ row }">
|
<template #column-salesPersonFk="{ row }">
|
||||||
<span class="link" @click.stop>
|
<span class="link" @click.stop>
|
||||||
|
|
|
@ -300,10 +300,6 @@ const getLink = (param) => `#/travel/${entityId.value}/${param}`;
|
||||||
<VnLv :label="t('globals.reference')" :value="travel.ref" />
|
<VnLv :label="t('globals.reference')" :value="travel.ref" />
|
||||||
<VnLv label="m³" :value="travel.m3" />
|
<VnLv label="m³" :value="travel.m3" />
|
||||||
<VnLv :label="t('globals.totalEntries')" :value="travel.totalEntries" />
|
<VnLv :label="t('globals.totalEntries')" :value="travel.totalEntries" />
|
||||||
<VnLv
|
|
||||||
:label="t('travel.basicData.daysInForward')"
|
|
||||||
:value="travel?.daysInForward"
|
|
||||||
/>
|
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="full-width">
|
<QCard class="full-width">
|
||||||
<VnTitle :text="t('travel.summary.entries')" />
|
<VnTitle :text="t('travel.summary.entries')" />
|
||||||
|
|
|
@ -0,0 +1,263 @@
|
||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
|
import axios from 'axios';
|
||||||
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
import FormModel from 'src/components/FormModel.vue';
|
||||||
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
|
import CrudModel from 'components/CrudModel.vue';
|
||||||
|
import VnTitle from 'src/components/common/VnTitle.vue';
|
||||||
|
import { useQuasar } from 'quasar';
|
||||||
|
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||||
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
const { notify } = useNotify();
|
||||||
|
const route = useRoute();
|
||||||
|
const { t } = useI18n();
|
||||||
|
const disabilityGradesOptions = ref();
|
||||||
|
const workerPitCrudRef = ref({});
|
||||||
|
const insertTag = () => {
|
||||||
|
workerPitCrudRef.value.insert();
|
||||||
|
};
|
||||||
|
const quasar = useQuasar();
|
||||||
|
const deleteRelative = async (id) => {
|
||||||
|
await new Promise((resolve) => {
|
||||||
|
quasar
|
||||||
|
.dialog({
|
||||||
|
component: VnConfirm,
|
||||||
|
componentProps: {
|
||||||
|
title: t('Remove Relative'),
|
||||||
|
message: t('Do you want to remove this relative?'),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.onOk(() => {
|
||||||
|
resolve(true);
|
||||||
|
})
|
||||||
|
.onCancel(() => {
|
||||||
|
resolve(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
await axios.delete(`WorkerRelatives/${id}`);
|
||||||
|
workerPitCrudRef.value.reload();
|
||||||
|
notify('Relative removed', 'positive');
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<FetchData
|
||||||
|
url="DisabilityGrades"
|
||||||
|
@on-fetch="(data) => (disabilityGradesOptions = data)"
|
||||||
|
auto-load
|
||||||
|
/>
|
||||||
|
|
||||||
|
<FormModel
|
||||||
|
url="WorkerIrpfs"
|
||||||
|
:filter="{ where: { workerFk: route.params.id } }"
|
||||||
|
auto-load
|
||||||
|
data-key="workerIrpfs"
|
||||||
|
:max-width="false"
|
||||||
|
>
|
||||||
|
<template #form="{ data }">
|
||||||
|
<QCard class="q-px-lg q-py-lg">
|
||||||
|
<VnTitle :text="t('IRPF')" />
|
||||||
|
<VnRow>
|
||||||
|
<VnInput
|
||||||
|
:label="t('familySituation')"
|
||||||
|
clearable
|
||||||
|
v-model="data.familySituation"
|
||||||
|
/>
|
||||||
|
<VnInput :label="t('spouseNif')" clearable v-model="data.spouseNif" />
|
||||||
|
</VnRow>
|
||||||
|
<VnRow>
|
||||||
|
<VnSelect
|
||||||
|
:label="t('disabilityGrades')"
|
||||||
|
:options="disabilityGradesOptions"
|
||||||
|
option-label="description"
|
||||||
|
option-value="id"
|
||||||
|
v-model="data.disabilityGradeFk"
|
||||||
|
id="disabilityGrades"
|
||||||
|
data-cy="disabilityGrades"
|
||||||
|
hide-selected
|
||||||
|
/>
|
||||||
|
|
||||||
|
<VnInputDate
|
||||||
|
:label="t('geographicMobilityDate')"
|
||||||
|
v-model="data.geographicMobilityDate"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow>
|
||||||
|
<VnInput
|
||||||
|
clearable
|
||||||
|
v-model="data.childPension"
|
||||||
|
:label="t(`childPension`)"
|
||||||
|
/>
|
||||||
|
<VnInput
|
||||||
|
clearable
|
||||||
|
v-model="data.spousePension"
|
||||||
|
:label="t(`spousePension`)"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow>
|
||||||
|
<QCheckbox v-model="data.isDependend" :label="t(`isDependend`)" />
|
||||||
|
<QCheckbox
|
||||||
|
v-model="data.hasHousingPaymentBefore"
|
||||||
|
:label="t(`hasHousingPaymentBefore`)"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow>
|
||||||
|
<QCheckbox
|
||||||
|
v-model="data.hasHousingPaymentAfter"
|
||||||
|
:label="t(`hasHousingPaymentAfter`)"
|
||||||
|
/>
|
||||||
|
<QCheckbox
|
||||||
|
v-model="data.hasExtendedWorking"
|
||||||
|
:label="t(`hasExtendedWorking`)"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
</QCard>
|
||||||
|
|
||||||
|
<CrudModel
|
||||||
|
ref="workerPitCrudRef"
|
||||||
|
data-key="workerPit"
|
||||||
|
url="WorkerRelatives"
|
||||||
|
auto-load
|
||||||
|
:filter="{
|
||||||
|
where: { workerFk: route.params.id },
|
||||||
|
}"
|
||||||
|
:data-required="{ workerFk: route.params.id }"
|
||||||
|
:has-sub-toolbar="false"
|
||||||
|
>
|
||||||
|
<template #body="{ rows }">
|
||||||
|
<QCard class="q-px-lg q-py-lg" flat>
|
||||||
|
<div class="row no-wrap justify-between q-pb-md">
|
||||||
|
<VnTitle :text="t('Relatives')" />
|
||||||
|
<QBtnGroup push style="column-gap: 10px">
|
||||||
|
<QBtn
|
||||||
|
color="primary"
|
||||||
|
icon="restart_alt"
|
||||||
|
flat
|
||||||
|
@click="workerPitCrudRef.reset"
|
||||||
|
:disable="!workerPitCrudRef.hasChanges"
|
||||||
|
:title="t('globals.reset')"
|
||||||
|
/>
|
||||||
|
<QBtn
|
||||||
|
ref="saveButtonRef"
|
||||||
|
color="primary"
|
||||||
|
icon="save"
|
||||||
|
@click="workerPitCrudRef.onSubmit"
|
||||||
|
:disable="!workerPitCrudRef.hasChanges"
|
||||||
|
:title="t('globals.save')"
|
||||||
|
data-cy="workerPitRelativeSaveBtn"
|
||||||
|
/>
|
||||||
|
</QBtnGroup>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-for="(row, index) in rows"
|
||||||
|
:key="index"
|
||||||
|
class="row no-wrap q-mb-lg q-gutter-lg"
|
||||||
|
padding="none"
|
||||||
|
>
|
||||||
|
<VnSelect
|
||||||
|
:options="[
|
||||||
|
{ id: 0, name: 'Ascendiente' },
|
||||||
|
{ id: 1, name: 'Descendiente' },
|
||||||
|
]"
|
||||||
|
:label="t('isDescendant')"
|
||||||
|
v-model="row.isDescendant"
|
||||||
|
class="q-gutter-xs q-mb-xs"
|
||||||
|
/>
|
||||||
|
<VnSelect
|
||||||
|
:label="t('disabilityGrades')"
|
||||||
|
:options="disabilityGradesOptions"
|
||||||
|
option-label="description"
|
||||||
|
option-value="id"
|
||||||
|
v-model="row.disabilityGradeFk"
|
||||||
|
class="q-gutter-xs q-mb-xs"
|
||||||
|
/>
|
||||||
|
<VnInput
|
||||||
|
type="number"
|
||||||
|
v-model="row.birthed"
|
||||||
|
:label="t(`birthed`)"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<VnInput
|
||||||
|
type="number"
|
||||||
|
v-model="row.adoptionYear"
|
||||||
|
:label="t(`adoptionYear`)"
|
||||||
|
/>
|
||||||
|
<QCheckbox
|
||||||
|
v-model="row.isDependend"
|
||||||
|
:label="t(`isDependend`)"
|
||||||
|
/>
|
||||||
|
<QCheckbox
|
||||||
|
v-model="row.isJointCustody"
|
||||||
|
:label="t(`isJointCustody`)"
|
||||||
|
size="xs"
|
||||||
|
/>
|
||||||
|
<QBtn
|
||||||
|
@click="deleteRelative(rows[0].id)"
|
||||||
|
class="cursor-pointer"
|
||||||
|
color="primary"
|
||||||
|
flat
|
||||||
|
icon="delete"
|
||||||
|
style="flex: 0"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<VnRow class="justify-left items-center">
|
||||||
|
<QBtn
|
||||||
|
@click="insertTag(rows)"
|
||||||
|
class="cursor-pointer"
|
||||||
|
color="primary"
|
||||||
|
flat
|
||||||
|
icon="add"
|
||||||
|
shortcut="+"
|
||||||
|
style="flex: 0"
|
||||||
|
data-cy="addRelative"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
</QCard>
|
||||||
|
</template>
|
||||||
|
</CrudModel>
|
||||||
|
</template>
|
||||||
|
</FormModel>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
familySituation: Situación familiar
|
||||||
|
disabilityGrades: Discapacidad
|
||||||
|
geographicMobilityDate: Movilidad geografica
|
||||||
|
childPension: Pensión hijos
|
||||||
|
spousePension: Pensión cónyuge
|
||||||
|
isDependend: Ayuda / Movilidad reducida
|
||||||
|
spouseNif: NIF cónyuge
|
||||||
|
hasHousingPaymentBefore: Pagos vivienda anterior 2011
|
||||||
|
hasHousingPaymentAfter: Pagos vivienda posterior 2011
|
||||||
|
hasExtendedWorking: Prolongación actividad laboral
|
||||||
|
isDescendant: Descen/Ascen
|
||||||
|
disabilityGradeFk: Discapacidad
|
||||||
|
birthed: Año nacimiento
|
||||||
|
adoptionYear: Año adopción
|
||||||
|
isJointCustody: Computo por entero
|
||||||
|
Relatives: Relacionados
|
||||||
|
en:
|
||||||
|
familySituation: Family Situation
|
||||||
|
disabilityGrades: Disability Grades
|
||||||
|
geographicMobilityDate: Geographic Mobility Date
|
||||||
|
childPension: Child Pension
|
||||||
|
spousePension: Spouse Pension
|
||||||
|
isDependend: Dependent Suport / Reduced Mobility
|
||||||
|
spouseNif: Spouse NIF (Tax ID)
|
||||||
|
hasHousingPaymentBefore: Housing Payments Before 2011
|
||||||
|
hasHousingPaymentAfter: Housing Payments After 2011
|
||||||
|
hasExtendedWorking: Extended Work Activity
|
||||||
|
isDescendant: Descendant/Ascendant
|
||||||
|
disabilityGradeFk: Disability Grade
|
||||||
|
birthed: Birth Year
|
||||||
|
adoptionYear: Adoption Year
|
||||||
|
isJointCustody: Joint custody
|
||||||
|
Relatives: Relatives
|
||||||
|
</i18n>
|
|
@ -113,7 +113,7 @@ export default {
|
||||||
name: 'SupplierAccounts',
|
name: 'SupplierAccounts',
|
||||||
meta: {
|
meta: {
|
||||||
title: 'accounts',
|
title: 'accounts',
|
||||||
icon: 'vn:account',
|
icon: 'vn:credit',
|
||||||
},
|
},
|
||||||
component: () =>
|
component: () =>
|
||||||
import('src/pages/Supplier/Card/SupplierAccounts.vue'),
|
import('src/pages/Supplier/Card/SupplierAccounts.vue'),
|
||||||
|
|
|
@ -24,6 +24,7 @@ export default {
|
||||||
'WorkerDms',
|
'WorkerDms',
|
||||||
'WorkerTimeControl',
|
'WorkerTimeControl',
|
||||||
'WorkerLocker',
|
'WorkerLocker',
|
||||||
|
'WorkerPit',
|
||||||
'WorkerBalance',
|
'WorkerBalance',
|
||||||
'WorkerFormation',
|
'WorkerFormation',
|
||||||
'WorkerMedical',
|
'WorkerMedical',
|
||||||
|
@ -216,6 +217,15 @@ export default {
|
||||||
},
|
},
|
||||||
component: () => import('src/pages/Worker/Card/WorkerMedical.vue'),
|
component: () => import('src/pages/Worker/Card/WorkerMedical.vue'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'WorkerPit',
|
||||||
|
path: 'pit',
|
||||||
|
meta: {
|
||||||
|
title: 'pit',
|
||||||
|
icon: 'lock',
|
||||||
|
},
|
||||||
|
component: () => import('src/pages/Worker/Card/WorkerPit.vue'),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'WorkerOperator',
|
name: 'WorkerOperator',
|
||||||
path: 'operator',
|
path: 'operator',
|
||||||
|
|
|
@ -162,6 +162,15 @@ export const useInvoiceOutGlobalStore = defineStore({
|
||||||
);
|
);
|
||||||
throw new Error('Invalid Serial Type');
|
throw new Error('Invalid Serial Type');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (clientsToInvoice === 'all' && params.serialType !== 'global') {
|
||||||
|
notify(
|
||||||
|
'invoiceOut.globalInvoices.errors.invalidSerialTypeForAll',
|
||||||
|
'negative'
|
||||||
|
);
|
||||||
|
throw new Error('For "all" clients, the serialType must be "global"');
|
||||||
|
}
|
||||||
|
|
||||||
if (!params.companyFk) {
|
if (!params.companyFk) {
|
||||||
notify('invoiceOut.globalInvoices.errors.chooseValidCompany', 'negative');
|
notify('invoiceOut.globalInvoices.errors.chooseValidCompany', 'negative');
|
||||||
throw new Error('Invalid company');
|
throw new Error('Invalid company');
|
||||||
|
|
|
@ -0,0 +1,112 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('OrderCatalog', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.viewport(1920, 720);
|
||||||
|
cy.visit('/#/order/8/catalog');
|
||||||
|
});
|
||||||
|
|
||||||
|
const checkCustomFilterTag = (filterName = 'Plant') => {
|
||||||
|
cy.dataCy('catalogFilterCustomTag').should('exist');
|
||||||
|
cy.dataCy('catalogFilterCustomTag').contains(filterName);
|
||||||
|
};
|
||||||
|
|
||||||
|
const checkFilterTag = (filterName = 'Plant') => {
|
||||||
|
cy.dataCy('vnFilterPanelChip').should('exist');
|
||||||
|
cy.dataCy('vnFilterPanelChip').contains(filterName);
|
||||||
|
};
|
||||||
|
|
||||||
|
const selectCategory = (categoryIndex = 1, categoryName = 'Plant') => {
|
||||||
|
cy.get(
|
||||||
|
`div.q-page-container div:nth-of-type(${categoryIndex}) > [data-cy='catalogFilterCategory']`
|
||||||
|
).should('exist');
|
||||||
|
cy.get(
|
||||||
|
`div.q-page-container div:nth-of-type(${categoryIndex}) > [data-cy='catalogFilterCategory']`
|
||||||
|
).click();
|
||||||
|
checkCustomFilterTag(categoryName);
|
||||||
|
};
|
||||||
|
|
||||||
|
const searchByCustomTagInput = (option) => {
|
||||||
|
cy.dataCy('catalogFilterValueInput').find('input').last().focus();
|
||||||
|
cy.dataCy('catalogFilterValueInput').find('input').last().type(option);
|
||||||
|
cy.dataCy('catalogFilterValueInput').find('input').last().type('{enter}');
|
||||||
|
checkCustomFilterTag(option);
|
||||||
|
};
|
||||||
|
|
||||||
|
const selectTypeFilter = (option) => {
|
||||||
|
cy.selectOption(
|
||||||
|
'div.q-page-container div.list > div:nth-of-type(2) div:nth-of-type(3)',
|
||||||
|
option
|
||||||
|
);
|
||||||
|
checkFilterTag(option);
|
||||||
|
};
|
||||||
|
|
||||||
|
it('Shows empty state', () => {
|
||||||
|
cy.dataCy('orderCatalogPage').should('exist');
|
||||||
|
cy.dataCy('orderCatalogPage').contains('No data to display');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('filter by category', () => {
|
||||||
|
selectCategory();
|
||||||
|
cy.dataCy('orderCatalogItem').should('exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('filters by type', () => {
|
||||||
|
selectCategory();
|
||||||
|
selectTypeFilter('Anthurium');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('filters by custom value select', () => {
|
||||||
|
selectCategory();
|
||||||
|
searchByCustomTagInput('Silver');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('filters by custom value dialog', () => {
|
||||||
|
Cypress.on('uncaught:exception', (err) => {
|
||||||
|
if (err.message.includes('canceled')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
selectCategory();
|
||||||
|
cy.dataCy('catalogFilterValueDialogBtn').should('exist');
|
||||||
|
cy.dataCy('catalogFilterValueDialogBtn').last().click();
|
||||||
|
cy.dataCy('catalogFilterValueDialogTagSelect').should('exist');
|
||||||
|
cy.selectOption("[data-cy='catalogFilterValueDialogTagSelect']", 'Tallos');
|
||||||
|
cy.dataCy('catalogFilterValueDialogValueInput').find('input').focus();
|
||||||
|
cy.dataCy('catalogFilterValueDialogValueInput').find('input').type('2');
|
||||||
|
cy.dataCy('catalogFilterValueDialogValueInput').find('input').type('{enter}');
|
||||||
|
checkCustomFilterTag('2');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('removes a secondary tag', () => {
|
||||||
|
selectCategory();
|
||||||
|
selectTypeFilter('Anthurium');
|
||||||
|
cy.dataCy('vnFilterPanelChip').should('exist');
|
||||||
|
cy.get(
|
||||||
|
"div.q-page-container [data-cy='vnFilterPanelChip'] > i.q-chip__icon--remove"
|
||||||
|
)
|
||||||
|
.contains('cancel')
|
||||||
|
.should('exist');
|
||||||
|
cy.get(
|
||||||
|
"div.q-page-container [data-cy='vnFilterPanelChip'] > i.q-chip__icon--remove"
|
||||||
|
)
|
||||||
|
.contains('cancel')
|
||||||
|
.click();
|
||||||
|
cy.dataCy('vnFilterPanelChip').should('not.exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Removes category tag', () => {
|
||||||
|
selectCategory();
|
||||||
|
cy.get(
|
||||||
|
"div.q-page-container [data-cy='catalogFilterCustomTag'] > i.q-chip__icon--remove"
|
||||||
|
)
|
||||||
|
.contains('cancel')
|
||||||
|
.should('exist');
|
||||||
|
cy.get(
|
||||||
|
"div.q-page-container [data-cy='catalogFilterCustomTag'] > i.q-chip__icon--remove"
|
||||||
|
)
|
||||||
|
.contains('cancel')
|
||||||
|
.click();
|
||||||
|
cy.dataCy('catalogFilterCustomTag').should('not.exist');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,54 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('TicketList', () => {
|
||||||
|
const firstRow = 'tbody > :nth-child(1)';
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.visit('/#/ticket/list');
|
||||||
|
});
|
||||||
|
|
||||||
|
const searchResults = (search) => {
|
||||||
|
cy.dataCy('vnSearchBar').find('input').focus();
|
||||||
|
if (search) cy.dataCy('vnSearchBar').find('input').type(search);
|
||||||
|
cy.dataCy('vnSearchBar').find('input').type('{enter}');
|
||||||
|
cy.dataCy('ticketListTable').should('exist');
|
||||||
|
cy.get(firstRow).should('exist');
|
||||||
|
};
|
||||||
|
|
||||||
|
it('should search results', () => {
|
||||||
|
cy.dataCy('ticketListTable').should('not.exist');
|
||||||
|
cy.get('.q-field__control').should('exist');
|
||||||
|
searchResults();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should open ticket sales', () => {
|
||||||
|
searchResults();
|
||||||
|
cy.window().then((win) => {
|
||||||
|
cy.stub(win, 'open').as('windowOpen');
|
||||||
|
});
|
||||||
|
cy.get(firstRow).find('.q-btn:first').click();
|
||||||
|
cy.get('@windowOpen').should('be.calledWithMatch', /\/ticket\/\d+\/sale/);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should open ticket summary', () => {
|
||||||
|
searchResults();
|
||||||
|
cy.get(firstRow).find('.q-btn:last').click();
|
||||||
|
cy.dataCy('ticketSummary').should('exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Client list create new client', () => {
|
||||||
|
cy.dataCy('vnTableCreateBtn').should('exist');
|
||||||
|
cy.dataCy('vnTableCreateBtn').click();
|
||||||
|
const data = {
|
||||||
|
Customer: { val: 1, type: 'select' },
|
||||||
|
Warehouse: { val: 'Warehouse One', type: 'select' },
|
||||||
|
Address: { val: 'employee', type: 'select' },
|
||||||
|
Landed: { val: '01-01-2024', type: 'date' },
|
||||||
|
};
|
||||||
|
cy.fillInForm(data);
|
||||||
|
cy.get('.q-mt-lg > .q-btn--standard').click();
|
||||||
|
cy.checkNotification('Data created');
|
||||||
|
cy.url().should('match', /\/ticket\/\d+\/summary/);
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,25 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('TicketRequest', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.visit('/#/ticket/31/observation');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Creates and deletes a note', () => {
|
||||||
|
cy.dataCy('ticketNotesAddNoteBtn').should('exist');
|
||||||
|
cy.dataCy('ticketNotesAddNoteBtn').click();
|
||||||
|
cy.dataCy('ticketNotesObservationType').should('exist');
|
||||||
|
cy.selectOption('[data-cy="ticketNotesObservationType"]:last', 'Weight');
|
||||||
|
cy.dataCy('ticketNotesDescription').should('exist');
|
||||||
|
cy.get('[data-cy="ticketNotesDescription"]:last').type(
|
||||||
|
'This is a note description'
|
||||||
|
);
|
||||||
|
cy.dataCy('crudModelDefaultSaveBtn').click();
|
||||||
|
cy.checkNotification('Data saved');
|
||||||
|
cy.dataCy('ticketNotesRemoveNoteBtn').should('exist');
|
||||||
|
cy.dataCy('ticketNotesRemoveNoteBtn').click();
|
||||||
|
cy.dataCy('VnConfirm_confirm').click();
|
||||||
|
cy.checkNotification('Data saved');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,22 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('TicketRequest', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.visit('/#/ticket/31/request');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Creates a new request', () => {
|
||||||
|
cy.dataCy('vnTableCreateBtn').should('exist');
|
||||||
|
cy.dataCy('vnTableCreateBtn').click();
|
||||||
|
const data = {
|
||||||
|
Description: { val: 'Purchase description' },
|
||||||
|
Atender: { val: 'buyerNick', type: 'select' },
|
||||||
|
Quantity: { val: 2 },
|
||||||
|
Price: { val: 123 },
|
||||||
|
};
|
||||||
|
cy.fillInForm(data);
|
||||||
|
cy.get('.q-mt-lg > .q-btn--standard').click();
|
||||||
|
cy.checkNotification('Data created');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,131 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
|
||||||
|
const c = require('croppie');
|
||||||
|
|
||||||
|
describe('TicketSale', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.visit('/#/ticket/31/sale');
|
||||||
|
});
|
||||||
|
|
||||||
|
const firstRow = 'tbody > :nth-child(1)';
|
||||||
|
|
||||||
|
const selectFirstRow = () => {
|
||||||
|
cy.waitForElement(firstRow);
|
||||||
|
cy.get(firstRow).find('.q-checkbox__inner').click();
|
||||||
|
};
|
||||||
|
|
||||||
|
it('it should add item to basket', () => {
|
||||||
|
cy.window().then((win) => {
|
||||||
|
cy.stub(win, 'open').as('windowOpen');
|
||||||
|
});
|
||||||
|
cy.dataCy('ticketSaleAddToBasketBtn').should('exist');
|
||||||
|
cy.dataCy('ticketSaleAddToBasketBtn').click();
|
||||||
|
cy.get('@windowOpen').should('be.calledWithMatch', /\/order\/\d+\/catalog/);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should send SMS', () => {
|
||||||
|
selectFirstRow();
|
||||||
|
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
||||||
|
cy.waitForElement('[data-cy="sendShortageSMSItem"]');
|
||||||
|
cy.dataCy('sendShortageSMSItem').should('exist');
|
||||||
|
cy.dataCy('sendShortageSMSItem').click();
|
||||||
|
cy.dataCy('vnSmsDialog').should('exist');
|
||||||
|
cy.dataCy('sendSmsBtn').click();
|
||||||
|
cy.checkNotification('SMS sent');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should recalculate price when "Recalculate price" is clicked', () => {
|
||||||
|
cy.intercept('POST', '**/recalculatePrice').as('recalculatePrice');
|
||||||
|
selectFirstRow();
|
||||||
|
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
||||||
|
cy.waitForElement('[data-cy="recalculatePriceItem"]');
|
||||||
|
cy.dataCy('recalculatePriceItem').should('exist');
|
||||||
|
cy.dataCy('recalculatePriceItem').click();
|
||||||
|
cy.wait('@recalculatePrice').its('response.statusCode').should('eq', 200);
|
||||||
|
cy.checkNotification('Data saved');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should update discount when "Update discount" is clicked', () => {
|
||||||
|
selectFirstRow();
|
||||||
|
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
||||||
|
cy.waitForElement('[data-cy="updateDiscountItem"]');
|
||||||
|
cy.dataCy('updateDiscountItem').should('exist');
|
||||||
|
cy.dataCy('updateDiscountItem').click();
|
||||||
|
cy.waitForElement('[data-cy="ticketSaleDiscountInput"]');
|
||||||
|
cy.dataCy('ticketSaleDiscountInput').find('input').focus();
|
||||||
|
cy.dataCy('ticketSaleDiscountInput').find('input').type('10');
|
||||||
|
cy.dataCy('saveManaBtn').click();
|
||||||
|
cy.waitForElement('.q-notification__message');
|
||||||
|
cy.checkNotification('Data saved');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('adds claim', () => {
|
||||||
|
selectFirstRow();
|
||||||
|
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
||||||
|
cy.dataCy('createClaimItem').click();
|
||||||
|
cy.dataCy('VnConfirm_confirm').click();
|
||||||
|
cy.url().should('match', /\/claim\/\d+\/basic-data/);
|
||||||
|
// Delete created claim to avoid cluttering the database
|
||||||
|
cy.dataCy('descriptor-more-opts').click();
|
||||||
|
cy.dataCy('deleteClaim').click();
|
||||||
|
cy.dataCy('VnConfirm_confirm').click();
|
||||||
|
cy.checkNotification('Data deleted');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('marks row as reserved', () => {
|
||||||
|
selectFirstRow();
|
||||||
|
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
||||||
|
cy.waitForElement('[data-cy="markAsReservedItem"]');
|
||||||
|
cy.dataCy('markAsReservedItem').click();
|
||||||
|
cy.dataCy('ticketSaleReservedIcon').should('exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('unmarks row as reserved', () => {
|
||||||
|
selectFirstRow();
|
||||||
|
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
||||||
|
cy.waitForElement('[data-cy="unmarkAsReservedItem"]');
|
||||||
|
cy.dataCy('unmarkAsReservedItem').click();
|
||||||
|
cy.dataCy('ticketSaleReservedIcon').should('not.exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('refunds row with warehouse', () => {
|
||||||
|
selectFirstRow();
|
||||||
|
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
||||||
|
cy.dataCy('ticketSaleRefundItem').click();
|
||||||
|
cy.dataCy('ticketSaleRefundWithWarehouse').click();
|
||||||
|
cy.checkNotification('The following refund ticket have been created');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('refunds row without warehouse', () => {
|
||||||
|
selectFirstRow();
|
||||||
|
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
||||||
|
cy.dataCy('ticketSaleRefundItem').click();
|
||||||
|
cy.dataCy('ticketSaleRefundWithoutWarehouse').click();
|
||||||
|
cy.checkNotification('The following refund ticket have been created');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('transfers ticket', () => {
|
||||||
|
cy.visit('/#/ticket/32/sale');
|
||||||
|
selectFirstRow();
|
||||||
|
cy.dataCy('ticketSaleTransferBtn').click();
|
||||||
|
cy.dataCy('ticketTransferPopup').should('exist');
|
||||||
|
cy.dataCy('ticketTransferNewTicketBtn').click();
|
||||||
|
// existen 3 elementos "tbody" necesito checkear que el segundo elemento tbody tenga una row sola
|
||||||
|
cy.get('tbody').eq(1).find('tr').should('have.length', 1);
|
||||||
|
selectFirstRow();
|
||||||
|
cy.dataCy('ticketSaleTransferBtn').click();
|
||||||
|
cy.dataCy('ticketTransferPopup').should('exist');
|
||||||
|
cy.dataCy('ticketTransferDestinationTicketInput').find('input').focus();
|
||||||
|
cy.dataCy('ticketTransferDestinationTicketInput').find('input').type('32');
|
||||||
|
cy.dataCy('ticketTransferTransferBtn').click();
|
||||||
|
// checkear que la url contenga /ticket/1000002/sale
|
||||||
|
cy.url().should('match', /\/ticket\/32\/sale/);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should redirect to ticket logs', () => {
|
||||||
|
cy.get(firstRow).find('.q-btn:last').click();
|
||||||
|
cy.url().should('match', /\/ticket\/31\/log/);
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,39 @@
|
||||||
|
describe('VnInput Component', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.visit('/#/supplier/1/fiscal-data');
|
||||||
|
cy.domContentLoad();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should replace character at cursor position in insert mode', () => {
|
||||||
|
// Simula escribir en el input
|
||||||
|
cy.dataCy('supplierFiscalDataAccount').clear();
|
||||||
|
cy.dataCy('supplierFiscalDataAccount').type('4100000001');
|
||||||
|
// Coloca el cursor en la posición 0
|
||||||
|
cy.dataCy('supplierFiscalDataAccount').type('{movetostart}');
|
||||||
|
// Escribe un número y verifica que se reemplace correctamente
|
||||||
|
cy.dataCy('supplierFiscalDataAccount').type('999');
|
||||||
|
cy.dataCy('supplierFiscalDataAccount')
|
||||||
|
.should('have.value', '9990000001');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should replace character at cursor position in insert mode', () => {
|
||||||
|
// Simula escribir en el input
|
||||||
|
cy.dataCy('supplierFiscalDataAccount').clear();
|
||||||
|
cy.dataCy('supplierFiscalDataAccount').type('4100000001');
|
||||||
|
// Coloca el cursor en la posición 0
|
||||||
|
cy.dataCy('supplierFiscalDataAccount').type('{movetostart}');
|
||||||
|
// Escribe un número y verifica que se reemplace correctamente en la posicion incial
|
||||||
|
cy.dataCy('supplierFiscalDataAccount').type('999');
|
||||||
|
cy.dataCy('supplierFiscalDataAccount')
|
||||||
|
.should('have.value', '9990000001');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should respect maxlength prop', () => {
|
||||||
|
cy.dataCy('supplierFiscalDataAccount').clear();
|
||||||
|
cy.dataCy('supplierFiscalDataAccount').type('123456789012345');
|
||||||
|
cy.dataCy('supplierFiscalDataAccount')
|
||||||
|
.should('have.value', '1234567890'); // asumiendo que maxlength es 10
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,3 +1,5 @@
|
||||||
|
const { randomNumber, randomString } = require('../../support');
|
||||||
|
|
||||||
describe('VnLocation', () => {
|
describe('VnLocation', () => {
|
||||||
const locationOptions = '[role="listbox"] > div.q-virtual-scroll__content > .q-item';
|
const locationOptions = '[role="listbox"] > div.q-virtual-scroll__content > .q-item';
|
||||||
const dialogInputs = '.q-dialog label input';
|
const dialogInputs = '.q-dialog label input';
|
||||||
|
@ -41,11 +43,9 @@ describe('VnLocation', () => {
|
||||||
province
|
province
|
||||||
);
|
);
|
||||||
cy.get(
|
cy.get(
|
||||||
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix} > :nth-child(3) > .q-icon`
|
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix} > :nth-child(3) `
|
||||||
).click();
|
).click();
|
||||||
cy.get(
|
cy.dataCy('locationProvince').should('have.value', province);
|
||||||
`#q-portal--dialog--5 > .q-dialog > ${createForm.prefix} > .vn-row > .q-select > ${createForm.sufix} > :nth-child(1) input`
|
|
||||||
).should('have.value', province);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('Worker Create', () => {
|
describe('Worker Create', () => {
|
||||||
|
@ -99,7 +99,7 @@ describe('VnLocation', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Create postCode', () => {
|
it('Create postCode', () => {
|
||||||
const postCode = '1234475';
|
const postCode = Math.floor(100000 + Math.random() * 900000);
|
||||||
const province = 'Valencia';
|
const province = 'Valencia';
|
||||||
cy.get(createLocationButton).click();
|
cy.get(createLocationButton).click();
|
||||||
cy.get('.q-card > h1').should('have.text', 'New postcode');
|
cy.get('.q-card > h1').should('have.text', 'New postcode');
|
||||||
|
@ -115,22 +115,64 @@ describe('VnLocation', () => {
|
||||||
|
|
||||||
checkVnLocation(postCode, province);
|
checkVnLocation(postCode, province);
|
||||||
});
|
});
|
||||||
it('Create city', () => {
|
|
||||||
const postCode = '9011';
|
it('Create city without country', () => {
|
||||||
const province = 'Saskatchew';
|
const postCode = randomNumber();
|
||||||
|
const province = randomString({ length: 4 });
|
||||||
cy.get(createLocationButton).click();
|
cy.get(createLocationButton).click();
|
||||||
cy.get(dialogInputs).eq(0).type(postCode);
|
cy.get(dialogInputs).eq(0).type(postCode);
|
||||||
cy.get(
|
cy.dataCy('City_icon').click();
|
||||||
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix} > :nth-child(2) > .q-icon`
|
cy.selectOption('[data-cy="locationProvince"]:last', 'Province one');
|
||||||
).click();
|
cy.dataCy('cityName').type(province);
|
||||||
cy.selectOption('#q-portal--dialog--3 .q-select', 'one');
|
cy.dataCy('FormModelPopup_save').eq(1).click();
|
||||||
cy.get('#q-portal--dialog--3 .q-input').type(province);
|
cy.dataCy('FormModelPopup_save').eq(0).click();
|
||||||
cy.get('#q-portal--dialog--3 .q-btn--standard').click();
|
|
||||||
cy.get('#q-portal--dialog--1 .q-btn--standard').click();
|
|
||||||
cy.waitForElement('.q-form');
|
cy.waitForElement('.q-form');
|
||||||
checkVnLocation(postCode, province);
|
checkVnLocation(postCode, province);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Create city with country', () => {
|
||||||
|
const cityName = 'Saskatchew'.concat(Math.random(1 * 100));
|
||||||
|
cy.get(createLocationButton).click();
|
||||||
|
cy.selectOption(
|
||||||
|
`${createForm.prefix} > :nth-child(5) > :nth-child(3) `,
|
||||||
|
'Italia'
|
||||||
|
);
|
||||||
|
cy.dataCy('City_icon').click();
|
||||||
|
cy.selectOption('[data-cy="locationProvince"]:last', 'Province four');
|
||||||
|
cy.countSelectOptions('[data-cy="locationProvince"]:last', 1);
|
||||||
|
|
||||||
|
cy.dataCy('cityName').type(cityName);
|
||||||
|
cy.dataCy('FormModelPopup_save').eq(1).click();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Create province without country', () => {
|
||||||
|
const provinceName = 'Saskatchew'.concat(Math.random(1 * 100));
|
||||||
|
cy.get(createLocationButton).click();
|
||||||
|
cy.dataCy('Province_icon').click();
|
||||||
|
cy.selectOption('[data-cy="autonomyProvince"] ', 'Autonomy one');
|
||||||
|
cy.countSelectOptions('[data-cy="autonomyProvince"]', 4);
|
||||||
|
cy.dataCy('provinceName').type(provinceName);
|
||||||
|
|
||||||
|
cy.dataCy('FormModelPopup_save').eq(1).click();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Create province with country', () => {
|
||||||
|
const provinceName = 'Saskatchew'.concat(Math.random(1 * 100));
|
||||||
|
cy.get(createLocationButton).click();
|
||||||
|
cy.selectOption(
|
||||||
|
`${createForm.prefix} > :nth-child(5) > :nth-child(3) `,
|
||||||
|
'España'
|
||||||
|
);
|
||||||
|
cy.dataCy('Province_icon').click();
|
||||||
|
|
||||||
|
cy.selectOption('[data-cy="autonomyProvince"] ', 'Autonomy one');
|
||||||
|
cy.countSelectOptions('[data-cy="autonomyProvince"]', 2);
|
||||||
|
|
||||||
|
cy.dataCy('provinceName').type(provinceName);
|
||||||
|
cy.dataCy('FormModelPopup_save').eq(1).click();
|
||||||
|
});
|
||||||
|
|
||||||
function checkVnLocation(postCode, province) {
|
function checkVnLocation(postCode, province) {
|
||||||
cy.get(`${createForm.prefix}`).should('not.exist');
|
cy.get(`${createForm.prefix}`).should('not.exist');
|
||||||
cy.get('.q-form > .q-card > .vn-row:nth-child(6)')
|
cy.get('.q-form > .q-card > .vn-row:nth-child(6)')
|
|
@ -0,0 +1,40 @@
|
||||||
|
describe('WorkerPit', () => {
|
||||||
|
const familySituationInput = '[data-cy="Family Situation_input"]';
|
||||||
|
const familySituation = '1';
|
||||||
|
const childPensionInput = '[data-cy="Child Pension_input"]';
|
||||||
|
const childPension = '120';
|
||||||
|
const spouseNifInput = '[data-cy="Spouse Pension_input"]';
|
||||||
|
const spouseNif = '65117125P';
|
||||||
|
const spousePensionInput = '[data-cy="Spouse Pension_input"]';
|
||||||
|
const spousePension = '120';
|
||||||
|
const addRelative = '[data-cy="addRelative"]';
|
||||||
|
const isDescendantSelect = '[data-cy="Descendant/Ascendant_select"]';
|
||||||
|
const birthedInput = '[data-cy="Birth Year_input"]';
|
||||||
|
const birthed = '2002';
|
||||||
|
const adoptionYearInput = '[data-cy="Adoption Year_input"]';
|
||||||
|
const adoptionYear = '2004';
|
||||||
|
const saveRelative = '[data-cy="workerPitRelativeSaveBtn"]';
|
||||||
|
const savePIT = '#st-actions > .q-btn-group > .q-btn--standard';
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit(`/#/worker/1107/pit`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('complete PIT', () => {
|
||||||
|
cy.get(familySituationInput).type(familySituation);
|
||||||
|
cy.get(childPensionInput).type(childPension);
|
||||||
|
cy.get(spouseNifInput).type(spouseNif);
|
||||||
|
cy.get(spousePensionInput).type(spousePension);
|
||||||
|
cy.get(savePIT).click();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('complete relative', () => {
|
||||||
|
cy.get(addRelative).click();
|
||||||
|
cy.get(isDescendantSelect).type('{downArrow}{downArrow}{enter}');
|
||||||
|
cy.get(birthedInput).type(birthed);
|
||||||
|
cy.get(adoptionYearInput).type(adoptionYear);
|
||||||
|
cy.get(saveRelative).click();
|
||||||
|
});
|
||||||
|
});
|
|
@ -86,11 +86,17 @@ Cypress.Commands.add('getValue', (selector) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Fill Inputs
|
// Fill Inputs
|
||||||
Cypress.Commands.add('selectOption', (selector, option) => {
|
Cypress.Commands.add('selectOption', (selector, option, timeout) => {
|
||||||
cy.waitForElement(selector);
|
cy.waitForElement(selector);
|
||||||
cy.get(selector).click();
|
cy.get(selector).click();
|
||||||
|
cy.wait(timeout || 1000);
|
||||||
cy.get('.q-menu .q-item').contains(option).click();
|
cy.get('.q-menu .q-item').contains(option).click();
|
||||||
});
|
});
|
||||||
|
Cypress.Commands.add('countSelectOptions', (selector, option) => {
|
||||||
|
cy.waitForElement(selector);
|
||||||
|
cy.get(selector).click();
|
||||||
|
cy.get('.q-menu .q-item').should('have.length', option);
|
||||||
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('fillInForm', (obj, form = '.q-form > .q-card') => {
|
Cypress.Commands.add('fillInForm', (obj, form = '.q-form > .q-card') => {
|
||||||
cy.waitForElement('.q-form > .q-card');
|
cy.waitForElement('.q-form > .q-card');
|
||||||
|
|
|
@ -15,3 +15,19 @@
|
||||||
|
|
||||||
import './commands';
|
import './commands';
|
||||||
|
|
||||||
|
function randomString(options = { length: 10 }) {
|
||||||
|
let possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
|
||||||
|
return randomizeValue(possible, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
function randomNumber(options = { length: 10 }) {
|
||||||
|
let possible = '0123456789';
|
||||||
|
return randomizeValue(possible, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
function randomizeValue(characterSet, options) {
|
||||||
|
return Array.from({ length: options.length }, () =>
|
||||||
|
characterSet.charAt(Math.floor(Math.random() * characterSet.length))
|
||||||
|
).join('');
|
||||||
|
}
|
||||||
|
export { randomString, randomNumber, randomizeValue };
|
||||||
|
|
|
@ -1,25 +1,36 @@
|
||||||
import { vi, describe, expect, it } from 'vitest';
|
import { vi, describe, expect, it, beforeAll, afterAll } from 'vitest';
|
||||||
import { axios } from 'app/test/vitest/helper';
|
import { axios } from 'app/test/vitest/helper';
|
||||||
import { downloadFile } from 'src/composables/downloadFile';
|
import { downloadFile } from 'src/composables/downloadFile';
|
||||||
import { useSession } from 'src/composables/useSession';
|
import { useSession } from 'src/composables/useSession';
|
||||||
|
|
||||||
const session = useSession();
|
const session = useSession();
|
||||||
const token = session.getToken();
|
const token = session.getToken();
|
||||||
|
|
||||||
describe('downloadFile', () => {
|
describe('downloadFile', () => {
|
||||||
|
const baseUrl = 'http://localhost:9000';
|
||||||
|
let defaulCreateObjectURL;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
defaulCreateObjectURL = window.URL.createObjectURL;
|
||||||
|
window.URL.createObjectURL = vi.fn(() => 'blob:http://localhost:9000/blob-id');
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(() => (window.URL.createObjectURL = defaulCreateObjectURL));
|
||||||
|
|
||||||
it('should open a new window to download the file', async () => {
|
it('should open a new window to download the file', async () => {
|
||||||
const url = 'http://localhost:9000';
|
const res = {
|
||||||
|
data: new Blob(['file content'], { type: 'application/octet-stream' }),
|
||||||
vi.spyOn(axios, 'get').mockResolvedValueOnce({ data: url });
|
headers: { 'content-disposition': 'attachment; filename="test-file.txt"' },
|
||||||
|
};
|
||||||
const mockWindowOpen = vi.spyOn(window, 'open');
|
vi.spyOn(axios, 'get').mockImplementation((url) => {
|
||||||
|
if (url == 'Urls/getUrl') return Promise.resolve({ data: baseUrl });
|
||||||
|
else if (url.includes('downloadFile')) return Promise.resolve(res);
|
||||||
|
});
|
||||||
|
|
||||||
await downloadFile(1);
|
await downloadFile(1);
|
||||||
|
|
||||||
expect(mockWindowOpen).toHaveBeenCalledWith(
|
expect(axios.get).toHaveBeenCalledWith(
|
||||||
`${url}/api/dms/1/downloadFile?access_token=${token}`
|
`${baseUrl}/api/dms/1/downloadFile?access_token=${token}`,
|
||||||
|
{ responseType: 'blob' }
|
||||||
);
|
);
|
||||||
|
|
||||||
mockWindowOpen.mockRestore();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue